@pluno/product-agent-web 0.1.319 → 0.1.320
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/model-selection/contracts.d.ts +1 -1
- package/dist/core/model-selection/selectors.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +1 -1
- package/dist/product-agent-sdk.js +400 -400
- package/dist/product-agent-widget.js +612 -612
- package/dist/runtime/modelSelection.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ot(t, e, s) {
|
|
2
2
|
t.throwIfAborted();
|
|
3
3
|
let i, n = () => {
|
|
4
4
|
};
|
|
@@ -20,7 +20,7 @@ function Se(t) {
|
|
|
20
20
|
updatedAt: null
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function vt(t, e) {
|
|
24
24
|
const s = t.key === e.key, i = s ? t.data : null;
|
|
25
25
|
return {
|
|
26
26
|
...t,
|
|
@@ -47,10 +47,10 @@ function nr(t, e) {
|
|
|
47
47
|
function rr(t, e) {
|
|
48
48
|
return t.key !== e.key || t.requestId !== e.requestId ? t : { ...t, status: "error", error: e.error };
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function us(t = null) {
|
|
51
51
|
return { authority: t, refusal: null, query: Se("account") };
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function bt(t, e) {
|
|
54
54
|
return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : t ?? { allowed: !0, reason: "allowed", actions: [] };
|
|
55
55
|
}
|
|
56
56
|
const or = {
|
|
@@ -146,15 +146,15 @@ const or = {
|
|
|
146
146
|
embedded_widget: Oe,
|
|
147
147
|
embedded_custom_ui: Oe
|
|
148
148
|
};
|
|
149
|
-
function
|
|
149
|
+
function It(t, e) {
|
|
150
150
|
return ar[t][e] === !0;
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function hs() {
|
|
153
153
|
return { sources: {}, actions: {} };
|
|
154
154
|
}
|
|
155
155
|
function Xi(t, e, s, i) {
|
|
156
156
|
const n = t.account.authority, r = s.selections[s.clients[i]];
|
|
157
|
-
return !n || !
|
|
157
|
+
return !n || !It(n.profile, "canManageInteractions") || !It(n.profile, "canManageIntegrationAuth") || s.authorityId !== n.authorityId || s.generation !== n.generation || !r || n.interactionAdapters?.integrationAuth === !1 ? [] : Object.values(t.interactions.sources).filter(
|
|
158
158
|
(o) => o.conversation_id === r.sessionId && o.payload.kind === "integration_auth" && o.lifecycle !== "completed"
|
|
159
159
|
).map((o) => {
|
|
160
160
|
const a = Object.values(t.interactions.actions).filter(
|
|
@@ -258,7 +258,7 @@ function cr(t, e, s, i) {
|
|
|
258
258
|
}
|
|
259
259
|
return { state: t, effects: r, command: null };
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function ps(t = 0) {
|
|
262
262
|
return {
|
|
263
263
|
localScribbleStyle: null,
|
|
264
264
|
queries: {},
|
|
@@ -270,8 +270,8 @@ function hs(t = 0) {
|
|
|
270
270
|
schedulerError: null
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
|
-
const
|
|
274
|
-
function
|
|
273
|
+
const Xe = (t) => t;
|
|
274
|
+
function at(t, e) {
|
|
275
275
|
return JSON.stringify([
|
|
276
276
|
t.authorityId,
|
|
277
277
|
t.generation,
|
|
@@ -283,7 +283,7 @@ function ot(t, e) {
|
|
|
283
283
|
null
|
|
284
284
|
]);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function fs(t, e) {
|
|
287
287
|
const s = {
|
|
288
288
|
account: "canReadAccount",
|
|
289
289
|
starterPrompts: "canReadStarterPrompts",
|
|
@@ -291,7 +291,7 @@ function ps(t, e) {
|
|
|
291
291
|
feedback: "canSubmitFeedback",
|
|
292
292
|
generatePrompts: "canReadStarterPrompts"
|
|
293
293
|
}[e.kind];
|
|
294
|
-
if (!s || !
|
|
294
|
+
if (!s || !It(t.profile, s))
|
|
295
295
|
throw new Error("Feature capability unavailable.");
|
|
296
296
|
}
|
|
297
297
|
function ai(t, e, s) {
|
|
@@ -299,9 +299,9 @@ function ai(t, e, s) {
|
|
|
299
299
|
const n = [];
|
|
300
300
|
if (e.type === "stage7.initialize")
|
|
301
301
|
return JSON.stringify(i.account.authority) !== JSON.stringify(e.authority) && (i = {
|
|
302
|
-
account: { ...
|
|
303
|
-
features:
|
|
304
|
-
interactions:
|
|
302
|
+
account: { ...us(), authority: e.authority },
|
|
303
|
+
features: ps(e.now),
|
|
304
|
+
interactions: hs()
|
|
305
305
|
}), { state: i, effects: n };
|
|
306
306
|
const r = i.account.authority;
|
|
307
307
|
if (!r) return { state: i, effects: n };
|
|
@@ -316,8 +316,8 @@ function ai(t, e, s) {
|
|
|
316
316
|
l,
|
|
317
317
|
h
|
|
318
318
|
]), c = (l, h, f, m = !1) => {
|
|
319
|
-
|
|
320
|
-
const p = h === "query" ?
|
|
319
|
+
fs(r, l);
|
|
320
|
+
const p = h === "query" ? at(r, l) : l.kind, g = a(h, f), y = JSON.stringify(l), _ = i.features.pending[g];
|
|
321
321
|
if (_ && _.fingerprint !== y)
|
|
322
322
|
throw new Error("Request ID was reused with a different payload.");
|
|
323
323
|
if (_ && !m || h === "query" && !m && Object.values(i.features.pending).some(
|
|
@@ -326,21 +326,21 @@ function ai(t, e, s) {
|
|
|
326
326
|
return;
|
|
327
327
|
const b = { ...i.features.queries };
|
|
328
328
|
if (h === "query")
|
|
329
|
-
b[p] =
|
|
329
|
+
b[p] = vt(
|
|
330
330
|
b[p] ?? Se(p),
|
|
331
|
-
{ key: p, requestId:
|
|
331
|
+
{ key: p, requestId: Xe(f), mode: "replace" }
|
|
332
332
|
);
|
|
333
333
|
else if (l.kind === "generatePrompts") {
|
|
334
334
|
const I = {
|
|
335
335
|
...l.page,
|
|
336
336
|
kind: "starterPrompts",
|
|
337
337
|
includeUserSuggestions: l.includeUserSuggestions ?? !1
|
|
338
|
-
}, w =
|
|
339
|
-
b[w] =
|
|
338
|
+
}, w = at(r, I);
|
|
339
|
+
b[w] = vt(
|
|
340
340
|
b[w] ?? Se(w),
|
|
341
341
|
{
|
|
342
342
|
key: w,
|
|
343
|
-
requestId:
|
|
343
|
+
requestId: Xe(f),
|
|
344
344
|
mode: "replace"
|
|
345
345
|
}
|
|
346
346
|
);
|
|
@@ -393,14 +393,14 @@ function ai(t, e, s) {
|
|
|
393
393
|
case "stage7.retire":
|
|
394
394
|
return {
|
|
395
395
|
state: {
|
|
396
|
-
account:
|
|
397
|
-
features:
|
|
398
|
-
interactions:
|
|
396
|
+
account: us(),
|
|
397
|
+
features: ps(o),
|
|
398
|
+
interactions: hs()
|
|
399
399
|
},
|
|
400
400
|
effects: n
|
|
401
401
|
};
|
|
402
402
|
case "stage7.account_refusal": {
|
|
403
|
-
const l =
|
|
403
|
+
const l = bt(
|
|
404
404
|
void 0,
|
|
405
405
|
e.code
|
|
406
406
|
);
|
|
@@ -473,7 +473,7 @@ function ai(t, e, s) {
|
|
|
473
473
|
if (!l || l.status !== "pending") break;
|
|
474
474
|
const h = e.type === "effect.failed", f = { ...i.features.queries };
|
|
475
475
|
let m = l.key;
|
|
476
|
-
l.operation.kind === "generatePrompts" && (m =
|
|
476
|
+
l.operation.kind === "generatePrompts" && (m = at(r, {
|
|
477
477
|
...l.operation.page,
|
|
478
478
|
kind: "starterPrompts",
|
|
479
479
|
includeUserSuggestions: l.operation.includeUserSuggestions ?? !1
|
|
@@ -481,11 +481,11 @@ function ai(t, e, s) {
|
|
|
481
481
|
const p = f[m];
|
|
482
482
|
p && (f[m] = h ? rr(p, {
|
|
483
483
|
key: m,
|
|
484
|
-
requestId:
|
|
484
|
+
requestId: Xe(l.requestId),
|
|
485
485
|
error: e.error
|
|
486
486
|
}) : nr(p, {
|
|
487
487
|
key: m,
|
|
488
|
-
requestId:
|
|
488
|
+
requestId: Xe(l.requestId),
|
|
489
489
|
data: e.output.data,
|
|
490
490
|
cursor: null,
|
|
491
491
|
updatedAt: e.output.completedAt
|
|
@@ -532,14 +532,14 @@ function ai(t, e, s) {
|
|
|
532
532
|
}
|
|
533
533
|
return { state: i, effects: n };
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
return t.account.authority ? t.features.queries[
|
|
535
|
+
function wt(t, e) {
|
|
536
|
+
return t.account.authority ? t.features.queries[at(t.account.authority, e)] ?? null : null;
|
|
537
537
|
}
|
|
538
538
|
function dr(t, e) {
|
|
539
|
-
const s =
|
|
539
|
+
const s = wt(t, e);
|
|
540
540
|
return s?.status === "loading" || s?.status === "refreshing";
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function ms(t) {
|
|
543
543
|
if (!t || typeof t != "object" || Array.isArray(t))
|
|
544
544
|
throw new Error("Invalid feature response object.");
|
|
545
545
|
return t;
|
|
@@ -554,7 +554,7 @@ function ci(t) {
|
|
|
554
554
|
return t.map(lr);
|
|
555
555
|
}
|
|
556
556
|
function ur(t) {
|
|
557
|
-
const e =
|
|
557
|
+
const e = ms(t);
|
|
558
558
|
if (e.success !== !0)
|
|
559
559
|
throw new Error(
|
|
560
560
|
typeof e.message == "string" ? e.message : "Failed to submit feedback"
|
|
@@ -570,7 +570,7 @@ function hr(t) {
|
|
|
570
570
|
};
|
|
571
571
|
return {
|
|
572
572
|
"stage7.query": async ({ authority: s, query: i }) => {
|
|
573
|
-
e(s),
|
|
573
|
+
e(s), fs(s, i);
|
|
574
574
|
let n;
|
|
575
575
|
switch (i.kind) {
|
|
576
576
|
case "account":
|
|
@@ -580,7 +580,7 @@ function hr(t) {
|
|
|
580
580
|
};
|
|
581
581
|
break;
|
|
582
582
|
case "starterPrompts": {
|
|
583
|
-
const r =
|
|
583
|
+
const r = ms(
|
|
584
584
|
await t.http.request(
|
|
585
585
|
"/starter-prompts",
|
|
586
586
|
{ page_url: i.pageUrl },
|
|
@@ -605,7 +605,7 @@ function hr(t) {
|
|
|
605
605
|
return e(s), { data: n, completedAt: t.now() };
|
|
606
606
|
},
|
|
607
607
|
"stage7.mutate": async ({ authority: s, mutation: i }) => {
|
|
608
|
-
e(s),
|
|
608
|
+
e(s), fs(s, i);
|
|
609
609
|
let n;
|
|
610
610
|
switch (i.kind) {
|
|
611
611
|
case "feedback":
|
|
@@ -614,7 +614,7 @@ function hr(t) {
|
|
|
614
614
|
});
|
|
615
615
|
break;
|
|
616
616
|
case "generatePrompts": {
|
|
617
|
-
const r =
|
|
617
|
+
const r = ms(
|
|
618
618
|
await t.http.request(
|
|
619
619
|
"/starter-prompts",
|
|
620
620
|
{},
|
|
@@ -706,7 +706,7 @@ function Yi(t, e, s) {
|
|
|
706
706
|
(g) => g.requestId === r
|
|
707
707
|
);
|
|
708
708
|
if (!p && e.type === "stage7.query") {
|
|
709
|
-
const g =
|
|
709
|
+
const g = wt(m, e.query);
|
|
710
710
|
g?.status === "error" ? h(g.error) : g?.status === "ready" && g.data && h(null, g.data);
|
|
711
711
|
}
|
|
712
712
|
p?.status === "error" ? h(p.error) : p?.status === "done" && h(null, p.result);
|
|
@@ -812,7 +812,7 @@ function vr(t, e, s = null, i = !0) {
|
|
|
812
812
|
reason: o,
|
|
813
813
|
recovery: a
|
|
814
814
|
}), r = t.authority;
|
|
815
|
-
return r ?
|
|
815
|
+
return r ? It(
|
|
816
816
|
r.profile,
|
|
817
817
|
or[e]
|
|
818
818
|
) ? i ? n("allowed", "none") : n("device", "settings") : n("capability", "none") : n("authentication", "login");
|
|
@@ -846,24 +846,24 @@ function br(t, e = null) {
|
|
|
846
846
|
} : void 0);
|
|
847
847
|
return { ...i, ...a ? { auth: a } : {}, submissionGate: o };
|
|
848
848
|
}
|
|
849
|
-
const Ir = "0.1.
|
|
849
|
+
const Ir = "0.1.320", At = {
|
|
850
850
|
version: Ir
|
|
851
851
|
};
|
|
852
|
-
function
|
|
852
|
+
function Ve(t) {
|
|
853
853
|
if (!t || typeof t != "object") return !1;
|
|
854
854
|
const e = t;
|
|
855
855
|
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);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function He(t) {
|
|
858
858
|
if (t === null || typeof t == "string" || typeof t == "boolean") return !0;
|
|
859
859
|
if (typeof t == "number") return Number.isFinite(t);
|
|
860
|
-
if (Array.isArray(t)) return t.every(
|
|
860
|
+
if (Array.isArray(t)) return t.every(He);
|
|
861
861
|
if (typeof t != "object") return !1;
|
|
862
862
|
const e = Object.getPrototypeOf(t);
|
|
863
|
-
return e !== Object.prototype && e !== null ? !1 : Object.values(t).every(
|
|
863
|
+
return e !== Object.prototype && e !== null ? !1 : Object.values(t).every(He);
|
|
864
864
|
}
|
|
865
865
|
function wr(t) {
|
|
866
|
-
if (t.details !== void 0 && !
|
|
866
|
+
if (t.details !== void 0 && !He(t.details))
|
|
867
867
|
throw new TypeError("Product Agent transported error details must be JSON-safe.");
|
|
868
868
|
return {
|
|
869
869
|
code: t.code,
|
|
@@ -876,7 +876,7 @@ function J(t, e = "runtime_error", s = "runtime") {
|
|
|
876
876
|
const i = t !== null && typeof t == "object" ? t : null, n = typeof t == "string" ? t : i && "message" in i && typeof i.message == "string" ? i.message : "", r = i && "code" in i && typeof i.code == "string" && i.code.trim() ? i.code : e, o = i && "details" in i ? i.details : null, a = o && typeof o == "object" ? o : {}, c = {
|
|
877
877
|
...typeof a.httpStatus == "number" && Number.isInteger(a.httpStatus) && a.httpStatus >= 100 && a.httpStatus <= 599 ? { httpStatus: a.httpStatus } : {},
|
|
878
878
|
// Preserve the first boundary's shape after normalization replaces the original message/prototype.
|
|
879
|
-
errorNormalization:
|
|
879
|
+
errorNormalization: Ve(a.errorNormalization) ? a.errorNormalization : {
|
|
880
880
|
boundary: s,
|
|
881
881
|
category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
|
|
882
882
|
messageKind: n.trim() === "[object Object]" ? "object_coercion" : n.trim() ? "text" : typeof t == "string" || i && "message" in i && typeof i.message == "string" ? "blank" : "non_text"
|
|
@@ -905,20 +905,20 @@ function ve(t) {
|
|
|
905
905
|
if (!e) throw new Error("Display timestamps must retain the backend UTC precision.");
|
|
906
906
|
return `${e[1]}.${(e[2] ?? "").padEnd(6, "0")}`;
|
|
907
907
|
}
|
|
908
|
-
function
|
|
908
|
+
function _t(t) {
|
|
909
909
|
return "revision" in t.data ? t.data.revision : null;
|
|
910
910
|
}
|
|
911
911
|
function K(t) {
|
|
912
912
|
return t !== null && typeof t == "object" && !Object.isFrozen(t) && (Object.values(t).forEach(K), Object.freeze(t)), t;
|
|
913
913
|
}
|
|
914
914
|
function Q(t) {
|
|
915
|
-
if (!
|
|
915
|
+
if (!He(t)) throw new Error("Conversation inputs must be JSON-safe values.");
|
|
916
916
|
return JSON.parse(JSON.stringify(t));
|
|
917
917
|
}
|
|
918
918
|
function en(t = "", e = 0) {
|
|
919
919
|
return K({ authorityId: t, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, durableSubmissionIds: [], pendingDurabilityIds: [], checkpointEffectId: null, checkpointError: null });
|
|
920
920
|
}
|
|
921
|
-
function
|
|
921
|
+
function gs(t) {
|
|
922
922
|
return {
|
|
923
923
|
sessionId: t,
|
|
924
924
|
items: {},
|
|
@@ -935,22 +935,22 @@ function tn(t) {
|
|
|
935
935
|
return ["history_load_failed", "request_timed_out", "connection_interrupted", "408", "425", "429"].includes(t) || /^5\d\d$/.test(t);
|
|
936
936
|
}
|
|
937
937
|
const Sr = "Message storage has not confirmed this submission. Reconnect to check its status.";
|
|
938
|
-
function
|
|
938
|
+
function Et(t) {
|
|
939
939
|
if (!Number.isSafeInteger(t) || t < 0) throw new Error("Invalid conversation revision.");
|
|
940
940
|
}
|
|
941
|
-
function
|
|
941
|
+
function ys(t, e) {
|
|
942
942
|
if (e.conversation_id !== t.sessionId) throw new Error("Display item belongs to another conversation.");
|
|
943
943
|
if (t.removedItems[e.id]) return t;
|
|
944
944
|
const s = ve(e.created_at);
|
|
945
945
|
ve(e.updated_at);
|
|
946
|
-
const i =
|
|
947
|
-
i !== null &&
|
|
946
|
+
const i = _t(e);
|
|
947
|
+
i !== null && Et(i);
|
|
948
948
|
const n = t.streams[e.id];
|
|
949
949
|
if (i !== null && n && (n.state === "stopped" || n.state === "finished") && i > n.revision) return t;
|
|
950
950
|
const r = t.items[e.id];
|
|
951
951
|
if (r) {
|
|
952
952
|
if (ve(r.created_at) !== s) throw new Error("Display shell timestamp changed.");
|
|
953
|
-
const o =
|
|
953
|
+
const o = _t(r);
|
|
954
954
|
if (o !== null && i !== null) {
|
|
955
955
|
if (i <= o) return t;
|
|
956
956
|
} else if (ve(e.updated_at) <= ve(r.updated_at)) return t;
|
|
@@ -958,13 +958,13 @@ function gs(t, e) {
|
|
|
958
958
|
return { ...t, items: { ...t.items, [e.id]: { ...e, created_at: r?.created_at ?? e.created_at } } };
|
|
959
959
|
}
|
|
960
960
|
function sn(t, e) {
|
|
961
|
-
if (
|
|
961
|
+
if (Et(e.revision), t.removedItems[e.item_id]) return t;
|
|
962
962
|
const s = t.streams[e.item_id];
|
|
963
963
|
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 } };
|
|
964
964
|
}
|
|
965
|
-
function
|
|
965
|
+
function vs(t, e) {
|
|
966
966
|
if (e.conversation_id !== t.sessionId) throw new Error("Execution belongs to another conversation.");
|
|
967
|
-
if (
|
|
967
|
+
if (Et(e.version), t.execution && e.version <= t.execution.version) return t;
|
|
968
968
|
const s = { ...t.executionByUserMessage };
|
|
969
969
|
for (const i of ie(e)) s[i] = {
|
|
970
970
|
version: e.version,
|
|
@@ -976,23 +976,23 @@ function ys(t, e) {
|
|
|
976
976
|
function Rr(t) {
|
|
977
977
|
const e = /* @__PURE__ */ new Set();
|
|
978
978
|
for (const s of Object.values(t.items)) {
|
|
979
|
-
const i =
|
|
979
|
+
const i = _t(s), n = t.streams[s.id];
|
|
980
980
|
i !== null && (!n || n.state === "open" || i < n.revision) && e.add(s.id);
|
|
981
981
|
}
|
|
982
982
|
for (const s of [...Object.keys(t.streams), ...Object.values(t.removedItems)])
|
|
983
983
|
!t.items[s] && !t.removedItems[s] && e.add(s);
|
|
984
984
|
return [...e];
|
|
985
985
|
}
|
|
986
|
-
function
|
|
986
|
+
function Lt(t, e) {
|
|
987
987
|
switch (e.type) {
|
|
988
988
|
case "conversation.interaction.updated":
|
|
989
989
|
return t;
|
|
990
990
|
case "conversation.follow_ups.updated":
|
|
991
|
-
return
|
|
991
|
+
return Et(e.version), e.version > t.followUpsVersion ? { ...t, followUps: e.follow_ups, followUpsVersion: e.version } : t;
|
|
992
992
|
case "conversation.item.updated":
|
|
993
|
-
return
|
|
993
|
+
return ys(t, e.item);
|
|
994
994
|
case "conversation.execution.updated":
|
|
995
|
-
return
|
|
995
|
+
return vs(t, e.execution);
|
|
996
996
|
case "conversation.item.stream_finished":
|
|
997
997
|
if (e.conversation_id !== t.sessionId) throw new Error("Stream belongs to another conversation.");
|
|
998
998
|
return sn(t, { item_id: e.item_id, revision: e.revision, state: e.state });
|
|
@@ -1006,20 +1006,20 @@ function jt(t, e) {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
1008
|
}
|
|
1009
|
-
function
|
|
1009
|
+
function bs(t, e, s) {
|
|
1010
1010
|
const i = { ...t.submissions };
|
|
1011
1011
|
for (const n of Object.values(i))
|
|
1012
1012
|
if (n.conversationScopeId === e.conversationScopeId && !((n.cancelled || e.cancelled) && n.userMessageId !== e.userMessageId)) {
|
|
1013
1013
|
if (n.sessionId !== null && n.sessionId !== s) throw new Error("Submission scope accepted into conflicting conversations.");
|
|
1014
1014
|
i[n.userMessageId] = { ...n, sessionId: s };
|
|
1015
1015
|
}
|
|
1016
|
-
return { ...t, submissions: i, sessions: { ...t.sessions, [s]: t.sessions[s] ??
|
|
1016
|
+
return { ...t, submissions: i, sessions: { ...t.sessions, [s]: t.sessions[s] ?? gs(s) } };
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function Is(t, e) {
|
|
1019
1019
|
const s = e.clients[t.clientScopeId];
|
|
1020
1020
|
return s === t.conversationScopeId || s === void 0 && t.sessionId !== null && (e.memberships[t.sessionId]?.members.length ?? 0) > 0;
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function ws(t, e, s = !1) {
|
|
1023
1023
|
if (t.authorityId !== (e.authorityId ?? "") || t.generation !== e.generation) {
|
|
1024
1024
|
const r = en(e.authorityId ?? void 0, e.generation);
|
|
1025
1025
|
if (!s || t.authorityId) return r;
|
|
@@ -1036,9 +1036,9 @@ function Is(t, e, s = !1) {
|
|
|
1036
1036
|
let n = Object.keys(i).length === Object.keys(t.pendingRestoration).length ? t : { ...t, pendingRestoration: i };
|
|
1037
1037
|
for (const r of Object.values(t.submissions)) {
|
|
1038
1038
|
if (n.pendingRestoration[r.clientScopeId] === r.conversationScopeId) continue;
|
|
1039
|
-
r.delivery !== "accepted" && !r.cancelled && !
|
|
1039
|
+
r.delivery !== "accepted" && !r.cancelled && !Is(r, e) && (n = { ...n, submissions: { ...n.submissions, [r.userMessageId]: { ...r, cancelled: !0, cancellationReason: r.cancellationReason ?? "owner_lost" } } });
|
|
1040
1040
|
const o = e.selections[r.conversationScopeId]?.sessionId;
|
|
1041
|
-
o && !n.submissions[r.userMessageId].cancelled && r.sessionId === null && (n =
|
|
1041
|
+
o && !n.submissions[r.userMessageId].cancelled && r.sessionId === null && (n = bs(n, n.submissions[r.userMessageId], o));
|
|
1042
1042
|
}
|
|
1043
1043
|
for (const [r, o] of Object.entries(n.requests)) {
|
|
1044
1044
|
if ((e.memberships[o.sessionId]?.members.length ?? 0) > 0) continue;
|
|
@@ -1052,7 +1052,7 @@ function Is(t, e, s = !1) {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
return K(n);
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Ye(t) {
|
|
1056
1056
|
return JSON.stringify(t, (e, s) => s && typeof s == "object" && !Array.isArray(s) ? Object.fromEntries(Object.entries(s).sort(([i], [n]) => i.localeCompare(n))) : s);
|
|
1057
1057
|
}
|
|
1058
1058
|
function kr(t, e, s, i) {
|
|
@@ -1079,8 +1079,8 @@ function kr(t, e, s, i) {
|
|
|
1079
1079
|
let f = t.submissions;
|
|
1080
1080
|
if (e.type === "effect.completed" && e.output.snapshot.conversation_id !== a.sessionId) throw new Error("Snapshot belongs to another conversation.");
|
|
1081
1081
|
if (e.type === "effect.completed" && !e.output.snapshot.projection_ready && (e.output.snapshot.preparation === "pending" || e.output.snapshot.preparation === "busy")) {
|
|
1082
|
-
for (const m of e.output.snapshot.items) m.type === "user_message" && (c =
|
|
1083
|
-
c =
|
|
1082
|
+
for (const m of e.output.snapshot.items) m.type === "user_message" && (c = ys(c, m));
|
|
1083
|
+
c = vs(c, e.output.snapshot.execution), c = {
|
|
1084
1084
|
...c,
|
|
1085
1085
|
...a.lane === "current" ? { preparation: e.output.snapshot.preparation } : {},
|
|
1086
1086
|
queries: { ...c.queries, [a.lane]: { ...d, status: "loading", requestId: null, error: null } }
|
|
@@ -1097,10 +1097,10 @@ function kr(t, e, s, i) {
|
|
|
1097
1097
|
a.lane === "current" && (c = { ...c, preparation: null });
|
|
1098
1098
|
const p = c.queries.history, g = a.lane === "current" && (p.status === "not_requested" || m.next_cursor !== null && !c.items[m.next_cursor]);
|
|
1099
1099
|
if (m.conversation_id !== a.sessionId) throw new Error("Snapshot belongs to another conversation.");
|
|
1100
|
-
for (const y of m.removed_items) c =
|
|
1101
|
-
for (const y of m.items) c =
|
|
1100
|
+
for (const y of m.removed_items) c = Lt(c, y);
|
|
1101
|
+
for (const y of m.items) c = ys(c, y);
|
|
1102
1102
|
for (const y of m.streams) c = sn(c, y);
|
|
1103
|
-
if (c =
|
|
1103
|
+
if (c = vs(c, m.execution), c = Lt(c, {
|
|
1104
1104
|
type: "conversation.follow_ups.updated",
|
|
1105
1105
|
conversation_id: m.conversation_id,
|
|
1106
1106
|
version: m.follow_ups_version,
|
|
@@ -1151,7 +1151,7 @@ function kr(t, e, s, i) {
|
|
|
1151
1151
|
if (!a || a.cancelled || a.delivery === "failed") return { state: t, effects: r };
|
|
1152
1152
|
const c = Q({ pageContent: e.pageContent, sessionTabs: e.sessionTabs });
|
|
1153
1153
|
if (a.contextPreparation !== null) {
|
|
1154
|
-
if (
|
|
1154
|
+
if (Ye(a.contextPreparation) !== Ye(c)) throw new Error("Prepared submission context cannot change.");
|
|
1155
1155
|
return { state: t, effects: r };
|
|
1156
1156
|
}
|
|
1157
1157
|
n = { ...t, submissions: { ...t.submissions, [e.userMessageId]: { ...a, contextPreparation: c } } };
|
|
@@ -1162,7 +1162,7 @@ function kr(t, e, s, i) {
|
|
|
1162
1162
|
const { type: a, authorityId: c, generation: d, prepareContext: u, reconcileAcceptance: l, waitForAuthentication: h, ...f } = e, m = t.submissions[e.userMessageId];
|
|
1163
1163
|
if (m) {
|
|
1164
1164
|
const { contextPreparation: I, requestedModel: w, sessionId: A, delivery: E, cancelled: D, cancellationReason: S, error: q, executionVersion: k, ...P } = m;
|
|
1165
|
-
if (
|
|
1165
|
+
if (Ye(P) !== Ye(f)) throw new Error("User-message identity cannot be reused with different input.");
|
|
1166
1166
|
return { state: t, effects: r };
|
|
1167
1167
|
}
|
|
1168
1168
|
const p = s.selections[e.conversationScopeId], g = Object.values(t.submissions).find((I) => I.conversationScopeId === e.conversationScopeId && !I.cancelled && I.sessionId !== null), y = i.scopes[e.clientScopeId], _ = {
|
|
@@ -1182,7 +1182,7 @@ function kr(t, e, s, i) {
|
|
|
1182
1182
|
case "conversation.submission_accepted": {
|
|
1183
1183
|
const a = t.submissions[e.userMessageId];
|
|
1184
1184
|
if (!a) return { state: t, effects: r };
|
|
1185
|
-
n =
|
|
1185
|
+
n = bs(t, a, e.sessionId), n = { ...n, submissions: { ...n.submissions, [e.userMessageId]: { ...n.submissions[e.userMessageId], delivery: "accepted", error: null } } };
|
|
1186
1186
|
break;
|
|
1187
1187
|
}
|
|
1188
1188
|
case "conversation.submission_delivery": {
|
|
@@ -1208,14 +1208,14 @@ function kr(t, e, s, i) {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
case "conversation.display_received": {
|
|
1210
1210
|
const a = Q(e.event), c = a.type === "conversation.item.updated" ? a.item.conversation_id : a.type === "conversation.execution.updated" ? a.execution.conversation_id : a.type === "conversation.interaction.updated" ? a.interaction.conversation_id : a.conversation_id, d = a.type === "conversation.item.updated" && a.item.type === "user_message" ? t.submissions[a.item.id] : void 0;
|
|
1211
|
-
if (d && (n =
|
|
1211
|
+
if (d && (n = bs(t, d, c)), !n.sessions[c] && !s.memberships[c]?.members.length && !d) return { state: t, effects: r };
|
|
1212
1212
|
s.memberships[c]?.members.length && (a.type === "conversation.interaction.updated" || a.type === "conversation.execution.updated" || a.type === "conversation.item.updated" && a.item.type === "user_message") && (o = {
|
|
1213
1213
|
authorityId: t.authorityId,
|
|
1214
1214
|
generation: t.generation,
|
|
1215
1215
|
sessionId: c,
|
|
1216
1216
|
sources: a.type === "conversation.interaction.updated" ? [a.interaction] : []
|
|
1217
1217
|
});
|
|
1218
|
-
const u = n.sessions[c] ??
|
|
1218
|
+
const u = n.sessions[c] ?? gs(c), l = Lt(u, a);
|
|
1219
1219
|
l !== u && (n = { ...n, sessions: { ...n.sessions, [c]: l } });
|
|
1220
1220
|
break;
|
|
1221
1221
|
}
|
|
@@ -1234,7 +1234,7 @@ function kr(t, e, s, i) {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
case "conversation.snapshot": {
|
|
1236
1236
|
if (!s.memberships[e.sessionId]?.members.length) return { state: t, effects: r };
|
|
1237
|
-
const a = t.sessions[e.sessionId] ??
|
|
1237
|
+
const a = t.sessions[e.sessionId] ?? gs(e.sessionId), c = a.queries[e.lane];
|
|
1238
1238
|
if (c.requestId !== null) return { state: t, effects: r };
|
|
1239
1239
|
const d = {
|
|
1240
1240
|
authorityId: e.authorityId,
|
|
@@ -1252,7 +1252,7 @@ function kr(t, e, s, i) {
|
|
|
1252
1252
|
requests: { ...t.requests, [h]: { ...d, acceptedUserMessageIds: u } },
|
|
1253
1253
|
sessions: { ...t.sessions, [e.sessionId]: { ...a, queries: {
|
|
1254
1254
|
...a.queries,
|
|
1255
|
-
[e.lane]:
|
|
1255
|
+
[e.lane]: vt(c, { key: c.key, requestId: e.requestId, mode: d.before === null ? "replace" : "append" })
|
|
1256
1256
|
} } }
|
|
1257
1257
|
}, r.push({ id: h, kind: "conversation.snapshot", input: d });
|
|
1258
1258
|
break;
|
|
@@ -1318,7 +1318,7 @@ function pe(t, e) {
|
|
|
1318
1318
|
const s = t.submissions[e], i = t.deliveries[e];
|
|
1319
1319
|
return !s.cancelled || i?.step === "send" || i?.step === "receipt";
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function _s(t, e, s, i = !1) {
|
|
1322
1322
|
if (!e.effectsEnabled || !i && t.submissions === e.submissions && t.deliveries === e.deliveries && t.operations === e.operations && t.stops === e.stops && t.sessions === e.sessions) return { state: e, effects: [] };
|
|
1323
1323
|
const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, o = K({ ...e, requestSequence: n, checkpointEffectId: r });
|
|
1324
1324
|
return { state: o, effects: [{ id: r, kind: "conversation.checkpoint", input: {
|
|
@@ -1327,7 +1327,7 @@ function ws(t, e, s, i = !1) {
|
|
|
1327
1327
|
checkpoint: Ns(o, s)
|
|
1328
1328
|
} }] };
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1330
|
+
function Ss(t, e = null) {
|
|
1331
1331
|
return { command: Q(t), conversationScopeId: e, phase: "waiting", effectId: null, result: null, error: null };
|
|
1332
1332
|
}
|
|
1333
1333
|
function Ar(t) {
|
|
@@ -1339,7 +1339,7 @@ function ui(t, e) {
|
|
|
1339
1339
|
throw new Error("Conversation acceptance receipt does not match the submitted message.");
|
|
1340
1340
|
return { sessionId: t.sessionId, clientMessageId: e };
|
|
1341
1341
|
}
|
|
1342
|
-
function
|
|
1342
|
+
function Rs(t) {
|
|
1343
1343
|
let e = t;
|
|
1344
1344
|
const s = [];
|
|
1345
1345
|
if (!t.effectsEnabled || !t.authorityId) return { state: t, effects: s };
|
|
@@ -1403,7 +1403,7 @@ function Ss(t) {
|
|
|
1403
1403
|
const o = (a, c, d, u = "user_requested") => {
|
|
1404
1404
|
if (e.operations[a]) return;
|
|
1405
1405
|
const l = n();
|
|
1406
|
-
e = { ...e, operations: { ...e.operations, [a]:
|
|
1406
|
+
e = { ...e, operations: { ...e.operations, [a]: Ss({
|
|
1407
1407
|
request_id: l,
|
|
1408
1408
|
type: "run.stop",
|
|
1409
1409
|
payload: { sessionId: c, expectedUserMessageId: d, reason: u }
|
|
@@ -1525,7 +1525,7 @@ function Er(t, e, s, i) {
|
|
|
1525
1525
|
const m = e.output;
|
|
1526
1526
|
m?.sessionId && (n = { ...n, operations: {
|
|
1527
1527
|
...n.operations,
|
|
1528
|
-
[`cleanup:${h}`]:
|
|
1528
|
+
[`cleanup:${h}`]: Ss({
|
|
1529
1529
|
request_id: `cleanup:${f.command.request_id}`,
|
|
1530
1530
|
type: "session.reset",
|
|
1531
1531
|
payload: {
|
|
@@ -1564,8 +1564,8 @@ function Er(t, e, s, i) {
|
|
|
1564
1564
|
submissions: Object.fromEntries(Object.entries(m.submissions).map(([I, w]) => [I, {
|
|
1565
1565
|
...w,
|
|
1566
1566
|
executionVersion: null,
|
|
1567
|
-
cancelled: w.cancelled || !b(w) && !
|
|
1568
|
-
...!w.cancelled && !b(w) && !
|
|
1567
|
+
cancelled: w.cancelled || !b(w) && !Is(w, s),
|
|
1568
|
+
...!w.cancelled && !b(w) && !Is(w, s) ? { cancellationReason: "owner_lost" } : {},
|
|
1569
1569
|
delivery: (w.contextPreparation === null && !m.deliveries[I]?.handoffRecovery || !m.deliveries[I]) && !w.cancelled && w.delivery !== "accepted" ? "failed" : w.delivery === "sending" ? "uncertain" : w.delivery,
|
|
1570
1570
|
error: w.contextPreparation === null && !m.deliveries[I]?.handoffRecovery && !w.cancelled && !["unauthorized", "auth_reconnecting"].includes(w.error?.code ?? "") ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : !m.deliveries[I] && w.delivery !== "accepted" && !w.cancelled ? { code: "submission_interrupted", message: "Message preparation was interrupted. Retry this message.", retryable: !0 } : w.error
|
|
1571
1571
|
}])),
|
|
@@ -1594,7 +1594,7 @@ function Er(t, e, s, i) {
|
|
|
1594
1594
|
}
|
|
1595
1595
|
if (e.type === "conversation.restoration_resolved") {
|
|
1596
1596
|
const l = { ...n.pendingRestoration };
|
|
1597
|
-
delete l[e.clientScopeId], n =
|
|
1597
|
+
delete l[e.clientScopeId], n = ws({ ...n, pendingRestoration: l }, s);
|
|
1598
1598
|
}
|
|
1599
1599
|
if (e.type === "conversation.recover" && (n = {
|
|
1600
1600
|
...t,
|
|
@@ -1658,7 +1658,7 @@ function Er(t, e, s, i) {
|
|
|
1658
1658
|
})) : t.stops;
|
|
1659
1659
|
n = { ...t, stops: f, effectsEnabled: !0, operations: {
|
|
1660
1660
|
...t.operations,
|
|
1661
|
-
[l.request_id]:
|
|
1661
|
+
[l.request_id]: Ss(l, e.conversationScopeId ?? null)
|
|
1662
1662
|
} };
|
|
1663
1663
|
}
|
|
1664
1664
|
}
|
|
@@ -1709,7 +1709,7 @@ function Er(t, e, s, i) {
|
|
|
1709
1709
|
return h && !h.cancelled && !["accepted", "failed"].includes(h.delivery) && !a.durableSubmissionIds.includes(l);
|
|
1710
1710
|
});
|
|
1711
1711
|
c.length !== a.pendingDurabilityIds.length && (a = { ...a, pendingDurabilityIds: c });
|
|
1712
|
-
const d =
|
|
1712
|
+
const d = Rs(a), u = _s(t, d.state, s, e.type === "conversation.recover" && t.checkpointError !== null);
|
|
1713
1713
|
return { state: u.state, effects: [...u.effects, ...o.effects, ...d.effects], interactionSources: o.interactionSources };
|
|
1714
1714
|
}
|
|
1715
1715
|
const Tr = [
|
|
@@ -1795,7 +1795,7 @@ function qr(t) {
|
|
|
1795
1795
|
const on = Math.random().toString(36).slice(2);
|
|
1796
1796
|
let Mr = 0;
|
|
1797
1797
|
const hi = () => `timing:${on}:${++Mr}`, Pe = (t) => typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
|
|
1798
|
-
function
|
|
1798
|
+
function We(t) {
|
|
1799
1799
|
if (!t || typeof t != "object") return !1;
|
|
1800
1800
|
const e = t;
|
|
1801
1801
|
return Object.keys(e).every((s) => ["entrySurface", "operation", "layer", "stage", "status", "spanId", "requestId", "clientMessageId", "sessionId", "occurredAt", "durationMs", "failureCategory", "tabId", "queueDepth", "workerId"].includes(s)) && (e.tabId === void 0 || Number.isSafeInteger(e.tabId) && e.tabId >= 0) && (e.queueDepth === void 0 || Number.isSafeInteger(e.queueDepth) && e.queueDepth >= 0) && (e.workerId === void 0 || Pe(e.workerId)) && (e.failureCategory === void 0 || e.status === "failed" && rn.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) && Tr.includes(e.stage) && ["started", "completed", "failed", "observed"].includes(e.status) && Pe(e.spanId) && Pe(e.requestId) && (e.clientMessageId === null || Pe(e.clientMessageId)) && (e.sessionId === null || Pe(e.sessionId)) && typeof e.occurredAt == "string" && e.occurredAt.length <= 40 && Number.isFinite(Date.parse(e.occurredAt)) && Number.isSafeInteger(e.durationMs) && e.durationMs >= 0;
|
|
@@ -1817,7 +1817,7 @@ function G(t, e) {
|
|
|
1817
1817
|
durationMs: Math.max(0, Math.round(performance.now() - o)),
|
|
1818
1818
|
...r === "failed" ? { failureCategory: qr(c) } : {}
|
|
1819
1819
|
};
|
|
1820
|
-
t &&
|
|
1820
|
+
t && We(d) && Promise.resolve().then(() => t(d)).catch(() => {
|
|
1821
1821
|
});
|
|
1822
1822
|
};
|
|
1823
1823
|
return {
|
|
@@ -1843,7 +1843,7 @@ function Cr(t) {
|
|
|
1843
1843
|
});
|
|
1844
1844
|
};
|
|
1845
1845
|
return (n) => {
|
|
1846
|
-
|
|
1846
|
+
We(n) && (JSON.stringify([...e, n]).length > 2800 && i(), e.push(n), e.length === 8 ? i() : s ??= setTimeout(i, 250));
|
|
1847
1847
|
};
|
|
1848
1848
|
}
|
|
1849
1849
|
function Or(t) {
|
|
@@ -1991,7 +1991,7 @@ function an(t) {
|
|
|
1991
1991
|
function Br(t) {
|
|
1992
1992
|
if (!t || typeof t != "object") return !1;
|
|
1993
1993
|
const e = t;
|
|
1994
|
-
return Object.keys(e).every((s) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(s)) && (e.clientMessageId === void 0 || x(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((s) => s === null || x(s) !== null) && (e.normalization === void 0 ||
|
|
1994
|
+
return Object.keys(e).every((s) => ["sessionId", "requestId", "code", "normalization", "builds", "clientMessageId"].includes(s)) && (e.clientMessageId === void 0 || x(e.clientMessageId) !== null) && [e.sessionId, e.requestId, e.code].every((s) => s === null || x(s) !== null) && (e.normalization === void 0 || Ve(e.normalization)) && !!e.builds && typeof e.builds == "object" && typeof e.builds.sdk == "string" && Object.entries(e.builds).every(([s, i]) => ["sdk", "rendererExtension", "contentExtension", "backgroundExtension"].includes(s) && typeof i == "string" && /^\d{1,5}\.\d{1,5}\.\d{1,5}$/.test(i));
|
|
1995
1995
|
}
|
|
1996
1996
|
function cn(t, e, s, i, n = {}) {
|
|
1997
1997
|
const r = !i && e === "conversation_error" && s !== void 0 && t.conversationDiagnostics?.errorMessageFingerprint === an(_e(s)) ? t.conversationDiagnostics : void 0;
|
|
@@ -2000,8 +2000,8 @@ function cn(t, e, s, i, n = {}) {
|
|
|
2000
2000
|
requestId: x(r?.httpRequest?.requestId ?? r?.errorRequestId ?? r?.queryRequestId),
|
|
2001
2001
|
...x(r?.failedClientMessageId) ? { clientMessageId: r.failedClientMessageId } : {},
|
|
2002
2002
|
code: r ? x(t.lastErrorCode) : null,
|
|
2003
|
-
...
|
|
2004
|
-
builds: { sdk:
|
|
2003
|
+
...Ve(r?.errorNormalization) ? { normalization: r.errorNormalization } : {},
|
|
2004
|
+
builds: { sdk: At.version, ...n }
|
|
2005
2005
|
};
|
|
2006
2006
|
}
|
|
2007
2007
|
function jr(t, e = "runtime") {
|
|
@@ -2010,7 +2010,7 @@ function jr(t, e = "runtime") {
|
|
|
2010
2010
|
`).replace(/\n\s*at\s/g, `
|
|
2011
2011
|
frame `)) : void 0;
|
|
2012
2012
|
return {
|
|
2013
|
-
...
|
|
2013
|
+
...Ve(s.details?.errorNormalization) ? { normalization: s.details.errorNormalization } : {},
|
|
2014
2014
|
category: t instanceof Error ? "error" : t === null ? "null" : Array.isArray(t) ? "array" : typeof t,
|
|
2015
2015
|
code: _e(s.code),
|
|
2016
2016
|
message: _e(s.message),
|
|
@@ -2103,7 +2103,7 @@ function $r(t, e) {
|
|
|
2103
2103
|
}
|
|
2104
2104
|
return { schema: 1, authorityId: t.authorityId, operations: t.operations, stops: t.stops, requestSequence: t.requestSequence, submissions: s, submissionOrder: Object.keys(s), deliveries: i };
|
|
2105
2105
|
}
|
|
2106
|
-
function
|
|
2106
|
+
function Ft(t) {
|
|
2107
2107
|
try {
|
|
2108
2108
|
return window.sessionStorage.getItem(t);
|
|
2109
2109
|
} catch (e) {
|
|
@@ -2186,11 +2186,11 @@ oe.pong = "3";
|
|
|
2186
2186
|
oe.message = "4";
|
|
2187
2187
|
oe.upgrade = "5";
|
|
2188
2188
|
oe.noop = "6";
|
|
2189
|
-
const
|
|
2189
|
+
const ct = /* @__PURE__ */ Object.create(null);
|
|
2190
2190
|
Object.keys(oe).forEach((t) => {
|
|
2191
|
-
|
|
2191
|
+
ct[oe[t]] = t;
|
|
2192
2192
|
});
|
|
2193
|
-
const
|
|
2193
|
+
const ks = { type: "error", data: "parser error" }, dn = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ln = typeof ArrayBuffer == "function", un = (t) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(t) : t && t.buffer instanceof ArrayBuffer, $s = ({ type: t, data: e }, s, i) => dn && e instanceof Blob ? s ? i(e) : mi(e, i) : ln && (e instanceof ArrayBuffer || un(e)) ? s ? i(e) : mi(new Blob([e]), i) : i(oe[t] + (e || "")), mi = (t, e) => {
|
|
2194
2194
|
const s = new FileReader();
|
|
2195
2195
|
return s.onload = function() {
|
|
2196
2196
|
const i = s.result.split(",")[1];
|
|
@@ -2200,14 +2200,14 @@ const Rs = { type: "error", data: "parser error" }, dn = typeof Blob == "functio
|
|
|
2200
2200
|
function gi(t) {
|
|
2201
2201
|
return t instanceof Uint8Array ? t : t instanceof ArrayBuffer ? new Uint8Array(t) : new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
2202
2202
|
}
|
|
2203
|
-
let
|
|
2203
|
+
let $t;
|
|
2204
2204
|
function Hr(t, e) {
|
|
2205
2205
|
if (dn && t.data instanceof Blob)
|
|
2206
2206
|
return t.data.arrayBuffer().then(gi).then(e);
|
|
2207
2207
|
if (ln && (t.data instanceof ArrayBuffer || un(t.data)))
|
|
2208
2208
|
return e(gi(t.data));
|
|
2209
2209
|
$s(t, !1, (s) => {
|
|
2210
|
-
|
|
2210
|
+
$t || ($t = new TextEncoder()), e($t.encode(s));
|
|
2211
2211
|
});
|
|
2212
2212
|
}
|
|
2213
2213
|
const yi = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", je = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
@@ -2230,12 +2230,12 @@ const Kr = (t) => {
|
|
|
2230
2230
|
return s === "b" ? {
|
|
2231
2231
|
type: "message",
|
|
2232
2232
|
data: Wr(t.substring(1), e)
|
|
2233
|
-
} :
|
|
2234
|
-
type:
|
|
2233
|
+
} : ct[s] ? t.length > 1 ? {
|
|
2234
|
+
type: ct[s],
|
|
2235
2235
|
data: t.substring(1)
|
|
2236
2236
|
} : {
|
|
2237
|
-
type:
|
|
2238
|
-
} :
|
|
2237
|
+
type: ct[s]
|
|
2238
|
+
} : ks;
|
|
2239
2239
|
}, Wr = (t, e) => {
|
|
2240
2240
|
if (Vr) {
|
|
2241
2241
|
const s = Kr(t);
|
|
@@ -2281,11 +2281,11 @@ function Qr() {
|
|
|
2281
2281
|
}
|
|
2282
2282
|
});
|
|
2283
2283
|
}
|
|
2284
|
-
let
|
|
2285
|
-
function
|
|
2284
|
+
let zt;
|
|
2285
|
+
function Ze(t) {
|
|
2286
2286
|
return t.reduce((e, s) => e + s.length, 0);
|
|
2287
2287
|
}
|
|
2288
|
-
function
|
|
2288
|
+
function et(t, e) {
|
|
2289
2289
|
if (t[0].length === e)
|
|
2290
2290
|
return t.shift();
|
|
2291
2291
|
const s = new Uint8Array(e);
|
|
@@ -2295,39 +2295,39 @@ function Ze(t, e) {
|
|
|
2295
2295
|
return t.length && i < t[0].length && (t[0] = t[0].slice(i)), s;
|
|
2296
2296
|
}
|
|
2297
2297
|
function Xr(t, e) {
|
|
2298
|
-
|
|
2298
|
+
zt || (zt = new TextDecoder());
|
|
2299
2299
|
const s = [];
|
|
2300
2300
|
let i = 0, n = -1, r = !1;
|
|
2301
2301
|
return new TransformStream({
|
|
2302
2302
|
transform(o, a) {
|
|
2303
2303
|
for (s.push(o); ; ) {
|
|
2304
2304
|
if (i === 0) {
|
|
2305
|
-
if (
|
|
2305
|
+
if (Ze(s) < 1)
|
|
2306
2306
|
break;
|
|
2307
|
-
const c =
|
|
2307
|
+
const c = et(s, 1);
|
|
2308
2308
|
r = (c[0] & 128) === 128, n = c[0] & 127, n < 126 ? i = 3 : n === 126 ? i = 1 : i = 2;
|
|
2309
2309
|
} else if (i === 1) {
|
|
2310
|
-
if (
|
|
2310
|
+
if (Ze(s) < 2)
|
|
2311
2311
|
break;
|
|
2312
|
-
const c =
|
|
2312
|
+
const c = et(s, 2);
|
|
2313
2313
|
n = new DataView(c.buffer, c.byteOffset, c.length).getUint16(0), i = 3;
|
|
2314
2314
|
} else if (i === 2) {
|
|
2315
|
-
if (
|
|
2315
|
+
if (Ze(s) < 8)
|
|
2316
2316
|
break;
|
|
2317
|
-
const c =
|
|
2317
|
+
const c = et(s, 8), d = new DataView(c.buffer, c.byteOffset, c.length), u = d.getUint32(0);
|
|
2318
2318
|
if (u > Math.pow(2, 21) - 1) {
|
|
2319
|
-
a.enqueue(
|
|
2319
|
+
a.enqueue(ks);
|
|
2320
2320
|
break;
|
|
2321
2321
|
}
|
|
2322
2322
|
n = u * Math.pow(2, 32) + d.getUint32(4), i = 3;
|
|
2323
2323
|
} else {
|
|
2324
|
-
if (
|
|
2324
|
+
if (Ze(s) < n)
|
|
2325
2325
|
break;
|
|
2326
|
-
const c =
|
|
2327
|
-
a.enqueue(zs(r ? c :
|
|
2326
|
+
const c = et(s, n);
|
|
2327
|
+
a.enqueue(zs(r ? c : zt.decode(c), e)), i = 0;
|
|
2328
2328
|
}
|
|
2329
2329
|
if (n === 0 || n > t) {
|
|
2330
|
-
a.enqueue(
|
|
2330
|
+
a.enqueue(ks);
|
|
2331
2331
|
break;
|
|
2332
2332
|
}
|
|
2333
2333
|
}
|
|
@@ -2384,12 +2384,12 @@ B.prototype.listeners = function(t) {
|
|
|
2384
2384
|
B.prototype.hasListeners = function(t) {
|
|
2385
2385
|
return !!this.listeners(t).length;
|
|
2386
2386
|
};
|
|
2387
|
-
const
|
|
2387
|
+
const Tt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, s) => s(e, 0), te = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Zr = "arraybuffer";
|
|
2388
2388
|
function mn(t, ...e) {
|
|
2389
2389
|
return e.reduce((s, i) => (t.hasOwnProperty(i) && (s[i] = t[i]), s), {});
|
|
2390
2390
|
}
|
|
2391
2391
|
const eo = te.setTimeout, to = te.clearTimeout;
|
|
2392
|
-
function
|
|
2392
|
+
function qt(t, e) {
|
|
2393
2393
|
e.useNativeTimers ? (t.setTimeoutFn = eo.bind(te), t.clearTimeoutFn = to.bind(te)) : (t.setTimeoutFn = te.setTimeout.bind(te), t.clearTimeoutFn = te.clearTimeout.bind(te));
|
|
2394
2394
|
}
|
|
2395
2395
|
const so = 1.33;
|
|
@@ -2432,7 +2432,7 @@ class Hs extends B {
|
|
|
2432
2432
|
* @protected
|
|
2433
2433
|
*/
|
|
2434
2434
|
constructor(e) {
|
|
2435
|
-
super(), this.writable = !1,
|
|
2435
|
+
super(), this.writable = !1, qt(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
2436
2436
|
}
|
|
2437
2437
|
/**
|
|
2438
2438
|
* Emits an error.
|
|
@@ -2664,7 +2664,7 @@ class ho extends co {
|
|
|
2664
2664
|
}), this.pollXhr = e;
|
|
2665
2665
|
}
|
|
2666
2666
|
}
|
|
2667
|
-
let Ee = class
|
|
2667
|
+
let Ee = class dt extends B {
|
|
2668
2668
|
/**
|
|
2669
2669
|
* Request constructor
|
|
2670
2670
|
*
|
|
@@ -2672,7 +2672,7 @@ let Ee = class ct extends B {
|
|
|
2672
2672
|
* @package
|
|
2673
2673
|
*/
|
|
2674
2674
|
constructor(e, s, i) {
|
|
2675
|
-
super(), this.createRequest = e,
|
|
2675
|
+
super(), this.createRequest = e, qt(this, i), this._opts = i, this._method = i.method || "GET", this._uri = s, this._data = i.data !== void 0 ? i.data : null, this._create();
|
|
2676
2676
|
}
|
|
2677
2677
|
/**
|
|
2678
2678
|
* Creates the XHR object and sends the request.
|
|
@@ -2718,7 +2718,7 @@ let Ee = class ct extends B {
|
|
|
2718
2718
|
}, 0);
|
|
2719
2719
|
return;
|
|
2720
2720
|
}
|
|
2721
|
-
typeof document < "u" && (this._index =
|
|
2721
|
+
typeof document < "u" && (this._index = dt.requestsCount++, dt.requests[this._index] = this);
|
|
2722
2722
|
}
|
|
2723
2723
|
/**
|
|
2724
2724
|
* Called upon error.
|
|
@@ -2740,7 +2740,7 @@ let Ee = class ct extends B {
|
|
|
2740
2740
|
this._xhr.abort();
|
|
2741
2741
|
} catch {
|
|
2742
2742
|
}
|
|
2743
|
-
typeof document < "u" && delete
|
|
2743
|
+
typeof document < "u" && delete dt.requests[this._index], this._xhr = null;
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
2746
|
/**
|
|
@@ -2841,7 +2841,7 @@ class mo extends Hs {
|
|
|
2841
2841
|
this.doWrite(i, r);
|
|
2842
2842
|
} catch {
|
|
2843
2843
|
}
|
|
2844
|
-
n &&
|
|
2844
|
+
n && Tt(() => {
|
|
2845
2845
|
this.writable = !0, this.emitReserved("drain");
|
|
2846
2846
|
}, this.setTimeoutFn);
|
|
2847
2847
|
});
|
|
@@ -2861,10 +2861,10 @@ class mo extends Hs {
|
|
|
2861
2861
|
return this.opts.timestampRequests && (s[this.opts.timestampParam] = gn()), this.supportsBinary || (s.b64 = 1), this.createUri(e, s);
|
|
2862
2862
|
}
|
|
2863
2863
|
}
|
|
2864
|
-
const
|
|
2864
|
+
const Ht = te.WebSocket || te.MozWebSocket;
|
|
2865
2865
|
class go extends mo {
|
|
2866
2866
|
createSocket(e, s, i) {
|
|
2867
|
-
return bn ? new
|
|
2867
|
+
return bn ? new Ht(e, s, i) : s ? new Ht(e, s) : new Ht(e);
|
|
2868
2868
|
}
|
|
2869
2869
|
doWrite(e, s) {
|
|
2870
2870
|
this.ws.send(s);
|
|
@@ -2905,7 +2905,7 @@ class yo extends Hs {
|
|
|
2905
2905
|
for (let s = 0; s < e.length; s++) {
|
|
2906
2906
|
const i = e[s], n = s === e.length - 1;
|
|
2907
2907
|
this._writer.write(i).then(() => {
|
|
2908
|
-
n &&
|
|
2908
|
+
n && Tt(() => {
|
|
2909
2909
|
this.writable = !0, this.emitReserved("drain");
|
|
2910
2910
|
}, this.setTimeoutFn);
|
|
2911
2911
|
});
|
|
@@ -2936,7 +2936,7 @@ const vo = {
|
|
|
2936
2936
|
"query",
|
|
2937
2937
|
"anchor"
|
|
2938
2938
|
];
|
|
2939
|
-
function
|
|
2939
|
+
function As(t) {
|
|
2940
2940
|
if (t.length > 8e3)
|
|
2941
2941
|
throw "URI too long";
|
|
2942
2942
|
const e = t, s = t.indexOf("["), i = t.indexOf("]");
|
|
@@ -2956,9 +2956,9 @@ function _o(t, e) {
|
|
|
2956
2956
|
n && (s[n] = r);
|
|
2957
2957
|
}), s;
|
|
2958
2958
|
}
|
|
2959
|
-
const
|
|
2960
|
-
|
|
2961
|
-
|
|
2959
|
+
const Es = typeof addEventListener == "function" && typeof removeEventListener == "function", lt = [];
|
|
2960
|
+
Es && addEventListener("offline", () => {
|
|
2961
|
+
lt.forEach((t) => t());
|
|
2962
2962
|
}, !1);
|
|
2963
2963
|
class fe extends B {
|
|
2964
2964
|
/**
|
|
@@ -2969,10 +2969,10 @@ class fe extends B {
|
|
|
2969
2969
|
*/
|
|
2970
2970
|
constructor(e, s) {
|
|
2971
2971
|
if (super(), this.binaryType = Zr, 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) {
|
|
2972
|
-
const i =
|
|
2972
|
+
const i = As(e);
|
|
2973
2973
|
s.hostname = i.host, s.secure = i.protocol === "https" || i.protocol === "wss", s.port = i.port, i.query && (s.query = i.query);
|
|
2974
|
-
} else s.host && (s.hostname =
|
|
2975
|
-
|
|
2974
|
+
} else s.host && (s.hostname = As(s.host).host);
|
|
2975
|
+
qt(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((i) => {
|
|
2976
2976
|
const n = i.prototype.name;
|
|
2977
2977
|
this.transports.push(n), this._transportsByName[n] = i;
|
|
2978
2978
|
}), this.opts = Object.assign({
|
|
@@ -2989,13 +2989,13 @@ class fe extends B {
|
|
|
2989
2989
|
},
|
|
2990
2990
|
transportOptions: {},
|
|
2991
2991
|
closeOnBeforeunload: !1
|
|
2992
|
-
}, s), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = oo(this.opts.query)),
|
|
2992
|
+
}, s), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = oo(this.opts.query)), Es && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
2993
2993
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
2994
2994
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
2995
2995
|
this._onClose("transport close", {
|
|
2996
2996
|
description: "network connection lost"
|
|
2997
2997
|
});
|
|
2998
|
-
},
|
|
2998
|
+
}, lt.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
|
|
2999
2999
|
}
|
|
3000
3000
|
/**
|
|
3001
3001
|
* Creates transport of the given type.
|
|
@@ -3144,7 +3144,7 @@ class fe extends B {
|
|
|
3144
3144
|
if (!this._pingTimeoutTime)
|
|
3145
3145
|
return !0;
|
|
3146
3146
|
const e = Date.now() > this._pingTimeoutTime;
|
|
3147
|
-
return e && (this._pingTimeoutTime = 0,
|
|
3147
|
+
return e && (this._pingTimeoutTime = 0, Tt(() => {
|
|
3148
3148
|
this._onClose("ping timeout");
|
|
3149
3149
|
}, this.setTimeoutFn)), e;
|
|
3150
3150
|
}
|
|
@@ -3222,9 +3222,9 @@ class fe extends B {
|
|
|
3222
3222
|
*/
|
|
3223
3223
|
_onClose(e, s) {
|
|
3224
3224
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
3225
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
3226
|
-
const i =
|
|
3227
|
-
i !== -1 &&
|
|
3225
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Es && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
3226
|
+
const i = lt.indexOf(this._offlineEventListener);
|
|
3227
|
+
i !== -1 && lt.splice(i, 1);
|
|
3228
3228
|
}
|
|
3229
3229
|
this.readyState = "closed", this.id = null, this.emitReserved("close", e, s), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
3230
3230
|
}
|
|
@@ -3311,7 +3311,7 @@ let Ro = class extends So {
|
|
|
3311
3311
|
};
|
|
3312
3312
|
function ko(t, e = "", s) {
|
|
3313
3313
|
let i = t;
|
|
3314
|
-
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), i =
|
|
3314
|
+
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), i = As(t)), i.port || (/^(http|ws)$/.test(i.protocol) ? i.port = "80" : /^(http|ws)s$/.test(i.protocol) && (i.port = "443")), i.path = i.path || "/";
|
|
3315
3315
|
const r = i.host.indexOf(":") !== -1 ? "[" + i.host + "]" : i.host;
|
|
3316
3316
|
return i.id = i.protocol + "://" + r + ":" + i.port + e, i.href = i.protocol + "://" + r + (s && s.port === i.port ? "" : ":" + i.port), i;
|
|
3317
3317
|
}
|
|
@@ -3319,29 +3319,29 @@ const Ao = typeof ArrayBuffer == "function", Eo = (t) => typeof ArrayBuffer.isVi
|
|
|
3319
3319
|
function Ks(t) {
|
|
3320
3320
|
return Ao && (t instanceof ArrayBuffer || Eo(t)) || To && t instanceof Blob || qo && t instanceof File;
|
|
3321
3321
|
}
|
|
3322
|
-
function
|
|
3322
|
+
function ut(t, e) {
|
|
3323
3323
|
if (!t || typeof t != "object")
|
|
3324
3324
|
return !1;
|
|
3325
3325
|
if (Array.isArray(t)) {
|
|
3326
3326
|
for (let s = 0, i = t.length; s < i; s++)
|
|
3327
|
-
if (
|
|
3327
|
+
if (ut(t[s]))
|
|
3328
3328
|
return !0;
|
|
3329
3329
|
return !1;
|
|
3330
3330
|
}
|
|
3331
3331
|
if (Ks(t))
|
|
3332
3332
|
return !0;
|
|
3333
3333
|
if (t.toJSON && typeof t.toJSON == "function" && arguments.length === 1)
|
|
3334
|
-
return
|
|
3334
|
+
return ut(t.toJSON(), !0);
|
|
3335
3335
|
for (const s in t)
|
|
3336
|
-
if (Object.prototype.hasOwnProperty.call(t, s) &&
|
|
3336
|
+
if (Object.prototype.hasOwnProperty.call(t, s) && ut(t[s]))
|
|
3337
3337
|
return !0;
|
|
3338
3338
|
return !1;
|
|
3339
3339
|
}
|
|
3340
3340
|
function Mo(t) {
|
|
3341
3341
|
const e = [], s = t.data, i = t;
|
|
3342
|
-
return i.data =
|
|
3342
|
+
return i.data = ht(s, e), i.attachments = e.length, { packet: i, buffers: e };
|
|
3343
3343
|
}
|
|
3344
|
-
function
|
|
3344
|
+
function ht(t, e, s) {
|
|
3345
3345
|
if (!t)
|
|
3346
3346
|
return t;
|
|
3347
3347
|
if (Ks(t)) {
|
|
@@ -3350,22 +3350,22 @@ function ut(t, e, s) {
|
|
|
3350
3350
|
} else if (Array.isArray(t)) {
|
|
3351
3351
|
const i = new Array(t.length);
|
|
3352
3352
|
for (let n = 0; n < t.length; n++)
|
|
3353
|
-
i[n] =
|
|
3353
|
+
i[n] = ht(t[n], e);
|
|
3354
3354
|
return i;
|
|
3355
3355
|
} else if (typeof t == "object" && !(t instanceof Date)) {
|
|
3356
3356
|
if (t.toJSON && typeof t.toJSON == "function" && !s)
|
|
3357
|
-
return
|
|
3357
|
+
return ht(t.toJSON(), e, !0);
|
|
3358
3358
|
const i = {};
|
|
3359
3359
|
for (const n in t)
|
|
3360
|
-
Object.prototype.hasOwnProperty.call(t, n) && (i[n] =
|
|
3360
|
+
Object.prototype.hasOwnProperty.call(t, n) && (i[n] = ht(t[n], e));
|
|
3361
3361
|
return i;
|
|
3362
3362
|
}
|
|
3363
3363
|
return t;
|
|
3364
3364
|
}
|
|
3365
3365
|
function Co(t, e) {
|
|
3366
|
-
return t.data =
|
|
3366
|
+
return t.data = Ts(t.data, e), delete t.attachments, t;
|
|
3367
3367
|
}
|
|
3368
|
-
function
|
|
3368
|
+
function Ts(t, e) {
|
|
3369
3369
|
if (!t)
|
|
3370
3370
|
return t;
|
|
3371
3371
|
if (t && t._placeholder === !0) {
|
|
@@ -3374,10 +3374,10 @@ function Es(t, e) {
|
|
|
3374
3374
|
throw new Error("illegal attachments");
|
|
3375
3375
|
} else if (Array.isArray(t))
|
|
3376
3376
|
for (let s = 0; s < t.length; s++)
|
|
3377
|
-
t[s] =
|
|
3377
|
+
t[s] = Ts(t[s], e);
|
|
3378
3378
|
else if (typeof t == "object")
|
|
3379
3379
|
for (const s in t)
|
|
3380
|
-
Object.prototype.hasOwnProperty.call(t, s) && (t[s] =
|
|
3380
|
+
Object.prototype.hasOwnProperty.call(t, s) && (t[s] = Ts(t[s], e));
|
|
3381
3381
|
return t;
|
|
3382
3382
|
}
|
|
3383
3383
|
const Oo = [
|
|
@@ -3414,7 +3414,7 @@ class Po {
|
|
|
3414
3414
|
* @param {Object} obj - packet object
|
|
3415
3415
|
*/
|
|
3416
3416
|
encode(e) {
|
|
3417
|
-
return (e.type === M.EVENT || e.type === M.ACK) &&
|
|
3417
|
+
return (e.type === M.EVENT || e.type === M.ACK) && ut(e) ? this.encodeAsBinary({
|
|
3418
3418
|
type: e.type === M.EVENT ? M.BINARY_EVENT : M.BINARY_ACK,
|
|
3419
3419
|
nsp: e.nsp,
|
|
3420
3420
|
data: e.data,
|
|
@@ -4225,10 +4225,10 @@ qe.prototype.setMax = function(t) {
|
|
|
4225
4225
|
qe.prototype.setJitter = function(t) {
|
|
4226
4226
|
this.jitter = t;
|
|
4227
4227
|
};
|
|
4228
|
-
class
|
|
4228
|
+
class qs extends B {
|
|
4229
4229
|
constructor(e, s) {
|
|
4230
4230
|
var i;
|
|
4231
|
-
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,
|
|
4231
|
+
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, qt(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((i = s.randomizationFactor) !== null && i !== void 0 ? i : 0.5), this.backoff = new qe({
|
|
4232
4232
|
min: this.reconnectionDelay(),
|
|
4233
4233
|
max: this.reconnectionDelayMax(),
|
|
4234
4234
|
jitter: this.randomizationFactor()
|
|
@@ -4346,7 +4346,7 @@ class Ts extends B {
|
|
|
4346
4346
|
* @private
|
|
4347
4347
|
*/
|
|
4348
4348
|
ondecoded(e) {
|
|
4349
|
-
|
|
4349
|
+
Tt(() => {
|
|
4350
4350
|
this.emitReserved("packet", e);
|
|
4351
4351
|
}, this.setTimeoutFn);
|
|
4352
4352
|
}
|
|
@@ -4464,17 +4464,17 @@ class Ts extends B {
|
|
|
4464
4464
|
}
|
|
4465
4465
|
}
|
|
4466
4466
|
const xe = {};
|
|
4467
|
-
function
|
|
4467
|
+
function pt(t, e) {
|
|
4468
4468
|
typeof t == "object" && (e = t, t = void 0), e = e || {};
|
|
4469
4469
|
const s = ko(t, e.path || "/socket.io"), i = s.source, n = s.id, r = s.path, o = xe[n] && r in xe[n].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
4470
4470
|
let c;
|
|
4471
|
-
return a ? c = new
|
|
4471
|
+
return a ? c = new qs(i, e) : (xe[n] || (xe[n] = new qs(i, e)), c = xe[n]), s.query && !e.query && (e.query = s.queryKey), c.socket(s.path, e);
|
|
4472
4472
|
}
|
|
4473
|
-
Object.assign(
|
|
4474
|
-
Manager:
|
|
4473
|
+
Object.assign(pt, {
|
|
4474
|
+
Manager: qs,
|
|
4475
4475
|
Socket: wn,
|
|
4476
|
-
io:
|
|
4477
|
-
connect:
|
|
4476
|
+
io: pt,
|
|
4477
|
+
connect: pt
|
|
4478
4478
|
});
|
|
4479
4479
|
const Bo = 9e4, jo = /* @__PURE__ */ new Set([
|
|
4480
4480
|
"chat.user_message",
|
|
@@ -4502,7 +4502,7 @@ function Ii(t, e) {
|
|
|
4502
4502
|
}
|
|
4503
4503
|
class Lo {
|
|
4504
4504
|
constructor(e) {
|
|
4505
|
-
this.options = e, this.socket =
|
|
4505
|
+
this.options = e, this.socket = pt(`${e.backendUrl.replace(/\/$/, "")}/product-agent`, {
|
|
4506
4506
|
path: "/api/product-agent/socket.io",
|
|
4507
4507
|
transports: ["websocket"],
|
|
4508
4508
|
autoConnect: !1,
|
|
@@ -4916,7 +4916,7 @@ function Fo(t) {
|
|
|
4916
4916
|
const p = l.engine.getState().slices, g = p.conversation.submissions[o.submission.userMessageId];
|
|
4917
4917
|
(!W(t) || !g || g.cancelled || g.requestId !== o.submission.requestId || p.directory.clients[g.clientScopeId] !== g.conversationScopeId) && d(Object.assign(new Error("Submission preparation was retired."), { code: "aborted", retryable: !1 }));
|
|
4918
4918
|
}, f = l.engine.subscribe(h), m = l.onDispose(() => d(Object.assign(new Error("Submission runtime was disposed."), { code: "aborted" })));
|
|
4919
|
-
return h(),
|
|
4919
|
+
return h(), ot(a.signal, () => t.prepareSubmission(o, a.signal).then((p) => (a.signal.aborted && c.mark("context_discarded"), p), (p) => {
|
|
4920
4920
|
throw a.signal.aborted && c.mark("context_discarded"), p;
|
|
4921
4921
|
})).then((p) => (h(), a.signal.throwIfAborted(), p)).catch((p) => (d(p), i(p, { operation: "conversation.prepare", requestId: o.submission.userMessageId }))).finally(() => {
|
|
4922
4922
|
clearTimeout(u), f(), m();
|
|
@@ -4965,7 +4965,7 @@ function Fo(t) {
|
|
|
4965
4965
|
"conversations",
|
|
4966
4966
|
{ timing: d }
|
|
4967
4967
|
);
|
|
4968
|
-
if (X(t, o), u.request_id !== o.command.request_id || !
|
|
4968
|
+
if (X(t, o), u.request_id !== o.command.request_id || !He(u.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
|
|
4969
4969
|
if (o.command.type.startsWith("chat.")) {
|
|
4970
4970
|
const l = u.result;
|
|
4971
4971
|
if (typeof l?.sessionId != "string" || !l.sessionId || l.clientMessageId !== o.command.payload.clientMessageId || o.command.payload.sessionId && l.sessionId !== o.command.payload.sessionId) throw Object.assign(new Error("Conversation acceptance identity mismatch."), { code: "acceptance_identity_mismatch" });
|
|
@@ -5261,7 +5261,7 @@ function he(t, e, s) {
|
|
|
5261
5261
|
return U < F ? -1 : U > F ? 1 : v.id < C.id ? -1 : v.id > C.id ? 1 : 0;
|
|
5262
5262
|
}), c = o.filter((v) => (!v.cancelled || v.conversationScopeId === s && (v.sessionId === null || v.sessionId === n || n === null && v === o[o.length - 1])) && !r?.items[v.userMessageId] && !r?.removedItems[v.userMessageId]), d = {};
|
|
5263
5263
|
for (const v of a) {
|
|
5264
|
-
const C =
|
|
5264
|
+
const C = _t(v);
|
|
5265
5265
|
if (C === null) continue;
|
|
5266
5266
|
const U = r?.streams[v.id];
|
|
5267
5267
|
d[v.id] = U ? U.state === "open" ? "open" : C < U.revision ? "awaiting_content" : U.state : "open";
|
|
@@ -5277,7 +5277,7 @@ function he(t, e, s) {
|
|
|
5277
5277
|
}
|
|
5278
5278
|
for (const v of c) {
|
|
5279
5279
|
const C = u.findIndex((U) => {
|
|
5280
|
-
const F = o.find((
|
|
5280
|
+
const F = o.find((Je) => Je.userMessageId === U.userMessageId), Me = r?.items[U.userMessageId ?? U.activityIds[0] ?? U.outcomeIds[0]];
|
|
5281
5281
|
return (F?.submittedAt ?? (Me ? Date.parse(Me.created_at) : 1 / 0)) > v.submittedAt;
|
|
5282
5282
|
});
|
|
5283
5283
|
u.splice(C < 0 ? u.length : C, 0, {
|
|
@@ -5345,7 +5345,7 @@ function Ae(t, e) {
|
|
|
5345
5345
|
(s, i, n, r) => `${i}${new URL(n, e).toString()}${r}`
|
|
5346
5346
|
) : t;
|
|
5347
5347
|
}
|
|
5348
|
-
function
|
|
5348
|
+
function Ms(t, e, s = "stopped", i, n = "Run stopped by user.") {
|
|
5349
5349
|
const r = new Set(i ?? [
|
|
5350
5350
|
t.assistantDraftRespondsToUserMessageId,
|
|
5351
5351
|
t.activeResponseUserMessageId,
|
|
@@ -5419,7 +5419,7 @@ function Vo(t, e, s, i) {
|
|
|
5419
5419
|
return { ...r, role: "system", dataType: "run_status", content: t.data.message, loading: !1 };
|
|
5420
5420
|
}
|
|
5421
5421
|
}
|
|
5422
|
-
function
|
|
5422
|
+
function Kt(t, e, s, i) {
|
|
5423
5423
|
const n = /* @__PURE__ */ new Map();
|
|
5424
5424
|
for (const S of t.segments)
|
|
5425
5425
|
for (const q of [...S.activityIds, ...S.outcomeIds]) n.set(q, S.userMessageId);
|
|
@@ -5481,7 +5481,7 @@ function Ht(t, e, s, i) {
|
|
|
5481
5481
|
...I ? { errorMessageFingerprint: an(_e(I.message)) } : {},
|
|
5482
5482
|
...u && I && I === u.error && !f ? { failedClientMessageId: u.userMessageId } : {},
|
|
5483
5483
|
...typeof I?.details?.requestId == "string" ? { errorRequestId: I.details.requestId } : {},
|
|
5484
|
-
...
|
|
5484
|
+
...Ve(I?.details?.errorNormalization) ? { errorNormalization: I.details.errorNormalization } : {},
|
|
5485
5485
|
...i ? { owner: i } : {},
|
|
5486
5486
|
...re(I?.details?.httpRequest) ? { httpRequest: I.details.httpRequest } : {},
|
|
5487
5487
|
queryStatus: e?.status ?? null,
|
|
@@ -5517,11 +5517,11 @@ function Ht(t, e, s, i) {
|
|
|
5517
5517
|
lastErrorSecuritySettingsUrl: typeof I?.details?.securitySettingsUrl == "string" ? I.details.securitySettingsUrl : null
|
|
5518
5518
|
};
|
|
5519
5519
|
for (const S of t.optimistic.filter((q) => q.cancelled && !t.stop?.userMessageIds.includes(q.userMessageId))) {
|
|
5520
|
-
const q =
|
|
5520
|
+
const q = Ms(A, "", "stopped", [S.userMessageId], _i(S.cancellationReason));
|
|
5521
5521
|
A = { ...A, messages: q.messages, segments: q.segments };
|
|
5522
5522
|
}
|
|
5523
5523
|
if (t.stop) {
|
|
5524
|
-
const S =
|
|
5524
|
+
const S = Ms(
|
|
5525
5525
|
A,
|
|
5526
5526
|
"",
|
|
5527
5527
|
t.stop.pending ? "stopping" : "stopped",
|
|
@@ -5572,7 +5572,7 @@ function Wo(t) {
|
|
|
5572
5572
|
}))
|
|
5573
5573
|
};
|
|
5574
5574
|
}
|
|
5575
|
-
function
|
|
5575
|
+
function ft(t) {
|
|
5576
5576
|
return {
|
|
5577
5577
|
key: t,
|
|
5578
5578
|
status: "not_requested",
|
|
@@ -5584,7 +5584,7 @@ function pt(t) {
|
|
|
5584
5584
|
}
|
|
5585
5585
|
class Si {
|
|
5586
5586
|
constructor(e, s, i = (n, r) => r) {
|
|
5587
|
-
this.loader = s, this.merge = i, this.state =
|
|
5587
|
+
this.loader = s, this.merge = i, this.state = ft(e);
|
|
5588
5588
|
}
|
|
5589
5589
|
loader;
|
|
5590
5590
|
merge;
|
|
@@ -5599,10 +5599,10 @@ class Si {
|
|
|
5599
5599
|
return this.listeners.add(e), e(this.state), () => this.listeners.delete(e);
|
|
5600
5600
|
}
|
|
5601
5601
|
setKey(e) {
|
|
5602
|
-
e !== this.state.key && (this.state =
|
|
5602
|
+
e !== this.state.key && (this.state = ft(e), this.trailingLoad = null, this.publish());
|
|
5603
5603
|
}
|
|
5604
5604
|
reset() {
|
|
5605
|
-
this.state =
|
|
5605
|
+
this.state = ft(this.state.key), this.trailingLoad = null, this.publish();
|
|
5606
5606
|
}
|
|
5607
5607
|
invalidate() {
|
|
5608
5608
|
this.state = {
|
|
@@ -5657,7 +5657,7 @@ class Si {
|
|
|
5657
5657
|
for (const e of this.listeners) e(this.state);
|
|
5658
5658
|
}
|
|
5659
5659
|
}
|
|
5660
|
-
function
|
|
5660
|
+
function mt(t) {
|
|
5661
5661
|
const e = {}, s = [];
|
|
5662
5662
|
for (const i of t.entities)
|
|
5663
5663
|
e[i.id] || s.push(i.id), e[i.id] = i;
|
|
@@ -5788,7 +5788,7 @@ class Sn {
|
|
|
5788
5788
|
throw new R(T === "embedded_submission_conflict" ? "This message conflicts with an earlier submission. Review the conversation before retrying." : "This earlier submission cannot be verified. Review the conversation before retrying.", T, !1, void 0, !0);
|
|
5789
5789
|
if (r === "conversations" && e === "/commands" && (k.status === 409 && T?.code === "executor_not_ready" && T.retryable === !0 || k.status === 403 && T === "Register the executor before commands"))
|
|
5790
5790
|
throw new R("Reconnecting the browser before continuing.", "executor_not_ready");
|
|
5791
|
-
if (k.status !== 401 && T && typeof T == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(T.code) || !
|
|
5791
|
+
if (k.status !== 401 && T && typeof T == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(T.code) || !bt(void 0, T.code).allowed) && typeof T.message == "string")
|
|
5792
5792
|
throw new R(T.message, T.code, !1, {
|
|
5793
5793
|
...typeof T.blockedOrigin == "string" ? { blockedOrigin: T.blockedOrigin } : {},
|
|
5794
5794
|
...typeof T.securitySettingsUrl == "string" ? { securitySettingsUrl: T.securitySettingsUrl } : {}
|
|
@@ -5814,7 +5814,7 @@ class Sn {
|
|
|
5814
5814
|
ownerId: x(a?.ownerId),
|
|
5815
5815
|
authorityGeneration: a?.authorityGeneration ?? null,
|
|
5816
5816
|
sessionId: x(a?.sessionId),
|
|
5817
|
-
release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${
|
|
5817
|
+
release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${At.version}`,
|
|
5818
5818
|
upstreamRequestId: S,
|
|
5819
5819
|
upstreamTraceId: q
|
|
5820
5820
|
};
|
|
@@ -5841,15 +5841,15 @@ class Sn {
|
|
|
5841
5841
|
}
|
|
5842
5842
|
}
|
|
5843
5843
|
}
|
|
5844
|
-
function
|
|
5844
|
+
function Ke(t) {
|
|
5845
5845
|
if (t !== null && typeof t == "object" && !Object.isFrozen(t)) {
|
|
5846
|
-
for (const e of Object.values(t))
|
|
5846
|
+
for (const e of Object.values(t)) Ke(e);
|
|
5847
5847
|
Object.freeze(t);
|
|
5848
5848
|
}
|
|
5849
5849
|
return t;
|
|
5850
5850
|
}
|
|
5851
5851
|
function Rn() {
|
|
5852
|
-
return
|
|
5852
|
+
return Ke({
|
|
5853
5853
|
authorityId: null,
|
|
5854
5854
|
generation: 0,
|
|
5855
5855
|
entities: {},
|
|
@@ -5884,7 +5884,7 @@ function Le(t) {
|
|
|
5884
5884
|
const e = t.error;
|
|
5885
5885
|
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));
|
|
5886
5886
|
}
|
|
5887
|
-
const
|
|
5887
|
+
const Vt = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
|
|
5888
5888
|
function Y(t) {
|
|
5889
5889
|
const e = t.currentAuthority();
|
|
5890
5890
|
return e.authorityId === t.authority.authorityId && e.generation === t.authority.generation;
|
|
@@ -5980,7 +5980,7 @@ class ta {
|
|
|
5980
5980
|
if (s) for (const [n, r] of Object.entries(e)) {
|
|
5981
5981
|
if (!r.observe || this.observations.has(n)) continue;
|
|
5982
5982
|
const o = this.options.recovery?.(n), a = new Be({
|
|
5983
|
-
...
|
|
5983
|
+
...Vt,
|
|
5984
5984
|
isActiveTurn: () => this.options.isActiveTurn(n),
|
|
5985
5985
|
poll: async () => {
|
|
5986
5986
|
try {
|
|
@@ -6016,8 +6016,8 @@ class ta {
|
|
|
6016
6016
|
const o = this.queryRetries.get(r) ?? { timer: null };
|
|
6017
6017
|
if (o.timer !== null) continue;
|
|
6018
6018
|
const a = Math.min(
|
|
6019
|
-
|
|
6020
|
-
|
|
6019
|
+
Vt.activeIntervalMs * 2 ** Math.min(n.consecutiveFailures - 1, 4),
|
|
6020
|
+
Vt.maxFailureIntervalMs
|
|
6021
6021
|
);
|
|
6022
6022
|
o.timer = setTimeout(() => {
|
|
6023
6023
|
o.timer = null, !this.queryRequests.has(r) && this.refreshObservedQuery(n.query).catch((c) => this.report(c));
|
|
@@ -6377,7 +6377,7 @@ class L extends EventTarget {
|
|
|
6377
6377
|
const i = this.connectionAttempt, n = (/* @__PURE__ */ new Date()).toISOString(), r = this.diagnostics.findIndex((c) => c.phase === e && c.connectionAttemptId === i?.connectionAttemptId), o = this.diagnostics[r], a = {
|
|
6378
6378
|
id: o?.id ?? crypto.randomUUID(),
|
|
6379
6379
|
phase: e,
|
|
6380
|
-
sdkVersion:
|
|
6380
|
+
sdkVersion: At.version,
|
|
6381
6381
|
stage: s.stage ?? (s.readinessPhase === "bootstrap" ? "bootstrap" : s.readinessPhase === "activation" ? "executor_registration" : "socket_admission"),
|
|
6382
6382
|
...s.httpStatus ? { httpStatus: s.httpStatus } : {},
|
|
6383
6383
|
...s.failureKind ? { failureKind: s.failureKind } : {},
|
|
@@ -6641,7 +6641,7 @@ class L extends EventTarget {
|
|
|
6641
6641
|
}), n;
|
|
6642
6642
|
}
|
|
6643
6643
|
}
|
|
6644
|
-
const
|
|
6644
|
+
const Cs = /* @__PURE__ */ new WeakMap(), Ie = (t) => t === null || typeof t == "string" && /^[a-zA-Z0-9:_-]{1,160}$/.test(t);
|
|
6645
6645
|
function An(t) {
|
|
6646
6646
|
if (!t || typeof t != "object") return !1;
|
|
6647
6647
|
const e = t;
|
|
@@ -6649,7 +6649,7 @@ function An(t) {
|
|
|
6649
6649
|
}
|
|
6650
6650
|
function oa(t, e, s) {
|
|
6651
6651
|
if (!An(s)) return;
|
|
6652
|
-
const i =
|
|
6652
|
+
const i = Cs.get(t) ?? /* @__PURE__ */ new Map();
|
|
6653
6653
|
i.set(e, {
|
|
6654
6654
|
observedAt: s.observedAt,
|
|
6655
6655
|
sessionId: s.sessionId,
|
|
@@ -6658,10 +6658,10 @@ function oa(t, e, s) {
|
|
|
6658
6658
|
panelVisible: s.panelVisible,
|
|
6659
6659
|
documentVisible: s.documentVisible,
|
|
6660
6660
|
loading: s.loading
|
|
6661
|
-
}), i.size > 2 && i.delete(i.keys().next().value),
|
|
6661
|
+
}), i.size > 2 && i.delete(i.keys().next().value), Cs.set(t, i);
|
|
6662
6662
|
}
|
|
6663
6663
|
function aa(t, e, s) {
|
|
6664
|
-
const i =
|
|
6664
|
+
const i = Cs.get(t)?.get(e);
|
|
6665
6665
|
return i?.sessionId === s ? i : null;
|
|
6666
6666
|
}
|
|
6667
6667
|
function ca(t, e, s, i, n, r, o, a, c = null, d = !1) {
|
|
@@ -6845,20 +6845,20 @@ function ha(t, e, s, i) {
|
|
|
6845
6845
|
const n = t.clients[e];
|
|
6846
6846
|
return n === void 0 || t.selections[n].sessionId === s ? !0 : !i || Object.values(i.pendingRestoration).includes(n) || Object.values(i.submissions).some((r) => r.conversationScopeId === n && !r.cancelled) ? !1 : t.selections[n].sessionId === null || he(i, t, n).isDraftSession;
|
|
6847
6847
|
}
|
|
6848
|
-
function
|
|
6848
|
+
function Os(t) {
|
|
6849
6849
|
return {
|
|
6850
6850
|
...t,
|
|
6851
6851
|
metadataRevision: t.metadataRevision + 1,
|
|
6852
6852
|
queries: Object.fromEntries(Object.entries(t.queries).map(([e, s]) => [e, { ...s, invalidated: !0 }]))
|
|
6853
6853
|
};
|
|
6854
6854
|
}
|
|
6855
|
-
function
|
|
6855
|
+
function Wt(t, e, s) {
|
|
6856
6856
|
if (e.conversation_id !== e.conversation.id || !Number.isSafeInteger(e.version) || e.version < 0)
|
|
6857
6857
|
throw new Error("Invalid conversation metadata envelope identity or version.");
|
|
6858
6858
|
const i = t.entities[e.conversation_id];
|
|
6859
6859
|
if (i && i.version >= e.version) return t;
|
|
6860
6860
|
const n = { ...e, conversation: { ...e.conversation } }, r = { ...t, entities: { ...t.entities, [e.conversation_id]: n } };
|
|
6861
|
-
return s ?
|
|
6861
|
+
return s ? Os(r) : r;
|
|
6862
6862
|
}
|
|
6863
6863
|
function we(t, e, s) {
|
|
6864
6864
|
let i = t;
|
|
@@ -6879,11 +6879,11 @@ function we(t, e, s) {
|
|
|
6879
6879
|
const o = { ...t.requests };
|
|
6880
6880
|
if (delete o[e.effectId], i = { ...t, requests: o }, r.kind === "directory.query") {
|
|
6881
6881
|
const a = N(r.input.query), c = t.queries[a];
|
|
6882
|
-
if (c.requestId !== r.input.requestId) return { state:
|
|
6882
|
+
if (c.requestId !== r.input.requestId) return { state: Ke(i), effects: n };
|
|
6883
6883
|
if (e.type === "effect.failed")
|
|
6884
6884
|
i = { ...i, queries: { ...i.queries, [a]: { ...c, status: "error", error: { ...e.error }, requestId: null, consecutiveFailures: c.consecutiveFailures + 1 } } };
|
|
6885
6885
|
else if (e.effectKind === "directory.query") {
|
|
6886
|
-
for (const p of e.output.entries) i =
|
|
6886
|
+
for (const p of e.output.entries) i = Wt(i, p, !0);
|
|
6887
6887
|
const d = e.output.entries.map((p) => p.conversation_id), u = { ...i.durableActivityBySessionId }, l = { ...i.activityBySessionId }, h = { ...i.activityRevisionBySessionId };
|
|
6888
6888
|
for (const p of e.output.entries) {
|
|
6889
6889
|
if (typeof p.is_active != "boolean") continue;
|
|
@@ -6911,7 +6911,7 @@ function we(t, e, s) {
|
|
|
6911
6911
|
} else {
|
|
6912
6912
|
if (e.type === "effect.completed" && e.effectKind === "directory.mutate") {
|
|
6913
6913
|
if (e.output.conversation_id !== r.input.sessionId) throw new Error("Mutation response has the wrong conversation identity.");
|
|
6914
|
-
i =
|
|
6914
|
+
i = Wt(i, e.output, !0);
|
|
6915
6915
|
}
|
|
6916
6916
|
const a = { ...i.mutations[r.input.sessionId] };
|
|
6917
6917
|
for (const c of ["title", "pinned"]) {
|
|
@@ -6924,9 +6924,9 @@ function we(t, e, s) {
|
|
|
6924
6924
|
if (e.authorityId !== (t.authorityId ?? "") || e.generation !== t.generation)
|
|
6925
6925
|
return { state: t, effects: n };
|
|
6926
6926
|
if (e.type === "directory.metadata_received")
|
|
6927
|
-
i =
|
|
6927
|
+
i = Wt(t, e.metadata, !0);
|
|
6928
6928
|
else if (e.type === "directory.invalidate")
|
|
6929
|
-
i =
|
|
6929
|
+
i = Os(t);
|
|
6930
6930
|
else if (e.type === "directory.optimistic_upsert")
|
|
6931
6931
|
i = { ...t, optimisticEntries: {
|
|
6932
6932
|
...t.optimisticEntries,
|
|
@@ -6974,7 +6974,7 @@ function we(t, e, s) {
|
|
|
6974
6974
|
query: u,
|
|
6975
6975
|
cursor: e.cursor !== void 0 ? e.cursor : e.mode === "append" ? d?.cursor ?? null : null
|
|
6976
6976
|
} }, i = { ...t, queries: { ...t.queries, [c]: {
|
|
6977
|
-
...
|
|
6977
|
+
...vt(d ?? Se(c), { key: c, requestId: e.requestId, mode: e.mode }),
|
|
6978
6978
|
query: u,
|
|
6979
6979
|
requestSequence: t.requestSequence + 1,
|
|
6980
6980
|
mode: e.mode,
|
|
@@ -6993,13 +6993,13 @@ function we(t, e, s) {
|
|
|
6993
6993
|
const l = c[u];
|
|
6994
6994
|
l !== void 0 && (d[u] = { requestId: e.requestId, value: l, status: "pending", error: null });
|
|
6995
6995
|
}
|
|
6996
|
-
i =
|
|
6996
|
+
i = Os({ ...t, mutations: { ...t.mutations, [e.sessionId]: d } });
|
|
6997
6997
|
}
|
|
6998
6998
|
i = { ...i, requestSequence: t.requestSequence + 1, requests: { ...i.requests, [r]: a } }, n.push({ id: r, ...a });
|
|
6999
6999
|
} else
|
|
7000
7000
|
i = ua(t, e, s);
|
|
7001
7001
|
}
|
|
7002
|
-
return { state:
|
|
7002
|
+
return { state: Ke(i), effects: n };
|
|
7003
7003
|
}
|
|
7004
7004
|
function pa(t) {
|
|
7005
7005
|
const e = { ...t.entities };
|
|
@@ -7014,7 +7014,7 @@ function pa(t) {
|
|
|
7014
7014
|
activityRevision: n,
|
|
7015
7015
|
...r
|
|
7016
7016
|
} = t;
|
|
7017
|
-
return
|
|
7017
|
+
return Ke({
|
|
7018
7018
|
...r,
|
|
7019
7019
|
entities: e,
|
|
7020
7020
|
activityBySessionId: { ...s, ...t.activityBySessionId },
|
|
@@ -7305,9 +7305,9 @@ class wa {
|
|
|
7305
7305
|
constructor(e = ba, s = {}, i) {
|
|
7306
7306
|
this.conversationPorts = { ...Ia, ...s }, this.featurePorts = i ?? {}, this.engine = new ma({
|
|
7307
7307
|
initialState: Object.freeze({ revision: 0, slices: Object.freeze({
|
|
7308
|
-
account: K(
|
|
7309
|
-
features: K(
|
|
7310
|
-
interactions: K(
|
|
7308
|
+
account: K(us()),
|
|
7309
|
+
features: K(ps()),
|
|
7310
|
+
interactions: K(hs()),
|
|
7311
7311
|
modelSelection: da(),
|
|
7312
7312
|
directory: Rn(),
|
|
7313
7313
|
conversation: en()
|
|
@@ -7321,7 +7321,7 @@ class wa {
|
|
|
7321
7321
|
return { state: Object.freeze({ revision: n.revision + 1, slices: Object.freeze({ ...n.slices, ...d }) }), effects: c.effects };
|
|
7322
7322
|
}
|
|
7323
7323
|
if (ya(o)) {
|
|
7324
|
-
const c = we(n.slices.directory, o, n.slices.conversation), d =
|
|
7324
|
+
const c = we(n.slices.directory, o, n.slices.conversation), d = Rs(ws(n.slices.conversation, c.state, o.type === "directory.authority_replace" && o.adoptLocalSubmissions === !0)), u = _s(n.slices.conversation, d.state, c.state, c.state.clients !== n.slices.directory.clients), l = u.state, h = Pi(n.slices.conversation, l, c.state);
|
|
7325
7325
|
return { state: h === n.slices.directory && l === n.slices.conversation ? n : Object.freeze({
|
|
7326
7326
|
revision: n.revision + 1,
|
|
7327
7327
|
slices: Object.freeze({ ...n.slices, directory: h, conversation: l })
|
|
@@ -7355,7 +7355,7 @@ class wa {
|
|
|
7355
7355
|
}).state);
|
|
7356
7356
|
}
|
|
7357
7357
|
d = Pi(n.slices.conversation, c.state, d);
|
|
7358
|
-
const l =
|
|
7358
|
+
const l = Rs(ws(c.state, d)), h = _s(c.state, l.state, d);
|
|
7359
7359
|
let f = n.slices;
|
|
7360
7360
|
const m = [], p = c.interactionSources, g = f.account.authority;
|
|
7361
7361
|
if (p && g && g.authorityId === p.authorityId && g.generation === p.generation) {
|
|
@@ -7440,13 +7440,13 @@ class wa {
|
|
|
7440
7440
|
}
|
|
7441
7441
|
}
|
|
7442
7442
|
}
|
|
7443
|
-
const _a = "pluno-product-agent-attachments", Sa = 1,
|
|
7443
|
+
const _a = "pluno-product-agent-attachments", Sa = 1, Ps = "files", Ra = 1440 * 60 * 1e3;
|
|
7444
7444
|
async function ka(t) {
|
|
7445
|
-
const e = await
|
|
7445
|
+
const e = await Mt();
|
|
7446
7446
|
await Tn(e, "readwrite", (s) => s.put(t));
|
|
7447
7447
|
}
|
|
7448
7448
|
async function xi(t) {
|
|
7449
|
-
const e = await
|
|
7449
|
+
const e = await Mt(), s = await Tn(
|
|
7450
7450
|
e,
|
|
7451
7451
|
"readonly",
|
|
7452
7452
|
(n) => n.get(t)
|
|
@@ -7457,7 +7457,7 @@ async function xi(t) {
|
|
|
7457
7457
|
return await En(t, { lastUsedAt: i }), { ...s, lastUsedAt: i };
|
|
7458
7458
|
}
|
|
7459
7459
|
async function En(t, e) {
|
|
7460
|
-
const s = await
|
|
7460
|
+
const s = await Mt();
|
|
7461
7461
|
await Ws(s, "readwrite", async (i) => {
|
|
7462
7462
|
const n = await Gs(
|
|
7463
7463
|
i.get(t)
|
|
@@ -7469,17 +7469,17 @@ async function En(t, e) {
|
|
|
7469
7469
|
});
|
|
7470
7470
|
}
|
|
7471
7471
|
async function Aa(t = Ra) {
|
|
7472
|
-
const e = await
|
|
7472
|
+
const e = await Mt(), s = Date.now() - t;
|
|
7473
7473
|
await Ws(e, "readwrite", async (i) => {
|
|
7474
7474
|
const n = i.index("lastUsedAt");
|
|
7475
7475
|
(await Gs(n.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => i.delete(o));
|
|
7476
7476
|
});
|
|
7477
7477
|
}
|
|
7478
|
-
function
|
|
7478
|
+
function Mt() {
|
|
7479
7479
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
|
|
7480
7480
|
const s = indexedDB.open(_a, Sa);
|
|
7481
7481
|
s.onupgradeneeded = () => {
|
|
7482
|
-
const n = s.result.createObjectStore(
|
|
7482
|
+
const n = s.result.createObjectStore(Ps, { keyPath: "attachmentId" });
|
|
7483
7483
|
n.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), n.createIndex("sessionId", "sessionId", { unique: !1 }), n.createIndex("origin", "origin", { unique: !1 });
|
|
7484
7484
|
}, s.onsuccess = () => t(s.result), s.onerror = () => e(s.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
7485
7485
|
});
|
|
@@ -7489,7 +7489,7 @@ async function Tn(t, e, s) {
|
|
|
7489
7489
|
}
|
|
7490
7490
|
function Ws(t, e, s) {
|
|
7491
7491
|
return new Promise((i, n) => {
|
|
7492
|
-
const r = t.transaction(
|
|
7492
|
+
const r = t.transaction(Ps, e), o = r.objectStore(Ps);
|
|
7493
7493
|
let a, c = !1;
|
|
7494
7494
|
s(o).then((d) => {
|
|
7495
7495
|
a = d;
|
|
@@ -7551,11 +7551,11 @@ const Ma = "save_runtime_captured_skill";
|
|
|
7551
7551
|
function Ca(t) {
|
|
7552
7552
|
return (t.type === "function_call" || t.type === "tool_call") && t.name === Ma;
|
|
7553
7553
|
}
|
|
7554
|
-
const
|
|
7554
|
+
const Gt = "pluno.productAgent.transportId", Oa = "pluno.productAgent.transportIdentity", Jt = "pluno.productAgent.transportIdentity.event", Pa = 50, xa = globalThis.setTimeout.bind(globalThis);
|
|
7555
7555
|
let Ue = null;
|
|
7556
|
-
const
|
|
7556
|
+
const gt = /* @__PURE__ */ new Set(), Qt = /* @__PURE__ */ new Map();
|
|
7557
7557
|
async function Da(t = Cn()) {
|
|
7558
|
-
const e = t.randomUUID(), s = t.storage.getItem(
|
|
7558
|
+
const e = t.randomUUID(), s = t.storage.getItem(Gt);
|
|
7559
7559
|
let i = s ?? t.randomUUID(), n = !1, r = !1;
|
|
7560
7560
|
const o = t.channel.subscribe((c) => {
|
|
7561
7561
|
if (!(c.senderId === e || c.transportId !== i)) {
|
|
@@ -7573,7 +7573,7 @@ async function Da(t = Cn()) {
|
|
|
7573
7573
|
}
|
|
7574
7574
|
});
|
|
7575
7575
|
if (!s)
|
|
7576
|
-
t.storage.setItem(
|
|
7576
|
+
t.storage.setItem(Gt, i), n = !0;
|
|
7577
7577
|
else if (t.skipStoredIdentityCollisionCheck)
|
|
7578
7578
|
n = !0;
|
|
7579
7579
|
else
|
|
@@ -7582,7 +7582,7 @@ async function Da(t = Cn()) {
|
|
|
7582
7582
|
n = !0;
|
|
7583
7583
|
break;
|
|
7584
7584
|
}
|
|
7585
|
-
i = t.randomUUID(), t.storage.setItem(
|
|
7585
|
+
i = t.randomUUID(), t.storage.setItem(Gt, i);
|
|
7586
7586
|
}
|
|
7587
7587
|
let a = !1;
|
|
7588
7588
|
return {
|
|
@@ -7598,24 +7598,24 @@ async function Ua(t = !1) {
|
|
|
7598
7598
|
skipStoredIdentityCollisionCheck: t
|
|
7599
7599
|
}), Ue.then((n) => {
|
|
7600
7600
|
const r = (o) => {
|
|
7601
|
-
o.persisted || (n.release(), Ue = null,
|
|
7601
|
+
o.persisted || (n.release(), Ue = null, gt.clear(), window.removeEventListener("pagehide", r));
|
|
7602
7602
|
};
|
|
7603
7603
|
window.addEventListener("pagehide", r);
|
|
7604
7604
|
}));
|
|
7605
7605
|
const e = await Ue, s = Na();
|
|
7606
|
-
|
|
7606
|
+
gt.add(s);
|
|
7607
7607
|
let i = !1;
|
|
7608
7608
|
return {
|
|
7609
7609
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
7610
7610
|
transportId: s === 0 ? e.transportId : `${e.transportId}.${s}`,
|
|
7611
7611
|
release: () => {
|
|
7612
|
-
i || (i = !0,
|
|
7612
|
+
i || (i = !0, gt.delete(s));
|
|
7613
7613
|
}
|
|
7614
7614
|
};
|
|
7615
7615
|
}
|
|
7616
7616
|
function Na() {
|
|
7617
7617
|
let t = 0;
|
|
7618
|
-
for (;
|
|
7618
|
+
for (; gt.has(t); )
|
|
7619
7619
|
t += 1;
|
|
7620
7620
|
return t;
|
|
7621
7621
|
}
|
|
@@ -7631,13 +7631,13 @@ function Ba() {
|
|
|
7631
7631
|
return {
|
|
7632
7632
|
getItem: (t) => {
|
|
7633
7633
|
try {
|
|
7634
|
-
return window.sessionStorage?.getItem(t) ??
|
|
7634
|
+
return window.sessionStorage?.getItem(t) ?? Qt.get(t) ?? null;
|
|
7635
7635
|
} catch {
|
|
7636
|
-
return
|
|
7636
|
+
return Qt.get(t) ?? null;
|
|
7637
7637
|
}
|
|
7638
7638
|
},
|
|
7639
7639
|
setItem: (t, e) => {
|
|
7640
|
-
|
|
7640
|
+
Qt.set(t, e);
|
|
7641
7641
|
try {
|
|
7642
7642
|
window.sessionStorage?.setItem(t, e);
|
|
7643
7643
|
} catch {
|
|
@@ -7661,7 +7661,7 @@ function ja() {
|
|
|
7661
7661
|
}
|
|
7662
7662
|
function La() {
|
|
7663
7663
|
const t = /* @__PURE__ */ new Set(), e = (s) => {
|
|
7664
|
-
if (s.key !==
|
|
7664
|
+
if (s.key !== Jt || !s.newValue)
|
|
7665
7665
|
return;
|
|
7666
7666
|
const i = JSON.parse(s.newValue);
|
|
7667
7667
|
for (const n of t)
|
|
@@ -7670,9 +7670,9 @@ function La() {
|
|
|
7670
7670
|
return window.addEventListener("storage", e), {
|
|
7671
7671
|
postMessage: (s) => {
|
|
7672
7672
|
window.localStorage.setItem(
|
|
7673
|
-
|
|
7673
|
+
Jt,
|
|
7674
7674
|
JSON.stringify({ ...s, eventId: crypto.randomUUID() })
|
|
7675
|
-
), window.localStorage.removeItem(
|
|
7675
|
+
), window.localStorage.removeItem(Jt);
|
|
7676
7676
|
},
|
|
7677
7677
|
subscribe: (s) => (t.add(s), () => t.delete(s)),
|
|
7678
7678
|
close: () => {
|
|
@@ -7703,16 +7703,13 @@ const $a = [
|
|
|
7703
7703
|
"anthropic/claude-sonnet-5",
|
|
7704
7704
|
"deepseek/deepseek-chat-v3.1",
|
|
7705
7705
|
"deepseek/deepseek-v4-flash",
|
|
7706
|
-
"gpt-5.4-nano",
|
|
7707
|
-
"gpt-5.4-mini",
|
|
7708
|
-
"gpt-5.4",
|
|
7709
7706
|
"gpt-5.6-luna",
|
|
7710
7707
|
"gpt-5.6-terra",
|
|
7711
7708
|
"gpt-5.6-sol",
|
|
7712
7709
|
"gpt-6.1-sol",
|
|
7713
7710
|
"gpt-6-sol",
|
|
7714
7711
|
"gpt-6-luna"
|
|
7715
|
-
],
|
|
7712
|
+
], $e = (t) => typeof t == "string" && $a.includes(t), Xt = /* @__PURE__ */ new Map();
|
|
7716
7713
|
function za(t, e, s) {
|
|
7717
7714
|
const i = `pluno.productAgent.modelClientScope:${e}`, n = t.getItem(i);
|
|
7718
7715
|
if (n) return n;
|
|
@@ -7722,24 +7719,24 @@ function za(t, e, s) {
|
|
|
7722
7719
|
function Ha(t, e) {
|
|
7723
7720
|
try {
|
|
7724
7721
|
const s = za(window.sessionStorage, t, e);
|
|
7725
|
-
return
|
|
7722
|
+
return Xt.set(t, s), s;
|
|
7726
7723
|
} catch (s) {
|
|
7727
7724
|
if (!(s instanceof DOMException) || s.name !== "SecurityError" && s.name !== "QuotaExceededError") throw s;
|
|
7728
|
-
const i =
|
|
7729
|
-
return
|
|
7725
|
+
const i = Xt.get(t) ?? e();
|
|
7726
|
+
return Xt.set(t, i), i;
|
|
7730
7727
|
}
|
|
7731
7728
|
}
|
|
7732
7729
|
function Ka(t) {
|
|
7733
7730
|
if (!t || typeof t != "object") return;
|
|
7734
7731
|
const e = t, s = e.requestedModel ?? e.requested_model, i = e.effectiveModel ?? e.effective_model, n = e.provider;
|
|
7735
|
-
if (!(
|
|
7732
|
+
if (!(!$e(s) || !$e(i) || n !== "openrouter" && n !== "azure" && n !== "openai"))
|
|
7736
7733
|
return Object.freeze({ requestedModel: s, effectiveModel: i, provider: n });
|
|
7737
7734
|
}
|
|
7738
7735
|
const Pn = (t, e) => _r(
|
|
7739
7736
|
t.engine.getState().slices.modelSelection,
|
|
7740
7737
|
e
|
|
7741
7738
|
);
|
|
7742
|
-
function
|
|
7739
|
+
function Yt(t, e, s, i) {
|
|
7743
7740
|
return t.engine.dispatch({
|
|
7744
7741
|
type: "model.submission_capture",
|
|
7745
7742
|
clientScopeId: e,
|
|
@@ -7758,7 +7755,7 @@ function Va(t, e, s, i, n, r) {
|
|
|
7758
7755
|
updatedAt: r ? Date.parse(r) : void 0
|
|
7759
7756
|
});
|
|
7760
7757
|
}
|
|
7761
|
-
function
|
|
7758
|
+
function Zt(t, e, s, i) {
|
|
7762
7759
|
if (Array.isArray(i))
|
|
7763
7760
|
for (const n of i) {
|
|
7764
7761
|
if (!n || typeof n != "object") continue;
|
|
@@ -7777,7 +7774,7 @@ class tl {
|
|
|
7777
7774
|
constructor(e, s, i = 20) {
|
|
7778
7775
|
this.loadPage = s, this.limit = i, this.recentQuery = new Si(
|
|
7779
7776
|
`${e}:recent`,
|
|
7780
|
-
async ({ cursor: n }) =>
|
|
7777
|
+
async ({ cursor: n }) => mt(
|
|
7781
7778
|
await this.loadPage({ cursor: n, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
7782
7779
|
entities: r.sessions,
|
|
7783
7780
|
nextCursor: r.nextCursor
|
|
@@ -7786,7 +7783,7 @@ class tl {
|
|
|
7786
7783
|
Go
|
|
7787
7784
|
), this.pinnedQuery = new Si(
|
|
7788
7785
|
`${e}:pinned`,
|
|
7789
|
-
async () =>
|
|
7786
|
+
async () => mt({
|
|
7790
7787
|
entities: await this.loadAllPinned(),
|
|
7791
7788
|
nextCursor: null
|
|
7792
7789
|
})
|
|
@@ -7806,11 +7803,11 @@ class tl {
|
|
|
7806
7803
|
activityReconciliationScheduled = !1;
|
|
7807
7804
|
getState() {
|
|
7808
7805
|
const e = this.recentQuery.getState(), s = this.pinnedQuery.getState(), i = [
|
|
7809
|
-
...
|
|
7810
|
-
...
|
|
7806
|
+
...tt(s.data),
|
|
7807
|
+
...tt(e.data)
|
|
7811
7808
|
], n = new Map(i.map((c) => [c.id, c])), r = Array.from(n.values()).map(
|
|
7812
7809
|
(c) => this.applyOverrides(c, this.completedRefreshSequence)
|
|
7813
|
-
), o = Array.from(this.optimisticEntities.values()).filter((c) => !n.has(c.id)).reverse(), a = e.data || s.data || o.length > 0 ?
|
|
7810
|
+
), o = Array.from(this.optimisticEntities.values()).filter((c) => !n.has(c.id)).reverse(), a = e.data || s.data || o.length > 0 ? mt({
|
|
7814
7811
|
entities: [...o, ...r],
|
|
7815
7812
|
nextCursor: e.data?.nextCursor ?? null
|
|
7816
7813
|
}) : null;
|
|
@@ -7882,8 +7879,8 @@ class tl {
|
|
|
7882
7879
|
}
|
|
7883
7880
|
reconcileDurableEntities() {
|
|
7884
7881
|
const e = [
|
|
7885
|
-
...
|
|
7886
|
-
...
|
|
7882
|
+
...tt(this.pinnedQuery.getState().data),
|
|
7883
|
+
...tt(this.recentQuery.getState().data)
|
|
7887
7884
|
], s = new Set(e.map((i) => i.id));
|
|
7888
7885
|
for (const i of this.optimisticEntities.keys())
|
|
7889
7886
|
s.has(i) && this.optimisticEntities.delete(i);
|
|
@@ -7922,7 +7919,7 @@ class tl {
|
|
|
7922
7919
|
for (const e of this.listeners) e(this.getState());
|
|
7923
7920
|
}
|
|
7924
7921
|
}
|
|
7925
|
-
function
|
|
7922
|
+
function tt(t) {
|
|
7926
7923
|
return t ? t.ids.map((e) => t.entitiesById[e]).filter((e) => !!e) : [];
|
|
7927
7924
|
}
|
|
7928
7925
|
function Wa(t, e) {
|
|
@@ -8053,14 +8050,14 @@ class sl {
|
|
|
8053
8050
|
return null;
|
|
8054
8051
|
}
|
|
8055
8052
|
getDecisionKey(e) {
|
|
8056
|
-
const s =
|
|
8053
|
+
const s = es(e.scope);
|
|
8057
8054
|
return e.action === "dont_show_again" ? `${s}:category:${e.category}` : `${s}:interaction:${e.promptKey}`;
|
|
8058
8055
|
}
|
|
8059
8056
|
getExactKey(e) {
|
|
8060
|
-
return `${
|
|
8057
|
+
return `${es(e.scope)}:interaction:${e.key}`;
|
|
8061
8058
|
}
|
|
8062
8059
|
getCategoryKey(e) {
|
|
8063
|
-
return `${
|
|
8060
|
+
return `${es(e.scope)}:category:${e.category}`;
|
|
8064
8061
|
}
|
|
8065
8062
|
}
|
|
8066
8063
|
function il(t, e) {
|
|
@@ -8075,7 +8072,7 @@ function Ga(t, e) {
|
|
|
8075
8072
|
const i = JSON.parse(s);
|
|
8076
8073
|
return Array.isArray(i) ? i.filter(xs) : [];
|
|
8077
8074
|
}
|
|
8078
|
-
function
|
|
8075
|
+
function es(t) {
|
|
8079
8076
|
return `${t.level}:${t.key}`;
|
|
8080
8077
|
}
|
|
8081
8078
|
function xn(t) {
|
|
@@ -8093,8 +8090,8 @@ const Ja = {
|
|
|
8093
8090
|
stopped: "⏹️"
|
|
8094
8091
|
}, Qa = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
8095
8092
|
function Xa(t, e) {
|
|
8096
|
-
if (!e) return
|
|
8097
|
-
const s =
|
|
8093
|
+
if (!e) return St(t);
|
|
8094
|
+
const s = St(t), i = `${Ja[e]} Pluno`;
|
|
8098
8095
|
return s ? `${i}: ${s}` : i;
|
|
8099
8096
|
}
|
|
8100
8097
|
class nl {
|
|
@@ -8119,10 +8116,10 @@ class nl {
|
|
|
8119
8116
|
}
|
|
8120
8117
|
applyStatus(e) {
|
|
8121
8118
|
const s = this.titleDocument.getTitle();
|
|
8122
|
-
s !== this.lastAppliedTitle && (this.baseTitle =
|
|
8119
|
+
s !== this.lastAppliedTitle && (this.baseTitle = St(s)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
8123
8120
|
}
|
|
8124
8121
|
applyClear() {
|
|
8125
|
-
const e = this.titleDocument.getTitle(), s = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ?
|
|
8122
|
+
const e = this.titleDocument.getTitle(), s = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, i = this.lastAppliedTitle === null ? St(e) : e;
|
|
8126
8123
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, s ? this.titleDocument.setTitle(this.baseTitle) : i !== e && this.titleDocument.setTitle(i);
|
|
8127
8124
|
}
|
|
8128
8125
|
handleTitleChanged() {
|
|
@@ -8151,7 +8148,7 @@ function rl(t) {
|
|
|
8151
8148
|
}
|
|
8152
8149
|
};
|
|
8153
8150
|
}
|
|
8154
|
-
function
|
|
8151
|
+
function St(t) {
|
|
8155
8152
|
return t.replace(Qa, "");
|
|
8156
8153
|
}
|
|
8157
8154
|
const Ya = {
|
|
@@ -8198,7 +8195,7 @@ function ol(t) {
|
|
|
8198
8195
|
case "runtime.report_response_visibility":
|
|
8199
8196
|
return An(e.observation);
|
|
8200
8197
|
case "runtime.report_operation_timing":
|
|
8201
|
-
return
|
|
8198
|
+
return We(e.timing);
|
|
8202
8199
|
case "runtime.report_displayed_error":
|
|
8203
8200
|
return (e.errorDiagnostic === void 0 || Br(e.errorDiagnostic)) && (e.httpRequest === void 0 || re(e.httpRequest)) && (e.historyRefreshFailure === void 0 || Bs(e.historyRefreshFailure)) && (e.renderedError === void 0 || Ls(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);
|
|
8204
8201
|
case "runtime.report_invalid_state_transition":
|
|
@@ -8234,7 +8231,7 @@ function ol(t) {
|
|
|
8234
8231
|
}
|
|
8235
8232
|
class al {
|
|
8236
8233
|
constructor(e, s, i) {
|
|
8237
|
-
this.adapter = s, this.state =
|
|
8234
|
+
this.adapter = s, this.state = st(e), this.hasBeenReady = e.status === "connected" && e.submissionReady !== !1, this.initialModel = i ?? "gpt-6.1-sol", this.model = this.initialModel;
|
|
8238
8235
|
}
|
|
8239
8236
|
adapter;
|
|
8240
8237
|
listeners = {};
|
|
@@ -8243,7 +8240,7 @@ class al {
|
|
|
8243
8240
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
8244
8241
|
accountListeners = /* @__PURE__ */ new Set();
|
|
8245
8242
|
state;
|
|
8246
|
-
sessionHistoryState =
|
|
8243
|
+
sessionHistoryState = ft("unavailable");
|
|
8247
8244
|
model;
|
|
8248
8245
|
modelExplicit = !1;
|
|
8249
8246
|
initialModel;
|
|
@@ -8272,9 +8269,9 @@ class al {
|
|
|
8272
8269
|
return i.add(s), this.listeners[e] = i, () => i.delete(s);
|
|
8273
8270
|
}
|
|
8274
8271
|
getState() {
|
|
8275
|
-
const e =
|
|
8272
|
+
const e = st(this.state);
|
|
8276
8273
|
if (this.pendingNavigation && (e.isLoadingSession = !0), this.retainedTranscript) {
|
|
8277
|
-
const n =
|
|
8274
|
+
const n = st({ ...e, ...this.retainedTranscript }), r = new Set(n.messages.map((a) => a.id)), o = new Set(n.segments?.map((a) => a.id));
|
|
8278
8275
|
e.messages = [...n.messages, ...e.messages.filter((a) => !r.has(a.id))], (n.segments || e.segments) && (e.segments = [
|
|
8279
8276
|
...(n.segments ?? []).map((a) => ({ ...a })),
|
|
8280
8277
|
...(e.segments ?? []).filter((a) => !o.has(a.id))
|
|
@@ -8285,7 +8282,7 @@ class al {
|
|
|
8285
8282
|
this.stopError && (e.lastError = this.stopError, e.lastErrorCode = "stop_failed");
|
|
8286
8283
|
const s = [...this.stopPreviews.keys()];
|
|
8287
8284
|
if (!s.length) return e;
|
|
8288
|
-
const i =
|
|
8285
|
+
const i = Ms(e, "", "stopping", s);
|
|
8289
8286
|
return e.activeResponseUserMessageId && !this.stopPreviews.has(e.activeResponseUserMessageId) ? { ...e, messages: i.messages, segments: i.segments } : i;
|
|
8290
8287
|
}
|
|
8291
8288
|
updateProjection(e, s, i, n, r) {
|
|
@@ -8295,7 +8292,7 @@ class al {
|
|
|
8295
8292
|
for (const l of e.messages)
|
|
8296
8293
|
l.role === "user" && e.receipts?.find((h) => h.userMessageId === l.id)?.durable !== !1 && this.submissionPreviews.delete(l.id);
|
|
8297
8294
|
const u = c && e.sessionId !== null && e.isLoadingSession && !e.isDraftSession;
|
|
8298
|
-
this.retainedTranscript = u ? this.retainedTranscript ?? (this.state.isLoadingSession || this.state.messages.length === 0 ? null : { messages: this.state.messages, segments: this.state.segments, removedItems: this.state.removedItems }) : null, this.state =
|
|
8295
|
+
this.retainedTranscript = u ? this.retainedTranscript ?? (this.state.isLoadingSession || this.state.messages.length === 0 ? null : { messages: this.state.messages, segments: this.state.segments, removedItems: this.state.removedItems }) : null, this.state = st(e), s !== void 0 && !this.modelExplicit && (this.model = s), e.status === "connected" && e.submissionReady !== !1 && (this.hasBeenReady = !0);
|
|
8299
8296
|
for (const [l, h] of this.stopPreviews) {
|
|
8300
8297
|
const f = e.activity?.executionKey;
|
|
8301
8298
|
(h !== void 0 && h !== "[]" && f !== void 0 && f !== "[]" && (f !== h || ["completed", "failed", "stopped"].includes(e.activity.phase)) || (h === void 0 || h === "[]") && e.messages.some((p) => p.respondsToUserMessageId === l && !p.provisional && p.loading !== !0 && (p.dataType === "run_status" || p.dataType === "run_error" || p.role === "assistant" && p.phase !== "commentary" && (p.streamState === void 0 || ["finished", "stopped", "failed"].includes(p.streamState))))) && this.stopPreviews.delete(l);
|
|
@@ -8340,7 +8337,7 @@ class al {
|
|
|
8340
8337
|
this.dispatch({ type: "runtime.widget_lifecycle", action: e, trigger: s });
|
|
8341
8338
|
}
|
|
8342
8339
|
reportOperationTiming(e) {
|
|
8343
|
-
!this.destroyed &&
|
|
8340
|
+
!this.destroyed && We(e) && this.adapter.dispatch({ type: "runtime.report_operation_timing", timing: e }).catch(() => {
|
|
8344
8341
|
});
|
|
8345
8342
|
}
|
|
8346
8343
|
reportResponseVisibility(e) {
|
|
@@ -8732,7 +8729,7 @@ function ec(t, e) {
|
|
|
8732
8729
|
return n ? { ...i, previewUrl: n } : i;
|
|
8733
8730
|
});
|
|
8734
8731
|
}
|
|
8735
|
-
function
|
|
8732
|
+
function st(t) {
|
|
8736
8733
|
return {
|
|
8737
8734
|
...t,
|
|
8738
8735
|
starterPrompts: [...t.starterPrompts],
|
|
@@ -8759,7 +8756,7 @@ function tt(t) {
|
|
|
8759
8756
|
function Ui(t) {
|
|
8760
8757
|
return {
|
|
8761
8758
|
...t,
|
|
8762
|
-
data: t.data ?
|
|
8759
|
+
data: t.data ? mt({
|
|
8763
8760
|
entities: Jo(t.data).map((e) => ({ ...e })),
|
|
8764
8761
|
nextCursor: t.data.nextCursor
|
|
8765
8762
|
}) : null
|
|
@@ -8775,7 +8772,7 @@ class ae extends Error {
|
|
|
8775
8772
|
retryAfterMs;
|
|
8776
8773
|
}
|
|
8777
8774
|
let rc = 0;
|
|
8778
|
-
function
|
|
8775
|
+
function ts(t) {
|
|
8779
8776
|
const e = {};
|
|
8780
8777
|
for (const c of [
|
|
8781
8778
|
"type",
|
|
@@ -8852,14 +8849,14 @@ function Re(t, e, s) {
|
|
|
8852
8849
|
};
|
|
8853
8850
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: n }));
|
|
8854
8851
|
}
|
|
8855
|
-
const oc = "https://app.pluno.ai", ac = 2e4, cc = 1e4, dc = 6e4, lc = 6e4, uc = 1e4, hc = 1e4, pc = 1e3, Ds = 3e4, Bi = 0.2,
|
|
8852
|
+
const oc = "https://app.pluno.ai", ac = 2e4, cc = 1e4, dc = 6e4, lc = 6e4, uc = 1e4, hc = 1e4, pc = 1e3, Ds = 3e4, Bi = 0.2, ss = 6e4, is = 3, ji = "Still connecting to Pluno. Retrying automatically.", fc = 1e3, mc = 100, Li = 3, gc = [300, 1e3], Dn = 50 * 1024 * 1024, yc = /* @__PURE__ */ new Set([
|
|
8856
8853
|
".jpeg:image/jpeg",
|
|
8857
8854
|
".jpg:image/jpeg",
|
|
8858
8855
|
".pdf:application/pdf",
|
|
8859
8856
|
".png:image/png",
|
|
8860
8857
|
".webp:image/webp"
|
|
8861
|
-
]), cl = ".pdf,.png,.jpg,.jpeg,.webp", Js = 64e3,
|
|
8862
|
-
let
|
|
8858
|
+
]), cl = ".pdf,.png,.jpg,.jpeg,.webp", Js = 64e3, ns = 4e3, Qs = 30, vc = 2e3, bc = 1e3, Un = "Image is too large for model vision input.", Ic = "pluno.productAgent.state.", Us = "pluno.productAgent.pendingEvents.", Ct = "pluno.productAgent.activeToolCalls.", wc = 100, yt = /* @__PURE__ */ new Set();
|
|
8859
|
+
let it = null;
|
|
8863
8860
|
function _c(t, e = Math.random) {
|
|
8864
8861
|
const s = Math.min(Ds, pc * 2 ** t), i = 1 - Bi + e() * Bi * 2;
|
|
8865
8862
|
return Math.min(Ds, Math.round(s * i));
|
|
@@ -8875,7 +8872,7 @@ function Sc(t) {
|
|
|
8875
8872
|
return null;
|
|
8876
8873
|
}
|
|
8877
8874
|
}
|
|
8878
|
-
function
|
|
8875
|
+
function rs(t) {
|
|
8879
8876
|
if (t instanceof ae)
|
|
8880
8877
|
return t.retryable;
|
|
8881
8878
|
if (t && typeof t == "object") {
|
|
@@ -8885,7 +8882,7 @@ function ns(t) {
|
|
|
8885
8882
|
}
|
|
8886
8883
|
return !0;
|
|
8887
8884
|
}
|
|
8888
|
-
function
|
|
8885
|
+
function nt(t) {
|
|
8889
8886
|
const e = J(t, "connection_failed", "web_transport");
|
|
8890
8887
|
if (t instanceof Error && t.message === e.message) return t;
|
|
8891
8888
|
if (t && typeof t == "object" && !("message" in t)) {
|
|
@@ -8895,13 +8892,13 @@ function it(t) {
|
|
|
8895
8892
|
}
|
|
8896
8893
|
return Object.assign(new Error(e.message), e);
|
|
8897
8894
|
}
|
|
8898
|
-
function
|
|
8895
|
+
function os(t) {
|
|
8899
8896
|
return t === "main_web_chat" ? ["pinned", "recent"] : ["all"];
|
|
8900
8897
|
}
|
|
8901
|
-
class
|
|
8898
|
+
class Ot {
|
|
8902
8899
|
constructor(e, s) {
|
|
8903
8900
|
this.options = e, this.transportIdentity = s, this.directoryAuthority = {
|
|
8904
|
-
authorityId:
|
|
8901
|
+
authorityId: Ft(`pa.authority:${e.clientId}`) ?? `${e.clientId}:${e.runtimeCommunityId ?? e.productVariant}`,
|
|
8905
8902
|
generation: 1
|
|
8906
8903
|
}, this.directoryHttp = new Sn({
|
|
8907
8904
|
backendUrl: e.backendUrl,
|
|
@@ -9055,10 +9052,12 @@ class Ct {
|
|
|
9055
9052
|
s in e && Object.assign(this.platformState, { [s]: e[s] });
|
|
9056
9053
|
}
|
|
9057
9054
|
static async init(e) {
|
|
9055
|
+
if (e.model !== void 0 && !$e(e.model))
|
|
9056
|
+
throw new Error(`Unsupported Product Agent model: ${e.model}`);
|
|
9058
9057
|
if (e.productVariant === "personal") throw new R("Personal Product Agent has retired.", "personal_product_agent_retired", !1);
|
|
9059
9058
|
const s = e, i = await Ua(
|
|
9060
9059
|
s.skipStoredTransportIdentityCollisionCheck === !0
|
|
9061
|
-
), n = new
|
|
9060
|
+
), n = new Ot({
|
|
9062
9061
|
...e,
|
|
9063
9062
|
backendUrl: Nc(e.backendUrl ?? oc),
|
|
9064
9063
|
clientId: e.clientId ?? td(),
|
|
@@ -9092,19 +9091,19 @@ class Ct {
|
|
|
9092
9091
|
isActiveTurn: (e) => this.clientRuntime.engine.getProjection().directory.activityBySessionId[e] === !0,
|
|
9093
9092
|
nextRequestId: $,
|
|
9094
9093
|
onError: (e) => {
|
|
9095
|
-
this.handleDirectoryTransportError(e), this.emit("error",
|
|
9094
|
+
this.handleDirectoryTransportError(e), this.emit("error", nt(e));
|
|
9096
9095
|
},
|
|
9097
9096
|
wakeup: { start: () => {
|
|
9098
9097
|
}, stop: () => {
|
|
9099
9098
|
} },
|
|
9100
9099
|
enabled: () => !!this.token && !this.authenticationFailure && !this.refreshingDefaultCredentials && this.state.status !== "closed",
|
|
9101
|
-
observedQueries: () =>
|
|
9100
|
+
observedQueries: () => os(this.options.entrySurface).map((e) => this.getDirectoryQuery(e))
|
|
9102
9101
|
});
|
|
9103
9102
|
}
|
|
9104
9103
|
operationTimingReporter = () => {
|
|
9105
9104
|
};
|
|
9106
9105
|
reportOperationTiming(e) {
|
|
9107
|
-
|
|
9106
|
+
We(e) && this.operationTimingReporter(e);
|
|
9108
9107
|
}
|
|
9109
9108
|
async initializeConversation() {
|
|
9110
9109
|
const e = ++this.conversationAdapterGeneration;
|
|
@@ -9115,7 +9114,7 @@ class Ct {
|
|
|
9115
9114
|
});
|
|
9116
9115
|
const n = `pa.conversation.delivery:${this.modelClientScopeId}:${s.authorityId}`, r = `${n}:cancellations`;
|
|
9117
9116
|
this.authenticatedUserId && this.options.restorePersistedState === !1 && sessionStorage.removeItem(r);
|
|
9118
|
-
const o = this.authenticatedUserId ?
|
|
9117
|
+
const o = this.authenticatedUserId ? Ft(r) : null, a = Or({
|
|
9119
9118
|
authorityId: s.authorityId,
|
|
9120
9119
|
isCurrent: i,
|
|
9121
9120
|
read: async () => o ? JSON.parse(o) : null,
|
|
@@ -9138,7 +9137,7 @@ class Ct {
|
|
|
9138
9137
|
requestId: p.requestId,
|
|
9139
9138
|
clientMessageId: p.userMessageId,
|
|
9140
9139
|
sessionId: p.sessionId
|
|
9141
|
-
}), b = (w, A) => _.measure(w, () =>
|
|
9140
|
+
}), b = (w, A) => _.measure(w, () => ot(y, A));
|
|
9142
9141
|
let I = p.contextPreparation ?? { pageContent: "", sessionTabs: [] };
|
|
9143
9142
|
if (p.contextPreparation === null) {
|
|
9144
9143
|
await b("first_frame", () => new Promise((A) => {
|
|
@@ -9159,9 +9158,9 @@ class Ct {
|
|
|
9159
9158
|
}
|
|
9160
9159
|
if (await b("authentication", () => this.waitForAuthentication()), !i() || s !== this.directoryAuthority || this.clientRuntime.isDisposed) throw new Error("Submission authority was retired.");
|
|
9161
9160
|
for (const w of g)
|
|
9162
|
-
if (!w.uploaded && (await
|
|
9161
|
+
if (!w.uploaded && (await ot(y, () => (this.attachmentPersistence.get(w.sourceId) ?? Promise.resolve()).catch(() => {
|
|
9163
9162
|
throw Object.assign(new Error("Attachment files could not be stored. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
|
|
9164
|
-
})), !await
|
|
9163
|
+
})), !await ot(y, () => xi(w.sourceId))))
|
|
9165
9164
|
throw Object.assign(new Error("Attachment files are unavailable. Attach the files again and send a new message."), { code: "attachment_source_unavailable", retryable: !1 });
|
|
9166
9165
|
return y.throwIfAborted(), _.mark("context_ready"), { ...I, now: Date.now() };
|
|
9167
9166
|
},
|
|
@@ -9193,7 +9192,7 @@ class Ct {
|
|
|
9193
9192
|
onTiming: (p) => {
|
|
9194
9193
|
i() && this.reportOperationTiming(p);
|
|
9195
9194
|
},
|
|
9196
|
-
onCommand: (p) => Re("client_event", p.type,
|
|
9195
|
+
onCommand: (p) => Re("client_event", p.type, ts({ ...p.payload, type: p.type })),
|
|
9197
9196
|
onError: (p, g) => {
|
|
9198
9197
|
if (this.options.productVariant === "customer_embedded" && g.operation === "conversation.snapshot" && p instanceof R && p.code === "conversation_access_denied") {
|
|
9199
9198
|
g.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
|
|
@@ -9203,7 +9202,7 @@ class Ct {
|
|
|
9203
9202
|
}
|
|
9204
9203
|
})
|
|
9205
9204
|
});
|
|
9206
|
-
const c = this.clientRuntime.engine.getState().slices.conversation, d = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null :
|
|
9205
|
+
const c = this.clientRuntime.engine.getState().slices.conversation, d = this.options.restorePersistedState === !1 || !this.authenticatedUserId ? null : Ft(n);
|
|
9207
9206
|
if (this.authenticatedUserId && !c.submissionOrder.length && !Object.keys(c.operations).length) {
|
|
9208
9207
|
const p = this.queuedClientEvents.filter((_) => _.type === "chat.user_message"), g = d ? JSON.parse(d) : p.length ? $r(c, p.map((_) => {
|
|
9209
9208
|
const { type: b, ...I } = _, w = this.clientRuntime.engine.getState().slices.directory, A = w.clients[this.modelClientScopeId];
|
|
@@ -9275,7 +9274,7 @@ class Ct {
|
|
|
9275
9274
|
I && (I.sessionId = b.sessionId), this.emit("ack", { clientMessageId: b.userMessageId, sessionId: b.sessionId });
|
|
9276
9275
|
const w = b.sessionId;
|
|
9277
9276
|
w && this.getState().sessionId === w && this.directoryHttp.request(`/sessions/${encodeURIComponent(w)}/history`, { limit: 200 }).then((A) => {
|
|
9278
|
-
i() && this.getState().sessionId === w && this.state.status !== "closed" &&
|
|
9277
|
+
i() && this.getState().sessionId === w && this.state.status !== "closed" && Zt(this.clientRuntime, this.modelClientScopeId, w, A.turns);
|
|
9279
9278
|
}).catch((A) => {
|
|
9280
9279
|
i() && this.getState().sessionId === w && this.handleDirectoryTransportError(A);
|
|
9281
9280
|
});
|
|
@@ -9285,7 +9284,7 @@ class Ct {
|
|
|
9285
9284
|
for (const [b, I] of Object.entries(p.directory.clients)) {
|
|
9286
9285
|
if (!b.startsWith(`background:${this.modelClientScopeId}:`)) continue;
|
|
9287
9286
|
const w = he(p.conversation, p.directory, I), A = w.sessionId ? p.conversation.sessions[w.sessionId] : void 0;
|
|
9288
|
-
if (this.firstResponseTimersByClientMessageId.size && (u(
|
|
9287
|
+
if (this.firstResponseTimersByClientMessageId.size && (u(Kt(w, A?.queries.current, this.options.backendUrl).messages, w.sessionId), ["failed", "stopped"].includes(w.activity.phase)))
|
|
9289
9288
|
for (const D of ie(A?.execution)) this.clearFirstResponseTimer(D);
|
|
9290
9289
|
const E = w.activity.phase === "completed" && ie(A?.execution).some((D) => this.firstResponseTimersByClientMessageId.has(D));
|
|
9291
9290
|
(y && w.sessionId === this.getState().sessionId || !E && ["completed", "failed", "stopped"].includes(w.activity.phase)) && this.directoryScope.detach(b);
|
|
@@ -9318,7 +9317,7 @@ class Ct {
|
|
|
9318
9317
|
}
|
|
9319
9318
|
}
|
|
9320
9319
|
handleDirectoryTransportError(e) {
|
|
9321
|
-
if (!(e instanceof R) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) &&
|
|
9320
|
+
if (!(e instanceof R) || this.authenticationFailure || !["unauthorized", "update_required", "service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(e.code) && bt(void 0, e.code).allowed) return;
|
|
9322
9321
|
const s = e.detail && typeof e.detail == "object" ? e.detail : {};
|
|
9323
9322
|
this.handleServerEvent({
|
|
9324
9323
|
...s,
|
|
@@ -9351,12 +9350,12 @@ class Ct {
|
|
|
9351
9350
|
return i.add(s), this.listeners[e] = i, () => i.delete(s);
|
|
9352
9351
|
}
|
|
9353
9352
|
getState() {
|
|
9354
|
-
const e = this.clientRuntime.engine.getState().slices, s = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = he(e.conversation, e.directory, s), n =
|
|
9353
|
+
const e = this.clientRuntime.engine.getState().slices, s = e.directory.clients[this.modelClientScopeId] ?? this.directoryConversationScopeId, i = he(e.conversation, e.directory, s), n = Kt(
|
|
9355
9354
|
i,
|
|
9356
9355
|
i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
|
|
9357
9356
|
this.options.backendUrl,
|
|
9358
9357
|
this.clientRuntime.engine.getDiagnostics({ clientScopeId: this.modelClientScopeId, scopeId: s, sessionId: i.sessionId })
|
|
9359
|
-
), r = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, o = { kind: "starterPrompts", ...r, includeUserSuggestions: !1 }, a =
|
|
9358
|
+
), r = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, o = { kind: "starterPrompts", ...r, includeUserSuggestions: !1 }, a = wt(e, o), c = wt(e, { kind: "appearance", ...r }), d = c?.data?.kind === "appearance" ? c.data.value : null;
|
|
9360
9359
|
return {
|
|
9361
9360
|
...this.platformState,
|
|
9362
9361
|
...n,
|
|
@@ -9544,8 +9543,8 @@ class Ct {
|
|
|
9544
9543
|
this.handleDirectoryTransportError(r);
|
|
9545
9544
|
return;
|
|
9546
9545
|
}
|
|
9547
|
-
const o =
|
|
9548
|
-
if (
|
|
9546
|
+
const o = nt(r);
|
|
9547
|
+
if (rs(r)) {
|
|
9549
9548
|
V("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
9550
9549
|
message: o.message,
|
|
9551
9550
|
reconnectAttempt: this.reconnectAttempts
|
|
@@ -9612,14 +9611,14 @@ class Ct {
|
|
|
9612
9611
|
sessionId: this.getState().sessionId
|
|
9613
9612
|
});
|
|
9614
9613
|
o.mark("submit");
|
|
9615
|
-
const a =
|
|
9614
|
+
const a = Yt(
|
|
9616
9615
|
this.clientRuntime,
|
|
9617
9616
|
this.modelClientScopeId,
|
|
9618
9617
|
r,
|
|
9619
9618
|
s.requestedModel ?? this.getModel()
|
|
9620
9619
|
), c = this.submissionIntentRevision, d = this.authenticatedUserId;
|
|
9621
9620
|
if (s.initiatedBy || this.startFirstResponseTimer(r, s.submittedAt), d || await o.measure("authentication", () => this.waitForAuthentication()), this.clientRuntime.isDisposed || c !== this.submissionIntentRevision || d && d !== this.authenticatedUserId) return null;
|
|
9622
|
-
|
|
9621
|
+
Yt(this.clientRuntime, this.modelClientScopeId, r, a ?? null);
|
|
9623
9622
|
const u = this.clientRuntime.engine.getState().slices.conversation.submissions[r];
|
|
9624
9623
|
if (u && (u.content !== i || JSON.stringify(u.attachments.map((g) => g.sourceId)) !== JSON.stringify(n.map((g) => g.id ?? g.storageKey ?? g.sandboxPath)))) throw new Error("User-message identity cannot be reused with different input.");
|
|
9625
9624
|
const l = ne(), h = !u && !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== l.url, m = this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId];
|
|
@@ -9705,6 +9704,7 @@ class Ct {
|
|
|
9705
9704
|
return this.draftModel;
|
|
9706
9705
|
}
|
|
9707
9706
|
setModel(e) {
|
|
9707
|
+
if (!$e(e)) throw new Error(`Unsupported Product Agent model: ${e}`);
|
|
9708
9708
|
const s = e;
|
|
9709
9709
|
this.draftModelExplicit = !0, this.draftModel !== s && (this.draftModel = s, this.emit("state", this.getState()));
|
|
9710
9710
|
}
|
|
@@ -9713,7 +9713,7 @@ class Ct {
|
|
|
9713
9713
|
if (!r) return !1;
|
|
9714
9714
|
if (r.type === "preparation") {
|
|
9715
9715
|
const o = $(), a = Wo(r.submission);
|
|
9716
|
-
return
|
|
9716
|
+
return Yt(this.clientRuntime, this.modelClientScopeId, o, r.submission.requestedModel), this.sendMessage(a.content, { clientMessageId: o, attachments: a.attachments, proactiveSuggestionQuestion: a.proactiveSuggestionQuestion }).catch((c) => this.emit("error", nt(c))), !0;
|
|
9717
9717
|
}
|
|
9718
9718
|
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: {
|
|
9719
9719
|
request_id: $(),
|
|
@@ -9868,7 +9868,7 @@ class Ct {
|
|
|
9868
9868
|
}
|
|
9869
9869
|
getSessionHistoryState() {
|
|
9870
9870
|
return this.clientRuntime.project("directory", { core: () => {
|
|
9871
|
-
const e = this.clientRuntime.engine.getProjection().directory, s = e.queries[N(this.getDirectoryQuery())], i =
|
|
9871
|
+
const e = this.clientRuntime.engine.getProjection().directory, s = e.queries[N(this.getDirectoryQuery())], i = os(this.options.entrySurface).map((u) => this.getDirectoryQuery(u)).map((u) => e.queries[N(u)]).filter((u) => u !== void 0), n = Object.values(e.optimisticEntries).reverse(), r = Zo(i), o = new Set(n.flatMap((u) => u.sessionId ? [u.sessionId] : [])), a = [...n.map((u) => u.id), ...r.filter((u) => !o.has(u))], c = Object.fromEntries([
|
|
9872
9872
|
...n.map((u) => [u.id, {
|
|
9873
9873
|
id: u.id,
|
|
9874
9874
|
title: null,
|
|
@@ -9898,7 +9898,7 @@ class Ct {
|
|
|
9898
9898
|
}
|
|
9899
9899
|
refreshSessionHistory() {
|
|
9900
9900
|
return this.clientRuntime.route("directory", { core: async () => {
|
|
9901
|
-
await Promise.all(
|
|
9901
|
+
await Promise.all(os(this.options.entrySurface).map((e) => this.getDirectoryQuery(e)).map((e) => this.refreshDirectoryQuery(e, e.kind === "pinned")));
|
|
9902
9902
|
} });
|
|
9903
9903
|
}
|
|
9904
9904
|
loadMoreSessionHistory() {
|
|
@@ -10052,7 +10052,7 @@ class Ct {
|
|
|
10052
10052
|
})), !0;
|
|
10053
10053
|
}
|
|
10054
10054
|
try {
|
|
10055
|
-
return s.send(JSON.stringify(e)), Re("client_event", e.type,
|
|
10055
|
+
return s.send(JSON.stringify(e)), Re("client_event", e.type, ts(e)), !0;
|
|
10056
10056
|
} catch (i) {
|
|
10057
10057
|
return V("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
10058
10058
|
message: i instanceof Error ? i.message : String(i),
|
|
@@ -10065,7 +10065,7 @@ class Ct {
|
|
|
10065
10065
|
let i = this.getState();
|
|
10066
10066
|
if (e === "first_response_slow" && s.sessionId && s.sessionId !== i.sessionId) {
|
|
10067
10067
|
const { conversation: m, directory: p } = this.clientRuntime.engine.getState().slices, g = Object.values(p.clients).find((y) => p.selections[y]?.sessionId === s.sessionId);
|
|
10068
|
-
g && (i = { ...i, ...
|
|
10068
|
+
g && (i = { ...i, ...Kt(
|
|
10069
10069
|
he(m, p, g),
|
|
10070
10070
|
m.sessions[s.sessionId]?.queries.current,
|
|
10071
10071
|
this.options.backendUrl
|
|
@@ -10131,7 +10131,7 @@ class Ct {
|
|
|
10131
10131
|
missedResponseChecks: i,
|
|
10132
10132
|
timer: window.setTimeout(() => this.recordFirstResponseMiss(e), Math.max(
|
|
10133
10133
|
0,
|
|
10134
|
-
n + (i + 1) *
|
|
10134
|
+
n + (i + 1) * ss - Date.now()
|
|
10135
10135
|
))
|
|
10136
10136
|
});
|
|
10137
10137
|
}
|
|
@@ -10141,13 +10141,13 @@ class Ct {
|
|
|
10141
10141
|
return;
|
|
10142
10142
|
const i = Date.now() - s.submittedAt;
|
|
10143
10143
|
if (s.missedResponseChecks = Math.min(
|
|
10144
|
-
|
|
10145
|
-
Math.max(s.missedResponseChecks + 1, Math.floor(i /
|
|
10146
|
-
), s.missedResponseChecks >=
|
|
10144
|
+
is,
|
|
10145
|
+
Math.max(s.missedResponseChecks + 1, Math.floor(i / ss))
|
|
10146
|
+
), s.missedResponseChecks >= is) {
|
|
10147
10147
|
this.reportFirstResponseSlow(e);
|
|
10148
10148
|
return;
|
|
10149
10149
|
}
|
|
10150
|
-
const n = s.submittedAt + (s.missedResponseChecks + 1) *
|
|
10150
|
+
const n = s.submittedAt + (s.missedResponseChecks + 1) * ss;
|
|
10151
10151
|
s.timer = window.setTimeout(
|
|
10152
10152
|
() => this.recordFirstResponseMiss(e),
|
|
10153
10153
|
Math.max(0, n - Date.now())
|
|
@@ -10155,7 +10155,7 @@ class Ct {
|
|
|
10155
10155
|
}
|
|
10156
10156
|
reportFirstResponseSlow(e) {
|
|
10157
10157
|
const s = this.firstResponseTimersByClientMessageId.get(e);
|
|
10158
|
-
s && (s.missedResponseChecks =
|
|
10158
|
+
s && (s.missedResponseChecks = is, window.clearTimeout(s.timer), this.reportHealthSignal("first_response_slow", {
|
|
10159
10159
|
...s.sessionId ? { sessionId: s.sessionId } : {},
|
|
10160
10160
|
clientMessageId: e,
|
|
10161
10161
|
durationMs: Date.now() - s.submittedAt,
|
|
@@ -10192,7 +10192,7 @@ class Ct {
|
|
|
10192
10192
|
occurrenceCount: (a?.occurrenceCount ?? 0) + 1,
|
|
10193
10193
|
maxReconnectAttempt: Math.max(a?.maxReconnectAttempt ?? 0, this.reconnectAttempts),
|
|
10194
10194
|
connectivity: i,
|
|
10195
|
-
sdkVersion:
|
|
10195
|
+
sdkVersion: At.version,
|
|
10196
10196
|
stage: "socket_admission",
|
|
10197
10197
|
...s,
|
|
10198
10198
|
connectionAttemptId: n
|
|
@@ -10328,7 +10328,7 @@ class Ct {
|
|
|
10328
10328
|
applyAuthenticatedDirectoryIdentity(e) {
|
|
10329
10329
|
const s = Ki(e);
|
|
10330
10330
|
if (!s) return !1;
|
|
10331
|
-
const i =
|
|
10331
|
+
const i = ds(e, "runtimeCommunityId") ?? this.directoryHttp.auth.community_id, n = `${this.options.clientId}:${s.id}:${i ?? this.options.productVariant}`, r = this.directoryAuthority.authorityId !== n, o = this.authenticatedUserId === null, a = o ? Object.values(this.clientRuntime.engine.getState().slices.conversation.operations).filter((u) => ["waiting", "running", "uncertain"].includes(u.phase) && (u.command.type === "run.stop" || u.command.type === "session.reset")).map((u) => u.command) : [], c = o && this.directoryAuthority.authorityId === `${this.options.clientId}:${this.options.runtimeCommunityId ?? this.options.productVariant}` ? this.state.sessionId : null;
|
|
10332
10332
|
if (this.authenticatedUserId = s.id, this.directoryHttp.auth.community_id = i, zr(this.options.clientId, n), r) {
|
|
10333
10333
|
const u = this.directoryAuthority;
|
|
10334
10334
|
this.directoryObservation.dispose(), this.conversationAdapterGeneration++, this.conversationObservation?.dispose(), this.directoryAuthority = { authorityId: n, generation: u.generation + 1 }, this.clientRuntime.engine.dispatch({ ...this.directoryAuthority, type: "directory.authority_replace", expectedGeneration: u.generation }), this.createDirectoryAdapters();
|
|
@@ -10396,7 +10396,7 @@ class Ct {
|
|
|
10396
10396
|
}
|
|
10397
10397
|
}
|
|
10398
10398
|
handleServerEvent(e) {
|
|
10399
|
-
if (Re("server_event", e.type,
|
|
10399
|
+
if (Re("server_event", e.type, ts(e)), ["conversation.item.updated", "conversation.item.removed", "conversation.item.stream_finished", "conversation.execution.updated", "conversation.interaction.updated", "conversation.follow_ups.updated"].includes(e.type)) {
|
|
10400
10400
|
this.conversationObservation?.receive(e);
|
|
10401
10401
|
return;
|
|
10402
10402
|
}
|
|
@@ -10432,11 +10432,11 @@ class Ct {
|
|
|
10432
10432
|
return;
|
|
10433
10433
|
}
|
|
10434
10434
|
if (e.type === "conversation.routing") {
|
|
10435
|
-
e.sessionId === this.state.sessionId &&
|
|
10435
|
+
e.sessionId === this.state.sessionId && Zt(this.clientRuntime, this.modelClientScopeId, String(e.sessionId), e.turns);
|
|
10436
10436
|
return;
|
|
10437
10437
|
}
|
|
10438
10438
|
if (e.type === "session.updated" || e.type === "conversation.state") {
|
|
10439
|
-
|
|
10439
|
+
ds(e.session, "id") === this.state.sessionId && (this.updateHistoricalModelFromSession(e.session), Zt(this.clientRuntime, this.modelClientScopeId, this.state.sessionId, e.turns));
|
|
10440
10440
|
return;
|
|
10441
10441
|
}
|
|
10442
10442
|
if (e.type === "tool.call")
|
|
@@ -10446,7 +10446,7 @@ class Ct {
|
|
|
10446
10446
|
this.setState({ status: "reconnecting", lastError: String(e.message), lastErrorCode: e.code });
|
|
10447
10447
|
return;
|
|
10448
10448
|
}
|
|
10449
|
-
if (e.code === "service_origin_not_allowed" || e.code === "security_control_enforcement_unavailable" || !
|
|
10449
|
+
if (e.code === "service_origin_not_allowed" || e.code === "security_control_enforcement_unavailable" || !bt(void 0, String(e.code)).allowed) {
|
|
10450
10450
|
this.applyAccountSubmissionError(String(e.code)), this.setState({
|
|
10451
10451
|
status: "error",
|
|
10452
10452
|
lastError: String(e.message),
|
|
@@ -10486,14 +10486,14 @@ class Ct {
|
|
|
10486
10486
|
}
|
|
10487
10487
|
updateHistoricalModelFromSession(e) {
|
|
10488
10488
|
if (!e || typeof e != "object") return;
|
|
10489
|
-
const s =
|
|
10489
|
+
const s = ds(e, "id");
|
|
10490
10490
|
if (!s) return;
|
|
10491
10491
|
const i = e.metadata, r = i && typeof i == "object" ? i.model : void 0;
|
|
10492
10492
|
this.clientRuntime.engine.accept({
|
|
10493
10493
|
type: "model.history_received",
|
|
10494
10494
|
clientScopeId: this.modelClientScopeId,
|
|
10495
10495
|
sessionId: s,
|
|
10496
|
-
model:
|
|
10496
|
+
model: $e(r) ? r : void 0
|
|
10497
10497
|
});
|
|
10498
10498
|
}
|
|
10499
10499
|
async executeToolCall(e) {
|
|
@@ -10634,7 +10634,7 @@ class Ct {
|
|
|
10634
10634
|
this.embeddedRecoveryTimer !== null && window.clearTimeout(this.embeddedRecoveryTimer), this.embeddedRecoveryTimer = null, this.embeddedRecoveryTokenExpired = !1;
|
|
10635
10635
|
}
|
|
10636
10636
|
connectionFailureDiagnostic(e, s) {
|
|
10637
|
-
const i = e instanceof ae ? e.status : e instanceof R && e.code === "unauthorized" ? 401 : e instanceof R && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, n = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, o = !(e instanceof R && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) &&
|
|
10637
|
+
const i = e instanceof ae ? e.status : e instanceof R && e.code === "unauthorized" ? 401 : e instanceof R && /^[45][0-9]{2}$/.test(e.code) ? Number(e.code) : void 0, n = i !== void 0 && Number.isInteger(i) && i >= 400 && i <= 599 ? i : void 0, o = !(e instanceof R && ["unauthorized", "403", "update_required", "executor_replaced"].includes(e.code)) && rs(e) && n !== 401 && n !== 403;
|
|
10638
10638
|
return {
|
|
10639
10639
|
stage: s,
|
|
10640
10640
|
...n !== void 0 ? { httpStatus: n } : {},
|
|
@@ -10737,7 +10737,7 @@ class Ct {
|
|
|
10737
10737
|
this.directoryHttp.auth.token = o, n = "bootstrap", this.lastRecoveryStage = n, await this.replaceDefaultTransportCredentials(e), this.reportTransportDiagnostic("auth_refresh_validated", i);
|
|
10738
10738
|
})().catch((o) => {
|
|
10739
10739
|
if (this.socket !== e || this.state.status === "closed") throw o;
|
|
10740
|
-
if (this.reportTransportDiagnostic("auth_refresh_failed", { ...i, ...this.connectionFailureDiagnostic(o, n) }), this.credentialRecoveryFailure =
|
|
10740
|
+
if (this.reportTransportDiagnostic("auth_refresh_failed", { ...i, ...this.connectionFailureDiagnostic(o, n) }), this.credentialRecoveryFailure = nt(o), o instanceof R && ["unauthorized", "403", "update_required"].includes(o.code) || !rs(o)) {
|
|
10741
10741
|
const a = o instanceof R ? o : new R(o instanceof ae ? o.message : "Your session could not be refreshed. Try again.", this.options.productVariant === "customer_embedded" ? "connection_failed" : "unauthorized", !1);
|
|
10742
10742
|
throw this.stopAuthentication(a), a;
|
|
10743
10743
|
}
|
|
@@ -10795,7 +10795,7 @@ class Ct {
|
|
|
10795
10795
|
this.listeners[e]?.forEach((n) => n(s));
|
|
10796
10796
|
}
|
|
10797
10797
|
}
|
|
10798
|
-
const
|
|
10798
|
+
const as = /* @__PURE__ */ new WeakMap();
|
|
10799
10799
|
function Nn(t) {
|
|
10800
10800
|
const e = window.__plunoProductAgentNetworkCapture ?? Rc();
|
|
10801
10801
|
return e.subscribers.add(t), () => {
|
|
@@ -10822,8 +10822,8 @@ function Rc() {
|
|
|
10822
10822
|
const y = f instanceof Request ? f : null, _ = Md(f, y), b = Gn(m?.headers ?? y?.headers);
|
|
10823
10823
|
if (!ke(_, b, m?.body)) {
|
|
10824
10824
|
const w = {
|
|
10825
|
-
requestId:
|
|
10826
|
-
url: ce(_,
|
|
10825
|
+
requestId: ls("fetch"),
|
|
10826
|
+
url: ce(_, ns),
|
|
10827
10827
|
method: (m?.method ?? y?.method ?? "GET").toUpperCase(),
|
|
10828
10828
|
requestHeaders: b,
|
|
10829
10829
|
requestBody: Ji(m?.body),
|
|
@@ -10854,21 +10854,21 @@ function Rc() {
|
|
|
10854
10854
|
return g;
|
|
10855
10855
|
}, a = function(f, m, p, g, y) {
|
|
10856
10856
|
const _ = i.call(this, f, m, p ?? !0, g ?? void 0, y ?? void 0), b = typeof m == "string" ? m : m.toString();
|
|
10857
|
-
return
|
|
10858
|
-
requestId:
|
|
10857
|
+
return as.set(this, {
|
|
10858
|
+
requestId: ls("xhr"),
|
|
10859
10859
|
method: String(f ?? "GET").toUpperCase(),
|
|
10860
|
-
url: ce(b,
|
|
10860
|
+
url: ce(b, ns),
|
|
10861
10861
|
requestHeaders: {},
|
|
10862
10862
|
startedAtMs: Date.now(),
|
|
10863
10863
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10864
10864
|
excluded: ke(b)
|
|
10865
10865
|
}), _;
|
|
10866
10866
|
}, c = function(f, m) {
|
|
10867
|
-
const p = n.call(this, f, m), g =
|
|
10867
|
+
const p = n.call(this, f, m), g = as.get(this);
|
|
10868
10868
|
return g && Object.keys(g.requestHeaders).length < Qs && (g.requestHeaders[f] = ei(f, m), g.excluded = g.excluded || ke(g.url, g.requestHeaders)), p;
|
|
10869
10869
|
}, d = function(f) {
|
|
10870
10870
|
try {
|
|
10871
|
-
const m =
|
|
10871
|
+
const m = as.get(this);
|
|
10872
10872
|
m && (m.excluded = m.excluded || ke(m.url, m.requestHeaders, f), m.requestBody = Ji(f), m.excluded || this.addEventListener(
|
|
10873
10873
|
"loadend",
|
|
10874
10874
|
() => {
|
|
@@ -10925,8 +10925,8 @@ function Rc() {
|
|
|
10925
10925
|
continue;
|
|
10926
10926
|
const p = performance.timeOrigin + m.startTime;
|
|
10927
10927
|
e({
|
|
10928
|
-
requestId:
|
|
10929
|
-
url: ce(m.name,
|
|
10928
|
+
requestId: ls("resource"),
|
|
10929
|
+
url: ce(m.name, ns),
|
|
10930
10930
|
method: "GET",
|
|
10931
10931
|
resourceType: "resource",
|
|
10932
10932
|
responseStatus: m.responseStatus,
|
|
@@ -11171,13 +11171,13 @@ function Lc() {
|
|
|
11171
11171
|
};
|
|
11172
11172
|
}
|
|
11173
11173
|
function Fc(t) {
|
|
11174
|
-
return
|
|
11175
|
-
|
|
11174
|
+
return yt.add(t), it || (it = $c()), () => {
|
|
11175
|
+
yt.delete(t), yt.size === 0 && (it?.(), it = null);
|
|
11176
11176
|
};
|
|
11177
11177
|
}
|
|
11178
11178
|
function $c() {
|
|
11179
11179
|
const t = () => {
|
|
11180
|
-
for (const r of Array.from(
|
|
11180
|
+
for (const r of Array.from(yt))
|
|
11181
11181
|
r();
|
|
11182
11182
|
}, e = window.history.pushState.bind(window.history), s = window.history.replaceState.bind(window.history), i = ((...r) => {
|
|
11183
11183
|
const o = e(...r);
|
|
@@ -11202,9 +11202,9 @@ function Xs() {
|
|
|
11202
11202
|
(p) => jn(p) && !p.parentElement?.closest(i)
|
|
11203
11203
|
);
|
|
11204
11204
|
for (const p of n.slice(0, 3))
|
|
11205
|
-
s("Active overlay",
|
|
11206
|
-
const r = zc(), o = r ?
|
|
11207
|
-
s("Main page content", o), s("Additional visible page text",
|
|
11205
|
+
s("Active overlay", cs(ze(p), e));
|
|
11206
|
+
const r = zc(), o = r ? cs(ze(r), e) : "";
|
|
11207
|
+
s("Main page content", o), s("Additional visible page text", cs(ze(document.body), e));
|
|
11208
11208
|
const a = t.map(([p, g]) => `${p}:
|
|
11209
11209
|
${g}`).join(`
|
|
11210
11210
|
|
|
@@ -11215,7 +11215,7 @@ Visible page text:
|
|
|
11215
11215
|
`, l = 12e3 - d.length - u.length, h = Math.min(a.length, 7900), f = c.slice(0, l - h), m = a.slice(0, l - f.length);
|
|
11216
11216
|
return `${d}${f}${u}${m}`;
|
|
11217
11217
|
}
|
|
11218
|
-
function
|
|
11218
|
+
function ze(t) {
|
|
11219
11219
|
return t.innerText ?? t.textContent ?? "";
|
|
11220
11220
|
}
|
|
11221
11221
|
function Te(t) {
|
|
@@ -11226,7 +11226,7 @@ function Te(t) {
|
|
|
11226
11226
|
|
|
11227
11227
|
`).trim();
|
|
11228
11228
|
}
|
|
11229
|
-
function
|
|
11229
|
+
function cs(t, e) {
|
|
11230
11230
|
let s = Te(t);
|
|
11231
11231
|
for (const i of e)
|
|
11232
11232
|
s = s.replace(i, "");
|
|
@@ -11237,7 +11237,7 @@ function jn(t) {
|
|
|
11237
11237
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
11238
11238
|
}
|
|
11239
11239
|
function zc() {
|
|
11240
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(jn).sort((t, e) =>
|
|
11240
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(jn).sort((t, e) => ze(e).length - ze(t).length)[0] ?? null;
|
|
11241
11241
|
}
|
|
11242
11242
|
function Hc(t, e) {
|
|
11243
11243
|
const s = /* @__PURE__ */ new Set([
|
|
@@ -11344,45 +11344,45 @@ function Hc(t, e) {
|
|
|
11344
11344
|
const j = p(O), le = Me.get(j) ?? 0;
|
|
11345
11345
|
Me.set(j, le + 1), (U.get(j) ?? 0) > 8 && le >= 6 && !u.has(O) && F.set(j, (F.get(j) ?? 0) + 1);
|
|
11346
11346
|
}
|
|
11347
|
-
const
|
|
11347
|
+
const Je = /* @__PURE__ */ new Map(), ti = /* @__PURE__ */ new Set(), xt = [], si = [];
|
|
11348
11348
|
for (const O of C) {
|
|
11349
|
-
const j = p(O), le = U.get(j) ?? 0, ri =
|
|
11350
|
-
if (
|
|
11351
|
-
ti.has(j) || (
|
|
11349
|
+
const j = p(O), le = U.get(j) ?? 0, ri = Je.get(j) ?? 0;
|
|
11350
|
+
if (Je.set(j, ri + 1), le > 8 && ri >= 6 && !u.has(O)) {
|
|
11351
|
+
ti.has(j) || (xt.push([`… ${F.get(j) ?? 0} similar siblings omitted`]), ti.add(j));
|
|
11352
11352
|
continue;
|
|
11353
11353
|
}
|
|
11354
11354
|
const oi = A(O, D);
|
|
11355
|
-
si.push(oi),
|
|
11355
|
+
si.push(oi), xt.push(oi.lines);
|
|
11356
11356
|
}
|
|
11357
|
-
const
|
|
11357
|
+
const Dt = [];
|
|
11358
11358
|
if (E.shadowRoot)
|
|
11359
11359
|
for (const O of Array.from(E.shadowRoot.children))
|
|
11360
|
-
O instanceof HTMLElement &&
|
|
11361
|
-
const
|
|
11362
|
-
[T, ...
|
|
11363
|
-
).slice(0, 180), ir = E.hasAttribute("contenteditable") && (T.length > 0 || !E.querySelector("[contenteditable]")), ni = d.some((O) => E.hasAttribute(O)) || !!P || ir,
|
|
11364
|
-
if (
|
|
11365
|
-
const O =
|
|
11360
|
+
O instanceof HTMLElement && Dt.push(A(O, D + 1));
|
|
11361
|
+
const Qe = [...si, ...Dt], Ut = T.length > 0 || v || Qe.some((O) => O.hasUsefulContent), ii = Te(
|
|
11362
|
+
[T, ...Qe.map((O) => O.textPreview)].filter(Boolean).join(" ")
|
|
11363
|
+
).slice(0, 180), ir = E.hasAttribute("contenteditable") && (T.length > 0 || !E.querySelector("[contenteditable]")), ni = d.some((O) => E.hasAttribute(O)) || !!P || ir, Nt = (E.getClientRects().length > 0 || q.display === "contents") && (s.has(S) || ni || k) && (Ut || k) && (!n.has(S) || Ut || ni || k), Bt = Nt ? 1 : 0, Ce = [];
|
|
11364
|
+
if (Nt) {
|
|
11365
|
+
const O = Qe.some((le) => le.containsTextElement), j = i.has(S) && !O ? ii : T;
|
|
11366
11366
|
Ce.push(Ln(E, c, o, j.slice(0, 180)));
|
|
11367
11367
|
}
|
|
11368
|
-
for (const O of
|
|
11369
|
-
Ce.push(...
|
|
11370
|
-
const
|
|
11371
|
-
if (
|
|
11372
|
-
const O =
|
|
11373
|
-
|
|
11368
|
+
for (const O of xt)
|
|
11369
|
+
Ce.push(...rt(O, Bt));
|
|
11370
|
+
const jt = Dt.flatMap((O) => O.lines);
|
|
11371
|
+
if (jt.length > 0) {
|
|
11372
|
+
const O = jt.slice(0, 20);
|
|
11373
|
+
jt.length > O.length && O.push("… shadow DOM omitted");
|
|
11374
11374
|
const j = S.includes("tooltip") || S.includes("popper") || S.includes("loader");
|
|
11375
11375
|
if (D < 2 && !j) {
|
|
11376
|
-
const le =
|
|
11377
|
-
Ce.push(...
|
|
11376
|
+
const le = Nt ? "#shadow-root" : `${S} #shadow-root`;
|
|
11377
|
+
Ce.push(...rt([le, ...rt(O, 1)], Bt));
|
|
11378
11378
|
} else
|
|
11379
|
-
Ce.push(...
|
|
11379
|
+
Ce.push(...rt(O, Bt));
|
|
11380
11380
|
}
|
|
11381
11381
|
return {
|
|
11382
11382
|
lines: Ce,
|
|
11383
|
-
hasUsefulContent:
|
|
11383
|
+
hasUsefulContent: Ut,
|
|
11384
11384
|
textPreview: ii,
|
|
11385
|
-
containsTextElement: i.has(S) ||
|
|
11385
|
+
containsTextElement: i.has(S) || Qe.some((O) => O.containsTextElement)
|
|
11386
11386
|
};
|
|
11387
11387
|
};
|
|
11388
11388
|
return [`--- ${I} ---`, ...A(b, 0).lines].join(`
|
|
@@ -11485,7 +11485,7 @@ function Vc(t, e, s, i) {
|
|
|
11485
11485
|
function zi(t) {
|
|
11486
11486
|
return t instanceof HTMLElement ? t : t?.parentElement instanceof HTMLElement ? t.parentElement : null;
|
|
11487
11487
|
}
|
|
11488
|
-
function
|
|
11488
|
+
function rt(t, e) {
|
|
11489
11489
|
if (e === 0)
|
|
11490
11490
|
return t;
|
|
11491
11491
|
const s = " ".repeat(e);
|
|
@@ -11870,7 +11870,7 @@ function ld(t, e) {
|
|
|
11870
11870
|
}
|
|
11871
11871
|
function ud(t, e, s) {
|
|
11872
11872
|
const i = t[e], n = t[s];
|
|
11873
|
-
if (
|
|
11873
|
+
if (Ge(i, n))
|
|
11874
11874
|
return !0;
|
|
11875
11875
|
if (!i.respondsToUserMessageId || n.respondsToUserMessageId || !i.runId || i.runId !== n.runId)
|
|
11876
11876
|
return !1;
|
|
@@ -11883,7 +11883,7 @@ function hd(t, e) {
|
|
|
11883
11883
|
const s = t[e];
|
|
11884
11884
|
for (let i = e + 1; i < t.length; i += 1) {
|
|
11885
11885
|
const n = t[i];
|
|
11886
|
-
if (n.role === "assistant" &&
|
|
11886
|
+
if (n.role === "assistant" && Ge(s, n))
|
|
11887
11887
|
return !0;
|
|
11888
11888
|
}
|
|
11889
11889
|
return !1;
|
|
@@ -11904,26 +11904,26 @@ function pd(t, e) {
|
|
|
11904
11904
|
function fd(t, e) {
|
|
11905
11905
|
const s = t[e];
|
|
11906
11906
|
return t.some(
|
|
11907
|
-
(i, n) => n !== e && i.role === "assistant" &&
|
|
11907
|
+
(i, n) => n !== e && i.role === "assistant" && Ge(s, i)
|
|
11908
11908
|
);
|
|
11909
11909
|
}
|
|
11910
11910
|
function md(t, e) {
|
|
11911
11911
|
const s = t[e];
|
|
11912
11912
|
return t.some(
|
|
11913
|
-
(i, n) => n !== e && i.role === "tool" &&
|
|
11913
|
+
(i, n) => n !== e && i.role === "tool" && Ge(s, i)
|
|
11914
11914
|
);
|
|
11915
11915
|
}
|
|
11916
11916
|
function gd(t, e) {
|
|
11917
11917
|
const s = t[e];
|
|
11918
11918
|
for (let i = e + 1; i < t.length; i += 1)
|
|
11919
|
-
if (Ys(t[i]) &&
|
|
11919
|
+
if (Ys(t[i]) && Ge(s, t[i]))
|
|
11920
11920
|
return !0;
|
|
11921
11921
|
return !1;
|
|
11922
11922
|
}
|
|
11923
|
-
function
|
|
11923
|
+
function Ge(t, e) {
|
|
11924
11924
|
return !!(t.respondsToUserMessageId && t.respondsToUserMessageId === e.respondsToUserMessageId);
|
|
11925
11925
|
}
|
|
11926
|
-
function
|
|
11926
|
+
function ds(t, e) {
|
|
11927
11927
|
return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
|
|
11928
11928
|
}
|
|
11929
11929
|
function yd(t, e) {
|
|
@@ -11971,7 +11971,7 @@ function ge(t, e) {
|
|
|
11971
11971
|
}
|
|
11972
11972
|
function zn(t, e) {
|
|
11973
11973
|
try {
|
|
11974
|
-
const s = `${
|
|
11974
|
+
const s = `${Ct}${t}`, i = location.href, n = location.origin, r = Array.from(e, (o) => ({
|
|
11975
11975
|
...o,
|
|
11976
11976
|
storedAt: Date.now(),
|
|
11977
11977
|
unloadUrl: i,
|
|
@@ -11987,7 +11987,7 @@ function zn(t, e) {
|
|
|
11987
11987
|
}
|
|
11988
11988
|
function Wi(t, e) {
|
|
11989
11989
|
try {
|
|
11990
|
-
if (window.sessionStorage.getItem(`${
|
|
11990
|
+
if (window.sessionStorage.getItem(`${Ct}${t}`) === null)
|
|
11991
11991
|
return;
|
|
11992
11992
|
} catch {
|
|
11993
11993
|
return;
|
|
@@ -11996,7 +11996,7 @@ function Wi(t, e) {
|
|
|
11996
11996
|
}
|
|
11997
11997
|
function bd(t) {
|
|
11998
11998
|
try {
|
|
11999
|
-
const e = `${
|
|
11999
|
+
const e = `${Ct}${t}`, s = window.sessionStorage.getItem(e);
|
|
12000
12000
|
if (window.sessionStorage.removeItem(e), !s)
|
|
12001
12001
|
return [];
|
|
12002
12002
|
const i = JSON.parse(s);
|
|
@@ -12044,7 +12044,7 @@ function _d(t, e) {
|
|
|
12044
12044
|
}
|
|
12045
12045
|
function Sd(t) {
|
|
12046
12046
|
try {
|
|
12047
|
-
window.sessionStorage.removeItem(`${
|
|
12047
|
+
window.sessionStorage.removeItem(`${Ct}${t}`);
|
|
12048
12048
|
} catch {
|
|
12049
12049
|
return;
|
|
12050
12050
|
}
|
|
@@ -12159,7 +12159,7 @@ function Gn(t) {
|
|
|
12159
12159
|
return e;
|
|
12160
12160
|
}
|
|
12161
12161
|
function ei(t, e) {
|
|
12162
|
-
return tr(t) ?
|
|
12162
|
+
return tr(t) ? Pt : ce(kt(e), vc);
|
|
12163
12163
|
}
|
|
12164
12164
|
function Md(t, e) {
|
|
12165
12165
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
@@ -12230,11 +12230,11 @@ function Qi(t) {
|
|
|
12230
12230
|
return t;
|
|
12231
12231
|
const e = t.trim();
|
|
12232
12232
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
12233
|
-
return
|
|
12233
|
+
return kt(t);
|
|
12234
12234
|
try {
|
|
12235
12235
|
return JSON.stringify(ee(JSON.parse(t)));
|
|
12236
12236
|
} catch {
|
|
12237
|
-
return
|
|
12237
|
+
return kt(t);
|
|
12238
12238
|
}
|
|
12239
12239
|
}
|
|
12240
12240
|
function Jn(t) {
|
|
@@ -12288,7 +12288,7 @@ function Nd(t) {
|
|
|
12288
12288
|
function ce(t, e = Js) {
|
|
12289
12289
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
12290
12290
|
}
|
|
12291
|
-
function
|
|
12291
|
+
function ls(t) {
|
|
12292
12292
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
12293
12293
|
}
|
|
12294
12294
|
class Qn extends Error {
|
|
@@ -12324,13 +12324,13 @@ function Fd(t) {
|
|
|
12324
12324
|
function $d(t) {
|
|
12325
12325
|
return t === 401 || t === 403;
|
|
12326
12326
|
}
|
|
12327
|
-
const
|
|
12327
|
+
const Pt = "[REDACTED_SECRET]", de = "[REDACTED_TOKEN]", zd = "[REDACTED_SIGNED_URL]", Hd = 20, Kd = /^(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, Xn = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Yn = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Zn = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, er = /\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, Vd = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Wd = /\bhttps?:\/\/[^\s"'<>]+/gi, Gd = /[),.;\]]+$/;
|
|
12328
12328
|
function ee(t) {
|
|
12329
|
-
return
|
|
12329
|
+
return Rt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
12330
12330
|
}
|
|
12331
|
-
function
|
|
12331
|
+
function Rt(t, e, s) {
|
|
12332
12332
|
if (typeof t == "string")
|
|
12333
|
-
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t :
|
|
12333
|
+
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : kt(t);
|
|
12334
12334
|
if (t === null || typeof t != "object")
|
|
12335
12335
|
return t;
|
|
12336
12336
|
if (e >= Hd)
|
|
@@ -12338,10 +12338,10 @@ function St(t, e, s) {
|
|
|
12338
12338
|
if (s.has(t))
|
|
12339
12339
|
return "[REDACTED_CIRCULAR]";
|
|
12340
12340
|
if (s.add(t), Array.isArray(t))
|
|
12341
|
-
return t.map((n) =>
|
|
12341
|
+
return t.map((n) => Rt(n, e + 1, s));
|
|
12342
12342
|
const i = {};
|
|
12343
12343
|
for (const [n, r] of Object.entries(t))
|
|
12344
|
-
n === "pageContent" ? i[n] = r : tr(n) ? i[n] =
|
|
12344
|
+
n === "pageContent" ? i[n] = r : tr(n) ? i[n] = Pt : i[n] = n.toLowerCase() === "url" ? Jd(r) : Rt(r, e + 1, s);
|
|
12345
12345
|
return i;
|
|
12346
12346
|
}
|
|
12347
12347
|
function tr(t) {
|
|
@@ -12349,7 +12349,7 @@ function tr(t) {
|
|
|
12349
12349
|
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");
|
|
12350
12350
|
}
|
|
12351
12351
|
function Jd(t) {
|
|
12352
|
-
return typeof t == "string" ? sr(t) :
|
|
12352
|
+
return typeof t == "string" ? sr(t) : Rt(t, 0, /* @__PURE__ */ new WeakSet());
|
|
12353
12353
|
}
|
|
12354
12354
|
function sr(t) {
|
|
12355
12355
|
try {
|
|
@@ -12361,21 +12361,21 @@ function sr(t) {
|
|
|
12361
12361
|
return Qd(t);
|
|
12362
12362
|
}
|
|
12363
12363
|
}
|
|
12364
|
-
function
|
|
12365
|
-
return t.replace(Vd, zd).replace(Wd, Xd).replace(Xn, `Bearer ${de}`).replace(Yn, `Basic ${de}`).replace(Zn, de).replace(er, (e, s) => `${s}: ${
|
|
12364
|
+
function kt(t) {
|
|
12365
|
+
return t.replace(Vd, zd).replace(Wd, Xd).replace(Xn, `Bearer ${de}`).replace(Yn, `Basic ${de}`).replace(Zn, de).replace(er, (e, s) => `${s}: ${Pt}`);
|
|
12366
12366
|
}
|
|
12367
12367
|
function Qd(t) {
|
|
12368
|
-
return t.replace(Xn, `Bearer ${de}`).replace(Yn, `Basic ${de}`).replace(Zn, de).replace(er, (e, s) => `${s}: ${
|
|
12368
|
+
return t.replace(Xn, `Bearer ${de}`).replace(Yn, `Basic ${de}`).replace(Zn, de).replace(er, (e, s) => `${s}: ${Pt}`);
|
|
12369
12369
|
}
|
|
12370
12370
|
function Xd(t) {
|
|
12371
12371
|
const e = t.match(Gd)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
|
|
12372
12372
|
return `${sr(s)}${e}`;
|
|
12373
12373
|
}
|
|
12374
12374
|
const hl = Object.freeze({
|
|
12375
|
-
init: (t) =>
|
|
12375
|
+
init: (t) => Ot.init(t)
|
|
12376
12376
|
});
|
|
12377
12377
|
function pl(t) {
|
|
12378
|
-
return
|
|
12378
|
+
return Ot.init(t);
|
|
12379
12379
|
}
|
|
12380
12380
|
export {
|
|
12381
12381
|
Ni as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
@@ -12388,13 +12388,13 @@ export {
|
|
|
12388
12388
|
sl as ProductAgentInteractionManager,
|
|
12389
12389
|
Si as ProductAgentQueryController,
|
|
12390
12390
|
al as ProductAgentRemoteRuntimeClient,
|
|
12391
|
-
|
|
12391
|
+
Ot as ProductAgentSessionEngine,
|
|
12392
12392
|
tl as ProductAgentSessionHistoryManager,
|
|
12393
12393
|
nl as ProductAgentTaskPageTitleController,
|
|
12394
12394
|
ae as ProductAgentTokenProviderError,
|
|
12395
12395
|
_c as calculateReconnectDelay,
|
|
12396
12396
|
il as createLocalStorageInteractionDecisionStorage,
|
|
12397
|
-
|
|
12397
|
+
ft as createProductAgentQueryState,
|
|
12398
12398
|
pl as createProductAgentRuntime,
|
|
12399
12399
|
rl as createProductAgentTaskPageTitleDocument,
|
|
12400
12400
|
hl as default,
|
|
@@ -12404,7 +12404,7 @@ export {
|
|
|
12404
12404
|
Ri as isProductAgentAuthReconnectError,
|
|
12405
12405
|
ol as isProductAgentRuntimeCommand,
|
|
12406
12406
|
Go as mergeProductAgentEntityPages,
|
|
12407
|
-
|
|
12407
|
+
mt as normalizeProductAgentEntityPage,
|
|
12408
12408
|
ul as normalizeProductAgentSessionItems,
|
|
12409
12409
|
Ga as readLocalStorageInteractionDecisions,
|
|
12410
12410
|
el as resolveProductAgentComposerAction,
|