@pluno/product-agent-web 0.1.322 → 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 +410 -377
- package/dist/product-agent-widget.js +647 -614
- package/package.json +1 -1
- package/dist/assistantDeltaReplay.d.ts +0 -10
|
@@ -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;
|
|
@@ -7995,8 +7995,7 @@ function co(t) {
|
|
|
7995
7995
|
"status",
|
|
7996
7996
|
"reason",
|
|
7997
7997
|
"phase",
|
|
7998
|
-
"elapsedMs"
|
|
7999
|
-
"e2bEventSequence"
|
|
7998
|
+
"elapsedMs"
|
|
8000
7999
|
]) {
|
|
8001
8000
|
const l = t[c];
|
|
8002
8001
|
(typeof l == "string" || typeof l == "number" || typeof l == "boolean" || l === null) && (e[c] = l);
|
|
@@ -8063,7 +8062,7 @@ const tg = "https://app.pluno.ai", ng = 2e4, sg = 1e4, ig = 6e4, og = 6e4, rg =
|
|
|
8063
8062
|
".pdf:application/pdf",
|
|
8064
8063
|
".png:image/png",
|
|
8065
8064
|
".webp:image/webp"
|
|
8066
|
-
]), 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();
|
|
8067
8066
|
let qs = null;
|
|
8068
8067
|
function bg(t, e = Math.random) {
|
|
8069
8068
|
const n = Math.min(nr, cg * 2 ** t), s = 1 - Ga + e() * Ga * 2;
|
|
@@ -8115,8 +8114,8 @@ class Er {
|
|
|
8115
8114
|
pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
|
|
8116
8115
|
recoverAuthentication: (i, o, r) => this.recoverHttpAuthentication(i, o, r),
|
|
8117
8116
|
// Public custom transports own their admission contract and do not expose the default Socket.IO lease.
|
|
8118
|
-
executorConnection: e.webSocketFactory ? void 0 : () => this.socket instanceof
|
|
8119
|
-
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")),
|
|
8120
8119
|
auth: {
|
|
8121
8120
|
protocol: 1,
|
|
8122
8121
|
token: e.token ?? "",
|
|
@@ -8166,6 +8165,8 @@ class Er {
|
|
|
8166
8165
|
reconnectAttempts = 0;
|
|
8167
8166
|
embeddedRecoveryTimer = null;
|
|
8168
8167
|
embeddedRecoveryTokenExpired = !1;
|
|
8168
|
+
embeddedRecoveryExhausted = !1;
|
|
8169
|
+
embeddedRecoverySuspended = !1;
|
|
8169
8170
|
recoveryDiagnosticId = crypto.randomUUID();
|
|
8170
8171
|
rejectedDiagnosticsToken = null;
|
|
8171
8172
|
lastRecoveryStage = "token_provider";
|
|
@@ -8274,7 +8275,7 @@ class Er {
|
|
|
8274
8275
|
}, s);
|
|
8275
8276
|
try {
|
|
8276
8277
|
await i.initializeDirectory(), await i.initializeConversation(), Eh().catch((o) => {
|
|
8277
|
-
|
|
8278
|
+
De("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
8278
8279
|
message: o instanceof Error ? o.message : String(o)
|
|
8279
8280
|
});
|
|
8280
8281
|
}), n.disableNetworkCapture || i.enableNetworkCapture(), i.startPageLifecycleRecovery(), i.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await i.connect();
|
|
@@ -8297,7 +8298,7 @@ class Er {
|
|
|
8297
8298
|
authority: this.directoryAuthority,
|
|
8298
8299
|
http: this.directoryHttp,
|
|
8299
8300
|
isActiveTurn: (e) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[e] === !0,
|
|
8300
|
-
nextRequestId:
|
|
8301
|
+
nextRequestId: ze,
|
|
8301
8302
|
onError: (e) => {
|
|
8302
8303
|
this.handleDirectoryTransportError(e), this.emit("error", Os(e));
|
|
8303
8304
|
},
|
|
@@ -8345,7 +8346,7 @@ class Er {
|
|
|
8345
8346
|
requestId: g.requestId,
|
|
8346
8347
|
clientMessageId: g.userMessageId,
|
|
8347
8348
|
sessionId: g.sessionId
|
|
8348
|
-
}), _ = (k, T) => v.measure(k, () =>
|
|
8349
|
+
}), _ = (k, T) => v.measure(k, () => Bs(b, T));
|
|
8349
8350
|
let I = g.contextPreparation ?? { pageContent: "", sessionTabs: [] };
|
|
8350
8351
|
if (g.contextPreparation === null) {
|
|
8351
8352
|
await _("first_frame", () => new Promise((T) => {
|
|
@@ -8366,13 +8367,13 @@ class Er {
|
|
|
8366
8367
|
}
|
|
8367
8368
|
if (await _("authentication", () => this.waitForAuthentication()), !s() || n !== this.directoryAuthority || this.clientRuntime.isDisposed) throw new Error("Submission authority was retired.");
|
|
8368
8369
|
for (const k of y)
|
|
8369
|
-
if (!k.uploaded && (await
|
|
8370
|
+
if (!k.uploaded && (await Bs(b, () => (this.attachmentPersistence.get(k.sourceId) ?? Promise.resolve()).catch(() => {
|
|
8370
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 });
|
|
8371
|
-
})), !await
|
|
8372
|
+
})), !await Bs(b, () => Wa(k.sourceId))))
|
|
8372
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 });
|
|
8373
8374
|
return b.throwIfAborted(), v.mark("context_ready"), { ...I, now: Date.now() };
|
|
8374
8375
|
},
|
|
8375
|
-
connectionId: () => this.socket instanceof
|
|
8376
|
+
connectionId: () => this.socket instanceof Ie ? this.socket.connectionId : null,
|
|
8376
8377
|
prepareUpload: this.options.prepareAttachmentUpload ?? (this.options.productVariant === "customer_embedded" ? (g) => this.prepareEmbedAttachmentUpload(g, s) : void 0),
|
|
8377
8378
|
onUploaded: async (g, y, b) => {
|
|
8378
8379
|
await _l(g, {
|
|
@@ -8381,7 +8382,7 @@ class Er {
|
|
|
8381
8382
|
storageKey: b.storage_key ?? void 0,
|
|
8382
8383
|
fileUrl: b.file_url ? new URL(b.file_url, this.options.backendUrl).toString() : void 0,
|
|
8383
8384
|
lastUsedAt: Date.now()
|
|
8384
|
-
}).catch((v) =>
|
|
8385
|
+
}).catch((v) => De("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
8385
8386
|
attachmentId: g,
|
|
8386
8387
|
message: v instanceof Error ? v.message : String(v)
|
|
8387
8388
|
}));
|
|
@@ -8406,7 +8407,7 @@ class Er {
|
|
|
8406
8407
|
y.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
8407
8408
|
return;
|
|
8408
8409
|
}
|
|
8409
|
-
|
|
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);
|
|
8410
8411
|
}
|
|
8411
8412
|
})
|
|
8412
8413
|
});
|
|
@@ -8440,19 +8441,19 @@ class Er {
|
|
|
8440
8441
|
socket: {
|
|
8441
8442
|
retain: async (g, y) => {
|
|
8442
8443
|
const b = this.socket;
|
|
8443
|
-
b instanceof
|
|
8444
|
+
b instanceof Ie && await b.directoryRooms.retain(g, y).catch((v) => {
|
|
8444
8445
|
if (this.socket === b) throw v;
|
|
8445
8446
|
});
|
|
8446
8447
|
},
|
|
8447
8448
|
release: async (g, y) => {
|
|
8448
8449
|
const b = this.socket;
|
|
8449
|
-
b instanceof
|
|
8450
|
+
b instanceof Ie && await b.directoryRooms.release(g, y).catch((v) => {
|
|
8450
8451
|
if (this.socket === b) throw v;
|
|
8451
8452
|
});
|
|
8452
8453
|
}
|
|
8453
8454
|
},
|
|
8454
8455
|
socketIdentity: () => this.socket,
|
|
8455
|
-
nextRequestId:
|
|
8456
|
+
nextRequestId: ze,
|
|
8456
8457
|
wakeup: { start: () => {
|
|
8457
8458
|
}, stop: () => {
|
|
8458
8459
|
} },
|
|
@@ -8517,7 +8518,7 @@ class Er {
|
|
|
8517
8518
|
this.modelClientScopeId,
|
|
8518
8519
|
this.directoryConversationScopeId,
|
|
8519
8520
|
n
|
|
8520
|
-
) : (this.directoryProvisionalId =
|
|
8521
|
+
) : (this.directoryProvisionalId = ze(), await this.directoryScope.provisional(
|
|
8521
8522
|
this.modelClientScopeId,
|
|
8522
8523
|
this.directoryConversationScopeId,
|
|
8523
8524
|
this.directoryProvisionalId
|
|
@@ -8546,7 +8547,7 @@ class Er {
|
|
|
8546
8547
|
);
|
|
8547
8548
|
}
|
|
8548
8549
|
async beginDirectoryProvisional() {
|
|
8549
|
-
const e =
|
|
8550
|
+
const e = ze();
|
|
8550
8551
|
this.directoryProvisionalId = e, this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}:${e}`, await this.directoryScope.provisional(
|
|
8551
8552
|
this.modelClientScopeId,
|
|
8552
8553
|
this.directoryConversationScopeId,
|
|
@@ -8637,36 +8638,38 @@ class Er {
|
|
|
8637
8638
|
}
|
|
8638
8639
|
async connect() {
|
|
8639
8640
|
return this.clientRuntime.route("conversation", { core: async () => {
|
|
8640
|
-
if (this.socket instanceof
|
|
8641
|
-
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;
|
|
8642
8643
|
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget();
|
|
8643
|
-
const
|
|
8644
|
-
this.setState({ status: "reconnecting" }),
|
|
8644
|
+
const a = this.waitForConnectionOutcome(r);
|
|
8645
|
+
this.setState({ status: "reconnecting" }), r.retryReadiness(), await a;
|
|
8645
8646
|
return;
|
|
8646
8647
|
}
|
|
8647
8648
|
if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
|
|
8648
8649
|
return;
|
|
8649
8650
|
this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0);
|
|
8650
8651
|
const e = this.authenticationFailure !== null, n = e && this.state.lastErrorCode === "connection_failed";
|
|
8651
|
-
this.authenticationFailure = null, this.
|
|
8652
|
-
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;
|
|
8653
8656
|
this.setState(
|
|
8654
8657
|
this.state.status === "reconnecting" || n ? { status: "reconnecting" } : { status: "connecting", ...e ? {} : { lastError: null } }
|
|
8655
8658
|
);
|
|
8656
8659
|
try {
|
|
8657
|
-
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")
|
|
8658
8661
|
return;
|
|
8659
8662
|
if (this.lastRecoveryStage = "socket_admission", !this.token && !this.options.webSocketFactory)
|
|
8660
8663
|
throw new Je("Pluno requires a token or tokenProvider", !1);
|
|
8661
8664
|
if (!this.options.webSocketFactory && this.rejectedTransportToken !== null && this.rejectedTransportToken === this.token) {
|
|
8662
|
-
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError:
|
|
8665
|
+
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError: o });
|
|
8663
8666
|
return;
|
|
8664
8667
|
}
|
|
8665
|
-
if (this.socket instanceof
|
|
8668
|
+
if (this.socket instanceof Ie) {
|
|
8666
8669
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
8667
8670
|
return;
|
|
8668
8671
|
}
|
|
8669
|
-
const
|
|
8672
|
+
const r = Ug(this.options.backendUrl), a = this.options.webSocketFactory?.(r) ?? new Ie({
|
|
8670
8673
|
displaySchema: "canonical",
|
|
8671
8674
|
backendUrl: this.options.backendUrl,
|
|
8672
8675
|
entrySurface: this.options.entrySurface,
|
|
@@ -8685,13 +8688,13 @@ class Er {
|
|
|
8685
8688
|
currentSession: () => this.state.sessionId,
|
|
8686
8689
|
sessionReferences: () => []
|
|
8687
8690
|
});
|
|
8688
|
-
this.socket =
|
|
8689
|
-
this.socket ===
|
|
8690
|
-
}, rg)),
|
|
8691
|
-
this.socket ===
|
|
8692
|
-
}),
|
|
8693
|
-
this.socket !==
|
|
8694
|
-
}), 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", {
|
|
8695
8698
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8696
8699
|
isThinking: this.state.isThinking
|
|
8697
8700
|
}), !(this.token ? this.sendNow({
|
|
@@ -8701,67 +8704,67 @@ class Er {
|
|
|
8701
8704
|
transportId: this.transportIdentity.transportId,
|
|
8702
8705
|
pageUrl: location.href
|
|
8703
8706
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
8704
|
-
this.socket ===
|
|
8707
|
+
this.socket === a && (De("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
|
|
8705
8708
|
}, ag));
|
|
8706
|
-
}),
|
|
8707
|
-
if (this.socket !==
|
|
8709
|
+
}), a.addEventListener("message", (c) => {
|
|
8710
|
+
if (this.socket !== a)
|
|
8708
8711
|
return;
|
|
8709
|
-
const
|
|
8710
|
-
if (
|
|
8712
|
+
const l = ec(c.data);
|
|
8713
|
+
if (a instanceof Ie && l.type === "tool.call" && !Gg(l)) {
|
|
8711
8714
|
this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
|
|
8712
8715
|
return;
|
|
8713
8716
|
}
|
|
8714
|
-
const
|
|
8715
|
-
|
|
8716
|
-
}),
|
|
8717
|
-
this.socket ===
|
|
8718
|
-
}),
|
|
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) => {
|
|
8719
8722
|
if (this.clientRuntime.isDisposed || this.state.status === "closed") return;
|
|
8720
|
-
const
|
|
8721
|
-
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((
|
|
8722
|
-
}),
|
|
8723
|
-
this.socket ===
|
|
8724
|
-
code: typeof
|
|
8725
|
-
reason: typeof
|
|
8726
|
-
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,
|
|
8727
8730
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8728
8731
|
isThinking: this.state.isThinking
|
|
8729
|
-
}), (typeof
|
|
8730
|
-
closeCode: typeof
|
|
8731
|
-
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
|
|
8732
8735
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
8733
|
-
}),
|
|
8734
|
-
this.socket !==
|
|
8736
|
+
}), a.addEventListener("error", () => {
|
|
8737
|
+
this.socket !== a || this.state.status === "closed" || (De("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
8735
8738
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
8736
8739
|
isThinking: this.state.isThinking
|
|
8737
|
-
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(),
|
|
8738
|
-
}), e &&
|
|
8739
|
-
} catch (
|
|
8740
|
-
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")
|
|
8741
8744
|
return;
|
|
8742
|
-
if (
|
|
8743
|
-
this.handleDirectoryTransportError(
|
|
8745
|
+
if (r instanceof q && (r.code === "unauthorized" || r.code === "update_required")) {
|
|
8746
|
+
this.handleDirectoryTransportError(r);
|
|
8744
8747
|
return;
|
|
8745
8748
|
}
|
|
8746
|
-
const
|
|
8747
|
-
if (ho(
|
|
8748
|
-
|
|
8749
|
-
message:
|
|
8749
|
+
const a = Os(r);
|
|
8750
|
+
if (ho(r)) {
|
|
8751
|
+
De("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
8752
|
+
message: a.message,
|
|
8750
8753
|
reconnectAttempt: this.reconnectAttempts
|
|
8751
|
-
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(
|
|
8754
|
+
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(r, "token_provider")), this.setState({
|
|
8752
8755
|
status: "reconnecting",
|
|
8753
8756
|
lastError: Ja,
|
|
8754
8757
|
lastErrorCode: "connection_failed"
|
|
8755
|
-
}), this.emit("error",
|
|
8756
|
-
|
|
8758
|
+
}), this.emit("error", a), this.scheduleReconnect(
|
|
8759
|
+
r instanceof Je ? r.retryAfterMs : void 0
|
|
8757
8760
|
);
|
|
8758
8761
|
return;
|
|
8759
8762
|
}
|
|
8760
|
-
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({
|
|
8761
8764
|
status: "error",
|
|
8762
|
-
lastError:
|
|
8765
|
+
lastError: a.message,
|
|
8763
8766
|
lastErrorCode: "connection_failed"
|
|
8764
|
-
}), this.emit("error",
|
|
8767
|
+
}), this.emit("error", a), a);
|
|
8765
8768
|
} finally {
|
|
8766
8769
|
this.connectionInProgress = !1;
|
|
8767
8770
|
}
|
|
@@ -8769,7 +8772,7 @@ class Er {
|
|
|
8769
8772
|
}
|
|
8770
8773
|
disconnect() {
|
|
8771
8774
|
return this.clientRuntime.route("conversation", { core: () => {
|
|
8772
|
-
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;
|
|
8773
8776
|
} });
|
|
8774
8777
|
}
|
|
8775
8778
|
destroy() {
|
|
@@ -8804,7 +8807,7 @@ class Er {
|
|
|
8804
8807
|
if (!s && !i.length) return null;
|
|
8805
8808
|
if (this.options.productVariant === "customer_embedded" && (i.forEach(Nl), i.reduce((y, b) => y + b.sizeBytes, 0) > Cl))
|
|
8806
8809
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
8807
|
-
const o = n.clientMessageId ??
|
|
8810
|
+
const o = n.clientMessageId ?? ze(), r = Ye(this.operationTimingReporter, {
|
|
8808
8811
|
operation: "send",
|
|
8809
8812
|
layer: "sdk",
|
|
8810
8813
|
requestId: o,
|
|
@@ -8879,7 +8882,7 @@ class Er {
|
|
|
8879
8882
|
rh(this, this.options.entrySurface, e);
|
|
8880
8883
|
}
|
|
8881
8884
|
reportInvalidStateTransition(e, n, s) {
|
|
8882
|
-
s !== void 0 && !
|
|
8885
|
+
s !== void 0 && !Au(s) || this.reportHealthSignal("invalid_state_transition", {
|
|
8883
8886
|
reason: e,
|
|
8884
8887
|
clientMessageId: n,
|
|
8885
8888
|
...s ? { uiInvariant: s } : {}
|
|
@@ -8912,11 +8915,11 @@ class Er {
|
|
|
8912
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);
|
|
8913
8916
|
if (!o) return !1;
|
|
8914
8917
|
if (o.type === "preparation") {
|
|
8915
|
-
const r =
|
|
8918
|
+
const r = ze(), a = Vp(o.submission);
|
|
8916
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;
|
|
8917
8920
|
}
|
|
8918
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: {
|
|
8919
|
-
request_id:
|
|
8922
|
+
request_id: ze(),
|
|
8920
8923
|
type: "chat.retry_last_user_message",
|
|
8921
8924
|
payload: {
|
|
8922
8925
|
sessionId: o.sessionId,
|
|
@@ -8927,7 +8930,7 @@ class Er {
|
|
|
8927
8930
|
}
|
|
8928
8931
|
createLocalAttachment(e) {
|
|
8929
8932
|
this.options.productVariant === "customer_embedded" && Ll(e);
|
|
8930
|
-
const n =
|
|
8933
|
+
const n = ze(), s = {
|
|
8931
8934
|
id: n,
|
|
8932
8935
|
name: e.name || "attachment",
|
|
8933
8936
|
mimeType: Dl(e),
|
|
@@ -8944,7 +8947,7 @@ class Er {
|
|
|
8944
8947
|
lastUsedAt: i
|
|
8945
8948
|
});
|
|
8946
8949
|
return this.attachmentPersistence.set(n, o), o.catch((r) => {
|
|
8947
|
-
|
|
8950
|
+
De("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
8948
8951
|
attachmentId: n,
|
|
8949
8952
|
name: s.name,
|
|
8950
8953
|
message: r instanceof Error ? r.message : String(r)
|
|
@@ -9006,9 +9009,9 @@ class Er {
|
|
|
9006
9009
|
});
|
|
9007
9010
|
};
|
|
9008
9011
|
let r = !1;
|
|
9009
|
-
return
|
|
9012
|
+
return Af(async () => {
|
|
9010
9013
|
let a = await o(!1);
|
|
9011
|
-
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);
|
|
9012
9015
|
return await a.json();
|
|
9013
9016
|
}, "Failed to prepare attachment upload");
|
|
9014
9017
|
}
|
|
@@ -9017,7 +9020,7 @@ class Er {
|
|
|
9017
9020
|
Ye((n) => this.reportOperationTiming(n), {
|
|
9018
9021
|
operation: "stop",
|
|
9019
9022
|
layer: "sdk",
|
|
9020
|
-
requestId:
|
|
9023
|
+
requestId: ze(),
|
|
9021
9024
|
clientMessageId: e.activeResponseUserMessageId ?? e.messages.filter((n) => n.role === "user").slice(-1)[0]?.id ?? null,
|
|
9022
9025
|
sessionId: e.sessionId
|
|
9023
9026
|
}).mark("stop"), this.stopConversation("user_requested");
|
|
@@ -9034,7 +9037,7 @@ class Er {
|
|
|
9034
9037
|
type: "conversation.stop",
|
|
9035
9038
|
clientScopeId: this.modelClientScopeId,
|
|
9036
9039
|
conversationScopeId: s,
|
|
9037
|
-
requestId:
|
|
9040
|
+
requestId: ze(),
|
|
9038
9041
|
reason: e
|
|
9039
9042
|
});
|
|
9040
9043
|
}
|
|
@@ -9044,7 +9047,7 @@ class Er {
|
|
|
9044
9047
|
resetConversationSelection(e) {
|
|
9045
9048
|
const n = this.getState();
|
|
9046
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: {
|
|
9047
|
-
request_id:
|
|
9050
|
+
request_id: ze(),
|
|
9048
9051
|
type: "session.reset",
|
|
9049
9052
|
payload: {
|
|
9050
9053
|
sessionId: n.sessionId,
|
|
@@ -9109,7 +9112,7 @@ class Er {
|
|
|
9109
9112
|
}
|
|
9110
9113
|
setSessionPinned(e, n) {
|
|
9111
9114
|
return this.clientRuntime.route("directory", { core: async () => {
|
|
9112
|
-
const s =
|
|
9115
|
+
const s = ze();
|
|
9113
9116
|
await this.clientRuntime.engine.dispatch({
|
|
9114
9117
|
...this.directoryAuthority,
|
|
9115
9118
|
type: "directory.mutate",
|
|
@@ -9129,7 +9132,7 @@ class Er {
|
|
|
9129
9132
|
}
|
|
9130
9133
|
renameSession(e, n) {
|
|
9131
9134
|
return this.clientRuntime.route("directory", { core: async () => {
|
|
9132
|
-
const s =
|
|
9135
|
+
const s = ze();
|
|
9133
9136
|
await this.clientRuntime.engine.dispatch({
|
|
9134
9137
|
...this.directoryAuthority,
|
|
9135
9138
|
type: "directory.mutate",
|
|
@@ -9232,7 +9235,7 @@ class Er {
|
|
|
9232
9235
|
const n = this.clientRuntime.engine.getProjection().directory;
|
|
9233
9236
|
if (Object.values(n.optimisticEntries).some((i) => i.id === e && i.sessionId === null)) return;
|
|
9234
9237
|
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.stopConversation("session_switch"), this.retainNavigatedConversation();
|
|
9235
|
-
const s = "conversation:" + this.modelClientScopeId + ":" +
|
|
9238
|
+
const s = "conversation:" + this.modelClientScopeId + ":" + ze();
|
|
9236
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 () => {
|
|
9237
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() }));
|
|
9238
9241
|
});
|
|
@@ -9245,7 +9248,7 @@ class Er {
|
|
|
9245
9248
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
9246
9249
|
return !1;
|
|
9247
9250
|
const n = this.socket;
|
|
9248
|
-
if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof
|
|
9251
|
+
if ((e.type === "tool.result" || e.type === "run.stop") && n instanceof Ie) {
|
|
9249
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;
|
|
9250
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) => {
|
|
9251
9254
|
this.pendingRetainedCommandDeliveries.delete(s), i && (this.queuedClientEvents = this.queuedClientEvents.filter((o) => o !== s), on(this.options.clientId, this.queuedClientEvents));
|
|
@@ -9254,7 +9257,7 @@ class Er {
|
|
|
9254
9257
|
try {
|
|
9255
9258
|
return n.send(JSON.stringify(e)), _n("client_event", e.type, co(e)), !0;
|
|
9256
9259
|
} catch (s) {
|
|
9257
|
-
return
|
|
9260
|
+
return De("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
9258
9261
|
message: s instanceof Error ? s.message : String(s),
|
|
9259
9262
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9260
9263
|
isThinking: this.state.isThinking
|
|
@@ -9316,7 +9319,7 @@ class Er {
|
|
|
9316
9319
|
signal: o
|
|
9317
9320
|
}));
|
|
9318
9321
|
} catch (m) {
|
|
9319
|
-
|
|
9322
|
+
De("web-sdk.agent", "Pluno health signal send failed", {
|
|
9320
9323
|
name: e,
|
|
9321
9324
|
message: m instanceof Error ? m.message : String(m)
|
|
9322
9325
|
}), this.queueHealthDiagnostic(o);
|
|
@@ -9383,7 +9386,7 @@ class Er {
|
|
|
9383
9386
|
reportTransportDiagnostic(e, n = {}) {
|
|
9384
9387
|
const s = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online";
|
|
9385
9388
|
n.stage && (this.lastRecoveryStage = n.stage);
|
|
9386
|
-
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 = {
|
|
9387
9390
|
id: a?.id ?? crypto.randomUUID(),
|
|
9388
9391
|
phase: e,
|
|
9389
9392
|
entrySurface: this.options.entrySurface,
|
|
@@ -9479,7 +9482,7 @@ class Er {
|
|
|
9479
9482
|
}, 3e4));
|
|
9480
9483
|
}
|
|
9481
9484
|
requestTransientStarterPrompts() {
|
|
9482
|
-
const e = it(
|
|
9485
|
+
const e = it(Bg());
|
|
9483
9486
|
return su(this.clientRuntime, {
|
|
9484
9487
|
kind: "generatePrompts",
|
|
9485
9488
|
page: { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: e.pageUrl },
|
|
@@ -9489,7 +9492,7 @@ class Er {
|
|
|
9489
9492
|
});
|
|
9490
9493
|
}
|
|
9491
9494
|
startStarterPromptUrlWatcher() {
|
|
9492
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
9495
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = zg(() => this.handleStarterPromptUrlChange()));
|
|
9493
9496
|
}
|
|
9494
9497
|
handleStarterPromptUrlChange() {
|
|
9495
9498
|
const e = location.href;
|
|
@@ -9514,7 +9517,7 @@ class Er {
|
|
|
9514
9517
|
}
|
|
9515
9518
|
flushQueuedClientEvents() {
|
|
9516
9519
|
const e = [...this.queuedClientEvents];
|
|
9517
|
-
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);
|
|
9518
9521
|
for (let n = 0; n < e.length; n++)
|
|
9519
9522
|
if (!this.sendNow(it(e[n]))) {
|
|
9520
9523
|
this.queuedClientEvents.unshift(...e.slice(n).filter((s) => !this.queuedClientEvents.includes(s)));
|
|
@@ -9533,7 +9536,7 @@ class Er {
|
|
|
9533
9536
|
const u = this.directoryAuthority;
|
|
9534
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();
|
|
9535
9538
|
const d = r ? this.draftModel : void 0, h = this.draftModelExplicit;
|
|
9536
|
-
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()));
|
|
9537
9540
|
}
|
|
9538
9541
|
const l = {
|
|
9539
9542
|
...this.directoryAuthority,
|
|
@@ -9661,7 +9664,7 @@ class Er {
|
|
|
9661
9664
|
}
|
|
9662
9665
|
if ((e.code === "unauthorized" || e.code === "401") && e.reason === "token_expired" && e.retryable === !0 && this.options.tokenProvider) {
|
|
9663
9666
|
const n = this.socket;
|
|
9664
|
-
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());
|
|
9665
9668
|
return;
|
|
9666
9669
|
}
|
|
9667
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")) {
|
|
@@ -9775,10 +9778,30 @@ class Er {
|
|
|
9775
9778
|
if (this.pageLifecycleCleanup)
|
|
9776
9779
|
return;
|
|
9777
9780
|
const e = () => {
|
|
9778
|
-
Pl(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
9781
|
+
Pl(this.options.clientId, this.activeBrowserToolCalls.values()), this.embeddedRecoverySuspended = !0;
|
|
9779
9782
|
};
|
|
9780
|
-
|
|
9781
|
-
|
|
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);
|
|
9782
9805
|
};
|
|
9783
9806
|
}
|
|
9784
9807
|
installSessionBrowserApis() {
|
|
@@ -9812,26 +9835,36 @@ class Er {
|
|
|
9812
9835
|
}
|
|
9813
9836
|
startEmbeddedRecoveryBudget(e = !1) {
|
|
9814
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
|
+
}
|
|
9815
9842
|
if (this.embeddedRecoveryTimer !== null) {
|
|
9816
9843
|
if (!e || this.embeddedRecoveryTokenExpired || !this.authenticatedUserId) return;
|
|
9817
9844
|
this.clearEmbeddedRecoveryBudget();
|
|
9818
9845
|
}
|
|
9819
9846
|
this.embeddedRecoveryTokenExpired = e, this.recoveryDiagnosticId = crypto.randomUUID();
|
|
9820
|
-
const n = this.authenticatedUserId ? (e ? 30 : 10) * 6e4 : 12e4
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
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
|
+
}
|
|
9831
9863
|
}, n);
|
|
9864
|
+
this.embeddedRecoveryTimer = s;
|
|
9832
9865
|
}
|
|
9833
9866
|
clearEmbeddedRecoveryBudget() {
|
|
9834
|
-
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;
|
|
9835
9868
|
}
|
|
9836
9869
|
connectionFailureDiagnostic(e, n) {
|
|
9837
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;
|
|
@@ -9850,8 +9883,8 @@ class Er {
|
|
|
9850
9883
|
Math.max(bg(this.reconnectAttempts), e)
|
|
9851
9884
|
);
|
|
9852
9885
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
9853
|
-
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof
|
|
9854
|
-
|
|
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", {
|
|
9855
9888
|
message: i instanceof Error ? i.message : String(i),
|
|
9856
9889
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9857
9890
|
isThinking: this.state.isThinking
|
|
@@ -9891,11 +9924,11 @@ class Er {
|
|
|
9891
9924
|
authReason: ["invalid_token", "token_expired", "missing_token", "user_not_found"].includes(n?.reason ?? "") ? n.reason : "unknown",
|
|
9892
9925
|
authTransport: n?.authTransport === "http" ? "http" : "socket",
|
|
9893
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 } : {} } : {},
|
|
9894
|
-
...this.socket instanceof
|
|
9927
|
+
...this.socket instanceof Ie ? { connectionAttemptId: this.socket.connectionAttempt?.connectionAttemptId } : {}
|
|
9895
9928
|
};
|
|
9896
9929
|
}
|
|
9897
9930
|
stopAuthentication(e, n = !1) {
|
|
9898
|
-
n || this.reportTransportDiagnostic("auth_rejected", {
|
|
9931
|
+
this.embeddedRecoveryExhausted = !1, n || this.reportTransportDiagnostic("auth_rejected", {
|
|
9899
9932
|
...this.authenticationDiagnostic(e),
|
|
9900
9933
|
failureKind: "permanent",
|
|
9901
9934
|
recoveryOutcome: "refused"
|
|
@@ -9912,7 +9945,7 @@ class Er {
|
|
|
9912
9945
|
if (this.credentialRecovery) return this.credentialRecovery;
|
|
9913
9946
|
if (this.directoryHttp.auth.token !== e) return;
|
|
9914
9947
|
const o = this.socket;
|
|
9915
|
-
if (o instanceof
|
|
9948
|
+
if (o instanceof Ie) return this.refreshCredentials(o, n);
|
|
9916
9949
|
if (this.options.webSocketFactory) throw n;
|
|
9917
9950
|
}
|
|
9918
9951
|
throw this.stopAuthentication(n), n;
|
|
@@ -9949,7 +9982,7 @@ class Er {
|
|
|
9949
9982
|
}
|
|
9950
9983
|
async refreshDefaultTransportCredentials(e) {
|
|
9951
9984
|
this.authenticationFailure || await this.refreshCredentials(e).catch((n) => {
|
|
9952
|
-
|
|
9985
|
+
De("web-sdk.agent", "Pluno credential refresh did not complete", {
|
|
9953
9986
|
message: n instanceof Error ? n.message : String(n)
|
|
9954
9987
|
});
|
|
9955
9988
|
});
|
|
@@ -9958,7 +9991,7 @@ class Er {
|
|
|
9958
9991
|
this.stopHeartbeat(), this.options.webSocketFactory && (this.heartbeatTimer = window.setInterval(() => {
|
|
9959
9992
|
const e = this.socket;
|
|
9960
9993
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
9961
|
-
this.socket === e && (
|
|
9994
|
+
this.socket === e && (De("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
9962
9995
|
}, sg));
|
|
9963
9996
|
}, ng));
|
|
9964
9997
|
}
|
|
@@ -9984,7 +10017,7 @@ class Er {
|
|
|
9984
10017
|
this.clientRuntime.isDisposed || (this.state = e, this.rebuildRuntimeInteractions(), this.emit("state", this.getState()));
|
|
9985
10018
|
}
|
|
9986
10019
|
setReconnectingState() {
|
|
9987
|
-
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;
|
|
9988
10021
|
this.conversationObservation?.wake();
|
|
9989
10022
|
const e = this.state.lastError !== null && (!this.state.isThinking || this.state.lastErrorCode === "connection_failed");
|
|
9990
10023
|
this.setState({
|
|
@@ -10065,7 +10098,7 @@ function vg() {
|
|
|
10065
10098
|
}), v;
|
|
10066
10099
|
}, c = function(f, m) {
|
|
10067
10100
|
const g = i.call(this, f, m), y = fo.get(this);
|
|
10068
|
-
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;
|
|
10069
10102
|
}, l = function(f) {
|
|
10070
10103
|
try {
|
|
10071
10104
|
const m = fo.get(this);
|
|
@@ -10074,7 +10107,7 @@ function vg() {
|
|
|
10074
10107
|
() => {
|
|
10075
10108
|
queueMicrotask(() => {
|
|
10076
10109
|
try {
|
|
10077
|
-
const g =
|
|
10110
|
+
const g = Rf(this.getAllResponseHeaders());
|
|
10078
10111
|
e({
|
|
10079
10112
|
requestId: m.requestId,
|
|
10080
10113
|
url: m.url,
|
|
@@ -10165,7 +10198,7 @@ function vg() {
|
|
|
10165
10198
|
};
|
|
10166
10199
|
return window.__plunoProductAgentNetworkCapture = d, d;
|
|
10167
10200
|
}
|
|
10168
|
-
function
|
|
10201
|
+
function De(t, e, n) {
|
|
10169
10202
|
if (typeof window > "u")
|
|
10170
10203
|
return;
|
|
10171
10204
|
const s = window, i = {
|
|
@@ -10200,11 +10233,11 @@ function Eg() {
|
|
|
10200
10233
|
});
|
|
10201
10234
|
}
|
|
10202
10235
|
async function Cg(t, e = {}) {
|
|
10203
|
-
const n = Mg(e.name), s = await
|
|
10236
|
+
const n = Mg(e.name), s = await Rg(t);
|
|
10204
10237
|
return s.ok ? s.sizeBytes > 8 * 1024 * 1024 ? {
|
|
10205
10238
|
type: "pluno.pageImages.inspectImage",
|
|
10206
10239
|
imageAttached: !1,
|
|
10207
|
-
imageAttachmentError:
|
|
10240
|
+
imageAttachmentError: Rl
|
|
10208
10241
|
} : {
|
|
10209
10242
|
type: "pluno.pageImages.inspectImage",
|
|
10210
10243
|
imageAttached: !0,
|
|
@@ -10218,15 +10251,15 @@ async function Cg(t, e = {}) {
|
|
|
10218
10251
|
imageAttachmentError: s.error
|
|
10219
10252
|
};
|
|
10220
10253
|
}
|
|
10221
|
-
async function
|
|
10222
|
-
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 } : {
|
|
10223
10256
|
ok: !0,
|
|
10224
10257
|
mimeType: t.type,
|
|
10225
10258
|
sizeBytes: t.size,
|
|
10226
10259
|
dataUrl: await qg(t)
|
|
10227
|
-
} : { 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);
|
|
10228
10261
|
}
|
|
10229
|
-
function
|
|
10262
|
+
function Ag(t) {
|
|
10230
10263
|
if (!t.startsWith("data:") || !t.includes(","))
|
|
10231
10264
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
10232
10265
|
const [e, n] = t.slice(5).split(",", 2), s = e.split(";").map((a) => a.trim()).filter(Boolean), i = s[0] ?? "";
|
|
@@ -10357,14 +10390,14 @@ function bt() {
|
|
|
10357
10390
|
...t ? { plunoProductAgentUi: t } : {}
|
|
10358
10391
|
};
|
|
10359
10392
|
}
|
|
10360
|
-
function
|
|
10393
|
+
function Bg() {
|
|
10361
10394
|
return {
|
|
10362
10395
|
pageUrl: location.href,
|
|
10363
10396
|
pageTitle: document.title,
|
|
10364
10397
|
htmlContent: Cr()
|
|
10365
10398
|
};
|
|
10366
10399
|
}
|
|
10367
|
-
function
|
|
10400
|
+
function zg(t) {
|
|
10368
10401
|
return Js.add(t), qs || (qs = jg()), () => {
|
|
10369
10402
|
Js.delete(t), Js.size === 0 && (qs?.(), qs = null);
|
|
10370
10403
|
};
|
|
@@ -10393,7 +10426,7 @@ function Cr() {
|
|
|
10393
10426
|
};
|
|
10394
10427
|
n("Selected text", window.getSelection()?.toString() ?? "");
|
|
10395
10428
|
const s = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(s)).filter(
|
|
10396
|
-
(g) =>
|
|
10429
|
+
(g) => Al(g) && !g.parentElement?.closest(s)
|
|
10397
10430
|
);
|
|
10398
10431
|
for (const g of i.slice(0, 3))
|
|
10399
10432
|
n("Active overlay", mo(rs(g), e));
|
|
@@ -10426,12 +10459,12 @@ function mo(t, e) {
|
|
|
10426
10459
|
n = n.replace(s, "");
|
|
10427
10460
|
return En(n);
|
|
10428
10461
|
}
|
|
10429
|
-
function
|
|
10462
|
+
function Al(t) {
|
|
10430
10463
|
const e = window.getComputedStyle(t);
|
|
10431
10464
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
10432
10465
|
}
|
|
10433
10466
|
function Fg() {
|
|
10434
|
-
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;
|
|
10435
10468
|
}
|
|
10436
10469
|
function $g(t, e) {
|
|
10437
10470
|
const n = /* @__PURE__ */ new Set([
|
|
@@ -10524,25 +10557,25 @@ function $g(t, e) {
|
|
|
10524
10557
|
return `${_.tagName.toLowerCase()}|${m(_)}|${I}`;
|
|
10525
10558
|
}, y = (_, I, k) => {
|
|
10526
10559
|
const T = (O, V) => {
|
|
10527
|
-
const E = O.tagName.toLowerCase(),
|
|
10528
|
-
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")
|
|
10529
10562
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
10530
10563
|
f += 1;
|
|
10531
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();
|
|
10532
10565
|
for (const C of D) {
|
|
10533
|
-
const
|
|
10534
|
-
Z.set(
|
|
10566
|
+
const B = g(C);
|
|
10567
|
+
Z.set(B, (Z.get(B) ?? 0) + 1);
|
|
10535
10568
|
}
|
|
10536
10569
|
const J = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
|
|
10537
10570
|
for (const C of D) {
|
|
10538
|
-
const
|
|
10539
|
-
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);
|
|
10540
10573
|
}
|
|
10541
10574
|
const le = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Set(), ke = [], N = [];
|
|
10542
10575
|
for (const C of D) {
|
|
10543
|
-
const
|
|
10544
|
-
if (le.set(
|
|
10545
|
-
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));
|
|
10546
10579
|
continue;
|
|
10547
10580
|
}
|
|
10548
10581
|
const j = T(C, V);
|
|
@@ -10552,12 +10585,12 @@ function $g(t, e) {
|
|
|
10552
10585
|
if (O.shadowRoot)
|
|
10553
10586
|
for (const C of Array.from(O.shadowRoot.children))
|
|
10554
10587
|
C instanceof HTMLElement && _e.push(T(C, V + 1));
|
|
10555
|
-
const
|
|
10556
|
-
[U, ...
|
|
10557
|
-
).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 = [];
|
|
10558
10591
|
if (Pe) {
|
|
10559
|
-
const C =
|
|
10560
|
-
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)));
|
|
10561
10594
|
}
|
|
10562
10595
|
for (const C of ke)
|
|
10563
10596
|
oe.push(...Ds(C, H));
|
|
@@ -10565,8 +10598,8 @@ function $g(t, e) {
|
|
|
10565
10598
|
if (x.length > 0) {
|
|
10566
10599
|
const C = x.slice(0, 20);
|
|
10567
10600
|
x.length > C.length && C.push("… shadow DOM omitted");
|
|
10568
|
-
const
|
|
10569
|
-
if (V < 2 && !
|
|
10601
|
+
const B = E.includes("tooltip") || E.includes("popper") || E.includes("loader");
|
|
10602
|
+
if (V < 2 && !B) {
|
|
10570
10603
|
const Y = Pe ? "#shadow-root" : `${E} #shadow-root`;
|
|
10571
10604
|
oe.push(...Ds([Y, ...Ds(C, 1)], H));
|
|
10572
10605
|
} else
|
|
@@ -10576,7 +10609,7 @@ function $g(t, e) {
|
|
|
10576
10609
|
lines: oe,
|
|
10577
10610
|
hasUsefulContent: be,
|
|
10578
10611
|
textPreview: Ze,
|
|
10579
|
-
containsTextElement: s.has(E) ||
|
|
10612
|
+
containsTextElement: s.has(E) || Ue.some((C) => C.containsTextElement)
|
|
10580
10613
|
};
|
|
10581
10614
|
};
|
|
10582
10615
|
return [`--- ${I} ---`, ...T(_, 0).lines].join(`
|
|
@@ -10792,7 +10825,7 @@ function ef() {
|
|
|
10792
10825
|
const n = crypto.randomUUID();
|
|
10793
10826
|
return window.localStorage.setItem(t, n), n;
|
|
10794
10827
|
}
|
|
10795
|
-
function
|
|
10828
|
+
function ze() {
|
|
10796
10829
|
return crypto.randomUUID();
|
|
10797
10830
|
}
|
|
10798
10831
|
function tc(t) {
|
|
@@ -10825,10 +10858,10 @@ function tf(t, e) {
|
|
|
10825
10858
|
e
|
|
10826
10859
|
),
|
|
10827
10860
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10828
|
-
...
|
|
10861
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10829
10862
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10830
|
-
respondsToUserMessageId:
|
|
10831
|
-
...
|
|
10863
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10864
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10832
10865
|
dataType: "assistant_draft",
|
|
10833
10866
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
10834
10867
|
};
|
|
@@ -10842,10 +10875,10 @@ function tf(t, e) {
|
|
|
10842
10875
|
e
|
|
10843
10876
|
),
|
|
10844
10877
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10845
|
-
...
|
|
10878
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10846
10879
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10847
|
-
respondsToUserMessageId:
|
|
10848
|
-
...
|
|
10880
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10881
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10849
10882
|
attachments: ql(i.attachments, e),
|
|
10850
10883
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
10851
10884
|
};
|
|
@@ -10861,16 +10894,16 @@ function tf(t, e) {
|
|
|
10861
10894
|
}), r;
|
|
10862
10895
|
}
|
|
10863
10896
|
if (i.type === "function_call_output") {
|
|
10864
|
-
const o =
|
|
10897
|
+
const o = Rh(i.output);
|
|
10865
10898
|
if (o !== null)
|
|
10866
10899
|
return {
|
|
10867
10900
|
id: String(n.id ?? crypto.randomUUID()),
|
|
10868
10901
|
role: "tool",
|
|
10869
10902
|
content: "",
|
|
10870
10903
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10871
|
-
...
|
|
10872
|
-
respondsToUserMessageId:
|
|
10873
|
-
...
|
|
10904
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10905
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10906
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10874
10907
|
dataType: "function_call_output",
|
|
10875
10908
|
toolName: Sl,
|
|
10876
10909
|
callId: Yn(i) ?? void 0,
|
|
@@ -10883,9 +10916,9 @@ function tf(t, e) {
|
|
|
10883
10916
|
role: "tool",
|
|
10884
10917
|
content: "",
|
|
10885
10918
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10886
|
-
...
|
|
10887
|
-
respondsToUserMessageId:
|
|
10888
|
-
...
|
|
10919
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10920
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10921
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10889
10922
|
dataType: "scheduled_check_in",
|
|
10890
10923
|
toolName: kl,
|
|
10891
10924
|
callId: Yn(i) ?? void 0,
|
|
@@ -10898,10 +10931,10 @@ function tf(t, e) {
|
|
|
10898
10931
|
role: "tool",
|
|
10899
10932
|
content: `Connect ${a.appName} to continue`,
|
|
10900
10933
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10901
|
-
...
|
|
10934
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10902
10935
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10903
|
-
respondsToUserMessageId:
|
|
10904
|
-
...
|
|
10936
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10937
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10905
10938
|
dataType: "function_call_output",
|
|
10906
10939
|
toolName: "authenticate_pipedream_app",
|
|
10907
10940
|
callId: Yn(i) ?? void 0,
|
|
@@ -10911,10 +10944,10 @@ function tf(t, e) {
|
|
|
10911
10944
|
role: "tool",
|
|
10912
10945
|
content: "Connect WhatsApp to continue",
|
|
10913
10946
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10914
|
-
...
|
|
10947
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10915
10948
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10916
|
-
respondsToUserMessageId:
|
|
10917
|
-
...
|
|
10949
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10950
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10918
10951
|
dataType: "function_call_output",
|
|
10919
10952
|
toolName: "request_personal_channel_connection",
|
|
10920
10953
|
callId: Yn(i) ?? void 0,
|
|
@@ -10926,10 +10959,10 @@ function tf(t, e) {
|
|
|
10926
10959
|
role: "tool",
|
|
10927
10960
|
content: i.type === "mcp_call" ? nf(i) : af(i),
|
|
10928
10961
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10929
|
-
...
|
|
10962
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10930
10963
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10931
|
-
respondsToUserMessageId:
|
|
10932
|
-
...
|
|
10964
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10965
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10933
10966
|
dataType: String(i.type),
|
|
10934
10967
|
toolName: i.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof i.name == "string" ? i.name : void 0,
|
|
10935
10968
|
callId: Yn(i) ?? void 0,
|
|
@@ -10940,10 +10973,10 @@ function tf(t, e) {
|
|
|
10940
10973
|
role: "system",
|
|
10941
10974
|
content: rf(i),
|
|
10942
10975
|
createdAt: typeof n.createdAt == "string" ? n.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
10943
|
-
...
|
|
10976
|
+
...Le(i) !== null ? { displaySequence: Le(i) } : {},
|
|
10944
10977
|
...st(i) !== null ? { causalSequence: st(i) } : {},
|
|
10945
|
-
respondsToUserMessageId:
|
|
10946
|
-
...
|
|
10978
|
+
respondsToUserMessageId: zt(i) ?? void 0,
|
|
10979
|
+
...Ne(i) ? { runId: Ne(i) } : {},
|
|
10947
10980
|
dataType: String(i.type),
|
|
10948
10981
|
loading: i.steered !== !0 && i.type === "run_status" && (i.status === "running" || i.status === "retrying"),
|
|
10949
10982
|
...i.steered === !0 || i.type === "run_status" && i.status === "steered" ? { steered: !0 } : {},
|
|
@@ -11028,7 +11061,7 @@ function Yn(t) {
|
|
|
11028
11061
|
function st(t) {
|
|
11029
11062
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
11030
11063
|
}
|
|
11031
|
-
function
|
|
11064
|
+
function Le(t) {
|
|
11032
11065
|
return typeof t.displaySequence == "number" && Number.isSafeInteger(t.displaySequence) ? t.displaySequence : null;
|
|
11033
11066
|
}
|
|
11034
11067
|
function nc(t) {
|
|
@@ -11065,14 +11098,14 @@ function df(t) {
|
|
|
11065
11098
|
if (!e)
|
|
11066
11099
|
return [];
|
|
11067
11100
|
const n = JSON.parse(e);
|
|
11068
|
-
return Array.isArray(n) ? n.filter(
|
|
11101
|
+
return Array.isArray(n) ? n.filter(Rr) : [];
|
|
11069
11102
|
} catch {
|
|
11070
11103
|
return [];
|
|
11071
11104
|
}
|
|
11072
11105
|
}
|
|
11073
11106
|
function on(t, e) {
|
|
11074
11107
|
try {
|
|
11075
|
-
const n = e.filter(
|
|
11108
|
+
const n = e.filter(Rr);
|
|
11076
11109
|
if (n.length === 0) {
|
|
11077
11110
|
window.localStorage.removeItem(`${sr}${t}`);
|
|
11078
11111
|
return;
|
|
@@ -11147,7 +11180,7 @@ function hf(t) {
|
|
|
11147
11180
|
if (!t || typeof t != "object")
|
|
11148
11181
|
return !1;
|
|
11149
11182
|
const e = t, n = e.event;
|
|
11150
|
-
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";
|
|
11151
11184
|
}
|
|
11152
11185
|
function gf(t, e) {
|
|
11153
11186
|
const n = new Set(
|
|
@@ -11165,7 +11198,7 @@ function ff(t) {
|
|
|
11165
11198
|
return;
|
|
11166
11199
|
}
|
|
11167
11200
|
}
|
|
11168
|
-
function
|
|
11201
|
+
function Rr(t) {
|
|
11169
11202
|
if (!t || typeof t != "object")
|
|
11170
11203
|
return !1;
|
|
11171
11204
|
const e = t;
|
|
@@ -11251,11 +11284,11 @@ function wf(t) {
|
|
|
11251
11284
|
} = t;
|
|
11252
11285
|
return o;
|
|
11253
11286
|
}
|
|
11254
|
-
function
|
|
11287
|
+
function zt(t) {
|
|
11255
11288
|
const e = t.respondsToUserMessageId;
|
|
11256
11289
|
return typeof e == "string" && e ? e : null;
|
|
11257
11290
|
}
|
|
11258
|
-
function
|
|
11291
|
+
function Ne(t) {
|
|
11259
11292
|
const e = t.runId;
|
|
11260
11293
|
return typeof e == "string" && e ? e : null;
|
|
11261
11294
|
}
|
|
@@ -11267,14 +11300,14 @@ function Ul(t) {
|
|
|
11267
11300
|
const e = {};
|
|
11268
11301
|
try {
|
|
11269
11302
|
new Headers(t).forEach((n, s) => {
|
|
11270
|
-
Object.keys(e).length < kr && (e[s] =
|
|
11303
|
+
Object.keys(e).length < kr && (e[s] = Ar(s, n));
|
|
11271
11304
|
});
|
|
11272
11305
|
} catch {
|
|
11273
11306
|
return {};
|
|
11274
11307
|
}
|
|
11275
11308
|
return e;
|
|
11276
11309
|
}
|
|
11277
|
-
function
|
|
11310
|
+
function Ar(t, e) {
|
|
11278
11311
|
return Kl(t) ? bi : Mt(oi(e), gg);
|
|
11279
11312
|
}
|
|
11280
11313
|
function vf(t, e) {
|
|
@@ -11291,7 +11324,7 @@ async function If(t, e, n, s) {
|
|
|
11291
11324
|
});
|
|
11292
11325
|
}
|
|
11293
11326
|
async function Sf(t) {
|
|
11294
|
-
if (!
|
|
11327
|
+
if (!Bl(t.headers))
|
|
11295
11328
|
return;
|
|
11296
11329
|
let e = null, n = null;
|
|
11297
11330
|
try {
|
|
@@ -11323,7 +11356,7 @@ async function Sf(t) {
|
|
|
11323
11356
|
}
|
|
11324
11357
|
}
|
|
11325
11358
|
function xf(t, e) {
|
|
11326
|
-
if (
|
|
11359
|
+
if (Bl(new Headers(e)))
|
|
11327
11360
|
try {
|
|
11328
11361
|
return t.responseType === "" || t.responseType === "text" ? Mt(t.responseText ?? "") : void 0;
|
|
11329
11362
|
} catch {
|
|
@@ -11353,7 +11386,7 @@ function rc(t) {
|
|
|
11353
11386
|
return oi(t);
|
|
11354
11387
|
}
|
|
11355
11388
|
}
|
|
11356
|
-
function
|
|
11389
|
+
function Bl(t) {
|
|
11357
11390
|
if (!t)
|
|
11358
11391
|
return !1;
|
|
11359
11392
|
const e = t.get("content-type")?.toLowerCase() ?? "", n = t.get("content-length"), s = Number(n);
|
|
@@ -11388,7 +11421,7 @@ function Ef(t, e) {
|
|
|
11388
11421
|
function Cf(t) {
|
|
11389
11422
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
11390
11423
|
}
|
|
11391
|
-
function
|
|
11424
|
+
function Rf(t) {
|
|
11392
11425
|
const e = {};
|
|
11393
11426
|
for (const n of t.trim().split(/[\r\n]+/)) {
|
|
11394
11427
|
const s = n.indexOf(":");
|
|
@@ -11397,7 +11430,7 @@ function Af(t) {
|
|
|
11397
11430
|
if (Object.keys(e).length >= kr)
|
|
11398
11431
|
break;
|
|
11399
11432
|
const i = n.slice(0, s).trim();
|
|
11400
|
-
e[i] =
|
|
11433
|
+
e[i] = Ar(i, n.slice(s + 1).trim());
|
|
11401
11434
|
}
|
|
11402
11435
|
return e;
|
|
11403
11436
|
}
|
|
@@ -11407,14 +11440,14 @@ function Mt(t, e = xr) {
|
|
|
11407
11440
|
function bo(t) {
|
|
11408
11441
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
11409
11442
|
}
|
|
11410
|
-
class
|
|
11443
|
+
class zl extends Error {
|
|
11411
11444
|
constructor(e, n) {
|
|
11412
11445
|
super(`${e} (${n})`), this.status = n, this.name = "AttachmentUploadHttpError", this.code = String(n);
|
|
11413
11446
|
}
|
|
11414
11447
|
status;
|
|
11415
11448
|
code;
|
|
11416
11449
|
}
|
|
11417
|
-
async function
|
|
11450
|
+
async function Af(t, e) {
|
|
11418
11451
|
let n = null;
|
|
11419
11452
|
for (let s = 0; s < Ya; s += 1)
|
|
11420
11453
|
try {
|
|
@@ -11432,7 +11465,7 @@ function Tf(t) {
|
|
|
11432
11465
|
});
|
|
11433
11466
|
}
|
|
11434
11467
|
function Mf(t) {
|
|
11435
|
-
return t instanceof
|
|
11468
|
+
return t instanceof zl ? Pf(t.status) : t instanceof TypeError;
|
|
11436
11469
|
}
|
|
11437
11470
|
function Pf(t) {
|
|
11438
11471
|
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
@@ -11440,7 +11473,7 @@ function Pf(t) {
|
|
|
11440
11473
|
function qf(t) {
|
|
11441
11474
|
return t === 401 || t === 403;
|
|
11442
11475
|
}
|
|
11443
|
-
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 = /[),.;\]]+$/;
|
|
11444
11477
|
function it(t) {
|
|
11445
11478
|
return ii(t, 0, /* @__PURE__ */ new WeakSet());
|
|
11446
11479
|
}
|
|
@@ -11457,14 +11490,14 @@ function ii(t, e, n) {
|
|
|
11457
11490
|
return t.map((i) => ii(i, e + 1, n));
|
|
11458
11491
|
const s = {};
|
|
11459
11492
|
for (const [i, o] of Object.entries(t))
|
|
11460
|
-
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);
|
|
11461
11494
|
return s;
|
|
11462
11495
|
}
|
|
11463
11496
|
function Kl(t) {
|
|
11464
11497
|
const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
11465
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");
|
|
11466
11499
|
}
|
|
11467
|
-
function
|
|
11500
|
+
function zf(t) {
|
|
11468
11501
|
return typeof t == "string" ? Wl(t) : ii(t, 0, /* @__PURE__ */ new WeakSet());
|
|
11469
11502
|
}
|
|
11470
11503
|
function Wl(t) {
|
|
@@ -11484,7 +11517,7 @@ function jf(t) {
|
|
|
11484
11517
|
return t.replace(jl, `Bearer ${Pt}`).replace(Fl, `Basic ${Pt}`).replace($l, Pt).replace(Hl, (e, n) => `${n}: ${bi}`);
|
|
11485
11518
|
}
|
|
11486
11519
|
function Ff(t) {
|
|
11487
|
-
const e = t.match(
|
|
11520
|
+
const e = t.match(Bf)?.[0] ?? "", n = e ? t.slice(0, -e.length) : t;
|
|
11488
11521
|
return `${Wl(n)}${e}`;
|
|
11489
11522
|
}
|
|
11490
11523
|
const $f = Object.freeze({
|
|
@@ -11774,7 +11807,7 @@ function gm(t, e, n, s) {
|
|
|
11774
11807
|
const b = e.ownerDocument.defaultView;
|
|
11775
11808
|
let v, _, I = /* @__PURE__ */ new Map(), k = d.sessionId, T = d.selectionKey;
|
|
11776
11809
|
const O = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map();
|
|
11777
|
-
let E = null,
|
|
11810
|
+
let E = null, z = null, P = null, G = 0, U = null, S = null, D = null;
|
|
11778
11811
|
const Z = () => JSON.stringify([
|
|
11779
11812
|
d.sessionId,
|
|
11780
11813
|
d.assistantDraftRespondsToUserMessageId,
|
|
@@ -11785,7 +11818,7 @@ function gm(t, e, n, s) {
|
|
|
11785
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]");
|
|
11786
11819
|
};
|
|
11787
11820
|
function ce() {
|
|
11788
|
-
|
|
11821
|
+
z !== null && b.clearTimeout(z), z = null, P = null;
|
|
11789
11822
|
}
|
|
11790
11823
|
function le(H = !1) {
|
|
11791
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();
|
|
@@ -11800,13 +11833,13 @@ function gm(t, e, n, s) {
|
|
|
11800
11833
|
le();
|
|
11801
11834
|
return;
|
|
11802
11835
|
}
|
|
11803
|
-
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 = [];
|
|
11804
11837
|
for (const L of Array.from(e.querySelectorAll(`${C}, [data-message-role="user"]`))) {
|
|
11805
11838
|
const ee = b.getComputedStyle(L);
|
|
11806
|
-
!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");
|
|
11807
11840
|
}
|
|
11808
11841
|
let Y = 0;
|
|
11809
|
-
if (
|
|
11842
|
+
if (B.includes("thinking")) {
|
|
11810
11843
|
const L = Array.from(e.querySelectorAll('[data-message-role="user"]')), ee = L[L.length - 1], ie = ee?.dataset.messageKey ?? ee?.dataset.entryKey ?? null;
|
|
11811
11844
|
ie !== U && O.delete("thinking-without-progress"), U = ie;
|
|
11812
11845
|
let ae = 2166136261;
|
|
@@ -11819,7 +11852,7 @@ function gm(t, e, n, s) {
|
|
|
11819
11852
|
ae = Math.imul(ae ^ ve.charCodeAt(M), 16777619) >>> 0;
|
|
11820
11853
|
}
|
|
11821
11854
|
const lt = b.performance.now();
|
|
11822
|
-
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;
|
|
11823
11856
|
} else
|
|
11824
11857
|
ce(), O.delete("thinking-without-progress");
|
|
11825
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;
|
|
@@ -11833,7 +11866,7 @@ function gm(t, e, n, s) {
|
|
|
11833
11866
|
'button[aria-label="Stop"], button[aria-label="Stop generating"]'
|
|
11834
11867
|
)).filter(J).length,
|
|
11835
11868
|
stopPendingMs: S ? b.performance.now() - S.at : 0,
|
|
11836
|
-
thinkingSequence:
|
|
11869
|
+
thinkingSequence: B,
|
|
11837
11870
|
thinkingIdleMs: Y,
|
|
11838
11871
|
messageKeys: Array.from(e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]")).flatMap((L) => L.dataset.messageKey ?? L.dataset.entryKey ?? []),
|
|
11839
11872
|
canonicalItemKeys: x("[data-canonical-item-key]", "data-canonical-item-key"),
|
|
@@ -11877,8 +11910,8 @@ function gm(t, e, n, s) {
|
|
|
11877
11910
|
}, Math.max(1, 250 - (se - Math.min(...Array.from(V.values(), (L) => L.monotonicMs))))) : null;
|
|
11878
11911
|
}
|
|
11879
11912
|
function ke(H, oe = null) {
|
|
11880
|
-
const x = H !== "runtime", C = x ? e.querySelectorAll("[data-message-key], [data-entry-key][data-message-role]") : null,
|
|
11881
|
-
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) {
|
|
11882
11915
|
const se = C ? C[ne].dataset.messageKey ?? C[ne].dataset.entryKey : d.messages[ne].id;
|
|
11883
11916
|
se && Y.push(se.slice(0, _o));
|
|
11884
11917
|
}
|
|
@@ -11886,8 +11919,8 @@ function gm(t, e, n, s) {
|
|
|
11886
11919
|
session_id: d.sessionId?.slice(0, _o) ?? null,
|
|
11887
11920
|
run_id: (d.assistantDraftRunId ?? d.messages[d.messages.length - 1]?.runId)?.slice(0, _o) ?? null,
|
|
11888
11921
|
item_keys: Y,
|
|
11889
|
-
item_count:
|
|
11890
|
-
items_truncated:
|
|
11922
|
+
item_count: B,
|
|
11923
|
+
items_truncated: B > pc,
|
|
11891
11924
|
thinking: d.isThinking,
|
|
11892
11925
|
loading: d.isLoadingSession,
|
|
11893
11926
|
welcome: x && si(e) === "none" && !!e.querySelector(".pluno-pa-widget__empty-state--starter, .empty-state--starter"),
|
|
@@ -11953,8 +11986,8 @@ function gm(t, e, n, s) {
|
|
|
11953
11986
|
}
|
|
11954
11987
|
const _e = s.on("state", (H) => {
|
|
11955
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();
|
|
11956
|
-
}),
|
|
11957
|
-
|
|
11989
|
+
}), Ue = new MutationObserver(N);
|
|
11990
|
+
Ue.observe(e, {
|
|
11958
11991
|
subtree: !0,
|
|
11959
11992
|
childList: !0,
|
|
11960
11993
|
characterData: !0,
|
|
@@ -11980,14 +12013,14 @@ function gm(t, e, n, s) {
|
|
|
11980
12013
|
records: o.map((H) => ({ ...H, item_keys: [...H.item_keys] }))
|
|
11981
12014
|
}),
|
|
11982
12015
|
dispose: () => {
|
|
11983
|
-
_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;
|
|
11984
12017
|
}
|
|
11985
12018
|
};
|
|
11986
12019
|
return t.__plunoUiFlightRecorder = Pe, ke("runtime"), N(), Pe;
|
|
11987
12020
|
}
|
|
11988
12021
|
const fm = [100, 500, 1500, 4e3];
|
|
11989
12022
|
let mm = 0;
|
|
11990
|
-
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 = {
|
|
11991
12024
|
launcherLabel: "Ask for anything...",
|
|
11992
12025
|
accentColor: "#7c3aed",
|
|
11993
12026
|
colorScheme: "light",
|
|
@@ -11995,7 +12028,7 @@ const ym = "product-agent:sdk-preview-socket-connect", bm = "product-agent:sdk-p
|
|
|
11995
12028
|
scribbleStyle: !0,
|
|
11996
12029
|
position: "bottom-right",
|
|
11997
12030
|
movableLauncher: !0
|
|
11998
|
-
}, 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 = [
|
|
11999
12032
|
{
|
|
12000
12033
|
ellipseCx: "17.5",
|
|
12001
12034
|
ellipseCy: "24.5",
|
|
@@ -12042,13 +12075,13 @@ async function Wm(t = {}) {
|
|
|
12042
12075
|
const e = {
|
|
12043
12076
|
layout: t.layout ?? "floating",
|
|
12044
12077
|
mountTarget: t.mountTarget,
|
|
12045
|
-
launcherLabel: t.launcherLabel ??
|
|
12046
|
-
accentColor: t.accentColor ??
|
|
12047
|
-
colorScheme: t.colorScheme ??
|
|
12048
|
-
fontFamily: t.fontFamily ??
|
|
12049
|
-
scribbleStyle: t.scribbleStyle ??
|
|
12050
|
-
position: t.position ??
|
|
12051
|
-
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,
|
|
12052
12085
|
mobilePanelTopOffset: typeof t.mobilePanelTopOffset == "number" && Number.isFinite(t.mobilePanelTopOffset) ? Math.max(0, t.mobilePanelTopOffset) : 0,
|
|
12053
12086
|
token: t.token,
|
|
12054
12087
|
tokenProvider: t.tokenProvider,
|
|
@@ -12175,7 +12208,7 @@ async function Wm(t = {}) {
|
|
|
12175
12208
|
".pluno-pa-widget__status--launcher"
|
|
12176
12209
|
), V = l.querySelector(
|
|
12177
12210
|
".pluno-pa-widget__launcher-minimize"
|
|
12178
|
-
), E = l.querySelector(".pluno-pa-widget__panel"),
|
|
12211
|
+
), E = l.querySelector(".pluno-pa-widget__panel"), z = l.querySelector(
|
|
12179
12212
|
".pluno-pa-widget__panel-drag-handle"
|
|
12180
12213
|
), P = l.querySelector(
|
|
12181
12214
|
".pluno-pa-widget__scribble-spirals--panel"
|
|
@@ -12199,7 +12232,7 @@ async function Wm(t = {}) {
|
|
|
12199
12232
|
".pluno-pa-widget__input"
|
|
12200
12233
|
), _e = l.querySelector(
|
|
12201
12234
|
".pluno-pa-widget__send"
|
|
12202
|
-
),
|
|
12235
|
+
), Ue = l.querySelector(
|
|
12203
12236
|
".pluno-pa-widget__top-actions"
|
|
12204
12237
|
), be = l.querySelector(
|
|
12205
12238
|
".pluno-pa-widget__history"
|
|
@@ -12218,13 +12251,13 @@ async function Wm(t = {}) {
|
|
|
12218
12251
|
), C = l.querySelector(
|
|
12219
12252
|
".pluno-pa-widget__timeline-bottom-sentinel"
|
|
12220
12253
|
);
|
|
12221
|
-
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)
|
|
12222
12255
|
throw new Error("Failed to mount Pluno widget");
|
|
12223
12256
|
if (e.movableLauncher && !k)
|
|
12224
12257
|
throw new Error("Failed to mount Pluno widget drag handle");
|
|
12225
|
-
if (e.movableLauncher && !
|
|
12258
|
+
if (e.movableLauncher && !z)
|
|
12226
12259
|
throw new Error("Failed to mount Pluno widget panel drag handle");
|
|
12227
|
-
let
|
|
12260
|
+
let B = !1, Y = !1;
|
|
12228
12261
|
const re = () => {
|
|
12229
12262
|
if (s()) {
|
|
12230
12263
|
Z.hidden = !0, Z.replaceChildren();
|
|
@@ -12248,9 +12281,9 @@ async function Wm(t = {}) {
|
|
|
12248
12281
|
let W = 0, ge = 0, ye = 0;
|
|
12249
12282
|
const ne = /* @__PURE__ */ new Map();
|
|
12250
12283
|
let se = null, L = null;
|
|
12251
|
-
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,
|
|
12252
|
-
const
|
|
12253
|
-
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());
|
|
12254
12287
|
const de = Co(_);
|
|
12255
12288
|
return ht(
|
|
12256
12289
|
"web-sdk.widget.focus",
|
|
@@ -12259,8 +12292,8 @@ async function Wm(t = {}) {
|
|
|
12259
12292
|
reason: w,
|
|
12260
12293
|
mountId: o,
|
|
12261
12294
|
widgetAgeMs: Date.now() - r,
|
|
12262
|
-
scheduledDelayMs:
|
|
12263
|
-
previousFocus: ee(
|
|
12295
|
+
scheduledDelayMs: R.scheduledAt === void 0 ? null : Date.now() - R.scheduledAt,
|
|
12296
|
+
previousFocus: ee(A),
|
|
12264
12297
|
requestedFocus: ee(p),
|
|
12265
12298
|
resultingFocus: ee(de),
|
|
12266
12299
|
focusSkipped: F,
|
|
@@ -12277,13 +12310,13 @@ async function Wm(t = {}) {
|
|
|
12277
12310
|
preventScroll: !0,
|
|
12278
12311
|
skipIfAlreadyFocused: !0
|
|
12279
12312
|
}), lt = () => {
|
|
12280
|
-
|
|
12313
|
+
Ry(
|
|
12281
12314
|
le,
|
|
12282
12315
|
j,
|
|
12283
12316
|
(p) => {
|
|
12284
12317
|
ge++, j = j.filter(
|
|
12285
|
-
(w,
|
|
12286
|
-
), lt(),
|
|
12318
|
+
(w, R) => R !== p
|
|
12319
|
+
), lt(), Ae(M.getState()), Re(), ae("remove_attachment");
|
|
12287
12320
|
}
|
|
12288
12321
|
);
|
|
12289
12322
|
}, Ke = e.loginRequired || e.token || e.webSocketFactory ? void 0 : e.tokenProvider ?? (e.tokenEndpoint ? async (p) => bb(
|
|
@@ -12337,7 +12370,7 @@ async function Wm(t = {}) {
|
|
|
12337
12370
|
} catch (p) {
|
|
12338
12371
|
throw ve?.release(), a.remove(), p;
|
|
12339
12372
|
}
|
|
12340
|
-
let
|
|
12373
|
+
let An = M.getState().sessionId, Tn = M.getState().selectionKey, Yt = M.getState().user?.id ?? null;
|
|
12341
12374
|
const Ii = e.model ?? "gpt-6.1-sol";
|
|
12342
12375
|
let mn = Ii, Si = M.getAccount()?.auth?.workspace?.id ?? null;
|
|
12343
12376
|
v.appendChild(a), ht(
|
|
@@ -12353,13 +12386,13 @@ async function Wm(t = {}) {
|
|
|
12353
12386
|
const xi = new Set(d.openToolGroupKeys);
|
|
12354
12387
|
let dt = null, We = !1, Ot = !1, It = {
|
|
12355
12388
|
enabled: !0
|
|
12356
|
-
}, Dt = 0, ki = null, Xt = null, Qt = null, gs = null, Mn = !1, me = null,
|
|
12357
|
-
const jr = (p) =>
|
|
12358
|
-
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,
|
|
12359
12392
|
guardCreatedAt: me?.createdAt ?? null,
|
|
12360
12393
|
selectionFencePending: jr(p)
|
|
12361
12394
|
}), fs = /* @__PURE__ */ new Set();
|
|
12362
|
-
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 = () => {
|
|
12363
12396
|
}, Ci = "", Fe = M.getSessionHistoryState();
|
|
12364
12397
|
const vd = M.subscribeSessionHistory((p) => {
|
|
12365
12398
|
Fe = p, We || St();
|
|
@@ -12367,15 +12400,15 @@ async function Wm(t = {}) {
|
|
|
12367
12400
|
It = { enabled: p, reason: w };
|
|
12368
12401
|
}, ut = () => {
|
|
12369
12402
|
oe.hidden = !0;
|
|
12370
|
-
},
|
|
12403
|
+
}, Ri = () => {
|
|
12371
12404
|
x.clientHeight === 0 || x.scrollHeight - x.scrollTop - x.clientHeight > 1 || (nt(!0, "bottom"), ut());
|
|
12372
|
-
},
|
|
12373
|
-
const
|
|
12374
|
-
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));
|
|
12375
12408
|
}, Id = () => {
|
|
12376
|
-
Mu(Mn,
|
|
12409
|
+
Mu(Mn, Ai), oe.hidden = !1;
|
|
12377
12410
|
}, Wr = () => {
|
|
12378
|
-
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, {
|
|
12379
12412
|
before: me.observedConversation,
|
|
12380
12413
|
current: me.observedWelcome
|
|
12381
12414
|
}), me = null);
|
|
@@ -12388,53 +12421,53 @@ async function Wm(t = {}) {
|
|
|
12388
12421
|
};
|
|
12389
12422
|
St = () => {
|
|
12390
12423
|
const p = Gp(Fe.data), w = Fe.status === "loading" || Fe.status === "refreshing" || Fe.status === "loading_more";
|
|
12391
|
-
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) {
|
|
12392
12425
|
Ci = "";
|
|
12393
12426
|
return;
|
|
12394
12427
|
}
|
|
12395
|
-
const
|
|
12428
|
+
const R = JSON.stringify([
|
|
12396
12429
|
Fe.status,
|
|
12397
12430
|
p,
|
|
12398
12431
|
M.getState().sessionId,
|
|
12399
|
-
p.map((
|
|
12432
|
+
p.map((A) => Cc(A.lastActiveAt, Date.now()))
|
|
12400
12433
|
]);
|
|
12401
|
-
if (
|
|
12402
|
-
if (Ci =
|
|
12434
|
+
if (R !== Ci) {
|
|
12435
|
+
if (Ci = R, Ce.classList.toggle(
|
|
12403
12436
|
"pluno-pa-widget__history-list--center",
|
|
12404
12437
|
w && p.length === 0
|
|
12405
12438
|
), Ce.replaceChildren(), w && p.length === 0) {
|
|
12406
|
-
const
|
|
12407
|
-
|
|
12439
|
+
const A = document.createElement("p");
|
|
12440
|
+
A.className = "pluno-pa-widget__history-loading", A.textContent = "Loading...", Ce.appendChild(A);
|
|
12408
12441
|
}
|
|
12409
|
-
for (const
|
|
12442
|
+
for (const A of p) {
|
|
12410
12443
|
const F = document.createElement("button");
|
|
12411
12444
|
F.type = "button", F.className = "pluno-pa-widget__history-item";
|
|
12412
|
-
const de =
|
|
12445
|
+
const de = A.id === M.getState().sessionId;
|
|
12413
12446
|
F.disabled = de, de && F.setAttribute("aria-current", "page");
|
|
12414
12447
|
const Ee = document.createElement("span");
|
|
12415
|
-
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));
|
|
12416
12449
|
const Te = document.createElement("time");
|
|
12417
|
-
Te.className = "pluno-pa-widget__history-time", Te.dateTime =
|
|
12418
|
-
|
|
12450
|
+
Te.className = "pluno-pa-widget__history-time", Te.dateTime = A.lastActiveAt, Te.textContent = Cc(
|
|
12451
|
+
A.lastActiveAt,
|
|
12419
12452
|
Date.now()
|
|
12420
12453
|
);
|
|
12421
12454
|
const ue = document.createElement("small");
|
|
12422
|
-
ue.className = "pluno-pa-widget__history-path", ue.textContent = dy(
|
|
12423
|
-
|
|
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");
|
|
12424
12457
|
}), Ce.appendChild(F);
|
|
12425
12458
|
}
|
|
12426
12459
|
if (w && p.length > 0) {
|
|
12427
|
-
const
|
|
12428
|
-
|
|
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);
|
|
12429
12462
|
}
|
|
12430
|
-
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;
|
|
12431
12464
|
}
|
|
12432
12465
|
};
|
|
12433
12466
|
const Ti = (p = !1) => {
|
|
12434
|
-
if (tt !== null && (window.clearTimeout(tt), tt = null), !(e.layout === "page" || e.loginRequired || e.signupRequired ||
|
|
12435
|
-
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(() => {
|
|
12436
12469
|
}).finally(() => {
|
|
12437
|
-
|
|
12470
|
+
B = !1;
|
|
12438
12471
|
});
|
|
12439
12472
|
};
|
|
12440
12473
|
H.addEventListener("click", () => {
|
|
@@ -12477,10 +12510,10 @@ async function Wm(t = {}) {
|
|
|
12477
12510
|
});
|
|
12478
12511
|
}, ys = (p, w) => {
|
|
12479
12512
|
e.onDisplayStateChange?.(p, w);
|
|
12480
|
-
}, On = (p, w = !0,
|
|
12481
|
-
const
|
|
12513
|
+
}, On = (p, w = !0, R = "external_request") => {
|
|
12514
|
+
const A = l.classList.contains("pluno-pa-widget--minimized");
|
|
12482
12515
|
if (Nc(e, p), p === "shown") {
|
|
12483
|
-
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);
|
|
12484
12517
|
return;
|
|
12485
12518
|
}
|
|
12486
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(
|
|
@@ -12490,7 +12523,7 @@ async function Wm(t = {}) {
|
|
|
12490
12523
|
f,
|
|
12491
12524
|
e.position
|
|
12492
12525
|
)
|
|
12493
|
-
), xc(l), $e(), !
|
|
12526
|
+
), xc(l), $e(), !A && e.layout === "floating" && M.recordWidgetLifecycle("minimized", R), w && ys("minimized", R);
|
|
12494
12527
|
}, Zt = (p, w = {}) => {
|
|
12495
12528
|
ry(p, {
|
|
12496
12529
|
debugVersion: $m,
|
|
@@ -12545,11 +12578,11 @@ async function Wm(t = {}) {
|
|
|
12545
12578
|
if (l.classList.contains("pluno-pa-widget--open") || l.classList.contains("pluno-pa-widget--closing")) {
|
|
12546
12579
|
Io(l, g);
|
|
12547
12580
|
const w = an(g);
|
|
12548
|
-
|
|
12581
|
+
Ro(
|
|
12549
12582
|
P,
|
|
12550
12583
|
Pi()
|
|
12551
12584
|
);
|
|
12552
|
-
const
|
|
12585
|
+
const R = is(
|
|
12553
12586
|
y ? Xs(y, w) : ko(
|
|
12554
12587
|
l,
|
|
12555
12588
|
p,
|
|
@@ -12558,9 +12591,9 @@ async function Wm(t = {}) {
|
|
|
12558
12591
|
),
|
|
12559
12592
|
w
|
|
12560
12593
|
);
|
|
12561
|
-
bs(
|
|
12594
|
+
bs(R, p), Zt(
|
|
12562
12595
|
"Applied open panel position after viewport resize",
|
|
12563
|
-
{ openPanelPosition:
|
|
12596
|
+
{ openPanelPosition: R }
|
|
12564
12597
|
);
|
|
12565
12598
|
} else f && Zt(
|
|
12566
12599
|
"Applied visible launcher position after viewport resize",
|
|
@@ -12575,15 +12608,15 @@ async function Wm(t = {}) {
|
|
|
12575
12608
|
launcherDragHandle: k,
|
|
12576
12609
|
getPosition: () => qn(),
|
|
12577
12610
|
setPosition: (p) => {
|
|
12578
|
-
const w = p,
|
|
12611
|
+
const w = p, R = ls(l), A = Ys(
|
|
12579
12612
|
l,
|
|
12580
12613
|
p,
|
|
12581
|
-
|
|
12614
|
+
R
|
|
12582
12615
|
);
|
|
12583
12616
|
f = xo(
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
), y = null, jt(l,
|
|
12617
|
+
A,
|
|
12618
|
+
R
|
|
12619
|
+
), y = null, jt(l, A), Zt("Dragging closed launcher", {
|
|
12587
12620
|
requestedPosition: w
|
|
12588
12621
|
});
|
|
12589
12622
|
},
|
|
@@ -12606,7 +12639,7 @@ async function Wm(t = {}) {
|
|
|
12606
12639
|
size: p
|
|
12607
12640
|
};
|
|
12608
12641
|
}, kd = (p) => {
|
|
12609
|
-
g = wi(p.size), Io(l, g),
|
|
12642
|
+
g = wi(p.size), Io(l, g), Ro(
|
|
12610
12643
|
P,
|
|
12611
12644
|
Pi()
|
|
12612
12645
|
);
|
|
@@ -12618,43 +12651,43 @@ async function Wm(t = {}) {
|
|
|
12618
12651
|
w,
|
|
12619
12652
|
an(g)
|
|
12620
12653
|
);
|
|
12621
|
-
const
|
|
12622
|
-
bs(w,
|
|
12654
|
+
const R = qn();
|
|
12655
|
+
bs(w, R);
|
|
12623
12656
|
}, Ed = (p) => {
|
|
12624
|
-
const w = an(g),
|
|
12657
|
+
const w = an(g), R = is(
|
|
12625
12658
|
p,
|
|
12626
12659
|
w
|
|
12627
|
-
),
|
|
12660
|
+
), A = ls(l), F = Ys(
|
|
12628
12661
|
l,
|
|
12629
12662
|
iy(
|
|
12630
|
-
A,
|
|
12631
|
-
w,
|
|
12632
12663
|
R,
|
|
12664
|
+
w,
|
|
12665
|
+
A,
|
|
12633
12666
|
e.position
|
|
12634
12667
|
),
|
|
12635
|
-
|
|
12668
|
+
A
|
|
12636
12669
|
);
|
|
12637
12670
|
f = xo(
|
|
12638
12671
|
F,
|
|
12639
|
-
|
|
12640
|
-
), m = !0, y = null, jt(l, F), bs(
|
|
12641
|
-
}, Cd = e.movableLauncher &&
|
|
12672
|
+
A
|
|
12673
|
+
), m = !0, y = null, jt(l, F), bs(R, F);
|
|
12674
|
+
}, Cd = e.movableLauncher && z ? Xm({
|
|
12642
12675
|
root: l,
|
|
12643
|
-
handle:
|
|
12676
|
+
handle: z,
|
|
12644
12677
|
getPosition: () => Xr().position,
|
|
12645
12678
|
setPosition: Ed,
|
|
12646
12679
|
persist: $e
|
|
12647
12680
|
}) : () => {
|
|
12648
|
-
},
|
|
12681
|
+
}, Rd = G.length > 0 ? Qm({
|
|
12649
12682
|
root: l,
|
|
12650
12683
|
handles: G,
|
|
12651
12684
|
getBounds: Xr,
|
|
12652
12685
|
setBounds: kd,
|
|
12653
12686
|
persist: $e
|
|
12654
12687
|
}) : () => {
|
|
12655
|
-
}, xt = (p = "", w = !0,
|
|
12688
|
+
}, xt = (p = "", w = !0, R = !0, A = "external_request") => {
|
|
12656
12689
|
const F = l.classList.contains("pluno-pa-widget--open") || !E.hidden && !l.classList.contains("pluno-pa-widget--closing");
|
|
12657
|
-
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(
|
|
12658
12691
|
P,
|
|
12659
12692
|
Pi()
|
|
12660
12693
|
), l.classList.remove("pluno-pa-widget--closing");
|
|
@@ -12667,15 +12700,15 @@ async function Wm(t = {}) {
|
|
|
12667
12700
|
if (bs(Ee, de), Zt("Opening launcher at clamped open panel position", {
|
|
12668
12701
|
openPanelPosition: Ee,
|
|
12669
12702
|
visibleLauncherPosition: de
|
|
12670
|
-
}), nt(!0, "open"), ut(), !F && e.layout === "floating" && M.recordWidgetLifecycle("opened",
|
|
12671
|
-
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);
|
|
12672
12705
|
return;
|
|
12673
12706
|
}
|
|
12674
12707
|
const Te = Date.now();
|
|
12675
12708
|
window.requestAnimationFrame(() => {
|
|
12676
|
-
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", {
|
|
12677
12710
|
scheduledAt: Te
|
|
12678
|
-
}), 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(() => {
|
|
12679
12712
|
I.hidden = !0, In(x, () => It.enabled), Dt = x.scrollTop;
|
|
12680
12713
|
}, 220);
|
|
12681
12714
|
});
|
|
@@ -12702,7 +12735,7 @@ async function Wm(t = {}) {
|
|
|
12702
12735
|
xt(p, !0, !0, "launcher_input"), T.value = "";
|
|
12703
12736
|
});
|
|
12704
12737
|
let Ln = null, Lt = null, ws = null, en = null, mt = null, qe = null;
|
|
12705
|
-
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) => {
|
|
12706
12739
|
let w = p;
|
|
12707
12740
|
for (; w; ) {
|
|
12708
12741
|
if (w.assignedSlot)
|
|
@@ -12715,12 +12748,12 @@ async function Wm(t = {}) {
|
|
|
12715
12748
|
return null;
|
|
12716
12749
|
let w = p;
|
|
12717
12750
|
for (; w; ) {
|
|
12718
|
-
const
|
|
12719
|
-
if (
|
|
12720
|
-
return
|
|
12721
|
-
const
|
|
12722
|
-
if (
|
|
12723
|
-
w =
|
|
12751
|
+
const R = w.closest(gc);
|
|
12752
|
+
if (R)
|
|
12753
|
+
return R;
|
|
12754
|
+
const A = Ad(w);
|
|
12755
|
+
if (A) {
|
|
12756
|
+
w = A;
|
|
12724
12757
|
continue;
|
|
12725
12758
|
}
|
|
12726
12759
|
const F = w.getRootNode();
|
|
@@ -12742,11 +12775,11 @@ async function Wm(t = {}) {
|
|
|
12742
12775
|
if (!w)
|
|
12743
12776
|
return;
|
|
12744
12777
|
mt !== null && window.clearTimeout(mt);
|
|
12745
|
-
const
|
|
12778
|
+
const R = Date.now();
|
|
12746
12779
|
mt = window.setTimeout(() => {
|
|
12747
12780
|
mt = null, kt === p && w.isConnected && ie(w, "host_modal_recovery", {
|
|
12748
12781
|
preventScroll: !0,
|
|
12749
|
-
scheduledAt:
|
|
12782
|
+
scheduledAt: R
|
|
12750
12783
|
});
|
|
12751
12784
|
}, 0);
|
|
12752
12785
|
}, Nn = (p, w = null) => {
|
|
@@ -12755,24 +12788,24 @@ async function Wm(t = {}) {
|
|
|
12755
12788
|
return;
|
|
12756
12789
|
}
|
|
12757
12790
|
kt = p, p !== null ? (Di(p, w), en = window.setInterval(() => {
|
|
12758
|
-
const
|
|
12759
|
-
if (!
|
|
12791
|
+
const R = kt;
|
|
12792
|
+
if (!R || !Td(R)) {
|
|
12760
12793
|
Nn(null);
|
|
12761
12794
|
return;
|
|
12762
12795
|
}
|
|
12763
|
-
Di(
|
|
12764
|
-
},
|
|
12796
|
+
Di(R, null);
|
|
12797
|
+
}, Rm)) : (en !== null && (window.clearInterval(en), en = null), mt !== null && (window.clearTimeout(mt), mt = null), ws = null);
|
|
12765
12798
|
}, Md = () => {
|
|
12766
12799
|
en !== null && (window.clearInterval(en), en = null), mt !== null && (window.clearTimeout(mt), mt = null), qe !== null && (window.clearTimeout(qe), qe = null);
|
|
12767
12800
|
}, ta = (p) => {
|
|
12768
12801
|
const w = ea(p);
|
|
12769
12802
|
if (!w)
|
|
12770
12803
|
return;
|
|
12771
|
-
const
|
|
12772
|
-
Lt =
|
|
12773
|
-
const
|
|
12774
|
-
|
|
12775
|
-
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)
|
|
12776
12809
|
return;
|
|
12777
12810
|
const F = Oi();
|
|
12778
12811
|
if (F === w) {
|
|
@@ -12808,19 +12841,19 @@ async function Wm(t = {}) {
|
|
|
12808
12841
|
const w = Ln;
|
|
12809
12842
|
if (Ln = null, w === null || Date.now() - w > fc)
|
|
12810
12843
|
return;
|
|
12811
|
-
const
|
|
12844
|
+
const R = p.target, A = Lt !== null && Date.now() - Lt <= fc;
|
|
12812
12845
|
Lt = null, qe !== null && (window.clearTimeout(qe), qe = null);
|
|
12813
12846
|
const F = (de) => {
|
|
12814
12847
|
const Ee = qi(de);
|
|
12815
12848
|
if (!Ee)
|
|
12816
12849
|
return !1;
|
|
12817
|
-
if (
|
|
12818
|
-
return Nn(Ee,
|
|
12850
|
+
if (A)
|
|
12851
|
+
return Nn(Ee, R), !0;
|
|
12819
12852
|
const Te = Date.now();
|
|
12820
|
-
return ws !== null && Te - ws <= Cm ? (Nn(Ee,
|
|
12853
|
+
return ws !== null && Te - ws <= Cm ? (Nn(Ee, R), !0) : (ws = Te, !0);
|
|
12821
12854
|
};
|
|
12822
12855
|
F(p.relatedTarget) || window.setTimeout(() => {
|
|
12823
|
-
kt === null &&
|
|
12856
|
+
kt === null && R.isConnected && F(Oi());
|
|
12824
12857
|
}, 0);
|
|
12825
12858
|
}), I.addEventListener("keydown", (p) => {
|
|
12826
12859
|
!l.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(), xt("", !0, !0, "minimized_launcher"));
|
|
@@ -12846,18 +12879,18 @@ async function Wm(t = {}) {
|
|
|
12846
12879
|
}), x.addEventListener("keydown", (p) => {
|
|
12847
12880
|
(p.key === "ArrowUp" || p.key === "PageUp" || p.key === "Home") && ms("up");
|
|
12848
12881
|
}), x.addEventListener("scroll", () => {
|
|
12849
|
-
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();
|
|
12850
12883
|
}), oe.addEventListener("click", () => {
|
|
12851
12884
|
Sd();
|
|
12852
12885
|
});
|
|
12853
12886
|
const na = typeof IntersectionObserver > "u" ? null : new IntersectionObserver(
|
|
12854
12887
|
([p]) => {
|
|
12855
|
-
p?.isIntersecting &&
|
|
12888
|
+
p?.isIntersecting && Ri();
|
|
12856
12889
|
},
|
|
12857
12890
|
{ root: x, threshold: 0 }
|
|
12858
12891
|
);
|
|
12859
12892
|
na?.observe(C);
|
|
12860
|
-
const sa = typeof ResizeObserver > "u" ? null : new ResizeObserver(
|
|
12893
|
+
const sa = typeof ResizeObserver > "u" ? null : new ResizeObserver(Ri);
|
|
12861
12894
|
sa?.observe(x);
|
|
12862
12895
|
const ia = l.querySelector(".pluno-pa-widget__permission-overlay"), oa = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
|
|
12863
12896
|
const p = ia.offsetHeight;
|
|
@@ -12872,10 +12905,10 @@ async function Wm(t = {}) {
|
|
|
12872
12905
|
const p = M.getState().status;
|
|
12873
12906
|
return Ss() ? !1 : p !== "connected" && !(Is && p === "reconnecting");
|
|
12874
12907
|
}, yn = () => {
|
|
12875
|
-
const p = s(), w = M.getState(),
|
|
12876
|
-
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;
|
|
12877
12910
|
}, ra = () => [...ne.values()].some((p) => p.revision === ge && p.generation === W), bn = () => !M.getState().isLoadingSession && !qd() && !Qn(e.billingStatus) && !ra(), aa = () => {
|
|
12878
|
-
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);
|
|
12879
12912
|
return Jp({
|
|
12880
12913
|
hasRunningAssistantTurn: w || p.isThinking || p.turnPhase !== null || p.pendingMessageStatus !== null,
|
|
12881
12914
|
// Retained text already submitted by this revision must not hide Stop behind a disabled Send.
|
|
@@ -12883,7 +12916,7 @@ async function Wm(t = {}) {
|
|
|
12883
12916
|
hasPreSubmittedAttachment: j.length > 0,
|
|
12884
12917
|
canSubmitMessage: bn()
|
|
12885
12918
|
});
|
|
12886
|
-
},
|
|
12919
|
+
}, Re = () => {
|
|
12887
12920
|
const p = aa();
|
|
12888
12921
|
Nr(_e, p.action === "stop"), _e.disabled = p.disabled, l.querySelectorAll(".pluno-pa-widget__starter-prompt").forEach((w) => {
|
|
12889
12922
|
w.disabled = !bn();
|
|
@@ -12891,21 +12924,21 @@ async function Wm(t = {}) {
|
|
|
12891
12924
|
};
|
|
12892
12925
|
yn();
|
|
12893
12926
|
const Li = () => {
|
|
12894
|
-
const p = M.getState(), w = p.isThinking,
|
|
12895
|
-
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(
|
|
12896
12929
|
"pluno-pa-widget--unread",
|
|
12897
|
-
!
|
|
12930
|
+
!R && (Un || !!p.lastError)
|
|
12898
12931
|
), yn();
|
|
12899
12932
|
};
|
|
12900
12933
|
Li();
|
|
12901
12934
|
const Ni = () => {
|
|
12902
12935
|
if (!(s() || We))
|
|
12903
|
-
return yn(),
|
|
12936
|
+
return yn(), Re(), M.connect().then(
|
|
12904
12937
|
() => {
|
|
12905
|
-
We || (yn(),
|
|
12938
|
+
We || (yn(), Re());
|
|
12906
12939
|
},
|
|
12907
12940
|
(p) => {
|
|
12908
|
-
We || (yn(),
|
|
12941
|
+
We || (yn(), Re(), ht(
|
|
12909
12942
|
"web-sdk.widget",
|
|
12910
12943
|
"Failed to connect Product Agent widget",
|
|
12911
12944
|
{
|
|
@@ -12919,10 +12952,10 @@ async function Wm(t = {}) {
|
|
|
12919
12952
|
D.textContent = "", D.hidden = !0, L = null;
|
|
12920
12953
|
}, 3e3);
|
|
12921
12954
|
}, Ui = (p, w) => {
|
|
12922
|
-
const
|
|
12923
|
-
if (!
|
|
12924
|
-
const
|
|
12925
|
-
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();
|
|
12926
12959
|
}, ca = (p) => {
|
|
12927
12960
|
const w = W;
|
|
12928
12961
|
ay(
|
|
@@ -12932,47 +12965,47 @@ async function Wm(t = {}) {
|
|
|
12932
12965
|
p.clientMessageId,
|
|
12933
12966
|
p.submittedAt,
|
|
12934
12967
|
p.requestedModel
|
|
12935
|
-
).then((
|
|
12936
|
-
w === W && (M.getState().receipts === void 0 && Ui(p.clientMessageId), me?.clientMessageId === p.clientMessageId && (me.pendingSubmission = !1,
|
|
12937
|
-
}).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) => {
|
|
12938
12971
|
if (w !== W) return;
|
|
12939
12972
|
me?.clientMessageId === p.clientMessageId && (me = null), ne.delete(p.clientMessageId), lt();
|
|
12940
|
-
const
|
|
12941
|
-
M.getState().lastError !==
|
|
12973
|
+
const A = R instanceof Error ? R.message : "Failed to upload attachment";
|
|
12974
|
+
M.getState().lastError !== A && xs(A);
|
|
12942
12975
|
}).finally(() => {
|
|
12943
|
-
w === W &&
|
|
12976
|
+
w === W && Re();
|
|
12944
12977
|
});
|
|
12945
12978
|
}, la = () => {
|
|
12946
12979
|
if (We || !se || M.getState().status !== "connected" || s() || Qn(e.billingStatus))
|
|
12947
12980
|
return;
|
|
12948
12981
|
const p = se;
|
|
12949
12982
|
se = null, ca(p);
|
|
12950
|
-
},
|
|
12951
|
-
const p = N.value, w = p.trim(),
|
|
12952
|
-
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)
|
|
12953
12986
|
return;
|
|
12954
|
-
for (const F of
|
|
12987
|
+
for (const F of R)
|
|
12955
12988
|
F.id && F.previewUrl && $.set(F.id, F.previewUrl);
|
|
12956
12989
|
if ([...ne.values()].some((F) => F.revision === ge && F.generation === W)) return;
|
|
12957
|
-
const
|
|
12990
|
+
const A = {
|
|
12958
12991
|
inputValue: p,
|
|
12959
12992
|
requestedModel: mn,
|
|
12960
12993
|
value: w,
|
|
12961
|
-
attachments:
|
|
12994
|
+
attachments: R,
|
|
12962
12995
|
clientMessageId: crypto.randomUUID(),
|
|
12963
12996
|
submittedAt: Math.max(Date.now(), ye + 1)
|
|
12964
12997
|
};
|
|
12965
|
-
if (ye =
|
|
12998
|
+
if (ye = A.submittedAt, ne.set(A.clientMessageId, { ...A, revision: ge, generation: W }), Re(), me = {
|
|
12966
12999
|
createdAt: Date.now(),
|
|
12967
|
-
clientMessageId:
|
|
13000
|
+
clientMessageId: A.clientMessageId,
|
|
12968
13001
|
observedConversation: null,
|
|
12969
13002
|
observedWelcome: null,
|
|
12970
13003
|
pendingSubmission: !0
|
|
12971
13004
|
}, Ss() && !e.runtimeClient) {
|
|
12972
|
-
se =
|
|
13005
|
+
se = A;
|
|
12973
13006
|
return;
|
|
12974
13007
|
}
|
|
12975
|
-
ca(
|
|
13008
|
+
ca(A);
|
|
12976
13009
|
};
|
|
12977
13010
|
S.addEventListener("submit", (p) => {
|
|
12978
13011
|
if (p.preventDefault(), e.loginRequired) {
|
|
@@ -12983,14 +13016,14 @@ async function Wm(t = {}) {
|
|
|
12983
13016
|
e.onSignupClick?.();
|
|
12984
13017
|
return;
|
|
12985
13018
|
}
|
|
12986
|
-
bn() && (Ot = !0, nt(!0, "send"), ut(),
|
|
13019
|
+
bn() && (Ot = !0, nt(!0, "send"), ut(), Bi());
|
|
12987
13020
|
});
|
|
12988
|
-
let
|
|
13021
|
+
let Bn = 0;
|
|
12989
13022
|
const Nt = () => {
|
|
12990
|
-
|
|
13023
|
+
Bn = 0, l.classList.remove("pluno-pa-widget--drag-over");
|
|
12991
13024
|
}, Od = () => {
|
|
12992
13025
|
L !== null && (window.clearTimeout(L), L = null), D.textContent = "", D.hidden = !0;
|
|
12993
|
-
},
|
|
13026
|
+
}, zi = async (p) => {
|
|
12994
13027
|
if (!e.attachmentsEnabled || p.length === 0 || tn())
|
|
12995
13028
|
return;
|
|
12996
13029
|
const w = Py(
|
|
@@ -12998,13 +13031,13 @@ async function Wm(t = {}) {
|
|
|
12998
13031
|
p,
|
|
12999
13032
|
e.productVariant === "customer_embedded"
|
|
13000
13033
|
);
|
|
13001
|
-
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")) {
|
|
13002
13035
|
xt("", !0, !0, "attachment_drop");
|
|
13003
13036
|
return;
|
|
13004
13037
|
}
|
|
13005
13038
|
ae("attachment_added");
|
|
13006
13039
|
}, Dd = async (p) => {
|
|
13007
|
-
await
|
|
13040
|
+
await zi(p), !(p.length === 0 || kt !== null) && ie(N, "attachment_picker_completed");
|
|
13008
13041
|
};
|
|
13009
13042
|
ke.addEventListener("click", () => {
|
|
13010
13043
|
e.loginRequired || tn() || Qn(e.billingStatus) || he.click();
|
|
@@ -13018,12 +13051,12 @@ async function Wm(t = {}) {
|
|
|
13018
13051
|
});
|
|
13019
13052
|
});
|
|
13020
13053
|
}), l.addEventListener("dragenter", (p) => {
|
|
13021
|
-
!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"));
|
|
13022
13055
|
}), l.addEventListener("dragover", (p) => {
|
|
13023
13056
|
const w = p.dataTransfer;
|
|
13024
13057
|
!e.attachmentsEnabled || !Ls(w) || e.loginRequired || tn() || (p.preventDefault(), p.stopPropagation(), w.dropEffect = "copy");
|
|
13025
13058
|
}), l.addEventListener("dragleave", (p) => {
|
|
13026
|
-
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"));
|
|
13027
13060
|
});
|
|
13028
13061
|
const da = (p) => {
|
|
13029
13062
|
l.classList.contains("pluno-pa-widget--drag-over") && !p.composedPath().includes(l) && Nt();
|
|
@@ -13034,21 +13067,21 @@ async function Wm(t = {}) {
|
|
|
13034
13067
|
!0
|
|
13035
13068
|
), _.addEventListener("drop", Nt, !0), _.addEventListener("dragend", Nt, !0), _.defaultView?.addEventListener("blur", Nt), l.addEventListener("drop", (p) => {
|
|
13036
13069
|
const w = p.dataTransfer;
|
|
13037
|
-
!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) => {
|
|
13038
13071
|
xs(
|
|
13039
|
-
|
|
13072
|
+
R instanceof Error ? R.message : "Failed to attach file"
|
|
13040
13073
|
), ht("web-sdk.widget", "Attachment failed", {
|
|
13041
|
-
...Zn(
|
|
13074
|
+
...Zn(R)
|
|
13042
13075
|
});
|
|
13043
13076
|
}));
|
|
13044
13077
|
}), l.addEventListener("paste", (p) => {
|
|
13045
13078
|
p.stopPropagation();
|
|
13046
|
-
const w = p.clipboardData,
|
|
13047
|
-
!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) => {
|
|
13048
13081
|
xs(
|
|
13049
|
-
|
|
13082
|
+
A instanceof Error ? A.message : "Failed to attach file"
|
|
13050
13083
|
), ht("web-sdk.widget", "Attachment failed", {
|
|
13051
|
-
...Zn(
|
|
13084
|
+
...Zn(A)
|
|
13052
13085
|
});
|
|
13053
13086
|
}));
|
|
13054
13087
|
}), _e.addEventListener("click", () => {
|
|
@@ -13060,29 +13093,29 @@ async function Wm(t = {}) {
|
|
|
13060
13093
|
if (p.disabled)
|
|
13061
13094
|
return;
|
|
13062
13095
|
if (p.action === "stop") {
|
|
13063
|
-
ne.clear(), se = null, me = null, M.stop(),
|
|
13096
|
+
ne.clear(), se = null, me = null, M.stop(), Re();
|
|
13064
13097
|
return;
|
|
13065
13098
|
}
|
|
13066
13099
|
const w = N.value.trim().length > 0 || j.length > 0;
|
|
13067
|
-
Ot = !0, nt(!0, "send"), ut(),
|
|
13100
|
+
Ot = !0, nt(!0, "send"), ut(), Bi(), Ae(M.getState()), Re(), w && ae("send_button_submit");
|
|
13068
13101
|
}), be.addEventListener("click", () => {
|
|
13069
|
-
|
|
13102
|
+
Be = !Be, St(), Be && (Fe.data === null || Fe.status === "error") && Fe.status !== "loading" && Ti(), Be || ae("history_closed");
|
|
13070
13103
|
}), et.addEventListener("click", () => {
|
|
13071
|
-
|
|
13104
|
+
Be = !1, St(), ae("history_closed");
|
|
13072
13105
|
}), Ce.addEventListener("scroll", xd), N.addEventListener("input", () => {
|
|
13073
|
-
ge++, Xn(N), $e(),
|
|
13106
|
+
ge++, Xn(N), $e(), Re();
|
|
13074
13107
|
}), N.addEventListener("keydown", (p) => {
|
|
13075
13108
|
if (!(p.key !== "Enter" || p.shiftKey || p.isComposing || p.keyCode === 229)) {
|
|
13076
13109
|
if (p.preventDefault(), e.loginRequired) {
|
|
13077
13110
|
e.onLoginClick?.();
|
|
13078
13111
|
return;
|
|
13079
13112
|
}
|
|
13080
|
-
bn() && (Ot = !0, nt(!0, "send"), ut(),
|
|
13113
|
+
bn() && (Ot = !0, nt(!0, "send"), ut(), Bi(), Ae(M.getState()), Re());
|
|
13081
13114
|
}
|
|
13082
13115
|
}), l.addEventListener("click", (p) => {
|
|
13083
13116
|
const w = p.target instanceof Element ? p.target : null;
|
|
13084
|
-
w?.closest("a[href]") && $e(),
|
|
13085
|
-
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));
|
|
13086
13119
|
sm(p.target, p.detail, F) && ae("passive_surface_click");
|
|
13087
13120
|
});
|
|
13088
13121
|
let ua = !1;
|
|
@@ -13091,17 +13124,17 @@ async function Wm(t = {}) {
|
|
|
13091
13124
|
}, ha = (p) => {
|
|
13092
13125
|
if (!ua || E.hidden || l.classList.contains("pluno-pa-widget--closing"))
|
|
13093
13126
|
return;
|
|
13094
|
-
const w = c.activeElement ?? _.activeElement,
|
|
13095
|
-
if (!
|
|
13127
|
+
const w = c.activeElement ?? _.activeElement, R = am(p, w);
|
|
13128
|
+
if (!R || N.disabled || N.readOnly)
|
|
13096
13129
|
return;
|
|
13097
13130
|
p.preventDefault();
|
|
13098
|
-
const
|
|
13131
|
+
const A = cm(
|
|
13099
13132
|
N.value,
|
|
13100
13133
|
N.selectionStart,
|
|
13101
13134
|
N.selectionEnd,
|
|
13102
|
-
|
|
13135
|
+
R
|
|
13103
13136
|
);
|
|
13104
|
-
N.value =
|
|
13137
|
+
N.value = A.value, N.dispatchEvent(new Event("input", { bubbles: !0 })), rm(N), N.setSelectionRange(A.caret, A.caret);
|
|
13105
13138
|
};
|
|
13106
13139
|
_.addEventListener(
|
|
13107
13140
|
"pointerdown",
|
|
@@ -13134,33 +13167,33 @@ async function Wm(t = {}) {
|
|
|
13134
13167
|
pd(p), p.stopPropagation();
|
|
13135
13168
|
return;
|
|
13136
13169
|
}
|
|
13137
|
-
p.key !== "Escape" || !
|
|
13170
|
+
p.key !== "Escape" || !Be || (Be = !1, St(), ae("history_escape"));
|
|
13138
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");
|
|
13139
|
-
const
|
|
13172
|
+
const zn = () => u;
|
|
13140
13173
|
let ji = M.getState().appearance !== null, Fi = M.getInteractions();
|
|
13141
|
-
const Ld = (p, w,
|
|
13174
|
+
const Ld = (p, w, R) => p ? M.actOnInteraction(
|
|
13142
13175
|
p.id,
|
|
13143
13176
|
w,
|
|
13144
13177
|
p.revision,
|
|
13145
|
-
{ ...
|
|
13178
|
+
{ ...R, expectedSourceVersion: p.sourceVersion, ...w === "run" ? { requestedModel: mn } : {} }
|
|
13146
13179
|
) : Promise.resolve();
|
|
13147
13180
|
let $i = M.getState().isThinking;
|
|
13148
|
-
const jn = /* @__PURE__ */ new Map(), ks = /* @__PURE__ */ new Map(), Es = /* @__PURE__ */ new Map(), Cs = /* @__PURE__ */ new Map(), Nd = async (p, w,
|
|
13149
|
-
const
|
|
13150
|
-
if (!
|
|
13151
|
-
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());
|
|
13152
13185
|
try {
|
|
13153
|
-
await
|
|
13186
|
+
await R();
|
|
13154
13187
|
} finally {
|
|
13155
|
-
|
|
13188
|
+
A.delete(w), A.size || Cs.delete(p), We || Ae(M.getState());
|
|
13156
13189
|
}
|
|
13157
13190
|
}
|
|
13158
13191
|
};
|
|
13159
13192
|
let wn = null;
|
|
13160
13193
|
const Hi = (p = {}) => {
|
|
13161
|
-
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();
|
|
13162
13195
|
const w = Promise.resolve(M.startNewSession(p));
|
|
13163
|
-
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;
|
|
13164
13197
|
}, Fn = (p) => {
|
|
13165
13198
|
if (s() || !p || e.layout === "page") {
|
|
13166
13199
|
wn?.remove(), wn = null;
|
|
@@ -13171,7 +13204,7 @@ async function Wm(t = {}) {
|
|
|
13171
13204
|
"New chat",
|
|
13172
13205
|
vy(),
|
|
13173
13206
|
!1
|
|
13174
|
-
), wn.addEventListener("click", () => Hi()),
|
|
13207
|
+
), wn.addEventListener("click", () => Hi()), Ue.insertBefore(wn, be));
|
|
13175
13208
|
}, Et = document.createElement("div");
|
|
13176
13209
|
Et.className = "pluno-pa-widget__error";
|
|
13177
13210
|
const Ki = document.createTextNode("");
|
|
@@ -13182,10 +13215,10 @@ async function Wm(t = {}) {
|
|
|
13182
13215
|
pt.type = "button", pt.className = "pluno-pa-widget__error-retry";
|
|
13183
13216
|
const ga = kn(), fa = document.createTextNode("Try again");
|
|
13184
13217
|
pt.append(ga, fa);
|
|
13185
|
-
let ma = "",
|
|
13218
|
+
let ma = "", Bt = !1;
|
|
13186
13219
|
const Ud = async () => {
|
|
13187
|
-
if (
|
|
13188
|
-
|
|
13220
|
+
if (Bt) return;
|
|
13221
|
+
Bt = !0, Ae(M.getState());
|
|
13189
13222
|
let p;
|
|
13190
13223
|
try {
|
|
13191
13224
|
await Promise.race([
|
|
@@ -13195,19 +13228,19 @@ async function Wm(t = {}) {
|
|
|
13195
13228
|
})
|
|
13196
13229
|
]);
|
|
13197
13230
|
} finally {
|
|
13198
|
-
clearTimeout(p),
|
|
13231
|
+
clearTimeout(p), Bt = !1, We || Ae(M.getState());
|
|
13199
13232
|
}
|
|
13200
13233
|
};
|
|
13201
13234
|
pt.addEventListener("click", () => {
|
|
13202
13235
|
Ud();
|
|
13203
13236
|
});
|
|
13204
|
-
let nn = !1, $n = null,
|
|
13205
|
-
const
|
|
13206
|
-
jr(p) && (me = null),
|
|
13207
|
-
const
|
|
13208
|
-
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(
|
|
13209
13242
|
"pluno-pa-widget--logged-out",
|
|
13210
|
-
(e.loginRequired ||
|
|
13243
|
+
(e.loginRequired || R) && e.entrySurface === "extension_widget"
|
|
13211
13244
|
), J.classList.remove("pluno-pa-widget__access-notice--login-only"), p = { ...p, messages: p.messages.map((ue) => {
|
|
13212
13245
|
if (!ue.attachments?.some((Oe) => Oe.id && !Oe.fileUrl && $.has(Oe.id))) return ue;
|
|
13213
13246
|
const Ct = ue.attachments.map((Oe) => {
|
|
@@ -13219,24 +13252,24 @@ async function Wm(t = {}) {
|
|
|
13219
13252
|
attachments: { value: Ct, enumerable: !0, configurable: !0 }
|
|
13220
13253
|
});
|
|
13221
13254
|
}) }, St(), re(), J.hidden = !s(), J.hidden && J.replaceChildren();
|
|
13222
|
-
const
|
|
13255
|
+
const A = JSON.stringify([
|
|
13223
13256
|
s(),
|
|
13224
13257
|
p.lastError,
|
|
13225
13258
|
p.lastErrorCode,
|
|
13226
13259
|
p.lastErrorSecuritySettingsUrl,
|
|
13227
|
-
|
|
13260
|
+
Bt
|
|
13228
13261
|
]);
|
|
13229
|
-
if (ma !==
|
|
13230
|
-
ma =
|
|
13262
|
+
if (ma !== A) {
|
|
13263
|
+
ma = A, ce.hidden = s() || !p.lastError || as(p.lastErrorCode) !== "bottom_notice";
|
|
13231
13264
|
const ue = ce.hidden ? "" : p.lastError ?? "";
|
|
13232
|
-
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();
|
|
13233
13266
|
}
|
|
13234
|
-
if (
|
|
13267
|
+
if (R) {
|
|
13235
13268
|
Pn = "", jn.clear(), ks.clear(), Es.clear(), x.replaceChildren(), Ns(
|
|
13236
13269
|
J,
|
|
13237
13270
|
_e,
|
|
13238
13271
|
Fn,
|
|
13239
|
-
|
|
13272
|
+
zn,
|
|
13240
13273
|
"Connecting to Pluno…",
|
|
13241
13274
|
null,
|
|
13242
13275
|
void 0,
|
|
@@ -13253,7 +13286,7 @@ async function Wm(t = {}) {
|
|
|
13253
13286
|
J,
|
|
13254
13287
|
_e,
|
|
13255
13288
|
Fn,
|
|
13256
|
-
|
|
13289
|
+
zn,
|
|
13257
13290
|
($n ?? ue.message).replace(new RegExp("(?<=[.!?])\\s+", "g"), `
|
|
13258
13291
|
`),
|
|
13259
13292
|
nn ? "Trying" : "Try again",
|
|
@@ -13263,11 +13296,11 @@ async function Wm(t = {}) {
|
|
|
13263
13296
|
);
|
|
13264
13297
|
const Oe = J.querySelector(".pluno-pa-widget__login");
|
|
13265
13298
|
Oe.disabled = nn, Oe.setAttribute("aria-busy", String(nn)), nn && Oe.prepend(kn()), Oe.addEventListener("click", () => {
|
|
13266
|
-
const Hn = ++
|
|
13267
|
-
nn = !0, $n = null,
|
|
13268
|
-
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.");
|
|
13269
13302
|
}).finally(() => {
|
|
13270
|
-
Hn ===
|
|
13303
|
+
Hn === Rs && (nn = !1, We || Ae(M.getState()));
|
|
13271
13304
|
});
|
|
13272
13305
|
});
|
|
13273
13306
|
return;
|
|
@@ -13276,7 +13309,7 @@ async function Wm(t = {}) {
|
|
|
13276
13309
|
J,
|
|
13277
13310
|
_e,
|
|
13278
13311
|
Fn,
|
|
13279
|
-
|
|
13312
|
+
zn,
|
|
13280
13313
|
e.entrySurface === "extension_widget" ? null : "Log in to use Pluno on this page.",
|
|
13281
13314
|
e.loginButtonLabel,
|
|
13282
13315
|
e.loginUrl,
|
|
@@ -13290,7 +13323,7 @@ async function Wm(t = {}) {
|
|
|
13290
13323
|
J,
|
|
13291
13324
|
_e,
|
|
13292
13325
|
Fn,
|
|
13293
|
-
|
|
13326
|
+
zn,
|
|
13294
13327
|
"Complete signup to unlock your free trial credits.",
|
|
13295
13328
|
e.signupButtonLabel,
|
|
13296
13329
|
e.signupUrl,
|
|
@@ -13308,7 +13341,7 @@ async function Wm(t = {}) {
|
|
|
13308
13341
|
]), de = F !== Pn;
|
|
13309
13342
|
Pn = F;
|
|
13310
13343
|
const Ee = Ot || It.enabled;
|
|
13311
|
-
Ot = !1, (de || w.skipUnchangedTimeline !== !0) &&
|
|
13344
|
+
Ot = !1, (de || w.skipUnchangedTimeline !== !0) && By(
|
|
13312
13345
|
x,
|
|
13313
13346
|
C,
|
|
13314
13347
|
_e,
|
|
@@ -13321,7 +13354,7 @@ async function Wm(t = {}) {
|
|
|
13321
13354
|
ks,
|
|
13322
13355
|
Es,
|
|
13323
13356
|
$e,
|
|
13324
|
-
|
|
13357
|
+
zn,
|
|
13325
13358
|
(ue, Ct) => {
|
|
13326
13359
|
bn() && (Ot = !0, nt(!0, "send"), ut(), M.sendMessage(ue, { requestedModel: mn }));
|
|
13327
13360
|
},
|
|
@@ -13344,34 +13377,34 @@ async function Wm(t = {}) {
|
|
|
13344
13377
|
const Te = !!x.querySelector(
|
|
13345
13378
|
".pluno-pa-widget__empty-state--starter"
|
|
13346
13379
|
);
|
|
13347
|
-
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();
|
|
13348
13381
|
}, ya = () => {
|
|
13349
|
-
_.getSelection()?.isCollapsed !== !1 && Wy(jn) &&
|
|
13382
|
+
_.getSelection()?.isCollapsed !== !1 && Wy(jn) && Ae(M.getState());
|
|
13350
13383
|
};
|
|
13351
13384
|
_.addEventListener(
|
|
13352
13385
|
"selectionchange",
|
|
13353
13386
|
ya
|
|
13354
13387
|
);
|
|
13355
|
-
const
|
|
13356
|
-
Fi = p, We ||
|
|
13357
|
-
}),
|
|
13388
|
+
const Bd = M.subscribeInteractions((p) => {
|
|
13389
|
+
Fi = p, We || Ae(M.getState(), { skipUnchangedTimeline: !0, renderSource: "interactions" });
|
|
13390
|
+
}), zd = M.subscribeAccount((p) => {
|
|
13358
13391
|
if (!p && !Is) return;
|
|
13359
|
-
const w = p?.auth,
|
|
13360
|
-
|
|
13361
|
-
const
|
|
13362
|
-
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();
|
|
13363
13396
|
});
|
|
13364
13397
|
M.on("state", (p) => {
|
|
13365
13398
|
const w = p.user?.id ?? null;
|
|
13366
|
-
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;
|
|
13367
13400
|
for (const Te of p.messages)
|
|
13368
13401
|
Te.role === "user" && Ui(Te.id);
|
|
13369
13402
|
for (const Te of p.receipts ?? []) Ui(Te.userMessageId, Te.acceptedRendererRevision);
|
|
13370
13403
|
e.extensionRuntime && (Wi += 1, $n = null), p.status === "connected" && (Is = !0, se && queueMicrotask(() => {
|
|
13371
13404
|
la();
|
|
13372
13405
|
}));
|
|
13373
|
-
const
|
|
13374
|
-
$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(
|
|
13375
13408
|
"web-sdk.widget",
|
|
13376
13409
|
"Agent state supplied appearance",
|
|
13377
13410
|
{
|
|
@@ -13385,19 +13418,19 @@ async function Wm(t = {}) {
|
|
|
13385
13418
|
fallbackColorScheme: e.colorScheme,
|
|
13386
13419
|
fallbackFontFamily: e.fontFamily
|
|
13387
13420
|
}
|
|
13388
|
-
), Vi({}, "agent.state.appearance-cleared")),
|
|
13421
|
+
), Vi({}, "agent.state.appearance-cleared")), Ae(p, { skipUnchangedTimeline: !0, renderSource: "state" }), Re();
|
|
13389
13422
|
});
|
|
13390
13423
|
const jd = M.getState();
|
|
13391
|
-
|
|
13392
|
-
const Fd = Pu(l, (p, w,
|
|
13393
|
-
const de = ku(M.getState(),
|
|
13394
|
-
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);
|
|
13395
13428
|
}), $d = gm(
|
|
13396
13429
|
a,
|
|
13397
13430
|
l,
|
|
13398
13431
|
e.extensionRuntime || e.entrySurface === "extension_widget" ? "extension_widget" : e.entrySurface === "main_web_chat" ? "main_web_chat" : "embedded_widget",
|
|
13399
13432
|
M
|
|
13400
|
-
), Hd = qu(l,
|
|
13433
|
+
), Hd = qu(l, Ai);
|
|
13401
13434
|
return {
|
|
13402
13435
|
agent: M,
|
|
13403
13436
|
startNewChat: Hi,
|
|
@@ -13407,8 +13440,8 @@ async function Wm(t = {}) {
|
|
|
13407
13440
|
p.scribbleStyle !== void 0 && (e.scribbleStyle = p.scribbleStyle), Vi(p, "widgetHandle.updateAppearance");
|
|
13408
13441
|
},
|
|
13409
13442
|
openPanel: (p) => {
|
|
13410
|
-
const w = typeof p == "string" ? p : N.value,
|
|
13411
|
-
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);
|
|
13412
13445
|
},
|
|
13413
13446
|
closePanel: Qr,
|
|
13414
13447
|
updateDisplayState: (p) => {
|
|
@@ -13419,7 +13452,7 @@ async function Wm(t = {}) {
|
|
|
13419
13452
|
On("minimized", !1);
|
|
13420
13453
|
},
|
|
13421
13454
|
destroy: () => {
|
|
13422
|
-
We || (Fd(), $d.dispose(), Hd(), $e(), We = !0, Q(),
|
|
13455
|
+
We || (Fd(), $d.dispose(), Hd(), $e(), We = !0, Q(), Bd(), zd(), Gr.disconnect(), _.removeEventListener(
|
|
13423
13456
|
"selectionchange",
|
|
13424
13457
|
ya
|
|
13425
13458
|
), _.removeEventListener(
|
|
@@ -13448,24 +13481,24 @@ async function Wm(t = {}) {
|
|
|
13448
13481
|
), _.removeEventListener("drop", Nt, !0), _.removeEventListener("dragend", Nt, !0), _.defaultView?.removeEventListener(
|
|
13449
13482
|
"blur",
|
|
13450
13483
|
Nt
|
|
13451
|
-
), 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());
|
|
13452
13485
|
}
|
|
13453
13486
|
};
|
|
13454
13487
|
function Vi(p, w) {
|
|
13455
|
-
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]);
|
|
13456
13489
|
Ee !== b && (b = Ee, u = wc(
|
|
13457
|
-
|
|
13490
|
+
R,
|
|
13458
13491
|
de
|
|
13459
13492
|
), _c(l, u, {
|
|
13460
|
-
accentColor:
|
|
13461
|
-
colorScheme:
|
|
13493
|
+
accentColor: R,
|
|
13494
|
+
colorScheme: A,
|
|
13462
13495
|
fontFamily: F,
|
|
13463
13496
|
scribbleStyle: de
|
|
13464
13497
|
}), ht("web-sdk.widget", "Updated widget appearance", {
|
|
13465
13498
|
source: w,
|
|
13466
13499
|
inputAppearance: p,
|
|
13467
|
-
appliedAccentColor:
|
|
13468
|
-
appliedColorScheme:
|
|
13500
|
+
appliedAccentColor: R,
|
|
13501
|
+
appliedColorScheme: A,
|
|
13469
13502
|
appliedFontFamily: F,
|
|
13470
13503
|
appliedScribbleStyle: de,
|
|
13471
13504
|
cssAccent: l.style.getPropertyValue("--pluno-pa-accent")
|
|
@@ -14401,7 +14434,7 @@ function yy(t, e) {
|
|
|
14401
14434
|
opacity: "0.48"
|
|
14402
14435
|
});
|
|
14403
14436
|
const _ = K(i, "g", { filter: ot(s.eyeShadow) });
|
|
14404
|
-
return
|
|
14437
|
+
return Rc(
|
|
14405
14438
|
_,
|
|
14406
14439
|
"rotate(-2 528 463)",
|
|
14407
14440
|
"528",
|
|
@@ -14411,7 +14444,7 @@ function yy(t, e) {
|
|
|
14411
14444
|
"557",
|
|
14412
14445
|
"447",
|
|
14413
14446
|
s
|
|
14414
|
-
),
|
|
14447
|
+
), Rc(
|
|
14415
14448
|
_,
|
|
14416
14449
|
"rotate(2 717 462)",
|
|
14417
14450
|
"717",
|
|
@@ -14468,7 +14501,7 @@ function by(t, e) {
|
|
|
14468
14501
|
stroke: ai,
|
|
14469
14502
|
"stroke-width": "18",
|
|
14470
14503
|
"stroke-linejoin": "round"
|
|
14471
|
-
}),
|
|
14504
|
+
}), Ac(
|
|
14472
14505
|
c,
|
|
14473
14506
|
"rotate(-2 528 463)",
|
|
14474
14507
|
"528",
|
|
@@ -14477,7 +14510,7 @@ function by(t, e) {
|
|
|
14477
14510
|
"473",
|
|
14478
14511
|
"557",
|
|
14479
14512
|
"447"
|
|
14480
|
-
),
|
|
14513
|
+
), Ac(
|
|
14481
14514
|
c,
|
|
14482
14515
|
"rotate(2 717 462)",
|
|
14483
14516
|
"717",
|
|
@@ -14494,7 +14527,7 @@ function od() {
|
|
|
14494
14527
|
viewBox: "0 0 1254 1254"
|
|
14495
14528
|
});
|
|
14496
14529
|
}
|
|
14497
|
-
function
|
|
14530
|
+
function Rc(t, e, n, s, i, o, r, a, c) {
|
|
14498
14531
|
const l = K(t, "g", { transform: e });
|
|
14499
14532
|
K(l, "ellipse", {
|
|
14500
14533
|
cx: n,
|
|
@@ -14516,7 +14549,7 @@ function Ac(t, e, n, s, i, o, r, a, c) {
|
|
|
14516
14549
|
fill: "#ffffff"
|
|
14517
14550
|
});
|
|
14518
14551
|
}
|
|
14519
|
-
function
|
|
14552
|
+
function Ac(t, e, n, s, i, o, r, a) {
|
|
14520
14553
|
const c = K(t, "g", { transform: e });
|
|
14521
14554
|
K(c, "ellipse", {
|
|
14522
14555
|
cx: n,
|
|
@@ -14562,10 +14595,10 @@ function wy() {
|
|
|
14562
14595
|
width: "0",
|
|
14563
14596
|
height: "0"
|
|
14564
14597
|
}), e = te("defs");
|
|
14565
|
-
return e.appendChild(
|
|
14566
|
-
|
|
14598
|
+
return e.appendChild(Ao("pluno-pa-scribble-wobble", "2", "12")), e.appendChild(
|
|
14599
|
+
Ao("pluno-pa-scribble-wobble-2", "5", "15")
|
|
14567
14600
|
), e.appendChild(
|
|
14568
|
-
|
|
14601
|
+
Ao("pluno-pa-scribble-wobble-3", "9", "19")
|
|
14569
14602
|
), t.appendChild(e), t;
|
|
14570
14603
|
}
|
|
14571
14604
|
function rd(t, e) {
|
|
@@ -14577,14 +14610,14 @@ function rd(t, e) {
|
|
|
14577
14610
|
});
|
|
14578
14611
|
return ad(n, e), n;
|
|
14579
14612
|
}
|
|
14580
|
-
function
|
|
14613
|
+
function Ro(t, e) {
|
|
14581
14614
|
if (!t)
|
|
14582
14615
|
return;
|
|
14583
14616
|
const n = Math.max(
|
|
14584
14617
|
0,
|
|
14585
14618
|
e - dr * 2
|
|
14586
14619
|
), s = Math.max(
|
|
14587
|
-
|
|
14620
|
+
zm,
|
|
14588
14621
|
Math.floor(
|
|
14589
14622
|
(n - lr * 2) / cr
|
|
14590
14623
|
)
|
|
@@ -14597,7 +14630,7 @@ function ad(t, e) {
|
|
|
14597
14630
|
const n = e * cr + lr * 2;
|
|
14598
14631
|
t.dataset.spiralCount = `${e}`, t.setAttribute(
|
|
14599
14632
|
"viewBox",
|
|
14600
|
-
`0 0 ${n} ${
|
|
14633
|
+
`0 0 ${n} ${Bm}`
|
|
14601
14634
|
), t.replaceChildren();
|
|
14602
14635
|
for (let s = 0; s < e; s += 1) {
|
|
14603
14636
|
const i = yc[s % yc.length], o = te("g", {
|
|
@@ -14625,7 +14658,7 @@ function ad(t, e) {
|
|
|
14625
14658
|
), t.appendChild(o);
|
|
14626
14659
|
}
|
|
14627
14660
|
}
|
|
14628
|
-
function
|
|
14661
|
+
function Ao(t, e, n) {
|
|
14629
14662
|
const s = te("filter", {
|
|
14630
14663
|
id: t,
|
|
14631
14664
|
x: "-8%",
|
|
@@ -14864,18 +14897,18 @@ function pd(t) {
|
|
|
14864
14897
|
e.input.value === n && e.input.selectionStart === e.start && e.input.selectionEnd === e.end && ud(e);
|
|
14865
14898
|
});
|
|
14866
14899
|
}
|
|
14867
|
-
function
|
|
14900
|
+
function Ry(t, e, n) {
|
|
14868
14901
|
t.replaceChildren(), t.hidden = e.length === 0;
|
|
14869
14902
|
for (let s = 0; s < e.length; s += 1) {
|
|
14870
14903
|
const i = e[s], o = document.createElement("div");
|
|
14871
|
-
o.className = "pluno-pa-widget__attachment", o.appendChild(
|
|
14904
|
+
o.className = "pluno-pa-widget__attachment", o.appendChild(Ay(i));
|
|
14872
14905
|
const r = document.createElement("span");
|
|
14873
14906
|
r.textContent = i.name, o.appendChild(r);
|
|
14874
14907
|
const a = document.createElement("button");
|
|
14875
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);
|
|
14876
14909
|
}
|
|
14877
14910
|
}
|
|
14878
|
-
function
|
|
14911
|
+
function Ay(t) {
|
|
14879
14912
|
const e = Or(t), n = li(t);
|
|
14880
14913
|
if (e === "image" && n) {
|
|
14881
14914
|
const s = document.createElement("img");
|
|
@@ -15105,7 +15138,7 @@ function Pc(t, e) {
|
|
|
15105
15138
|
const s = n[1], i = e ? "Finding example tasks..." : " ";
|
|
15106
15139
|
s.textContent !== i && (s.textContent = i), s.classList.toggle("pluno-pa-widget__starter-placeholder--loading", e), s.parentElement.setAttribute("aria-hidden", String(!e));
|
|
15107
15140
|
}
|
|
15108
|
-
function
|
|
15141
|
+
function By(t, e, n, s, i, o, r, a, c, l, u, d, h, f, m, g, y, b, v, _, I) {
|
|
15109
15142
|
const k = Yf(i), T = Yy(i), O = Xy(
|
|
15110
15143
|
T.filter(
|
|
15111
15144
|
(x) => !x.scheduledCheckInAt
|
|
@@ -15116,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) {
|
|
|
15116
15149
|
const E = i.activeResponseUserMessageId;
|
|
15117
15150
|
if (k.showProgress && i.turnPhase && !i.assistantDraft && E) {
|
|
15118
15151
|
const x = O.findIndex(
|
|
15119
|
-
(
|
|
15152
|
+
(B) => B.role === "user" && B.id === E
|
|
15120
15153
|
), C = O.some(
|
|
15121
|
-
(
|
|
15154
|
+
(B) => B.role !== "user" && B.respondsToUserMessageId === E
|
|
15122
15155
|
);
|
|
15123
15156
|
x !== -1 && !C && O.splice(x + 1, 0, {
|
|
15124
15157
|
id: `turn-status:${E}`,
|
|
@@ -15130,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) {
|
|
|
15130
15163
|
loading: !0
|
|
15131
15164
|
});
|
|
15132
15165
|
}
|
|
15133
|
-
const
|
|
15166
|
+
const z = t.scrollTop, P = [], G = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set(), D = (x) => {
|
|
15134
15167
|
x === e && P.push(t.querySelector('slot[name="conversation-notices"]') ?? sd("conversation-notices")), x.dataset.sessionId = i.sessionId ?? "", P.push(x);
|
|
15135
15168
|
};
|
|
15136
15169
|
Nr(n, i.isThinking), n.disabled = !1;
|
|
@@ -15167,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) {
|
|
|
15167
15200
|
Pc(C.node, i.starterPromptsLoading), D(C.node), D(e), wt(t, P);
|
|
15168
15201
|
return;
|
|
15169
15202
|
}
|
|
15170
|
-
const
|
|
15171
|
-
|
|
15203
|
+
const B = document.createElement("div");
|
|
15204
|
+
B.className = "pluno-pa-widget__empty-state pluno-pa-widget__empty-state--starter";
|
|
15172
15205
|
const Y = document.createElement("div");
|
|
15173
15206
|
Y.className = "pluno-pa-widget__empty-hero";
|
|
15174
15207
|
const re = qt(
|
|
15175
15208
|
"pluno-pa-widget__character--empty",
|
|
15176
15209
|
h()
|
|
15177
15210
|
);
|
|
15178
|
-
Y.appendChild(re),
|
|
15211
|
+
Y.appendChild(re), B.appendChild(Y), B.appendChild(id());
|
|
15179
15212
|
const j = i.starterPrompts, $ = document.createElement("div");
|
|
15180
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)
|
|
15181
15214
|
for (const [Q, W] of j.entries()) {
|
|
@@ -15189,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) {
|
|
|
15189
15222
|
const W = document.createElement("div");
|
|
15190
15223
|
W.className = "pluno-pa-widget__starter-placeholder", Q === 1 && W.setAttribute("role", "status"), W.textContent = " ", $.appendChild(W);
|
|
15191
15224
|
}
|
|
15192
|
-
|
|
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);
|
|
15193
15226
|
return;
|
|
15194
15227
|
}
|
|
15195
15228
|
let ce = null, le = null, he = [];
|
|
15196
15229
|
const ke = O.some(pr), N = O.some(
|
|
15197
15230
|
(x) => x.role === "tool" && x.id === i.activity?.activeItemId
|
|
15198
15231
|
), _e = i.turnPhase ? dm(i.turnPhase) : "Thinking...";
|
|
15199
|
-
let
|
|
15232
|
+
let Ue = !1;
|
|
15200
15233
|
const be = () => {
|
|
15201
15234
|
if (he.length === 0)
|
|
15202
|
-
return
|
|
15235
|
+
return Ue = !1, !1;
|
|
15203
15236
|
const x = k.showProgress && he.some(
|
|
15204
|
-
(
|
|
15237
|
+
(B) => B.id === i.activity?.activeItemId
|
|
15205
15238
|
), C = tb(
|
|
15206
15239
|
he,
|
|
15207
15240
|
x,
|
|
@@ -15212,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) {
|
|
|
15212
15245
|
h(),
|
|
15213
15246
|
V.get(he[0].id)?.collapsed ?? !0
|
|
15214
15247
|
);
|
|
15215
|
-
return D(C), ce = null, le = C, he = [],
|
|
15248
|
+
return D(C), ce = null, le = C, he = [], Ue = x, !0;
|
|
15216
15249
|
}, Ze = (x) => {
|
|
15217
|
-
const C = `interaction:${i.sessionId ?? ""}:${x.id}`,
|
|
15218
|
-
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;
|
|
15219
15252
|
if (!re) {
|
|
15220
15253
|
const j = (Q, W) => I.act(x, Q, W), $ = x.payload.error ?? null;
|
|
15221
15254
|
if (x.kind !== "integration_connection") return;
|
|
15222
|
-
re =
|
|
15255
|
+
re = zy(
|
|
15223
15256
|
x.payload.request,
|
|
15224
15257
|
{ status: x.status === "pending" ? "connecting" : x.payload.status, error: $ ?? void 0 },
|
|
15225
15258
|
() => j("connect"),
|
|
15226
15259
|
x.presentation
|
|
15227
|
-
), c.set(C, { node: re, renderSignature:
|
|
15260
|
+
), c.set(C, { node: re, renderSignature: B });
|
|
15228
15261
|
}
|
|
15229
15262
|
G.add(C), re.dataset.interactionId = x.id, re.dataset.interactionUserMessageId = x.userMessageId ?? "", D(re), ce = null, le = re;
|
|
15230
15263
|
}, Ce = new Set(O.filter((x) => x.role === "user").map((x) => x.id));
|
|
@@ -15251,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) {
|
|
|
15251
15284
|
continue;
|
|
15252
15285
|
const $ = be(), Q = gd(C);
|
|
15253
15286
|
if ($) {
|
|
15254
|
-
if (!
|
|
15287
|
+
if (!Ue) {
|
|
15255
15288
|
const W = Dc(
|
|
15256
15289
|
u,
|
|
15257
15290
|
S,
|
|
@@ -15293,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) {
|
|
|
15293
15326
|
continue;
|
|
15294
15327
|
}
|
|
15295
15328
|
C.role;
|
|
15296
|
-
const
|
|
15329
|
+
const B = be(), Y = ui(C.content), re = C.role === "assistant" && O.some(
|
|
15297
15330
|
($) => $.role === "tool" && di($, C)
|
|
15298
15331
|
);
|
|
15299
|
-
if (C.role === "assistant" && !
|
|
15332
|
+
if (C.role === "assistant" && !B && !re) {
|
|
15300
15333
|
const $ = ds(h());
|
|
15301
15334
|
D($), ce = null, le = $;
|
|
15302
15335
|
}
|
|
@@ -15317,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) {
|
|
|
15317
15350
|
if (k.showProgress && i.turnPhase && !i.assistantDraft && !N && !oe && !ke) {
|
|
15318
15351
|
const x = i.activeResponseUserMessageId ? `response:${i.activeResponseUserMessageId}` : `session:${i.sessionId ?? "pending"}`;
|
|
15319
15352
|
if (H) {
|
|
15320
|
-
if (!
|
|
15353
|
+
if (!Ue) {
|
|
15321
15354
|
const C = Dc(
|
|
15322
15355
|
u,
|
|
15323
15356
|
S,
|
|
@@ -15338,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) {
|
|
|
15338
15371
|
}
|
|
15339
15372
|
}
|
|
15340
15373
|
if (i.lastError && as(i.lastErrorCode) === "conversation") {
|
|
15341
|
-
const
|
|
15342
|
-
|
|
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");
|
|
15343
15376
|
const Y = document.createElement("div");
|
|
15344
15377
|
Y.className = "pluno-pa-widget__error", i.historyRefreshFailure && (Y.dataset.historyRefreshFailure = JSON.stringify(i.historyRefreshFailure));
|
|
15345
15378
|
const re = document.createElement("span");
|
|
@@ -15353,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) {
|
|
|
15353
15386
|
const Q = b?.has(j) === !0 || j === "retry_history" && i.conversationDiagnostics?.queryRequestId != null || j === "retry_message" && i.isRetrying;
|
|
15354
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($);
|
|
15355
15388
|
}
|
|
15356
|
-
|
|
15389
|
+
B.appendChild(Y), D(B), ce = null, le = B;
|
|
15357
15390
|
}
|
|
15358
15391
|
Pe(), ce?.classList.add(
|
|
15359
15392
|
"pluno-pa-widget__message--bottom-reserve"
|
|
@@ -15368,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) {
|
|
|
15368
15401
|
), Jy(
|
|
15369
15402
|
u,
|
|
15370
15403
|
S
|
|
15371
|
-
), wt(t, P), o ? In(t, r) : t.scrollTop =
|
|
15404
|
+
), wt(t, P), o ? In(t, r) : t.scrollTop = z;
|
|
15372
15405
|
}
|
|
15373
|
-
function
|
|
15406
|
+
function zy(t, e, n, s, i = null) {
|
|
15374
15407
|
const o = document.createElement("section");
|
|
15375
15408
|
o.className = "pluno-pa-widget__integration-auth-card", o.setAttribute("aria-label", s?.title ?? `Connect ${t.appName}`);
|
|
15376
15409
|
const r = document.createElement("div");
|
|
@@ -15644,13 +15677,13 @@ function tb(t, e, n, s, i, o, r, a = !0) {
|
|
|
15644
15677
|
r
|
|
15645
15678
|
), T = JSON.stringify(r), O = document.createElement("div");
|
|
15646
15679
|
O.className = "pluno-pa-widget__tool-active-content";
|
|
15647
|
-
const V = vi(), E = document.createElement("details"),
|
|
15648
|
-
|
|
15680
|
+
const V = vi(), E = document.createElement("details"), z = document.createElement("summary");
|
|
15681
|
+
z.className = "pluno-pa-widget__tool-summary";
|
|
15649
15682
|
const P = document.createElement("div");
|
|
15650
|
-
P.className = "pluno-pa-widget__tool-summary-title",
|
|
15683
|
+
P.className = "pluno-pa-widget__tool-summary-title", z.appendChild(P), z.addEventListener("click", () => {
|
|
15651
15684
|
const U = I.dataset.responseGroupKey ?? l;
|
|
15652
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";
|
|
15653
|
-
}), E.appendChild(
|
|
15686
|
+
}), E.appendChild(z);
|
|
15654
15687
|
const G = document.createElement("div");
|
|
15655
15688
|
G.className = "pluno-pa-widget__tool-lines", E.addEventListener("toggle", () => {
|
|
15656
15689
|
I.dataset.responseGroupKey, I.classList.toggle("pluno-pa-widget__tool-group--open", E.open), P.textContent = E.open ? "Activities" : I.dataset.collapsedActivityTitle ?? "Activities";
|
|
@@ -15661,7 +15694,7 @@ function tb(t, e, n, s, i, o, r, a = !0) {
|
|
|
15661
15694
|
activeContent: O,
|
|
15662
15695
|
thinkingStatus: V,
|
|
15663
15696
|
details: E,
|
|
15664
|
-
summary:
|
|
15697
|
+
summary: z,
|
|
15665
15698
|
summaryTitle: P,
|
|
15666
15699
|
lines: G,
|
|
15667
15700
|
lineNodes: /* @__PURE__ */ new Map()
|
|
@@ -16033,7 +16066,7 @@ function Lc(t, e) {
|
|
|
16033
16066
|
--pluno-pa-accent-contrast: #fafafa;
|
|
16034
16067
|
position: fixed;
|
|
16035
16068
|
z-index: 2147483645;
|
|
16036
|
-
font-family: ${
|
|
16069
|
+
font-family: ${At.fontFamily};
|
|
16037
16070
|
font-size: 14px;
|
|
16038
16071
|
color: var(--pluno-pa-text);
|
|
16039
16072
|
width: var(--pluno-pa-launcher-width);
|
|
@@ -18771,11 +18804,11 @@ async function ub() {
|
|
|
18771
18804
|
e.observe(document.documentElement, { childList: !0 });
|
|
18772
18805
|
});
|
|
18773
18806
|
}
|
|
18774
|
-
function
|
|
18807
|
+
function Br(t) {
|
|
18775
18808
|
return `pluno.productAgent.widgetState.${location.origin}.${t.backendUrl ?? ""}.${t.tokenEndpoint ?? ""}.${t.position ?? ""}`;
|
|
18776
18809
|
}
|
|
18777
18810
|
function wd(t) {
|
|
18778
|
-
return `${
|
|
18811
|
+
return `${Br(t)}.displayState`;
|
|
18779
18812
|
}
|
|
18780
18813
|
function pb(t) {
|
|
18781
18814
|
try {
|
|
@@ -18823,7 +18856,7 @@ function hb(t) {
|
|
|
18823
18856
|
}
|
|
18824
18857
|
function gb(t) {
|
|
18825
18858
|
try {
|
|
18826
|
-
const e = window.localStorage.getItem(
|
|
18859
|
+
const e = window.localStorage.getItem(Br(t));
|
|
18827
18860
|
if (!e)
|
|
18828
18861
|
return Uc();
|
|
18829
18862
|
const n = JSON.parse(e);
|
|
@@ -18852,7 +18885,7 @@ function Uc() {
|
|
|
18852
18885
|
function fb(t, e) {
|
|
18853
18886
|
try {
|
|
18854
18887
|
window.localStorage.setItem(
|
|
18855
|
-
|
|
18888
|
+
Br(t),
|
|
18856
18889
|
JSON.stringify(e)
|
|
18857
18890
|
);
|
|
18858
18891
|
} catch {
|
|
@@ -18916,17 +18949,17 @@ function wb(t) {
|
|
|
18916
18949
|
const n = Date.parse(t);
|
|
18917
18950
|
return Number.isFinite(n) ? Math.max(0, n - Date.now()) : void 0;
|
|
18918
18951
|
}
|
|
18919
|
-
const
|
|
18952
|
+
const Bc = /* @__PURE__ */ new WeakSet();
|
|
18920
18953
|
function _b(t) {
|
|
18921
18954
|
return Object.keys(t.dataset).some((e) => e.startsWith("pluno"));
|
|
18922
18955
|
}
|
|
18923
|
-
function
|
|
18956
|
+
function zc(t) {
|
|
18924
18957
|
const e = t.pathname.split("/");
|
|
18925
18958
|
return e[e.length - 1] ?? "";
|
|
18926
18959
|
}
|
|
18927
18960
|
function vb(t, e) {
|
|
18928
18961
|
const n = new URL(t.src, document.baseURI);
|
|
18929
|
-
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);
|
|
18930
18963
|
}
|
|
18931
18964
|
class Tt extends EventTarget {
|
|
18932
18965
|
constructor(e, n) {
|
|
@@ -19041,21 +19074,21 @@ function Sb(t) {
|
|
|
19041
19074
|
}
|
|
19042
19075
|
function xb(t) {
|
|
19043
19076
|
for (const e of Sb(t))
|
|
19044
|
-
|
|
19077
|
+
Bc.has(e) || e.dataset.plunoAutoMount === "false" || (Bc.add(e), _d(e).catch((n) => {
|
|
19045
19078
|
console.error("Failed to mount Pluno widget", n);
|
|
19046
19079
|
}));
|
|
19047
19080
|
}
|
|
19048
19081
|
function _d(t) {
|
|
19049
|
-
const e = window, n = e[
|
|
19082
|
+
const e = window, n = e[Rt];
|
|
19050
19083
|
if (n) {
|
|
19051
19084
|
if (n.host === null)
|
|
19052
19085
|
return n.mountPromise.catch(() => {
|
|
19053
|
-
const a = e[
|
|
19086
|
+
const a = e[Rt];
|
|
19054
19087
|
return a ? a.mountPromise : _d(t);
|
|
19055
19088
|
});
|
|
19056
19089
|
if (kb(n.host))
|
|
19057
19090
|
return n.mountPromise;
|
|
19058
|
-
n.destroy?.(), delete e[
|
|
19091
|
+
n.destroy?.(), delete e[Rt];
|
|
19059
19092
|
}
|
|
19060
19093
|
const s = t.dataset.plunoPreviewChannel, i = t.dataset.plunoTokenEndpoint;
|
|
19061
19094
|
let o;
|
|
@@ -19071,22 +19104,22 @@ function _d(t) {
|
|
|
19071
19104
|
scribbleStyle: t.dataset.plunoScribbleStyle === void 0 ? void 0 : t.dataset.plunoScribbleStyle !== "false",
|
|
19072
19105
|
position: t.dataset.plunoPosition === "bottom-left" ? "bottom-left" : "bottom-right"
|
|
19073
19106
|
}).then((a) => {
|
|
19074
|
-
if (e[
|
|
19107
|
+
if (e[Rt] !== o) {
|
|
19075
19108
|
a.destroy();
|
|
19076
19109
|
return;
|
|
19077
19110
|
}
|
|
19078
19111
|
const c = a.host;
|
|
19079
19112
|
c.setAttribute(Yl, "true"), o.host = c, o.destroy = () => {
|
|
19080
|
-
e[
|
|
19113
|
+
e[Rt] === o && delete e[Rt], o.host = null, o.destroy = null, a.destroy();
|
|
19081
19114
|
};
|
|
19082
19115
|
}).catch((a) => {
|
|
19083
|
-
throw e[
|
|
19116
|
+
throw e[Rt] === o && delete e[Rt], a;
|
|
19084
19117
|
});
|
|
19085
19118
|
return o = {
|
|
19086
19119
|
mountPromise: r,
|
|
19087
19120
|
host: null,
|
|
19088
19121
|
destroy: null
|
|
19089
|
-
}, e[
|
|
19122
|
+
}, e[Rt] = o, r;
|
|
19090
19123
|
}
|
|
19091
19124
|
function kb(t) {
|
|
19092
19125
|
return t.isConnected && t.getAttribute(Yl) === "true" && !!t.shadowRoot?.querySelector(".pluno-pa-widget__launcher") && !!t.shadowRoot?.querySelector(".pluno-pa-widget__panel");
|