@pluno/product-agent-web 0.1.170 → 0.1.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/product-agent-sdk.js +225 -199
- package/dist/product-agent-widget.js +1010 -982
- package/dist/widget.d.ts +5 -4
- package/package.json +1 -1
|
@@ -39,15 +39,15 @@ function Je(t, e, s) {
|
|
|
39
39
|
return new Promise((n, r) => {
|
|
40
40
|
const i = t.transaction(He, e), o = i.objectStore(He);
|
|
41
41
|
let a, l = !1;
|
|
42
|
-
s(o).then((
|
|
43
|
-
a =
|
|
44
|
-
}).catch((
|
|
42
|
+
s(o).then((c) => {
|
|
43
|
+
a = c;
|
|
44
|
+
}).catch((c) => {
|
|
45
45
|
l = !0;
|
|
46
46
|
try {
|
|
47
47
|
i.abort();
|
|
48
48
|
} catch {
|
|
49
49
|
}
|
|
50
|
-
r(
|
|
50
|
+
r(c);
|
|
51
51
|
}), i.oncomplete = () => {
|
|
52
52
|
l || n(a);
|
|
53
53
|
}, i.onerror = () => {
|
|
@@ -92,41 +92,41 @@ function As(t) {
|
|
|
92
92
|
return (t.type === "function_call" || t.type === "tool_call") && t.name === Ms;
|
|
93
93
|
}
|
|
94
94
|
function Rs(t, e, s) {
|
|
95
|
-
const n = e.map((
|
|
95
|
+
const n = e.map((u) => ({ item: u, identity: s(u) })), r = new Set(
|
|
96
96
|
n.flatMap(
|
|
97
|
-
({ identity:
|
|
97
|
+
({ identity: u }) => u.isActivity && !u.isTransient ? u.activityKeys ?? [] : []
|
|
98
98
|
)
|
|
99
99
|
), i = n.filter(
|
|
100
|
-
({ identity:
|
|
101
|
-
), o = new Map(i.map(({ item:
|
|
100
|
+
({ identity: u }) => !(u.isTransient && u.activityKeys?.some((d) => r.has(d)))
|
|
101
|
+
), o = new Map(i.map(({ item: u, identity: d }) => [d.id, u])), a = new Map(
|
|
102
102
|
i.flatMap(
|
|
103
|
-
({ item:
|
|
103
|
+
({ item: u, identity: d }) => d.optimisticKey ? [[d.optimisticKey, u]] : []
|
|
104
104
|
)
|
|
105
105
|
), l = new Map(
|
|
106
106
|
i.flatMap(
|
|
107
|
-
({ item:
|
|
107
|
+
({ item: u, identity: d }) => d.assistantDraftKey ? [[d.assistantDraftKey, u]] : []
|
|
108
108
|
)
|
|
109
|
-
),
|
|
110
|
-
for (const { item:
|
|
109
|
+
), c = /* @__PURE__ */ new Map();
|
|
110
|
+
for (const { item: u, identity: d } of i)
|
|
111
111
|
for (const g of d.activityKeys ?? []) {
|
|
112
|
-
const T =
|
|
113
|
-
(!T || s(T).isTransient) &&
|
|
112
|
+
const T = c.get(g);
|
|
113
|
+
(!T || s(T).isTransient) && c.set(g, u);
|
|
114
114
|
}
|
|
115
|
-
const h = new Set(i.map(({ identity:
|
|
116
|
-
i.flatMap(({ identity:
|
|
115
|
+
const h = new Set(i.map(({ identity: u }) => u.id)), p = new Set(
|
|
116
|
+
i.flatMap(({ identity: u }) => u.runId ? [u.runId] : [])
|
|
117
117
|
), I = /* @__PURE__ */ new Set(), f = [];
|
|
118
|
-
for (const
|
|
119
|
-
const d = s(
|
|
118
|
+
for (const u of t) {
|
|
119
|
+
const d = s(u);
|
|
120
120
|
let g = o.get(d.id);
|
|
121
|
-
if (d.isOptimistic && d.optimisticKey ? g = a.get(d.optimisticKey) : d.isAssistantDraft && d.assistantDraftKey ? g = l.get(d.assistantDraftKey) : d.isActivity && (g = d.activityKeys?.map((k) =>
|
|
121
|
+
if (d.isOptimistic && d.optimisticKey ? g = a.get(d.optimisticKey) : d.isAssistantDraft && d.assistantDraftKey ? g = l.get(d.assistantDraftKey) : d.isActivity && (g = d.activityKeys?.map((k) => c.get(k)).find((k) => k !== void 0) ?? g), g && !I.has(g)) {
|
|
122
122
|
f.push(g), I.add(g);
|
|
123
123
|
continue;
|
|
124
124
|
}
|
|
125
125
|
const T = d.respondsToUserMessageId !== void 0 && h.has(d.respondsToUserMessageId) || d.runId !== void 0 && p.has(d.runId);
|
|
126
|
-
(d.isOptimistic || (d.isAssistantDraft || d.isActivity) && T) && f.push(
|
|
126
|
+
(d.isOptimistic || (d.isAssistantDraft || d.isActivity) && T) && f.push(u);
|
|
127
127
|
}
|
|
128
|
-
for (const { item:
|
|
129
|
-
I.has(
|
|
128
|
+
for (const { item: u } of i)
|
|
129
|
+
I.has(u) || f.push(u);
|
|
130
130
|
return f;
|
|
131
131
|
}
|
|
132
132
|
function Es(t, e, s, n) {
|
|
@@ -260,7 +260,7 @@ function Os() {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
const Bt = "schedule_follow_up";
|
|
263
|
-
function
|
|
263
|
+
function Ls(t) {
|
|
264
264
|
let e = t;
|
|
265
265
|
if (typeof e == "string")
|
|
266
266
|
try {
|
|
@@ -273,7 +273,7 @@ function qs(t) {
|
|
|
273
273
|
const s = e;
|
|
274
274
|
return s.ok !== !0 || s.toolName !== Bt || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const qs = globalThis.fetch.bind(globalThis), $e = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ns = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', xs = ".pluno-pa-widget__panel", Bs = ".pluno-pa-widget__timeline", ht = `${$e}[data-pluno-sdk-preview-channel]`;
|
|
277
277
|
let Ws = 0;
|
|
278
278
|
function pt(t) {
|
|
279
279
|
const e = {};
|
|
@@ -306,14 +306,14 @@ function pt(t) {
|
|
|
306
306
|
if (a && typeof a == "object") {
|
|
307
307
|
const l = a.composerPreload;
|
|
308
308
|
if (l && typeof l == "object") {
|
|
309
|
-
const
|
|
310
|
-
e.composerPreloaded = !0, typeof
|
|
309
|
+
const c = l.runId;
|
|
310
|
+
e.composerPreloaded = !0, typeof c == "string" && (e.preloadRunId = c);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
return e;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function Le(t, e, s) {
|
|
317
317
|
if (typeof window > "u")
|
|
318
318
|
return;
|
|
319
319
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -338,18 +338,18 @@ const Hs = "https://app.pluno.ai", $s = "gpt-5.6-terra", js = 2e4, Fs = 1e4, zs
|
|
|
338
338
|
".pdf:application/pdf",
|
|
339
339
|
".png:image/png",
|
|
340
340
|
".webp:image/webp"
|
|
341
|
-
]), yi = ".pdf,.png,.jpg,.jpeg,.webp", Qe = 64e3,
|
|
341
|
+
]), yi = ".pdf,.png,.jpg,.jpeg,.webp", Qe = 64e3, qe = 4e3, Ze = 30, nn = 2e3, rn = 1e3, Ht = "Image is too large for model vision input.", on = 100, $t = "pluno.productAgent.state.", je = "pluno.productAgent.pendingEvents.", Ae = "pluno.productAgent.activeToolCalls.", an = 100;
|
|
342
342
|
function ie(t, e = 0) {
|
|
343
343
|
const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
344
344
|
return Math.max(e, s);
|
|
345
345
|
}
|
|
346
346
|
const me = /* @__PURE__ */ new Set();
|
|
347
|
-
let
|
|
347
|
+
let ce = null;
|
|
348
348
|
function ln(t, e = Math.random) {
|
|
349
349
|
const s = Math.min(gt, Js * 2 ** t), n = 1 - ft + e() * ft * 2;
|
|
350
350
|
return Math.min(gt, Math.round(s * n));
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function cn(t, e, s) {
|
|
353
353
|
return new Promise((n, r) => {
|
|
354
354
|
const i = setTimeout(() => r(new Error(s)), e);
|
|
355
355
|
t.then(
|
|
@@ -368,7 +368,7 @@ class jt {
|
|
|
368
368
|
...this.state,
|
|
369
369
|
starterPrompts: jn(e.initialStarterPrompts)
|
|
370
370
|
};
|
|
371
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
371
|
+
const n = e.restorePersistedState === !1 ? null : qr(e.clientId, e.expectedPersistedSessionId);
|
|
372
372
|
n && (this.state = {
|
|
373
373
|
...this.state,
|
|
374
374
|
...n,
|
|
@@ -415,6 +415,7 @@ class jt {
|
|
|
415
415
|
networkBatchTimer = null;
|
|
416
416
|
queuedNetworkEvents = [];
|
|
417
417
|
queuedClientEvents = [];
|
|
418
|
+
pendingWidgetLifecycleEvents = [];
|
|
418
419
|
pendingPassiveWarmupEvent = null;
|
|
419
420
|
pendingComposerWarmup = null;
|
|
420
421
|
activeComposerWarmupId = null;
|
|
@@ -537,7 +538,7 @@ class jt {
|
|
|
537
538
|
this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
|
|
538
539
|
);
|
|
539
540
|
try {
|
|
540
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await
|
|
541
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await cn(this.options.tokenProvider(), zs, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
|
|
541
542
|
return;
|
|
542
543
|
if (!this.token && !this.options.webSocketFactory)
|
|
543
544
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
@@ -595,7 +596,7 @@ class jt {
|
|
|
595
596
|
}
|
|
596
597
|
}
|
|
597
598
|
disconnect() {
|
|
598
|
-
this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
599
|
+
this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
599
600
|
}
|
|
600
601
|
destroy() {
|
|
601
602
|
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), jr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
@@ -619,6 +620,21 @@ class jt {
|
|
|
619
620
|
r || (this.clearPendingComposerWarmup(), this.pendingComposerWarmup = { event: i, scope: n, retryAttempt: 0, acknowledged: !1 }, this.activeComposerWarmupId = i.warmupId ?? null, this.activeComposerWarmupScope = n), this.flushPendingComposerWarmup();
|
|
620
621
|
} else this.sendNow(i) || (this.pendingPassiveWarmupEvent = i);
|
|
621
622
|
}
|
|
623
|
+
recordWidgetLifecycle(e, s) {
|
|
624
|
+
const n = {
|
|
625
|
+
type: "runtime.widget_lifecycle",
|
|
626
|
+
event: {
|
|
627
|
+
id: crypto.randomUUID(),
|
|
628
|
+
action: e,
|
|
629
|
+
trigger: s,
|
|
630
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
631
|
+
entrySurface: this.options.entrySurface,
|
|
632
|
+
...this.state.sessionId ? { sessionId: this.state.sessionId } : {},
|
|
633
|
+
pageOrigin: b().origin
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
this.authenticatedSocket === this.socket && this.sendNow(n) || (this.pendingWidgetLifecycleEvents.push(n), this.pendingWidgetLifecycleEvents.length > 20 && this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length - 20));
|
|
637
|
+
}
|
|
622
638
|
async sendMessage(e, s = {}) {
|
|
623
639
|
const n = e.trim(), r = s.attachments ?? [];
|
|
624
640
|
if (this.options.productVariant === "customer_embedded" && (r.forEach(rs), r.reduce(
|
|
@@ -637,7 +653,7 @@ class jt {
|
|
|
637
653
|
content: n,
|
|
638
654
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
639
655
|
...r.length > 0 ? { attachments: r } : {}
|
|
640
|
-
},
|
|
656
|
+
}, c = this.state.messages.some((m) => m.id === l.id || m.clientMessageId === a), h = this.state.isThinking, p = this.state.taskStatus, I = this.state.pendingMessageStatus, f = this.state.turnPhase, u = this.state.messages, d = c ? this.state.messages : [...this.state.messages, l], g = {
|
|
641
657
|
assistantDraft: this.state.assistantDraft,
|
|
642
658
|
assistantDraftItemId: this.state.assistantDraftItemId,
|
|
643
659
|
assistantDraftPhase: this.state.assistantDraftPhase,
|
|
@@ -660,7 +676,7 @@ class jt {
|
|
|
660
676
|
taskStatus: "working",
|
|
661
677
|
isRetrying: !1,
|
|
662
678
|
lastError: null
|
|
663
|
-
}),
|
|
679
|
+
}), c || this.emit("message", l);
|
|
664
680
|
try {
|
|
665
681
|
const m = [];
|
|
666
682
|
for (const w of i) {
|
|
@@ -676,7 +692,7 @@ class jt {
|
|
|
676
692
|
i = m;
|
|
677
693
|
} catch (m) {
|
|
678
694
|
throw this.setState({
|
|
679
|
-
...
|
|
695
|
+
...c ? {} : { messages: u },
|
|
680
696
|
...h ? {} : { ...g, isThinking: !1 },
|
|
681
697
|
pendingMessageStatus: I,
|
|
682
698
|
turnPhase: f,
|
|
@@ -779,14 +795,14 @@ class jt {
|
|
|
779
795
|
"Failed to prepare attachment upload"
|
|
780
796
|
) : await this.prepareEmbedAttachmentUpload(i);
|
|
781
797
|
await ge(async () => {
|
|
782
|
-
const
|
|
798
|
+
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
783
799
|
method: l.uploadMethod,
|
|
784
800
|
headers: l.uploadHeaders,
|
|
785
801
|
body: e
|
|
786
802
|
});
|
|
787
|
-
if (!
|
|
788
|
-
throw new Ie("Failed to upload attachment",
|
|
789
|
-
return
|
|
803
|
+
if (!c.ok)
|
|
804
|
+
throw new Ie("Failed to upload attachment", c.status);
|
|
805
|
+
return c;
|
|
790
806
|
}, "Failed to upload attachment"), o = l;
|
|
791
807
|
}
|
|
792
808
|
this.setState({ sessionId: o.sessionId });
|
|
@@ -994,7 +1010,7 @@ class jt {
|
|
|
994
1010
|
});
|
|
995
1011
|
}
|
|
996
1012
|
send(e) {
|
|
997
|
-
this.sendNow(
|
|
1013
|
+
this.sendNow(L(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
|
|
998
1014
|
(r) => r.type === "chat.user_message" && r.clientMessageId === e.clientMessageId
|
|
999
1015
|
) || this.queuedClientEvents.push(e), G(this.options.clientId, this.queuedClientEvents), this.setState({
|
|
1000
1016
|
status: "reconnecting",
|
|
@@ -1012,7 +1028,7 @@ class jt {
|
|
|
1012
1028
|
return !1;
|
|
1013
1029
|
const s = this.socket;
|
|
1014
1030
|
try {
|
|
1015
|
-
return s.send(JSON.stringify(e)),
|
|
1031
|
+
return s.send(JSON.stringify(e)), Le("client_event", e.type, pt(e)), !0;
|
|
1016
1032
|
} catch (n) {
|
|
1017
1033
|
return A("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
1018
1034
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -1058,7 +1074,7 @@ class jt {
|
|
|
1058
1074
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
1059
1075
|
const e = vn();
|
|
1060
1076
|
this.sendNow(
|
|
1061
|
-
|
|
1077
|
+
L({
|
|
1062
1078
|
type: "starter_prompts.page_context",
|
|
1063
1079
|
pageUrl: e.pageUrl,
|
|
1064
1080
|
pageTitle: e.pageTitle,
|
|
@@ -1091,7 +1107,7 @@ class jt {
|
|
|
1091
1107
|
G(this.options.clientId, this.queuedClientEvents);
|
|
1092
1108
|
for (let s = 0; s < e.length; s += 1) {
|
|
1093
1109
|
const n = e[s];
|
|
1094
|
-
if (!this.sendNow(
|
|
1110
|
+
if (!this.sendNow(L(n))) {
|
|
1095
1111
|
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)), G(this.options.clientId, this.queuedClientEvents);
|
|
1096
1112
|
return;
|
|
1097
1113
|
}
|
|
@@ -1099,7 +1115,17 @@ class jt {
|
|
|
1099
1115
|
}
|
|
1100
1116
|
}
|
|
1101
1117
|
resetForAuthenticationScopeChange() {
|
|
1102
|
-
this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [], G(this.options.clientId, this.queuedClientEvents), this.backgroundSessionIds.clear(), this.backgroundClientMessageIds.clear(), this.deferredSessionUpdatedSessionIds.clear();
|
|
1118
|
+
this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [], G(this.options.clientId, this.queuedClientEvents), this.pendingWidgetLifecycleEvents = [], this.backgroundSessionIds.clear(), this.backgroundClientMessageIds.clear(), this.deferredSessionUpdatedSessionIds.clear();
|
|
1119
|
+
}
|
|
1120
|
+
flushPendingWidgetLifecycleEvents() {
|
|
1121
|
+
if (this.authenticatedSocket !== this.socket || this.socket?.readyState !== WebSocket.OPEN || this.pendingWidgetLifecycleEvents.length === 0)
|
|
1122
|
+
return;
|
|
1123
|
+
const e = this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length);
|
|
1124
|
+
for (let s = 0; s < e.length; s += 1)
|
|
1125
|
+
if (!this.sendNow(e[s])) {
|
|
1126
|
+
this.pendingWidgetLifecycleEvents.unshift(...e.slice(s));
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1103
1129
|
}
|
|
1104
1130
|
flushPendingPassiveWarmup() {
|
|
1105
1131
|
!this.pendingPassiveWarmupEvent || !this.sendNow(this.pendingPassiveWarmupEvent) || (this.pendingPassiveWarmupEvent = null);
|
|
@@ -1126,7 +1152,7 @@ class jt {
|
|
|
1126
1152
|
findStoppedTurnForEvent(e) {
|
|
1127
1153
|
const s = e.type === "session.item" ? P(e.item) : null;
|
|
1128
1154
|
return this.findStoppedTurn(
|
|
1129
|
-
|
|
1155
|
+
ue(e) ?? this.state.sessionId,
|
|
1130
1156
|
s ?? e
|
|
1131
1157
|
);
|
|
1132
1158
|
}
|
|
@@ -1172,7 +1198,7 @@ class jt {
|
|
|
1172
1198
|
});
|
|
1173
1199
|
}
|
|
1174
1200
|
handleServerEvent(e) {
|
|
1175
|
-
if (
|
|
1201
|
+
if (Le("server_event", e.type, pt(e)), e.type === "session.item" && this.rememberDurablyStoppedTurn(
|
|
1176
1202
|
S(e.item, "sessionId") ?? this.state.sessionId,
|
|
1177
1203
|
P(e.item),
|
|
1178
1204
|
S(e.item, "createdAt")
|
|
@@ -1184,12 +1210,12 @@ class jt {
|
|
|
1184
1210
|
if (e.type === "run.ack") {
|
|
1185
1211
|
if (this.shouldIgnoreStoppedTurnEvent(e))
|
|
1186
1212
|
return;
|
|
1187
|
-
const s =
|
|
1213
|
+
const s = ue(e), n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
1188
1214
|
s && n && this.backgroundClientMessageIds.delete(n) ? (this.backgroundSessionIds.add(s), this.deferredSessionUpdatedSessionIds.delete(s)) : s && (n === this.activeClientMessageId || n === this.pendingClientMessageId) && this.deferredSessionUpdatedSessionIds.delete(s) && this.state.sessionId === null && this.setState({ sessionId: s }), this.handleRunAck(e);
|
|
1189
1215
|
return;
|
|
1190
1216
|
}
|
|
1191
1217
|
if (e.type === "session.updated" && this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId === null && this.backgroundClientMessageIds.size > 0) {
|
|
1192
|
-
const s =
|
|
1218
|
+
const s = ue(e);
|
|
1193
1219
|
if (s) {
|
|
1194
1220
|
this.deferredSessionUpdatedSessionIds.add(s);
|
|
1195
1221
|
return;
|
|
@@ -1214,7 +1240,7 @@ class jt {
|
|
|
1214
1240
|
if (hn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
1215
1241
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0;
|
|
1216
1242
|
const s = Vn(e.user);
|
|
1217
|
-
this.authenticatedSocket !== this.socket && this.authenticatedUserId && s && s.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = s?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
1243
|
+
this.authenticatedSocket !== this.socket && this.authenticatedUserId && s && s.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = s?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
1218
1244
|
const n = Fn(e), r = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
1219
1245
|
A("web-sdk.agent", "Received auth.ok appearance", {
|
|
1220
1246
|
hasAppearance: r,
|
|
@@ -1256,28 +1282,28 @@ class jt {
|
|
|
1256
1282
|
clientMessageId: a?.clientMessageId,
|
|
1257
1283
|
respondsToUserMessageId: S(o, "id"),
|
|
1258
1284
|
runId: a?.runId
|
|
1259
|
-
}),
|
|
1285
|
+
}), c = this.filterStoppedSnapshotItems(s, n), h = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, p = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, I = e.isRetrying === !0, f = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
1260
1286
|
h && p && (this.pendingClientMessageId = p);
|
|
1261
|
-
let
|
|
1287
|
+
let u = nr(
|
|
1262
1288
|
e.assistantDraft
|
|
1263
1289
|
);
|
|
1264
|
-
|
|
1265
|
-
respondsToUserMessageId:
|
|
1266
|
-
runId:
|
|
1267
|
-
}) && (
|
|
1268
|
-
const d =
|
|
1269
|
-
this.rememberUserMessageClientMessageIds(
|
|
1270
|
-
const g = Sr(
|
|
1290
|
+
u && this.findStoppedTurn(n, {
|
|
1291
|
+
respondsToUserMessageId: u.respondsToUserMessageId,
|
|
1292
|
+
runId: u.runId
|
|
1293
|
+
}) && (u = void 0);
|
|
1294
|
+
const d = u !== void 0;
|
|
1295
|
+
this.rememberUserMessageClientMessageIds(c);
|
|
1296
|
+
const g = Sr(c);
|
|
1271
1297
|
if (g) {
|
|
1272
|
-
const E = wr(
|
|
1298
|
+
const E = wr(c, g);
|
|
1273
1299
|
this.retryAttemptsByClientMessageId[g] = Math.max(
|
|
1274
1300
|
this.retryAttemptsByClientMessageId[g] ?? 0,
|
|
1275
1301
|
E
|
|
1276
1302
|
);
|
|
1277
1303
|
}
|
|
1278
|
-
const T =
|
|
1304
|
+
const T = c.filter((E) => {
|
|
1279
1305
|
const O = P(E);
|
|
1280
|
-
return bt(O) ? !1 : !O || !g || !Se(O) ? !0 : Ke(
|
|
1306
|
+
return bt(O) ? !1 : !O || !g || !Se(O) ? !0 : Ke(c, O) !== g;
|
|
1281
1307
|
}), k = dr(
|
|
1282
1308
|
this.state.messages,
|
|
1283
1309
|
Ct(T, this.options.backendUrl)
|
|
@@ -1285,21 +1311,21 @@ class jt {
|
|
|
1285
1311
|
this.state.messages,
|
|
1286
1312
|
k,
|
|
1287
1313
|
this.loadedOlderSessionItemIds
|
|
1288
|
-
) : k, w = _t(m), U = d ?
|
|
1314
|
+
) : k, w = _t(m), U = d ? u?.content ?? "" : this.state.assistantDraft, D = d ? u?.itemId ?? null : this.state.assistantDraftItemId, R = d ? u?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, ee = d ? u?.runId ?? null : this.state.assistantDraftRunId, C = c.some(
|
|
1289
1315
|
(E, O) => Pt(
|
|
1290
1316
|
P(E),
|
|
1291
1317
|
U,
|
|
1292
1318
|
D,
|
|
1293
1319
|
R,
|
|
1294
1320
|
ee,
|
|
1295
|
-
Mr(
|
|
1321
|
+
Mr(c, O)
|
|
1296
1322
|
)
|
|
1297
|
-
), te = d ?
|
|
1298
|
-
if (!w && Tr(this.state.messages,
|
|
1323
|
+
), te = d ? u?.content ?? "" : this.state.assistantDraft, z = !!u?.content && !C, H = w && (!te || C), K = yr(m), X = H && K ? "completed" : l ? "stopped" : H ? "failed" : null;
|
|
1324
|
+
if (!w && Tr(this.state.messages, c))
|
|
1299
1325
|
return;
|
|
1300
|
-
this.lastUserMessagePageUrl = Ir(
|
|
1301
|
-
const
|
|
1302
|
-
if (this.latestRecoverableClientMessageId =
|
|
1326
|
+
this.lastUserMessagePageUrl = Ir(c);
|
|
1327
|
+
const q = H || l ? null : ze(c);
|
|
1328
|
+
if (this.latestRecoverableClientMessageId = q, K && this.clearRetryTimers(), this.setState({
|
|
1303
1329
|
sessionId: S(e.session, "id") ?? this.state.sessionId,
|
|
1304
1330
|
messages: m,
|
|
1305
1331
|
isLoadingSession: !1,
|
|
@@ -1316,11 +1342,11 @@ class jt {
|
|
|
1316
1342
|
assistantDraftRespondsToUserMessageId: null,
|
|
1317
1343
|
assistantDraftRunId: null
|
|
1318
1344
|
} : d ? {
|
|
1319
|
-
assistantDraft:
|
|
1320
|
-
assistantDraftItemId:
|
|
1321
|
-
assistantDraftPhase:
|
|
1322
|
-
assistantDraftRespondsToUserMessageId:
|
|
1323
|
-
assistantDraftRunId:
|
|
1345
|
+
assistantDraft: u?.content ?? "",
|
|
1346
|
+
assistantDraftItemId: u?.itemId ?? null,
|
|
1347
|
+
assistantDraftPhase: u?.phase ?? null,
|
|
1348
|
+
assistantDraftRespondsToUserMessageId: u?.respondsToUserMessageId ?? null,
|
|
1349
|
+
assistantDraftRunId: u?.runId ?? null
|
|
1324
1350
|
} : {},
|
|
1325
1351
|
...z ? {
|
|
1326
1352
|
isThinking: !0,
|
|
@@ -1332,17 +1358,17 @@ class jt {
|
|
|
1332
1358
|
lastError: null,
|
|
1333
1359
|
lastErrorCode: null,
|
|
1334
1360
|
lastErrorSecuritySettingsUrl: null
|
|
1335
|
-
} :
|
|
1361
|
+
} : q ? {
|
|
1336
1362
|
isThinking: !0,
|
|
1337
1363
|
turnPhase: f ?? this.state.turnPhase ?? "starting",
|
|
1338
1364
|
lastError: null
|
|
1339
1365
|
} : {}
|
|
1340
1366
|
}), H)
|
|
1341
1367
|
this.retryableClientMessageId = null, this.clearThinkingWatchdog();
|
|
1342
|
-
else if (!l && (z ||
|
|
1343
|
-
if (
|
|
1344
|
-
this.activeClientMessageId =
|
|
1345
|
-
const E = Z(
|
|
1368
|
+
else if (!l && (z || q)) {
|
|
1369
|
+
if (q) {
|
|
1370
|
+
this.activeClientMessageId = q;
|
|
1371
|
+
const E = Z(c), O = E === null ? null : c[E];
|
|
1346
1372
|
this.activeResponseUserMessageId = S(O, "id");
|
|
1347
1373
|
}
|
|
1348
1374
|
this.markThinkingProgress();
|
|
@@ -1428,7 +1454,7 @@ class jt {
|
|
|
1428
1454
|
o,
|
|
1429
1455
|
o.findIndex((p) => p.id === n.id)
|
|
1430
1456
|
)
|
|
1431
|
-
),
|
|
1457
|
+
), c = a && (!this.state.assistantDraft || l), h = Te(n) && (c || B(n) && !this.state.isThinking && this.activeClientMessageId === null);
|
|
1432
1458
|
this.setState({
|
|
1433
1459
|
messages: o,
|
|
1434
1460
|
...l ? {
|
|
@@ -1438,7 +1464,7 @@ class jt {
|
|
|
1438
1464
|
assistantDraftRespondsToUserMessageId: null,
|
|
1439
1465
|
assistantDraftRunId: null
|
|
1440
1466
|
} : {},
|
|
1441
|
-
...
|
|
1467
|
+
...c ? {
|
|
1442
1468
|
isThinking: !1,
|
|
1443
1469
|
...r && this.state.taskStatus === "working" ? { taskStatus: r } : {},
|
|
1444
1470
|
isRetrying: !1
|
|
@@ -1449,14 +1475,14 @@ class jt {
|
|
|
1449
1475
|
lastErrorCode: null,
|
|
1450
1476
|
lastErrorSecuritySettingsUrl: null
|
|
1451
1477
|
} : {}
|
|
1452
|
-
}),
|
|
1478
|
+
}), c && this.clearThinkingWatchdog(), this.emit("message", n);
|
|
1453
1479
|
}
|
|
1454
1480
|
return;
|
|
1455
1481
|
}
|
|
1456
1482
|
if (e.type === "chat.assistant_delta") {
|
|
1457
1483
|
this.clearRunAckResyncRetryTimer();
|
|
1458
|
-
const s = typeof e.delta == "string" ? e.delta : "", n = typeof e.itemId == "string" ? e.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((p) => p.id === o), l = e.phase === "commentary" || e.phase === "final_answer" ? e.phase : r ? null : this.state.assistantDraftPhase,
|
|
1459
|
-
this.activeClientMessageId && (this.activeResponseUserMessageId =
|
|
1484
|
+
const s = typeof e.delta == "string" ? e.delta : "", n = typeof e.itemId == "string" ? e.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((p) => p.id === o), l = e.phase === "commentary" || e.phase === "final_answer" ? e.phase : r ? null : this.state.assistantDraftPhase, c = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId, h = typeof e.runId == "string" ? e.runId : this.state.assistantDraftRunId;
|
|
1485
|
+
this.activeClientMessageId && (this.activeResponseUserMessageId = c, this.activeResponseRunId = h), this.setState({
|
|
1460
1486
|
messages: Fe(this.state.messages, {
|
|
1461
1487
|
id: o,
|
|
1462
1488
|
role: "assistant",
|
|
@@ -1465,13 +1491,13 @@ class jt {
|
|
|
1465
1491
|
...typeof e.causalSequence == "number" ? { causalSequence: e.causalSequence } : {},
|
|
1466
1492
|
dataType: "assistant_draft",
|
|
1467
1493
|
...l ? { phase: l } : {},
|
|
1468
|
-
...
|
|
1494
|
+
...c ? { respondsToUserMessageId: c } : {},
|
|
1469
1495
|
...h ? { runId: h } : {}
|
|
1470
1496
|
}),
|
|
1471
1497
|
assistantDraft: i,
|
|
1472
1498
|
assistantDraftItemId: n ?? this.state.assistantDraftItemId,
|
|
1473
1499
|
assistantDraftPhase: l,
|
|
1474
|
-
assistantDraftRespondsToUserMessageId:
|
|
1500
|
+
assistantDraftRespondsToUserMessageId: c,
|
|
1475
1501
|
assistantDraftRunId: h,
|
|
1476
1502
|
isThinking: !0,
|
|
1477
1503
|
taskStatus: "working",
|
|
@@ -1488,8 +1514,8 @@ class jt {
|
|
|
1488
1514
|
return;
|
|
1489
1515
|
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l = Es(
|
|
1490
1516
|
this.state.messages.filter(
|
|
1491
|
-
(
|
|
1492
|
-
|
|
1517
|
+
(c) => c.dataType !== "assistant_draft" || !Be(
|
|
1518
|
+
c,
|
|
1493
1519
|
n,
|
|
1494
1520
|
r
|
|
1495
1521
|
)
|
|
@@ -1523,7 +1549,7 @@ class jt {
|
|
|
1523
1549
|
if (s)
|
|
1524
1550
|
this.nonTranscriptToolCallIds.add(s);
|
|
1525
1551
|
else {
|
|
1526
|
-
const n =
|
|
1552
|
+
const n = cr(e);
|
|
1527
1553
|
if (n) {
|
|
1528
1554
|
const r = ar(
|
|
1529
1555
|
this.state.messages,
|
|
@@ -1595,13 +1621,13 @@ class jt {
|
|
|
1595
1621
|
o && r && i && (this.retryableClientMessageId = i);
|
|
1596
1622
|
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Un(a.message);
|
|
1597
1623
|
l && console.error(l);
|
|
1598
|
-
const
|
|
1624
|
+
const c = i ?? this.activeClientMessageId, h = typeof e.runId == "string" ? e.runId : null, p = Ut(
|
|
1599
1625
|
this.state.messages,
|
|
1600
|
-
|
|
1626
|
+
c,
|
|
1601
1627
|
h
|
|
1602
1628
|
), I = mr(
|
|
1603
1629
|
p,
|
|
1604
|
-
|
|
1630
|
+
c,
|
|
1605
1631
|
h
|
|
1606
1632
|
);
|
|
1607
1633
|
this.setState({
|
|
@@ -1626,7 +1652,7 @@ class jt {
|
|
|
1626
1652
|
shouldIgnoreBackgroundSessionEvent(e) {
|
|
1627
1653
|
if (!this.options.keepRunsActiveOnSessionNavigation || !pn(e))
|
|
1628
1654
|
return !1;
|
|
1629
|
-
const s =
|
|
1655
|
+
const s = ue(e);
|
|
1630
1656
|
return s ? this.deferredSessionUpdatedSessionIds.has(s) ? !0 : this.state.sessionId ? s !== this.state.sessionId : this.backgroundSessionIds.has(s) : !1;
|
|
1631
1657
|
}
|
|
1632
1658
|
rememberCurrentRunAsBackground() {
|
|
@@ -1943,8 +1969,8 @@ class jt {
|
|
|
1943
1969
|
callId: n,
|
|
1944
1970
|
toolName: r,
|
|
1945
1971
|
summary: i,
|
|
1946
|
-
rawInput:
|
|
1947
|
-
rawOutput:
|
|
1972
|
+
rawInput: L(o),
|
|
1973
|
+
rawOutput: L({
|
|
1948
1974
|
ok: !1,
|
|
1949
1975
|
toolName: r,
|
|
1950
1976
|
error: `Unsupported browser tool: ${r}`
|
|
@@ -1959,7 +1985,7 @@ class jt {
|
|
|
1959
1985
|
callId: n,
|
|
1960
1986
|
toolName: r,
|
|
1961
1987
|
summary: i,
|
|
1962
|
-
rawInput:
|
|
1988
|
+
rawInput: L(o),
|
|
1963
1989
|
rawOutput: {
|
|
1964
1990
|
ok: !1,
|
|
1965
1991
|
toolName: r,
|
|
@@ -1975,15 +2001,15 @@ class jt {
|
|
|
1975
2001
|
callId: n,
|
|
1976
2002
|
toolName: r,
|
|
1977
2003
|
summary: i,
|
|
1978
|
-
rawInput:
|
|
2004
|
+
rawInput: L(o),
|
|
1979
2005
|
rawOutput: null
|
|
1980
2006
|
},
|
|
1981
2007
|
startedAtMs: Date.now(),
|
|
1982
2008
|
startedAtUrl: location.href,
|
|
1983
2009
|
startedAtOrigin: location.origin
|
|
1984
2010
|
}), this.installSessionBrowserApis();
|
|
1985
|
-
let
|
|
1986
|
-
|
|
2011
|
+
let c = null, h;
|
|
2012
|
+
c = await this.executeRuntimeHelper(), h = await Rt(
|
|
1987
2013
|
o,
|
|
1988
2014
|
kn(e.runtimeContext, this.options.backendUrl)
|
|
1989
2015
|
).catch((p) => ({
|
|
@@ -1997,8 +2023,8 @@ class jt {
|
|
|
1997
2023
|
callId: n,
|
|
1998
2024
|
toolName: r,
|
|
1999
2025
|
summary: o.summary,
|
|
2000
|
-
rawInput:
|
|
2001
|
-
rawOutput:
|
|
2026
|
+
rawInput: L(o),
|
|
2027
|
+
rawOutput: L(Kn(h, c))
|
|
2002
2028
|
}), vt(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
2003
2029
|
}
|
|
2004
2030
|
setToolMessageLoading(e, s) {
|
|
@@ -2034,7 +2060,7 @@ class jt {
|
|
|
2034
2060
|
return e.ok === !1 ? Gn(e) : null;
|
|
2035
2061
|
}
|
|
2036
2062
|
enableNetworkCapture() {
|
|
2037
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
2063
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = un((e) => {
|
|
2038
2064
|
ti(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
2039
2065
|
}));
|
|
2040
2066
|
}
|
|
@@ -2108,7 +2134,7 @@ class jt {
|
|
|
2108
2134
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
2109
2135
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
2110
2136
|
};
|
|
2111
|
-
this.state = o, Nr(this.options.clientId, this.state), this.emit("state", this.getState()),
|
|
2137
|
+
this.state = o, Nr(this.options.clientId, this.state), this.emit("state", this.getState()), Le("state", this.state.status, {
|
|
2112
2138
|
status: this.state.status,
|
|
2113
2139
|
sessionId: this.state.sessionId,
|
|
2114
2140
|
messageCount: this.state.messages.length,
|
|
@@ -2131,7 +2157,7 @@ class jt {
|
|
|
2131
2157
|
}
|
|
2132
2158
|
}
|
|
2133
2159
|
const Ne = /* @__PURE__ */ new WeakMap();
|
|
2134
|
-
function
|
|
2160
|
+
function un(t) {
|
|
2135
2161
|
const e = window.__plunoProductAgentNetworkCapture ?? dn();
|
|
2136
2162
|
return e.subscribers.add(t), () => {
|
|
2137
2163
|
e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
@@ -2145,23 +2171,23 @@ function dn() {
|
|
|
2145
2171
|
} catch {
|
|
2146
2172
|
}
|
|
2147
2173
|
});
|
|
2148
|
-
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(f,
|
|
2174
|
+
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(f, u) {
|
|
2149
2175
|
const d = Date.now();
|
|
2150
2176
|
let g;
|
|
2151
2177
|
try {
|
|
2152
|
-
g = s.call(this, f,
|
|
2178
|
+
g = s.call(this, f, u);
|
|
2153
2179
|
} catch (T) {
|
|
2154
2180
|
throw T;
|
|
2155
2181
|
}
|
|
2156
2182
|
try {
|
|
2157
|
-
const T = f instanceof Request ? f : null, k = Jr(f, T), m = is(
|
|
2158
|
-
if (!V(k, m,
|
|
2183
|
+
const T = f instanceof Request ? f : null, k = Jr(f, T), m = is(u?.headers ?? T?.headers);
|
|
2184
|
+
if (!V(k, m, u?.body)) {
|
|
2159
2185
|
const U = {
|
|
2160
2186
|
requestId: We("fetch"),
|
|
2161
|
-
url: x(k,
|
|
2162
|
-
method: (
|
|
2187
|
+
url: x(k, qe),
|
|
2188
|
+
method: (u?.method ?? T?.method ?? "GET").toUpperCase(),
|
|
2163
2189
|
requestHeaders: m,
|
|
2164
|
-
requestBody:
|
|
2190
|
+
requestBody: Lt(u?.body),
|
|
2165
2191
|
resourceType: "fetch",
|
|
2166
2192
|
startedAt: new Date(d).toISOString()
|
|
2167
2193
|
};
|
|
@@ -2187,42 +2213,42 @@ function dn() {
|
|
|
2187
2213
|
} catch {
|
|
2188
2214
|
}
|
|
2189
2215
|
return g;
|
|
2190
|
-
}, a = function(f,
|
|
2191
|
-
const k = n.call(this, f,
|
|
2216
|
+
}, a = function(f, u, d, g, T) {
|
|
2217
|
+
const k = n.call(this, f, u, d ?? !0, g ?? void 0, T ?? void 0), m = typeof u == "string" ? u : u.toString();
|
|
2192
2218
|
return Ne.set(this, {
|
|
2193
2219
|
requestId: We("xhr"),
|
|
2194
2220
|
method: String(f ?? "GET").toUpperCase(),
|
|
2195
|
-
url: x(m,
|
|
2221
|
+
url: x(m, qe),
|
|
2196
2222
|
requestHeaders: {},
|
|
2197
2223
|
startedAtMs: Date.now(),
|
|
2198
2224
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2199
2225
|
excluded: V(m)
|
|
2200
2226
|
}), k;
|
|
2201
|
-
}, l = function(f,
|
|
2202
|
-
const d = r.call(this, f,
|
|
2203
|
-
return g && Object.keys(g.requestHeaders).length < Ze && (g.requestHeaders[f] = nt(f,
|
|
2204
|
-
},
|
|
2227
|
+
}, l = function(f, u) {
|
|
2228
|
+
const d = r.call(this, f, u), g = Ne.get(this);
|
|
2229
|
+
return g && Object.keys(g.requestHeaders).length < Ze && (g.requestHeaders[f] = nt(f, u), g.excluded = g.excluded || V(g.url, g.requestHeaders)), d;
|
|
2230
|
+
}, c = function(f) {
|
|
2205
2231
|
try {
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2232
|
+
const u = Ne.get(this);
|
|
2233
|
+
u && (u.excluded = u.excluded || V(u.url, u.requestHeaders, f), u.requestBody = Lt(f), u.excluded || this.addEventListener(
|
|
2208
2234
|
"loadend",
|
|
2209
2235
|
() => {
|
|
2210
2236
|
queueMicrotask(() => {
|
|
2211
2237
|
try {
|
|
2212
2238
|
const d = ni(this.getAllResponseHeaders());
|
|
2213
2239
|
e({
|
|
2214
|
-
requestId:
|
|
2215
|
-
url:
|
|
2216
|
-
method:
|
|
2217
|
-
requestHeaders:
|
|
2218
|
-
requestBody:
|
|
2240
|
+
requestId: u.requestId,
|
|
2241
|
+
url: u.url,
|
|
2242
|
+
method: u.method,
|
|
2243
|
+
requestHeaders: u.requestHeaders,
|
|
2244
|
+
requestBody: u.requestBody,
|
|
2219
2245
|
resourceType: "xhr",
|
|
2220
2246
|
responseStatus: this.status,
|
|
2221
2247
|
responseHeaders: d,
|
|
2222
2248
|
responseBody: Zr(this, d),
|
|
2223
2249
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
2224
|
-
startedAt:
|
|
2225
|
-
durationMs: Date.now() -
|
|
2250
|
+
startedAt: u.startedAt,
|
|
2251
|
+
durationMs: Date.now() - u.startedAtMs
|
|
2226
2252
|
});
|
|
2227
2253
|
} catch {
|
|
2228
2254
|
return;
|
|
@@ -2248,25 +2274,25 @@ function dn() {
|
|
|
2248
2274
|
} catch {
|
|
2249
2275
|
}
|
|
2250
2276
|
try {
|
|
2251
|
-
XMLHttpRequest.prototype.send =
|
|
2277
|
+
XMLHttpRequest.prototype.send = c;
|
|
2252
2278
|
} catch {
|
|
2253
2279
|
}
|
|
2254
2280
|
let h = null;
|
|
2255
2281
|
if (typeof PerformanceObserver < "u") {
|
|
2256
2282
|
h = new PerformanceObserver((I) => {
|
|
2257
2283
|
for (const f of I.getEntries()) {
|
|
2258
|
-
const
|
|
2259
|
-
if (
|
|
2284
|
+
const u = f;
|
|
2285
|
+
if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" || V(u.name))
|
|
2260
2286
|
continue;
|
|
2261
|
-
const d = performance.timeOrigin +
|
|
2287
|
+
const d = performance.timeOrigin + u.startTime;
|
|
2262
2288
|
e({
|
|
2263
2289
|
requestId: We("resource"),
|
|
2264
|
-
url: x(
|
|
2290
|
+
url: x(u.name, qe),
|
|
2265
2291
|
method: "GET",
|
|
2266
2292
|
resourceType: "resource",
|
|
2267
|
-
responseStatus:
|
|
2293
|
+
responseStatus: u.responseStatus,
|
|
2268
2294
|
startedAt: new Date(d).toISOString(),
|
|
2269
|
-
durationMs:
|
|
2295
|
+
durationMs: u.duration
|
|
2270
2296
|
});
|
|
2271
2297
|
}
|
|
2272
2298
|
});
|
|
@@ -2293,7 +2319,7 @@ function dn() {
|
|
|
2293
2319
|
} catch {
|
|
2294
2320
|
}
|
|
2295
2321
|
try {
|
|
2296
|
-
XMLHttpRequest.prototype.send ===
|
|
2322
|
+
XMLHttpRequest.prototype.send === c && (XMLHttpRequest.prototype.send = i);
|
|
2297
2323
|
} catch {
|
|
2298
2324
|
}
|
|
2299
2325
|
}
|
|
@@ -2321,7 +2347,7 @@ function hn(t) {
|
|
|
2321
2347
|
function pn(t) {
|
|
2322
2348
|
return t.type === "run.steered" || t.type === "run.ack" || t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call" || t.type === "tool.status" || t.type === "error" && typeof t.requestId != "string";
|
|
2323
2349
|
}
|
|
2324
|
-
function
|
|
2350
|
+
function ue(t) {
|
|
2325
2351
|
if (typeof t.sessionId == "string")
|
|
2326
2352
|
return t.sessionId;
|
|
2327
2353
|
if (t.session && typeof t.session == "object") {
|
|
@@ -2437,18 +2463,18 @@ async function Rt(t, e) {
|
|
|
2437
2463
|
info: console.info,
|
|
2438
2464
|
warn: console.warn,
|
|
2439
2465
|
error: console.error
|
|
2440
|
-
}, l = (
|
|
2441
|
-
i.push({ level:
|
|
2466
|
+
}, l = (c) => (...h) => {
|
|
2467
|
+
i.push({ level: c, args: h }), a[c](...h);
|
|
2442
2468
|
};
|
|
2443
2469
|
console.log = l("log"), console.info = l("info"), console.warn = l("warn"), console.error = l("error");
|
|
2444
2470
|
try {
|
|
2445
|
-
const
|
|
2471
|
+
const c = /* @__PURE__ */ Symbol("execute_code_timeout"), h = await Promise.race([
|
|
2446
2472
|
new s("sandboxFiles", t.javascript)(e?.value),
|
|
2447
2473
|
new Promise((p) => {
|
|
2448
|
-
o = window.setTimeout(() => p(
|
|
2474
|
+
o = window.setTimeout(() => p(c), n);
|
|
2449
2475
|
})
|
|
2450
2476
|
]);
|
|
2451
|
-
return h ===
|
|
2477
|
+
return h === c ? Cn(n) : {
|
|
2452
2478
|
ok: !0,
|
|
2453
2479
|
result: h,
|
|
2454
2480
|
console: i,
|
|
@@ -2458,14 +2484,14 @@ async function Rt(t, e) {
|
|
|
2458
2484
|
origin: location.origin
|
|
2459
2485
|
}
|
|
2460
2486
|
};
|
|
2461
|
-
} catch (
|
|
2487
|
+
} catch (c) {
|
|
2462
2488
|
return {
|
|
2463
2489
|
ok: !1,
|
|
2464
2490
|
console: i,
|
|
2465
2491
|
exception: {
|
|
2466
|
-
name:
|
|
2467
|
-
message:
|
|
2468
|
-
stack:
|
|
2492
|
+
name: c instanceof Error ? c.name : "Error",
|
|
2493
|
+
message: c instanceof Error ? c.message : String(c),
|
|
2494
|
+
stack: c instanceof Error ? c.stack : void 0
|
|
2469
2495
|
},
|
|
2470
2496
|
metadata: {
|
|
2471
2497
|
durationMs: Date.now() - r,
|
|
@@ -2487,13 +2513,13 @@ function kn(t, e) {
|
|
|
2487
2513
|
const r = () => {
|
|
2488
2514
|
if (!n)
|
|
2489
2515
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
2490
|
-
}, i = async (a, l) => await
|
|
2516
|
+
}, i = async (a, l) => await qs(`${e.replace(/\/$/, "")}${a}`, l);
|
|
2491
2517
|
return {
|
|
2492
2518
|
value: Object.freeze({
|
|
2493
2519
|
upload: async (a) => {
|
|
2494
2520
|
if (r(), !(a instanceof Blob))
|
|
2495
2521
|
throw new TypeError("sandboxFiles.upload expects a File or Blob");
|
|
2496
|
-
const l = a instanceof File && a.name ? a.name : "file",
|
|
2522
|
+
const l = a instanceof File && a.name ? a.name : "file", c = `?name=${encodeURIComponent(l)}&size_bytes=${a.size}`, h = await i(`/api/product-agent/attachments/sandbox-files${c}`, {
|
|
2497
2523
|
method: "PUT",
|
|
2498
2524
|
headers: { Authorization: `Bearer ${s}` },
|
|
2499
2525
|
body: a
|
|
@@ -2510,9 +2536,9 @@ function kn(t, e) {
|
|
|
2510
2536
|
);
|
|
2511
2537
|
if (!l.ok)
|
|
2512
2538
|
throw new Error(`sandboxFiles.download failed (${l.status})`);
|
|
2513
|
-
const
|
|
2514
|
-
return new File([
|
|
2515
|
-
type:
|
|
2539
|
+
const c = await l.blob(), p = (l.headers.get("content-disposition") ?? "").match(/filename="([^"]+)"/i)?.[1];
|
|
2540
|
+
return new File([c], p || a.split("/").pop() || "file", {
|
|
2541
|
+
type: c.type
|
|
2516
2542
|
});
|
|
2517
2543
|
}
|
|
2518
2544
|
}),
|
|
@@ -2577,11 +2603,11 @@ function vn() {
|
|
|
2577
2603
|
};
|
|
2578
2604
|
}
|
|
2579
2605
|
function On(t) {
|
|
2580
|
-
return me.add(t),
|
|
2581
|
-
me.delete(t), me.size === 0 && (
|
|
2606
|
+
return me.add(t), ce || (ce = Ln()), () => {
|
|
2607
|
+
me.delete(t), me.size === 0 && (ce?.(), ce = null);
|
|
2582
2608
|
};
|
|
2583
2609
|
}
|
|
2584
|
-
function
|
|
2610
|
+
function Ln() {
|
|
2585
2611
|
const t = () => {
|
|
2586
2612
|
for (const i of Array.from(me))
|
|
2587
2613
|
i();
|
|
@@ -2612,17 +2638,17 @@ function et() {
|
|
|
2612
2638
|
);
|
|
2613
2639
|
for (const d of r.slice(0, 3))
|
|
2614
2640
|
s("Active overlay", xe(oe(d), e));
|
|
2615
|
-
const i =
|
|
2641
|
+
const i = qn(), o = i ? xe(oe(i), e) : "";
|
|
2616
2642
|
s("Main page content", o), s("Additional visible page text", xe(oe(document.body), e));
|
|
2617
2643
|
const a = t.map(([d, g]) => `${d}:
|
|
2618
2644
|
${g}`).join(`
|
|
2619
2645
|
|
|
2620
|
-
`).trim().slice(0, 12e3), l = Nn(r, i).trim(),
|
|
2646
|
+
`).trim().slice(0, 12e3), l = Nn(r, i).trim(), c = `Simplified DOM outline:
|
|
2621
2647
|
`, h = `
|
|
2622
2648
|
|
|
2623
2649
|
Visible page text:
|
|
2624
|
-
`, p = 12e3 -
|
|
2625
|
-
return `${
|
|
2650
|
+
`, p = 12e3 - c.length - h.length, I = Math.min(a.length, 7900), f = l.slice(0, p - I), u = a.slice(0, p - f.length);
|
|
2651
|
+
return `${c}${f}${h}${u}`;
|
|
2626
2652
|
}
|
|
2627
2653
|
function oe(t) {
|
|
2628
2654
|
return t.innerText ?? t.textContent ?? "";
|
|
@@ -2645,7 +2671,7 @@ function Ft(t) {
|
|
|
2645
2671
|
const e = window.getComputedStyle(t);
|
|
2646
2672
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
2647
2673
|
}
|
|
2648
|
-
function
|
|
2674
|
+
function qn() {
|
|
2649
2675
|
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ft).sort((t, e) => oe(e).length - oe(t).length)[0] ?? null;
|
|
2650
2676
|
}
|
|
2651
2677
|
function Nn(t, e) {
|
|
@@ -2728,35 +2754,35 @@ function Nn(t, e) {
|
|
|
2728
2754
|
"data-test",
|
|
2729
2755
|
"data-qa",
|
|
2730
2756
|
"data-cy"
|
|
2731
|
-
],
|
|
2757
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: h, priorityTargets: p } = xn(), I = new Set(t);
|
|
2732
2758
|
e && I.add(e);
|
|
2733
2759
|
let f = 0;
|
|
2734
|
-
const
|
|
2760
|
+
const u = (m) => {
|
|
2735
2761
|
const w = m.getAttribute("role");
|
|
2736
2762
|
return w && !o.has(w) ? w : "";
|
|
2737
2763
|
}, d = (m) => {
|
|
2738
2764
|
const w = m.getAttribute("data-testid") || m.getAttribute("data-test") || m.getAttribute("data-qa") || m.getAttribute("data-cy") || "";
|
|
2739
|
-
return `${m.tagName.toLowerCase()}|${
|
|
2765
|
+
return `${m.tagName.toLowerCase()}|${u(m)}|${w}`;
|
|
2740
2766
|
}, g = (m, w, U) => {
|
|
2741
2767
|
const D = (R, ee) => {
|
|
2742
2768
|
const C = R.tagName.toLowerCase(), te = window.getComputedStyle(R), z = h.has(R);
|
|
2743
2769
|
if (f >= 1e3 && !z || U.has(R) || i.has(C) || R.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || te.display === "none" || te.visibility === "hidden")
|
|
2744
2770
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
2745
2771
|
f += 1;
|
|
2746
|
-
const H =
|
|
2772
|
+
const H = u(R), K = Kt(R), rt = a.has(H) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(C) || C === "a" && R.hasAttribute("href"), X = Array.from(R.children).filter((y) => y instanceof HTMLElement), q = /* @__PURE__ */ new Map();
|
|
2747
2773
|
for (const y of X) {
|
|
2748
2774
|
const M = d(y);
|
|
2749
|
-
|
|
2775
|
+
q.set(M, (q.get(M) ?? 0) + 1);
|
|
2750
2776
|
}
|
|
2751
2777
|
const E = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map();
|
|
2752
2778
|
for (const y of X) {
|
|
2753
2779
|
const M = d(y), $ = O.get(M) ?? 0;
|
|
2754
|
-
O.set(M, $ + 1), (
|
|
2780
|
+
O.set(M, $ + 1), (q.get(M) ?? 0) > 8 && $ >= 6 && !h.has(y) && E.set(M, (E.get(M) ?? 0) + 1);
|
|
2755
2781
|
}
|
|
2756
2782
|
const it = /* @__PURE__ */ new Map(), ot = /* @__PURE__ */ new Set(), ke = [], at = [];
|
|
2757
2783
|
for (const y of X) {
|
|
2758
|
-
const M = d(y), $ =
|
|
2759
|
-
if (it.set(M,
|
|
2784
|
+
const M = d(y), $ = q.get(M) ?? 0, ut = it.get(M) ?? 0;
|
|
2785
|
+
if (it.set(M, ut + 1), $ > 8 && ut >= 6 && !h.has(y)) {
|
|
2760
2786
|
ot.has(M) || (ke.push([`… ${E.get(M) ?? 0} similar siblings omitted`]), ot.add(M));
|
|
2761
2787
|
continue;
|
|
2762
2788
|
}
|
|
@@ -2769,7 +2795,7 @@ function Nn(t, e) {
|
|
|
2769
2795
|
y instanceof HTMLElement && Ce.push(D(y, ee + 1));
|
|
2770
2796
|
const le = [...at, ...Ce], _e = K.length > 0 || rt || le.some((y) => y.hasUsefulContent), lt = Y(
|
|
2771
2797
|
[K, ...le.map((y) => y.textPreview)].filter(Boolean).join(" ")
|
|
2772
|
-
).slice(0, 180), ps = R.hasAttribute("contenteditable") && (K.length > 0 || !R.querySelector("[contenteditable]")),
|
|
2798
|
+
).slice(0, 180), ps = R.hasAttribute("contenteditable") && (K.length > 0 || !R.querySelector("[contenteditable]")), ct = c.some((y) => R.hasAttribute(y)) || !!H || ps, be = (R.getClientRects().length > 0 || te.display === "contents") && (s.has(C) || ct || z) && (_e || z) && (!r.has(C) || _e || ct || z), Pe = be ? 1 : 0, se = [];
|
|
2773
2799
|
if (be) {
|
|
2774
2800
|
const y = le.some(($) => $.containsTextElement), M = n.has(C) && !y ? lt : K;
|
|
2775
2801
|
se.push(zt(R, l, o, M.slice(0, 180)));
|
|
@@ -2830,8 +2856,8 @@ function xn() {
|
|
|
2830
2856
|
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), s = (a, l) => {
|
|
2831
2857
|
if (!a)
|
|
2832
2858
|
return;
|
|
2833
|
-
const
|
|
2834
|
-
if (
|
|
2859
|
+
const c = window.getComputedStyle(a);
|
|
2860
|
+
if (c.display === "none" || c.visibility === "hidden")
|
|
2835
2861
|
return;
|
|
2836
2862
|
const h = e.get(a) ?? /* @__PURE__ */ new Set();
|
|
2837
2863
|
h.add(l), e.set(a, h);
|
|
@@ -2858,11 +2884,11 @@ function xn() {
|
|
|
2858
2884
|
], o = [document];
|
|
2859
2885
|
for (let a = 0; a < o.length; a += 1) {
|
|
2860
2886
|
const l = o[a];
|
|
2861
|
-
for (const [
|
|
2862
|
-
for (const p of Array.from(l.querySelectorAll(
|
|
2887
|
+
for (const [c, h] of i)
|
|
2888
|
+
for (const p of Array.from(l.querySelectorAll(c)))
|
|
2863
2889
|
s(p, h);
|
|
2864
|
-
for (const
|
|
2865
|
-
|
|
2890
|
+
for (const c of Array.from(l.querySelectorAll("*")))
|
|
2891
|
+
c.shadowRoot && o.push(c.shadowRoot);
|
|
2866
2892
|
}
|
|
2867
2893
|
return {
|
|
2868
2894
|
priorityElements: t,
|
|
@@ -2880,13 +2906,13 @@ function Bn(t, e, s, n) {
|
|
|
2880
2906
|
const p = a.getRootNode();
|
|
2881
2907
|
a = a.parentElement ?? (p instanceof ShadowRoot && p.host instanceof HTMLElement ? p.host : null);
|
|
2882
2908
|
}
|
|
2883
|
-
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o,
|
|
2909
|
+
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((h, p) => zt(
|
|
2884
2910
|
h,
|
|
2885
2911
|
s,
|
|
2886
2912
|
n,
|
|
2887
2913
|
p === l.length - 1 ? Kt(h).slice(0, 180) : ""
|
|
2888
2914
|
));
|
|
2889
|
-
o.length > l.length &&
|
|
2915
|
+
o.length > l.length && c.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${c.join(" > ")}`);
|
|
2890
2916
|
}
|
|
2891
2917
|
return r.join(`
|
|
2892
2918
|
`);
|
|
@@ -3080,7 +3106,7 @@ function Xt(t, e) {
|
|
|
3080
3106
|
}), o;
|
|
3081
3107
|
}
|
|
3082
3108
|
if (r.type === "function_call_output") {
|
|
3083
|
-
const i =
|
|
3109
|
+
const i = Ls(r.output);
|
|
3084
3110
|
if (i)
|
|
3085
3111
|
return {
|
|
3086
3112
|
id: String(s.id ?? crypto.randomUUID()),
|
|
@@ -3249,7 +3275,7 @@ function rr(t) {
|
|
|
3249
3275
|
}).filter(Boolean).join("") : "";
|
|
3250
3276
|
}
|
|
3251
3277
|
function Fe(t, e) {
|
|
3252
|
-
const s = Jt(t, e), n =
|
|
3278
|
+
const s = Jt(t, e), n = ur(
|
|
3253
3279
|
ir(
|
|
3254
3280
|
fr(t, e),
|
|
3255
3281
|
s
|
|
@@ -3311,7 +3337,7 @@ function lr(t, e, s) {
|
|
|
3311
3337
|
const r = t.map((i) => i.callId !== e || i.loading === s ? i : (n = !0, { ...i, loading: s }));
|
|
3312
3338
|
return n ? r : t;
|
|
3313
3339
|
}
|
|
3314
|
-
function
|
|
3340
|
+
function cr(t) {
|
|
3315
3341
|
if (t.hiddenFromTranscript === !0)
|
|
3316
3342
|
return null;
|
|
3317
3343
|
const e = typeof t.callId == "string" ? t.callId : null, s = typeof t.toolName == "string" ? t.toolName : null;
|
|
@@ -3331,7 +3357,7 @@ function ur(t) {
|
|
|
3331
3357
|
loading: !0
|
|
3332
3358
|
};
|
|
3333
3359
|
}
|
|
3334
|
-
function
|
|
3360
|
+
function ur(t, e) {
|
|
3335
3361
|
if (e.id.startsWith("transient-activity:"))
|
|
3336
3362
|
return t;
|
|
3337
3363
|
const s = e.toolName === "tab_lifecycle";
|
|
@@ -3627,7 +3653,7 @@ function Rr(t) {
|
|
|
3627
3653
|
return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
|
|
3628
3654
|
}
|
|
3629
3655
|
function Ge(t) {
|
|
3630
|
-
return t.filter((e, s) => F(e) ? !
|
|
3656
|
+
return t.filter((e, s) => F(e) ? !Lr(t, s) && !es(t, s) && !vr(t, s) && !Or(t, s) : Er(e) ? e.retryable === !0 && Dr(t, s) ? !1 : !Ur(t, s) : !0);
|
|
3631
3657
|
}
|
|
3632
3658
|
function Er(t) {
|
|
3633
3659
|
return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
|
|
@@ -3637,7 +3663,7 @@ function F(t) {
|
|
|
3637
3663
|
}
|
|
3638
3664
|
function kr(t, e, s, n) {
|
|
3639
3665
|
const r = t.findIndex(
|
|
3640
|
-
(l,
|
|
3666
|
+
(l, c) => F(l) && !es(t, c)
|
|
3641
3667
|
), i = r === -1 ? null : t[r], o = e ?? i?.respondsToUserMessageId ?? null, a = o ? t.find(
|
|
3642
3668
|
(l) => l.role === "user" && l.id === o
|
|
3643
3669
|
) : null;
|
|
@@ -3736,7 +3762,7 @@ function Or(t, e) {
|
|
|
3736
3762
|
(n, r) => r !== e && n.role === "tool" && ae(s, n)
|
|
3737
3763
|
);
|
|
3738
3764
|
}
|
|
3739
|
-
function
|
|
3765
|
+
function Lr(t, e) {
|
|
3740
3766
|
const s = t[e];
|
|
3741
3767
|
for (let n = e + 1; n < t.length; n += 1)
|
|
3742
3768
|
if (F(t[n]) && ae(s, t[n]))
|
|
@@ -3749,7 +3775,7 @@ function ae(t, e) {
|
|
|
3749
3775
|
function S(t, e) {
|
|
3750
3776
|
return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
|
|
3751
3777
|
}
|
|
3752
|
-
function
|
|
3778
|
+
function qr(t, e) {
|
|
3753
3779
|
try {
|
|
3754
3780
|
const s = window.localStorage.getItem(`${$t}${t}`);
|
|
3755
3781
|
if (!s)
|
|
@@ -4031,13 +4057,13 @@ async function Qr(t) {
|
|
|
4031
4057
|
const a = await Promise.race([e.read(), n]);
|
|
4032
4058
|
if (a === "timeout")
|
|
4033
4059
|
return;
|
|
4034
|
-
const { done: l, value:
|
|
4060
|
+
const { done: l, value: c } = a;
|
|
4035
4061
|
if (l)
|
|
4036
4062
|
return x(i + r.decode());
|
|
4037
4063
|
const h = Qe - o;
|
|
4038
|
-
if (
|
|
4039
|
-
return i += r.decode(
|
|
4040
|
-
o +=
|
|
4064
|
+
if (c.byteLength > h)
|
|
4065
|
+
return i += r.decode(c.subarray(0, Math.max(h, 0)), { stream: !0 }), e.cancel(), `${x(i)}... [truncated]`;
|
|
4066
|
+
o += c.byteLength, i += r.decode(c, { stream: !0 });
|
|
4041
4067
|
}
|
|
4042
4068
|
} catch {
|
|
4043
4069
|
e?.cancel();
|
|
@@ -4054,25 +4080,25 @@ function Zr(t, e) {
|
|
|
4054
4080
|
return;
|
|
4055
4081
|
}
|
|
4056
4082
|
}
|
|
4057
|
-
function
|
|
4083
|
+
function Lt(t) {
|
|
4058
4084
|
if (typeof t == "string")
|
|
4059
4085
|
return x(t);
|
|
4060
4086
|
}
|
|
4061
4087
|
function ei(t) {
|
|
4062
|
-
return
|
|
4088
|
+
return L({
|
|
4063
4089
|
...t,
|
|
4064
|
-
requestBody:
|
|
4065
|
-
responseBody:
|
|
4090
|
+
requestBody: qt(t.requestBody),
|
|
4091
|
+
responseBody: qt(t.responseBody)
|
|
4066
4092
|
});
|
|
4067
4093
|
}
|
|
4068
|
-
function
|
|
4094
|
+
function qt(t) {
|
|
4069
4095
|
if (typeof t != "string")
|
|
4070
4096
|
return t;
|
|
4071
4097
|
const e = t.trim();
|
|
4072
4098
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
4073
4099
|
return Me(t);
|
|
4074
4100
|
try {
|
|
4075
|
-
return JSON.stringify(
|
|
4101
|
+
return JSON.stringify(L(JSON.parse(t)));
|
|
4076
4102
|
} catch {
|
|
4077
4103
|
return Me(t);
|
|
4078
4104
|
}
|
|
@@ -4163,8 +4189,8 @@ function oi(t) {
|
|
|
4163
4189
|
function ai(t) {
|
|
4164
4190
|
return t === 401 || t === 403;
|
|
4165
4191
|
}
|
|
4166
|
-
const Ee = "[REDACTED_SECRET]", W = "[REDACTED_TOKEN]", li = "[REDACTED_SIGNED_URL]",
|
|
4167
|
-
function
|
|
4192
|
+
const Ee = "[REDACTED_SECRET]", W = "[REDACTED_TOKEN]", li = "[REDACTED_SIGNED_URL]", ci = 20, ui = /^(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, as = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, ls = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, cs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, us = /\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, di = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, hi = /\bhttps?:\/\/[^\s"'<>]+/gi, pi = /[),.;\]]+$/;
|
|
4193
|
+
function L(t) {
|
|
4168
4194
|
return we(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4169
4195
|
}
|
|
4170
4196
|
function we(t, e, s) {
|
|
@@ -4172,7 +4198,7 @@ function we(t, e, s) {
|
|
|
4172
4198
|
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : Me(t);
|
|
4173
4199
|
if (t === null || typeof t != "object")
|
|
4174
4200
|
return t;
|
|
4175
|
-
if (e >=
|
|
4201
|
+
if (e >= ci)
|
|
4176
4202
|
return "[REDACTED_MAX_DEPTH]";
|
|
4177
4203
|
if (s.has(t))
|
|
4178
4204
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -4194,17 +4220,17 @@ function hs(t) {
|
|
|
4194
4220
|
try {
|
|
4195
4221
|
const e = new URL(t, location.href);
|
|
4196
4222
|
for (const s of Array.from(e.searchParams.keys()))
|
|
4197
|
-
|
|
4223
|
+
ui.test(s) && e.searchParams.set(s, W);
|
|
4198
4224
|
return e.username && (e.username = W), e.password && (e.password = W), e.toString();
|
|
4199
4225
|
} catch {
|
|
4200
4226
|
return fi(t);
|
|
4201
4227
|
}
|
|
4202
4228
|
}
|
|
4203
4229
|
function Me(t) {
|
|
4204
|
-
return t.replace(di, li).replace(hi, mi).replace(as, `Bearer ${W}`).replace(ls, `Basic ${W}`).replace(
|
|
4230
|
+
return t.replace(di, li).replace(hi, mi).replace(as, `Bearer ${W}`).replace(ls, `Basic ${W}`).replace(cs, W).replace(us, (e, s) => `${s}: ${Ee}`);
|
|
4205
4231
|
}
|
|
4206
4232
|
function fi(t) {
|
|
4207
|
-
return t.replace(as, `Bearer ${W}`).replace(ls, `Basic ${W}`).replace(
|
|
4233
|
+
return t.replace(as, `Bearer ${W}`).replace(ls, `Basic ${W}`).replace(cs, W).replace(us, (e, s) => `${s}: ${Ee}`);
|
|
4208
4234
|
}
|
|
4209
4235
|
function mi(t) {
|
|
4210
4236
|
const e = t.match(pi)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
|