@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
|
@@ -846,7 +846,7 @@ function wr(t, e = null) {
|
|
|
846
846
|
} : void 0);
|
|
847
847
|
return { ...i, ...a ? { auth: a } : {}, submissionGate: o };
|
|
848
848
|
}
|
|
849
|
-
const _r = "0.1.
|
|
849
|
+
const _r = "0.1.324", Tt = {
|
|
850
850
|
version: _r
|
|
851
851
|
};
|
|
852
852
|
function We(t) {
|
|
@@ -911,18 +911,18 @@ function Rt(t) {
|
|
|
911
911
|
function F(t, e) {
|
|
912
912
|
return t.context.proactiveSuggestionQuestion != null || t.context.proactive_suggestion_question != null || e?.command?.payload.proactiveSuggestionQuestion != null || e?.command?.payload.proactive_suggestion_question != null;
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function Er(t, e) {
|
|
915
915
|
return t.delivery === "failed" && t.error?.code === "personal_product_agent_retired" && F(t, e);
|
|
916
916
|
}
|
|
917
|
-
function
|
|
918
|
-
return t !== null && typeof t == "object" && !Object.isFrozen(t) && (Object.values(t).forEach(
|
|
917
|
+
function V(t) {
|
|
918
|
+
return t !== null && typeof t == "object" && !Object.isFrozen(t) && (Object.values(t).forEach(V), Object.freeze(t)), t;
|
|
919
919
|
}
|
|
920
920
|
function X(t) {
|
|
921
921
|
if (!Ke(t)) throw new Error("Conversation inputs must be JSON-safe values.");
|
|
922
922
|
return JSON.parse(JSON.stringify(t));
|
|
923
923
|
}
|
|
924
924
|
function sn(t = "", e = 0) {
|
|
925
|
-
return
|
|
925
|
+
return V({ authorityId: t, generation: e, pendingRestoration: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, durableSubmissionIds: [], pendingDurabilityIds: [], checkpointEffectId: null, checkpointError: null });
|
|
926
926
|
}
|
|
927
927
|
function vs(t) {
|
|
928
928
|
return {
|
|
@@ -940,7 +940,7 @@ function vs(t) {
|
|
|
940
940
|
function nn(t) {
|
|
941
941
|
return ["history_load_failed", "request_timed_out", "connection_interrupted", "408", "425", "429"].includes(t) || /^5\d\d$/.test(t);
|
|
942
942
|
}
|
|
943
|
-
const
|
|
943
|
+
const kr = "Message storage has not confirmed this submission. Reconnect to check its status.";
|
|
944
944
|
function qt(t) {
|
|
945
945
|
if (!Number.isSafeInteger(t) || t < 0) throw new Error("Invalid conversation revision.");
|
|
946
946
|
}
|
|
@@ -979,7 +979,7 @@ function Is(t, e) {
|
|
|
979
979
|
};
|
|
980
980
|
return { ...t, execution: e, executionByUserMessage: s };
|
|
981
981
|
}
|
|
982
|
-
function
|
|
982
|
+
function Ar(t) {
|
|
983
983
|
const e = /* @__PURE__ */ new Set();
|
|
984
984
|
for (const s of Object.values(t.items)) {
|
|
985
985
|
const i = Rt(s), n = t.streams[s.id];
|
|
@@ -1056,7 +1056,7 @@ function Ss(t, e, s = !1) {
|
|
|
1056
1056
|
queries: { ...c.queries, [o.lane]: { ...d, requestId: null, status: d.data === null ? "not_requested" : "ready" } }
|
|
1057
1057
|
} } };
|
|
1058
1058
|
}
|
|
1059
|
-
return
|
|
1059
|
+
return V(n);
|
|
1060
1060
|
}
|
|
1061
1061
|
function Ze(t) {
|
|
1062
1062
|
return JSON.stringify(t, (e, s) => s && typeof s == "object" && !Array.isArray(s) ? Object.fromEntries(Object.entries(s).sort(([i], [n]) => i.localeCompare(n))) : s);
|
|
@@ -1159,8 +1159,8 @@ function Tr(t, e, s, i) {
|
|
|
1159
1159
|
if (s.clients[e.clientScopeId] !== e.conversationScopeId) throw new Error("Submission selection has changed.");
|
|
1160
1160
|
const { type: a, authorityId: c, generation: d, prepareContext: u, reconcileAcceptance: l, waitForAuthentication: h, ...f } = e, m = t.submissions[e.userMessageId];
|
|
1161
1161
|
if (m) {
|
|
1162
|
-
const { contextPreparation: b, requestedModel: I, sessionId: w, delivery:
|
|
1163
|
-
if (Ze(
|
|
1162
|
+
const { contextPreparation: b, requestedModel: I, sessionId: w, delivery: k, cancelled: A, cancellationReason: D, error: S, executionVersion: q, ...E } = m;
|
|
1163
|
+
if (Ze(E) !== Ze(f)) throw new Error("User-message identity cannot be reused with different input.");
|
|
1164
1164
|
return { state: t, effects: r };
|
|
1165
1165
|
}
|
|
1166
1166
|
const p = s.selections[e.conversationScopeId], g = Object.values(t.submissions).find((b) => b.conversationScopeId === e.conversationScopeId && !b.cancelled && b.sessionId !== null && !F(b, t.deliveries[b.userMessageId])), y = i.scopes[e.clientScopeId], _ = {
|
|
@@ -1241,7 +1241,7 @@ function Tr(t, e, s, i) {
|
|
|
1241
1241
|
requestId: e.requestId,
|
|
1242
1242
|
lane: e.lane,
|
|
1243
1243
|
before: e.lane === "history" ? c.cursor : null,
|
|
1244
|
-
refreshItemIds:
|
|
1244
|
+
refreshItemIds: Ar(a),
|
|
1245
1245
|
retryPreparation: c.error?.code === "history_preparation_failed"
|
|
1246
1246
|
}, u = Object.values(t.submissions).filter((f) => f.sessionId === e.sessionId && f.delivery === "accepted" && f.executionVersion === null).map((f) => f.userMessageId), l = t.requestSequence + 1, h = `conversation:${t.generation}:${l}`;
|
|
1247
1247
|
n = {
|
|
@@ -1261,7 +1261,7 @@ function Tr(t, e, s, i) {
|
|
|
1261
1261
|
const c = a.sessionId ? n.sessions[a.sessionId]?.execution : null;
|
|
1262
1262
|
c?.user_message_ids.includes(a.userMessageId) && a.executionVersion !== c.version && (n = { ...n, submissions: { ...n.submissions, [a.userMessageId]: { ...a, executionVersion: c.version } } });
|
|
1263
1263
|
}
|
|
1264
|
-
return { state:
|
|
1264
|
+
return { state: V(n), effects: r, ...o ? { interactionSources: V(o) } : {} };
|
|
1265
1265
|
}
|
|
1266
1266
|
const hi = (t, e) => ({
|
|
1267
1267
|
acceptance: "unissued",
|
|
@@ -1276,7 +1276,7 @@ const hi = (t, e) => ({
|
|
|
1276
1276
|
completedUploads: 0,
|
|
1277
1277
|
command: null
|
|
1278
1278
|
});
|
|
1279
|
-
function
|
|
1279
|
+
function js(t, e) {
|
|
1280
1280
|
const s = new Set(Object.values(e.clients)), i = Object.values(t.operations).filter((u) => u.command.type === "run.stop"), n = (u) => i.some((l) => l.command.payload.expectedUserMessageId === u && l.phase === "done"), r = Object.fromEntries(Object.entries(t.submissions).filter(([u, l]) => {
|
|
1281
1281
|
const h = l.sessionId ? t.sessions[l.sessionId] : void 0;
|
|
1282
1282
|
if (l.cancelled && s.has(l.conversationScopeId) && t.stops[l.conversationScopeId]?.userMessageIds.includes(u) && !h?.items[u] && !h?.removedItems[u]) return !0;
|
|
@@ -1300,7 +1300,7 @@ function Bs(t, e) {
|
|
|
1300
1300
|
const l = u.command.payload.source;
|
|
1301
1301
|
return !Object.values(t.submissions).some((h) => h.conversationScopeId === u.conversationScopeId && h.delivery === "accepted" && h.attachments.some((f) => f.sourceId === l.sourceId));
|
|
1302
1302
|
}));
|
|
1303
|
-
return
|
|
1303
|
+
return V({
|
|
1304
1304
|
schema: 1,
|
|
1305
1305
|
authorityId: t.authorityId,
|
|
1306
1306
|
submissions: r,
|
|
@@ -1320,14 +1320,14 @@ function fe(t, e) {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
function Rs(t, e, s, i = !1) {
|
|
1322
1322
|
if (!e.effectsEnabled || !i && t.submissions === e.submissions && t.deliveries === e.deliveries && t.operations === e.operations && t.stops === e.stops && t.sessions === e.sessions) return { state: e, effects: [] };
|
|
1323
|
-
const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, o =
|
|
1323
|
+
const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, o = V({ ...e, requestSequence: n, checkpointEffectId: r });
|
|
1324
1324
|
return { state: o, effects: [{ id: r, kind: "conversation.checkpoint", input: {
|
|
1325
1325
|
authorityId: o.authorityId,
|
|
1326
1326
|
generation: o.generation,
|
|
1327
|
-
checkpoint:
|
|
1327
|
+
checkpoint: js(o, s)
|
|
1328
1328
|
} }] };
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1330
|
+
function Es(t, e = null) {
|
|
1331
1331
|
return { command: X(t), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
|
|
1332
1332
|
}
|
|
1333
1333
|
function qr(t) {
|
|
@@ -1340,7 +1340,7 @@ function pi(t, e) {
|
|
|
1340
1340
|
return { sessionId: t.sessionId, clientMessageId: e };
|
|
1341
1341
|
}
|
|
1342
1342
|
const dt = { code: "personal_product_agent_retired", message: "Personal Product Agent has retired.", retryable: !1 };
|
|
1343
|
-
function
|
|
1343
|
+
function ks(t) {
|
|
1344
1344
|
let e = t;
|
|
1345
1345
|
const s = [];
|
|
1346
1346
|
if (!t.effectsEnabled || !t.authorityId) return { state: t, effects: s };
|
|
@@ -1386,7 +1386,7 @@ function Es(t) {
|
|
|
1386
1386
|
d = { ...d, completedUploads: d.completedUploads + 1 };
|
|
1387
1387
|
if (!c.cancelled && d.uploads.length === c.attachments.length && d.completedUploads === d.uploads.length && r.slice(0, r.indexOf(a)).some((f) => {
|
|
1388
1388
|
const m = e.submissions[f];
|
|
1389
|
-
return !(
|
|
1389
|
+
return !(Er(m, e.deliveries[f]) || m.cancelled && F(m, e.deliveries[f])) && (m.conversationScopeId === c.conversationScopeId || c.sessionId !== null && m.sessionId === c.sessionId) && m.delivery !== "accepted" && (m.delivery !== "failed" || e.deliveries[f]?.acceptance === "uncertain") && (!m.cancelled || fe(e, f));
|
|
1390
1390
|
})) continue;
|
|
1391
1391
|
const u = n();
|
|
1392
1392
|
let l, h = d.command;
|
|
@@ -1416,7 +1416,7 @@ function Es(t) {
|
|
|
1416
1416
|
const o = (a, c, d, u = "user_requested") => {
|
|
1417
1417
|
if (e.operations[a]) return;
|
|
1418
1418
|
const l = n();
|
|
1419
|
-
e = { ...e, operations: { ...e.operations, [a]:
|
|
1419
|
+
e = { ...e, operations: { ...e.operations, [a]: Es({
|
|
1420
1420
|
request_id: l,
|
|
1421
1421
|
type: "run.stop",
|
|
1422
1422
|
payload: { sessionId: c, expectedUserMessageId: d, reason: u }
|
|
@@ -1453,7 +1453,7 @@ function Es(t) {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
} }) : s.push({ id: m, kind: "conversation.command", input: { ...i, command: f } });
|
|
1455
1455
|
}
|
|
1456
|
-
return { state:
|
|
1456
|
+
return { state: V(e), effects: s };
|
|
1457
1457
|
}
|
|
1458
1458
|
function Mr(t, e, s, i) {
|
|
1459
1459
|
let n = t, r = e;
|
|
@@ -1545,7 +1545,7 @@ function Mr(t, e, s, i) {
|
|
|
1545
1545
|
const m = e.output;
|
|
1546
1546
|
m?.sessionId && (n = { ...n, operations: {
|
|
1547
1547
|
...n.operations,
|
|
1548
|
-
[`cleanup:${h}`]:
|
|
1548
|
+
[`cleanup:${h}`]: Es({
|
|
1549
1549
|
request_id: `cleanup:${f.command.request_id}`,
|
|
1550
1550
|
type: "session.reset",
|
|
1551
1551
|
payload: {
|
|
@@ -1589,20 +1589,20 @@ function Mr(t, e, s, i) {
|
|
|
1589
1589
|
delivery: (w.contextPreparation === null && !m.deliveries[I]?.handoffRecovery || !m.deliveries[I]) && !w.cancelled && w.delivery !== "accepted" ? "failed" : w.delivery === "sending" ? "uncertain" : w.delivery,
|
|
1590
1590
|
error: w.delivery !== "accepted" && F(w, m.deliveries[I]) ? dt : w.contextPreparation === null && !m.deliveries[I]?.handoffRecovery && !w.cancelled && !["unauthorized", "auth_reconnecting"].includes(w.error?.code ?? "") ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : !m.deliveries[I] && w.delivery !== "accepted" && !w.cancelled ? { code: "submission_interrupted", message: "Message preparation was interrupted. Retry this message.", retryable: !0 } : w.error
|
|
1591
1591
|
}])),
|
|
1592
|
-
deliveries: Object.fromEntries(Object.entries(m.submissions).map(([I, w],
|
|
1593
|
-
const
|
|
1592
|
+
deliveries: Object.fromEntries(Object.entries(m.submissions).map(([I, w], k) => {
|
|
1593
|
+
const A = m.deliveries[I], D = w.contextPreparation === null && !A?.handoffRecovery, S = w.delivery === "accepted" ? "accepted" : A?.acceptance ?? (A && (A.step === "send" || A.step === "receipt") ? "uncertain" : "unissued");
|
|
1594
1594
|
return [I, {
|
|
1595
|
-
...hi(w,
|
|
1596
|
-
...
|
|
1595
|
+
...hi(w, k),
|
|
1596
|
+
...A,
|
|
1597
1597
|
acceptance: S,
|
|
1598
|
-
allocation: w.sessionId !== null ? "resolved" :
|
|
1598
|
+
allocation: w.sessionId !== null ? "resolved" : A?.allocation ?? (A?.step === "upload" ? "uncertain" : "unissued"),
|
|
1599
1599
|
effectId: null,
|
|
1600
1600
|
// Readiness is authority-local and must be re-established after restart. Captured input stays immutable.
|
|
1601
|
-
step: S === "uncertain" && (
|
|
1601
|
+
step: S === "uncertain" && (A?.step === "send" || A?.handoffRecovery) && A.phase !== "done" ? "receipt" : A?.step ?? null,
|
|
1602
1602
|
prepared: S === "accepted",
|
|
1603
|
-
queuePosition:
|
|
1603
|
+
queuePosition: A?.queuePosition ?? k,
|
|
1604
1604
|
// Retired inputs can only reconcile their original receipt, including interrupted preparation.
|
|
1605
|
-
phase: S === "accepted" ? "done" : S === "uncertain" && F(w,
|
|
1605
|
+
phase: S === "accepted" ? "done" : S === "uncertain" && F(w, A) ? "uncertain" : D || !A ? "failed" : ["running", "waiting"].includes(A.phase) ? "uncertain" : A.phase
|
|
1606
1606
|
}];
|
|
1607
1607
|
})),
|
|
1608
1608
|
// Retired warmup hints must never replay; other durable commands retain their recovery state.
|
|
@@ -1679,7 +1679,7 @@ function Mr(t, e, s, i) {
|
|
|
1679
1679
|
})) : t.stops;
|
|
1680
1680
|
n = { ...t, stops: f, effectsEnabled: !0, operations: {
|
|
1681
1681
|
...t.operations,
|
|
1682
|
-
[l.request_id]:
|
|
1682
|
+
[l.request_id]: Es(l, e.conversationScopeId ?? null)
|
|
1683
1683
|
} };
|
|
1684
1684
|
}
|
|
1685
1685
|
}
|
|
@@ -1730,7 +1730,7 @@ function Mr(t, e, s, i) {
|
|
|
1730
1730
|
return h && !h.cancelled && !["accepted", "failed"].includes(h.delivery) && !a.durableSubmissionIds.includes(l);
|
|
1731
1731
|
});
|
|
1732
1732
|
c.length !== a.pendingDurabilityIds.length && (a = { ...a, pendingDurabilityIds: c });
|
|
1733
|
-
const d =
|
|
1733
|
+
const d = ks(a), u = Rs(t, d.state, s, e.type === "conversation.recover" && t.checkpointError !== null);
|
|
1734
1734
|
return { state: u.state, effects: [...u.effects, ...o.effects, ...d.effects], interactionSources: o.interactionSources };
|
|
1735
1735
|
}
|
|
1736
1736
|
const Cr = [
|
|
@@ -1950,7 +1950,7 @@ function Nr(t) {
|
|
|
1950
1950
|
const e = t, s = (n) => Number.isSafeInteger(n) && n >= 0, i = (n) => n && typeof n == "object" && Object.keys(n).every((r) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(r)) && s(n.sequence) && s(n.at) && x(n.type) !== null && typeof n.changed == "boolean" && [n.generation, n.itemCount, n.removedCount].every((r) => r === null || s(r)) && [n.sessionId, n.scopeId, n.requestId, n.effectId, n.clientScopeId, n.reason, n.effectKind, n.eventType].every((r) => r === null || x(r) !== null) && (n.projectionReady === null || typeof n.projectionReady == "boolean");
|
|
1951
1951
|
return Object.keys(e).every((n) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(n)) && x(e.ownerId) !== null && s(e.revision) && s(e.dropped) && (e.lastIntent == null || i(e.lastIntent)) && (e.lastSelection === null || i(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(i);
|
|
1952
1952
|
}
|
|
1953
|
-
function
|
|
1953
|
+
function Br(t, e, s) {
|
|
1954
1954
|
const i = t;
|
|
1955
1955
|
if (!/^(directory\.|conversation\.|session\.)/.test(i.type ?? "") && !/^(directory\.|conversation\.|session\.)/.test(i.effectKind ?? "") || i.type === "conversation.display_received" && !["conversation.execution.updated", "conversation.item.removed"].includes(i.event?.type ?? "")) return null;
|
|
1956
1956
|
const n = i.output?.snapshot;
|
|
@@ -1978,11 +1978,11 @@ function Ls(t) {
|
|
|
1978
1978
|
const e = t;
|
|
1979
1979
|
return Object.keys(e).every((s) => ["sessionId", "episodeId", "consecutiveFailures", "transportCode", "requestId", "durationMs"].includes(s)) && typeof e.sessionId == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(e.sessionId) && typeof e.episodeId == "string" && /^[a-zA-Z0-9:_-]{1,500}$/.test(e.episodeId) && (e.transportCode === void 0 || typeof e.transportCode == "string" && /^[a-z0-9_]{1,80}$/.test(e.transportCode)) && (e.requestId === void 0 || typeof e.requestId == "string" && /^[a-zA-Z0-9_-]{1,160}$/.test(e.requestId)) && (e.durationMs === void 0 || typeof e.durationMs == "number" && Number.isFinite(e.durationMs) && e.durationMs >= 0) && Number.isSafeInteger(e.consecutiveFailures) && e.consecutiveFailures >= 1;
|
|
1980
1980
|
}
|
|
1981
|
-
const mi = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Fs = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), Ie = (t) => t === null || Fs(t),
|
|
1981
|
+
const mi = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], Fs = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), Ie = (t) => t === null || Fs(t), jr = (t) => typeof t == "string" && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:Z|\+00:00)$/.test(t) && Number.isFinite(Date.parse(t));
|
|
1982
1982
|
function $s(t) {
|
|
1983
1983
|
if (!t || typeof t != "object") return !1;
|
|
1984
1984
|
const e = t;
|
|
1985
|
-
return Object.keys(t).every((s) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(s)) && Ie(e.sessionId) && Fs(e.itemId) && Ie(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && Ie(e.runId) && (e.createdAt === null ||
|
|
1985
|
+
return Object.keys(t).every((s) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(s)) && Ie(e.sessionId) && Fs(e.itemId) && Ie(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && Ie(e.runId) && (e.createdAt === null || jr(e.createdAt));
|
|
1986
1986
|
}
|
|
1987
1987
|
function Lr(t) {
|
|
1988
1988
|
if (!t || typeof t != "object") return !1;
|
|
@@ -2139,7 +2139,7 @@ function Vr(t, e) {
|
|
|
2139
2139
|
if (!(s instanceof DOMException) || !["SecurityError", "QuotaExceededError"].includes(s.name)) throw s;
|
|
2140
2140
|
}
|
|
2141
2141
|
}
|
|
2142
|
-
class
|
|
2142
|
+
class je {
|
|
2143
2143
|
constructor(e) {
|
|
2144
2144
|
this.options = e;
|
|
2145
2145
|
}
|
|
@@ -2211,7 +2211,7 @@ const lt = /* @__PURE__ */ Object.create(null);
|
|
|
2211
2211
|
Object.keys(ae).forEach((t) => {
|
|
2212
2212
|
lt[ae[t]] = t;
|
|
2213
2213
|
});
|
|
2214
|
-
const
|
|
2214
|
+
const As = { type: "error", data: "parser error" }, un = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", hn = typeof ArrayBuffer == "function", pn = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer, Hs = ({ type: t, data: e }, s, i) => un && e instanceof Blob ? s ? i(e) : yi(e, i) : hn && (e instanceof ArrayBuffer || pn(e)) ? s ? i(e) : yi(new Blob([e]), i) : i(ae[t] + (e || "")), yi = (t, e) => {
|
|
2215
2215
|
const s = new FileReader();
|
|
2216
2216
|
return s.onload = function() {
|
|
2217
2217
|
const i = s.result.split(",")[1];
|
|
@@ -2256,7 +2256,7 @@ const Gr = (t) => {
|
|
|
2256
2256
|
data: t.substring(1)
|
|
2257
2257
|
} : {
|
|
2258
2258
|
type: lt[s]
|
|
2259
|
-
} :
|
|
2259
|
+
} : As;
|
|
2260
2260
|
}, Qr = (t, e) => {
|
|
2261
2261
|
if (Jr) {
|
|
2262
2262
|
const s = Gr(t);
|
|
@@ -2337,7 +2337,7 @@ function eo(t, e) {
|
|
|
2337
2337
|
break;
|
|
2338
2338
|
const c = tt(s, 8), d = new DataView(c.buffer, c.byteOffset, c.length), u = d.getUint32(0);
|
|
2339
2339
|
if (u > Math.pow(2, 21) - 1) {
|
|
2340
|
-
a.enqueue(
|
|
2340
|
+
a.enqueue(As);
|
|
2341
2341
|
break;
|
|
2342
2342
|
}
|
|
2343
2343
|
n = u * Math.pow(2, 32) + d.getUint32(4), i = 3;
|
|
@@ -2348,7 +2348,7 @@ function eo(t, e) {
|
|
|
2348
2348
|
a.enqueue(Ks(r ? c : Kt.decode(c), e)), i = 0;
|
|
2349
2349
|
}
|
|
2350
2350
|
if (n === 0 || n > t) {
|
|
2351
|
-
a.enqueue(
|
|
2351
|
+
a.enqueue(As);
|
|
2352
2352
|
break;
|
|
2353
2353
|
}
|
|
2354
2354
|
}
|
|
@@ -2965,13 +2965,13 @@ function Ts(t) {
|
|
|
2965
2965
|
let n = _o.exec(t || ""), r = {}, o = 14;
|
|
2966
2966
|
for (; o--; )
|
|
2967
2967
|
r[So[o]] = n[o] || "";
|
|
2968
|
-
return s != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = Ro(r, r.path), r.queryKey =
|
|
2968
|
+
return s != -1 && i != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = Ro(r, r.path), r.queryKey = Eo(r, r.query), r;
|
|
2969
2969
|
}
|
|
2970
2970
|
function Ro(t, e) {
|
|
2971
2971
|
const s = /\/{2,9}/g, i = e.replace(s, "/").split("/");
|
|
2972
2972
|
return (e.slice(0, 1) == "/" || e.length === 0) && i.splice(0, 1), e.slice(-1) == "/" && i.splice(i.length - 1, 1), i;
|
|
2973
2973
|
}
|
|
2974
|
-
function
|
|
2974
|
+
function Eo(t, e) {
|
|
2975
2975
|
const s = {};
|
|
2976
2976
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(i, n, r) {
|
|
2977
2977
|
n && (s[n] = r);
|
|
@@ -3252,7 +3252,7 @@ class me extends j {
|
|
|
3252
3252
|
}
|
|
3253
3253
|
}
|
|
3254
3254
|
me.protocol = gn;
|
|
3255
|
-
class
|
|
3255
|
+
class ko extends me {
|
|
3256
3256
|
constructor() {
|
|
3257
3257
|
super(...arguments), this._upgrades = [];
|
|
3258
3258
|
}
|
|
@@ -3324,7 +3324,7 @@ class Eo extends me {
|
|
|
3324
3324
|
return s;
|
|
3325
3325
|
}
|
|
3326
3326
|
}
|
|
3327
|
-
let
|
|
3327
|
+
let Ao = class extends ko {
|
|
3328
3328
|
constructor(e, s = {}) {
|
|
3329
3329
|
const i = typeof e == "object", n = i ? { ...e } : { ...s };
|
|
3330
3330
|
(!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((r) => wo[r]).filter((r) => !!r)), super(i ? n : e, n);
|
|
@@ -3511,7 +3511,7 @@ class Gs extends j {
|
|
|
3511
3511
|
if (o != Number(o) || e.charAt(s) !== "-")
|
|
3512
3512
|
throw new Error("Illegal attachments");
|
|
3513
3513
|
const a = Number(o);
|
|
3514
|
-
if (!
|
|
3514
|
+
if (!Bo(a) || a < 1)
|
|
3515
3515
|
throw new Error("Illegal attachments");
|
|
3516
3516
|
if (a > this.opts.maxAttachments)
|
|
3517
3517
|
throw new Error("too many attachments");
|
|
@@ -3603,13 +3603,13 @@ class No {
|
|
|
3603
3603
|
this.reconPack = null, this.buffers = [];
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
|
-
const
|
|
3606
|
+
const Bo = Number.isInteger || function(t) {
|
|
3607
3607
|
return typeof t == "number" && isFinite(t) && Math.floor(t) === t;
|
|
3608
3608
|
};
|
|
3609
3609
|
function wi(t) {
|
|
3610
3610
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
3611
3611
|
}
|
|
3612
|
-
const
|
|
3612
|
+
const jo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3613
3613
|
__proto__: null,
|
|
3614
3614
|
Decoder: Gs,
|
|
3615
3615
|
Encoder: Uo,
|
|
@@ -4254,7 +4254,7 @@ class Cs extends j {
|
|
|
4254
4254
|
max: this.reconnectionDelayMax(),
|
|
4255
4255
|
jitter: this.randomizationFactor()
|
|
4256
4256
|
}), this.timeout(s.timeout == null ? 2e4 : s.timeout), this._readyState = "closed", this.uri = e;
|
|
4257
|
-
const n = s.parser ||
|
|
4257
|
+
const n = s.parser || jo;
|
|
4258
4258
|
this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = s.autoConnect !== !1, this._autoConnect && this.open();
|
|
4259
4259
|
}
|
|
4260
4260
|
reconnection(e) {
|
|
@@ -4297,7 +4297,7 @@ class Cs extends j {
|
|
|
4297
4297
|
open(e) {
|
|
4298
4298
|
if (~this._readyState.indexOf("open"))
|
|
4299
4299
|
return this;
|
|
4300
|
-
this.engine = new
|
|
4300
|
+
this.engine = new Ao(this.uri, this.opts);
|
|
4301
4301
|
const s = this.engine, i = this;
|
|
4302
4302
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
4303
4303
|
const n = ie(s, "open", function() {
|
|
@@ -4887,7 +4887,7 @@ function ge(t, e) {
|
|
|
4887
4887
|
}
|
|
4888
4888
|
function Ho(t) {
|
|
4889
4889
|
let e = Promise.resolve();
|
|
4890
|
-
const s = (o =
|
|
4890
|
+
const s = (o = js(t.runtime().engine.getState().slices.conversation, t.runtime().engine.getState().slices.directory), a = Promise.resolve()) => {
|
|
4891
4891
|
const c = a.then(() => ({ ok: !0 }), (f) => ({ ok: !1, error: f })), d = o ? Object.values(o.submissions).filter((f) => f.delivery !== "accepted").slice(-8).map((f) => ({ submission: f, timer: J(t.onTiming, {
|
|
4892
4892
|
operation: "send",
|
|
4893
4893
|
layer: "http",
|
|
@@ -5133,7 +5133,7 @@ function Ho(t) {
|
|
|
5133
5133
|
}
|
|
5134
5134
|
class Ko {
|
|
5135
5135
|
constructor(e) {
|
|
5136
|
-
this.options = e, this.owner = `conversation:${e.authority.authorityId}:${e.authority.generation}`, this.deliveryRecovery = new
|
|
5136
|
+
this.options = e, this.owner = `conversation:${e.authority.authorityId}:${e.authority.generation}`, this.deliveryRecovery = new je({
|
|
5137
5137
|
activeIntervalMs: 3e3,
|
|
5138
5138
|
idleIntervalMs: 3e3,
|
|
5139
5139
|
maxFailureIntervalMs: 3e4,
|
|
@@ -5167,7 +5167,7 @@ class Ko {
|
|
|
5167
5167
|
}
|
|
5168
5168
|
if (s) for (const [r, o] of Object.entries(i)) {
|
|
5169
5169
|
if (!o.observe || this.observations.has(r)) continue;
|
|
5170
|
-
const a = `${this.owner}:${this.options.nextRequestId()}`, c = new
|
|
5170
|
+
const a = `${this.owner}:${this.options.nextRequestId()}`, c = new je({
|
|
5171
5171
|
activeIntervalMs: 3e3,
|
|
5172
5172
|
idleIntervalMs: 3e3,
|
|
5173
5173
|
maxFailureIntervalMs: 3e4,
|
|
@@ -5186,7 +5186,7 @@ class Ko {
|
|
|
5186
5186
|
const h = this.observations.get(r);
|
|
5187
5187
|
h?.subscription === c && h.subscriptionIdentity === l && this.subscriptionIdentity() === l && (h.subscribed = !0, c.stop()), this.observations.get(r)?.subscription !== c && await this.options.socket.release(r, a);
|
|
5188
5188
|
}
|
|
5189
|
-
}), d = new
|
|
5189
|
+
}), d = new je({
|
|
5190
5190
|
activeIntervalMs: 6e4,
|
|
5191
5191
|
idleIntervalMs: 6e4,
|
|
5192
5192
|
maxFailureIntervalMs: 6e4,
|
|
@@ -5201,7 +5201,7 @@ class Ko {
|
|
|
5201
5201
|
throw new Error("Conversation history cursor did not advance.");
|
|
5202
5202
|
}
|
|
5203
5203
|
}
|
|
5204
|
-
}), u = new
|
|
5204
|
+
}), u = new je({
|
|
5205
5205
|
activeIntervalMs: 15e3,
|
|
5206
5206
|
idleIntervalMs: 6e4,
|
|
5207
5207
|
maxFailureIntervalMs: 6e4,
|
|
@@ -5313,12 +5313,12 @@ function pe(t, e, s) {
|
|
|
5313
5313
|
let _ = g ? "submitting" : y ? "awaiting_execution" : l?.phase ?? "idle";
|
|
5314
5314
|
const b = Object.entries(t.stops).filter(([v]) => v === s || n !== null && e.selections[v]?.sessionId === n).map(([, v]) => v).find((v) => (!o.length || v.userMessageIds.includes(o[o.length - 1].userMessageId) || !g && !y && ne(l).some((C) => v.userMessageIds.includes(C))) && (!l || l.version <= v.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(l.phase) || o.some((C) => C.cancelled && C.executionVersion === null && v.userMessageIds.includes(C.userMessageId)))), I = l && ["thinking", "steering", "queued", "stopping"].includes(l.phase) || o.some((v) => v.delivery === "accepted" && v.executionVersion === null && b?.userMessageIds.includes(v.userMessageId));
|
|
5315
5315
|
b && I && !g && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) || ne(l).every((v) => b.userMessageIds.includes(v))) && (_ = "stopping"), b && !I && !g && o.some((v) => v.cancelled && v.executionVersion === null && b.userMessageIds.includes(v.userMessageId)) && (_ = o.some((v) => b.userMessageIds.includes(v.userMessageId) && ["sending", "uncertain"].includes(v.delivery)) ? "stopping" : "stopped");
|
|
5316
|
-
const w = ["thinking", "steering", "queued"].includes(_),
|
|
5316
|
+
const w = ["thinking", "steering", "queued"].includes(_), k = t.stops[s] ?? b, A = k?.userMessageIds.filter((v) => !["completed", "failed"].includes(r?.executionByUserMessage[v]?.phase ?? "")) ?? [], D = A.some((v) => {
|
|
5317
5317
|
const C = o.find(($) => $.userMessageId === v);
|
|
5318
5318
|
return !Object.values(t.operations).some(($) => $.command.type === "run.stop" && $.command.payload.expectedUserMessageId === v && $.phase === "done") && (C?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(C.delivery) || !!(l && ne(l).includes(v) && ["thinking", "steering", "queued", "stopping"].includes(l.phase)));
|
|
5319
|
-
}), S = l?.user_message_ids ?? [], q = g || y ? p?.userMessageId ?? null : S[S.length - 1] ?? null,
|
|
5319
|
+
}), S = l?.user_message_ids ?? [], q = g || y ? p?.userMessageId ?? null : S[S.length - 1] ?? null, E = u.find((v) => v.userMessageId === q), P = w ? [...E?.activityIds ?? []].reverse().find((v) => d[v] === "open") ?? null : null, T = n !== null && !!e.selections[s]?.provisionalId && a.length === 0 && o.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
|
|
5320
5320
|
(!r?.execution || r.execution.phase === "idle" && r.execution.user_message_ids.length === 0) && Object.values(t.operations).some((v) => v.conversationScopeId === s && v.phase === "done" && v.command.type === "attachment.prepare" && !v.command.payload.sessionId && v.result?.sessionId === n);
|
|
5321
|
-
return
|
|
5321
|
+
return V({
|
|
5322
5322
|
historyRefreshFailure: r?.historyRefreshFailure ?? null,
|
|
5323
5323
|
selectionKey: s ? JSON.stringify([t.authorityId, t.generation, s]) : void 0,
|
|
5324
5324
|
stableSelectionKey: s ? JSON.stringify([t.authorityId, s]) : void 0,
|
|
@@ -5334,7 +5334,7 @@ function pe(t, e, s) {
|
|
|
5334
5334
|
removedItems: r?.removedItems ?? {},
|
|
5335
5335
|
streamStates: d,
|
|
5336
5336
|
preparation: r?.preparation ?? null,
|
|
5337
|
-
stop:
|
|
5337
|
+
stop: k ? { ...k, userMessageIds: A, pending: D } : null,
|
|
5338
5338
|
segments: u.map((v, C) => ({ ...v, collapsed: w ? v.userMessageId !== q : C < u.length - 1 || v.activityIds.length > 0 })),
|
|
5339
5339
|
activity: { phase: _, activeItemId: P, userMessageId: q, executionKey: JSON.stringify([...ne(l)].sort()) },
|
|
5340
5340
|
// Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
|
|
@@ -5357,10 +5357,10 @@ function Rn(t, e) {
|
|
|
5357
5357
|
return t.sessionId && o ? { type: "execution", userMessageId: o, sessionId: t.sessionId } : null;
|
|
5358
5358
|
}
|
|
5359
5359
|
function Wo(t, e) {
|
|
5360
|
-
return
|
|
5360
|
+
return V({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((s) => [s, pe(t, e, s)])) });
|
|
5361
5361
|
}
|
|
5362
5362
|
const Go = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
5363
|
-
function
|
|
5363
|
+
function Ae(t, e) {
|
|
5364
5364
|
return e ? t.replace(
|
|
5365
5365
|
Go,
|
|
5366
5366
|
(s, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
|
|
@@ -5411,21 +5411,21 @@ function Jo(t, e, s, i) {
|
|
|
5411
5411
|
};
|
|
5412
5412
|
switch (t.type) {
|
|
5413
5413
|
case "user_message":
|
|
5414
|
-
return { ...r, role: "user", content:
|
|
5414
|
+
return { ...r, role: "user", content: Ae(t.data.content, i), attachments: t.data.attachments.map((o) => Si(o, i)) };
|
|
5415
5415
|
case "final_response":
|
|
5416
5416
|
return {
|
|
5417
5417
|
...r,
|
|
5418
5418
|
role: "assistant",
|
|
5419
5419
|
phase: "final_answer",
|
|
5420
|
-
content:
|
|
5420
|
+
content: Ae(t.data.content, i),
|
|
5421
5421
|
attachments: t.data.attachments.map((o) => Si(o, i)),
|
|
5422
5422
|
loading: n,
|
|
5423
5423
|
streamState: s
|
|
5424
5424
|
};
|
|
5425
5425
|
case "commentary":
|
|
5426
|
-
return { ...r, role: "tool", phase: "commentary", dataType: "commentary_history", content:
|
|
5426
|
+
return { ...r, role: "tool", phase: "commentary", dataType: "commentary_history", content: Ae(t.data.content, i), loading: n };
|
|
5427
5427
|
case "tool_summary":
|
|
5428
|
-
return { ...r, role: "tool", dataType: "tool_summary", content:
|
|
5428
|
+
return { ...r, role: "tool", dataType: "tool_summary", content: Ae(t.data.content, i), loading: n };
|
|
5429
5429
|
// The supported public renderer recognizes run_error; a bare error system row is silently omitted.
|
|
5430
5430
|
case "error":
|
|
5431
5431
|
return {
|
|
@@ -5467,7 +5467,7 @@ function Wt(t, e, s, i) {
|
|
|
5467
5467
|
const o = r, a = { ...t.removedItems };
|
|
5468
5468
|
for (const S of t.segments) {
|
|
5469
5469
|
if (!S.userMessageId) continue;
|
|
5470
|
-
const q = r.find((
|
|
5470
|
+
const q = r.find((E) => S.outcomeIds.includes(E.id) && !E.loading && (E.dataType === "run_status" || E.dataType === "run_error" || E.role === "assistant" && E.phase === "final_answer" && E.streamState === "finished"));
|
|
5471
5471
|
q && (a[`local-interrupted:${S.userMessageId}`] = q.id);
|
|
5472
5472
|
}
|
|
5473
5473
|
const c = t.activity.phase, d = t.submissions.filter((S) => !S.cancelled && !["accepted", "failed"].includes(S.delivery)), u = t.submissions[t.submissions.length - 1], l = [...t.items].reverse().find((S) => S.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 || l !== void 0 && l.id !== u.userMessageId && Date.parse(l.created_at) > u.submittedAt), m = new Map(t.submissions.filter((S) => (S !== u || f) && !S.cancelled && S.delivery === "failed" && S.error).map((S) => [S.userMessageId, S])), p = o.flatMap((S) => {
|
|
@@ -5484,10 +5484,10 @@ function Wt(t, e, s, i) {
|
|
|
5484
5484
|
}] : [S];
|
|
5485
5485
|
}), g = e?.error != null && t.historyRefreshFailure != null && t.historyRefreshFailure.consecutiveFailures < 4, y = g ? null : e?.error ?? null, _ = [...t.submissions].reverse().find((S) => t.pendingDurabilityIds?.includes(S.userMessageId)), b = _ ? {
|
|
5486
5486
|
code: "submission_checkpoint_pending",
|
|
5487
|
-
message:
|
|
5487
|
+
message: kr,
|
|
5488
5488
|
details: { requestId: _.requestId }
|
|
5489
5489
|
} : null, I = u?.delivery === "failed" && !u.cancelled && !f ? u.error : y ?? b;
|
|
5490
|
-
let
|
|
5490
|
+
let k = {
|
|
5491
5491
|
isRetrying: t.isRetrying ?? !1,
|
|
5492
5492
|
historyRefreshFailure: I === e?.error ? t.historyRefreshFailure ?? null : null,
|
|
5493
5493
|
conversationDiagnostics: {
|
|
@@ -5530,21 +5530,21 @@ function Wt(t, e, s, i) {
|
|
|
5530
5530
|
lastErrorSecuritySettingsUrl: typeof I?.details?.securitySettingsUrl == "string" ? I.details.securitySettingsUrl : null
|
|
5531
5531
|
};
|
|
5532
5532
|
for (const S of t.optimistic.filter((q) => q.cancelled && !t.stop?.userMessageIds.includes(q.userMessageId))) {
|
|
5533
|
-
const q = Os(
|
|
5534
|
-
|
|
5533
|
+
const q = Os(k, "", "stopped", [S.userMessageId], Ri(S.cancellationReason));
|
|
5534
|
+
k = { ...k, messages: q.messages, segments: q.segments };
|
|
5535
5535
|
}
|
|
5536
5536
|
if (t.stop) {
|
|
5537
5537
|
const S = Os(
|
|
5538
|
-
|
|
5538
|
+
k,
|
|
5539
5539
|
"",
|
|
5540
5540
|
t.stop.pending ? "stopping" : "stopped",
|
|
5541
5541
|
t.stop.userMessageIds,
|
|
5542
5542
|
Ri(t.stop.reason ?? "user_requested")
|
|
5543
5543
|
);
|
|
5544
|
-
|
|
5544
|
+
k = { ...k, messages: S.messages, segments: S.segments };
|
|
5545
5545
|
}
|
|
5546
|
-
const
|
|
5547
|
-
return { ...
|
|
5546
|
+
const A = new Map(k.segments.flatMap((S, q) => [S.userMessageId, ...S.activityIds, ...S.outcomeIds].filter((E) => E !== null).map((E) => [E, q]))), D = (S) => A.get(S.id) ?? A.get(S.respondsToUserMessageId ?? "") ?? 1 / 0;
|
|
5547
|
+
return { ...k, messages: [...k.messages].sort((S, q) => D(S) - D(q)) };
|
|
5548
5548
|
}
|
|
5549
5549
|
function Ri(t) {
|
|
5550
5550
|
switch (t) {
|
|
@@ -5594,7 +5594,7 @@ function gt(t) {
|
|
|
5594
5594
|
updatedAt: null
|
|
5595
5595
|
};
|
|
5596
5596
|
}
|
|
5597
|
-
class
|
|
5597
|
+
class Ei {
|
|
5598
5598
|
constructor(e, s, i = (n, r) => r) {
|
|
5599
5599
|
this.loader = s, this.merge = i, this.state = gt(e);
|
|
5600
5600
|
}
|
|
@@ -5703,7 +5703,7 @@ function il(t) {
|
|
|
5703
5703
|
};
|
|
5704
5704
|
}
|
|
5705
5705
|
const Zo = "Pluno is reconnecting. Try again in a moment.";
|
|
5706
|
-
function
|
|
5706
|
+
function ki(t) {
|
|
5707
5707
|
return (t instanceof Error ? t.message : t) === Zo;
|
|
5708
5708
|
}
|
|
5709
5709
|
function ea() {
|
|
@@ -5712,8 +5712,8 @@ function ea() {
|
|
|
5712
5712
|
const e = Array.from(t, (s) => s.toString(16).padStart(2, "0")).join("");
|
|
5713
5713
|
return `${e.slice(0, 8)}-${e.slice(8, 12)}-${e.slice(12, 16)}-${e.slice(16, 20)}-${e.slice(20)}`;
|
|
5714
5714
|
}
|
|
5715
|
-
const
|
|
5716
|
-
class
|
|
5715
|
+
const Ai = (t) => t && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(t) ? t : null;
|
|
5716
|
+
class En {
|
|
5717
5717
|
constructor(e) {
|
|
5718
5718
|
this.options = e, this.auth = e.auth;
|
|
5719
5719
|
}
|
|
@@ -5763,28 +5763,28 @@ class An {
|
|
|
5763
5763
|
}
|
|
5764
5764
|
async requestOnce(e, s, i, n, r, o, a, c = 1) {
|
|
5765
5765
|
const d = this.auth.client_kind === "embed", u = new URL(`/api/product-agent/${r ?? (d ? "embed" : "runtime")}${e}`, this.options.backendUrl), l = r === "conversations" ? {} : d ? { client_id: this.auth.client_id, transport_id: this.auth.transport_id } : { community_id: this.auth.community_id, automation_run_id: this.auth.automation_run_id };
|
|
5766
|
-
for (const [
|
|
5767
|
-
P != null && u.searchParams.set(
|
|
5766
|
+
for (const [E, P] of Object.entries({ ...l, ...s }))
|
|
5767
|
+
P != null && u.searchParams.set(E, String(P));
|
|
5768
5768
|
this.requests.signal.throwIfAborted(), o?.throwIfAborted();
|
|
5769
|
-
const h = new AbortController(), f = { trigger: null }, m = (
|
|
5770
|
-
h.signal.aborted || (f.trigger =
|
|
5769
|
+
const h = new AbortController(), f = { trigger: null }, m = (E) => {
|
|
5770
|
+
h.signal.aborted || (f.trigger = E, h.abort());
|
|
5771
5771
|
}, p = () => m("transport_disposed"), g = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(o?.reason) ? o.reason : "caller_cancelled");
|
|
5772
5772
|
this.requests.signal.addEventListener("abort", p, { once: !0 }), o?.addEventListener("abort", g, { once: !0 });
|
|
5773
5773
|
const y = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", _ = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", b = setTimeout(() => m("deadline"), _ ? 6e4 : y ? 3e4 : 15e3), I = ea(), w = Date.now();
|
|
5774
|
-
let
|
|
5774
|
+
let k = null, A = !1, D = null, S = null, q = null;
|
|
5775
5775
|
try {
|
|
5776
|
-
const
|
|
5776
|
+
const E = await Promise.resolve(fetch(u, {
|
|
5777
5777
|
method: n ?? (i === void 0 ? "GET" : "POST"),
|
|
5778
5778
|
cache: "no-store",
|
|
5779
5779
|
signal: h.signal,
|
|
5780
5780
|
headers: { "x-product-agent-auth-request-id": I, authorization: d || r === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...y ? { "x-request-id": I } : {} },
|
|
5781
5781
|
...i === void 0 ? {} : { body: JSON.stringify(i) }
|
|
5782
5782
|
})).catch((P) => {
|
|
5783
|
-
throw
|
|
5783
|
+
throw A = !0, P;
|
|
5784
5784
|
});
|
|
5785
|
-
if (
|
|
5786
|
-
const P =
|
|
5787
|
-
if (
|
|
5785
|
+
if (k = Date.now(), D = E.status, S = Ai(E.headers.get("x-request-id")), q = Ai(E.headers.get("x-cloud-trace-context")), !E.ok) {
|
|
5786
|
+
const P = E.status === 401 ? "unauthorized" : E.status === 426 ? "update_required" : String(E.status), T = (await E.json().catch(() => null))?.detail;
|
|
5787
|
+
if (E.status === 410 && T?.code === "personal_product_agent_retired" && typeof T.message == "string")
|
|
5788
5788
|
throw new R(
|
|
5789
5789
|
T.message,
|
|
5790
5790
|
T.code,
|
|
@@ -5792,33 +5792,33 @@ class An {
|
|
|
5792
5792
|
{ retryable: !1 },
|
|
5793
5793
|
r === "conversations" && e === "/commands"
|
|
5794
5794
|
);
|
|
5795
|
-
if (d &&
|
|
5795
|
+
if (d && E.status === 403 && (r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) || (!r || r === "embed") && /^\/conversations\/[^/]+$/.test(e)) && ["Conversation unavailable", "Integration mismatch", "Embedded origin mismatch"].includes(T))
|
|
5796
5796
|
throw new R("Conversation unavailable", "conversation_access_denied");
|
|
5797
|
-
if (r === "conversations" && e.endsWith("/snapshot") &&
|
|
5797
|
+
if (r === "conversations" && e.endsWith("/snapshot") && E.status === 409 && T === "Display projection is not enabled")
|
|
5798
5798
|
throw new R("Conversation history is unavailable. Try loading this chat again after the service is ready.", "display_projection_disabled");
|
|
5799
|
-
if (r === "conversations" && e === "/commands" &&
|
|
5799
|
+
if (r === "conversations" && e === "/commands" && E.status === 409 && (T === "embedded_submission_conflict" || T === "embedded_submission_snapshot_unavailable"))
|
|
5800
5800
|
throw new R(T === "embedded_submission_conflict" ? "This message conflicts with an earlier submission. Review the conversation before retrying." : "This earlier submission cannot be verified. Review the conversation before retrying.", T, !1, void 0, !0);
|
|
5801
|
-
if (r === "conversations" && e === "/commands" && (
|
|
5801
|
+
if (r === "conversations" && e === "/commands" && (E.status === 409 && T?.code === "executor_not_ready" && T.retryable === !0 || E.status === 403 && T === "Register the executor before commands"))
|
|
5802
5802
|
throw new R("Reconnecting the browser before continuing.", "executor_not_ready");
|
|
5803
|
-
if (
|
|
5803
|
+
if (E.status !== 401 && T && typeof T == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(T.code) || !wt(void 0, T.code).allowed) && typeof T.message == "string")
|
|
5804
5804
|
throw new R(T.message, T.code, !1, {
|
|
5805
5805
|
...typeof T.blockedOrigin == "string" ? { blockedOrigin: T.blockedOrigin } : {},
|
|
5806
5806
|
...typeof T.securitySettingsUrl == "string" ? { securitySettingsUrl: T.securitySettingsUrl } : {}
|
|
5807
5807
|
}, r === "conversations" && e === "/commands");
|
|
5808
|
-
const v = T === "Token expired" ? "token_expired" : T === "Invalid token" ? "invalid_token" : T?.reason, C =
|
|
5809
|
-
throw new R(
|
|
5808
|
+
const v = T === "Token expired" ? "token_expired" : T === "Invalid token" ? "invalid_token" : T?.reason, C = E.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(v) ? { requestId: I, authTransport: "http", authEndpoint: `${r ?? (d ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: v, retryable: v === "token_expired" && (T === "Token expired" || T.retryable === !0) } : void 0;
|
|
5809
|
+
throw new R(E.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : E.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${E.status})`, P, !1, C);
|
|
5810
5810
|
}
|
|
5811
|
-
return await
|
|
5812
|
-
} catch (
|
|
5813
|
-
const P = f.trigger ?? ((
|
|
5811
|
+
return await E.json();
|
|
5812
|
+
} catch (E) {
|
|
5813
|
+
const P = f.trigger ?? ((E instanceof Error || E instanceof DOMException) && E.name === "AbortError" ? "unexpected_abort" : null), T = {
|
|
5814
5814
|
requestId: I,
|
|
5815
5815
|
method: n ?? (i === void 0 ? "GET" : "POST"),
|
|
5816
5816
|
route: y ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
|
|
5817
5817
|
status: D,
|
|
5818
5818
|
abortTrigger: P,
|
|
5819
|
-
category: P === "deadline" ? "request_timed_out" : P === "unexpected_abort" ? "connection_interrupted" : P ? "request_cancelled" :
|
|
5820
|
-
responseHeadersMs:
|
|
5821
|
-
responseBodyMs:
|
|
5819
|
+
category: P === "deadline" ? "request_timed_out" : P === "unexpected_abort" ? "connection_interrupted" : P ? "request_cancelled" : E instanceof R ? E.code : A ? "connection_interrupted" : "invalid_response",
|
|
5820
|
+
responseHeadersMs: k === null ? null : Math.max(0, k - w),
|
|
5821
|
+
responseBodyMs: k === null ? null : Math.max(0, Date.now() - k),
|
|
5822
5822
|
owner: P === "deadline" ? "http_deadline" : P === "transport_disposed" ? "http_transport" : P && P !== "unexpected_abort" ? "conversation_query" : D === null ? "browser" : "http_response",
|
|
5823
5823
|
elapsedMs: Math.max(0, Date.now() - w),
|
|
5824
5824
|
attempt: c,
|
|
@@ -5842,12 +5842,12 @@ class An {
|
|
|
5842
5842
|
v
|
|
5843
5843
|
);
|
|
5844
5844
|
}
|
|
5845
|
-
throw
|
|
5846
|
-
|
|
5845
|
+
throw E instanceof R && v ? new R(E.message, E.code, E.outcomeUnknown, { ...E.detail, ...v }, E.backendRefusal) : v ? new R(
|
|
5846
|
+
A ? "The connection was interrupted. Please try again." : y ? "The conversation response could not be read. Please try again." : "The response could not be read. Please try again.",
|
|
5847
5847
|
"connection_interrupted",
|
|
5848
5848
|
!0,
|
|
5849
5849
|
v
|
|
5850
|
-
) :
|
|
5850
|
+
) : E;
|
|
5851
5851
|
} finally {
|
|
5852
5852
|
clearTimeout(b), this.requests.signal.removeEventListener("abort", p), o?.removeEventListener("abort", g);
|
|
5853
5853
|
}
|
|
@@ -5860,7 +5860,7 @@ function Ve(t) {
|
|
|
5860
5860
|
}
|
|
5861
5861
|
return t;
|
|
5862
5862
|
}
|
|
5863
|
-
function
|
|
5863
|
+
function kn() {
|
|
5864
5864
|
return Ve({
|
|
5865
5865
|
authorityId: null,
|
|
5866
5866
|
generation: 0,
|
|
@@ -5910,7 +5910,7 @@ function ve(t) {
|
|
|
5910
5910
|
const e = t.origin.trim();
|
|
5911
5911
|
return { ...t, origin: e.includes("://") ? new URL(e).origin : e.toLowerCase() };
|
|
5912
5912
|
}
|
|
5913
|
-
function
|
|
5913
|
+
function An(t, e) {
|
|
5914
5914
|
return t.request(`/conversations/${encodeURIComponent(e)}`, {}, void 0, "GET", t.auth.client_kind === "extension" ? "extension" : void 0);
|
|
5915
5915
|
}
|
|
5916
5916
|
function Ti(t) {
|
|
@@ -5942,7 +5942,7 @@ function ia(t) {
|
|
|
5942
5942
|
if (t.http.auth.client_kind === "embed") {
|
|
5943
5943
|
const a = await t.http.request("/conversations", { ...r, page_url: n.origin ?? t.pageUrl() });
|
|
5944
5944
|
Ue(t, i), o = { entries: await Promise.all(a.sessions.map(async (d) => ({
|
|
5945
|
-
...await
|
|
5945
|
+
...await An(t.http, d.id),
|
|
5946
5946
|
...typeof d.isActive == "boolean" ? { is_active: d.isActive } : {}
|
|
5947
5947
|
}))), next_cursor: a.nextCursor };
|
|
5948
5948
|
} else
|
|
@@ -5991,12 +5991,12 @@ class na {
|
|
|
5991
5991
|
s && e[n]?.observe || (r.metadata.stop(), r.recovery?.transcript.stop(), r.recovery?.activity.stop(), this.observations.delete(n), this.options.socket?.release(n, this.owner).catch((o) => this.report(o)));
|
|
5992
5992
|
if (s) for (const [n, r] of Object.entries(e)) {
|
|
5993
5993
|
if (!r.observe || this.observations.has(n)) continue;
|
|
5994
|
-
const o = this.options.recovery?.(n), a = new
|
|
5994
|
+
const o = this.options.recovery?.(n), a = new je({
|
|
5995
5995
|
...Gt,
|
|
5996
5996
|
isActiveTurn: () => this.options.isActiveTurn(n),
|
|
5997
5997
|
poll: async () => {
|
|
5998
5998
|
try {
|
|
5999
|
-
return await
|
|
5999
|
+
return await An(this.options.http, n);
|
|
6000
6000
|
} catch (c) {
|
|
6001
6001
|
throw this.options.onError(c), c;
|
|
6002
6002
|
}
|
|
@@ -6285,9 +6285,9 @@ function ca(t, e, s = () => crypto.randomUUID()) {
|
|
|
6285
6285
|
};
|
|
6286
6286
|
}
|
|
6287
6287
|
}
|
|
6288
|
-
class
|
|
6288
|
+
class B extends EventTarget {
|
|
6289
6289
|
constructor(e) {
|
|
6290
|
-
super(), this.options = e, this.httpTransport = new
|
|
6290
|
+
super(), this.options = e, this.httpTransport = new En({
|
|
6291
6291
|
...e,
|
|
6292
6292
|
executorConnection: () => this.connectionId,
|
|
6293
6293
|
restoreExecutor: (s) => this.restoreExecutor(s)
|
|
@@ -6879,7 +6879,7 @@ function _e(t, e, s) {
|
|
|
6879
6879
|
if (e.expectedGeneration !== t.generation || e.generation <= t.generation) return { state: t, effects: n };
|
|
6880
6880
|
const r = e.adoptLocalSubmissions && !t.authorityId ? Object.fromEntries(Object.entries(t.clients).filter(([, o]) => t.selections[o]?.sessionId === null)) : {};
|
|
6881
6881
|
i = {
|
|
6882
|
-
...
|
|
6882
|
+
...kn(),
|
|
6883
6883
|
authorityId: e.authorityId,
|
|
6884
6884
|
generation: e.generation,
|
|
6885
6885
|
clients: r,
|
|
@@ -7113,7 +7113,7 @@ class va {
|
|
|
7113
7113
|
return this.state;
|
|
7114
7114
|
}
|
|
7115
7115
|
recordDiagnosticTransition(e, s = !1) {
|
|
7116
|
-
let i =
|
|
7116
|
+
let i = Br(e, this.diagnostics.revision + 1, s);
|
|
7117
7117
|
if (i?.effectId) {
|
|
7118
7118
|
if (i.type === "effect.started")
|
|
7119
7119
|
this.diagnosticEffects.set(i.effectId, i), this.diagnosticEffects.size > 128 && this.diagnosticEffects.delete(this.diagnosticEffects.keys().next().value);
|
|
@@ -7317,11 +7317,11 @@ class Ra {
|
|
|
7317
7317
|
constructor(e = _a, s = {}, i) {
|
|
7318
7318
|
this.conversationPorts = { ...Sa, ...s }, this.featurePorts = i ?? {}, this.engine = new va({
|
|
7319
7319
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({
|
|
7320
|
-
account:
|
|
7321
|
-
features:
|
|
7322
|
-
interactions:
|
|
7320
|
+
account: V(ps()),
|
|
7321
|
+
features: V(ms()),
|
|
7322
|
+
interactions: V(fs()),
|
|
7323
7323
|
modelSelection: ha(),
|
|
7324
|
-
directory:
|
|
7324
|
+
directory: kn(),
|
|
7325
7325
|
conversation: sn()
|
|
7326
7326
|
}) }),
|
|
7327
7327
|
reducer: (n, r) => {
|
|
@@ -7329,11 +7329,11 @@ class Ra {
|
|
|
7329
7329
|
if (o.type.startsWith("stage7.") || (o.type === "effect.completed" || o.type === "effect.failed") && o.effectKind.startsWith("stage7.")) {
|
|
7330
7330
|
const c = di(n.slices, o, n.slices);
|
|
7331
7331
|
if (c.state === n.slices) return { state: n, effects: c.effects };
|
|
7332
|
-
const d =
|
|
7332
|
+
const d = V(X({ account: c.state.account, features: c.state.features, interactions: c.state.interactions }));
|
|
7333
7333
|
return { state: Object.freeze({ revision: n.revision + 1, slices: Object.freeze({ ...n.slices, ...d }) }), effects: c.effects };
|
|
7334
7334
|
}
|
|
7335
7335
|
if (Ia(o)) {
|
|
7336
|
-
const c = _e(n.slices.directory, o, n.slices.conversation), d =
|
|
7336
|
+
const c = _e(n.slices.directory, o, n.slices.conversation), d = ks(Ss(n.slices.conversation, c.state, o.type === "directory.authority_replace" && o.adoptLocalSubmissions === !0)), u = Rs(n.slices.conversation, d.state, c.state, c.state.clients !== n.slices.directory.clients), l = u.state, h = Di(n.slices.conversation, l, c.state);
|
|
7337
7337
|
return { state: h === n.slices.directory && l === n.slices.conversation ? n : Object.freeze({
|
|
7338
7338
|
revision: n.revision + 1,
|
|
7339
7339
|
slices: Object.freeze({ ...n.slices, directory: h, conversation: l })
|
|
@@ -7370,12 +7370,12 @@ class Ra {
|
|
|
7370
7370
|
}).state);
|
|
7371
7371
|
}
|
|
7372
7372
|
d = Di(n.slices.conversation, c.state, d);
|
|
7373
|
-
const l =
|
|
7373
|
+
const l = ks(Ss(c.state, d)), h = Rs(c.state, l.state, d);
|
|
7374
7374
|
let f = n.slices;
|
|
7375
7375
|
const m = [], p = c.interactionSources, g = f.account.authority;
|
|
7376
7376
|
if (p && g && g.authorityId === p.authorityId && g.generation === p.generation) {
|
|
7377
7377
|
const y = di(f, { type: "stage7.sources", authority: g, now: f.features.now, sources: p.sources }, { conversation: h.state, directory: d });
|
|
7378
|
-
f =
|
|
7378
|
+
f = V(X({ account: y.state.account, features: y.state.features, interactions: y.state.interactions })), m.push(...y.effects);
|
|
7379
7379
|
}
|
|
7380
7380
|
return { state: h.state === n.slices.conversation && d === n.slices.directory && f === n.slices ? n : Object.freeze({
|
|
7381
7381
|
revision: n.revision + 1,
|
|
@@ -7455,7 +7455,7 @@ class Ra {
|
|
|
7455
7455
|
}
|
|
7456
7456
|
}
|
|
7457
7457
|
}
|
|
7458
|
-
const
|
|
7458
|
+
const Ea = "pluno-product-agent-attachments", ka = 1, Ds = "files", Aa = 1440 * 60 * 1e3;
|
|
7459
7459
|
async function Ta(t) {
|
|
7460
7460
|
const e = await Ot();
|
|
7461
7461
|
await Mn(e, "readwrite", (s) => s.put(t));
|
|
@@ -7483,7 +7483,7 @@ async function qn(t, e) {
|
|
|
7483
7483
|
});
|
|
7484
7484
|
});
|
|
7485
7485
|
}
|
|
7486
|
-
async function qa(t =
|
|
7486
|
+
async function qa(t = Aa) {
|
|
7487
7487
|
const e = await Ot(), s = Date.now() - t;
|
|
7488
7488
|
await Js(e, "readwrite", async (i) => {
|
|
7489
7489
|
const n = i.index("lastUsedAt");
|
|
@@ -7492,7 +7492,7 @@ async function qa(t = ka) {
|
|
|
7492
7492
|
}
|
|
7493
7493
|
function Ot() {
|
|
7494
7494
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
|
|
7495
|
-
const s = indexedDB.open(
|
|
7495
|
+
const s = indexedDB.open(Ea, ka);
|
|
7496
7496
|
s.onupgradeneeded = () => {
|
|
7497
7497
|
const n = s.result.createObjectStore(Ds, { keyPath: "attachmentId" });
|
|
7498
7498
|
n.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), n.createIndex("sessionId", "sessionId", { unique: !1 }), n.createIndex("origin", "origin", { unique: !1 });
|
|
@@ -7569,7 +7569,7 @@ function xa(t) {
|
|
|
7569
7569
|
const Qt = "pluno.productAgent.transportId", Da = "pluno.productAgent.transportIdentity", Xt = "pluno.productAgent.transportIdentity.event", Ua = 50, Na = globalThis.setTimeout.bind(globalThis);
|
|
7570
7570
|
let Ne = null;
|
|
7571
7571
|
const vt = /* @__PURE__ */ new Set(), Yt = /* @__PURE__ */ new Map();
|
|
7572
|
-
async function
|
|
7572
|
+
async function Ba(t = Pn()) {
|
|
7573
7573
|
const e = t.randomUUID(), s = t.storage.getItem(Qt);
|
|
7574
7574
|
let i = s ?? t.randomUUID(), n = !1, r = !1;
|
|
7575
7575
|
const o = t.channel.subscribe((c) => {
|
|
@@ -7607,8 +7607,8 @@ async function ja(t = Pn()) {
|
|
|
7607
7607
|
}
|
|
7608
7608
|
};
|
|
7609
7609
|
}
|
|
7610
|
-
async function
|
|
7611
|
-
Ne || (Ne =
|
|
7610
|
+
async function ja(t = !1) {
|
|
7611
|
+
Ne || (Ne = Ba({
|
|
7612
7612
|
...Pn(),
|
|
7613
7613
|
skipStoredIdentityCollisionCheck: t
|
|
7614
7614
|
}), Ne.then((n) => {
|
|
@@ -7787,7 +7787,7 @@ function ts(t, e, s, i) {
|
|
|
7787
7787
|
}
|
|
7788
7788
|
class nl {
|
|
7789
7789
|
constructor(e, s, i = 20) {
|
|
7790
|
-
this.loadPage = s, this.limit = i, this.recentQuery = new
|
|
7790
|
+
this.loadPage = s, this.limit = i, this.recentQuery = new Ei(
|
|
7791
7791
|
`${e}:recent`,
|
|
7792
7792
|
async ({ cursor: n }) => yt(
|
|
7793
7793
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
@@ -7796,7 +7796,7 @@ class nl {
|
|
|
7796
7796
|
}))
|
|
7797
7797
|
),
|
|
7798
7798
|
Xo
|
|
7799
|
-
), this.pinnedQuery = new
|
|
7799
|
+
), this.pinnedQuery = new Ei(
|
|
7800
7800
|
`${e}:pinned`,
|
|
7801
7801
|
async () => yt({
|
|
7802
7802
|
entities: await this.loadAllPinned(),
|
|
@@ -7964,7 +7964,7 @@ class rl {
|
|
|
7964
7964
|
const i = JSON.stringify([s.conversation_id, s.id]), n = this.sources.get(i);
|
|
7965
7965
|
if (!(n && n.version >= s.version)) {
|
|
7966
7966
|
if (n && n.payload.kind !== s.payload.kind) throw new Error("Interaction kind changed.");
|
|
7967
|
-
s.payload.kind === "integration_auth" && (this.sources.set(i,
|
|
7967
|
+
s.payload.kind === "integration_auth" && (this.sources.set(i, V(X(s))), s.payload.kind === "integration_auth" && this.invalidateAuth(s.payload.request_id));
|
|
7968
7968
|
}
|
|
7969
7969
|
}
|
|
7970
7970
|
}
|
|
@@ -8105,8 +8105,8 @@ const Ya = {
|
|
|
8105
8105
|
stopped: "⏹️"
|
|
8106
8106
|
}, Za = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
8107
8107
|
function ec(t, e) {
|
|
8108
|
-
if (!e) return
|
|
8109
|
-
const s =
|
|
8108
|
+
if (!e) return Et(t);
|
|
8109
|
+
const s = Et(t), i = `${Ya[e]} Pluno`;
|
|
8110
8110
|
return s ? `${i}: ${s}` : i;
|
|
8111
8111
|
}
|
|
8112
8112
|
class al {
|
|
@@ -8131,10 +8131,10 @@ class al {
|
|
|
8131
8131
|
}
|
|
8132
8132
|
applyStatus(e) {
|
|
8133
8133
|
const s = this.titleDocument.getTitle();
|
|
8134
|
-
s !== this.lastAppliedTitle && (this.baseTitle =
|
|
8134
|
+
s !== this.lastAppliedTitle && (this.baseTitle = Et(s)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
8135
8135
|
}
|
|
8136
8136
|
applyClear() {
|
|
8137
|
-
const e = this.titleDocument.getTitle(), s = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ?
|
|
8137
|
+
const e = this.titleDocument.getTitle(), s = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? Et(e) : e;
|
|
8138
8138
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, s ? this.titleDocument.setTitle(this.baseTitle) : i !== e && this.titleDocument.setTitle(i);
|
|
8139
8139
|
}
|
|
8140
8140
|
handleTitleChanged() {
|
|
@@ -8163,7 +8163,7 @@ function cl(t) {
|
|
|
8163
8163
|
}
|
|
8164
8164
|
};
|
|
8165
8165
|
}
|
|
8166
|
-
function
|
|
8166
|
+
function Et(t) {
|
|
8167
8167
|
return t.replace(Za, "");
|
|
8168
8168
|
}
|
|
8169
8169
|
const tc = {
|
|
@@ -8318,7 +8318,7 @@ class ll {
|
|
|
8318
8318
|
o.sessionId !== e.sessionId && !(o.sessionId === null && h) || (l.attachments = ic(h?.attachments, l.attachments));
|
|
8319
8319
|
}
|
|
8320
8320
|
if (i && JSON.stringify(i) !== JSON.stringify(this.sessionHistoryState)) {
|
|
8321
|
-
this.sessionHistoryState =
|
|
8321
|
+
this.sessionHistoryState = Bi(i);
|
|
8322
8322
|
for (const l of this.sessionHistoryListeners)
|
|
8323
8323
|
l(this.getSessionHistoryState());
|
|
8324
8324
|
}
|
|
@@ -8484,11 +8484,11 @@ class ll {
|
|
|
8484
8484
|
return r;
|
|
8485
8485
|
} catch (u) {
|
|
8486
8486
|
if (i !== this.submissionGeneration) return null;
|
|
8487
|
-
if (
|
|
8487
|
+
if (ki(u))
|
|
8488
8488
|
for (const m of s.attachments ?? [])
|
|
8489
8489
|
m.id && this.attachmentFiles.delete(m.id);
|
|
8490
8490
|
const h = Q(u).code === "command_not_received";
|
|
8491
|
-
!c && !
|
|
8491
|
+
!c && !ki(u) && (d || h || s.selectionKey !== void 0) && this.submissionRetries.set(r, {
|
|
8492
8492
|
retry: async () => (d && await this.connect(), this.sendMessageNow(e, { ...s, reconcileAcceptance: !d && !h }, i)),
|
|
8493
8493
|
attachmentIds: (s.attachments ?? []).flatMap((m) => m.id ? [m.id] : [])
|
|
8494
8494
|
});
|
|
@@ -8647,7 +8647,7 @@ class ll {
|
|
|
8647
8647
|
return s.sessionHistoryPage;
|
|
8648
8648
|
}
|
|
8649
8649
|
getSessionHistoryState() {
|
|
8650
|
-
return
|
|
8650
|
+
return Bi(this.sessionHistoryState);
|
|
8651
8651
|
}
|
|
8652
8652
|
subscribeSessionHistory(e) {
|
|
8653
8653
|
return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
|
|
@@ -8757,7 +8757,7 @@ function it(t) {
|
|
|
8757
8757
|
activeScheduledFollowUps: t.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
|
|
8758
8758
|
};
|
|
8759
8759
|
}
|
|
8760
|
-
function
|
|
8760
|
+
function Bi(t) {
|
|
8761
8761
|
return {
|
|
8762
8762
|
...t,
|
|
8763
8763
|
data: t.data ? yt({
|
|
@@ -8766,7 +8766,7 @@ function ji(t) {
|
|
|
8766
8766
|
}) : null
|
|
8767
8767
|
};
|
|
8768
8768
|
}
|
|
8769
|
-
const
|
|
8769
|
+
const ji = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', nc = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', rc = ".pluno-pa-widget__panel", oc = ".pluno-pa-widget__timeline", ac = "__plunoExtensionWidgetOwner";
|
|
8770
8770
|
class ce extends Error {
|
|
8771
8771
|
constructor(e, s, i, n) {
|
|
8772
8772
|
super(e), this.retryable = s, this.status = i, this.retryAfterMs = n, this.name = "ProductAgentTokenProviderError";
|
|
@@ -8791,8 +8791,7 @@ function is(t) {
|
|
|
8791
8791
|
"status",
|
|
8792
8792
|
"reason",
|
|
8793
8793
|
"phase",
|
|
8794
|
-
"elapsedMs"
|
|
8795
|
-
"e2bEventSequence"
|
|
8794
|
+
"elapsedMs"
|
|
8796
8795
|
]) {
|
|
8797
8796
|
const d = t[c];
|
|
8798
8797
|
(typeof d == "string" || typeof d == "number" || typeof d == "boolean" || d === null) && (e[c] = d);
|
|
@@ -8834,7 +8833,7 @@ function is(t) {
|
|
|
8834
8833
|
}
|
|
8835
8834
|
return { ...e, ...zr(t) };
|
|
8836
8835
|
}
|
|
8837
|
-
function
|
|
8836
|
+
function Ee(t, e, s) {
|
|
8838
8837
|
if (typeof window > "u")
|
|
8839
8838
|
return;
|
|
8840
8839
|
const i = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -8859,13 +8858,13 @@ const dc = "https://app.pluno.ai", lc = 2e4, uc = 1e4, hc = 6e4, pc = 6e4, fc =
|
|
|
8859
8858
|
".pdf:application/pdf",
|
|
8860
8859
|
".png:image/png",
|
|
8861
8860
|
".webp:image/webp"
|
|
8862
|
-
]), ul = ".pdf,.png,.jpg,.jpeg,.webp", Xs = 64e3, os = 4e3, Ys = 30, wc = 2e3, _c = 1e3,
|
|
8861
|
+
]), ul = ".pdf,.png,.jpg,.jpeg,.webp", Xs = 64e3, os = 4e3, Ys = 30, wc = 2e3, _c = 1e3, Bn = "Image is too large for model vision input.", Sc = "pluno.productAgent.state.", Bs = "pluno.productAgent.pendingEvents.", Pt = "pluno.productAgent.activeToolCalls.", Rc = 100, bt = /* @__PURE__ */ new Set();
|
|
8863
8862
|
let nt = null;
|
|
8864
|
-
function
|
|
8863
|
+
function Ec(t, e = Math.random) {
|
|
8865
8864
|
const s = Math.min(Ns, gc * 2 ** t), i = 1 - Li + e() * Li * 2;
|
|
8866
8865
|
return Math.min(Ns, Math.round(s * i));
|
|
8867
8866
|
}
|
|
8868
|
-
function
|
|
8867
|
+
function kc(t) {
|
|
8869
8868
|
const e = t.split(".")[1];
|
|
8870
8869
|
if (!e)
|
|
8871
8870
|
return null;
|
|
@@ -8904,15 +8903,15 @@ class xt {
|
|
|
8904
8903
|
this.options = e, this.transportIdentity = s, this.directoryAuthority = {
|
|
8905
8904
|
authorityId: zt(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
|
|
8906
8905
|
generation: 1
|
|
8907
|
-
}, this.directoryHttp = new
|
|
8906
|
+
}, this.directoryHttp = new En({
|
|
8908
8907
|
backendUrl: e.backendUrl,
|
|
8909
8908
|
authority: () => `${this.directoryAuthority.authorityId}:${this.directoryAuthority.generation}`,
|
|
8910
8909
|
authenticationFailure: () => this.authenticationFailure,
|
|
8911
8910
|
pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
|
|
8912
8911
|
recoverAuthentication: (n, r, o) => this.recoverHttpAuthentication(n, r, o),
|
|
8913
8912
|
// Public custom transports own their admission contract and do not expose the default Socket.IO lease.
|
|
8914
|
-
executorConnection: e.webSocketFactory ? void 0 : () => this.socket instanceof
|
|
8915
|
-
restoreExecutor: e.webSocketFactory ? void 0 : (n) => this.socket instanceof
|
|
8913
|
+
executorConnection: e.webSocketFactory ? void 0 : () => this.socket instanceof B ? this.socket.connectionId : null,
|
|
8914
|
+
restoreExecutor: e.webSocketFactory ? void 0 : (n) => this.socket instanceof B ? this.socket.restoreExecutor(n) : Promise.reject(new R("Browser is reconnecting.", "executor_not_ready")),
|
|
8916
8915
|
auth: {
|
|
8917
8916
|
protocol: 1,
|
|
8918
8917
|
token: e.token ?? "",
|
|
@@ -8940,7 +8939,7 @@ class xt {
|
|
|
8940
8939
|
clientScopeId: this.modelClientScopeId,
|
|
8941
8940
|
sessionId: null,
|
|
8942
8941
|
defaultModel: this.draftModel
|
|
8943
|
-
}), this.installFeaturePorts(), this.queuedClientEvents =
|
|
8942
|
+
}), this.installFeaturePorts(), this.queuedClientEvents = Ed(
|
|
8944
8943
|
wd(e.clientId),
|
|
8945
8944
|
_d(e.clientId)
|
|
8946
8945
|
);
|
|
@@ -8962,6 +8961,8 @@ class xt {
|
|
|
8962
8961
|
reconnectAttempts = 0;
|
|
8963
8962
|
embeddedRecoveryTimer = null;
|
|
8964
8963
|
embeddedRecoveryTokenExpired = !1;
|
|
8964
|
+
embeddedRecoveryExhausted = !1;
|
|
8965
|
+
embeddedRecoverySuspended = !1;
|
|
8965
8966
|
recoveryDiagnosticId = crypto.randomUUID();
|
|
8966
8967
|
rejectedDiagnosticsToken = null;
|
|
8967
8968
|
lastRecoveryStage = "token_provider";
|
|
@@ -9059,7 +9060,7 @@ class xt {
|
|
|
9059
9060
|
if (e.model !== void 0 && !ze(e.model))
|
|
9060
9061
|
throw new Error(`Unsupported Product Agent model: ${e.model}`);
|
|
9061
9062
|
if (e.productVariant === "personal") throw new R("Personal Product Agent has retired.", "personal_product_agent_retired", !1);
|
|
9062
|
-
const s = e, i = await
|
|
9063
|
+
const s = e, i = await ja(
|
|
9063
9064
|
s.skipStoredTransportIdentityCollisionCheck === !0
|
|
9064
9065
|
), n = new xt({
|
|
9065
9066
|
...e,
|
|
@@ -9070,7 +9071,7 @@ class xt {
|
|
|
9070
9071
|
}, i);
|
|
9071
9072
|
try {
|
|
9072
9073
|
await n.initializeDirectory(), await n.initializeConversation(), qa().catch((r) => {
|
|
9073
|
-
|
|
9074
|
+
z("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
9074
9075
|
message: r instanceof Error ? r.message : String(r)
|
|
9075
9076
|
});
|
|
9076
9077
|
}), s.disableNetworkCapture || n.enableNetworkCapture(), n.startPageLifecycleRecovery(), n.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await n.connect();
|
|
@@ -9141,19 +9142,19 @@ class xt {
|
|
|
9141
9142
|
requestId: p.requestId,
|
|
9142
9143
|
clientMessageId: p.userMessageId,
|
|
9143
9144
|
sessionId: p.sessionId
|
|
9144
|
-
}), b = (w,
|
|
9145
|
+
}), b = (w, k) => _.measure(w, () => at(y, k));
|
|
9145
9146
|
let I = p.contextPreparation ?? { pageContent: "", sessionTabs: [] };
|
|
9146
9147
|
if (p.contextPreparation === null) {
|
|
9147
|
-
await b("first_frame", () => new Promise((
|
|
9148
|
+
await b("first_frame", () => new Promise((k) => {
|
|
9148
9149
|
if (document.visibilityState !== "visible") {
|
|
9149
|
-
setTimeout(
|
|
9150
|
+
setTimeout(k, 0);
|
|
9150
9151
|
return;
|
|
9151
9152
|
}
|
|
9152
|
-
const
|
|
9153
|
-
cancelAnimationFrame(S), document.removeEventListener("visibilitychange", D), setTimeout(
|
|
9153
|
+
const A = () => {
|
|
9154
|
+
cancelAnimationFrame(S), document.removeEventListener("visibilitychange", D), setTimeout(k, 0);
|
|
9154
9155
|
}, D = () => {
|
|
9155
|
-
document.visibilityState !== "visible" &&
|
|
9156
|
-
}, S = requestAnimationFrame(
|
|
9156
|
+
document.visibilityState !== "visible" && A();
|
|
9157
|
+
}, S = requestAnimationFrame(A);
|
|
9157
9158
|
document.addEventListener("visibilitychange", D);
|
|
9158
9159
|
}));
|
|
9159
9160
|
const w = p.context.page;
|
|
@@ -9168,7 +9169,7 @@ class xt {
|
|
|
9168
9169
|
throw Object.assign(new Error("Attachment files are unavailable. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
|
|
9169
9170
|
return y.throwIfAborted(), _.mark("context_ready"), { ...I, now: Date.now() };
|
|
9170
9171
|
},
|
|
9171
|
-
connectionId: () => this.socket instanceof
|
|
9172
|
+
connectionId: () => this.socket instanceof B ? this.socket.connectionId : null,
|
|
9172
9173
|
prepareUpload: this.options.prepareAttachmentUpload ?? (this.options.productVariant === "customer_embedded" ? (p) => this.prepareEmbedAttachmentUpload(p, i) : void 0),
|
|
9173
9174
|
onUploaded: async (p, g, y) => {
|
|
9174
9175
|
await qn(p, {
|
|
@@ -9177,7 +9178,7 @@ class xt {
|
|
|
9177
9178
|
storageKey: y.storage_key ?? void 0,
|
|
9178
9179
|
fileUrl: y.file_url ? new URL(y.file_url, this.options.backendUrl).toString() : void 0,
|
|
9179
9180
|
lastUsedAt: Date.now()
|
|
9180
|
-
}).catch((_) =>
|
|
9181
|
+
}).catch((_) => z("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
9181
9182
|
attachmentId: p,
|
|
9182
9183
|
message: _ instanceof Error ? _.message : String(_)
|
|
9183
9184
|
}));
|
|
@@ -9196,32 +9197,32 @@ class xt {
|
|
|
9196
9197
|
onTiming: (p) => {
|
|
9197
9198
|
i() && this.reportOperationTiming(p);
|
|
9198
9199
|
},
|
|
9199
|
-
onCommand: (p) =>
|
|
9200
|
+
onCommand: (p) => Ee("client_event", p.type, is({ ...p.payload, type: p.type })),
|
|
9200
9201
|
onError: (p, g) => {
|
|
9201
9202
|
if (this.options.productVariant === "customer_embedded" && g.operation === "conversation.snapshot" && p instanceof R && p.code === "conversation_access_denied") {
|
|
9202
9203
|
g.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
9203
9204
|
return;
|
|
9204
9205
|
}
|
|
9205
|
-
|
|
9206
|
+
z("web-sdk.conversation", "Conversation operation failed", { ...g, ...$r(p) }), p instanceof R && p.backendRefusal && g.operation.startsWith("chat.") ? this.applyAccountSubmissionError(p.code) : this.handleDirectoryTransportError(p);
|
|
9206
9207
|
}
|
|
9207
9208
|
})
|
|
9208
9209
|
});
|
|
9209
9210
|
const c = this.clientRuntime.engine.getState().slices.conversation, d = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : zt(n);
|
|
9210
9211
|
if (this.authenticatedUserId && !c.submissionOrder.length && !Object.keys(c.operations).length) {
|
|
9211
9212
|
const p = this.queuedClientEvents.filter((_) => _.type === "chat.user_message"), g = d ? JSON.parse(d) : p.length ? Kr(c, p.map((_) => {
|
|
9212
|
-
const { type: b, ...I } = _, w = this.clientRuntime.engine.getState().slices.directory,
|
|
9213
|
+
const { type: b, ...I } = _, w = this.clientRuntime.engine.getState().slices.directory, k = w.clients[this.modelClientScopeId];
|
|
9213
9214
|
return {
|
|
9214
9215
|
command: { type: b, request_id: _.clientMessageId, payload: JSON.parse(JSON.stringify(I)) },
|
|
9215
9216
|
requestedModel: _.model ?? null,
|
|
9216
9217
|
clientScopeId: this.modelClientScopeId,
|
|
9217
|
-
conversationScopeId:
|
|
9218
|
+
conversationScopeId: k,
|
|
9218
9219
|
viewId: `sdk:${this.modelClientScopeId}`,
|
|
9219
|
-
sessionId: _.sessionId ?? w.selections[
|
|
9220
|
+
sessionId: _.sessionId ?? w.selections[k]?.sessionId ?? null,
|
|
9220
9221
|
entrySurface: this.options.entrySurface,
|
|
9221
9222
|
submittedAt: Date.now()
|
|
9222
9223
|
};
|
|
9223
9224
|
})) : null, y = this.options.restorePersistedState === !1 || !o ? g : await a.restore(
|
|
9224
|
-
g ??
|
|
9225
|
+
g ?? js(c, this.clientRuntime.engine.getState().slices.directory)
|
|
9225
9226
|
);
|
|
9226
9227
|
if (!i()) return;
|
|
9227
9228
|
y && (g || Object.keys(y.operations).length || Object.keys(y.stops).length) && await this.clientRuntime.engine.dispatch({ ...s, type: "conversation.restore_delivery", checkpoint: y });
|
|
@@ -9236,13 +9237,13 @@ class xt {
|
|
|
9236
9237
|
socket: {
|
|
9237
9238
|
retain: async (p, g) => {
|
|
9238
9239
|
const y = this.socket;
|
|
9239
|
-
y instanceof
|
|
9240
|
+
y instanceof B && await y.directoryRooms.retain(p, g).catch((_) => {
|
|
9240
9241
|
if (this.socket === y) throw _;
|
|
9241
9242
|
});
|
|
9242
9243
|
},
|
|
9243
9244
|
release: async (p, g) => {
|
|
9244
9245
|
const y = this.socket;
|
|
9245
|
-
y instanceof
|
|
9246
|
+
y instanceof B && await y.directoryRooms.release(p, g).catch((_) => {
|
|
9246
9247
|
if (this.socket === y) throw _;
|
|
9247
9248
|
});
|
|
9248
9249
|
}
|
|
@@ -9277,21 +9278,21 @@ class xt {
|
|
|
9277
9278
|
const I = this.firstResponseTimersByClientMessageId.get(b.userMessageId);
|
|
9278
9279
|
I && (I.sessionId = b.sessionId), this.emit("ack", { clientMessageId: b.userMessageId, sessionId: b.sessionId });
|
|
9279
9280
|
const w = b.sessionId;
|
|
9280
|
-
w && this.getState().sessionId === w && this.directoryHttp.request(`/sessions/${encodeURIComponent(w)}/history`, { limit: 200 }).then((
|
|
9281
|
-
i() && this.getState().sessionId === w && this.state.status !== "closed" && ts(this.clientRuntime, this.modelClientScopeId, w,
|
|
9282
|
-
}).catch((
|
|
9283
|
-
i() && this.getState().sessionId === w && this.handleDirectoryTransportError(
|
|
9281
|
+
w && this.getState().sessionId === w && this.directoryHttp.request(`/sessions/${encodeURIComponent(w)}/history`, { limit: 200 }).then((k) => {
|
|
9282
|
+
i() && this.getState().sessionId === w && this.state.status !== "closed" && ts(this.clientRuntime, this.modelClientScopeId, w, k.turns);
|
|
9283
|
+
}).catch((k) => {
|
|
9284
|
+
i() && this.getState().sessionId === w && this.handleDirectoryTransportError(k);
|
|
9284
9285
|
});
|
|
9285
9286
|
}
|
|
9286
9287
|
(b.cancelled || b.delivery === "failed") && this.clearFirstResponseTimer(b.userMessageId);
|
|
9287
9288
|
}
|
|
9288
9289
|
for (const [b, I] of Object.entries(p.directory.clients)) {
|
|
9289
9290
|
if (!b.startsWith(`background:${this.modelClientScopeId}:`)) continue;
|
|
9290
|
-
const w = pe(p.conversation, p.directory, I),
|
|
9291
|
-
if (this.firstResponseTimersByClientMessageId.size && (u(Wt(w,
|
|
9292
|
-
for (const D of ne(
|
|
9293
|
-
const
|
|
9294
|
-
(y && w.sessionId === this.getState().sessionId || !
|
|
9291
|
+
const w = pe(p.conversation, p.directory, I), k = w.sessionId ? p.conversation.sessions[w.sessionId] : void 0;
|
|
9292
|
+
if (this.firstResponseTimersByClientMessageId.size && (u(Wt(w, k?.queries.current, this.options.backendUrl).messages, w.sessionId), ["failed", "stopped"].includes(w.activity.phase)))
|
|
9293
|
+
for (const D of ne(k?.execution)) this.clearFirstResponseTimer(D);
|
|
9294
|
+
const A = w.activity.phase === "completed" && ne(k?.execution).some((D) => this.firstResponseTimersByClientMessageId.has(D));
|
|
9295
|
+
(y && w.sessionId === this.getState().sessionId || !A && ["completed", "failed", "stopped"].includes(w.activity.phase)) && this.directoryScope.detach(b);
|
|
9295
9296
|
}
|
|
9296
9297
|
const _ = this.getState();
|
|
9297
9298
|
u(_.messages, _.sessionId);
|
|
@@ -9408,7 +9409,7 @@ class xt {
|
|
|
9408
9409
|
throw new ce("Pluno token request was cancelled", !0);
|
|
9409
9410
|
if (typeof d != "string" || !d.trim())
|
|
9410
9411
|
throw new ce("Chat setup did not return a session. Contact your app administrator, then try again.", !1);
|
|
9411
|
-
return this.token = d, this.tokenExpiresAtMs =
|
|
9412
|
+
return this.token = d, this.tokenExpiresAtMs = kc(d), d;
|
|
9412
9413
|
} finally {
|
|
9413
9414
|
a !== null && window.clearTimeout(a);
|
|
9414
9415
|
}
|
|
@@ -9433,36 +9434,38 @@ class xt {
|
|
|
9433
9434
|
}
|
|
9434
9435
|
async connect() {
|
|
9435
9436
|
return this.clientRuntime.route("conversation", { core: async () => {
|
|
9436
|
-
if (this.socket instanceof
|
|
9437
|
-
const
|
|
9437
|
+
if (this.socket instanceof B && (this.socket.initialReadinessExpired || this.state.lastErrorCode === "connection_failed" && this.state.status !== "connected" && this.socket.readyState !== WebSocket.CLOSED)) {
|
|
9438
|
+
const o = this.socket;
|
|
9438
9439
|
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget();
|
|
9439
|
-
const
|
|
9440
|
-
this.setState({ status: "reconnecting" }),
|
|
9440
|
+
const a = this.waitForConnectionOutcome(o);
|
|
9441
|
+
this.setState({ status: "reconnecting" }), o.retryReadiness(), await a;
|
|
9441
9442
|
return;
|
|
9442
9443
|
}
|
|
9443
9444
|
if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
|
|
9444
9445
|
return;
|
|
9445
9446
|
this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0);
|
|
9446
9447
|
const e = this.authenticationFailure !== null, s = e && this.state.lastErrorCode === "connection_failed";
|
|
9447
|
-
this.authenticationFailure = null, this.
|
|
9448
|
-
const i =
|
|
9448
|
+
this.authenticationFailure = null, this.embeddedRecoveryExhausted = !1;
|
|
9449
|
+
const i = this.embeddedRecoveryTokenExpired;
|
|
9450
|
+
this.embeddedRecoverySuspended && document.visibilityState === "visible" && navigator.onLine !== !1 && this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget(i), this.credentialRecoveryFailure = null, this.connectionInProgress = !0;
|
|
9451
|
+
const n = ++this.connectionAttemptId, r = this.state.lastError;
|
|
9449
9452
|
this.setState(
|
|
9450
9453
|
this.state.status === "reconnecting" || s ? { status: "reconnecting" } : { status: "connecting", ...e ? {} : { lastError: null } }
|
|
9451
9454
|
);
|
|
9452
9455
|
try {
|
|
9453
|
-
if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token),
|
|
9456
|
+
if (this.lastRecoveryStage = "token_provider", this.token = await this.acquireToken("connect", { forceRefresh: e }), this.token && (this.directoryHttp.auth.token = this.token), n !== this.connectionAttemptId || this.state.status === "closed")
|
|
9454
9457
|
return;
|
|
9455
9458
|
if (this.lastRecoveryStage = "socket_admission", !this.token && !this.options.webSocketFactory)
|
|
9456
9459
|
throw new ce("Pluno requires a token or tokenProvider", !1);
|
|
9457
9460
|
if (!this.options.webSocketFactory && this.rejectedTransportToken !== null && this.rejectedTransportToken === this.token) {
|
|
9458
|
-
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError:
|
|
9461
|
+
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError: r });
|
|
9459
9462
|
return;
|
|
9460
9463
|
}
|
|
9461
|
-
if (this.socket instanceof
|
|
9464
|
+
if (this.socket instanceof B) {
|
|
9462
9465
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
9463
9466
|
return;
|
|
9464
9467
|
}
|
|
9465
|
-
const
|
|
9468
|
+
const o = $c(this.options.backendUrl), a = this.options.webSocketFactory?.(o) ?? new B({
|
|
9466
9469
|
displaySchema: "canonical",
|
|
9467
9470
|
backendUrl: this.options.backendUrl,
|
|
9468
9471
|
entrySurface: this.options.entrySurface,
|
|
@@ -9481,13 +9484,13 @@ class xt {
|
|
|
9481
9484
|
currentSession: () => this.state.sessionId,
|
|
9482
9485
|
sessionReferences: () => []
|
|
9483
9486
|
});
|
|
9484
|
-
this.socket =
|
|
9485
|
-
this.socket ===
|
|
9486
|
-
}, fc)),
|
|
9487
|
-
this.socket ===
|
|
9488
|
-
}),
|
|
9489
|
-
this.socket !==
|
|
9490
|
-
}), this.conversationObservation?.wake(),
|
|
9487
|
+
this.socket = a, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
9488
|
+
this.socket === a && a.readyState === WebSocket.CONNECTING && (z("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(a));
|
|
9489
|
+
}, fc)), a.addEventListener("reconnecting", (c) => {
|
|
9490
|
+
this.socket === a && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: c.detail.reason }), this.setReconnectingState());
|
|
9491
|
+
}), a.addEventListener("open", () => {
|
|
9492
|
+
this.socket !== a || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
9493
|
+
}), this.conversationObservation?.wake(), z("web-sdk.agent", "Pluno socket opened", {
|
|
9491
9494
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9492
9495
|
isThinking: this.state.isThinking
|
|
9493
9496
|
}), !(this.token ? this.sendNow({
|
|
@@ -9497,67 +9500,67 @@ class xt {
|
|
|
9497
9500
|
transportId: this.transportIdentity.transportId,
|
|
9498
9501
|
pageUrl: location.href
|
|
9499
9502
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
9500
|
-
this.socket ===
|
|
9503
|
+
this.socket === a && (z("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
|
|
9501
9504
|
}, mc));
|
|
9502
|
-
}),
|
|
9503
|
-
if (this.socket !==
|
|
9505
|
+
}), a.addEventListener("message", (c) => {
|
|
9506
|
+
if (this.socket !== a)
|
|
9504
9507
|
return;
|
|
9505
|
-
const
|
|
9506
|
-
if (
|
|
9508
|
+
const d = Vi(c.data);
|
|
9509
|
+
if (a instanceof B && d.type === "tool.call" && !Yc(d)) {
|
|
9507
9510
|
this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
|
|
9508
9511
|
return;
|
|
9509
9512
|
}
|
|
9510
|
-
const
|
|
9511
|
-
|
|
9512
|
-
}),
|
|
9513
|
-
this.socket ===
|
|
9514
|
-
}),
|
|
9513
|
+
const u = this.handleServerEvent(d);
|
|
9514
|
+
a instanceof B && d.type === "tool.call" && u === !0 && a.acceptMessage(c);
|
|
9515
|
+
}), a.addEventListener("sendfailure", (c) => {
|
|
9516
|
+
this.socket === a && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), a.readyState !== WebSocket.CLOSED && a.readyState !== WebSocket.CLOSING && a.close());
|
|
9517
|
+
}), a.addEventListener("diagnosticpending", (c) => {
|
|
9515
9518
|
if (this.clientRuntime.isDisposed || this.state.status === "closed") return;
|
|
9516
|
-
const
|
|
9517
|
-
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((
|
|
9518
|
-
}),
|
|
9519
|
-
this.socket ===
|
|
9520
|
-
code: typeof
|
|
9521
|
-
reason: typeof
|
|
9522
|
-
wasClean: typeof
|
|
9519
|
+
const d = c.detail, u = new Set(d.map((l) => l.id));
|
|
9520
|
+
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((l) => !u.has(l.id)), ...d].slice(-20), this.flushClientDiagnostics();
|
|
9521
|
+
}), a.addEventListener("close", (c) => {
|
|
9522
|
+
this.socket === a && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (z("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
9523
|
+
code: typeof c?.code == "number" ? c.code : null,
|
|
9524
|
+
reason: typeof c?.reason == "string" ? c.reason : "",
|
|
9525
|
+
wasClean: typeof c?.wasClean == "boolean" ? c.wasClean : null,
|
|
9523
9526
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9524
9527
|
isThinking: this.state.isThinking
|
|
9525
|
-
}), (typeof
|
|
9526
|
-
closeCode: typeof
|
|
9527
|
-
wasClean: typeof
|
|
9528
|
+
}), (typeof c?.code != "number" || c.code !== 1e3) && this.reportTransportDiagnostic("socket_closed", {
|
|
9529
|
+
closeCode: typeof c?.code == "number" ? c.code : void 0,
|
|
9530
|
+
wasClean: typeof c?.wasClean == "boolean" ? c.wasClean : void 0
|
|
9528
9531
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
9529
|
-
}),
|
|
9530
|
-
this.socket !==
|
|
9532
|
+
}), a.addEventListener("error", () => {
|
|
9533
|
+
this.socket !== a || this.state.status === "closed" || (z("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
9531
9534
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9532
9535
|
isThinking: this.state.isThinking
|
|
9533
|
-
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(),
|
|
9534
|
-
}), e &&
|
|
9535
|
-
} catch (
|
|
9536
|
-
if (
|
|
9536
|
+
}), 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());
|
|
9537
|
+
}), e && a instanceof B && await this.waitForConnectionOutcome(a);
|
|
9538
|
+
} catch (o) {
|
|
9539
|
+
if (n !== this.connectionAttemptId || this.state.status === "closed")
|
|
9537
9540
|
return;
|
|
9538
|
-
if (
|
|
9539
|
-
this.handleDirectoryTransportError(
|
|
9541
|
+
if (o instanceof R && (o.code === "unauthorized" || o.code === "update_required")) {
|
|
9542
|
+
this.handleDirectoryTransportError(o);
|
|
9540
9543
|
return;
|
|
9541
9544
|
}
|
|
9542
|
-
const
|
|
9543
|
-
if (as(
|
|
9544
|
-
|
|
9545
|
-
message:
|
|
9545
|
+
const a = rt(o);
|
|
9546
|
+
if (as(o)) {
|
|
9547
|
+
z("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
9548
|
+
message: a.message,
|
|
9546
9549
|
reconnectAttempt: this.reconnectAttempts
|
|
9547
|
-
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(
|
|
9550
|
+
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(o, "token_provider")), this.setState({
|
|
9548
9551
|
status: "reconnecting",
|
|
9549
9552
|
lastError: Fi,
|
|
9550
9553
|
lastErrorCode: "connection_failed"
|
|
9551
|
-
}), this.emit("error",
|
|
9552
|
-
|
|
9554
|
+
}), this.emit("error", a), this.scheduleReconnect(
|
|
9555
|
+
o instanceof ce ? o.retryAfterMs : void 0
|
|
9553
9556
|
);
|
|
9554
9557
|
return;
|
|
9555
9558
|
}
|
|
9556
|
-
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(
|
|
9559
|
+
throw this.options.productVariant === "customer_embedded" ? (this.reportTransportDiagnostic("auth_rejected", this.connectionFailureDiagnostic(o, "token_provider")), this.stopAuthentication(new R(a.message, "connection_failed", !1), !0), this.emit("error", a), a) : (this.setState({
|
|
9557
9560
|
status: "error",
|
|
9558
|
-
lastError:
|
|
9561
|
+
lastError: a.message,
|
|
9559
9562
|
lastErrorCode: "connection_failed"
|
|
9560
|
-
}), this.emit("error",
|
|
9563
|
+
}), this.emit("error", a), a);
|
|
9561
9564
|
} finally {
|
|
9562
9565
|
this.connectionInProgress = !1;
|
|
9563
9566
|
}
|
|
@@ -9565,12 +9568,12 @@ class xt {
|
|
|
9565
9568
|
}
|
|
9566
9569
|
disconnect() {
|
|
9567
9570
|
return this.clientRuntime.route("conversation", { core: () => {
|
|
9568
|
-
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;
|
|
9571
|
+
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;
|
|
9569
9572
|
} });
|
|
9570
9573
|
}
|
|
9571
9574
|
destroy() {
|
|
9572
9575
|
if (!this.clientRuntime.isDisposed) {
|
|
9573
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
9576
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), kd(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
9574
9577
|
for (const e of Object.values(this.listeners))
|
|
9575
9578
|
e?.clear();
|
|
9576
9579
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.conversationUnsubscribe?.(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
|
|
@@ -9662,8 +9665,8 @@ class xt {
|
|
|
9662
9665
|
if (!(w && !w.cancelled && w.delivery !== "accepted" && w.delivery !== "failed"))
|
|
9663
9666
|
if (_?.(), b?.(), w?.delivery === "failed" && !w.cancelled) y(new Error(w.error?.message ?? "Message delivery failed."));
|
|
9664
9667
|
else {
|
|
9665
|
-
const
|
|
9666
|
-
w?.delivery === "accepted" && !w.cancelled && typeof
|
|
9668
|
+
const k = w?.invocation === "user" && w.contextPreparation?.pageContent ? w.context.page?.url : null;
|
|
9669
|
+
w?.delivery === "accepted" && !w.cancelled && typeof k == "string" && c === this.submissionIntentRevision && p === this.directoryAuthority && this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId] === m && (this.lastUserMessagePageUrl = k), g(w?.delivery === "accepted" && !w.cancelled ? r : null);
|
|
9667
9670
|
}
|
|
9668
9671
|
};
|
|
9669
9672
|
_ = this.clientRuntime.engine.subscribe(I), b = this.clientRuntime.onDispose(() => {
|
|
@@ -9722,7 +9725,7 @@ class xt {
|
|
|
9722
9725
|
} }), !0);
|
|
9723
9726
|
}
|
|
9724
9727
|
createLocalAttachment(e) {
|
|
9725
|
-
this.options.productVariant === "customer_embedded" &&
|
|
9728
|
+
this.options.productVariant === "customer_embedded" && Ad(e);
|
|
9726
9729
|
const s = W(), i = {
|
|
9727
9730
|
id: s,
|
|
9728
9731
|
name: e.name || "attachment",
|
|
@@ -9740,7 +9743,7 @@ class xt {
|
|
|
9740
9743
|
lastUsedAt: n
|
|
9741
9744
|
});
|
|
9742
9745
|
return this.attachmentPersistence.set(s, r), r.catch((o) => {
|
|
9743
|
-
|
|
9746
|
+
z("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
9744
9747
|
attachmentId: s,
|
|
9745
9748
|
name: i.name,
|
|
9746
9749
|
message: o instanceof Error ? o.message : String(o)
|
|
@@ -10041,16 +10044,16 @@ class xt {
|
|
|
10041
10044
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
10042
10045
|
return !1;
|
|
10043
10046
|
const s = this.socket;
|
|
10044
|
-
if ((e.type === "tool.result" || e.type === "run.stop") && s instanceof
|
|
10047
|
+
if ((e.type === "tool.result" || e.type === "run.stop") && s instanceof B) {
|
|
10045
10048
|
const i = this.queuedClientEvents.find((n) => "sessionId" in n && n.sessionId === e.sessionId && (e.type === "tool.result" && n.type === "tool.result" && n.callId === e.callId || e.type === "run.stop" && n.type === "run.stop" && n.expectedUserMessageId === e.expectedUserMessageId)) ?? e;
|
|
10046
10049
|
return this.queuedClientEvents.includes(i) || this.queuedClientEvents.push(i), ye(this.options.clientId, this.queuedClientEvents), this.pendingRetainedCommandDeliveries.has(i) || (this.pendingRetainedCommandDeliveries.add(i), s.sendRetainedCommand(te(i)).then((n) => {
|
|
10047
10050
|
this.pendingRetainedCommandDeliveries.delete(i), n && (this.queuedClientEvents = this.queuedClientEvents.filter((r) => r !== i), ye(this.options.clientId, this.queuedClientEvents));
|
|
10048
10051
|
})), !0;
|
|
10049
10052
|
}
|
|
10050
10053
|
try {
|
|
10051
|
-
return s.send(JSON.stringify(e)),
|
|
10054
|
+
return s.send(JSON.stringify(e)), Ee("client_event", e.type, is(e)), !0;
|
|
10052
10055
|
} catch (i) {
|
|
10053
|
-
return
|
|
10056
|
+
return z("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
10054
10057
|
message: i instanceof Error ? i.message : String(i),
|
|
10055
10058
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
10056
10059
|
isThinking: this.state.isThinking
|
|
@@ -10097,8 +10100,8 @@ class xt {
|
|
|
10097
10100
|
...s,
|
|
10098
10101
|
...s.renderedError?.runId ? { runId: s.renderedError.runId } : {}
|
|
10099
10102
|
}, { errorDiagnostic: o, responseDiagnostics: a, renderedError: c, uiInvariant: d, timings: u, httpRequest: l, historyRefreshFailure: h, ...f } = r;
|
|
10100
|
-
for (const m of u ?? [])
|
|
10101
|
-
if (
|
|
10103
|
+
for (const m of u ?? []) Ee("client_event", "operation_timing", { ...m });
|
|
10104
|
+
if (Ee("client_event", "runtime.health", {
|
|
10102
10105
|
...f,
|
|
10103
10106
|
signalName: e,
|
|
10104
10107
|
...h ? { historyRefreshConsecutiveFailures: h.consecutiveFailures, historyRefreshEpisodeId: h.episodeId } : {}
|
|
@@ -10112,7 +10115,7 @@ class xt {
|
|
|
10112
10115
|
signal: r
|
|
10113
10116
|
}));
|
|
10114
10117
|
} catch (m) {
|
|
10115
|
-
|
|
10118
|
+
z("web-sdk.agent", "Pluno health signal send failed", {
|
|
10116
10119
|
name: e,
|
|
10117
10120
|
message: m instanceof Error ? m.message : String(m)
|
|
10118
10121
|
}), this.queueHealthDiagnostic(r);
|
|
@@ -10179,7 +10182,7 @@ class xt {
|
|
|
10179
10182
|
reportTransportDiagnostic(e, s = {}) {
|
|
10180
10183
|
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online";
|
|
10181
10184
|
s.stage && (this.lastRecoveryStage = s.stage);
|
|
10182
|
-
const n = s.connectionAttemptId ?? (this.socket instanceof
|
|
10185
|
+
const n = s.connectionAttemptId ?? (this.socket instanceof B ? this.socket.connectionAttempt?.connectionAttemptId ?? this.recoveryDiagnosticId : this.recoveryDiagnosticId), r = `${s.stage ?? "socket_admission"}:${e}:${s.recoveryOutcome ?? "none"}:${s.httpStatus ?? "none"}:${s.requestId ?? n}:${s.closeCode ?? "none"}:${s.disconnectReason ?? "none"}:${i}`, o = (/* @__PURE__ */ new Date()).toISOString(), a = this.transportDiagnosticEpisodes.get(r), c = {
|
|
10183
10186
|
id: a?.id ?? crypto.randomUUID(),
|
|
10184
10187
|
phase: e,
|
|
10185
10188
|
entrySurface: this.options.entrySurface,
|
|
@@ -10193,7 +10196,7 @@ class xt {
|
|
|
10193
10196
|
...s,
|
|
10194
10197
|
connectionAttemptId: n
|
|
10195
10198
|
};
|
|
10196
|
-
this.transportDiagnosticEpisodes.set(r, c), this.transportDiagnosticEpisodes.size > 20 && this.transportDiagnosticEpisodes.delete(this.transportDiagnosticEpisodes.keys().next().value), e.startsWith("auth_") &&
|
|
10199
|
+
this.transportDiagnosticEpisodes.set(r, c), this.transportDiagnosticEpisodes.size > 20 && this.transportDiagnosticEpisodes.delete(this.transportDiagnosticEpisodes.keys().next().value), e.startsWith("auth_") && Ee("client_event", "authentication_diagnostic", { ...c }), [1, 3, 10, 30, 100].includes(c.occurrenceCount) && (this.pendingTransportDiagnostics = [
|
|
10197
10200
|
...this.pendingTransportDiagnostics.filter((d) => d.id !== c.id),
|
|
10198
10201
|
c
|
|
10199
10202
|
], this.pendingTransportDiagnostics.splice(0, Math.max(0, this.pendingTransportDiagnostics.length - 20)), this.flushClientDiagnostics());
|
|
@@ -10310,7 +10313,7 @@ class xt {
|
|
|
10310
10313
|
}
|
|
10311
10314
|
flushQueuedClientEvents() {
|
|
10312
10315
|
const e = [...this.queuedClientEvents];
|
|
10313
|
-
this.queuedClientEvents = this.queuedClientEvents.filter((s) => (s.type === "tool.result" || s.type === "run.stop") && this.socket instanceof
|
|
10316
|
+
this.queuedClientEvents = this.queuedClientEvents.filter((s) => (s.type === "tool.result" || s.type === "run.stop") && this.socket instanceof B), ye(this.options.clientId, this.queuedClientEvents);
|
|
10314
10317
|
for (let s = 0; s < e.length; s++)
|
|
10315
10318
|
if (!this.sendNow(te(e[s]))) {
|
|
10316
10319
|
this.queuedClientEvents.unshift(...e.slice(s).filter((i) => !this.queuedClientEvents.includes(i)));
|
|
@@ -10392,7 +10395,7 @@ class xt {
|
|
|
10392
10395
|
}
|
|
10393
10396
|
}
|
|
10394
10397
|
handleServerEvent(e) {
|
|
10395
|
-
if (
|
|
10398
|
+
if (Ee("server_event", e.type, is(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
|
|
10396
10399
|
this.conversationObservation?.receive(e);
|
|
10397
10400
|
return;
|
|
10398
10401
|
}
|
|
@@ -10457,7 +10460,7 @@ class xt {
|
|
|
10457
10460
|
}
|
|
10458
10461
|
if ((e.code === "unauthorized" || e.code === "401") && e.reason === "token_expired" && e.retryable === !0 && this.options.tokenProvider) {
|
|
10459
10462
|
const s = this.socket;
|
|
10460
|
-
s instanceof
|
|
10463
|
+
s instanceof B ? this.refreshDefaultTransportCredentials(s) : (this.invalidateProviderToken(), this.startEmbeddedRecoveryBudget(!0), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.setReconnectingState(), this.socket = null, this.scheduleReconnect(), s?.close());
|
|
10461
10464
|
return;
|
|
10462
10465
|
}
|
|
10463
10466
|
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")) {
|
|
@@ -10571,10 +10574,30 @@ class xt {
|
|
|
10571
10574
|
if (this.pageLifecycleCleanup)
|
|
10572
10575
|
return;
|
|
10573
10576
|
const e = () => {
|
|
10574
|
-
Kn(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
10577
|
+
Kn(this.options.clientId, this.activeBrowserToolCalls.values()), this.embeddedRecoverySuspended = !0;
|
|
10575
10578
|
};
|
|
10576
|
-
|
|
10577
|
-
|
|
10579
|
+
let s = null;
|
|
10580
|
+
const i = () => this.options.productVariant === "customer_embedded" && document.visibilityState === "visible" && navigator.onLine !== !1 && !this.clientRuntime.isDisposed && (this.state.status === "reconnecting" || this.embeddedRecoveryExhausted) && (!this.authenticationFailure || this.embeddedRecoveryExhausted), n = () => {
|
|
10581
|
+
document.visibilityState === "visible" && navigator.onLine !== !1 && this.state.status === "connected" && (this.embeddedRecoverySuspended = !1), !(!i() || s !== null) && (s = window.setTimeout(() => {
|
|
10582
|
+
if (s = null, !!i()) {
|
|
10583
|
+
if (this.embeddedRecoverySuspended) {
|
|
10584
|
+
const a = this.embeddedRecoveryTokenExpired;
|
|
10585
|
+
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget(a);
|
|
10586
|
+
}
|
|
10587
|
+
this.connectionInProgress || this.credentialRecovery || (this.reconnectTimer !== null && window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.socket instanceof B && !this.authenticationFailure ? this.refreshingDefaultCredentials ? this.refreshDefaultTransportCredentials(this.socket) : this.socket.retryReadiness() : this.connect().catch((a) => {
|
|
10588
|
+
z("web-sdk.agent", "Pluno resume recovery did not complete", {
|
|
10589
|
+
message: a instanceof Error ? a.message : String(a)
|
|
10590
|
+
});
|
|
10591
|
+
}));
|
|
10592
|
+
}
|
|
10593
|
+
}, 0));
|
|
10594
|
+
}, r = () => {
|
|
10595
|
+
document.visibilityState === "hidden" ? this.embeddedRecoverySuspended = !0 : n();
|
|
10596
|
+
}, o = () => {
|
|
10597
|
+
this.embeddedRecoverySuspended = !0;
|
|
10598
|
+
};
|
|
10599
|
+
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), window.addEventListener("online", n), window.addEventListener("offline", o), window.addEventListener("pageshow", n), document.addEventListener("visibilitychange", r), this.pageLifecycleCleanup = () => {
|
|
10600
|
+
s !== null && window.clearTimeout(s), window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e), window.removeEventListener("online", n), window.removeEventListener("offline", o), window.removeEventListener("pageshow", n), document.removeEventListener("visibilitychange", r);
|
|
10578
10601
|
};
|
|
10579
10602
|
}
|
|
10580
10603
|
installSessionBrowserApis() {
|
|
@@ -10590,8 +10613,8 @@ class xt {
|
|
|
10590
10613
|
return i.ok === !1 ? id(i) : null;
|
|
10591
10614
|
}
|
|
10592
10615
|
enableNetworkCapture() {
|
|
10593
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup = (this.options.runtimeAdapters?.subscribeNetworkCapture ??
|
|
10594
|
-
|
|
10616
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = (this.options.runtimeAdapters?.subscribeNetworkCapture ?? jn)((e) => {
|
|
10617
|
+
Bd(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
10595
10618
|
}));
|
|
10596
10619
|
}
|
|
10597
10620
|
enqueueNetworkEvent(e) {
|
|
@@ -10608,26 +10631,36 @@ class xt {
|
|
|
10608
10631
|
}
|
|
10609
10632
|
startEmbeddedRecoveryBudget(e = !1) {
|
|
10610
10633
|
if (this.options.productVariant !== "customer_embedded" || this.authenticationFailure) return;
|
|
10634
|
+
if (this.embeddedRecoverySuspended || document.visibilityState === "hidden" || navigator.onLine === !1) {
|
|
10635
|
+
this.embeddedRecoverySuspended = !0, this.embeddedRecoveryTokenExpired ||= e;
|
|
10636
|
+
return;
|
|
10637
|
+
}
|
|
10611
10638
|
if (this.embeddedRecoveryTimer !== null) {
|
|
10612
10639
|
if (!e || this.embeddedRecoveryTokenExpired || !this.authenticatedUserId) return;
|
|
10613
10640
|
this.clearEmbeddedRecoveryBudget();
|
|
10614
10641
|
}
|
|
10615
10642
|
this.embeddedRecoveryTokenExpired = e, this.recoveryDiagnosticId = crypto.randomUUID();
|
|
10616
|
-
const s = this.authenticatedUserId ? (e ? 30 : 10) * 6e4 : 12e4
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10643
|
+
const s = this.authenticatedUserId ? (e ? 30 : 10) * 6e4 : 12e4, i = window.setTimeout(() => {
|
|
10644
|
+
if (this.embeddedRecoveryTimer === i) {
|
|
10645
|
+
if (this.embeddedRecoveryTimer = null, this.embeddedRecoverySuspended || document.visibilityState === "hidden" || navigator.onLine === !1) {
|
|
10646
|
+
this.embeddedRecoverySuspended = !0;
|
|
10647
|
+
return;
|
|
10648
|
+
}
|
|
10649
|
+
this.connectionAttemptId += 1, this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.connectionInProgress = !1, this.reportTransportDiagnostic("auth_refresh_failed", {
|
|
10650
|
+
stage: this.lastRecoveryStage,
|
|
10651
|
+
recoveryOutcome: "exhausted",
|
|
10652
|
+
failureKind: "temporary"
|
|
10653
|
+
}), this.stopAuthentication(new R(
|
|
10654
|
+
"Chat could not reconnect. Your conversation and draft are saved here. Try again.",
|
|
10655
|
+
"connection_failed",
|
|
10656
|
+
!1
|
|
10657
|
+
), !0), this.embeddedRecoveryExhausted = !0;
|
|
10658
|
+
}
|
|
10627
10659
|
}, s);
|
|
10660
|
+
this.embeddedRecoveryTimer = i;
|
|
10628
10661
|
}
|
|
10629
10662
|
clearEmbeddedRecoveryBudget() {
|
|
10630
|
-
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null, this.embeddedRecoveryTokenExpired = !1;
|
|
10663
|
+
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null, this.embeddedRecoveryTokenExpired = !1, this.embeddedRecoverySuspended = !1;
|
|
10631
10664
|
}
|
|
10632
10665
|
connectionFailureDiagnostic(e, s) {
|
|
10633
10666
|
const i = e instanceof ce ? e.status : e instanceof R && e.code === "unauthorized" ? 401 : e instanceof R && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, n = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, o = !(e instanceof R && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && as(e) && n !== 401 && n !== 403;
|
|
@@ -10643,11 +10676,11 @@ class xt {
|
|
|
10643
10676
|
return;
|
|
10644
10677
|
const s = Math.min(
|
|
10645
10678
|
Ns,
|
|
10646
|
-
Math.max(
|
|
10679
|
+
Math.max(Ec(this.reconnectAttempts), e)
|
|
10647
10680
|
);
|
|
10648
10681
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
10649
|
-
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof
|
|
10650
|
-
|
|
10682
|
+
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof B ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((n) => {
|
|
10683
|
+
z("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
10651
10684
|
message: n instanceof Error ? n.message : String(n),
|
|
10652
10685
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
10653
10686
|
isThinking: this.state.isThinking
|
|
@@ -10687,11 +10720,11 @@ class xt {
|
|
|
10687
10720
|
authReason: ["invalid_token", "token_expired", "missing_token", "user_not_found"].includes(s?.reason ?? "") ? s.reason : "unknown",
|
|
10688
10721
|
authTransport: s?.authTransport === "http" ? "http" : "socket",
|
|
10689
10722
|
...s?.requestId && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(s.requestId) ? { requestId: s.requestId, .../^(runtime|embed|extension|conversations):(snapshot|me|bootstrap|commands|activity|session-history|other)$/.test(s.authEndpoint ?? "") ? { authEndpoint: s.authEndpoint } : {} } : {},
|
|
10690
|
-
...this.socket instanceof
|
|
10723
|
+
...this.socket instanceof B ? { connectionAttemptId: this.socket.connectionAttempt?.connectionAttemptId } : {}
|
|
10691
10724
|
};
|
|
10692
10725
|
}
|
|
10693
10726
|
stopAuthentication(e, s = !1) {
|
|
10694
|
-
s || this.reportTransportDiagnostic("auth_rejected", {
|
|
10727
|
+
this.embeddedRecoveryExhausted = !1, s || this.reportTransportDiagnostic("auth_rejected", {
|
|
10695
10728
|
...this.authenticationDiagnostic(e),
|
|
10696
10729
|
failureKind: "permanent",
|
|
10697
10730
|
recoveryOutcome: "refused"
|
|
@@ -10708,7 +10741,7 @@ class xt {
|
|
|
10708
10741
|
if (this.credentialRecovery) return this.credentialRecovery;
|
|
10709
10742
|
if (this.directoryHttp.auth.token !== e) return;
|
|
10710
10743
|
const r = this.socket;
|
|
10711
|
-
if (r instanceof
|
|
10744
|
+
if (r instanceof B) return this.refreshCredentials(r, s);
|
|
10712
10745
|
if (this.options.webSocketFactory) throw s;
|
|
10713
10746
|
}
|
|
10714
10747
|
throw this.stopAuthentication(s), s;
|
|
@@ -10745,7 +10778,7 @@ class xt {
|
|
|
10745
10778
|
}
|
|
10746
10779
|
async refreshDefaultTransportCredentials(e) {
|
|
10747
10780
|
this.authenticationFailure || await this.refreshCredentials(e).catch((s) => {
|
|
10748
|
-
|
|
10781
|
+
z("web-sdk.agent", "Pluno credential refresh did not complete", {
|
|
10749
10782
|
message: s instanceof Error ? s.message : String(s)
|
|
10750
10783
|
});
|
|
10751
10784
|
});
|
|
@@ -10754,7 +10787,7 @@ class xt {
|
|
|
10754
10787
|
this.stopHeartbeat(), this.options.webSocketFactory && (this.heartbeatTimer = window.setInterval(() => {
|
|
10755
10788
|
const e = this.socket;
|
|
10756
10789
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
10757
|
-
this.socket === e && (
|
|
10790
|
+
this.socket === e && (z("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
10758
10791
|
}, uc));
|
|
10759
10792
|
}, lc));
|
|
10760
10793
|
}
|
|
@@ -10780,7 +10813,7 @@ class xt {
|
|
|
10780
10813
|
this.clientRuntime.isDisposed || (this.state = e, this.rebuildRuntimeInteractions(), this.emit("state", this.getState()));
|
|
10781
10814
|
}
|
|
10782
10815
|
setReconnectingState() {
|
|
10783
|
-
if (this.authenticationFailure || this.state.status === "closed" || (this.startEmbeddedRecoveryBudget(), this.socket instanceof
|
|
10816
|
+
if (this.authenticationFailure || this.state.status === "closed" || (this.startEmbeddedRecoveryBudget(), this.socket instanceof B && this.socket.initialReadinessExpired)) return;
|
|
10784
10817
|
this.conversationObservation?.wake();
|
|
10785
10818
|
const e = this.state.lastError !== null && (!this.state.isThinking || this.state.lastErrorCode === "connection_failed");
|
|
10786
10819
|
this.setState({
|
|
@@ -10792,13 +10825,13 @@ class xt {
|
|
|
10792
10825
|
}
|
|
10793
10826
|
}
|
|
10794
10827
|
const ds = /* @__PURE__ */ new WeakMap();
|
|
10795
|
-
function
|
|
10796
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
10828
|
+
function jn(t) {
|
|
10829
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Ac();
|
|
10797
10830
|
return e.subscribers.add(t), () => {
|
|
10798
10831
|
e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
10799
10832
|
};
|
|
10800
10833
|
}
|
|
10801
|
-
function
|
|
10834
|
+
function Ac() {
|
|
10802
10835
|
const t = /* @__PURE__ */ new Set(), e = (h) => {
|
|
10803
10836
|
t.forEach((f) => {
|
|
10804
10837
|
try {
|
|
@@ -10816,7 +10849,7 @@ function kc() {
|
|
|
10816
10849
|
}
|
|
10817
10850
|
try {
|
|
10818
10851
|
const y = f instanceof Request ? f : null, _ = Pd(f, y), b = Qn(m?.headers ?? y?.headers);
|
|
10819
|
-
if (!
|
|
10852
|
+
if (!ke(_, b, m?.body)) {
|
|
10820
10853
|
const w = {
|
|
10821
10854
|
requestId: hs("fetch"),
|
|
10822
10855
|
url: de(_, os),
|
|
@@ -10827,19 +10860,19 @@ function kc() {
|
|
|
10827
10860
|
startedAt: new Date(p).toISOString()
|
|
10828
10861
|
};
|
|
10829
10862
|
g.then(
|
|
10830
|
-
(
|
|
10831
|
-
xd(
|
|
10863
|
+
(k) => {
|
|
10864
|
+
xd(k, w, p, e).catch(() => {
|
|
10832
10865
|
e({
|
|
10833
10866
|
...w,
|
|
10834
|
-
responseStatus:
|
|
10867
|
+
responseStatus: k.status,
|
|
10835
10868
|
durationMs: Date.now() - p
|
|
10836
10869
|
});
|
|
10837
10870
|
});
|
|
10838
10871
|
},
|
|
10839
|
-
(
|
|
10872
|
+
(k) => {
|
|
10840
10873
|
e({
|
|
10841
10874
|
...w,
|
|
10842
|
-
errorText: de(
|
|
10875
|
+
errorText: de(k instanceof Error ? k.message : String(k)),
|
|
10843
10876
|
durationMs: Date.now() - p
|
|
10844
10877
|
});
|
|
10845
10878
|
}
|
|
@@ -10857,15 +10890,15 @@ function kc() {
|
|
|
10857
10890
|
requestHeaders: {},
|
|
10858
10891
|
startedAtMs: Date.now(),
|
|
10859
10892
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10860
|
-
excluded:
|
|
10893
|
+
excluded: ke(b)
|
|
10861
10894
|
}), _;
|
|
10862
10895
|
}, c = function(f, m) {
|
|
10863
10896
|
const p = n.call(this, f, m), g = ds.get(this);
|
|
10864
|
-
return g && Object.keys(g.requestHeaders).length < Ys && (g.requestHeaders[f] = si(f, m), g.excluded = g.excluded ||
|
|
10897
|
+
return g && Object.keys(g.requestHeaders).length < Ys && (g.requestHeaders[f] = si(f, m), g.excluded = g.excluded || ke(g.url, g.requestHeaders)), p;
|
|
10865
10898
|
}, d = function(f) {
|
|
10866
10899
|
try {
|
|
10867
10900
|
const m = ds.get(this);
|
|
10868
|
-
m && (m.excluded = m.excluded ||
|
|
10901
|
+
m && (m.excluded = m.excluded || ke(m.url, m.requestHeaders, f), m.requestBody = Xi(f), m.excluded || this.addEventListener(
|
|
10869
10902
|
"loadend",
|
|
10870
10903
|
() => {
|
|
10871
10904
|
queueMicrotask(() => {
|
|
@@ -10917,7 +10950,7 @@ function kc() {
|
|
|
10917
10950
|
u = new PerformanceObserver((h) => {
|
|
10918
10951
|
for (const f of h.getEntries()) {
|
|
10919
10952
|
const m = f;
|
|
10920
|
-
if (m.initiatorType === "fetch" || m.initiatorType === "xmlhttprequest" ||
|
|
10953
|
+
if (m.initiatorType === "fetch" || m.initiatorType === "xmlhttprequest" || ke(m.name))
|
|
10921
10954
|
continue;
|
|
10922
10955
|
const p = performance.timeOrigin + m.startTime;
|
|
10923
10956
|
e({
|
|
@@ -10961,7 +10994,7 @@ function kc() {
|
|
|
10961
10994
|
};
|
|
10962
10995
|
return window.__plunoProductAgentNetworkCapture = l, l;
|
|
10963
10996
|
}
|
|
10964
|
-
function
|
|
10997
|
+
function z(t, e, s) {
|
|
10965
10998
|
if (typeof window > "u")
|
|
10966
10999
|
return;
|
|
10967
11000
|
const i = window, n = {
|
|
@@ -10988,7 +11021,7 @@ function Ln() {
|
|
|
10988
11021
|
};
|
|
10989
11022
|
}
|
|
10990
11023
|
function hl(t) {
|
|
10991
|
-
const e = Ln(), s =
|
|
11024
|
+
const e = Ln(), s = jn(t);
|
|
10992
11025
|
return () => {
|
|
10993
11026
|
s(), e();
|
|
10994
11027
|
};
|
|
@@ -11006,7 +11039,7 @@ async function Oc(t, e = {}) {
|
|
|
11006
11039
|
return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
|
|
11007
11040
|
type: "pluno.pageImages.inspectImage",
|
|
11008
11041
|
imageAttached: !1,
|
|
11009
|
-
imageAttachmentError:
|
|
11042
|
+
imageAttachmentError: Bn
|
|
11010
11043
|
} : {
|
|
11011
11044
|
type: "pluno.pageImages.inspectImage",
|
|
11012
11045
|
imageAttached: !0,
|
|
@@ -11021,11 +11054,11 @@ async function Oc(t, e = {}) {
|
|
|
11021
11054
|
};
|
|
11022
11055
|
}
|
|
11023
11056
|
async function Pc(t) {
|
|
11024
|
-
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:
|
|
11057
|
+
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: Bn } : {
|
|
11025
11058
|
ok: !0,
|
|
11026
11059
|
mimeType: t.type,
|
|
11027
11060
|
sizeBytes: t.size,
|
|
11028
|
-
dataUrl: await
|
|
11061
|
+
dataUrl: await Bc(t)
|
|
11029
11062
|
} : { 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." } : xc(t);
|
|
11030
11063
|
}
|
|
11031
11064
|
function xc(t) {
|
|
@@ -11062,7 +11095,7 @@ function Nc(t) {
|
|
|
11062
11095
|
} catch {
|
|
11063
11096
|
}
|
|
11064
11097
|
}
|
|
11065
|
-
function
|
|
11098
|
+
function Bc(t) {
|
|
11066
11099
|
return new Promise((e, s) => {
|
|
11067
11100
|
const i = new FileReader();
|
|
11068
11101
|
i.onload = () => {
|
|
@@ -11094,7 +11127,7 @@ async function Hi(t) {
|
|
|
11094
11127
|
r = window.setTimeout(() => u(c), s);
|
|
11095
11128
|
})
|
|
11096
11129
|
]);
|
|
11097
|
-
return d === c ?
|
|
11130
|
+
return d === c ? jc(s) : {
|
|
11098
11131
|
ok: !0,
|
|
11099
11132
|
result: d,
|
|
11100
11133
|
console: n,
|
|
@@ -11123,7 +11156,7 @@ async function Hi(t) {
|
|
|
11123
11156
|
r !== void 0 && window.clearTimeout(r), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
|
|
11124
11157
|
}
|
|
11125
11158
|
}
|
|
11126
|
-
function
|
|
11159
|
+
function jc(t) {
|
|
11127
11160
|
return {
|
|
11128
11161
|
ok: !1,
|
|
11129
11162
|
exception: {
|
|
@@ -11325,41 +11358,41 @@ function Wc(t, e) {
|
|
|
11325
11358
|
const I = b.getAttribute("data-testid") || b.getAttribute("data-test") || b.getAttribute("data-qa") || b.getAttribute("data-cy") || "";
|
|
11326
11359
|
return `${b.tagName.toLowerCase()}|${m(b)}|${I}`;
|
|
11327
11360
|
}, g = (b, I, w) => {
|
|
11328
|
-
const
|
|
11329
|
-
const S =
|
|
11330
|
-
if (f >= 1e3 && !
|
|
11361
|
+
const k = (A, D) => {
|
|
11362
|
+
const S = A.tagName.toLowerCase(), q = window.getComputedStyle(A), E = u.has(A);
|
|
11363
|
+
if (f >= 1e3 && !E || w.has(A) || r.has(S) || A.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || q.display === "none" || q.visibility === "hidden")
|
|
11331
11364
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
11332
11365
|
f += 1;
|
|
11333
|
-
const P = m(
|
|
11366
|
+
const P = m(A), T = zn(A), v = a.has(P) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(S) || S === "a" && A.hasAttribute("href"), C = Array.from(A.children).filter((O) => O instanceof HTMLElement), U = /* @__PURE__ */ new Map();
|
|
11334
11367
|
for (const O of C) {
|
|
11335
|
-
const
|
|
11336
|
-
U.set(
|
|
11368
|
+
const L = p(O);
|
|
11369
|
+
U.set(L, (U.get(L) ?? 0) + 1);
|
|
11337
11370
|
}
|
|
11338
11371
|
const $ = /* @__PURE__ */ new Map(), Ce = /* @__PURE__ */ new Map();
|
|
11339
11372
|
for (const O of C) {
|
|
11340
|
-
const
|
|
11341
|
-
Ce.set(
|
|
11373
|
+
const L = p(O), ue = Ce.get(L) ?? 0;
|
|
11374
|
+
Ce.set(L, ue + 1), (U.get(L) ?? 0) > 8 && ue >= 6 && !u.has(O) && $.set(L, ($.get(L) ?? 0) + 1);
|
|
11342
11375
|
}
|
|
11343
11376
|
const Qe = /* @__PURE__ */ new Map(), ii = /* @__PURE__ */ new Set(), Ut = [], ni = [];
|
|
11344
11377
|
for (const O of C) {
|
|
11345
|
-
const
|
|
11346
|
-
if (Qe.set(
|
|
11347
|
-
ii.has(
|
|
11378
|
+
const L = p(O), ue = U.get(L) ?? 0, ai = Qe.get(L) ?? 0;
|
|
11379
|
+
if (Qe.set(L, ai + 1), ue > 8 && ai >= 6 && !u.has(O)) {
|
|
11380
|
+
ii.has(L) || (Ut.push([`… ${$.get(L) ?? 0} similar siblings omitted`]), ii.add(L));
|
|
11348
11381
|
continue;
|
|
11349
11382
|
}
|
|
11350
|
-
const ci =
|
|
11383
|
+
const ci = k(O, D);
|
|
11351
11384
|
ni.push(ci), Ut.push(ci.lines);
|
|
11352
11385
|
}
|
|
11353
11386
|
const Nt = [];
|
|
11354
|
-
if (
|
|
11355
|
-
for (const O of Array.from(
|
|
11356
|
-
O instanceof HTMLElement && Nt.push(
|
|
11357
|
-
const Xe = [...ni, ...Nt],
|
|
11387
|
+
if (A.shadowRoot)
|
|
11388
|
+
for (const O of Array.from(A.shadowRoot.children))
|
|
11389
|
+
O instanceof HTMLElement && Nt.push(k(O, D + 1));
|
|
11390
|
+
const Xe = [...ni, ...Nt], Bt = T.length > 0 || v || Xe.some((O) => O.hasUsefulContent), ri = qe(
|
|
11358
11391
|
[T, ...Xe.map((O) => O.textPreview)].filter(Boolean).join(" ")
|
|
11359
|
-
).slice(0, 180), rr =
|
|
11360
|
-
if (
|
|
11361
|
-
const O = Xe.some((ue) => ue.containsTextElement),
|
|
11362
|
-
Oe.push($n(
|
|
11392
|
+
).slice(0, 180), rr = A.hasAttribute("contenteditable") && (T.length > 0 || !A.querySelector("[contenteditable]")), oi = d.some((O) => A.hasAttribute(O)) || !!P || rr, jt = (A.getClientRects().length > 0 || q.display === "contents") && (s.has(S) || oi || E) && (Bt || E) && (!n.has(S) || Bt || oi || E), Lt = jt ? 1 : 0, Oe = [];
|
|
11393
|
+
if (jt) {
|
|
11394
|
+
const O = Xe.some((ue) => ue.containsTextElement), L = i.has(S) && !O ? ri : T;
|
|
11395
|
+
Oe.push($n(A, c, o, L.slice(0, 180)));
|
|
11363
11396
|
}
|
|
11364
11397
|
for (const O of Ut)
|
|
11365
11398
|
Oe.push(...ot(O, Lt));
|
|
@@ -11367,21 +11400,21 @@ function Wc(t, e) {
|
|
|
11367
11400
|
if (Ft.length > 0) {
|
|
11368
11401
|
const O = Ft.slice(0, 20);
|
|
11369
11402
|
Ft.length > O.length && O.push("… shadow DOM omitted");
|
|
11370
|
-
const
|
|
11371
|
-
if (D < 2 && !
|
|
11372
|
-
const ue =
|
|
11403
|
+
const L = S.includes("tooltip") || S.includes("popper") || S.includes("loader");
|
|
11404
|
+
if (D < 2 && !L) {
|
|
11405
|
+
const ue = jt ? "#shadow-root" : `${S} #shadow-root`;
|
|
11373
11406
|
Oe.push(...ot([ue, ...ot(O, 1)], Lt));
|
|
11374
11407
|
} else
|
|
11375
11408
|
Oe.push(...ot(O, Lt));
|
|
11376
11409
|
}
|
|
11377
11410
|
return {
|
|
11378
11411
|
lines: Oe,
|
|
11379
|
-
hasUsefulContent:
|
|
11412
|
+
hasUsefulContent: Bt,
|
|
11380
11413
|
textPreview: ri,
|
|
11381
11414
|
containsTextElement: i.has(S) || Xe.some((O) => O.containsTextElement)
|
|
11382
11415
|
};
|
|
11383
11416
|
};
|
|
11384
|
-
return [`--- ${I} ---`, ...
|
|
11417
|
+
return [`--- ${I} ---`, ...k(b, 0).lines].join(`
|
|
11385
11418
|
`);
|
|
11386
11419
|
}, y = [], _ = qe(window.getSelection()?.toString() ?? "");
|
|
11387
11420
|
_ && y.push(`--- selected text ---
|
|
@@ -11496,7 +11529,7 @@ function Qc(t) {
|
|
|
11496
11529
|
return t.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(t) && !/[a-f0-9]{12,}/i.test(t) && !/:r[0-9a-z]+:/i.test(t);
|
|
11497
11530
|
}
|
|
11498
11531
|
function Xc() {
|
|
11499
|
-
const t = Array.from(document.querySelectorAll(
|
|
11532
|
+
const t = Array.from(document.querySelectorAll(ji)), e = t.find(
|
|
11500
11533
|
(r) => typeof r[ac] == "string"
|
|
11501
11534
|
);
|
|
11502
11535
|
if (!(e ?? t[0]))
|
|
@@ -11508,7 +11541,7 @@ function Xc() {
|
|
|
11508
11541
|
selectors: [
|
|
11509
11542
|
{
|
|
11510
11543
|
name: "widget_host",
|
|
11511
|
-
selector:
|
|
11544
|
+
selector: ji,
|
|
11512
11545
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
11513
11546
|
},
|
|
11514
11547
|
{
|
|
@@ -11627,15 +11660,15 @@ function Hn(t, e) {
|
|
|
11627
11660
|
id: typeof n.id == "string" ? n.id : String(s.id ?? crypto.randomUUID()),
|
|
11628
11661
|
role: "assistant",
|
|
11629
11662
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
11630
|
-
content:
|
|
11663
|
+
content: Ae(
|
|
11631
11664
|
Gi(n.content),
|
|
11632
11665
|
e
|
|
11633
11666
|
),
|
|
11634
11667
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11635
|
-
...
|
|
11668
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11636
11669
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11637
11670
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11638
|
-
...
|
|
11671
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11639
11672
|
dataType: "assistant_draft",
|
|
11640
11673
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
11641
11674
|
};
|
|
@@ -11644,15 +11677,15 @@ function Hn(t, e) {
|
|
|
11644
11677
|
id: String(s.id ?? crypto.randomUUID()),
|
|
11645
11678
|
role: r,
|
|
11646
11679
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
11647
|
-
content:
|
|
11680
|
+
content: Ae(
|
|
11648
11681
|
Gi(n.content),
|
|
11649
11682
|
e
|
|
11650
11683
|
),
|
|
11651
11684
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11652
|
-
...
|
|
11685
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11653
11686
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11654
11687
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11655
|
-
...
|
|
11688
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11656
11689
|
attachments: Vn(n.attachments, e),
|
|
11657
11690
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
11658
11691
|
};
|
|
@@ -11675,12 +11708,12 @@ function Hn(t, e) {
|
|
|
11675
11708
|
role: "tool",
|
|
11676
11709
|
content: "",
|
|
11677
11710
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11678
|
-
...
|
|
11711
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11679
11712
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11680
|
-
...
|
|
11713
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11681
11714
|
dataType: "function_call_output",
|
|
11682
11715
|
toolName: On,
|
|
11683
|
-
callId:
|
|
11716
|
+
callId: Be(n) ?? void 0,
|
|
11684
11717
|
sharePromptAllowed: r
|
|
11685
11718
|
};
|
|
11686
11719
|
const o = Ha(n.output);
|
|
@@ -11690,12 +11723,12 @@ function Hn(t, e) {
|
|
|
11690
11723
|
role: "tool",
|
|
11691
11724
|
content: "",
|
|
11692
11725
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11693
|
-
...
|
|
11726
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11694
11727
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11695
|
-
...
|
|
11728
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11696
11729
|
dataType: "scheduled_check_in",
|
|
11697
11730
|
toolName: xn,
|
|
11698
|
-
callId:
|
|
11731
|
+
callId: Be(n) ?? void 0,
|
|
11699
11732
|
scheduledCheckInId: o.id ?? void 0,
|
|
11700
11733
|
scheduledCheckInAt: o.dueAt
|
|
11701
11734
|
};
|
|
@@ -11705,26 +11738,26 @@ function Hn(t, e) {
|
|
|
11705
11738
|
role: "tool",
|
|
11706
11739
|
content: `Connect ${a.appName} to continue`,
|
|
11707
11740
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11708
|
-
...
|
|
11741
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11709
11742
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11710
11743
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11711
|
-
...
|
|
11744
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11712
11745
|
dataType: "function_call_output",
|
|
11713
11746
|
toolName: "authenticate_pipedream_app",
|
|
11714
|
-
callId:
|
|
11747
|
+
callId: Be(n) ?? void 0,
|
|
11715
11748
|
integrationAuthRequest: a
|
|
11716
11749
|
} : c ? {
|
|
11717
11750
|
id: String(s.id ?? crypto.randomUUID()),
|
|
11718
11751
|
role: "tool",
|
|
11719
11752
|
content: "Connect WhatsApp to continue",
|
|
11720
11753
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11721
|
-
...
|
|
11754
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11722
11755
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11723
11756
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11724
|
-
...
|
|
11757
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11725
11758
|
dataType: "function_call_output",
|
|
11726
11759
|
toolName: "request_personal_channel_connection",
|
|
11727
|
-
callId:
|
|
11760
|
+
callId: Be(n) ?? void 0,
|
|
11728
11761
|
personalChannelConnectionRequest: c
|
|
11729
11762
|
} : null;
|
|
11730
11763
|
}
|
|
@@ -11733,13 +11766,13 @@ function Hn(t, e) {
|
|
|
11733
11766
|
role: "tool",
|
|
11734
11767
|
content: n.type === "mcp_call" ? rd(n) : dd(n),
|
|
11735
11768
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11736
|
-
...
|
|
11769
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11737
11770
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11738
11771
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11739
|
-
...
|
|
11772
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11740
11773
|
dataType: String(n.type),
|
|
11741
11774
|
toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
|
|
11742
|
-
callId:
|
|
11775
|
+
callId: Be(n) ?? void 0,
|
|
11743
11776
|
loading: n.steered === !0 ? !1 : n.localExecutionStatus === "queued" || n.localExecutionStatus === "running" ? !0 : typeof n.localExecutionStatus == "string" ? !1 : void 0,
|
|
11744
11777
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
11745
11778
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
@@ -11747,10 +11780,10 @@ function Hn(t, e) {
|
|
|
11747
11780
|
role: "system",
|
|
11748
11781
|
content: cd(n),
|
|
11749
11782
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11750
|
-
...
|
|
11783
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11751
11784
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11752
11785
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11753
|
-
...
|
|
11786
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11754
11787
|
dataType: String(n.type),
|
|
11755
11788
|
loading: n.steered !== !0 && n.type === "run_status" && (n.status === "running" || n.status === "retrying"),
|
|
11756
11789
|
...n.steered === !0 || n.type === "run_status" && n.status === "steered" ? { steered: !0 } : {},
|
|
@@ -11828,14 +11861,14 @@ function $e(t) {
|
|
|
11828
11861
|
const e = t.trim() || "Run tool", s = e.codePointAt(0) ?? 0;
|
|
11829
11862
|
return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? e : `🛠️ ${e}`;
|
|
11830
11863
|
}
|
|
11831
|
-
function
|
|
11864
|
+
function Be(t) {
|
|
11832
11865
|
const e = t.callId ?? t.call_id;
|
|
11833
11866
|
return typeof e == "string" && e ? e : null;
|
|
11834
11867
|
}
|
|
11835
11868
|
function ee(t) {
|
|
11836
11869
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
11837
11870
|
}
|
|
11838
|
-
function
|
|
11871
|
+
function H(t) {
|
|
11839
11872
|
return typeof t.displaySequence == "number" && Number.isSafeInteger(t.displaySequence) ? t.displaySequence : null;
|
|
11840
11873
|
}
|
|
11841
11874
|
function Gi(t) {
|
|
@@ -11941,7 +11974,7 @@ function Id(t, e) {
|
|
|
11941
11974
|
}
|
|
11942
11975
|
function wd(t) {
|
|
11943
11976
|
try {
|
|
11944
|
-
const e = window.localStorage.getItem(`${
|
|
11977
|
+
const e = window.localStorage.getItem(`${Bs}${t}`);
|
|
11945
11978
|
if (!e)
|
|
11946
11979
|
return [];
|
|
11947
11980
|
const s = JSON.parse(e);
|
|
@@ -11954,11 +11987,11 @@ function ye(t, e) {
|
|
|
11954
11987
|
try {
|
|
11955
11988
|
const s = e.filter(ti);
|
|
11956
11989
|
if (s.length === 0) {
|
|
11957
|
-
window.localStorage.removeItem(`${
|
|
11990
|
+
window.localStorage.removeItem(`${Bs}${t}`);
|
|
11958
11991
|
return;
|
|
11959
11992
|
}
|
|
11960
11993
|
window.localStorage.setItem(
|
|
11961
|
-
`${
|
|
11994
|
+
`${Bs}${t}`,
|
|
11962
11995
|
JSON.stringify(s.slice(-25))
|
|
11963
11996
|
);
|
|
11964
11997
|
} catch {
|
|
@@ -12029,7 +12062,7 @@ function Rd(t) {
|
|
|
12029
12062
|
const e = t, s = e.event;
|
|
12030
12063
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && ti(s) && s.type === "tool.result";
|
|
12031
12064
|
}
|
|
12032
|
-
function
|
|
12065
|
+
function Ed(t, e) {
|
|
12033
12066
|
const s = new Set(
|
|
12034
12067
|
t.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
|
|
12035
12068
|
);
|
|
@@ -12038,7 +12071,7 @@ function Ad(t, e) {
|
|
|
12038
12071
|
...e.filter((i) => !s.has(i.callId))
|
|
12039
12072
|
];
|
|
12040
12073
|
}
|
|
12041
|
-
function
|
|
12074
|
+
function kd(t) {
|
|
12042
12075
|
try {
|
|
12043
12076
|
window.sessionStorage.removeItem(`${Pt}${t}`);
|
|
12044
12077
|
} catch {
|
|
@@ -12077,7 +12110,7 @@ function Wn(t, e) {
|
|
|
12077
12110
|
function Gn(t) {
|
|
12078
12111
|
return t.type || qd(t.name) || "application/octet-stream";
|
|
12079
12112
|
}
|
|
12080
|
-
function
|
|
12113
|
+
function Ad(t) {
|
|
12081
12114
|
Jn({
|
|
12082
12115
|
name: t.name,
|
|
12083
12116
|
mimeType: Gn(t),
|
|
@@ -12135,7 +12168,7 @@ function he(t) {
|
|
|
12135
12168
|
const e = t.respondsToUserMessageId;
|
|
12136
12169
|
return typeof e == "string" && e ? e : null;
|
|
12137
12170
|
}
|
|
12138
|
-
function
|
|
12171
|
+
function K(t) {
|
|
12139
12172
|
const e = t.runId;
|
|
12140
12173
|
return typeof e == "string" && e ? e : null;
|
|
12141
12174
|
}
|
|
@@ -12155,7 +12188,7 @@ function Qn(t) {
|
|
|
12155
12188
|
return e;
|
|
12156
12189
|
}
|
|
12157
12190
|
function si(t, e) {
|
|
12158
|
-
return ir(t) ? Dt : de(
|
|
12191
|
+
return ir(t) ? Dt : de(At(e), wc);
|
|
12159
12192
|
}
|
|
12160
12193
|
function Pd(t, e) {
|
|
12161
12194
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
@@ -12226,11 +12259,11 @@ function Yi(t) {
|
|
|
12226
12259
|
return t;
|
|
12227
12260
|
const e = t.trim();
|
|
12228
12261
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
12229
|
-
return
|
|
12262
|
+
return At(t);
|
|
12230
12263
|
try {
|
|
12231
12264
|
return JSON.stringify(te(JSON.parse(t)));
|
|
12232
12265
|
} catch {
|
|
12233
|
-
return
|
|
12266
|
+
return At(t);
|
|
12234
12267
|
}
|
|
12235
12268
|
}
|
|
12236
12269
|
function Xn(t) {
|
|
@@ -12239,8 +12272,8 @@ function Xn(t) {
|
|
|
12239
12272
|
const e = t.get("content-type")?.toLowerCase() ?? "", s = t.get("content-length"), i = Number(s);
|
|
12240
12273
|
return s !== null && Number.isInteger(i) && i >= 0 && i <= Xs && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
12241
12274
|
}
|
|
12242
|
-
function
|
|
12243
|
-
if (
|
|
12275
|
+
function ke(t, e = {}, s) {
|
|
12276
|
+
if (jd(s))
|
|
12244
12277
|
return !0;
|
|
12245
12278
|
const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
12246
12279
|
if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
|
|
@@ -12255,8 +12288,8 @@ function Ee(t, e = {}, s) {
|
|
|
12255
12288
|
return !0;
|
|
12256
12289
|
}
|
|
12257
12290
|
}
|
|
12258
|
-
function
|
|
12259
|
-
if (
|
|
12291
|
+
function Bd(t, e) {
|
|
12292
|
+
if (ke(t))
|
|
12260
12293
|
return !0;
|
|
12261
12294
|
try {
|
|
12262
12295
|
const s = new URL(t, location.href), i = new URL(e);
|
|
@@ -12265,7 +12298,7 @@ function jd(t, e) {
|
|
|
12265
12298
|
return !0;
|
|
12266
12299
|
}
|
|
12267
12300
|
}
|
|
12268
|
-
function
|
|
12301
|
+
function jd(t) {
|
|
12269
12302
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
12270
12303
|
}
|
|
12271
12304
|
function Ld(t) {
|
|
@@ -12322,11 +12355,11 @@ function Kd(t) {
|
|
|
12322
12355
|
}
|
|
12323
12356
|
const Dt = "[REDACTED_SECRET]", le = "[REDACTED_TOKEN]", Vd = "[REDACTED_SIGNED_URL]", Wd = 20, Gd = /^(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, Zn = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, er = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, tr = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, sr = /\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, Jd = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Qd = /\bhttps?:\/\/[^\s"'<>]+/gi, Xd = /[),.;\]]+$/;
|
|
12324
12357
|
function te(t) {
|
|
12325
|
-
return
|
|
12358
|
+
return kt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
12326
12359
|
}
|
|
12327
|
-
function
|
|
12360
|
+
function kt(t, e, s) {
|
|
12328
12361
|
if (typeof t == "string")
|
|
12329
|
-
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t :
|
|
12362
|
+
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : At(t);
|
|
12330
12363
|
if (t === null || typeof t != "object")
|
|
12331
12364
|
return t;
|
|
12332
12365
|
if (e >= Wd)
|
|
@@ -12334,10 +12367,10 @@ function Et(t, e, s) {
|
|
|
12334
12367
|
if (s.has(t))
|
|
12335
12368
|
return "[REDACTED_CIRCULAR]";
|
|
12336
12369
|
if (s.add(t), Array.isArray(t))
|
|
12337
|
-
return t.map((n) =>
|
|
12370
|
+
return t.map((n) => kt(n, e + 1, s));
|
|
12338
12371
|
const i = {};
|
|
12339
12372
|
for (const [n, r] of Object.entries(t))
|
|
12340
|
-
n === "pageContent" ? i[n] = r : ir(n) ? i[n] = Dt : i[n] = n.toLowerCase() === "url" ? Yd(r) :
|
|
12373
|
+
n === "pageContent" ? i[n] = r : ir(n) ? i[n] = Dt : i[n] = n.toLowerCase() === "url" ? Yd(r) : kt(r, e + 1, s);
|
|
12341
12374
|
return i;
|
|
12342
12375
|
}
|
|
12343
12376
|
function ir(t) {
|
|
@@ -12345,7 +12378,7 @@ function ir(t) {
|
|
|
12345
12378
|
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");
|
|
12346
12379
|
}
|
|
12347
12380
|
function Yd(t) {
|
|
12348
|
-
return typeof t == "string" ? nr(t) :
|
|
12381
|
+
return typeof t == "string" ? nr(t) : kt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
12349
12382
|
}
|
|
12350
12383
|
function nr(t) {
|
|
12351
12384
|
try {
|
|
@@ -12357,7 +12390,7 @@ function nr(t) {
|
|
|
12357
12390
|
return Zd(t);
|
|
12358
12391
|
}
|
|
12359
12392
|
}
|
|
12360
|
-
function
|
|
12393
|
+
function At(t) {
|
|
12361
12394
|
return t.replace(Jd, Vd).replace(Qd, el).replace(Zn, `Bearer ${le}`).replace(er, `Basic ${le}`).replace(tr, le).replace(sr, (e, s) => `${s}: ${Dt}`);
|
|
12362
12395
|
}
|
|
12363
12396
|
function Zd(t) {
|
|
@@ -12374,7 +12407,7 @@ function gl(t) {
|
|
|
12374
12407
|
return xt.init(t);
|
|
12375
12408
|
}
|
|
12376
12409
|
export {
|
|
12377
|
-
|
|
12410
|
+
ji as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
12378
12411
|
rc as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
12379
12412
|
nc as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
12380
12413
|
oc as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
@@ -12382,13 +12415,13 @@ export {
|
|
|
12382
12415
|
ul as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
12383
12416
|
ml as PlunoProductAgent,
|
|
12384
12417
|
rl as ProductAgentInteractionManager,
|
|
12385
|
-
|
|
12418
|
+
Ei as ProductAgentQueryController,
|
|
12386
12419
|
ll as ProductAgentRemoteRuntimeClient,
|
|
12387
12420
|
xt as ProductAgentSessionEngine,
|
|
12388
12421
|
nl as ProductAgentSessionHistoryManager,
|
|
12389
12422
|
al as ProductAgentTaskPageTitleController,
|
|
12390
12423
|
ce as ProductAgentTokenProviderError,
|
|
12391
|
-
|
|
12424
|
+
Ec as calculateReconnectDelay,
|
|
12392
12425
|
ol as createLocalStorageInteractionDecisionStorage,
|
|
12393
12426
|
gt as createProductAgentQueryState,
|
|
12394
12427
|
gl as createProductAgentRuntime,
|
|
@@ -12397,7 +12430,7 @@ export {
|
|
|
12397
12430
|
ec as formatProductAgentTaskPageTitle,
|
|
12398
12431
|
pl as getProductAgentOriginAccessErrorMessage,
|
|
12399
12432
|
hl as installProductAgentPageEnvironment,
|
|
12400
|
-
|
|
12433
|
+
ki as isProductAgentAuthReconnectError,
|
|
12401
12434
|
dl as isProductAgentRuntimeCommand,
|
|
12402
12435
|
Xo as mergeProductAgentEntityPages,
|
|
12403
12436
|
yt as normalizeProductAgentEntityPage,
|
|
@@ -12406,5 +12439,5 @@ export {
|
|
|
12406
12439
|
il as resolveProductAgentComposerAction,
|
|
12407
12440
|
sl as resolveProductAgentWidgetPresentation,
|
|
12408
12441
|
Yo as selectProductAgentQueryEntities,
|
|
12409
|
-
|
|
12442
|
+
Ad as validateProductAgentProviderInputFile
|
|
12410
12443
|
};
|