@pluno/product-agent-web 0.1.133 → 0.1.135
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 +4 -0
- package/dist/product-agent-sdk.js +231 -208
- package/dist/product-agent-widget.js +1537 -1507
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const Ge = "pluno-product-agent-attachments";
|
|
2
2
|
const _t = "files";
|
|
3
3
|
async function Xe(e) {
|
|
4
|
-
const t = await
|
|
4
|
+
const t = await xt();
|
|
5
5
|
await Ve(t, "readwrite", (s) => s.put(e));
|
|
6
6
|
}
|
|
7
7
|
async function Ke(e, t) {
|
|
8
|
-
const s = await
|
|
8
|
+
const s = await xt();
|
|
9
9
|
await Nt(s, "readwrite", async (n) => {
|
|
10
10
|
const r = await Ot(
|
|
11
11
|
n.get(e)
|
|
@@ -17,13 +17,13 @@ async function Ke(e, t) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
async function Je(e = 864e5) {
|
|
20
|
-
const t = await
|
|
20
|
+
const t = await xt(), s = Date.now() - e;
|
|
21
21
|
await Nt(t, "readwrite", async (n) => {
|
|
22
22
|
const r = n.index("lastUsedAt");
|
|
23
23
|
(await Ot(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function xt() {
|
|
27
27
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((e, t) => {
|
|
28
28
|
const s = indexedDB.open(Ge, 1);
|
|
29
29
|
s.onupgradeneeded = () => {
|
|
@@ -87,11 +87,11 @@ function Qe(e, t) {
|
|
|
87
87
|
(s, n, r, i) => `${n}${new URL(r, t).toString()}${i}`
|
|
88
88
|
) : e;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
let
|
|
92
|
-
const
|
|
90
|
+
const It = "pluno.productAgent.transportId", ts = "pluno.productAgent.transportIdentity", wt = "pluno.productAgent.transportIdentity.event", es = 50, ss = globalThis.setTimeout.bind(globalThis);
|
|
91
|
+
let W = null;
|
|
92
|
+
const tt = /* @__PURE__ */ new Set(), At = /* @__PURE__ */ new Map();
|
|
93
93
|
async function ns(e = we()) {
|
|
94
|
-
const t = e.randomUUID(), s = e.storage.getItem(
|
|
94
|
+
const t = e.randomUUID(), s = e.storage.getItem(It);
|
|
95
95
|
let n = s ?? e.randomUUID(), r = !1, i = !1;
|
|
96
96
|
const o = e.channel.subscribe((c) => {
|
|
97
97
|
if (!(c.senderId === t || c.transportId !== n)) {
|
|
@@ -109,14 +109,14 @@ async function ns(e = we()) {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
if (!s)
|
|
112
|
-
e.storage.setItem(
|
|
112
|
+
e.storage.setItem(It, n), r = !0;
|
|
113
113
|
else
|
|
114
114
|
for (; ; ) {
|
|
115
115
|
if (i = !1, e.channel.postMessage({ type: "probe", transportId: n, senderId: t }), await e.settle(), !i) {
|
|
116
116
|
r = !0;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
|
-
n = e.randomUUID(), e.storage.setItem(
|
|
119
|
+
n = e.randomUUID(), e.storage.setItem(It, n);
|
|
120
120
|
}
|
|
121
121
|
let a = !1;
|
|
122
122
|
return {
|
|
@@ -127,26 +127,26 @@ async function ns(e = we()) {
|
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
async function rs() {
|
|
130
|
-
|
|
130
|
+
W || (W = ns(we()), W.then((n) => {
|
|
131
131
|
const r = (i) => {
|
|
132
|
-
i.persisted || (n.release(),
|
|
132
|
+
i.persisted || (n.release(), W = null, tt.clear(), window.removeEventListener("pagehide", r));
|
|
133
133
|
};
|
|
134
134
|
window.addEventListener("pagehide", r);
|
|
135
135
|
}));
|
|
136
|
-
const e = await
|
|
137
|
-
|
|
136
|
+
const e = await W, t = is();
|
|
137
|
+
tt.add(t);
|
|
138
138
|
let s = !1;
|
|
139
139
|
return {
|
|
140
140
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
141
141
|
transportId: t === 0 ? e.transportId : `${e.transportId}.${t}`,
|
|
142
142
|
release: () => {
|
|
143
|
-
s || (s = !0,
|
|
143
|
+
s || (s = !0, tt.delete(t));
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function is() {
|
|
148
148
|
let e = 0;
|
|
149
|
-
for (;
|
|
149
|
+
for (; tt.has(e); )
|
|
150
150
|
e += 1;
|
|
151
151
|
return e;
|
|
152
152
|
}
|
|
@@ -162,13 +162,13 @@ function os() {
|
|
|
162
162
|
return {
|
|
163
163
|
getItem: (e) => {
|
|
164
164
|
try {
|
|
165
|
-
return window.sessionStorage?.getItem(e) ??
|
|
165
|
+
return window.sessionStorage?.getItem(e) ?? At.get(e) ?? null;
|
|
166
166
|
} catch {
|
|
167
|
-
return
|
|
167
|
+
return At.get(e) ?? null;
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
setItem: (e, t) => {
|
|
171
|
-
|
|
171
|
+
At.set(e, t);
|
|
172
172
|
try {
|
|
173
173
|
window.sessionStorage?.setItem(e, t);
|
|
174
174
|
} catch {
|
|
@@ -192,7 +192,7 @@ function as() {
|
|
|
192
192
|
}
|
|
193
193
|
function cs() {
|
|
194
194
|
const e = /* @__PURE__ */ new Set(), t = (s) => {
|
|
195
|
-
if (s.key !==
|
|
195
|
+
if (s.key !== wt || !s.newValue)
|
|
196
196
|
return;
|
|
197
197
|
const n = JSON.parse(s.newValue);
|
|
198
198
|
for (const r of e)
|
|
@@ -201,9 +201,9 @@ function cs() {
|
|
|
201
201
|
return window.addEventListener("storage", t), {
|
|
202
202
|
postMessage: (s) => {
|
|
203
203
|
window.localStorage.setItem(
|
|
204
|
-
|
|
204
|
+
wt,
|
|
205
205
|
JSON.stringify({ ...s, eventId: crypto.randomUUID() })
|
|
206
|
-
), window.localStorage.removeItem(
|
|
206
|
+
), window.localStorage.removeItem(wt);
|
|
207
207
|
},
|
|
208
208
|
subscribe: (s) => (e.add(s), () => e.delete(s)),
|
|
209
209
|
close: () => {
|
|
@@ -211,18 +211,18 @@ function cs() {
|
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
const ls = globalThis.fetch.bind(globalThis), Mt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', us = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ds = ".pluno-pa-widget__panel", hs = ".pluno-pa-widget__timeline", te = `${Mt}[data-pluno-sdk-preview-channel]`, ps = "https://app.pluno.ai", fs = "gpt-5.6-terra", gs = 2e4, ms = 1e4, ys = 1e4, Ts = 1e4, Is = 1e4, ws = 1e3, ee = 3e4, se = 0.2, ne = 6e4, As = 15e3, J = 8, Ss = 15e3, Es = 2e3, bs = 1e3, ks = 100, Rs = 8e3, re = 3, _s = [300, 1e3], Lt = 64e3,
|
|
214
|
+
const ls = globalThis.fetch.bind(globalThis), Mt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', us = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ds = ".pluno-pa-widget__panel", hs = ".pluno-pa-widget__timeline", te = `${Mt}[data-pluno-sdk-preview-channel]`, ps = "https://app.pluno.ai", fs = "gpt-5.6-terra", gs = 2e4, ms = 1e4, ys = 1e4, Ts = 1e4, Is = 1e4, ws = 1e3, ee = 3e4, se = 0.2, ne = 6e4, As = 15e3, J = 8, Ss = 15e3, Es = 2e3, bs = 1e3, ks = 100, Rs = 8e3, re = 3, _s = [300, 1e3], Lt = 64e3, St = 4e3, Bt = 30, Ms = 2e3, Cs = 1e3, Ae = "Image is too large for model vision input.", Ps = 100, Se = "pluno.productAgent.state.", Ct = "pluno.productAgent.pendingEvents.", it = "pluno.productAgent.activeToolCalls.", Us = 100;
|
|
215
215
|
function V(e, t = 0) {
|
|
216
216
|
const s = e === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (e - 1));
|
|
217
217
|
return Math.max(t, s);
|
|
218
218
|
}
|
|
219
|
-
const
|
|
219
|
+
const et = /* @__PURE__ */ new Set();
|
|
220
220
|
let Y = null;
|
|
221
221
|
function Ds(e, t = Math.random) {
|
|
222
222
|
const s = Math.min(ee, ws * 2 ** e), n = 1 - se + t() * se * 2;
|
|
223
223
|
return Math.min(ee, Math.round(s * n));
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function vs(e, t, s) {
|
|
226
226
|
return new Promise((n, r) => {
|
|
227
227
|
const i = setTimeout(() => r(new Error(s)), t);
|
|
228
228
|
e.then(
|
|
@@ -257,7 +257,7 @@ class Ee {
|
|
|
257
257
|
}), this.queuedClientEvents = ir(
|
|
258
258
|
tr(t.clientId),
|
|
259
259
|
sr(t.clientId)
|
|
260
|
-
),
|
|
260
|
+
), $(t.clientId, this.queuedClientEvents);
|
|
261
261
|
}
|
|
262
262
|
options;
|
|
263
263
|
listeners = {};
|
|
@@ -275,6 +275,7 @@ class Ee {
|
|
|
275
275
|
networkBatchTimer = null;
|
|
276
276
|
queuedNetworkEvents = [];
|
|
277
277
|
queuedClientEvents = [];
|
|
278
|
+
pendingWarmupEvent = null;
|
|
278
279
|
pendingSessionHistoryRequests = /* @__PURE__ */ new Map();
|
|
279
280
|
transportIdentity;
|
|
280
281
|
retryAttemptsByClientMessageId = {};
|
|
@@ -364,7 +365,7 @@ class Ee {
|
|
|
364
365
|
lastError: null
|
|
365
366
|
});
|
|
366
367
|
try {
|
|
367
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await
|
|
368
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await vs(this.options.tokenProvider(), ys, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
|
|
368
369
|
return;
|
|
369
370
|
if (!this.token && !this.options.webSocketFactory)
|
|
370
371
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
@@ -415,19 +416,28 @@ class Ee {
|
|
|
415
416
|
}
|
|
416
417
|
}
|
|
417
418
|
disconnect() {
|
|
418
|
-
this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.socket?.close(), this.socket = null;
|
|
419
|
+
this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWarmupEvent = null, this.socket?.close(), this.socket = null;
|
|
419
420
|
}
|
|
420
421
|
destroy() {
|
|
421
422
|
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), or(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
422
423
|
for (const t of Object.values(this.listeners))
|
|
423
424
|
t?.clear();
|
|
424
425
|
}
|
|
426
|
+
warmup(t = "panel_open") {
|
|
427
|
+
const s = {
|
|
428
|
+
type: "runtime.warmup",
|
|
429
|
+
reason: t,
|
|
430
|
+
entrySurface: this.options.entrySurface,
|
|
431
|
+
page: k()
|
|
432
|
+
};
|
|
433
|
+
this.sendNow(s) || (this.pendingWarmupEvent = s);
|
|
434
|
+
}
|
|
425
435
|
async sendMessage(t, s = {}) {
|
|
426
436
|
const n = t.trim(), r = s.attachments ?? [];
|
|
427
|
-
let i = r.map(
|
|
437
|
+
let i = r.map($t);
|
|
428
438
|
if (!n && i.length === 0)
|
|
429
439
|
return null;
|
|
430
|
-
const o =
|
|
440
|
+
const o = k(), a = s.clientMessageId ?? kt(), c = {
|
|
431
441
|
id: `local-${a}`,
|
|
432
442
|
role: "user",
|
|
433
443
|
content: n,
|
|
@@ -494,7 +504,7 @@ class Ee {
|
|
|
494
504
|
return !t || !s ? !1 : (this.retryAttemptsByClientMessageId[s] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: t, clientMessageId: s, automatic: !1 }), !0);
|
|
495
505
|
}
|
|
496
506
|
createLocalAttachment(t) {
|
|
497
|
-
const s =
|
|
507
|
+
const s = kt(), n = {
|
|
498
508
|
id: s,
|
|
499
509
|
name: t.name || "attachment",
|
|
500
510
|
mimeType: me(t),
|
|
@@ -508,7 +518,7 @@ class Ee {
|
|
|
508
518
|
mimeType: n.mimeType,
|
|
509
519
|
sizeBytes: n.sizeBytes,
|
|
510
520
|
blob: t,
|
|
511
|
-
origin:
|
|
521
|
+
origin: k().origin,
|
|
512
522
|
sessionId: this.state.sessionId ?? void 0,
|
|
513
523
|
createdAt: r,
|
|
514
524
|
lastUsedAt: r
|
|
@@ -539,24 +549,34 @@ class Ee {
|
|
|
539
549
|
name: t.name || "attachment",
|
|
540
550
|
mimeType: r,
|
|
541
551
|
sizeBytes: t.size,
|
|
542
|
-
page:
|
|
552
|
+
page: k(),
|
|
543
553
|
model: this.options.model,
|
|
544
554
|
metadata: ie(this.options.metadata),
|
|
545
555
|
entrySurface: this.options.entrySurface
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
556
|
+
};
|
|
557
|
+
let o;
|
|
558
|
+
if (this.options.persistAttachmentUpload)
|
|
559
|
+
o = await Q(
|
|
560
|
+
() => this.options.persistAttachmentUpload(i, t),
|
|
561
|
+
"Failed to upload attachment"
|
|
562
|
+
);
|
|
563
|
+
else {
|
|
564
|
+
const c = this.options.prepareAttachmentUpload ? await Q(
|
|
565
|
+
() => this.options.prepareAttachmentUpload(i),
|
|
566
|
+
"Failed to prepare attachment upload"
|
|
567
|
+
) : await this.prepareEmbedAttachmentUpload(i);
|
|
568
|
+
await Q(async () => {
|
|
569
|
+
const l = await fetch(new URL(c.uploadUrl, this.options.backendUrl), {
|
|
570
|
+
method: c.uploadMethod,
|
|
571
|
+
headers: c.uploadHeaders,
|
|
572
|
+
body: t
|
|
573
|
+
});
|
|
574
|
+
if (!l.ok)
|
|
575
|
+
throw new st("Failed to upload attachment", l.status);
|
|
576
|
+
return l;
|
|
577
|
+
}, "Failed to upload attachment"), o = c;
|
|
578
|
+
}
|
|
579
|
+
this.setState({ sessionId: o.sessionId });
|
|
560
580
|
const a = Ne(o.attachment, this.options.backendUrl);
|
|
561
581
|
return this.updateAttachmentInState(s.id, a), s.id && Ke(s.id, {
|
|
562
582
|
sessionId: o.sessionId,
|
|
@@ -584,7 +604,7 @@ class Ee {
|
|
|
584
604
|
}
|
|
585
605
|
async prepareEmbedAttachmentUpload(t) {
|
|
586
606
|
let s = !1;
|
|
587
|
-
return await
|
|
607
|
+
return await Q(async () => {
|
|
588
608
|
const n = await this.fetchEmbedAttachmentUpload(t);
|
|
589
609
|
if (n.ok)
|
|
590
610
|
return await n.json();
|
|
@@ -593,9 +613,9 @@ class Ee {
|
|
|
593
613
|
const r = await this.fetchEmbedAttachmentUpload(t);
|
|
594
614
|
if (r.ok)
|
|
595
615
|
return await r.json();
|
|
596
|
-
throw new
|
|
616
|
+
throw new st("Failed to prepare attachment upload", r.status);
|
|
597
617
|
}
|
|
598
|
-
throw new
|
|
618
|
+
throw new st("Failed to prepare attachment upload", n.status);
|
|
599
619
|
}, "Failed to prepare attachment upload");
|
|
600
620
|
}
|
|
601
621
|
async fetchEmbedAttachmentUpload(t) {
|
|
@@ -617,7 +637,7 @@ class Ee {
|
|
|
617
637
|
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && this.state.isThinking && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.cleanupSessionUserFilesApi(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, s && this.send({
|
|
618
638
|
type: "session.reset",
|
|
619
639
|
sessionId: this.state.sessionId ?? void 0,
|
|
620
|
-
page:
|
|
640
|
+
page: k()
|
|
621
641
|
}), this.setState({
|
|
622
642
|
sessionId: null,
|
|
623
643
|
starterPrompts: [...this.state.starterPrompts],
|
|
@@ -632,7 +652,7 @@ class Ee {
|
|
|
632
652
|
});
|
|
633
653
|
}
|
|
634
654
|
listSessions(t = {}) {
|
|
635
|
-
const s =
|
|
655
|
+
const s = kt(), n = new Promise((i, o) => {
|
|
636
656
|
const a = window.setTimeout(() => {
|
|
637
657
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
638
658
|
}, Rs);
|
|
@@ -640,7 +660,7 @@ class Ee {
|
|
|
640
660
|
}), r = {
|
|
641
661
|
type: "sessions.list",
|
|
642
662
|
requestId: s,
|
|
643
|
-
page:
|
|
663
|
+
page: k(),
|
|
644
664
|
...t.cursor ? { cursor: t.cursor } : {},
|
|
645
665
|
...t.limit ? { limit: t.limit } : {}
|
|
646
666
|
};
|
|
@@ -664,11 +684,11 @@ class Ee {
|
|
|
664
684
|
}), this.send({
|
|
665
685
|
type: "session.load",
|
|
666
686
|
sessionId: t,
|
|
667
|
-
page:
|
|
687
|
+
page: k()
|
|
668
688
|
});
|
|
669
689
|
}
|
|
670
690
|
send(t) {
|
|
671
|
-
this.sendNow(
|
|
691
|
+
this.sendNow(R(t)) || (this.queuedClientEvents.push(t), $(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
|
|
672
692
|
}
|
|
673
693
|
async getUploadToken() {
|
|
674
694
|
const t = this.options.token ?? await this.options.tokenProvider?.() ?? this.token ?? null;
|
|
@@ -696,7 +716,7 @@ class Ee {
|
|
|
696
716
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
697
717
|
const t = nn();
|
|
698
718
|
this.sendNow(
|
|
699
|
-
|
|
719
|
+
R({
|
|
700
720
|
type: "starter_prompts.page_context",
|
|
701
721
|
pageUrl: t.pageUrl,
|
|
702
722
|
pageTitle: t.pageTitle,
|
|
@@ -726,16 +746,19 @@ class Ee {
|
|
|
726
746
|
if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
|
|
727
747
|
return;
|
|
728
748
|
const t = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
|
|
729
|
-
|
|
749
|
+
$(this.options.clientId, this.queuedClientEvents);
|
|
730
750
|
for (let s = 0; s < t.length; s += 1) {
|
|
731
751
|
const n = t[s];
|
|
732
|
-
if (!this.sendNow(
|
|
733
|
-
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)),
|
|
752
|
+
if (!this.sendNow(R(n))) {
|
|
753
|
+
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), $(this.options.clientId, this.queuedClientEvents);
|
|
734
754
|
return;
|
|
735
755
|
}
|
|
736
|
-
|
|
756
|
+
$(this.options.clientId, this.queuedClientEvents);
|
|
737
757
|
}
|
|
738
758
|
}
|
|
759
|
+
flushPendingWarmupEvent() {
|
|
760
|
+
!this.pendingWarmupEvent || !this.sendNow(this.pendingWarmupEvent) || (this.pendingWarmupEvent = null);
|
|
761
|
+
}
|
|
739
762
|
handleServerEvent(t) {
|
|
740
763
|
if (t.type === "run.ack") {
|
|
741
764
|
this.handleRunAck(t);
|
|
@@ -746,7 +769,7 @@ class Ee {
|
|
|
746
769
|
return;
|
|
747
770
|
}
|
|
748
771
|
if (Os(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
749
|
-
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
|
|
772
|
+
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.flushPendingWarmupEvent(), this.startHeartbeat();
|
|
750
773
|
const s = gn(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
751
774
|
A("web-sdk.agent", "Received auth.ok appearance", {
|
|
752
775
|
hasAppearance: n,
|
|
@@ -760,7 +783,7 @@ class Ee {
|
|
|
760
783
|
(i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !an() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
761
784
|
type: "page.upsert",
|
|
762
785
|
sessionId: this.state.sessionId,
|
|
763
|
-
page:
|
|
786
|
+
page: k(),
|
|
764
787
|
model: this.options.model
|
|
765
788
|
});
|
|
766
789
|
return;
|
|
@@ -777,9 +800,9 @@ class Ee {
|
|
|
777
800
|
t.assistantDraft
|
|
778
801
|
), r = n !== void 0;
|
|
779
802
|
this.rememberUserMessageClientMessageIds(s);
|
|
780
|
-
const i =
|
|
803
|
+
const i = Wn(s);
|
|
781
804
|
if (i) {
|
|
782
|
-
const f =
|
|
805
|
+
const f = $n(s, i);
|
|
783
806
|
this.retryAttemptsByClientMessageId[i] = Math.max(
|
|
784
807
|
this.retryAttemptsByClientMessageId[i] ?? 0,
|
|
785
808
|
f
|
|
@@ -788,7 +811,7 @@ class Ee {
|
|
|
788
811
|
const o = s.filter((f) => {
|
|
789
812
|
const T = L(f);
|
|
790
813
|
return !he(T) && (!i || !Pt(T));
|
|
791
|
-
}), a =
|
|
814
|
+
}), a = xn(
|
|
792
815
|
this.state.messages,
|
|
793
816
|
An(o, this.options.backendUrl)
|
|
794
817
|
), c = de(a), l = !r && s.some(
|
|
@@ -858,7 +881,7 @@ class Ee {
|
|
|
858
881
|
const s = L(t.item);
|
|
859
882
|
if (Pt(s)) {
|
|
860
883
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
861
|
-
const r = E(t.item, "sessionId") ?? this.state.sessionId, i = s ?
|
|
884
|
+
const r = E(t.item, "sessionId") ?? this.state.sessionId, i = s ? x(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
862
885
|
if (r && a) {
|
|
863
886
|
this.retryAfterInterruptedRun(r, a);
|
|
864
887
|
return;
|
|
@@ -1162,7 +1185,7 @@ class Ee {
|
|
|
1162
1185
|
this.state.sessionId ? this.send({
|
|
1163
1186
|
type: "page.upsert",
|
|
1164
1187
|
sessionId: this.state.sessionId,
|
|
1165
|
-
page:
|
|
1188
|
+
page: k(),
|
|
1166
1189
|
model: this.options.model
|
|
1167
1190
|
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect());
|
|
1168
1191
|
}
|
|
@@ -1180,8 +1203,8 @@ class Ee {
|
|
|
1180
1203
|
callId: n,
|
|
1181
1204
|
toolName: r,
|
|
1182
1205
|
summary: i,
|
|
1183
|
-
rawInput:
|
|
1184
|
-
rawOutput:
|
|
1206
|
+
rawInput: R(o),
|
|
1207
|
+
rawOutput: R({
|
|
1185
1208
|
ok: !1,
|
|
1186
1209
|
toolName: r,
|
|
1187
1210
|
error: `Unsupported browser tool: ${r}`
|
|
@@ -1196,7 +1219,7 @@ class Ee {
|
|
|
1196
1219
|
callId: n,
|
|
1197
1220
|
toolName: r,
|
|
1198
1221
|
summary: i,
|
|
1199
|
-
rawInput:
|
|
1222
|
+
rawInput: R(o),
|
|
1200
1223
|
rawOutput: {
|
|
1201
1224
|
ok: !1,
|
|
1202
1225
|
toolName: r,
|
|
@@ -1213,7 +1236,7 @@ class Ee {
|
|
|
1213
1236
|
callId: n,
|
|
1214
1237
|
toolName: r,
|
|
1215
1238
|
summary: i,
|
|
1216
|
-
rawInput:
|
|
1239
|
+
rawInput: R(o),
|
|
1217
1240
|
rawOutput: null
|
|
1218
1241
|
},
|
|
1219
1242
|
startedAtMs: Date.now(),
|
|
@@ -1235,8 +1258,8 @@ class Ee {
|
|
|
1235
1258
|
callId: n,
|
|
1236
1259
|
toolName: r,
|
|
1237
1260
|
summary: o.summary,
|
|
1238
|
-
rawInput:
|
|
1239
|
-
rawOutput:
|
|
1261
|
+
rawInput: R(o),
|
|
1262
|
+
rawOutput: R(yn(d, l))
|
|
1240
1263
|
}), er(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1241
1264
|
}
|
|
1242
1265
|
setToolMessageLoading(t, s) {
|
|
@@ -1251,7 +1274,7 @@ class Ee {
|
|
|
1251
1274
|
if (this.pageLifecycleCleanup)
|
|
1252
1275
|
return;
|
|
1253
1276
|
const t = () => {
|
|
1254
|
-
|
|
1277
|
+
ve(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1255
1278
|
};
|
|
1256
1279
|
window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
|
|
1257
1280
|
window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
|
|
@@ -1272,7 +1295,7 @@ class Ee {
|
|
|
1272
1295
|
return t.ok === !1 ? Tn(t) : null;
|
|
1273
1296
|
}
|
|
1274
1297
|
enableNetworkCapture() {
|
|
1275
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
1298
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = xs((t) => {
|
|
1276
1299
|
mr(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
|
|
1277
1300
|
}));
|
|
1278
1301
|
}
|
|
@@ -1283,7 +1306,7 @@ class Ee {
|
|
|
1283
1306
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
1284
1307
|
type: "network.batch",
|
|
1285
1308
|
sessionId: this.state.sessionId ?? void 0,
|
|
1286
|
-
page:
|
|
1309
|
+
page: k(),
|
|
1287
1310
|
events: s
|
|
1288
1311
|
});
|
|
1289
1312
|
}, bs)));
|
|
@@ -1340,8 +1363,8 @@ class Ee {
|
|
|
1340
1363
|
this.listeners[t]?.forEach((r) => r(s));
|
|
1341
1364
|
}
|
|
1342
1365
|
}
|
|
1343
|
-
const
|
|
1344
|
-
function
|
|
1366
|
+
const Et = /* @__PURE__ */ new WeakMap();
|
|
1367
|
+
function xs(e) {
|
|
1345
1368
|
const t = window.__plunoProductAgentNetworkCapture ?? Ns();
|
|
1346
1369
|
return t.subscribers.add(e), () => {
|
|
1347
1370
|
t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
|
|
@@ -1364,11 +1387,11 @@ function Ns() {
|
|
|
1364
1387
|
throw T;
|
|
1365
1388
|
}
|
|
1366
1389
|
try {
|
|
1367
|
-
const T = m instanceof Request ? m : null,
|
|
1368
|
-
if (!N(
|
|
1390
|
+
const T = m instanceof Request ? m : null, v = dr(m, T), I = Oe(u?.headers ?? T?.headers);
|
|
1391
|
+
if (!N(v, I, u?.body)) {
|
|
1369
1392
|
const H = {
|
|
1370
|
-
requestId:
|
|
1371
|
-
url: C(
|
|
1393
|
+
requestId: Rt("fetch"),
|
|
1394
|
+
url: C(v, St),
|
|
1372
1395
|
method: (u?.method ?? T?.method ?? "GET").toUpperCase(),
|
|
1373
1396
|
requestHeaders: I,
|
|
1374
1397
|
requestBody: ye(u?.body),
|
|
@@ -1376,19 +1399,19 @@ function Ns() {
|
|
|
1376
1399
|
startedAt: new Date(h).toISOString()
|
|
1377
1400
|
};
|
|
1378
1401
|
f.then(
|
|
1379
|
-
(
|
|
1380
|
-
hr(
|
|
1402
|
+
(_) => {
|
|
1403
|
+
hr(_, H, h, t).catch(() => {
|
|
1381
1404
|
t({
|
|
1382
1405
|
...H,
|
|
1383
|
-
responseStatus:
|
|
1406
|
+
responseStatus: _.status,
|
|
1384
1407
|
durationMs: Date.now() - h
|
|
1385
1408
|
});
|
|
1386
1409
|
});
|
|
1387
1410
|
},
|
|
1388
|
-
(
|
|
1411
|
+
(_) => {
|
|
1389
1412
|
t({
|
|
1390
1413
|
...H,
|
|
1391
|
-
errorText: C(
|
|
1414
|
+
errorText: C(_ instanceof Error ? _.message : String(_)),
|
|
1392
1415
|
durationMs: Date.now() - h
|
|
1393
1416
|
});
|
|
1394
1417
|
}
|
|
@@ -1398,22 +1421,22 @@ function Ns() {
|
|
|
1398
1421
|
}
|
|
1399
1422
|
return f;
|
|
1400
1423
|
}, a = function(m, u, h, f, T) {
|
|
1401
|
-
const
|
|
1402
|
-
return
|
|
1403
|
-
requestId:
|
|
1424
|
+
const v = n.call(this, m, u, h ?? !0, f ?? void 0, T ?? void 0), I = typeof u == "string" ? u : u.toString();
|
|
1425
|
+
return Et.set(this, {
|
|
1426
|
+
requestId: Rt("xhr"),
|
|
1404
1427
|
method: String(m ?? "GET").toUpperCase(),
|
|
1405
|
-
url: C(I,
|
|
1428
|
+
url: C(I, St),
|
|
1406
1429
|
requestHeaders: {},
|
|
1407
1430
|
startedAtMs: Date.now(),
|
|
1408
1431
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1409
1432
|
excluded: N(I)
|
|
1410
|
-
}),
|
|
1433
|
+
}), v;
|
|
1411
1434
|
}, c = function(m, u) {
|
|
1412
|
-
const h = r.call(this, m, u), f =
|
|
1435
|
+
const h = r.call(this, m, u), f = Et.get(this);
|
|
1413
1436
|
return f && Object.keys(f.requestHeaders).length < Bt && (f.requestHeaders[m] = jt(m, u), f.excluded = f.excluded || N(f.url, f.requestHeaders)), h;
|
|
1414
1437
|
}, l = function(m) {
|
|
1415
1438
|
try {
|
|
1416
|
-
const u =
|
|
1439
|
+
const u = Et.get(this);
|
|
1417
1440
|
u && (u.excluded = u.excluded || N(u.url, u.requestHeaders, m), u.requestBody = ye(m), u.excluded || this.addEventListener(
|
|
1418
1441
|
"loadend",
|
|
1419
1442
|
() => {
|
|
@@ -1470,8 +1493,8 @@ function Ns() {
|
|
|
1470
1493
|
continue;
|
|
1471
1494
|
const h = performance.timeOrigin + u.startTime;
|
|
1472
1495
|
t({
|
|
1473
|
-
requestId:
|
|
1474
|
-
url: C(u.name,
|
|
1496
|
+
requestId: Rt("resource"),
|
|
1497
|
+
url: C(u.name, St),
|
|
1475
1498
|
method: "GET",
|
|
1476
1499
|
resourceType: "resource",
|
|
1477
1500
|
responseStatus: u.responseStatus,
|
|
@@ -1542,7 +1565,7 @@ function qs(e) {
|
|
|
1542
1565
|
}
|
|
1543
1566
|
function Hs(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
1544
1567
|
const n = [
|
|
1545
|
-
|
|
1568
|
+
Ws(),
|
|
1546
1569
|
Fs()
|
|
1547
1570
|
].filter((r) => typeof r == "function");
|
|
1548
1571
|
return () => {
|
|
@@ -1553,12 +1576,12 @@ function Hs(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1553
1576
|
function Fs() {
|
|
1554
1577
|
return Ie(globalThis, "getPageSnapshot", async () => qt());
|
|
1555
1578
|
}
|
|
1556
|
-
function
|
|
1579
|
+
function Ws() {
|
|
1557
1580
|
return Ie(globalThis, "pageImages", {
|
|
1558
|
-
inspectImage: async (t, s) => await
|
|
1581
|
+
inspectImage: async (t, s) => await $s(t, s)
|
|
1559
1582
|
});
|
|
1560
1583
|
}
|
|
1561
|
-
async function
|
|
1584
|
+
async function $s(e, t = {}) {
|
|
1562
1585
|
const s = Xs(t.name), n = await js(e);
|
|
1563
1586
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
1564
1587
|
type: "pluno.pageImages.inspectImage",
|
|
@@ -1763,7 +1786,7 @@ function sn(e) {
|
|
|
1763
1786
|
const t = new URL("/api/product-agent/embed/ws", e);
|
|
1764
1787
|
return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
|
|
1765
1788
|
}
|
|
1766
|
-
function
|
|
1789
|
+
function k() {
|
|
1767
1790
|
const e = _e();
|
|
1768
1791
|
return {
|
|
1769
1792
|
url: location.href,
|
|
@@ -1780,13 +1803,13 @@ function nn() {
|
|
|
1780
1803
|
};
|
|
1781
1804
|
}
|
|
1782
1805
|
function rn(e) {
|
|
1783
|
-
return
|
|
1784
|
-
|
|
1806
|
+
return et.add(e), Y || (Y = on()), () => {
|
|
1807
|
+
et.delete(e), et.size === 0 && (Y?.(), Y = null);
|
|
1785
1808
|
};
|
|
1786
1809
|
}
|
|
1787
1810
|
function on() {
|
|
1788
1811
|
const e = () => {
|
|
1789
|
-
for (const i of Array.from(
|
|
1812
|
+
for (const i of Array.from(et))
|
|
1790
1813
|
i();
|
|
1791
1814
|
}, t = window.history.pushState.bind(window.history), s = window.history.replaceState.bind(window.history), n = ((...i) => {
|
|
1792
1815
|
const o = t(...i);
|
|
@@ -1814,9 +1837,9 @@ function qt() {
|
|
|
1814
1837
|
(h) => be(h) && !h.parentElement?.closest(n)
|
|
1815
1838
|
);
|
|
1816
1839
|
for (const h of r.slice(0, 3))
|
|
1817
|
-
s("Active overlay",
|
|
1818
|
-
const i = cn(), o = i ?
|
|
1819
|
-
s("Main page content", o), s("Additional visible page text",
|
|
1840
|
+
s("Active overlay", bt(j(h), t));
|
|
1841
|
+
const i = cn(), o = i ? bt(j(i), t) : "";
|
|
1842
|
+
s("Main page content", o), s("Additional visible page text", bt(j(document.body), t));
|
|
1820
1843
|
const a = e.map(([h, f]) => `${h}:
|
|
1821
1844
|
${f}`).join(`
|
|
1822
1845
|
|
|
@@ -1838,7 +1861,7 @@ function B(e) {
|
|
|
1838
1861
|
|
|
1839
1862
|
`).trim();
|
|
1840
1863
|
}
|
|
1841
|
-
function
|
|
1864
|
+
function bt(e, t) {
|
|
1842
1865
|
let s = B(e);
|
|
1843
1866
|
for (const n of t)
|
|
1844
1867
|
s = s.replace(n, "");
|
|
@@ -1941,67 +1964,67 @@ function ln(e, t) {
|
|
|
1941
1964
|
const U = I.getAttribute("data-testid") || I.getAttribute("data-test") || I.getAttribute("data-qa") || I.getAttribute("data-cy") || "";
|
|
1942
1965
|
return `${I.tagName.toLowerCase()}|${u(I)}|${U}`;
|
|
1943
1966
|
}, f = (I, U, H) => {
|
|
1944
|
-
const
|
|
1945
|
-
const b = S.tagName.toLowerCase(),
|
|
1946
|
-
if (m >= 1e3 && !z || H.has(S) || i.has(b) || S.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") ||
|
|
1967
|
+
const _ = (S, lt) => {
|
|
1968
|
+
const b = S.tagName.toLowerCase(), ut = window.getComputedStyle(S), z = d.has(S);
|
|
1969
|
+
if (m >= 1e3 && !z || H.has(S) || i.has(b) || S.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ut.display === "none" || ut.visibility === "hidden")
|
|
1947
1970
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
1948
1971
|
m += 1;
|
|
1949
|
-
const zt = u(S), G = Re(S), je = a.has(zt) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(b) || b === "a" && S.hasAttribute("href"),
|
|
1950
|
-
for (const g of
|
|
1972
|
+
const zt = u(S), G = Re(S), je = a.has(zt) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(b) || b === "a" && S.hasAttribute("href"), dt = Array.from(S.children).filter((g) => g instanceof HTMLElement), X = /* @__PURE__ */ new Map();
|
|
1973
|
+
for (const g of dt) {
|
|
1951
1974
|
const w = h(g);
|
|
1952
1975
|
X.set(w, (X.get(w) ?? 0) + 1);
|
|
1953
1976
|
}
|
|
1954
|
-
const
|
|
1955
|
-
for (const g of
|
|
1977
|
+
const ht = /* @__PURE__ */ new Map(), Gt = /* @__PURE__ */ new Map();
|
|
1978
|
+
for (const g of dt) {
|
|
1956
1979
|
const w = h(g), D = Gt.get(w) ?? 0;
|
|
1957
|
-
Gt.set(w, D + 1), (X.get(w) ?? 0) > 8 && D >= 6 && !d.has(g) &&
|
|
1980
|
+
Gt.set(w, D + 1), (X.get(w) ?? 0) > 8 && D >= 6 && !d.has(g) && ht.set(w, (ht.get(w) ?? 0) + 1);
|
|
1958
1981
|
}
|
|
1959
|
-
const Xt = /* @__PURE__ */ new Map(), Kt = /* @__PURE__ */ new Set(),
|
|
1960
|
-
for (const g of
|
|
1982
|
+
const Xt = /* @__PURE__ */ new Map(), Kt = /* @__PURE__ */ new Set(), pt = [], Jt = [];
|
|
1983
|
+
for (const g of dt) {
|
|
1961
1984
|
const w = h(g), D = X.get(w) ?? 0, Zt = Xt.get(w) ?? 0;
|
|
1962
1985
|
if (Xt.set(w, Zt + 1), D > 8 && Zt >= 6 && !d.has(g)) {
|
|
1963
|
-
Kt.has(w) || (
|
|
1986
|
+
Kt.has(w) || (pt.push([`… ${ht.get(w) ?? 0} similar siblings omitted`]), Kt.add(w));
|
|
1964
1987
|
continue;
|
|
1965
1988
|
}
|
|
1966
|
-
const Qt =
|
|
1967
|
-
Jt.push(Qt),
|
|
1989
|
+
const Qt = _(g, lt);
|
|
1990
|
+
Jt.push(Qt), pt.push(Qt.lines);
|
|
1968
1991
|
}
|
|
1969
|
-
const
|
|
1992
|
+
const ft = [];
|
|
1970
1993
|
if (S.shadowRoot)
|
|
1971
1994
|
for (const g of Array.from(S.shadowRoot.children))
|
|
1972
|
-
g instanceof HTMLElement &&
|
|
1973
|
-
const K = [...Jt, ...
|
|
1995
|
+
g instanceof HTMLElement && ft.push(_(g, lt + 1));
|
|
1996
|
+
const K = [...Jt, ...ft], gt = G.length > 0 || je || K.some((g) => g.hasUsefulContent), Vt = B(
|
|
1974
1997
|
[G, ...K.map((g) => g.textPreview)].filter(Boolean).join(" ")
|
|
1975
|
-
).slice(0, 180), ze = S.hasAttribute("contenteditable") && (G.length > 0 || !S.querySelector("[contenteditable]")), Yt = l.some((g) => S.hasAttribute(g)) || !!zt || ze,
|
|
1976
|
-
if (
|
|
1998
|
+
).slice(0, 180), ze = S.hasAttribute("contenteditable") && (G.length > 0 || !S.querySelector("[contenteditable]")), Yt = l.some((g) => S.hasAttribute(g)) || !!zt || ze, mt = (S.getClientRects().length > 0 || ut.display === "contents") && (s.has(b) || Yt || z) && (gt || z) && (!r.has(b) || gt || Yt || z), yt = mt ? 1 : 0, F = [];
|
|
1999
|
+
if (mt) {
|
|
1977
2000
|
const g = K.some((D) => D.containsTextElement), w = n.has(b) && !g ? Vt : G;
|
|
1978
2001
|
F.push(ke(S, c, o, w.slice(0, 180)));
|
|
1979
2002
|
}
|
|
1980
|
-
for (const g of
|
|
1981
|
-
F.push(...Z(g,
|
|
1982
|
-
const
|
|
1983
|
-
if (
|
|
1984
|
-
const g =
|
|
1985
|
-
|
|
2003
|
+
for (const g of pt)
|
|
2004
|
+
F.push(...Z(g, yt));
|
|
2005
|
+
const Tt = ft.flatMap((g) => g.lines);
|
|
2006
|
+
if (Tt.length > 0) {
|
|
2007
|
+
const g = Tt.slice(0, 20);
|
|
2008
|
+
Tt.length > g.length && g.push("… shadow DOM omitted");
|
|
1986
2009
|
const w = b.includes("tooltip") || b.includes("popper") || b.includes("loader");
|
|
1987
|
-
if (
|
|
1988
|
-
const D =
|
|
1989
|
-
F.push(...Z([D, ...Z(g, 1)],
|
|
2010
|
+
if (lt < 2 && !w) {
|
|
2011
|
+
const D = mt ? "#shadow-root" : `${b} #shadow-root`;
|
|
2012
|
+
F.push(...Z([D, ...Z(g, 1)], yt));
|
|
1990
2013
|
} else
|
|
1991
|
-
F.push(...Z(g,
|
|
2014
|
+
F.push(...Z(g, yt));
|
|
1992
2015
|
}
|
|
1993
2016
|
return {
|
|
1994
2017
|
lines: F,
|
|
1995
|
-
hasUsefulContent:
|
|
2018
|
+
hasUsefulContent: gt,
|
|
1996
2019
|
textPreview: Vt,
|
|
1997
2020
|
containsTextElement: n.has(b) || K.some((g) => g.containsTextElement)
|
|
1998
2021
|
};
|
|
1999
2022
|
};
|
|
2000
|
-
return [`--- ${U} ---`, ...
|
|
2023
|
+
return [`--- ${U} ---`, ..._(I, 0).lines].join(`
|
|
2001
2024
|
`);
|
|
2002
|
-
}, T = [],
|
|
2003
|
-
|
|
2004
|
-
${JSON.stringify(
|
|
2025
|
+
}, T = [], v = B(window.getSelection()?.toString() ?? "");
|
|
2026
|
+
v && T.push(`--- selected text ---
|
|
2027
|
+
${JSON.stringify(v)}`), p.length > 0 && T.push(dn(p, s, c, o));
|
|
2005
2028
|
for (const I of e.slice(0, 3))
|
|
2006
2029
|
T.push(f(I, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
2007
2030
|
if (t && T.push(f(t, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -2200,7 +2223,7 @@ function In() {
|
|
|
2200
2223
|
const s = crypto.randomUUID();
|
|
2201
2224
|
return window.localStorage.setItem(e, s), s;
|
|
2202
2225
|
}
|
|
2203
|
-
function
|
|
2226
|
+
function kt() {
|
|
2204
2227
|
return crypto.randomUUID();
|
|
2205
2228
|
}
|
|
2206
2229
|
function wn(e) {
|
|
@@ -2216,7 +2239,7 @@ function wn(e) {
|
|
|
2216
2239
|
}
|
|
2217
2240
|
function An(e, t) {
|
|
2218
2241
|
return Array.isArray(e) ? Dt(
|
|
2219
|
-
|
|
2242
|
+
vt(
|
|
2220
2243
|
e.map((s) => Me(s, t)).filter((s) => s !== null)
|
|
2221
2244
|
)
|
|
2222
2245
|
) : [];
|
|
@@ -2261,9 +2284,9 @@ function Me(e, t) {
|
|
|
2261
2284
|
t
|
|
2262
2285
|
),
|
|
2263
2286
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2264
|
-
respondsToUserMessageId:
|
|
2287
|
+
respondsToUserMessageId: x(r) ?? void 0,
|
|
2265
2288
|
...M(r) ? { runId: M(r) } : {},
|
|
2266
|
-
attachments:
|
|
2289
|
+
attachments: xe(r.attachments, t)
|
|
2267
2290
|
};
|
|
2268
2291
|
return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
2269
2292
|
value: r.id,
|
|
@@ -2280,7 +2303,7 @@ function Me(e, t) {
|
|
|
2280
2303
|
role: "tool",
|
|
2281
2304
|
content: `Connect ${i.appName} to continue`,
|
|
2282
2305
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2283
|
-
respondsToUserMessageId:
|
|
2306
|
+
respondsToUserMessageId: x(r) ?? void 0,
|
|
2284
2307
|
...M(r) ? { runId: M(r) } : {},
|
|
2285
2308
|
dataType: "function_call_output",
|
|
2286
2309
|
toolName: "authenticate_pipedream_app",
|
|
@@ -2293,7 +2316,7 @@ function Me(e, t) {
|
|
|
2293
2316
|
role: "tool",
|
|
2294
2317
|
content: r.type === "mcp_call" ? En(r) : Rn(r),
|
|
2295
2318
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2296
|
-
respondsToUserMessageId:
|
|
2319
|
+
respondsToUserMessageId: x(r) ?? void 0,
|
|
2297
2320
|
...M(r) ? { runId: M(r) } : {},
|
|
2298
2321
|
dataType: String(r.type),
|
|
2299
2322
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
@@ -2304,7 +2327,7 @@ function Me(e, t) {
|
|
|
2304
2327
|
role: "system",
|
|
2305
2328
|
content: kn(r),
|
|
2306
2329
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2307
|
-
respondsToUserMessageId:
|
|
2330
|
+
respondsToUserMessageId: x(r) ?? void 0,
|
|
2308
2331
|
...M(r) ? { runId: M(r) } : {},
|
|
2309
2332
|
dataType: String(r.type),
|
|
2310
2333
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
@@ -2395,16 +2418,16 @@ function Cn(e) {
|
|
|
2395
2418
|
}).filter(Boolean).join("") : "";
|
|
2396
2419
|
}
|
|
2397
2420
|
function Ce(e, t) {
|
|
2398
|
-
const s = Pe(e, t), n =
|
|
2421
|
+
const s = Pe(e, t), n = vn(
|
|
2399
2422
|
Ln(e, t),
|
|
2400
2423
|
s
|
|
2401
2424
|
), r = n.findIndex((o) => o.id === s.id);
|
|
2402
2425
|
if (r === -1)
|
|
2403
2426
|
return Dt(
|
|
2404
|
-
|
|
2427
|
+
vt([...n, s])
|
|
2405
2428
|
);
|
|
2406
2429
|
const i = [...n];
|
|
2407
|
-
return i[r] = s, Dt(
|
|
2430
|
+
return i[r] = s, Dt(vt(i));
|
|
2408
2431
|
}
|
|
2409
2432
|
function Pn(e, t) {
|
|
2410
2433
|
const s = e.findIndex(
|
|
@@ -2441,7 +2464,7 @@ function Dn(e) {
|
|
|
2441
2464
|
loading: !0
|
|
2442
2465
|
};
|
|
2443
2466
|
}
|
|
2444
|
-
function
|
|
2467
|
+
function vn(e, t) {
|
|
2445
2468
|
if (t.id.startsWith("transient-activity:"))
|
|
2446
2469
|
return e;
|
|
2447
2470
|
const s = t.toolName === "tab_lifecycle";
|
|
@@ -2449,7 +2472,7 @@ function xn(e, t) {
|
|
|
2449
2472
|
(n) => !(n.id === `transient-activity:${t.callId}` && n.callId === t.callId || s && n.id.startsWith("transient-activity:") && n.toolName === "browser_tabs" && n.runId === t.runId && n.respondsToUserMessageId === t.respondsToUserMessageId)
|
|
2450
2473
|
);
|
|
2451
2474
|
}
|
|
2452
|
-
function
|
|
2475
|
+
function xn(e, t) {
|
|
2453
2476
|
const s = t.map(
|
|
2454
2477
|
(n) => Pe(e, n)
|
|
2455
2478
|
);
|
|
@@ -2533,7 +2556,7 @@ function De(e) {
|
|
|
2533
2556
|
function qn(e) {
|
|
2534
2557
|
return q(e) ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
|
|
2535
2558
|
}
|
|
2536
|
-
function
|
|
2559
|
+
function ot(e) {
|
|
2537
2560
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
2538
2561
|
const s = e[t];
|
|
2539
2562
|
if (!s || typeof s != "object")
|
|
@@ -2548,7 +2571,7 @@ function it(e) {
|
|
|
2548
2571
|
return null;
|
|
2549
2572
|
}
|
|
2550
2573
|
function Hn(e) {
|
|
2551
|
-
const t =
|
|
2574
|
+
const t = ot(e);
|
|
2552
2575
|
if (t === null)
|
|
2553
2576
|
return null;
|
|
2554
2577
|
const n = L(e[t])?.page;
|
|
@@ -2570,7 +2593,7 @@ function he(e) {
|
|
|
2570
2593
|
return e?.type === "run_status" && e.status === "interrupted" && e.reason === "backend_restart";
|
|
2571
2594
|
}
|
|
2572
2595
|
function Fn(e, t) {
|
|
2573
|
-
const s =
|
|
2596
|
+
const s = ot(t);
|
|
2574
2597
|
if (s === null)
|
|
2575
2598
|
return !1;
|
|
2576
2599
|
const n = t[s], r = n && typeof n == "object" ? n.id : null;
|
|
@@ -2580,7 +2603,7 @@ function Fn(e, t) {
|
|
|
2580
2603
|
return i === -1 ? !1 : e.slice(i + 1).some(qn);
|
|
2581
2604
|
}
|
|
2582
2605
|
function Ut(e) {
|
|
2583
|
-
const t =
|
|
2606
|
+
const t = ot(e);
|
|
2584
2607
|
if (t === null)
|
|
2585
2608
|
return null;
|
|
2586
2609
|
const s = e[t];
|
|
@@ -2592,8 +2615,8 @@ function Ut(e) {
|
|
|
2592
2615
|
const r = n.clientMessageId;
|
|
2593
2616
|
return typeof r == "string" ? r : null;
|
|
2594
2617
|
}
|
|
2595
|
-
function
|
|
2596
|
-
const t =
|
|
2618
|
+
function Wn(e) {
|
|
2619
|
+
const t = ot(e);
|
|
2597
2620
|
if (t === null)
|
|
2598
2621
|
return null;
|
|
2599
2622
|
for (let s = e.length - 1; s > t; s -= 1) {
|
|
@@ -2616,13 +2639,13 @@ function $n(e) {
|
|
|
2616
2639
|
function pe(e, t) {
|
|
2617
2640
|
if (typeof t.clientMessageId == "string")
|
|
2618
2641
|
return t.clientMessageId;
|
|
2619
|
-
const s =
|
|
2642
|
+
const s = x(t);
|
|
2620
2643
|
if (!s)
|
|
2621
2644
|
return null;
|
|
2622
2645
|
const n = e.find((i) => E(i, "id") === s), r = L(n);
|
|
2623
2646
|
return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
|
|
2624
2647
|
}
|
|
2625
|
-
function
|
|
2648
|
+
function $n(e, t) {
|
|
2626
2649
|
let s = 0;
|
|
2627
2650
|
for (const n of e) {
|
|
2628
2651
|
if (!n || typeof n != "object")
|
|
@@ -2639,7 +2662,7 @@ function fe(e, t, s, n, r) {
|
|
|
2639
2662
|
if (!t || !jn(e))
|
|
2640
2663
|
return !1;
|
|
2641
2664
|
const i = e;
|
|
2642
|
-
return !(Pt(i) || s !== null && typeof i.id == "string" && i.id !== s || n !== null &&
|
|
2665
|
+
return !(Pt(i) || s !== null && typeof i.id == "string" && i.id !== s || n !== null && x(i) !== n || r !== null && M(i) !== r);
|
|
2643
2666
|
}
|
|
2644
2667
|
function jn(e) {
|
|
2645
2668
|
if (!e || typeof e != "object")
|
|
@@ -2665,7 +2688,7 @@ function Gn(e) {
|
|
|
2665
2688
|
function Ft(e) {
|
|
2666
2689
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2667
2690
|
}
|
|
2668
|
-
function
|
|
2691
|
+
function vt(e) {
|
|
2669
2692
|
const t = new Set(e.filter((i) => i.role === "user").map((i) => i.id)), s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
|
|
2670
2693
|
for (const i of e) {
|
|
2671
2694
|
if (i.role === "user" || !i.respondsToUserMessageId || !t.has(i.respondsToUserMessageId))
|
|
@@ -2687,7 +2710,7 @@ function Xn(e, t) {
|
|
|
2687
2710
|
const r = e[n];
|
|
2688
2711
|
if (r.role === "user")
|
|
2689
2712
|
return !1;
|
|
2690
|
-
if (r.role === "assistant" &&
|
|
2713
|
+
if (r.role === "assistant" && at(s, r))
|
|
2691
2714
|
return !0;
|
|
2692
2715
|
}
|
|
2693
2716
|
return !1;
|
|
@@ -2708,25 +2731,25 @@ function Kn(e, t) {
|
|
|
2708
2731
|
function Jn(e, t) {
|
|
2709
2732
|
const s = e[t];
|
|
2710
2733
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2711
|
-
if (e[n].role === "assistant" &&
|
|
2734
|
+
if (e[n].role === "assistant" && at(s, e[n]))
|
|
2712
2735
|
return !0;
|
|
2713
2736
|
return !1;
|
|
2714
2737
|
}
|
|
2715
2738
|
function Vn(e, t) {
|
|
2716
2739
|
const s = e[t];
|
|
2717
2740
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2718
|
-
if (e[n].role === "tool" &&
|
|
2741
|
+
if (e[n].role === "tool" && at(s, e[n]))
|
|
2719
2742
|
return !0;
|
|
2720
2743
|
return !1;
|
|
2721
2744
|
}
|
|
2722
2745
|
function Yn(e, t) {
|
|
2723
2746
|
const s = e[t];
|
|
2724
2747
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2725
|
-
if (Ft(e[n]) &&
|
|
2748
|
+
if (Ft(e[n]) && at(s, e[n]))
|
|
2726
2749
|
return !0;
|
|
2727
2750
|
return !1;
|
|
2728
2751
|
}
|
|
2729
|
-
function
|
|
2752
|
+
function at(e, t) {
|
|
2730
2753
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
2731
2754
|
}
|
|
2732
2755
|
function E(e, t) {
|
|
@@ -2768,14 +2791,14 @@ function tr(e) {
|
|
|
2768
2791
|
if (!t)
|
|
2769
2792
|
return [];
|
|
2770
2793
|
const s = JSON.parse(t);
|
|
2771
|
-
return Array.isArray(s) ? s.filter(
|
|
2794
|
+
return Array.isArray(s) ? s.filter(Wt) : [];
|
|
2772
2795
|
} catch {
|
|
2773
2796
|
return [];
|
|
2774
2797
|
}
|
|
2775
2798
|
}
|
|
2776
|
-
function
|
|
2799
|
+
function $(e, t) {
|
|
2777
2800
|
try {
|
|
2778
|
-
const s = t.filter(
|
|
2801
|
+
const s = t.filter(Wt);
|
|
2779
2802
|
if (s.length === 0) {
|
|
2780
2803
|
window.localStorage.removeItem(`${Ct}${e}`);
|
|
2781
2804
|
return;
|
|
@@ -2788,9 +2811,9 @@ function W(e, t) {
|
|
|
2788
2811
|
return;
|
|
2789
2812
|
}
|
|
2790
2813
|
}
|
|
2791
|
-
function
|
|
2814
|
+
function ve(e, t) {
|
|
2792
2815
|
try {
|
|
2793
|
-
const s = `${
|
|
2816
|
+
const s = `${it}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
|
|
2794
2817
|
...o,
|
|
2795
2818
|
storedAt: Date.now(),
|
|
2796
2819
|
unloadUrl: n,
|
|
@@ -2806,22 +2829,22 @@ function xe(e, t) {
|
|
|
2806
2829
|
}
|
|
2807
2830
|
function er(e, t) {
|
|
2808
2831
|
try {
|
|
2809
|
-
if (window.sessionStorage.getItem(`${
|
|
2832
|
+
if (window.sessionStorage.getItem(`${it}${e}`) === null)
|
|
2810
2833
|
return;
|
|
2811
2834
|
} catch {
|
|
2812
2835
|
return;
|
|
2813
2836
|
}
|
|
2814
|
-
|
|
2837
|
+
ve(e, t);
|
|
2815
2838
|
}
|
|
2816
2839
|
function sr(e) {
|
|
2817
2840
|
try {
|
|
2818
|
-
const t = `${
|
|
2841
|
+
const t = `${it}${e}`, s = window.sessionStorage.getItem(t);
|
|
2819
2842
|
if (window.sessionStorage.removeItem(t), !s)
|
|
2820
2843
|
return [];
|
|
2821
2844
|
const n = JSON.parse(s);
|
|
2822
2845
|
return Array.isArray(n) ? n.flatMap((r) => rr(r) ? [{
|
|
2823
2846
|
...r.event,
|
|
2824
|
-
page:
|
|
2847
|
+
page: k(),
|
|
2825
2848
|
rawOutput: {
|
|
2826
2849
|
pageContextRestarted: !0,
|
|
2827
2850
|
outcome: "unknown",
|
|
@@ -2850,7 +2873,7 @@ function rr(e) {
|
|
|
2850
2873
|
if (!e || typeof e != "object")
|
|
2851
2874
|
return !1;
|
|
2852
2875
|
const t = e, s = t.event;
|
|
2853
|
-
return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" &&
|
|
2876
|
+
return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && Wt(s) && s.type === "tool.result";
|
|
2854
2877
|
}
|
|
2855
2878
|
function ir(e, t) {
|
|
2856
2879
|
const s = new Set(
|
|
@@ -2863,12 +2886,12 @@ function ir(e, t) {
|
|
|
2863
2886
|
}
|
|
2864
2887
|
function or(e) {
|
|
2865
2888
|
try {
|
|
2866
|
-
window.sessionStorage.removeItem(`${
|
|
2889
|
+
window.sessionStorage.removeItem(`${it}${e}`);
|
|
2867
2890
|
} catch {
|
|
2868
2891
|
return;
|
|
2869
2892
|
}
|
|
2870
2893
|
}
|
|
2871
|
-
function
|
|
2894
|
+
function Wt(e) {
|
|
2872
2895
|
if (!e || typeof e != "object")
|
|
2873
2896
|
return !1;
|
|
2874
2897
|
const t = e;
|
|
@@ -2880,7 +2903,7 @@ function ge(e) {
|
|
|
2880
2903
|
const t = e;
|
|
2881
2904
|
return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
|
|
2882
2905
|
}
|
|
2883
|
-
function
|
|
2906
|
+
function xe(e, t) {
|
|
2884
2907
|
if (!Array.isArray(e))
|
|
2885
2908
|
return;
|
|
2886
2909
|
const s = e.filter((r) => {
|
|
@@ -2917,17 +2940,17 @@ function cr(e) {
|
|
|
2917
2940
|
...typeof t.runId == "string" ? { runId: t.runId } : {},
|
|
2918
2941
|
dataType: typeof t.dataType == "string" ? t.dataType : void 0,
|
|
2919
2942
|
securitySettingsUrl: typeof t.securitySettingsUrl == "string" ? t.securitySettingsUrl : void 0,
|
|
2920
|
-
attachments:
|
|
2943
|
+
attachments: xe(t.attachments)?.map($t),
|
|
2921
2944
|
loading: typeof t.loading == "boolean" ? t.loading : void 0
|
|
2922
2945
|
};
|
|
2923
2946
|
}
|
|
2924
2947
|
function lr(e) {
|
|
2925
2948
|
return e.attachments?.length ? {
|
|
2926
2949
|
...e,
|
|
2927
|
-
attachments: e.attachments.map(
|
|
2950
|
+
attachments: e.attachments.map($t)
|
|
2928
2951
|
} : e;
|
|
2929
2952
|
}
|
|
2930
|
-
function
|
|
2953
|
+
function $t(e) {
|
|
2931
2954
|
const {
|
|
2932
2955
|
dataUrl: t,
|
|
2933
2956
|
objectUrl: s,
|
|
@@ -2936,7 +2959,7 @@ function Wt(e) {
|
|
|
2936
2959
|
} = e;
|
|
2937
2960
|
return r;
|
|
2938
2961
|
}
|
|
2939
|
-
function
|
|
2962
|
+
function x(e) {
|
|
2940
2963
|
const t = e.respondsToUserMessageId;
|
|
2941
2964
|
return typeof t == "string" && t ? t : null;
|
|
2942
2965
|
}
|
|
@@ -2960,7 +2983,7 @@ function Oe(e) {
|
|
|
2960
2983
|
return t;
|
|
2961
2984
|
}
|
|
2962
2985
|
function jt(e, t) {
|
|
2963
|
-
return
|
|
2986
|
+
return We(e) ? ct : C(rt(t), Ms);
|
|
2964
2987
|
}
|
|
2965
2988
|
function dr(e, t) {
|
|
2966
2989
|
return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
|
|
@@ -3020,7 +3043,7 @@ function ye(e) {
|
|
|
3020
3043
|
return C(e);
|
|
3021
3044
|
}
|
|
3022
3045
|
function gr(e) {
|
|
3023
|
-
return
|
|
3046
|
+
return R({
|
|
3024
3047
|
...e,
|
|
3025
3048
|
requestBody: Te(e.requestBody),
|
|
3026
3049
|
responseBody: Te(e.responseBody)
|
|
@@ -3031,11 +3054,11 @@ function Te(e) {
|
|
|
3031
3054
|
return e;
|
|
3032
3055
|
const t = e.trim();
|
|
3033
3056
|
if (!t.startsWith("{") && !t.startsWith("["))
|
|
3034
|
-
return
|
|
3057
|
+
return rt(e);
|
|
3035
3058
|
try {
|
|
3036
|
-
return JSON.stringify(
|
|
3059
|
+
return JSON.stringify(R(JSON.parse(e)));
|
|
3037
3060
|
} catch {
|
|
3038
|
-
return
|
|
3061
|
+
return rt(e);
|
|
3039
3062
|
}
|
|
3040
3063
|
}
|
|
3041
3064
|
function Le(e) {
|
|
@@ -3089,16 +3112,16 @@ function Tr(e) {
|
|
|
3089
3112
|
function C(e, t = Lt) {
|
|
3090
3113
|
return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
|
|
3091
3114
|
}
|
|
3092
|
-
function
|
|
3115
|
+
function Rt(e) {
|
|
3093
3116
|
return `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
3094
3117
|
}
|
|
3095
|
-
class
|
|
3118
|
+
class st extends Error {
|
|
3096
3119
|
constructor(t, s) {
|
|
3097
3120
|
super(`${t} (${s})`), this.status = s, this.name = "AttachmentUploadHttpError";
|
|
3098
3121
|
}
|
|
3099
3122
|
status;
|
|
3100
3123
|
}
|
|
3101
|
-
async function
|
|
3124
|
+
async function Q(e, t) {
|
|
3102
3125
|
let s = null;
|
|
3103
3126
|
for (let n = 0; n < re; n += 1)
|
|
3104
3127
|
try {
|
|
@@ -3116,7 +3139,7 @@ function Ir(e) {
|
|
|
3116
3139
|
});
|
|
3117
3140
|
}
|
|
3118
3141
|
function wr(e) {
|
|
3119
|
-
return e instanceof
|
|
3142
|
+
return e instanceof st ? Ar(e.status) : e instanceof TypeError;
|
|
3120
3143
|
}
|
|
3121
3144
|
function Ar(e) {
|
|
3122
3145
|
return e === 408 || e === 409 || e === 429 || e >= 500;
|
|
@@ -3124,13 +3147,13 @@ function Ar(e) {
|
|
|
3124
3147
|
function Sr(e) {
|
|
3125
3148
|
return e === 401 || e === 403;
|
|
3126
3149
|
}
|
|
3127
|
-
const
|
|
3128
|
-
function
|
|
3129
|
-
return
|
|
3150
|
+
const ct = "[REDACTED_SECRET]", P = "[REDACTED_TOKEN]", Er = "[REDACTED_SIGNED_URL]", br = 20, kr = /^(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, Be = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, qe = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, He = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Fe = /\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, Rr = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, _r = /\bhttps?:\/\/[^\s"'<>]+/gi, Mr = /[),.;\]]+$/;
|
|
3151
|
+
function R(e) {
|
|
3152
|
+
return nt(e, 0, /* @__PURE__ */ new WeakSet());
|
|
3130
3153
|
}
|
|
3131
|
-
function
|
|
3154
|
+
function nt(e, t, s) {
|
|
3132
3155
|
if (typeof e == "string")
|
|
3133
|
-
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e :
|
|
3156
|
+
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : rt(e);
|
|
3134
3157
|
if (e === null || typeof e != "object")
|
|
3135
3158
|
return e;
|
|
3136
3159
|
if (t >= br)
|
|
@@ -3138,20 +3161,20 @@ function st(e, t, s) {
|
|
|
3138
3161
|
if (s.has(e))
|
|
3139
3162
|
return "[REDACTED_CIRCULAR]";
|
|
3140
3163
|
if (s.add(e), Array.isArray(e))
|
|
3141
|
-
return e.map((r) =>
|
|
3164
|
+
return e.map((r) => nt(r, t + 1, s));
|
|
3142
3165
|
const n = {};
|
|
3143
3166
|
for (const [r, i] of Object.entries(e))
|
|
3144
|
-
r === "pageContent" ? n[r] = i :
|
|
3167
|
+
r === "pageContent" ? n[r] = i : We(r) ? n[r] = ct : n[r] = r.toLowerCase() === "url" ? Cr(i) : nt(i, t + 1, s);
|
|
3145
3168
|
return n;
|
|
3146
3169
|
}
|
|
3147
|
-
function
|
|
3170
|
+
function We(e) {
|
|
3148
3171
|
const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
3149
3172
|
return t.includes("authorization") || t.includes("cookie") || t.includes("password") || t.includes("passwd") || t === "pwd" || t.includes("secret") || t === "token" || t.endsWith("token") || t.includes("apikey") || t.includes("csrf") || t.includes("xsrf") || t === "jwt" || t === "session" || t === "signature" || t.includes("privatekey");
|
|
3150
3173
|
}
|
|
3151
3174
|
function Cr(e) {
|
|
3152
|
-
return typeof e == "string" ?
|
|
3175
|
+
return typeof e == "string" ? $e(e) : nt(e, 0, /* @__PURE__ */ new WeakSet());
|
|
3153
3176
|
}
|
|
3154
|
-
function
|
|
3177
|
+
function $e(e) {
|
|
3155
3178
|
try {
|
|
3156
3179
|
const t = new URL(e, location.href);
|
|
3157
3180
|
for (const s of Array.from(t.searchParams.keys()))
|
|
@@ -3161,15 +3184,15 @@ function We(e) {
|
|
|
3161
3184
|
return Pr(e);
|
|
3162
3185
|
}
|
|
3163
3186
|
}
|
|
3164
|
-
function
|
|
3165
|
-
return e.replace(Rr, Er).replace(_r, Ur).replace(Be, `Bearer ${P}`).replace(qe, `Basic ${P}`).replace(He, P).replace(Fe, (t, s) => `${s}: ${
|
|
3187
|
+
function rt(e) {
|
|
3188
|
+
return e.replace(Rr, Er).replace(_r, Ur).replace(Be, `Bearer ${P}`).replace(qe, `Basic ${P}`).replace(He, P).replace(Fe, (t, s) => `${s}: ${ct}`);
|
|
3166
3189
|
}
|
|
3167
3190
|
function Pr(e) {
|
|
3168
|
-
return e.replace(Be, `Bearer ${P}`).replace(qe, `Basic ${P}`).replace(He, P).replace(Fe, (t, s) => `${s}: ${
|
|
3191
|
+
return e.replace(Be, `Bearer ${P}`).replace(qe, `Basic ${P}`).replace(He, P).replace(Fe, (t, s) => `${s}: ${ct}`);
|
|
3169
3192
|
}
|
|
3170
3193
|
function Ur(e) {
|
|
3171
3194
|
const t = e.match(Mr)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
|
|
3172
|
-
return `${
|
|
3195
|
+
return `${$e(s)}${t}`;
|
|
3173
3196
|
}
|
|
3174
3197
|
export {
|
|
3175
3198
|
te as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|