@pluno/product-agent-web 0.1.267 → 0.1.268
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/core/features/contracts.d.ts +1 -0
- package/dist/core/features/selectors.d.ts +1 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +1 -1
- package/dist/product-agent-sdk.js +770 -764
- package/dist/product-agent-widget.js +1267 -1261
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
const e = JSON.parse(t.getItem(
|
|
4
|
-
t.setItem(
|
|
1
|
+
const Os = ["main-chat-omnibox-hint", "main-chat-whatsapp-hint"], xs = "pluno.productAgent.deviceHints", Dn = ["pluno.productAgent.omniboxHintDismissed", "pluno.productAgent.whatsappHintDismissed"], Un = "pluno.productAgent.mainChatPromptDecisions";
|
|
2
|
+
function Ms(t) {
|
|
3
|
+
const e = JSON.parse(t.getItem(xs) ?? "{}"), s = JSON.parse(t.getItem(Un) ?? "[]"), n = Object.fromEntries(Os.map((i, r) => [i, e[i] === !0 || t.getItem(Dn[r]) === "true" || s.some((a) => a.scope.level === "device" && a.scope.key === "main-web-chat" && (a.promptKey === i || a.action === "dont_show_again" && a.category === (r ? "connections" : "product-tips")) && ["dismiss", "never", "dont_show_again"].includes(a.action))]));
|
|
4
|
+
t.setItem(xs, JSON.stringify(n));
|
|
5
5
|
for (const i of Dn) t.removeItem(i);
|
|
6
|
-
return t.setItem(Un, JSON.stringify(s.filter((i) => !
|
|
6
|
+
return t.setItem(Un, JSON.stringify(s.filter((i) => !Os.includes(i.promptKey)))), n;
|
|
7
7
|
}
|
|
8
8
|
function Br(t, e) {
|
|
9
|
-
if (!
|
|
10
|
-
t.setItem(
|
|
9
|
+
if (!Os.includes(e)) throw new Error("Unknown device hint.");
|
|
10
|
+
t.setItem(xs, JSON.stringify({ ...Ms(t), [e]: !0 }));
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Zt(t, e, s, n) {
|
|
13
13
|
if (s.authorityId !== t.account.authority?.authorityId || s.generation !== t.account.authority.generation) return t;
|
|
14
14
|
const i = {};
|
|
15
15
|
let r = t.interactions.openingGeneration;
|
|
@@ -87,7 +87,7 @@ const Oi = {
|
|
|
87
87
|
read_hosted_browser_eligibility: "canReadHostedBrowserEligibility",
|
|
88
88
|
manage_interactions: "canManageInteractions",
|
|
89
89
|
invoke_conversation_action: "canInvokeConversationActions"
|
|
90
|
-
},
|
|
90
|
+
}, Ps = {
|
|
91
91
|
canConnect: !0,
|
|
92
92
|
canRenderConversation: !0,
|
|
93
93
|
canShowPersonalFeatures: !0,
|
|
@@ -134,7 +134,7 @@ const Oi = {
|
|
|
134
134
|
canManageInteractions: !0,
|
|
135
135
|
canInvokeConversationActions: !0
|
|
136
136
|
}, Lr = {
|
|
137
|
-
...
|
|
137
|
+
...Ps,
|
|
138
138
|
canExecuteCurrentPageTools: !1,
|
|
139
139
|
canManageTabs: !1,
|
|
140
140
|
canUseSandboxFiles: !1,
|
|
@@ -190,8 +190,8 @@ const Oi = {
|
|
|
190
190
|
canManageInteractions: !0,
|
|
191
191
|
canInvokeConversationActions: !0
|
|
192
192
|
}, Fr = {
|
|
193
|
-
extension_sidepanel:
|
|
194
|
-
extension_widget:
|
|
193
|
+
extension_sidepanel: Ps,
|
|
194
|
+
extension_widget: Ps,
|
|
195
195
|
main_web_chat: Lr,
|
|
196
196
|
embedded_widget: Nn,
|
|
197
197
|
embedded_custom_ui: Nn
|
|
@@ -251,7 +251,7 @@ function De(t, e) {
|
|
|
251
251
|
updatedAt: s ? t.updatedAt : null
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function es(t, e) {
|
|
255
255
|
return t.key !== e.key || t.requestId !== e.requestId ? t : {
|
|
256
256
|
...t,
|
|
257
257
|
status: "ready",
|
|
@@ -282,7 +282,7 @@ function X(t) {
|
|
|
282
282
|
function Mi(t = "", e = 0) {
|
|
283
283
|
return G({ authorityId: t, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, checkpointEffectId: null, checkpointError: null });
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function Ds(t) {
|
|
286
286
|
return {
|
|
287
287
|
sessionId: t,
|
|
288
288
|
items: {},
|
|
@@ -400,7 +400,7 @@ function Ni(t) {
|
|
|
400
400
|
function cn(t) {
|
|
401
401
|
if (!{ social_share: ["dismiss", "shared"], proactive_suggestion: ["not_now", "never"], morning_report: ["snooze"] }[t.category]?.some((s) => s === t.action)) throw new Error("Unsupported category action.");
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function ts(t, e) {
|
|
404
404
|
const s = { ...t.decisions };
|
|
405
405
|
for (const n of e) {
|
|
406
406
|
if (cn(n.request), n.decisionKey !== Ni(n.request)) throw new Error("Decision scope does not match its category.");
|
|
@@ -662,7 +662,7 @@ function Vr(t, e, s, n) {
|
|
|
662
662
|
}
|
|
663
663
|
return { state: i, effects: r, command: null };
|
|
664
664
|
}
|
|
665
|
-
const
|
|
665
|
+
const oe = (t) => t;
|
|
666
666
|
function Li(t) {
|
|
667
667
|
return ["appearance", "sampleStyle", "saveStyle", "scribble", "deleteStyle"].includes(t.kind);
|
|
668
668
|
}
|
|
@@ -681,7 +681,7 @@ function Kr(t, e, s, n) {
|
|
|
681
681
|
if (m && m.fingerprint !== JSON.stringify(u)) throw new Error("Query request ID changed payload.");
|
|
682
682
|
a({
|
|
683
683
|
appearanceQueries: { ...i.appearanceQueries, [p]: u },
|
|
684
|
-
queries: { ...i.queries, [p]: De(i.queries[p] ?? ye(p), { key: p, requestId:
|
|
684
|
+
queries: { ...i.queries, [p]: De(i.queries[p] ?? ye(p), { key: p, requestId: oe(s.requestId), mode: "replace" }) },
|
|
685
685
|
pending: { ...i.pending, [g]: {
|
|
686
686
|
requestId: s.requestId,
|
|
687
687
|
effectId: g,
|
|
@@ -748,13 +748,13 @@ function Kr(t, e, s, n) {
|
|
|
748
748
|
}
|
|
749
749
|
return { state: i, effects: r };
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function Us(t = null) {
|
|
752
752
|
return { authority: t, refusal: null, paidFallbackBySession: {}, query: ye("account"), preferences: null };
|
|
753
753
|
}
|
|
754
754
|
function Wr(t, e) {
|
|
755
755
|
return t.preferences && e.preferencesVersion <= t.preferences.preferencesVersion ? t : { ...t, preferences: e };
|
|
756
756
|
}
|
|
757
|
-
function
|
|
757
|
+
function Ns() {
|
|
758
758
|
return {
|
|
759
759
|
promptActions: {},
|
|
760
760
|
openings: {},
|
|
@@ -782,10 +782,10 @@ function Us() {
|
|
|
782
782
|
deviceErrors: {}
|
|
783
783
|
};
|
|
784
784
|
}
|
|
785
|
-
function
|
|
786
|
-
return { suggestionReadFailures: 0, localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
|
|
785
|
+
function js(t = 0) {
|
|
786
|
+
return { suggestionReadFailures: 0, suggestionRetryAfter: null, localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function ie(t, e) {
|
|
789
789
|
return e.kind === "originContext" ? JSON.stringify([t.authorityId, t.generation, t.communityId, e.kind, e.origin]) : JSON.stringify([
|
|
790
790
|
t.authorityId,
|
|
791
791
|
t.generation,
|
|
@@ -849,7 +849,7 @@ function Ln(t) {
|
|
|
849
849
|
function Se(t, e, s) {
|
|
850
850
|
return JSON.stringify(["stage7", t.authorityId, t.generation, e, s]);
|
|
851
851
|
}
|
|
852
|
-
function
|
|
852
|
+
function Bs(t, e, s) {
|
|
853
853
|
let n = t;
|
|
854
854
|
const i = [], r = (h) => {
|
|
855
855
|
n = { ...n, features: { ...n.features, ...h } };
|
|
@@ -858,16 +858,16 @@ function js(t, e, s) {
|
|
|
858
858
|
};
|
|
859
859
|
if (e.type === "stage7.initialize") {
|
|
860
860
|
const h = n.account.authority;
|
|
861
|
-
return h && JSON.stringify(h) === JSON.stringify(e.authority) ? { state: n, effects: i } : { state: { account:
|
|
861
|
+
return h && JSON.stringify(h) === JSON.stringify(e.authority) ? { state: n, effects: i } : { state: { account: Us(e.authority), features: js(e.now), interactions: Ns() }, effects: i };
|
|
862
862
|
}
|
|
863
863
|
const o = n.account.authority;
|
|
864
864
|
if (!o) return { state: n, effects: i };
|
|
865
865
|
if ("authority" in e && JSON.stringify(e.authority) !== JSON.stringify(o)) return { state: n, effects: i };
|
|
866
|
-
if (e.type === "stage7.retire") return { state: { account:
|
|
866
|
+
if (e.type === "stage7.retire") return { state: { account: Us(), features: js(e.now), interactions: Ns() }, effects: i };
|
|
867
867
|
"now" in e && r({ now: e.now });
|
|
868
868
|
const c = (h, b) => {
|
|
869
869
|
const y = { ...n.features.contextObservers }, w = y[h];
|
|
870
|
-
if (b === null ? delete y[h] : y[h] =
|
|
870
|
+
if (b === null ? delete y[h] : y[h] = ie(o, { kind: "originContext", clientScopeId: h, origin: b, pageUrl: "" }), r({ contextObservers: y }), !w || Object.values(y).includes(w)) return;
|
|
871
871
|
const R = { ...n.features.queries }, T = { ...n.features.polls }, C = { ...n.features.contextReads }, E = { ...n.features.originContextQueries }, q = { ...n.features.pending }, O = E[w]?.origin, k = { ...n.features.contextRunOrigins };
|
|
872
872
|
for (const [x, U] of Object.entries(k)) U === O && delete k[x];
|
|
873
873
|
delete R[w], delete T[w], delete C[w], delete E[w];
|
|
@@ -881,13 +881,13 @@ function js(t, e, s) {
|
|
|
881
881
|
const l = e.type === "stage7.query" ? e.query : e.type === "stage7.mutate" ? e.mutation : e.type === "effect.completed" || e.type === "effect.failed" ? n.features.pending[e.effectId]?.operation : null;
|
|
882
882
|
if (l && Li(l)) {
|
|
883
883
|
et(o, l);
|
|
884
|
-
const h = Kr(n.features, o, e, (b) =>
|
|
884
|
+
const h = Kr(n.features, o, e, (b) => ie(o, b));
|
|
885
885
|
return { state: { ...n, features: h.state }, effects: h.effects };
|
|
886
886
|
}
|
|
887
887
|
if (e.type === "stage7.act" || e.type === "stage7.retry_action" || (e.type === "effect.completed" || e.type === "effect.failed") && e.effectKind === "stage7.platform") {
|
|
888
888
|
const h = Vr(n, e, s.conversation, s.directory);
|
|
889
889
|
if (!h.command) return { state: h.state, effects: h.effects };
|
|
890
|
-
const b =
|
|
890
|
+
const b = Bs(h.state, h.command, s);
|
|
891
891
|
return { state: b.state, effects: [...h.effects, ...b.effects] };
|
|
892
892
|
}
|
|
893
893
|
const d = (h, b, y) => {
|
|
@@ -918,13 +918,13 @@ function js(t, e, s) {
|
|
|
918
918
|
const w = h.kind === "preferencePrompts" ? h.value[y] : h.feature === y ? h.value : null;
|
|
919
919
|
w && w.revision > n.interactions.preferencePrompts[y].revision && u(y, w.requestId);
|
|
920
920
|
}
|
|
921
|
-
h.kind === "preferences" && (n = { ...n, account: Wr(n.account, h.value) }), h.kind === "preferencePrompts" && (n = { ...n, interactions: jn(n.interactions, h.value) }), h.kind === "preferencePrompt" && (n = { ...n, interactions: jn(n.interactions, { ...n.interactions.preferencePrompts, [h.feature]: h.value }) }), h.kind === "decisions" && (n = { ...n, interactions:
|
|
921
|
+
h.kind === "preferences" && (n = { ...n, account: Wr(n.account, h.value) }), h.kind === "preferencePrompts" && (n = { ...n, interactions: jn(n.interactions, h.value) }), h.kind === "preferencePrompt" && (n = { ...n, interactions: jn(n.interactions, { ...n.interactions.preferencePrompts, [h.feature]: h.value }) }), h.kind === "decisions" && (n = { ...n, interactions: ts(n.interactions, h.decisions) }), h.kind === "decision" && (n = { ...n, interactions: ts(n.interactions, [h.value]) });
|
|
922
922
|
}, g = (h, b) => {
|
|
923
923
|
const y = n.interactions.deviceFacts[h];
|
|
924
924
|
b.revision <= y.revision || (Qe(n, h) === !0 && (b.permission === "granted" && y.permission !== "granted" || b.snoozedUntil && b.snoozedUntil !== y.snoozedUntil) && u(h, null), a({ deviceFacts: { ...n.interactions.deviceFacts, [h]: b } }));
|
|
925
925
|
}, m = (h, b, y = !1) => {
|
|
926
926
|
et(o, h);
|
|
927
|
-
const w =
|
|
927
|
+
const w = ie(o, h), R = Se(o, "query", b);
|
|
928
928
|
if (h.kind === "originContext") {
|
|
929
929
|
const q = n.features.queries[w], O = n.features.contextReads[w];
|
|
930
930
|
if (r({ originContextQueries: { ...n.features.originContextQueries, [w]: h } }), !y && (q?.status === "ready" || q?.status === "error") && O && (n.features.now - O.settledAt < 3e4 || q.error && !q.error.retryable && q.error.code !== "runtime_error")) return;
|
|
@@ -932,7 +932,7 @@ function js(t, e, s) {
|
|
|
932
932
|
const T = n.features.pending[R];
|
|
933
933
|
if (T && T.fingerprint !== JSON.stringify(h)) throw new Error("Query request ID changed payload.");
|
|
934
934
|
if (T?.status === "pending" || Object.values(n.features.pending).some((q) => q.mode === "query" && q.key === w && q.status === "pending")) return;
|
|
935
|
-
const C = n.features.queries[w] ?? ye(w), E = De(C, { key: w, requestId:
|
|
935
|
+
const C = n.features.queries[w] ?? ye(w), E = De(C, { key: w, requestId: oe(b), mode: "replace" });
|
|
936
936
|
r({ queries: { ...n.features.queries, [w]: E }, pending: { ...n.features.pending, [R]: {
|
|
937
937
|
requestId: b,
|
|
938
938
|
effectId: R,
|
|
@@ -944,7 +944,7 @@ function js(t, e, s) {
|
|
|
944
944
|
status: "pending",
|
|
945
945
|
error: null,
|
|
946
946
|
result: null
|
|
947
|
-
} } }), h.kind === "account" && (n = { ...n, account: { ...n.account, query: De(n.account.query, { key: w, requestId:
|
|
947
|
+
} } }), h.kind === "account" && (n = { ...n, account: { ...n.account, query: De(n.account.query, { key: w, requestId: oe(b), mode: "replace" }) } }), i.push({ kind: "stage7.query", id: R, input: { authority: o, requestId: b, query: h } });
|
|
948
948
|
}, f = (h, b, y = !1) => {
|
|
949
949
|
if (et(o, h), h.kind === "report" && !n.account.query.data?.user?.isSuperuser) throw new Error("Chat reporting requires superuser access.");
|
|
950
950
|
const w = Se(o, "mutate", b), R = JSON.stringify(h), T = n.features.pending[w];
|
|
@@ -975,8 +975,8 @@ function js(t, e, s) {
|
|
|
975
975
|
return;
|
|
976
976
|
}
|
|
977
977
|
if (h.kind === "generatePrompts") {
|
|
978
|
-
const C = { kind: "starterPrompts", ...h.page, includeUserSuggestions: h.includeUserSuggestions ?? !1 }, E =
|
|
979
|
-
r({ queries: { ...n.features.queries, [E]: De(q, { key: E, requestId:
|
|
978
|
+
const C = { kind: "starterPrompts", ...h.page, includeUserSuggestions: h.includeUserSuggestions ?? !1 }, E = ie(o, C), q = n.features.queries[E] ?? ye(E);
|
|
979
|
+
r({ queries: { ...n.features.queries, [E]: De(q, { key: E, requestId: oe(b), mode: "replace" }) } });
|
|
980
980
|
}
|
|
981
981
|
r({ pending: { ...n.features.pending, [w]: { requestId: b, effectId: w, fingerprint: R, key: Ln(h), generation: o.generation, operation: h, mode: "mutation", status: "pending", error: null, result: null } } }), i.push({ kind: "stage7.mutate", id: w, input: { authority: o, requestId: b, mutation: h } });
|
|
982
982
|
}, v = (h) => {
|
|
@@ -1010,7 +1010,7 @@ function js(t, e, s) {
|
|
|
1010
1010
|
const C = { code: e.code, message: "The backend refused account access. Refresh account status before retrying.", retryable: !0 };
|
|
1011
1011
|
y[R] = { ...T, status: "error", error: C }, w.push(R);
|
|
1012
1012
|
const E = b[T.key];
|
|
1013
|
-
E && (b[T.key] = ct(E, { key: T.key, requestId:
|
|
1013
|
+
E && (b[T.key] = ct(E, { key: T.key, requestId: oe(T.requestId), error: C }));
|
|
1014
1014
|
}
|
|
1015
1015
|
n = { ...n, features: { ...n.features, pending: y, queries: b }, account: {
|
|
1016
1016
|
...n.account,
|
|
@@ -1025,12 +1025,12 @@ function js(t, e, s) {
|
|
|
1025
1025
|
break;
|
|
1026
1026
|
case "stage7.query":
|
|
1027
1027
|
if (e.query.kind === "userSuggestedTasks") {
|
|
1028
|
-
const h =
|
|
1029
|
-
if (!e.force && (n.features.polls[h] || n.features.
|
|
1030
|
-
e.force && r({ suggestionReadFailures: 0 });
|
|
1028
|
+
const h = ie(o, e.query), b = n.features.queries[h]?.status === "error";
|
|
1029
|
+
if (!e.force && (n.features.polls[h] || b && (n.features.suggestionRetryAfter === null || e.now < n.features.suggestionRetryAfter))) break;
|
|
1030
|
+
(e.force || b) && r({ suggestionReadFailures: 0, suggestionRetryAfter: null });
|
|
1031
1031
|
}
|
|
1032
1032
|
if (e.query.kind === "originContext" && (c(e.query.clientScopeId, e.query.origin), e.force)) {
|
|
1033
|
-
const h =
|
|
1033
|
+
const h = ie(o, e.query), b = { ...n.features.contextReads };
|
|
1034
1034
|
delete b[h], r({ contextReads: b });
|
|
1035
1035
|
}
|
|
1036
1036
|
m(e.query, e.requestId, e.force);
|
|
@@ -1054,7 +1054,7 @@ function js(t, e, s) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
break;
|
|
1056
1056
|
case "stage7.observe_work":
|
|
1057
|
-
n =
|
|
1057
|
+
n = Zt(n, s.conversation, s.directory, e.now);
|
|
1058
1058
|
break;
|
|
1059
1059
|
case "stage7.bridge_ready":
|
|
1060
1060
|
a({ bridgeReady: e.ready, bridgeError: e.ready ? null : e.error ?? null });
|
|
@@ -1069,7 +1069,7 @@ function js(t, e, s) {
|
|
|
1069
1069
|
const h = s.directory.clients[e.clientScopeId];
|
|
1070
1070
|
if (!h) break;
|
|
1071
1071
|
const b = { ...n.interactions.openings };
|
|
1072
|
-
e.open || delete b[h], a({ openings: b, closedScopes: { ...n.interactions.closedScopes, [h]: !e.open } }), n =
|
|
1072
|
+
e.open || delete b[h], a({ openings: b, closedScopes: { ...n.interactions.closedScopes, [h]: !e.open } }), n = Zt(n, s.conversation, s.directory, e.now);
|
|
1073
1073
|
break;
|
|
1074
1074
|
}
|
|
1075
1075
|
case "stage7.prompt_shown": {
|
|
@@ -1101,7 +1101,7 @@ function js(t, e, s) {
|
|
|
1101
1101
|
break;
|
|
1102
1102
|
case "stage7.import_legacy_decisions":
|
|
1103
1103
|
if (!o.profile.startsWith("extension_") || e.decisions.some((h) => h.revision !== 0)) throw new Error("Invalid legacy decision import.");
|
|
1104
|
-
n = { ...n, interactions:
|
|
1104
|
+
n = { ...n, interactions: ts(n.interactions, e.decisions) };
|
|
1105
1105
|
break;
|
|
1106
1106
|
case "stage7.device_hints": {
|
|
1107
1107
|
if (o.profile !== "main_web_chat") throw new Error("Main-web hints unavailable.");
|
|
@@ -1164,7 +1164,7 @@ function js(t, e, s) {
|
|
|
1164
1164
|
if (e.effectKind === "stage7.wait") {
|
|
1165
1165
|
if (e.effectId !== n.features.timerId) break;
|
|
1166
1166
|
if (r({ timerId: null, timerDeadline: null, schedulerError: e.type === "effect.failed" ? e.error : null }), e.type === "effect.completed") {
|
|
1167
|
-
r({ now: e.output.now }), n =
|
|
1167
|
+
r({ now: e.output.now }), n = Zt(n, s.conversation, s.directory, e.output.now);
|
|
1168
1168
|
for (const [y, w] of Object.entries(n.features.polls)) {
|
|
1169
1169
|
if (w.deadline > e.output.now) continue;
|
|
1170
1170
|
Object.values(n.features.pending).some((T) => T.mode === "query" && T.key === y && T.status === "pending") || m(w.query.kind === "originContext" ? { ...w.query, trigger: "poll" } : w.query, `poll:${y}:${e.output.now}`, !0);
|
|
@@ -1209,10 +1209,10 @@ function js(t, e, s) {
|
|
|
1209
1209
|
} } });
|
|
1210
1210
|
}
|
|
1211
1211
|
if (b)
|
|
1212
|
-
r({ queries: { ...n.features.queries, [h.key]: ct(w, { key: h.key, requestId:
|
|
1212
|
+
r({ queries: { ...n.features.queries, [h.key]: ct(w, { key: h.key, requestId: oe(h.requestId), error: e.error }) } }), h.operation.kind === "account" && (n = { ...n, account: { ...n.account, query: ct(n.account.query, { key: h.key, requestId: oe(h.requestId), error: e.error }) } });
|
|
1213
1213
|
else {
|
|
1214
1214
|
if (e.output.data.kind !== h.operation.kind) throw new Error("Feature response kind does not match the query.");
|
|
1215
|
-
r({ now: e.output.completedAt, queries: { ...n.features.queries, [h.key]:
|
|
1215
|
+
r({ now: e.output.completedAt, queries: { ...n.features.queries, [h.key]: es(w, { key: h.key, requestId: oe(h.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } }), p(e.output.data, h.requestId), e.output.data.kind === "account" && (n = { ...n, account: { ...n.account, refusal: null, query: es(n.account.query, { key: h.key, requestId: oe(h.requestId), data: e.output.data.value, cursor: null, updatedAt: e.output.completedAt }) } });
|
|
1216
1216
|
}
|
|
1217
1217
|
} else if (!b)
|
|
1218
1218
|
r({ now: e.output.completedAt }), p(e.output.data, h.requestId);
|
|
@@ -1236,8 +1236,8 @@ function js(t, e, s) {
|
|
|
1236
1236
|
}, `${h.requestId}:ack`);
|
|
1237
1237
|
}
|
|
1238
1238
|
if (I(e.effectId, b), h.operation.kind === "generatePrompts") {
|
|
1239
|
-
const y = { kind: "starterPrompts", ...h.operation.page, includeUserSuggestions: h.operation.includeUserSuggestions ?? !1 }, w =
|
|
1240
|
-
R?.requestId === h.requestId && r({ queries: { ...n.features.queries, [w]: b ? ct(R, { key: w, requestId:
|
|
1239
|
+
const y = { kind: "starterPrompts", ...h.operation.page, includeUserSuggestions: h.operation.includeUserSuggestions ?? !1 }, w = ie(o, y), R = n.features.queries[w];
|
|
1240
|
+
R?.requestId === h.requestId && r({ queries: { ...n.features.queries, [w]: b ? ct(R, { key: w, requestId: oe(h.requestId), error: e.error }) : es(R, { key: w, requestId: oe(h.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } });
|
|
1241
1241
|
}
|
|
1242
1242
|
if (!b && e.output.data.kind === "originContext") {
|
|
1243
1243
|
const y = e.output.data, w = h.operation.kind === "originContext" || h.operation.kind === "refreshContext" ? h.operation.origin : null;
|
|
@@ -1279,7 +1279,7 @@ function js(t, e, s) {
|
|
|
1279
1279
|
if (y.kind === "originContext" || y.kind === "userContext" || y.kind === "contextRun") {
|
|
1280
1280
|
const w = y.kind === "originContext" ? h.mode === "query" && h.operation.kind === "originContext" && Object.values(n.features.contextObservers).includes(h.key) ? h.operation : null : y.kind === "userContext" ? { kind: "userContext" } : y.value.runId ? { kind: "contextRun", runId: y.value.runId } : null;
|
|
1281
1281
|
if (w && ["queued", "pending", "running", "in_progress", "stopping", "cancel_requested"].includes(y.value.status)) {
|
|
1282
|
-
const R =
|
|
1282
|
+
const R = ie(o, w);
|
|
1283
1283
|
r({ polls: { ...n.features.polls, [R]: { query: w, deadline: n.features.now + 5e3 } } });
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
@@ -1294,12 +1294,14 @@ function js(t, e, s) {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
1296
|
if (b && h.mode === "query" && ["originContext", "userContext", "contextRun"].includes(h.operation.kind) && e.error.retryable && (n.features.contextReads[h.key]?.failures ?? 0) <= 3) {
|
|
1297
|
-
const y = h.operation, w =
|
|
1297
|
+
const y = h.operation, w = ie(o, y);
|
|
1298
1298
|
r({ polls: { ...n.features.polls, [w]: { query: y, deadline: n.features.now + 5e3 * (n.features.contextReads[h.key]?.failures ?? 1) } } });
|
|
1299
1299
|
}
|
|
1300
1300
|
if (h.mode === "query" && h.operation.kind === "userSuggestedTasks") {
|
|
1301
1301
|
const y = b ? n.features.suggestionReadFailures + 1 : 0, w = { ...n.features.polls };
|
|
1302
|
-
delete w[h.key]
|
|
1302
|
+
delete w[h.key];
|
|
1303
|
+
const R = b && (e.error.retryable || ["connection_interrupted", "request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.error.code));
|
|
1304
|
+
R && y <= 3 && (w[h.key] = { query: h.operation, deadline: n.features.now + 1e3 * 2 ** (y - 1) }), r({ suggestionReadFailures: y, suggestionRetryAfter: R && y > 3 ? n.features.now + 3e4 : null, polls: w });
|
|
1303
1305
|
}
|
|
1304
1306
|
if (h.operation.kind === "preference") {
|
|
1305
1307
|
const y = h.operation.feature, w = n.features.queuedPreferences[y];
|
|
@@ -1332,15 +1334,19 @@ function js(t, e, s) {
|
|
|
1332
1334
|
}
|
|
1333
1335
|
return { state: n, effects: i };
|
|
1334
1336
|
}
|
|
1335
|
-
function
|
|
1336
|
-
return t.account.authority ? t.features.queries[
|
|
1337
|
+
function Mt(t, e) {
|
|
1338
|
+
return t.account.authority ? t.features.queries[ie(t.account.authority, e)] ?? null : null;
|
|
1339
|
+
}
|
|
1340
|
+
function Jr(t, e) {
|
|
1341
|
+
const s = Mt(t, e);
|
|
1342
|
+
return s?.status === "loading" || s?.status === "refreshing" || !!(t.account.authority && t.features.polls[ie(t.account.authority, e)]);
|
|
1337
1343
|
}
|
|
1338
1344
|
function nt(t) {
|
|
1339
1345
|
if (!t || typeof t != "object") return !1;
|
|
1340
1346
|
const e = t;
|
|
1341
1347
|
return Object.keys(t).every((s) => ["boundary", "category", "messageKind"].includes(s)) && ["runtime", "web_transport", "extension_ipc"].includes(e.boundary) && ["error", "object", "null", "array", "string", "undefined", "number", "boolean", "bigint", "symbol", "function"].includes(e.category) && ["object_coercion", "text", "blank", "non_text"].includes(e.messageKind);
|
|
1342
1348
|
}
|
|
1343
|
-
function
|
|
1349
|
+
function Qr(t) {
|
|
1344
1350
|
if (t.details !== void 0 && !Ne(t.details))
|
|
1345
1351
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
1346
1352
|
return {
|
|
@@ -1367,7 +1373,7 @@ function Y(t, e = "runtime_error", s = "runtime") {
|
|
|
1367
1373
|
...typeof o.durationMs == "number" && Number.isFinite(o.durationMs) && o.durationMs >= 0 ? { durationMs: o.durationMs } : {},
|
|
1368
1374
|
...typeof o.successfulRequests == "number" && Number.isSafeInteger(o.successfulRequests) && o.successfulRequests >= 0 ? { successfulRequests: o.successfulRequests } : {}
|
|
1369
1375
|
};
|
|
1370
|
-
return
|
|
1376
|
+
return Qr({
|
|
1371
1377
|
code: r,
|
|
1372
1378
|
message: i.trim() && i.trim() !== "[object Object]" ? i : "The Product Agent operation failed. Try again.",
|
|
1373
1379
|
retryable: !!(n && "retryable" in n && n.retryable === !0),
|
|
@@ -1393,14 +1399,14 @@ function je(t) {
|
|
|
1393
1399
|
if (typeof t != "boolean") throw new Error("Invalid feature response boolean.");
|
|
1394
1400
|
return t;
|
|
1395
1401
|
}
|
|
1396
|
-
function
|
|
1402
|
+
function ss(t) {
|
|
1397
1403
|
return t === null ? null : je(t);
|
|
1398
1404
|
}
|
|
1399
1405
|
function bt(t) {
|
|
1400
1406
|
if (!Array.isArray(t)) throw new Error("Invalid feature string list.");
|
|
1401
1407
|
return t.map(P);
|
|
1402
1408
|
}
|
|
1403
|
-
function
|
|
1409
|
+
function Pt(t) {
|
|
1404
1410
|
const e = de(t);
|
|
1405
1411
|
if (e !== null && !Number.isFinite(Date.parse(e))) throw new Error("Invalid feature deadline.");
|
|
1406
1412
|
return e;
|
|
@@ -1408,31 +1414,31 @@ function Mt(t) {
|
|
|
1408
1414
|
function ze(t) {
|
|
1409
1415
|
const e = N(t);
|
|
1410
1416
|
return {
|
|
1411
|
-
taskNotificationsEnabled:
|
|
1412
|
-
tabGroupingEnabled:
|
|
1417
|
+
taskNotificationsEnabled: ss(e.taskNotificationsEnabled),
|
|
1418
|
+
tabGroupingEnabled: ss(e.tabGroupingEnabled),
|
|
1413
1419
|
preferencesVersion: Oe(e.preferencesVersion),
|
|
1414
|
-
scribbleStyleEnabled:
|
|
1420
|
+
scribbleStyleEnabled: ss(e.scribbleStyleEnabled),
|
|
1415
1421
|
blockedOrigins: bt(e.blockedServiceOrigins),
|
|
1416
1422
|
personalInstructions: de(e.personalInstructions),
|
|
1417
1423
|
securityPolicyVersion: Oe(e.securityPolicyVersion)
|
|
1418
1424
|
};
|
|
1419
1425
|
}
|
|
1420
|
-
function
|
|
1426
|
+
function Dt(t) {
|
|
1421
1427
|
const e = N(t);
|
|
1422
|
-
return { eligibleSince:
|
|
1428
|
+
return { eligibleSince: Pt(e.eligibleSince), revision: Oe(e.revision), requestId: de(e.requestId), snoozedUntil: Pt(e.snoozedUntil) };
|
|
1423
1429
|
}
|
|
1424
|
-
function
|
|
1430
|
+
function Xr(t) {
|
|
1425
1431
|
const e = N(t);
|
|
1426
|
-
return { notifications:
|
|
1432
|
+
return { notifications: Dt(e.notifications), tab_grouping: Dt(e.tabGrouping) };
|
|
1427
1433
|
}
|
|
1428
1434
|
function Fn(t) {
|
|
1429
1435
|
const e = N(t), s = N(e.request), n = P(s.category), i = P(s.action), r = { category: n, action: i, promptKey: P(s.promptKey), expectedRevision: Oe(s.expectedRevision) };
|
|
1430
1436
|
cn(r);
|
|
1431
1437
|
const a = P(e.outcome);
|
|
1432
1438
|
if (!["resolved", "snoozed", "suppressed"].includes(a)) throw new Error("Invalid decision outcome.");
|
|
1433
|
-
const o =
|
|
1439
|
+
const o = Pt(e.decidedAt);
|
|
1434
1440
|
if (o === null) throw new Error("Missing decision acceptance time.");
|
|
1435
|
-
const c =
|
|
1441
|
+
const c = Pt(e.nextEligibleAt);
|
|
1436
1442
|
if (a === "snoozed" && c === null) throw new Error("Missing decision deadline.");
|
|
1437
1443
|
return {
|
|
1438
1444
|
decisionKey: P(e.decisionKey),
|
|
@@ -1443,7 +1449,7 @@ function Fn(t) {
|
|
|
1443
1449
|
nextEligibleAt: c
|
|
1444
1450
|
};
|
|
1445
1451
|
}
|
|
1446
|
-
function
|
|
1452
|
+
function ns(t) {
|
|
1447
1453
|
const e = N(t);
|
|
1448
1454
|
return {
|
|
1449
1455
|
eventTypeRegex: P(e.eventTypeRegex),
|
|
@@ -1453,17 +1459,17 @@ function ss(t) {
|
|
|
1453
1459
|
...e.targetAncestorRegex == null ? {} : { targetAncestorRegex: P(e.targetAncestorRegex) }
|
|
1454
1460
|
};
|
|
1455
1461
|
}
|
|
1456
|
-
function
|
|
1462
|
+
function Yr(t) {
|
|
1457
1463
|
const e = N(t), s = N(e.condition), n = { id: P(e.id), suggestedQuery: P(e.suggestedQuery) };
|
|
1458
1464
|
if (s.template === "page_visit") return { ...n, condition: { template: s.template, urlRegex: P(s.urlRegex) } };
|
|
1459
|
-
if (s.template === "semantic_interaction") return { ...n, condition: { template: s.template, event:
|
|
1465
|
+
if (s.template === "semantic_interaction") return { ...n, condition: { template: s.template, event: ns(s.event) } };
|
|
1460
1466
|
if (s.template === "event_sequence") {
|
|
1461
1467
|
if (!Array.isArray(s.steps)) throw new Error("Invalid proactive sequence.");
|
|
1462
|
-
return { ...n, condition: { template: s.template, steps: s.steps.map(
|
|
1468
|
+
return { ...n, condition: { template: s.template, steps: s.steps.map(ns), withinSeconds: Oe(s.withinSeconds) } };
|
|
1463
1469
|
}
|
|
1464
1470
|
if (s.template === "page_state_after_event") {
|
|
1465
1471
|
const i = N(s.state);
|
|
1466
|
-
return { ...n, condition: { template: s.template, event:
|
|
1472
|
+
return { ...n, condition: { template: s.template, event: ns(s.event), withinSeconds: Oe(s.withinSeconds), state: {
|
|
1467
1473
|
urlRegex: P(i.urlRegex),
|
|
1468
1474
|
...i.textRegex == null ? {} : { textRegex: P(i.textRegex) },
|
|
1469
1475
|
...i.roleRegex == null ? {} : { roleRegex: P(i.roleRegex) },
|
|
@@ -1499,7 +1505,7 @@ function lt(t) {
|
|
|
1499
1505
|
if (!je(e.success)) throw new Error(de(e.message) ?? "Failed to submit feedback");
|
|
1500
1506
|
return { kind: "ack", success: !0 };
|
|
1501
1507
|
}
|
|
1502
|
-
function
|
|
1508
|
+
function is(t) {
|
|
1503
1509
|
const e = t.page;
|
|
1504
1510
|
return {
|
|
1505
1511
|
community_id: t.communityId,
|
|
@@ -1523,7 +1529,7 @@ function ns(t) {
|
|
|
1523
1529
|
sdk_preview_open: t.sdkPreviewOpen
|
|
1524
1530
|
};
|
|
1525
1531
|
}
|
|
1526
|
-
function
|
|
1532
|
+
function Zr(t) {
|
|
1527
1533
|
const e = (s) => {
|
|
1528
1534
|
if (JSON.stringify(s) !== JSON.stringify(t.authority())) throw new Error("Feature authority retired.");
|
|
1529
1535
|
};
|
|
@@ -1540,7 +1546,7 @@ function Yr(t) {
|
|
|
1540
1546
|
o = { kind: "preferences", value: ze(await a("/preferences")) };
|
|
1541
1547
|
break;
|
|
1542
1548
|
case "preferencePrompts":
|
|
1543
|
-
o = { kind: "preferencePrompts", value:
|
|
1549
|
+
o = { kind: "preferencePrompts", value: Xr(await a("/preference-prompts")) };
|
|
1544
1550
|
break;
|
|
1545
1551
|
case "decisions": {
|
|
1546
1552
|
const c = N(await a("/interaction-decisions"));
|
|
@@ -1561,7 +1567,7 @@ function Yr(t) {
|
|
|
1561
1567
|
prompts: bt(c.starterPrompts),
|
|
1562
1568
|
morningReportOpening: de(c.morningReportOpening),
|
|
1563
1569
|
signupAt: P(c.signupAt),
|
|
1564
|
-
proactiveSuggestions: c.proactiveSuggestions.map(
|
|
1570
|
+
proactiveSuggestions: c.proactiveSuggestions.map(Yr)
|
|
1565
1571
|
};
|
|
1566
1572
|
break;
|
|
1567
1573
|
}
|
|
@@ -1606,20 +1612,20 @@ function Yr(t) {
|
|
|
1606
1612
|
o = { kind: "preferences", value: ze(await a("/preferences", { blocked_service_origins: n.origins, security_policy_version: n.expectedSecurityVersion }, "PATCH")) };
|
|
1607
1613
|
break;
|
|
1608
1614
|
case "preferenceAcknowledge":
|
|
1609
|
-
o = { kind: "preferencePrompt", feature: n.feature, value:
|
|
1615
|
+
o = { kind: "preferencePrompt", feature: n.feature, value: Dt(await a(`/preference-prompts/${n.feature}/acknowledge`, { request_id: i, expected_revision: n.expectedRevision, action: n.action })) };
|
|
1610
1616
|
break;
|
|
1611
1617
|
case "preferenceSnooze":
|
|
1612
|
-
o = { kind: "preferencePrompt", feature: n.feature, value:
|
|
1618
|
+
o = { kind: "preferencePrompt", feature: n.feature, value: Dt(await a(`/preference-prompts/${n.feature}/snooze`, { request_id: i, expected_revision: n.expectedRevision })) };
|
|
1613
1619
|
break;
|
|
1614
1620
|
case "decision":
|
|
1615
1621
|
o = { kind: "decision", value: Fn(await a("/interaction-decisions", { category: n.category, prompt_key: n.promptKey, action: n.action, request_id: i, expected_revision: n.expectedRevision })) };
|
|
1616
1622
|
break;
|
|
1617
1623
|
case "feedback":
|
|
1618
|
-
o = lt(r ? { success: await t.embedded.feedback(n.message) } : await a("/feedback", { ...
|
|
1624
|
+
o = lt(r ? { success: await t.embedded.feedback(n.message) } : await a("/feedback", { ...is(n.context), feedback_type: "general", message: n.message }));
|
|
1619
1625
|
break;
|
|
1620
1626
|
case "proactiveFeedback":
|
|
1621
1627
|
o = lt(await a("/feedback", {
|
|
1622
|
-
...
|
|
1628
|
+
...is(n.context),
|
|
1623
1629
|
feedback_type: "proactive_suggestion",
|
|
1624
1630
|
proactive_suggestion_action: "feedback",
|
|
1625
1631
|
proactive_suggestion_id: n.suggestionId,
|
|
@@ -1632,7 +1638,7 @@ function Yr(t) {
|
|
|
1632
1638
|
o = lt(await a("/feedback/target", { feedback_type: "target_rating", target_id: n.targetId, rating: n.rating, ...n.comment === void 0 ? {} : { comment: n.comment } }));
|
|
1633
1639
|
break;
|
|
1634
1640
|
case "report":
|
|
1635
|
-
o = lt(await a("/feedback", { ...
|
|
1641
|
+
o = lt(await a("/feedback", { ...is(n.context), feedback_type: "chat_report", session_id: n.sessionId, message: n.message, ui_evidence: n.uiEvidence, widget_evidence_available: n.widgetEvidenceAvailable }));
|
|
1636
1642
|
break;
|
|
1637
1643
|
case "generatePrompts": {
|
|
1638
1644
|
const c = N(await a("/starter-prompts", { page_url: n.page.pageUrl, html_content: n.htmlContent, page_title: n.pageTitle }, "POST", r ? {} : { origin: n.page.origin, include_user_suggestions: n.includeUserSuggestions ?? !1 }));
|
|
@@ -1671,7 +1677,7 @@ function Yr(t) {
|
|
|
1671
1677
|
}
|
|
1672
1678
|
};
|
|
1673
1679
|
}
|
|
1674
|
-
function
|
|
1680
|
+
function eo(t) {
|
|
1675
1681
|
let e = null, s = null, n = !1;
|
|
1676
1682
|
const i = () => {
|
|
1677
1683
|
e !== null && clearTimeout(e), e = null, s?.({ now: t() }), s = null;
|
|
@@ -1689,7 +1695,7 @@ function Zr(t) {
|
|
|
1689
1695
|
}
|
|
1690
1696
|
};
|
|
1691
1697
|
}
|
|
1692
|
-
function
|
|
1698
|
+
function to(t, e) {
|
|
1693
1699
|
let s = "";
|
|
1694
1700
|
const n = () => {
|
|
1695
1701
|
const r = t.engine.getState().slices, a = r.account.authority;
|
|
@@ -1704,13 +1710,13 @@ function eo(t, e) {
|
|
|
1704
1710
|
}, i = t.engine.subscribe(n);
|
|
1705
1711
|
return t.onDispose(i), n(), i;
|
|
1706
1712
|
}
|
|
1707
|
-
async function
|
|
1713
|
+
async function so(t, e, s) {
|
|
1708
1714
|
await t.engine.dispatch({ type: "stage7.initialize", authority: e, now: s }), await t.engine.dispatch({ type: "stage7.reconcile", authority: e, now: s, requestId: crypto.randomUUID(), reason: "startup" });
|
|
1709
1715
|
}
|
|
1710
|
-
function
|
|
1716
|
+
function rs(t, e, s = {}) {
|
|
1711
1717
|
return Fi(t, { type: "stage7.query", query: e, force: s.force });
|
|
1712
1718
|
}
|
|
1713
|
-
function
|
|
1719
|
+
function no(t, e, s) {
|
|
1714
1720
|
return Fi(t, { type: "stage7.mutate", mutation: e });
|
|
1715
1721
|
}
|
|
1716
1722
|
function Fi(t, e, s) {
|
|
@@ -1730,13 +1736,13 @@ function Fi(t, e, s) {
|
|
|
1730
1736
|
p(new Error("Feature authority retired."));
|
|
1731
1737
|
return;
|
|
1732
1738
|
}
|
|
1733
|
-
if (e.type === "stage7.query" && e.query.kind === "originContext" && m.features.contextObservers[e.query.clientScopeId] !==
|
|
1739
|
+
if (e.type === "stage7.query" && e.query.kind === "originContext" && m.features.contextObservers[e.query.clientScopeId] !== ie(n, e.query)) {
|
|
1734
1740
|
p(Object.assign(new Error("Context observation retired."), { code: "observation_released", retryable: !1 }));
|
|
1735
1741
|
return;
|
|
1736
1742
|
}
|
|
1737
1743
|
const f = Object.values(m.features.pending).find((v) => v.requestId === r);
|
|
1738
1744
|
if (!f && e.type === "stage7.query") {
|
|
1739
|
-
const v =
|
|
1745
|
+
const v = Mt(m, e.query);
|
|
1740
1746
|
v?.status === "error" ? p(v.error) : v?.status === "ready" && v.data && p(null, v.data);
|
|
1741
1747
|
}
|
|
1742
1748
|
f?.status === "error" ? p(f.error) : f?.status === "done" && p(null, f.result);
|
|
@@ -1746,7 +1752,7 @@ function Fi(t, e, s) {
|
|
|
1746
1752
|
}, (m) => p(m));
|
|
1747
1753
|
});
|
|
1748
1754
|
}
|
|
1749
|
-
async function
|
|
1755
|
+
async function io(t, e, s = crypto.randomUUID()) {
|
|
1750
1756
|
const n = t.engine.getState().slices.account.authority;
|
|
1751
1757
|
if (!n || t.isDisposed) throw new Error("Product Agent is not authenticated.");
|
|
1752
1758
|
const i = Object.entries(t.engine.getState().slices.interactions.actions).find(([, a]) => a.clientScopeId === e.clientScopeId && a.sourceVersion === (e.expectedSourceVersion ?? null) && a.interactionId === e.interactionId && a.action === e.action && a.expectedRevision === e.expectedRevision && a.status === "error" && a.step === "persist"), r = i?.[0] ?? s;
|
|
@@ -1781,7 +1787,7 @@ async function no(t, e, s = crypto.randomUUID()) {
|
|
|
1781
1787
|
}, p);
|
|
1782
1788
|
});
|
|
1783
1789
|
}
|
|
1784
|
-
function
|
|
1790
|
+
function ro(t, e, s, n) {
|
|
1785
1791
|
return Bi(t, e, s, n).map((i) => {
|
|
1786
1792
|
const r = i.sourceId ? Object.values(t.interactions.sources).find((m) => m.id === i.sourceId && m.conversation_id === i.conversationId) : null, a = r?.payload, o = i.payload.feature, c = i.category === "permission", l = i.category === "sharing" ? "social_share" : i.category === "integration_auth" ? "integration_connection" : i.category === "personal_channel" ? "personal_channel_connection" : o === "notifications" ? "task_notifications" : o === "tab_grouping" ? "tab_group_permission" : i.category, d = l === "integration_connection" && a?.kind === "integration_auth" ? `Connect ${a.app_name}` : l === "personal_channel_connection" ? "Connect WhatsApp" : null, u = o === "notifications" ? c ? "Allow notifications in this browser?" : "Get notified when Pluno finishes a task?" : o === "tab_grouping" ? c ? "Allow Pluno to group tabs in this browser?" : "Group tabs used by Pluno?" : i.category === "sharing" ? "Share what Pluno helped you accomplish." : String(i.payload.text ?? d ?? ""), p = Object.fromEntries(i.actions.map((m) => [m, i.actionLabels?.[m] ?? { enable: "Enable", not_now: "Not now", dont_enable: "Don't enable", allow: "Allow", run: i.category === "proactive_suggestion" ? "Yes" : "Start", edit: "Edit", never: "Never", snooze: "Snooze morning report", pair: "Pair WhatsApp", dismiss: "Dismiss", copy: "Copy", share: "Share", feedback: "Send feedback" }[m] ?? m])), g = a?.kind === "integration_auth" ? { type: "pipedream_auth_required", authRequestId: a.request_id, appSlug: a.app_slug, appName: a.app_name, appLogo: a.app_logo, expiresAt: a.expires_at } : a?.kind === "personal_channel" ? { type: "personal_channel_connection_required", requestId: a.request_id, channel: a.channel, managementUrl: a.management_url } : null;
|
|
1787
1793
|
return {
|
|
@@ -1811,7 +1817,7 @@ function io(t, e, s, n) {
|
|
|
1811
1817
|
};
|
|
1812
1818
|
});
|
|
1813
1819
|
}
|
|
1814
|
-
function
|
|
1820
|
+
function oo(t, e, s) {
|
|
1815
1821
|
return {
|
|
1816
1822
|
user: e,
|
|
1817
1823
|
communityId: s,
|
|
@@ -1824,7 +1830,7 @@ function ro(t, e, s) {
|
|
|
1824
1830
|
presentation: t
|
|
1825
1831
|
};
|
|
1826
1832
|
}
|
|
1827
|
-
function
|
|
1833
|
+
function ao(t, e = null) {
|
|
1828
1834
|
if (!t.authority) return null;
|
|
1829
1835
|
const s = t.query.data, n = s?.presentation ?? {
|
|
1830
1836
|
creditsUsed: null,
|
|
@@ -1845,10 +1851,10 @@ function oo(t, e = null) {
|
|
|
1845
1851
|
} : void 0);
|
|
1846
1852
|
return { ...n, ...o ? { auth: o } : {}, submissionGate: a, usingPaidCreditFallback: e ? t.paidFallbackBySession[e] ?? !1 : !1 };
|
|
1847
1853
|
}
|
|
1848
|
-
const
|
|
1849
|
-
version:
|
|
1850
|
-
}, dn = (t) => t.selectedModel ?? t.historyModel ?? t.defaultModel,
|
|
1851
|
-
function
|
|
1854
|
+
const co = "0.1.268", Bt = {
|
|
1855
|
+
version: co
|
|
1856
|
+
}, dn = (t) => t.selectedModel ?? t.historyModel ?? t.defaultModel, lo = (t, e) => t.scopes[e];
|
|
1857
|
+
function Lt(t) {
|
|
1852
1858
|
if (!Number.isSafeInteger(t) || t < 0) throw new Error("Invalid conversation revision.");
|
|
1853
1859
|
}
|
|
1854
1860
|
function Ls(t, e) {
|
|
@@ -1857,7 +1863,7 @@ function Ls(t, e) {
|
|
|
1857
1863
|
const s = fe(e.created_at);
|
|
1858
1864
|
fe(e.updated_at);
|
|
1859
1865
|
const n = xt(e);
|
|
1860
|
-
n !== null &&
|
|
1866
|
+
n !== null && Lt(n);
|
|
1861
1867
|
const i = t.streams[e.id];
|
|
1862
1868
|
if (n !== null && i && (i.state === "stopped" || i.state === "finished") && n > i.revision) return t;
|
|
1863
1869
|
const r = t.items[e.id];
|
|
@@ -1871,13 +1877,13 @@ function Ls(t, e) {
|
|
|
1871
1877
|
return { ...t, items: { ...t.items, [e.id]: { ...e, created_at: r?.created_at ?? e.created_at } } };
|
|
1872
1878
|
}
|
|
1873
1879
|
function $i(t, e) {
|
|
1874
|
-
if (
|
|
1880
|
+
if (Lt(e.revision), t.removedItems[e.item_id]) return t;
|
|
1875
1881
|
const s = t.streams[e.item_id];
|
|
1876
1882
|
return s && (s.state === "stopped" || e.revision < s.revision || s.state !== "open" && (e.state === "open" || e.revision === s.revision) || s.state === e.state && s.revision === e.revision) ? t : { ...t, streams: { ...t.streams, [e.item_id]: e } };
|
|
1877
1883
|
}
|
|
1878
1884
|
function Fs(t, e) {
|
|
1879
1885
|
if (e.conversation_id !== t.sessionId) throw new Error("Execution belongs to another conversation.");
|
|
1880
|
-
if (
|
|
1886
|
+
if (Lt(e.version), t.execution && e.version <= t.execution.version) return t;
|
|
1881
1887
|
const s = { ...t.executionByUserMessage };
|
|
1882
1888
|
for (const n of le(e)) s[n] = {
|
|
1883
1889
|
version: e.version,
|
|
@@ -1886,7 +1892,7 @@ function Fs(t, e) {
|
|
|
1886
1892
|
};
|
|
1887
1893
|
return { ...t, execution: e, executionByUserMessage: s };
|
|
1888
1894
|
}
|
|
1889
|
-
function
|
|
1895
|
+
function uo(t) {
|
|
1890
1896
|
const e = /* @__PURE__ */ new Set();
|
|
1891
1897
|
for (const s of Object.values(t.items)) {
|
|
1892
1898
|
const n = xt(s), i = t.streams[s.id];
|
|
@@ -1896,12 +1902,12 @@ function lo(t) {
|
|
|
1896
1902
|
!t.items[s] && !t.removedItems[s] && e.add(s);
|
|
1897
1903
|
return [...e];
|
|
1898
1904
|
}
|
|
1899
|
-
function
|
|
1905
|
+
function os(t, e) {
|
|
1900
1906
|
switch (e.type) {
|
|
1901
1907
|
case "conversation.interaction.updated":
|
|
1902
1908
|
return t;
|
|
1903
1909
|
case "conversation.follow_ups.updated":
|
|
1904
|
-
return
|
|
1910
|
+
return Lt(e.version), e.version > t.followUpsVersion ? { ...t, followUps: e.follow_ups, followUpsVersion: e.version } : t;
|
|
1905
1911
|
case "conversation.item.updated":
|
|
1906
1912
|
return Ls(t, e.item);
|
|
1907
1913
|
case "conversation.execution.updated":
|
|
@@ -1926,7 +1932,7 @@ function $s(t, e, s) {
|
|
|
1926
1932
|
if (i.sessionId !== null && i.sessionId !== s) throw new Error("Submission scope accepted into conflicting conversations.");
|
|
1927
1933
|
n[i.userMessageId] = { ...i, sessionId: s };
|
|
1928
1934
|
}
|
|
1929
|
-
return { ...t, submissions: n, sessions: { ...t.sessions, [s]: t.sessions[s] ??
|
|
1935
|
+
return { ...t, submissions: n, sessions: { ...t.sessions, [s]: t.sessions[s] ?? Ds(s) } };
|
|
1930
1936
|
}
|
|
1931
1937
|
function zs(t, e) {
|
|
1932
1938
|
const s = e.clients[t.clientScopeId];
|
|
@@ -1968,7 +1974,7 @@ function Hs(t, e, s = !1) {
|
|
|
1968
1974
|
function ut(t) {
|
|
1969
1975
|
return JSON.stringify(t, (e, s) => s && typeof s == "object" && !Array.isArray(s) ? Object.fromEntries(Object.entries(s).sort(([n], [i]) => n.localeCompare(i))) : s);
|
|
1970
1976
|
}
|
|
1971
|
-
function
|
|
1977
|
+
function po(t, e, s, n) {
|
|
1972
1978
|
let i = t;
|
|
1973
1979
|
const r = [];
|
|
1974
1980
|
let a = null;
|
|
@@ -2010,10 +2016,10 @@ function uo(t, e, s, n) {
|
|
|
2010
2016
|
o.lane === "current" && (c = { ...c, preparation: null });
|
|
2011
2017
|
const f = c.queries.history, v = o.lane === "current" && (f.status === "not_requested" || m.next_cursor !== null && !c.items[m.next_cursor]);
|
|
2012
2018
|
if (m.conversation_id !== o.sessionId) throw new Error("Snapshot belongs to another conversation.");
|
|
2013
|
-
for (const I of m.removed_items) c =
|
|
2019
|
+
for (const I of m.removed_items) c = os(c, I);
|
|
2014
2020
|
for (const I of m.items) c = Ls(c, I);
|
|
2015
2021
|
for (const I of m.streams) c = $i(c, I);
|
|
2016
|
-
if (c = Fs(c, m.execution), c =
|
|
2022
|
+
if (c = Fs(c, m.execution), c = os(c, {
|
|
2017
2023
|
type: "conversation.follow_ups.updated",
|
|
2018
2024
|
conversation_id: m.conversation_id,
|
|
2019
2025
|
version: m.follow_ups_version,
|
|
@@ -2122,7 +2128,7 @@ function uo(t, e, s, n) {
|
|
|
2122
2128
|
sessionId: c,
|
|
2123
2129
|
sources: o.type === "conversation.interaction.updated" ? [o.interaction] : []
|
|
2124
2130
|
});
|
|
2125
|
-
const d = i.sessions[c] ??
|
|
2131
|
+
const d = i.sessions[c] ?? Ds(c), u = os(d, o);
|
|
2126
2132
|
u !== d && (i = { ...i, sessions: { ...i.sessions, [c]: u } });
|
|
2127
2133
|
break;
|
|
2128
2134
|
}
|
|
@@ -2141,7 +2147,7 @@ function uo(t, e, s, n) {
|
|
|
2141
2147
|
}
|
|
2142
2148
|
case "conversation.snapshot": {
|
|
2143
2149
|
if (!s.memberships[e.sessionId]?.members.length) return { state: t, effects: r };
|
|
2144
|
-
const o = t.sessions[e.sessionId] ??
|
|
2150
|
+
const o = t.sessions[e.sessionId] ?? Ds(e.sessionId), c = o.queries[e.lane];
|
|
2145
2151
|
if (c.requestId !== null) return { state: t, effects: r };
|
|
2146
2152
|
const l = {
|
|
2147
2153
|
authorityId: e.authorityId,
|
|
@@ -2150,7 +2156,7 @@ function uo(t, e, s, n) {
|
|
|
2150
2156
|
requestId: e.requestId,
|
|
2151
2157
|
lane: e.lane,
|
|
2152
2158
|
before: e.lane === "history" ? c.cursor : null,
|
|
2153
|
-
refreshItemIds:
|
|
2159
|
+
refreshItemIds: uo(o),
|
|
2154
2160
|
retryPreparation: c.error?.code === "history_preparation_failed"
|
|
2155
2161
|
}, d = Object.values(t.submissions).filter((g) => g.sessionId === e.sessionId && g.delivery === "accepted" && g.executionVersion === null).map((g) => g.userMessageId), u = t.requestSequence + 1, p = `conversation:${t.generation}:${u}`;
|
|
2156
2162
|
i = {
|
|
@@ -2239,7 +2245,7 @@ function Vs(t, e, s, n = !1) {
|
|
|
2239
2245
|
function Ks(t, e = null) {
|
|
2240
2246
|
return { command: X(t), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
|
|
2241
2247
|
}
|
|
2242
|
-
function
|
|
2248
|
+
function ho(t) {
|
|
2243
2249
|
const e = { ...t.context, ...t.contextPreparation };
|
|
2244
2250
|
return Object.fromEntries(["page", "pageContent", "agentMode", "metadata", "sessionTabs", "proactiveSuggestionQuestion"].filter((s) => s in e).map((s) => [s, e[s]]));
|
|
2245
2251
|
}
|
|
@@ -2289,7 +2295,7 @@ function Ws(t) {
|
|
|
2289
2295
|
request_id: c.requestId,
|
|
2290
2296
|
type: "chat.user_message",
|
|
2291
2297
|
payload: {
|
|
2292
|
-
...
|
|
2298
|
+
...ho(c),
|
|
2293
2299
|
sessionId: c.sessionId,
|
|
2294
2300
|
clientMessageId: o,
|
|
2295
2301
|
content: c.content,
|
|
@@ -2350,7 +2356,7 @@ function Ws(t) {
|
|
|
2350
2356
|
}
|
|
2351
2357
|
return { state: G(e), effects: s };
|
|
2352
2358
|
}
|
|
2353
|
-
function
|
|
2359
|
+
function fo(t, e, s, n) {
|
|
2354
2360
|
let i = t, r = e;
|
|
2355
2361
|
if (e.type === "effect.completed" || e.type === "effect.failed") {
|
|
2356
2362
|
e.effectKind === "conversation.checkpoint" && e.effectId === t.checkpointEffectId && (i = { ...i, checkpointEffectId: null, checkpointError: e.type === "effect.failed" ? e.error : null });
|
|
@@ -2566,7 +2572,7 @@ function ho(t, e, s, n) {
|
|
|
2566
2572
|
d?.phase === "uncertain" && (i = { ...t, operations: { ...t.operations, [e.requestId]: { ...d, phase: "waiting" } } });
|
|
2567
2573
|
}
|
|
2568
2574
|
}
|
|
2569
|
-
const a =
|
|
2575
|
+
const a = po(i, r, s, n);
|
|
2570
2576
|
let o = a.state;
|
|
2571
2577
|
e.type === "conversation.submission_stage" && o !== i && !o.deliveries[e.userMessageId] && (o = {
|
|
2572
2578
|
...o,
|
|
@@ -2595,7 +2601,7 @@ function ho(t, e, s, n) {
|
|
|
2595
2601
|
const c = Ws(o), l = Vs(t, c.state, s, e.type === "conversation.recover" && t.checkpointError !== null);
|
|
2596
2602
|
return { state: l.state, effects: [...l.effects, ...a.effects, ...c.effects], interactionSources: a.interactionSources };
|
|
2597
2603
|
}
|
|
2598
|
-
const
|
|
2604
|
+
const go = [
|
|
2599
2605
|
"submit",
|
|
2600
2606
|
"stop",
|
|
2601
2607
|
"staging_ipc",
|
|
@@ -2654,17 +2660,17 @@ const fo = [
|
|
|
2654
2660
|
"backend_refusal",
|
|
2655
2661
|
"unknown"
|
|
2656
2662
|
];
|
|
2657
|
-
function
|
|
2663
|
+
function mo(t) {
|
|
2658
2664
|
const e = t, s = e?.code;
|
|
2659
2665
|
return e?.backendRefusal === !0 ? "backend_refusal" : typeof s == "string" && s !== "backend_refusal" && Hi.includes(s) ? s : e?.name === "AbortError" ? "aborted" : e?.name === "TypeError" ? "type_error" : "unknown";
|
|
2660
2666
|
}
|
|
2661
|
-
const
|
|
2662
|
-
let
|
|
2663
|
-
const Hn = () => `timing:${
|
|
2667
|
+
const yo = Math.random().toString(36).slice(2);
|
|
2668
|
+
let vo = 0;
|
|
2669
|
+
const Hn = () => `timing:${yo}:${++vo}`, pt = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
|
|
2664
2670
|
function it(t) {
|
|
2665
2671
|
if (!t || typeof t != "object") return !1;
|
|
2666
2672
|
const e = t;
|
|
2667
|
-
return Object.keys(e).every((s) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory"].includes(s)) && (e.failureCategory === void 0 || e.status === "failed" && Hi.includes(e.failureCategory)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp", "email"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) &&
|
|
2673
|
+
return Object.keys(e).every((s) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory"].includes(s)) && (e.failureCategory === void 0 || e.status === "failed" && Hi.includes(e.failureCategory)) && (e.entrySurface === void 0 || ["extension_sidepanel", "extension_widget", "main_web_chat", "embedded_widget", "embedded_custom_ui", "automation", "mcp", "whatsapp", "email"].includes(e.entrySurface)) && ["send", "stop"].includes(e.operation) && ["renderer", "sdk", "extension", "http"].includes(e.layer) && go.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && pt(e.spanId) && pt(e.requestId) && (e.clientMessageId === null || pt(e.clientMessageId)) && (e.sessionId === null || pt(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
2668
2674
|
}
|
|
2669
2675
|
function te(t, e) {
|
|
2670
2676
|
if (!t) return {
|
|
@@ -2680,7 +2686,7 @@ function te(t, e) {
|
|
|
2680
2686
|
spanId: o,
|
|
2681
2687
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2682
2688
|
durationMs: Math.max(0, Math.round(performance.now() - a)),
|
|
2683
|
-
...r === "failed" ? { failureCategory:
|
|
2689
|
+
...r === "failed" ? { failureCategory: mo(c) } : {}
|
|
2684
2690
|
};
|
|
2685
2691
|
t && it(l) && Promise.resolve().then(() => t(l)).catch(() => {
|
|
2686
2692
|
});
|
|
@@ -2698,7 +2704,7 @@ function te(t, e) {
|
|
|
2698
2704
|
}
|
|
2699
2705
|
};
|
|
2700
2706
|
}
|
|
2701
|
-
function
|
|
2707
|
+
function bo(t) {
|
|
2702
2708
|
let e = [], s;
|
|
2703
2709
|
const n = () => {
|
|
2704
2710
|
clearTimeout(s), s = void 0;
|
|
@@ -2710,7 +2716,7 @@ function vo(t) {
|
|
|
2710
2716
|
it(i) && (JSON.stringify([...e, i]).length > 2800 && n(), e.push(i), e.length === 8 ? n() : s ??= setTimeout(n, 250));
|
|
2711
2717
|
};
|
|
2712
2718
|
}
|
|
2713
|
-
function
|
|
2719
|
+
function Io(t) {
|
|
2714
2720
|
let e = Promise.resolve(), s = null, n = null;
|
|
2715
2721
|
const i = () => n ??= t.read().catch((a) => {
|
|
2716
2722
|
throw n = null, a;
|
|
@@ -2775,7 +2781,7 @@ function bo(t) {
|
|
|
2775
2781
|
}
|
|
2776
2782
|
};
|
|
2777
2783
|
}
|
|
2778
|
-
function
|
|
2784
|
+
function wo(t, e, s, n) {
|
|
2779
2785
|
if (t !== e)
|
|
2780
2786
|
for (const i of Object.values(e.submissions))
|
|
2781
2787
|
i.delivery !== "accepted" || t.submissions[i.userMessageId]?.delivery === "accepted" || te(s, {
|
|
@@ -2788,12 +2794,12 @@ function Io(t, e, s, n) {
|
|
|
2788
2794
|
}).mark("acceptance_applied");
|
|
2789
2795
|
}
|
|
2790
2796
|
const j = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
|
|
2791
|
-
function
|
|
2797
|
+
function _o(t) {
|
|
2792
2798
|
if (!t || typeof t != "object") return !1;
|
|
2793
2799
|
const e = t, s = (i) => Number.isSafeInteger(i) && i >= 0, n = (i) => i && typeof i == "object" && Object.keys(i).every((r) => ["sequence", "at", "type", "changed", "generation", "sessionId", "scopeId", "requestId", "effectId", "clientScopeId", "reason", "effectKind", "eventType", "itemCount", "removedCount", "projectionReady"].includes(r)) && s(i.sequence) && s(i.at) && j(i.type) !== null && typeof i.changed == "boolean" && [i.generation, i.itemCount, i.removedCount].every((r) => r === null || s(r)) && [i.sessionId, i.scopeId, i.requestId, i.effectId, i.clientScopeId, i.reason, i.effectKind, i.eventType].every((r) => r === null || j(r) !== null) && (i.projectionReady === null || typeof i.projectionReady == "boolean");
|
|
2794
2800
|
return Object.keys(e).every((i) => ["ownerId", "revision", "dropped", "lastIntent", "lastSelection", "transitions"].includes(i)) && j(e.ownerId) !== null && s(e.revision) && s(e.dropped) && (e.lastIntent == null || n(e.lastIntent)) && (e.lastSelection === null || n(e.lastSelection)) && Array.isArray(e.transitions) && e.transitions.length <= 16 && e.transitions.every(n);
|
|
2795
2801
|
}
|
|
2796
|
-
function
|
|
2802
|
+
function So(t, e, s) {
|
|
2797
2803
|
const n = t;
|
|
2798
2804
|
if (!/^(directory\.|conversation\.|session\.)/.test(n.type ?? "") && !/^(directory\.|conversation\.|session\.)/.test(n.effectKind ?? "") || n.type === "conversation.display_received" && !["conversation.execution.updated", "conversation.item.removed"].includes(n.event?.type ?? "")) return null;
|
|
2799
2805
|
const i = n.output?.snapshot;
|
|
@@ -2821,23 +2827,23 @@ function un(t) {
|
|
|
2821
2827
|
const e = t;
|
|
2822
2828
|
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;
|
|
2823
2829
|
}
|
|
2824
|
-
const Vn = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], pn = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), Ee = (t) => t === null || pn(t),
|
|
2830
|
+
const Vn = ["messageKeys", "canonicalItemKeys", "terminalResponseKeys", "toolCallKeys", "activeResponseKeys"], pn = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t), Ee = (t) => t === null || pn(t), ko = (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));
|
|
2825
2831
|
function hn(t) {
|
|
2826
2832
|
if (!t || typeof t != "object") return !1;
|
|
2827
2833
|
const e = t;
|
|
2828
|
-
return Object.keys(t).every((s) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(s)) && Ee(e.sessionId) && pn(e.itemId) && Ee(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && Ee(e.runId) && (e.createdAt === null ||
|
|
2834
|
+
return Object.keys(t).every((s) => ["sessionId", "itemId", "userMessageId", "createdAt", "runId", "retryable"].includes(s)) && Ee(e.sessionId) && pn(e.itemId) && Ee(e.userMessageId) && (e.retryable === void 0 || typeof e.retryable == "boolean") && Ee(e.runId) && (e.createdAt === null || ko(e.createdAt));
|
|
2829
2835
|
}
|
|
2830
|
-
function
|
|
2836
|
+
function Ro(t) {
|
|
2831
2837
|
if (!t || typeof t != "object") return !1;
|
|
2832
2838
|
const e = t, s = (n) => Number.isSafeInteger(n) && n >= 0;
|
|
2833
|
-
return Object.keys(e).every((n) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner", "sdkVersion", "presentationGate", "firstObservedAt", "confirmationMs"].includes(n)) && s(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((n) => n === null || s(n)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((n) => n === null || j(n) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((n) => typeof n == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout", "observer"].includes(e.renderSource) && (e.owner === void 0 ||
|
|
2839
|
+
return Object.keys(e).every((n) => ["capturedAt", "selectionKey", "userId", "loading", "draft", "thinking", "connected", "hasError", "phase", "queryStatus", "queryRequestId", "queryUpdatedAt", "renderSource", "selectionFencePending", "guardCreatedAt", "owner", "sdkVersion", "presentationGate", "firstObservedAt", "confirmationMs"].includes(n)) && s(e.capturedAt) && [e.queryUpdatedAt, e.guardCreatedAt].every((n) => n === null || s(n)) && [e.selectionKey, e.userId, e.phase, e.queryStatus, e.queryRequestId].every((n) => n === null || j(n) !== null) && [e.loading, e.draft, e.thinking, e.connected, e.hasError, e.selectionFencePending].every((n) => typeof n == "boolean") && ["state", "account", "interactions", "local", "sidepanel_layout", "observer"].includes(e.renderSource) && (e.owner === void 0 || _o(e.owner)) && (e.sdkVersion === void 0 || typeof e.sdkVersion == "string" && e.sdkVersion.length <= 32 && /^\d+\.\d+\.\d+(?:[-+][a-zA-Z0-9.-]+)?$/.test(e.sdkVersion)) && (e.presentationGate === void 0 || ["none", "authentication", "signup"].includes(e.presentationGate)) && [e.firstObservedAt, e.confirmationMs].every((n) => n === void 0 || s(n));
|
|
2834
2840
|
}
|
|
2835
2841
|
function fn(t) {
|
|
2836
2842
|
if (!t || typeof t != "object" || Object.keys(t).some((n) => n !== "before" && n !== "current")) return !1;
|
|
2837
2843
|
const e = (n) => {
|
|
2838
2844
|
if (!n || typeof n != "object") return !1;
|
|
2839
2845
|
const i = n;
|
|
2840
|
-
return Object.keys(n).every((r) => [...Vn, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(r)) && (i.duplicateToolCalls === void 0 || Array.isArray(i.duplicateToolCalls) && i.duplicateToolCalls.length <= 5 && i.duplicateToolCalls.every((r) => r && Object.keys(r).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && Ee(r.key) && Number.isSafeInteger(r.count) && r.count >= 2 && typeof r.truncated == "boolean" && Array.isArray(r.rows) && r.rows.length >= 1 && r.rows.length <= 5 && r.rows.length <= r.count && r.rows.every((a) => a && Object.keys(a).every((o) => ["itemId", "groupId"].includes(o)) && Ee(a.itemId) && Ee(a.groupId)))) && (i.context === void 0 ||
|
|
2846
|
+
return Object.keys(n).every((r) => [...Vn, "sessionId", "runtimeItemCount", "welcome", "truncated", "thinkingSequence", "context", "duplicateToolCalls"].includes(r)) && (i.duplicateToolCalls === void 0 || Array.isArray(i.duplicateToolCalls) && i.duplicateToolCalls.length <= 5 && i.duplicateToolCalls.every((r) => r && Object.keys(r).every((a) => ["key", "count", "rows", "truncated"].includes(a)) && Ee(r.key) && Number.isSafeInteger(r.count) && r.count >= 2 && typeof r.truncated == "boolean" && Array.isArray(r.rows) && r.rows.length >= 1 && r.rows.length <= 5 && r.rows.length <= r.count && r.rows.every((a) => a && Object.keys(a).every((o) => ["itemId", "groupId"].includes(o)) && Ee(a.itemId) && Ee(a.groupId)))) && (i.context === void 0 || Ro(i.context)) && (i.thinkingSequence === void 0 || Array.isArray(i.thinkingSequence) && i.thinkingSequence.length <= 20 && i.thinkingSequence.every((r) => r === "user" || r === "thinking")) && Ee(i.sessionId) && Number.isSafeInteger(i.runtimeItemCount) && i.runtimeItemCount >= 0 && typeof i.welcome == "boolean" && typeof i.truncated == "boolean" && Vn.every((r) => Array.isArray(i[r]) && i[r].length <= 20 && i[r].every(pn));
|
|
2841
2847
|
}, s = t;
|
|
2842
2848
|
return (s.before === null || e(s.before)) && e(s.current);
|
|
2843
2849
|
}
|
|
@@ -2852,7 +2858,7 @@ function Vi(t) {
|
|
|
2852
2858
|
e ^= t.charCodeAt(s), e = Math.imul(e, 16777619);
|
|
2853
2859
|
return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
|
|
2854
2860
|
}
|
|
2855
|
-
function
|
|
2861
|
+
function Ao(t) {
|
|
2856
2862
|
if (!t || typeof t != "object") return !1;
|
|
2857
2863
|
const e = t;
|
|
2858
2864
|
return Object.keys(e).every((s) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(s)) && (e.clientMessageId === void 0 || j(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((s) => s === null || j(s) !== null) && (e.normalization === void 0 || nt(e.normalization)) && !!e.builds && typeof e.builds == "object" && typeof e.builds.sdk == "string" && Object.entries(e.builds).every(([s, n]) => ["sdk", "rendererExtension", "contentExtension", "backgroundExtension"].includes(s) && typeof n == "string" && /^\d{1,5}\.\d{1,5}\.\d{1,5}$/.test(n));
|
|
@@ -2865,10 +2871,10 @@ function Ki(t, e, s, n, i = {}) {
|
|
|
2865
2871
|
...j(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
|
|
2866
2872
|
code: r ? j(t.lastErrorCode) : null,
|
|
2867
2873
|
...nt(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
|
|
2868
|
-
builds: { sdk:
|
|
2874
|
+
builds: { sdk: Bt.version, ...i }
|
|
2869
2875
|
};
|
|
2870
2876
|
}
|
|
2871
|
-
function
|
|
2877
|
+
function Eo(t, e = "runtime") {
|
|
2872
2878
|
const s = Y(t, "runtime_error", e), n = t !== null && typeof t == "object" && "stack" in t && typeof t.stack == "string" ? Ce(t.stack.slice(0, 4e3).split(`
|
|
2873
2879
|
`).slice(0, 6).join(`
|
|
2874
2880
|
`).replace(/\n\s*at\s/g, `
|
|
@@ -2905,7 +2911,7 @@ function pe(t) {
|
|
|
2905
2911
|
"upstreamTraceId"
|
|
2906
2912
|
].includes(n)) && j(e.requestId) !== null && ["GET", "POST", "PUT", "PATCH", "DELETE"].includes(e.method) && ["/api/product-agent/conversations/:sessionId/snapshot", "/api/product-agent/:namespace/commands", "/api/product-agent/:namespace/:operation"].includes(e.route) && (e.status === null || s(e.status) && e.status >= 100 && e.status <= 599) && (e.abortTrigger === null || ["deadline", "transport_disposed", "owner_disposed", "authority_retired", "observation_released", "request_replaced", "caller_cancelled", "unexpected_abort"].includes(e.abortTrigger)) && ["http_deadline", "http_transport", "conversation_query", "browser", "http_response"].includes(e.owner) && (e.category === void 0 || /^[a-z0-9_]{1,80}$/.test(e.category)) && [e.responseHeadersMs, e.responseBodyMs].every((n) => n == null || s(n)) && s(e.elapsedMs) && s(e.attempt) && e.attempt >= 1 && e.attempt <= 10 && [e.queryRequestId, e.ownerId, e.sessionId].every((n) => n === null || j(n) !== null) && (e.authorityGeneration === null || s(e.authorityGeneration)) && typeof e.release == "string" && /^[a-zA-Z0-9._-]{1,80}$/.test(e.release) && [e.upstreamRequestId, e.upstreamTraceId].every((n) => n === null || typeof n == "string" && /^[a-zA-Z0-9_:;=./-]{1,160}$/.test(n));
|
|
2907
2913
|
}
|
|
2908
|
-
function
|
|
2914
|
+
function To(t) {
|
|
2909
2915
|
const e = {}, s = (n, i) => {
|
|
2910
2916
|
if (!n || typeof n != "object") return;
|
|
2911
2917
|
const r = n;
|
|
@@ -2926,7 +2932,7 @@ function Eo(t) {
|
|
|
2926
2932
|
}
|
|
2927
2933
|
return e;
|
|
2928
2934
|
}
|
|
2929
|
-
function
|
|
2935
|
+
function qo(t, e = Math.random, s = Math.random) {
|
|
2930
2936
|
const n = () => Math.floor(s() * 21) - 10;
|
|
2931
2937
|
return {
|
|
2932
2938
|
"activeUsers.load": async () => ({ count: await t(), updatedAt: Date.now(), offset: n() }),
|
|
@@ -2934,14 +2940,14 @@ function To(t, e = Math.random, s = Math.random) {
|
|
|
2934
2940
|
"activeUsers.wait": ({ milliseconds: i }) => new Promise((r) => setTimeout(() => r(null), i + Math.round((e() - 0.5) * 1e3)))
|
|
2935
2941
|
};
|
|
2936
2942
|
}
|
|
2937
|
-
async function
|
|
2943
|
+
async function Co(t, e = fetch) {
|
|
2938
2944
|
const s = await e(new URL("/api/product-agent/embed/active-users", t), { cache: "no-store", credentials: "omit" });
|
|
2939
2945
|
if (!s.ok) throw new Error(`Active users request failed (${s.status})`);
|
|
2940
2946
|
const n = await s.json();
|
|
2941
2947
|
if (typeof n.count != "number" || !Number.isFinite(n.count) || n.count < 0) throw new Error("Invalid active users count");
|
|
2942
2948
|
return Math.round(n.count);
|
|
2943
2949
|
}
|
|
2944
|
-
function
|
|
2950
|
+
function Oo(t) {
|
|
2945
2951
|
const e = {
|
|
2946
2952
|
sidepanel: "extension_sidepanel",
|
|
2947
2953
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -2953,7 +2959,7 @@ function Co(t) {
|
|
|
2953
2959
|
};
|
|
2954
2960
|
return t && t in e ? e[t] : t ?? "embedded_custom_ui";
|
|
2955
2961
|
}
|
|
2956
|
-
function
|
|
2962
|
+
function xo(t, e) {
|
|
2957
2963
|
const s = {}, n = {};
|
|
2958
2964
|
for (const i of e) {
|
|
2959
2965
|
const r = i.command.payload, a = String(r.clientMessageId);
|
|
@@ -2982,7 +2988,7 @@ function Oo(t, e) {
|
|
|
2982
2988
|
}
|
|
2983
2989
|
return { schema: 1, authorityId: t.authorityId, operations: t.operations, stops: t.stops, requestSequence: t.requestSequence, submissions: s, submissionOrder: Object.keys(s), deliveries: n };
|
|
2984
2990
|
}
|
|
2985
|
-
function
|
|
2991
|
+
function as(t) {
|
|
2986
2992
|
try {
|
|
2987
2993
|
return window.sessionStorage.getItem(t);
|
|
2988
2994
|
} catch (e) {
|
|
@@ -2990,7 +2996,7 @@ function os(t) {
|
|
|
2990
2996
|
return null;
|
|
2991
2997
|
}
|
|
2992
2998
|
}
|
|
2993
|
-
function
|
|
2999
|
+
function Mo(t, e) {
|
|
2994
3000
|
try {
|
|
2995
3001
|
window.sessionStorage.setItem(`pa.authority:${t}`, e);
|
|
2996
3002
|
} catch (s) {
|
|
@@ -3083,7 +3089,7 @@ function ke(t, e) {
|
|
|
3083
3089
|
retryable: t !== null && typeof t == "object" && "retryable" in t && typeof t.retryable == "boolean" ? t.retryable : ["authority_retired", "executor_not_ready", "connection_interrupted", "request_timed_out", "408", "425", "429"].includes(n) || /^5\d\d$/.test(n)
|
|
3084
3090
|
});
|
|
3085
3091
|
}
|
|
3086
|
-
function
|
|
3092
|
+
function Po(t) {
|
|
3087
3093
|
let e = Promise.resolve();
|
|
3088
3094
|
const s = (o = ln(t.runtime().engine.getState().slices.conversation, t.runtime().engine.getState().slices.directory), c = Promise.resolve()) => {
|
|
3089
3095
|
const l = c.then(() => ({ ok: !0 }), (u) => ({ ok: !1, error: u })), d = async () => {
|
|
@@ -3333,7 +3339,7 @@ function Mo(t) {
|
|
|
3333
3339
|
})
|
|
3334
3340
|
};
|
|
3335
3341
|
}
|
|
3336
|
-
class
|
|
3342
|
+
class Do {
|
|
3337
3343
|
constructor(e) {
|
|
3338
3344
|
this.options = e, this.owner = `conversation:${e.authority.authorityId}:${e.authority.generation}`, this.deliveryRecovery = new It({
|
|
3339
3345
|
activeIntervalMs: 3e3,
|
|
@@ -3450,10 +3456,10 @@ class Po {
|
|
|
3450
3456
|
}
|
|
3451
3457
|
}
|
|
3452
3458
|
}
|
|
3453
|
-
const
|
|
3459
|
+
const Uo = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
3454
3460
|
function Pe(t, e) {
|
|
3455
3461
|
return e ? t.replace(
|
|
3456
|
-
|
|
3462
|
+
Uo,
|
|
3457
3463
|
(s, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
|
|
3458
3464
|
) : t;
|
|
3459
3465
|
}
|
|
@@ -3494,7 +3500,7 @@ function Wn(t, e) {
|
|
|
3494
3500
|
...t.file_url === null ? {} : { fileUrl: new URL(t.file_url, e).toString() }
|
|
3495
3501
|
};
|
|
3496
3502
|
}
|
|
3497
|
-
function
|
|
3503
|
+
function No(t, e, s, n) {
|
|
3498
3504
|
const i = s === "open" || s === "awaiting_content", r = {
|
|
3499
3505
|
id: t.id,
|
|
3500
3506
|
createdAt: t.created_at,
|
|
@@ -3531,11 +3537,11 @@ function Uo(t, e, s, n) {
|
|
|
3531
3537
|
return { ...r, role: "system", dataType: "run_status", content: t.data.message, loading: !1 };
|
|
3532
3538
|
}
|
|
3533
3539
|
}
|
|
3534
|
-
function
|
|
3540
|
+
function cs(t, e, s, n) {
|
|
3535
3541
|
const i = /* @__PURE__ */ new Map();
|
|
3536
3542
|
for (const y of t.segments)
|
|
3537
3543
|
for (const w of [...y.activityIds, ...y.outcomeIds]) i.set(w, y.userMessageId);
|
|
3538
|
-
const r = t.items.map((y) =>
|
|
3544
|
+
const r = t.items.map((y) => No(
|
|
3539
3545
|
y,
|
|
3540
3546
|
i.get(y.id) ?? null,
|
|
3541
3547
|
t.streamStates[y.id],
|
|
@@ -3659,7 +3665,7 @@ function Gn(t) {
|
|
|
3659
3665
|
return "This request was interrupted before acceptance could be confirmed.";
|
|
3660
3666
|
}
|
|
3661
3667
|
}
|
|
3662
|
-
function
|
|
3668
|
+
function jo(t) {
|
|
3663
3669
|
return {
|
|
3664
3670
|
content: t.content,
|
|
3665
3671
|
...typeof t.context.proactiveSuggestionQuestion == "string" ? { proactiveSuggestionQuestion: t.context.proactiveSuggestionQuestion } : {},
|
|
@@ -3771,28 +3777,28 @@ function _t(t) {
|
|
|
3771
3777
|
nextCursor: t.nextCursor
|
|
3772
3778
|
};
|
|
3773
3779
|
}
|
|
3774
|
-
function
|
|
3780
|
+
function Bo(t, e, s) {
|
|
3775
3781
|
if (s === "replace" || t === null) return e;
|
|
3776
3782
|
const n = { ...t.entitiesById, ...e.entitiesById }, i = [...t.ids];
|
|
3777
3783
|
for (const r of e.ids)
|
|
3778
3784
|
t.entitiesById[r] || i.push(r);
|
|
3779
3785
|
return { entitiesById: n, ids: i, nextCursor: e.nextCursor };
|
|
3780
3786
|
}
|
|
3781
|
-
function
|
|
3787
|
+
function Lo(t) {
|
|
3782
3788
|
return t ? t.ids.map((e) => t.entitiesById[e]).filter((e) => !!e) : [];
|
|
3783
3789
|
}
|
|
3784
|
-
function
|
|
3790
|
+
function Jl(t) {
|
|
3785
3791
|
return t.visible ? t.minimized ? { state: "minimized" } : { state: t.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
3786
3792
|
}
|
|
3787
|
-
function
|
|
3793
|
+
function Fo(t) {
|
|
3788
3794
|
if (!t || typeof t != "object") return !1;
|
|
3789
3795
|
const e = t.paidCreditFallbackModel;
|
|
3790
3796
|
return typeof e == "string" && e.length > 0;
|
|
3791
3797
|
}
|
|
3792
|
-
function
|
|
3798
|
+
function Ql(t) {
|
|
3793
3799
|
return t.submissionAllowed && t.isAuthenticated && t.hasWorkspace && !t.isWebsiteBlocked && t.isCurrentPageResolved && !t.isSubmitting && !t.hasPendingMessage;
|
|
3794
3800
|
}
|
|
3795
|
-
function
|
|
3801
|
+
function Xl(t) {
|
|
3796
3802
|
const e = t.hasDraftMessage || t.hasPreSubmittedAttachment;
|
|
3797
3803
|
return t.hasRunningAssistantTurn && !e ? {
|
|
3798
3804
|
action: "stop",
|
|
@@ -3802,9 +3808,9 @@ function Ql(t) {
|
|
|
3802
3808
|
disabled: !e || !t.canSubmitMessage
|
|
3803
3809
|
};
|
|
3804
3810
|
}
|
|
3805
|
-
const
|
|
3806
|
-
function
|
|
3807
|
-
return (t instanceof Error ? t.message : t) ===
|
|
3811
|
+
const $o = "Pluno is reconnecting. Try again in a moment.";
|
|
3812
|
+
function zo(t) {
|
|
3813
|
+
return (t instanceof Error ? t.message : t) === $o;
|
|
3808
3814
|
}
|
|
3809
3815
|
const he = /* @__PURE__ */ Object.create(null);
|
|
3810
3816
|
he.open = "0";
|
|
@@ -3828,27 +3834,27 @@ const Js = { type: "error", data: "parser error" }, Wi = typeof Blob == "functio
|
|
|
3828
3834
|
function Xn(t) {
|
|
3829
3835
|
return t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
3830
3836
|
}
|
|
3831
|
-
let
|
|
3832
|
-
function
|
|
3837
|
+
let ds;
|
|
3838
|
+
function Ho(t, e) {
|
|
3833
3839
|
if (Wi && t.data instanceof Blob)
|
|
3834
3840
|
return t.data.arrayBuffer().then(Xn).then(e);
|
|
3835
3841
|
if (Gi && (t.data instanceof ArrayBuffer || Ji(t.data)))
|
|
3836
3842
|
return e(Xn(t.data));
|
|
3837
3843
|
gn(t, !1, (s) => {
|
|
3838
|
-
|
|
3844
|
+
ds || (ds = new TextEncoder()), e(ds.encode(s));
|
|
3839
3845
|
});
|
|
3840
3846
|
}
|
|
3841
3847
|
const Yn = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Xe = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
3842
3848
|
for (let t = 0; t < Yn.length; t++)
|
|
3843
3849
|
Xe[Yn.charCodeAt(t)] = t;
|
|
3844
|
-
const
|
|
3850
|
+
const Vo = (t) => {
|
|
3845
3851
|
let e = t.length * 0.75, s = t.length, n, i = 0, r, a, o, c;
|
|
3846
3852
|
t[t.length - 1] === "=" && (e--, t[t.length - 2] === "=" && e--);
|
|
3847
3853
|
const l = new ArrayBuffer(e), d = new Uint8Array(l);
|
|
3848
3854
|
for (n = 0; n < s; n += 4)
|
|
3849
3855
|
r = Xe[t.charCodeAt(n)], a = Xe[t.charCodeAt(n + 1)], o = Xe[t.charCodeAt(n + 2)], c = Xe[t.charCodeAt(n + 3)], d[i++] = r << 2 | a >> 4, d[i++] = (a & 15) << 4 | o >> 2, d[i++] = (o & 3) << 6 | c & 63;
|
|
3850
3856
|
return l;
|
|
3851
|
-
},
|
|
3857
|
+
}, Ko = typeof ArrayBuffer == "function", mn = (t, e) => {
|
|
3852
3858
|
if (typeof t != "string")
|
|
3853
3859
|
return {
|
|
3854
3860
|
type: "message",
|
|
@@ -3857,20 +3863,20 @@ const Ho = (t) => {
|
|
|
3857
3863
|
const s = t.charAt(0);
|
|
3858
3864
|
return s === "b" ? {
|
|
3859
3865
|
type: "message",
|
|
3860
|
-
data:
|
|
3866
|
+
data: Wo(t.substring(1), e)
|
|
3861
3867
|
} : St[s] ? t.length > 1 ? {
|
|
3862
3868
|
type: St[s],
|
|
3863
3869
|
data: t.substring(1)
|
|
3864
3870
|
} : {
|
|
3865
3871
|
type: St[s]
|
|
3866
3872
|
} : Js;
|
|
3867
|
-
},
|
|
3868
|
-
if (
|
|
3869
|
-
const s =
|
|
3873
|
+
}, Wo = (t, e) => {
|
|
3874
|
+
if (Ko) {
|
|
3875
|
+
const s = Vo(t);
|
|
3870
3876
|
return Qi(s, e);
|
|
3871
3877
|
} else
|
|
3872
3878
|
return { base64: !0, data: t };
|
|
3873
|
-
}, Qi = (t, e) => e === "blob" ? t instanceof Blob ? t : new Blob([t]) : t instanceof ArrayBuffer ? t : t.buffer, Xi = "",
|
|
3879
|
+
}, Qi = (t, e) => e === "blob" ? t instanceof Blob ? t : new Blob([t]) : t instanceof ArrayBuffer ? t : t.buffer, Xi = "", Go = (t, e) => {
|
|
3874
3880
|
const s = t.length, n = new Array(s);
|
|
3875
3881
|
let i = 0;
|
|
3876
3882
|
t.forEach((r, a) => {
|
|
@@ -3878,7 +3884,7 @@ const Ho = (t) => {
|
|
|
3878
3884
|
n[a] = o, ++i === s && e(n.join(Xi));
|
|
3879
3885
|
});
|
|
3880
3886
|
});
|
|
3881
|
-
},
|
|
3887
|
+
}, Jo = (t, e) => {
|
|
3882
3888
|
const s = t.split(Xi), n = [];
|
|
3883
3889
|
for (let i = 0; i < s.length; i++) {
|
|
3884
3890
|
const r = mn(s[i], e);
|
|
@@ -3887,10 +3893,10 @@ const Ho = (t) => {
|
|
|
3887
3893
|
}
|
|
3888
3894
|
return n;
|
|
3889
3895
|
};
|
|
3890
|
-
function
|
|
3896
|
+
function Qo() {
|
|
3891
3897
|
return new TransformStream({
|
|
3892
3898
|
transform(t, e) {
|
|
3893
|
-
|
|
3899
|
+
Ho(t, (s) => {
|
|
3894
3900
|
const n = s.length;
|
|
3895
3901
|
let i;
|
|
3896
3902
|
if (n < 126)
|
|
@@ -3909,7 +3915,7 @@ function Jo() {
|
|
|
3909
3915
|
}
|
|
3910
3916
|
});
|
|
3911
3917
|
}
|
|
3912
|
-
let
|
|
3918
|
+
let ls;
|
|
3913
3919
|
function ht(t) {
|
|
3914
3920
|
return t.reduce((e, s) => e + s.length, 0);
|
|
3915
3921
|
}
|
|
@@ -3922,8 +3928,8 @@ function ft(t, e) {
|
|
|
3922
3928
|
s[i] = t[0][n++], n === t[0].length && (t.shift(), n = 0);
|
|
3923
3929
|
return t.length && n < t[0].length && (t[0] = t[0].slice(n)), s;
|
|
3924
3930
|
}
|
|
3925
|
-
function
|
|
3926
|
-
|
|
3931
|
+
function Xo(t, e) {
|
|
3932
|
+
ls || (ls = new TextDecoder());
|
|
3927
3933
|
const s = [];
|
|
3928
3934
|
let n = 0, i = -1, r = !1;
|
|
3929
3935
|
return new TransformStream({
|
|
@@ -3952,7 +3958,7 @@ function Qo(t, e) {
|
|
|
3952
3958
|
if (ht(s) < i)
|
|
3953
3959
|
break;
|
|
3954
3960
|
const c = ft(s, i);
|
|
3955
|
-
o.enqueue(mn(r ? c :
|
|
3961
|
+
o.enqueue(mn(r ? c : ls.decode(c), e)), n = 0;
|
|
3956
3962
|
}
|
|
3957
3963
|
if (i === 0 || i > t) {
|
|
3958
3964
|
o.enqueue(Js);
|
|
@@ -3964,9 +3970,9 @@ function Qo(t, e) {
|
|
|
3964
3970
|
}
|
|
3965
3971
|
const Yi = 4;
|
|
3966
3972
|
function F(t) {
|
|
3967
|
-
if (t) return
|
|
3973
|
+
if (t) return Yo(t);
|
|
3968
3974
|
}
|
|
3969
|
-
function
|
|
3975
|
+
function Yo(t) {
|
|
3970
3976
|
for (var e in F.prototype)
|
|
3971
3977
|
t[e] = F.prototype[e];
|
|
3972
3978
|
return t;
|
|
@@ -4012,19 +4018,19 @@ F.prototype.listeners = function(t) {
|
|
|
4012
4018
|
F.prototype.hasListeners = function(t) {
|
|
4013
4019
|
return !!this.listeners(t).length;
|
|
4014
4020
|
};
|
|
4015
|
-
const
|
|
4021
|
+
const Ft = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, s) => s(e, 0), re = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Zo = "arraybuffer";
|
|
4016
4022
|
function Zi(t, ...e) {
|
|
4017
4023
|
return e.reduce((s, n) => (t.hasOwnProperty(n) && (s[n] = t[n]), s), {});
|
|
4018
4024
|
}
|
|
4019
|
-
const
|
|
4020
|
-
function
|
|
4021
|
-
e.useNativeTimers ? (t.setTimeoutFn =
|
|
4022
|
-
}
|
|
4023
|
-
const ta = 1.33;
|
|
4024
|
-
function sa(t) {
|
|
4025
|
-
return typeof t == "string" ? na(t) : Math.ceil((t.byteLength || t.size) * ta);
|
|
4025
|
+
const ea = re.setTimeout, ta = re.clearTimeout;
|
|
4026
|
+
function $t(t, e) {
|
|
4027
|
+
e.useNativeTimers ? (t.setTimeoutFn = ea.bind(re), t.clearTimeoutFn = ta.bind(re)) : (t.setTimeoutFn = re.setTimeout.bind(re), t.clearTimeoutFn = re.clearTimeout.bind(re));
|
|
4026
4028
|
}
|
|
4029
|
+
const sa = 1.33;
|
|
4027
4030
|
function na(t) {
|
|
4031
|
+
return typeof t == "string" ? ia(t) : Math.ceil((t.byteLength || t.size) * sa);
|
|
4032
|
+
}
|
|
4033
|
+
function ia(t) {
|
|
4028
4034
|
let e = 0, s = 0;
|
|
4029
4035
|
for (let n = 0, i = t.length; n < i; n++)
|
|
4030
4036
|
e = t.charCodeAt(n), e < 128 ? s += 1 : e < 2048 ? s += 2 : e < 55296 || e >= 57344 ? s += 3 : (n++, s += 4);
|
|
@@ -4033,13 +4039,13 @@ function na(t) {
|
|
|
4033
4039
|
function er() {
|
|
4034
4040
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
4035
4041
|
}
|
|
4036
|
-
function
|
|
4042
|
+
function ra(t) {
|
|
4037
4043
|
let e = "";
|
|
4038
4044
|
for (let s in t)
|
|
4039
4045
|
t.hasOwnProperty(s) && (e.length && (e += "&"), e += encodeURIComponent(s) + "=" + encodeURIComponent(t[s]));
|
|
4040
4046
|
return e;
|
|
4041
4047
|
}
|
|
4042
|
-
function
|
|
4048
|
+
function oa(t) {
|
|
4043
4049
|
let e = {}, s = t.split("&");
|
|
4044
4050
|
for (let n = 0, i = s.length; n < i; n++) {
|
|
4045
4051
|
let r = s[n].split("=");
|
|
@@ -4047,7 +4053,7 @@ function ra(t) {
|
|
|
4047
4053
|
}
|
|
4048
4054
|
return e;
|
|
4049
4055
|
}
|
|
4050
|
-
class
|
|
4056
|
+
class aa extends Error {
|
|
4051
4057
|
constructor(e, s, n) {
|
|
4052
4058
|
super(e), this.description = s, this.context = n, this.type = "TransportError";
|
|
4053
4059
|
}
|
|
@@ -4060,7 +4066,7 @@ class yn extends F {
|
|
|
4060
4066
|
* @protected
|
|
4061
4067
|
*/
|
|
4062
4068
|
constructor(e) {
|
|
4063
|
-
super(), this.writable = !1,
|
|
4069
|
+
super(), this.writable = !1, $t(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
4064
4070
|
}
|
|
4065
4071
|
/**
|
|
4066
4072
|
* Emits an error.
|
|
@@ -4072,7 +4078,7 @@ class yn extends F {
|
|
|
4072
4078
|
* @protected
|
|
4073
4079
|
*/
|
|
4074
4080
|
onError(e, s, n) {
|
|
4075
|
-
return super.emitReserved("error", new
|
|
4081
|
+
return super.emitReserved("error", new aa(e, s, n)), this;
|
|
4076
4082
|
}
|
|
4077
4083
|
/**
|
|
4078
4084
|
* Opens the transport.
|
|
@@ -4146,11 +4152,11 @@ class yn extends F {
|
|
|
4146
4152
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
4147
4153
|
}
|
|
4148
4154
|
_query(e) {
|
|
4149
|
-
const s =
|
|
4155
|
+
const s = ra(e);
|
|
4150
4156
|
return s.length ? "?" + s : "";
|
|
4151
4157
|
}
|
|
4152
4158
|
}
|
|
4153
|
-
class
|
|
4159
|
+
class ca extends yn {
|
|
4154
4160
|
constructor() {
|
|
4155
4161
|
super(...arguments), this._polling = !1;
|
|
4156
4162
|
}
|
|
@@ -4206,7 +4212,7 @@ class aa extends yn {
|
|
|
4206
4212
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
4207
4213
|
this.onPacket(n);
|
|
4208
4214
|
};
|
|
4209
|
-
|
|
4215
|
+
Jo(e, this.socket.binaryType).forEach(s), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
4210
4216
|
}
|
|
4211
4217
|
/**
|
|
4212
4218
|
* For polling, send a close packet.
|
|
@@ -4226,7 +4232,7 @@ class aa extends yn {
|
|
|
4226
4232
|
* @protected
|
|
4227
4233
|
*/
|
|
4228
4234
|
write(e) {
|
|
4229
|
-
this.writable = !1,
|
|
4235
|
+
this.writable = !1, Go(e, (s) => {
|
|
4230
4236
|
this.doWrite(s, () => {
|
|
4231
4237
|
this.writable = !0, this.emitReserved("drain");
|
|
4232
4238
|
});
|
|
@@ -4247,10 +4253,10 @@ try {
|
|
|
4247
4253
|
tr = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
4248
4254
|
} catch {
|
|
4249
4255
|
}
|
|
4250
|
-
const
|
|
4251
|
-
function
|
|
4256
|
+
const da = tr;
|
|
4257
|
+
function la() {
|
|
4252
4258
|
}
|
|
4253
|
-
class
|
|
4259
|
+
class ua extends ca {
|
|
4254
4260
|
/**
|
|
4255
4261
|
* XHR Polling constructor.
|
|
4256
4262
|
*
|
|
@@ -4300,7 +4306,7 @@ let Ue = class kt extends F {
|
|
|
4300
4306
|
* @package
|
|
4301
4307
|
*/
|
|
4302
4308
|
constructor(e, s, n) {
|
|
4303
|
-
super(), this.createRequest = e,
|
|
4309
|
+
super(), this.createRequest = e, $t(this, n), this._opts = n, this._method = n.method || "GET", this._uri = s, this._data = n.data !== void 0 ? n.data : null, this._create();
|
|
4304
4310
|
}
|
|
4305
4311
|
/**
|
|
4306
4312
|
* Creates the XHR object and sends the request.
|
|
@@ -4363,7 +4369,7 @@ let Ue = class kt extends F {
|
|
|
4363
4369
|
*/
|
|
4364
4370
|
_cleanup(e) {
|
|
4365
4371
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
4366
|
-
if (this._xhr.onreadystatechange =
|
|
4372
|
+
if (this._xhr.onreadystatechange = la, e)
|
|
4367
4373
|
try {
|
|
4368
4374
|
this._xhr.abort();
|
|
4369
4375
|
} catch {
|
|
@@ -4395,7 +4401,7 @@ if (typeof document < "u") {
|
|
|
4395
4401
|
if (typeof attachEvent == "function")
|
|
4396
4402
|
attachEvent("onunload", Zn);
|
|
4397
4403
|
else if (typeof addEventListener == "function") {
|
|
4398
|
-
const t = "onpagehide" in
|
|
4404
|
+
const t = "onpagehide" in re ? "pagehide" : "unload";
|
|
4399
4405
|
addEventListener(t, Zn, !1);
|
|
4400
4406
|
}
|
|
4401
4407
|
}
|
|
@@ -4403,17 +4409,17 @@ function Zn() {
|
|
|
4403
4409
|
for (let t in Ue.requests)
|
|
4404
4410
|
Ue.requests.hasOwnProperty(t) && Ue.requests[t].abort();
|
|
4405
4411
|
}
|
|
4406
|
-
const
|
|
4412
|
+
const pa = (function() {
|
|
4407
4413
|
const t = sr({
|
|
4408
4414
|
xdomain: !1
|
|
4409
4415
|
});
|
|
4410
4416
|
return t && t.responseType !== null;
|
|
4411
4417
|
})();
|
|
4412
|
-
class
|
|
4418
|
+
class ha extends ua {
|
|
4413
4419
|
constructor(e) {
|
|
4414
4420
|
super(e);
|
|
4415
4421
|
const s = e && e.forceBase64;
|
|
4416
|
-
this.supportsBinary =
|
|
4422
|
+
this.supportsBinary = pa && !s;
|
|
4417
4423
|
}
|
|
4418
4424
|
request(e = {}) {
|
|
4419
4425
|
return Object.assign(e, { xd: this.xd }, this.opts), new Ue(sr, this.uri(), e);
|
|
@@ -4422,18 +4428,18 @@ class pa extends la {
|
|
|
4422
4428
|
function sr(t) {
|
|
4423
4429
|
const e = t.xdomain;
|
|
4424
4430
|
try {
|
|
4425
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
4431
|
+
if (typeof XMLHttpRequest < "u" && (!e || da))
|
|
4426
4432
|
return new XMLHttpRequest();
|
|
4427
4433
|
} catch {
|
|
4428
4434
|
}
|
|
4429
4435
|
if (!e)
|
|
4430
4436
|
try {
|
|
4431
|
-
return new
|
|
4437
|
+
return new re[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
4432
4438
|
} catch {
|
|
4433
4439
|
}
|
|
4434
4440
|
}
|
|
4435
4441
|
const nr = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
4436
|
-
class
|
|
4442
|
+
class fa extends yn {
|
|
4437
4443
|
get name() {
|
|
4438
4444
|
return "websocket";
|
|
4439
4445
|
}
|
|
@@ -4469,7 +4475,7 @@ class ha extends yn {
|
|
|
4469
4475
|
this.doWrite(n, r);
|
|
4470
4476
|
} catch {
|
|
4471
4477
|
}
|
|
4472
|
-
i &&
|
|
4478
|
+
i && Ft(() => {
|
|
4473
4479
|
this.writable = !0, this.emitReserved("drain");
|
|
4474
4480
|
}, this.setTimeoutFn);
|
|
4475
4481
|
});
|
|
@@ -4489,16 +4495,16 @@ class ha extends yn {
|
|
|
4489
4495
|
return this.opts.timestampRequests && (s[this.opts.timestampParam] = er()), this.supportsBinary || (s.b64 = 1), this.createUri(e, s);
|
|
4490
4496
|
}
|
|
4491
4497
|
}
|
|
4492
|
-
const
|
|
4493
|
-
class
|
|
4498
|
+
const us = re.WebSocket || re.MozWebSocket;
|
|
4499
|
+
class ga extends fa {
|
|
4494
4500
|
createSocket(e, s, n) {
|
|
4495
|
-
return nr ? new
|
|
4501
|
+
return nr ? new us(e, s, n) : s ? new us(e, s) : new us(e);
|
|
4496
4502
|
}
|
|
4497
4503
|
doWrite(e, s) {
|
|
4498
4504
|
this.ws.send(s);
|
|
4499
4505
|
}
|
|
4500
4506
|
}
|
|
4501
|
-
class
|
|
4507
|
+
class ma extends yn {
|
|
4502
4508
|
get name() {
|
|
4503
4509
|
return "webtransport";
|
|
4504
4510
|
}
|
|
@@ -4514,7 +4520,7 @@ class ga extends yn {
|
|
|
4514
4520
|
this.onError("webtransport error", e);
|
|
4515
4521
|
}), this._transport.ready.then(() => {
|
|
4516
4522
|
this._transport.createBidirectionalStream().then((e) => {
|
|
4517
|
-
const s =
|
|
4523
|
+
const s = Xo(Number.MAX_SAFE_INTEGER, this.socket.binaryType), n = e.readable.pipeThrough(s).getReader(), i = Qo();
|
|
4518
4524
|
i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
|
|
4519
4525
|
const r = () => {
|
|
4520
4526
|
n.read().then(({ done: o, value: c }) => {
|
|
@@ -4533,7 +4539,7 @@ class ga extends yn {
|
|
|
4533
4539
|
for (let s = 0; s < e.length; s++) {
|
|
4534
4540
|
const n = e[s], i = s === e.length - 1;
|
|
4535
4541
|
this._writer.write(n).then(() => {
|
|
4536
|
-
i &&
|
|
4542
|
+
i && Ft(() => {
|
|
4537
4543
|
this.writable = !0, this.emitReserved("drain");
|
|
4538
4544
|
}, this.setTimeoutFn);
|
|
4539
4545
|
});
|
|
@@ -4544,11 +4550,11 @@ class ga extends yn {
|
|
|
4544
4550
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
4545
4551
|
}
|
|
4546
4552
|
}
|
|
4547
|
-
const
|
|
4548
|
-
websocket:
|
|
4549
|
-
webtransport:
|
|
4550
|
-
polling:
|
|
4551
|
-
},
|
|
4553
|
+
const ya = {
|
|
4554
|
+
websocket: ga,
|
|
4555
|
+
webtransport: ma,
|
|
4556
|
+
polling: ha
|
|
4557
|
+
}, va = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, ba = [
|
|
4552
4558
|
"source",
|
|
4553
4559
|
"protocol",
|
|
4554
4560
|
"authority",
|
|
@@ -4569,16 +4575,16 @@ function Qs(t) {
|
|
|
4569
4575
|
throw "URI too long";
|
|
4570
4576
|
const e = t, s = t.indexOf("["), n = t.indexOf("]");
|
|
4571
4577
|
s != -1 && n != -1 && (t = t.substring(0, s) + t.substring(s, n).replace(/:/g, ";") + t.substring(n, t.length));
|
|
4572
|
-
let i =
|
|
4578
|
+
let i = va.exec(t || ""), r = {}, a = 14;
|
|
4573
4579
|
for (; a--; )
|
|
4574
|
-
r[
|
|
4575
|
-
return s != -1 && n != -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 =
|
|
4580
|
+
r[ba[a]] = i[a] || "";
|
|
4581
|
+
return s != -1 && n != -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 = Ia(r, r.path), r.queryKey = wa(r, r.query), r;
|
|
4576
4582
|
}
|
|
4577
|
-
function
|
|
4583
|
+
function Ia(t, e) {
|
|
4578
4584
|
const s = /\/{2,9}/g, n = e.replace(s, "/").split("/");
|
|
4579
4585
|
return (e.slice(0, 1) == "/" || e.length === 0) && n.splice(0, 1), e.slice(-1) == "/" && n.splice(n.length - 1, 1), n;
|
|
4580
4586
|
}
|
|
4581
|
-
function
|
|
4587
|
+
function wa(t, e) {
|
|
4582
4588
|
const s = {};
|
|
4583
4589
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(n, i, r) {
|
|
4584
4590
|
i && (s[i] = r);
|
|
@@ -4596,11 +4602,11 @@ class _e extends F {
|
|
|
4596
4602
|
* @param {Object} opts - options
|
|
4597
4603
|
*/
|
|
4598
4604
|
constructor(e, s) {
|
|
4599
|
-
if (super(), this.binaryType =
|
|
4605
|
+
if (super(), this.binaryType = Zo, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (s = e, e = null), e) {
|
|
4600
4606
|
const n = Qs(e);
|
|
4601
4607
|
s.hostname = n.host, s.secure = n.protocol === "https" || n.protocol === "wss", s.port = n.port, n.query && (s.query = n.query);
|
|
4602
4608
|
} else s.host && (s.hostname = Qs(s.host).host);
|
|
4603
|
-
|
|
4609
|
+
$t(this, s), this.secure = s.secure != null ? s.secure : typeof location < "u" && location.protocol === "https:", s.hostname && !s.port && (s.port = this.secure ? "443" : "80"), this.hostname = s.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = s.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, s.transports.forEach((n) => {
|
|
4604
4610
|
const i = n.prototype.name;
|
|
4605
4611
|
this.transports.push(i), this._transportsByName[i] = n;
|
|
4606
4612
|
}), this.opts = Object.assign({
|
|
@@ -4617,7 +4623,7 @@ class _e extends F {
|
|
|
4617
4623
|
},
|
|
4618
4624
|
transportOptions: {},
|
|
4619
4625
|
closeOnBeforeunload: !1
|
|
4620
|
-
}, s), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
4626
|
+
}, s), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = oa(this.opts.query)), Xs && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
4621
4627
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
4622
4628
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
4623
4629
|
this._onClose("transport close", {
|
|
@@ -4752,7 +4758,7 @@ class _e extends F {
|
|
|
4752
4758
|
let s = 1;
|
|
4753
4759
|
for (let n = 0; n < this.writeBuffer.length; n++) {
|
|
4754
4760
|
const i = this.writeBuffer[n].data;
|
|
4755
|
-
if (i && (s +=
|
|
4761
|
+
if (i && (s += na(i)), n > 0 && s > this._maxPayload)
|
|
4756
4762
|
return this.writeBuffer.slice(0, n);
|
|
4757
4763
|
s += 2;
|
|
4758
4764
|
}
|
|
@@ -4772,7 +4778,7 @@ class _e extends F {
|
|
|
4772
4778
|
if (!this._pingTimeoutTime)
|
|
4773
4779
|
return !0;
|
|
4774
4780
|
const e = Date.now() > this._pingTimeoutTime;
|
|
4775
|
-
return e && (this._pingTimeoutTime = 0,
|
|
4781
|
+
return e && (this._pingTimeoutTime = 0, Ft(() => {
|
|
4776
4782
|
this._onClose("ping timeout");
|
|
4777
4783
|
}, this.setTimeoutFn)), e;
|
|
4778
4784
|
}
|
|
@@ -4859,7 +4865,7 @@ class _e extends F {
|
|
|
4859
4865
|
}
|
|
4860
4866
|
}
|
|
4861
4867
|
_e.protocol = Yi;
|
|
4862
|
-
class
|
|
4868
|
+
class _a extends _e {
|
|
4863
4869
|
constructor() {
|
|
4864
4870
|
super(...arguments), this._upgrades = [];
|
|
4865
4871
|
}
|
|
@@ -4931,21 +4937,21 @@ class wa extends _e {
|
|
|
4931
4937
|
return s;
|
|
4932
4938
|
}
|
|
4933
4939
|
}
|
|
4934
|
-
let
|
|
4940
|
+
let Sa = class extends _a {
|
|
4935
4941
|
constructor(e, s = {}) {
|
|
4936
4942
|
const n = typeof e == "object", i = n ? { ...e } : { ...s };
|
|
4937
|
-
(!i.transports || i.transports && typeof i.transports[0] == "string") && (i.transports = (i.transports || ["polling", "websocket", "webtransport"]).map((r) =>
|
|
4943
|
+
(!i.transports || i.transports && typeof i.transports[0] == "string") && (i.transports = (i.transports || ["polling", "websocket", "webtransport"]).map((r) => ya[r]).filter((r) => !!r)), super(n ? i : e, i);
|
|
4938
4944
|
}
|
|
4939
4945
|
};
|
|
4940
|
-
function
|
|
4946
|
+
function ka(t, e = "", s) {
|
|
4941
4947
|
let n = t;
|
|
4942
4948
|
s = s || typeof location < "u" && location, t == null && (t = s.protocol + "//" + s.host), typeof t == "string" && (t.charAt(0) === "/" && (t.charAt(1) === "/" ? t = s.protocol + t : t = s.host + t), /^(https?|wss?):\/\//.test(t) || (typeof s < "u" ? t = s.protocol + "//" + t : t = "https://" + t), n = Qs(t)), n.port || (/^(http|ws)$/.test(n.protocol) ? n.port = "80" : /^(http|ws)s$/.test(n.protocol) && (n.port = "443")), n.path = n.path || "/";
|
|
4943
4949
|
const r = n.host.indexOf(":") !== -1 ? "[" + n.host + "]" : n.host;
|
|
4944
4950
|
return n.id = n.protocol + "://" + r + ":" + n.port + e, n.href = n.protocol + "://" + r + (s && s.port === n.port ? "" : ":" + n.port), n;
|
|
4945
4951
|
}
|
|
4946
|
-
const
|
|
4952
|
+
const Ra = typeof ArrayBuffer == "function", Aa = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t.buffer instanceof ArrayBuffer, ir = Object.prototype.toString, Ea = typeof Blob == "function" || typeof Blob < "u" && ir.call(Blob) === "[object BlobConstructor]", Ta = typeof File == "function" || typeof File < "u" && ir.call(File) === "[object FileConstructor]";
|
|
4947
4953
|
function vn(t) {
|
|
4948
|
-
return
|
|
4954
|
+
return Ra && (t instanceof ArrayBuffer || Aa(t)) || Ea && t instanceof Blob || Ta && t instanceof File;
|
|
4949
4955
|
}
|
|
4950
4956
|
function At(t, e) {
|
|
4951
4957
|
if (!t || typeof t != "object")
|
|
@@ -4965,7 +4971,7 @@ function At(t, e) {
|
|
|
4965
4971
|
return !0;
|
|
4966
4972
|
return !1;
|
|
4967
4973
|
}
|
|
4968
|
-
function
|
|
4974
|
+
function qa(t) {
|
|
4969
4975
|
const e = [], s = t.data, n = t;
|
|
4970
4976
|
return n.data = Et(s, e), n.attachments = e.length, { packet: n, buffers: e };
|
|
4971
4977
|
}
|
|
@@ -4990,7 +4996,7 @@ function Et(t, e, s) {
|
|
|
4990
4996
|
}
|
|
4991
4997
|
return t;
|
|
4992
4998
|
}
|
|
4993
|
-
function
|
|
4999
|
+
function Ca(t, e) {
|
|
4994
5000
|
return t.data = Ys(t.data, e), delete t.attachments, t;
|
|
4995
5001
|
}
|
|
4996
5002
|
function Ys(t, e) {
|
|
@@ -5008,7 +5014,7 @@ function Ys(t, e) {
|
|
|
5008
5014
|
Object.prototype.hasOwnProperty.call(t, s) && (t[s] = Ys(t[s], e));
|
|
5009
5015
|
return t;
|
|
5010
5016
|
}
|
|
5011
|
-
const
|
|
5017
|
+
const Oa = [
|
|
5012
5018
|
"connect",
|
|
5013
5019
|
// used on the client side
|
|
5014
5020
|
"connect_error",
|
|
@@ -5026,7 +5032,7 @@ var M;
|
|
|
5026
5032
|
(function(t) {
|
|
5027
5033
|
t[t.CONNECT = 0] = "CONNECT", t[t.DISCONNECT = 1] = "DISCONNECT", t[t.EVENT = 2] = "EVENT", t[t.ACK = 3] = "ACK", t[t.CONNECT_ERROR = 4] = "CONNECT_ERROR", t[t.BINARY_EVENT = 5] = "BINARY_EVENT", t[t.BINARY_ACK = 6] = "BINARY_ACK";
|
|
5028
5034
|
})(M || (M = {}));
|
|
5029
|
-
class
|
|
5035
|
+
class xa {
|
|
5030
5036
|
/**
|
|
5031
5037
|
* Encoder constructor
|
|
5032
5038
|
*
|
|
@@ -5062,7 +5068,7 @@ class Oa {
|
|
|
5062
5068
|
* a list of buffers.
|
|
5063
5069
|
*/
|
|
5064
5070
|
encodeAsBinary(e) {
|
|
5065
|
-
const s =
|
|
5071
|
+
const s = qa(e), n = this.encodeAsString(s.packet), i = s.buffers;
|
|
5066
5072
|
return i.unshift(n), i;
|
|
5067
5073
|
}
|
|
5068
5074
|
}
|
|
@@ -5088,7 +5094,7 @@ class bn extends F {
|
|
|
5088
5094
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
5089
5095
|
s = this.decodeString(e);
|
|
5090
5096
|
const n = s.type === M.BINARY_EVENT;
|
|
5091
|
-
n || s.type === M.BINARY_ACK ? (s.type = n ? M.EVENT : M.ACK, this.reconstructor = new
|
|
5097
|
+
n || s.type === M.BINARY_ACK ? (s.type = n ? M.EVENT : M.ACK, this.reconstructor = new Ma(s)) : super.emitReserved("decoded", s);
|
|
5092
5098
|
} else if (vn(e) || e.base64)
|
|
5093
5099
|
if (this.reconstructor)
|
|
5094
5100
|
s = this.reconstructor.takeBinaryData(e), s && (this.reconstructor = null, super.emitReserved("decoded", s));
|
|
@@ -5118,7 +5124,7 @@ class bn extends F {
|
|
|
5118
5124
|
if (a != Number(a) || e.charAt(s) !== "-")
|
|
5119
5125
|
throw new Error("Illegal attachments");
|
|
5120
5126
|
const o = Number(a);
|
|
5121
|
-
if (!
|
|
5127
|
+
if (!Pa(o) || o < 1)
|
|
5122
5128
|
throw new Error("Illegal attachments");
|
|
5123
5129
|
if (o > this.opts.maxAttachments)
|
|
5124
5130
|
throw new Error("too many attachments");
|
|
@@ -5171,7 +5177,7 @@ class bn extends F {
|
|
|
5171
5177
|
return typeof s == "string" || ei(s);
|
|
5172
5178
|
case M.EVENT:
|
|
5173
5179
|
case M.BINARY_EVENT:
|
|
5174
|
-
return Array.isArray(s) && (typeof s[0] == "number" || typeof s[0] == "string" &&
|
|
5180
|
+
return Array.isArray(s) && (typeof s[0] == "number" || typeof s[0] == "string" && Oa.indexOf(s[0]) === -1);
|
|
5175
5181
|
case M.ACK:
|
|
5176
5182
|
case M.BINARY_ACK:
|
|
5177
5183
|
return Array.isArray(s);
|
|
@@ -5184,7 +5190,7 @@ class bn extends F {
|
|
|
5184
5190
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
5185
5191
|
}
|
|
5186
5192
|
}
|
|
5187
|
-
class
|
|
5193
|
+
class Ma {
|
|
5188
5194
|
constructor(e) {
|
|
5189
5195
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
5190
5196
|
}
|
|
@@ -5198,7 +5204,7 @@ class xa {
|
|
|
5198
5204
|
*/
|
|
5199
5205
|
takeBinaryData(e) {
|
|
5200
5206
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
5201
|
-
const s =
|
|
5207
|
+
const s = Ca(this.reconPack, this.buffers);
|
|
5202
5208
|
return this.finishedReconstruction(), s;
|
|
5203
5209
|
}
|
|
5204
5210
|
return null;
|
|
@@ -5210,16 +5216,16 @@ class xa {
|
|
|
5210
5216
|
this.reconPack = null, this.buffers = [];
|
|
5211
5217
|
}
|
|
5212
5218
|
}
|
|
5213
|
-
const
|
|
5219
|
+
const Pa = Number.isInteger || function(t) {
|
|
5214
5220
|
return typeof t == "number" && isFinite(t) && Math.floor(t) === t;
|
|
5215
5221
|
};
|
|
5216
5222
|
function ei(t) {
|
|
5217
5223
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
5218
5224
|
}
|
|
5219
|
-
const
|
|
5225
|
+
const Da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5220
5226
|
__proto__: null,
|
|
5221
5227
|
Decoder: bn,
|
|
5222
|
-
Encoder:
|
|
5228
|
+
Encoder: xa,
|
|
5223
5229
|
get PacketType() {
|
|
5224
5230
|
return M;
|
|
5225
5231
|
}
|
|
@@ -5229,7 +5235,7 @@ function ce(t, e, s) {
|
|
|
5229
5235
|
t.off(e, s);
|
|
5230
5236
|
};
|
|
5231
5237
|
}
|
|
5232
|
-
const
|
|
5238
|
+
const Ua = Object.freeze({
|
|
5233
5239
|
connect: 1,
|
|
5234
5240
|
connect_error: 1,
|
|
5235
5241
|
disconnect: 1,
|
|
@@ -5354,7 +5360,7 @@ class rr extends F {
|
|
|
5354
5360
|
*/
|
|
5355
5361
|
emit(e, ...s) {
|
|
5356
5362
|
var n, i, r;
|
|
5357
|
-
if (
|
|
5363
|
+
if (Ua.hasOwnProperty(e))
|
|
5358
5364
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
5359
5365
|
if (s.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
5360
5366
|
return this._addToQueue(s), this;
|
|
@@ -5856,12 +5862,12 @@ Le.prototype.setJitter = function(t) {
|
|
|
5856
5862
|
class Zs extends F {
|
|
5857
5863
|
constructor(e, s) {
|
|
5858
5864
|
var n;
|
|
5859
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (s = e, e = void 0), s = s || {}, s.path = s.path || "/socket.io", this.opts = s,
|
|
5865
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (s = e, e = void 0), s = s || {}, s.path = s.path || "/socket.io", this.opts = s, $t(this, s), this.reconnection(s.reconnection !== !1), this.reconnectionAttempts(s.reconnectionAttempts || 1 / 0), this.reconnectionDelay(s.reconnectionDelay || 1e3), this.reconnectionDelayMax(s.reconnectionDelayMax || 5e3), this.randomizationFactor((n = s.randomizationFactor) !== null && n !== void 0 ? n : 0.5), this.backoff = new Le({
|
|
5860
5866
|
min: this.reconnectionDelay(),
|
|
5861
5867
|
max: this.reconnectionDelayMax(),
|
|
5862
5868
|
jitter: this.randomizationFactor()
|
|
5863
5869
|
}), this.timeout(s.timeout == null ? 2e4 : s.timeout), this._readyState = "closed", this.uri = e;
|
|
5864
|
-
const i = s.parser ||
|
|
5870
|
+
const i = s.parser || Da;
|
|
5865
5871
|
this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = s.autoConnect !== !1, this._autoConnect && this.open();
|
|
5866
5872
|
}
|
|
5867
5873
|
reconnection(e) {
|
|
@@ -5904,7 +5910,7 @@ class Zs extends F {
|
|
|
5904
5910
|
open(e) {
|
|
5905
5911
|
if (~this._readyState.indexOf("open"))
|
|
5906
5912
|
return this;
|
|
5907
|
-
this.engine = new
|
|
5913
|
+
this.engine = new Sa(this.uri, this.opts);
|
|
5908
5914
|
const s = this.engine, n = this;
|
|
5909
5915
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
5910
5916
|
const i = ce(s, "open", function() {
|
|
@@ -5974,7 +5980,7 @@ class Zs extends F {
|
|
|
5974
5980
|
* @private
|
|
5975
5981
|
*/
|
|
5976
5982
|
ondecoded(e) {
|
|
5977
|
-
|
|
5983
|
+
Ft(() => {
|
|
5978
5984
|
this.emitReserved("packet", e);
|
|
5979
5985
|
}, this.setTimeoutFn);
|
|
5980
5986
|
}
|
|
@@ -6094,7 +6100,7 @@ class Zs extends F {
|
|
|
6094
6100
|
const Ve = {};
|
|
6095
6101
|
function Tt(t, e) {
|
|
6096
6102
|
typeof t == "object" && (e = t, t = void 0), e = e || {};
|
|
6097
|
-
const s =
|
|
6103
|
+
const s = ka(t, e.path || "/socket.io"), n = s.source, i = s.id, r = s.path, a = Ve[i] && r in Ve[i].nsps, o = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
|
|
6098
6104
|
let c;
|
|
6099
6105
|
return o ? c = new Zs(n, e) : (Ve[i] || (Ve[i] = new Zs(n, e)), c = Ve[i]), s.query && !e.query && (e.query = s.queryKey), c.socket(s.path, e);
|
|
6100
6106
|
}
|
|
@@ -6104,7 +6110,7 @@ Object.assign(Tt, {
|
|
|
6104
6110
|
io: Tt,
|
|
6105
6111
|
connect: Tt
|
|
6106
6112
|
});
|
|
6107
|
-
const
|
|
6113
|
+
const Na = 9e4, ja = /* @__PURE__ */ new Set([
|
|
6108
6114
|
"chat.user_message",
|
|
6109
6115
|
"chat.retry_last_user_message",
|
|
6110
6116
|
"run.stop",
|
|
@@ -6129,7 +6135,7 @@ function ti(t, e) {
|
|
|
6129
6135
|
const s = t.result && typeof t.result == "object" ? t.result : void 0, n = typeof s?.message == "string" && s.message.trim() ? s.message : `${e} (${t.code ?? "request_rejected"})`;
|
|
6130
6136
|
return new A(n, t.code ?? "request_rejected", !1, t.result, !0);
|
|
6131
6137
|
}
|
|
6132
|
-
class
|
|
6138
|
+
class Ba {
|
|
6133
6139
|
constructor(e) {
|
|
6134
6140
|
this.options = e, this.socket = Tt(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
|
|
6135
6141
|
path: "/api/product-agent/socket.io",
|
|
@@ -6281,7 +6287,7 @@ class ja {
|
|
|
6281
6287
|
readinessPhase: this.ready ? "bootstrap" : this.admitted ? "activation" : "namespace_ready"
|
|
6282
6288
|
})), e === this.generation && this.recover(n));
|
|
6283
6289
|
};
|
|
6284
|
-
this.admissionTimer = setTimeout(() => s("connect_timeout"), 6e4), this.readinessTimer = setTimeout(() => s("auth_timeout"),
|
|
6290
|
+
this.admissionTimer = setTimeout(() => s("connect_timeout"), 6e4), this.readinessTimer = setTimeout(() => s("auth_timeout"), Na);
|
|
6285
6291
|
}
|
|
6286
6292
|
clearReadinessTimers() {
|
|
6287
6293
|
this.admissionTimer !== null && clearTimeout(this.admissionTimer), this.readinessTimer !== null && clearTimeout(this.readinessTimer), this.admissionTimer = null, this.readinessTimer = null;
|
|
@@ -6302,7 +6308,7 @@ class ja {
|
|
|
6302
6308
|
this.bindings.get(e)?.owners.delete(s), this.ready && await this.synchronize();
|
|
6303
6309
|
}
|
|
6304
6310
|
async rpc(e, s) {
|
|
6305
|
-
if (!
|
|
6311
|
+
if (!ja.has(e)) throw new A("Operation requires its HTTP adapter", "unsupported_rpc");
|
|
6306
6312
|
const n = this.generation, i = JSON.stringify(s);
|
|
6307
6313
|
return e === "run.stop" && this.uploadingResult ? (this.assertReady(n), this.request("runtime.rpc", { type: e, payload: JSON.parse(i) }, n)) : this.enqueue(async () => {
|
|
6308
6314
|
if (this.assertReady(n), e === "tool.result") {
|
|
@@ -6444,7 +6450,7 @@ class ja {
|
|
|
6444
6450
|
}
|
|
6445
6451
|
}
|
|
6446
6452
|
}
|
|
6447
|
-
function
|
|
6453
|
+
function La() {
|
|
6448
6454
|
const t = crypto.getRandomValues(new Uint8Array(16));
|
|
6449
6455
|
t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
|
|
6450
6456
|
const e = Array.from(t, (s) => s.toString(16).padStart(2, "0")).join("");
|
|
@@ -6508,7 +6514,7 @@ class or {
|
|
|
6508
6514
|
p.signal.aborted || (g.trigger = E, p.abort());
|
|
6509
6515
|
}, f = () => m("transport_disposed"), v = () => m(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(a?.reason) ? a.reason : "caller_cancelled");
|
|
6510
6516
|
this.requests.signal.addEventListener("abort", f, { once: !0 }), a?.addEventListener("abort", v, { once: !0 });
|
|
6511
|
-
const I = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && i === "POST", _ = /^\/conversations(?:\/[^/]+)?$/.test(e) && (i ?? (n === void 0 ? "GET" : "POST")) === "GET", S = setTimeout(() => m("deadline"), _ ? 6e4 : I ? 3e4 : 15e3), h =
|
|
6517
|
+
const I = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && i === "POST", _ = /^\/conversations(?:\/[^/]+)?$/.test(e) && (i ?? (n === void 0 ? "GET" : "POST")) === "GET", S = setTimeout(() => m("deadline"), _ ? 6e4 : I ? 3e4 : 15e3), h = La(), b = Date.now();
|
|
6512
6518
|
let y = null, w = !1, R = null, T = null, C = null;
|
|
6513
6519
|
try {
|
|
6514
6520
|
const E = await Promise.resolve(fetch(d, {
|
|
@@ -6556,7 +6562,7 @@ class or {
|
|
|
6556
6562
|
ownerId: j(o?.ownerId),
|
|
6557
6563
|
authorityGeneration: o?.authorityGeneration ?? null,
|
|
6558
6564
|
sessionId: j(o?.sessionId),
|
|
6559
|
-
release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${
|
|
6565
|
+
release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${Bt.version}`,
|
|
6560
6566
|
upstreamRequestId: T,
|
|
6561
6567
|
upstreamTraceId: C
|
|
6562
6568
|
};
|
|
@@ -6615,18 +6621,18 @@ function ar() {
|
|
|
6615
6621
|
function B(t) {
|
|
6616
6622
|
return JSON.stringify([t.kind, t.origin, t.limit]);
|
|
6617
6623
|
}
|
|
6618
|
-
function
|
|
6624
|
+
function Fa(t) {
|
|
6619
6625
|
const e = t.map((s) => Ye(s) || s.requestId !== null && s.status !== "error" ? { ...s, status: s.status === "error" ? s.data?.length ? "refreshing" : "loading" : s.status, error: null } : s);
|
|
6620
6626
|
return e.find((s) => s.status === "loading_more" || s.status === "loading" || s.status === "refreshing") ?? e.find((s) => s.status === "error") ?? e.find((s) => s.query.kind === "recent") ?? e[0];
|
|
6621
6627
|
}
|
|
6622
|
-
function
|
|
6628
|
+
function $a(t) {
|
|
6623
6629
|
return [...new Set(t.flatMap((e) => e.data ?? []))];
|
|
6624
6630
|
}
|
|
6625
6631
|
function Ye(t) {
|
|
6626
6632
|
const e = t.error;
|
|
6627
6633
|
return t.status === "error" && t.consecutiveFailures < 10 && e !== null && !["unauthorized", "401", "403", "authority_retired"].includes(e.code) && (e.retryable || /^5\d\d$/.test(e.code) || ["runtime_error", "connection_interrupted", "request_timed_out", "408", "429"].includes(e.code));
|
|
6628
6634
|
}
|
|
6629
|
-
const
|
|
6635
|
+
const ps = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
|
|
6630
6636
|
function ee(t) {
|
|
6631
6637
|
const e = t.currentAuthority();
|
|
6632
6638
|
return e.authorityId === t.authority.authorityId && e.generation === t.authority.generation;
|
|
@@ -6661,7 +6667,7 @@ function ni(t) {
|
|
|
6661
6667
|
c() || (n = t.runtime.engine.subscribe(c), i = t.runtime.onDispose(o));
|
|
6662
6668
|
});
|
|
6663
6669
|
}
|
|
6664
|
-
function
|
|
6670
|
+
function za(t) {
|
|
6665
6671
|
const e = t.http.auth.client_kind === "extension" ? "extension" : void 0, s = /* @__PURE__ */ new Map();
|
|
6666
6672
|
return {
|
|
6667
6673
|
"directory.query": async (n) => {
|
|
@@ -6701,7 +6707,7 @@ function $a(t) {
|
|
|
6701
6707
|
}
|
|
6702
6708
|
};
|
|
6703
6709
|
}
|
|
6704
|
-
class
|
|
6710
|
+
class Ha {
|
|
6705
6711
|
constructor(e) {
|
|
6706
6712
|
this.options = e, this.owner = `directory:${e.authority.authorityId}:${e.authority.generation}`, this.boundary = { authority: e.authority, currentAuthority: () => e.runtime.engine.getState().slices.directory }, this.unsubscribe = e.runtime.engine.subscribe(() => this.reconcile());
|
|
6707
6713
|
}
|
|
@@ -6722,7 +6728,7 @@ class za {
|
|
|
6722
6728
|
if (s) for (const [i, r] of Object.entries(e)) {
|
|
6723
6729
|
if (!r.observe || this.observations.has(i)) continue;
|
|
6724
6730
|
const a = this.options.recovery?.(i), o = new It({
|
|
6725
|
-
...
|
|
6731
|
+
...ps,
|
|
6726
6732
|
isActiveTurn: () => this.options.isActiveTurn(i),
|
|
6727
6733
|
poll: async () => {
|
|
6728
6734
|
try {
|
|
@@ -6758,8 +6764,8 @@ class za {
|
|
|
6758
6764
|
const a = this.queryRetries.get(r) ?? { timer: null };
|
|
6759
6765
|
if (a.timer !== null) continue;
|
|
6760
6766
|
const o = Math.min(
|
|
6761
|
-
|
|
6762
|
-
|
|
6767
|
+
ps.activeIntervalMs * 2 ** Math.min(i.consecutiveFailures - 1, 4),
|
|
6768
|
+
ps.maxFailureIntervalMs
|
|
6763
6769
|
);
|
|
6764
6770
|
a.timer = setTimeout(() => {
|
|
6765
6771
|
a.timer = null, !this.queryRequests.has(r) && this.refreshObservedQuery(i.query).catch((c) => this.report(c));
|
|
@@ -6874,7 +6880,7 @@ class za {
|
|
|
6874
6880
|
this.unsubscribe(), this.reconcile();
|
|
6875
6881
|
}
|
|
6876
6882
|
}
|
|
6877
|
-
function
|
|
6883
|
+
function Va(t) {
|
|
6878
6884
|
if (!t || typeof t != "object") return !1;
|
|
6879
6885
|
const e = t;
|
|
6880
6886
|
if (e.version !== 1 || typeof e.authorityId != "string" || typeof e.browserSessionId != "string" || !Array.isArray(e.bindings) || !e.mains || typeof e.mains != "object" || Array.isArray(e.mains)) return !1;
|
|
@@ -6891,7 +6897,7 @@ function Ha(t) {
|
|
|
6891
6897
|
return !0;
|
|
6892
6898
|
}
|
|
6893
6899
|
const ii = /* @__PURE__ */ new WeakMap();
|
|
6894
|
-
class
|
|
6900
|
+
class Ka {
|
|
6895
6901
|
constructor(e) {
|
|
6896
6902
|
this.options = e;
|
|
6897
6903
|
}
|
|
@@ -6961,7 +6967,7 @@ class Va {
|
|
|
6961
6967
|
const s = this.state();
|
|
6962
6968
|
if (!this.current()) return !1;
|
|
6963
6969
|
const n = await this.options.persistence.read();
|
|
6964
|
-
if (!
|
|
6970
|
+
if (!Va(n) || n.authorityId !== this.options.authority.authorityId || n.browserSessionId !== this.options.persistence.sessionId()) return !1;
|
|
6965
6971
|
const i = new Set(await this.options.persistence.liveClients());
|
|
6966
6972
|
if (!this.current() || this.state().clients !== s.clients) return !1;
|
|
6967
6973
|
const r = n.bindings.filter((c) => {
|
|
@@ -6987,7 +6993,7 @@ class Va {
|
|
|
6987
6993
|
return await Promise.all(a.map((c) => this.options.runtime.engine.dispatch(c))), !0;
|
|
6988
6994
|
}
|
|
6989
6995
|
}
|
|
6990
|
-
function
|
|
6996
|
+
function Wa(t, e, s, n = () => crypto.randomUUID()) {
|
|
6991
6997
|
const i = `pluno.productAgent.directory:${encodeURIComponent(s)}:${encodeURIComponent(e)}`, r = `${i}:tabSession`, a = t.getItem(r) ?? n();
|
|
6992
6998
|
return t.setItem(r, a), {
|
|
6993
6999
|
sessionId: () => a,
|
|
@@ -6999,9 +7005,9 @@ function Ka(t, e, s, n = () => crypto.randomUUID()) {
|
|
|
6999
7005
|
};
|
|
7000
7006
|
}
|
|
7001
7007
|
const ri = /* @__PURE__ */ new Map(), oi = /* @__PURE__ */ new Map();
|
|
7002
|
-
function
|
|
7008
|
+
function Ga(t, e, s = () => crypto.randomUUID()) {
|
|
7003
7009
|
try {
|
|
7004
|
-
return
|
|
7010
|
+
return Wa(window.sessionStorage, t, e, s);
|
|
7005
7011
|
} catch (n) {
|
|
7006
7012
|
if (!(n instanceof DOMException) || n.name !== "SecurityError" && n.name !== "QuotaExceededError") throw n;
|
|
7007
7013
|
const i = `${e}:${t}`, r = oi.get(i) ?? s();
|
|
@@ -7021,7 +7027,7 @@ class L extends EventTarget {
|
|
|
7021
7027
|
...e,
|
|
7022
7028
|
executorConnection: () => this.connectionId,
|
|
7023
7029
|
restoreExecutor: (s) => this.restoreExecutor(s)
|
|
7024
|
-
}), this.transport = new
|
|
7030
|
+
}), this.transport = new Ba({
|
|
7025
7031
|
backendUrl: e.backendUrl,
|
|
7026
7032
|
auth: e.auth,
|
|
7027
7033
|
displaySchema: e.displaySchema,
|
|
@@ -7116,7 +7122,7 @@ class L extends EventTarget {
|
|
|
7116
7122
|
const n = this.connectionAttempt, i = (/* @__PURE__ */ new Date()).toISOString(), r = this.diagnostics.findIndex((c) => c.phase === e && c.connectionAttemptId === n?.connectionAttemptId), a = this.diagnostics[r], o = {
|
|
7117
7123
|
id: a?.id ?? crypto.randomUUID(),
|
|
7118
7124
|
phase: e,
|
|
7119
|
-
sdkVersion:
|
|
7125
|
+
sdkVersion: Bt.version,
|
|
7120
7126
|
stage: s.stage ?? (s.readinessPhase === "bootstrap" ? "bootstrap" : s.readinessPhase === "activation" ? "executor_registration" : "socket_admission"),
|
|
7121
7127
|
...s.httpStatus ? { httpStatus: s.httpStatus } : {},
|
|
7122
7128
|
...s.failureKind ? { failureKind: s.failureKind } : {},
|
|
@@ -7389,7 +7395,7 @@ function dr(t) {
|
|
|
7389
7395
|
const e = t;
|
|
7390
7396
|
return typeof e.observedAt == "string" && e.observedAt.length <= 40 && Number.isFinite(Date.parse(e.observedAt)) && Te(e.sessionId) && Te(e.responseItemId) && Te(e.respondsToUserMessageId) && typeof e.panelVisible == "boolean" && typeof e.documentVisible == "boolean" && typeof e.loading == "boolean";
|
|
7391
7397
|
}
|
|
7392
|
-
function
|
|
7398
|
+
function Ja(t, e, s) {
|
|
7393
7399
|
if (!dr(s)) return;
|
|
7394
7400
|
const n = en.get(t) ?? /* @__PURE__ */ new Map();
|
|
7395
7401
|
n.set(e, {
|
|
@@ -7402,11 +7408,11 @@ function Ga(t, e, s) {
|
|
|
7402
7408
|
loading: s.loading
|
|
7403
7409
|
}), n.size > 2 && n.delete(n.keys().next().value), en.set(t, n);
|
|
7404
7410
|
}
|
|
7405
|
-
function
|
|
7411
|
+
function Qa(t, e, s) {
|
|
7406
7412
|
const n = en.get(t)?.get(e);
|
|
7407
7413
|
return n?.sessionId === s ? n : null;
|
|
7408
7414
|
}
|
|
7409
|
-
function
|
|
7415
|
+
function Xa(t, e, s, n, i, r, a, o, c = null, l = !1) {
|
|
7410
7416
|
const d = n ? o.find((p) => p.role === "user" && (p.id === n || p.clientMessageId === n)) : void 0, u = d ? [...o].reverse().find((p) => (p.role === "assistant" || p.dataType === "commentary_history" || p.dataType === "tool_summary") && p.respondsToUserMessageId === d.id) : void 0;
|
|
7411
7417
|
return {
|
|
7412
7418
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -7416,14 +7422,14 @@ function Qa(t, e, s, n, i, r, a, o, c = null, l = !1) {
|
|
|
7416
7422
|
clientUserMessageItemId: d && Te(d.id) ? d.id : null,
|
|
7417
7423
|
clientResponseItemId: u && Te(u.id) ? u.id : null,
|
|
7418
7424
|
clientDraftObserved: !!(d && l && c === d.id),
|
|
7419
|
-
renderer:
|
|
7425
|
+
renderer: Qa(t, e, s)
|
|
7420
7426
|
};
|
|
7421
7427
|
}
|
|
7422
|
-
const
|
|
7428
|
+
const Ya = 1e4, Za = 3e3;
|
|
7423
7429
|
function lr() {
|
|
7424
7430
|
return { authenticated: !1, generation: 0, sequence: 0, displaySequence: 0, backendCount: null, query: ye("activeUsers") };
|
|
7425
7431
|
}
|
|
7426
|
-
function
|
|
7432
|
+
function ec(t, e) {
|
|
7427
7433
|
if (e.type === "activeUsers.authenticate") {
|
|
7428
7434
|
if (t.authenticated === e.authenticated) return { state: t, effects: [] };
|
|
7429
7435
|
const n = { ...lr(), authenticated: e.authenticated, generation: t.generation + 1 };
|
|
@@ -7445,7 +7451,7 @@ function Za(t, e) {
|
|
|
7445
7451
|
return t.backendCount === null ? ci(s) : { state: s, effects: [] };
|
|
7446
7452
|
}
|
|
7447
7453
|
function ai(t) {
|
|
7448
|
-
const e = t.sequence + 1, s = `activeUsers:${t.generation}:${e}`, n = [{ id: `${s}:wait`, kind: "activeUsers.wait", input: { milliseconds:
|
|
7454
|
+
const e = t.sequence + 1, s = `activeUsers:${t.generation}:${e}`, n = [{ id: `${s}:wait`, kind: "activeUsers.wait", input: { milliseconds: Ya } }];
|
|
7449
7455
|
return t.query.status === "loading" || t.query.status === "refreshing" ? { state: { ...t, sequence: e }, effects: n } : (n.push({ id: `${s}:load`, kind: "activeUsers.load", input: { generation: t.generation } }), { state: { ...t, sequence: e, query: { ...t.query, requestId: `${s}:load`, status: t.query.data === null ? "loading" : "refreshing", error: null } }, effects: n });
|
|
7450
7456
|
}
|
|
7451
7457
|
function ci(t) {
|
|
@@ -7453,11 +7459,11 @@ function ci(t) {
|
|
|
7453
7459
|
return { state: { ...t, displaySequence: e }, effects: [{
|
|
7454
7460
|
id: `activeUsers:${t.generation}:display:${e}`,
|
|
7455
7461
|
kind: "activeUsers.displayWait",
|
|
7456
|
-
input: { milliseconds:
|
|
7462
|
+
input: { milliseconds: Za }
|
|
7457
7463
|
}] };
|
|
7458
7464
|
}
|
|
7459
|
-
const
|
|
7460
|
-
function
|
|
7465
|
+
const tc = () => Object.freeze({ scopes: Object.freeze({}) });
|
|
7466
|
+
function sc(t, e) {
|
|
7461
7467
|
const s = t.scopes[e.clientScopeId];
|
|
7462
7468
|
let n;
|
|
7463
7469
|
if (e.type === "model.scope_close") {
|
|
@@ -7570,7 +7576,7 @@ function li(t, e, s, n) {
|
|
|
7570
7576
|
membershipRevision: t.membershipRevision + 1
|
|
7571
7577
|
};
|
|
7572
7578
|
}
|
|
7573
|
-
function
|
|
7579
|
+
function nc(t, e, s) {
|
|
7574
7580
|
switch (e.type) {
|
|
7575
7581
|
case "directory.bind":
|
|
7576
7582
|
case "directory.provisional": {
|
|
@@ -7582,7 +7588,7 @@ function sc(t, e, s) {
|
|
|
7582
7588
|
const r = t.clients[e.clientScopeId];
|
|
7583
7589
|
if (r === e.conversationScopeId) return t;
|
|
7584
7590
|
const a = t.selections[r];
|
|
7585
|
-
if (e.type === "directory.bind" && e.reason === "tool" && !
|
|
7591
|
+
if (e.type === "directory.bind" && e.reason === "tool" && !ic(t, e.clientScopeId, e.sessionId, s))
|
|
7586
7592
|
throw new Error("Tool target is already bound to another conversation.");
|
|
7587
7593
|
return a && a.sessionId !== null && a.sessionId === n.sessionId ? {
|
|
7588
7594
|
...t,
|
|
@@ -7617,7 +7623,7 @@ function sc(t, e, s) {
|
|
|
7617
7623
|
return t;
|
|
7618
7624
|
}
|
|
7619
7625
|
}
|
|
7620
|
-
function
|
|
7626
|
+
function ic(t, e, s, n) {
|
|
7621
7627
|
const i = t.clients[e];
|
|
7622
7628
|
return i === void 0 || t.selections[i].sessionId === s ? !0 : !n || Object.values(n.pendingRestoration).includes(i) || Object.values(n.submissions).some((r) => r.conversationScopeId === i && !r.cancelled) ? !1 : t.selections[i].sessionId === null || Ie(n, t, i).isDraftSession;
|
|
7623
7629
|
}
|
|
@@ -7628,7 +7634,7 @@ function tn(t) {
|
|
|
7628
7634
|
queries: Object.fromEntries(Object.entries(t.queries).map(([e, s]) => [e, { ...s, invalidated: !0 }]))
|
|
7629
7635
|
};
|
|
7630
7636
|
}
|
|
7631
|
-
function
|
|
7637
|
+
function hs(t, e, s) {
|
|
7632
7638
|
if (e.conversation_id !== e.conversation.id || !Number.isSafeInteger(e.version) || e.version < 0)
|
|
7633
7639
|
throw new Error("Invalid conversation metadata envelope identity or version.");
|
|
7634
7640
|
const n = t.entities[e.conversation_id];
|
|
@@ -7659,7 +7665,7 @@ function qe(t, e, s) {
|
|
|
7659
7665
|
if (e.type === "effect.failed")
|
|
7660
7666
|
n = { ...n, queries: { ...n.queries, [o]: { ...c, status: "error", error: { ...e.error }, requestId: null, consecutiveFailures: c.consecutiveFailures + 1 } } };
|
|
7661
7667
|
else if (e.effectKind === "directory.query") {
|
|
7662
|
-
for (const f of e.output.entries) n =
|
|
7668
|
+
for (const f of e.output.entries) n = hs(n, f, !0);
|
|
7663
7669
|
const l = e.output.entries.map((f) => f.conversation_id), d = { ...n.durableActivityBySessionId }, u = { ...n.activityBySessionId }, p = { ...n.activityRevisionBySessionId };
|
|
7664
7670
|
for (const f of e.output.entries) {
|
|
7665
7671
|
if (typeof f.is_active != "boolean") continue;
|
|
@@ -7687,7 +7693,7 @@ function qe(t, e, s) {
|
|
|
7687
7693
|
} else {
|
|
7688
7694
|
if (e.type === "effect.completed" && e.effectKind === "directory.mutate") {
|
|
7689
7695
|
if (e.output.conversation_id !== r.input.sessionId) throw new Error("Mutation response has the wrong conversation identity.");
|
|
7690
|
-
n =
|
|
7696
|
+
n = hs(n, e.output, !0);
|
|
7691
7697
|
}
|
|
7692
7698
|
const o = { ...n.mutations[r.input.sessionId] };
|
|
7693
7699
|
for (const c of ["title", "pinned"]) {
|
|
@@ -7700,7 +7706,7 @@ function qe(t, e, s) {
|
|
|
7700
7706
|
if (e.authorityId !== (t.authorityId ?? "") || e.generation !== t.generation)
|
|
7701
7707
|
return { state: t, effects: i };
|
|
7702
7708
|
if (e.type === "directory.metadata_received")
|
|
7703
|
-
n =
|
|
7709
|
+
n = hs(t, e.metadata, !0);
|
|
7704
7710
|
else if (e.type === "directory.invalidate")
|
|
7705
7711
|
n = tn(t);
|
|
7706
7712
|
else if (e.type === "directory.optimistic_upsert")
|
|
@@ -7773,11 +7779,11 @@ function qe(t, e, s) {
|
|
|
7773
7779
|
}
|
|
7774
7780
|
n = { ...n, requestSequence: t.requestSequence + 1, requests: { ...n.requests, [r]: o } }, i.push({ id: r, ...o });
|
|
7775
7781
|
} else
|
|
7776
|
-
n =
|
|
7782
|
+
n = nc(t, e, s);
|
|
7777
7783
|
}
|
|
7778
7784
|
return { state: st(n), effects: i };
|
|
7779
7785
|
}
|
|
7780
|
-
function
|
|
7786
|
+
function rc(t) {
|
|
7781
7787
|
const e = { ...t.entities };
|
|
7782
7788
|
for (const [a, o] of Object.entries(t.mutations)) {
|
|
7783
7789
|
if (!e[a]) continue;
|
|
@@ -7806,7 +7812,7 @@ function ic(t) {
|
|
|
7806
7812
|
]))
|
|
7807
7813
|
});
|
|
7808
7814
|
}
|
|
7809
|
-
class
|
|
7815
|
+
class oc {
|
|
7810
7816
|
constructor(e, s, n) {
|
|
7811
7817
|
this.handlers = e, this.accept = s, this.errorAdapter = n;
|
|
7812
7818
|
}
|
|
@@ -7845,7 +7851,7 @@ class rc {
|
|
|
7845
7851
|
);
|
|
7846
7852
|
}
|
|
7847
7853
|
}
|
|
7848
|
-
class
|
|
7854
|
+
class ac {
|
|
7849
7855
|
state;
|
|
7850
7856
|
reducer;
|
|
7851
7857
|
selector;
|
|
@@ -7859,7 +7865,7 @@ class oc {
|
|
|
7859
7865
|
scopedDiagnostics = /* @__PURE__ */ new Map();
|
|
7860
7866
|
diagnostics = { ownerId: `owner-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, revision: 0, dropped: 0, lastSelection: null, transitions: [] };
|
|
7861
7867
|
constructor(e) {
|
|
7862
|
-
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new
|
|
7868
|
+
this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new oc(
|
|
7863
7869
|
e.effectHandlers,
|
|
7864
7870
|
(s) => this.acceptEffectResult(s),
|
|
7865
7871
|
e.errorAdapter
|
|
@@ -7877,7 +7883,7 @@ class oc {
|
|
|
7877
7883
|
return this.state;
|
|
7878
7884
|
}
|
|
7879
7885
|
recordDiagnosticTransition(e, s = !1) {
|
|
7880
|
-
let n =
|
|
7886
|
+
let n = So(e, this.diagnostics.revision + 1, s);
|
|
7881
7887
|
if (n?.effectId) {
|
|
7882
7888
|
if (n.type === "effect.started")
|
|
7883
7889
|
this.diagnosticEffects.set(n.effectId, n), this.diagnosticEffects.size > 128 && this.diagnosticEffects.delete(this.diagnosticEffects.keys().next().value);
|
|
@@ -7993,7 +7999,7 @@ class oc {
|
|
|
7993
7999
|
for (const s of this.listeners) s(e);
|
|
7994
8000
|
}
|
|
7995
8001
|
}
|
|
7996
|
-
const
|
|
8002
|
+
const cc = Object.freeze({
|
|
7997
8003
|
modelSelection: "core",
|
|
7998
8004
|
directory: "core",
|
|
7999
8005
|
activeUsers: "core",
|
|
@@ -8003,24 +8009,24 @@ const ac = Object.freeze({
|
|
|
8003
8009
|
browserExecution: "legacy"
|
|
8004
8010
|
});
|
|
8005
8011
|
function ui(t, e) {
|
|
8006
|
-
const s =
|
|
8012
|
+
const s = cc[t], n = e[s];
|
|
8007
8013
|
if (!n) throw new Error(`No ${s} implementation for ${t}.`);
|
|
8008
8014
|
return n();
|
|
8009
8015
|
}
|
|
8010
|
-
function
|
|
8016
|
+
function dc(t) {
|
|
8011
8017
|
return t.type === "effect.completed" || t.type === "effect.failed" ? t.effectKind === "directory.query" || t.effectKind === "directory.mutate" : t.type.startsWith("directory.");
|
|
8012
8018
|
}
|
|
8013
|
-
function
|
|
8019
|
+
function lc(t) {
|
|
8014
8020
|
return t.type === "effect.completed" || t.type === "effect.failed" ? t.effectKind.startsWith("conversation.") : t.type.startsWith("conversation.");
|
|
8015
8021
|
}
|
|
8016
|
-
const
|
|
8022
|
+
const uc = {
|
|
8017
8023
|
"directory.query": async () => {
|
|
8018
8024
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
8019
8025
|
},
|
|
8020
8026
|
"directory.mutate": async () => {
|
|
8021
8027
|
throw new Error("Directory ports are not installed before S5-C.");
|
|
8022
8028
|
}
|
|
8023
|
-
},
|
|
8029
|
+
}, pc = {
|
|
8024
8030
|
"conversation.prepare": async () => {
|
|
8025
8031
|
throw new Error("Conversation preparation adapter is not installed.");
|
|
8026
8032
|
},
|
|
@@ -8074,18 +8080,18 @@ function pi(t, e, s) {
|
|
|
8074
8080
|
}
|
|
8075
8081
|
return n;
|
|
8076
8082
|
}
|
|
8077
|
-
class
|
|
8083
|
+
class hc {
|
|
8078
8084
|
engine;
|
|
8079
8085
|
disposeListeners = /* @__PURE__ */ new Set();
|
|
8080
8086
|
conversationPorts;
|
|
8081
8087
|
featurePorts;
|
|
8082
|
-
constructor(e =
|
|
8083
|
-
this.conversationPorts = { ...
|
|
8088
|
+
constructor(e = uc, s = {}, n, i) {
|
|
8089
|
+
this.conversationPorts = { ...pc, ...s }, this.featurePorts = i ?? {}, this.engine = new ac({
|
|
8084
8090
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({
|
|
8085
|
-
account: G(
|
|
8086
|
-
features: G(
|
|
8087
|
-
interactions: G(
|
|
8088
|
-
modelSelection:
|
|
8091
|
+
account: G(Us()),
|
|
8092
|
+
features: G(js()),
|
|
8093
|
+
interactions: G(Ns()),
|
|
8094
|
+
modelSelection: tc(),
|
|
8089
8095
|
directory: ar(),
|
|
8090
8096
|
conversation: Mi(),
|
|
8091
8097
|
activeUsers: lr()
|
|
@@ -8093,24 +8099,24 @@ class pc {
|
|
|
8093
8099
|
reducer: (r, a) => {
|
|
8094
8100
|
const o = a.value;
|
|
8095
8101
|
if (o.type.startsWith("stage7.") || (o.type === "effect.completed" || o.type === "effect.failed") && o.effectKind.startsWith("stage7.")) {
|
|
8096
|
-
const l =
|
|
8102
|
+
const l = Bs(r.slices, o, r.slices);
|
|
8097
8103
|
if (l.state === r.slices) return { state: r, effects: l.effects };
|
|
8098
8104
|
const d = G(X({ account: l.state.account, features: l.state.features, interactions: l.state.interactions }));
|
|
8099
8105
|
return { state: Object.freeze({ revision: r.revision + 1, slices: Object.freeze({ ...r.slices, ...d }) }), effects: l.effects };
|
|
8100
8106
|
}
|
|
8101
8107
|
if (o.type.startsWith("activeUsers.") || (o.type === "effect.completed" || o.type === "effect.failed") && o.effectKind.startsWith("activeUsers.")) {
|
|
8102
|
-
const l =
|
|
8108
|
+
const l = ec(r.slices.activeUsers, o);
|
|
8103
8109
|
return { state: l.state === r.slices.activeUsers ? r : Object.freeze({ revision: r.revision + 1, slices: Object.freeze({ ...r.slices, activeUsers: l.state }) }), effects: l.effects };
|
|
8104
8110
|
}
|
|
8105
|
-
if (
|
|
8111
|
+
if (dc(o)) {
|
|
8106
8112
|
const l = qe(r.slices.directory, o, r.slices.conversation), d = Ws(Hs(r.slices.conversation, l.state, o.type === "directory.authority_replace" && o.adoptLocalSubmissions === !0)), u = Vs(r.slices.conversation, d.state, l.state, l.state.clients !== r.slices.directory.clients), p = u.state, g = pi(r.slices.conversation, p, l.state);
|
|
8107
8113
|
return { state: g === r.slices.directory && p === r.slices.conversation ? r : Object.freeze({
|
|
8108
8114
|
revision: r.revision + 1,
|
|
8109
8115
|
slices: Object.freeze({ ...r.slices, directory: g, conversation: p })
|
|
8110
8116
|
}), effects: [...u.effects, ...l.effects, ...d.effects] };
|
|
8111
8117
|
}
|
|
8112
|
-
if (
|
|
8113
|
-
const l =
|
|
8118
|
+
if (lc(o)) {
|
|
8119
|
+
const l = fo(r.slices.conversation, o, r.slices.directory, r.slices.modelSelection);
|
|
8114
8120
|
let d = r.slices.directory;
|
|
8115
8121
|
for (const [_, S] of Object.entries(l.state.operations)) {
|
|
8116
8122
|
if (!["runtime.warmup", "attachment.prepare"].includes(S.command.type) || !S.conversationScopeId || S.phase !== "done" || r.slices.conversation.operations[_]?.phase === "done") continue;
|
|
@@ -8141,7 +8147,7 @@ class pc {
|
|
|
8141
8147
|
let m = r.slices;
|
|
8142
8148
|
const f = [], v = l.interactionSources, I = m.account.authority;
|
|
8143
8149
|
if (v && I && I.authorityId === v.authorityId && I.generation === v.generation) {
|
|
8144
|
-
const _ =
|
|
8150
|
+
const _ = Bs(m, { type: "stage7.sources", authority: I, now: m.features.now, sources: v.sources }, { conversation: g.state, directory: d });
|
|
8145
8151
|
m = G(X({ account: _.state.account, features: _.state.features, interactions: _.state.interactions })), f.push(..._.effects);
|
|
8146
8152
|
}
|
|
8147
8153
|
return { state: g.state === r.slices.conversation && d === r.slices.directory && m === r.slices ? r : Object.freeze({
|
|
@@ -8149,13 +8155,13 @@ class pc {
|
|
|
8149
8155
|
slices: Object.freeze({ ...r.slices, account: m.account, features: m.features, interactions: m.interactions, directory: d, conversation: g.state })
|
|
8150
8156
|
}), effects: [...l.effects, ...f, ...g.effects, ...p.effects] };
|
|
8151
8157
|
}
|
|
8152
|
-
const c =
|
|
8158
|
+
const c = sc(r.slices.modelSelection, o);
|
|
8153
8159
|
return { state: c === r.slices.modelSelection ? r : Object.freeze({
|
|
8154
8160
|
revision: r.revision + 1,
|
|
8155
8161
|
slices: Object.freeze({ ...r.slices, modelSelection: c })
|
|
8156
8162
|
}), effects: [] };
|
|
8157
8163
|
},
|
|
8158
|
-
selector: (r) => Object.freeze({ ...r.slices, directory:
|
|
8164
|
+
selector: (r) => Object.freeze({ ...r.slices, directory: rc(r.slices.directory), conversation: zr(r.slices.conversation, r.slices.directory) }),
|
|
8159
8165
|
effectHandlers: {
|
|
8160
8166
|
...e,
|
|
8161
8167
|
"stage7.platform": (r) => {
|
|
@@ -8237,13 +8243,13 @@ class pc {
|
|
|
8237
8243
|
}
|
|
8238
8244
|
}
|
|
8239
8245
|
}
|
|
8240
|
-
const
|
|
8241
|
-
async function
|
|
8242
|
-
const e = await
|
|
8246
|
+
const fc = "pluno-product-agent-attachments", gc = 1, sn = "files", mc = 1440 * 60 * 1e3;
|
|
8247
|
+
async function yc(t) {
|
|
8248
|
+
const e = await zt();
|
|
8243
8249
|
await pr(e, "readwrite", (s) => s.put(t));
|
|
8244
8250
|
}
|
|
8245
8251
|
async function hi(t) {
|
|
8246
|
-
const e = await
|
|
8252
|
+
const e = await zt(), s = await pr(
|
|
8247
8253
|
e,
|
|
8248
8254
|
"readonly",
|
|
8249
8255
|
(i) => i.get(t)
|
|
@@ -8254,7 +8260,7 @@ async function hi(t) {
|
|
|
8254
8260
|
return await ur(t, { lastUsedAt: n }), { ...s, lastUsedAt: n };
|
|
8255
8261
|
}
|
|
8256
8262
|
async function ur(t, e) {
|
|
8257
|
-
const s = await
|
|
8263
|
+
const s = await zt();
|
|
8258
8264
|
await In(s, "readwrite", async (n) => {
|
|
8259
8265
|
const i = await wn(
|
|
8260
8266
|
n.get(t)
|
|
@@ -8265,16 +8271,16 @@ async function ur(t, e) {
|
|
|
8265
8271
|
});
|
|
8266
8272
|
});
|
|
8267
8273
|
}
|
|
8268
|
-
async function
|
|
8269
|
-
const e = await
|
|
8274
|
+
async function vc(t = mc) {
|
|
8275
|
+
const e = await zt(), s = Date.now() - t;
|
|
8270
8276
|
await In(e, "readwrite", async (n) => {
|
|
8271
8277
|
const i = n.index("lastUsedAt");
|
|
8272
8278
|
(await wn(i.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((a) => n.delete(a));
|
|
8273
8279
|
});
|
|
8274
8280
|
}
|
|
8275
|
-
function
|
|
8281
|
+
function zt() {
|
|
8276
8282
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
|
|
8277
|
-
const s = indexedDB.open(
|
|
8283
|
+
const s = indexedDB.open(fc, gc);
|
|
8278
8284
|
s.onupgradeneeded = () => {
|
|
8279
8285
|
const i = s.result.createObjectStore(sn, { keyPath: "attachmentId" });
|
|
8280
8286
|
i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
|
|
@@ -8311,11 +8317,11 @@ function wn(t) {
|
|
|
8311
8317
|
t.onsuccess = () => e(t.result), t.onerror = () => s(t.error ?? new Error("Product Agent attachment storage request failed"));
|
|
8312
8318
|
});
|
|
8313
8319
|
}
|
|
8314
|
-
function
|
|
8320
|
+
function bc(t) {
|
|
8315
8321
|
return t !== null && (typeof t == "object" || typeof t == "function");
|
|
8316
8322
|
}
|
|
8317
8323
|
function hr(t, e, s) {
|
|
8318
|
-
const n = Reflect.get(t, "pluno"), i =
|
|
8324
|
+
const n = Reflect.get(t, "pluno"), i = bc(n) ? n : {};
|
|
8319
8325
|
if (i !== n && !Reflect.set(t, "pluno", i))
|
|
8320
8326
|
return null;
|
|
8321
8327
|
const r = Object.getOwnPropertyDescriptor(i, e);
|
|
@@ -8330,7 +8336,7 @@ function hr(t, e, s) {
|
|
|
8330
8336
|
};
|
|
8331
8337
|
}
|
|
8332
8338
|
const fr = "suggest_share_on_socials";
|
|
8333
|
-
function
|
|
8339
|
+
function Ic(t) {
|
|
8334
8340
|
let e = t;
|
|
8335
8341
|
if (typeof t == "string")
|
|
8336
8342
|
try {
|
|
@@ -8338,21 +8344,21 @@ function bc(t) {
|
|
|
8338
8344
|
} catch {
|
|
8339
8345
|
return null;
|
|
8340
8346
|
}
|
|
8341
|
-
const s =
|
|
8347
|
+
const s = wc(e);
|
|
8342
8348
|
return s ? typeof s.showSharePrompt == "boolean" ? s.showSharePrompt : s.ok === !0 && typeof s.message == "string" && s.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
8343
8349
|
}
|
|
8344
|
-
function
|
|
8350
|
+
function wc(t) {
|
|
8345
8351
|
return t && typeof t == "object" && !Array.isArray(t) ? t : null;
|
|
8346
8352
|
}
|
|
8347
|
-
const
|
|
8348
|
-
function
|
|
8349
|
-
return (t.type === "function_call" || t.type === "tool_call") && t.name ===
|
|
8353
|
+
const _c = "save_runtime_captured_skill";
|
|
8354
|
+
function Sc(t) {
|
|
8355
|
+
return (t.type === "function_call" || t.type === "tool_call") && t.name === _c;
|
|
8350
8356
|
}
|
|
8351
|
-
const
|
|
8357
|
+
const fs = "pluno.productAgent.transportId", kc = "pluno.productAgent.transportIdentity", gs = "pluno.productAgent.transportIdentity.event", Rc = 50, Ac = globalThis.setTimeout.bind(globalThis);
|
|
8352
8358
|
let We = null;
|
|
8353
|
-
const qt = /* @__PURE__ */ new Set(),
|
|
8354
|
-
async function
|
|
8355
|
-
const e = t.randomUUID(), s = t.storage.getItem(
|
|
8359
|
+
const qt = /* @__PURE__ */ new Set(), ms = /* @__PURE__ */ new Map();
|
|
8360
|
+
async function Ec(t = gr()) {
|
|
8361
|
+
const e = t.randomUUID(), s = t.storage.getItem(fs);
|
|
8356
8362
|
let n = s ?? t.randomUUID(), i = !1, r = !1;
|
|
8357
8363
|
const a = t.channel.subscribe((c) => {
|
|
8358
8364
|
if (!(c.senderId === e || c.transportId !== n)) {
|
|
@@ -8370,7 +8376,7 @@ async function Ac(t = gr()) {
|
|
|
8370
8376
|
}
|
|
8371
8377
|
});
|
|
8372
8378
|
if (!s)
|
|
8373
|
-
t.storage.setItem(
|
|
8379
|
+
t.storage.setItem(fs, n), i = !0;
|
|
8374
8380
|
else if (t.skipStoredIdentityCollisionCheck)
|
|
8375
8381
|
i = !0;
|
|
8376
8382
|
else
|
|
@@ -8379,7 +8385,7 @@ async function Ac(t = gr()) {
|
|
|
8379
8385
|
i = !0;
|
|
8380
8386
|
break;
|
|
8381
8387
|
}
|
|
8382
|
-
n = t.randomUUID(), t.storage.setItem(
|
|
8388
|
+
n = t.randomUUID(), t.storage.setItem(fs, n);
|
|
8383
8389
|
}
|
|
8384
8390
|
let o = !1;
|
|
8385
8391
|
return {
|
|
@@ -8389,8 +8395,8 @@ async function Ac(t = gr()) {
|
|
|
8389
8395
|
}
|
|
8390
8396
|
};
|
|
8391
8397
|
}
|
|
8392
|
-
async function
|
|
8393
|
-
We || (We =
|
|
8398
|
+
async function Tc(t = !1) {
|
|
8399
|
+
We || (We = Ec({
|
|
8394
8400
|
...gr(),
|
|
8395
8401
|
skipStoredIdentityCollisionCheck: t
|
|
8396
8402
|
}), We.then((i) => {
|
|
@@ -8399,7 +8405,7 @@ async function Ec(t = !1) {
|
|
|
8399
8405
|
};
|
|
8400
8406
|
window.addEventListener("pagehide", r);
|
|
8401
8407
|
}));
|
|
8402
|
-
const e = await We, s =
|
|
8408
|
+
const e = await We, s = qc();
|
|
8403
8409
|
qt.add(s);
|
|
8404
8410
|
let n = !1;
|
|
8405
8411
|
return {
|
|
@@ -8410,7 +8416,7 @@ async function Ec(t = !1) {
|
|
|
8410
8416
|
}
|
|
8411
8417
|
};
|
|
8412
8418
|
}
|
|
8413
|
-
function
|
|
8419
|
+
function qc() {
|
|
8414
8420
|
let t = 0;
|
|
8415
8421
|
for (; qt.has(t); )
|
|
8416
8422
|
t += 1;
|
|
@@ -8418,23 +8424,23 @@ function Tc() {
|
|
|
8418
8424
|
}
|
|
8419
8425
|
function gr() {
|
|
8420
8426
|
return {
|
|
8421
|
-
storage:
|
|
8422
|
-
channel:
|
|
8427
|
+
storage: Cc(),
|
|
8428
|
+
channel: Oc(),
|
|
8423
8429
|
randomUUID: () => crypto.randomUUID(),
|
|
8424
|
-
settle: () => new Promise((t) =>
|
|
8430
|
+
settle: () => new Promise((t) => Ac(t, Rc))
|
|
8425
8431
|
};
|
|
8426
8432
|
}
|
|
8427
|
-
function
|
|
8433
|
+
function Cc() {
|
|
8428
8434
|
return {
|
|
8429
8435
|
getItem: (t) => {
|
|
8430
8436
|
try {
|
|
8431
|
-
return window.sessionStorage?.getItem(t) ??
|
|
8437
|
+
return window.sessionStorage?.getItem(t) ?? ms.get(t) ?? null;
|
|
8432
8438
|
} catch {
|
|
8433
|
-
return
|
|
8439
|
+
return ms.get(t) ?? null;
|
|
8434
8440
|
}
|
|
8435
8441
|
},
|
|
8436
8442
|
setItem: (t, e) => {
|
|
8437
|
-
|
|
8443
|
+
ms.set(t, e);
|
|
8438
8444
|
try {
|
|
8439
8445
|
window.sessionStorage?.setItem(t, e);
|
|
8440
8446
|
} catch {
|
|
@@ -8442,9 +8448,9 @@ function qc() {
|
|
|
8442
8448
|
}
|
|
8443
8449
|
};
|
|
8444
8450
|
}
|
|
8445
|
-
function
|
|
8451
|
+
function Oc() {
|
|
8446
8452
|
if (typeof BroadcastChannel < "u") {
|
|
8447
|
-
const t = new BroadcastChannel(
|
|
8453
|
+
const t = new BroadcastChannel(kc);
|
|
8448
8454
|
return {
|
|
8449
8455
|
postMessage: (e) => t.postMessage(e),
|
|
8450
8456
|
subscribe: (e) => {
|
|
@@ -8454,11 +8460,11 @@ function Cc() {
|
|
|
8454
8460
|
close: () => t.close()
|
|
8455
8461
|
};
|
|
8456
8462
|
}
|
|
8457
|
-
return
|
|
8463
|
+
return xc();
|
|
8458
8464
|
}
|
|
8459
|
-
function
|
|
8465
|
+
function xc() {
|
|
8460
8466
|
const t = /* @__PURE__ */ new Set(), e = (s) => {
|
|
8461
|
-
if (s.key !==
|
|
8467
|
+
if (s.key !== gs || !s.newValue)
|
|
8462
8468
|
return;
|
|
8463
8469
|
const n = JSON.parse(s.newValue);
|
|
8464
8470
|
for (const i of t)
|
|
@@ -8467,9 +8473,9 @@ function Oc() {
|
|
|
8467
8473
|
return window.addEventListener("storage", e), {
|
|
8468
8474
|
postMessage: (s) => {
|
|
8469
8475
|
window.localStorage.setItem(
|
|
8470
|
-
|
|
8476
|
+
gs,
|
|
8471
8477
|
JSON.stringify({ ...s, eventId: crypto.randomUUID() })
|
|
8472
|
-
), window.localStorage.removeItem(
|
|
8478
|
+
), window.localStorage.removeItem(gs);
|
|
8473
8479
|
},
|
|
8474
8480
|
subscribe: (s) => (t.add(s), () => t.delete(s)),
|
|
8475
8481
|
close: () => {
|
|
@@ -8478,7 +8484,7 @@ function Oc() {
|
|
|
8478
8484
|
};
|
|
8479
8485
|
}
|
|
8480
8486
|
const mr = "schedule_follow_up";
|
|
8481
|
-
function
|
|
8487
|
+
function Mc(t) {
|
|
8482
8488
|
let e = t;
|
|
8483
8489
|
if (typeof e == "string")
|
|
8484
8490
|
try {
|
|
@@ -8494,7 +8500,7 @@ function xc(t) {
|
|
|
8494
8500
|
dueAt: s.dueAt
|
|
8495
8501
|
};
|
|
8496
8502
|
}
|
|
8497
|
-
const
|
|
8503
|
+
const Pc = [
|
|
8498
8504
|
"anthropic/claude-opus-5",
|
|
8499
8505
|
"anthropic/claude-sonnet-5",
|
|
8500
8506
|
"deepseek/deepseek-chat-v3.1",
|
|
@@ -8505,34 +8511,34 @@ const Mc = [
|
|
|
8505
8511
|
"gpt-5.6-luna",
|
|
8506
8512
|
"gpt-5.6-terra",
|
|
8507
8513
|
"gpt-5.6-sol"
|
|
8508
|
-
], nn = (t) => typeof t == "string" &&
|
|
8509
|
-
function
|
|
8514
|
+
], nn = (t) => typeof t == "string" && Pc.includes(t), ys = /* @__PURE__ */ new Map();
|
|
8515
|
+
function Dc(t, e, s) {
|
|
8510
8516
|
const n = `pluno.productAgent.modelClientScope:${e}`, i = t.getItem(n);
|
|
8511
8517
|
if (i) return i;
|
|
8512
8518
|
const r = s();
|
|
8513
8519
|
return t.setItem(n, r), r;
|
|
8514
8520
|
}
|
|
8515
|
-
function
|
|
8521
|
+
function Uc(t, e) {
|
|
8516
8522
|
try {
|
|
8517
|
-
const s =
|
|
8518
|
-
return
|
|
8523
|
+
const s = Dc(window.sessionStorage, t, e);
|
|
8524
|
+
return ys.set(t, s), s;
|
|
8519
8525
|
} catch (s) {
|
|
8520
8526
|
if (!(s instanceof DOMException) || s.name !== "SecurityError" && s.name !== "QuotaExceededError") throw s;
|
|
8521
|
-
const n =
|
|
8522
|
-
return
|
|
8527
|
+
const n = ys.get(t) ?? e();
|
|
8528
|
+
return ys.set(t, n), n;
|
|
8523
8529
|
}
|
|
8524
8530
|
}
|
|
8525
|
-
function
|
|
8531
|
+
function Nc(t) {
|
|
8526
8532
|
if (!t || typeof t != "object") return;
|
|
8527
8533
|
const e = t, s = e.requestedModel ?? e.requested_model, n = e.effectiveModel ?? e.effective_model, i = e.provider;
|
|
8528
8534
|
if (!(!nn(s) || !nn(n) || i !== "openrouter" && i !== "azure" && i !== "openai"))
|
|
8529
8535
|
return Object.freeze({ requestedModel: s, effectiveModel: n, provider: i });
|
|
8530
8536
|
}
|
|
8531
|
-
const _n = (t, e) =>
|
|
8537
|
+
const _n = (t, e) => lo(
|
|
8532
8538
|
t.engine.getState().slices.modelSelection,
|
|
8533
8539
|
e
|
|
8534
|
-
),
|
|
8535
|
-
function
|
|
8540
|
+
), jc = (t, e) => dn(_n(t, e));
|
|
8541
|
+
function vs(t, e, s, n) {
|
|
8536
8542
|
return t.engine.dispatch({
|
|
8537
8543
|
type: "model.submission_capture",
|
|
8538
8544
|
clientScopeId: e,
|
|
@@ -8540,8 +8546,8 @@ function ys(t, e, s, n) {
|
|
|
8540
8546
|
requestedModel: n
|
|
8541
8547
|
}), _n(t, e).submissions[s].requestedModel;
|
|
8542
8548
|
}
|
|
8543
|
-
function
|
|
8544
|
-
const a =
|
|
8549
|
+
function Bc(t, e, s, n, i, r) {
|
|
8550
|
+
const a = Nc(i);
|
|
8545
8551
|
a && t.engine.accept({
|
|
8546
8552
|
type: "model.routing_accepted",
|
|
8547
8553
|
clientScopeId: e,
|
|
@@ -8551,12 +8557,12 @@ function jc(t, e, s, n, i, r) {
|
|
|
8551
8557
|
updatedAt: r ? Date.parse(r) : void 0
|
|
8552
8558
|
});
|
|
8553
8559
|
}
|
|
8554
|
-
function
|
|
8560
|
+
function bs(t, e, s, n) {
|
|
8555
8561
|
if (Array.isArray(n))
|
|
8556
8562
|
for (const i of n) {
|
|
8557
8563
|
if (!i || typeof i != "object") continue;
|
|
8558
8564
|
const r = i, a = r.clientMessageId ?? r.client_message_id, o = r.updatedAt ?? r.updated_at;
|
|
8559
|
-
typeof a == "string" &&
|
|
8565
|
+
typeof a == "string" && Bc(
|
|
8560
8566
|
t,
|
|
8561
8567
|
e,
|
|
8562
8568
|
s,
|
|
@@ -8566,7 +8572,7 @@ function vs(t, e, s, n) {
|
|
|
8566
8572
|
);
|
|
8567
8573
|
}
|
|
8568
8574
|
}
|
|
8569
|
-
class
|
|
8575
|
+
class Zl {
|
|
8570
8576
|
constructor(e, s, n = 20) {
|
|
8571
8577
|
this.loadPage = s, this.limit = n, this.recentQuery = new Jn(
|
|
8572
8578
|
`${e}:recent`,
|
|
@@ -8576,7 +8582,7 @@ class Yl {
|
|
|
8576
8582
|
nextCursor: r.nextCursor
|
|
8577
8583
|
}))
|
|
8578
8584
|
),
|
|
8579
|
-
|
|
8585
|
+
Bo
|
|
8580
8586
|
), this.pinnedQuery = new Jn(
|
|
8581
8587
|
`${e}:pinned`,
|
|
8582
8588
|
async () => _t({
|
|
@@ -8609,7 +8615,7 @@ class Yl {
|
|
|
8609
8615
|
}) : null;
|
|
8610
8616
|
return {
|
|
8611
8617
|
key: e.key.slice(0, -7),
|
|
8612
|
-
status:
|
|
8618
|
+
status: Lc(e, s),
|
|
8613
8619
|
data: o,
|
|
8614
8620
|
error: e.error ?? s.error,
|
|
8615
8621
|
requestId: Math.max(e.requestId, s.requestId),
|
|
@@ -8718,10 +8724,10 @@ class Yl {
|
|
|
8718
8724
|
function gt(t) {
|
|
8719
8725
|
return t ? t.ids.map((e) => t.entitiesById[e]).filter((e) => !!e) : [];
|
|
8720
8726
|
}
|
|
8721
|
-
function
|
|
8727
|
+
function Lc(t, e) {
|
|
8722
8728
|
return t.status === "error" || e.status === "error" ? "error" : t.status === "loading" || e.status === "loading" ? "loading" : t.status === "refreshing" || e.status === "refreshing" ? "refreshing" : t.status === "loading_more" ? "loading_more" : t.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
|
|
8723
8729
|
}
|
|
8724
|
-
class
|
|
8730
|
+
class eu {
|
|
8725
8731
|
constructor(e, s = null) {
|
|
8726
8732
|
this.storage = e, s && (this.decisions = new Map(
|
|
8727
8733
|
s.filter(rn).map((n) => [this.getDecisionKey(n), n])
|
|
@@ -8864,29 +8870,29 @@ class Zl {
|
|
|
8864
8870
|
return null;
|
|
8865
8871
|
}
|
|
8866
8872
|
getDecisionKey(e) {
|
|
8867
|
-
const s =
|
|
8873
|
+
const s = Is(e.scope);
|
|
8868
8874
|
return e.action === "dont_show_again" ? `${s}:category:${e.category}` : `${s}:interaction:${e.promptKey}`;
|
|
8869
8875
|
}
|
|
8870
8876
|
getExactKey(e) {
|
|
8871
|
-
return `${
|
|
8877
|
+
return `${Is(e.scope)}:interaction:${e.key}`;
|
|
8872
8878
|
}
|
|
8873
8879
|
getCategoryKey(e) {
|
|
8874
|
-
return `${
|
|
8880
|
+
return `${Is(e.scope)}:category:${e.category}`;
|
|
8875
8881
|
}
|
|
8876
8882
|
}
|
|
8877
|
-
function
|
|
8883
|
+
function tu(t, e) {
|
|
8878
8884
|
return {
|
|
8879
|
-
load: async () =>
|
|
8885
|
+
load: async () => Fc(t, e),
|
|
8880
8886
|
save: async (s) => t.setItem(e, JSON.stringify(s))
|
|
8881
8887
|
};
|
|
8882
8888
|
}
|
|
8883
|
-
function
|
|
8889
|
+
function Fc(t, e) {
|
|
8884
8890
|
const s = t.getItem(e);
|
|
8885
8891
|
if (!s) return [];
|
|
8886
8892
|
const n = JSON.parse(s);
|
|
8887
8893
|
return Array.isArray(n) ? n.filter(rn) : [];
|
|
8888
8894
|
}
|
|
8889
|
-
function
|
|
8895
|
+
function Is(t) {
|
|
8890
8896
|
return `${t.level}:${t.key}`;
|
|
8891
8897
|
}
|
|
8892
8898
|
function yr(t) {
|
|
@@ -8897,18 +8903,18 @@ function rn(t) {
|
|
|
8897
8903
|
const e = t;
|
|
8898
8904
|
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && yr(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
8899
8905
|
}
|
|
8900
|
-
const
|
|
8906
|
+
const $c = {
|
|
8901
8907
|
working: "⏳",
|
|
8902
8908
|
completed: "✅",
|
|
8903
8909
|
failed: "❗",
|
|
8904
8910
|
stopped: "⏹️"
|
|
8905
|
-
},
|
|
8906
|
-
function
|
|
8907
|
-
if (!e) return
|
|
8908
|
-
const s =
|
|
8911
|
+
}, zc = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
8912
|
+
function Hc(t, e) {
|
|
8913
|
+
if (!e) return Ut(t);
|
|
8914
|
+
const s = Ut(t), n = `${$c[e]} Pluno`;
|
|
8909
8915
|
return s ? `${n}: ${s}` : n;
|
|
8910
8916
|
}
|
|
8911
|
-
class
|
|
8917
|
+
class su {
|
|
8912
8918
|
constructor(e) {
|
|
8913
8919
|
this.titleDocument = e;
|
|
8914
8920
|
}
|
|
@@ -8930,10 +8936,10 @@ class tu {
|
|
|
8930
8936
|
}
|
|
8931
8937
|
applyStatus(e) {
|
|
8932
8938
|
const s = this.titleDocument.getTitle();
|
|
8933
|
-
s !== this.lastAppliedTitle && (this.baseTitle =
|
|
8939
|
+
s !== this.lastAppliedTitle && (this.baseTitle = Ut(s)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
8934
8940
|
}
|
|
8935
8941
|
applyClear() {
|
|
8936
|
-
const e = this.titleDocument.getTitle(), s = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, n = this.lastAppliedTitle === null ?
|
|
8942
|
+
const e = this.titleDocument.getTitle(), s = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, n = this.lastAppliedTitle === null ? Ut(e) : e;
|
|
8937
8943
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, s ? this.titleDocument.setTitle(this.baseTitle) : n !== e && this.titleDocument.setTitle(n);
|
|
8938
8944
|
}
|
|
8939
8945
|
handleTitleChanged() {
|
|
@@ -8942,11 +8948,11 @@ class tu {
|
|
|
8942
8948
|
applyTitle() {
|
|
8943
8949
|
if (!this.status)
|
|
8944
8950
|
return;
|
|
8945
|
-
const e =
|
|
8951
|
+
const e = Hc(this.baseTitle, this.status);
|
|
8946
8952
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
8947
8953
|
}
|
|
8948
8954
|
}
|
|
8949
|
-
function
|
|
8955
|
+
function nu(t) {
|
|
8950
8956
|
return {
|
|
8951
8957
|
getTitle: () => t.title,
|
|
8952
8958
|
setTitle: (e) => {
|
|
@@ -8962,10 +8968,10 @@ function su(t) {
|
|
|
8962
8968
|
}
|
|
8963
8969
|
};
|
|
8964
8970
|
}
|
|
8965
|
-
function
|
|
8966
|
-
return t.replace(
|
|
8971
|
+
function Ut(t) {
|
|
8972
|
+
return t.replace(zc, "");
|
|
8967
8973
|
}
|
|
8968
|
-
const
|
|
8974
|
+
const Vc = {
|
|
8969
8975
|
"stop-without-rendered-message": "Stop is enabled while no message is rendered or the welcome screen is still visible.",
|
|
8970
8976
|
"in-progress-stop-unavailable": "An in-progress response has no visible enabled interrupt control.",
|
|
8971
8977
|
"stop-did-not-interrupt": "The stopped response remained in progress after an interrupt click.",
|
|
@@ -8981,8 +8987,8 @@ const Hc = {
|
|
|
8981
8987
|
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
8982
8988
|
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
8983
8989
|
};
|
|
8984
|
-
function
|
|
8985
|
-
return typeof t == "string" && t.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(
|
|
8990
|
+
function Kc(t) {
|
|
8991
|
+
return typeof t == "string" && t.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Vc, t.slice(13));
|
|
8986
8992
|
}
|
|
8987
8993
|
function fi(t) {
|
|
8988
8994
|
return {
|
|
@@ -8995,7 +9001,7 @@ function fi(t) {
|
|
|
8995
9001
|
...t.fileUrl === void 0 ? {} : { fileUrl: t.fileUrl }
|
|
8996
9002
|
};
|
|
8997
9003
|
}
|
|
8998
|
-
function
|
|
9004
|
+
function iu(t) {
|
|
8999
9005
|
if (!t || typeof t != "object" || !("type" in t)) return !1;
|
|
9000
9006
|
const e = t;
|
|
9001
9007
|
switch (e.type) {
|
|
@@ -9013,9 +9019,9 @@ function nu(t) {
|
|
|
9013
9019
|
case "runtime.report_operation_timing":
|
|
9014
9020
|
return it(e.timing);
|
|
9015
9021
|
case "runtime.report_displayed_error":
|
|
9016
|
-
return (e.errorDiagnostic === void 0 ||
|
|
9022
|
+
return (e.errorDiagnostic === void 0 || Ao(e.errorDiagnostic)) && (e.httpRequest === void 0 || pe(e.httpRequest)) && (e.historyRefreshFailure === void 0 || un(e.historyRefreshFailure)) && (e.renderedError === void 0 || hn(e.renderedError)) && (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
|
|
9017
9023
|
case "runtime.report_invalid_state_transition":
|
|
9018
|
-
return (e.uiInvariant === void 0 || fn(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" ||
|
|
9024
|
+
return (e.uiInvariant === void 0 || fn(e.uiInvariant)) && (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || Kc(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
9019
9025
|
case "runtime.prompt_presented":
|
|
9020
9026
|
return (e.feature === "notifications" || e.feature === "tab_grouping") && typeof e.openingGeneration == "number" && Number.isSafeInteger(e.openingGeneration) && e.openingGeneration > 0;
|
|
9021
9027
|
case "runtime.widget_lifecycle":
|
|
@@ -9045,9 +9051,9 @@ function nu(t) {
|
|
|
9045
9051
|
return !1;
|
|
9046
9052
|
}
|
|
9047
9053
|
}
|
|
9048
|
-
class
|
|
9054
|
+
class ru {
|
|
9049
9055
|
constructor(e, s, n) {
|
|
9050
|
-
this.adapter = s, this.state =
|
|
9056
|
+
this.adapter = s, this.state = ws(e), this.model = n;
|
|
9051
9057
|
}
|
|
9052
9058
|
adapter;
|
|
9053
9059
|
listeners = {};
|
|
@@ -9075,7 +9081,7 @@ class iu {
|
|
|
9075
9081
|
return n.add(s), this.listeners[e] = n, () => n.delete(s);
|
|
9076
9082
|
}
|
|
9077
9083
|
getState() {
|
|
9078
|
-
const e =
|
|
9084
|
+
const e = ws(this.state);
|
|
9079
9085
|
for (const [i, r] of this.submissionPreviews)
|
|
9080
9086
|
e.messages.some((a) => a.id === i) || (e.messages.push({ ...r.message, attachments: r.message.attachments?.map((a) => ({ ...a })) }), e.segments && (e.segments = [...e.segments, { id: i, userMessageId: i, activityIds: [], outcomeIds: [], collapsed: !1 }]), e.isLoadingSession = !1, r.pending && (e.activeResponseUserMessageId = i, e.pendingMessageStatus = "sending", e.turnPhase = "sending", e.activity = { phase: "submitting", activeItemId: null }), r.error && (e.lastError = r.error.message, e.lastErrorCode = ["unauthorized", "401", "auth_reconnecting", "submission_not_available"].includes(r.error.code) ? r.error.code : "message_delivery_failed"));
|
|
9081
9087
|
this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed");
|
|
@@ -9090,7 +9096,7 @@ class iu {
|
|
|
9090
9096
|
(a.user?.id !== e.user?.id || a.selectionKey !== void 0 && a.selectionKey !== e.selectionKey || a.selectionKey === void 0 && a.sessionId !== null && a.sessionId !== e.sessionId) && (this.cancelPendingSubmissions(), this.submissionPreviews.clear());
|
|
9091
9097
|
for (const o of e.messages)
|
|
9092
9098
|
o.role === "user" && this.submissionPreviews.delete(o.id);
|
|
9093
|
-
this.state =
|
|
9099
|
+
this.state = ws(e);
|
|
9094
9100
|
for (const [o, c] of this.stopPreviews) {
|
|
9095
9101
|
const l = e.activity?.executionKey;
|
|
9096
9102
|
(c !== void 0 && c !== "[]" && l !== void 0 && l !== "[]" && (l !== c || ["completed", "failed", "stopped"].includes(e.activity.phase)) || (c === void 0 || c === "[]") && e.messages.some((u) => u.respondsToUserMessageId === o && !u.provisional && u.loading !== !0 && (u.dataType === "run_status" || u.dataType === "run_error" || u.role === "assistant" && u.phase !== "commentary" && (u.streamState === void 0 || ["finished", "stopped", "failed"].includes(u.streamState))))) && this.stopPreviews.delete(o);
|
|
@@ -9099,7 +9105,7 @@ class iu {
|
|
|
9099
9105
|
for (const o of this.state.messages) {
|
|
9100
9106
|
if (o.role !== "user" || !o.attachments?.length) continue;
|
|
9101
9107
|
const c = a.messages.find((l) => l.role === "user" && l.id === o.id);
|
|
9102
|
-
a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments =
|
|
9108
|
+
a.sessionId !== e.sessionId && !(a.sessionId === null && c) || (o.attachments = Wc(c?.attachments, o.attachments));
|
|
9103
9109
|
}
|
|
9104
9110
|
if (s !== void 0 && (this.model = s), n && JSON.stringify(n) !== JSON.stringify(this.sessionHistoryState)) {
|
|
9105
9111
|
this.sessionHistoryState = gi(n);
|
|
@@ -9248,7 +9254,7 @@ class iu {
|
|
|
9248
9254
|
return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), r;
|
|
9249
9255
|
} catch (l) {
|
|
9250
9256
|
if (n !== this.submissionGeneration) return null;
|
|
9251
|
-
if (
|
|
9257
|
+
if (zo(l))
|
|
9252
9258
|
for (const u of s.attachments ?? [])
|
|
9253
9259
|
u.id && this.attachmentFiles.delete(u.id);
|
|
9254
9260
|
const d = this.submissionPreviews.get(r);
|
|
@@ -9435,7 +9441,7 @@ class iu {
|
|
|
9435
9441
|
for (const i of n ?? []) i(s);
|
|
9436
9442
|
}
|
|
9437
9443
|
}
|
|
9438
|
-
function
|
|
9444
|
+
function Wc(t, e) {
|
|
9439
9445
|
if (!e || !t) return e;
|
|
9440
9446
|
const s = /* @__PURE__ */ new Map();
|
|
9441
9447
|
for (const n of t) {
|
|
@@ -9447,7 +9453,7 @@ function Kc(t, e) {
|
|
|
9447
9453
|
return i ? { ...n, previewUrl: i } : n;
|
|
9448
9454
|
});
|
|
9449
9455
|
}
|
|
9450
|
-
function
|
|
9456
|
+
function ws(t) {
|
|
9451
9457
|
return {
|
|
9452
9458
|
...t,
|
|
9453
9459
|
starterPrompts: [...t.starterPrompts],
|
|
@@ -9475,12 +9481,12 @@ function gi(t) {
|
|
|
9475
9481
|
return {
|
|
9476
9482
|
...t,
|
|
9477
9483
|
data: t.data ? _t({
|
|
9478
|
-
entities:
|
|
9484
|
+
entities: Lo(t.data).map((e) => ({ ...e })),
|
|
9479
9485
|
nextCursor: t.data.nextCursor
|
|
9480
9486
|
}) : null
|
|
9481
9487
|
};
|
|
9482
9488
|
}
|
|
9483
|
-
const
|
|
9489
|
+
const Gc = globalThis.fetch.bind(globalThis), mi = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Jc = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Qc = ".pluno-pa-widget__panel", Xc = ".pluno-pa-widget__timeline", Yc = "__plunoExtensionWidgetOwner";
|
|
9484
9490
|
class ue extends Error {
|
|
9485
9491
|
constructor(e, s, n, i) {
|
|
9486
9492
|
super(e), this.retryable = s, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
|
|
@@ -9489,8 +9495,8 @@ class ue extends Error {
|
|
|
9489
9495
|
status;
|
|
9490
9496
|
retryAfterMs;
|
|
9491
9497
|
}
|
|
9492
|
-
let
|
|
9493
|
-
function
|
|
9498
|
+
let Zc = 0;
|
|
9499
|
+
function _s(t) {
|
|
9494
9500
|
const e = {};
|
|
9495
9501
|
for (const c of [
|
|
9496
9502
|
"type",
|
|
@@ -9555,7 +9561,7 @@ function ws(t) {
|
|
|
9555
9561
|
}
|
|
9556
9562
|
}
|
|
9557
9563
|
}
|
|
9558
|
-
return { ...e, ...
|
|
9564
|
+
return { ...e, ...To(t) };
|
|
9559
9565
|
}
|
|
9560
9566
|
function xe(t, e, s) {
|
|
9561
9567
|
if (typeof window > "u")
|
|
@@ -9569,26 +9575,26 @@ function xe(t, e, s) {
|
|
|
9569
9575
|
source: "web_sdk",
|
|
9570
9576
|
category: t,
|
|
9571
9577
|
name: e,
|
|
9572
|
-
sequence: ++
|
|
9578
|
+
sequence: ++Zc,
|
|
9573
9579
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9574
9580
|
monotonicMs: performance.now(),
|
|
9575
9581
|
data: s
|
|
9576
9582
|
};
|
|
9577
9583
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: i }));
|
|
9578
9584
|
}
|
|
9579
|
-
const
|
|
9585
|
+
const ed = "https://app.pluno.ai", td = 2e4, sd = 1e4, nd = 6e4, id = 6e4, rd = 1e4, od = 1e4, ad = 1e3, on = 3e4, yi = 0.2, Ss = 6e4, ks = 3, vi = "Still connecting to Pluno. Retrying automatically.", cd = 1e3, dd = 100, bi = 3, ld = [300, 1e3], vr = 50 * 1024 * 1024, ud = /* @__PURE__ */ new Set([
|
|
9580
9586
|
".jpeg:image/jpeg",
|
|
9581
9587
|
".jpg:image/jpeg",
|
|
9582
9588
|
".pdf:application/pdf",
|
|
9583
9589
|
".png:image/png",
|
|
9584
9590
|
".webp:image/webp"
|
|
9585
|
-
]),
|
|
9591
|
+
]), ou = ".pdf,.png,.jpg,.jpeg,.webp", Sn = 64e3, Rs = 4e3, kn = 30, pd = 2e3, hd = 1e3, br = "Image is too large for model vision input.", fd = "pluno.productAgent.state.", an = "pluno.productAgent.pendingEvents.", Ht = "pluno.productAgent.activeToolCalls.", gd = 100, Ct = /* @__PURE__ */ new Set();
|
|
9586
9592
|
let mt = null;
|
|
9587
|
-
function
|
|
9588
|
-
const s = Math.min(on,
|
|
9593
|
+
function md(t, e = Math.random) {
|
|
9594
|
+
const s = Math.min(on, ad * 2 ** t), n = 1 - yi + e() * yi * 2;
|
|
9589
9595
|
return Math.min(on, Math.round(s * n));
|
|
9590
9596
|
}
|
|
9591
|
-
function
|
|
9597
|
+
function yd(t) {
|
|
9592
9598
|
const e = t.split(".")[1];
|
|
9593
9599
|
if (!e)
|
|
9594
9600
|
return null;
|
|
@@ -9599,7 +9605,7 @@ function md(t) {
|
|
|
9599
9605
|
return null;
|
|
9600
9606
|
}
|
|
9601
9607
|
}
|
|
9602
|
-
function
|
|
9608
|
+
function As(t) {
|
|
9603
9609
|
if (t instanceof ue)
|
|
9604
9610
|
return t.retryable;
|
|
9605
9611
|
if (t && typeof t == "object") {
|
|
@@ -9619,13 +9625,13 @@ function Ge(t) {
|
|
|
9619
9625
|
}
|
|
9620
9626
|
return Object.assign(new Error(e.message), e);
|
|
9621
9627
|
}
|
|
9622
|
-
function
|
|
9628
|
+
function Es(t) {
|
|
9623
9629
|
return t === "main_web_chat" ? ["pinned", "recent"] : ["all"];
|
|
9624
9630
|
}
|
|
9625
|
-
class
|
|
9631
|
+
class Vt {
|
|
9626
9632
|
constructor(e, s) {
|
|
9627
9633
|
this.options = e, this.transportIdentity = s, this.directoryAuthority = {
|
|
9628
|
-
authorityId:
|
|
9634
|
+
authorityId: as(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
|
|
9629
9635
|
generation: 1
|
|
9630
9636
|
}, this.directoryHttp = new or({
|
|
9631
9637
|
backendUrl: e.backendUrl,
|
|
@@ -9649,7 +9655,7 @@ class Ht {
|
|
|
9649
9655
|
}
|
|
9650
9656
|
});
|
|
9651
9657
|
const n = this;
|
|
9652
|
-
this.clientRuntime = new
|
|
9658
|
+
this.clientRuntime = new hc(za({
|
|
9653
9659
|
http: this.directoryHttp,
|
|
9654
9660
|
get authority() {
|
|
9655
9661
|
return n.directoryAuthority;
|
|
@@ -9658,19 +9664,19 @@ class Ht {
|
|
|
9658
9664
|
pageUrl: () => location.href,
|
|
9659
9665
|
now: () => Date.now(),
|
|
9660
9666
|
onError: (i) => this.handleDirectoryTransportError(i)
|
|
9661
|
-
}), void 0,
|
|
9667
|
+
}), void 0, qo(async () => {
|
|
9662
9668
|
if (!this.token || !this.state.user || this.state.status === "closed") throw new Error("Product Agent is not authenticated");
|
|
9663
|
-
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count :
|
|
9664
|
-
})), this.modelClientScopeId =
|
|
9669
|
+
return this.options.activeUsersLoader ? (await this.options.activeUsersLoader()).count : Co(this.options.backendUrl);
|
|
9670
|
+
})), this.modelClientScopeId = Uc(e.clientId, () => crypto.randomUUID()), this.directoryConversationScopeId = `conversation:${this.modelClientScopeId}`, this.createDirectoryAdapters(), this.clientRuntime.engine.dispatch({
|
|
9665
9671
|
type: "model.scope_open",
|
|
9666
9672
|
clientScopeId: this.modelClientScopeId,
|
|
9667
9673
|
sessionId: null,
|
|
9668
9674
|
// Personal new chats defer to the backend rolling preference until history hydrates the core.
|
|
9669
9675
|
defaultModel: e.productVariant === "personal" ? void 0 : "gpt-5.6-terra",
|
|
9670
9676
|
selectedModel: e.model
|
|
9671
|
-
}), this.installFeaturePorts(), this.queuedClientEvents =
|
|
9672
|
-
|
|
9673
|
-
|
|
9677
|
+
}), this.installFeaturePorts(), this.queuedClientEvents = bl(
|
|
9678
|
+
gl(e.clientId),
|
|
9679
|
+
ml(e.clientId)
|
|
9674
9680
|
);
|
|
9675
9681
|
}
|
|
9676
9682
|
options;
|
|
@@ -9785,17 +9791,17 @@ class Ht {
|
|
|
9785
9791
|
s in e && Object.assign(this.platformState, { [s]: e[s] });
|
|
9786
9792
|
}
|
|
9787
9793
|
static async init(e) {
|
|
9788
|
-
const s = e, n = await
|
|
9794
|
+
const s = e, n = await Tc(
|
|
9789
9795
|
s.skipStoredTransportIdentityCollisionCheck === !0
|
|
9790
|
-
), i = new
|
|
9796
|
+
), i = new Vt({
|
|
9791
9797
|
...e,
|
|
9792
|
-
backendUrl:
|
|
9793
|
-
clientId: e.clientId ??
|
|
9798
|
+
backendUrl: Pd(e.backendUrl ?? ed),
|
|
9799
|
+
clientId: e.clientId ?? Yd(),
|
|
9794
9800
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
9795
|
-
entrySurface:
|
|
9801
|
+
entrySurface: Oo(e.entrySurface)
|
|
9796
9802
|
}, n);
|
|
9797
9803
|
try {
|
|
9798
|
-
await i.initializeDirectory(), await i.initializeConversation(),
|
|
9804
|
+
await i.initializeDirectory(), await i.initializeConversation(), vc().catch((r) => {
|
|
9799
9805
|
V("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
9800
9806
|
message: r instanceof Error ? r.message : String(r)
|
|
9801
9807
|
});
|
|
@@ -9806,15 +9812,15 @@ class Ht {
|
|
|
9806
9812
|
return i;
|
|
9807
9813
|
}
|
|
9808
9814
|
createDirectoryAdapters() {
|
|
9809
|
-
this.directoryScope = new
|
|
9815
|
+
this.directoryScope = new Ka({
|
|
9810
9816
|
runtime: this.clientRuntime,
|
|
9811
9817
|
authority: this.directoryAuthority,
|
|
9812
9818
|
random: Math.random,
|
|
9813
|
-
persistence:
|
|
9819
|
+
persistence: Ga(
|
|
9814
9820
|
this.modelClientScopeId,
|
|
9815
9821
|
this.directoryAuthority.authorityId
|
|
9816
9822
|
)
|
|
9817
|
-
}), this.directoryObservation = new
|
|
9823
|
+
}), this.directoryObservation = new Ha({
|
|
9818
9824
|
runtime: this.clientRuntime,
|
|
9819
9825
|
authority: this.directoryAuthority,
|
|
9820
9826
|
http: this.directoryHttp,
|
|
@@ -9827,7 +9833,7 @@ class Ht {
|
|
|
9827
9833
|
}, stop: () => {
|
|
9828
9834
|
} },
|
|
9829
9835
|
enabled: () => !!this.token && !this.authenticationFailure && !this.refreshingDefaultCredentials && this.state.status !== "closed",
|
|
9830
|
-
observedQueries: () =>
|
|
9836
|
+
observedQueries: () => Es(this.options.entrySurface).map((s) => this.getDirectoryQuery(s))
|
|
9831
9837
|
});
|
|
9832
9838
|
let e = this.clientRuntime.engine.getProjection().activeUsers.query.data;
|
|
9833
9839
|
this.clientRuntime.engine.subscribe((s) => {
|
|
@@ -9843,12 +9849,12 @@ class Ht {
|
|
|
9843
9849
|
const e = ++this.conversationAdapterGeneration;
|
|
9844
9850
|
this.conversationObservation?.dispose(), this.conversationUnsubscribe?.();
|
|
9845
9851
|
const s = this.directoryAuthority, n = () => e === this.conversationAdapterGeneration;
|
|
9846
|
-
this.operationTimingReporter =
|
|
9852
|
+
this.operationTimingReporter = bo((f) => {
|
|
9847
9853
|
n() && !this.clientRuntime.isDisposed && this.reportHealthSignal("operation_timing", { timings: f.map((v) => ({ ...v, entrySurface: this.options.entrySurface })) });
|
|
9848
9854
|
});
|
|
9849
9855
|
const i = `pa.conversation.delivery:${this.modelClientScopeId}:${s.authorityId}`, r = `${i}:cancellations`;
|
|
9850
9856
|
this.authenticatedUserId && this.options.restorePersistedState === !1 && sessionStorage.removeItem(r);
|
|
9851
|
-
const a = this.authenticatedUserId ?
|
|
9857
|
+
const a = this.authenticatedUserId ? as(r) : null, o = Io({
|
|
9852
9858
|
authorityId: s.authorityId,
|
|
9853
9859
|
isCurrent: n,
|
|
9854
9860
|
read: async () => a ? JSON.parse(a) : null,
|
|
@@ -9858,7 +9864,7 @@ class Ht {
|
|
|
9858
9864
|
onTiming: (f) => this.reportOperationTiming(f)
|
|
9859
9865
|
});
|
|
9860
9866
|
this.clientRuntime.installConversationPorts({
|
|
9861
|
-
...
|
|
9867
|
+
...Po({
|
|
9862
9868
|
authority: s,
|
|
9863
9869
|
runtime: () => this.clientRuntime,
|
|
9864
9870
|
isCurrent: n,
|
|
@@ -9887,7 +9893,7 @@ class Ht {
|
|
|
9887
9893
|
document.addEventListener("visibilitychange", y);
|
|
9888
9894
|
}));
|
|
9889
9895
|
const S = f.context.page;
|
|
9890
|
-
if (
|
|
9896
|
+
if (ae().url !== S.url) throw Object.assign(new Error("The page changed before preparation completed. Send this message again."), { code: "context_preparation_interrupted", retryable: !1 });
|
|
9891
9897
|
_ = { pageContent: await I.measure("page_capture", async () => Rn()), sessionTabs: [] };
|
|
9892
9898
|
}
|
|
9893
9899
|
if (await I.measure("authentication", () => this.waitForAuthentication()), !n() || s !== this.directoryAuthority || this.clientRuntime.isDisposed) throw new Error("Submission authority was retired.");
|
|
@@ -9926,19 +9932,19 @@ class Ht {
|
|
|
9926
9932
|
onTiming: (f) => {
|
|
9927
9933
|
n() && this.reportOperationTiming(f);
|
|
9928
9934
|
},
|
|
9929
|
-
onCommand: (f) => xe("client_event", f.type,
|
|
9935
|
+
onCommand: (f) => xe("client_event", f.type, _s({ ...f.payload, type: f.type })),
|
|
9930
9936
|
onError: (f, v) => {
|
|
9931
9937
|
if (this.options.productVariant === "customer_embedded" && v.operation === "conversation.snapshot" && f instanceof A && f.code === "conversation_access_denied") {
|
|
9932
9938
|
v.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
9933
9939
|
return;
|
|
9934
9940
|
}
|
|
9935
|
-
V("web-sdk.conversation", "Conversation operation failed", { ...v, ...
|
|
9941
|
+
V("web-sdk.conversation", "Conversation operation failed", { ...v, ...Eo(f) }), f instanceof A && f.backendRefusal && v.operation.startsWith("chat.") ? this.applyAccountSubmissionError(f.code) : this.handleDirectoryTransportError(f);
|
|
9936
9942
|
}
|
|
9937
9943
|
})
|
|
9938
9944
|
});
|
|
9939
|
-
const c = this.clientRuntime.engine.getState().slices.conversation, l = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null :
|
|
9945
|
+
const c = this.clientRuntime.engine.getState().slices.conversation, l = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : as(i);
|
|
9940
9946
|
if (this.authenticatedUserId && !c.submissionOrder.length && !Object.keys(c.operations).length) {
|
|
9941
|
-
const f = this.queuedClientEvents.filter((_) => _.type === "chat.user_message"), v = l ? JSON.parse(l) : f.length ?
|
|
9947
|
+
const f = this.queuedClientEvents.filter((_) => _.type === "chat.user_message"), v = l ? JSON.parse(l) : f.length ? xo(c, f.map((_) => {
|
|
9942
9948
|
const { type: S, ...h } = _, b = this.clientRuntime.engine.getState().slices.directory, y = b.clients[this.modelClientScopeId];
|
|
9943
9949
|
return {
|
|
9944
9950
|
command: { type: S, request_id: _.clientMessageId, payload: JSON.parse(JSON.stringify(h)) },
|
|
@@ -9957,7 +9963,7 @@ class Ht {
|
|
|
9957
9963
|
I && (v || Object.keys(I.operations).length || Object.keys(I.stops).length) && await this.clientRuntime.engine.dispatch({ ...s, type: "conversation.restore_delivery", checkpoint: I });
|
|
9958
9964
|
}
|
|
9959
9965
|
if (this.authenticatedUserId && (this.queuedClientEvents = this.queuedClientEvents.filter((f) => !["chat.user_message", "chat.retry_last_user_message", "run.stop", "runtime.warmup", "session.reset", "attachment.upload_completed"].includes(f.type))), Re(this.options.clientId, this.queuedClientEvents), !n()) return;
|
|
9960
|
-
this.conversationObservation = new
|
|
9966
|
+
this.conversationObservation = new Do({
|
|
9961
9967
|
authority: s,
|
|
9962
9968
|
now: () => Date.now(),
|
|
9963
9969
|
runtime: () => this.clientRuntime,
|
|
@@ -9998,7 +10004,7 @@ class Ht {
|
|
|
9998
10004
|
let u = new Map(this.getState().messages.map((f) => [f.id, f])), p = this.clientRuntime.engine.getState().slices.conversation, g = this.clientRuntime.engine.getState().slices.directory.selections, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
|
|
9999
10005
|
this.conversationUnsubscribe = this.clientRuntime.engine.subscribe(() => {
|
|
10000
10006
|
const f = this.clientRuntime.engine.getState().slices, v = p;
|
|
10001
|
-
p = f.conversation,
|
|
10007
|
+
p = f.conversation, wo(v, f.conversation, this.operationTimingReporter, "sdk");
|
|
10002
10008
|
const I = m !== f.directory.clients[this.modelClientScopeId];
|
|
10003
10009
|
m = f.directory.clients[this.modelClientScopeId], g !== f.directory.selections && (g = f.directory.selections, this.directoryScope.persist());
|
|
10004
10010
|
for (const S of Object.values(f.conversation.submissions)) {
|
|
@@ -10007,7 +10013,7 @@ class Ht {
|
|
|
10007
10013
|
h && (h.sessionId = S.sessionId), this.emit("ack", { clientMessageId: S.userMessageId, sessionId: S.sessionId });
|
|
10008
10014
|
const b = S.sessionId;
|
|
10009
10015
|
b && this.getState().sessionId === b && this.directoryHttp.request(`/sessions/${encodeURIComponent(b)}/history`, { limit: 200 }).then((y) => {
|
|
10010
|
-
n() && this.getState().sessionId === b && this.state.status !== "closed" &&
|
|
10016
|
+
n() && this.getState().sessionId === b && this.state.status !== "closed" && bs(this.clientRuntime, this.modelClientScopeId, b, y.turns);
|
|
10011
10017
|
}).catch((y) => {
|
|
10012
10018
|
n() && this.getState().sessionId === b && this.handleDirectoryTransportError(y);
|
|
10013
10019
|
});
|
|
@@ -10017,7 +10023,7 @@ class Ht {
|
|
|
10017
10023
|
for (const [S, h] of Object.entries(f.directory.clients)) {
|
|
10018
10024
|
if (!S.startsWith(`background:${this.modelClientScopeId}:`)) continue;
|
|
10019
10025
|
const b = Ie(f.conversation, f.directory, h), y = b.sessionId ? f.conversation.sessions[b.sessionId] : void 0;
|
|
10020
|
-
if (this.firstResponseTimersByClientMessageId.size && (d(
|
|
10026
|
+
if (this.firstResponseTimersByClientMessageId.size && (d(cs(b, y?.queries.current, this.options.backendUrl).messages, b.sessionId), ["failed", "stopped"].includes(b.activity.phase)))
|
|
10021
10027
|
for (const R of le(y?.execution)) this.clearFirstResponseTimer(R);
|
|
10022
10028
|
const w = b.activity.phase === "completed" && le(y?.execution).some((R) => this.firstResponseTimersByClientMessageId.has(R));
|
|
10023
10029
|
(I && b.sessionId === this.getState().sessionId || !w && ["completed", "failed", "stopped"].includes(b.activity.phase)) && this.directoryScope.detach(S);
|
|
@@ -10037,7 +10043,7 @@ class Ht {
|
|
|
10037
10043
|
type: "directory.authority_replace",
|
|
10038
10044
|
expectedGeneration: 0
|
|
10039
10045
|
}), !(this.options.restorePersistedState !== !1 && await this.directoryScope.restore(this.options.expectedPersistedSessionId))) {
|
|
10040
|
-
const s = this.options.restorePersistedState === !1 ? null :
|
|
10046
|
+
const s = this.options.restorePersistedState === !1 ? null : fl(this.options.clientId, this.options.expectedPersistedSessionId)?.sessionId;
|
|
10041
10047
|
s ? await this.directoryScope.bind(
|
|
10042
10048
|
this.modelClientScopeId,
|
|
10043
10049
|
this.directoryConversationScopeId,
|
|
@@ -10083,12 +10089,12 @@ class Ht {
|
|
|
10083
10089
|
return n.add(s), this.listeners[e] = n, () => n.delete(s);
|
|
10084
10090
|
}
|
|
10085
10091
|
getState() {
|
|
10086
|
-
const e = this.clientRuntime.engine.getState().slices, s = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, n = Ie(e.conversation, e.directory, s), i =
|
|
10092
|
+
const e = this.clientRuntime.engine.getState().slices, s = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, n = Ie(e.conversation, e.directory, s), i = cs(
|
|
10087
10093
|
n,
|
|
10088
10094
|
n.sessionId ? e.conversation.sessions[n.sessionId]?.queries.current : void 0,
|
|
10089
10095
|
this.options.backendUrl,
|
|
10090
10096
|
this.clientRuntime.engine.getDiagnostics({ clientScopeId: this.modelClientScopeId, scopeId: s, sessionId: n.sessionId })
|
|
10091
|
-
), r = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a =
|
|
10097
|
+
), r = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...r, includeUserSuggestions: !1 }, o = Mt(e, a), c = Mt(e, { kind: "appearance", ...r }), l = c?.data?.kind === "appearance" ? c.data.value : null;
|
|
10092
10098
|
return {
|
|
10093
10099
|
...this.platformState,
|
|
10094
10100
|
...i,
|
|
@@ -10100,9 +10106,9 @@ class Ht {
|
|
|
10100
10106
|
lastError: i.lastError ?? this.platformState.lastError,
|
|
10101
10107
|
lastErrorCode: i.lastErrorCode ?? this.platformState.lastErrorCode,
|
|
10102
10108
|
lastErrorSecuritySettingsUrl: !i.lastErrorCode || i.lastErrorCode === this.platformState.lastErrorCode ? this.platformState.lastErrorSecuritySettingsUrl : null,
|
|
10103
|
-
starterPrompts:
|
|
10104
|
-
starterPromptsLoading:
|
|
10105
|
-
appearance:
|
|
10109
|
+
starterPrompts: o?.data && (o.data.kind === "starterPrompts" || o.data.kind === "userSuggestedTasks") ? [...o.data.prompts] : Wd(this.options.initialStarterPrompts),
|
|
10110
|
+
starterPromptsLoading: Jr(e, a),
|
|
10111
|
+
appearance: l ? { accentColor: l.accent, colorScheme: l.colorScheme, fontFamily: l.fontFamily, scribbleStyle: l.scribbleStyle } : null
|
|
10106
10112
|
};
|
|
10107
10113
|
}
|
|
10108
10114
|
stageProactiveSuggestionQuestion(e) {
|
|
@@ -10124,7 +10130,7 @@ class Ht {
|
|
|
10124
10130
|
if (!this.options.tokenProvider)
|
|
10125
10131
|
return this.token;
|
|
10126
10132
|
if (this.tokenRequest) return await this.tokenRequest;
|
|
10127
|
-
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
10133
|
+
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - id > n;
|
|
10128
10134
|
if (!s.forceRefresh && (i || s.preferCached && this.token !== null))
|
|
10129
10135
|
return this.token;
|
|
10130
10136
|
s.forceRefresh && this.invalidateProviderToken();
|
|
@@ -10135,7 +10141,7 @@ class Ht {
|
|
|
10135
10141
|
const c = new Promise((l, d) => {
|
|
10136
10142
|
o = window.setTimeout(() => {
|
|
10137
10143
|
r.abort(), d(new ue("Pluno token provider timed out", !0));
|
|
10138
|
-
},
|
|
10144
|
+
}, nd);
|
|
10139
10145
|
});
|
|
10140
10146
|
try {
|
|
10141
10147
|
const l = await Promise.race([
|
|
@@ -10146,7 +10152,7 @@ class Ht {
|
|
|
10146
10152
|
throw new ue("Pluno token request was cancelled", !0);
|
|
10147
10153
|
if (typeof l != "string" || !l.trim())
|
|
10148
10154
|
throw new ue("Chat setup did not return a session. Contact your app administrator, then try again.", !1);
|
|
10149
|
-
return this.token = l, this.tokenExpiresAtMs =
|
|
10155
|
+
return this.token = l, this.tokenExpiresAtMs = yd(l), l;
|
|
10150
10156
|
} finally {
|
|
10151
10157
|
o !== null && window.clearTimeout(o);
|
|
10152
10158
|
}
|
|
@@ -10200,7 +10206,7 @@ class Ht {
|
|
|
10200
10206
|
await this.replaceDefaultTransportCredentials(this.socket);
|
|
10201
10207
|
return;
|
|
10202
10208
|
}
|
|
10203
|
-
const r =
|
|
10209
|
+
const r = Ud(this.options.backendUrl), a = this.options.webSocketFactory?.(r) ?? new L({
|
|
10204
10210
|
displaySchema: "canonical",
|
|
10205
10211
|
backendUrl: this.options.backendUrl,
|
|
10206
10212
|
entrySurface: this.options.entrySurface,
|
|
@@ -10221,7 +10227,7 @@ class Ht {
|
|
|
10221
10227
|
});
|
|
10222
10228
|
this.socket = a, this.options.webSocketFactory && (this.socketConnectTimer = window.setTimeout(() => {
|
|
10223
10229
|
this.socket === a && a.readyState === WebSocket.CONNECTING && (V("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(a));
|
|
10224
|
-
},
|
|
10230
|
+
}, rd)), a.addEventListener("reconnecting", (o) => {
|
|
10225
10231
|
this.socket === a && this.state.status !== "closed" && (this.refreshingDefaultCredentials || this.reportTransportDiagnostic("socket_closed", { disconnectReason: o.detail.reason }), this.setReconnectingState());
|
|
10226
10232
|
}), a.addEventListener("open", () => {
|
|
10227
10233
|
this.socket !== a || (this.clearSocketConnectTimer(), this.directoryObservation.reconnect().catch(() => {
|
|
@@ -10236,12 +10242,12 @@ class Ht {
|
|
|
10236
10242
|
pageUrl: location.href
|
|
10237
10243
|
}) : !0)) || this.options.webSocketFactory && (this.socketAuthTimer = window.setTimeout(() => {
|
|
10238
10244
|
this.socket === a && (V("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(a));
|
|
10239
|
-
},
|
|
10245
|
+
}, od));
|
|
10240
10246
|
}), a.addEventListener("message", (o) => {
|
|
10241
10247
|
if (this.socket !== a)
|
|
10242
10248
|
return;
|
|
10243
10249
|
const c = Si(o.data);
|
|
10244
|
-
if (a instanceof L && c.type === "tool.call" && !
|
|
10250
|
+
if (a instanceof L && c.type === "tool.call" && !Kd(c)) {
|
|
10245
10251
|
this.setState({ status: "error", lastError: "Invalid tool-call envelope", lastErrorCode: "invalid_tool_call" });
|
|
10246
10252
|
return;
|
|
10247
10253
|
}
|
|
@@ -10278,7 +10284,7 @@ class Ht {
|
|
|
10278
10284
|
return;
|
|
10279
10285
|
}
|
|
10280
10286
|
const a = Ge(r);
|
|
10281
|
-
if (
|
|
10287
|
+
if (As(r)) {
|
|
10282
10288
|
V("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
10283
10289
|
message: a.message,
|
|
10284
10290
|
reconnectAttempt: this.reconnectAttempts
|
|
@@ -10308,7 +10314,7 @@ class Ht {
|
|
|
10308
10314
|
}
|
|
10309
10315
|
destroy() {
|
|
10310
10316
|
if (!this.clientRuntime.isDisposed) {
|
|
10311
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
10317
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Il(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
10312
10318
|
for (const e of Object.values(this.listeners))
|
|
10313
10319
|
e?.clear();
|
|
10314
10320
|
this.accountListeners.clear(), this.interactionListeners.clear(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.conversationUnsubscribe?.(), this.directoryObservation.dispose(), this.directoryHttp.dispose(), this.clientRuntime.dispose();
|
|
@@ -10343,7 +10349,7 @@ class Ht {
|
|
|
10343
10349
|
reason: e,
|
|
10344
10350
|
...i ? { warmupId: i } : {},
|
|
10345
10351
|
sessionId: s,
|
|
10346
|
-
page:
|
|
10352
|
+
page: ae(),
|
|
10347
10353
|
entrySurface: this.options.entrySurface,
|
|
10348
10354
|
model: this.getModel() ?? null
|
|
10349
10355
|
}
|
|
@@ -10379,7 +10385,7 @@ class Ht {
|
|
|
10379
10385
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10380
10386
|
entrySurface: this.options.entrySurface,
|
|
10381
10387
|
...this.state.sessionId ? { sessionId: this.state.sessionId } : {},
|
|
10382
|
-
pageOrigin:
|
|
10388
|
+
pageOrigin: ae().origin
|
|
10383
10389
|
}
|
|
10384
10390
|
};
|
|
10385
10391
|
this.authenticatedSocket === this.socket && this.sendNow(i) || (this.pendingWidgetLifecycleEvents.push(i), this.pendingWidgetLifecycleEvents.length > 20 && this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length - 20));
|
|
@@ -10398,12 +10404,12 @@ class Ht {
|
|
|
10398
10404
|
sessionId: this.getState().sessionId
|
|
10399
10405
|
});
|
|
10400
10406
|
a.mark("submit");
|
|
10401
|
-
const o =
|
|
10407
|
+
const o = vs(this.clientRuntime, this.modelClientScopeId, r), c = this.submissionIntentRevision, l = this.authenticatedUserId;
|
|
10402
10408
|
if (s.initiatedBy || this.startFirstResponseTimer(r, s.submittedAt), l || await a.measure("authentication", () => this.waitForAuthentication()), this.clientRuntime.isDisposed || c !== this.submissionIntentRevision || l && l !== this.authenticatedUserId) return null;
|
|
10403
|
-
|
|
10409
|
+
vs(this.clientRuntime, this.modelClientScopeId, r, o ?? null);
|
|
10404
10410
|
const d = this.clientRuntime.engine.getState().slices.conversation.submissions[r];
|
|
10405
10411
|
if (d && (d.content !== n || JSON.stringify(d.attachments.map((v) => v.sourceId)) !== JSON.stringify(i.map((v) => v.id ?? v.storageKey ?? v.sandboxPath)))) throw new Error("User-message identity cannot be reused with different input.");
|
|
10406
|
-
const u =
|
|
10412
|
+
const u = ae(), p = !d && !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== u.url, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
|
|
10407
10413
|
if (!m) throw new Error("Conversation selection is not initialized.");
|
|
10408
10414
|
d || await this.clientRuntime.engine.dispatch({
|
|
10409
10415
|
...this.directoryAuthority,
|
|
@@ -10436,7 +10442,7 @@ class Ht {
|
|
|
10436
10442
|
...s.proactiveSuggestionQuestion ? { proactiveSuggestionQuestion: s.proactiveSuggestionQuestion } : {},
|
|
10437
10443
|
metadata: { ...Ii(this.options.metadata), ...s.automationOnboarding ? { automationOnboarding: !0 } : {} }
|
|
10438
10444
|
})),
|
|
10439
|
-
invocation:
|
|
10445
|
+
invocation: Dd(s.invocation ?? s.initiatedBy),
|
|
10440
10446
|
entrySurface: this.options.entrySurface,
|
|
10441
10447
|
submittedAt: s.submittedAt ?? Date.now()
|
|
10442
10448
|
});
|
|
@@ -10458,7 +10464,7 @@ class Ht {
|
|
|
10458
10464
|
});
|
|
10459
10465
|
}
|
|
10460
10466
|
reportResponseVisibility(e) {
|
|
10461
|
-
|
|
10467
|
+
Ja(this, this.options.entrySurface, e);
|
|
10462
10468
|
}
|
|
10463
10469
|
reportInvalidStateTransition(e, s, n) {
|
|
10464
10470
|
n !== void 0 && !fn(n) || this.reportHealthSignal("invalid_state_transition", {
|
|
@@ -10484,7 +10490,7 @@ class Ht {
|
|
|
10484
10490
|
}
|
|
10485
10491
|
getModel() {
|
|
10486
10492
|
return this.clientRuntime.project("modelSelection", {
|
|
10487
|
-
core: () =>
|
|
10493
|
+
core: () => jc(this.clientRuntime, this.modelClientScopeId)
|
|
10488
10494
|
});
|
|
10489
10495
|
}
|
|
10490
10496
|
setModel(e) {
|
|
@@ -10496,8 +10502,8 @@ class Ht {
|
|
|
10496
10502
|
const s = this.clientRuntime.engine.getState().slices, n = s.directory.clients[this.modelClientScopeId], i = Ie(s.conversation, s.directory, n), r = Di(i, e);
|
|
10497
10503
|
if (!r) return !1;
|
|
10498
10504
|
if (r.type === "preparation") {
|
|
10499
|
-
const a = z(), o =
|
|
10500
|
-
return
|
|
10505
|
+
const a = z(), o = jo(r.submission);
|
|
10506
|
+
return vs(this.clientRuntime, this.modelClientScopeId, a, r.submission.requestedModel), this.sendMessage(o.content, { clientMessageId: a, attachments: o.attachments, proactiveSuggestionQuestion: o.proactiveSuggestionQuestion }).catch((c) => this.emit("error", Ge(c))), !0;
|
|
10501
10507
|
}
|
|
10502
10508
|
return r.type === "delivery" ? (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.submit", userMessageId: r.userMessageId, now: Date.now(), manualRetry: !0 }), !0) : (this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "conversation.operation", command: {
|
|
10503
10509
|
request_id: z(),
|
|
@@ -10510,19 +10516,19 @@ class Ht {
|
|
|
10510
10516
|
} }), !0);
|
|
10511
10517
|
}
|
|
10512
10518
|
createLocalAttachment(e) {
|
|
10513
|
-
this.options.productVariant === "customer_embedded" &&
|
|
10519
|
+
this.options.productVariant === "customer_embedded" && wl(e);
|
|
10514
10520
|
const s = z(), n = {
|
|
10515
10521
|
id: s,
|
|
10516
10522
|
name: e.name || "attachment",
|
|
10517
10523
|
mimeType: Er(e),
|
|
10518
10524
|
sizeBytes: e.size
|
|
10519
|
-
}, i = Date.now(), r =
|
|
10525
|
+
}, i = Date.now(), r = yc({
|
|
10520
10526
|
attachmentId: s,
|
|
10521
10527
|
name: n.name,
|
|
10522
10528
|
mimeType: n.mimeType,
|
|
10523
10529
|
sizeBytes: n.sizeBytes,
|
|
10524
10530
|
blob: e,
|
|
10525
|
-
origin:
|
|
10531
|
+
origin: ae().origin,
|
|
10526
10532
|
sessionId: this.state.sessionId ?? void 0,
|
|
10527
10533
|
createdAt: i,
|
|
10528
10534
|
lastUsedAt: i
|
|
@@ -10545,7 +10551,7 @@ class Ht {
|
|
|
10545
10551
|
conversationScopeId: o,
|
|
10546
10552
|
command: { request_id: c, type: "attachment.prepare", payload: {
|
|
10547
10553
|
source: { sourceId: r.id, name: r.name, mimeType: r.mimeType, sizeBytes: r.sizeBytes },
|
|
10548
|
-
context: JSON.parse(JSON.stringify({ page:
|
|
10554
|
+
context: JSON.parse(JSON.stringify({ page: ae(), metadata: Ii(this.options.metadata) })),
|
|
10549
10555
|
requestedModel: n ?? null,
|
|
10550
10556
|
entrySurface: this.options.entrySurface,
|
|
10551
10557
|
sessionId: this.getState().sessionId
|
|
@@ -10590,9 +10596,9 @@ class Ht {
|
|
|
10590
10596
|
});
|
|
10591
10597
|
};
|
|
10592
10598
|
let a = !1;
|
|
10593
|
-
return
|
|
10599
|
+
return Dl(async () => {
|
|
10594
10600
|
let o = await r(!1);
|
|
10595
|
-
if (i(), !o.ok &&
|
|
10601
|
+
if (i(), !o.ok && Bl(o.status) && this.options.tokenProvider && !a && (a = !0, o = await r(!0), i()), !o.ok) throw new Or("Failed to prepare attachment upload", o.status);
|
|
10596
10602
|
return await o.json();
|
|
10597
10603
|
}, "Failed to prepare attachment upload");
|
|
10598
10604
|
}
|
|
@@ -10633,7 +10639,7 @@ class Ht {
|
|
|
10633
10639
|
payload: {
|
|
10634
10640
|
sessionId: s.sessionId,
|
|
10635
10641
|
warmupId: this.activeComposerWarmupId,
|
|
10636
|
-
page:
|
|
10642
|
+
page: ae()
|
|
10637
10643
|
}
|
|
10638
10644
|
} }), this.activeComposerWarmupId = null, this.lastUserMessagePageUrl = null, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: null }), this.beginDirectoryProvisional();
|
|
10639
10645
|
}
|
|
@@ -10653,7 +10659,7 @@ class Ht {
|
|
|
10653
10659
|
}
|
|
10654
10660
|
getSessionHistoryState() {
|
|
10655
10661
|
return this.clientRuntime.project("directory", { core: () => {
|
|
10656
|
-
const e = this.clientRuntime.engine.getProjection().directory, s = e.queries[B(this.getDirectoryQuery())], n =
|
|
10662
|
+
const e = this.clientRuntime.engine.getProjection().directory, s = e.queries[B(this.getDirectoryQuery())], n = Es(this.options.entrySurface).map((d) => this.getDirectoryQuery(d)).map((d) => e.queries[B(d)]).filter((d) => d !== void 0), i = Object.values(e.optimisticEntries).reverse(), r = $a(n), a = new Set(i.flatMap((d) => d.sessionId ? [d.sessionId] : [])), o = [...i.map((d) => d.id), ...r.filter((d) => !a.has(d))], c = Object.fromEntries([
|
|
10657
10663
|
...i.map((d) => [d.id, {
|
|
10658
10664
|
id: d.id,
|
|
10659
10665
|
title: null,
|
|
@@ -10667,7 +10673,7 @@ class Ht {
|
|
|
10667
10673
|
isPinned: !1
|
|
10668
10674
|
}]),
|
|
10669
10675
|
...r.filter((d) => !a.has(d)).map((d) => [d, this.toSessionHistoryEntry(e.entities[d])])
|
|
10670
|
-
]), l =
|
|
10676
|
+
]), l = Fa(n);
|
|
10671
10677
|
return {
|
|
10672
10678
|
key: `${this.options.clientId}:recent`,
|
|
10673
10679
|
status: l?.status ?? "not_requested",
|
|
@@ -10683,7 +10689,7 @@ class Ht {
|
|
|
10683
10689
|
}
|
|
10684
10690
|
refreshSessionHistory() {
|
|
10685
10691
|
return this.clientRuntime.route("directory", { core: async () => {
|
|
10686
|
-
await Promise.all(
|
|
10692
|
+
await Promise.all(Es(this.options.entrySurface).map((e) => this.getDirectoryQuery(e)).map((e) => this.refreshDirectoryQuery(e, e.kind === "pinned")));
|
|
10687
10693
|
} });
|
|
10688
10694
|
}
|
|
10689
10695
|
loadMoreSessionHistory() {
|
|
@@ -10758,7 +10764,7 @@ class Ht {
|
|
|
10758
10764
|
}
|
|
10759
10765
|
getInteractions() {
|
|
10760
10766
|
const e = this.clientRuntime.engine.getState().slices;
|
|
10761
|
-
return
|
|
10767
|
+
return ro(e, e.conversation, e.directory, this.modelClientScopeId);
|
|
10762
10768
|
}
|
|
10763
10769
|
subscribeInteractions(e) {
|
|
10764
10770
|
return this.interactionListeners.add(e), e(this.getInteractions()), () => this.interactionListeners.delete(e);
|
|
@@ -10767,7 +10773,7 @@ class Ht {
|
|
|
10767
10773
|
const r = this.clientRuntime.engine.getState().slices.account.authority;
|
|
10768
10774
|
if (!r) throw new Error("Product Agent is not authenticated.");
|
|
10769
10775
|
const a = this.getInteractions().find((l) => l.id === e), o = i.expectedSourceVersion === void 0 ? a?.sourceVersion ?? null : i.expectedSourceVersion, c = crypto.randomUUID();
|
|
10770
|
-
await
|
|
10776
|
+
await io(this.clientRuntime, {
|
|
10771
10777
|
clientScopeId: this.modelClientScopeId,
|
|
10772
10778
|
interactionId: e,
|
|
10773
10779
|
action: s,
|
|
@@ -10801,7 +10807,7 @@ class Ht {
|
|
|
10801
10807
|
for (const e of this.accountListeners) e(this.getAccount());
|
|
10802
10808
|
}
|
|
10803
10809
|
getAccount() {
|
|
10804
|
-
return
|
|
10810
|
+
return ao(this.clientRuntime.engine.getState().slices.account, this.state.sessionId);
|
|
10805
10811
|
}
|
|
10806
10812
|
subscribeAccount(e) {
|
|
10807
10813
|
return this.accountListeners.add(e), e(this.getAccount()), () => this.accountListeners.delete(e);
|
|
@@ -10827,11 +10833,11 @@ class Ht {
|
|
|
10827
10833
|
if (!n() || !i) return;
|
|
10828
10834
|
this.clientRuntime.engine.getState().slices.account.authority || this.applyAuthenticatedDirectoryIdentity(i.user);
|
|
10829
10835
|
}
|
|
10830
|
-
await
|
|
10836
|
+
await rs(this.clientRuntime, { kind: "account" });
|
|
10831
10837
|
}
|
|
10832
10838
|
}
|
|
10833
10839
|
installFeaturePorts() {
|
|
10834
|
-
const e =
|
|
10840
|
+
const e = eo(() => Date.now());
|
|
10835
10841
|
let s = !1, n = !1;
|
|
10836
10842
|
const i = () => {
|
|
10837
10843
|
const d = this.options.runtimeAdapters?.featurePermissions, u = this.clientRuntime.engine.getState().slices.account.authority;
|
|
@@ -10869,14 +10875,14 @@ class Ht {
|
|
|
10869
10875
|
}).finally(() => {
|
|
10870
10876
|
s = !1, n && (n = !1, i());
|
|
10871
10877
|
});
|
|
10872
|
-
}, r =
|
|
10878
|
+
}, r = Zr({
|
|
10873
10879
|
http: this.directoryHttp,
|
|
10874
10880
|
now: () => Date.now(),
|
|
10875
10881
|
authority: () => this.clientRuntime.engine.getState().slices.account.authority,
|
|
10876
10882
|
readAccount: async (d) => {
|
|
10877
10883
|
const u = this.clientRuntime.engine.getState().slices.account, p = this.options.accountLoader ? await this.options.accountLoader() : u.refusal ? null : this.options.initialAccount;
|
|
10878
10884
|
if (!p) throw new Error("Account information is unavailable.");
|
|
10879
|
-
return i(),
|
|
10885
|
+
return i(), oo(p, {
|
|
10880
10886
|
id: d.userId,
|
|
10881
10887
|
email: this.state.user?.email ?? null,
|
|
10882
10888
|
name: this.state.user?.name ?? null,
|
|
@@ -10885,7 +10891,7 @@ class Ht {
|
|
|
10885
10891
|
},
|
|
10886
10892
|
embedded: {
|
|
10887
10893
|
appearance: async (d) => {
|
|
10888
|
-
const u = await this.directoryHttp.request("/bootstrap", { page_url: d.pageUrl }, void 0, "GET", "embed"), p =
|
|
10894
|
+
const u = await this.directoryHttp.request("/bootstrap", { page_url: d.pageUrl }, void 0, "GET", "embed"), p = Gd(u);
|
|
10889
10895
|
return { kind: "appearance", origin: d.origin, value: p ? { accent: p.accentColor ?? "#7c3aed", colorScheme: p.colorScheme ?? "light", fontFamily: p.fontFamily ?? "inherit", scribbleStyle: p.scribbleStyle ?? !1 } : null };
|
|
10890
10896
|
},
|
|
10891
10897
|
feedback: async (d) => (await this.directoryHttp.request("/feedback", {}, { message: d }, "POST", "embed")).success
|
|
@@ -10941,10 +10947,10 @@ class Ht {
|
|
|
10941
10947
|
const d = this.clientRuntime.engine.getState().slices, p = d.directory.selections[d.directory.clients[this.modelClientScopeId]]?.sessionId, g = JSON.stringify([p, p ? d.conversation.sessions[p]?.execution : null]);
|
|
10942
10948
|
g !== a && (a = g, i());
|
|
10943
10949
|
}), c = this.options.runtimeAdapters?.featurePermissions?.subscribe?.(i);
|
|
10944
|
-
this.clientRuntime.onDispose(() => c?.()),
|
|
10950
|
+
this.clientRuntime.onDispose(() => c?.()), to(this.clientRuntime, () => Date.now());
|
|
10945
10951
|
const l = () => {
|
|
10946
10952
|
const d = this.clientRuntime.engine.getState().slices.account.authority;
|
|
10947
|
-
d?.profile === "main_web_chat" && this.options.entrySurface === "main_web_chat" && this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: d, now: Date.now(), hints:
|
|
10953
|
+
d?.profile === "main_web_chat" && this.options.entrySurface === "main_web_chat" && this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: d, now: Date.now(), hints: Ms(localStorage) });
|
|
10948
10954
|
};
|
|
10949
10955
|
window.addEventListener("storage", l), this.clientRuntime.onDispose(() => window.removeEventListener("storage", l)), this.clientRuntime.onDispose(() => {
|
|
10950
10956
|
e.dispose(), o(), this.options.runtimeAdapters?.featurePermissions?.dispose?.();
|
|
@@ -10961,7 +10967,7 @@ class Ht {
|
|
|
10961
10967
|
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.stopConversation("session_switch"), this.retainNavigatedConversation();
|
|
10962
10968
|
const n = "conversation:" + this.modelClientScopeId + ":" + z();
|
|
10963
10969
|
this.directoryConversationScopeId = n, this.lastUserMessagePageUrl = null, this.clientRuntime.engine.dispatch({ type: "model.scope_navigate", clientScopeId: this.modelClientScopeId, sessionId: e }), this.directoryScope.bind(this.modelClientScopeId, this.directoryConversationScopeId, e).then(async () => {
|
|
10964
|
-
await this.directoryScope.persist(), this.state.sessionId === e && (s.intents[e]?.observe && this.conversationObservation?.refresh(e).catch((i) => this.handleDirectoryTransportError(i)), this.send({ type: "page.upsert", sessionId: e, page:
|
|
10970
|
+
await this.directoryScope.persist(), this.state.sessionId === e && (s.intents[e]?.observe && this.conversationObservation?.refresh(e).catch((i) => this.handleDirectoryTransportError(i)), this.send({ type: "page.upsert", sessionId: e, page: ae(), model: this.getModel() }));
|
|
10965
10971
|
});
|
|
10966
10972
|
}
|
|
10967
10973
|
send(e) {
|
|
@@ -10979,7 +10985,7 @@ class Ht {
|
|
|
10979
10985
|
})), !0;
|
|
10980
10986
|
}
|
|
10981
10987
|
try {
|
|
10982
|
-
return s.send(JSON.stringify(e)), xe("client_event", e.type,
|
|
10988
|
+
return s.send(JSON.stringify(e)), xe("client_event", e.type, _s(e)), !0;
|
|
10983
10989
|
} catch (n) {
|
|
10984
10990
|
return V("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
10985
10991
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -10992,7 +10998,7 @@ class Ht {
|
|
|
10992
10998
|
let n = this.getState();
|
|
10993
10999
|
if (e === "first_response_slow" && s.sessionId && s.sessionId !== n.sessionId) {
|
|
10994
11000
|
const { conversation: m, directory: f } = this.clientRuntime.engine.getState().slices, v = Object.values(f.clients).find((I) => f.selections[I]?.sessionId === s.sessionId);
|
|
10995
|
-
v && (n = { ...n, ...
|
|
11001
|
+
v && (n = { ...n, ...cs(
|
|
10996
11002
|
Ie(m, f, v),
|
|
10997
11003
|
m.sessions[s.sessionId]?.queries.current,
|
|
10998
11004
|
this.options.backendUrl
|
|
@@ -11012,7 +11018,7 @@ class Ht {
|
|
|
11012
11018
|
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11013
11019
|
source: "web_sdk",
|
|
11014
11020
|
entrySurface: this.options.entrySurface,
|
|
11015
|
-
...e === "first_response_slow" ? { responseDiagnostics:
|
|
11021
|
+
...e === "first_response_slow" ? { responseDiagnostics: Xa(
|
|
11016
11022
|
this,
|
|
11017
11023
|
this.options.entrySurface,
|
|
11018
11024
|
n.sessionId,
|
|
@@ -11058,7 +11064,7 @@ class Ht {
|
|
|
11058
11064
|
missedResponseChecks: n,
|
|
11059
11065
|
timer: window.setTimeout(() => this.recordFirstResponseMiss(e), Math.max(
|
|
11060
11066
|
0,
|
|
11061
|
-
i + (n + 1) *
|
|
11067
|
+
i + (n + 1) * Ss - Date.now()
|
|
11062
11068
|
))
|
|
11063
11069
|
});
|
|
11064
11070
|
}
|
|
@@ -11068,13 +11074,13 @@ class Ht {
|
|
|
11068
11074
|
return;
|
|
11069
11075
|
const n = Date.now() - s.submittedAt;
|
|
11070
11076
|
if (s.missedResponseChecks = Math.min(
|
|
11071
|
-
|
|
11072
|
-
Math.max(s.missedResponseChecks + 1, Math.floor(n /
|
|
11073
|
-
), s.missedResponseChecks >=
|
|
11077
|
+
ks,
|
|
11078
|
+
Math.max(s.missedResponseChecks + 1, Math.floor(n / Ss))
|
|
11079
|
+
), s.missedResponseChecks >= ks) {
|
|
11074
11080
|
this.reportFirstResponseSlow(e);
|
|
11075
11081
|
return;
|
|
11076
11082
|
}
|
|
11077
|
-
const i = s.submittedAt + (s.missedResponseChecks + 1) *
|
|
11083
|
+
const i = s.submittedAt + (s.missedResponseChecks + 1) * Ss;
|
|
11078
11084
|
s.timer = window.setTimeout(
|
|
11079
11085
|
() => this.recordFirstResponseMiss(e),
|
|
11080
11086
|
Math.max(0, i - Date.now())
|
|
@@ -11082,7 +11088,7 @@ class Ht {
|
|
|
11082
11088
|
}
|
|
11083
11089
|
reportFirstResponseSlow(e) {
|
|
11084
11090
|
const s = this.firstResponseTimersByClientMessageId.get(e);
|
|
11085
|
-
s && (s.missedResponseChecks =
|
|
11091
|
+
s && (s.missedResponseChecks = ks, window.clearTimeout(s.timer), this.reportHealthSignal("first_response_slow", {
|
|
11086
11092
|
...s.sessionId ? { sessionId: s.sessionId } : {},
|
|
11087
11093
|
clientMessageId: e,
|
|
11088
11094
|
durationMs: Date.now() - s.submittedAt,
|
|
@@ -11119,7 +11125,7 @@ class Ht {
|
|
|
11119
11125
|
occurrenceCount: (o?.occurrenceCount ?? 0) + 1,
|
|
11120
11126
|
maxReconnectAttempt: Math.max(o?.maxReconnectAttempt ?? 0, this.reconnectAttempts),
|
|
11121
11127
|
connectivity: n,
|
|
11122
|
-
sdkVersion:
|
|
11128
|
+
sdkVersion: Bt.version,
|
|
11123
11129
|
stage: "socket_admission",
|
|
11124
11130
|
...s,
|
|
11125
11131
|
connectionAttemptId: i
|
|
@@ -11204,8 +11210,8 @@ class Ht {
|
|
|
11204
11210
|
}, 3e4));
|
|
11205
11211
|
}
|
|
11206
11212
|
requestTransientStarterPrompts() {
|
|
11207
|
-
const e = ne(
|
|
11208
|
-
return
|
|
11213
|
+
const e = ne(Nd());
|
|
11214
|
+
return no(this.clientRuntime, {
|
|
11209
11215
|
kind: "generatePrompts",
|
|
11210
11216
|
page: { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: e.pageUrl },
|
|
11211
11217
|
htmlContent: e.htmlContent,
|
|
@@ -11214,21 +11220,21 @@ class Ht {
|
|
|
11214
11220
|
});
|
|
11215
11221
|
}
|
|
11216
11222
|
startStarterPromptUrlWatcher() {
|
|
11217
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
11223
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = jd(() => this.handleStarterPromptUrlChange()));
|
|
11218
11224
|
}
|
|
11219
11225
|
handleStarterPromptUrlChange() {
|
|
11220
11226
|
const e = location.href;
|
|
11221
11227
|
e !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
11222
11228
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl().catch(() => {
|
|
11223
11229
|
});
|
|
11224
|
-
},
|
|
11230
|
+
}, gd));
|
|
11225
11231
|
}
|
|
11226
11232
|
refreshStarterPromptsForCurrentUrl() {
|
|
11227
11233
|
if (!this.clientRuntime.engine.getState().slices.account.authority || this.state.status === "closed") return Promise.resolve();
|
|
11228
11234
|
const e = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href };
|
|
11229
11235
|
return Promise.all([
|
|
11230
|
-
|
|
11231
|
-
|
|
11236
|
+
rs(this.clientRuntime, { kind: "appearance", ...e }),
|
|
11237
|
+
rs(this.clientRuntime, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (s) => {
|
|
11232
11238
|
s.kind === "starterPrompts" && s.prompts.length === 0 && location.href === e.pageUrl && await this.requestTransientStarterPrompts();
|
|
11233
11239
|
})
|
|
11234
11240
|
]).then(() => {
|
|
@@ -11254,7 +11260,7 @@ class Ht {
|
|
|
11254
11260
|
const s = ki(e);
|
|
11255
11261
|
if (!s) return !1;
|
|
11256
11262
|
const n = vt(e, "runtimeCommunityId") ?? this.directoryHttp.auth.community_id, i = `${this.options.clientId}:${s.id}:${n ?? this.options.productVariant}`, r = this.directoryAuthority.authorityId !== i, a = this.authenticatedUserId === null, o = a ? Object.values(this.clientRuntime.engine.getState().slices.conversation.operations).filter((d) => ["waiting", "running", "uncertain"].includes(d.phase) && (d.command.type === "run.stop" || d.command.type === "session.reset")).map((d) => d.command) : [], c = a && this.directoryAuthority.authorityId === `${this.options.clientId}:${this.options.runtimeCommunityId ?? this.options.productVariant}` ? this.state.sessionId : null;
|
|
11257
|
-
if (this.authenticatedUserId = s.id, this.directoryHttp.auth.community_id = n,
|
|
11263
|
+
if (this.authenticatedUserId = s.id, this.directoryHttp.auth.community_id = n, Mo(this.options.clientId, i), r) {
|
|
11258
11264
|
const d = this.directoryAuthority;
|
|
11259
11265
|
this.directoryObservation.dispose(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.directoryAuthority = { authorityId: i, generation: d.generation + 1 }, this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "directory.authority_replace", expectedGeneration: d.generation }), this.createDirectoryAdapters();
|
|
11260
11266
|
const u = this.getModel();
|
|
@@ -11271,8 +11277,8 @@ class Ht {
|
|
|
11271
11277
|
personalChannel: !!this.options.runtimeAdapters?.personalChannelConnectionHandler
|
|
11272
11278
|
}
|
|
11273
11279
|
};
|
|
11274
|
-
if (
|
|
11275
|
-
this.options.entrySurface === "main_web_chat" && l.profile === "main_web_chat" && await this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: l, now: Date.now(), hints:
|
|
11280
|
+
if (so(this.clientRuntime, l, Date.now()).then(async () => {
|
|
11281
|
+
this.options.entrySurface === "main_web_chat" && l.profile === "main_web_chat" && await this.clientRuntime.engine.dispatch({ type: "stage7.device_hints", authority: l, now: Date.now(), hints: Ms(localStorage) }), await this.refreshStarterPromptsForCurrentUrl();
|
|
11276
11282
|
}).catch(() => {
|
|
11277
11283
|
}), r || a) {
|
|
11278
11284
|
const d = this.directoryAuthority;
|
|
@@ -11324,7 +11330,7 @@ class Ht {
|
|
|
11324
11330
|
}
|
|
11325
11331
|
}
|
|
11326
11332
|
handleServerEvent(e) {
|
|
11327
|
-
if (xe("server_event", e.type,
|
|
11333
|
+
if (xe("server_event", e.type, _s(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
|
|
11328
11334
|
this.conversationObservation?.receive(e);
|
|
11329
11335
|
return;
|
|
11330
11336
|
}
|
|
@@ -11336,7 +11342,7 @@ class Ht {
|
|
|
11336
11342
|
this.clearSocketAuthTimer(), this.clearEmbeddedRecoveryBudget(), this.rejectedDiagnosticsToken = null, this.clientDiagnosticsRetryTimer !== null && window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null, this.options.productVariant === "customer_embedded" && (this.pendingTransportDiagnostics.length > 0 || this.state.lastErrorCode === "connection_failed") && this.reportTransportDiagnostic("ready_applied", { recoveryOutcome: "recovered", stage: "bootstrap" }), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear(), this.flushClientDiagnostics();
|
|
11337
11343
|
const s = ki(e.user);
|
|
11338
11344
|
this.applyAuthenticatedDirectoryIdentity(e.user), this.authenticatedSocket = this.socket, this.directoryObservation.reconnect().catch(() => {
|
|
11339
|
-
}), this.conversationObservation?.wake(), this.flushPendingWidgetLifecycleEvents(), this.flushQueuedClientEvents(), this.startHeartbeat(), this.runtimeHelperJavascript =
|
|
11345
|
+
}), this.conversationObservation?.wake(), this.flushPendingWidgetLifecycleEvents(), this.flushQueuedClientEvents(), this.startHeartbeat(), this.runtimeHelperJavascript = Jd(e.runtimeHelpers)?.javascript ?? null;
|
|
11340
11346
|
const n = {
|
|
11341
11347
|
user: s,
|
|
11342
11348
|
status: "connected",
|
|
@@ -11350,7 +11356,7 @@ class Ht {
|
|
|
11350
11356
|
}), this.state.sessionId && this.send({
|
|
11351
11357
|
type: "page.upsert",
|
|
11352
11358
|
sessionId: this.state.sessionId,
|
|
11353
|
-
page:
|
|
11359
|
+
page: ae(),
|
|
11354
11360
|
model: _n(this.clientRuntime, this.modelClientScopeId).selectedModel
|
|
11355
11361
|
});
|
|
11356
11362
|
return;
|
|
@@ -11360,11 +11366,11 @@ class Ht {
|
|
|
11360
11366
|
return;
|
|
11361
11367
|
}
|
|
11362
11368
|
if (e.type === "conversation.routing") {
|
|
11363
|
-
e.sessionId === this.state.sessionId &&
|
|
11369
|
+
e.sessionId === this.state.sessionId && bs(this.clientRuntime, this.modelClientScopeId, String(e.sessionId), e.turns);
|
|
11364
11370
|
return;
|
|
11365
11371
|
}
|
|
11366
11372
|
if (e.type === "session.updated" || e.type === "conversation.state") {
|
|
11367
|
-
vt(e.session, "id") === this.state.sessionId && (this.updatePersonalModelFromSession(e.session), this.updateAccountFallbackFromSession(e.session),
|
|
11373
|
+
vt(e.session, "id") === this.state.sessionId && (this.updatePersonalModelFromSession(e.session), this.updateAccountFallbackFromSession(e.session), bs(this.clientRuntime, this.modelClientScopeId, this.state.sessionId, e.turns));
|
|
11368
11374
|
return;
|
|
11369
11375
|
}
|
|
11370
11376
|
if (e.type === "tool.call")
|
|
@@ -11449,7 +11455,7 @@ class Ht {
|
|
|
11449
11455
|
authority: n,
|
|
11450
11456
|
now: Date.now(),
|
|
11451
11457
|
sessionId: s,
|
|
11452
|
-
enabled:
|
|
11458
|
+
enabled: Fo(e.metadata)
|
|
11453
11459
|
});
|
|
11454
11460
|
}
|
|
11455
11461
|
async executeToolCall(e) {
|
|
@@ -11465,7 +11471,7 @@ class Ht {
|
|
|
11465
11471
|
}
|
|
11466
11472
|
if (this.activeBrowserToolCalls.has(n)) return;
|
|
11467
11473
|
const c = i === "execute_code", l = i === "execute_code_in_browser_tab" && a !== null && typeof a == "object" && a.tabId === "local:current";
|
|
11468
|
-
if (!c && !l || !
|
|
11474
|
+
if (!c && !l || !Al(a)) {
|
|
11469
11475
|
this.send({
|
|
11470
11476
|
type: "tool.result",
|
|
11471
11477
|
sessionId: s,
|
|
@@ -11514,7 +11520,7 @@ class Ht {
|
|
|
11514
11520
|
let d = null, u;
|
|
11515
11521
|
d = await this.executeRuntimeHelper(), u = await wi(
|
|
11516
11522
|
a,
|
|
11517
|
-
|
|
11523
|
+
xd(e.runtimeContext, this.options.backendUrl)
|
|
11518
11524
|
).catch((p) => ({
|
|
11519
11525
|
ok: !1,
|
|
11520
11526
|
exception: {
|
|
@@ -11527,7 +11533,7 @@ class Ht {
|
|
|
11527
11533
|
toolName: i,
|
|
11528
11534
|
summary: a.summary,
|
|
11529
11535
|
rawInput: ne(a),
|
|
11530
|
-
rawOutput: ne(
|
|
11536
|
+
rawOutput: ne(Qd(u, d))
|
|
11531
11537
|
}), Ai(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
11532
11538
|
}
|
|
11533
11539
|
startPageLifecycleRecovery() {
|
|
@@ -11541,10 +11547,10 @@ class Ht {
|
|
|
11541
11547
|
};
|
|
11542
11548
|
}
|
|
11543
11549
|
installSessionBrowserApis() {
|
|
11544
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
11550
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = _d();
|
|
11545
11551
|
}
|
|
11546
11552
|
cleanupSessionBrowserApis() {
|
|
11547
|
-
this.sessionBrowserApisCleanup && (
|
|
11553
|
+
this.sessionBrowserApisCleanup && (Cd(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
11548
11554
|
}
|
|
11549
11555
|
async executeRuntimeHelper() {
|
|
11550
11556
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -11552,24 +11558,24 @@ class Ht {
|
|
|
11552
11558
|
const e = await wi({
|
|
11553
11559
|
javascript: this.runtimeHelperJavascript
|
|
11554
11560
|
});
|
|
11555
|
-
return e.ok === !1 ?
|
|
11561
|
+
return e.ok === !1 ? Xd(e) : null;
|
|
11556
11562
|
}
|
|
11557
11563
|
enableNetworkCapture() {
|
|
11558
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
11559
|
-
|
|
11564
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = vd((e) => {
|
|
11565
|
+
xl(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
11560
11566
|
}));
|
|
11561
11567
|
}
|
|
11562
11568
|
enqueueNetworkEvent(e) {
|
|
11563
|
-
this.queuedNetworkEvents.length >=
|
|
11569
|
+
this.queuedNetworkEvents.length >= dd || (this.queuedNetworkEvents.push(Ol(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
11564
11570
|
this.networkBatchTimer = null;
|
|
11565
11571
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
11566
11572
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
11567
11573
|
type: "network.batch",
|
|
11568
11574
|
sessionId: this.state.sessionId ?? void 0,
|
|
11569
|
-
page:
|
|
11575
|
+
page: ae(),
|
|
11570
11576
|
events: s
|
|
11571
11577
|
});
|
|
11572
|
-
},
|
|
11578
|
+
}, cd)));
|
|
11573
11579
|
}
|
|
11574
11580
|
startEmbeddedRecoveryBudget() {
|
|
11575
11581
|
if (this.options.productVariant !== "customer_embedded" || this.embeddedRecoveryTimer !== null || this.authenticationFailure) return;
|
|
@@ -11591,7 +11597,7 @@ class Ht {
|
|
|
11591
11597
|
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null;
|
|
11592
11598
|
}
|
|
11593
11599
|
connectionFailureDiagnostic(e, s) {
|
|
11594
|
-
const n = e instanceof ue ? e.status : e instanceof A && e.code === "unauthorized" ? 401 : e instanceof A && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, i = n !== void 0 && Number.isInteger(n) && n >= 400 && n <= 599 ? n : void 0, a = !(e instanceof A && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) &&
|
|
11600
|
+
const n = e instanceof ue ? e.status : e instanceof A && e.code === "unauthorized" ? 401 : e instanceof A && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, i = n !== void 0 && Number.isInteger(n) && n >= 400 && n <= 599 ? n : void 0, a = !(e instanceof A && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && As(e) && i !== 401 && i !== 403;
|
|
11595
11601
|
return {
|
|
11596
11602
|
stage: s,
|
|
11597
11603
|
...i !== void 0 ? { httpStatus: i } : {},
|
|
@@ -11604,7 +11610,7 @@ class Ht {
|
|
|
11604
11610
|
return;
|
|
11605
11611
|
const s = Math.min(
|
|
11606
11612
|
on,
|
|
11607
|
-
Math.max(
|
|
11613
|
+
Math.max(md(this.reconnectAttempts), e)
|
|
11608
11614
|
);
|
|
11609
11615
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
11610
11616
|
this.reconnectTimer = null, (this.refreshingDefaultCredentials && this.socket instanceof L ? this.refreshDefaultTransportCredentials(this.socket) : this.connect()).catch((i) => {
|
|
@@ -11704,7 +11710,7 @@ class Ht {
|
|
|
11704
11710
|
this.directoryHttp.auth.token = c, a = "bootstrap", this.lastRecoveryStage = a, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", r);
|
|
11705
11711
|
})().catch((c) => {
|
|
11706
11712
|
if (this.socket !== e || this.state.status === "closed") throw c;
|
|
11707
|
-
if (this.reportTransportDiagnostic("auth_refresh_failed", { ...r, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Ge(c), c instanceof A && ["unauthorized", "403", "update_required"].includes(c.code) || !
|
|
11713
|
+
if (this.reportTransportDiagnostic("auth_refresh_failed", { ...r, ...this.connectionFailureDiagnostic(c, a) }), this.credentialRecoveryFailure = Ge(c), c instanceof A && ["unauthorized", "403", "update_required"].includes(c.code) || !As(c)) {
|
|
11708
11714
|
const l = c instanceof A ? c : new A(c instanceof ue ? c.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
|
|
11709
11715
|
throw this.stopAuthentication(l), l;
|
|
11710
11716
|
}
|
|
@@ -11726,8 +11732,8 @@ class Ht {
|
|
|
11726
11732
|
const e = this.socket;
|
|
11727
11733
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
11728
11734
|
this.socket === e && (V("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
11729
|
-
},
|
|
11730
|
-
},
|
|
11735
|
+
}, sd));
|
|
11736
|
+
}, td));
|
|
11731
11737
|
}
|
|
11732
11738
|
stopHeartbeat() {
|
|
11733
11739
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -11762,14 +11768,14 @@ class Ht {
|
|
|
11762
11768
|
this.listeners[e]?.forEach((i) => i(s));
|
|
11763
11769
|
}
|
|
11764
11770
|
}
|
|
11765
|
-
const
|
|
11766
|
-
function
|
|
11767
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
11771
|
+
const Ts = /* @__PURE__ */ new WeakMap();
|
|
11772
|
+
function vd(t) {
|
|
11773
|
+
const e = window.__plunoProductAgentNetworkCapture ?? bd();
|
|
11768
11774
|
return e.subscribers.add(t), () => {
|
|
11769
11775
|
e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
11770
11776
|
};
|
|
11771
11777
|
}
|
|
11772
|
-
function
|
|
11778
|
+
function bd() {
|
|
11773
11779
|
const t = /* @__PURE__ */ new Set(), e = (p) => {
|
|
11774
11780
|
t.forEach((g) => {
|
|
11775
11781
|
try {
|
|
@@ -11786,11 +11792,11 @@ function vd() {
|
|
|
11786
11792
|
throw I;
|
|
11787
11793
|
}
|
|
11788
11794
|
try {
|
|
11789
|
-
const I = g instanceof Request ? g : null, _ =
|
|
11795
|
+
const I = g instanceof Request ? g : null, _ = El(g, I), S = qr(m?.headers ?? I?.headers);
|
|
11790
11796
|
if (!Me(_, S, m?.body)) {
|
|
11791
11797
|
const b = {
|
|
11792
|
-
requestId:
|
|
11793
|
-
url: ge(_,
|
|
11798
|
+
requestId: Cs("fetch"),
|
|
11799
|
+
url: ge(_, Rs),
|
|
11794
11800
|
method: (m?.method ?? I?.method ?? "GET").toUpperCase(),
|
|
11795
11801
|
requestHeaders: S,
|
|
11796
11802
|
requestBody: Ti(m?.body),
|
|
@@ -11799,7 +11805,7 @@ function vd() {
|
|
|
11799
11805
|
};
|
|
11800
11806
|
v.then(
|
|
11801
11807
|
(y) => {
|
|
11802
|
-
|
|
11808
|
+
Tl(y, b, f, e).catch(() => {
|
|
11803
11809
|
e({
|
|
11804
11810
|
...b,
|
|
11805
11811
|
responseStatus: y.status,
|
|
@@ -11821,27 +11827,27 @@ function vd() {
|
|
|
11821
11827
|
return v;
|
|
11822
11828
|
}, o = function(g, m, f, v, I) {
|
|
11823
11829
|
const _ = n.call(this, g, m, f ?? !0, v ?? void 0, I ?? void 0), S = typeof m == "string" ? m : m.toString();
|
|
11824
|
-
return
|
|
11825
|
-
requestId:
|
|
11830
|
+
return Ts.set(this, {
|
|
11831
|
+
requestId: Cs("xhr"),
|
|
11826
11832
|
method: String(g ?? "GET").toUpperCase(),
|
|
11827
|
-
url: ge(S,
|
|
11833
|
+
url: ge(S, Rs),
|
|
11828
11834
|
requestHeaders: {},
|
|
11829
11835
|
startedAtMs: Date.now(),
|
|
11830
11836
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
11831
11837
|
excluded: Me(S)
|
|
11832
11838
|
}), _;
|
|
11833
11839
|
}, c = function(g, m) {
|
|
11834
|
-
const f = i.call(this, g, m), v =
|
|
11840
|
+
const f = i.call(this, g, m), v = Ts.get(this);
|
|
11835
11841
|
return v && Object.keys(v.requestHeaders).length < kn && (v.requestHeaders[g] = Tn(g, m), v.excluded = v.excluded || Me(v.url, v.requestHeaders)), f;
|
|
11836
11842
|
}, l = function(g) {
|
|
11837
11843
|
try {
|
|
11838
|
-
const m =
|
|
11844
|
+
const m = Ts.get(this);
|
|
11839
11845
|
m && (m.excluded = m.excluded || Me(m.url, m.requestHeaders, g), m.requestBody = Ti(g), m.excluded || this.addEventListener(
|
|
11840
11846
|
"loadend",
|
|
11841
11847
|
() => {
|
|
11842
11848
|
queueMicrotask(() => {
|
|
11843
11849
|
try {
|
|
11844
|
-
const f =
|
|
11850
|
+
const f = Pl(this.getAllResponseHeaders());
|
|
11845
11851
|
e({
|
|
11846
11852
|
requestId: m.requestId,
|
|
11847
11853
|
url: m.url,
|
|
@@ -11851,7 +11857,7 @@ function vd() {
|
|
|
11851
11857
|
resourceType: "xhr",
|
|
11852
11858
|
responseStatus: this.status,
|
|
11853
11859
|
responseHeaders: f,
|
|
11854
|
-
responseBody:
|
|
11860
|
+
responseBody: Cl(this, f),
|
|
11855
11861
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
11856
11862
|
startedAt: m.startedAt,
|
|
11857
11863
|
durationMs: Date.now() - m.startedAtMs
|
|
@@ -11892,8 +11898,8 @@ function vd() {
|
|
|
11892
11898
|
continue;
|
|
11893
11899
|
const f = performance.timeOrigin + m.startTime;
|
|
11894
11900
|
e({
|
|
11895
|
-
requestId:
|
|
11896
|
-
url: ge(m.name,
|
|
11901
|
+
requestId: Cs("resource"),
|
|
11902
|
+
url: ge(m.name, Rs),
|
|
11897
11903
|
method: "GET",
|
|
11898
11904
|
resourceType: "resource",
|
|
11899
11905
|
responseStatus: m.responseStatus,
|
|
@@ -11947,27 +11953,27 @@ function Ii(t) {
|
|
|
11947
11953
|
const e = typeof t == "function" ? t() : t;
|
|
11948
11954
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
11949
11955
|
}
|
|
11950
|
-
const
|
|
11951
|
-
function
|
|
11956
|
+
const Id = 5e3, wd = 12e4;
|
|
11957
|
+
function _d() {
|
|
11952
11958
|
const t = [
|
|
11953
|
-
|
|
11954
|
-
|
|
11959
|
+
kd(),
|
|
11960
|
+
Sd()
|
|
11955
11961
|
].filter((e) => typeof e == "function");
|
|
11956
11962
|
return () => {
|
|
11957
11963
|
for (const e of t.reverse())
|
|
11958
11964
|
e();
|
|
11959
11965
|
};
|
|
11960
11966
|
}
|
|
11961
|
-
function
|
|
11967
|
+
function Sd() {
|
|
11962
11968
|
return hr(globalThis, "getPageSnapshot", async () => Rn());
|
|
11963
11969
|
}
|
|
11964
|
-
function
|
|
11970
|
+
function kd() {
|
|
11965
11971
|
return hr(globalThis, "pageImages", {
|
|
11966
|
-
inspectImage: async (e, s) => await
|
|
11972
|
+
inspectImage: async (e, s) => await Rd(e, s)
|
|
11967
11973
|
});
|
|
11968
11974
|
}
|
|
11969
|
-
async function
|
|
11970
|
-
const s =
|
|
11975
|
+
async function Rd(t, e = {}) {
|
|
11976
|
+
const s = qd(e.name), n = await Ad(t);
|
|
11971
11977
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
11972
11978
|
type: "pluno.pageImages.inspectImage",
|
|
11973
11979
|
imageAttached: !1,
|
|
@@ -11985,15 +11991,15 @@ async function kd(t, e = {}) {
|
|
|
11985
11991
|
imageAttachmentError: n.error
|
|
11986
11992
|
};
|
|
11987
11993
|
}
|
|
11988
|
-
async function
|
|
11994
|
+
async function Ad(t) {
|
|
11989
11995
|
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: br } : {
|
|
11990
11996
|
ok: !0,
|
|
11991
11997
|
mimeType: t.type,
|
|
11992
11998
|
sizeBytes: t.size,
|
|
11993
|
-
dataUrl: await
|
|
11994
|
-
} : { 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." } :
|
|
11999
|
+
dataUrl: await Od(t)
|
|
12000
|
+
} : { 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." } : Ed(t);
|
|
11995
12001
|
}
|
|
11996
|
-
function
|
|
12002
|
+
function Ed(t) {
|
|
11997
12003
|
if (!t.startsWith("data:") || !t.includes(","))
|
|
11998
12004
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
11999
12005
|
const [e, s] = t.slice(5).split(",", 2), n = e.split(";").map((o) => o.trim()).filter(Boolean), i = n[0] ?? "";
|
|
@@ -12004,7 +12010,7 @@ function Ad(t) {
|
|
|
12004
12010
|
const r = s.replace(/[ \t\r\n\f]+/g, "");
|
|
12005
12011
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
12006
12012
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
12007
|
-
const a =
|
|
12013
|
+
const a = Td(r);
|
|
12008
12014
|
return a === null ? { ok: !1, error: "Page image data URL has invalid base64." } : a === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
12009
12015
|
ok: !0,
|
|
12010
12016
|
mimeType: i,
|
|
@@ -12012,22 +12018,22 @@ function Ad(t) {
|
|
|
12012
12018
|
dataUrl: `data:${i};base64,${r}`
|
|
12013
12019
|
};
|
|
12014
12020
|
}
|
|
12015
|
-
function
|
|
12021
|
+
function Td(t) {
|
|
12016
12022
|
if (t.length === 0 || t.length % 4 !== 0)
|
|
12017
12023
|
return null;
|
|
12018
12024
|
const e = t.length - t.replace(/=+$/, "").length;
|
|
12019
12025
|
return e > 2 ? null : t.length / 4 * 3 - e;
|
|
12020
12026
|
}
|
|
12021
|
-
function
|
|
12027
|
+
function qd(t) {
|
|
12022
12028
|
return (typeof t == "string" ? t.trim() : "") || "Page image";
|
|
12023
12029
|
}
|
|
12024
|
-
function
|
|
12030
|
+
function Cd(t) {
|
|
12025
12031
|
try {
|
|
12026
12032
|
t();
|
|
12027
12033
|
} catch {
|
|
12028
12034
|
}
|
|
12029
12035
|
}
|
|
12030
|
-
function
|
|
12036
|
+
function Od(t) {
|
|
12031
12037
|
return new Promise((e, s) => {
|
|
12032
12038
|
const n = new FileReader();
|
|
12033
12039
|
n.onload = () => {
|
|
@@ -12041,7 +12047,7 @@ function Cd(t) {
|
|
|
12041
12047
|
}
|
|
12042
12048
|
async function wi(t, e) {
|
|
12043
12049
|
const s = Object.getPrototypeOf(async function() {
|
|
12044
|
-
}).constructor, n = t.timeoutMs ??
|
|
12050
|
+
}).constructor, n = t.timeoutMs ?? Id, i = Date.now(), r = [];
|
|
12045
12051
|
let a;
|
|
12046
12052
|
const o = {
|
|
12047
12053
|
log: console.log,
|
|
@@ -12059,7 +12065,7 @@ async function wi(t, e) {
|
|
|
12059
12065
|
a = window.setTimeout(() => u(l), n);
|
|
12060
12066
|
})
|
|
12061
12067
|
]);
|
|
12062
|
-
return d === l ?
|
|
12068
|
+
return d === l ? Md(n) : {
|
|
12063
12069
|
ok: !0,
|
|
12064
12070
|
result: d,
|
|
12065
12071
|
console: r,
|
|
@@ -12088,7 +12094,7 @@ async function wi(t, e) {
|
|
|
12088
12094
|
e?.deactivate(), a !== void 0 && window.clearTimeout(a), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
|
|
12089
12095
|
}
|
|
12090
12096
|
}
|
|
12091
|
-
function
|
|
12097
|
+
function xd(t, e) {
|
|
12092
12098
|
if (!t || typeof t != "object")
|
|
12093
12099
|
return;
|
|
12094
12100
|
const s = t.sandboxFilesToken;
|
|
@@ -12098,7 +12104,7 @@ function Od(t, e) {
|
|
|
12098
12104
|
const i = () => {
|
|
12099
12105
|
if (!n)
|
|
12100
12106
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
12101
|
-
}, r = async (o, c) => await
|
|
12107
|
+
}, r = async (o, c) => await Gc(`${e.replace(/\/$/, "")}${o}`, c);
|
|
12102
12108
|
return {
|
|
12103
12109
|
value: Object.freeze({
|
|
12104
12110
|
upload: async (o) => {
|
|
@@ -12132,7 +12138,7 @@ function Od(t, e) {
|
|
|
12132
12138
|
}
|
|
12133
12139
|
};
|
|
12134
12140
|
}
|
|
12135
|
-
function
|
|
12141
|
+
function Md(t) {
|
|
12136
12142
|
return {
|
|
12137
12143
|
ok: !1,
|
|
12138
12144
|
exception: {
|
|
@@ -12146,21 +12152,21 @@ function xd(t) {
|
|
|
12146
12152
|
}
|
|
12147
12153
|
};
|
|
12148
12154
|
}
|
|
12149
|
-
function
|
|
12155
|
+
function Pd(t) {
|
|
12150
12156
|
return t.replace(/\/+$/, "");
|
|
12151
12157
|
}
|
|
12152
|
-
function
|
|
12158
|
+
function Dd(t) {
|
|
12153
12159
|
return t === "pluno" ? "scheduled_continuation" : t ?? "user";
|
|
12154
12160
|
}
|
|
12155
|
-
function
|
|
12161
|
+
function au(t, e = location.origin) {
|
|
12156
12162
|
return /origin (?:is not allowed|does not match browser origin)/i.test(t) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
|
|
12157
12163
|
}
|
|
12158
|
-
function
|
|
12164
|
+
function Ud(t) {
|
|
12159
12165
|
const e = new URL("/api/product-agent/embed/ws", t);
|
|
12160
12166
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
12161
12167
|
}
|
|
12162
|
-
function
|
|
12163
|
-
const t =
|
|
12168
|
+
function ae() {
|
|
12169
|
+
const t = Vd();
|
|
12164
12170
|
return {
|
|
12165
12171
|
url: location.href,
|
|
12166
12172
|
title: document.title,
|
|
@@ -12168,19 +12174,19 @@ function oe() {
|
|
|
12168
12174
|
...t ? { plunoProductAgentUi: t } : {}
|
|
12169
12175
|
};
|
|
12170
12176
|
}
|
|
12171
|
-
function
|
|
12177
|
+
function Nd() {
|
|
12172
12178
|
return {
|
|
12173
12179
|
pageUrl: location.href,
|
|
12174
12180
|
pageTitle: document.title,
|
|
12175
12181
|
htmlContent: Rn()
|
|
12176
12182
|
};
|
|
12177
12183
|
}
|
|
12178
|
-
function
|
|
12179
|
-
return Ct.add(t), mt || (mt =
|
|
12184
|
+
function jd(t) {
|
|
12185
|
+
return Ct.add(t), mt || (mt = Bd()), () => {
|
|
12180
12186
|
Ct.delete(t), Ct.size === 0 && (mt?.(), mt = null);
|
|
12181
12187
|
};
|
|
12182
12188
|
}
|
|
12183
|
-
function
|
|
12189
|
+
function Bd() {
|
|
12184
12190
|
const t = () => {
|
|
12185
12191
|
for (const r of Array.from(Ct))
|
|
12186
12192
|
r();
|
|
@@ -12207,13 +12213,13 @@ function Rn() {
|
|
|
12207
12213
|
(f) => Ir(f) && !f.parentElement?.closest(n)
|
|
12208
12214
|
);
|
|
12209
12215
|
for (const f of i.slice(0, 3))
|
|
12210
|
-
s("Active overlay",
|
|
12211
|
-
const r =
|
|
12212
|
-
s("Main page content", a), s("Additional visible page text",
|
|
12216
|
+
s("Active overlay", qs(tt(f), e));
|
|
12217
|
+
const r = Ld(), a = r ? qs(tt(r), e) : "";
|
|
12218
|
+
s("Main page content", a), s("Additional visible page text", qs(tt(document.body), e));
|
|
12213
12219
|
const o = t.map(([f, v]) => `${f}:
|
|
12214
12220
|
${v}`).join(`
|
|
12215
12221
|
|
|
12216
|
-
`).trim().slice(0, 12e3), c =
|
|
12222
|
+
`).trim().slice(0, 12e3), c = Fd(i, r).trim(), l = `Simplified DOM outline:
|
|
12217
12223
|
`, d = `
|
|
12218
12224
|
|
|
12219
12225
|
Visible page text:
|
|
@@ -12231,7 +12237,7 @@ function Be(t) {
|
|
|
12231
12237
|
|
|
12232
12238
|
`).trim();
|
|
12233
12239
|
}
|
|
12234
|
-
function
|
|
12240
|
+
function qs(t, e) {
|
|
12235
12241
|
let s = Be(t);
|
|
12236
12242
|
for (const n of e)
|
|
12237
12243
|
s = s.replace(n, "");
|
|
@@ -12241,10 +12247,10 @@ function Ir(t) {
|
|
|
12241
12247
|
const e = window.getComputedStyle(t);
|
|
12242
12248
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
12243
12249
|
}
|
|
12244
|
-
function
|
|
12250
|
+
function Ld() {
|
|
12245
12251
|
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ir).sort((t, e) => tt(e).length - tt(t).length)[0] ?? null;
|
|
12246
12252
|
}
|
|
12247
|
-
function
|
|
12253
|
+
function Fd(t, e) {
|
|
12248
12254
|
const s = /* @__PURE__ */ new Set([
|
|
12249
12255
|
"main",
|
|
12250
12256
|
"nav",
|
|
@@ -12324,7 +12330,7 @@ function Ld(t, e) {
|
|
|
12324
12330
|
"data-test",
|
|
12325
12331
|
"data-qa",
|
|
12326
12332
|
"data-cy"
|
|
12327
|
-
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } =
|
|
12333
|
+
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: u } = $d(), p = new Set(t);
|
|
12328
12334
|
e && p.add(e);
|
|
12329
12335
|
let g = 0;
|
|
12330
12336
|
const m = (S) => {
|
|
@@ -12349,43 +12355,43 @@ function Ld(t, e) {
|
|
|
12349
12355
|
const $ = f(D), ve = Fe.get($) ?? 0;
|
|
12350
12356
|
Fe.set($, ve + 1), (U.get($) ?? 0) > 8 && ve >= 6 && !d.has(D) && H.set($, (H.get($) ?? 0) + 1);
|
|
12351
12357
|
}
|
|
12352
|
-
const ot = /* @__PURE__ */ new Map(), qn = /* @__PURE__ */ new Set(),
|
|
12358
|
+
const ot = /* @__PURE__ */ new Map(), qn = /* @__PURE__ */ new Set(), Wt = [], Cn = [];
|
|
12353
12359
|
for (const D of x) {
|
|
12354
12360
|
const $ = f(D), ve = U.get($) ?? 0, Mn = ot.get($) ?? 0;
|
|
12355
12361
|
if (ot.set($, Mn + 1), ve > 8 && Mn >= 6 && !d.has(D)) {
|
|
12356
|
-
qn.has($) || (
|
|
12362
|
+
qn.has($) || (Wt.push([`… ${H.get($) ?? 0} similar siblings omitted`]), qn.add($));
|
|
12357
12363
|
continue;
|
|
12358
12364
|
}
|
|
12359
12365
|
const Pn = y(D, R);
|
|
12360
|
-
Cn.push(Pn),
|
|
12366
|
+
Cn.push(Pn), Wt.push(Pn.lines);
|
|
12361
12367
|
}
|
|
12362
|
-
const
|
|
12368
|
+
const Gt = [];
|
|
12363
12369
|
if (w.shadowRoot)
|
|
12364
12370
|
for (const D of Array.from(w.shadowRoot.children))
|
|
12365
|
-
D instanceof HTMLElement &&
|
|
12366
|
-
const at = [...Cn, ...
|
|
12371
|
+
D instanceof HTMLElement && Gt.push(y(D, R + 1));
|
|
12372
|
+
const at = [...Cn, ...Gt], Jt = O.length > 0 || k || at.some((D) => D.hasUsefulContent), On = Be(
|
|
12367
12373
|
[O, ...at.map((D) => D.textPreview)].filter(Boolean).join(" ")
|
|
12368
|
-
).slice(0, 180), jr = w.hasAttribute("contenteditable") && (O.length > 0 || !w.querySelector("[contenteditable]")), xn = l.some((D) => w.hasAttribute(D)) || !!q || jr,
|
|
12369
|
-
if (
|
|
12374
|
+
).slice(0, 180), jr = w.hasAttribute("contenteditable") && (O.length > 0 || !w.querySelector("[contenteditable]")), xn = l.some((D) => w.hasAttribute(D)) || !!q || jr, Qt = (w.getClientRects().length > 0 || C.display === "contents") && (s.has(T) || xn || E) && (Jt || E) && (!i.has(T) || Jt || xn || E), Xt = Qt ? 1 : 0, $e = [];
|
|
12375
|
+
if (Qt) {
|
|
12370
12376
|
const D = at.some((ve) => ve.containsTextElement), $ = n.has(T) && !D ? On : O;
|
|
12371
12377
|
$e.push(wr(w, c, a, $.slice(0, 180)));
|
|
12372
12378
|
}
|
|
12373
|
-
for (const D of
|
|
12374
|
-
$e.push(...yt(D,
|
|
12375
|
-
const
|
|
12376
|
-
if (
|
|
12377
|
-
const D =
|
|
12378
|
-
|
|
12379
|
+
for (const D of Wt)
|
|
12380
|
+
$e.push(...yt(D, Xt));
|
|
12381
|
+
const Yt = Gt.flatMap((D) => D.lines);
|
|
12382
|
+
if (Yt.length > 0) {
|
|
12383
|
+
const D = Yt.slice(0, 20);
|
|
12384
|
+
Yt.length > D.length && D.push("… shadow DOM omitted");
|
|
12379
12385
|
const $ = T.includes("tooltip") || T.includes("popper") || T.includes("loader");
|
|
12380
12386
|
if (R < 2 && !$) {
|
|
12381
|
-
const ve =
|
|
12382
|
-
$e.push(...yt([ve, ...yt(D, 1)],
|
|
12387
|
+
const ve = Qt ? "#shadow-root" : `${T} #shadow-root`;
|
|
12388
|
+
$e.push(...yt([ve, ...yt(D, 1)], Xt));
|
|
12383
12389
|
} else
|
|
12384
|
-
$e.push(...yt(D,
|
|
12390
|
+
$e.push(...yt(D, Xt));
|
|
12385
12391
|
}
|
|
12386
12392
|
return {
|
|
12387
12393
|
lines: $e,
|
|
12388
|
-
hasUsefulContent:
|
|
12394
|
+
hasUsefulContent: Jt,
|
|
12389
12395
|
textPreview: On,
|
|
12390
12396
|
containsTextElement: n.has(T) || at.some((D) => D.containsTextElement)
|
|
12391
12397
|
};
|
|
@@ -12394,7 +12400,7 @@ function Ld(t, e) {
|
|
|
12394
12400
|
`);
|
|
12395
12401
|
}, I = [], _ = Be(window.getSelection()?.toString() ?? "");
|
|
12396
12402
|
_ && I.push(`--- selected text ---
|
|
12397
|
-
${JSON.stringify(_)}`), u.length > 0 && I.push(
|
|
12403
|
+
${JSON.stringify(_)}`), u.length > 0 && I.push(zd(u, s, c, a));
|
|
12398
12404
|
for (const S of t.slice(0, 3))
|
|
12399
12405
|
I.push(v(S, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
12400
12406
|
if (e && I.push(v(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -12409,7 +12415,7 @@ function wr(t, e, s, n) {
|
|
|
12409
12415
|
const i = t.tagName.toLowerCase();
|
|
12410
12416
|
let r = i;
|
|
12411
12417
|
const a = t.getAttribute("id");
|
|
12412
|
-
a &&
|
|
12418
|
+
a && Hd(a) && (r += `#${a}`);
|
|
12413
12419
|
for (const o of e) {
|
|
12414
12420
|
const c = t.getAttribute(o);
|
|
12415
12421
|
c && c.length <= 160 && (o !== "role" || !s.has(c)) && (r += `[${o}=${JSON.stringify(c)}]`);
|
|
@@ -12422,7 +12428,7 @@ function wr(t, e, s, n) {
|
|
|
12422
12428
|
t.hasAttribute(o) && (r += `[${o}]`);
|
|
12423
12429
|
return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
12424
12430
|
}
|
|
12425
|
-
function
|
|
12431
|
+
function $d() {
|
|
12426
12432
|
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), s = (o, c) => {
|
|
12427
12433
|
if (!o)
|
|
12428
12434
|
return;
|
|
@@ -12465,7 +12471,7 @@ function Fd() {
|
|
|
12465
12471
|
priorityTargets: Array.from(e, ([o, c]) => ({ element: o, labels: Array.from(c) }))
|
|
12466
12472
|
};
|
|
12467
12473
|
}
|
|
12468
|
-
function
|
|
12474
|
+
function zd(t, e, s, n) {
|
|
12469
12475
|
const i = ["--- active/current elements ---"];
|
|
12470
12476
|
for (const r of t) {
|
|
12471
12477
|
const a = [];
|
|
@@ -12501,12 +12507,12 @@ function _r(t) {
|
|
|
12501
12507
|
Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
12502
12508
|
);
|
|
12503
12509
|
}
|
|
12504
|
-
function
|
|
12510
|
+
function Hd(t) {
|
|
12505
12511
|
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);
|
|
12506
12512
|
}
|
|
12507
|
-
function
|
|
12513
|
+
function Vd() {
|
|
12508
12514
|
const t = Array.from(document.querySelectorAll(mi)), e = t.find(
|
|
12509
|
-
(r) => typeof r[
|
|
12515
|
+
(r) => typeof r[Yc] == "string"
|
|
12510
12516
|
);
|
|
12511
12517
|
if (!(e ?? t[0]))
|
|
12512
12518
|
return;
|
|
@@ -12522,23 +12528,23 @@ function Hd() {
|
|
|
12522
12528
|
},
|
|
12523
12529
|
{
|
|
12524
12530
|
name: "widget_root",
|
|
12525
|
-
selector:
|
|
12531
|
+
selector: Jc,
|
|
12526
12532
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
12527
12533
|
},
|
|
12528
12534
|
{
|
|
12529
12535
|
name: "widget_panel",
|
|
12530
|
-
selector:
|
|
12536
|
+
selector: Qc,
|
|
12531
12537
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
12532
12538
|
},
|
|
12533
12539
|
{
|
|
12534
12540
|
name: "widget_timeline",
|
|
12535
|
-
selector:
|
|
12541
|
+
selector: Xc,
|
|
12536
12542
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
12537
12543
|
}
|
|
12538
12544
|
]
|
|
12539
12545
|
};
|
|
12540
12546
|
}
|
|
12541
|
-
function
|
|
12547
|
+
function Kd(t) {
|
|
12542
12548
|
if (t.runtimeContext !== void 0) {
|
|
12543
12549
|
if (!t.runtimeContext || typeof t.runtimeContext != "object" || Array.isArray(t.runtimeContext)) return !1;
|
|
12544
12550
|
const e = t.runtimeContext;
|
|
@@ -12560,10 +12566,10 @@ function Si(t) {
|
|
|
12560
12566
|
return { type: "error", message: "Invalid server event" };
|
|
12561
12567
|
}
|
|
12562
12568
|
}
|
|
12563
|
-
function
|
|
12569
|
+
function Wd(t) {
|
|
12564
12570
|
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
12565
12571
|
}
|
|
12566
|
-
function
|
|
12572
|
+
function Gd(t) {
|
|
12567
12573
|
if (!t || typeof t != "object")
|
|
12568
12574
|
return null;
|
|
12569
12575
|
const e = t, s = e.appearance, n = s && typeof s == "object" ? s : e, i = typeof n.accentColor == "string" ? n.accentColor : null, r = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, a = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, o = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -12574,13 +12580,13 @@ function Wd(t) {
|
|
|
12574
12580
|
...o !== null ? { scribbleStyle: o } : {}
|
|
12575
12581
|
};
|
|
12576
12582
|
}
|
|
12577
|
-
function
|
|
12583
|
+
function Jd(t) {
|
|
12578
12584
|
if (!t || typeof t != "object")
|
|
12579
12585
|
return null;
|
|
12580
12586
|
const e = t.javascript;
|
|
12581
12587
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
12582
12588
|
}
|
|
12583
|
-
function
|
|
12589
|
+
function Qd(t, e) {
|
|
12584
12590
|
return e ? t && typeof t == "object" ? {
|
|
12585
12591
|
...t,
|
|
12586
12592
|
helperError: e
|
|
@@ -12590,13 +12596,13 @@ function Jd(t, e) {
|
|
|
12590
12596
|
helperError: e
|
|
12591
12597
|
} : t;
|
|
12592
12598
|
}
|
|
12593
|
-
function
|
|
12599
|
+
function Xd(t) {
|
|
12594
12600
|
if (!t || typeof t != "object")
|
|
12595
12601
|
return t;
|
|
12596
12602
|
const e = t;
|
|
12597
12603
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : t;
|
|
12598
12604
|
}
|
|
12599
|
-
function
|
|
12605
|
+
function Yd() {
|
|
12600
12606
|
const t = "pluno.productAgent.clientId", e = window.localStorage.getItem(t);
|
|
12601
12607
|
if (e)
|
|
12602
12608
|
return e;
|
|
@@ -12617,8 +12623,8 @@ function ki(t) {
|
|
|
12617
12623
|
avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
|
|
12618
12624
|
} : null;
|
|
12619
12625
|
}
|
|
12620
|
-
function
|
|
12621
|
-
return Array.isArray(t) ?
|
|
12626
|
+
function cu(t, e) {
|
|
12627
|
+
return Array.isArray(t) ? rl(
|
|
12622
12628
|
t.map((s) => Sr(s, e)).filter((s) => s !== null)
|
|
12623
12629
|
) : [];
|
|
12624
12630
|
}
|
|
@@ -12629,7 +12635,7 @@ function Sr(t, e) {
|
|
|
12629
12635
|
if (!n || typeof n != "object")
|
|
12630
12636
|
return null;
|
|
12631
12637
|
const i = n;
|
|
12632
|
-
if (i.hiddenFromTranscript === !0 ||
|
|
12638
|
+
if (i.hiddenFromTranscript === !0 || Sc(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
|
|
12633
12639
|
return null;
|
|
12634
12640
|
if (i.type === "assistant_draft")
|
|
12635
12641
|
return {
|
|
@@ -12677,7 +12683,7 @@ function Sr(t, e) {
|
|
|
12677
12683
|
}), a;
|
|
12678
12684
|
}
|
|
12679
12685
|
if (i.type === "function_call_output") {
|
|
12680
|
-
const r =
|
|
12686
|
+
const r = Ic(i.output);
|
|
12681
12687
|
if (r !== null)
|
|
12682
12688
|
return {
|
|
12683
12689
|
id: String(s.id ?? crypto.randomUUID()),
|
|
@@ -12692,7 +12698,7 @@ function Sr(t, e) {
|
|
|
12692
12698
|
callId: Je(i) ?? void 0,
|
|
12693
12699
|
sharePromptAllowed: r
|
|
12694
12700
|
};
|
|
12695
|
-
const a =
|
|
12701
|
+
const a = Mc(i.output);
|
|
12696
12702
|
if (a)
|
|
12697
12703
|
return {
|
|
12698
12704
|
id: String(s.id ?? crypto.randomUUID()),
|
|
@@ -12708,7 +12714,7 @@ function Sr(t, e) {
|
|
|
12708
12714
|
scheduledCheckInId: a.id ?? void 0,
|
|
12709
12715
|
scheduledCheckInAt: a.dueAt
|
|
12710
12716
|
};
|
|
12711
|
-
const o =
|
|
12717
|
+
const o = el(i.output), c = tl(i.output);
|
|
12712
12718
|
return o ? {
|
|
12713
12719
|
id: String(s.id ?? crypto.randomUUID()),
|
|
12714
12720
|
role: "tool",
|
|
@@ -12740,7 +12746,7 @@ function Sr(t, e) {
|
|
|
12740
12746
|
return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
|
|
12741
12747
|
id: String(s.id ?? crypto.randomUUID()),
|
|
12742
12748
|
role: "tool",
|
|
12743
|
-
content: i.type === "mcp_call" ?
|
|
12749
|
+
content: i.type === "mcp_call" ? Zd(i) : nl(i),
|
|
12744
12750
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
12745
12751
|
...K(i) !== null ? { displaySequence: K(i) } : {},
|
|
12746
12752
|
...se(i) !== null ? { causalSequence: se(i) } : {},
|
|
@@ -12754,7 +12760,7 @@ function Sr(t, e) {
|
|
|
12754
12760
|
} : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
|
|
12755
12761
|
id: String(s.id ?? crypto.randomUUID()),
|
|
12756
12762
|
role: "system",
|
|
12757
|
-
content:
|
|
12763
|
+
content: sl(i),
|
|
12758
12764
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
12759
12765
|
...K(i) !== null ? { displaySequence: K(i) } : {},
|
|
12760
12766
|
...se(i) !== null ? { causalSequence: se(i) } : {},
|
|
@@ -12767,11 +12773,11 @@ function Sr(t, e) {
|
|
|
12767
12773
|
...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
|
|
12768
12774
|
} : null;
|
|
12769
12775
|
}
|
|
12770
|
-
function
|
|
12776
|
+
function Zd(t) {
|
|
12771
12777
|
const s = (typeof t.server_label == "string" ? t.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
|
|
12772
12778
|
return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
|
|
12773
12779
|
}
|
|
12774
|
-
function
|
|
12780
|
+
function el(t) {
|
|
12775
12781
|
if (typeof t != "string")
|
|
12776
12782
|
return null;
|
|
12777
12783
|
try {
|
|
@@ -12788,7 +12794,7 @@ function Zd(t) {
|
|
|
12788
12794
|
return null;
|
|
12789
12795
|
}
|
|
12790
12796
|
}
|
|
12791
|
-
function
|
|
12797
|
+
function tl(t) {
|
|
12792
12798
|
if (typeof t != "string")
|
|
12793
12799
|
return null;
|
|
12794
12800
|
try {
|
|
@@ -12803,10 +12809,10 @@ function el(t) {
|
|
|
12803
12809
|
return null;
|
|
12804
12810
|
}
|
|
12805
12811
|
}
|
|
12806
|
-
function
|
|
12812
|
+
function sl(t) {
|
|
12807
12813
|
return t.type === "run_status" && t.status === "steered" ? "Steered" : typeof t.message == "string" && t.message.trim().length > 0 ? t.message : "";
|
|
12808
12814
|
}
|
|
12809
|
-
function
|
|
12815
|
+
function nl(t) {
|
|
12810
12816
|
if (t.type === "web_search_call") {
|
|
12811
12817
|
const e = t.action;
|
|
12812
12818
|
if (e && typeof e == "object") {
|
|
@@ -12818,9 +12824,9 @@ function sl(t) {
|
|
|
12818
12824
|
}
|
|
12819
12825
|
return "🔎 Searching the web";
|
|
12820
12826
|
}
|
|
12821
|
-
return
|
|
12827
|
+
return il(t);
|
|
12822
12828
|
}
|
|
12823
|
-
function
|
|
12829
|
+
function il(t) {
|
|
12824
12830
|
if (typeof t.summary == "string" && t.summary.trim().length > 0)
|
|
12825
12831
|
return Ze(t.summary);
|
|
12826
12832
|
if (typeof t.arguments == "string")
|
|
@@ -12855,25 +12861,25 @@ function Ri(t) {
|
|
|
12855
12861
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
12856
12862
|
}).filter(Boolean).join("") : "";
|
|
12857
12863
|
}
|
|
12858
|
-
function il(t) {
|
|
12859
|
-
return t.filter((e, s) => An(e) ? !pl(t, s) && !ol(t, s) && !ll(t, s) && !ul(t, s) : rl(e) ? e.retryable === !0 && dl(t, s) ? !1 : !cl(t, s) : !0);
|
|
12860
|
-
}
|
|
12861
12864
|
function rl(t) {
|
|
12865
|
+
return t.filter((e, s) => An(e) ? !hl(t, s) && !al(t, s) && !ul(t, s) && !pl(t, s) : ol(e) ? e.retryable === !0 && ll(t, s) ? !1 : !dl(t, s) : !0);
|
|
12866
|
+
}
|
|
12867
|
+
function ol(t) {
|
|
12862
12868
|
return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
|
|
12863
12869
|
}
|
|
12864
12870
|
function An(t) {
|
|
12865
12871
|
return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
|
|
12866
12872
|
}
|
|
12867
|
-
function
|
|
12873
|
+
function al(t, e) {
|
|
12868
12874
|
return t.some(
|
|
12869
|
-
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) &&
|
|
12875
|
+
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && cl(
|
|
12870
12876
|
t,
|
|
12871
12877
|
e,
|
|
12872
12878
|
n
|
|
12873
12879
|
)
|
|
12874
12880
|
);
|
|
12875
12881
|
}
|
|
12876
|
-
function
|
|
12882
|
+
function cl(t, e, s) {
|
|
12877
12883
|
const n = t[e], i = t[s];
|
|
12878
12884
|
if (rt(n, i))
|
|
12879
12885
|
return !0;
|
|
@@ -12884,7 +12890,7 @@ function al(t, e, s) {
|
|
|
12884
12890
|
return t[r].id === n.respondsToUserMessageId;
|
|
12885
12891
|
return !1;
|
|
12886
12892
|
}
|
|
12887
|
-
function
|
|
12893
|
+
function dl(t, e) {
|
|
12888
12894
|
const s = t[e];
|
|
12889
12895
|
for (let n = e + 1; n < t.length; n += 1) {
|
|
12890
12896
|
const i = t[n];
|
|
@@ -12893,7 +12899,7 @@ function cl(t, e) {
|
|
|
12893
12899
|
}
|
|
12894
12900
|
return !1;
|
|
12895
12901
|
}
|
|
12896
|
-
function
|
|
12902
|
+
function ll(t, e) {
|
|
12897
12903
|
const s = t[e];
|
|
12898
12904
|
if (!s.respondsToUserMessageId)
|
|
12899
12905
|
return !1;
|
|
@@ -12906,19 +12912,19 @@ function dl(t, e) {
|
|
|
12906
12912
|
}
|
|
12907
12913
|
return !1;
|
|
12908
12914
|
}
|
|
12909
|
-
function
|
|
12915
|
+
function ul(t, e) {
|
|
12910
12916
|
const s = t[e];
|
|
12911
12917
|
return t.some(
|
|
12912
12918
|
(n, i) => i !== e && n.role === "assistant" && rt(s, n)
|
|
12913
12919
|
);
|
|
12914
12920
|
}
|
|
12915
|
-
function
|
|
12921
|
+
function pl(t, e) {
|
|
12916
12922
|
const s = t[e];
|
|
12917
12923
|
return t.some(
|
|
12918
12924
|
(n, i) => i !== e && n.role === "tool" && rt(s, n)
|
|
12919
12925
|
);
|
|
12920
12926
|
}
|
|
12921
|
-
function
|
|
12927
|
+
function hl(t, e) {
|
|
12922
12928
|
const s = t[e];
|
|
12923
12929
|
for (let n = e + 1; n < t.length; n += 1)
|
|
12924
12930
|
if (An(t[n]) && rt(s, t[n]))
|
|
@@ -12931,15 +12937,15 @@ function rt(t, e) {
|
|
|
12931
12937
|
function vt(t, e) {
|
|
12932
12938
|
return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
|
|
12933
12939
|
}
|
|
12934
|
-
function
|
|
12940
|
+
function fl(t, e) {
|
|
12935
12941
|
try {
|
|
12936
|
-
const s = window.localStorage.getItem(`${
|
|
12942
|
+
const s = window.localStorage.getItem(`${fd}${t}`);
|
|
12937
12943
|
if (!s)
|
|
12938
12944
|
return null;
|
|
12939
12945
|
const n = JSON.parse(s), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
12940
12946
|
if (e !== void 0 && i !== e)
|
|
12941
12947
|
return null;
|
|
12942
|
-
const r = Array.isArray(n.messages) ? n.messages.map(
|
|
12948
|
+
const r = Array.isArray(n.messages) ? n.messages.map(kl).filter((a) => !!a) : [];
|
|
12943
12949
|
return {
|
|
12944
12950
|
sessionId: i,
|
|
12945
12951
|
messages: r
|
|
@@ -12948,7 +12954,7 @@ function hl(t, e) {
|
|
|
12948
12954
|
return null;
|
|
12949
12955
|
}
|
|
12950
12956
|
}
|
|
12951
|
-
function
|
|
12957
|
+
function gl(t) {
|
|
12952
12958
|
try {
|
|
12953
12959
|
const e = window.localStorage.getItem(`${an}${t}`);
|
|
12954
12960
|
if (!e)
|
|
@@ -12976,7 +12982,7 @@ function Re(t, e) {
|
|
|
12976
12982
|
}
|
|
12977
12983
|
function kr(t, e) {
|
|
12978
12984
|
try {
|
|
12979
|
-
const s = `${
|
|
12985
|
+
const s = `${Ht}${t}`, n = location.href, i = location.origin, r = Array.from(e, (a) => ({
|
|
12980
12986
|
...a,
|
|
12981
12987
|
storedAt: Date.now(),
|
|
12982
12988
|
unloadUrl: n,
|
|
@@ -12992,26 +12998,26 @@ function kr(t, e) {
|
|
|
12992
12998
|
}
|
|
12993
12999
|
function Ai(t, e) {
|
|
12994
13000
|
try {
|
|
12995
|
-
if (window.sessionStorage.getItem(`${
|
|
13001
|
+
if (window.sessionStorage.getItem(`${Ht}${t}`) === null)
|
|
12996
13002
|
return;
|
|
12997
13003
|
} catch {
|
|
12998
13004
|
return;
|
|
12999
13005
|
}
|
|
13000
13006
|
kr(t, e);
|
|
13001
13007
|
}
|
|
13002
|
-
function
|
|
13008
|
+
function ml(t) {
|
|
13003
13009
|
try {
|
|
13004
|
-
const e = `${
|
|
13010
|
+
const e = `${Ht}${t}`, s = window.sessionStorage.getItem(e);
|
|
13005
13011
|
if (window.sessionStorage.removeItem(e), !s)
|
|
13006
13012
|
return [];
|
|
13007
13013
|
const n = JSON.parse(s);
|
|
13008
|
-
return Array.isArray(n) ? n.flatMap((i) =>
|
|
13014
|
+
return Array.isArray(n) ? n.flatMap((i) => vl(i) ? [{
|
|
13009
13015
|
...i.event,
|
|
13010
|
-
page:
|
|
13016
|
+
page: ae(),
|
|
13011
13017
|
rawOutput: {
|
|
13012
13018
|
pageContextRestarted: !0,
|
|
13013
13019
|
outcome: "unknown",
|
|
13014
|
-
message:
|
|
13020
|
+
message: yl(location.href),
|
|
13015
13021
|
currentUrl: location.href,
|
|
13016
13022
|
console: [],
|
|
13017
13023
|
metadata: {
|
|
@@ -13028,17 +13034,17 @@ function gl(t) {
|
|
|
13028
13034
|
return [];
|
|
13029
13035
|
}
|
|
13030
13036
|
}
|
|
13031
|
-
function
|
|
13037
|
+
function yl(t) {
|
|
13032
13038
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
13033
13039
|
Current URL: ${t}`;
|
|
13034
13040
|
}
|
|
13035
|
-
function
|
|
13041
|
+
function vl(t) {
|
|
13036
13042
|
if (!t || typeof t != "object")
|
|
13037
13043
|
return !1;
|
|
13038
13044
|
const e = t, s = e.event;
|
|
13039
13045
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && En(s) && s.type === "tool.result";
|
|
13040
13046
|
}
|
|
13041
|
-
function
|
|
13047
|
+
function bl(t, e) {
|
|
13042
13048
|
const s = new Set(
|
|
13043
13049
|
t.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
13044
13050
|
);
|
|
@@ -13047,9 +13053,9 @@ function vl(t, e) {
|
|
|
13047
13053
|
...e.filter((n) => !s.has(n.callId))
|
|
13048
13054
|
];
|
|
13049
13055
|
}
|
|
13050
|
-
function
|
|
13056
|
+
function Il(t) {
|
|
13051
13057
|
try {
|
|
13052
|
-
window.sessionStorage.removeItem(`${
|
|
13058
|
+
window.sessionStorage.removeItem(`${Ht}${t}`);
|
|
13053
13059
|
} catch {
|
|
13054
13060
|
return;
|
|
13055
13061
|
}
|
|
@@ -13084,9 +13090,9 @@ function Ar(t, e) {
|
|
|
13084
13090
|
} : t;
|
|
13085
13091
|
}
|
|
13086
13092
|
function Er(t) {
|
|
13087
|
-
return t.type ||
|
|
13093
|
+
return t.type || Sl(t.name) || "application/octet-stream";
|
|
13088
13094
|
}
|
|
13089
|
-
function
|
|
13095
|
+
function wl(t) {
|
|
13090
13096
|
Tr({
|
|
13091
13097
|
name: t.name,
|
|
13092
13098
|
mimeType: Er(t),
|
|
@@ -13094,21 +13100,21 @@ function Il(t) {
|
|
|
13094
13100
|
});
|
|
13095
13101
|
}
|
|
13096
13102
|
function Tr(t) {
|
|
13097
|
-
const e =
|
|
13098
|
-
if (!
|
|
13103
|
+
const e = _l(t.name), s = t.mimeType.trim().toLowerCase();
|
|
13104
|
+
if (!ud.has(`${e}:${s}`))
|
|
13099
13105
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
13100
13106
|
if (t.sizeBytes <= 0 || t.sizeBytes >= vr)
|
|
13101
13107
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
13102
13108
|
}
|
|
13103
|
-
function
|
|
13109
|
+
function _l(t) {
|
|
13104
13110
|
const e = t.trim().toLowerCase(), s = e.lastIndexOf(".");
|
|
13105
13111
|
return s >= 0 ? e.slice(s) : "";
|
|
13106
13112
|
}
|
|
13107
|
-
function
|
|
13113
|
+
function Sl(t) {
|
|
13108
13114
|
const e = t.toLowerCase();
|
|
13109
13115
|
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
13110
13116
|
}
|
|
13111
|
-
function
|
|
13117
|
+
function kl(t) {
|
|
13112
13118
|
if (!t || typeof t != "object")
|
|
13113
13119
|
return null;
|
|
13114
13120
|
const e = t;
|
|
@@ -13126,11 +13132,11 @@ function Sl(t) {
|
|
|
13126
13132
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
13127
13133
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
13128
13134
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
13129
|
-
attachments: Rr(e.attachments)?.map(
|
|
13135
|
+
attachments: Rr(e.attachments)?.map(Rl),
|
|
13130
13136
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
13131
13137
|
};
|
|
13132
13138
|
}
|
|
13133
|
-
function
|
|
13139
|
+
function Rl(t) {
|
|
13134
13140
|
const {
|
|
13135
13141
|
dataUrl: e,
|
|
13136
13142
|
objectUrl: s,
|
|
@@ -13148,9 +13154,9 @@ function W(t) {
|
|
|
13148
13154
|
const e = t.runId;
|
|
13149
13155
|
return typeof e == "string" && e ? e : null;
|
|
13150
13156
|
}
|
|
13151
|
-
function
|
|
13157
|
+
function Al(t) {
|
|
13152
13158
|
const e = t?.timeoutMs;
|
|
13153
|
-
return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <=
|
|
13159
|
+
return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= wd);
|
|
13154
13160
|
}
|
|
13155
13161
|
function qr(t) {
|
|
13156
13162
|
const e = {};
|
|
@@ -13164,22 +13170,22 @@ function qr(t) {
|
|
|
13164
13170
|
return e;
|
|
13165
13171
|
}
|
|
13166
13172
|
function Tn(t, e) {
|
|
13167
|
-
return Ur(t) ?
|
|
13173
|
+
return Ur(t) ? Kt : ge(jt(e), pd);
|
|
13168
13174
|
}
|
|
13169
|
-
function
|
|
13175
|
+
function El(t, e) {
|
|
13170
13176
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
13171
13177
|
}
|
|
13172
|
-
async function
|
|
13178
|
+
async function Tl(t, e, s, n) {
|
|
13173
13179
|
const i = qr(t.headers);
|
|
13174
13180
|
n({
|
|
13175
13181
|
...e,
|
|
13176
13182
|
responseStatus: t.status,
|
|
13177
13183
|
responseHeaders: i,
|
|
13178
|
-
responseBody: await
|
|
13184
|
+
responseBody: await ql(t),
|
|
13179
13185
|
durationMs: Date.now() - s
|
|
13180
13186
|
});
|
|
13181
13187
|
}
|
|
13182
|
-
async function
|
|
13188
|
+
async function ql(t) {
|
|
13183
13189
|
if (!Cr(t.headers))
|
|
13184
13190
|
return;
|
|
13185
13191
|
let e = null, s = null;
|
|
@@ -13189,7 +13195,7 @@ async function Tl(t) {
|
|
|
13189
13195
|
const n = new Promise((o) => {
|
|
13190
13196
|
s = window.setTimeout(() => {
|
|
13191
13197
|
e?.cancel(), o("timeout");
|
|
13192
|
-
},
|
|
13198
|
+
}, hd);
|
|
13193
13199
|
}), i = new TextDecoder();
|
|
13194
13200
|
let r = "", a = 0;
|
|
13195
13201
|
for (; ; ) {
|
|
@@ -13211,7 +13217,7 @@ async function Tl(t) {
|
|
|
13211
13217
|
s !== null && window.clearTimeout(s);
|
|
13212
13218
|
}
|
|
13213
13219
|
}
|
|
13214
|
-
function
|
|
13220
|
+
function Cl(t, e) {
|
|
13215
13221
|
if (Cr(new Headers(e)))
|
|
13216
13222
|
try {
|
|
13217
13223
|
return t.responseType === "" || t.responseType === "text" ? ge(t.responseText ?? "") : void 0;
|
|
@@ -13223,7 +13229,7 @@ function Ti(t) {
|
|
|
13223
13229
|
if (typeof t == "string")
|
|
13224
13230
|
return ge(t);
|
|
13225
13231
|
}
|
|
13226
|
-
function
|
|
13232
|
+
function Ol(t) {
|
|
13227
13233
|
return ne({
|
|
13228
13234
|
...t,
|
|
13229
13235
|
requestBody: qi(t.requestBody),
|
|
@@ -13235,11 +13241,11 @@ function qi(t) {
|
|
|
13235
13241
|
return t;
|
|
13236
13242
|
const e = t.trim();
|
|
13237
13243
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
13238
|
-
return
|
|
13244
|
+
return jt(t);
|
|
13239
13245
|
try {
|
|
13240
13246
|
return JSON.stringify(ne(JSON.parse(t)));
|
|
13241
13247
|
} catch {
|
|
13242
|
-
return
|
|
13248
|
+
return jt(t);
|
|
13243
13249
|
}
|
|
13244
13250
|
}
|
|
13245
13251
|
function Cr(t) {
|
|
@@ -13249,7 +13255,7 @@ function Cr(t) {
|
|
|
13249
13255
|
return s !== null && Number.isInteger(n) && n >= 0 && n <= Sn && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
13250
13256
|
}
|
|
13251
13257
|
function Me(t, e = {}, s) {
|
|
13252
|
-
if (
|
|
13258
|
+
if (Ml(s))
|
|
13253
13259
|
return !0;
|
|
13254
13260
|
const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
13255
13261
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -13264,7 +13270,7 @@ function Me(t, e = {}, s) {
|
|
|
13264
13270
|
return !0;
|
|
13265
13271
|
}
|
|
13266
13272
|
}
|
|
13267
|
-
function
|
|
13273
|
+
function xl(t, e) {
|
|
13268
13274
|
if (Me(t))
|
|
13269
13275
|
return !0;
|
|
13270
13276
|
try {
|
|
@@ -13274,10 +13280,10 @@ function Ol(t, e) {
|
|
|
13274
13280
|
return !0;
|
|
13275
13281
|
}
|
|
13276
13282
|
}
|
|
13277
|
-
function
|
|
13283
|
+
function Ml(t) {
|
|
13278
13284
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
13279
13285
|
}
|
|
13280
|
-
function
|
|
13286
|
+
function Pl(t) {
|
|
13281
13287
|
const e = {};
|
|
13282
13288
|
for (const s of t.trim().split(/[\r\n]+/)) {
|
|
13283
13289
|
const n = s.indexOf(":");
|
|
@@ -13293,7 +13299,7 @@ function Ml(t) {
|
|
|
13293
13299
|
function ge(t, e = Sn) {
|
|
13294
13300
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
13295
13301
|
}
|
|
13296
|
-
function
|
|
13302
|
+
function Cs(t) {
|
|
13297
13303
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
13298
13304
|
}
|
|
13299
13305
|
class Or extends Error {
|
|
@@ -13303,117 +13309,117 @@ class Or extends Error {
|
|
|
13303
13309
|
status;
|
|
13304
13310
|
code;
|
|
13305
13311
|
}
|
|
13306
|
-
async function
|
|
13312
|
+
async function Dl(t, e) {
|
|
13307
13313
|
let s = null;
|
|
13308
13314
|
for (let n = 0; n < bi; n += 1)
|
|
13309
13315
|
try {
|
|
13310
13316
|
return await t();
|
|
13311
13317
|
} catch (i) {
|
|
13312
|
-
if (s = i, n >= bi - 1 || !
|
|
13318
|
+
if (s = i, n >= bi - 1 || !Nl(i))
|
|
13313
13319
|
throw i;
|
|
13314
|
-
await
|
|
13320
|
+
await Ul(n);
|
|
13315
13321
|
}
|
|
13316
13322
|
throw s instanceof Error ? s : new Error(e);
|
|
13317
13323
|
}
|
|
13318
|
-
function
|
|
13324
|
+
function Ul(t) {
|
|
13319
13325
|
return new Promise((e) => {
|
|
13320
|
-
window.setTimeout(e,
|
|
13326
|
+
window.setTimeout(e, ld[t] ?? 0);
|
|
13321
13327
|
});
|
|
13322
13328
|
}
|
|
13323
|
-
function Ul(t) {
|
|
13324
|
-
return t instanceof Or ? Nl(t.status) : t instanceof TypeError;
|
|
13325
|
-
}
|
|
13326
13329
|
function Nl(t) {
|
|
13327
|
-
return t
|
|
13330
|
+
return t instanceof Or ? jl(t.status) : t instanceof TypeError;
|
|
13328
13331
|
}
|
|
13329
13332
|
function jl(t) {
|
|
13333
|
+
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
13334
|
+
}
|
|
13335
|
+
function Bl(t) {
|
|
13330
13336
|
return t === 401 || t === 403;
|
|
13331
13337
|
}
|
|
13332
|
-
const
|
|
13338
|
+
const Kt = "[REDACTED_SECRET]", me = "[REDACTED_TOKEN]", Ll = "[REDACTED_SIGNED_URL]", Fl = 20, $l = /^(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, xr = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Mr = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Pr = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Dr = /\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, zl = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Hl = /\bhttps?:\/\/[^\s"'<>]+/gi, Vl = /[),.;\]]+$/;
|
|
13333
13339
|
function ne(t) {
|
|
13334
|
-
return
|
|
13340
|
+
return Nt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
13335
13341
|
}
|
|
13336
|
-
function
|
|
13342
|
+
function Nt(t, e, s) {
|
|
13337
13343
|
if (typeof t == "string")
|
|
13338
|
-
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t :
|
|
13344
|
+
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : jt(t);
|
|
13339
13345
|
if (t === null || typeof t != "object")
|
|
13340
13346
|
return t;
|
|
13341
|
-
if (e >=
|
|
13347
|
+
if (e >= Fl)
|
|
13342
13348
|
return "[REDACTED_MAX_DEPTH]";
|
|
13343
13349
|
if (s.has(t))
|
|
13344
13350
|
return "[REDACTED_CIRCULAR]";
|
|
13345
13351
|
if (s.add(t), Array.isArray(t))
|
|
13346
|
-
return t.map((i) =>
|
|
13352
|
+
return t.map((i) => Nt(i, e + 1, s));
|
|
13347
13353
|
const n = {};
|
|
13348
13354
|
for (const [i, r] of Object.entries(t))
|
|
13349
|
-
i === "pageContent" ? n[i] = r : Ur(i) ? n[i] =
|
|
13355
|
+
i === "pageContent" ? n[i] = r : Ur(i) ? n[i] = Kt : n[i] = i.toLowerCase() === "url" ? Kl(r) : Nt(r, e + 1, s);
|
|
13350
13356
|
return n;
|
|
13351
13357
|
}
|
|
13352
13358
|
function Ur(t) {
|
|
13353
13359
|
const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
13354
13360
|
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");
|
|
13355
13361
|
}
|
|
13356
|
-
function
|
|
13357
|
-
return typeof t == "string" ? Nr(t) :
|
|
13362
|
+
function Kl(t) {
|
|
13363
|
+
return typeof t == "string" ? Nr(t) : Nt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
13358
13364
|
}
|
|
13359
13365
|
function Nr(t) {
|
|
13360
13366
|
try {
|
|
13361
13367
|
const e = new URL(t, location.href);
|
|
13362
13368
|
for (const s of Array.from(e.searchParams.keys()))
|
|
13363
|
-
|
|
13369
|
+
$l.test(s) && e.searchParams.set(s, me);
|
|
13364
13370
|
return e.username && (e.username = me), e.password && (e.password = me), e.toString();
|
|
13365
13371
|
} catch {
|
|
13366
|
-
return
|
|
13372
|
+
return Wl(t);
|
|
13367
13373
|
}
|
|
13368
13374
|
}
|
|
13369
|
-
function
|
|
13370
|
-
return t.replace(
|
|
13371
|
-
}
|
|
13372
|
-
function Kl(t) {
|
|
13373
|
-
return t.replace(xr, `Bearer ${me}`).replace(Mr, `Basic ${me}`).replace(Pr, me).replace(Dr, (e, s) => `${s}: ${Vt}`);
|
|
13375
|
+
function jt(t) {
|
|
13376
|
+
return t.replace(zl, Ll).replace(Hl, Gl).replace(xr, `Bearer ${me}`).replace(Mr, `Basic ${me}`).replace(Pr, me).replace(Dr, (e, s) => `${s}: ${Kt}`);
|
|
13374
13377
|
}
|
|
13375
13378
|
function Wl(t) {
|
|
13376
|
-
|
|
13379
|
+
return t.replace(xr, `Bearer ${me}`).replace(Mr, `Basic ${me}`).replace(Pr, me).replace(Dr, (e, s) => `${s}: ${Kt}`);
|
|
13380
|
+
}
|
|
13381
|
+
function Gl(t) {
|
|
13382
|
+
const e = t.match(Vl)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
|
|
13377
13383
|
return `${Nr(s)}${e}`;
|
|
13378
13384
|
}
|
|
13379
|
-
const
|
|
13380
|
-
init: (t) =>
|
|
13385
|
+
const du = Object.freeze({
|
|
13386
|
+
init: (t) => Vt.init(t)
|
|
13381
13387
|
});
|
|
13382
|
-
function
|
|
13383
|
-
return
|
|
13388
|
+
function lu(t) {
|
|
13389
|
+
return Vt.init(t);
|
|
13384
13390
|
}
|
|
13385
13391
|
export {
|
|
13386
13392
|
mi as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
13387
|
-
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13391
|
-
|
|
13392
|
-
|
|
13393
|
-
|
|
13393
|
+
Qc as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
13394
|
+
Jc as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
13395
|
+
Xc as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
13396
|
+
$o as PRODUCT_AGENT_AUTH_RECONNECTING_ERROR_MESSAGE,
|
|
13397
|
+
ou as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
13398
|
+
du as PlunoProductAgent,
|
|
13399
|
+
eu as ProductAgentInteractionManager,
|
|
13394
13400
|
Jn as ProductAgentQueryController,
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13401
|
+
ru as ProductAgentRemoteRuntimeClient,
|
|
13402
|
+
Vt as ProductAgentSessionEngine,
|
|
13403
|
+
Zl as ProductAgentSessionHistoryManager,
|
|
13404
|
+
su as ProductAgentTaskPageTitleController,
|
|
13399
13405
|
ue as ProductAgentTokenProviderError,
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13406
|
+
md as calculateReconnectDelay,
|
|
13407
|
+
Ql as canSubmitPersonalProductAgentMessage,
|
|
13408
|
+
tu as createLocalStorageInteractionDecisionStorage,
|
|
13403
13409
|
wt as createProductAgentQueryState,
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13410
|
+
lu as createProductAgentRuntime,
|
|
13411
|
+
nu as createProductAgentTaskPageTitleDocument,
|
|
13412
|
+
du as default,
|
|
13413
|
+
Hc as formatProductAgentTaskPageTitle,
|
|
13414
|
+
au as getProductAgentOriginAccessErrorMessage,
|
|
13415
|
+
zo as isProductAgentAuthReconnectError,
|
|
13416
|
+
iu as isProductAgentRuntimeCommand,
|
|
13417
|
+
Bo as mergeProductAgentEntityPages,
|
|
13412
13418
|
_t as normalizeProductAgentEntityPage,
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
+
cu as normalizeProductAgentSessionItems,
|
|
13420
|
+
Fc as readLocalStorageInteractionDecisions,
|
|
13421
|
+
Xl as resolveProductAgentComposerAction,
|
|
13422
|
+
Jl as resolveProductAgentWidgetPresentation,
|
|
13423
|
+
Lo as selectProductAgentQueryEntities,
|
|
13424
|
+
wl as validateProductAgentProviderInputFile
|
|
13419
13425
|
};
|