@pluno/product-agent-web 0.1.323 → 0.1.325
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +1 -1
- package/dist/product-agent-sdk.js +409 -375
- package/dist/product-agent-widget.js +2550 -2551
- package/package.json +1 -1
|
@@ -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.325", 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";
|
|
@@ -8833,7 +8833,7 @@ function is(t) {
|
|
|
8833
8833
|
}
|
|
8834
8834
|
return { ...e, ...zr(t) };
|
|
8835
8835
|
}
|
|
8836
|
-
function
|
|
8836
|
+
function Ee(t, e, s) {
|
|
8837
8837
|
if (typeof window > "u")
|
|
8838
8838
|
return;
|
|
8839
8839
|
const i = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -8858,13 +8858,13 @@ const dc = "https://app.pluno.ai", lc = 2e4, uc = 1e4, hc = 6e4, pc = 6e4, fc =
|
|
|
8858
8858
|
".pdf:application/pdf",
|
|
8859
8859
|
".png:image/png",
|
|
8860
8860
|
".webp:image/webp"
|
|
8861
|
-
]), 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();
|
|
8862
8862
|
let nt = null;
|
|
8863
|
-
function
|
|
8863
|
+
function Ec(t, e = Math.random) {
|
|
8864
8864
|
const s = Math.min(Ns, gc * 2 ** t), i = 1 - Li + e() * Li * 2;
|
|
8865
8865
|
return Math.min(Ns, Math.round(s * i));
|
|
8866
8866
|
}
|
|
8867
|
-
function
|
|
8867
|
+
function kc(t) {
|
|
8868
8868
|
const e = t.split(".")[1];
|
|
8869
8869
|
if (!e)
|
|
8870
8870
|
return null;
|
|
@@ -8903,15 +8903,15 @@ class xt {
|
|
|
8903
8903
|
this.options = e, this.transportIdentity = s, this.directoryAuthority = {
|
|
8904
8904
|
authorityId: zt(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
|
|
8905
8905
|
generation: 1
|
|
8906
|
-
}, this.directoryHttp = new
|
|
8906
|
+
}, this.directoryHttp = new En({
|
|
8907
8907
|
backendUrl: e.backendUrl,
|
|
8908
8908
|
authority: () => `${this.directoryAuthority.authorityId}:${this.directoryAuthority.generation}`,
|
|
8909
8909
|
authenticationFailure: () => this.authenticationFailure,
|
|
8910
8910
|
pendingAuthentication: () => this.credentialRecovery ?? (this.credentialRecoveryFailure ? Promise.reject(this.credentialRecoveryFailure) : null),
|
|
8911
8911
|
recoverAuthentication: (n, r, o) => this.recoverHttpAuthentication(n, r, o),
|
|
8912
8912
|
// Public custom transports own their admission contract and do not expose the default Socket.IO lease.
|
|
8913
|
-
executorConnection: e.webSocketFactory ? void 0 : () => this.socket instanceof
|
|
8914
|
-
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")),
|
|
8915
8915
|
auth: {
|
|
8916
8916
|
protocol: 1,
|
|
8917
8917
|
token: e.token ?? "",
|
|
@@ -8939,7 +8939,7 @@ class xt {
|
|
|
8939
8939
|
clientScopeId: this.modelClientScopeId,
|
|
8940
8940
|
sessionId: null,
|
|
8941
8941
|
defaultModel: this.draftModel
|
|
8942
|
-
}), this.installFeaturePorts(), this.queuedClientEvents =
|
|
8942
|
+
}), this.installFeaturePorts(), this.queuedClientEvents = Ed(
|
|
8943
8943
|
wd(e.clientId),
|
|
8944
8944
|
_d(e.clientId)
|
|
8945
8945
|
);
|
|
@@ -8961,6 +8961,8 @@ class xt {
|
|
|
8961
8961
|
reconnectAttempts = 0;
|
|
8962
8962
|
embeddedRecoveryTimer = null;
|
|
8963
8963
|
embeddedRecoveryTokenExpired = !1;
|
|
8964
|
+
embeddedRecoveryExhausted = !1;
|
|
8965
|
+
embeddedRecoverySuspended = !1;
|
|
8964
8966
|
recoveryDiagnosticId = crypto.randomUUID();
|
|
8965
8967
|
rejectedDiagnosticsToken = null;
|
|
8966
8968
|
lastRecoveryStage = "token_provider";
|
|
@@ -9058,7 +9060,7 @@ class xt {
|
|
|
9058
9060
|
if (e.model !== void 0 && !ze(e.model))
|
|
9059
9061
|
throw new Error(`Unsupported Product Agent model: ${e.model}`);
|
|
9060
9062
|
if (e.productVariant === "personal") throw new R("Personal Product Agent has retired.", "personal_product_agent_retired", !1);
|
|
9061
|
-
const s = e, i = await
|
|
9063
|
+
const s = e, i = await ja(
|
|
9062
9064
|
s.skipStoredTransportIdentityCollisionCheck === !0
|
|
9063
9065
|
), n = new xt({
|
|
9064
9066
|
...e,
|
|
@@ -9069,7 +9071,7 @@ class xt {
|
|
|
9069
9071
|
}, i);
|
|
9070
9072
|
try {
|
|
9071
9073
|
await n.initializeDirectory(), await n.initializeConversation(), qa().catch((r) => {
|
|
9072
|
-
|
|
9074
|
+
z("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
9073
9075
|
message: r instanceof Error ? r.message : String(r)
|
|
9074
9076
|
});
|
|
9075
9077
|
}), s.disableNetworkCapture || n.enableNetworkCapture(), n.startPageLifecycleRecovery(), n.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await n.connect();
|
|
@@ -9140,19 +9142,19 @@ class xt {
|
|
|
9140
9142
|
requestId: p.requestId,
|
|
9141
9143
|
clientMessageId: p.userMessageId,
|
|
9142
9144
|
sessionId: p.sessionId
|
|
9143
|
-
}), b = (w,
|
|
9145
|
+
}), b = (w, k) => _.measure(w, () => at(y, k));
|
|
9144
9146
|
let I = p.contextPreparation ?? { pageContent: "", sessionTabs: [] };
|
|
9145
9147
|
if (p.contextPreparation === null) {
|
|
9146
|
-
await b("first_frame", () => new Promise((
|
|
9148
|
+
await b("first_frame", () => new Promise((k) => {
|
|
9147
9149
|
if (document.visibilityState !== "visible") {
|
|
9148
|
-
setTimeout(
|
|
9150
|
+
setTimeout(k, 0);
|
|
9149
9151
|
return;
|
|
9150
9152
|
}
|
|
9151
|
-
const
|
|
9152
|
-
cancelAnimationFrame(S), document.removeEventListener("visibilitychange", D), setTimeout(
|
|
9153
|
+
const A = () => {
|
|
9154
|
+
cancelAnimationFrame(S), document.removeEventListener("visibilitychange", D), setTimeout(k, 0);
|
|
9153
9155
|
}, D = () => {
|
|
9154
|
-
document.visibilityState !== "visible" &&
|
|
9155
|
-
}, S = requestAnimationFrame(
|
|
9156
|
+
document.visibilityState !== "visible" && A();
|
|
9157
|
+
}, S = requestAnimationFrame(A);
|
|
9156
9158
|
document.addEventListener("visibilitychange", D);
|
|
9157
9159
|
}));
|
|
9158
9160
|
const w = p.context.page;
|
|
@@ -9167,7 +9169,7 @@ class xt {
|
|
|
9167
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 });
|
|
9168
9170
|
return y.throwIfAborted(), _.mark("context_ready"), { ...I, now: Date.now() };
|
|
9169
9171
|
},
|
|
9170
|
-
connectionId: () => this.socket instanceof
|
|
9172
|
+
connectionId: () => this.socket instanceof B ? this.socket.connectionId : null,
|
|
9171
9173
|
prepareUpload: this.options.prepareAttachmentUpload ?? (this.options.productVariant === "customer_embedded" ? (p) => this.prepareEmbedAttachmentUpload(p, i) : void 0),
|
|
9172
9174
|
onUploaded: async (p, g, y) => {
|
|
9173
9175
|
await qn(p, {
|
|
@@ -9176,7 +9178,7 @@ class xt {
|
|
|
9176
9178
|
storageKey: y.storage_key ?? void 0,
|
|
9177
9179
|
fileUrl: y.file_url ? new URL(y.file_url, this.options.backendUrl).toString() : void 0,
|
|
9178
9180
|
lastUsedAt: Date.now()
|
|
9179
|
-
}).catch((_) =>
|
|
9181
|
+
}).catch((_) => z("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
9180
9182
|
attachmentId: p,
|
|
9181
9183
|
message: _ instanceof Error ? _.message : String(_)
|
|
9182
9184
|
}));
|
|
@@ -9195,32 +9197,32 @@ class xt {
|
|
|
9195
9197
|
onTiming: (p) => {
|
|
9196
9198
|
i() && this.reportOperationTiming(p);
|
|
9197
9199
|
},
|
|
9198
|
-
onCommand: (p) =>
|
|
9200
|
+
onCommand: (p) => Ee("client_event", p.type, is({ ...p.payload, type: p.type })),
|
|
9199
9201
|
onError: (p, g) => {
|
|
9200
9202
|
if (this.options.productVariant === "customer_embedded" && g.operation === "conversation.snapshot" && p instanceof R && p.code === "conversation_access_denied") {
|
|
9201
9203
|
g.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
9202
9204
|
return;
|
|
9203
9205
|
}
|
|
9204
|
-
|
|
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);
|
|
9205
9207
|
}
|
|
9206
9208
|
})
|
|
9207
9209
|
});
|
|
9208
9210
|
const c = this.clientRuntime.engine.getState().slices.conversation, d = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : zt(n);
|
|
9209
9211
|
if (this.authenticatedUserId && !c.submissionOrder.length && !Object.keys(c.operations).length) {
|
|
9210
9212
|
const p = this.queuedClientEvents.filter((_) => _.type === "chat.user_message"), g = d ? JSON.parse(d) : p.length ? Kr(c, p.map((_) => {
|
|
9211
|
-
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];
|
|
9212
9214
|
return {
|
|
9213
9215
|
command: { type: b, request_id: _.clientMessageId, payload: JSON.parse(JSON.stringify(I)) },
|
|
9214
9216
|
requestedModel: _.model ?? null,
|
|
9215
9217
|
clientScopeId: this.modelClientScopeId,
|
|
9216
|
-
conversationScopeId:
|
|
9218
|
+
conversationScopeId: k,
|
|
9217
9219
|
viewId: `sdk:${this.modelClientScopeId}`,
|
|
9218
|
-
sessionId: _.sessionId ?? w.selections[
|
|
9220
|
+
sessionId: _.sessionId ?? w.selections[k]?.sessionId ?? null,
|
|
9219
9221
|
entrySurface: this.options.entrySurface,
|
|
9220
9222
|
submittedAt: Date.now()
|
|
9221
9223
|
};
|
|
9222
9224
|
})) : null, y = this.options.restorePersistedState === !1 || !o ? g : await a.restore(
|
|
9223
|
-
g ??
|
|
9225
|
+
g ?? js(c, this.clientRuntime.engine.getState().slices.directory)
|
|
9224
9226
|
);
|
|
9225
9227
|
if (!i()) return;
|
|
9226
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 });
|
|
@@ -9235,13 +9237,13 @@ class xt {
|
|
|
9235
9237
|
socket: {
|
|
9236
9238
|
retain: async (p, g) => {
|
|
9237
9239
|
const y = this.socket;
|
|
9238
|
-
y instanceof
|
|
9240
|
+
y instanceof B && await y.directoryRooms.retain(p, g).catch((_) => {
|
|
9239
9241
|
if (this.socket === y) throw _;
|
|
9240
9242
|
});
|
|
9241
9243
|
},
|
|
9242
9244
|
release: async (p, g) => {
|
|
9243
9245
|
const y = this.socket;
|
|
9244
|
-
y instanceof
|
|
9246
|
+
y instanceof B && await y.directoryRooms.release(p, g).catch((_) => {
|
|
9245
9247
|
if (this.socket === y) throw _;
|
|
9246
9248
|
});
|
|
9247
9249
|
}
|
|
@@ -9276,21 +9278,21 @@ class xt {
|
|
|
9276
9278
|
const I = this.firstResponseTimersByClientMessageId.get(b.userMessageId);
|
|
9277
9279
|
I && (I.sessionId = b.sessionId), this.emit("ack", { clientMessageId: b.userMessageId, sessionId: b.sessionId });
|
|
9278
9280
|
const w = b.sessionId;
|
|
9279
|
-
w && this.getState().sessionId === w && this.directoryHttp.request(`/sessions/${encodeURIComponent(w)}/history`, { limit: 200 }).then((
|
|
9280
|
-
i() && this.getState().sessionId === w && this.state.status !== "closed" && ts(this.clientRuntime, this.modelClientScopeId, w,
|
|
9281
|
-
}).catch((
|
|
9282
|
-
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);
|
|
9283
9285
|
});
|
|
9284
9286
|
}
|
|
9285
9287
|
(b.cancelled || b.delivery === "failed") && this.clearFirstResponseTimer(b.userMessageId);
|
|
9286
9288
|
}
|
|
9287
9289
|
for (const [b, I] of Object.entries(p.directory.clients)) {
|
|
9288
9290
|
if (!b.startsWith(`background:${this.modelClientScopeId}:`)) continue;
|
|
9289
|
-
const w = pe(p.conversation, p.directory, I),
|
|
9290
|
-
if (this.firstResponseTimersByClientMessageId.size && (u(Wt(w,
|
|
9291
|
-
for (const D of ne(
|
|
9292
|
-
const
|
|
9293
|
-
(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);
|
|
9294
9296
|
}
|
|
9295
9297
|
const _ = this.getState();
|
|
9296
9298
|
u(_.messages, _.sessionId);
|
|
@@ -9407,7 +9409,7 @@ class xt {
|
|
|
9407
9409
|
throw new ce("Pluno token request was cancelled", !0);
|
|
9408
9410
|
if (typeof d != "string" || !d.trim())
|
|
9409
9411
|
throw new ce("Chat setup did not return a session. Contact your app administrator, then try again.", !1);
|
|
9410
|
-
return this.token = d, this.tokenExpiresAtMs =
|
|
9412
|
+
return this.token = d, this.tokenExpiresAtMs = kc(d), d;
|
|
9411
9413
|
} finally {
|
|
9412
9414
|
a !== null && window.clearTimeout(a);
|
|
9413
9415
|
}
|
|
@@ -9432,36 +9434,38 @@ class xt {
|
|
|
9432
9434
|
}
|
|
9433
9435
|
async connect() {
|
|
9434
9436
|
return this.clientRuntime.route("conversation", { core: async () => {
|
|
9435
|
-
if (this.socket instanceof
|
|
9436
|
-
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;
|
|
9437
9439
|
this.clearEmbeddedRecoveryBudget(), this.startEmbeddedRecoveryBudget();
|
|
9438
|
-
const
|
|
9439
|
-
this.setState({ status: "reconnecting" }),
|
|
9440
|
+
const a = this.waitForConnectionOutcome(o);
|
|
9441
|
+
this.setState({ status: "reconnecting" }), o.retryReadiness(), await a;
|
|
9440
9442
|
return;
|
|
9441
9443
|
}
|
|
9442
9444
|
if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
|
|
9443
9445
|
return;
|
|
9444
9446
|
this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0);
|
|
9445
9447
|
const e = this.authenticationFailure !== null, s = e && this.state.lastErrorCode === "connection_failed";
|
|
9446
|
-
this.authenticationFailure = null, this.
|
|
9447
|
-
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;
|
|
9448
9452
|
this.setState(
|
|
9449
9453
|
this.state.status === "reconnecting" || s ? { status: "reconnecting" } : { status: "connecting", ...e ? {} : { lastError: null } }
|
|
9450
9454
|
);
|
|
9451
9455
|
try {
|
|
9452
|
-
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")
|
|
9453
9457
|
return;
|
|
9454
9458
|
if (this.lastRecoveryStage = "socket_admission", !this.token && !this.options.webSocketFactory)
|
|
9455
9459
|
throw new ce("Pluno requires a token or tokenProvider", !1);
|
|
9456
9460
|
if (!this.options.webSocketFactory && this.rejectedTransportToken !== null && this.rejectedTransportToken === this.token) {
|
|
9457
|
-
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError:
|
|
9461
|
+
this.clearEmbeddedRecoveryBudget(), this.setState({ status: "error", lastError: r });
|
|
9458
9462
|
return;
|
|
9459
9463
|
}
|
|
9460
|
-
if (this.socket instanceof
|
|
9464
|
+
if (this.socket instanceof B) {
|
|
9461
9465
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
9462
9466
|
return;
|
|
9463
9467
|
}
|
|
9464
|
-
const
|
|
9468
|
+
const o = $c(this.options.backendUrl), a = this.options.webSocketFactory?.(o) ?? new B({
|
|
9465
9469
|
displaySchema: "canonical",
|
|
9466
9470
|
backendUrl: this.options.backendUrl,
|
|
9467
9471
|
entrySurface: this.options.entrySurface,
|
|
@@ -9480,13 +9484,13 @@ class xt {
|
|
|
9480
9484
|
currentSession: () => this.state.sessionId,
|
|
9481
9485
|
sessionReferences: () => []
|
|
9482
9486
|
});
|
|
9483
|
-
this.socket =
|
|
9484
|
-
this.socket ===
|
|
9485
|
-
}, fc)),
|
|
9486
|
-
this.socket ===
|
|
9487
|
-
}),
|
|
9488
|
-
this.socket !==
|
|
9489
|
-
}), 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", {
|
|
9490
9494
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9491
9495
|
isThinking: this.state.isThinking
|
|
9492
9496
|
}), !(this.token ? this.sendNow({
|
|
@@ -9496,67 +9500,67 @@ class xt {
|
|
|
9496
9500
|
transportId: this.transportIdentity.transportId,
|
|
9497
9501
|
pageUrl: location.href
|
|
9498
9502
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
9499
|
-
this.socket ===
|
|
9503
|
+
this.socket === a && (z("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
|
|
9500
9504
|
}, mc));
|
|
9501
|
-
}),
|
|
9502
|
-
if (this.socket !==
|
|
9505
|
+
}), a.addEventListener("message", (c) => {
|
|
9506
|
+
if (this.socket !== a)
|
|
9503
9507
|
return;
|
|
9504
|
-
const
|
|
9505
|
-
if (
|
|
9508
|
+
const d = Vi(c.data);
|
|
9509
|
+
if (a instanceof B && d.type === "tool.call" && !Yc(d)) {
|
|
9506
9510
|
this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
|
|
9507
9511
|
return;
|
|
9508
9512
|
}
|
|
9509
|
-
const
|
|
9510
|
-
|
|
9511
|
-
}),
|
|
9512
|
-
this.socket ===
|
|
9513
|
-
}),
|
|
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) => {
|
|
9514
9518
|
if (this.clientRuntime.isDisposed || this.state.status === "closed") return;
|
|
9515
|
-
const
|
|
9516
|
-
this.pendingTransportDiagnostics = [...this.pendingTransportDiagnostics.filter((
|
|
9517
|
-
}),
|
|
9518
|
-
this.socket ===
|
|
9519
|
-
code: typeof
|
|
9520
|
-
reason: typeof
|
|
9521
|
-
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,
|
|
9522
9526
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9523
9527
|
isThinking: this.state.isThinking
|
|
9524
|
-
}), (typeof
|
|
9525
|
-
closeCode: typeof
|
|
9526
|
-
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
|
|
9527
9531
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
9528
|
-
}),
|
|
9529
|
-
this.socket !==
|
|
9532
|
+
}), a.addEventListener("error", () => {
|
|
9533
|
+
this.socket !== a || this.state.status === "closed" || (z("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
9530
9534
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
9531
9535
|
isThinking: this.state.isThinking
|
|
9532
|
-
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(),
|
|
9533
|
-
}), e &&
|
|
9534
|
-
} catch (
|
|
9535
|
-
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")
|
|
9536
9540
|
return;
|
|
9537
|
-
if (
|
|
9538
|
-
this.handleDirectoryTransportError(
|
|
9541
|
+
if (o instanceof R && (o.code === "unauthorized" || o.code === "update_required")) {
|
|
9542
|
+
this.handleDirectoryTransportError(o);
|
|
9539
9543
|
return;
|
|
9540
9544
|
}
|
|
9541
|
-
const
|
|
9542
|
-
if (as(
|
|
9543
|
-
|
|
9544
|
-
message:
|
|
9545
|
+
const a = rt(o);
|
|
9546
|
+
if (as(o)) {
|
|
9547
|
+
z("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
9548
|
+
message: a.message,
|
|
9545
9549
|
reconnectAttempt: this.reconnectAttempts
|
|
9546
|
-
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(
|
|
9550
|
+
}), this.reportTransportDiagnostic("auth_timeout", this.connectionFailureDiagnostic(o, "token_provider")), this.setState({
|
|
9547
9551
|
status: "reconnecting",
|
|
9548
9552
|
lastError: Fi,
|
|
9549
9553
|
lastErrorCode: "connection_failed"
|
|
9550
|
-
}), this.emit("error",
|
|
9551
|
-
|
|
9554
|
+
}), this.emit("error", a), this.scheduleReconnect(
|
|
9555
|
+
o instanceof ce ? o.retryAfterMs : void 0
|
|
9552
9556
|
);
|
|
9553
9557
|
return;
|
|
9554
9558
|
}
|
|
9555
|
-
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({
|
|
9556
9560
|
status: "error",
|
|
9557
|
-
lastError:
|
|
9561
|
+
lastError: a.message,
|
|
9558
9562
|
lastErrorCode: "connection_failed"
|
|
9559
|
-
}), this.emit("error",
|
|
9563
|
+
}), this.emit("error", a), a);
|
|
9560
9564
|
} finally {
|
|
9561
9565
|
this.connectionInProgress = !1;
|
|
9562
9566
|
}
|
|
@@ -9564,12 +9568,12 @@ class xt {
|
|
|
9564
9568
|
}
|
|
9565
9569
|
disconnect() {
|
|
9566
9570
|
return this.clientRuntime.route("conversation", { core: () => {
|
|
9567
|
-
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;
|
|
9568
9572
|
} });
|
|
9569
9573
|
}
|
|
9570
9574
|
destroy() {
|
|
9571
9575
|
if (!this.clientRuntime.isDisposed) {
|
|
9572
|
-
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 = [];
|
|
9573
9577
|
for (const e of Object.values(this.listeners))
|
|
9574
9578
|
e?.clear();
|
|
9575
9579
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.conversationUnsubscribe?.(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
|
|
@@ -9661,8 +9665,8 @@ class xt {
|
|
|
9661
9665
|
if (!(w && !w.cancelled && w.delivery !== "accepted" && w.delivery !== "failed"))
|
|
9662
9666
|
if (_?.(), b?.(), w?.delivery === "failed" && !w.cancelled) y(new Error(w.error?.message ?? "Message delivery failed."));
|
|
9663
9667
|
else {
|
|
9664
|
-
const
|
|
9665
|
-
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);
|
|
9666
9670
|
}
|
|
9667
9671
|
};
|
|
9668
9672
|
_ = this.clientRuntime.engine.subscribe(I), b = this.clientRuntime.onDispose(() => {
|
|
@@ -9721,7 +9725,7 @@ class xt {
|
|
|
9721
9725
|
} }), !0);
|
|
9722
9726
|
}
|
|
9723
9727
|
createLocalAttachment(e) {
|
|
9724
|
-
this.options.productVariant === "customer_embedded" &&
|
|
9728
|
+
this.options.productVariant === "customer_embedded" && Ad(e);
|
|
9725
9729
|
const s = W(), i = {
|
|
9726
9730
|
id: s,
|
|
9727
9731
|
name: e.name || "attachment",
|
|
@@ -9739,7 +9743,7 @@ class xt {
|
|
|
9739
9743
|
lastUsedAt: n
|
|
9740
9744
|
});
|
|
9741
9745
|
return this.attachmentPersistence.set(s, r), r.catch((o) => {
|
|
9742
|
-
|
|
9746
|
+
z("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
9743
9747
|
attachmentId: s,
|
|
9744
9748
|
name: i.name,
|
|
9745
9749
|
message: o instanceof Error ? o.message : String(o)
|
|
@@ -10040,16 +10044,16 @@ class xt {
|
|
|
10040
10044
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
10041
10045
|
return !1;
|
|
10042
10046
|
const s = this.socket;
|
|
10043
|
-
if ((e.type === "tool.result" || e.type === "run.stop") && s instanceof
|
|
10047
|
+
if ((e.type === "tool.result" || e.type === "run.stop") && s instanceof B) {
|
|
10044
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;
|
|
10045
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) => {
|
|
10046
10050
|
this.pendingRetainedCommandDeliveries.delete(i), n && (this.queuedClientEvents = this.queuedClientEvents.filter((r) => r !== i), ye(this.options.clientId, this.queuedClientEvents));
|
|
10047
10051
|
})), !0;
|
|
10048
10052
|
}
|
|
10049
10053
|
try {
|
|
10050
|
-
return s.send(JSON.stringify(e)),
|
|
10054
|
+
return s.send(JSON.stringify(e)), Ee("client_event", e.type, is(e)), !0;
|
|
10051
10055
|
} catch (i) {
|
|
10052
|
-
return
|
|
10056
|
+
return z("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
10053
10057
|
message: i instanceof Error ? i.message : String(i),
|
|
10054
10058
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
10055
10059
|
isThinking: this.state.isThinking
|
|
@@ -10096,8 +10100,8 @@ class xt {
|
|
|
10096
10100
|
...s,
|
|
10097
10101
|
...s.renderedError?.runId ? { runId: s.renderedError.runId } : {}
|
|
10098
10102
|
}, { errorDiagnostic: o, responseDiagnostics: a, renderedError: c, uiInvariant: d, timings: u, httpRequest: l, historyRefreshFailure: h, ...f } = r;
|
|
10099
|
-
for (const m of u ?? [])
|
|
10100
|
-
if (
|
|
10103
|
+
for (const m of u ?? []) Ee("client_event", "operation_timing", { ...m });
|
|
10104
|
+
if (Ee("client_event", "runtime.health", {
|
|
10101
10105
|
...f,
|
|
10102
10106
|
signalName: e,
|
|
10103
10107
|
...h ? { historyRefreshConsecutiveFailures: h.consecutiveFailures, historyRefreshEpisodeId: h.episodeId } : {}
|
|
@@ -10111,7 +10115,7 @@ class xt {
|
|
|
10111
10115
|
signal: r
|
|
10112
10116
|
}));
|
|
10113
10117
|
} catch (m) {
|
|
10114
|
-
|
|
10118
|
+
z("web-sdk.agent", "Pluno health signal send failed", {
|
|
10115
10119
|
name: e,
|
|
10116
10120
|
message: m instanceof Error ? m.message : String(m)
|
|
10117
10121
|
}), this.queueHealthDiagnostic(r);
|
|
@@ -10178,7 +10182,7 @@ class xt {
|
|
|
10178
10182
|
reportTransportDiagnostic(e, s = {}) {
|
|
10179
10183
|
const i = typeof navigator > "u" ? "unknown" : navigator.onLine === !1 ? "offline" : "online";
|
|
10180
10184
|
s.stage && (this.lastRecoveryStage = s.stage);
|
|
10181
|
-
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 = {
|
|
10182
10186
|
id: a?.id ?? crypto.randomUUID(),
|
|
10183
10187
|
phase: e,
|
|
10184
10188
|
entrySurface: this.options.entrySurface,
|
|
@@ -10192,7 +10196,7 @@ class xt {
|
|
|
10192
10196
|
...s,
|
|
10193
10197
|
connectionAttemptId: n
|
|
10194
10198
|
};
|
|
10195
|
-
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 = [
|
|
10196
10200
|
...this.pendingTransportDiagnostics.filter((d) => d.id !== c.id),
|
|
10197
10201
|
c
|
|
10198
10202
|
], this.pendingTransportDiagnostics.splice(0, Math.max(0, this.pendingTransportDiagnostics.length - 20)), this.flushClientDiagnostics());
|
|
@@ -10309,7 +10313,7 @@ class xt {
|
|
|
10309
10313
|
}
|
|
10310
10314
|
flushQueuedClientEvents() {
|
|
10311
10315
|
const e = [...this.queuedClientEvents];
|
|
10312
|
-
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);
|
|
10313
10317
|
for (let s = 0; s < e.length; s++)
|
|
10314
10318
|
if (!this.sendNow(te(e[s]))) {
|
|
10315
10319
|
this.queuedClientEvents.unshift(...e.slice(s).filter((i) => !this.queuedClientEvents.includes(i)));
|
|
@@ -10391,7 +10395,7 @@ class xt {
|
|
|
10391
10395
|
}
|
|
10392
10396
|
}
|
|
10393
10397
|
handleServerEvent(e) {
|
|
10394
|
-
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)) {
|
|
10395
10399
|
this.conversationObservation?.receive(e);
|
|
10396
10400
|
return;
|
|
10397
10401
|
}
|
|
@@ -10456,7 +10460,7 @@ class xt {
|
|
|
10456
10460
|
}
|
|
10457
10461
|
if ((e.code === "unauthorized" || e.code === "401") && e.reason === "token_expired" && e.retryable === !0 && this.options.tokenProvider) {
|
|
10458
10462
|
const s = this.socket;
|
|
10459
|
-
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());
|
|
10460
10464
|
return;
|
|
10461
10465
|
}
|
|
10462
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")) {
|
|
@@ -10570,10 +10574,30 @@ class xt {
|
|
|
10570
10574
|
if (this.pageLifecycleCleanup)
|
|
10571
10575
|
return;
|
|
10572
10576
|
const e = () => {
|
|
10573
|
-
Kn(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
10577
|
+
Kn(this.options.clientId, this.activeBrowserToolCalls.values()), this.embeddedRecoverySuspended = !0;
|
|
10578
|
+
};
|
|
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;
|
|
10574
10598
|
};
|
|
10575
|
-
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
10576
|
-
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
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);
|
|
10577
10601
|
};
|
|
10578
10602
|
}
|
|
10579
10603
|
installSessionBrowserApis() {
|
|
@@ -10589,8 +10613,8 @@ class xt {
|
|
|
10589
10613
|
return i.ok === !1 ? id(i) : null;
|
|
10590
10614
|
}
|
|
10591
10615
|
enableNetworkCapture() {
|
|
10592
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup = (this.options.runtimeAdapters?.subscribeNetworkCapture ??
|
|
10593
|
-
|
|
10616
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = (this.options.runtimeAdapters?.subscribeNetworkCapture ?? jn)((e) => {
|
|
10617
|
+
Bd(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
10594
10618
|
}));
|
|
10595
10619
|
}
|
|
10596
10620
|
enqueueNetworkEvent(e) {
|
|
@@ -10607,26 +10631,36 @@ class xt {
|
|
|
10607
10631
|
}
|
|
10608
10632
|
startEmbeddedRecoveryBudget(e = !1) {
|
|
10609
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
|
+
}
|
|
10610
10638
|
if (this.embeddedRecoveryTimer !== null) {
|
|
10611
10639
|
if (!e || this.embeddedRecoveryTokenExpired || !this.authenticatedUserId) return;
|
|
10612
10640
|
this.clearEmbeddedRecoveryBudget();
|
|
10613
10641
|
}
|
|
10614
10642
|
this.embeddedRecoveryTokenExpired = e, this.recoveryDiagnosticId = crypto.randomUUID();
|
|
10615
|
-
const s = this.authenticatedUserId ? (e ? 30 : 10) * 6e4 : 12e4
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
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
|
+
}
|
|
10626
10659
|
}, s);
|
|
10660
|
+
this.embeddedRecoveryTimer = i;
|
|
10627
10661
|
}
|
|
10628
10662
|
clearEmbeddedRecoveryBudget() {
|
|
10629
|
-
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;
|
|
10630
10664
|
}
|
|
10631
10665
|
connectionFailureDiagnostic(e, s) {
|
|
10632
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;
|
|
@@ -10642,11 +10676,11 @@ class xt {
|
|
|
10642
10676
|
return;
|
|
10643
10677
|
const s = Math.min(
|
|
10644
10678
|
Ns,
|
|
10645
|
-
Math.max(
|
|
10679
|
+
Math.max(Ec(this.reconnectAttempts), e)
|
|
10646
10680
|
);
|
|
10647
10681
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
10648
|
-
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof
|
|
10649
|
-
|
|
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", {
|
|
10650
10684
|
message: n instanceof Error ? n.message : String(n),
|
|
10651
10685
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
10652
10686
|
isThinking: this.state.isThinking
|
|
@@ -10686,11 +10720,11 @@ class xt {
|
|
|
10686
10720
|
authReason: ["invalid_token", "token_expired", "missing_token", "user_not_found"].includes(s?.reason ?? "") ? s.reason : "unknown",
|
|
10687
10721
|
authTransport: s?.authTransport === "http" ? "http" : "socket",
|
|
10688
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 } : {} } : {},
|
|
10689
|
-
...this.socket instanceof
|
|
10723
|
+
...this.socket instanceof B ? { connectionAttemptId: this.socket.connectionAttempt?.connectionAttemptId } : {}
|
|
10690
10724
|
};
|
|
10691
10725
|
}
|
|
10692
10726
|
stopAuthentication(e, s = !1) {
|
|
10693
|
-
s || this.reportTransportDiagnostic("auth_rejected", {
|
|
10727
|
+
this.embeddedRecoveryExhausted = !1, s || this.reportTransportDiagnostic("auth_rejected", {
|
|
10694
10728
|
...this.authenticationDiagnostic(e),
|
|
10695
10729
|
failureKind: "permanent",
|
|
10696
10730
|
recoveryOutcome: "refused"
|
|
@@ -10707,7 +10741,7 @@ class xt {
|
|
|
10707
10741
|
if (this.credentialRecovery) return this.credentialRecovery;
|
|
10708
10742
|
if (this.directoryHttp.auth.token !== e) return;
|
|
10709
10743
|
const r = this.socket;
|
|
10710
|
-
if (r instanceof
|
|
10744
|
+
if (r instanceof B) return this.refreshCredentials(r, s);
|
|
10711
10745
|
if (this.options.webSocketFactory) throw s;
|
|
10712
10746
|
}
|
|
10713
10747
|
throw this.stopAuthentication(s), s;
|
|
@@ -10744,7 +10778,7 @@ class xt {
|
|
|
10744
10778
|
}
|
|
10745
10779
|
async refreshDefaultTransportCredentials(e) {
|
|
10746
10780
|
this.authenticationFailure || await this.refreshCredentials(e).catch((s) => {
|
|
10747
|
-
|
|
10781
|
+
z("web-sdk.agent", "Pluno credential refresh did not complete", {
|
|
10748
10782
|
message: s instanceof Error ? s.message : String(s)
|
|
10749
10783
|
});
|
|
10750
10784
|
});
|
|
@@ -10753,7 +10787,7 @@ class xt {
|
|
|
10753
10787
|
this.stopHeartbeat(), this.options.webSocketFactory && (this.heartbeatTimer = window.setInterval(() => {
|
|
10754
10788
|
const e = this.socket;
|
|
10755
10789
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
10756
|
-
this.socket === e && (
|
|
10790
|
+
this.socket === e && (z("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
10757
10791
|
}, uc));
|
|
10758
10792
|
}, lc));
|
|
10759
10793
|
}
|
|
@@ -10779,7 +10813,7 @@ class xt {
|
|
|
10779
10813
|
this.clientRuntime.isDisposed || (this.state = e, this.rebuildRuntimeInteractions(), this.emit("state", this.getState()));
|
|
10780
10814
|
}
|
|
10781
10815
|
setReconnectingState() {
|
|
10782
|
-
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;
|
|
10783
10817
|
this.conversationObservation?.wake();
|
|
10784
10818
|
const e = this.state.lastError !== null && (!this.state.isThinking || this.state.lastErrorCode === "connection_failed");
|
|
10785
10819
|
this.setState({
|
|
@@ -10791,13 +10825,13 @@ class xt {
|
|
|
10791
10825
|
}
|
|
10792
10826
|
}
|
|
10793
10827
|
const ds = /* @__PURE__ */ new WeakMap();
|
|
10794
|
-
function
|
|
10795
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
10828
|
+
function jn(t) {
|
|
10829
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Ac();
|
|
10796
10830
|
return e.subscribers.add(t), () => {
|
|
10797
10831
|
e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
10798
10832
|
};
|
|
10799
10833
|
}
|
|
10800
|
-
function
|
|
10834
|
+
function Ac() {
|
|
10801
10835
|
const t = /* @__PURE__ */ new Set(), e = (h) => {
|
|
10802
10836
|
t.forEach((f) => {
|
|
10803
10837
|
try {
|
|
@@ -10815,7 +10849,7 @@ function kc() {
|
|
|
10815
10849
|
}
|
|
10816
10850
|
try {
|
|
10817
10851
|
const y = f instanceof Request ? f : null, _ = Pd(f, y), b = Qn(m?.headers ?? y?.headers);
|
|
10818
|
-
if (!
|
|
10852
|
+
if (!ke(_, b, m?.body)) {
|
|
10819
10853
|
const w = {
|
|
10820
10854
|
requestId: hs("fetch"),
|
|
10821
10855
|
url: de(_, os),
|
|
@@ -10826,19 +10860,19 @@ function kc() {
|
|
|
10826
10860
|
startedAt: new Date(p).toISOString()
|
|
10827
10861
|
};
|
|
10828
10862
|
g.then(
|
|
10829
|
-
(
|
|
10830
|
-
xd(
|
|
10863
|
+
(k) => {
|
|
10864
|
+
xd(k, w, p, e).catch(() => {
|
|
10831
10865
|
e({
|
|
10832
10866
|
...w,
|
|
10833
|
-
responseStatus:
|
|
10867
|
+
responseStatus: k.status,
|
|
10834
10868
|
durationMs: Date.now() - p
|
|
10835
10869
|
});
|
|
10836
10870
|
});
|
|
10837
10871
|
},
|
|
10838
|
-
(
|
|
10872
|
+
(k) => {
|
|
10839
10873
|
e({
|
|
10840
10874
|
...w,
|
|
10841
|
-
errorText: de(
|
|
10875
|
+
errorText: de(k instanceof Error ? k.message : String(k)),
|
|
10842
10876
|
durationMs: Date.now() - p
|
|
10843
10877
|
});
|
|
10844
10878
|
}
|
|
@@ -10856,15 +10890,15 @@ function kc() {
|
|
|
10856
10890
|
requestHeaders: {},
|
|
10857
10891
|
startedAtMs: Date.now(),
|
|
10858
10892
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10859
|
-
excluded:
|
|
10893
|
+
excluded: ke(b)
|
|
10860
10894
|
}), _;
|
|
10861
10895
|
}, c = function(f, m) {
|
|
10862
10896
|
const p = n.call(this, f, m), g = ds.get(this);
|
|
10863
|
-
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;
|
|
10864
10898
|
}, d = function(f) {
|
|
10865
10899
|
try {
|
|
10866
10900
|
const m = ds.get(this);
|
|
10867
|
-
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(
|
|
10868
10902
|
"loadend",
|
|
10869
10903
|
() => {
|
|
10870
10904
|
queueMicrotask(() => {
|
|
@@ -10916,7 +10950,7 @@ function kc() {
|
|
|
10916
10950
|
u = new PerformanceObserver((h) => {
|
|
10917
10951
|
for (const f of h.getEntries()) {
|
|
10918
10952
|
const m = f;
|
|
10919
|
-
if (m.initiatorType === "fetch" || m.initiatorType === "xmlhttprequest" ||
|
|
10953
|
+
if (m.initiatorType === "fetch" || m.initiatorType === "xmlhttprequest" || ke(m.name))
|
|
10920
10954
|
continue;
|
|
10921
10955
|
const p = performance.timeOrigin + m.startTime;
|
|
10922
10956
|
e({
|
|
@@ -10960,7 +10994,7 @@ function kc() {
|
|
|
10960
10994
|
};
|
|
10961
10995
|
return window.__plunoProductAgentNetworkCapture = l, l;
|
|
10962
10996
|
}
|
|
10963
|
-
function
|
|
10997
|
+
function z(t, e, s) {
|
|
10964
10998
|
if (typeof window > "u")
|
|
10965
10999
|
return;
|
|
10966
11000
|
const i = window, n = {
|
|
@@ -10987,7 +11021,7 @@ function Ln() {
|
|
|
10987
11021
|
};
|
|
10988
11022
|
}
|
|
10989
11023
|
function hl(t) {
|
|
10990
|
-
const e = Ln(), s =
|
|
11024
|
+
const e = Ln(), s = jn(t);
|
|
10991
11025
|
return () => {
|
|
10992
11026
|
s(), e();
|
|
10993
11027
|
};
|
|
@@ -11005,7 +11039,7 @@ async function Oc(t, e = {}) {
|
|
|
11005
11039
|
return i.ok ? i.sizeBytes > 8 * 1024 * 1024 ? {
|
|
11006
11040
|
type: "pluno.pageImages.inspectImage",
|
|
11007
11041
|
imageAttached: !1,
|
|
11008
|
-
imageAttachmentError:
|
|
11042
|
+
imageAttachmentError: Bn
|
|
11009
11043
|
} : {
|
|
11010
11044
|
type: "pluno.pageImages.inspectImage",
|
|
11011
11045
|
imageAttached: !0,
|
|
@@ -11020,11 +11054,11 @@ async function Oc(t, e = {}) {
|
|
|
11020
11054
|
};
|
|
11021
11055
|
}
|
|
11022
11056
|
async function Pc(t) {
|
|
11023
|
-
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 } : {
|
|
11024
11058
|
ok: !0,
|
|
11025
11059
|
mimeType: t.type,
|
|
11026
11060
|
sizeBytes: t.size,
|
|
11027
|
-
dataUrl: await
|
|
11061
|
+
dataUrl: await Bc(t)
|
|
11028
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);
|
|
11029
11063
|
}
|
|
11030
11064
|
function xc(t) {
|
|
@@ -11061,7 +11095,7 @@ function Nc(t) {
|
|
|
11061
11095
|
} catch {
|
|
11062
11096
|
}
|
|
11063
11097
|
}
|
|
11064
|
-
function
|
|
11098
|
+
function Bc(t) {
|
|
11065
11099
|
return new Promise((e, s) => {
|
|
11066
11100
|
const i = new FileReader();
|
|
11067
11101
|
i.onload = () => {
|
|
@@ -11093,7 +11127,7 @@ async function Hi(t) {
|
|
|
11093
11127
|
r = window.setTimeout(() => u(c), s);
|
|
11094
11128
|
})
|
|
11095
11129
|
]);
|
|
11096
|
-
return d === c ?
|
|
11130
|
+
return d === c ? jc(s) : {
|
|
11097
11131
|
ok: !0,
|
|
11098
11132
|
result: d,
|
|
11099
11133
|
console: n,
|
|
@@ -11122,7 +11156,7 @@ async function Hi(t) {
|
|
|
11122
11156
|
r !== void 0 && window.clearTimeout(r), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
|
|
11123
11157
|
}
|
|
11124
11158
|
}
|
|
11125
|
-
function
|
|
11159
|
+
function jc(t) {
|
|
11126
11160
|
return {
|
|
11127
11161
|
ok: !1,
|
|
11128
11162
|
exception: {
|
|
@@ -11324,41 +11358,41 @@ function Wc(t, e) {
|
|
|
11324
11358
|
const I = b.getAttribute("data-testid") || b.getAttribute("data-test") || b.getAttribute("data-qa") || b.getAttribute("data-cy") || "";
|
|
11325
11359
|
return `${b.tagName.toLowerCase()}|${m(b)}|${I}`;
|
|
11326
11360
|
}, g = (b, I, w) => {
|
|
11327
|
-
const
|
|
11328
|
-
const S =
|
|
11329
|
-
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")
|
|
11330
11364
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
11331
11365
|
f += 1;
|
|
11332
|
-
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();
|
|
11333
11367
|
for (const O of C) {
|
|
11334
|
-
const
|
|
11335
|
-
U.set(
|
|
11368
|
+
const L = p(O);
|
|
11369
|
+
U.set(L, (U.get(L) ?? 0) + 1);
|
|
11336
11370
|
}
|
|
11337
11371
|
const $ = /* @__PURE__ */ new Map(), Ce = /* @__PURE__ */ new Map();
|
|
11338
11372
|
for (const O of C) {
|
|
11339
|
-
const
|
|
11340
|
-
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);
|
|
11341
11375
|
}
|
|
11342
11376
|
const Qe = /* @__PURE__ */ new Map(), ii = /* @__PURE__ */ new Set(), Ut = [], ni = [];
|
|
11343
11377
|
for (const O of C) {
|
|
11344
|
-
const
|
|
11345
|
-
if (Qe.set(
|
|
11346
|
-
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));
|
|
11347
11381
|
continue;
|
|
11348
11382
|
}
|
|
11349
|
-
const ci =
|
|
11383
|
+
const ci = k(O, D);
|
|
11350
11384
|
ni.push(ci), Ut.push(ci.lines);
|
|
11351
11385
|
}
|
|
11352
11386
|
const Nt = [];
|
|
11353
|
-
if (
|
|
11354
|
-
for (const O of Array.from(
|
|
11355
|
-
O instanceof HTMLElement && Nt.push(
|
|
11356
|
-
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(
|
|
11357
11391
|
[T, ...Xe.map((O) => O.textPreview)].filter(Boolean).join(" ")
|
|
11358
|
-
).slice(0, 180), rr =
|
|
11359
|
-
if (
|
|
11360
|
-
const O = Xe.some((ue) => ue.containsTextElement),
|
|
11361
|
-
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)));
|
|
11362
11396
|
}
|
|
11363
11397
|
for (const O of Ut)
|
|
11364
11398
|
Oe.push(...ot(O, Lt));
|
|
@@ -11366,21 +11400,21 @@ function Wc(t, e) {
|
|
|
11366
11400
|
if (Ft.length > 0) {
|
|
11367
11401
|
const O = Ft.slice(0, 20);
|
|
11368
11402
|
Ft.length > O.length && O.push("… shadow DOM omitted");
|
|
11369
|
-
const
|
|
11370
|
-
if (D < 2 && !
|
|
11371
|
-
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`;
|
|
11372
11406
|
Oe.push(...ot([ue, ...ot(O, 1)], Lt));
|
|
11373
11407
|
} else
|
|
11374
11408
|
Oe.push(...ot(O, Lt));
|
|
11375
11409
|
}
|
|
11376
11410
|
return {
|
|
11377
11411
|
lines: Oe,
|
|
11378
|
-
hasUsefulContent:
|
|
11412
|
+
hasUsefulContent: Bt,
|
|
11379
11413
|
textPreview: ri,
|
|
11380
11414
|
containsTextElement: i.has(S) || Xe.some((O) => O.containsTextElement)
|
|
11381
11415
|
};
|
|
11382
11416
|
};
|
|
11383
|
-
return [`--- ${I} ---`, ...
|
|
11417
|
+
return [`--- ${I} ---`, ...k(b, 0).lines].join(`
|
|
11384
11418
|
`);
|
|
11385
11419
|
}, y = [], _ = qe(window.getSelection()?.toString() ?? "");
|
|
11386
11420
|
_ && y.push(`--- selected text ---
|
|
@@ -11495,7 +11529,7 @@ function Qc(t) {
|
|
|
11495
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);
|
|
11496
11530
|
}
|
|
11497
11531
|
function Xc() {
|
|
11498
|
-
const t = Array.from(document.querySelectorAll(
|
|
11532
|
+
const t = Array.from(document.querySelectorAll(ji)), e = t.find(
|
|
11499
11533
|
(r) => typeof r[ac] == "string"
|
|
11500
11534
|
);
|
|
11501
11535
|
if (!(e ?? t[0]))
|
|
@@ -11507,7 +11541,7 @@ function Xc() {
|
|
|
11507
11541
|
selectors: [
|
|
11508
11542
|
{
|
|
11509
11543
|
name: "widget_host",
|
|
11510
|
-
selector:
|
|
11544
|
+
selector: ji,
|
|
11511
11545
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
11512
11546
|
},
|
|
11513
11547
|
{
|
|
@@ -11626,15 +11660,15 @@ function Hn(t, e) {
|
|
|
11626
11660
|
id: typeof n.id == "string" ? n.id : String(s.id ?? crypto.randomUUID()),
|
|
11627
11661
|
role: "assistant",
|
|
11628
11662
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
11629
|
-
content:
|
|
11663
|
+
content: Ae(
|
|
11630
11664
|
Gi(n.content),
|
|
11631
11665
|
e
|
|
11632
11666
|
),
|
|
11633
11667
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11634
|
-
...
|
|
11668
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11635
11669
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11636
11670
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11637
|
-
...
|
|
11671
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11638
11672
|
dataType: "assistant_draft",
|
|
11639
11673
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
11640
11674
|
};
|
|
@@ -11643,15 +11677,15 @@ function Hn(t, e) {
|
|
|
11643
11677
|
id: String(s.id ?? crypto.randomUUID()),
|
|
11644
11678
|
role: r,
|
|
11645
11679
|
...n.phase === "commentary" || n.phase === "final_answer" ? { phase: n.phase } : {},
|
|
11646
|
-
content:
|
|
11680
|
+
content: Ae(
|
|
11647
11681
|
Gi(n.content),
|
|
11648
11682
|
e
|
|
11649
11683
|
),
|
|
11650
11684
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11651
|
-
...
|
|
11685
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11652
11686
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11653
11687
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11654
|
-
...
|
|
11688
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11655
11689
|
attachments: Vn(n.attachments, e),
|
|
11656
11690
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
11657
11691
|
};
|
|
@@ -11674,12 +11708,12 @@ function Hn(t, e) {
|
|
|
11674
11708
|
role: "tool",
|
|
11675
11709
|
content: "",
|
|
11676
11710
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11677
|
-
...
|
|
11711
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11678
11712
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11679
|
-
...
|
|
11713
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11680
11714
|
dataType: "function_call_output",
|
|
11681
11715
|
toolName: On,
|
|
11682
|
-
callId:
|
|
11716
|
+
callId: Be(n) ?? void 0,
|
|
11683
11717
|
sharePromptAllowed: r
|
|
11684
11718
|
};
|
|
11685
11719
|
const o = Ha(n.output);
|
|
@@ -11689,12 +11723,12 @@ function Hn(t, e) {
|
|
|
11689
11723
|
role: "tool",
|
|
11690
11724
|
content: "",
|
|
11691
11725
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11692
|
-
...
|
|
11726
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11693
11727
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11694
|
-
...
|
|
11728
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11695
11729
|
dataType: "scheduled_check_in",
|
|
11696
11730
|
toolName: xn,
|
|
11697
|
-
callId:
|
|
11731
|
+
callId: Be(n) ?? void 0,
|
|
11698
11732
|
scheduledCheckInId: o.id ?? void 0,
|
|
11699
11733
|
scheduledCheckInAt: o.dueAt
|
|
11700
11734
|
};
|
|
@@ -11704,26 +11738,26 @@ function Hn(t, e) {
|
|
|
11704
11738
|
role: "tool",
|
|
11705
11739
|
content: `Connect ${a.appName} to continue`,
|
|
11706
11740
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11707
|
-
...
|
|
11741
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11708
11742
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11709
11743
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11710
|
-
...
|
|
11744
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11711
11745
|
dataType: "function_call_output",
|
|
11712
11746
|
toolName: "authenticate_pipedream_app",
|
|
11713
|
-
callId:
|
|
11747
|
+
callId: Be(n) ?? void 0,
|
|
11714
11748
|
integrationAuthRequest: a
|
|
11715
11749
|
} : c ? {
|
|
11716
11750
|
id: String(s.id ?? crypto.randomUUID()),
|
|
11717
11751
|
role: "tool",
|
|
11718
11752
|
content: "Connect WhatsApp to continue",
|
|
11719
11753
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11720
|
-
...
|
|
11754
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11721
11755
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11722
11756
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11723
|
-
...
|
|
11757
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11724
11758
|
dataType: "function_call_output",
|
|
11725
11759
|
toolName: "request_personal_channel_connection",
|
|
11726
|
-
callId:
|
|
11760
|
+
callId: Be(n) ?? void 0,
|
|
11727
11761
|
personalChannelConnectionRequest: c
|
|
11728
11762
|
} : null;
|
|
11729
11763
|
}
|
|
@@ -11732,13 +11766,13 @@ function Hn(t, e) {
|
|
|
11732
11766
|
role: "tool",
|
|
11733
11767
|
content: n.type === "mcp_call" ? rd(n) : dd(n),
|
|
11734
11768
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11735
|
-
...
|
|
11769
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11736
11770
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11737
11771
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11738
|
-
...
|
|
11772
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11739
11773
|
dataType: String(n.type),
|
|
11740
11774
|
toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
|
|
11741
|
-
callId:
|
|
11775
|
+
callId: Be(n) ?? void 0,
|
|
11742
11776
|
loading: n.steered === !0 ? !1 : n.localExecutionStatus === "queued" || n.localExecutionStatus === "running" ? !0 : typeof n.localExecutionStatus == "string" ? !1 : void 0,
|
|
11743
11777
|
...n.steered === !0 ? { steered: !0 } : {}
|
|
11744
11778
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
@@ -11746,10 +11780,10 @@ function Hn(t, e) {
|
|
|
11746
11780
|
role: "system",
|
|
11747
11781
|
content: cd(n),
|
|
11748
11782
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
11749
|
-
...
|
|
11783
|
+
...H(n) !== null ? { displaySequence: H(n) } : {},
|
|
11750
11784
|
...ee(n) !== null ? { causalSequence: ee(n) } : {},
|
|
11751
11785
|
respondsToUserMessageId: he(n) ?? void 0,
|
|
11752
|
-
...
|
|
11786
|
+
...K(n) ? { runId: K(n) } : {},
|
|
11753
11787
|
dataType: String(n.type),
|
|
11754
11788
|
loading: n.steered !== !0 && n.type === "run_status" && (n.status === "running" || n.status === "retrying"),
|
|
11755
11789
|
...n.steered === !0 || n.type === "run_status" && n.status === "steered" ? { steered: !0 } : {},
|
|
@@ -11827,14 +11861,14 @@ function $e(t) {
|
|
|
11827
11861
|
const e = t.trim() || "Run tool", s = e.codePointAt(0) ?? 0;
|
|
11828
11862
|
return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? e : `🛠️ ${e}`;
|
|
11829
11863
|
}
|
|
11830
|
-
function
|
|
11864
|
+
function Be(t) {
|
|
11831
11865
|
const e = t.callId ?? t.call_id;
|
|
11832
11866
|
return typeof e == "string" && e ? e : null;
|
|
11833
11867
|
}
|
|
11834
11868
|
function ee(t) {
|
|
11835
11869
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
11836
11870
|
}
|
|
11837
|
-
function
|
|
11871
|
+
function H(t) {
|
|
11838
11872
|
return typeof t.displaySequence == "number" && Number.isSafeInteger(t.displaySequence) ? t.displaySequence : null;
|
|
11839
11873
|
}
|
|
11840
11874
|
function Gi(t) {
|
|
@@ -11940,7 +11974,7 @@ function Id(t, e) {
|
|
|
11940
11974
|
}
|
|
11941
11975
|
function wd(t) {
|
|
11942
11976
|
try {
|
|
11943
|
-
const e = window.localStorage.getItem(`${
|
|
11977
|
+
const e = window.localStorage.getItem(`${Bs}${t}`);
|
|
11944
11978
|
if (!e)
|
|
11945
11979
|
return [];
|
|
11946
11980
|
const s = JSON.parse(e);
|
|
@@ -11953,11 +11987,11 @@ function ye(t, e) {
|
|
|
11953
11987
|
try {
|
|
11954
11988
|
const s = e.filter(ti);
|
|
11955
11989
|
if (s.length === 0) {
|
|
11956
|
-
window.localStorage.removeItem(`${
|
|
11990
|
+
window.localStorage.removeItem(`${Bs}${t}`);
|
|
11957
11991
|
return;
|
|
11958
11992
|
}
|
|
11959
11993
|
window.localStorage.setItem(
|
|
11960
|
-
`${
|
|
11994
|
+
`${Bs}${t}`,
|
|
11961
11995
|
JSON.stringify(s.slice(-25))
|
|
11962
11996
|
);
|
|
11963
11997
|
} catch {
|
|
@@ -12028,7 +12062,7 @@ function Rd(t) {
|
|
|
12028
12062
|
const e = t, s = e.event;
|
|
12029
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";
|
|
12030
12064
|
}
|
|
12031
|
-
function
|
|
12065
|
+
function Ed(t, e) {
|
|
12032
12066
|
const s = new Set(
|
|
12033
12067
|
t.flatMap((i) => i.type === "tool.result" ? [i.callId] : [])
|
|
12034
12068
|
);
|
|
@@ -12037,7 +12071,7 @@ function Ad(t, e) {
|
|
|
12037
12071
|
...e.filter((i) => !s.has(i.callId))
|
|
12038
12072
|
];
|
|
12039
12073
|
}
|
|
12040
|
-
function
|
|
12074
|
+
function kd(t) {
|
|
12041
12075
|
try {
|
|
12042
12076
|
window.sessionStorage.removeItem(`${Pt}${t}`);
|
|
12043
12077
|
} catch {
|
|
@@ -12076,7 +12110,7 @@ function Wn(t, e) {
|
|
|
12076
12110
|
function Gn(t) {
|
|
12077
12111
|
return t.type || qd(t.name) || "application/octet-stream";
|
|
12078
12112
|
}
|
|
12079
|
-
function
|
|
12113
|
+
function Ad(t) {
|
|
12080
12114
|
Jn({
|
|
12081
12115
|
name: t.name,
|
|
12082
12116
|
mimeType: Gn(t),
|
|
@@ -12134,7 +12168,7 @@ function he(t) {
|
|
|
12134
12168
|
const e = t.respondsToUserMessageId;
|
|
12135
12169
|
return typeof e == "string" && e ? e : null;
|
|
12136
12170
|
}
|
|
12137
|
-
function
|
|
12171
|
+
function K(t) {
|
|
12138
12172
|
const e = t.runId;
|
|
12139
12173
|
return typeof e == "string" && e ? e : null;
|
|
12140
12174
|
}
|
|
@@ -12154,7 +12188,7 @@ function Qn(t) {
|
|
|
12154
12188
|
return e;
|
|
12155
12189
|
}
|
|
12156
12190
|
function si(t, e) {
|
|
12157
|
-
return ir(t) ? Dt : de(
|
|
12191
|
+
return ir(t) ? Dt : de(At(e), wc);
|
|
12158
12192
|
}
|
|
12159
12193
|
function Pd(t, e) {
|
|
12160
12194
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
@@ -12225,11 +12259,11 @@ function Yi(t) {
|
|
|
12225
12259
|
return t;
|
|
12226
12260
|
const e = t.trim();
|
|
12227
12261
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
12228
|
-
return
|
|
12262
|
+
return At(t);
|
|
12229
12263
|
try {
|
|
12230
12264
|
return JSON.stringify(te(JSON.parse(t)));
|
|
12231
12265
|
} catch {
|
|
12232
|
-
return
|
|
12266
|
+
return At(t);
|
|
12233
12267
|
}
|
|
12234
12268
|
}
|
|
12235
12269
|
function Xn(t) {
|
|
@@ -12238,8 +12272,8 @@ function Xn(t) {
|
|
|
12238
12272
|
const e = t.get("content-type")?.toLowerCase() ?? "", s = t.get("content-length"), i = Number(s);
|
|
12239
12273
|
return s !== null && Number.isInteger(i) && i >= 0 && i <= Xs && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
12240
12274
|
}
|
|
12241
|
-
function
|
|
12242
|
-
if (
|
|
12275
|
+
function ke(t, e = {}, s) {
|
|
12276
|
+
if (jd(s))
|
|
12243
12277
|
return !0;
|
|
12244
12278
|
const i = Object.entries(e).find(([n]) => n.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
12245
12279
|
if (i?.includes("multipart/form-data") || i?.includes("application/octet-stream"))
|
|
@@ -12254,8 +12288,8 @@ function Ee(t, e = {}, s) {
|
|
|
12254
12288
|
return !0;
|
|
12255
12289
|
}
|
|
12256
12290
|
}
|
|
12257
|
-
function
|
|
12258
|
-
if (
|
|
12291
|
+
function Bd(t, e) {
|
|
12292
|
+
if (ke(t))
|
|
12259
12293
|
return !0;
|
|
12260
12294
|
try {
|
|
12261
12295
|
const s = new URL(t, location.href), i = new URL(e);
|
|
@@ -12264,7 +12298,7 @@ function jd(t, e) {
|
|
|
12264
12298
|
return !0;
|
|
12265
12299
|
}
|
|
12266
12300
|
}
|
|
12267
|
-
function
|
|
12301
|
+
function jd(t) {
|
|
12268
12302
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
12269
12303
|
}
|
|
12270
12304
|
function Ld(t) {
|
|
@@ -12321,11 +12355,11 @@ function Kd(t) {
|
|
|
12321
12355
|
}
|
|
12322
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 = /[),.;\]]+$/;
|
|
12323
12357
|
function te(t) {
|
|
12324
|
-
return
|
|
12358
|
+
return kt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
12325
12359
|
}
|
|
12326
|
-
function
|
|
12360
|
+
function kt(t, e, s) {
|
|
12327
12361
|
if (typeof t == "string")
|
|
12328
|
-
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);
|
|
12329
12363
|
if (t === null || typeof t != "object")
|
|
12330
12364
|
return t;
|
|
12331
12365
|
if (e >= Wd)
|
|
@@ -12333,10 +12367,10 @@ function Et(t, e, s) {
|
|
|
12333
12367
|
if (s.has(t))
|
|
12334
12368
|
return "[REDACTED_CIRCULAR]";
|
|
12335
12369
|
if (s.add(t), Array.isArray(t))
|
|
12336
|
-
return t.map((n) =>
|
|
12370
|
+
return t.map((n) => kt(n, e + 1, s));
|
|
12337
12371
|
const i = {};
|
|
12338
12372
|
for (const [n, r] of Object.entries(t))
|
|
12339
|
-
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);
|
|
12340
12374
|
return i;
|
|
12341
12375
|
}
|
|
12342
12376
|
function ir(t) {
|
|
@@ -12344,7 +12378,7 @@ function ir(t) {
|
|
|
12344
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");
|
|
12345
12379
|
}
|
|
12346
12380
|
function Yd(t) {
|
|
12347
|
-
return typeof t == "string" ? nr(t) :
|
|
12381
|
+
return typeof t == "string" ? nr(t) : kt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
12348
12382
|
}
|
|
12349
12383
|
function nr(t) {
|
|
12350
12384
|
try {
|
|
@@ -12356,7 +12390,7 @@ function nr(t) {
|
|
|
12356
12390
|
return Zd(t);
|
|
12357
12391
|
}
|
|
12358
12392
|
}
|
|
12359
|
-
function
|
|
12393
|
+
function At(t) {
|
|
12360
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}`);
|
|
12361
12395
|
}
|
|
12362
12396
|
function Zd(t) {
|
|
@@ -12373,7 +12407,7 @@ function gl(t) {
|
|
|
12373
12407
|
return xt.init(t);
|
|
12374
12408
|
}
|
|
12375
12409
|
export {
|
|
12376
|
-
|
|
12410
|
+
ji as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
12377
12411
|
rc as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
12378
12412
|
nc as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
12379
12413
|
oc as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
@@ -12381,13 +12415,13 @@ export {
|
|
|
12381
12415
|
ul as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
12382
12416
|
ml as PlunoProductAgent,
|
|
12383
12417
|
rl as ProductAgentInteractionManager,
|
|
12384
|
-
|
|
12418
|
+
Ei as ProductAgentQueryController,
|
|
12385
12419
|
ll as ProductAgentRemoteRuntimeClient,
|
|
12386
12420
|
xt as ProductAgentSessionEngine,
|
|
12387
12421
|
nl as ProductAgentSessionHistoryManager,
|
|
12388
12422
|
al as ProductAgentTaskPageTitleController,
|
|
12389
12423
|
ce as ProductAgentTokenProviderError,
|
|
12390
|
-
|
|
12424
|
+
Ec as calculateReconnectDelay,
|
|
12391
12425
|
ol as createLocalStorageInteractionDecisionStorage,
|
|
12392
12426
|
gt as createProductAgentQueryState,
|
|
12393
12427
|
gl as createProductAgentRuntime,
|
|
@@ -12396,7 +12430,7 @@ export {
|
|
|
12396
12430
|
ec as formatProductAgentTaskPageTitle,
|
|
12397
12431
|
pl as getProductAgentOriginAccessErrorMessage,
|
|
12398
12432
|
hl as installProductAgentPageEnvironment,
|
|
12399
|
-
|
|
12433
|
+
ki as isProductAgentAuthReconnectError,
|
|
12400
12434
|
dl as isProductAgentRuntimeCommand,
|
|
12401
12435
|
Xo as mergeProductAgentEntityPages,
|
|
12402
12436
|
yt as normalizeProductAgentEntityPage,
|
|
@@ -12405,5 +12439,5 @@ export {
|
|
|
12405
12439
|
il as resolveProductAgentComposerAction,
|
|
12406
12440
|
sl as resolveProductAgentWidgetPresentation,
|
|
12407
12441
|
Yo as selectProductAgentQueryEntities,
|
|
12408
|
-
|
|
12442
|
+
Ad as validateProductAgentProviderInputFile
|
|
12409
12443
|
};
|