@pluno/product-agent-web 0.1.103 → 0.1.105
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 +9 -0
- package/dist/product-agent-sdk.js +374 -336
- package/dist/product-agent-widget.js +1448 -1279
- package/dist/widget.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ue = "pluno-product-agent-attachments";
|
|
2
2
|
const st = "files";
|
|
3
|
-
async function
|
|
3
|
+
async function Ft(e) {
|
|
4
4
|
const t = await $();
|
|
5
|
-
await
|
|
5
|
+
await Wt(t, "readwrite", (s) => s.put(e));
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
8
|
-
const t = await $(), s = await
|
|
7
|
+
async function de(e) {
|
|
8
|
+
const t = await $(), s = await Wt(
|
|
9
9
|
t,
|
|
10
10
|
"readonly",
|
|
11
11
|
(r) => r.get(e)
|
|
@@ -13,9 +13,9 @@ async function ue(e) {
|
|
|
13
13
|
if (!s)
|
|
14
14
|
return null;
|
|
15
15
|
const n = Date.now();
|
|
16
|
-
return await
|
|
16
|
+
return await Ht(e, { lastUsedAt: n }), { ...s, lastUsedAt: n };
|
|
17
17
|
}
|
|
18
|
-
async function
|
|
18
|
+
async function Ht(e, t) {
|
|
19
19
|
const s = await $();
|
|
20
20
|
await dt(s, "readwrite", async (n) => {
|
|
21
21
|
const r = await ht(
|
|
@@ -27,7 +27,7 @@ async function Ft(e, t) {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function he(e = 864e5) {
|
|
31
31
|
const t = await $(), s = Date.now() - e;
|
|
32
32
|
await dt(t, "readwrite", async (n) => {
|
|
33
33
|
const r = n.index("lastUsedAt");
|
|
@@ -36,14 +36,14 @@ async function de(e = 864e5) {
|
|
|
36
36
|
}
|
|
37
37
|
function $() {
|
|
38
38
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((e, t) => {
|
|
39
|
-
const s = indexedDB.open(
|
|
39
|
+
const s = indexedDB.open(ue, 1);
|
|
40
40
|
s.onupgradeneeded = () => {
|
|
41
41
|
const r = s.result.createObjectStore(st, { keyPath: "attachmentId" });
|
|
42
42
|
r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
|
|
43
43
|
}, s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
async function
|
|
46
|
+
async function Wt(e, t, s) {
|
|
47
47
|
return await dt(e, t, async (n) => await ht(s(n)));
|
|
48
48
|
}
|
|
49
49
|
function dt(e, t, s) {
|
|
@@ -73,11 +73,11 @@ function ht(e) {
|
|
|
73
73
|
e.onsuccess = () => t(e.result), e.onerror = () => s(e.error ?? new Error("Product Agent attachment storage request failed"));
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function pe(e) {
|
|
77
77
|
return e !== null && (typeof e == "object" || typeof e == "function");
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const n = Reflect.get(e, "pluno"), r =
|
|
79
|
+
function jt(e, t, s) {
|
|
80
|
+
const n = Reflect.get(e, "pluno"), r = pe(n) ? n : {};
|
|
81
81
|
if (r !== n && !Reflect.set(e, "pluno", r))
|
|
82
82
|
return null;
|
|
83
83
|
const i = Object.getOwnPropertyDescriptor(r, t);
|
|
@@ -91,8 +91,8 @@ function Wt(e, t, s) {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
const H = "pluno.productAgent.scheduledChatContinuation.", nt = "pluno:scheduled-chat-continuation-changed",
|
|
95
|
-
function
|
|
94
|
+
const H = "pluno.productAgent.scheduledChatContinuation.", nt = "pluno:scheduled-chat-continuation-changed", $t = 10080 * 6e4, fe = 5e3, ge = 15e3;
|
|
95
|
+
function me(e, {
|
|
96
96
|
clientId: t,
|
|
97
97
|
sessionId: s,
|
|
98
98
|
callId: n
|
|
@@ -103,7 +103,7 @@ function ge(e, {
|
|
|
103
103
|
clientId: t,
|
|
104
104
|
sessionId: s,
|
|
105
105
|
defaultTaskId: `scheduled-${n}`,
|
|
106
|
-
expiresAfterDueMs:
|
|
106
|
+
expiresAfterDueMs: $t
|
|
107
107
|
})});
|
|
108
108
|
const scheduleQuery = (query, delaySeconds) => {
|
|
109
109
|
if (typeof query !== "string" || query.trim().length === 0) {
|
|
@@ -132,15 +132,15 @@ const scheduleQuery = (query, delaySeconds) => {
|
|
|
132
132
|
};
|
|
133
133
|
${e}`;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
const t = e.storage === void 0 ?
|
|
135
|
+
function ye(e) {
|
|
136
|
+
const t = e.storage === void 0 ? Te() : e.storage;
|
|
137
137
|
let s = null, n = !1, r = !1, i = !1, o = t !== null;
|
|
138
138
|
const c = /* @__PURE__ */ new Map(), u = () => {
|
|
139
139
|
s !== null && (clearTimeout(s), s = null);
|
|
140
140
|
}, l = () => {
|
|
141
141
|
u(), !(i || !o) && (s = setTimeout(() => {
|
|
142
142
|
s = null, h();
|
|
143
|
-
},
|
|
143
|
+
}, fe));
|
|
144
144
|
}, a = () => {
|
|
145
145
|
o = !1, u();
|
|
146
146
|
}, h = async () => {
|
|
@@ -170,7 +170,7 @@ function me(e) {
|
|
|
170
170
|
e.onTasksChanged?.(m);
|
|
171
171
|
for (const g of m)
|
|
172
172
|
if (!(g.clientId !== e.clientId || g.dueAt > f || c.has(g.id) || !await e.canDeliver(g))) {
|
|
173
|
-
c.set(g.id, f +
|
|
173
|
+
c.set(g.id, f + ge);
|
|
174
174
|
try {
|
|
175
175
|
await e.deliver(g);
|
|
176
176
|
} catch {
|
|
@@ -216,9 +216,9 @@ function D(e) {
|
|
|
216
216
|
if (!e || typeof e != "object")
|
|
217
217
|
return !1;
|
|
218
218
|
const t = e;
|
|
219
|
-
return typeof t.id == "string" && t.id.length > 0 && typeof t.clientId == "string" && t.clientId.length > 0 && typeof t.sessionId == "string" && t.sessionId.length > 0 && typeof t.prompt == "string" && t.prompt.trim().length > 0 && typeof t.dueAt == "number" && Number.isFinite(t.dueAt) && typeof t.expiresAt == "number" && Number.isFinite(t.expiresAt) && t.expiresAt === t.dueAt +
|
|
219
|
+
return typeof t.id == "string" && t.id.length > 0 && typeof t.clientId == "string" && t.clientId.length > 0 && typeof t.sessionId == "string" && t.sessionId.length > 0 && typeof t.prompt == "string" && t.prompt.trim().length > 0 && typeof t.dueAt == "number" && Number.isFinite(t.dueAt) && typeof t.expiresAt == "number" && Number.isFinite(t.expiresAt) && t.expiresAt === t.dueAt + $t;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Te() {
|
|
222
222
|
let e;
|
|
223
223
|
try {
|
|
224
224
|
e = window.localStorage, e.length;
|
|
@@ -262,10 +262,10 @@ function ye() {
|
|
|
262
262
|
function J(e) {
|
|
263
263
|
return `${H}${e}`;
|
|
264
264
|
}
|
|
265
|
-
const Y = "pluno.productAgent.transportId",
|
|
265
|
+
const Y = "pluno.productAgent.transportId", we = "pluno.productAgent.transportIdentity", V = "pluno.productAgent.transportIdentity.event", Ie = 50, Ae = globalThis.setTimeout.bind(globalThis);
|
|
266
266
|
let U = null;
|
|
267
267
|
const q = /* @__PURE__ */ new Set();
|
|
268
|
-
async function
|
|
268
|
+
async function Se(e = zt()) {
|
|
269
269
|
const t = e.randomUUID(), s = e.storage.getItem(Y);
|
|
270
270
|
let n = s ?? e.randomUUID(), r = !1, i = !1;
|
|
271
271
|
const o = e.channel.subscribe((u) => {
|
|
@@ -301,14 +301,14 @@ async function Ae(e = $t()) {
|
|
|
301
301
|
}
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
|
-
async function
|
|
305
|
-
U || (U =
|
|
304
|
+
async function ke() {
|
|
305
|
+
U || (U = Se(zt()), U.then((n) => {
|
|
306
306
|
const r = (i) => {
|
|
307
307
|
i.persisted || (n.release(), U = null, q.clear(), window.removeEventListener("pagehide", r));
|
|
308
308
|
};
|
|
309
309
|
window.addEventListener("pagehide", r);
|
|
310
310
|
}));
|
|
311
|
-
const e = await U, t =
|
|
311
|
+
const e = await U, t = Ee();
|
|
312
312
|
q.add(t);
|
|
313
313
|
let s = !1;
|
|
314
314
|
return {
|
|
@@ -319,23 +319,23 @@ async function Se() {
|
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function Ee() {
|
|
323
323
|
let e = 0;
|
|
324
324
|
for (; q.has(e); )
|
|
325
325
|
e += 1;
|
|
326
326
|
return e;
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function zt() {
|
|
329
329
|
return {
|
|
330
330
|
storage: window.sessionStorage,
|
|
331
|
-
channel:
|
|
331
|
+
channel: _e(),
|
|
332
332
|
randomUUID: () => crypto.randomUUID(),
|
|
333
|
-
settle: () => new Promise((e) =>
|
|
333
|
+
settle: () => new Promise((e) => Ae(e, Ie))
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function _e() {
|
|
337
337
|
if (typeof BroadcastChannel < "u") {
|
|
338
|
-
const e = new BroadcastChannel(
|
|
338
|
+
const e = new BroadcastChannel(we);
|
|
339
339
|
return {
|
|
340
340
|
postMessage: (t) => e.postMessage(t),
|
|
341
341
|
subscribe: (t) => {
|
|
@@ -368,18 +368,18 @@ function Re() {
|
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
const rt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ce = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]',
|
|
371
|
+
const rt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ce = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', be = ".pluno-pa-widget__panel", Me = ".pluno-pa-widget__timeline", St = `${rt}[data-pluno-sdk-preview-channel]`, Ue = "https://app.pluno.ai", Pe = "gpt-5.6-terra", De = 2e4, ve = 1e4, Ne = 1e4, Oe = 1e4, Le = 1e4, Be = 1e3, kt = 3e4, Et = 0.2, _t = 6e4, qe = 15e3, N = 8, xe = 15e3, Fe = 2e3, He = 1e3, We = 100, je = 8e3, $e = 15e3, Rt = 3, ze = [300, 1e3], pt = 64e3, Z = 4e3, ft = 30, Ge = 2e3, Xe = 1e3, Ke = 200 * 1024 * 1024, gt = "Image is too large for model vision input.", Je = 100, Gt = "pluno.productAgent.state.", it = "pluno.productAgent.pendingEvents.", z = "pluno.productAgent.activeToolCalls.", Ye = 100;
|
|
372
372
|
function O(e, t = 0) {
|
|
373
373
|
const s = e === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (e - 1));
|
|
374
374
|
return Math.max(t, s);
|
|
375
375
|
}
|
|
376
376
|
const x = /* @__PURE__ */ new Set();
|
|
377
377
|
let L = null;
|
|
378
|
-
function
|
|
379
|
-
const s = Math.min(kt,
|
|
378
|
+
function Ve(e, t = Math.random) {
|
|
379
|
+
const s = Math.min(kt, Be * 2 ** e), n = 1 - Et + t() * Et * 2;
|
|
380
380
|
return Math.min(kt, Math.round(s * n));
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Ze(e, t, s) {
|
|
383
383
|
return new Promise((n, r) => {
|
|
384
384
|
const i = setTimeout(() => r(new Error(s)), t);
|
|
385
385
|
e.then(
|
|
@@ -392,13 +392,13 @@ function Ve(e, t, s) {
|
|
|
392
392
|
);
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
|
-
class
|
|
395
|
+
class Xt {
|
|
396
396
|
constructor(t, s) {
|
|
397
397
|
this.options = t, this.transportIdentity = s, this.state = {
|
|
398
398
|
...this.state,
|
|
399
|
-
starterPrompts:
|
|
399
|
+
starterPrompts: _s(t.initialStarterPrompts)
|
|
400
400
|
};
|
|
401
|
-
const n = t.restorePersistedState === !1 ? null :
|
|
401
|
+
const n = t.restorePersistedState === !1 ? null : rn(t.clientId, t.expectedPersistedSessionId);
|
|
402
402
|
n && (this.state = {
|
|
403
403
|
...this.state,
|
|
404
404
|
...n,
|
|
@@ -409,10 +409,10 @@ class Gt {
|
|
|
409
409
|
assistantDraftRunId: null,
|
|
410
410
|
isThinking: !1,
|
|
411
411
|
lastError: null
|
|
412
|
-
}), this.queuedClientEvents =
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
), P(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler =
|
|
412
|
+
}), this.queuedClientEvents = hn(
|
|
413
|
+
an(t.clientId),
|
|
414
|
+
ln(t.clientId)
|
|
415
|
+
), P(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler = ye({
|
|
416
416
|
clientId: t.clientId,
|
|
417
417
|
canDeliver: (r) => r.sessionId === this.state.sessionId,
|
|
418
418
|
deliver: async (r) => {
|
|
@@ -485,14 +485,14 @@ class Gt {
|
|
|
485
485
|
lastErrorSecuritySettingsUrl: null
|
|
486
486
|
};
|
|
487
487
|
static async init(t) {
|
|
488
|
-
const s = await
|
|
488
|
+
const s = await ke(), n = new Xt({
|
|
489
489
|
...t,
|
|
490
|
-
backendUrl:
|
|
491
|
-
clientId: t.clientId ??
|
|
492
|
-
model: t.model ??
|
|
490
|
+
backendUrl: ms(t.backendUrl ?? Ue),
|
|
491
|
+
clientId: t.clientId ?? Us(),
|
|
492
|
+
model: t.model ?? Pe
|
|
493
493
|
}, s);
|
|
494
494
|
try {
|
|
495
|
-
|
|
495
|
+
he().catch((r) => {
|
|
496
496
|
y("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
497
497
|
message: r instanceof Error ? r.message : String(r)
|
|
498
498
|
});
|
|
@@ -524,14 +524,14 @@ class Gt {
|
|
|
524
524
|
lastError: null
|
|
525
525
|
});
|
|
526
526
|
try {
|
|
527
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await
|
|
527
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ze(this.options.tokenProvider(), Ne, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
|
|
528
528
|
return;
|
|
529
529
|
if (!this.token && !this.options.webSocketFactory)
|
|
530
530
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
531
|
-
const s =
|
|
531
|
+
const s = Ts(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
|
|
532
532
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
533
533
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (y("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
534
|
-
},
|
|
534
|
+
}, Oe), n.addEventListener("open", () => {
|
|
535
535
|
this.socket !== n || (this.clearSocketConnectTimer(), y("web-sdk.agent", "Pluno socket opened", {
|
|
536
536
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
537
537
|
isThinking: this.state.isThinking
|
|
@@ -543,9 +543,9 @@ class Gt {
|
|
|
543
543
|
pageUrl: location.href
|
|
544
544
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
545
545
|
this.socket === n && (y("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
546
|
-
},
|
|
546
|
+
}, Le));
|
|
547
547
|
}), n.addEventListener("message", (r) => {
|
|
548
|
-
this.socket === n && this.handleServerEvent(
|
|
548
|
+
this.socket === n && this.handleServerEvent(Es(r.data));
|
|
549
549
|
}), n.addEventListener("close", (r) => {
|
|
550
550
|
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (y("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
551
551
|
code: typeof r?.code == "number" ? r.code : null,
|
|
@@ -578,7 +578,7 @@ class Gt {
|
|
|
578
578
|
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;
|
|
579
579
|
}
|
|
580
580
|
destroy() {
|
|
581
|
-
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(),
|
|
581
|
+
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(), pn(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
582
582
|
for (const t of Object.values(this.listeners))
|
|
583
583
|
t?.clear();
|
|
584
584
|
}
|
|
@@ -614,7 +614,7 @@ class Gt {
|
|
|
614
614
|
attachments: i.length > 0 ? i : void 0,
|
|
615
615
|
page: o,
|
|
616
616
|
model: this.options.model,
|
|
617
|
-
metadata:
|
|
617
|
+
metadata: Ct(this.options.metadata)
|
|
618
618
|
};
|
|
619
619
|
return this.activeClientMessageId = c, this.activeUserMessageEvent = a, this.markThinkingProgress(), this.send(a), this.startBackgroundAttachmentUploads(c, i), c;
|
|
620
620
|
}
|
|
@@ -626,12 +626,12 @@ class Gt {
|
|
|
626
626
|
const s = B(), n = {
|
|
627
627
|
id: s,
|
|
628
628
|
name: t.name || "attachment",
|
|
629
|
-
mimeType:
|
|
629
|
+
mimeType: Bt(t),
|
|
630
630
|
sizeBytes: t.size
|
|
631
631
|
};
|
|
632
632
|
this.attachmentFiles.set(s, t), this.attachmentBlobCache.set(s, t);
|
|
633
633
|
const r = Date.now();
|
|
634
|
-
return
|
|
634
|
+
return Ft({
|
|
635
635
|
attachmentId: s,
|
|
636
636
|
name: n.name,
|
|
637
637
|
mimeType: n.mimeType,
|
|
@@ -686,7 +686,7 @@ class Gt {
|
|
|
686
686
|
waitForSession: r,
|
|
687
687
|
notifyCompletion: i
|
|
688
688
|
}) {
|
|
689
|
-
const o = r ? await this.waitForSessionId() : this.state.sessionId, c =
|
|
689
|
+
const o = r ? await this.waitForSessionId() : this.state.sessionId, c = Bt(t), u = {
|
|
690
690
|
sessionId: o ?? void 0,
|
|
691
691
|
attachmentId: s.id,
|
|
692
692
|
clientId: this.options.clientId,
|
|
@@ -696,7 +696,7 @@ class Gt {
|
|
|
696
696
|
sizeBytes: t.size,
|
|
697
697
|
page: S(),
|
|
698
698
|
model: this.options.model,
|
|
699
|
-
metadata:
|
|
699
|
+
metadata: Ct(this.options.metadata)
|
|
700
700
|
}, l = this.options.prepareAttachmentUpload ? await et(
|
|
701
701
|
() => this.options.prepareAttachmentUpload(u),
|
|
702
702
|
"Failed to prepare attachment upload"
|
|
@@ -711,8 +711,8 @@ class Gt {
|
|
|
711
711
|
throw new F("Failed to upload attachment", h.status);
|
|
712
712
|
return h;
|
|
713
713
|
}, "Failed to upload attachment"), this.setState({ sessionId: l.sessionId });
|
|
714
|
-
const a =
|
|
715
|
-
return this.updateAttachmentInState(s.id, a), s.id &&
|
|
714
|
+
const a = ee(l.attachment, this.options.backendUrl);
|
|
715
|
+
return this.updateAttachmentInState(s.id, a), s.id && Ht(s.id, {
|
|
716
716
|
sessionId: l.sessionId,
|
|
717
717
|
fileUrl: a.fileUrl,
|
|
718
718
|
gcsPath: a.gcsPath,
|
|
@@ -734,7 +734,7 @@ class Gt {
|
|
|
734
734
|
return this.state.sessionId ? Promise.resolve(this.state.sessionId) : new Promise((t, s) => {
|
|
735
735
|
const n = window.setTimeout(() => {
|
|
736
736
|
r(), s(new Error("Timed out waiting for Pluno session before persisting attachment"));
|
|
737
|
-
},
|
|
737
|
+
}, $e), r = this.on("state", (i) => {
|
|
738
738
|
i.sessionId && (window.clearTimeout(n), r(), t(i.sessionId));
|
|
739
739
|
});
|
|
740
740
|
});
|
|
@@ -756,7 +756,7 @@ class Gt {
|
|
|
756
756
|
const n = await this.fetchEmbedAttachmentUpload(t);
|
|
757
757
|
if (n.ok)
|
|
758
758
|
return await n.json();
|
|
759
|
-
if (
|
|
759
|
+
if (Pn(n.status) && this.options.tokenProvider && !s) {
|
|
760
760
|
s = !0;
|
|
761
761
|
const r = await this.fetchEmbedAttachmentUpload(t);
|
|
762
762
|
if (r.ok)
|
|
@@ -801,7 +801,7 @@ class Gt {
|
|
|
801
801
|
const s = B(), n = new Promise((i, o) => {
|
|
802
802
|
const c = window.setTimeout(() => {
|
|
803
803
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
804
|
-
},
|
|
804
|
+
}, je);
|
|
805
805
|
this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: c });
|
|
806
806
|
}), r = {
|
|
807
807
|
type: "sessions.list",
|
|
@@ -858,7 +858,7 @@ class Gt {
|
|
|
858
858
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
859
859
|
return;
|
|
860
860
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
861
|
-
const t =
|
|
861
|
+
const t = ws();
|
|
862
862
|
this.sendNow(
|
|
863
863
|
k({
|
|
864
864
|
type: "starter_prompts.page_context",
|
|
@@ -869,13 +869,13 @@ class Gt {
|
|
|
869
869
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
870
870
|
}
|
|
871
871
|
startStarterPromptUrlWatcher() {
|
|
872
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
872
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = Is(() => this.handleStarterPromptUrlChange()));
|
|
873
873
|
}
|
|
874
874
|
handleStarterPromptUrlChange() {
|
|
875
875
|
const t = location.href;
|
|
876
876
|
t !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = t, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
877
877
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
878
|
-
},
|
|
878
|
+
}, Ye));
|
|
879
879
|
}
|
|
880
880
|
refreshStarterPromptsForCurrentUrl() {
|
|
881
881
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -909,7 +909,7 @@ class Gt {
|
|
|
909
909
|
this.clearHeartbeatAckTimer();
|
|
910
910
|
return;
|
|
911
911
|
}
|
|
912
|
-
if (
|
|
912
|
+
if (es(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
913
913
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
|
|
914
914
|
const s = Rs(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
915
915
|
y("web-sdk.agent", "Received auth.ok appearance", {
|
|
@@ -918,10 +918,10 @@ class Gt {
|
|
|
918
918
|
normalizedAppearance: s
|
|
919
919
|
}), this.runtimeHelperJavascript = Cs(t.runtimeHelpers)?.javascript ?? null;
|
|
920
920
|
const r = Mt(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, c = {
|
|
921
|
-
user:
|
|
921
|
+
user: Ps(t.user),
|
|
922
922
|
status: "connected"
|
|
923
923
|
};
|
|
924
|
-
(i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !
|
|
924
|
+
(i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !Ss() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
925
925
|
type: "page.upsert",
|
|
926
926
|
sessionId: this.state.sessionId,
|
|
927
927
|
page: S(),
|
|
@@ -939,9 +939,9 @@ class Gt {
|
|
|
939
939
|
if (t.type === "conversation.state") {
|
|
940
940
|
const s = Array.isArray(t.items) ? t.items : [];
|
|
941
941
|
this.rememberUserMessageClientMessageIds(s);
|
|
942
|
-
const n =
|
|
942
|
+
const n = Ks(s);
|
|
943
943
|
if (n) {
|
|
944
|
-
const a =
|
|
944
|
+
const a = Js(s, n);
|
|
945
945
|
this.retryAttemptsByClientMessageId[n] = Math.max(
|
|
946
946
|
this.retryAttemptsByClientMessageId[n] ?? 0,
|
|
947
947
|
a
|
|
@@ -949,22 +949,22 @@ class Gt {
|
|
|
949
949
|
}
|
|
950
950
|
const r = s.filter((a) => {
|
|
951
951
|
const h = v(a);
|
|
952
|
-
return !
|
|
953
|
-
}), i =
|
|
952
|
+
return !vt(h) && (!n || !at(h));
|
|
953
|
+
}), i = Hs(
|
|
954
954
|
this.state.messages,
|
|
955
|
-
|
|
956
|
-
), o =
|
|
957
|
-
(a) =>
|
|
955
|
+
Ds(r, this.options.backendUrl)
|
|
956
|
+
), o = Dt(i), c = s.some(
|
|
957
|
+
(a) => Ot(
|
|
958
958
|
v(a),
|
|
959
959
|
this.state.assistantDraft,
|
|
960
960
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
961
961
|
this.state.assistantDraftRunId
|
|
962
962
|
)
|
|
963
963
|
), u = o && (!this.state.assistantDraft || c);
|
|
964
|
-
if (!o &&
|
|
964
|
+
if (!o && Xs(this.state.messages, s))
|
|
965
965
|
return;
|
|
966
966
|
const l = u ? null : ct(s);
|
|
967
|
-
if (this.latestRecoverableClientMessageId = l,
|
|
967
|
+
if (this.latestRecoverableClientMessageId = l, zs(i) && this.clearRetryTimers(), this.setState({
|
|
968
968
|
sessionId: I(t.session, "id") ?? this.state.sessionId,
|
|
969
969
|
messages: i,
|
|
970
970
|
...u ? {
|
|
@@ -987,7 +987,7 @@ class Gt {
|
|
|
987
987
|
if (t.type === "sessions.page") {
|
|
988
988
|
const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
|
|
989
989
|
s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
|
|
990
|
-
sessions:
|
|
990
|
+
sessions: vs(t.sessions),
|
|
991
991
|
nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
|
|
992
992
|
}));
|
|
993
993
|
return;
|
|
@@ -1001,7 +1001,7 @@ class Gt {
|
|
|
1001
1001
|
const s = v(t.item);
|
|
1002
1002
|
if (at(s)) {
|
|
1003
1003
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
1004
|
-
const r = I(t.item, "sessionId") ?? this.state.sessionId, i = s ?
|
|
1004
|
+
const r = I(t.item, "sessionId") ?? this.state.sessionId, i = s ? C(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, c = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
1005
1005
|
if (r && c) {
|
|
1006
1006
|
this.retryAfterInterruptedRun(r, c);
|
|
1007
1007
|
return;
|
|
@@ -1011,14 +1011,14 @@ class Gt {
|
|
|
1011
1011
|
return;
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
-
if (
|
|
1014
|
+
if (vt(s))
|
|
1015
1015
|
return;
|
|
1016
|
-
const n =
|
|
1016
|
+
const n = Jt(t.item, this.options.backendUrl);
|
|
1017
1017
|
if (n) {
|
|
1018
1018
|
n.role === "assistant" && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
1019
1019
|
const r = t.item.data;
|
|
1020
|
-
|
|
1021
|
-
const i =
|
|
1020
|
+
Vs(r) && this.clearRunAckResyncRetryTimer();
|
|
1021
|
+
const i = Fs(this.state.messages, n), o = Dt(i), c = Ot(
|
|
1022
1022
|
r,
|
|
1023
1023
|
this.state.assistantDraft,
|
|
1024
1024
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
@@ -1072,7 +1072,7 @@ class Gt {
|
|
|
1072
1072
|
return;
|
|
1073
1073
|
}
|
|
1074
1074
|
o && r && i && (this.retryableClientMessageId = i);
|
|
1075
|
-
const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u =
|
|
1075
|
+
const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = ys(c.message);
|
|
1076
1076
|
u && console.error(u), this.setState({
|
|
1077
1077
|
status: "error",
|
|
1078
1078
|
isThinking: !1,
|
|
@@ -1147,7 +1147,7 @@ class Gt {
|
|
|
1147
1147
|
this.pendingSessionHistoryRequests.clear();
|
|
1148
1148
|
}
|
|
1149
1149
|
markThinkingProgress() {
|
|
1150
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
1150
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(_t), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
1151
1151
|
}
|
|
1152
1152
|
scheduleThinkingWatchdog(t) {
|
|
1153
1153
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -1167,7 +1167,7 @@ class Gt {
|
|
|
1167
1167
|
scheduleRunAckWatchdog(t) {
|
|
1168
1168
|
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
1169
1169
|
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
|
|
1170
|
-
},
|
|
1170
|
+
}, xe);
|
|
1171
1171
|
}
|
|
1172
1172
|
recoverMissedRunAck(t) {
|
|
1173
1173
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (y("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
@@ -1191,8 +1191,8 @@ class Gt {
|
|
|
1191
1191
|
sessionId: this.state.sessionId,
|
|
1192
1192
|
clientMessageId: t,
|
|
1193
1193
|
automatic: !0
|
|
1194
|
-
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(
|
|
1195
|
-
}, O(s,
|
|
1194
|
+
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(_t)));
|
|
1195
|
+
}, O(s, Fe)));
|
|
1196
1196
|
}
|
|
1197
1197
|
clearRunAckResyncRetryTimer() {
|
|
1198
1198
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -1231,7 +1231,7 @@ class Gt {
|
|
|
1231
1231
|
sessionId: this.state.sessionId,
|
|
1232
1232
|
clientMessageId: t,
|
|
1233
1233
|
resyncAttempts: s + 1
|
|
1234
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
1234
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(qe);
|
|
1235
1235
|
return;
|
|
1236
1236
|
}
|
|
1237
1237
|
this.setState({
|
|
@@ -1263,7 +1263,7 @@ class Gt {
|
|
|
1263
1263
|
const s = typeof t.sessionId == "string" ? t.sessionId : null, n = typeof t.callId == "string" ? t.callId : null, r = typeof t.toolName == "string" ? t.toolName : null, i = typeof t.summary == "string" ? t.summary : "Running browser tool", o = t.rawInput;
|
|
1264
1264
|
if (!s || !n || !r)
|
|
1265
1265
|
return;
|
|
1266
|
-
if (r !== "execute_code" || !
|
|
1266
|
+
if (r !== "execute_code" || !wn(o)) {
|
|
1267
1267
|
this.send({
|
|
1268
1268
|
type: "tool.result",
|
|
1269
1269
|
sessionId: s,
|
|
@@ -1279,7 +1279,7 @@ class Gt {
|
|
|
1279
1279
|
});
|
|
1280
1280
|
return;
|
|
1281
1281
|
}
|
|
1282
|
-
const c =
|
|
1282
|
+
const c = rs(this.state.messages);
|
|
1283
1283
|
this.activeBrowserToolCalls.set(n, {
|
|
1284
1284
|
event: {
|
|
1285
1285
|
type: "tool.result",
|
|
@@ -1297,7 +1297,7 @@ class Gt {
|
|
|
1297
1297
|
let u = null, l;
|
|
1298
1298
|
u = await this.executeRuntimeHelper(), l = await bt({
|
|
1299
1299
|
...o,
|
|
1300
|
-
javascript:
|
|
1300
|
+
javascript: me(o.javascript, {
|
|
1301
1301
|
clientId: this.options.clientId,
|
|
1302
1302
|
sessionId: s,
|
|
1303
1303
|
callId: n
|
|
@@ -1314,24 +1314,24 @@ class Gt {
|
|
|
1314
1314
|
toolName: r,
|
|
1315
1315
|
summary: o.summary,
|
|
1316
1316
|
rawInput: k(o),
|
|
1317
|
-
rawOutput: k(
|
|
1318
|
-
}),
|
|
1317
|
+
rawOutput: k(bs(l, u))
|
|
1318
|
+
}), cn(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1319
1319
|
}
|
|
1320
1320
|
startPageLifecycleRecovery() {
|
|
1321
1321
|
if (this.pageLifecycleCleanup)
|
|
1322
1322
|
return;
|
|
1323
1323
|
const t = () => {
|
|
1324
|
-
|
|
1324
|
+
Qt(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1325
1325
|
};
|
|
1326
1326
|
window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
|
|
1327
1327
|
window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
|
|
1328
1328
|
};
|
|
1329
1329
|
}
|
|
1330
1330
|
installSessionUserFilesApi(t) {
|
|
1331
|
-
this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup =
|
|
1331
|
+
this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = is(t, this.attachmentFiles, this.attachmentBlobCache);
|
|
1332
1332
|
}
|
|
1333
1333
|
cleanupSessionUserFilesApi() {
|
|
1334
|
-
this.sessionUserFilesApiCleanup && (
|
|
1334
|
+
this.sessionUserFilesApiCleanup && (ps(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
|
|
1335
1335
|
}
|
|
1336
1336
|
async executeRuntimeHelper() {
|
|
1337
1337
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -1339,15 +1339,15 @@ class Gt {
|
|
|
1339
1339
|
const t = await bt({
|
|
1340
1340
|
javascript: this.runtimeHelperJavascript
|
|
1341
1341
|
});
|
|
1342
|
-
return t.ok === !1 ?
|
|
1342
|
+
return t.ok === !1 ? Ms(t) : null;
|
|
1343
1343
|
}
|
|
1344
1344
|
enableNetworkCapture() {
|
|
1345
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
1346
|
-
|
|
1345
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = Qe((t) => {
|
|
1346
|
+
_n(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
|
|
1347
1347
|
}));
|
|
1348
1348
|
}
|
|
1349
1349
|
enqueueNetworkEvent(t) {
|
|
1350
|
-
this.queuedNetworkEvents.length >=
|
|
1350
|
+
this.queuedNetworkEvents.length >= We || (this.queuedNetworkEvents.push(En(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
1351
1351
|
this.networkBatchTimer = null;
|
|
1352
1352
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
1353
1353
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -1356,12 +1356,12 @@ class Gt {
|
|
|
1356
1356
|
page: S(),
|
|
1357
1357
|
events: s
|
|
1358
1358
|
});
|
|
1359
|
-
},
|
|
1359
|
+
}, He)));
|
|
1360
1360
|
}
|
|
1361
1361
|
scheduleReconnect() {
|
|
1362
1362
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
1363
1363
|
return;
|
|
1364
|
-
const t =
|
|
1364
|
+
const t = Ve(this.reconnectAttempts);
|
|
1365
1365
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
1366
1366
|
this.reconnectTimer = null, this.connect().catch((s) => {
|
|
1367
1367
|
y("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
@@ -1377,8 +1377,8 @@ class Gt {
|
|
|
1377
1377
|
const t = this.socket;
|
|
1378
1378
|
!t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
1379
1379
|
this.socket === t && (y("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
|
|
1380
|
-
},
|
|
1381
|
-
},
|
|
1380
|
+
}, ve));
|
|
1381
|
+
}, De);
|
|
1382
1382
|
}
|
|
1383
1383
|
stopHeartbeat() {
|
|
1384
1384
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -1404,20 +1404,20 @@ class Gt {
|
|
|
1404
1404
|
...t,
|
|
1405
1405
|
...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
1406
1406
|
...t.lastError !== void 0 && t.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
1407
|
-
},
|
|
1407
|
+
}, on(this.options.clientId, this.state), this.emit("state", this.getState());
|
|
1408
1408
|
}
|
|
1409
1409
|
emit(t, s) {
|
|
1410
1410
|
this.listeners[t]?.forEach((r) => r(s));
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
const Q = /* @__PURE__ */ new WeakMap();
|
|
1414
|
-
function
|
|
1415
|
-
const t = window.__plunoProductAgentNetworkCapture ??
|
|
1414
|
+
function Qe(e) {
|
|
1415
|
+
const t = window.__plunoProductAgentNetworkCapture ?? ts();
|
|
1416
1416
|
return t.subscribers.add(e), () => {
|
|
1417
1417
|
t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
|
|
1418
1418
|
};
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function ts() {
|
|
1421
1421
|
const e = /* @__PURE__ */ new Set(), t = (T) => {
|
|
1422
1422
|
e.forEach((p) => {
|
|
1423
1423
|
try {
|
|
@@ -1434,31 +1434,31 @@ function Qe() {
|
|
|
1434
1434
|
throw m;
|
|
1435
1435
|
}
|
|
1436
1436
|
try {
|
|
1437
|
-
const m = p instanceof Request ? p : null, g =
|
|
1438
|
-
if (!
|
|
1437
|
+
const m = p instanceof Request ? p : null, g = In(p, m), A = se(d?.headers ?? m?.headers);
|
|
1438
|
+
if (!M(g, A, d?.body)) {
|
|
1439
1439
|
const K = {
|
|
1440
1440
|
requestId: tt("fetch"),
|
|
1441
|
-
url:
|
|
1441
|
+
url: _(g, Z),
|
|
1442
1442
|
method: (d?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
1443
1443
|
requestHeaders: A,
|
|
1444
|
-
requestBody:
|
|
1444
|
+
requestBody: qt(d?.body),
|
|
1445
1445
|
resourceType: "fetch",
|
|
1446
1446
|
startedAt: new Date(f).toISOString()
|
|
1447
1447
|
};
|
|
1448
1448
|
w.then(
|
|
1449
|
-
(
|
|
1450
|
-
|
|
1449
|
+
(b) => {
|
|
1450
|
+
An(b, K, f, t).catch(() => {
|
|
1451
1451
|
t({
|
|
1452
1452
|
...K,
|
|
1453
|
-
responseStatus:
|
|
1453
|
+
responseStatus: b.status,
|
|
1454
1454
|
durationMs: Date.now() - f
|
|
1455
1455
|
});
|
|
1456
1456
|
});
|
|
1457
1457
|
},
|
|
1458
|
-
(
|
|
1458
|
+
(b) => {
|
|
1459
1459
|
t({
|
|
1460
1460
|
...K,
|
|
1461
|
-
errorText:
|
|
1461
|
+
errorText: _(b instanceof Error ? b.message : String(b)),
|
|
1462
1462
|
durationMs: Date.now() - f
|
|
1463
1463
|
});
|
|
1464
1464
|
}
|
|
@@ -1472,24 +1472,24 @@ function Qe() {
|
|
|
1472
1472
|
return Q.set(this, {
|
|
1473
1473
|
requestId: tt("xhr"),
|
|
1474
1474
|
method: String(p ?? "GET").toUpperCase(),
|
|
1475
|
-
url:
|
|
1475
|
+
url: _(A, Z),
|
|
1476
1476
|
requestHeaders: {},
|
|
1477
1477
|
startedAtMs: Date.now(),
|
|
1478
1478
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1479
|
-
excluded:
|
|
1479
|
+
excluded: M(A)
|
|
1480
1480
|
}), g;
|
|
1481
1481
|
}, u = function(p, d) {
|
|
1482
1482
|
const f = r.call(this, p, d), w = Q.get(this);
|
|
1483
|
-
return w && Object.keys(w.requestHeaders).length < ft && (w.requestHeaders[p] = At(p, d), w.excluded = w.excluded ||
|
|
1483
|
+
return w && Object.keys(w.requestHeaders).length < ft && (w.requestHeaders[p] = At(p, d), w.excluded = w.excluded || M(w.url, w.requestHeaders)), f;
|
|
1484
1484
|
}, l = function(p) {
|
|
1485
1485
|
try {
|
|
1486
1486
|
const d = Q.get(this);
|
|
1487
|
-
d && (d.excluded = d.excluded ||
|
|
1487
|
+
d && (d.excluded = d.excluded || M(d.url, d.requestHeaders, p), d.requestBody = qt(p), d.excluded || this.addEventListener(
|
|
1488
1488
|
"loadend",
|
|
1489
1489
|
() => {
|
|
1490
1490
|
queueMicrotask(() => {
|
|
1491
1491
|
try {
|
|
1492
|
-
const f =
|
|
1492
|
+
const f = Cn(this.getAllResponseHeaders());
|
|
1493
1493
|
t({
|
|
1494
1494
|
requestId: d.requestId,
|
|
1495
1495
|
url: d.url,
|
|
@@ -1499,7 +1499,7 @@ function Qe() {
|
|
|
1499
1499
|
resourceType: "xhr",
|
|
1500
1500
|
responseStatus: this.status,
|
|
1501
1501
|
responseHeaders: f,
|
|
1502
|
-
responseBody:
|
|
1502
|
+
responseBody: kn(this, f),
|
|
1503
1503
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
1504
1504
|
startedAt: d.startedAt,
|
|
1505
1505
|
durationMs: Date.now() - d.startedAtMs
|
|
@@ -1536,12 +1536,12 @@ function Qe() {
|
|
|
1536
1536
|
a = new PerformanceObserver((T) => {
|
|
1537
1537
|
for (const p of T.getEntries()) {
|
|
1538
1538
|
const d = p;
|
|
1539
|
-
if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" ||
|
|
1539
|
+
if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || M(d.name))
|
|
1540
1540
|
continue;
|
|
1541
1541
|
const f = performance.timeOrigin + d.startTime;
|
|
1542
1542
|
t({
|
|
1543
1543
|
requestId: tt("resource"),
|
|
1544
|
-
url:
|
|
1544
|
+
url: _(d.name, Z),
|
|
1545
1545
|
method: "GET",
|
|
1546
1546
|
resourceType: "resource",
|
|
1547
1547
|
responseStatus: d.responseStatus,
|
|
@@ -1591,15 +1591,15 @@ function y(e, t, s) {
|
|
|
1591
1591
|
}, i = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
1592
1592
|
i.push(r), i.length > 120 && i.splice(0, i.length - 120), n.__plunoProductAgentDiagnostics__ = i, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: r }));
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Ct(e) {
|
|
1595
1595
|
const t = typeof e == "function" ? e() : e;
|
|
1596
1596
|
return t && Object.keys(t).length > 0 ? t : void 0;
|
|
1597
1597
|
}
|
|
1598
|
-
function
|
|
1598
|
+
function es(e) {
|
|
1599
1599
|
return e.type === "conversation.state" || e.type === "session.updated" || e.type === "session.item" || e.type === "chat.assistant_delta" || e.type === "chat.assistant_done" || e.type === "tool.call";
|
|
1600
1600
|
}
|
|
1601
|
-
const
|
|
1602
|
-
function
|
|
1601
|
+
const ss = 5e3, ns = 12e4;
|
|
1602
|
+
function rs(e) {
|
|
1603
1603
|
const t = [];
|
|
1604
1604
|
for (const s of e)
|
|
1605
1605
|
s.role !== "user" || !s.attachments?.length || s.attachments.forEach((n, r) => {
|
|
@@ -1610,17 +1610,17 @@ function ns(e) {
|
|
|
1610
1610
|
});
|
|
1611
1611
|
return t;
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1613
|
+
function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
1614
1614
|
const n = [
|
|
1615
|
-
|
|
1616
|
-
|
|
1615
|
+
os(e, t, s),
|
|
1616
|
+
as()
|
|
1617
1617
|
].filter((r) => typeof r == "function");
|
|
1618
1618
|
return () => {
|
|
1619
1619
|
for (const r of n.reverse())
|
|
1620
1620
|
r();
|
|
1621
1621
|
};
|
|
1622
1622
|
}
|
|
1623
|
-
function
|
|
1623
|
+
function os(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
1624
1624
|
const n = new Map(e.map((l) => [l.id, l])), r = (l) => ({
|
|
1625
1625
|
id: l.id,
|
|
1626
1626
|
name: l.name,
|
|
@@ -1640,7 +1640,7 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1640
1640
|
const T = s.get(a.id);
|
|
1641
1641
|
if (T)
|
|
1642
1642
|
return T;
|
|
1643
|
-
const p = await
|
|
1643
|
+
const p = await de(a.id).then((m) => m?.blob ?? null).catch((m) => (y("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
|
|
1644
1644
|
attachmentId: a.id,
|
|
1645
1645
|
name: a.name,
|
|
1646
1646
|
message: m instanceof Error ? m.message : String(m)
|
|
@@ -1649,13 +1649,13 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1649
1649
|
return s.set(a.id, p), p;
|
|
1650
1650
|
if (!a.fileUrl)
|
|
1651
1651
|
throw new Error(`Pluno user file is missing content: ${l}`);
|
|
1652
|
-
const d = await fetch(a.fileUrl,
|
|
1652
|
+
const d = await fetch(a.fileUrl, fn(a.fileUrl));
|
|
1653
1653
|
if (!d.ok)
|
|
1654
1654
|
throw new Error(`Failed to load Pluno user file: ${l}`);
|
|
1655
1655
|
const f = await d.blob();
|
|
1656
1656
|
s.set(a.id, f);
|
|
1657
1657
|
const w = Date.now();
|
|
1658
|
-
return
|
|
1658
|
+
return Ft({
|
|
1659
1659
|
attachmentId: a.id,
|
|
1660
1660
|
name: a.name,
|
|
1661
1661
|
mimeType: a.mimeType,
|
|
@@ -1673,7 +1673,7 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1673
1673
|
});
|
|
1674
1674
|
}), f;
|
|
1675
1675
|
};
|
|
1676
|
-
return
|
|
1676
|
+
return jt(globalThis, "userFiles", {
|
|
1677
1677
|
list: () => e.map(r),
|
|
1678
1678
|
get: (l) => {
|
|
1679
1679
|
const a = n.get(l);
|
|
@@ -1684,7 +1684,7 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1684
1684
|
if (!T.startsWith("image/"))
|
|
1685
1685
|
throw new Error(`Pluno user file is not an image: ${l}`);
|
|
1686
1686
|
const p = h.type === T ? h : new Blob([h], { type: T });
|
|
1687
|
-
return
|
|
1687
|
+
return fs(T, p.size) > Ke ? {
|
|
1688
1688
|
type: "pluno.userFiles.inspectImage",
|
|
1689
1689
|
id: a.id,
|
|
1690
1690
|
name: a.name,
|
|
@@ -1711,13 +1711,13 @@ function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
});
|
|
1713
1713
|
}
|
|
1714
|
-
function
|
|
1715
|
-
return
|
|
1716
|
-
inspectImage: async (t, s) => await
|
|
1714
|
+
function as() {
|
|
1715
|
+
return jt(globalThis, "pageImages", {
|
|
1716
|
+
inspectImage: async (t, s) => await cs(t, s)
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
|
-
async function
|
|
1720
|
-
const s =
|
|
1719
|
+
async function cs(e, t = {}) {
|
|
1720
|
+
const s = hs(t.name), n = await ls(e);
|
|
1721
1721
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
1722
1722
|
type: "pluno.pageImages.inspectImage",
|
|
1723
1723
|
imageAttached: !1,
|
|
@@ -1735,15 +1735,15 @@ async function as(e, t = {}) {
|
|
|
1735
1735
|
imageAttachmentError: n.error
|
|
1736
1736
|
};
|
|
1737
1737
|
}
|
|
1738
|
-
async function
|
|
1738
|
+
async function ls(e) {
|
|
1739
1739
|
return e instanceof Blob ? e.type.startsWith("image/") ? e.size === 0 ? { ok: !1, error: "Page image is empty." } : e.size > 8 * 1024 * 1024 ? { ok: !1, error: gt } : {
|
|
1740
1740
|
ok: !0,
|
|
1741
1741
|
mimeType: e.type,
|
|
1742
1742
|
sizeBytes: e.size,
|
|
1743
1743
|
dataUrl: await ot(e)
|
|
1744
|
-
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } :
|
|
1744
|
+
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof e != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : us(e);
|
|
1745
1745
|
}
|
|
1746
|
-
function
|
|
1746
|
+
function us(e) {
|
|
1747
1747
|
if (!e.startsWith("data:") || !e.includes(","))
|
|
1748
1748
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
1749
1749
|
const [t, s] = e.slice(5).split(",", 2), n = t.split(";").map((c) => c.trim()).filter(Boolean), r = n[0] ?? "";
|
|
@@ -1754,7 +1754,7 @@ function ls(e) {
|
|
|
1754
1754
|
const i = s.replace(/[ \t\r\n\f]+/g, "");
|
|
1755
1755
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
|
|
1756
1756
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
1757
|
-
const o =
|
|
1757
|
+
const o = ds(i);
|
|
1758
1758
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
1759
1759
|
ok: !0,
|
|
1760
1760
|
mimeType: r,
|
|
@@ -1762,16 +1762,16 @@ function ls(e) {
|
|
|
1762
1762
|
dataUrl: `data:${r};base64,${i}`
|
|
1763
1763
|
};
|
|
1764
1764
|
}
|
|
1765
|
-
function
|
|
1765
|
+
function ds(e) {
|
|
1766
1766
|
if (e.length === 0 || e.length % 4 !== 0)
|
|
1767
1767
|
return null;
|
|
1768
1768
|
const t = e.length - e.replace(/=+$/, "").length;
|
|
1769
1769
|
return t > 2 ? null : e.length / 4 * 3 - t;
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function hs(e) {
|
|
1772
1772
|
return (typeof e == "string" ? e.trim() : "") || "Page image";
|
|
1773
1773
|
}
|
|
1774
|
-
function
|
|
1774
|
+
function ps(e) {
|
|
1775
1775
|
try {
|
|
1776
1776
|
e();
|
|
1777
1777
|
} catch {
|
|
@@ -1789,12 +1789,12 @@ function ot(e) {
|
|
|
1789
1789
|
}, n.onerror = () => s(n.error ?? new Error("Failed to read Pluno user file")), n.readAsDataURL(e);
|
|
1790
1790
|
});
|
|
1791
1791
|
}
|
|
1792
|
-
function
|
|
1792
|
+
function fs(e, t) {
|
|
1793
1793
|
return `data:${e};base64,`.length + Math.ceil(t / 3) * 4;
|
|
1794
1794
|
}
|
|
1795
1795
|
async function bt(e) {
|
|
1796
1796
|
const t = Object.getPrototypeOf(async function() {
|
|
1797
|
-
}).constructor, s = e.timeoutMs ??
|
|
1797
|
+
}).constructor, s = e.timeoutMs ?? ss, n = Date.now(), r = [];
|
|
1798
1798
|
let i;
|
|
1799
1799
|
const o = {
|
|
1800
1800
|
log: console.log,
|
|
@@ -1812,7 +1812,7 @@ async function bt(e) {
|
|
|
1812
1812
|
i = window.setTimeout(() => a(u), s);
|
|
1813
1813
|
})
|
|
1814
1814
|
]);
|
|
1815
|
-
return l === u ?
|
|
1815
|
+
return l === u ? gs(s) : {
|
|
1816
1816
|
ok: !0,
|
|
1817
1817
|
result: l,
|
|
1818
1818
|
console: r,
|
|
@@ -1841,7 +1841,7 @@ async function bt(e) {
|
|
|
1841
1841
|
i !== void 0 && window.clearTimeout(i), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
1844
|
-
function
|
|
1844
|
+
function gs(e) {
|
|
1845
1845
|
return {
|
|
1846
1846
|
ok: !1,
|
|
1847
1847
|
exception: {
|
|
@@ -1855,18 +1855,18 @@ function fs(e) {
|
|
|
1855
1855
|
}
|
|
1856
1856
|
};
|
|
1857
1857
|
}
|
|
1858
|
-
function
|
|
1858
|
+
function ms(e) {
|
|
1859
1859
|
return e.replace(/\/+$/, "");
|
|
1860
1860
|
}
|
|
1861
|
-
function
|
|
1861
|
+
function ys(e, t = location.origin) {
|
|
1862
1862
|
return /origin (?:is not allowed|does not match browser origin)/i.test(e) ? `Pluno widget blocked on ${t}: this domain is not allowed. Add ${t} in Pluno under Integration > Domains.` : null;
|
|
1863
1863
|
}
|
|
1864
|
-
function
|
|
1864
|
+
function Ts(e) {
|
|
1865
1865
|
const t = new URL("/api/product-agent/embed/ws", e);
|
|
1866
1866
|
return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
|
|
1867
1867
|
}
|
|
1868
1868
|
function S() {
|
|
1869
|
-
const e =
|
|
1869
|
+
const e = Kt();
|
|
1870
1870
|
return {
|
|
1871
1871
|
url: location.href,
|
|
1872
1872
|
title: document.title,
|
|
@@ -1874,19 +1874,19 @@ function S() {
|
|
|
1874
1874
|
...e ? { plunoProductAgentUi: e } : {}
|
|
1875
1875
|
};
|
|
1876
1876
|
}
|
|
1877
|
-
function
|
|
1877
|
+
function ws() {
|
|
1878
1878
|
return {
|
|
1879
1879
|
pageUrl: location.href,
|
|
1880
1880
|
pageTitle: document.title,
|
|
1881
|
-
htmlContent:
|
|
1881
|
+
htmlContent: ks()
|
|
1882
1882
|
};
|
|
1883
1883
|
}
|
|
1884
|
-
function
|
|
1885
|
-
return x.add(e), L || (L =
|
|
1884
|
+
function Is(e) {
|
|
1885
|
+
return x.add(e), L || (L = As()), () => {
|
|
1886
1886
|
x.delete(e), x.size === 0 && (L?.(), L = null);
|
|
1887
1887
|
};
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1889
|
+
function As() {
|
|
1890
1890
|
const e = () => {
|
|
1891
1891
|
for (const i of Array.from(x))
|
|
1892
1892
|
i();
|
|
@@ -1901,10 +1901,10 @@ function Is() {
|
|
|
1901
1901
|
window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
|
|
1902
1902
|
};
|
|
1903
1903
|
}
|
|
1904
|
-
function As() {
|
|
1905
|
-
return Xt()?.surface === "browser_extension_sdk_preview";
|
|
1906
|
-
}
|
|
1907
1904
|
function Ss() {
|
|
1905
|
+
return Kt()?.surface === "browser_extension_sdk_preview";
|
|
1906
|
+
}
|
|
1907
|
+
function ks() {
|
|
1908
1908
|
const e = document.body?.cloneNode(!0);
|
|
1909
1909
|
return e instanceof HTMLElement ? (e.querySelectorAll(
|
|
1910
1910
|
[
|
|
@@ -1928,7 +1928,7 @@ function Ss() {
|
|
|
1928
1928
|
s.name === "href" || s.name === "aria-label" || s.name === "role" || t.removeAttribute(s.name);
|
|
1929
1929
|
}), e.textContent?.replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[email]").replace(/\b(?:\d[ -]*?){13,19}\b/g, "[number]").replace(/\b(?:sk|pk|tok|key|secret|token)_[A-Za-z0-9_-]{8,}\b/gi, "[secret]").replace(/\s+/g, " ").trim().slice(0, 12e3) ?? "") : "";
|
|
1930
1930
|
}
|
|
1931
|
-
function
|
|
1931
|
+
function Kt() {
|
|
1932
1932
|
const e = document.querySelector(St);
|
|
1933
1933
|
if (!(e ?? document.querySelector(rt)))
|
|
1934
1934
|
return;
|
|
@@ -1949,18 +1949,18 @@ function Xt() {
|
|
|
1949
1949
|
},
|
|
1950
1950
|
{
|
|
1951
1951
|
name: "widget_panel",
|
|
1952
|
-
selector:
|
|
1952
|
+
selector: be,
|
|
1953
1953
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
1954
1954
|
},
|
|
1955
1955
|
{
|
|
1956
1956
|
name: "widget_timeline",
|
|
1957
|
-
selector:
|
|
1957
|
+
selector: Me,
|
|
1958
1958
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
1959
1959
|
}
|
|
1960
1960
|
]
|
|
1961
1961
|
};
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1963
|
+
function Es(e) {
|
|
1964
1964
|
try {
|
|
1965
1965
|
const t = JSON.parse(e);
|
|
1966
1966
|
return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
|
|
@@ -1974,7 +1974,7 @@ function Mt(e, t) {
|
|
|
1974
1974
|
const s = e[t];
|
|
1975
1975
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
1976
1976
|
}
|
|
1977
|
-
function
|
|
1977
|
+
function _s(e) {
|
|
1978
1978
|
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
|
|
1979
1979
|
}
|
|
1980
1980
|
function Rs(e) {
|
|
@@ -1994,7 +1994,7 @@ function Cs(e) {
|
|
|
1994
1994
|
const t = e.javascript;
|
|
1995
1995
|
return typeof t != "string" || !t.trim() ? null : { javascript: t };
|
|
1996
1996
|
}
|
|
1997
|
-
function
|
|
1997
|
+
function bs(e, t) {
|
|
1998
1998
|
return t ? e && typeof e == "object" ? {
|
|
1999
1999
|
...e,
|
|
2000
2000
|
helperError: t
|
|
@@ -2004,13 +2004,13 @@ function _s(e, t) {
|
|
|
2004
2004
|
helperError: t
|
|
2005
2005
|
} : e;
|
|
2006
2006
|
}
|
|
2007
|
-
function
|
|
2007
|
+
function Ms(e) {
|
|
2008
2008
|
if (!e || typeof e != "object")
|
|
2009
2009
|
return e;
|
|
2010
2010
|
const t = e;
|
|
2011
2011
|
return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
|
|
2012
2012
|
}
|
|
2013
|
-
function
|
|
2013
|
+
function Us() {
|
|
2014
2014
|
const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
|
|
2015
2015
|
if (t)
|
|
2016
2016
|
return t;
|
|
@@ -2020,7 +2020,7 @@ function Ms() {
|
|
|
2020
2020
|
function B() {
|
|
2021
2021
|
return crypto.randomUUID();
|
|
2022
2022
|
}
|
|
2023
|
-
function
|
|
2023
|
+
function Ps(e) {
|
|
2024
2024
|
if (!e || typeof e != "object")
|
|
2025
2025
|
return null;
|
|
2026
2026
|
const t = e, s = typeof t.id == "string" ? t.id : null;
|
|
@@ -2031,14 +2031,14 @@ function Us(e) {
|
|
|
2031
2031
|
avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
|
|
2032
2032
|
} : null;
|
|
2033
2033
|
}
|
|
2034
|
-
function
|
|
2034
|
+
function Ds(e, t) {
|
|
2035
2035
|
return Array.isArray(e) ? lt(
|
|
2036
2036
|
ut(
|
|
2037
|
-
e.map((s) =>
|
|
2037
|
+
e.map((s) => Jt(s, t)).filter((s) => s !== null)
|
|
2038
2038
|
)
|
|
2039
2039
|
) : [];
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2041
|
+
function vs(e) {
|
|
2042
2042
|
return Array.isArray(e) ? e.flatMap((t) => {
|
|
2043
2043
|
if (!t || typeof t != "object")
|
|
2044
2044
|
return [];
|
|
@@ -2057,7 +2057,7 @@ function Ds(e) {
|
|
|
2057
2057
|
];
|
|
2058
2058
|
}) : [];
|
|
2059
2059
|
}
|
|
2060
|
-
function
|
|
2060
|
+
function Jt(e, t) {
|
|
2061
2061
|
if (!e || typeof e != "object")
|
|
2062
2062
|
return null;
|
|
2063
2063
|
const s = e, n = s.data;
|
|
@@ -2067,48 +2067,86 @@ function Kt(e, t) {
|
|
|
2067
2067
|
if (r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
2068
2068
|
return null;
|
|
2069
2069
|
if (r.type === "message") {
|
|
2070
|
+
if (r.hiddenFromTranscript === !0)
|
|
2071
|
+
return null;
|
|
2070
2072
|
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
|
|
2071
2073
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2072
2074
|
role: i,
|
|
2073
|
-
content:
|
|
2075
|
+
content: xs(r.content),
|
|
2074
2076
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2075
|
-
respondsToUserMessageId:
|
|
2076
|
-
...
|
|
2077
|
-
attachments:
|
|
2077
|
+
respondsToUserMessageId: C(r) ?? void 0,
|
|
2078
|
+
...E(r) ? { runId: E(r) } : {},
|
|
2079
|
+
attachments: te(r.attachments, t)
|
|
2078
2080
|
};
|
|
2079
2081
|
return typeof r.clientMessageId == "string" && Object.defineProperty(o, "clientMessageId", {
|
|
2080
2082
|
value: r.clientMessageId,
|
|
2081
2083
|
enumerable: !1
|
|
2082
2084
|
}), o;
|
|
2083
2085
|
}
|
|
2084
|
-
|
|
2086
|
+
if (r.type === "function_call_output") {
|
|
2087
|
+
const i = Os(r.output);
|
|
2088
|
+
return i ? {
|
|
2089
|
+
id: String(s.id ?? crypto.randomUUID()),
|
|
2090
|
+
role: "tool",
|
|
2091
|
+
content: `Connect ${i.appName} to continue`,
|
|
2092
|
+
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2093
|
+
respondsToUserMessageId: C(r) ?? void 0,
|
|
2094
|
+
...E(r) ? { runId: E(r) } : {},
|
|
2095
|
+
dataType: "function_call_output",
|
|
2096
|
+
toolName: "authenticate_pipedream_app",
|
|
2097
|
+
callId: Ut(r) ?? void 0,
|
|
2098
|
+
integrationAuthRequest: i
|
|
2099
|
+
} : null;
|
|
2100
|
+
}
|
|
2101
|
+
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
|
|
2085
2102
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2086
2103
|
role: "tool",
|
|
2087
|
-
content: Ns(r),
|
|
2104
|
+
content: r.type === "mcp_call" ? Ns(r) : Bs(r),
|
|
2088
2105
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2089
|
-
respondsToUserMessageId:
|
|
2090
|
-
...
|
|
2106
|
+
respondsToUserMessageId: C(r) ?? void 0,
|
|
2107
|
+
...E(r) ? { runId: E(r) } : {},
|
|
2091
2108
|
dataType: String(r.type),
|
|
2092
2109
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
2093
|
-
callId:
|
|
2110
|
+
callId: Ut(r) ?? void 0,
|
|
2094
2111
|
loading: r.localExecutionStatus === "running"
|
|
2095
2112
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
2096
2113
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2097
2114
|
role: "system",
|
|
2098
|
-
content:
|
|
2115
|
+
content: Ls(r),
|
|
2099
2116
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2100
|
-
respondsToUserMessageId:
|
|
2101
|
-
...
|
|
2117
|
+
respondsToUserMessageId: C(r) ?? void 0,
|
|
2118
|
+
...E(r) ? { runId: E(r) } : {},
|
|
2102
2119
|
dataType: String(r.type),
|
|
2103
2120
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
2104
2121
|
...typeof r.retryable == "boolean" ? { retryable: r.retryable } : {},
|
|
2105
2122
|
...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
|
|
2106
2123
|
} : null;
|
|
2107
2124
|
}
|
|
2108
|
-
function
|
|
2125
|
+
function Ns(e) {
|
|
2126
|
+
const s = (typeof e.server_label == "string" ? e.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
|
|
2127
|
+
return s ? `Using ${s}` : "Using connected integration";
|
|
2128
|
+
}
|
|
2129
|
+
function Os(e) {
|
|
2130
|
+
if (typeof e != "string")
|
|
2131
|
+
return null;
|
|
2132
|
+
try {
|
|
2133
|
+
const t = JSON.parse(e);
|
|
2134
|
+
return t.type !== "pipedream_auth_required" || typeof t.authRequestId != "string" || typeof t.appSlug != "string" || typeof t.appName != "string" || typeof t.expiresAt != "string" ? null : {
|
|
2135
|
+
type: "pipedream_auth_required",
|
|
2136
|
+
authRequestId: t.authRequestId,
|
|
2137
|
+
appSlug: t.appSlug,
|
|
2138
|
+
appName: t.appName,
|
|
2139
|
+
appLogo: typeof t.appLogo == "string" ? t.appLogo : null,
|
|
2140
|
+
expiresAt: t.expiresAt
|
|
2141
|
+
};
|
|
2142
|
+
} catch {
|
|
2143
|
+
return null;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
function Ls(e) {
|
|
2109
2147
|
return typeof e.message == "string" && e.message.trim().length > 0 ? e.message.replace(/Product Agent/g, "Pluno") : e.type === "run_status" && e.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : e.type === "run_status" && e.status === "stopped" ? "Pluno stopped." : "Pluno run status changed.";
|
|
2110
2148
|
}
|
|
2111
|
-
function
|
|
2149
|
+
function Bs(e) {
|
|
2112
2150
|
if (e.type === "web_search_call") {
|
|
2113
2151
|
const t = e.action;
|
|
2114
2152
|
if (t && typeof t == "object") {
|
|
@@ -2120,9 +2158,9 @@ function Ns(e) {
|
|
|
2120
2158
|
}
|
|
2121
2159
|
return "Searching the web";
|
|
2122
2160
|
}
|
|
2123
|
-
return
|
|
2161
|
+
return qs(e);
|
|
2124
2162
|
}
|
|
2125
|
-
function
|
|
2163
|
+
function qs(e) {
|
|
2126
2164
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
2127
2165
|
return e.summary;
|
|
2128
2166
|
if (typeof e.arguments == "string")
|
|
@@ -2135,11 +2173,11 @@ function Os(e) {
|
|
|
2135
2173
|
}
|
|
2136
2174
|
return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
|
|
2137
2175
|
}
|
|
2138
|
-
function
|
|
2176
|
+
function Ut(e) {
|
|
2139
2177
|
const t = e.callId ?? e.call_id;
|
|
2140
2178
|
return typeof t == "string" && t ? t : null;
|
|
2141
2179
|
}
|
|
2142
|
-
function
|
|
2180
|
+
function xs(e) {
|
|
2143
2181
|
return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
|
|
2144
2182
|
if (!t || typeof t != "object")
|
|
2145
2183
|
return "";
|
|
@@ -2147,8 +2185,8 @@ function Bs(e) {
|
|
|
2147
2185
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
2148
2186
|
}).filter(Boolean).join("") : "";
|
|
2149
2187
|
}
|
|
2150
|
-
function
|
|
2151
|
-
const s =
|
|
2188
|
+
function Fs(e, t) {
|
|
2189
|
+
const s = Yt(e, t), n = $s(e, t), r = n.findIndex((o) => o.id === s.id);
|
|
2152
2190
|
if (r === -1)
|
|
2153
2191
|
return lt(
|
|
2154
2192
|
ut([...n, s])
|
|
@@ -2156,52 +2194,52 @@ function qs(e, t) {
|
|
|
2156
2194
|
const i = [...n];
|
|
2157
2195
|
return i[r] = s, lt(ut(i));
|
|
2158
2196
|
}
|
|
2159
|
-
function
|
|
2197
|
+
function Hs(e, t) {
|
|
2160
2198
|
const s = t.map(
|
|
2161
|
-
(n) =>
|
|
2199
|
+
(n) => Yt(e, n)
|
|
2162
2200
|
);
|
|
2163
2201
|
return t.length > 0 ? s : e.filter(mt);
|
|
2164
2202
|
}
|
|
2165
|
-
function
|
|
2203
|
+
function Yt(e, t) {
|
|
2166
2204
|
if (t.role !== "user" || !t.attachments?.length)
|
|
2167
2205
|
return t;
|
|
2168
2206
|
const s = e.find(
|
|
2169
|
-
(r) => r.role === "user" && (r.id === t.id || mt(r) &&
|
|
2207
|
+
(r) => r.role === "user" && (r.id === t.id || mt(r) && Vt(r, t))
|
|
2170
2208
|
);
|
|
2171
2209
|
if (!s?.attachments?.length)
|
|
2172
2210
|
return t;
|
|
2173
2211
|
const n = t.attachments.map((r) => {
|
|
2174
|
-
const i =
|
|
2175
|
-
return i ?
|
|
2212
|
+
const i = Ws(s.attachments ?? [], r);
|
|
2213
|
+
return i ? js(r, i) : r;
|
|
2176
2214
|
});
|
|
2177
2215
|
return { ...t, attachments: n };
|
|
2178
2216
|
}
|
|
2179
|
-
function
|
|
2217
|
+
function Ws(e, t) {
|
|
2180
2218
|
return t.id ? e.find((s) => s.id === t.id) ?? null : null;
|
|
2181
2219
|
}
|
|
2182
|
-
function
|
|
2220
|
+
function js(e, t) {
|
|
2183
2221
|
const { previewUrl: s } = t;
|
|
2184
2222
|
return s ? { ...e, previewUrl: s } : e;
|
|
2185
2223
|
}
|
|
2186
|
-
function
|
|
2224
|
+
function $s(e, t) {
|
|
2187
2225
|
if (t.role !== "user")
|
|
2188
2226
|
return e;
|
|
2189
2227
|
const s = e.findIndex(
|
|
2190
|
-
(r) => mt(r) &&
|
|
2228
|
+
(r) => mt(r) && Vt(r, t)
|
|
2191
2229
|
);
|
|
2192
2230
|
if (s === -1)
|
|
2193
2231
|
return e;
|
|
2194
2232
|
const n = [...e];
|
|
2195
2233
|
return n.splice(s, 1), n;
|
|
2196
2234
|
}
|
|
2197
|
-
function
|
|
2198
|
-
const s =
|
|
2235
|
+
function Vt(e, t) {
|
|
2236
|
+
const s = Pt(e), n = Pt(t);
|
|
2199
2237
|
return s && n ? s === n : e.content === t.content;
|
|
2200
2238
|
}
|
|
2201
2239
|
function mt(e) {
|
|
2202
2240
|
return e.role === "user" && (e.id.startsWith("local-") || e.id.startsWith("optimistic-user-message:"));
|
|
2203
2241
|
}
|
|
2204
|
-
function
|
|
2242
|
+
function Pt(e) {
|
|
2205
2243
|
const t = e.clientMessageId;
|
|
2206
2244
|
if (t)
|
|
2207
2245
|
return t;
|
|
@@ -2210,8 +2248,8 @@ function Ut(e) {
|
|
|
2210
2248
|
);
|
|
2211
2249
|
return n ? e.id.slice(n.length) : null;
|
|
2212
2250
|
}
|
|
2213
|
-
function
|
|
2214
|
-
const t =
|
|
2251
|
+
function Dt(e) {
|
|
2252
|
+
const t = Zt(e);
|
|
2215
2253
|
if (t === null)
|
|
2216
2254
|
return !1;
|
|
2217
2255
|
for (let s = e.length - 1; s > t; s -= 1) {
|
|
@@ -2227,17 +2265,17 @@ function Pt(e) {
|
|
|
2227
2265
|
}
|
|
2228
2266
|
return !1;
|
|
2229
2267
|
}
|
|
2230
|
-
function
|
|
2231
|
-
const t =
|
|
2268
|
+
function zs(e) {
|
|
2269
|
+
const t = Zt(e);
|
|
2232
2270
|
return t === null ? e.some((s) => s.role === "assistant") : e.slice(t + 1).some((s) => s.role === "assistant");
|
|
2233
2271
|
}
|
|
2234
|
-
function
|
|
2272
|
+
function Zt(e) {
|
|
2235
2273
|
for (let t = e.length - 1; t >= 0; t -= 1)
|
|
2236
2274
|
if (e[t].role === "user")
|
|
2237
2275
|
return t;
|
|
2238
2276
|
return null;
|
|
2239
2277
|
}
|
|
2240
|
-
function
|
|
2278
|
+
function Gs(e) {
|
|
2241
2279
|
return e.role === "assistant" ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
|
|
2242
2280
|
}
|
|
2243
2281
|
function yt(e) {
|
|
@@ -2263,10 +2301,10 @@ function v(e) {
|
|
|
2263
2301
|
function at(e) {
|
|
2264
2302
|
return e?.retryable !== !0 ? !1 : e.type === "run_error" ? !0 : e.type === "run_status" && e.status === "interrupted";
|
|
2265
2303
|
}
|
|
2266
|
-
function
|
|
2304
|
+
function vt(e) {
|
|
2267
2305
|
return e?.type === "run_status" && e.status === "interrupted" && e.reason === "backend_restart";
|
|
2268
2306
|
}
|
|
2269
|
-
function
|
|
2307
|
+
function Xs(e, t) {
|
|
2270
2308
|
const s = yt(t);
|
|
2271
2309
|
if (s === null)
|
|
2272
2310
|
return !1;
|
|
@@ -2274,7 +2312,7 @@ function zs(e, t) {
|
|
|
2274
2312
|
if (typeof r != "string" || !r)
|
|
2275
2313
|
return !1;
|
|
2276
2314
|
const i = e.findIndex((o) => o.role === "user" && o.id === r);
|
|
2277
|
-
return i === -1 ? !1 : e.slice(i + 1).some(
|
|
2315
|
+
return i === -1 ? !1 : e.slice(i + 1).some(Gs);
|
|
2278
2316
|
}
|
|
2279
2317
|
function ct(e) {
|
|
2280
2318
|
const t = yt(e);
|
|
@@ -2289,7 +2327,7 @@ function ct(e) {
|
|
|
2289
2327
|
const r = n.clientMessageId;
|
|
2290
2328
|
return typeof r == "string" ? r : null;
|
|
2291
2329
|
}
|
|
2292
|
-
function
|
|
2330
|
+
function Ks(e) {
|
|
2293
2331
|
const t = yt(e);
|
|
2294
2332
|
if (t === null)
|
|
2295
2333
|
return null;
|
|
@@ -2304,22 +2342,22 @@ function Gs(e) {
|
|
|
2304
2342
|
if (i.type === "message" && i.role === "assistant")
|
|
2305
2343
|
return null;
|
|
2306
2344
|
if (i.type === "run_error")
|
|
2307
|
-
return i.retryable !== !0 ? null :
|
|
2345
|
+
return i.retryable !== !0 ? null : Nt(e, i) ?? ct(e);
|
|
2308
2346
|
if (i.type === "run_status")
|
|
2309
|
-
return i.status === "interrupted" && i.retryable === !0 ?
|
|
2347
|
+
return i.status === "interrupted" && i.retryable === !0 ? Nt(e, i) ?? ct(e) : null;
|
|
2310
2348
|
}
|
|
2311
2349
|
return null;
|
|
2312
2350
|
}
|
|
2313
|
-
function
|
|
2351
|
+
function Nt(e, t) {
|
|
2314
2352
|
if (typeof t.clientMessageId == "string")
|
|
2315
2353
|
return t.clientMessageId;
|
|
2316
|
-
const s =
|
|
2354
|
+
const s = C(t);
|
|
2317
2355
|
if (!s)
|
|
2318
2356
|
return null;
|
|
2319
2357
|
const n = e.find((i) => I(i, "id") === s), r = v(n);
|
|
2320
2358
|
return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
|
|
2321
2359
|
}
|
|
2322
|
-
function
|
|
2360
|
+
function Js(e, t) {
|
|
2323
2361
|
let s = 0;
|
|
2324
2362
|
for (const n of e) {
|
|
2325
2363
|
if (!n || typeof n != "object")
|
|
@@ -2332,28 +2370,28 @@ function Xs(e, t) {
|
|
|
2332
2370
|
}
|
|
2333
2371
|
return s;
|
|
2334
2372
|
}
|
|
2335
|
-
function
|
|
2336
|
-
if (!t || !
|
|
2373
|
+
function Ot(e, t, s, n) {
|
|
2374
|
+
if (!t || !Ys(e))
|
|
2337
2375
|
return !1;
|
|
2338
2376
|
const r = e;
|
|
2339
|
-
return !(at(r) || s !== null &&
|
|
2377
|
+
return !(at(r) || s !== null && C(r) !== s || n !== null && E(r) !== n);
|
|
2340
2378
|
}
|
|
2341
|
-
function
|
|
2379
|
+
function Ys(e) {
|
|
2342
2380
|
if (!e || typeof e != "object")
|
|
2343
2381
|
return !1;
|
|
2344
2382
|
const t = e;
|
|
2345
2383
|
return t.type === "message" && t.role === "assistant" ? !0 : t.type === "run_error" ? t.stage !== "tool_execution" : t.type === "run_status" && (t.status === "stopped" || t.status === "interrupted");
|
|
2346
2384
|
}
|
|
2347
|
-
function
|
|
2385
|
+
function Vs(e) {
|
|
2348
2386
|
if (!e || typeof e != "object")
|
|
2349
2387
|
return !1;
|
|
2350
2388
|
const t = e;
|
|
2351
2389
|
return t.type === "message" && t.role === "user" ? !1 : t.type === "message" || t.type === "function_call" || t.type === "function_call_output" || t.type === "run_error" || t.type === "run_status";
|
|
2352
2390
|
}
|
|
2353
2391
|
function lt(e) {
|
|
2354
|
-
return e.filter((t, s) => Tt(t) ? !
|
|
2392
|
+
return e.filter((t, s) => Tt(t) ? !nn(e, s) && !en(e, s) && !sn(e, s) : Zs(t) ? t.retryable === !0 && tn(e, s) ? !1 : !Qs(e, s) : !0);
|
|
2355
2393
|
}
|
|
2356
|
-
function
|
|
2394
|
+
function Zs(e) {
|
|
2357
2395
|
return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
|
|
2358
2396
|
}
|
|
2359
2397
|
function Tt(e) {
|
|
@@ -2375,7 +2413,7 @@ function ut(e) {
|
|
|
2375
2413
|
n.has(i.id) || (r.push(i), i.role === "user" && r.push(...s.get(i.id) ?? []));
|
|
2376
2414
|
return r;
|
|
2377
2415
|
}
|
|
2378
|
-
function
|
|
2416
|
+
function Qs(e, t) {
|
|
2379
2417
|
const s = e[t];
|
|
2380
2418
|
for (let n = t + 1; n < e.length; n += 1) {
|
|
2381
2419
|
const r = e[n];
|
|
@@ -2386,7 +2424,7 @@ function Vs(e, t) {
|
|
|
2386
2424
|
}
|
|
2387
2425
|
return !1;
|
|
2388
2426
|
}
|
|
2389
|
-
function
|
|
2427
|
+
function tn(e, t) {
|
|
2390
2428
|
const s = e[t];
|
|
2391
2429
|
if (!s.respondsToUserMessageId)
|
|
2392
2430
|
return !1;
|
|
@@ -2399,21 +2437,21 @@ function Zs(e, t) {
|
|
|
2399
2437
|
}
|
|
2400
2438
|
return !1;
|
|
2401
2439
|
}
|
|
2402
|
-
function
|
|
2440
|
+
function en(e, t) {
|
|
2403
2441
|
const s = e[t];
|
|
2404
2442
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2405
2443
|
if (e[n].role === "assistant" && G(s, e[n]))
|
|
2406
2444
|
return !0;
|
|
2407
2445
|
return !1;
|
|
2408
2446
|
}
|
|
2409
|
-
function
|
|
2447
|
+
function sn(e, t) {
|
|
2410
2448
|
const s = e[t];
|
|
2411
2449
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2412
2450
|
if (e[n].role === "tool" && G(s, e[n]))
|
|
2413
2451
|
return !0;
|
|
2414
2452
|
return !1;
|
|
2415
2453
|
}
|
|
2416
|
-
function
|
|
2454
|
+
function nn(e, t) {
|
|
2417
2455
|
const s = e[t];
|
|
2418
2456
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2419
2457
|
if (Tt(e[n]) && G(s, e[n]))
|
|
@@ -2426,15 +2464,15 @@ function G(e, t) {
|
|
|
2426
2464
|
function I(e, t) {
|
|
2427
2465
|
return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
|
|
2428
2466
|
}
|
|
2429
|
-
function
|
|
2467
|
+
function rn(e, t) {
|
|
2430
2468
|
try {
|
|
2431
|
-
const s = window.localStorage.getItem(`${
|
|
2469
|
+
const s = window.localStorage.getItem(`${Gt}${e}`);
|
|
2432
2470
|
if (!s)
|
|
2433
2471
|
return null;
|
|
2434
2472
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
2435
2473
|
if (t !== void 0 && r !== t)
|
|
2436
2474
|
return null;
|
|
2437
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
2475
|
+
const i = Array.isArray(n.messages) ? n.messages.map(yn).filter((o) => !!o) : [];
|
|
2438
2476
|
return {
|
|
2439
2477
|
sessionId: r,
|
|
2440
2478
|
messages: i
|
|
@@ -2443,20 +2481,20 @@ function sn(e, t) {
|
|
|
2443
2481
|
return null;
|
|
2444
2482
|
}
|
|
2445
2483
|
}
|
|
2446
|
-
function
|
|
2484
|
+
function on(e, t) {
|
|
2447
2485
|
try {
|
|
2448
2486
|
window.localStorage.setItem(
|
|
2449
|
-
`${
|
|
2487
|
+
`${Gt}${e}`,
|
|
2450
2488
|
JSON.stringify({
|
|
2451
2489
|
sessionId: t.sessionId,
|
|
2452
|
-
messages: t.messages.slice(-
|
|
2490
|
+
messages: t.messages.slice(-Je).map(Tn)
|
|
2453
2491
|
})
|
|
2454
2492
|
);
|
|
2455
2493
|
} catch {
|
|
2456
2494
|
return;
|
|
2457
2495
|
}
|
|
2458
2496
|
}
|
|
2459
|
-
function
|
|
2497
|
+
function an(e) {
|
|
2460
2498
|
try {
|
|
2461
2499
|
const t = window.localStorage.getItem(`${it}${e}`);
|
|
2462
2500
|
if (!t)
|
|
@@ -2482,7 +2520,7 @@ function P(e, t) {
|
|
|
2482
2520
|
return;
|
|
2483
2521
|
}
|
|
2484
2522
|
}
|
|
2485
|
-
function
|
|
2523
|
+
function Qt(e, t) {
|
|
2486
2524
|
try {
|
|
2487
2525
|
const s = `${z}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
|
|
2488
2526
|
...o,
|
|
@@ -2498,28 +2536,28 @@ function Zt(e, t) {
|
|
|
2498
2536
|
} catch {
|
|
2499
2537
|
}
|
|
2500
2538
|
}
|
|
2501
|
-
function
|
|
2539
|
+
function cn(e, t) {
|
|
2502
2540
|
try {
|
|
2503
2541
|
if (window.sessionStorage.getItem(`${z}${e}`) === null)
|
|
2504
2542
|
return;
|
|
2505
2543
|
} catch {
|
|
2506
2544
|
return;
|
|
2507
2545
|
}
|
|
2508
|
-
|
|
2546
|
+
Qt(e, t);
|
|
2509
2547
|
}
|
|
2510
|
-
function
|
|
2548
|
+
function ln(e) {
|
|
2511
2549
|
try {
|
|
2512
2550
|
const t = `${z}${e}`, s = window.sessionStorage.getItem(t);
|
|
2513
2551
|
if (window.sessionStorage.removeItem(t), !s)
|
|
2514
2552
|
return [];
|
|
2515
2553
|
const n = JSON.parse(s);
|
|
2516
|
-
return Array.isArray(n) ? n.flatMap((r) =>
|
|
2554
|
+
return Array.isArray(n) ? n.flatMap((r) => dn(r) ? [{
|
|
2517
2555
|
...r.event,
|
|
2518
2556
|
page: S(),
|
|
2519
2557
|
rawOutput: {
|
|
2520
2558
|
pageContextRestarted: !0,
|
|
2521
2559
|
outcome: "unknown",
|
|
2522
|
-
message:
|
|
2560
|
+
message: un(location.href),
|
|
2523
2561
|
currentUrl: location.href,
|
|
2524
2562
|
console: [],
|
|
2525
2563
|
metadata: {
|
|
@@ -2536,17 +2574,17 @@ function an(e) {
|
|
|
2536
2574
|
return [];
|
|
2537
2575
|
}
|
|
2538
2576
|
}
|
|
2539
|
-
function
|
|
2577
|
+
function un(e) {
|
|
2540
2578
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
2541
2579
|
Current URL: ${e}`;
|
|
2542
2580
|
}
|
|
2543
|
-
function
|
|
2581
|
+
function dn(e) {
|
|
2544
2582
|
if (!e || typeof e != "object")
|
|
2545
2583
|
return !1;
|
|
2546
2584
|
const t = e, s = t.event;
|
|
2547
2585
|
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";
|
|
2548
2586
|
}
|
|
2549
|
-
function
|
|
2587
|
+
function hn(e, t) {
|
|
2550
2588
|
const s = new Set(
|
|
2551
2589
|
e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
2552
2590
|
);
|
|
@@ -2555,7 +2593,7 @@ function un(e, t) {
|
|
|
2555
2593
|
...t.filter((n) => !s.has(n.callId))
|
|
2556
2594
|
];
|
|
2557
2595
|
}
|
|
2558
|
-
function
|
|
2596
|
+
function pn(e) {
|
|
2559
2597
|
try {
|
|
2560
2598
|
window.sessionStorage.removeItem(`${z}${e}`);
|
|
2561
2599
|
} catch {
|
|
@@ -2566,15 +2604,15 @@ function wt(e) {
|
|
|
2566
2604
|
if (!e || typeof e != "object")
|
|
2567
2605
|
return !1;
|
|
2568
2606
|
const t = e;
|
|
2569
|
-
return t.type === "chat.user_message" ? typeof t.content == "string" &&
|
|
2607
|
+
return t.type === "chat.user_message" ? typeof t.content == "string" && Lt(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? Lt(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && t.toolName === "execute_code" : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" && (t.reason === "user_requested" || t.reason === "new_chat" || t.reason === "session_switch") : !1;
|
|
2570
2608
|
}
|
|
2571
|
-
function
|
|
2609
|
+
function Lt(e) {
|
|
2572
2610
|
if (!e || typeof e != "object")
|
|
2573
2611
|
return !1;
|
|
2574
2612
|
const t = e;
|
|
2575
2613
|
return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
|
|
2576
2614
|
}
|
|
2577
|
-
function
|
|
2615
|
+
function te(e, t) {
|
|
2578
2616
|
if (!Array.isArray(e))
|
|
2579
2617
|
return;
|
|
2580
2618
|
const s = e.filter((r) => {
|
|
@@ -2582,24 +2620,24 @@ function Qt(e, t) {
|
|
|
2582
2620
|
return !1;
|
|
2583
2621
|
const i = r;
|
|
2584
2622
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
2585
|
-
}), n = t ? s.map((r) =>
|
|
2623
|
+
}), n = t ? s.map((r) => ee(r, t)) : s;
|
|
2586
2624
|
return n.length > 0 ? n : void 0;
|
|
2587
2625
|
}
|
|
2588
|
-
function
|
|
2626
|
+
function ee(e, t) {
|
|
2589
2627
|
return e.fileUrl?.startsWith("/") ? {
|
|
2590
2628
|
...e,
|
|
2591
2629
|
fileUrl: new URL(e.fileUrl, t).toString()
|
|
2592
2630
|
} : e;
|
|
2593
2631
|
}
|
|
2594
|
-
function
|
|
2595
|
-
if (
|
|
2632
|
+
function fn(e) {
|
|
2633
|
+
if (gn(e))
|
|
2596
2634
|
return {
|
|
2597
2635
|
headers: {
|
|
2598
2636
|
"ngrok-skip-browser-warning": "true"
|
|
2599
2637
|
}
|
|
2600
2638
|
};
|
|
2601
2639
|
}
|
|
2602
|
-
function
|
|
2640
|
+
function gn(e) {
|
|
2603
2641
|
try {
|
|
2604
2642
|
const t = new URL(e).hostname;
|
|
2605
2643
|
return t.endsWith(".ngrok-free.dev") || t.endsWith(".ngrok-free.app") || t.endsWith(".ngrok.app") || t.endsWith(".ngrok.io");
|
|
@@ -2607,14 +2645,14 @@ function pn(e) {
|
|
|
2607
2645
|
return !1;
|
|
2608
2646
|
}
|
|
2609
2647
|
}
|
|
2610
|
-
function
|
|
2611
|
-
return e.type ||
|
|
2648
|
+
function Bt(e) {
|
|
2649
|
+
return e.type || mn(e.name) || "application/octet-stream";
|
|
2612
2650
|
}
|
|
2613
|
-
function
|
|
2651
|
+
function mn(e) {
|
|
2614
2652
|
const t = e.toLowerCase();
|
|
2615
2653
|
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
2616
2654
|
}
|
|
2617
|
-
function
|
|
2655
|
+
function yn(e) {
|
|
2618
2656
|
if (!e || typeof e != "object")
|
|
2619
2657
|
return null;
|
|
2620
2658
|
const t = e;
|
|
@@ -2627,11 +2665,11 @@ function gn(e) {
|
|
|
2627
2665
|
...typeof t.runId == "string" ? { runId: t.runId } : {},
|
|
2628
2666
|
dataType: typeof t.dataType == "string" ? t.dataType : void 0,
|
|
2629
2667
|
securitySettingsUrl: typeof t.securitySettingsUrl == "string" ? t.securitySettingsUrl : void 0,
|
|
2630
|
-
attachments:
|
|
2668
|
+
attachments: te(t.attachments)?.map(It),
|
|
2631
2669
|
loading: typeof t.loading == "boolean" ? t.loading : void 0
|
|
2632
2670
|
};
|
|
2633
2671
|
}
|
|
2634
|
-
function
|
|
2672
|
+
function Tn(e) {
|
|
2635
2673
|
return e.attachments?.length ? {
|
|
2636
2674
|
...e,
|
|
2637
2675
|
attachments: e.attachments.map(It)
|
|
@@ -2646,19 +2684,19 @@ function It(e) {
|
|
|
2646
2684
|
} = e;
|
|
2647
2685
|
return r;
|
|
2648
2686
|
}
|
|
2649
|
-
function
|
|
2687
|
+
function C(e) {
|
|
2650
2688
|
const t = e.respondsToUserMessageId;
|
|
2651
2689
|
return typeof t == "string" && t ? t : null;
|
|
2652
2690
|
}
|
|
2653
|
-
function
|
|
2691
|
+
function E(e) {
|
|
2654
2692
|
const t = e.runId;
|
|
2655
2693
|
return typeof t == "string" && t ? t : null;
|
|
2656
2694
|
}
|
|
2657
|
-
function
|
|
2695
|
+
function wn(e) {
|
|
2658
2696
|
const t = e?.timeoutMs;
|
|
2659
|
-
return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <=
|
|
2697
|
+
return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= ns);
|
|
2660
2698
|
}
|
|
2661
|
-
function
|
|
2699
|
+
function se(e) {
|
|
2662
2700
|
const t = {};
|
|
2663
2701
|
try {
|
|
2664
2702
|
new Headers(e).forEach((s, n) => {
|
|
@@ -2670,23 +2708,23 @@ function ee(e) {
|
|
|
2670
2708
|
return t;
|
|
2671
2709
|
}
|
|
2672
2710
|
function At(e, t) {
|
|
2673
|
-
return
|
|
2711
|
+
return ce(e) ? X : _(j(t), Ge);
|
|
2674
2712
|
}
|
|
2675
|
-
function
|
|
2713
|
+
function In(e, t) {
|
|
2676
2714
|
return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
|
|
2677
2715
|
}
|
|
2678
|
-
async function
|
|
2679
|
-
const r =
|
|
2716
|
+
async function An(e, t, s, n) {
|
|
2717
|
+
const r = se(e.headers);
|
|
2680
2718
|
n({
|
|
2681
2719
|
...t,
|
|
2682
2720
|
responseStatus: e.status,
|
|
2683
2721
|
responseHeaders: r,
|
|
2684
|
-
responseBody: await
|
|
2722
|
+
responseBody: await Sn(e),
|
|
2685
2723
|
durationMs: Date.now() - s
|
|
2686
2724
|
});
|
|
2687
2725
|
}
|
|
2688
|
-
async function
|
|
2689
|
-
if (!
|
|
2726
|
+
async function Sn(e) {
|
|
2727
|
+
if (!ne(e.headers))
|
|
2690
2728
|
return;
|
|
2691
2729
|
let t = null, s = null;
|
|
2692
2730
|
try {
|
|
@@ -2695,7 +2733,7 @@ async function In(e) {
|
|
|
2695
2733
|
const n = new Promise((c) => {
|
|
2696
2734
|
s = window.setTimeout(() => {
|
|
2697
2735
|
t?.cancel(), c("timeout");
|
|
2698
|
-
},
|
|
2736
|
+
}, Xe);
|
|
2699
2737
|
}), r = new TextDecoder();
|
|
2700
2738
|
let i = "", o = 0;
|
|
2701
2739
|
for (; ; ) {
|
|
@@ -2704,10 +2742,10 @@ async function In(e) {
|
|
|
2704
2742
|
return;
|
|
2705
2743
|
const { done: u, value: l } = c;
|
|
2706
2744
|
if (u)
|
|
2707
|
-
return
|
|
2745
|
+
return _(i + r.decode());
|
|
2708
2746
|
const a = pt - o;
|
|
2709
2747
|
if (l.byteLength > a)
|
|
2710
|
-
return i += r.decode(l.subarray(0, Math.max(a, 0)), { stream: !0 }), t.cancel(), `${
|
|
2748
|
+
return i += r.decode(l.subarray(0, Math.max(a, 0)), { stream: !0 }), t.cancel(), `${_(i)}... [truncated]`;
|
|
2711
2749
|
o += l.byteLength, i += r.decode(l, { stream: !0 });
|
|
2712
2750
|
}
|
|
2713
2751
|
} catch {
|
|
@@ -2717,26 +2755,26 @@ async function In(e) {
|
|
|
2717
2755
|
s !== null && window.clearTimeout(s);
|
|
2718
2756
|
}
|
|
2719
2757
|
}
|
|
2720
|
-
function
|
|
2721
|
-
if (
|
|
2758
|
+
function kn(e, t) {
|
|
2759
|
+
if (ne(new Headers(t)))
|
|
2722
2760
|
try {
|
|
2723
|
-
return e.responseType === "" || e.responseType === "text" ?
|
|
2761
|
+
return e.responseType === "" || e.responseType === "text" ? _(e.responseText ?? "") : void 0;
|
|
2724
2762
|
} catch {
|
|
2725
2763
|
return;
|
|
2726
2764
|
}
|
|
2727
2765
|
}
|
|
2728
|
-
function
|
|
2766
|
+
function qt(e) {
|
|
2729
2767
|
if (typeof e == "string")
|
|
2730
|
-
return
|
|
2768
|
+
return _(e);
|
|
2731
2769
|
}
|
|
2732
|
-
function
|
|
2770
|
+
function En(e) {
|
|
2733
2771
|
return k({
|
|
2734
2772
|
...e,
|
|
2735
|
-
requestBody:
|
|
2736
|
-
responseBody:
|
|
2773
|
+
requestBody: xt(e.requestBody),
|
|
2774
|
+
responseBody: xt(e.responseBody)
|
|
2737
2775
|
});
|
|
2738
2776
|
}
|
|
2739
|
-
function
|
|
2777
|
+
function xt(e) {
|
|
2740
2778
|
if (typeof e != "string")
|
|
2741
2779
|
return e;
|
|
2742
2780
|
const t = e.trim();
|
|
@@ -2748,14 +2786,14 @@ function qt(e) {
|
|
|
2748
2786
|
return j(e);
|
|
2749
2787
|
}
|
|
2750
2788
|
}
|
|
2751
|
-
function
|
|
2789
|
+
function ne(e) {
|
|
2752
2790
|
if (!e)
|
|
2753
2791
|
return !1;
|
|
2754
2792
|
const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
|
|
2755
2793
|
return s !== null && Number.isInteger(n) && n >= 0 && n <= pt && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
|
|
2756
2794
|
}
|
|
2757
|
-
function
|
|
2758
|
-
if (
|
|
2795
|
+
function M(e, t = {}, s) {
|
|
2796
|
+
if (Rn(s))
|
|
2759
2797
|
return !0;
|
|
2760
2798
|
const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
2761
2799
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -2770,8 +2808,8 @@ function b(e, t = {}, s) {
|
|
|
2770
2808
|
return !0;
|
|
2771
2809
|
}
|
|
2772
2810
|
}
|
|
2773
|
-
function
|
|
2774
|
-
if (
|
|
2811
|
+
function _n(e, t) {
|
|
2812
|
+
if (M(e))
|
|
2775
2813
|
return !0;
|
|
2776
2814
|
try {
|
|
2777
2815
|
const s = new URL(e, location.href), n = new URL(t);
|
|
@@ -2780,10 +2818,10 @@ function kn(e, t) {
|
|
|
2780
2818
|
return !0;
|
|
2781
2819
|
}
|
|
2782
2820
|
}
|
|
2783
|
-
function
|
|
2821
|
+
function Rn(e) {
|
|
2784
2822
|
return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
|
|
2785
2823
|
}
|
|
2786
|
-
function
|
|
2824
|
+
function Cn(e) {
|
|
2787
2825
|
const t = {};
|
|
2788
2826
|
for (const s of e.trim().split(/[\r\n]+/)) {
|
|
2789
2827
|
const n = s.indexOf(":");
|
|
@@ -2796,7 +2834,7 @@ function Rn(e) {
|
|
|
2796
2834
|
}
|
|
2797
2835
|
return t;
|
|
2798
2836
|
}
|
|
2799
|
-
function
|
|
2837
|
+
function _(e, t = pt) {
|
|
2800
2838
|
return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
|
|
2801
2839
|
}
|
|
2802
2840
|
function tt(e) {
|
|
@@ -2810,31 +2848,31 @@ class F extends Error {
|
|
|
2810
2848
|
}
|
|
2811
2849
|
async function et(e, t) {
|
|
2812
2850
|
let s = null;
|
|
2813
|
-
for (let n = 0; n <
|
|
2851
|
+
for (let n = 0; n < Rt; n += 1)
|
|
2814
2852
|
try {
|
|
2815
2853
|
return await e();
|
|
2816
2854
|
} catch (r) {
|
|
2817
|
-
if (s = r, n >=
|
|
2855
|
+
if (s = r, n >= Rt - 1 || !Mn(r))
|
|
2818
2856
|
throw r;
|
|
2819
|
-
await
|
|
2857
|
+
await bn(n);
|
|
2820
2858
|
}
|
|
2821
2859
|
throw s instanceof Error ? s : new Error(t);
|
|
2822
2860
|
}
|
|
2823
|
-
function
|
|
2861
|
+
function bn(e) {
|
|
2824
2862
|
return new Promise((t) => {
|
|
2825
|
-
window.setTimeout(t,
|
|
2863
|
+
window.setTimeout(t, ze[e] ?? 0);
|
|
2826
2864
|
});
|
|
2827
2865
|
}
|
|
2828
|
-
function
|
|
2829
|
-
return e instanceof F ?
|
|
2866
|
+
function Mn(e) {
|
|
2867
|
+
return e instanceof F ? Un(e.status) : e instanceof TypeError;
|
|
2830
2868
|
}
|
|
2831
|
-
function
|
|
2869
|
+
function Un(e) {
|
|
2832
2870
|
return e === 408 || e === 409 || e === 429 || e >= 500;
|
|
2833
2871
|
}
|
|
2834
|
-
function
|
|
2872
|
+
function Pn(e) {
|
|
2835
2873
|
return e === 401 || e === 403;
|
|
2836
2874
|
}
|
|
2837
|
-
const X = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]",
|
|
2875
|
+
const X = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]", Dn = "[REDACTED_SIGNED_URL]", vn = 20, Nn = /^(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, re = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, ie = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, oe = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, ae = /\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, On = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ln = /\bhttps?:\/\/[^\s"'<>]+/gi, Bn = /[),.;\]]+$/;
|
|
2838
2876
|
function k(e) {
|
|
2839
2877
|
return W(e, 0, /* @__PURE__ */ new WeakSet());
|
|
2840
2878
|
}
|
|
@@ -2843,7 +2881,7 @@ function W(e, t, s) {
|
|
|
2843
2881
|
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : j(e);
|
|
2844
2882
|
if (e === null || typeof e != "object")
|
|
2845
2883
|
return e;
|
|
2846
|
-
if (t >=
|
|
2884
|
+
if (t >= vn)
|
|
2847
2885
|
return "[REDACTED_MAX_DEPTH]";
|
|
2848
2886
|
if (s.has(e))
|
|
2849
2887
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -2851,44 +2889,44 @@ function W(e, t, s) {
|
|
|
2851
2889
|
return e.map((r) => W(r, t + 1, s));
|
|
2852
2890
|
const n = {};
|
|
2853
2891
|
for (const [r, i] of Object.entries(e))
|
|
2854
|
-
|
|
2892
|
+
ce(r) ? n[r] = X : n[r] = r.toLowerCase() === "url" ? qn(i) : W(i, t + 1, s);
|
|
2855
2893
|
return n;
|
|
2856
2894
|
}
|
|
2857
|
-
function
|
|
2895
|
+
function ce(e) {
|
|
2858
2896
|
const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
2859
2897
|
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");
|
|
2860
2898
|
}
|
|
2861
|
-
function
|
|
2862
|
-
return typeof e == "string" ?
|
|
2899
|
+
function qn(e) {
|
|
2900
|
+
return typeof e == "string" ? le(e) : W(e, 0, /* @__PURE__ */ new WeakSet());
|
|
2863
2901
|
}
|
|
2864
|
-
function
|
|
2902
|
+
function le(e) {
|
|
2865
2903
|
try {
|
|
2866
2904
|
const t = new URL(e, location.href);
|
|
2867
2905
|
for (const s of Array.from(t.searchParams.keys()))
|
|
2868
|
-
|
|
2906
|
+
Nn.test(s) && t.searchParams.set(s, R);
|
|
2869
2907
|
return t.username && (t.username = R), t.password && (t.password = R), t.toString();
|
|
2870
2908
|
} catch {
|
|
2871
|
-
return
|
|
2909
|
+
return xn(e);
|
|
2872
2910
|
}
|
|
2873
2911
|
}
|
|
2874
2912
|
function j(e) {
|
|
2875
|
-
return e.replace(
|
|
2913
|
+
return e.replace(On, Dn).replace(Ln, Fn).replace(re, `Bearer ${R}`).replace(ie, `Basic ${R}`).replace(oe, R).replace(ae, (t, s) => `${s}: ${X}`);
|
|
2876
2914
|
}
|
|
2877
|
-
function
|
|
2878
|
-
return e.replace(
|
|
2915
|
+
function xn(e) {
|
|
2916
|
+
return e.replace(re, `Bearer ${R}`).replace(ie, `Basic ${R}`).replace(oe, R).replace(ae, (t, s) => `${s}: ${X}`);
|
|
2879
2917
|
}
|
|
2880
|
-
function
|
|
2881
|
-
const t = e.match(
|
|
2882
|
-
return `${
|
|
2918
|
+
function Fn(e) {
|
|
2919
|
+
const t = e.match(Bn)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
|
|
2920
|
+
return `${le(s)}${t}`;
|
|
2883
2921
|
}
|
|
2884
2922
|
export {
|
|
2885
2923
|
St as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
2886
2924
|
rt as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
2887
|
-
|
|
2925
|
+
be as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
2888
2926
|
Ce as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2927
|
+
Me as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
2928
|
+
Xt as PlunoProductAgent,
|
|
2929
|
+
Ve as calculateReconnectDelay,
|
|
2930
|
+
Xt as default,
|
|
2931
|
+
ys as getProductAgentOriginAccessErrorMessage
|
|
2894
2932
|
};
|