@pluno/product-agent-web 0.1.323 → 0.1.324
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/index.d.ts +2 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +1 -1
- package/dist/product-agent-sdk.js +409 -375
- package/dist/product-agent-widget.js +646 -612
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Bs(t, e, n) {
|
|
2
2
|
t.throwIfAborted();
|
|
3
3
|
let s, i = () => {
|
|
4
4
|
};
|
|
@@ -270,8 +270,8 @@ function qo(t = 0) {
|
|
|
270
270
|
schedulerError: null
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
const
|
|
274
|
-
function
|
|
273
|
+
const As = (t) => t;
|
|
274
|
+
function zs(t, e) {
|
|
275
275
|
return JSON.stringify([
|
|
276
276
|
t.authorityId,
|
|
277
277
|
t.generation,
|
|
@@ -317,7 +317,7 @@ function wa(t, e, n) {
|
|
|
317
317
|
h
|
|
318
318
|
]), c = (d, h, f, m = !1) => {
|
|
319
319
|
Oo(o, d);
|
|
320
|
-
const g = h === "query" ?
|
|
320
|
+
const g = h === "query" ? zs(o, d) : d.kind, y = a(h, f), b = JSON.stringify(d), v = s.features.pending[y];
|
|
321
321
|
if (v && v.fingerprint !== b)
|
|
322
322
|
throw new Error("Request ID was reused with a different payload.");
|
|
323
323
|
if (v && !m || h === "query" && !m && Object.values(s.features.pending).some(
|
|
@@ -328,19 +328,19 @@ function wa(t, e, n) {
|
|
|
328
328
|
if (h === "query")
|
|
329
329
|
_[g] = Zs(
|
|
330
330
|
_[g] ?? gn(g),
|
|
331
|
-
{ key: g, requestId:
|
|
331
|
+
{ key: g, requestId: As(f), mode: "replace" }
|
|
332
332
|
);
|
|
333
333
|
else if (d.kind === "generatePrompts") {
|
|
334
334
|
const I = {
|
|
335
335
|
...d.page,
|
|
336
336
|
kind: "starterPrompts",
|
|
337
337
|
includeUserSuggestions: d.includeUserSuggestions ?? !1
|
|
338
|
-
}, k =
|
|
338
|
+
}, k = zs(o, I);
|
|
339
339
|
_[k] = Zs(
|
|
340
340
|
_[k] ?? gn(k),
|
|
341
341
|
{
|
|
342
342
|
key: k,
|
|
343
|
-
requestId:
|
|
343
|
+
requestId: As(f),
|
|
344
344
|
mode: "replace"
|
|
345
345
|
}
|
|
346
346
|
);
|
|
@@ -473,7 +473,7 @@ function wa(t, e, n) {
|
|
|
473
473
|
if (!d || d.status !== "pending") break;
|
|
474
474
|
const h = e.type === "effect.failed", f = { ...s.features.queries };
|
|
475
475
|
let m = d.key;
|
|
476
|
-
d.operation.kind === "generatePrompts" && (m =
|
|
476
|
+
d.operation.kind === "generatePrompts" && (m = zs(o, {
|
|
477
477
|
...d.operation.page,
|
|
478
478
|
kind: "starterPrompts",
|
|
479
479
|
includeUserSuggestions: d.operation.includeUserSuggestions ?? !1
|
|
@@ -481,11 +481,11 @@ function wa(t, e, n) {
|
|
|
481
481
|
const g = f[m];
|
|
482
482
|
g && (f[m] = h ? Vd(g, {
|
|
483
483
|
key: m,
|
|
484
|
-
requestId:
|
|
484
|
+
requestId: As(d.requestId),
|
|
485
485
|
error: e.error
|
|
486
486
|
}) : Wd(g, {
|
|
487
487
|
key: m,
|
|
488
|
-
requestId:
|
|
488
|
+
requestId: As(d.requestId),
|
|
489
489
|
data: e.output.data,
|
|
490
490
|
cursor: null,
|
|
491
491
|
updatedAt: e.output.completedAt
|
|
@@ -533,7 +533,7 @@ function wa(t, e, n) {
|
|
|
533
533
|
return { state: s, effects: i };
|
|
534
534
|
}
|
|
535
535
|
function ti(t, e) {
|
|
536
|
-
return t.account.authority ? t.features.queries[
|
|
536
|
+
return t.account.authority ? t.features.queries[zs(t.account.authority, e)] ?? null : null;
|
|
537
537
|
}
|
|
538
538
|
function Xd(t, e) {
|
|
539
539
|
const n = ti(t, e);
|
|
@@ -846,7 +846,7 @@ function au(t, e = null) {
|
|
|
846
846
|
} : void 0);
|
|
847
847
|
return { ...s, ...a ? { auth: a } : {}, submissionGate: r };
|
|
848
848
|
}
|
|
849
|
-
const cu = "0.1.
|
|
849
|
+
const cu = "0.1.324", Cn = {
|
|
850
850
|
version: cu
|
|
851
851
|
};
|
|
852
852
|
function pi(t) {
|
|
@@ -1012,7 +1012,7 @@ function Gi(t, e) {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1015
|
+
function Bo(t, e, n) {
|
|
1016
1016
|
const s = { ...t.submissions };
|
|
1017
1017
|
for (const i of Object.values(s))
|
|
1018
1018
|
if (i.conversationScopeId === e.conversationScopeId && !(i.userMessageId !== e.userMessageId && (i.cancelled || e.cancelled || xe(i, t.deliveries[i.userMessageId]) || xe(e, t.deliveries[e.userMessageId])))) {
|
|
@@ -1021,7 +1021,7 @@ function zo(t, e, n) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
return { ...t, submissions: s, sessions: { ...t.sessions, [n]: t.sessions[n] ?? Lo(n) } };
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function zo(t, e) {
|
|
1025
1025
|
const n = e.clients[t.clientScopeId];
|
|
1026
1026
|
return n === t.conversationScopeId || n === void 0 && t.sessionId !== null && (e.memberships[t.sessionId]?.members.length ?? 0) > 0;
|
|
1027
1027
|
}
|
|
@@ -1042,9 +1042,9 @@ function jo(t, e, n = !1) {
|
|
|
1042
1042
|
let i = Object.keys(s).length === Object.keys(t.pendingRestoration).length ? t : { ...t, pendingRestoration: s };
|
|
1043
1043
|
for (const o of Object.values(t.submissions)) {
|
|
1044
1044
|
if (i.pendingRestoration[o.clientScopeId] === o.conversationScopeId) continue;
|
|
1045
|
-
o.delivery !== "accepted" && !o.cancelled && !
|
|
1045
|
+
o.delivery !== "accepted" && !o.cancelled && !zo(o, e) && (i = { ...i, submissions: { ...i.submissions, [o.userMessageId]: { ...o, cancelled: !0, cancellationReason: o.cancellationReason ?? "owner_lost" } } });
|
|
1046
1046
|
const r = e.selections[o.conversationScopeId]?.sessionId;
|
|
1047
|
-
r && !i.submissions[o.userMessageId].cancelled && o.sessionId === null && !xe(o, i.deliveries[o.userMessageId]) && (i =
|
|
1047
|
+
r && !i.submissions[o.userMessageId].cancelled && o.sessionId === null && !xe(o, i.deliveries[o.userMessageId]) && (i = Bo(i, i.submissions[o.userMessageId], r));
|
|
1048
1048
|
}
|
|
1049
1049
|
for (const [o, r] of Object.entries(i.requests)) {
|
|
1050
1050
|
if ((e.memberships[r.sessionId]?.members.length ?? 0) > 0) continue;
|
|
@@ -1159,7 +1159,7 @@ function gu(t, e, n, s) {
|
|
|
1159
1159
|
if (n.clients[e.clientScopeId] !== e.conversationScopeId) throw new Error("Submission selection has changed.");
|
|
1160
1160
|
const { type: a, authorityId: c, generation: l, prepareContext: u, reconcileAcceptance: d, waitForAuthentication: h, ...f } = e, m = t.submissions[e.userMessageId];
|
|
1161
1161
|
if (m) {
|
|
1162
|
-
const { contextPreparation: _, requestedModel: I, sessionId: k, delivery: T, cancelled: O, cancellationReason: V, error: E, executionVersion:
|
|
1162
|
+
const { contextPreparation: _, requestedModel: I, sessionId: k, delivery: T, cancelled: O, cancellationReason: V, error: E, executionVersion: z, ...P } = m;
|
|
1163
1163
|
if (Ts(P) !== Ts(f)) throw new Error("User-message identity cannot be reused with different input.");
|
|
1164
1164
|
return { state: t, effects: o };
|
|
1165
1165
|
}
|
|
@@ -1180,7 +1180,7 @@ function gu(t, e, n, s) {
|
|
|
1180
1180
|
case "conversation.submission_accepted": {
|
|
1181
1181
|
const a = t.submissions[e.userMessageId];
|
|
1182
1182
|
if (!a) return { state: t, effects: o };
|
|
1183
|
-
i =
|
|
1183
|
+
i = Bo(t, a, e.sessionId), i = { ...i, submissions: { ...i.submissions, [e.userMessageId]: { ...i.submissions[e.userMessageId], delivery: "accepted", error: null } } };
|
|
1184
1184
|
break;
|
|
1185
1185
|
}
|
|
1186
1186
|
case "conversation.submission_delivery": {
|
|
@@ -1206,7 +1206,7 @@ function gu(t, e, n, s) {
|
|
|
1206
1206
|
}
|
|
1207
1207
|
case "conversation.display_received": {
|
|
1208
1208
|
const a = Xe(e.event), c = a.type === "conversation.item.updated" ? a.item.conversation_id : a.type === "conversation.execution.updated" ? a.execution.conversation_id : a.type === "conversation.interaction.updated" ? a.interaction.conversation_id : a.conversation_id, l = a.type === "conversation.item.updated" && a.item.type === "user_message" ? t.submissions[a.item.id] : void 0;
|
|
1209
|
-
if (l && (i =
|
|
1209
|
+
if (l && (i = Bo(t, l, c)), !i.sessions[c] && !n.memberships[c]?.members.length && !l) return { state: t, effects: o };
|
|
1210
1210
|
n.memberships[c]?.members.length && (a.type === "conversation.interaction.updated" || a.type === "conversation.execution.updated" || a.type === "conversation.item.updated" && a.item.type === "user_message") && (r = {
|
|
1211
1211
|
authorityId: t.authorityId,
|
|
1212
1212
|
generation: t.generation,
|
|
@@ -1584,8 +1584,8 @@ function mu(t, e, n, s) {
|
|
|
1584
1584
|
submissions: Object.fromEntries(Object.entries(m.submissions).map(([I, k]) => [I, {
|
|
1585
1585
|
...k,
|
|
1586
1586
|
executionVersion: null,
|
|
1587
|
-
cancelled: k.cancelled || !_(k) && !
|
|
1588
|
-
...!k.cancelled && !_(k) && !
|
|
1587
|
+
cancelled: k.cancelled || !_(k) && !zo(k, n),
|
|
1588
|
+
...!k.cancelled && !_(k) && !zo(k, n) ? { cancellationReason: "owner_lost" } : {},
|
|
1589
1589
|
delivery: (k.contextPreparation === null && !m.deliveries[I]?.handoffRecovery || !m.deliveries[I]) && !k.cancelled && k.delivery !== "accepted" ? "failed" : k.delivery === "sending" ? "uncertain" : k.delivery,
|
|
1590
1590
|
error: k.delivery !== "accepted" && xe(k, m.deliveries[I]) ? js : k.contextPreparation === null && !m.deliveries[I]?.handoffRecovery && !k.cancelled && !["unauthorized", "auth_reconnecting"].includes(k.error?.code ?? "") ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : !m.deliveries[I] && k.delivery !== "accepted" && !k.cancelled ? { code: "submission_interrupted", message: "Message preparation was interrupted. Retry this message.", retryable: !0 } : k.error
|
|
1591
1591
|
}])),
|
|
@@ -2091,17 +2091,17 @@ function Vo(t, e, n = {}) {
|
|
|
2091
2091
|
...Yc(s?.owner) ? { owner: s.owner } : {}
|
|
2092
2092
|
};
|
|
2093
2093
|
}
|
|
2094
|
-
function
|
|
2094
|
+
function Ru(t) {
|
|
2095
2095
|
if (!t || typeof t != "object") return !1;
|
|
2096
2096
|
const e = t, n = (s) => Number.isSafeInteger(s) && s >= 0;
|
|
2097
2097
|
return Object.keys(e).every((s) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner", "sdkVersion", "presentationGate", "firstObservedAt", "confirmationMs"].includes(s)) && n(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((s) => s === null || n(s)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((s) => s === null || pe(s) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((s) => typeof s == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout", "observer"].includes(e.renderSource) && (e.owner === void 0 || Yc(e.owner)) && (e.sdkVersion === void 0 || typeof e.sdkVersion == "string" && e.sdkVersion.length <= 32 && /^\d+\.\d+\.\d+(?:[-+][a-zA-Z0-9.-]+)?$/.test(e.sdkVersion)) && (e.presentationGate === void 0 || ["none", "authentication", "signup"].includes(e.presentationGate)) && [e.firstObservedAt, e.confirmationMs].every((s) => s === void 0 || n(s));
|
|
2098
2098
|
}
|
|
2099
|
-
function
|
|
2099
|
+
function Au(t) {
|
|
2100
2100
|
if (!t || typeof t != "object" || Object.keys(t).some((s) => s !== "before" && s !== "current")) return !1;
|
|
2101
2101
|
const e = (s) => {
|
|
2102
2102
|
if (!s || typeof s != "object") return !1;
|
|
2103
2103
|
const i = s;
|
|
2104
|
-
return Object.keys(s).every((o) => [...Ko, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (i.duplicateToolCalls === void 0 || Array.isArray(i.duplicateToolCalls) && i.duplicateToolCalls.length <= 5 && i.duplicateToolCalls.every((o) => o && Object.keys(o).every((r) => ["key", "count", "rows", "truncated"].includes(r)) && ln(o.key) && Number.isSafeInteger(o.count) && o.count >= 2 && typeof o.truncated == "boolean" && Array.isArray(o.rows) && o.rows.length >= 1 && o.rows.length <= 5 && o.rows.length <= o.count && o.rows.every((r) => r && Object.keys(r).every((a) => ["itemId", "groupId"].includes(a)) && ln(r.itemId) && ln(r.groupId)))) && (i.context === void 0 ||
|
|
2104
|
+
return Object.keys(s).every((o) => [...Ko, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(o)) && (i.duplicateToolCalls === void 0 || Array.isArray(i.duplicateToolCalls) && i.duplicateToolCalls.length <= 5 && i.duplicateToolCalls.every((o) => o && Object.keys(o).every((r) => ["key", "count", "rows", "truncated"].includes(r)) && ln(o.key) && Number.isSafeInteger(o.count) && o.count >= 2 && typeof o.truncated == "boolean" && Array.isArray(o.rows) && o.rows.length >= 1 && o.rows.length <= 5 && o.rows.length <= o.count && o.rows.every((r) => r && Object.keys(r).every((a) => ["itemId", "groupId"].includes(a)) && ln(r.itemId) && ln(r.groupId)))) && (i.context === void 0 || Ru(i.context)) && (i.thinkingSequence === void 0 || Array.isArray(i.thinkingSequence) && i.thinkingSequence.length <= 20 && i.thinkingSequence.every((o) => o === "user" || o === "thinking")) && ln(i.sessionId) && Number.isSafeInteger(i.runtimeItemCount) && i.runtimeItemCount >= 0 && typeof i.welcome == "boolean" && typeof i.truncated == "boolean" && Ko.every((o) => Array.isArray(i[o]) && i[o].length <= 20 && i[o].every(rt));
|
|
2105
2105
|
}, n = t;
|
|
2106
2106
|
return (n.before === null || e(n.before)) && e(n.current);
|
|
2107
2107
|
}
|
|
@@ -2395,7 +2395,7 @@ function Ca(t) {
|
|
|
2395
2395
|
return t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
2396
2396
|
}
|
|
2397
2397
|
let Yi;
|
|
2398
|
-
function
|
|
2398
|
+
function Bu(t, e) {
|
|
2399
2399
|
if (nl && t.data instanceof Blob)
|
|
2400
2400
|
return t.data.arrayBuffer().then(Ca).then(e);
|
|
2401
2401
|
if (sl && (t.data instanceof ArrayBuffer || il(t.data)))
|
|
@@ -2404,10 +2404,10 @@ function zu(t, e) {
|
|
|
2404
2404
|
Yi || (Yi = new TextEncoder()), e(Yi.encode(n));
|
|
2405
2405
|
});
|
|
2406
2406
|
}
|
|
2407
|
-
const
|
|
2408
|
-
for (let t = 0; t <
|
|
2409
|
-
ts[
|
|
2410
|
-
const
|
|
2407
|
+
const Ra = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ts = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
2408
|
+
for (let t = 0; t < Ra.length; t++)
|
|
2409
|
+
ts[Ra.charCodeAt(t)] = t;
|
|
2410
|
+
const zu = (t) => {
|
|
2411
2411
|
let e = t.length * 0.75, n = t.length, s, i = 0, o, r, a, c;
|
|
2412
2412
|
t[t.length - 1] === "=" && (e--, t[t.length - 2] === "=" && e--);
|
|
2413
2413
|
const l = new ArrayBuffer(e), u = new Uint8Array(l);
|
|
@@ -2432,7 +2432,7 @@ const Bu = (t) => {
|
|
|
2432
2432
|
} : Go;
|
|
2433
2433
|
}, Fu = (t, e) => {
|
|
2434
2434
|
if (ju) {
|
|
2435
|
-
const n =
|
|
2435
|
+
const n = zu(t);
|
|
2436
2436
|
return ol(n, e);
|
|
2437
2437
|
} else
|
|
2438
2438
|
return { base64: !0, data: t };
|
|
@@ -2456,7 +2456,7 @@ const Bu = (t) => {
|
|
|
2456
2456
|
function Ku() {
|
|
2457
2457
|
return new TransformStream({
|
|
2458
2458
|
transform(t, e) {
|
|
2459
|
-
|
|
2459
|
+
Bu(t, (n) => {
|
|
2460
2460
|
const s = n.length;
|
|
2461
2461
|
let i;
|
|
2462
2462
|
if (s < 126)
|
|
@@ -2529,24 +2529,24 @@ function Wu(t, e) {
|
|
|
2529
2529
|
});
|
|
2530
2530
|
}
|
|
2531
2531
|
const al = 4;
|
|
2532
|
-
function
|
|
2532
|
+
function Se(t) {
|
|
2533
2533
|
if (t) return Vu(t);
|
|
2534
2534
|
}
|
|
2535
2535
|
function Vu(t) {
|
|
2536
|
-
for (var e in
|
|
2537
|
-
t[e] =
|
|
2536
|
+
for (var e in Se.prototype)
|
|
2537
|
+
t[e] = Se.prototype[e];
|
|
2538
2538
|
return t;
|
|
2539
2539
|
}
|
|
2540
|
-
|
|
2540
|
+
Se.prototype.on = Se.prototype.addEventListener = function(t, e) {
|
|
2541
2541
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + t] = this._callbacks["$" + t] || []).push(e), this;
|
|
2542
2542
|
};
|
|
2543
|
-
|
|
2543
|
+
Se.prototype.once = function(t, e) {
|
|
2544
2544
|
function n() {
|
|
2545
2545
|
this.off(t, n), e.apply(this, arguments);
|
|
2546
2546
|
}
|
|
2547
2547
|
return n.fn = e, this.on(t, n), this;
|
|
2548
2548
|
};
|
|
2549
|
-
|
|
2549
|
+
Se.prototype.off = Se.prototype.removeListener = Se.prototype.removeAllListeners = Se.prototype.removeEventListener = function(t, e) {
|
|
2550
2550
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
2551
2551
|
return this._callbacks = {}, this;
|
|
2552
2552
|
var n = this._callbacks["$" + t];
|
|
@@ -2560,7 +2560,7 @@ Ie.prototype.off = Ie.prototype.removeListener = Ie.prototype.removeAllListeners
|
|
|
2560
2560
|
}
|
|
2561
2561
|
return n.length === 0 && delete this._callbacks["$" + t], this;
|
|
2562
2562
|
};
|
|
2563
|
-
|
|
2563
|
+
Se.prototype.emit = function(t) {
|
|
2564
2564
|
this._callbacks = this._callbacks || {};
|
|
2565
2565
|
for (var e = new Array(arguments.length - 1), n = this._callbacks["$" + t], s = 1; s < arguments.length; s++)
|
|
2566
2566
|
e[s - 1] = arguments[s];
|
|
@@ -2571,11 +2571,11 @@ Ie.prototype.emit = function(t) {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
return this;
|
|
2573
2573
|
};
|
|
2574
|
-
|
|
2575
|
-
|
|
2574
|
+
Se.prototype.emitReserved = Se.prototype.emit;
|
|
2575
|
+
Se.prototype.listeners = function(t) {
|
|
2576
2576
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + t] || [];
|
|
2577
2577
|
};
|
|
2578
|
-
|
|
2578
|
+
Se.prototype.hasListeners = function(t) {
|
|
2579
2579
|
return !!this.listeners(t).length;
|
|
2580
2580
|
};
|
|
2581
2581
|
const gi = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, n) => n(e, 0), at = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Gu = "arraybuffer";
|
|
@@ -2618,7 +2618,7 @@ class np extends Error {
|
|
|
2618
2618
|
super(e), this.description = n, this.context = s, this.type = "TransportError";
|
|
2619
2619
|
}
|
|
2620
2620
|
}
|
|
2621
|
-
class br extends
|
|
2621
|
+
class br extends Se {
|
|
2622
2622
|
/**
|
|
2623
2623
|
* Transport abstract constructor.
|
|
2624
2624
|
*
|
|
@@ -2858,7 +2858,7 @@ class rp extends sp {
|
|
|
2858
2858
|
}), this.pollXhr = e;
|
|
2859
2859
|
}
|
|
2860
2860
|
}
|
|
2861
|
-
let xn = class $s extends
|
|
2861
|
+
let xn = class $s extends Se {
|
|
2862
2862
|
/**
|
|
2863
2863
|
* Request constructor
|
|
2864
2864
|
*
|
|
@@ -2959,13 +2959,13 @@ xn.requestsCount = 0;
|
|
|
2959
2959
|
xn.requests = {};
|
|
2960
2960
|
if (typeof document < "u") {
|
|
2961
2961
|
if (typeof attachEvent == "function")
|
|
2962
|
-
attachEvent("onunload",
|
|
2962
|
+
attachEvent("onunload", Aa);
|
|
2963
2963
|
else if (typeof addEventListener == "function") {
|
|
2964
2964
|
const t = "onpagehide" in at ? "pagehide" : "unload";
|
|
2965
|
-
addEventListener(t,
|
|
2965
|
+
addEventListener(t, Aa, !1);
|
|
2966
2966
|
}
|
|
2967
2967
|
}
|
|
2968
|
-
function
|
|
2968
|
+
function Aa() {
|
|
2969
2969
|
for (let t in xn.requests)
|
|
2970
2970
|
xn.requests.hasOwnProperty(t) && xn.requests[t].abort();
|
|
2971
2971
|
}
|
|
@@ -3154,7 +3154,7 @@ const Yo = typeof addEventListener == "function" && typeof removeEventListener =
|
|
|
3154
3154
|
Yo && addEventListener("offline", () => {
|
|
3155
3155
|
Hs.forEach((t) => t());
|
|
3156
3156
|
}, !1);
|
|
3157
|
-
class Wt extends
|
|
3157
|
+
class Wt extends Se {
|
|
3158
3158
|
/**
|
|
3159
3159
|
* Socket constructor.
|
|
3160
3160
|
*
|
|
@@ -3632,7 +3632,7 @@ class Cp {
|
|
|
3632
3632
|
return i.unshift(s), i;
|
|
3633
3633
|
}
|
|
3634
3634
|
}
|
|
3635
|
-
class _r extends
|
|
3635
|
+
class _r extends Se {
|
|
3636
3636
|
/**
|
|
3637
3637
|
* Decoder constructor
|
|
3638
3638
|
*/
|
|
@@ -3654,7 +3654,7 @@ class _r extends Ie {
|
|
|
3654
3654
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
3655
3655
|
n = this.decodeString(e);
|
|
3656
3656
|
const s = n.type === X.BINARY_EVENT;
|
|
3657
|
-
s || n.type === X.BINARY_ACK ? (n.type = s ? X.EVENT : X.ACK, this.reconstructor = new
|
|
3657
|
+
s || n.type === X.BINARY_ACK ? (n.type = s ? X.EVENT : X.ACK, this.reconstructor = new Rp(n)) : super.emitReserved("decoded", n);
|
|
3658
3658
|
} else if (wr(e) || e.base64)
|
|
3659
3659
|
if (this.reconstructor)
|
|
3660
3660
|
n = this.reconstructor.takeBinaryData(e), n && (this.reconstructor = null, super.emitReserved("decoded", n));
|
|
@@ -3684,7 +3684,7 @@ class _r extends Ie {
|
|
|
3684
3684
|
if (r != Number(r) || e.charAt(n) !== "-")
|
|
3685
3685
|
throw new Error("Illegal attachments");
|
|
3686
3686
|
const a = Number(r);
|
|
3687
|
-
if (!
|
|
3687
|
+
if (!Ap(a) || a < 1)
|
|
3688
3688
|
throw new Error("Illegal attachments");
|
|
3689
3689
|
if (a > this.opts.maxAttachments)
|
|
3690
3690
|
throw new Error("too many attachments");
|
|
@@ -3750,7 +3750,7 @@ class _r extends Ie {
|
|
|
3750
3750
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
3751
3751
|
}
|
|
3752
3752
|
}
|
|
3753
|
-
class
|
|
3753
|
+
class Rp {
|
|
3754
3754
|
constructor(e) {
|
|
3755
3755
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
3756
3756
|
}
|
|
@@ -3776,7 +3776,7 @@ class Ap {
|
|
|
3776
3776
|
this.reconPack = null, this.buffers = [];
|
|
3777
3777
|
}
|
|
3778
3778
|
}
|
|
3779
|
-
const
|
|
3779
|
+
const Ap = Number.isInteger || function(t) {
|
|
3780
3780
|
return typeof t == "number" && isFinite(t) && Math.floor(t) === t;
|
|
3781
3781
|
};
|
|
3782
3782
|
function Ta(t) {
|
|
@@ -3804,7 +3804,7 @@ const Mp = Object.freeze({
|
|
|
3804
3804
|
newListener: 1,
|
|
3805
3805
|
removeListener: 1
|
|
3806
3806
|
});
|
|
3807
|
-
class gl extends
|
|
3807
|
+
class gl extends Se {
|
|
3808
3808
|
/**
|
|
3809
3809
|
* `Socket` constructor.
|
|
3810
3810
|
*/
|
|
@@ -4396,10 +4396,10 @@ class gl extends Ie {
|
|
|
4396
4396
|
}
|
|
4397
4397
|
}
|
|
4398
4398
|
}
|
|
4399
|
-
function
|
|
4399
|
+
function Rn(t) {
|
|
4400
4400
|
t = t || {}, this.ms = t.min || 100, this.max = t.max || 1e4, this.factor = t.factor || 2, this.jitter = t.jitter > 0 && t.jitter <= 1 ? t.jitter : 0, this.attempts = 0;
|
|
4401
4401
|
}
|
|
4402
|
-
|
|
4402
|
+
Rn.prototype.duration = function() {
|
|
4403
4403
|
var t = this.ms * Math.pow(this.factor, this.attempts++);
|
|
4404
4404
|
if (this.jitter) {
|
|
4405
4405
|
var e = Math.random(), n = Math.floor(e * this.jitter * t);
|
|
@@ -4407,22 +4407,22 @@ An.prototype.duration = function() {
|
|
|
4407
4407
|
}
|
|
4408
4408
|
return Math.min(t, this.max) | 0;
|
|
4409
4409
|
};
|
|
4410
|
-
|
|
4410
|
+
Rn.prototype.reset = function() {
|
|
4411
4411
|
this.attempts = 0;
|
|
4412
4412
|
};
|
|
4413
|
-
|
|
4413
|
+
Rn.prototype.setMin = function(t) {
|
|
4414
4414
|
this.ms = t;
|
|
4415
4415
|
};
|
|
4416
|
-
|
|
4416
|
+
Rn.prototype.setMax = function(t) {
|
|
4417
4417
|
this.max = t;
|
|
4418
4418
|
};
|
|
4419
|
-
|
|
4419
|
+
Rn.prototype.setJitter = function(t) {
|
|
4420
4420
|
this.jitter = t;
|
|
4421
4421
|
};
|
|
4422
|
-
class Qo extends
|
|
4422
|
+
class Qo extends Se {
|
|
4423
4423
|
constructor(e, n) {
|
|
4424
4424
|
var s;
|
|
4425
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (n = e, e = void 0), n = n || {}, n.path = n.path || "/socket.io", this.opts = n, fi(this, n), this.reconnection(n.reconnection !== !1), this.reconnectionAttempts(n.reconnectionAttempts || 1 / 0), this.reconnectionDelay(n.reconnectionDelay || 1e3), this.reconnectionDelayMax(n.reconnectionDelayMax || 5e3), this.randomizationFactor((s = n.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new
|
|
4425
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (n = e, e = void 0), n = n || {}, n.path = n.path || "/socket.io", this.opts = n, fi(this, n), this.reconnection(n.reconnection !== !1), this.reconnectionAttempts(n.reconnectionAttempts || 1 / 0), this.reconnectionDelay(n.reconnectionDelay || 1e3), this.reconnectionDelayMax(n.reconnectionDelayMax || 5e3), this.randomizationFactor((s = n.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Rn({
|
|
4426
4426
|
min: this.reconnectionDelay(),
|
|
4427
4427
|
max: this.reconnectionDelayMax(),
|
|
4428
4428
|
jitter: this.randomizationFactor()
|
|
@@ -5110,7 +5110,7 @@ function Dp(t) {
|
|
|
5110
5110
|
const g = d.engine.getState().slices, y = g.conversation.submissions[r.submission.userMessageId];
|
|
5111
5111
|
(!He(t) || !y || y.cancelled || y.requestId !== r.submission.requestId || g.directory.clients[y.clientScopeId] !== y.conversationScopeId) && l(Object.assign(new Error("Submission preparation was retired."), { code: "aborted", retryable: !1 }));
|
|
5112
5112
|
}, f = d.engine.subscribe(h), m = d.onDispose(() => l(Object.assign(new Error("Submission runtime was disposed."), { code: "aborted" })));
|
|
5113
|
-
return h(),
|
|
5113
|
+
return h(), Bs(a.signal, () => t.prepareSubmission(r, a.signal).then((g) => (a.signal.aborted && c.mark("context_discarded"), g), (g) => {
|
|
5114
5114
|
throw a.signal.aborted && c.mark("context_discarded"), g;
|
|
5115
5115
|
})).then((g) => (h(), a.signal.throwIfAborted(), g)).catch((g) => (l(g), s(g, { operation: "conversation.prepare", requestId: r.submission.userMessageId }))).finally(() => {
|
|
5116
5116
|
clearTimeout(u), f(), m();
|
|
@@ -5489,7 +5489,7 @@ function $t(t, e, n) {
|
|
|
5489
5489
|
const k = ["thinking", "steering", "queued"].includes(v), T = t.stops[n] ?? _, O = T?.userMessageIds.filter((S) => !["completed", "failed"].includes(o?.executionByUserMessage[S]?.phase ?? "")) ?? [], V = O.some((S) => {
|
|
5490
5490
|
const D = r.find((J) => J.userMessageId === S);
|
|
5491
5491
|
return !Object.values(t.operations).some((J) => J.command.type === "run.stop" && J.command.payload.expectedUserMessageId === S && J.phase === "done") && (D?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(D.delivery) || !!(d && ft(d).includes(S) && ["thinking", "steering", "queued", "stopping"].includes(d.phase)));
|
|
5492
|
-
}), E = d?.user_message_ids ?? [],
|
|
5492
|
+
}), E = d?.user_message_ids ?? [], z = y || b ? g?.userMessageId ?? null : E[E.length - 1] ?? null, P = u.find((S) => S.userMessageId === z), G = k ? [...P?.activityIds ?? []].reverse().find((S) => l[S] === "open") ?? null : null, U = i !== null && !!e.selections[n]?.provisionalId && a.length === 0 && r.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
|
|
5493
5493
|
(!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" && S.command.type === "attachment.prepare" && !S.command.payload.sessionId && S.result?.sessionId === i);
|
|
5494
5494
|
return je({
|
|
5495
5495
|
historyRefreshFailure: o?.historyRefreshFailure ?? null,
|
|
@@ -5508,8 +5508,8 @@ function $t(t, e, n) {
|
|
|
5508
5508
|
streamStates: l,
|
|
5509
5509
|
preparation: o?.preparation ?? null,
|
|
5510
5510
|
stop: T ? { ...T, userMessageIds: O, pending: V } : null,
|
|
5511
|
-
segments: u.map((S, D) => ({ ...S, collapsed: k ? S.userMessageId !==
|
|
5512
|
-
activity: { phase: v, activeItemId: G, userMessageId:
|
|
5511
|
+
segments: u.map((S, D) => ({ ...S, collapsed: k ? S.userMessageId !== z : D < u.length - 1 || S.activityIds.length > 0 })),
|
|
5512
|
+
activity: { phase: v, activeItemId: G, userMessageId: z, executionKey: JSON.stringify([...ft(d)].sort()) },
|
|
5513
5513
|
// Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
|
|
5514
5514
|
// the same submitted text in the optimistic transcript and composer during delivery.
|
|
5515
5515
|
receipts: s.filter((S) => !S.cancelled && e.clients[S.clientScopeId] === n).map((S) => ({ viewId: S.viewId, userMessageId: S.userMessageId, acceptedRendererRevision: S.rendererRevision, durable: t.durableSubmissionIds.includes(S.userMessageId) || S.delivery === "accepted" }))
|
|
@@ -5532,7 +5532,7 @@ function fl(t, e) {
|
|
|
5532
5532
|
function Up(t, e) {
|
|
5533
5533
|
return je({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((n) => [n, $t(t, e, n)])) });
|
|
5534
5534
|
}
|
|
5535
|
-
const
|
|
5535
|
+
const Bp = /(`+)(?!`)[\s\S]*?\1(?!`)/g, zp = "/api/product-agent/attachments/download", jp = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
5536
5536
|
function Sn(t, e) {
|
|
5537
5537
|
return e ? t.replace(
|
|
5538
5538
|
jp,
|
|
@@ -5544,7 +5544,7 @@ function Fp(t, e) {
|
|
|
5544
5544
|
return !1;
|
|
5545
5545
|
try {
|
|
5546
5546
|
const n = e ? new URL(t, e) : new URL(t);
|
|
5547
|
-
return n.pathname !==
|
|
5547
|
+
return n.pathname !== zp ? !1 : !e || n.origin === new URL(e).origin;
|
|
5548
5548
|
} catch {
|
|
5549
5549
|
return !1;
|
|
5550
5550
|
}
|
|
@@ -5575,7 +5575,7 @@ function $p(t) {
|
|
|
5575
5575
|
}
|
|
5576
5576
|
function Pa(t) {
|
|
5577
5577
|
let e = "", n = 0;
|
|
5578
|
-
for (const s of t.matchAll(
|
|
5578
|
+
for (const s of t.matchAll(Bp)) {
|
|
5579
5579
|
const i = s.index ?? 0;
|
|
5580
5580
|
e += qa(
|
|
5581
5581
|
t.slice(n, i)
|
|
@@ -5681,7 +5681,7 @@ function Wp(t, e, n, s) {
|
|
|
5681
5681
|
function Zi(t, e, n, s) {
|
|
5682
5682
|
const i = /* @__PURE__ */ new Map();
|
|
5683
5683
|
for (const E of t.segments)
|
|
5684
|
-
for (const
|
|
5684
|
+
for (const z of [...E.activityIds, ...E.outcomeIds]) i.set(z, E.userMessageId);
|
|
5685
5685
|
const o = t.items.map((E) => Wp(
|
|
5686
5686
|
E,
|
|
5687
5687
|
i.get(E.id) ?? null,
|
|
@@ -5695,30 +5695,30 @@ function Zi(t, e, n, s) {
|
|
|
5695
5695
|
// There is no canonical timestamp before acceptance. Keep identity stable without fabricating one.
|
|
5696
5696
|
createdAt: "",
|
|
5697
5697
|
retryable: E.delivery === "failed" && !["unauthorized", "401", "auth_reconnecting"].includes(E.error?.code ?? "") && ["delivery", "preparation"].includes(fl(t, E.userMessageId)?.type ?? ""),
|
|
5698
|
-
attachments: E.attachments.map((
|
|
5699
|
-
id:
|
|
5700
|
-
name:
|
|
5701
|
-
mimeType:
|
|
5702
|
-
sizeBytes:
|
|
5698
|
+
attachments: E.attachments.map((z) => ({
|
|
5699
|
+
id: z.sourceId,
|
|
5700
|
+
name: z.name,
|
|
5701
|
+
mimeType: z.mimeType,
|
|
5702
|
+
sizeBytes: z.sizeBytes
|
|
5703
5703
|
}))
|
|
5704
5704
|
});
|
|
5705
5705
|
const r = o, a = { ...t.removedItems };
|
|
5706
5706
|
for (const E of t.segments) {
|
|
5707
5707
|
if (!E.userMessageId) continue;
|
|
5708
|
-
const
|
|
5709
|
-
|
|
5708
|
+
const z = o.find((P) => E.outcomeIds.includes(P.id) && !P.loading && (P.dataType === "run_status" || P.dataType === "run_error" || P.role === "assistant" && P.phase === "final_answer" && P.streamState === "finished"));
|
|
5709
|
+
z && (a[`local-interrupted:${E.userMessageId}`] = z.id);
|
|
5710
5710
|
}
|
|
5711
5711
|
const c = t.activity.phase, l = t.submissions.filter((E) => !E.cancelled && !["accepted", "failed"].includes(E.delivery)), u = t.submissions[t.submissions.length - 1], d = [...t.items].reverse().find((E) => E.type === "user_message"), h = ["queued", "thinking", "steering", "awaiting_execution"].includes(c), f = u?.delivery === "failed" && (h && t.activity.userMessageId != null && t.activity.userMessageId !== u.userMessageId || d !== void 0 && d.id !== u.userMessageId && Date.parse(d.created_at) > u.submittedAt), m = new Map(t.submissions.filter((E) => (E !== u || f) && !E.cancelled && E.delivery === "failed" && E.error).map((E) => [E.userMessageId, E])), g = r.flatMap((E) => {
|
|
5712
|
-
const
|
|
5713
|
-
return
|
|
5714
|
-
id: `submission-error:${
|
|
5712
|
+
const z = E.role === "user" ? m.get(E.id) : void 0;
|
|
5713
|
+
return z?.error ? [E, {
|
|
5714
|
+
id: `submission-error:${z.userMessageId}`,
|
|
5715
5715
|
role: "system",
|
|
5716
5716
|
dataType: "run_error",
|
|
5717
|
-
respondsToUserMessageId:
|
|
5718
|
-
content:
|
|
5717
|
+
respondsToUserMessageId: z.userMessageId,
|
|
5718
|
+
content: z.error.message,
|
|
5719
5719
|
createdAt: "",
|
|
5720
5720
|
loading: !1,
|
|
5721
|
-
...typeof
|
|
5721
|
+
...typeof z.error.details?.securitySettingsUrl == "string" ? { securitySettingsUrl: z.error.details.securitySettingsUrl } : {}
|
|
5722
5722
|
}] : [E];
|
|
5723
5723
|
}), y = e?.error != null && t.historyRefreshFailure != null && t.historyRefreshFailure.consecutiveFailures < 4, b = y ? null : e?.error ?? null, v = [...t.submissions].reverse().find((E) => t.pendingDurabilityIds?.includes(E.userMessageId)), _ = v ? {
|
|
5724
5724
|
code: "submission_checkpoint_pending",
|
|
@@ -5767,9 +5767,9 @@ function Zi(t, e, n, s) {
|
|
|
5767
5767
|
lastErrorCode: I?.code ?? null,
|
|
5768
5768
|
lastErrorSecuritySettingsUrl: typeof I?.details?.securitySettingsUrl == "string" ? I.details.securitySettingsUrl : null
|
|
5769
5769
|
};
|
|
5770
|
-
for (const E of t.optimistic.filter((
|
|
5771
|
-
const
|
|
5772
|
-
T = { ...T, messages:
|
|
5770
|
+
for (const E of t.optimistic.filter((z) => z.cancelled && !t.stop?.userMessageIds.includes(z.userMessageId))) {
|
|
5771
|
+
const z = Oa(T, "", "stopped", [E.userMessageId], La(E.cancellationReason));
|
|
5772
|
+
T = { ...T, messages: z.messages, segments: z.segments };
|
|
5773
5773
|
}
|
|
5774
5774
|
if (t.stop) {
|
|
5775
5775
|
const E = Oa(
|
|
@@ -5781,8 +5781,8 @@ function Zi(t, e, n, s) {
|
|
|
5781
5781
|
);
|
|
5782
5782
|
T = { ...T, messages: E.messages, segments: E.segments };
|
|
5783
5783
|
}
|
|
5784
|
-
const O = new Map(T.segments.flatMap((E,
|
|
5785
|
-
return { ...T, messages: [...T.messages].sort((E,
|
|
5784
|
+
const O = new Map(T.segments.flatMap((E, z) => [E.userMessageId, ...E.activityIds, ...E.outcomeIds].filter((P) => P !== null).map((P) => [P, z]))), V = (E) => O.get(E.id) ?? O.get(E.respondsToUserMessageId ?? "") ?? 1 / 0;
|
|
5785
|
+
return { ...T, messages: [...T.messages].sort((E, z) => V(E) - V(z)) };
|
|
5786
5786
|
}
|
|
5787
5787
|
function La(t) {
|
|
5788
5788
|
switch (t) {
|
|
@@ -5903,7 +5903,7 @@ class yl {
|
|
|
5903
5903
|
}, g = () => m("transport_disposed"), y = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(r?.reason) ? r.reason : "caller_cancelled");
|
|
5904
5904
|
this.requests.signal.addEventListener("abort", g, { once: !0 }), r?.addEventListener("abort", y, { once: !0 });
|
|
5905
5905
|
const b = o === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && i === "POST", v = /^\/conversations(?:\/[^/]+)?$/.test(e) && (i ?? (s === void 0 ? "GET" : "POST")) === "GET", _ = setTimeout(() => m("deadline"), v ? 6e4 : b ? 3e4 : 15e3), I = Yp(), k = Date.now();
|
|
5906
|
-
let T = null, O = !1, V = null, E = null,
|
|
5906
|
+
let T = null, O = !1, V = null, E = null, z = null;
|
|
5907
5907
|
try {
|
|
5908
5908
|
const P = await Promise.resolve(fetch(u, {
|
|
5909
5909
|
method: i ?? (s === void 0 ? "GET" : "POST"),
|
|
@@ -5914,7 +5914,7 @@ class yl {
|
|
|
5914
5914
|
})).catch((G) => {
|
|
5915
5915
|
throw O = !0, G;
|
|
5916
5916
|
});
|
|
5917
|
-
if (T = Date.now(), V = P.status, E = Na(P.headers.get("x-request-id")),
|
|
5917
|
+
if (T = Date.now(), V = P.status, E = Na(P.headers.get("x-request-id")), z = Na(P.headers.get("x-cloud-trace-context")), !P.ok) {
|
|
5918
5918
|
const G = P.status === 401 ? "unauthorized" : P.status === 426 ? "update_required" : String(P.status), U = (await P.json().catch(() => null))?.detail;
|
|
5919
5919
|
if (P.status === 410 && U?.code === "personal_product_agent_retired" && typeof U.message == "string")
|
|
5920
5920
|
throw new q(
|
|
@@ -5960,7 +5960,7 @@ class yl {
|
|
|
5960
5960
|
sessionId: pe(a?.sessionId),
|
|
5961
5961
|
release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${Cn.version}`,
|
|
5962
5962
|
upstreamRequestId: E,
|
|
5963
|
-
upstreamTraceId:
|
|
5963
|
+
upstreamTraceId: z
|
|
5964
5964
|
};
|
|
5965
5965
|
Gt(U) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(U) : console.warn("Product Agent HTTP request failed", U)).catch(() => {
|
|
5966
5966
|
});
|
|
@@ -6292,7 +6292,7 @@ function th(t) {
|
|
|
6292
6292
|
if (!e.bindings.some((r) => r.sessionId === i && r.clientScopeId === o)) return !1;
|
|
6293
6293
|
return !0;
|
|
6294
6294
|
}
|
|
6295
|
-
const
|
|
6295
|
+
const Ba = /* @__PURE__ */ new WeakMap();
|
|
6296
6296
|
class nh {
|
|
6297
6297
|
constructor(e) {
|
|
6298
6298
|
this.options = e;
|
|
@@ -6353,10 +6353,10 @@ class nh {
|
|
|
6353
6353
|
browserSessionId: this.options.persistence.sessionId(),
|
|
6354
6354
|
bindings: Object.entries(e.clients).map(([i, o]) => ({ clientScopeId: i, conversationScopeId: o, ...e.selections[o] })),
|
|
6355
6355
|
mains: Object.fromEntries(Object.entries(e.memberships).flatMap(([i, o]) => o.mainClientScopeId ? [[i, o.mainClientScopeId]] : []))
|
|
6356
|
-
}, s = (
|
|
6356
|
+
}, s = (Ba.get(this.options.runtime) ?? Promise.resolve()).then(async () => {
|
|
6357
6357
|
this.current() && await this.options.persistence.write(n);
|
|
6358
6358
|
});
|
|
6359
|
-
return
|
|
6359
|
+
return Ba.set(this.options.runtime, s.catch(() => {
|
|
6360
6360
|
})), s;
|
|
6361
6361
|
}
|
|
6362
6362
|
async restore(e) {
|
|
@@ -6400,7 +6400,7 @@ function sh(t, e, n, s = () => crypto.randomUUID()) {
|
|
|
6400
6400
|
liveClients: async () => [e]
|
|
6401
6401
|
};
|
|
6402
6402
|
}
|
|
6403
|
-
const
|
|
6403
|
+
const za = /* @__PURE__ */ new Map(), ja = /* @__PURE__ */ new Map();
|
|
6404
6404
|
function ih(t, e, n = () => crypto.randomUUID()) {
|
|
6405
6405
|
try {
|
|
6406
6406
|
return sh(window.sessionStorage, t, e, n);
|
|
@@ -6409,15 +6409,15 @@ function ih(t, e, n = () => crypto.randomUUID()) {
|
|
|
6409
6409
|
const i = `${e}:${t}`, o = ja.get(i) ?? n();
|
|
6410
6410
|
return ja.set(i, o), {
|
|
6411
6411
|
sessionId: () => o,
|
|
6412
|
-
read: async () =>
|
|
6412
|
+
read: async () => za.get(i),
|
|
6413
6413
|
write: async (r) => {
|
|
6414
|
-
|
|
6414
|
+
za.set(i, r);
|
|
6415
6415
|
},
|
|
6416
6416
|
liveClients: async () => [t]
|
|
6417
6417
|
};
|
|
6418
6418
|
}
|
|
6419
6419
|
}
|
|
6420
|
-
class
|
|
6420
|
+
class Ie extends EventTarget {
|
|
6421
6421
|
constructor(e) {
|
|
6422
6422
|
super(), this.options = e, this.httpTransport = new yl({
|
|
6423
6423
|
...e,
|
|
@@ -7680,7 +7680,7 @@ function Il(t, e, n) {
|
|
|
7680
7680
|
};
|
|
7681
7681
|
}
|
|
7682
7682
|
const Sl = "suggest_share_on_socials";
|
|
7683
|
-
function
|
|
7683
|
+
function Rh(t) {
|
|
7684
7684
|
let e = t;
|
|
7685
7685
|
if (typeof t == "string")
|
|
7686
7686
|
try {
|
|
@@ -7688,10 +7688,10 @@ function Ah(t) {
|
|
|
7688
7688
|
} catch {
|
|
7689
7689
|
return null;
|
|
7690
7690
|
}
|
|
7691
|
-
const n =
|
|
7691
|
+
const n = Ah(e);
|
|
7692
7692
|
return n ? typeof n.showSharePrompt == "boolean" ? n.showSharePrompt : n.ok === !0 && typeof n.message == "string" && n.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
7693
7693
|
}
|
|
7694
|
-
function
|
|
7694
|
+
function Ah(t) {
|
|
7695
7695
|
return t && typeof t == "object" && !Array.isArray(t) ? t : null;
|
|
7696
7696
|
}
|
|
7697
7697
|
const Th = "save_runtime_captured_skill";
|
|
@@ -7769,7 +7769,7 @@ function Nh() {
|
|
|
7769
7769
|
function xl() {
|
|
7770
7770
|
return {
|
|
7771
7771
|
storage: Uh(),
|
|
7772
|
-
channel:
|
|
7772
|
+
channel: Bh(),
|
|
7773
7773
|
randomUUID: () => crypto.randomUUID(),
|
|
7774
7774
|
settle: () => new Promise((t) => Oh(t, qh))
|
|
7775
7775
|
};
|
|
@@ -7792,7 +7792,7 @@ function Uh() {
|
|
|
7792
7792
|
}
|
|
7793
7793
|
};
|
|
7794
7794
|
}
|
|
7795
|
-
function
|
|
7795
|
+
function Bh() {
|
|
7796
7796
|
if (typeof BroadcastChannel < "u") {
|
|
7797
7797
|
const t = new BroadcastChannel(Ph);
|
|
7798
7798
|
return {
|
|
@@ -7804,9 +7804,9 @@ function zh() {
|
|
|
7804
7804
|
close: () => t.close()
|
|
7805
7805
|
};
|
|
7806
7806
|
}
|
|
7807
|
-
return
|
|
7807
|
+
return zh();
|
|
7808
7808
|
}
|
|
7809
|
-
function
|
|
7809
|
+
function zh() {
|
|
7810
7810
|
const t = /* @__PURE__ */ new Set(), e = (n) => {
|
|
7811
7811
|
if (n.key !== so || !n.newValue)
|
|
7812
7812
|
return;
|
|
@@ -8062,7 +8062,7 @@ const tg = "https://app.pluno.ai", ng = 2e4, sg = 1e4, ig = 6e4, og = 6e4, rg =
|
|
|
8062
8062
|
".pdf:application/pdf",
|
|
8063
8063
|
".png:image/png",
|
|
8064
8064
|
".webp:image/webp"
|
|
8065
|
-
]), hg = ".pdf,.png,.jpg,.jpeg,.webp", xr = 64e3, po = 4e3, kr = 30, gg = 2e3, fg = 1e3,
|
|
8065
|
+
]), hg = ".pdf,.png,.jpg,.jpeg,.webp", xr = 64e3, po = 4e3, kr = 30, gg = 2e3, fg = 1e3, Rl = "Image is too large for model vision input.", mg = "pluno.productAgent.state.", sr = "pluno.productAgent.pendingEvents.", yi = "pluno.productAgent.activeToolCalls.", yg = 100, Js = /* @__PURE__ */ new Set();
|
|
8066
8066
|
let qs = null;
|
|
8067
8067
|
function bg(t, e = Math.random) {
|
|
8068
8068
|
const n = Math.min(nr, cg * 2 ** t), s = 1 - Ga + e() * Ga * 2;
|
|
@@ -8114,8 +8114,8 @@ class Er {
|
|
|
8114
8114
|
pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
|
|
8115
8115
|
recoverAuthentication: (i, o, r) => this.recoverHttpAuthentication(i, o, r),
|
|
8116
8116
|
// Public custom transports own their admission contract and do not expose the default Socket.IO lease.
|
|
8117
|
-
executorConnection: e.webSocketFactory ? void 0 : () => this.socket instanceof
|
|
8118
|
-
restoreExecutor: e.webSocketFactory ? void 0 : (i) => this.socket instanceof
|
|
8117
|
+
executorConnection: e.webSocketFactory ? void 0 : () => this.socket instanceof Ie ? this.socket.connectionId : null,
|
|
8118
|
+
restoreExecutor: e.webSocketFactory ? void 0 : (i) => this.socket instanceof Ie ? this.socket.restoreExecutor(i) : Promise.reject(new q("Browser is reconnecting.", "executor_not_ready")),
|
|
8119
8119
|
auth: {
|
|
8120
8120
|
protocol: 1,
|
|
8121
8121
|
token: e.token ?? "",
|
|
@@ -8165,6 +8165,8 @@ class Er {
|
|
|
8165
8165
|
reconnectAttempts = 0;
|
|
8166
8166
|
embeddedRecoveryTimer = null;
|
|
8167
8167
|
embeddedRecoveryTokenExpired = !1;
|
|
8168
|
+
embeddedRecoveryExhausted = !1;
|
|
8169
|
+
embeddedRecoverySuspended = !1;
|
|
8168
8170
|
recoveryDiagnosticId = crypto.randomUUID();
|
|
8169
8171
|
rejectedDiagnosticsToken = null;
|
|
8170
8172
|
lastRecoveryStage = "token_provider";
|
|
@@ -8273,7 +8275,7 @@ class Er {
|
|
|
8273
8275
|
}, s);
|
|
8274
8276
|
try {
|
|
8275
8277
|
await i.initializeDirectory(), await i.initializeConversation(), Eh().catch((o) => {
|
|
8276
|
-
|
|
8278
|
+
De("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
8277
8279
|
message: o instanceof Error ? o.message : String(o)
|
|
8278
8280
|
});
|
|
8279
8281
|
}), n.disableNetworkCapture || i.enableNetworkCapture(), i.startPageLifecycleRecovery(), i.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await i.connect();
|
|
@@ -8296,7 +8298,7 @@ class Er {
|
|
|
8296
8298
|
authority: this.directoryAuthority,
|
|
8297
8299
|
http: this.directoryHttp,
|
|
8298
8300
|
isActiveTurn: (e) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[e] === !0,
|
|
8299
|
-
nextRequestId:
|
|
8301
|
+
nextRequestId: ze,
|
|
8300
8302
|
onError: (e) => {
|
|
8301
8303
|
this.handleDirectoryTransportError(e), this.emit("error", Os(e));
|
|
8302
8304
|
},
|
|
@@ -8344,7 +8346,7 @@ class Er {
|
|
|
8344
8346
|
requestId: g.requestId,
|
|
8345
8347
|
clientMessageId: g.userMessageId,
|
|
8346
8348
|
sessionId: g.sessionId
|
|
8347
|
-
}), _ = (k, T) => v.measure(k, () =>
|
|
8349
|
+
}), _ = (k, T) => v.measure(k, () => Bs(b, T));
|
|
8348
8350
|
let I = g.contextPreparation ?? { pageContent: "", sessionTabs: [] };
|
|
8349
8351
|
if (g.contextPreparation === null) {
|
|
8350
8352
|
await _("first_frame", () => new Promise((T) => {
|
|
@@ -8365,13 +8367,13 @@ class Er {
|
|
|
8365
8367
|
}
|
|
8366
8368
|
if (await _("authentication", () => this.waitForAuthentication()), !s() || n !== this.directoryAuthority || this.clientRuntime.isDisposed) throw new Error("Submission authority was retired.");
|
|
8367
8369
|
for (const k of y)
|
|
8368
|
-
if (!k.uploaded && (await
|
|
8370
|
+
if (!k.uploaded && (await Bs(b, () => (this.attachmentPersistence.get(k.sourceId) ?? Promise.resolve()).catch(() => {
|
|
8369
8371
|
throw Object.assign(new Error("Attachment files could not be stored. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
|
|
8370
|
-
})), !await
|
|
8372
|
+
})), !await Bs(b, () => Wa(k.sourceId))))
|
|
8371
8373
|
throw Object.assign(new Error("Attachment files are unavailable. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
|
|
8372
8374
|
return b.throwIfAborted(), v.mark("context_ready"), { ...I, now: Date.now() };
|
|
8373
8375
|
},
|
|
8374
|
-
connectionId: () => this.socket instanceof
|
|
8376
|
+
connectionId: () => this.socket instanceof Ie ? this.socket.connectionId : null,
|
|
8375
8377
|
prepareUpload: this.options.prepareAttachmentUpload ?? (this.options.productVariant === "customer_embedded" ? (g) => this.prepareEmbedAttachmentUpload(g, s) : void 0),
|
|
8376
8378
|
onUploaded: async (g, y, b) => {
|
|
8377
8379
|
await _l(g, {
|
|
@@ -8380,7 +8382,7 @@ class Er {
|
|
|
8380
8382
|
storageKey: b.storage_key ?? void 0,
|
|
8381
8383
|
fileUrl: b.file_url ? new URL(b.file_url, this.options.backendUrl).toString() : void 0,
|
|
8382
8384
|
lastUsedAt: Date.now()
|
|
8383
|
-
}).catch((v) =>
|
|
8385
|
+
}).catch((v) => De("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
8384
8386
|
attachmentId: g,
|
|
8385
8387
|
message: v instanceof Error ? v.message : String(v)
|
|
8386
8388
|
}));
|
|
@@ -8405,7 +8407,7 @@ class Er {
|
|
|
8405
8407
|
y.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
8406
8408
|
return;
|
|
8407
8409
|
}
|
|
8408
|
-
|
|
8410
|
+
De("web-sdk.conversation", "Conversation operation failed", { ...y, ...Zn(g) }), g instanceof q && g.backendRefusal && y.operation.startsWith("chat.") ? this.applyAccountSubmissionError(g.code) : this.handleDirectoryTransportError(g);
|
|
8409
8411
|
}
|
|
8410
8412
|
})
|
|
8411
8413
|
});
|
|
@@ -8439,19 +8441,19 @@ class Er {
|
|
|
8439
8441
|
socket: {
|
|
8440
8442
|
retain: async (g, y) => {
|
|
8441
8443
|
const b = this.socket;
|
|
8442
|
-
b instanceof
|
|
8444
|
+
b instanceof Ie && await b.directoryRooms.retain(g, y).catch((v) => {
|
|
8443
8445
|
if (this.socket === b) throw v;
|
|
8444
8446
|
});
|
|
8445
8447
|
},
|
|
8446
8448
|
release: async (g, y) => {
|
|
8447
8449
|
const b = this.socket;
|
|
8448
|
-
b instanceof
|
|
8450
|
+
b instanceof Ie && await b.directoryRooms.release(g, y).catch((v) => {
|
|
8449
8451
|
if (this.socket === b) throw v;
|
|
8450
8452
|
});
|
|
8451
8453
|
}
|
|
8452
8454
|
},
|
|
8453
8455
|
socketIdentity: () => this.socket,
|
|
8454
|
-
nextRequestId:
|
|
8456
|
+
nextRequestId: ze,
|
|
8455
8457
|
wakeup: { start: () => {
|
|
8456
8458
|
}, stop: () => {
|
|
8457
8459
|
} },
|
|
@@ -8516,7 +8518,7 @@ class Er {
|
|
|
8516
8518
|
this.modelClientScopeId,
|
|
8517
8519
|
this.directoryConversationScopeId,
|
|
8518
8520
|
n
|
|
8519
|
-
) : (this.directoryProvisionalId =
|
|
8521
|
+
) : (this.directoryProvisionalId = ze(), await this.directoryScope.provisional(
|
|
8520
8522
|
this.modelClientScopeId,
|
|
8521
8523
|
this.directoryConversationScopeId,
|
|
8522
8524
|
this.directoryProvisionalId
|
|
@@ -8545,7 +8547,7 @@ class Er {
|
|
|
8545
8547
|
);
|
|
8546
8548
|
}
|
|
8547
8549
|
async beginDirectoryProvisional() {
|
|
8548
|
-
const e =
|
|
8550
|
+
const e = ze();
|
|
8549
8551
|
this.directoryProvisionalId = e, this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${e}`, await this.directoryScope.provisional(
|
|
8550
8552
|
this.modelClientScopeId,
|
|
8551
8553
|
this.directoryConversationScopeId,
|
|
@@ -8636,36 +8638,38 @@ class Er {
|
|
|
8636
8638
|
}
|
|
8637
8639
|
async connect() {
|
|
8638
8640
|
return this.clientRuntime.route("conversation", { core: async () => {
|
|
8639
|
-
if (this.socket instanceof
|
|
8640
|
-
const
|
|
8641
|
+
if (this.socket instanceof Ie && (this.socket.initialReadinessExpired || this.state.lastErrorCode === "connection_failed" && this.state.status !== "connected" && this.socket.readyState !== WebSocket.CLOSED)) {
|
|
8642
|
+
const r = this.socket;
|
|
8641
8643
|
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget();
|
|
8642
|
-
const
|
|
8643
|
-
this.setState({ status: "reconnecting" }),
|
|
8644
|
+
const a = this.waitForConnectionOutcome(r);
|
|
8645
|
+
this.setState({ status: "reconnecting" }), r.retryReadiness(), await a;
|
|
8644
8646
|
return;
|
|
8645
8647
|
}
|
|
8646
8648
|
if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
|
|
8647
8649
|
return;
|
|
8648
8650
|
this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0);
|
|
8649
8651
|
const e = this.authenticationFailure !== null, n = e && this.state.lastErrorCode === "connection_failed";
|
|
8650
|
-
this.authenticationFailure = null, this.
|
|
8651
|
-
const s =
|
|
8652
|
+
this.authenticationFailure = null, this.embeddedRecoveryExhausted = !1;
|
|
8653
|
+
const s = this.embeddedRecoveryTokenExpired;
|
|
8654
|
+
this.embeddedRecoverySuspended && document.visibilityState === "visible" && navigator.onLine !== !1 && this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget(s), this.credentialRecoveryFailure = null, this.connectionInProgress = !0;
|
|
8655
|
+
const i = ++this.connectionAttemptId, o = this.state.lastError;
|
|
8652
8656
|
this.setState(
|
|
8653
8657
|
this.state.status === "reconnecting" || n ? { status: "reconnecting" } : { status: "connecting", ...e ? {} : { lastError: null } }
|
|
8654
8658
|
);
|
|
8655
8659
|
try {
|
|
8656
|
-
if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token),
|
|
8660
|
+
if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token), i !== this.connectionAttemptId || this.state.status === "closed")
|
|
8657
8661
|
return;
|
|
8658
8662
|
if (this.lastRecoveryStage = "socket_admission", !this.token && !this.options.webSocketFactory)
|
|
8659
8663
|
throw new Je("Pluno requires a token or tokenProvider", !1);
|
|
8660
8664
|
if (!this.options.webSocketFactory && this.rejectedTransportToken !== null && this.rejectedTransportToken === this.token) {
|
|
8661
|
-
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError:
|
|
8665
|
+
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError: o });
|
|
8662
8666
|
return;
|
|
8663
8667
|
}
|
|
8664
|
-
if (this.socket instanceof
|
|
8668
|
+
if (this.socket instanceof Ie) {
|
|
8665
8669
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
8666
8670
|
return;
|
|
8667
8671
|
}
|
|
8668
|
-
const
|
|
8672
|
+
const r = Ug(this.options.backendUrl), a = this.options.webSocketFactory?.(r) ?? new Ie({
|
|
8669
8673
|
displaySchema: "canonical",
|
|
8670
8674
|
backendUrl: this.options.backendUrl,
|
|
8671
8675
|
entrySurface: this.options.entrySurface,
|
|
@@ -8684,13 +8688,13 @@ class Er {
|
|
|
8684
8688
|
currentSession: () => this.state.sessionId,
|
|
8685
8689
|
sessionReferences: () => []
|
|
8686
8690
|
});
|
|
8687
|
-
this.socket =
|
|
8688
|
-
this.socket ===
|
|
8689
|
-
}, rg)),
|
|
8690
|
-
this.socket ===
|
|
8691
|
-
}),
|
|
8692
|
-
this.socket !==
|
|
8693
|
-
}), this.conversationObservation?.wake(),
|
|
8691
|
+
this.socket = a, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
8692
|
+
this.socket === a && a.readyState === WebSocket.CONNECTING && (De("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(a));
|
|
8693
|
+
}, rg)), a.addEventListener("reconnecting", (c) => {
|
|
8694
|
+
this.socket === a && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: c.detail.reason }), this.setReconnectingState());
|
|
8695
|
+
}), a.addEventListener("open", () => {
|
|
8696
|
+
this.socket !== a || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
8697
|
+
}), this.conversationObservation?.wake(), De("web-sdk.agent", "Pluno socket opened", {
|
|
8694
8698
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8695
8699
|
isThinking: this.state.isThinking
|
|
8696
8700
|
}), !(this.token ? this.sendNow({
|
|
@@ -8700,67 +8704,67 @@ class Er {
|
|
|
8700
8704
|
transportId: this.transportIdentity.transportId,
|
|
8701
8705
|
pageUrl: location.href
|
|
8702
8706
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
8703
|
-
this.socket ===
|
|
8707
|
+
this.socket === a && (De("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
|
|
8704
8708
|
}, ag));
|
|
8705
|
-
}),
|
|
8706
|
-
if (this.socket !==
|
|
8709
|
+
}), a.addEventListener("message", (c) => {
|
|
8710
|
+
if (this.socket !== a)
|
|
8707
8711
|
return;
|
|
8708
|
-
const
|
|
8709
|
-
if (
|
|
8712
|
+
const l = ec(c.data);
|
|
8713
|
+
if (a instanceof Ie && l.type === "tool.call" && !Gg(l)) {
|
|
8710
8714
|
this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
|
|
8711
8715
|
return;
|
|
8712
8716
|
}
|
|
8713
|
-
const
|
|
8714
|
-
|
|
8715
|
-
}),
|
|
8716
|
-
this.socket ===
|
|
8717
|
-
}),
|
|
8717
|
+
const u = this.handleServerEvent(l);
|
|
8718
|
+
a instanceof Ie && l.type === "tool.call" && u === !0 && a.acceptMessage(c);
|
|
8719
|
+
}), a.addEventListener("sendfailure", (c) => {
|
|
8720
|
+
this.socket === a && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), a.readyState !== WebSocket.CLOSED && a.readyState !== WebSocket.CLOSING && a.close());
|
|
8721
|
+
}), a.addEventListener("diagnosticpending", (c) => {
|
|
8718
8722
|
if (this.clientRuntime.isDisposed || this.state.status === "closed") return;
|
|
8719
|
-
const
|
|
8720
|
-
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((
|
|
8721
|
-
}),
|
|
8722
|
-
this.socket ===
|
|
8723
|
-
code: typeof
|
|
8724
|
-
reason: typeof
|
|
8725
|
-
wasClean: typeof
|
|
8723
|
+
const l = c.detail, u = new Set(l.map((d) => d.id));
|
|
8724
|
+
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((d) => !u.has(d.id)), ...l].slice(-20), this.flushClientDiagnostics();
|
|
8725
|
+
}), a.addEventListener("close", (c) => {
|
|
8726
|
+
this.socket === a && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (De("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
8727
|
+
code: typeof c?.code == "number" ? c.code : null,
|
|
8728
|
+
reason: typeof c?.reason == "string" ? c.reason : "",
|
|
8729
|
+
wasClean: typeof c?.wasClean == "boolean" ? c.wasClean : null,
|
|
8726
8730
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8727
8731
|
isThinking: this.state.isThinking
|
|
8728
|
-
}), (typeof
|
|
8729
|
-
closeCode: typeof
|
|
8730
|
-
wasClean: typeof
|
|
8732
|
+
}), (typeof c?.code != "number" || c.code !== 1e3) && this.reportTransportDiagnostic("socket_closed", {
|
|
8733
|
+
closeCode: typeof c?.code == "number" ? c.code : void 0,
|
|
8734
|
+
wasClean: typeof c?.wasClean == "boolean" ? c.wasClean : void 0
|
|
8731
8735
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
8732
|
-
}),
|
|
8733
|
-
this.socket !==
|
|
8736
|
+
}), a.addEventListener("error", () => {
|
|
8737
|
+
this.socket !== a || this.state.status === "closed" || (De("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
8734
8738
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8735
8739
|
isThinking: this.state.isThinking
|
|
8736
|
-
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(),
|
|
8737
|
-
}), e &&
|
|
8738
|
-
} catch (
|
|
8739
|
-
if (
|
|
8740
|
+
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), a.readyState !== WebSocket.CLOSED && a.readyState !== WebSocket.CLOSING && a.close());
|
|
8741
|
+
}), e && a instanceof Ie && await this.waitForConnectionOutcome(a);
|
|
8742
|
+
} catch (r) {
|
|
8743
|
+
if (i !== this.connectionAttemptId || this.state.status === "closed")
|
|
8740
8744
|
return;
|
|
8741
|
-
if (
|
|
8742
|
-
this.handleDirectoryTransportError(
|
|
8745
|
+
if (r instanceof q && (r.code === "unauthorized" || r.code === "update_required")) {
|
|
8746
|
+
this.handleDirectoryTransportError(r);
|
|
8743
8747
|
return;
|
|
8744
8748
|
}
|
|
8745
|
-
const
|
|
8746
|
-
if (ho(
|
|
8747
|
-
|
|
8748
|
-
message:
|
|
8749
|
+
const a = Os(r);
|
|
8750
|
+
if (ho(r)) {
|
|
8751
|
+
De("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
8752
|
+
message: a.message,
|
|
8749
8753
|
reconnectAttempt: this.reconnectAttempts
|
|
8750
|
-
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(
|
|
8754
|
+
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(r, "token_provider")), this.setState({
|
|
8751
8755
|
status: "reconnecting",
|
|
8752
8756
|
lastError: Ja,
|
|
8753
8757
|
lastErrorCode: "connection_failed"
|
|
8754
|
-
}), this.emit("error",
|
|
8755
|
-
|
|
8758
|
+
}), this.emit("error", a), this.scheduleReconnect(
|
|
8759
|
+
r instanceof Je ? r.retryAfterMs : void 0
|
|
8756
8760
|
);
|
|
8757
8761
|
return;
|
|
8758
8762
|
}
|
|
8759
|
-
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(
|
|
8763
|
+
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(r, "token_provider")), this.stopAuthentication(new q(a.message, "connection_failed", !1), !0), this.emit("error", a), a) : (this.setState({
|
|
8760
8764
|
status: "error",
|
|
8761
|
-
lastError:
|
|
8765
|
+
lastError: a.message,
|
|
8762
8766
|
lastErrorCode: "connection_failed"
|
|
8763
|
-
}), this.emit("error",
|
|
8767
|
+
}), this.emit("error", a), a);
|
|
8764
8768
|
} finally {
|
|
8765
8769
|
this.connectionInProgress = !1;
|
|
8766
8770
|
}
|
|
@@ -8768,7 +8772,7 @@ class Er {
|
|
|
8768
8772
|
}
|
|
8769
8773
|
disconnect() {
|
|
8770
8774
|
return this.clientRuntime.route("conversation", { core: () => {
|
|
8771
|
-
this.connectionAttemptId += 1, this.clearEmbeddedRecoveryBudget(), this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.directoryObservation.reconcile(), this.conversationObservation?.wake(), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearAllFirstResponseTimers(), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
8775
|
+
this.connectionAttemptId += 1, this.embeddedRecoveryExhausted = !1, this.clearEmbeddedRecoveryBudget(), this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.directoryObservation.reconcile(), this.conversationObservation?.wake(), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearAllFirstResponseTimers(), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
8772
8776
|
} });
|
|
8773
8777
|
}
|
|
8774
8778
|
destroy() {
|
|
@@ -8803,7 +8807,7 @@ class Er {
|
|
|
8803
8807
|
if (!s && !i.length) return null;
|
|
8804
8808
|
if (this.options.productVariant === "customer_embedded" && (i.forEach(Nl), i.reduce((y, b) => y + b.sizeBytes, 0) > Cl))
|
|
8805
8809
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
8806
|
-
const o = n.clientMessageId ??
|
|
8810
|
+
const o = n.clientMessageId ?? ze(), r = Ye(this.operationTimingReporter, {
|
|
8807
8811
|
operation: "send",
|
|
8808
8812
|
layer: "sdk",
|
|
8809
8813
|
requestId: o,
|
|
@@ -8878,7 +8882,7 @@ class Er {
|
|
|
8878
8882
|
rh(this, this.options.entrySurface, e);
|
|
8879
8883
|
}
|
|
8880
8884
|
reportInvalidStateTransition(e, n, s) {
|
|
8881
|
-
s !== void 0 && !
|
|
8885
|
+
s !== void 0 && !Au(s) || this.reportHealthSignal("invalid_state_transition", {
|
|
8882
8886
|
reason: e,
|
|
8883
8887
|
clientMessageId: n,
|
|
8884
8888
|
...s ? { uiInvariant: s } : {}
|
|
@@ -8911,11 +8915,11 @@ class Er {
|
|
|
8911
8915
|
const n = this.clientRuntime.engine.getState().slices, s = n.directory.clients[this.modelClientScopeId], i = $t(n.conversation, n.directory, s), o = fl(i, e);
|
|
8912
8916
|
if (!o) return !1;
|
|
8913
8917
|
if (o.type === "preparation") {
|
|
8914
|
-
const r =
|
|
8918
|
+
const r = ze(), a = Vp(o.submission);
|
|
8915
8919
|
return ro(this.clientRuntime, this.modelClientScopeId, r, o.submission.requestedModel), this.sendMessage(a.content, { clientMessageId: r, attachments: a.attachments }).catch((c) => this.emit("error", Os(c))), !0;
|
|
8916
8920
|
}
|
|
8917
8921
|
return o.type === "delivery" ? (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: o.userMessageId, now: Date.now(), manualRetry: !0 }), !0) : (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
|
|
8918
|
-
request_id:
|
|
8922
|
+
request_id: ze(),
|
|
8919
8923
|
type: "chat.retry_last_user_message",
|
|
8920
8924
|
payload: {
|
|
8921
8925
|
sessionId: o.sessionId,
|
|
@@ -8926,7 +8930,7 @@ class Er {
|
|
|
8926
8930
|
}
|
|
8927
8931
|
createLocalAttachment(e) {
|
|
8928
8932
|
this.options.productVariant === "customer_embedded" && Ll(e);
|
|
8929
|
-
const n =
|
|
8933
|
+
const n = ze(), s = {
|
|
8930
8934
|
id: n,
|
|
8931
8935
|
name: e.name || "attachment",
|
|
8932
8936
|
mimeType: Dl(e),
|
|
@@ -8943,7 +8947,7 @@ class Er {
|
|
|
8943
8947
|
lastUsedAt: i
|
|
8944
8948
|
});
|
|
8945
8949
|
return this.attachmentPersistence.set(n, o), o.catch((r) => {
|
|
8946
|
-
|
|
8950
|
+
De("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
8947
8951
|
attachmentId: n,
|
|
8948
8952
|
name: s.name,
|
|
8949
8953
|
message: r instanceof Error ? r.message : String(r)
|
|
@@ -9005,9 +9009,9 @@ class Er {
|
|
|
9005
9009
|
});
|
|
9006
9010
|
};
|
|
9007
9011
|
let r = !1;
|
|
9008
|
-
return
|
|
9012
|
+
return Af(async () => {
|
|
9009
9013
|
let a = await o(!1);
|
|
9010
|
-
if (i(), !a.ok && qf(a.status) && this.options.tokenProvider && !r && (r = !0, a = await o(!0), i()), !a.ok) throw new
|
|
9014
|
+
if (i(), !a.ok && qf(a.status) && this.options.tokenProvider && !r && (r = !0, a = await o(!0), i()), !a.ok) throw new zl("Failed to prepare attachment upload", a.status);
|
|
9011
9015
|
return await a.json();
|
|
9012
9016
|
}, "Failed to prepare attachment upload");
|
|
9013
9017
|
}
|
|
@@ -9016,7 +9020,7 @@ class Er {
|
|
|
9016
9020
|
Ye((n) => this.reportOperationTiming(n), {
|
|
9017
9021
|
operation: "stop",
|
|
9018
9022
|
layer: "sdk",
|
|
9019
|
-
requestId:
|
|
9023
|
+
requestId: ze(),
|
|
9020
9024
|
clientMessageId: e.activeResponseUserMessageId ?? e.messages.filter((n) => n.role === "user").slice(-1)[0]?.id ?? null,
|
|
9021
9025
|
sessionId: e.sessionId
|
|
9022
9026
|
}).mark("stop"), this.stopConversation("user_requested");
|
|
@@ -9033,7 +9037,7 @@ class Er {
|
|
|
9033
9037
|
type: "conversation.stop",
|
|
9034
9038
|
clientScopeId: this.modelClientScopeId,
|
|
9035
9039
|
conversationScopeId: s,
|
|
9036
|
-
requestId:
|
|
9040
|
+
requestId: ze(),
|
|
9037
9041
|
reason: e
|
|
9038
9042
|
});
|
|
9039
9043
|
}
|
|
@@ -9043,7 +9047,7 @@ class Er {
|
|
|
9043
9047
|
resetConversationSelection(e) {
|
|
9044
9048
|
const n = this.getState();
|
|
9045
9049
|
this.retainNavigatedConversation(), !this.options.keepRunsActiveOnSessionNavigation && e.notifyTransport !== !1 && this.stopConversation("new_chat"), this.cleanupSessionBrowserApis(), e.notifyTransport !== !1 && n.sessionId && this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
|
|
9046
|
-
request_id:
|
|
9050
|
+
request_id: ze(),
|
|
9047
9051
|
type: "session.reset",
|
|
9048
9052
|
payload: {
|
|
9049
9053
|
sessionId: n.sessionId,
|
|
@@ -9108,7 +9112,7 @@ class Er {
|
|
|
9108
9112
|
}
|
|
9109
9113
|
setSessionPinned(e, n) {
|
|
9110
9114
|
return this.clientRuntime.route("directory", { core: async () => {
|
|
9111
|
-
const s =
|
|
9115
|
+
const s = ze();
|
|
9112
9116
|
await this.clientRuntime.engine.dispatch({
|
|
9113
9117
|
...this.directoryAuthority,
|
|
9114
9118
|
type: "directory.mutate",
|
|
@@ -9128,7 +9132,7 @@ class Er {
|
|
|
9128
9132
|
}
|
|
9129
9133
|
renameSession(e, n) {
|
|
9130
9134
|
return this.clientRuntime.route("directory", { core: async () => {
|
|
9131
|
-
const s =
|
|
9135
|
+
const s = ze();
|
|
9132
9136
|
await this.clientRuntime.engine.dispatch({
|
|
9133
9137
|
...this.directoryAuthority,
|
|
9134
9138
|
type: "directory.mutate",
|
|
@@ -9231,7 +9235,7 @@ class Er {
|
|
|
9231
9235
|
const n = this.clientRuntime.engine.getProjection().directory;
|
|
9232
9236
|
if (Object.values(n.optimisticEntries).some((i) => i.id === e && i.sessionId === null)) return;
|
|
9233
9237
|
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.stopConversation("session_switch"), this.retainNavigatedConversation();
|
|
9234
|
-
const s = "conversation:" + this.modelClientScopeId + ":" +
|
|
9238
|
+
const s = "conversation:" + this.modelClientScopeId + ":" + ze();
|
|
9235
9239
|
this.directoryConversationScopeId = s, this.lastUserMessagePageUrl = null, this.draftModelExplicit = !1, this.draftModel = this.options.model ?? "gpt-6.1-sol", this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: e }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, e).then(async () => {
|
|
9236
9240
|
await this.directoryScope.persist(), this.state.sessionId === e && (n.intents[e]?.observe && this.conversationObservation?.refresh(e).catch((i) => this.handleDirectoryTransportError(i)), this.send({ type: "page.upsert", sessionId: e, page: bt(), model: this.getModel() }));
|
|
9237
9241
|
});
|
|
@@ -9244,7 +9248,7 @@ class Er {
|
|
|
9244
9248
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
9245
9249
|
return !1;
|
|
9246
9250
|
const n = this.socket;
|
|
9247
|
-
if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof
|
|
9251
|
+
if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof Ie) {
|
|
9248
9252
|
const s = this.queuedClientEvents.find((i) => "sessionId" in i && i.sessionId === e.sessionId && (e.type === "tool.result" && i.type === "tool.result" && i.callId === e.callId || e.type === "run.stop" && i.type === "run.stop" && i.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
|
|
9249
9253
|
return this.queuedClientEvents.includes(s) || this.queuedClientEvents.push(s), on(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(s) || (this.pendingRetainedCommandDeliveries.add(s), n.sendRetainedCommand(it(s)).then((i) => {
|
|
9250
9254
|
this.pendingRetainedCommandDeliveries.delete(s), i && (this.queuedClientEvents = this.queuedClientEvents.filter((o) => o !== s), on(this.options.clientId, this.queuedClientEvents));
|
|
@@ -9253,7 +9257,7 @@ class Er {
|
|
|
9253
9257
|
try {
|
|
9254
9258
|
return n.send(JSON.stringify(e)), _n("client_event", e.type, co(e)), !0;
|
|
9255
9259
|
} catch (s) {
|
|
9256
|
-
return
|
|
9260
|
+
return De("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
9257
9261
|
message: s instanceof Error ? s.message : String(s),
|
|
9258
9262
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9259
9263
|
isThinking: this.state.isThinking
|
|
@@ -9315,7 +9319,7 @@ class Er {
|
|
|
9315
9319
|
signal: o
|
|
9316
9320
|
}));
|
|
9317
9321
|
} catch (m) {
|
|
9318
|
-
|
|
9322
|
+
De("web-sdk.agent", "Pluno health signal send failed", {
|
|
9319
9323
|
name: e,
|
|
9320
9324
|
message: m instanceof Error ? m.message : String(m)
|
|
9321
9325
|
}), this.queueHealthDiagnostic(o);
|
|
@@ -9382,7 +9386,7 @@ class Er {
|
|
|
9382
9386
|
reportTransportDiagnostic(e, n = {}) {
|
|
9383
9387
|
const s = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online";
|
|
9384
9388
|
n.stage && (this.lastRecoveryStage = n.stage);
|
|
9385
|
-
const i = n.connectionAttemptId ?? (this.socket instanceof
|
|
9389
|
+
const i = n.connectionAttemptId ?? (this.socket instanceof Ie ? this.socket.connectionAttempt?.connectionAttemptId ?? this.recoveryDiagnosticId : this.recoveryDiagnosticId), o = `${n.stage ?? "socket_admission"}:${e}:${n.recoveryOutcome ?? "none"}:${n.httpStatus ?? "none"}:${n.requestId ?? i}:${n.closeCode ?? "none"}:${n.disconnectReason ?? "none"}:${s}`, r = (/* @__PURE__ */ new Date()).toISOString(), a = this.transportDiagnosticEpisodes.get(o), c = {
|
|
9386
9390
|
id: a?.id ?? crypto.randomUUID(),
|
|
9387
9391
|
phase: e,
|
|
9388
9392
|
entrySurface: this.options.entrySurface,
|
|
@@ -9478,7 +9482,7 @@ class Er {
|
|
|
9478
9482
|
}, 3e4));
|
|
9479
9483
|
}
|
|
9480
9484
|
requestTransientStarterPrompts() {
|
|
9481
|
-
const e = it(
|
|
9485
|
+
const e = it(Bg());
|
|
9482
9486
|
return su(this.clientRuntime, {
|
|
9483
9487
|
kind: "generatePrompts",
|
|
9484
9488
|
page: { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: e.pageUrl },
|
|
@@ -9488,7 +9492,7 @@ class Er {
|
|
|
9488
9492
|
});
|
|
9489
9493
|
}
|
|
9490
9494
|
startStarterPromptUrlWatcher() {
|
|
9491
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
9495
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = zg(() => this.handleStarterPromptUrlChange()));
|
|
9492
9496
|
}
|
|
9493
9497
|
handleStarterPromptUrlChange() {
|
|
9494
9498
|
const e = location.href;
|
|
@@ -9513,7 +9517,7 @@ class Er {
|
|
|
9513
9517
|
}
|
|
9514
9518
|
flushQueuedClientEvents() {
|
|
9515
9519
|
const e = [...this.queuedClientEvents];
|
|
9516
|
-
this.queuedClientEvents = this.queuedClientEvents.filter((n) => (n.type === "tool.result" || n.type === "run.stop") && this.socket instanceof
|
|
9520
|
+
this.queuedClientEvents = this.queuedClientEvents.filter((n) => (n.type === "tool.result" || n.type === "run.stop") && this.socket instanceof Ie), on(this.options.clientId, this.queuedClientEvents);
|
|
9517
9521
|
for (let n = 0; n < e.length; n++)
|
|
9518
9522
|
if (!this.sendNow(it(e[n]))) {
|
|
9519
9523
|
this.queuedClientEvents.unshift(...e.slice(n).filter((s) => !this.queuedClientEvents.includes(s)));
|
|
@@ -9532,7 +9536,7 @@ class Er {
|
|
|
9532
9536
|
const u = this.directoryAuthority;
|
|
9533
9537
|
this.directoryObservation.dispose(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.directoryAuthority = { authorityId: i, generation: u.generation + 1 }, this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "directory.authority_replace", expectedGeneration: u.generation }), this.createDirectoryAdapters();
|
|
9534
9538
|
const d = r ? this.draftModel : void 0, h = this.draftModelExplicit;
|
|
9535
|
-
r || (this.pendingWidgetLifecycleEvents = []), this.resetForAuthenticationScopeChange(), c && (this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${
|
|
9539
|
+
r || (this.pendingWidgetLifecycleEvents = []), this.resetForAuthenticationScopeChange(), c && (this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${ze()}`, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: c }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, c).then(() => this.directoryScope.persist())), d && (this.draftModel = d, this.draftModelExplicit = h, this.emit("state", this.getState()));
|
|
9536
9540
|
}
|
|
9537
9541
|
const l = {
|
|
9538
9542
|
...this.directoryAuthority,
|
|
@@ -9660,7 +9664,7 @@ class Er {
|
|
|
9660
9664
|
}
|
|
9661
9665
|
if ((e.code === "unauthorized" || e.code === "401") && e.reason === "token_expired" && e.retryable === !0 && this.options.tokenProvider) {
|
|
9662
9666
|
const n = this.socket;
|
|
9663
|
-
n instanceof
|
|
9667
|
+
n instanceof Ie ? this.refreshDefaultTransportCredentials(n) : (this.invalidateProviderToken(), this.startEmbeddedRecoveryBudget(!0), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.setReconnectingState(), this.socket = null, this.scheduleReconnect(), n?.close());
|
|
9664
9668
|
return;
|
|
9665
9669
|
}
|
|
9666
9670
|
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")) {
|
|
@@ -9774,10 +9778,30 @@ class Er {
|
|
|
9774
9778
|
if (this.pageLifecycleCleanup)
|
|
9775
9779
|
return;
|
|
9776
9780
|
const e = () => {
|
|
9777
|
-
Pl(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
9781
|
+
Pl(this.options.clientId, this.activeBrowserToolCalls.values()), this.embeddedRecoverySuspended = !0;
|
|
9778
9782
|
};
|
|
9779
|
-
|
|
9780
|
-
|
|
9783
|
+
let n = null;
|
|
9784
|
+
const s = () => this.options.productVariant === "customer_embedded" && document.visibilityState === "visible" && navigator.onLine !== !1 && !this.clientRuntime.isDisposed && (this.state.status === "reconnecting" || this.embeddedRecoveryExhausted) && (!this.authenticationFailure || this.embeddedRecoveryExhausted), i = () => {
|
|
9785
|
+
document.visibilityState === "visible" && navigator.onLine !== !1 && this.state.status === "connected" && (this.embeddedRecoverySuspended = !1), !(!s() || n !== null) && (n = window.setTimeout(() => {
|
|
9786
|
+
if (n = null, !!s()) {
|
|
9787
|
+
if (this.embeddedRecoverySuspended) {
|
|
9788
|
+
const a = this.embeddedRecoveryTokenExpired;
|
|
9789
|
+
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget(a);
|
|
9790
|
+
}
|
|
9791
|
+
this.connectionInProgress || this.credentialRecovery || (this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.socket instanceof Ie && !this.authenticationFailure ? this.refreshingDefaultCredentials ? this.refreshDefaultTransportCredentials(this.socket) : this.socket.retryReadiness() : this.connect().catch((a) => {
|
|
9792
|
+
De("web-sdk.agent", "Pluno resume recovery did not complete", {
|
|
9793
|
+
message: a instanceof Error ? a.message : String(a)
|
|
9794
|
+
});
|
|
9795
|
+
}));
|
|
9796
|
+
}
|
|
9797
|
+
}, 0));
|
|
9798
|
+
}, o = () => {
|
|
9799
|
+
document.visibilityState === "hidden" ? this.embeddedRecoverySuspended = !0 : i();
|
|
9800
|
+
}, r = () => {
|
|
9801
|
+
this.embeddedRecoverySuspended = !0;
|
|
9802
|
+
};
|
|
9803
|
+
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), window.addEventListener("online", i), window.addEventListener("offline", r), window.addEventListener("pageshow", i), document.addEventListener("visibilitychange", o), this.pageLifecycleCleanup = () => {
|
|
9804
|
+
n !== null && window.clearTimeout(n), window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e), window.removeEventListener("online", i), window.removeEventListener("offline", r), window.removeEventListener("pageshow", i), document.removeEventListener("visibilitychange", o);
|
|
9781
9805
|
};
|
|
9782
9806
|
}
|
|
9783
9807
|
installSessionBrowserApis() {
|
|
@@ -9811,26 +9835,36 @@ class Er {
|
|
|
9811
9835
|
}
|
|
9812
9836
|
startEmbeddedRecoveryBudget(e = !1) {
|
|
9813
9837
|
if (this.options.productVariant !== "customer_embedded" || this.authenticationFailure) return;
|
|
9838
|
+
if (this.embeddedRecoverySuspended || document.visibilityState === "hidden" || navigator.onLine === !1) {
|
|
9839
|
+
this.embeddedRecoverySuspended = !0, this.embeddedRecoveryTokenExpired ||= e;
|
|
9840
|
+
return;
|
|
9841
|
+
}
|
|
9814
9842
|
if (this.embeddedRecoveryTimer !== null) {
|
|
9815
9843
|
if (!e || this.embeddedRecoveryTokenExpired || !this.authenticatedUserId) return;
|
|
9816
9844
|
this.clearEmbeddedRecoveryBudget();
|
|
9817
9845
|
}
|
|
9818
9846
|
this.embeddedRecoveryTokenExpired = e, this.recoveryDiagnosticId = crypto.randomUUID();
|
|
9819
|
-
const n = this.authenticatedUserId ? (e ? 30 : 10) * 6e4 : 12e4
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9847
|
+
const n = this.authenticatedUserId ? (e ? 30 : 10) * 6e4 : 12e4, s = window.setTimeout(() => {
|
|
9848
|
+
if (this.embeddedRecoveryTimer === s) {
|
|
9849
|
+
if (this.embeddedRecoveryTimer = null, this.embeddedRecoverySuspended || document.visibilityState === "hidden" || navigator.onLine === !1) {
|
|
9850
|
+
this.embeddedRecoverySuspended = !0;
|
|
9851
|
+
return;
|
|
9852
|
+
}
|
|
9853
|
+
this.connectionAttemptId += 1, this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.connectionInProgress = !1, this.reportTransportDiagnostic("auth_refresh_failed", {
|
|
9854
|
+
stage: this.lastRecoveryStage,
|
|
9855
|
+
recoveryOutcome: "exhausted",
|
|
9856
|
+
failureKind: "temporary"
|
|
9857
|
+
}), this.stopAuthentication(new q(
|
|
9858
|
+
"Chat could not reconnect. Your conversation and draft are saved here. Try again.",
|
|
9859
|
+
"connection_failed",
|
|
9860
|
+
!1
|
|
9861
|
+
), !0), this.embeddedRecoveryExhausted = !0;
|
|
9862
|
+
}
|
|
9830
9863
|
}, n);
|
|
9864
|
+
this.embeddedRecoveryTimer = s;
|
|
9831
9865
|
}
|
|
9832
9866
|
clearEmbeddedRecoveryBudget() {
|
|
9833
|
-
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null, this.embeddedRecoveryTokenExpired = !1;
|
|
9867
|
+
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null, this.embeddedRecoveryTokenExpired = !1, this.embeddedRecoverySuspended = !1;
|
|
9834
9868
|
}
|
|
9835
9869
|
connectionFailureDiagnostic(e, n) {
|
|
9836
9870
|
const s = e instanceof Je ? e.status : e instanceof q && e.code === "unauthorized" ? 401 : e instanceof q && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, i = s !== void 0 && Number.isInteger(s) && s >= 400 && s <= 599 ? s : void 0, r = !(e instanceof q && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && ho(e) && i !== 401 && i !== 403;
|
|
@@ -9849,8 +9883,8 @@ class Er {
|
|
|
9849
9883
|
Math.max(bg(this.reconnectAttempts), e)
|
|
9850
9884
|
);
|
|
9851
9885
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
9852
|
-
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof
|
|
9853
|
-
|
|
9886
|
+
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof Ie ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((i) => {
|
|
9887
|
+
De("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
9854
9888
|
message: i instanceof Error ? i.message : String(i),
|
|
9855
9889
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9856
9890
|
isThinking: this.state.isThinking
|
|
@@ -9890,11 +9924,11 @@ class Er {
|
|
|
9890
9924
|
authReason: ["invalid_token", "token_expired", "missing_token", "user_not_found"].includes(n?.reason ?? "") ? n.reason : "unknown",
|
|
9891
9925
|
authTransport: n?.authTransport === "http" ? "http" : "socket",
|
|
9892
9926
|
...n?.requestId && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(n.requestId) ? { requestId: n.requestId, .../^(runtime|embed|extension|conversations):(snapshot|me|bootstrap|commands|activity|session-history|other)$/.test(n.authEndpoint ?? "") ? { authEndpoint: n.authEndpoint } : {} } : {},
|
|
9893
|
-
...this.socket instanceof
|
|
9927
|
+
...this.socket instanceof Ie ? { connectionAttemptId: this.socket.connectionAttempt?.connectionAttemptId } : {}
|
|
9894
9928
|
};
|
|
9895
9929
|
}
|
|
9896
9930
|
stopAuthentication(e, n = !1) {
|
|
9897
|
-
n || this.reportTransportDiagnostic("auth_rejected", {
|
|
9931
|
+
this.embeddedRecoveryExhausted = !1, n || this.reportTransportDiagnostic("auth_rejected", {
|
|
9898
9932
|
...this.authenticationDiagnostic(e),
|
|
9899
9933
|
failureKind: "permanent",
|
|
9900
9934
|
recoveryOutcome: "refused"
|
|
@@ -9911,7 +9945,7 @@ class Er {
|
|
|
9911
9945
|
if (this.credentialRecovery) return this.credentialRecovery;
|
|
9912
9946
|
if (this.directoryHttp.auth.token !== e) return;
|
|
9913
9947
|
const o = this.socket;
|
|
9914
|
-
if (o instanceof
|
|
9948
|
+
if (o instanceof Ie) return this.refreshCredentials(o, n);
|
|
9915
9949
|
if (this.options.webSocketFactory) throw n;
|
|
9916
9950
|
}
|
|
9917
9951
|
throw this.stopAuthentication(n), n;
|
|
@@ -9948,7 +9982,7 @@ class Er {
|
|
|
9948
9982
|
}
|
|
9949
9983
|
async refreshDefaultTransportCredentials(e) {
|
|
9950
9984
|
this.authenticationFailure || await this.refreshCredentials(e).catch((n) => {
|
|
9951
|
-
|
|
9985
|
+
De("web-sdk.agent", "Pluno credential refresh did not complete", {
|
|
9952
9986
|
message: n instanceof Error ? n.message : String(n)
|
|
9953
9987
|
});
|
|
9954
9988
|
});
|
|
@@ -9957,7 +9991,7 @@ class Er {
|
|
|
9957
9991
|
this.stopHeartbeat(), this.options.webSocketFactory && (this.heartbeatTimer = window.setInterval(() => {
|
|
9958
9992
|
const e = this.socket;
|
|
9959
9993
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
9960
|
-
this.socket === e && (
|
|
9994
|
+
this.socket === e && (De("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
9961
9995
|
}, sg));
|
|
9962
9996
|
}, ng));
|
|
9963
9997
|
}
|
|
@@ -9983,7 +10017,7 @@ class Er {
|
|
|
9983
10017
|
this.clientRuntime.isDisposed || (this.state = e, this.rebuildRuntimeInteractions(), this.emit("state", this.getState()));
|
|
9984
10018
|
}
|
|
9985
10019
|
setReconnectingState() {
|
|
9986
|
-
if (this.authenticationFailure || this.state.status === "closed" || (this.startEmbeddedRecoveryBudget(), this.socket instanceof
|
|
10020
|
+
if (this.authenticationFailure || this.state.status === "closed" || (this.startEmbeddedRecoveryBudget(), this.socket instanceof Ie && this.socket.initialReadinessExpired)) return;
|
|
9987
10021
|
this.conversationObservation?.wake();
|
|
9988
10022
|
const e = this.state.lastError !== null && (!this.state.isThinking || this.state.lastErrorCode === "connection_failed");
|
|
9989
10023
|
this.setState({
|
|
@@ -10064,7 +10098,7 @@ function vg() {
|
|
|
10064
10098
|
}), v;
|
|
10065
10099
|
}, c = function(f, m) {
|
|
10066
10100
|
const g = i.call(this, f, m), y = fo.get(this);
|
|
10067
|
-
return y && Object.keys(y.requestHeaders).length < kr && (y.requestHeaders[f] =
|
|
10101
|
+
return y && Object.keys(y.requestHeaders).length < kr && (y.requestHeaders[f] = Ar(f, m), y.excluded = y.excluded || vn(y.url, y.requestHeaders)), g;
|
|
10068
10102
|
}, l = function(f) {
|
|
10069
10103
|
try {
|
|
10070
10104
|
const m = fo.get(this);
|
|
@@ -10073,7 +10107,7 @@ function vg() {
|
|
|
10073
10107
|
() => {
|
|
10074
10108
|
queueMicrotask(() => {
|
|
10075
10109
|
try {
|
|
10076
|
-
const g =
|
|
10110
|
+
const g = Rf(this.getAllResponseHeaders());
|
|
10077
10111
|
e({
|
|
10078
10112
|
requestId: m.requestId,
|
|
10079
10113
|
url: m.url,
|
|
@@ -10164,7 +10198,7 @@ function vg() {
|
|
|
10164
10198
|
};
|
|
10165
10199
|
return window.__plunoProductAgentNetworkCapture = d, d;
|
|
10166
10200
|
}
|
|
10167
|
-
function
|
|
10201
|
+
function De(t, e, n) {
|
|
10168
10202
|
if (typeof window > "u")
|
|
10169
10203
|
return;
|
|
10170
10204
|
const s = window, i = {
|
|
@@ -10199,11 +10233,11 @@ function Eg() {
|
|
|
10199
10233
|
});
|
|
10200
10234
|
}
|
|
10201
10235
|
async function Cg(t, e = {}) {
|
|
10202
|
-
const n = Mg(e.name), s = await
|
|
10236
|
+
const n = Mg(e.name), s = await Rg(t);
|
|
10203
10237
|
return s.ok ? s.sizeBytes > 8 * 1024 * 1024 ? {
|
|
10204
10238
|
type: "pluno.pageImages.inspectImage",
|
|
10205
10239
|
imageAttached: !1,
|
|
10206
|
-
imageAttachmentError:
|
|
10240
|
+
imageAttachmentError: Rl
|
|
10207
10241
|
} : {
|
|
10208
10242
|
type: "pluno.pageImages.inspectImage",
|
|
10209
10243
|
imageAttached: !0,
|
|
@@ -10217,15 +10251,15 @@ async function Cg(t, e = {}) {
|
|
|
10217
10251
|
imageAttachmentError: s.error
|
|
10218
10252
|
};
|
|
10219
10253
|
}
|
|
10220
|
-
async function
|
|
10221
|
-
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error:
|
|
10254
|
+
async function Rg(t) {
|
|
10255
|
+
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error: Rl } : {
|
|
10222
10256
|
ok: !0,
|
|
10223
10257
|
mimeType: t.type,
|
|
10224
10258
|
sizeBytes: t.size,
|
|
10225
10259
|
dataUrl: await qg(t)
|
|
10226
|
-
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } :
|
|
10260
|
+
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Ag(t);
|
|
10227
10261
|
}
|
|
10228
|
-
function
|
|
10262
|
+
function Ag(t) {
|
|
10229
10263
|
if (!t.startsWith("data:") || !t.includes(","))
|
|
10230
10264
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
10231
10265
|
const [e, n] = t.slice(5).split(",", 2), s = e.split(";").map((a) => a.trim()).filter(Boolean), i = s[0] ?? "";
|
|
@@ -10356,14 +10390,14 @@ function bt() {
|
|
|
10356
10390
|
...t ? { plunoProductAgentUi: t } : {}
|
|
10357
10391
|
};
|
|
10358
10392
|
}
|
|
10359
|
-
function
|
|
10393
|
+
function Bg() {
|
|
10360
10394
|
return {
|
|
10361
10395
|
pageUrl: location.href,
|
|
10362
10396
|
pageTitle: document.title,
|
|
10363
10397
|
htmlContent: Cr()
|
|
10364
10398
|
};
|
|
10365
10399
|
}
|
|
10366
|
-
function
|
|
10400
|
+
function zg(t) {
|
|
10367
10401
|
return Js.add(t), qs || (qs = jg()), () => {
|
|
10368
10402
|
Js.delete(t), Js.size === 0 && (qs?.(), qs = null);
|
|
10369
10403
|
};
|
|
@@ -10392,7 +10426,7 @@ function Cr() {
|
|
|
10392
10426
|
};
|
|
10393
10427
|
n("Selected text", window.getSelection()?.toString() ?? "");
|
|
10394
10428
|
const s = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(s)).filter(
|
|
10395
|
-
(g) =>
|
|
10429
|
+
(g) => Al(g) && !g.parentElement?.closest(s)
|
|
10396
10430
|
);
|
|
10397
10431
|
for (const g of i.slice(0, 3))
|
|
10398
10432
|
n("Active overlay", mo(rs(g), e));
|
|
@@ -10425,12 +10459,12 @@ function mo(t, e) {
|
|
|
10425
10459
|
n = n.replace(s, "");
|
|
10426
10460
|
return En(n);
|
|
10427
10461
|
}
|
|
10428
|
-
function
|
|
10462
|
+
function Al(t) {
|
|
10429
10463
|
const e = window.getComputedStyle(t);
|
|
10430
10464
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
10431
10465
|
}
|
|
10432
10466
|
function Fg() {
|
|
10433
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
10467
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Al).sort((t, e) => rs(e).length - rs(t).length)[0] ?? null;
|
|
10434
10468
|
}
|
|
10435
10469
|
function $g(t, e) {
|
|
10436
10470
|
const n = /* @__PURE__ */ new Set([
|
|
@@ -10523,25 +10557,25 @@ function $g(t, e) {
|
|
|
10523
10557
|
return `${_.tagName.toLowerCase()}|${m(_)}|${I}`;
|
|
10524
10558
|
}, y = (_, I, k) => {
|
|
10525
10559
|
const T = (O, V) => {
|
|
10526
|
-
const E = O.tagName.toLowerCase(),
|
|
10527
|
-
if (f >= 1e3 && !P || k.has(O) || o.has(E) || O.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") ||
|
|
10560
|
+
const E = O.tagName.toLowerCase(), z = window.getComputedStyle(O), P = u.has(O);
|
|
10561
|
+
if (f >= 1e3 && !P || k.has(O) || o.has(E) || O.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || z.display === "none" || z.visibility === "hidden")
|
|
10528
10562
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
10529
10563
|
f += 1;
|
|
10530
10564
|
const G = m(O), U = Ml(O), S = a.has(G) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(E) || E === "a" && O.hasAttribute("href"), D = Array.from(O.children).filter((C) => C instanceof HTMLElement), Z = /* @__PURE__ */ new Map();
|
|
10531
10565
|
for (const C of D) {
|
|
10532
|
-
const
|
|
10533
|
-
Z.set(
|
|
10566
|
+
const B = g(C);
|
|
10567
|
+
Z.set(B, (Z.get(B) ?? 0) + 1);
|
|
10534
10568
|
}
|
|
10535
10569
|
const J = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
|
|
10536
10570
|
for (const C of D) {
|
|
10537
|
-
const
|
|
10538
|
-
ce.set(
|
|
10571
|
+
const B = g(C), Y = ce.get(B) ?? 0;
|
|
10572
|
+
ce.set(B, Y + 1), (Z.get(B) ?? 0) > 8 && Y >= 6 && !u.has(C) && J.set(B, (J.get(B) ?? 0) + 1);
|
|
10539
10573
|
}
|
|
10540
10574
|
const le = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Set(), ke = [], N = [];
|
|
10541
10575
|
for (const C of D) {
|
|
10542
|
-
const
|
|
10543
|
-
if (le.set(
|
|
10544
|
-
he.has(
|
|
10576
|
+
const B = g(C), Y = Z.get(B) ?? 0, re = le.get(B) ?? 0;
|
|
10577
|
+
if (le.set(B, re + 1), Y > 8 && re >= 6 && !u.has(C)) {
|
|
10578
|
+
he.has(B) || (ke.push([`… ${J.get(B) ?? 0} similar siblings omitted`]), he.add(B));
|
|
10545
10579
|
continue;
|
|
10546
10580
|
}
|
|
10547
10581
|
const j = T(C, V);
|
|
@@ -10551,12 +10585,12 @@ function $g(t, e) {
|
|
|
10551
10585
|
if (O.shadowRoot)
|
|
10552
10586
|
for (const C of Array.from(O.shadowRoot.children))
|
|
10553
10587
|
C instanceof HTMLElement && _e.push(T(C, V + 1));
|
|
10554
|
-
const
|
|
10555
|
-
[U, ...
|
|
10556
|
-
).slice(0, 180), Ce = O.hasAttribute("contenteditable") && (U.length > 0 || !O.querySelector("[contenteditable]")), et = l.some((C) => O.hasAttribute(C)) || !!G || Ce, Pe = (O.getClientRects().length > 0 ||
|
|
10588
|
+
const Ue = [...N, ..._e], be = U.length > 0 || S || Ue.some((C) => C.hasUsefulContent), Ze = En(
|
|
10589
|
+
[U, ...Ue.map((C) => C.textPreview)].filter(Boolean).join(" ")
|
|
10590
|
+
).slice(0, 180), Ce = O.hasAttribute("contenteditable") && (U.length > 0 || !O.querySelector("[contenteditable]")), et = l.some((C) => O.hasAttribute(C)) || !!G || Ce, Pe = (O.getClientRects().length > 0 || z.display === "contents") && (n.has(E) || et || P) && (be || P) && (!i.has(E) || be || et || P), H = Pe ? 1 : 0, oe = [];
|
|
10557
10591
|
if (Pe) {
|
|
10558
|
-
const C =
|
|
10559
|
-
oe.push(Tl(O, c, r,
|
|
10592
|
+
const C = Ue.some((Y) => Y.containsTextElement), B = s.has(E) && !C ? Ze : U;
|
|
10593
|
+
oe.push(Tl(O, c, r, B.slice(0, 180)));
|
|
10560
10594
|
}
|
|
10561
10595
|
for (const C of ke)
|
|
10562
10596
|
oe.push(...Ds(C, H));
|
|
@@ -10564,8 +10598,8 @@ function $g(t, e) {
|
|
|
10564
10598
|
if (x.length > 0) {
|
|
10565
10599
|
const C = x.slice(0, 20);
|
|
10566
10600
|
x.length > C.length && C.push("… shadow DOM omitted");
|
|
10567
|
-
const
|
|
10568
|
-
if (V < 2 && !
|
|
10601
|
+
const B = E.includes("tooltip") || E.includes("popper") || E.includes("loader");
|
|
10602
|
+
if (V < 2 && !B) {
|
|
10569
10603
|
const Y = Pe ? "#shadow-root" : `${E} #shadow-root`;
|
|
10570
10604
|
oe.push(...Ds([Y, ...Ds(C, 1)], H));
|
|
10571
10605
|
} else
|
|
@@ -10575,7 +10609,7 @@ function $g(t, e) {
|
|
|
10575
10609
|
lines: oe,
|
|
10576
10610
|
hasUsefulContent: be,
|
|
10577
10611
|
textPreview: Ze,
|
|
10578
|
-
containsTextElement: s.has(E) ||
|
|
10612
|
+
containsTextElement: s.has(E) || Ue.some((C) => C.containsTextElement)
|
|
10579
10613
|
};
|
|
10580
10614
|
};
|
|
10581
10615
|
return [`--- ${I} ---`, ...T(_, 0).lines].join(`
|
|
@@ -10791,7 +10825,7 @@ function ef() {
|
|
|
10791
10825
|
const n = crypto.randomUUID();
|
|
10792
10826
|
return window.localStorage.setItem(t, n), n;
|
|
10793
10827
|
}
|
|
10794
|
-
function
|
|
10828
|
+
function ze() {
|
|
10795
10829
|
return crypto.randomUUID();
|
|
10796
10830
|
}
|
|
10797
10831
|
function tc(t) {
|
|
@@ -10824,10 +10858,10 @@ function tf(t, e) {
|
|
|
10824
10858
|
e
|
|
10825
10859
|
),
|
|
10826
10860
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10827
|
-
...
|
|
10861
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10828
10862
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10829
|
-
respondsToUserMessageId:
|
|
10830
|
-
...
|
|
10863
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10864
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10831
10865
|
dataType: "assistant_draft",
|
|
10832
10866
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
10833
10867
|
};
|
|
@@ -10841,10 +10875,10 @@ function tf(t, e) {
|
|
|
10841
10875
|
e
|
|
10842
10876
|
),
|
|
10843
10877
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10844
|
-
...
|
|
10878
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10845
10879
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10846
|
-
respondsToUserMessageId:
|
|
10847
|
-
...
|
|
10880
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10881
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10848
10882
|
attachments: ql(i.attachments, e),
|
|
10849
10883
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
10850
10884
|
};
|
|
@@ -10860,16 +10894,16 @@ function tf(t, e) {
|
|
|
10860
10894
|
}), r;
|
|
10861
10895
|
}
|
|
10862
10896
|
if (i.type === "function_call_output") {
|
|
10863
|
-
const o =
|
|
10897
|
+
const o = Rh(i.output);
|
|
10864
10898
|
if (o !== null)
|
|
10865
10899
|
return {
|
|
10866
10900
|
id: String(n.id ?? crypto.randomUUID()),
|
|
10867
10901
|
role: "tool",
|
|
10868
10902
|
content: "",
|
|
10869
10903
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10870
|
-
...
|
|
10871
|
-
respondsToUserMessageId:
|
|
10872
|
-
...
|
|
10904
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10905
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10906
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10873
10907
|
dataType: "function_call_output",
|
|
10874
10908
|
toolName: Sl,
|
|
10875
10909
|
callId: Yn(i) ?? void 0,
|
|
@@ -10882,9 +10916,9 @@ function tf(t, e) {
|
|
|
10882
10916
|
role: "tool",
|
|
10883
10917
|
content: "",
|
|
10884
10918
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10885
|
-
...
|
|
10886
|
-
respondsToUserMessageId:
|
|
10887
|
-
...
|
|
10919
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10920
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10921
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10888
10922
|
dataType: "scheduled_check_in",
|
|
10889
10923
|
toolName: kl,
|
|
10890
10924
|
callId: Yn(i) ?? void 0,
|
|
@@ -10897,10 +10931,10 @@ function tf(t, e) {
|
|
|
10897
10931
|
role: "tool",
|
|
10898
10932
|
content: `Connect ${a.appName} to continue`,
|
|
10899
10933
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10900
|
-
...
|
|
10934
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10901
10935
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10902
|
-
respondsToUserMessageId:
|
|
10903
|
-
...
|
|
10936
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10937
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10904
10938
|
dataType: "function_call_output",
|
|
10905
10939
|
toolName: "authenticate_pipedream_app",
|
|
10906
10940
|
callId: Yn(i) ?? void 0,
|
|
@@ -10910,10 +10944,10 @@ function tf(t, e) {
|
|
|
10910
10944
|
role: "tool",
|
|
10911
10945
|
content: "Connect WhatsApp to continue",
|
|
10912
10946
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10913
|
-
...
|
|
10947
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10914
10948
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10915
|
-
respondsToUserMessageId:
|
|
10916
|
-
...
|
|
10949
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10950
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10917
10951
|
dataType: "function_call_output",
|
|
10918
10952
|
toolName: "request_personal_channel_connection",
|
|
10919
10953
|
callId: Yn(i) ?? void 0,
|
|
@@ -10925,10 +10959,10 @@ function tf(t, e) {
|
|
|
10925
10959
|
role: "tool",
|
|
10926
10960
|
content: i.type === "mcp_call" ? nf(i) : af(i),
|
|
10927
10961
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10928
|
-
...
|
|
10962
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10929
10963
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10930
|
-
respondsToUserMessageId:
|
|
10931
|
-
...
|
|
10964
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10965
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10932
10966
|
dataType: String(i.type),
|
|
10933
10967
|
toolName: i.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof i.name == "string" ? i.name : void 0,
|
|
10934
10968
|
callId: Yn(i) ?? void 0,
|
|
@@ -10939,10 +10973,10 @@ function tf(t, e) {
|
|
|
10939
10973
|
role: "system",
|
|
10940
10974
|
content: rf(i),
|
|
10941
10975
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10942
|
-
...
|
|
10976
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10943
10977
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10944
|
-
respondsToUserMessageId:
|
|
10945
|
-
...
|
|
10978
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10979
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10946
10980
|
dataType: String(i.type),
|
|
10947
10981
|
loading: i.steered !== !0 && i.type === "run_status" && (i.status === "running" || i.status === "retrying"),
|
|
10948
10982
|
...i.steered === !0 || i.type === "run_status" && i.status === "steered" ? { steered: !0 } : {},
|
|
@@ -11027,7 +11061,7 @@ function Yn(t) {
|
|
|
11027
11061
|
function st(t) {
|
|
11028
11062
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
11029
11063
|
}
|
|
11030
|
-
function
|
|
11064
|
+
function Le(t) {
|
|
11031
11065
|
return typeof t.displaySequence == "number" && Number.isSafeInteger(t.displaySequence) ? t.displaySequence : null;
|
|
11032
11066
|
}
|
|
11033
11067
|
function nc(t) {
|
|
@@ -11064,14 +11098,14 @@ function df(t) {
|
|
|
11064
11098
|
if (!e)
|
|
11065
11099
|
return [];
|
|
11066
11100
|
const n = JSON.parse(e);
|
|
11067
|
-
return Array.isArray(n) ? n.filter(
|
|
11101
|
+
return Array.isArray(n) ? n.filter(Rr) : [];
|
|
11068
11102
|
} catch {
|
|
11069
11103
|
return [];
|
|
11070
11104
|
}
|
|
11071
11105
|
}
|
|
11072
11106
|
function on(t, e) {
|
|
11073
11107
|
try {
|
|
11074
|
-
const n = e.filter(
|
|
11108
|
+
const n = e.filter(Rr);
|
|
11075
11109
|
if (n.length === 0) {
|
|
11076
11110
|
window.localStorage.removeItem(`${sr}${t}`);
|
|
11077
11111
|
return;
|
|
@@ -11146,7 +11180,7 @@ function hf(t) {
|
|
|
11146
11180
|
if (!t || typeof t != "object")
|
|
11147
11181
|
return !1;
|
|
11148
11182
|
const e = t, n = e.event;
|
|
11149
|
-
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" &&
|
|
11183
|
+
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Rr(n) && n.type === "tool.result";
|
|
11150
11184
|
}
|
|
11151
11185
|
function gf(t, e) {
|
|
11152
11186
|
const n = new Set(
|
|
@@ -11164,7 +11198,7 @@ function ff(t) {
|
|
|
11164
11198
|
return;
|
|
11165
11199
|
}
|
|
11166
11200
|
}
|
|
11167
|
-
function
|
|
11201
|
+
function Rr(t) {
|
|
11168
11202
|
if (!t || typeof t != "object")
|
|
11169
11203
|
return !1;
|
|
11170
11204
|
const e = t;
|
|
@@ -11250,11 +11284,11 @@ function wf(t) {
|
|
|
11250
11284
|
} = t;
|
|
11251
11285
|
return o;
|
|
11252
11286
|
}
|
|
11253
|
-
function
|
|
11287
|
+
function zt(t) {
|
|
11254
11288
|
const e = t.respondsToUserMessageId;
|
|
11255
11289
|
return typeof e == "string" && e ? e : null;
|
|
11256
11290
|
}
|
|
11257
|
-
function
|
|
11291
|
+
function Ne(t) {
|
|
11258
11292
|
const e = t.runId;
|
|
11259
11293
|
return typeof e == "string" && e ? e : null;
|
|
11260
11294
|
}
|
|
@@ -11266,14 +11300,14 @@ function Ul(t) {
|
|
|
11266
11300
|
const e = {};
|
|
11267
11301
|
try {
|
|
11268
11302
|
new Headers(t).forEach((n, s) => {
|
|
11269
|
-
Object.keys(e).length < kr && (e[s] =
|
|
11303
|
+
Object.keys(e).length < kr && (e[s] = Ar(s, n));
|
|
11270
11304
|
});
|
|
11271
11305
|
} catch {
|
|
11272
11306
|
return {};
|
|
11273
11307
|
}
|
|
11274
11308
|
return e;
|
|
11275
11309
|
}
|
|
11276
|
-
function
|
|
11310
|
+
function Ar(t, e) {
|
|
11277
11311
|
return Kl(t) ? bi : Mt(oi(e), gg);
|
|
11278
11312
|
}
|
|
11279
11313
|
function vf(t, e) {
|
|
@@ -11290,7 +11324,7 @@ async function If(t, e, n, s) {
|
|
|
11290
11324
|
});
|
|
11291
11325
|
}
|
|
11292
11326
|
async function Sf(t) {
|
|
11293
|
-
if (!
|
|
11327
|
+
if (!Bl(t.headers))
|
|
11294
11328
|
return;
|
|
11295
11329
|
let e = null, n = null;
|
|
11296
11330
|
try {
|
|
@@ -11322,7 +11356,7 @@ async function Sf(t) {
|
|
|
11322
11356
|
}
|
|
11323
11357
|
}
|
|
11324
11358
|
function xf(t, e) {
|
|
11325
|
-
if (
|
|
11359
|
+
if (Bl(new Headers(e)))
|
|
11326
11360
|
try {
|
|
11327
11361
|
return t.responseType === "" || t.responseType === "text" ? Mt(t.responseText ?? "") : void 0;
|
|
11328
11362
|
} catch {
|
|
@@ -11352,7 +11386,7 @@ function rc(t) {
|
|
|
11352
11386
|
return oi(t);
|
|
11353
11387
|
}
|
|
11354
11388
|
}
|
|
11355
|
-
function
|
|
11389
|
+
function Bl(t) {
|
|
11356
11390
|
if (!t)
|
|
11357
11391
|
return !1;
|
|
11358
11392
|
const e = t.get("content-type")?.toLowerCase() ?? "", n = t.get("content-length"), s = Number(n);
|
|
@@ -11387,7 +11421,7 @@ function Ef(t, e) {
|
|
|
11387
11421
|
function Cf(t) {
|
|
11388
11422
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
11389
11423
|
}
|
|
11390
|
-
function
|
|
11424
|
+
function Rf(t) {
|
|
11391
11425
|
const e = {};
|
|
11392
11426
|
for (const n of t.trim().split(/[\r\n]+/)) {
|
|
11393
11427
|
const s = n.indexOf(":");
|
|
@@ -11396,7 +11430,7 @@ function Af(t) {
|
|
|
11396
11430
|
if (Object.keys(e).length >= kr)
|
|
11397
11431
|
break;
|
|
11398
11432
|
const i = n.slice(0, s).trim();
|
|
11399
|
-
e[i] =
|
|
11433
|
+
e[i] = Ar(i, n.slice(s + 1).trim());
|
|
11400
11434
|
}
|
|
11401
11435
|
return e;
|
|
11402
11436
|
}
|
|
@@ -11406,14 +11440,14 @@ function Mt(t, e = xr) {
|
|
|
11406
11440
|
function bo(t) {
|
|
11407
11441
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
11408
11442
|
}
|
|
11409
|
-
class
|
|
11443
|
+
class zl extends Error {
|
|
11410
11444
|
constructor(e, n) {
|
|
11411
11445
|
super(`${e} (${n})`), this.status = n, this.name = "AttachmentUploadHttpError", this.code = String(n);
|
|
11412
11446
|
}
|
|
11413
11447
|
status;
|
|
11414
11448
|
code;
|
|
11415
11449
|
}
|
|
11416
|
-
async function
|
|
11450
|
+
async function Af(t, e) {
|
|
11417
11451
|
let n = null;
|
|
11418
11452
|
for (let s = 0; s < Ya; s += 1)
|
|
11419
11453
|
try {
|
|
@@ -11431,7 +11465,7 @@ function Tf(t) {
|
|
|
11431
11465
|
});
|
|
11432
11466
|
}
|
|
11433
11467
|
function Mf(t) {
|
|
11434
|
-
return t instanceof
|
|
11468
|
+
return t instanceof zl ? Pf(t.status) : t instanceof TypeError;
|
|
11435
11469
|
}
|
|
11436
11470
|
function Pf(t) {
|
|
11437
11471
|
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
@@ -11439,7 +11473,7 @@ function Pf(t) {
|
|
|
11439
11473
|
function qf(t) {
|
|
11440
11474
|
return t === 401 || t === 403;
|
|
11441
11475
|
}
|
|
11442
|
-
const bi = "[REDACTED_SECRET]", Pt = "[REDACTED_TOKEN]", Of = "[REDACTED_SIGNED_URL]", Df = 20, Lf = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, jl = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Fl = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, $l = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Hl = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, Nf = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Uf = /\bhttps?:\/\/[^\s"'<>]+/gi,
|
|
11476
|
+
const bi = "[REDACTED_SECRET]", Pt = "[REDACTED_TOKEN]", Of = "[REDACTED_SIGNED_URL]", Df = 20, Lf = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, jl = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Fl = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, $l = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Hl = /\b(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|api_key|apiKey|apikey|client_secret|clientSecret|password|secret|token|jwt|csrf|csrfToken|xsrf|xsrfToken)\b\s*[:=]\s*["']?[^"',&\s}]+/gi, Nf = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Uf = /\bhttps?:\/\/[^\s"'<>]+/gi, Bf = /[),.;\]]+$/;
|
|
11443
11477
|
function it(t) {
|
|
11444
11478
|
return ii(t, 0, /* @__PURE__ */ new WeakSet());
|
|
11445
11479
|
}
|
|
@@ -11456,14 +11490,14 @@ function ii(t, e, n) {
|
|
|
11456
11490
|
return t.map((i) => ii(i, e + 1, n));
|
|
11457
11491
|
const s = {};
|
|
11458
11492
|
for (const [i, o] of Object.entries(t))
|
|
11459
|
-
i === "pageContent" ? s[i] = o : Kl(i) ? s[i] = bi : s[i] = i.toLowerCase() === "url" ?
|
|
11493
|
+
i === "pageContent" ? s[i] = o : Kl(i) ? s[i] = bi : s[i] = i.toLowerCase() === "url" ? zf(o) : ii(o, e + 1, n);
|
|
11460
11494
|
return s;
|
|
11461
11495
|
}
|
|
11462
11496
|
function Kl(t) {
|
|
11463
11497
|
const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
11464
11498
|
return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
|
|
11465
11499
|
}
|
|
11466
|
-
function
|
|
11500
|
+
function zf(t) {
|
|
11467
11501
|
return typeof t == "string" ? Wl(t) : ii(t, 0, /* @__PURE__ */ new WeakSet());
|
|
11468
11502
|
}
|
|
11469
11503
|
function Wl(t) {
|
|
@@ -11483,7 +11517,7 @@ function jf(t) {
|
|
|
11483
11517
|
return t.replace(jl, `Bearer ${Pt}`).replace(Fl, `Basic ${Pt}`).replace($l, Pt).replace(Hl, (e, n) => `${n}: ${bi}`);
|
|
11484
11518
|
}
|
|
11485
11519
|
function Ff(t) {
|
|
11486
|
-
const e = t.match(
|
|
11520
|
+
const e = t.match(Bf)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
|
|
11487
11521
|
return `${Wl(n)}${e}`;
|
|
11488
11522
|
}
|
|
11489
11523
|
const $f = Object.freeze({
|
|
@@ -11773,7 +11807,7 @@ function gm(t, e, n, s) {
|
|
|
11773
11807
|
const b = e.ownerDocument.defaultView;
|
|
11774
11808
|
let v, _, I = /* @__PURE__ */ new Map(), k = d.sessionId, T = d.selectionKey;
|
|
11775
11809
|
const O = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map();
|
|
11776
|
-
let E = null,
|
|
11810
|
+
let E = null, z = null, P = null, G = 0, U = null, S = null, D = null;
|
|
11777
11811
|
const Z = () => JSON.stringify([
|
|
11778
11812
|
d.sessionId,
|
|
11779
11813
|
d.assistantDraftRespondsToUserMessageId,
|
|
@@ -11784,7 +11818,7 @@ function gm(t, e, n, s) {
|
|
|
11784
11818
|
return H.getClientRects().length > 0 && oe.visibility !== "hidden" && oe.opacity !== "0" && oe.pointerEvents !== "none" && !H.matches(":disabled") && H.getAttribute("aria-disabled") !== "true" && !H.closest("[inert]");
|
|
11785
11819
|
};
|
|
11786
11820
|
function ce() {
|
|
11787
|
-
|
|
11821
|
+
z !== null && b.clearTimeout(z), z = null, P = null;
|
|
11788
11822
|
}
|
|
11789
11823
|
function le(H = !1) {
|
|
11790
11824
|
ce(), S = null, D !== null && b.clearTimeout(D), D = null, v = void 0, _ = void 0, I.clear(), V.clear(), E !== null && b.clearTimeout(E), E = null, H && O.clear();
|
|
@@ -11799,13 +11833,13 @@ function gm(t, e, n, s) {
|
|
|
11799
11833
|
le();
|
|
11800
11834
|
return;
|
|
11801
11835
|
}
|
|
11802
|
-
const x = (L, ee) => Array.from(e.querySelectorAll(L)).flatMap((ie) => ie.getAttribute(ee) ? [ie.getAttribute(ee)] : []), C = ".pluno-pa-widget__tool-group--active, .tool-group--active, .pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]",
|
|
11836
|
+
const x = (L, ee) => Array.from(e.querySelectorAll(L)).flatMap((ie) => ie.getAttribute(ee) ? [ie.getAttribute(ee)] : []), C = ".pluno-pa-widget__tool-group--active, .tool-group--active, .pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]", B = [];
|
|
11803
11837
|
for (const L of Array.from(e.querySelectorAll(`${C}, [data-message-role="user"]`))) {
|
|
11804
11838
|
const ee = b.getComputedStyle(L);
|
|
11805
|
-
!L.getClientRects().length || ee.visibility === "hidden" || ee.opacity === "0" || L.parentElement?.closest(C) ||
|
|
11839
|
+
!L.getClientRects().length || ee.visibility === "hidden" || ee.opacity === "0" || L.parentElement?.closest(C) || B.push(L.dataset.messageRole === "user" ? "user" : "thinking");
|
|
11806
11840
|
}
|
|
11807
11841
|
let Y = 0;
|
|
11808
|
-
if (
|
|
11842
|
+
if (B.includes("thinking")) {
|
|
11809
11843
|
const L = Array.from(e.querySelectorAll('[data-message-role="user"]')), ee = L[L.length - 1], ie = ee?.dataset.messageKey ?? ee?.dataset.entryKey ?? null;
|
|
11810
11844
|
ie !== U && O.delete("thinking-without-progress"), U = ie;
|
|
11811
11845
|
let ae = 2166136261;
|
|
@@ -11818,7 +11852,7 @@ function gm(t, e, n, s) {
|
|
|
11818
11852
|
ae = Math.imul(ae ^ ve.charCodeAt(M), 16777619) >>> 0;
|
|
11819
11853
|
}
|
|
11820
11854
|
const lt = b.performance.now();
|
|
11821
|
-
ae !== P && (P = ae, G = lt), Y = lt - G,
|
|
11855
|
+
ae !== P && (P = ae, G = lt), Y = lt - G, z !== null && b.clearTimeout(z), z = Y < 3e5 ? b.setTimeout(he, 3e5 - Y) : null;
|
|
11822
11856
|
} else
|
|
11823
11857
|
ce(), O.delete("thinking-without-progress");
|
|
11824
11858
|
const re = Array.from(e.querySelectorAll(".pluno-pa-widget__thinking-marker, .thinking-marker, [data-thinking-status]")).some((L) => L.getClientRects().length > 0 && b.getComputedStyle(L).visibility !== "hidden" && b.getComputedStyle(L).opacity !== "0"), j = d.isThinking || d.turnPhase != null || d.pendingMessageStatus != null || re;
|
|
@@ -11832,7 +11866,7 @@ function gm(t, e, n, s) {
|
|
|
11832
11866
|
'button[aria-label="Stop"], button[aria-label="Stop generating"]'
|
|
11833
11867
|
)).filter(J).length,
|
|
11834
11868
|
stopPendingMs: S ? b.performance.now() - S.at : 0,
|
|
11835
|
-
thinkingSequence:
|
|
11869
|
+
thinkingSequence: B,
|
|
11836
11870
|
thinkingIdleMs: Y,
|
|
11837
11871
|
messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((L) => L.dataset.messageKey ?? L.dataset.entryKey ?? []),
|
|
11838
11872
|
canonicalItemKeys: x("[data-canonical-item-key]", "data-canonical-item-key"),
|
|
@@ -11876,8 +11910,8 @@ function gm(t, e, n, s) {
|
|
|
11876
11910
|
}, Math.max(1, 250 - (se - Math.min(...Array.from(V.values(), (L) => L.monotonicMs))))) : null;
|
|
11877
11911
|
}
|
|
11878
11912
|
function ke(H, oe = null) {
|
|
11879
|
-
const x = H !== "runtime", C = x ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null,
|
|
11880
|
-
for (let ne = Math.max(0,
|
|
11913
|
+
const x = H !== "runtime", C = x ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null, B = C?.length ?? d.messages.length, Y = [];
|
|
11914
|
+
for (let ne = Math.max(0, B - pc); ne < B; ne += 1) {
|
|
11881
11915
|
const se = C ? C[ne].dataset.messageKey ?? C[ne].dataset.entryKey : d.messages[ne].id;
|
|
11882
11916
|
se && Y.push(se.slice(0, _o));
|
|
11883
11917
|
}
|
|
@@ -11885,8 +11919,8 @@ function gm(t, e, n, s) {
|
|
|
11885
11919
|
session_id: d.sessionId?.slice(0, _o) ?? null,
|
|
11886
11920
|
run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, _o) ?? null,
|
|
11887
11921
|
item_keys: Y,
|
|
11888
|
-
item_count:
|
|
11889
|
-
items_truncated:
|
|
11922
|
+
item_count: B,
|
|
11923
|
+
items_truncated: B > pc,
|
|
11890
11924
|
thinking: d.isThinking,
|
|
11891
11925
|
loading: d.isLoadingSession,
|
|
11892
11926
|
welcome: x && si(e) === "none" && !!e.querySelector(".pluno-pa-widget__empty-state--starter, .empty-state--starter"),
|
|
@@ -11952,8 +11986,8 @@ function gm(t, e, n, s) {
|
|
|
11952
11986
|
}
|
|
11953
11987
|
const _e = s.on("state", (H) => {
|
|
11954
11988
|
H.user?.id !== h || H.sessionId !== k || H.selectionKey !== T ? (le(!0), k = H.sessionId, T = H.selectionKey) : H.isLoadingSession && le(), H.user?.id !== h && (i.clear(), o.length = 0, r.length = 0, a = 0, c = 0, l = 0, u = crypto.randomUUID(), m = "", g = "", y = "", h = H.user?.id), d = H, e.dataset.executionKey = d.activity?.executionKey ?? "", ke("runtime"), N();
|
|
11955
|
-
}),
|
|
11956
|
-
|
|
11989
|
+
}), Ue = new MutationObserver(N);
|
|
11990
|
+
Ue.observe(e, {
|
|
11957
11991
|
subtree: !0,
|
|
11958
11992
|
childList: !0,
|
|
11959
11993
|
characterData: !0,
|
|
@@ -11979,14 +12013,14 @@ function gm(t, e, n, s) {
|
|
|
11979
12013
|
records: o.map((H) => ({ ...H, item_keys: [...H.item_keys] }))
|
|
11980
12014
|
}),
|
|
11981
12015
|
dispose: () => {
|
|
11982
|
-
_e(),
|
|
12016
|
+
_e(), Ue.disconnect(), le(!0), f !== null && b.cancelAnimationFrame(f), e.removeEventListener("click", be, !0), e.removeEventListener("submit", Ze, !0), e.removeEventListener("focusin", Ce, !0), e.removeEventListener("input", N, !0), e.ownerDocument.removeEventListener("visibilitychange", et), t.__plunoUiFlightRecorder === Pe && delete t.__plunoUiFlightRecorder;
|
|
11983
12017
|
}
|
|
11984
12018
|
};
|
|
11985
12019
|
return t.__plunoUiFlightRecorder = Pe, ke("runtime"), N(), Pe;
|
|
11986
12020
|
}
|
|
11987
12021
|
const fm = [100, 500, 1500, 4e3];
|
|
11988
12022
|
let mm = 0;
|
|
11989
|
-
const ym = "product-agent:sdk-preview-socket-connect", bm = "product-agent:sdk-preview-socket-send", wm = "product-agent:sdk-preview-socket-close", _m = "product-agent:sdk-preview-socket-open", vm = "product-agent:sdk-preview-socket-message", Im = "product-agent:sdk-preview-socket-error", Sm = "product-agent:sdk-preview-socket-closed", hc = "product-agent:sdk-preview-socket-id", Yl = "data-pluno-auto-mounted",
|
|
12023
|
+
const ym = "product-agent:sdk-preview-socket-connect", bm = "product-agent:sdk-preview-socket-send", wm = "product-agent:sdk-preview-socket-close", _m = "product-agent:sdk-preview-socket-open", vm = "product-agent:sdk-preview-socket-message", Im = "product-agent:sdk-preview-socket-error", Sm = "product-agent:sdk-preview-socket-closed", hc = "product-agent:sdk-preview-socket-id", Yl = "data-pluno-auto-mounted", Rt = "__plunoProductAgentAutoMountOwner", xm = "pluno.productAgent.widgetClientId.", vo = /* @__PURE__ */ new Set(), km = "product-agent:preview-diagnostic", Em = 3, gc = 'dialog[open], [aria-modal="true"], [role="dialog"]', fc = 1500, Cm = 5e3, Rm = 500, Am = "Could not load recent chats. Please try again.", At = {
|
|
11990
12024
|
launcherLabel: "Ask for anything...",
|
|
11991
12025
|
accentColor: "#7c3aed",
|
|
11992
12026
|
colorScheme: "light",
|
|
@@ -11994,7 +12028,7 @@ const ym = "product-agent:sdk-preview-socket-connect", bm = "product-agent:sdk-p
|
|
|
11994
12028
|
scribbleStyle: !0,
|
|
11995
12029
|
position: "bottom-right",
|
|
11996
12030
|
movableLauncher: !0
|
|
11997
|
-
}, Tm = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', mc = "pluno-pa-scribble-font", Xl = 190, Ql = 41, Mm = 22, Pm = 32, qm = 1, Om = 48, Tr = 420, Dm = 520, Lm = 0.24, Mr = 680, Nm = 800, Um = 0.76, fe = 8, fn = 50, Zl = "http://www.w3.org/2000/svg", cr = 26, lr = 8,
|
|
12031
|
+
}, Tm = '"Architects Daughter", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", "Comic Sans", "Segoe Print", cursive', mc = "pluno-pa-scribble-font", Xl = 190, Ql = 41, Mm = 22, Pm = 32, qm = 1, Om = 48, Tr = 420, Dm = 520, Lm = 0.24, Mr = 680, Nm = 800, Um = 0.76, fe = 8, fn = 50, Zl = "http://www.w3.org/2000/svg", cr = 26, lr = 8, Bm = 36, dr = 16, zm = 4, yc = [
|
|
11998
12032
|
{
|
|
11999
12033
|
ellipseCx: "17.5",
|
|
12000
12034
|
ellipseCy: "24.5",
|
|
@@ -12041,13 +12075,13 @@ async function Wm(t = {}) {
|
|
|
12041
12075
|
const e = {
|
|
12042
12076
|
layout: t.layout ?? "floating",
|
|
12043
12077
|
mountTarget: t.mountTarget,
|
|
12044
|
-
launcherLabel: t.launcherLabel ??
|
|
12045
|
-
accentColor: t.accentColor ??
|
|
12046
|
-
colorScheme: t.colorScheme ??
|
|
12047
|
-
fontFamily: t.fontFamily ??
|
|
12048
|
-
scribbleStyle: t.scribbleStyle ??
|
|
12049
|
-
position: t.position ??
|
|
12050
|
-
movableLauncher: t.movableLauncher ??
|
|
12078
|
+
launcherLabel: t.launcherLabel ?? At.launcherLabel,
|
|
12079
|
+
accentColor: t.accentColor ?? At.accentColor,
|
|
12080
|
+
colorScheme: t.colorScheme ?? At.colorScheme,
|
|
12081
|
+
fontFamily: t.fontFamily ?? At.fontFamily,
|
|
12082
|
+
scribbleStyle: t.scribbleStyle ?? At.scribbleStyle,
|
|
12083
|
+
position: t.position ?? At.position,
|
|
12084
|
+
movableLauncher: t.movableLauncher ?? At.movableLauncher,
|
|
12051
12085
|
mobilePanelTopOffset: typeof t.mobilePanelTopOffset == "number" && Number.isFinite(t.mobilePanelTopOffset) ? Math.max(0, t.mobilePanelTopOffset) : 0,
|
|
12052
12086
|
token: t.token,
|
|
12053
12087
|
tokenProvider: t.tokenProvider,
|
|
@@ -12174,7 +12208,7 @@ async function Wm(t = {}) {
|
|
|
12174
12208
|
".pluno-pa-widget__status--launcher"
|
|
12175
12209
|
), V = l.querySelector(
|
|
12176
12210
|
".pluno-pa-widget__launcher-minimize"
|
|
12177
|
-
), E = l.querySelector(".pluno-pa-widget__panel"),
|
|
12211
|
+
), E = l.querySelector(".pluno-pa-widget__panel"), z = l.querySelector(
|
|
12178
12212
|
".pluno-pa-widget__panel-drag-handle"
|
|
12179
12213
|
), P = l.querySelector(
|
|
12180
12214
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
@@ -12198,7 +12232,7 @@ async function Wm(t = {}) {
|
|
|
12198
12232
|
".pluno-pa-widget__input"
|
|
12199
12233
|
), _e = l.querySelector(
|
|
12200
12234
|
".pluno-pa-widget__send"
|
|
12201
|
-
),
|
|
12235
|
+
), Ue = l.querySelector(
|
|
12202
12236
|
".pluno-pa-widget__top-actions"
|
|
12203
12237
|
), be = l.querySelector(
|
|
12204
12238
|
".pluno-pa-widget__history"
|
|
@@ -12217,13 +12251,13 @@ async function Wm(t = {}) {
|
|
|
12217
12251
|
), C = l.querySelector(
|
|
12218
12252
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
12219
12253
|
);
|
|
12220
|
-
if (!I || !T || !E || !U || !S || !D || !Z || !le || !he || !ke || !N || !_e || !
|
|
12254
|
+
if (!I || !T || !E || !U || !S || !D || !Z || !le || !he || !ke || !N || !_e || !Ue || !be || !Ze || !Ce || !et || !Pe || !H || !oe || !x || !C)
|
|
12221
12255
|
throw new Error("Failed to mount Pluno widget");
|
|
12222
12256
|
if (e.movableLauncher && !k)
|
|
12223
12257
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
12224
|
-
if (e.movableLauncher && !
|
|
12258
|
+
if (e.movableLauncher && !z)
|
|
12225
12259
|
throw new Error("Failed to mount Pluno widget panel drag handle");
|
|
12226
|
-
let
|
|
12260
|
+
let B = !1, Y = !1;
|
|
12227
12261
|
const re = () => {
|
|
12228
12262
|
if (s()) {
|
|
12229
12263
|
Z.hidden = !0, Z.replaceChildren();
|
|
@@ -12247,9 +12281,9 @@ async function Wm(t = {}) {
|
|
|
12247
12281
|
let W = 0, ge = 0, ye = 0;
|
|
12248
12282
|
const ne = /* @__PURE__ */ new Map();
|
|
12249
12283
|
let se = null, L = null;
|
|
12250
|
-
const ee = (p) => p === N ? "widget_composer" : p === T ? "widget_launcher" : p && c.contains(p) ? "widget_control" : p === _.body ? "body" : p === _.documentElement ? "document" : p ? "host_page" : "none", ie = (p, w,
|
|
12251
|
-
const
|
|
12252
|
-
F || (
|
|
12284
|
+
const ee = (p) => p === N ? "widget_composer" : p === T ? "widget_launcher" : p && c.contains(p) ? "widget_control" : p === _.body ? "body" : p === _.documentElement ? "document" : p ? "host_page" : "none", ie = (p, w, R = {}) => {
|
|
12285
|
+
const A = Co(_), F = R.skipIfAlreadyFocused === !0 && A === p;
|
|
12286
|
+
F || (R.preventScroll ? p.focus({ preventScroll: !0 }) : p.focus());
|
|
12253
12287
|
const de = Co(_);
|
|
12254
12288
|
return ht(
|
|
12255
12289
|
"web-sdk.widget.focus",
|
|
@@ -12258,8 +12292,8 @@ async function Wm(t = {}) {
|
|
|
12258
12292
|
reason: w,
|
|
12259
12293
|
mountId: o,
|
|
12260
12294
|
widgetAgeMs: Date.now() - r,
|
|
12261
|
-
scheduledDelayMs:
|
|
12262
|
-
previousFocus: ee(
|
|
12295
|
+
scheduledDelayMs: R.scheduledAt === void 0 ? null : Date.now() - R.scheduledAt,
|
|
12296
|
+
previousFocus: ee(A),
|
|
12263
12297
|
requestedFocus: ee(p),
|
|
12264
12298
|
resultingFocus: ee(de),
|
|
12265
12299
|
focusSkipped: F,
|
|
@@ -12276,13 +12310,13 @@ async function Wm(t = {}) {
|
|
|
12276
12310
|
preventScroll: !0,
|
|
12277
12311
|
skipIfAlreadyFocused: !0
|
|
12278
12312
|
}), lt = () => {
|
|
12279
|
-
|
|
12313
|
+
Ry(
|
|
12280
12314
|
le,
|
|
12281
12315
|
j,
|
|
12282
12316
|
(p) => {
|
|
12283
12317
|
ge++, j = j.filter(
|
|
12284
|
-
(w,
|
|
12285
|
-
), lt(),
|
|
12318
|
+
(w, R) => R !== p
|
|
12319
|
+
), lt(), Ae(M.getState()), Re(), ae("remove_attachment");
|
|
12286
12320
|
}
|
|
12287
12321
|
);
|
|
12288
12322
|
}, Ke = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (e.tokenEndpoint ? async (p) => bb(
|
|
@@ -12336,7 +12370,7 @@ async function Wm(t = {}) {
|
|
|
12336
12370
|
} catch (p) {
|
|
12337
12371
|
throw ve?.release(), a.remove(), p;
|
|
12338
12372
|
}
|
|
12339
|
-
let
|
|
12373
|
+
let An = M.getState().sessionId, Tn = M.getState().selectionKey, Yt = M.getState().user?.id ?? null;
|
|
12340
12374
|
const Ii = e.model ?? "gpt-6.1-sol";
|
|
12341
12375
|
let mn = Ii, Si = M.getAccount()?.auth?.workspace?.id ?? null;
|
|
12342
12376
|
v.appendChild(a), ht(
|
|
@@ -12352,13 +12386,13 @@ async function Wm(t = {}) {
|
|
|
12352
12386
|
const xi = new Set(d.openToolGroupKeys);
|
|
12353
12387
|
let dt = null, We = !1, Ot = !1, It = {
|
|
12354
12388
|
enabled: !0
|
|
12355
|
-
}, Dt = 0, ki = null, Xt = null, Qt = null, gs = null, Mn = !1, me = null,
|
|
12356
|
-
const jr = (p) =>
|
|
12357
|
-
renderSource:
|
|
12389
|
+
}, Dt = 0, ki = null, Xt = null, Qt = null, gs = null, Mn = !1, me = null, zr = "local";
|
|
12390
|
+
const jr = (p) => An !== null && An !== p.sessionId || Yt !== null && Yt !== (p.user?.id ?? null) || Tn !== void 0 && Tn !== p.selectionKey, Fr = (p) => Cu(x, p, {
|
|
12391
|
+
renderSource: zr,
|
|
12358
12392
|
guardCreatedAt: me?.createdAt ?? null,
|
|
12359
12393
|
selectionFencePending: jr(p)
|
|
12360
12394
|
}), fs = /* @__PURE__ */ new Set();
|
|
12361
|
-
let Pn = "",
|
|
12395
|
+
let Pn = "", Be = !1, tt = null, $r = location.origin, Hr = M.getState().sessionId, Kr = M.getState().user?.id ?? null, Ei = M.getState().status, St = () => {
|
|
12362
12396
|
}, Ci = "", Fe = M.getSessionHistoryState();
|
|
12363
12397
|
const vd = M.subscribeSessionHistory((p) => {
|
|
12364
12398
|
Fe = p, We || St();
|
|
@@ -12366,15 +12400,15 @@ async function Wm(t = {}) {
|
|
|
12366
12400
|
It = { enabled: p, reason: w };
|
|
12367
12401
|
}, ut = () => {
|
|
12368
12402
|
oe.hidden = !0;
|
|
12369
|
-
},
|
|
12403
|
+
}, Ri = () => {
|
|
12370
12404
|
x.clientHeight === 0 || x.scrollHeight - x.scrollTop - x.clientHeight > 1 || (nt(!0, "bottom"), ut());
|
|
12371
|
-
},
|
|
12372
|
-
const
|
|
12373
|
-
fs.has(
|
|
12405
|
+
}, Ai = (p, w, R) => {
|
|
12406
|
+
const A = `${p}:${w ?? "current-view"}`;
|
|
12407
|
+
fs.has(A) || (fs.add(A), M.reportInvalidStateTransition?.(p, w, R));
|
|
12374
12408
|
}, Id = () => {
|
|
12375
|
-
Mu(Mn,
|
|
12409
|
+
Mu(Mn, Ai), oe.hidden = !1;
|
|
12376
12410
|
}, Wr = () => {
|
|
12377
|
-
me?.observedConversation && x.querySelector(".pluno-pa-widget__empty-state--starter") && (me.observedWelcome ??= Fr(M.getState())), me?.observedWelcome && !me.pendingSubmission && (
|
|
12411
|
+
me?.observedConversation && x.querySelector(".pluno-pa-widget__empty-state--starter") && (me.observedWelcome ??= Fr(M.getState())), me?.observedWelcome && !me.pendingSubmission && (Ai("submitted_turn_returned_to_welcome_without_new_chat", me.clientMessageId, {
|
|
12378
12412
|
before: me.observedConversation,
|
|
12379
12413
|
current: me.observedWelcome
|
|
12380
12414
|
}), me = null);
|
|
@@ -12387,53 +12421,53 @@ async function Wm(t = {}) {
|
|
|
12387
12421
|
};
|
|
12388
12422
|
St = () => {
|
|
12389
12423
|
const p = Gp(Fe.data), w = Fe.status === "loading" || Fe.status === "refreshing" || Fe.status === "loading_more";
|
|
12390
|
-
if (be.hidden = e.layout === "page" || s(), s() && (
|
|
12424
|
+
if (be.hidden = e.layout === "page" || s(), s() && (Be = !1), Ze.hidden = !Be, be.setAttribute("aria-expanded", String(Be)), !Be) {
|
|
12391
12425
|
Ci = "";
|
|
12392
12426
|
return;
|
|
12393
12427
|
}
|
|
12394
|
-
const
|
|
12428
|
+
const R = JSON.stringify([
|
|
12395
12429
|
Fe.status,
|
|
12396
12430
|
p,
|
|
12397
12431
|
M.getState().sessionId,
|
|
12398
|
-
p.map((
|
|
12432
|
+
p.map((A) => Cc(A.lastActiveAt, Date.now()))
|
|
12399
12433
|
]);
|
|
12400
|
-
if (
|
|
12401
|
-
if (Ci =
|
|
12434
|
+
if (R !== Ci) {
|
|
12435
|
+
if (Ci = R, Ce.classList.toggle(
|
|
12402
12436
|
"pluno-pa-widget__history-list--center",
|
|
12403
12437
|
w && p.length === 0
|
|
12404
12438
|
), Ce.replaceChildren(), w && p.length === 0) {
|
|
12405
|
-
const
|
|
12406
|
-
|
|
12439
|
+
const A = document.createElement("p");
|
|
12440
|
+
A.className = "pluno-pa-widget__history-loading", A.textContent = "Loading...", Ce.appendChild(A);
|
|
12407
12441
|
}
|
|
12408
|
-
for (const
|
|
12442
|
+
for (const A of p) {
|
|
12409
12443
|
const F = document.createElement("button");
|
|
12410
12444
|
F.type = "button", F.className = "pluno-pa-widget__history-item";
|
|
12411
|
-
const de =
|
|
12445
|
+
const de = A.id === M.getState().sessionId;
|
|
12412
12446
|
F.disabled = de, de && F.setAttribute("aria-current", "page");
|
|
12413
12447
|
const Ee = document.createElement("span");
|
|
12414
|
-
Ee.className = "pluno-pa-widget__history-item-title", Ee.textContent = Ec(
|
|
12448
|
+
Ee.className = "pluno-pa-widget__history-item-title", Ee.textContent = Ec(A), F.setAttribute("aria-label", Ec(A));
|
|
12415
12449
|
const Te = document.createElement("time");
|
|
12416
|
-
Te.className = "pluno-pa-widget__history-time", Te.dateTime =
|
|
12417
|
-
|
|
12450
|
+
Te.className = "pluno-pa-widget__history-time", Te.dateTime = A.lastActiveAt, Te.textContent = Cc(
|
|
12451
|
+
A.lastActiveAt,
|
|
12418
12452
|
Date.now()
|
|
12419
12453
|
);
|
|
12420
12454
|
const ue = document.createElement("small");
|
|
12421
|
-
ue.className = "pluno-pa-widget__history-path", ue.textContent = dy(
|
|
12422
|
-
|
|
12455
|
+
ue.className = "pluno-pa-widget__history-path", ue.textContent = dy(A), F.append(Ee, Te, ue), F.addEventListener("click", () => {
|
|
12456
|
+
Be = !1, St(), me = null, Mn = !1, fs.clear(), nt(!0, "newSession"), ut(), M.loadSession(A.id), Ae(M.getState()), ae("history_session_selected");
|
|
12423
12457
|
}), Ce.appendChild(F);
|
|
12424
12458
|
}
|
|
12425
12459
|
if (w && p.length > 0) {
|
|
12426
|
-
const
|
|
12427
|
-
|
|
12460
|
+
const A = document.createElement("p");
|
|
12461
|
+
A.className = "pluno-pa-widget__history-loading pluno-pa-widget__history-loading--inline", A.textContent = "Loading...", Ce.appendChild(A);
|
|
12428
12462
|
}
|
|
12429
|
-
Pe.textContent = (Fe.status === "error" ?
|
|
12463
|
+
Pe.textContent = (Fe.status === "error" ? Am : null) ?? (!w && p.length === 0 ? "No recent chats for this page yet." : ""), Pe.hidden = Pe.textContent.length === 0, Pe.classList.toggle("pluno-pa-widget__history-error", Fe.status === "error"), H.hidden = Fe.status !== "error", H.disabled = w;
|
|
12430
12464
|
}
|
|
12431
12465
|
};
|
|
12432
12466
|
const Ti = (p = !1) => {
|
|
12433
|
-
if (tt !== null && (window.clearTimeout(tt), tt = null), !(e.layout === "page" || e.loginRequired || e.signupRequired ||
|
|
12434
|
-
return
|
|
12467
|
+
if (tt !== null && (window.clearTimeout(tt), tt = null), !(e.layout === "page" || e.loginRequired || e.signupRequired || B || !p && M.getState().status !== "connected"))
|
|
12468
|
+
return B = !0, M.refreshSessionHistory().catch(() => {
|
|
12435
12469
|
}).finally(() => {
|
|
12436
|
-
|
|
12470
|
+
B = !1;
|
|
12437
12471
|
});
|
|
12438
12472
|
};
|
|
12439
12473
|
H.addEventListener("click", () => {
|
|
@@ -12476,10 +12510,10 @@ async function Wm(t = {}) {
|
|
|
12476
12510
|
});
|
|
12477
12511
|
}, ys = (p, w) => {
|
|
12478
12512
|
e.onDisplayStateChange?.(p, w);
|
|
12479
|
-
}, On = (p, w = !0,
|
|
12480
|
-
const
|
|
12513
|
+
}, On = (p, w = !0, R = "external_request") => {
|
|
12514
|
+
const A = l.classList.contains("pluno-pa-widget--minimized");
|
|
12481
12515
|
if (Nc(e, p), p === "shown") {
|
|
12482
|
-
l.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), I.removeAttribute("role"), I.removeAttribute("aria-label"), !l.classList.contains("pluno-pa-widget--open") && !l.classList.contains("pluno-pa-widget--closing") && Dn(!1), w && ys("shown",
|
|
12516
|
+
l.classList.remove("pluno-pa-widget--minimized"), I.removeAttribute("tabindex"), I.removeAttribute("role"), I.removeAttribute("aria-label"), !l.classList.contains("pluno-pa-widget--open") && !l.classList.contains("pluno-pa-widget--closing") && Dn(!1), w && ys("shown", R);
|
|
12483
12517
|
return;
|
|
12484
12518
|
}
|
|
12485
12519
|
dt !== null && (window.clearTimeout(dt), dt = null), l.classList.remove("pluno-pa-widget--open"), l.classList.remove("pluno-pa-widget--closing"), l.classList.add("pluno-pa-widget--minimized"), I.hidden = !1, I.setAttribute("role", "button"), I.setAttribute("aria-label", "Open Pluno"), E.hidden = !0, U.hidden = !0, I.tabIndex = 0, N.value = "", jt(
|
|
@@ -12489,7 +12523,7 @@ async function Wm(t = {}) {
|
|
|
12489
12523
|
f,
|
|
12490
12524
|
e.position
|
|
12491
12525
|
)
|
|
12492
|
-
), xc(l), $e(), !
|
|
12526
|
+
), xc(l), $e(), !A && e.layout === "floating" && M.recordWidgetLifecycle("minimized", R), w && ys("minimized", R);
|
|
12493
12527
|
}, Zt = (p, w = {}) => {
|
|
12494
12528
|
ry(p, {
|
|
12495
12529
|
debugVersion: $m,
|
|
@@ -12544,11 +12578,11 @@ async function Wm(t = {}) {
|
|
|
12544
12578
|
if (l.classList.contains("pluno-pa-widget--open") || l.classList.contains("pluno-pa-widget--closing")) {
|
|
12545
12579
|
Io(l, g);
|
|
12546
12580
|
const w = an(g);
|
|
12547
|
-
|
|
12581
|
+
Ro(
|
|
12548
12582
|
P,
|
|
12549
12583
|
Pi()
|
|
12550
12584
|
);
|
|
12551
|
-
const
|
|
12585
|
+
const R = is(
|
|
12552
12586
|
y ? Xs(y, w) : ko(
|
|
12553
12587
|
l,
|
|
12554
12588
|
p,
|
|
@@ -12557,9 +12591,9 @@ async function Wm(t = {}) {
|
|
|
12557
12591
|
),
|
|
12558
12592
|
w
|
|
12559
12593
|
);
|
|
12560
|
-
bs(
|
|
12594
|
+
bs(R, p), Zt(
|
|
12561
12595
|
"Applied open panel position after viewport resize",
|
|
12562
|
-
{ openPanelPosition:
|
|
12596
|
+
{ openPanelPosition: R }
|
|
12563
12597
|
);
|
|
12564
12598
|
} else f && Zt(
|
|
12565
12599
|
"Applied visible launcher position after viewport resize",
|
|
@@ -12574,15 +12608,15 @@ async function Wm(t = {}) {
|
|
|
12574
12608
|
launcherDragHandle: k,
|
|
12575
12609
|
getPosition: () => qn(),
|
|
12576
12610
|
setPosition: (p) => {
|
|
12577
|
-
const w = p,
|
|
12611
|
+
const w = p, R = ls(l), A = Ys(
|
|
12578
12612
|
l,
|
|
12579
12613
|
p,
|
|
12580
|
-
|
|
12614
|
+
R
|
|
12581
12615
|
);
|
|
12582
12616
|
f = xo(
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
), y = null, jt(l,
|
|
12617
|
+
A,
|
|
12618
|
+
R
|
|
12619
|
+
), y = null, jt(l, A), Zt("Dragging closed launcher", {
|
|
12586
12620
|
requestedPosition: w
|
|
12587
12621
|
});
|
|
12588
12622
|
},
|
|
@@ -12605,7 +12639,7 @@ async function Wm(t = {}) {
|
|
|
12605
12639
|
size: p
|
|
12606
12640
|
};
|
|
12607
12641
|
}, kd = (p) => {
|
|
12608
|
-
g = wi(p.size), Io(l, g),
|
|
12642
|
+
g = wi(p.size), Io(l, g), Ro(
|
|
12609
12643
|
P,
|
|
12610
12644
|
Pi()
|
|
12611
12645
|
);
|
|
@@ -12617,43 +12651,43 @@ async function Wm(t = {}) {
|
|
|
12617
12651
|
w,
|
|
12618
12652
|
an(g)
|
|
12619
12653
|
);
|
|
12620
|
-
const
|
|
12621
|
-
bs(w,
|
|
12654
|
+
const R = qn();
|
|
12655
|
+
bs(w, R);
|
|
12622
12656
|
}, Ed = (p) => {
|
|
12623
|
-
const w = an(g),
|
|
12657
|
+
const w = an(g), R = is(
|
|
12624
12658
|
p,
|
|
12625
12659
|
w
|
|
12626
|
-
),
|
|
12660
|
+
), A = ls(l), F = Ys(
|
|
12627
12661
|
l,
|
|
12628
12662
|
iy(
|
|
12629
|
-
A,
|
|
12630
|
-
w,
|
|
12631
12663
|
R,
|
|
12664
|
+
w,
|
|
12665
|
+
A,
|
|
12632
12666
|
e.position
|
|
12633
12667
|
),
|
|
12634
|
-
|
|
12668
|
+
A
|
|
12635
12669
|
);
|
|
12636
12670
|
f = xo(
|
|
12637
12671
|
F,
|
|
12638
|
-
|
|
12639
|
-
), m = !0, y = null, jt(l, F), bs(
|
|
12640
|
-
}, Cd = e.movableLauncher &&
|
|
12672
|
+
A
|
|
12673
|
+
), m = !0, y = null, jt(l, F), bs(R, F);
|
|
12674
|
+
}, Cd = e.movableLauncher && z ? Xm({
|
|
12641
12675
|
root: l,
|
|
12642
|
-
handle:
|
|
12676
|
+
handle: z,
|
|
12643
12677
|
getPosition: () => Xr().position,
|
|
12644
12678
|
setPosition: Ed,
|
|
12645
12679
|
persist: $e
|
|
12646
12680
|
}) : () => {
|
|
12647
|
-
},
|
|
12681
|
+
}, Rd = G.length > 0 ? Qm({
|
|
12648
12682
|
root: l,
|
|
12649
12683
|
handles: G,
|
|
12650
12684
|
getBounds: Xr,
|
|
12651
12685
|
setBounds: kd,
|
|
12652
12686
|
persist: $e
|
|
12653
12687
|
}) : () => {
|
|
12654
|
-
}, xt = (p = "", w = !0,
|
|
12688
|
+
}, xt = (p = "", w = !0, R = !0, A = "external_request") => {
|
|
12655
12689
|
const F = l.classList.contains("pluno-pa-widget--open") || !E.hidden && !l.classList.contains("pluno-pa-widget--closing");
|
|
12656
|
-
Un && (Un = !1, Li()), l.classList.contains("pluno-pa-widget--open") || (y = null), dt !== null && (window.clearTimeout(dt), dt = null), On("shown", !1), E.hidden = !1, U.hidden = !1,
|
|
12690
|
+
Un && (Un = !1, Li()), l.classList.contains("pluno-pa-widget--open") || (y = null), dt !== null && (window.clearTimeout(dt), dt = null), On("shown", !1), E.hidden = !1, U.hidden = !1, Ro(
|
|
12657
12691
|
P,
|
|
12658
12692
|
Pi()
|
|
12659
12693
|
), l.classList.remove("pluno-pa-widget--closing");
|
|
@@ -12666,15 +12700,15 @@ async function Wm(t = {}) {
|
|
|
12666
12700
|
if (bs(Ee, de), Zt("Opening launcher at clamped open panel position", {
|
|
12667
12701
|
openPanelPosition: Ee,
|
|
12668
12702
|
visibleLauncherPosition: de
|
|
12669
|
-
}), nt(!0, "open"), ut(), !F && e.layout === "floating" && M.recordWidgetLifecycle("opened",
|
|
12670
|
-
l.classList.add("pluno-pa-widget--open"), F || Mi(), I.hidden = !0, p && (N.value = p, Xn(N)), In(x, () => It.enabled), Dt = x.scrollTop,
|
|
12703
|
+
}), nt(!0, "open"), ut(), !F && e.layout === "floating" && M.recordWidgetLifecycle("opened", A), !w) {
|
|
12704
|
+
l.classList.add("pluno-pa-widget--open"), F || Mi(), I.hidden = !0, p && (N.value = p, Xn(N)), In(x, () => It.enabled), Dt = x.scrollTop, R && (ie(N, "panel_open_immediate"), N.setSelectionRange(N.value.length, N.value.length)), $e(), ys("shown", A), e.onPanelOpenChange?.(!0, A);
|
|
12671
12705
|
return;
|
|
12672
12706
|
}
|
|
12673
12707
|
const Te = Date.now();
|
|
12674
12708
|
window.requestAnimationFrame(() => {
|
|
12675
|
-
l.classList.add("pluno-pa-widget--open"), F || Mi(), p && (N.value = p, Xn(N)), In(x, () => It.enabled), Dt = x.scrollTop,
|
|
12709
|
+
l.classList.add("pluno-pa-widget--open"), F || Mi(), p && (N.value = p, Xn(N)), In(x, () => It.enabled), Dt = x.scrollTop, R && (ie(N, "panel_open_animation", {
|
|
12676
12710
|
scheduledAt: Te
|
|
12677
|
-
}), N.setSelectionRange(N.value.length, N.value.length)), $e(), ys("shown",
|
|
12711
|
+
}), N.setSelectionRange(N.value.length, N.value.length)), $e(), ys("shown", A), e.onPanelOpenChange?.(!0, A), dt = window.setTimeout(() => {
|
|
12678
12712
|
I.hidden = !0, In(x, () => It.enabled), Dt = x.scrollTop;
|
|
12679
12713
|
}, 220);
|
|
12680
12714
|
});
|
|
@@ -12701,7 +12735,7 @@ async function Wm(t = {}) {
|
|
|
12701
12735
|
xt(p, !0, !0, "launcher_input"), T.value = "";
|
|
12702
12736
|
});
|
|
12703
12737
|
let Ln = null, Lt = null, ws = null, en = null, mt = null, qe = null;
|
|
12704
|
-
const _s = (p) => p === T || p === N, ea = (p) => p.composedPath().find(_s) ?? null,
|
|
12738
|
+
const _s = (p) => p === T || p === N, ea = (p) => p.composedPath().find(_s) ?? null, Ad = (p) => {
|
|
12705
12739
|
let w = p;
|
|
12706
12740
|
for (; w; ) {
|
|
12707
12741
|
if (w.assignedSlot)
|
|
@@ -12714,12 +12748,12 @@ async function Wm(t = {}) {
|
|
|
12714
12748
|
return null;
|
|
12715
12749
|
let w = p;
|
|
12716
12750
|
for (; w; ) {
|
|
12717
|
-
const
|
|
12718
|
-
if (
|
|
12719
|
-
return
|
|
12720
|
-
const
|
|
12721
|
-
if (
|
|
12722
|
-
w =
|
|
12751
|
+
const R = w.closest(gc);
|
|
12752
|
+
if (R)
|
|
12753
|
+
return R;
|
|
12754
|
+
const A = Ad(w);
|
|
12755
|
+
if (A) {
|
|
12756
|
+
w = A;
|
|
12723
12757
|
continue;
|
|
12724
12758
|
}
|
|
12725
12759
|
const F = w.getRootNode();
|
|
@@ -12741,11 +12775,11 @@ async function Wm(t = {}) {
|
|
|
12741
12775
|
if (!w)
|
|
12742
12776
|
return;
|
|
12743
12777
|
mt !== null && window.clearTimeout(mt);
|
|
12744
|
-
const
|
|
12778
|
+
const R = Date.now();
|
|
12745
12779
|
mt = window.setTimeout(() => {
|
|
12746
12780
|
mt = null, kt === p && w.isConnected && ie(w, "host_modal_recovery", {
|
|
12747
12781
|
preventScroll: !0,
|
|
12748
|
-
scheduledAt:
|
|
12782
|
+
scheduledAt: R
|
|
12749
12783
|
});
|
|
12750
12784
|
}, 0);
|
|
12751
12785
|
}, Nn = (p, w = null) => {
|
|
@@ -12754,24 +12788,24 @@ async function Wm(t = {}) {
|
|
|
12754
12788
|
return;
|
|
12755
12789
|
}
|
|
12756
12790
|
kt = p, p !== null ? (Di(p, w), en = window.setInterval(() => {
|
|
12757
|
-
const
|
|
12758
|
-
if (!
|
|
12791
|
+
const R = kt;
|
|
12792
|
+
if (!R || !Td(R)) {
|
|
12759
12793
|
Nn(null);
|
|
12760
12794
|
return;
|
|
12761
12795
|
}
|
|
12762
|
-
Di(
|
|
12763
|
-
},
|
|
12796
|
+
Di(R, null);
|
|
12797
|
+
}, Rm)) : (en !== null && (window.clearInterval(en), en = null), mt !== null && (window.clearTimeout(mt), mt = null), ws = null);
|
|
12764
12798
|
}, Md = () => {
|
|
12765
12799
|
en !== null && (window.clearInterval(en), en = null), mt !== null && (window.clearTimeout(mt), mt = null), qe !== null && (window.clearTimeout(qe), qe = null);
|
|
12766
12800
|
}, ta = (p) => {
|
|
12767
12801
|
const w = ea(p);
|
|
12768
12802
|
if (!w)
|
|
12769
12803
|
return;
|
|
12770
|
-
const
|
|
12771
|
-
Lt =
|
|
12772
|
-
const
|
|
12773
|
-
|
|
12774
|
-
if (qe = null, Lt !==
|
|
12804
|
+
const R = Date.now();
|
|
12805
|
+
Lt = R, Ln = R, qe !== null && window.clearTimeout(qe);
|
|
12806
|
+
const A = kt ?? qi(Oi());
|
|
12807
|
+
A && (Nn(A, w), p.stopImmediatePropagation()), qe = window.setTimeout(() => {
|
|
12808
|
+
if (qe = null, Lt !== R)
|
|
12775
12809
|
return;
|
|
12776
12810
|
const F = Oi();
|
|
12777
12811
|
if (F === w) {
|
|
@@ -12807,19 +12841,19 @@ async function Wm(t = {}) {
|
|
|
12807
12841
|
const w = Ln;
|
|
12808
12842
|
if (Ln = null, w === null || Date.now() - w > fc)
|
|
12809
12843
|
return;
|
|
12810
|
-
const
|
|
12844
|
+
const R = p.target, A = Lt !== null && Date.now() - Lt <= fc;
|
|
12811
12845
|
Lt = null, qe !== null && (window.clearTimeout(qe), qe = null);
|
|
12812
12846
|
const F = (de) => {
|
|
12813
12847
|
const Ee = qi(de);
|
|
12814
12848
|
if (!Ee)
|
|
12815
12849
|
return !1;
|
|
12816
|
-
if (
|
|
12817
|
-
return Nn(Ee,
|
|
12850
|
+
if (A)
|
|
12851
|
+
return Nn(Ee, R), !0;
|
|
12818
12852
|
const Te = Date.now();
|
|
12819
|
-
return ws !== null && Te - ws <= Cm ? (Nn(Ee,
|
|
12853
|
+
return ws !== null && Te - ws <= Cm ? (Nn(Ee, R), !0) : (ws = Te, !0);
|
|
12820
12854
|
};
|
|
12821
12855
|
F(p.relatedTarget) || window.setTimeout(() => {
|
|
12822
|
-
kt === null &&
|
|
12856
|
+
kt === null && R.isConnected && F(Oi());
|
|
12823
12857
|
}, 0);
|
|
12824
12858
|
}), I.addEventListener("keydown", (p) => {
|
|
12825
12859
|
!l.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(), xt("", !0, !0, "minimized_launcher"));
|
|
@@ -12845,18 +12879,18 @@ async function Wm(t = {}) {
|
|
|
12845
12879
|
}), x.addEventListener("keydown", (p) => {
|
|
12846
12880
|
(p.key === "ArrowUp" || p.key === "PageUp" || p.key === "Home") && ms("up");
|
|
12847
12881
|
}), x.addEventListener("scroll", () => {
|
|
12848
|
-
x.scrollTop < Dt - 1 && ki === "up" && (Mn = !0, nt(!1, "userScroll")), Dt = x.scrollTop,
|
|
12882
|
+
x.scrollTop < Dt - 1 && ki === "up" && (Mn = !0, nt(!1, "userScroll")), Dt = x.scrollTop, Ri();
|
|
12849
12883
|
}), oe.addEventListener("click", () => {
|
|
12850
12884
|
Sd();
|
|
12851
12885
|
});
|
|
12852
12886
|
const na = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
12853
12887
|
([p]) => {
|
|
12854
|
-
p?.isIntersecting &&
|
|
12888
|
+
p?.isIntersecting && Ri();
|
|
12855
12889
|
},
|
|
12856
12890
|
{ root: x, threshold: 0 }
|
|
12857
12891
|
);
|
|
12858
12892
|
na?.observe(C);
|
|
12859
|
-
const sa = typeof ResizeObserver > "u" ? null : new ResizeObserver(
|
|
12893
|
+
const sa = typeof ResizeObserver > "u" ? null : new ResizeObserver(Ri);
|
|
12860
12894
|
sa?.observe(x);
|
|
12861
12895
|
const ia = l.querySelector(".pluno-pa-widget__permission-overlay"), oa = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
|
|
12862
12896
|
const p = ia.offsetHeight;
|
|
@@ -12871,10 +12905,10 @@ async function Wm(t = {}) {
|
|
|
12871
12905
|
const p = M.getState().status;
|
|
12872
12906
|
return Ss() ? !1 : p !== "connected" && !(Is && p === "reconnecting");
|
|
12873
12907
|
}, yn = () => {
|
|
12874
|
-
const p = s(), w = M.getState(),
|
|
12875
|
-
T.readOnly = !1, N.readOnly = !1, T.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel :
|
|
12908
|
+
const p = s(), w = M.getState(), R = !w.isThinking && !w.pendingMessageStatus && !!w.lastError;
|
|
12909
|
+
T.readOnly = !1, N.readOnly = !1, T.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : R ? "Needs attention" : Un ? "New update" : e.launcherLabel, N.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : At.launcherLabel, S.hidden = p;
|
|
12876
12910
|
}, ra = () => [...ne.values()].some((p) => p.revision === ge && p.generation === W), bn = () => !M.getState().isLoadingSession && !qd() && !Qn(e.billingStatus) && !ra(), aa = () => {
|
|
12877
|
-
const p = M.getState(), w = !Ss() && [...ne.values()].some((
|
|
12911
|
+
const p = M.getState(), w = !Ss() && [...ne.values()].some((R) => R.revision === ge && R.generation === W);
|
|
12878
12912
|
return Jp({
|
|
12879
12913
|
hasRunningAssistantTurn: w || p.isThinking || p.turnPhase !== null || p.pendingMessageStatus !== null,
|
|
12880
12914
|
// Retained text already submitted by this revision must not hide Stop behind a disabled Send.
|
|
@@ -12882,7 +12916,7 @@ async function Wm(t = {}) {
|
|
|
12882
12916
|
hasPreSubmittedAttachment: j.length > 0,
|
|
12883
12917
|
canSubmitMessage: bn()
|
|
12884
12918
|
});
|
|
12885
|
-
},
|
|
12919
|
+
}, Re = () => {
|
|
12886
12920
|
const p = aa();
|
|
12887
12921
|
Nr(_e, p.action === "stop"), _e.disabled = p.disabled, l.querySelectorAll(".pluno-pa-widget__starter-prompt").forEach((w) => {
|
|
12888
12922
|
w.disabled = !bn();
|
|
@@ -12890,21 +12924,21 @@ async function Wm(t = {}) {
|
|
|
12890
12924
|
};
|
|
12891
12925
|
yn();
|
|
12892
12926
|
const Li = () => {
|
|
12893
|
-
const p = M.getState(), w = p.isThinking,
|
|
12894
|
-
F && (F.textContent = "Working..."), l.classList.toggle("pluno-pa-widget--thinking", w), l.classList.toggle("pluno-pa-widget--sending",
|
|
12927
|
+
const p = M.getState(), w = p.isThinking, R = p.turnPhase !== null, A = p.turnPhase === "sending", F = O?.lastElementChild;
|
|
12928
|
+
F && (F.textContent = "Working..."), l.classList.toggle("pluno-pa-widget--thinking", w), l.classList.toggle("pluno-pa-widget--sending", A), l.classList.toggle(
|
|
12895
12929
|
"pluno-pa-widget--unread",
|
|
12896
|
-
!
|
|
12930
|
+
!R && (Un || !!p.lastError)
|
|
12897
12931
|
), yn();
|
|
12898
12932
|
};
|
|
12899
12933
|
Li();
|
|
12900
12934
|
const Ni = () => {
|
|
12901
12935
|
if (!(s() || We))
|
|
12902
|
-
return yn(),
|
|
12936
|
+
return yn(), Re(), M.connect().then(
|
|
12903
12937
|
() => {
|
|
12904
|
-
We || (yn(),
|
|
12938
|
+
We || (yn(), Re());
|
|
12905
12939
|
},
|
|
12906
12940
|
(p) => {
|
|
12907
|
-
We || (yn(),
|
|
12941
|
+
We || (yn(), Re(), ht(
|
|
12908
12942
|
"web-sdk.widget",
|
|
12909
12943
|
"Failed to connect Product Agent widget",
|
|
12910
12944
|
{
|
|
@@ -12918,10 +12952,10 @@ async function Wm(t = {}) {
|
|
|
12918
12952
|
D.textContent = "", D.hidden = !0, L = null;
|
|
12919
12953
|
}, 3e3);
|
|
12920
12954
|
}, Ui = (p, w) => {
|
|
12921
|
-
const
|
|
12922
|
-
if (!
|
|
12923
|
-
const
|
|
12924
|
-
j = j.filter((F) => !
|
|
12955
|
+
const R = ne.get(p);
|
|
12956
|
+
if (!R || w !== void 0 && R.submittedAt !== w || (ne.delete(p), R.generation !== W || R.revision !== ge)) return;
|
|
12957
|
+
const A = new Set(R.attachments);
|
|
12958
|
+
j = j.filter((F) => !A.has(F)), N.value = "", N.dispatchEvent(new Event("input", { bubbles: !0 })), lt(), Re();
|
|
12925
12959
|
}, ca = (p) => {
|
|
12926
12960
|
const w = W;
|
|
12927
12961
|
ay(
|
|
@@ -12931,47 +12965,47 @@ async function Wm(t = {}) {
|
|
|
12931
12965
|
p.clientMessageId,
|
|
12932
12966
|
p.submittedAt,
|
|
12933
12967
|
p.requestedModel
|
|
12934
|
-
).then((
|
|
12935
|
-
w === W && (M.getState().receipts === void 0 && Ui(p.clientMessageId), me?.clientMessageId === p.clientMessageId && (me.pendingSubmission = !1,
|
|
12936
|
-
}).catch((
|
|
12968
|
+
).then((R) => {
|
|
12969
|
+
w === W && (M.getState().receipts === void 0 && Ui(p.clientMessageId), me?.clientMessageId === p.clientMessageId && (me.pendingSubmission = !1, R && (me.clientMessageId = R), Wr()));
|
|
12970
|
+
}).catch((R) => {
|
|
12937
12971
|
if (w !== W) return;
|
|
12938
12972
|
me?.clientMessageId === p.clientMessageId && (me = null), ne.delete(p.clientMessageId), lt();
|
|
12939
|
-
const
|
|
12940
|
-
M.getState().lastError !==
|
|
12973
|
+
const A = R instanceof Error ? R.message : "Failed to upload attachment";
|
|
12974
|
+
M.getState().lastError !== A && xs(A);
|
|
12941
12975
|
}).finally(() => {
|
|
12942
|
-
w === W &&
|
|
12976
|
+
w === W && Re();
|
|
12943
12977
|
});
|
|
12944
12978
|
}, la = () => {
|
|
12945
12979
|
if (We || !se || M.getState().status !== "connected" || s() || Qn(e.billingStatus))
|
|
12946
12980
|
return;
|
|
12947
12981
|
const p = se;
|
|
12948
12982
|
se = null, ca(p);
|
|
12949
|
-
},
|
|
12950
|
-
const p = N.value, w = p.trim(),
|
|
12951
|
-
if (se !== null || ra() || !bn() || !w &&
|
|
12983
|
+
}, Bi = () => {
|
|
12984
|
+
const p = N.value, w = p.trim(), R = [...j];
|
|
12985
|
+
if (se !== null || ra() || !bn() || !w && R.length === 0)
|
|
12952
12986
|
return;
|
|
12953
|
-
for (const F of
|
|
12987
|
+
for (const F of R)
|
|
12954
12988
|
F.id && F.previewUrl && $.set(F.id, F.previewUrl);
|
|
12955
12989
|
if ([...ne.values()].some((F) => F.revision === ge && F.generation === W)) return;
|
|
12956
|
-
const
|
|
12990
|
+
const A = {
|
|
12957
12991
|
inputValue: p,
|
|
12958
12992
|
requestedModel: mn,
|
|
12959
12993
|
value: w,
|
|
12960
|
-
attachments:
|
|
12994
|
+
attachments: R,
|
|
12961
12995
|
clientMessageId: crypto.randomUUID(),
|
|
12962
12996
|
submittedAt: Math.max(Date.now(), ye + 1)
|
|
12963
12997
|
};
|
|
12964
|
-
if (ye =
|
|
12998
|
+
if (ye = A.submittedAt, ne.set(A.clientMessageId, { ...A, revision: ge, generation: W }), Re(), me = {
|
|
12965
12999
|
createdAt: Date.now(),
|
|
12966
|
-
clientMessageId:
|
|
13000
|
+
clientMessageId: A.clientMessageId,
|
|
12967
13001
|
observedConversation: null,
|
|
12968
13002
|
observedWelcome: null,
|
|
12969
13003
|
pendingSubmission: !0
|
|
12970
13004
|
}, Ss() && !e.runtimeClient) {
|
|
12971
|
-
se =
|
|
13005
|
+
se = A;
|
|
12972
13006
|
return;
|
|
12973
13007
|
}
|
|
12974
|
-
ca(
|
|
13008
|
+
ca(A);
|
|
12975
13009
|
};
|
|
12976
13010
|
S.addEventListener("submit", (p) => {
|
|
12977
13011
|
if (p.preventDefault(), e.loginRequired) {
|
|
@@ -12982,14 +13016,14 @@ async function Wm(t = {}) {
|
|
|
12982
13016
|
e.onSignupClick?.();
|
|
12983
13017
|
return;
|
|
12984
13018
|
}
|
|
12985
|
-
bn() && (Ot = !0, nt(!0, "send"), ut(),
|
|
13019
|
+
bn() && (Ot = !0, nt(!0, "send"), ut(), Bi());
|
|
12986
13020
|
});
|
|
12987
|
-
let
|
|
13021
|
+
let Bn = 0;
|
|
12988
13022
|
const Nt = () => {
|
|
12989
|
-
|
|
13023
|
+
Bn = 0, l.classList.remove("pluno-pa-widget--drag-over");
|
|
12990
13024
|
}, Od = () => {
|
|
12991
13025
|
L !== null && (window.clearTimeout(L), L = null), D.textContent = "", D.hidden = !0;
|
|
12992
|
-
},
|
|
13026
|
+
}, zi = async (p) => {
|
|
12993
13027
|
if (!e.attachmentsEnabled || p.length === 0 || tn())
|
|
12994
13028
|
return;
|
|
12995
13029
|
const w = Py(
|
|
@@ -12997,13 +13031,13 @@ async function Wm(t = {}) {
|
|
|
12997
13031
|
p,
|
|
12998
13032
|
e.productVariant === "customer_embedded"
|
|
12999
13033
|
);
|
|
13000
|
-
if (ge++, j = [...j, ...w], lt(), Od(),
|
|
13034
|
+
if (ge++, j = [...j, ...w], lt(), Od(), Re(), Ae(M.getState()), !l.classList.contains("pluno-pa-widget--open")) {
|
|
13001
13035
|
xt("", !0, !0, "attachment_drop");
|
|
13002
13036
|
return;
|
|
13003
13037
|
}
|
|
13004
13038
|
ae("attachment_added");
|
|
13005
13039
|
}, Dd = async (p) => {
|
|
13006
|
-
await
|
|
13040
|
+
await zi(p), !(p.length === 0 || kt !== null) && ie(N, "attachment_picker_completed");
|
|
13007
13041
|
};
|
|
13008
13042
|
ke.addEventListener("click", () => {
|
|
13009
13043
|
e.loginRequired || tn() || Qn(e.billingStatus) || he.click();
|
|
@@ -13017,12 +13051,12 @@ async function Wm(t = {}) {
|
|
|
13017
13051
|
});
|
|
13018
13052
|
});
|
|
13019
13053
|
}), l.addEventListener("dragenter", (p) => {
|
|
13020
|
-
!e.attachmentsEnabled || !Ls(p.dataTransfer) || e.loginRequired || tn() || (p.preventDefault(), p.stopPropagation(),
|
|
13054
|
+
!e.attachmentsEnabled || !Ls(p.dataTransfer) || e.loginRequired || tn() || (p.preventDefault(), p.stopPropagation(), Bn += 1, l.classList.add("pluno-pa-widget--drag-over"));
|
|
13021
13055
|
}), l.addEventListener("dragover", (p) => {
|
|
13022
13056
|
const w = p.dataTransfer;
|
|
13023
13057
|
!e.attachmentsEnabled || !Ls(w) || e.loginRequired || tn() || (p.preventDefault(), p.stopPropagation(), w.dropEffect = "copy");
|
|
13024
13058
|
}), l.addEventListener("dragleave", (p) => {
|
|
13025
|
-
Ls(p.dataTransfer) && (p.stopPropagation(),
|
|
13059
|
+
Ls(p.dataTransfer) && (p.stopPropagation(), Bn = Math.max(0, Bn - 1), Bn === 0 && l.classList.remove("pluno-pa-widget--drag-over"));
|
|
13026
13060
|
});
|
|
13027
13061
|
const da = (p) => {
|
|
13028
13062
|
l.classList.contains("pluno-pa-widget--drag-over") && !p.composedPath().includes(l) && Nt();
|
|
@@ -13033,21 +13067,21 @@ async function Wm(t = {}) {
|
|
|
13033
13067
|
!0
|
|
13034
13068
|
), _.addEventListener("drop", Nt, !0), _.addEventListener("dragend", Nt, !0), _.defaultView?.addEventListener("blur", Nt), l.addEventListener("drop", (p) => {
|
|
13035
13069
|
const w = p.dataTransfer;
|
|
13036
|
-
!e.attachmentsEnabled || !Ls(w) || e.loginRequired || tn() || (p.preventDefault(), p.stopPropagation(), Nt(),
|
|
13070
|
+
!e.attachmentsEnabled || !Ls(w) || e.loginRequired || tn() || (p.preventDefault(), p.stopPropagation(), Nt(), zi(w.files).catch((R) => {
|
|
13037
13071
|
xs(
|
|
13038
|
-
|
|
13072
|
+
R instanceof Error ? R.message : "Failed to attach file"
|
|
13039
13073
|
), ht("web-sdk.widget", "Attachment failed", {
|
|
13040
|
-
...Zn(
|
|
13074
|
+
...Zn(R)
|
|
13041
13075
|
});
|
|
13042
13076
|
}));
|
|
13043
13077
|
}), l.addEventListener("paste", (p) => {
|
|
13044
13078
|
p.stopPropagation();
|
|
13045
|
-
const w = p.clipboardData,
|
|
13046
|
-
!e.attachmentsEnabled ||
|
|
13079
|
+
const w = p.clipboardData, R = Array.from(w?.files ?? []);
|
|
13080
|
+
!e.attachmentsEnabled || R.length === 0 || e.loginRequired || tn() || (p.preventDefault(), zi(R).catch((A) => {
|
|
13047
13081
|
xs(
|
|
13048
|
-
|
|
13082
|
+
A instanceof Error ? A.message : "Failed to attach file"
|
|
13049
13083
|
), ht("web-sdk.widget", "Attachment failed", {
|
|
13050
|
-
...Zn(
|
|
13084
|
+
...Zn(A)
|
|
13051
13085
|
});
|
|
13052
13086
|
}));
|
|
13053
13087
|
}), _e.addEventListener("click", () => {
|
|
@@ -13059,29 +13093,29 @@ async function Wm(t = {}) {
|
|
|
13059
13093
|
if (p.disabled)
|
|
13060
13094
|
return;
|
|
13061
13095
|
if (p.action === "stop") {
|
|
13062
|
-
ne.clear(), se = null, me = null, M.stop(),
|
|
13096
|
+
ne.clear(), se = null, me = null, M.stop(), Re();
|
|
13063
13097
|
return;
|
|
13064
13098
|
}
|
|
13065
13099
|
const w = N.value.trim().length > 0 || j.length > 0;
|
|
13066
|
-
Ot = !0, nt(!0, "send"), ut(),
|
|
13100
|
+
Ot = !0, nt(!0, "send"), ut(), Bi(), Ae(M.getState()), Re(), w && ae("send_button_submit");
|
|
13067
13101
|
}), be.addEventListener("click", () => {
|
|
13068
|
-
|
|
13102
|
+
Be = !Be, St(), Be && (Fe.data === null || Fe.status === "error") && Fe.status !== "loading" && Ti(), Be || ae("history_closed");
|
|
13069
13103
|
}), et.addEventListener("click", () => {
|
|
13070
|
-
|
|
13104
|
+
Be = !1, St(), ae("history_closed");
|
|
13071
13105
|
}), Ce.addEventListener("scroll", xd), N.addEventListener("input", () => {
|
|
13072
|
-
ge++, Xn(N), $e(),
|
|
13106
|
+
ge++, Xn(N), $e(), Re();
|
|
13073
13107
|
}), N.addEventListener("keydown", (p) => {
|
|
13074
13108
|
if (!(p.key !== "Enter" || p.shiftKey || p.isComposing || p.keyCode === 229)) {
|
|
13075
13109
|
if (p.preventDefault(), e.loginRequired) {
|
|
13076
13110
|
e.onLoginClick?.();
|
|
13077
13111
|
return;
|
|
13078
13112
|
}
|
|
13079
|
-
bn() && (Ot = !0, nt(!0, "send"), ut(),
|
|
13113
|
+
bn() && (Ot = !0, nt(!0, "send"), ut(), Bi(), Ae(M.getState()), Re());
|
|
13080
13114
|
}
|
|
13081
13115
|
}), l.addEventListener("click", (p) => {
|
|
13082
13116
|
const w = p.target instanceof Element ? p.target : null;
|
|
13083
|
-
w?.closest("a[href]") && $e(),
|
|
13084
|
-
const
|
|
13117
|
+
w?.closest("a[href]") && $e(), Be && om(w, Ze, be) && (Be = !1, St());
|
|
13118
|
+
const A = window.getSelection(), F = !!(A && !A.isCollapsed && A.anchorNode && l.contains(A.anchorNode));
|
|
13085
13119
|
sm(p.target, p.detail, F) && ae("passive_surface_click");
|
|
13086
13120
|
});
|
|
13087
13121
|
let ua = !1;
|
|
@@ -13090,17 +13124,17 @@ async function Wm(t = {}) {
|
|
|
13090
13124
|
}, ha = (p) => {
|
|
13091
13125
|
if (!ua || E.hidden || l.classList.contains("pluno-pa-widget--closing"))
|
|
13092
13126
|
return;
|
|
13093
|
-
const w = c.activeElement ?? _.activeElement,
|
|
13094
|
-
if (!
|
|
13127
|
+
const w = c.activeElement ?? _.activeElement, R = am(p, w);
|
|
13128
|
+
if (!R || N.disabled || N.readOnly)
|
|
13095
13129
|
return;
|
|
13096
13130
|
p.preventDefault();
|
|
13097
|
-
const
|
|
13131
|
+
const A = cm(
|
|
13098
13132
|
N.value,
|
|
13099
13133
|
N.selectionStart,
|
|
13100
13134
|
N.selectionEnd,
|
|
13101
|
-
|
|
13135
|
+
R
|
|
13102
13136
|
);
|
|
13103
|
-
N.value =
|
|
13137
|
+
N.value = A.value, N.dispatchEvent(new Event("input", { bubbles: !0 })), rm(N), N.setSelectionRange(A.caret, A.caret);
|
|
13104
13138
|
};
|
|
13105
13139
|
_.addEventListener(
|
|
13106
13140
|
"pointerdown",
|
|
@@ -13133,33 +13167,33 @@ async function Wm(t = {}) {
|
|
|
13133
13167
|
pd(p), p.stopPropagation();
|
|
13134
13168
|
return;
|
|
13135
13169
|
}
|
|
13136
|
-
p.key !== "Escape" || !
|
|
13170
|
+
p.key !== "Escape" || !Be || (Be = !1, St(), ae("history_escape"));
|
|
13137
13171
|
}), d.composerValue && (N.value = d.composerValue, Xn(N)), e.layout === "page" ? xt(N.value, !1, !0, "external_request") : h === "minimized" ? On("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && xt(N.value, !1, !1, "restored_state");
|
|
13138
|
-
const
|
|
13172
|
+
const zn = () => u;
|
|
13139
13173
|
let ji = M.getState().appearance !== null, Fi = M.getInteractions();
|
|
13140
|
-
const Ld = (p, w,
|
|
13174
|
+
const Ld = (p, w, R) => p ? M.actOnInteraction(
|
|
13141
13175
|
p.id,
|
|
13142
13176
|
w,
|
|
13143
13177
|
p.revision,
|
|
13144
|
-
{ ...
|
|
13178
|
+
{ ...R, expectedSourceVersion: p.sourceVersion, ...w === "run" ? { requestedModel: mn } : {} }
|
|
13145
13179
|
) : Promise.resolve();
|
|
13146
13180
|
let $i = M.getState().isThinking;
|
|
13147
|
-
const jn = /* @__PURE__ */ new Map(), ks = /* @__PURE__ */ new Map(), Es = /* @__PURE__ */ new Map(), Cs = /* @__PURE__ */ new Map(), Nd = async (p, w,
|
|
13148
|
-
const
|
|
13149
|
-
if (!
|
|
13150
|
-
Cs.set(p,
|
|
13181
|
+
const jn = /* @__PURE__ */ new Map(), ks = /* @__PURE__ */ new Map(), Es = /* @__PURE__ */ new Map(), Cs = /* @__PURE__ */ new Map(), Nd = async (p, w, R) => {
|
|
13182
|
+
const A = Cs.get(p) ?? /* @__PURE__ */ new Set();
|
|
13183
|
+
if (!A.has(w)) {
|
|
13184
|
+
Cs.set(p, A), A.add(w), Ae(M.getState());
|
|
13151
13185
|
try {
|
|
13152
|
-
await
|
|
13186
|
+
await R();
|
|
13153
13187
|
} finally {
|
|
13154
|
-
|
|
13188
|
+
A.delete(w), A.size || Cs.delete(p), We || Ae(M.getState());
|
|
13155
13189
|
}
|
|
13156
13190
|
}
|
|
13157
13191
|
};
|
|
13158
13192
|
let wn = null;
|
|
13159
13193
|
const Hi = (p = {}) => {
|
|
13160
|
-
W++, ne.clear(), Q(), se = null, me = null, Mn = !1, fs.clear(), Ot = !0, nt(!0, "newSession"), ut(),
|
|
13194
|
+
W++, ne.clear(), Q(), se = null, me = null, Mn = !1, fs.clear(), Ot = !0, nt(!0, "newSession"), ut(), Be = !1, St();
|
|
13161
13195
|
const w = Promise.resolve(M.startNewSession(p));
|
|
13162
|
-
return xi.clear(), N.value = "", j = [], lt(), Xn(N), $e(),
|
|
13196
|
+
return xi.clear(), N.value = "", j = [], lt(), Xn(N), $e(), Re(), ie(N, "new_chat"), Ae(M.getState()), w;
|
|
13163
13197
|
}, Fn = (p) => {
|
|
13164
13198
|
if (s() || !p || e.layout === "page") {
|
|
13165
13199
|
wn?.remove(), wn = null;
|
|
@@ -13170,7 +13204,7 @@ async function Wm(t = {}) {
|
|
|
13170
13204
|
"New chat",
|
|
13171
13205
|
vy(),
|
|
13172
13206
|
!1
|
|
13173
|
-
), wn.addEventListener("click", () => Hi()),
|
|
13207
|
+
), wn.addEventListener("click", () => Hi()), Ue.insertBefore(wn, be));
|
|
13174
13208
|
}, Et = document.createElement("div");
|
|
13175
13209
|
Et.className = "pluno-pa-widget__error";
|
|
13176
13210
|
const Ki = document.createTextNode("");
|
|
@@ -13181,10 +13215,10 @@ async function Wm(t = {}) {
|
|
|
13181
13215
|
pt.type = "button", pt.className = "pluno-pa-widget__error-retry";
|
|
13182
13216
|
const ga = kn(), fa = document.createTextNode("Try again");
|
|
13183
13217
|
pt.append(ga, fa);
|
|
13184
|
-
let ma = "",
|
|
13218
|
+
let ma = "", Bt = !1;
|
|
13185
13219
|
const Ud = async () => {
|
|
13186
|
-
if (
|
|
13187
|
-
|
|
13220
|
+
if (Bt) return;
|
|
13221
|
+
Bt = !0, Ae(M.getState());
|
|
13188
13222
|
let p;
|
|
13189
13223
|
try {
|
|
13190
13224
|
await Promise.race([
|
|
@@ -13194,19 +13228,19 @@ async function Wm(t = {}) {
|
|
|
13194
13228
|
})
|
|
13195
13229
|
]);
|
|
13196
13230
|
} finally {
|
|
13197
|
-
clearTimeout(p),
|
|
13231
|
+
clearTimeout(p), Bt = !1, We || Ae(M.getState());
|
|
13198
13232
|
}
|
|
13199
13233
|
};
|
|
13200
13234
|
pt.addEventListener("click", () => {
|
|
13201
13235
|
Ud();
|
|
13202
13236
|
});
|
|
13203
|
-
let nn = !1, $n = null,
|
|
13204
|
-
const
|
|
13205
|
-
jr(p) && (me = null),
|
|
13206
|
-
const
|
|
13207
|
-
l.dataset.conversationGate = e.loginRequired ||
|
|
13237
|
+
let nn = !1, $n = null, Rs = 0, Wi = 0;
|
|
13238
|
+
const Ae = (p, w = {}) => {
|
|
13239
|
+
jr(p) && (me = null), zr = w.renderSource ?? "local";
|
|
13240
|
+
const R = n();
|
|
13241
|
+
l.dataset.conversationGate = e.loginRequired || R ? "authentication" : e.signupRequired ? "signup" : "none", l.classList.toggle(
|
|
13208
13242
|
"pluno-pa-widget--logged-out",
|
|
13209
|
-
(e.loginRequired ||
|
|
13243
|
+
(e.loginRequired || R) && e.entrySurface === "extension_widget"
|
|
13210
13244
|
), J.classList.remove("pluno-pa-widget__access-notice--login-only"), p = { ...p, messages: p.messages.map((ue) => {
|
|
13211
13245
|
if (!ue.attachments?.some((Oe) => Oe.id && !Oe.fileUrl && $.has(Oe.id))) return ue;
|
|
13212
13246
|
const Ct = ue.attachments.map((Oe) => {
|
|
@@ -13218,24 +13252,24 @@ async function Wm(t = {}) {
|
|
|
13218
13252
|
attachments: { value: Ct, enumerable: !0, configurable: !0 }
|
|
13219
13253
|
});
|
|
13220
13254
|
}) }, St(), re(), J.hidden = !s(), J.hidden && J.replaceChildren();
|
|
13221
|
-
const
|
|
13255
|
+
const A = JSON.stringify([
|
|
13222
13256
|
s(),
|
|
13223
13257
|
p.lastError,
|
|
13224
13258
|
p.lastErrorCode,
|
|
13225
13259
|
p.lastErrorSecuritySettingsUrl,
|
|
13226
|
-
|
|
13260
|
+
Bt
|
|
13227
13261
|
]);
|
|
13228
|
-
if (ma !==
|
|
13229
|
-
ma =
|
|
13262
|
+
if (ma !== A) {
|
|
13263
|
+
ma = A, ce.hidden = s() || !p.lastError || as(p.lastErrorCode) !== "bottom_notice";
|
|
13230
13264
|
const ue = ce.hidden ? "" : p.lastError ?? "";
|
|
13231
|
-
Ki.data !== ue && (Ki.data = ue), ce.hidden ? Et.remove() : Et.parentElement !== ce && ce.appendChild(Et), p.lastErrorSecuritySettingsUrl ? (Ut.href = p.lastErrorSecuritySettingsUrl, Ut.parentElement !== Et && Et.insertBefore(Ut, pt.parentElement ? pt : null)) : Ut.remove(), p.lastErrorCode === "connection_failed" || p.lastErrorCode === "auth_reconnecting" || p.lastErrorCode === "submission_checkpoint_pending" ? (pt.disabled =
|
|
13265
|
+
Ki.data !== ue && (Ki.data = ue), ce.hidden ? Et.remove() : Et.parentElement !== ce && ce.appendChild(Et), p.lastErrorSecuritySettingsUrl ? (Ut.href = p.lastErrorSecuritySettingsUrl, Ut.parentElement !== Et && Et.insertBefore(Ut, pt.parentElement ? pt : null)) : Ut.remove(), p.lastErrorCode === "connection_failed" || p.lastErrorCode === "auth_reconnecting" || p.lastErrorCode === "submission_checkpoint_pending" ? (pt.disabled = Bt, pt.setAttribute("aria-busy", String(Bt)), ga.hidden = !Bt, fa.data = Bt ? "Trying" : "Try again", pt.parentElement !== Et && Et.appendChild(pt)) : pt.remove();
|
|
13232
13266
|
}
|
|
13233
|
-
if (
|
|
13267
|
+
if (R) {
|
|
13234
13268
|
Pn = "", jn.clear(), ks.clear(), Es.clear(), x.replaceChildren(), Ns(
|
|
13235
13269
|
J,
|
|
13236
13270
|
_e,
|
|
13237
13271
|
Fn,
|
|
13238
|
-
|
|
13272
|
+
zn,
|
|
13239
13273
|
"Connecting to Pluno…",
|
|
13240
13274
|
null,
|
|
13241
13275
|
void 0,
|
|
@@ -13252,7 +13286,7 @@ async function Wm(t = {}) {
|
|
|
13252
13286
|
J,
|
|
13253
13287
|
_e,
|
|
13254
13288
|
Fn,
|
|
13255
|
-
|
|
13289
|
+
zn,
|
|
13256
13290
|
($n ?? ue.message).replace(new RegExp("(?<=[.!?])\\s+", "g"), `
|
|
13257
13291
|
`),
|
|
13258
13292
|
nn ? "Trying" : "Try again",
|
|
@@ -13262,11 +13296,11 @@ async function Wm(t = {}) {
|
|
|
13262
13296
|
);
|
|
13263
13297
|
const Oe = J.querySelector(".pluno-pa-widget__login");
|
|
13264
13298
|
Oe.disabled = nn, Oe.setAttribute("aria-busy", String(nn)), nn && Oe.prepend(kn()), Oe.addEventListener("click", () => {
|
|
13265
|
-
const Hn = ++
|
|
13266
|
-
nn = !0, $n = null,
|
|
13267
|
-
Hn !==
|
|
13299
|
+
const Hn = ++Rs, Kd = Wi;
|
|
13300
|
+
nn = !0, $n = null, Ae(M.getState()), Ct().catch((ba) => {
|
|
13301
|
+
Hn !== Rs || Kd !== Wi || ($n = ba instanceof Error ? ba.message : "Close and reopen Pluno to try again.");
|
|
13268
13302
|
}).finally(() => {
|
|
13269
|
-
Hn ===
|
|
13303
|
+
Hn === Rs && (nn = !1, We || Ae(M.getState()));
|
|
13270
13304
|
});
|
|
13271
13305
|
});
|
|
13272
13306
|
return;
|
|
@@ -13275,7 +13309,7 @@ async function Wm(t = {}) {
|
|
|
13275
13309
|
J,
|
|
13276
13310
|
_e,
|
|
13277
13311
|
Fn,
|
|
13278
|
-
|
|
13312
|
+
zn,
|
|
13279
13313
|
e.entrySurface === "extension_widget" ? null : "Log in to use Pluno on this page.",
|
|
13280
13314
|
e.loginButtonLabel,
|
|
13281
13315
|
e.loginUrl,
|
|
@@ -13289,7 +13323,7 @@ async function Wm(t = {}) {
|
|
|
13289
13323
|
J,
|
|
13290
13324
|
_e,
|
|
13291
13325
|
Fn,
|
|
13292
|
-
|
|
13326
|
+
zn,
|
|
13293
13327
|
"Complete signup to unlock your free trial credits.",
|
|
13294
13328
|
e.signupButtonLabel,
|
|
13295
13329
|
e.signupUrl,
|
|
@@ -13307,7 +13341,7 @@ async function Wm(t = {}) {
|
|
|
13307
13341
|
]), de = F !== Pn;
|
|
13308
13342
|
Pn = F;
|
|
13309
13343
|
const Ee = Ot || It.enabled;
|
|
13310
|
-
Ot = !1, (de || w.skipUnchangedTimeline !== !0) &&
|
|
13344
|
+
Ot = !1, (de || w.skipUnchangedTimeline !== !0) && By(
|
|
13311
13345
|
x,
|
|
13312
13346
|
C,
|
|
13313
13347
|
_e,
|
|
@@ -13320,7 +13354,7 @@ async function Wm(t = {}) {
|
|
|
13320
13354
|
ks,
|
|
13321
13355
|
Es,
|
|
13322
13356
|
$e,
|
|
13323
|
-
|
|
13357
|
+
zn,
|
|
13324
13358
|
(ue, Ct) => {
|
|
13325
13359
|
bn() && (Ot = !0, nt(!0, "send"), ut(), M.sendMessage(ue, { requestedModel: mn }));
|
|
13326
13360
|
},
|
|
@@ -13343,34 +13377,34 @@ async function Wm(t = {}) {
|
|
|
13343
13377
|
const Te = !!x.querySelector(
|
|
13344
13378
|
".pluno-pa-widget__empty-state--starter"
|
|
13345
13379
|
);
|
|
13346
|
-
me && !me.observedWelcome && !Te && kc(p) && (me.observedConversation = Fr(p)), Wr(),
|
|
13380
|
+
me && !me.observedWelcome && !Te && kc(p) && (me.observedConversation = Fr(p)), Wr(), Re(), Ee ? (Dt = x.scrollTop, ut()) : de && kc(p) && Id();
|
|
13347
13381
|
}, ya = () => {
|
|
13348
|
-
_.getSelection()?.isCollapsed !== !1 && Wy(jn) &&
|
|
13382
|
+
_.getSelection()?.isCollapsed !== !1 && Wy(jn) && Ae(M.getState());
|
|
13349
13383
|
};
|
|
13350
13384
|
_.addEventListener(
|
|
13351
13385
|
"selectionchange",
|
|
13352
13386
|
ya
|
|
13353
13387
|
);
|
|
13354
|
-
const
|
|
13355
|
-
Fi = p, We ||
|
|
13356
|
-
}),
|
|
13388
|
+
const Bd = M.subscribeInteractions((p) => {
|
|
13389
|
+
Fi = p, We || Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
|
|
13390
|
+
}), zd = M.subscribeAccount((p) => {
|
|
13357
13391
|
if (!p && !Is) return;
|
|
13358
|
-
const w = p?.auth,
|
|
13359
|
-
|
|
13360
|
-
const
|
|
13361
|
-
e.billingStatus = p, i(p), yn(),
|
|
13392
|
+
const w = p?.auth, R = w?.workspace?.id;
|
|
13393
|
+
R && (Si !== null && Si !== R && (mn = Ii), Si = R), (w?.status !== "error" || w.errorCode !== "browser_session_unavailable" && w.errorCode !== "backend_auth_pending") && (Rs += 1, $n = null, nn = !1);
|
|
13394
|
+
const A = s();
|
|
13395
|
+
e.billingStatus = p, i(p), yn(), Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), re(), Re(), queueMicrotask(la), A && !s() && Ni();
|
|
13362
13396
|
});
|
|
13363
13397
|
M.on("state", (p) => {
|
|
13364
13398
|
const w = p.user?.id ?? null;
|
|
13365
|
-
Yt !== null && Yt !== w && (mn = Ii), (
|
|
13399
|
+
Yt !== null && Yt !== w && (mn = Ii), (An !== null && An !== p.sessionId || Yt !== null && Yt !== w || Tn !== void 0 && Tn !== p.selectionKey) && (W++, ne.clear(), me = null), Tn = p.selectionKey, An = p.sessionId, Yt = w;
|
|
13366
13400
|
for (const Te of p.messages)
|
|
13367
13401
|
Te.role === "user" && Ui(Te.id);
|
|
13368
13402
|
for (const Te of p.receipts ?? []) Ui(Te.userMessageId, Te.acceptedRendererRevision);
|
|
13369
13403
|
e.extensionRuntime && (Wi += 1, $n = null), p.status === "connected" && (Is = !0, se && queueMicrotask(() => {
|
|
13370
13404
|
la();
|
|
13371
13405
|
}));
|
|
13372
|
-
const
|
|
13373
|
-
$r = location.origin, Hr = p.sessionId, Kr = p.user?.id ?? null, Ei = p.status, $i = p.isThinking, Ee && tt !== null && (window.clearTimeout(tt), tt = null), l.classList.contains("pluno-pa-widget--open") && p.status === "connected" && (
|
|
13406
|
+
const R = $i && !p.isThinking, A = $r !== location.origin || Hr !== p.sessionId || Kr !== (p.user?.id ?? null), F = $i !== p.isThinking, de = Ei !== "connected" && p.status === "connected", Ee = Ei === "connected" && p.status !== "connected";
|
|
13407
|
+
$r = location.origin, Hr = p.sessionId, Kr = p.user?.id ?? null, Ei = p.status, $i = p.isThinking, Ee && tt !== null && (window.clearTimeout(tt), tt = null), l.classList.contains("pluno-pa-widget--open") && p.status === "connected" && (A || F || de) && Mi(), R && !l.classList.contains("pluno-pa-widget--open") && (Un = !0), Li(), p.appearance ? (ji = !0, ht(
|
|
13374
13408
|
"web-sdk.widget",
|
|
13375
13409
|
"Agent state supplied appearance",
|
|
13376
13410
|
{
|
|
@@ -13384,19 +13418,19 @@ async function Wm(t = {}) {
|
|
|
13384
13418
|
fallbackColorScheme: e.colorScheme,
|
|
13385
13419
|
fallbackFontFamily: e.fontFamily
|
|
13386
13420
|
}
|
|
13387
|
-
), Vi({}, "agent.state.appearance-cleared")),
|
|
13421
|
+
), Vi({}, "agent.state.appearance-cleared")), Ae(p, { skipUnchangedTimeline: !0, renderSource: "state" }), Re();
|
|
13388
13422
|
});
|
|
13389
13423
|
const jd = M.getState();
|
|
13390
|
-
|
|
13391
|
-
const Fd = Pu(l, (p, w,
|
|
13392
|
-
const de = ku(M.getState(),
|
|
13393
|
-
M.reportDisplayedError?.(p, w,
|
|
13424
|
+
Ae(jd), Re(), Ni();
|
|
13425
|
+
const Fd = Pu(l, (p, w, R, A, F) => {
|
|
13426
|
+
const de = ku(M.getState(), A);
|
|
13427
|
+
M.reportDisplayedError?.(p, w, R, de ?? void 0, F);
|
|
13394
13428
|
}), $d = gm(
|
|
13395
13429
|
a,
|
|
13396
13430
|
l,
|
|
13397
13431
|
e.extensionRuntime || e.entrySurface === "extension_widget" ? "extension_widget" : e.entrySurface === "main_web_chat" ? "main_web_chat" : "embedded_widget",
|
|
13398
13432
|
M
|
|
13399
|
-
), Hd = qu(l,
|
|
13433
|
+
), Hd = qu(l, Ai);
|
|
13400
13434
|
return {
|
|
13401
13435
|
agent: M,
|
|
13402
13436
|
startNewChat: Hi,
|
|
@@ -13406,8 +13440,8 @@ async function Wm(t = {}) {
|
|
|
13406
13440
|
p.scribbleStyle !== void 0 && (e.scribbleStyle = p.scribbleStyle), Vi(p, "widgetHandle.updateAppearance");
|
|
13407
13441
|
},
|
|
13408
13442
|
openPanel: (p) => {
|
|
13409
|
-
const w = typeof p == "string" ? p : N.value,
|
|
13410
|
-
xt(w, !1,
|
|
13443
|
+
const w = typeof p == "string" ? p : N.value, R = typeof p == "object" ? p.focusComposer !== !1 : !0, A = typeof p == "object" ? p.trigger ?? "external_request" : "external_request";
|
|
13444
|
+
xt(w, !1, R, A);
|
|
13411
13445
|
},
|
|
13412
13446
|
closePanel: Qr,
|
|
13413
13447
|
updateDisplayState: (p) => {
|
|
@@ -13418,7 +13452,7 @@ async function Wm(t = {}) {
|
|
|
13418
13452
|
On("minimized", !1);
|
|
13419
13453
|
},
|
|
13420
13454
|
destroy: () => {
|
|
13421
|
-
We || (Fd(), $d.dispose(), Hd(), $e(), We = !0, Q(),
|
|
13455
|
+
We || (Fd(), $d.dispose(), Hd(), $e(), We = !0, Q(), Bd(), zd(), Gr.disconnect(), _.removeEventListener(
|
|
13422
13456
|
"selectionchange",
|
|
13423
13457
|
ya
|
|
13424
13458
|
), _.removeEventListener(
|
|
@@ -13447,24 +13481,24 @@ async function Wm(t = {}) {
|
|
|
13447
13481
|
), _.removeEventListener("drop", Nt, !0), _.removeEventListener("dragend", Nt, !0), _.defaultView?.removeEventListener(
|
|
13448
13482
|
"blur",
|
|
13449
13483
|
Nt
|
|
13450
|
-
), window.removeEventListener("resize", Jr), Yr(), Cd(),
|
|
13484
|
+
), window.removeEventListener("resize", Jr), Yr(), Cd(), Rd(), L !== null && window.clearTimeout(L), tt !== null && (window.clearTimeout(tt), tt = null), vd(), Xt !== null && (window.clearTimeout(Xt), Xt = null), Jt && M.destroy(), ve?.release(), a.remove());
|
|
13451
13485
|
}
|
|
13452
13486
|
};
|
|
13453
13487
|
function Vi(p, w) {
|
|
13454
|
-
const
|
|
13488
|
+
const R = p.accentColor ?? e.accentColor, A = p.colorScheme ?? e.colorScheme, F = p.fontFamily ?? e.fontFamily, de = p.scribbleStyle ?? e.scribbleStyle, Ee = JSON.stringify([R, A, F, de]);
|
|
13455
13489
|
Ee !== b && (b = Ee, u = wc(
|
|
13456
|
-
|
|
13490
|
+
R,
|
|
13457
13491
|
de
|
|
13458
13492
|
), _c(l, u, {
|
|
13459
|
-
accentColor:
|
|
13460
|
-
colorScheme:
|
|
13493
|
+
accentColor: R,
|
|
13494
|
+
colorScheme: A,
|
|
13461
13495
|
fontFamily: F,
|
|
13462
13496
|
scribbleStyle: de
|
|
13463
13497
|
}), ht("web-sdk.widget", "Updated widget appearance", {
|
|
13464
13498
|
source: w,
|
|
13465
13499
|
inputAppearance: p,
|
|
13466
|
-
appliedAccentColor:
|
|
13467
|
-
appliedColorScheme:
|
|
13500
|
+
appliedAccentColor: R,
|
|
13501
|
+
appliedColorScheme: A,
|
|
13468
13502
|
appliedFontFamily: F,
|
|
13469
13503
|
appliedScribbleStyle: de,
|
|
13470
13504
|
cssAccent: l.style.getPropertyValue("--pluno-pa-accent")
|
|
@@ -14400,7 +14434,7 @@ function yy(t, e) {
|
|
|
14400
14434
|
opacity: "0.48"
|
|
14401
14435
|
});
|
|
14402
14436
|
const _ = K(i, "g", { filter: ot(s.eyeShadow) });
|
|
14403
|
-
return
|
|
14437
|
+
return Rc(
|
|
14404
14438
|
_,
|
|
14405
14439
|
"rotate(-2 528 463)",
|
|
14406
14440
|
"528",
|
|
@@ -14410,7 +14444,7 @@ function yy(t, e) {
|
|
|
14410
14444
|
"557",
|
|
14411
14445
|
"447",
|
|
14412
14446
|
s
|
|
14413
|
-
),
|
|
14447
|
+
), Rc(
|
|
14414
14448
|
_,
|
|
14415
14449
|
"rotate(2 717 462)",
|
|
14416
14450
|
"717",
|
|
@@ -14467,7 +14501,7 @@ function by(t, e) {
|
|
|
14467
14501
|
stroke: ai,
|
|
14468
14502
|
"stroke-width": "18",
|
|
14469
14503
|
"stroke-linejoin": "round"
|
|
14470
|
-
}),
|
|
14504
|
+
}), Ac(
|
|
14471
14505
|
c,
|
|
14472
14506
|
"rotate(-2 528 463)",
|
|
14473
14507
|
"528",
|
|
@@ -14476,7 +14510,7 @@ function by(t, e) {
|
|
|
14476
14510
|
"473",
|
|
14477
14511
|
"557",
|
|
14478
14512
|
"447"
|
|
14479
|
-
),
|
|
14513
|
+
), Ac(
|
|
14480
14514
|
c,
|
|
14481
14515
|
"rotate(2 717 462)",
|
|
14482
14516
|
"717",
|
|
@@ -14493,7 +14527,7 @@ function od() {
|
|
|
14493
14527
|
viewBox: "0 0 1254 1254"
|
|
14494
14528
|
});
|
|
14495
14529
|
}
|
|
14496
|
-
function
|
|
14530
|
+
function Rc(t, e, n, s, i, o, r, a, c) {
|
|
14497
14531
|
const l = K(t, "g", { transform: e });
|
|
14498
14532
|
K(l, "ellipse", {
|
|
14499
14533
|
cx: n,
|
|
@@ -14515,7 +14549,7 @@ function Ac(t, e, n, s, i, o, r, a, c) {
|
|
|
14515
14549
|
fill: "#ffffff"
|
|
14516
14550
|
});
|
|
14517
14551
|
}
|
|
14518
|
-
function
|
|
14552
|
+
function Ac(t, e, n, s, i, o, r, a) {
|
|
14519
14553
|
const c = K(t, "g", { transform: e });
|
|
14520
14554
|
K(c, "ellipse", {
|
|
14521
14555
|
cx: n,
|
|
@@ -14561,10 +14595,10 @@ function wy() {
|
|
|
14561
14595
|
width: "0",
|
|
14562
14596
|
height: "0"
|
|
14563
14597
|
}), e = te("defs");
|
|
14564
|
-
return e.appendChild(
|
|
14565
|
-
|
|
14598
|
+
return e.appendChild(Ao("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
|
|
14599
|
+
Ao("pluno-pa-scribble-wobble-2", "5", "15")
|
|
14566
14600
|
), e.appendChild(
|
|
14567
|
-
|
|
14601
|
+
Ao("pluno-pa-scribble-wobble-3", "9", "19")
|
|
14568
14602
|
), t.appendChild(e), t;
|
|
14569
14603
|
}
|
|
14570
14604
|
function rd(t, e) {
|
|
@@ -14576,14 +14610,14 @@ function rd(t, e) {
|
|
|
14576
14610
|
});
|
|
14577
14611
|
return ad(n, e), n;
|
|
14578
14612
|
}
|
|
14579
|
-
function
|
|
14613
|
+
function Ro(t, e) {
|
|
14580
14614
|
if (!t)
|
|
14581
14615
|
return;
|
|
14582
14616
|
const n = Math.max(
|
|
14583
14617
|
0,
|
|
14584
14618
|
e - dr * 2
|
|
14585
14619
|
), s = Math.max(
|
|
14586
|
-
|
|
14620
|
+
zm,
|
|
14587
14621
|
Math.floor(
|
|
14588
14622
|
(n - lr * 2) / cr
|
|
14589
14623
|
)
|
|
@@ -14596,7 +14630,7 @@ function ad(t, e) {
|
|
|
14596
14630
|
const n = e * cr + lr * 2;
|
|
14597
14631
|
t.dataset.spiralCount = `${e}`, t.setAttribute(
|
|
14598
14632
|
"viewBox",
|
|
14599
|
-
`0 0 ${n} ${
|
|
14633
|
+
`0 0 ${n} ${Bm}`
|
|
14600
14634
|
), t.replaceChildren();
|
|
14601
14635
|
for (let s = 0; s < e; s += 1) {
|
|
14602
14636
|
const i = yc[s % yc.length], o = te("g", {
|
|
@@ -14624,7 +14658,7 @@ function ad(t, e) {
|
|
|
14624
14658
|
), t.appendChild(o);
|
|
14625
14659
|
}
|
|
14626
14660
|
}
|
|
14627
|
-
function
|
|
14661
|
+
function Ao(t, e, n) {
|
|
14628
14662
|
const s = te("filter", {
|
|
14629
14663
|
id: t,
|
|
14630
14664
|
x: "-8%",
|
|
@@ -14863,18 +14897,18 @@ function pd(t) {
|
|
|
14863
14897
|
e.input.value === n && e.input.selectionStart === e.start && e.input.selectionEnd === e.end && ud(e);
|
|
14864
14898
|
});
|
|
14865
14899
|
}
|
|
14866
|
-
function
|
|
14900
|
+
function Ry(t, e, n) {
|
|
14867
14901
|
t.replaceChildren(), t.hidden = e.length === 0;
|
|
14868
14902
|
for (let s = 0; s < e.length; s += 1) {
|
|
14869
14903
|
const i = e[s], o = document.createElement("div");
|
|
14870
|
-
o.className = "pluno-pa-widget__attachment", o.appendChild(
|
|
14904
|
+
o.className = "pluno-pa-widget__attachment", o.appendChild(Ay(i));
|
|
14871
14905
|
const r = document.createElement("span");
|
|
14872
14906
|
r.textContent = i.name, o.appendChild(r);
|
|
14873
14907
|
const a = document.createElement("button");
|
|
14874
14908
|
a.type = "button", a.setAttribute("aria-label", `Remove ${i.name}`), a.appendChild(Ey()), a.addEventListener("click", () => n(s)), o.appendChild(a), t.appendChild(o);
|
|
14875
14909
|
}
|
|
14876
14910
|
}
|
|
14877
|
-
function
|
|
14911
|
+
function Ay(t) {
|
|
14878
14912
|
const e = Or(t), n = li(t);
|
|
14879
14913
|
if (e === "image" && n) {
|
|
14880
14914
|
const s = document.createElement("img");
|
|
@@ -15104,7 +15138,7 @@ function Pc(t, e) {
|
|
|
15104
15138
|
const s = n[1], i = e ? "Finding example tasks..." : " ";
|
|
15105
15139
|
s.textContent !== i && (s.textContent = i), s.classList.toggle("pluno-pa-widget__starter-placeholder--loading", e), s.parentElement.setAttribute("aria-hidden", String(!e));
|
|
15106
15140
|
}
|
|
15107
|
-
function
|
|
15141
|
+
function By(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
15108
15142
|
const k = Yf(i), T = Yy(i), O = Xy(
|
|
15109
15143
|
T.filter(
|
|
15110
15144
|
(x) => !x.scheduledCheckInAt
|
|
@@ -15115,9 +15149,9 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15115
15149
|
const E = i.activeResponseUserMessageId;
|
|
15116
15150
|
if (k.showProgress && i.turnPhase && !i.assistantDraft && E) {
|
|
15117
15151
|
const x = O.findIndex(
|
|
15118
|
-
(
|
|
15152
|
+
(B) => B.role === "user" && B.id === E
|
|
15119
15153
|
), C = O.some(
|
|
15120
|
-
(
|
|
15154
|
+
(B) => B.role !== "user" && B.respondsToUserMessageId === E
|
|
15121
15155
|
);
|
|
15122
15156
|
x !== -1 && !C && O.splice(x + 1, 0, {
|
|
15123
15157
|
id: `turn-status:${E}`,
|
|
@@ -15129,7 +15163,7 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15129
15163
|
loading: !0
|
|
15130
15164
|
});
|
|
15131
15165
|
}
|
|
15132
|
-
const
|
|
15166
|
+
const z = t.scrollTop, P = [], G = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set(), D = (x) => {
|
|
15133
15167
|
x === e && P.push(t.querySelector('slot[name="conversation-notices"]') ?? sd("conversation-notices")), x.dataset.sessionId = i.sessionId ?? "", P.push(x);
|
|
15134
15168
|
};
|
|
15135
15169
|
Nr(n, i.isThinking), n.disabled = !1;
|
|
@@ -15166,15 +15200,15 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15166
15200
|
Pc(C.node, i.starterPromptsLoading), D(C.node), D(e), wt(t, P);
|
|
15167
15201
|
return;
|
|
15168
15202
|
}
|
|
15169
|
-
const
|
|
15170
|
-
|
|
15203
|
+
const B = document.createElement("div");
|
|
15204
|
+
B.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
15171
15205
|
const Y = document.createElement("div");
|
|
15172
15206
|
Y.className = "pluno-pa-widget__empty-hero";
|
|
15173
15207
|
const re = qt(
|
|
15174
15208
|
"pluno-pa-widget__character--empty",
|
|
15175
15209
|
h()
|
|
15176
15210
|
);
|
|
15177
|
-
Y.appendChild(re),
|
|
15211
|
+
Y.appendChild(re), B.appendChild(Y), B.appendChild(id());
|
|
15178
15212
|
const j = i.starterPrompts, $ = document.createElement("div");
|
|
15179
15213
|
if ($.className = j.length > 0 ? "pluno-pa-widget__starter-prompts" : "pluno-pa-widget__starter-prompts pluno-pa-widget__starter-prompts--empty", j.length === 0 && !i.starterPromptsLoading && $.setAttribute("aria-hidden", "true"), j.length > 0)
|
|
15180
15214
|
for (const [Q, W] of j.entries()) {
|
|
@@ -15188,19 +15222,19 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15188
15222
|
const W = document.createElement("div");
|
|
15189
15223
|
W.className = "pluno-pa-widget__starter-placeholder", Q === 1 && W.setAttribute("role", "status"), W.textContent = " ", $.appendChild(W);
|
|
15190
15224
|
}
|
|
15191
|
-
|
|
15225
|
+
B.appendChild($), Pc(B, i.starterPromptsLoading), c.clear(), l.clear(), u.clear(), D(B), c.set("welcome", { node: B, renderSignature: x }), D(e), wt(t, P);
|
|
15192
15226
|
return;
|
|
15193
15227
|
}
|
|
15194
15228
|
let ce = null, le = null, he = [];
|
|
15195
15229
|
const ke = O.some(pr), N = O.some(
|
|
15196
15230
|
(x) => x.role === "tool" && x.id === i.activity?.activeItemId
|
|
15197
15231
|
), _e = i.turnPhase ? dm(i.turnPhase) : "Thinking...";
|
|
15198
|
-
let
|
|
15232
|
+
let Ue = !1;
|
|
15199
15233
|
const be = () => {
|
|
15200
15234
|
if (he.length === 0)
|
|
15201
|
-
return
|
|
15235
|
+
return Ue = !1, !1;
|
|
15202
15236
|
const x = k.showProgress && he.some(
|
|
15203
|
-
(
|
|
15237
|
+
(B) => B.id === i.activity?.activeItemId
|
|
15204
15238
|
), C = tb(
|
|
15205
15239
|
he,
|
|
15206
15240
|
x,
|
|
@@ -15211,19 +15245,19 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15211
15245
|
h(),
|
|
15212
15246
|
V.get(he[0].id)?.collapsed ?? !0
|
|
15213
15247
|
);
|
|
15214
|
-
return D(C), ce = null, le = C, he = [],
|
|
15248
|
+
return D(C), ce = null, le = C, he = [], Ue = x, !0;
|
|
15215
15249
|
}, Ze = (x) => {
|
|
15216
|
-
const C = `interaction:${i.sessionId ?? ""}:${x.id}`,
|
|
15217
|
-
let re = Y?.renderSignature ===
|
|
15250
|
+
const C = `interaction:${i.sessionId ?? ""}:${x.id}`, B = JSON.stringify([x, h()]), Y = c.get(C);
|
|
15251
|
+
let re = Y?.renderSignature === B ? Y.node : void 0;
|
|
15218
15252
|
if (!re) {
|
|
15219
15253
|
const j = (Q, W) => I.act(x, Q, W), $ = x.payload.error ?? null;
|
|
15220
15254
|
if (x.kind !== "integration_connection") return;
|
|
15221
|
-
re =
|
|
15255
|
+
re = zy(
|
|
15222
15256
|
x.payload.request,
|
|
15223
15257
|
{ status: x.status === "pending" ? "connecting" : x.payload.status, error: $ ?? void 0 },
|
|
15224
15258
|
() => j("connect"),
|
|
15225
15259
|
x.presentation
|
|
15226
|
-
), c.set(C, { node: re, renderSignature:
|
|
15260
|
+
), c.set(C, { node: re, renderSignature: B });
|
|
15227
15261
|
}
|
|
15228
15262
|
G.add(C), re.dataset.interactionId = x.id, re.dataset.interactionUserMessageId = x.userMessageId ?? "", D(re), ce = null, le = re;
|
|
15229
15263
|
}, Ce = new Set(O.filter((x) => x.role === "user").map((x) => x.id));
|
|
@@ -15250,7 +15284,7 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15250
15284
|
continue;
|
|
15251
15285
|
const $ = be(), Q = gd(C);
|
|
15252
15286
|
if ($) {
|
|
15253
|
-
if (!
|
|
15287
|
+
if (!Ue) {
|
|
15254
15288
|
const W = Dc(
|
|
15255
15289
|
u,
|
|
15256
15290
|
S,
|
|
@@ -15292,10 +15326,10 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15292
15326
|
continue;
|
|
15293
15327
|
}
|
|
15294
15328
|
C.role;
|
|
15295
|
-
const
|
|
15329
|
+
const B = be(), Y = ui(C.content), re = C.role === "assistant" && O.some(
|
|
15296
15330
|
($) => $.role === "tool" && di($, C)
|
|
15297
15331
|
);
|
|
15298
|
-
if (C.role === "assistant" && !
|
|
15332
|
+
if (C.role === "assistant" && !B && !re) {
|
|
15299
15333
|
const $ = ds(h());
|
|
15300
15334
|
D($), ce = null, le = $;
|
|
15301
15335
|
}
|
|
@@ -15316,7 +15350,7 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15316
15350
|
if (k.showProgress && i.turnPhase && !i.assistantDraft && !N && !oe && !ke) {
|
|
15317
15351
|
const x = i.activeResponseUserMessageId ? `response:${i.activeResponseUserMessageId}` : `session:${i.sessionId ?? "pending"}`;
|
|
15318
15352
|
if (H) {
|
|
15319
|
-
if (!
|
|
15353
|
+
if (!Ue) {
|
|
15320
15354
|
const C = Dc(
|
|
15321
15355
|
u,
|
|
15322
15356
|
S,
|
|
@@ -15337,8 +15371,8 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15337
15371
|
}
|
|
15338
15372
|
}
|
|
15339
15373
|
if (i.lastError && as(i.lastErrorCode) === "conversation") {
|
|
15340
|
-
const
|
|
15341
|
-
|
|
15374
|
+
const B = O.slice(O.map((j) => j.role).lastIndexOf("user") + 1).some((j) => j.role === "assistant" || j.role === "tool") ? document.createElement("article") : ds(h());
|
|
15375
|
+
B.classList.add("pluno-pa-widget__terminal-marker");
|
|
15342
15376
|
const Y = document.createElement("div");
|
|
15343
15377
|
Y.className = "pluno-pa-widget__error", i.historyRefreshFailure && (Y.dataset.historyRefreshFailure = JSON.stringify(i.historyRefreshFailure));
|
|
15344
15378
|
const re = document.createElement("span");
|
|
@@ -15352,7 +15386,7 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15352
15386
|
const Q = b?.has(j) === !0 || j === "retry_history" && i.conversationDiagnostics?.queryRequestId != null || j === "retry_message" && i.isRetrying;
|
|
15353
15387
|
$.disabled = Q, $.setAttribute("aria-busy", String(Q)), $.textContent = j === "new_chat" ? Q ? "Starting new chat" : "Start new chat" : Q ? "Trying" : "Try again", Q && $.prepend(kn()), $.addEventListener("click", () => v(j, j === "retry_history" ? g : j === "retry_message" ? m : y)), Y.appendChild($);
|
|
15354
15388
|
}
|
|
15355
|
-
|
|
15389
|
+
B.appendChild(Y), D(B), ce = null, le = B;
|
|
15356
15390
|
}
|
|
15357
15391
|
Pe(), ce?.classList.add(
|
|
15358
15392
|
"pluno-pa-widget__message--bottom-reserve"
|
|
@@ -15367,9 +15401,9 @@ function zy(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
|
15367
15401
|
), Jy(
|
|
15368
15402
|
u,
|
|
15369
15403
|
S
|
|
15370
|
-
), wt(t, P), o ? In(t, r) : t.scrollTop =
|
|
15404
|
+
), wt(t, P), o ? In(t, r) : t.scrollTop = z;
|
|
15371
15405
|
}
|
|
15372
|
-
function
|
|
15406
|
+
function zy(t, e, n, s, i = null) {
|
|
15373
15407
|
const o = document.createElement("section");
|
|
15374
15408
|
o.className = "pluno-pa-widget__integration-auth-card", o.setAttribute("aria-label", s?.title ?? `Connect ${t.appName}`);
|
|
15375
15409
|
const r = document.createElement("div");
|
|
@@ -15643,13 +15677,13 @@ function tb(t, e, n, s, i, o, r, a = !0) {
|
|
|
15643
15677
|
r
|
|
15644
15678
|
), T = JSON.stringify(r), O = document.createElement("div");
|
|
15645
15679
|
O.className = "pluno-pa-widget__tool-active-content";
|
|
15646
|
-
const V = vi(), E = document.createElement("details"),
|
|
15647
|
-
|
|
15680
|
+
const V = vi(), E = document.createElement("details"), z = document.createElement("summary");
|
|
15681
|
+
z.className = "pluno-pa-widget__tool-summary";
|
|
15648
15682
|
const P = document.createElement("div");
|
|
15649
|
-
P.className = "pluno-pa-widget__tool-summary-title",
|
|
15683
|
+
P.className = "pluno-pa-widget__tool-summary-title", z.appendChild(P), z.addEventListener("click", () => {
|
|
15650
15684
|
const U = I.dataset.responseGroupKey ?? l;
|
|
15651
15685
|
E.open ? (n.delete(U), n.add(`closed:${U}`)) : (n.add(U), n.delete(`closed:${U}`)), o(), P.textContent = E.open ? I.dataset.collapsedActivityTitle ?? "Activities" : "Activities";
|
|
15652
|
-
}), E.appendChild(
|
|
15686
|
+
}), E.appendChild(z);
|
|
15653
15687
|
const G = document.createElement("div");
|
|
15654
15688
|
G.className = "pluno-pa-widget__tool-lines", E.addEventListener("toggle", () => {
|
|
15655
15689
|
I.dataset.responseGroupKey, I.classList.toggle("pluno-pa-widget__tool-group--open", E.open), P.textContent = E.open ? "Activities" : I.dataset.collapsedActivityTitle ?? "Activities";
|
|
@@ -15660,7 +15694,7 @@ function tb(t, e, n, s, i, o, r, a = !0) {
|
|
|
15660
15694
|
activeContent: O,
|
|
15661
15695
|
thinkingStatus: V,
|
|
15662
15696
|
details: E,
|
|
15663
|
-
summary:
|
|
15697
|
+
summary: z,
|
|
15664
15698
|
summaryTitle: P,
|
|
15665
15699
|
lines: G,
|
|
15666
15700
|
lineNodes: /* @__PURE__ */ new Map()
|
|
@@ -16032,7 +16066,7 @@ function Lc(t, e) {
|
|
|
16032
16066
|
--pluno-pa-accent-contrast: #fafafa;
|
|
16033
16067
|
position: fixed;
|
|
16034
16068
|
z-index: 2147483645;
|
|
16035
|
-
font-family: ${
|
|
16069
|
+
font-family: ${At.fontFamily};
|
|
16036
16070
|
font-size: 14px;
|
|
16037
16071
|
color: var(--pluno-pa-text);
|
|
16038
16072
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -18770,11 +18804,11 @@ async function ub() {
|
|
|
18770
18804
|
e.observe(document.documentElement, { childList: !0 });
|
|
18771
18805
|
});
|
|
18772
18806
|
}
|
|
18773
|
-
function
|
|
18807
|
+
function Br(t) {
|
|
18774
18808
|
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
18775
18809
|
}
|
|
18776
18810
|
function wd(t) {
|
|
18777
|
-
return `${
|
|
18811
|
+
return `${Br(t)}.displayState`;
|
|
18778
18812
|
}
|
|
18779
18813
|
function pb(t) {
|
|
18780
18814
|
try {
|
|
@@ -18822,7 +18856,7 @@ function hb(t) {
|
|
|
18822
18856
|
}
|
|
18823
18857
|
function gb(t) {
|
|
18824
18858
|
try {
|
|
18825
|
-
const e = window.localStorage.getItem(
|
|
18859
|
+
const e = window.localStorage.getItem(Br(t));
|
|
18826
18860
|
if (!e)
|
|
18827
18861
|
return Uc();
|
|
18828
18862
|
const n = JSON.parse(e);
|
|
@@ -18851,7 +18885,7 @@ function Uc() {
|
|
|
18851
18885
|
function fb(t, e) {
|
|
18852
18886
|
try {
|
|
18853
18887
|
window.localStorage.setItem(
|
|
18854
|
-
|
|
18888
|
+
Br(t),
|
|
18855
18889
|
JSON.stringify(e)
|
|
18856
18890
|
);
|
|
18857
18891
|
} catch {
|
|
@@ -18915,17 +18949,17 @@ function wb(t) {
|
|
|
18915
18949
|
const n = Date.parse(t);
|
|
18916
18950
|
return Number.isFinite(n) ? Math.max(0, n - Date.now()) : void 0;
|
|
18917
18951
|
}
|
|
18918
|
-
const
|
|
18952
|
+
const Bc = /* @__PURE__ */ new WeakSet();
|
|
18919
18953
|
function _b(t) {
|
|
18920
18954
|
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
18921
18955
|
}
|
|
18922
|
-
function
|
|
18956
|
+
function zc(t) {
|
|
18923
18957
|
const e = t.pathname.split("/");
|
|
18924
18958
|
return e[e.length - 1] ?? "";
|
|
18925
18959
|
}
|
|
18926
18960
|
function vb(t, e) {
|
|
18927
18961
|
const n = new URL(t.src, document.baseURI);
|
|
18928
|
-
return n.href === e.href || n.pathname === e.pathname ? !0 :
|
|
18962
|
+
return n.href === e.href || n.pathname === e.pathname ? !0 : zc(n) === zc(e);
|
|
18929
18963
|
}
|
|
18930
18964
|
class Tt extends EventTarget {
|
|
18931
18965
|
constructor(e, n) {
|
|
@@ -19040,21 +19074,21 @@ function Sb(t) {
|
|
|
19040
19074
|
}
|
|
19041
19075
|
function xb(t) {
|
|
19042
19076
|
for (const e of Sb(t))
|
|
19043
|
-
|
|
19077
|
+
Bc.has(e) || e.dataset.plunoAutoMount === "false" || (Bc.add(e), _d(e).catch((n) => {
|
|
19044
19078
|
console.error("Failed to mount Pluno widget", n);
|
|
19045
19079
|
}));
|
|
19046
19080
|
}
|
|
19047
19081
|
function _d(t) {
|
|
19048
|
-
const e = window, n = e[
|
|
19082
|
+
const e = window, n = e[Rt];
|
|
19049
19083
|
if (n) {
|
|
19050
19084
|
if (n.host === null)
|
|
19051
19085
|
return n.mountPromise.catch(() => {
|
|
19052
|
-
const a = e[
|
|
19086
|
+
const a = e[Rt];
|
|
19053
19087
|
return a ? a.mountPromise : _d(t);
|
|
19054
19088
|
});
|
|
19055
19089
|
if (kb(n.host))
|
|
19056
19090
|
return n.mountPromise;
|
|
19057
|
-
n.destroy?.(), delete e[
|
|
19091
|
+
n.destroy?.(), delete e[Rt];
|
|
19058
19092
|
}
|
|
19059
19093
|
const s = t.dataset.plunoPreviewChannel, i = t.dataset.plunoTokenEndpoint;
|
|
19060
19094
|
let o;
|
|
@@ -19070,22 +19104,22 @@ function _d(t) {
|
|
|
19070
19104
|
scribbleStyle: t.dataset.plunoScribbleStyle === void 0 ? void 0 : t.dataset.plunoScribbleStyle !== "false",
|
|
19071
19105
|
position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
19072
19106
|
}).then((a) => {
|
|
19073
|
-
if (e[
|
|
19107
|
+
if (e[Rt] !== o) {
|
|
19074
19108
|
a.destroy();
|
|
19075
19109
|
return;
|
|
19076
19110
|
}
|
|
19077
19111
|
const c = a.host;
|
|
19078
19112
|
c.setAttribute(Yl, "true"), o.host = c, o.destroy = () => {
|
|
19079
|
-
e[
|
|
19113
|
+
e[Rt] === o && delete e[Rt], o.host = null, o.destroy = null, a.destroy();
|
|
19080
19114
|
};
|
|
19081
19115
|
}).catch((a) => {
|
|
19082
|
-
throw e[
|
|
19116
|
+
throw e[Rt] === o && delete e[Rt], a;
|
|
19083
19117
|
});
|
|
19084
19118
|
return o = {
|
|
19085
19119
|
mountPromise: r,
|
|
19086
19120
|
host: null,
|
|
19087
19121
|
destroy: null
|
|
19088
|
-
}, e[
|
|
19122
|
+
}, e[Rt] = o, r;
|
|
19089
19123
|
}
|
|
19090
19124
|
function kb(t) {
|
|
19091
19125
|
return t.isConnected && t.getAttribute(Yl) === "true" && !!t.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!t.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|