@pluno/product-agent-web 0.1.96 → 0.1.98
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/composerFocus.d.ts +4 -0
- package/dist/product-agent-sdk.js +367 -350
- package/dist/product-agent-widget.js +1686 -1602
- package/dist/widget.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const le = "pluno-product-agent-attachments";
|
|
2
2
|
const st = "files";
|
|
3
|
-
async function
|
|
3
|
+
async function xt(e) {
|
|
4
4
|
const t = await $();
|
|
5
|
-
await
|
|
5
|
+
await Ht(t, "readwrite", (s) => s.put(e));
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
8
|
-
const t = await $(), s = await
|
|
7
|
+
async function ue(e) {
|
|
8
|
+
const t = await $(), s = await Ht(
|
|
9
9
|
t,
|
|
10
10
|
"readonly",
|
|
11
11
|
(r) => r.get(e)
|
|
@@ -13,9 +13,9 @@ async function ae(e) {
|
|
|
13
13
|
if (!s)
|
|
14
14
|
return null;
|
|
15
15
|
const n = Date.now();
|
|
16
|
-
return await
|
|
16
|
+
return await Ft(e, { lastUsedAt: n }), { ...s, lastUsedAt: n };
|
|
17
17
|
}
|
|
18
|
-
async function
|
|
18
|
+
async function Ft(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 qt(e, t) {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function de(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 ce(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(le, 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 Ht(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 he(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 Wt(e, t, s) {
|
|
80
|
+
const n = Reflect.get(e, "pluno"), r = he(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 Ft(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", jt = 10080 * 6e4, pe = 5e3, fe = 15e3;
|
|
95
|
+
function ge(e, {
|
|
96
96
|
clientId: t,
|
|
97
97
|
sessionId: s,
|
|
98
98
|
callId: n
|
|
@@ -103,7 +103,7 @@ function he(e, {
|
|
|
103
103
|
clientId: t,
|
|
104
104
|
sessionId: s,
|
|
105
105
|
defaultTaskId: `scheduled-${n}`,
|
|
106
|
-
expiresAfterDueMs:
|
|
106
|
+
expiresAfterDueMs: jt
|
|
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 me(e) {
|
|
136
|
+
const t = e.storage === void 0 ? ye() : 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
|
+
}, pe));
|
|
144
144
|
}, a = () => {
|
|
145
145
|
o = !1, u();
|
|
146
146
|
}, h = async () => {
|
|
@@ -170,7 +170,7 @@ function pe(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 + fe);
|
|
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 + jt;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function ye() {
|
|
222
222
|
let e;
|
|
223
223
|
try {
|
|
224
224
|
e = window.localStorage, e.length;
|
|
@@ -262,10 +262,10 @@ function fe() {
|
|
|
262
262
|
function J(e) {
|
|
263
263
|
return `${H}${e}`;
|
|
264
264
|
}
|
|
265
|
-
const Y = "pluno.productAgent.transportId",
|
|
265
|
+
const Y = "pluno.productAgent.transportId", Te = "pluno.productAgent.transportIdentity", V = "pluno.productAgent.transportIdentity.event", we = 50, Ie = globalThis.setTimeout.bind(globalThis);
|
|
266
266
|
let P = null;
|
|
267
267
|
const q = /* @__PURE__ */ new Set();
|
|
268
|
-
async function
|
|
268
|
+
async function Ae(e = $t()) {
|
|
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 Te(e = Wt()) {
|
|
|
301
301
|
}
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
|
-
async function
|
|
305
|
-
P || (P =
|
|
304
|
+
async function Se() {
|
|
305
|
+
P || (P = Ae($t()), P.then((n) => {
|
|
306
306
|
const r = (i) => {
|
|
307
307
|
i.persisted || (n.release(), P = null, q.clear(), window.removeEventListener("pagehide", r));
|
|
308
308
|
};
|
|
309
309
|
window.addEventListener("pagehide", r);
|
|
310
310
|
}));
|
|
311
|
-
const e = await P, t =
|
|
311
|
+
const e = await P, t = ke();
|
|
312
312
|
q.add(t);
|
|
313
313
|
let s = !1;
|
|
314
314
|
return {
|
|
@@ -319,23 +319,23 @@ async function we() {
|
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function ke() {
|
|
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 $t() {
|
|
329
329
|
return {
|
|
330
330
|
storage: window.sessionStorage,
|
|
331
|
-
channel:
|
|
331
|
+
channel: Ee(),
|
|
332
332
|
randomUUID: () => crypto.randomUUID(),
|
|
333
|
-
settle: () => new Promise((e) =>
|
|
333
|
+
settle: () => new Promise((e) => Ie(e, we))
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function Ee() {
|
|
337
337
|
if (typeof BroadcastChannel < "u") {
|
|
338
|
-
const e = new BroadcastChannel(
|
|
338
|
+
const e = new BroadcastChannel(Te);
|
|
339
339
|
return {
|
|
340
340
|
postMessage: (t) => e.postMessage(t),
|
|
341
341
|
subscribe: (t) => {
|
|
@@ -345,9 +345,9 @@ function Ae() {
|
|
|
345
345
|
close: () => e.close()
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
-
return
|
|
348
|
+
return Re();
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function Re() {
|
|
351
351
|
const e = /* @__PURE__ */ new Set(), t = (s) => {
|
|
352
352
|
if (s.key !== V || !s.newValue)
|
|
353
353
|
return;
|
|
@@ -368,18 +368,18 @@ function Se() {
|
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
const rt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="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"]', _e = ".pluno-pa-widget__panel", be = ".pluno-pa-widget__timeline", St = `${rt}[data-pluno-sdk-preview-channel]`, Me = "https://app.pluno.ai", Pe = "gpt-5.6-terra", Ue = 2e4, De = 1e4, ve = 1e4, Ne = 1e4, Oe = 1e4, Le = 1e3, kt = 3e4, Et = 0.2, Rt = 6e4, Be = 15e3, N = 8, qe = 15e3, xe = 2e3, Fe = 1e3, He = 100, We = 8e3, je = 15e3, Ct = 3, $e = [300, 1e3], pt = 64e3, Z = 4e3, ft = 30, ze = 2e3, Ge = 1e3, Xe = 200 * 1024 * 1024, gt = "Image is too large for model vision input.", Ke = 100, zt = "pluno.productAgent.state.", it = "pluno.productAgent.pendingEvents.", z = "pluno.productAgent.activeToolCalls.", Je = 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(
|
|
380
|
-
return Math.min(
|
|
378
|
+
function Ye(e, t = Math.random) {
|
|
379
|
+
const s = Math.min(kt, Le * 2 ** e), n = 1 - Et + t() * Et * 2;
|
|
380
|
+
return Math.min(kt, Math.round(s * n));
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Ve(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 Ke(e, t, s) {
|
|
|
392
392
|
);
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
|
-
class
|
|
395
|
+
class Gt {
|
|
396
396
|
constructor(t, s) {
|
|
397
397
|
this.options = t, this.transportIdentity = s, this.state = {
|
|
398
398
|
...this.state,
|
|
399
|
-
starterPrompts:
|
|
399
|
+
starterPrompts: Es(t.initialStarterPrompts)
|
|
400
400
|
};
|
|
401
|
-
const n = t.restorePersistedState === !1 ? null :
|
|
401
|
+
const n = t.restorePersistedState === !1 ? null : sn(t.clientId, t.expectedPersistedSessionId);
|
|
402
402
|
n && (this.state = {
|
|
403
403
|
...this.state,
|
|
404
404
|
...n,
|
|
@@ -409,10 +409,10 @@ class $t {
|
|
|
409
409
|
assistantDraftRunId: null,
|
|
410
410
|
isThinking: !1,
|
|
411
411
|
lastError: null
|
|
412
|
-
}), this.queuedClientEvents =
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
), U(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler =
|
|
412
|
+
}), this.queuedClientEvents = un(
|
|
413
|
+
rn(t.clientId),
|
|
414
|
+
an(t.clientId)
|
|
415
|
+
), U(t.clientId, this.queuedClientEvents), this.scheduledChatContinuationScheduler = me({
|
|
416
416
|
clientId: t.clientId,
|
|
417
417
|
canDeliver: (r) => r.sessionId === this.state.sessionId,
|
|
418
418
|
deliver: async (r) => {
|
|
@@ -484,14 +484,14 @@ class $t {
|
|
|
484
484
|
lastErrorCode: null
|
|
485
485
|
};
|
|
486
486
|
static async init(t) {
|
|
487
|
-
const s = await
|
|
487
|
+
const s = await Se(), n = new Gt({
|
|
488
488
|
...t,
|
|
489
|
-
backendUrl:
|
|
490
|
-
clientId: t.clientId ??
|
|
491
|
-
model: t.model ??
|
|
489
|
+
backendUrl: gs(t.backendUrl ?? Me),
|
|
490
|
+
clientId: t.clientId ?? Ms(),
|
|
491
|
+
model: t.model ?? Pe
|
|
492
492
|
}, s);
|
|
493
493
|
try {
|
|
494
|
-
|
|
494
|
+
de().catch((r) => {
|
|
495
495
|
y("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
496
496
|
message: r instanceof Error ? r.message : String(r)
|
|
497
497
|
});
|
|
@@ -523,14 +523,14 @@ class $t {
|
|
|
523
523
|
lastError: null
|
|
524
524
|
});
|
|
525
525
|
try {
|
|
526
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await
|
|
526
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ve(this.options.tokenProvider(), ve, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
|
|
527
527
|
return;
|
|
528
528
|
if (!this.token && !this.options.webSocketFactory)
|
|
529
529
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
530
|
-
const s =
|
|
530
|
+
const s = ys(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
|
|
531
531
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
532
532
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (y("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
533
|
-
},
|
|
533
|
+
}, Ne), n.addEventListener("open", () => {
|
|
534
534
|
this.socket !== n || (this.clearSocketConnectTimer(), y("web-sdk.agent", "Pluno socket opened", {
|
|
535
535
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
536
536
|
isThinking: this.state.isThinking
|
|
@@ -542,9 +542,9 @@ class $t {
|
|
|
542
542
|
pageUrl: location.href
|
|
543
543
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
544
544
|
this.socket === n && (y("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
545
|
-
},
|
|
545
|
+
}, Oe));
|
|
546
546
|
}), n.addEventListener("message", (r) => {
|
|
547
|
-
this.socket === n && this.handleServerEvent(
|
|
547
|
+
this.socket === n && this.handleServerEvent(ks(r.data));
|
|
548
548
|
}), n.addEventListener("close", (r) => {
|
|
549
549
|
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (y("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
550
550
|
code: typeof r?.code == "number" ? r.code : null,
|
|
@@ -577,12 +577,12 @@ class $t {
|
|
|
577
577
|
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;
|
|
578
578
|
}
|
|
579
579
|
destroy() {
|
|
580
|
-
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(),
|
|
580
|
+
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), this.scheduledChatContinuationScheduler.destroy(), dn(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
581
581
|
for (const t of Object.values(this.listeners))
|
|
582
582
|
t?.clear();
|
|
583
583
|
}
|
|
584
584
|
sendMessage(t, s = {}) {
|
|
585
|
-
const n = t.trim(), r = s.attachments ?? [], i = r.map(
|
|
585
|
+
const n = t.trim(), r = s.attachments ?? [], i = r.map(It);
|
|
586
586
|
if (!n && i.length === 0)
|
|
587
587
|
return null;
|
|
588
588
|
const o = S(), c = s.clientMessageId ?? B();
|
|
@@ -625,12 +625,12 @@ class $t {
|
|
|
625
625
|
const s = B(), n = {
|
|
626
626
|
id: s,
|
|
627
627
|
name: t.name || "attachment",
|
|
628
|
-
mimeType:
|
|
628
|
+
mimeType: Lt(t),
|
|
629
629
|
sizeBytes: t.size
|
|
630
630
|
};
|
|
631
631
|
this.attachmentFiles.set(s, t), this.attachmentBlobCache.set(s, t);
|
|
632
632
|
const r = Date.now();
|
|
633
|
-
return
|
|
633
|
+
return xt({
|
|
634
634
|
attachmentId: s,
|
|
635
635
|
name: n.name,
|
|
636
636
|
mimeType: n.mimeType,
|
|
@@ -685,7 +685,7 @@ class $t {
|
|
|
685
685
|
waitForSession: r,
|
|
686
686
|
notifyCompletion: i
|
|
687
687
|
}) {
|
|
688
|
-
const o = r ? await this.waitForSessionId() : this.state.sessionId, c =
|
|
688
|
+
const o = r ? await this.waitForSessionId() : this.state.sessionId, c = Lt(t), u = {
|
|
689
689
|
sessionId: o ?? void 0,
|
|
690
690
|
attachmentId: s.id,
|
|
691
691
|
clientId: this.options.clientId,
|
|
@@ -710,8 +710,8 @@ class $t {
|
|
|
710
710
|
throw new F("Failed to upload attachment", h.status);
|
|
711
711
|
return h;
|
|
712
712
|
}, "Failed to upload attachment"), this.setState({ sessionId: l.sessionId });
|
|
713
|
-
const a =
|
|
714
|
-
return this.updateAttachmentInState(s.id, a), s.id &&
|
|
713
|
+
const a = te(l.attachment, this.options.backendUrl);
|
|
714
|
+
return this.updateAttachmentInState(s.id, a), s.id && Ft(s.id, {
|
|
715
715
|
sessionId: l.sessionId,
|
|
716
716
|
fileUrl: a.fileUrl,
|
|
717
717
|
gcsPath: a.gcsPath,
|
|
@@ -733,7 +733,7 @@ class $t {
|
|
|
733
733
|
return this.state.sessionId ? Promise.resolve(this.state.sessionId) : new Promise((t, s) => {
|
|
734
734
|
const n = window.setTimeout(() => {
|
|
735
735
|
r(), s(new Error("Timed out waiting for Pluno session before persisting attachment"));
|
|
736
|
-
},
|
|
736
|
+
}, je), r = this.on("state", (i) => {
|
|
737
737
|
i.sessionId && (window.clearTimeout(n), r(), t(i.sessionId));
|
|
738
738
|
});
|
|
739
739
|
});
|
|
@@ -755,7 +755,7 @@ class $t {
|
|
|
755
755
|
const n = await this.fetchEmbedAttachmentUpload(t);
|
|
756
756
|
if (n.ok)
|
|
757
757
|
return await n.json();
|
|
758
|
-
if (
|
|
758
|
+
if (Mn(n.status) && this.options.tokenProvider && !s) {
|
|
759
759
|
s = !0;
|
|
760
760
|
const r = await this.fetchEmbedAttachmentUpload(t);
|
|
761
761
|
if (r.ok)
|
|
@@ -800,7 +800,7 @@ class $t {
|
|
|
800
800
|
const s = B(), n = new Promise((i, o) => {
|
|
801
801
|
const c = window.setTimeout(() => {
|
|
802
802
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
803
|
-
},
|
|
803
|
+
}, We);
|
|
804
804
|
this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: c });
|
|
805
805
|
}), r = {
|
|
806
806
|
type: "sessions.list",
|
|
@@ -857,7 +857,7 @@ class $t {
|
|
|
857
857
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
858
858
|
return;
|
|
859
859
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
860
|
-
const t =
|
|
860
|
+
const t = Ts();
|
|
861
861
|
this.sendNow(
|
|
862
862
|
k({
|
|
863
863
|
type: "starter_prompts.page_context",
|
|
@@ -868,13 +868,13 @@ class $t {
|
|
|
868
868
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
869
869
|
}
|
|
870
870
|
startStarterPromptUrlWatcher() {
|
|
871
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
871
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = ws(() => this.handleStarterPromptUrlChange()));
|
|
872
872
|
}
|
|
873
873
|
handleStarterPromptUrlChange() {
|
|
874
874
|
const t = location.href;
|
|
875
875
|
t !== this.lastStarterPromptPageUrl && (this.lastStarterPromptPageUrl = t, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
876
876
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
877
|
-
},
|
|
877
|
+
}, Je));
|
|
878
878
|
}
|
|
879
879
|
refreshStarterPromptsForCurrentUrl() {
|
|
880
880
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -908,19 +908,19 @@ class $t {
|
|
|
908
908
|
this.clearHeartbeatAckTimer();
|
|
909
909
|
return;
|
|
910
910
|
}
|
|
911
|
-
if (
|
|
911
|
+
if (ts(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
912
912
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
|
|
913
|
-
const s =
|
|
913
|
+
const s = Rs(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
914
914
|
y("web-sdk.agent", "Received auth.ok appearance", {
|
|
915
915
|
hasAppearance: n,
|
|
916
916
|
rawAppearance: t.appearance,
|
|
917
917
|
normalizedAppearance: s
|
|
918
|
-
}), this.runtimeHelperJavascript =
|
|
919
|
-
const r =
|
|
920
|
-
user:
|
|
918
|
+
}), this.runtimeHelperJavascript = Cs(t.runtimeHelpers)?.javascript ?? null;
|
|
919
|
+
const r = Mt(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, c = {
|
|
920
|
+
user: Ps(t.user),
|
|
921
921
|
status: "connected"
|
|
922
922
|
};
|
|
923
|
-
(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 && !
|
|
923
|
+
(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 && !As() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
924
924
|
type: "page.upsert",
|
|
925
925
|
sessionId: this.state.sessionId,
|
|
926
926
|
page: S(),
|
|
@@ -930,7 +930,7 @@ class $t {
|
|
|
930
930
|
}
|
|
931
931
|
if (t.type === "starterPrompts.updated") {
|
|
932
932
|
this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
|
|
933
|
-
starterPrompts:
|
|
933
|
+
starterPrompts: Mt(t, "starterPrompts"),
|
|
934
934
|
starterPromptsLoading: !1
|
|
935
935
|
});
|
|
936
936
|
return;
|
|
@@ -938,9 +938,9 @@ class $t {
|
|
|
938
938
|
if (t.type === "conversation.state") {
|
|
939
939
|
const s = Array.isArray(t.items) ? t.items : [];
|
|
940
940
|
this.rememberUserMessageClientMessageIds(s);
|
|
941
|
-
const n =
|
|
941
|
+
const n = Gs(s);
|
|
942
942
|
if (n) {
|
|
943
|
-
const a =
|
|
943
|
+
const a = Xs(s, n);
|
|
944
944
|
this.retryAttemptsByClientMessageId[n] = Math.max(
|
|
945
945
|
this.retryAttemptsByClientMessageId[n] ?? 0,
|
|
946
946
|
a
|
|
@@ -948,22 +948,22 @@ class $t {
|
|
|
948
948
|
}
|
|
949
949
|
const r = s.filter((a) => {
|
|
950
950
|
const h = v(a);
|
|
951
|
-
return !
|
|
952
|
-
}), i =
|
|
951
|
+
return !Dt(h) && (!n || !at(h));
|
|
952
|
+
}), i = xs(
|
|
953
953
|
this.state.messages,
|
|
954
|
-
|
|
955
|
-
), o =
|
|
956
|
-
(a) =>
|
|
954
|
+
Us(r, this.options.backendUrl)
|
|
955
|
+
), o = Ut(i), c = s.some(
|
|
956
|
+
(a) => Nt(
|
|
957
957
|
v(a),
|
|
958
958
|
this.state.assistantDraft,
|
|
959
959
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
960
960
|
this.state.assistantDraftRunId
|
|
961
961
|
)
|
|
962
962
|
), u = o && (!this.state.assistantDraft || c);
|
|
963
|
-
if (!o &&
|
|
963
|
+
if (!o && zs(this.state.messages, s))
|
|
964
964
|
return;
|
|
965
965
|
const l = u ? null : ct(s);
|
|
966
|
-
if (this.latestRecoverableClientMessageId = l,
|
|
966
|
+
if (this.latestRecoverableClientMessageId = l, js(i) && this.clearRetryTimers(), this.setState({
|
|
967
967
|
sessionId: I(t.session, "id") ?? this.state.sessionId,
|
|
968
968
|
messages: i,
|
|
969
969
|
...u ? {
|
|
@@ -986,7 +986,7 @@ class $t {
|
|
|
986
986
|
if (t.type === "sessions.page") {
|
|
987
987
|
const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
|
|
988
988
|
s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
|
|
989
|
-
sessions:
|
|
989
|
+
sessions: Ds(t.sessions),
|
|
990
990
|
nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
|
|
991
991
|
}));
|
|
992
992
|
return;
|
|
@@ -1010,14 +1010,14 @@ class $t {
|
|
|
1010
1010
|
return;
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
if (
|
|
1013
|
+
if (Dt(s))
|
|
1014
1014
|
return;
|
|
1015
|
-
const n =
|
|
1015
|
+
const n = Kt(t.item, this.options.backendUrl);
|
|
1016
1016
|
if (n) {
|
|
1017
1017
|
n.role === "assistant" && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
1018
1018
|
const r = t.item.data;
|
|
1019
|
-
|
|
1020
|
-
const i =
|
|
1019
|
+
Js(r) && this.clearRunAckResyncRetryTimer();
|
|
1020
|
+
const i = qs(this.state.messages, n), o = Ut(i), c = Nt(
|
|
1021
1021
|
r,
|
|
1022
1022
|
this.state.assistantDraft,
|
|
1023
1023
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
@@ -1071,7 +1071,7 @@ class $t {
|
|
|
1071
1071
|
return;
|
|
1072
1072
|
}
|
|
1073
1073
|
o && r && i && (this.retryableClientMessageId = i);
|
|
1074
|
-
const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u =
|
|
1074
|
+
const c = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), u = ms(c.message);
|
|
1075
1075
|
u && console.error(u), this.setState({
|
|
1076
1076
|
status: "error",
|
|
1077
1077
|
isThinking: !1,
|
|
@@ -1145,7 +1145,7 @@ class $t {
|
|
|
1145
1145
|
this.pendingSessionHistoryRequests.clear();
|
|
1146
1146
|
}
|
|
1147
1147
|
markThinkingProgress() {
|
|
1148
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
1148
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Rt), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
1149
1149
|
}
|
|
1150
1150
|
scheduleThinkingWatchdog(t) {
|
|
1151
1151
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -1165,7 +1165,7 @@ class $t {
|
|
|
1165
1165
|
scheduleRunAckWatchdog(t) {
|
|
1166
1166
|
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
1167
1167
|
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
|
|
1168
|
-
},
|
|
1168
|
+
}, qe);
|
|
1169
1169
|
}
|
|
1170
1170
|
recoverMissedRunAck(t) {
|
|
1171
1171
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (y("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
@@ -1189,8 +1189,8 @@ class $t {
|
|
|
1189
1189
|
sessionId: this.state.sessionId,
|
|
1190
1190
|
clientMessageId: t,
|
|
1191
1191
|
automatic: !0
|
|
1192
|
-
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(
|
|
1193
|
-
}, O(s,
|
|
1192
|
+
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(Rt)));
|
|
1193
|
+
}, O(s, xe)));
|
|
1194
1194
|
}
|
|
1195
1195
|
clearRunAckResyncRetryTimer() {
|
|
1196
1196
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -1229,7 +1229,7 @@ class $t {
|
|
|
1229
1229
|
sessionId: this.state.sessionId,
|
|
1230
1230
|
clientMessageId: t,
|
|
1231
1231
|
resyncAttempts: s + 1
|
|
1232
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
1232
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Be);
|
|
1233
1233
|
return;
|
|
1234
1234
|
}
|
|
1235
1235
|
this.setState({
|
|
@@ -1261,7 +1261,7 @@ class $t {
|
|
|
1261
1261
|
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;
|
|
1262
1262
|
if (!s || !n || !r)
|
|
1263
1263
|
return;
|
|
1264
|
-
if (r !== "execute_code" || !
|
|
1264
|
+
if (r !== "execute_code" || !yn(o)) {
|
|
1265
1265
|
this.send({
|
|
1266
1266
|
type: "tool.result",
|
|
1267
1267
|
sessionId: s,
|
|
@@ -1277,7 +1277,7 @@ class $t {
|
|
|
1277
1277
|
});
|
|
1278
1278
|
return;
|
|
1279
1279
|
}
|
|
1280
|
-
const c =
|
|
1280
|
+
const c = ns(this.state.messages);
|
|
1281
1281
|
this.activeBrowserToolCalls.set(n, {
|
|
1282
1282
|
event: {
|
|
1283
1283
|
type: "tool.result",
|
|
@@ -1293,9 +1293,9 @@ class $t {
|
|
|
1293
1293
|
startedAtOrigin: location.origin
|
|
1294
1294
|
}), this.installSessionUserFilesApi(c);
|
|
1295
1295
|
let u = null, l;
|
|
1296
|
-
u = await this.executeRuntimeHelper(), l = await
|
|
1296
|
+
u = await this.executeRuntimeHelper(), l = await bt({
|
|
1297
1297
|
...o,
|
|
1298
|
-
javascript:
|
|
1298
|
+
javascript: ge(o.javascript, {
|
|
1299
1299
|
clientId: this.options.clientId,
|
|
1300
1300
|
sessionId: s,
|
|
1301
1301
|
callId: n
|
|
@@ -1312,40 +1312,40 @@ class $t {
|
|
|
1312
1312
|
toolName: r,
|
|
1313
1313
|
summary: o.summary,
|
|
1314
1314
|
rawInput: k(o),
|
|
1315
|
-
rawOutput: k(
|
|
1316
|
-
}),
|
|
1315
|
+
rawOutput: k(_s(l, u))
|
|
1316
|
+
}), on(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1317
1317
|
}
|
|
1318
1318
|
startPageLifecycleRecovery() {
|
|
1319
1319
|
if (this.pageLifecycleCleanup)
|
|
1320
1320
|
return;
|
|
1321
1321
|
const t = () => {
|
|
1322
|
-
|
|
1322
|
+
Zt(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1323
1323
|
};
|
|
1324
1324
|
window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
|
|
1325
1325
|
window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
|
|
1326
1326
|
};
|
|
1327
1327
|
}
|
|
1328
1328
|
installSessionUserFilesApi(t) {
|
|
1329
|
-
this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup =
|
|
1329
|
+
this.cleanupSessionUserFilesApi(), this.sessionUserFilesApiCleanup = rs(t, this.attachmentFiles, this.attachmentBlobCache);
|
|
1330
1330
|
}
|
|
1331
1331
|
cleanupSessionUserFilesApi() {
|
|
1332
|
-
this.sessionUserFilesApiCleanup && (
|
|
1332
|
+
this.sessionUserFilesApiCleanup && (hs(this.sessionUserFilesApiCleanup), this.sessionUserFilesApiCleanup = null);
|
|
1333
1333
|
}
|
|
1334
1334
|
async executeRuntimeHelper() {
|
|
1335
1335
|
if (!this.runtimeHelperJavascript?.trim())
|
|
1336
1336
|
return null;
|
|
1337
|
-
const t = await
|
|
1337
|
+
const t = await bt({
|
|
1338
1338
|
javascript: this.runtimeHelperJavascript
|
|
1339
1339
|
});
|
|
1340
|
-
return t.ok === !1 ?
|
|
1340
|
+
return t.ok === !1 ? bs(t) : null;
|
|
1341
1341
|
}
|
|
1342
1342
|
enableNetworkCapture() {
|
|
1343
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
1344
|
-
|
|
1343
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = Ze((t) => {
|
|
1344
|
+
kn(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
|
|
1345
1345
|
}));
|
|
1346
1346
|
}
|
|
1347
1347
|
enqueueNetworkEvent(t) {
|
|
1348
|
-
this.queuedNetworkEvents.length >=
|
|
1348
|
+
this.queuedNetworkEvents.length >= He || (this.queuedNetworkEvents.push(Sn(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
1349
1349
|
this.networkBatchTimer = null;
|
|
1350
1350
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
1351
1351
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -1354,12 +1354,12 @@ class $t {
|
|
|
1354
1354
|
page: S(),
|
|
1355
1355
|
events: s
|
|
1356
1356
|
});
|
|
1357
|
-
},
|
|
1357
|
+
}, Fe)));
|
|
1358
1358
|
}
|
|
1359
1359
|
scheduleReconnect() {
|
|
1360
1360
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
1361
1361
|
return;
|
|
1362
|
-
const t =
|
|
1362
|
+
const t = Ye(this.reconnectAttempts);
|
|
1363
1363
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
1364
1364
|
this.reconnectTimer = null, this.connect().catch((s) => {
|
|
1365
1365
|
y("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
@@ -1375,8 +1375,8 @@ class $t {
|
|
|
1375
1375
|
const t = this.socket;
|
|
1376
1376
|
!t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
1377
1377
|
this.socket === t && (y("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
|
|
1378
|
-
},
|
|
1379
|
-
},
|
|
1378
|
+
}, De));
|
|
1379
|
+
}, Ue);
|
|
1380
1380
|
}
|
|
1381
1381
|
stopHeartbeat() {
|
|
1382
1382
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -1401,20 +1401,20 @@ class $t {
|
|
|
1401
1401
|
...this.state,
|
|
1402
1402
|
...t,
|
|
1403
1403
|
...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {}
|
|
1404
|
-
},
|
|
1404
|
+
}, nn(this.options.clientId, this.state), this.emit("state", this.getState());
|
|
1405
1405
|
}
|
|
1406
1406
|
emit(t, s) {
|
|
1407
1407
|
this.listeners[t]?.forEach((r) => r(s));
|
|
1408
1408
|
}
|
|
1409
1409
|
}
|
|
1410
1410
|
const Q = /* @__PURE__ */ new WeakMap();
|
|
1411
|
-
function
|
|
1412
|
-
const t = window.__plunoProductAgentNetworkCapture ??
|
|
1411
|
+
function Ze(e) {
|
|
1412
|
+
const t = window.__plunoProductAgentNetworkCapture ?? Qe();
|
|
1413
1413
|
return t.subscribers.add(e), () => {
|
|
1414
1414
|
t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
|
|
1415
1415
|
};
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1417
|
+
function Qe() {
|
|
1418
1418
|
const e = /* @__PURE__ */ new Set(), t = (T) => {
|
|
1419
1419
|
e.forEach((p) => {
|
|
1420
1420
|
try {
|
|
@@ -1431,31 +1431,31 @@ function Ye() {
|
|
|
1431
1431
|
throw m;
|
|
1432
1432
|
}
|
|
1433
1433
|
try {
|
|
1434
|
-
const m = p instanceof Request ? p : null, g =
|
|
1434
|
+
const m = p instanceof Request ? p : null, g = Tn(p, m), A = ee(d?.headers ?? m?.headers);
|
|
1435
1435
|
if (!b(g, A, d?.body)) {
|
|
1436
1436
|
const K = {
|
|
1437
1437
|
requestId: tt("fetch"),
|
|
1438
1438
|
url: E(g, Z),
|
|
1439
1439
|
method: (d?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
1440
1440
|
requestHeaders: A,
|
|
1441
|
-
requestBody:
|
|
1441
|
+
requestBody: Bt(d?.body),
|
|
1442
1442
|
resourceType: "fetch",
|
|
1443
1443
|
startedAt: new Date(f).toISOString()
|
|
1444
1444
|
};
|
|
1445
1445
|
w.then(
|
|
1446
|
-
(
|
|
1447
|
-
|
|
1446
|
+
(_) => {
|
|
1447
|
+
wn(_, K, f, t).catch(() => {
|
|
1448
1448
|
t({
|
|
1449
1449
|
...K,
|
|
1450
|
-
responseStatus:
|
|
1450
|
+
responseStatus: _.status,
|
|
1451
1451
|
durationMs: Date.now() - f
|
|
1452
1452
|
});
|
|
1453
1453
|
});
|
|
1454
1454
|
},
|
|
1455
|
-
(
|
|
1455
|
+
(_) => {
|
|
1456
1456
|
t({
|
|
1457
1457
|
...K,
|
|
1458
|
-
errorText: E(
|
|
1458
|
+
errorText: E(_ instanceof Error ? _.message : String(_)),
|
|
1459
1459
|
durationMs: Date.now() - f
|
|
1460
1460
|
});
|
|
1461
1461
|
}
|
|
@@ -1477,16 +1477,16 @@ function Ye() {
|
|
|
1477
1477
|
}), g;
|
|
1478
1478
|
}, u = function(p, d) {
|
|
1479
1479
|
const f = r.call(this, p, d), w = Q.get(this);
|
|
1480
|
-
return w && Object.keys(w.requestHeaders).length < ft && (w.requestHeaders[p] =
|
|
1480
|
+
return w && Object.keys(w.requestHeaders).length < ft && (w.requestHeaders[p] = At(p, d), w.excluded = w.excluded || b(w.url, w.requestHeaders)), f;
|
|
1481
1481
|
}, l = function(p) {
|
|
1482
1482
|
try {
|
|
1483
1483
|
const d = Q.get(this);
|
|
1484
|
-
d && (d.excluded = d.excluded || b(d.url, d.requestHeaders, p), d.requestBody =
|
|
1484
|
+
d && (d.excluded = d.excluded || b(d.url, d.requestHeaders, p), d.requestBody = Bt(p), d.excluded || this.addEventListener(
|
|
1485
1485
|
"loadend",
|
|
1486
1486
|
() => {
|
|
1487
1487
|
queueMicrotask(() => {
|
|
1488
1488
|
try {
|
|
1489
|
-
const f =
|
|
1489
|
+
const f = Rn(this.getAllResponseHeaders());
|
|
1490
1490
|
t({
|
|
1491
1491
|
requestId: d.requestId,
|
|
1492
1492
|
url: d.url,
|
|
@@ -1496,7 +1496,7 @@ function Ye() {
|
|
|
1496
1496
|
resourceType: "xhr",
|
|
1497
1497
|
responseStatus: this.status,
|
|
1498
1498
|
responseHeaders: f,
|
|
1499
|
-
responseBody:
|
|
1499
|
+
responseBody: An(this, f),
|
|
1500
1500
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
1501
1501
|
startedAt: d.startedAt,
|
|
1502
1502
|
durationMs: Date.now() - d.startedAtMs
|
|
@@ -1592,11 +1592,11 @@ function _t(e) {
|
|
|
1592
1592
|
const t = typeof e == "function" ? e() : e;
|
|
1593
1593
|
return t && Object.keys(t).length > 0 ? t : void 0;
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function ts(e) {
|
|
1596
1596
|
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";
|
|
1597
1597
|
}
|
|
1598
|
-
const
|
|
1599
|
-
function
|
|
1598
|
+
const es = 5e3, ss = 12e4;
|
|
1599
|
+
function ns(e) {
|
|
1600
1600
|
const t = [];
|
|
1601
1601
|
for (const s of e)
|
|
1602
1602
|
s.role !== "user" || !s.attachments?.length || s.attachments.forEach((n, r) => {
|
|
@@ -1607,17 +1607,17 @@ function ts(e) {
|
|
|
1607
1607
|
});
|
|
1608
1608
|
return t;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function rs(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
1611
1611
|
const n = [
|
|
1612
|
-
|
|
1613
|
-
|
|
1612
|
+
is(e, t, s),
|
|
1613
|
+
os()
|
|
1614
1614
|
].filter((r) => typeof r == "function");
|
|
1615
1615
|
return () => {
|
|
1616
1616
|
for (const r of n.reverse())
|
|
1617
1617
|
r();
|
|
1618
1618
|
};
|
|
1619
1619
|
}
|
|
1620
|
-
function
|
|
1620
|
+
function is(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
1621
1621
|
const n = new Map(e.map((l) => [l.id, l])), r = (l) => ({
|
|
1622
1622
|
id: l.id,
|
|
1623
1623
|
name: l.name,
|
|
@@ -1637,7 +1637,7 @@ function ss(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1637
1637
|
const T = s.get(a.id);
|
|
1638
1638
|
if (T)
|
|
1639
1639
|
return T;
|
|
1640
|
-
const p = await
|
|
1640
|
+
const p = await ue(a.id).then((m) => m?.blob ?? null).catch((m) => (y("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
|
|
1641
1641
|
attachmentId: a.id,
|
|
1642
1642
|
name: a.name,
|
|
1643
1643
|
message: m instanceof Error ? m.message : String(m)
|
|
@@ -1646,13 +1646,13 @@ function ss(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1646
1646
|
return s.set(a.id, p), p;
|
|
1647
1647
|
if (!a.fileUrl)
|
|
1648
1648
|
throw new Error(`Pluno user file is missing content: ${l}`);
|
|
1649
|
-
const d = await fetch(a.fileUrl,
|
|
1649
|
+
const d = await fetch(a.fileUrl, hn(a.fileUrl));
|
|
1650
1650
|
if (!d.ok)
|
|
1651
1651
|
throw new Error(`Failed to load Pluno user file: ${l}`);
|
|
1652
1652
|
const f = await d.blob();
|
|
1653
1653
|
s.set(a.id, f);
|
|
1654
1654
|
const w = Date.now();
|
|
1655
|
-
return
|
|
1655
|
+
return xt({
|
|
1656
1656
|
attachmentId: a.id,
|
|
1657
1657
|
name: a.name,
|
|
1658
1658
|
mimeType: a.mimeType,
|
|
@@ -1670,7 +1670,7 @@ function ss(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1670
1670
|
});
|
|
1671
1671
|
}), f;
|
|
1672
1672
|
};
|
|
1673
|
-
return
|
|
1673
|
+
return Wt(globalThis, "userFiles", {
|
|
1674
1674
|
list: () => e.map(r),
|
|
1675
1675
|
get: (l) => {
|
|
1676
1676
|
const a = n.get(l);
|
|
@@ -1681,7 +1681,7 @@ function ss(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1681
1681
|
if (!T.startsWith("image/"))
|
|
1682
1682
|
throw new Error(`Pluno user file is not an image: ${l}`);
|
|
1683
1683
|
const p = h.type === T ? h : new Blob([h], { type: T });
|
|
1684
|
-
return
|
|
1684
|
+
return ps(T, p.size) > Xe ? {
|
|
1685
1685
|
type: "pluno.userFiles.inspectImage",
|
|
1686
1686
|
id: a.id,
|
|
1687
1687
|
name: a.name,
|
|
@@ -1708,13 +1708,13 @@ function ss(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1708
1708
|
}
|
|
1709
1709
|
});
|
|
1710
1710
|
}
|
|
1711
|
-
function
|
|
1712
|
-
return
|
|
1713
|
-
inspectImage: async (t, s) => await
|
|
1711
|
+
function os() {
|
|
1712
|
+
return Wt(globalThis, "pageImages", {
|
|
1713
|
+
inspectImage: async (t, s) => await as(t, s)
|
|
1714
1714
|
});
|
|
1715
1715
|
}
|
|
1716
|
-
async function
|
|
1717
|
-
const s =
|
|
1716
|
+
async function as(e, t = {}) {
|
|
1717
|
+
const s = ds(t.name), n = await cs(e);
|
|
1718
1718
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
1719
1719
|
type: "pluno.pageImages.inspectImage",
|
|
1720
1720
|
imageAttached: !1,
|
|
@@ -1732,15 +1732,15 @@ async function rs(e, t = {}) {
|
|
|
1732
1732
|
imageAttachmentError: n.error
|
|
1733
1733
|
};
|
|
1734
1734
|
}
|
|
1735
|
-
async function
|
|
1735
|
+
async function cs(e) {
|
|
1736
1736
|
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 } : {
|
|
1737
1737
|
ok: !0,
|
|
1738
1738
|
mimeType: e.type,
|
|
1739
1739
|
sizeBytes: e.size,
|
|
1740
1740
|
dataUrl: await ot(e)
|
|
1741
|
-
} : { 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." } :
|
|
1741
|
+
} : { 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." } : ls(e);
|
|
1742
1742
|
}
|
|
1743
|
-
function
|
|
1743
|
+
function ls(e) {
|
|
1744
1744
|
if (!e.startsWith("data:") || !e.includes(","))
|
|
1745
1745
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
1746
1746
|
const [t, s] = e.slice(5).split(",", 2), n = t.split(";").map((c) => c.trim()).filter(Boolean), r = n[0] ?? "";
|
|
@@ -1751,7 +1751,7 @@ function os(e) {
|
|
|
1751
1751
|
const i = s.replace(/[ \t\r\n\f]+/g, "");
|
|
1752
1752
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
|
|
1753
1753
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
1754
|
-
const o =
|
|
1754
|
+
const o = us(i);
|
|
1755
1755
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
1756
1756
|
ok: !0,
|
|
1757
1757
|
mimeType: r,
|
|
@@ -1759,16 +1759,16 @@ function os(e) {
|
|
|
1759
1759
|
dataUrl: `data:${r};base64,${i}`
|
|
1760
1760
|
};
|
|
1761
1761
|
}
|
|
1762
|
-
function
|
|
1762
|
+
function us(e) {
|
|
1763
1763
|
if (e.length === 0 || e.length % 4 !== 0)
|
|
1764
1764
|
return null;
|
|
1765
1765
|
const t = e.length - e.replace(/=+$/, "").length;
|
|
1766
1766
|
return t > 2 ? null : e.length / 4 * 3 - t;
|
|
1767
1767
|
}
|
|
1768
|
-
function
|
|
1768
|
+
function ds(e) {
|
|
1769
1769
|
return (typeof e == "string" ? e.trim() : "") || "Page image";
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function hs(e) {
|
|
1772
1772
|
try {
|
|
1773
1773
|
e();
|
|
1774
1774
|
} catch {
|
|
@@ -1786,12 +1786,12 @@ function ot(e) {
|
|
|
1786
1786
|
}, n.onerror = () => s(n.error ?? new Error("Failed to read Pluno user file")), n.readAsDataURL(e);
|
|
1787
1787
|
});
|
|
1788
1788
|
}
|
|
1789
|
-
function
|
|
1789
|
+
function ps(e, t) {
|
|
1790
1790
|
return `data:${e};base64,`.length + Math.ceil(t / 3) * 4;
|
|
1791
1791
|
}
|
|
1792
|
-
async function
|
|
1792
|
+
async function bt(e) {
|
|
1793
1793
|
const t = Object.getPrototypeOf(async function() {
|
|
1794
|
-
}).constructor, s = e.timeoutMs ??
|
|
1794
|
+
}).constructor, s = e.timeoutMs ?? es, n = Date.now(), r = [];
|
|
1795
1795
|
let i;
|
|
1796
1796
|
const o = {
|
|
1797
1797
|
log: console.log,
|
|
@@ -1809,7 +1809,7 @@ async function Ct(e) {
|
|
|
1809
1809
|
i = window.setTimeout(() => a(u), s);
|
|
1810
1810
|
})
|
|
1811
1811
|
]);
|
|
1812
|
-
return l === u ?
|
|
1812
|
+
return l === u ? fs(s) : {
|
|
1813
1813
|
ok: !0,
|
|
1814
1814
|
result: l,
|
|
1815
1815
|
console: r,
|
|
@@ -1838,7 +1838,7 @@ async function Ct(e) {
|
|
|
1838
1838
|
i !== void 0 && window.clearTimeout(i), console.log = o.log, console.info = o.info, console.warn = o.warn, console.error = o.error;
|
|
1839
1839
|
}
|
|
1840
1840
|
}
|
|
1841
|
-
function
|
|
1841
|
+
function fs(e) {
|
|
1842
1842
|
return {
|
|
1843
1843
|
ok: !1,
|
|
1844
1844
|
exception: {
|
|
@@ -1852,18 +1852,18 @@ function ds(e) {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
};
|
|
1854
1854
|
}
|
|
1855
|
-
function
|
|
1855
|
+
function gs(e) {
|
|
1856
1856
|
return e.replace(/\/+$/, "");
|
|
1857
1857
|
}
|
|
1858
|
-
function
|
|
1858
|
+
function ms(e, t = location.origin) {
|
|
1859
1859
|
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;
|
|
1860
1860
|
}
|
|
1861
|
-
function
|
|
1861
|
+
function ys(e) {
|
|
1862
1862
|
const t = new URL("/api/product-agent/embed/ws", e);
|
|
1863
1863
|
return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
|
|
1864
1864
|
}
|
|
1865
1865
|
function S() {
|
|
1866
|
-
const e =
|
|
1866
|
+
const e = Xt();
|
|
1867
1867
|
return {
|
|
1868
1868
|
url: location.href,
|
|
1869
1869
|
title: document.title,
|
|
@@ -1871,19 +1871,19 @@ function S() {
|
|
|
1871
1871
|
...e ? { plunoProductAgentUi: e } : {}
|
|
1872
1872
|
};
|
|
1873
1873
|
}
|
|
1874
|
-
function
|
|
1874
|
+
function Ts() {
|
|
1875
1875
|
return {
|
|
1876
1876
|
pageUrl: location.href,
|
|
1877
1877
|
pageTitle: document.title,
|
|
1878
|
-
htmlContent:
|
|
1878
|
+
htmlContent: Ss()
|
|
1879
1879
|
};
|
|
1880
1880
|
}
|
|
1881
|
-
function
|
|
1882
|
-
return x.add(e), L || (L =
|
|
1881
|
+
function ws(e) {
|
|
1882
|
+
return x.add(e), L || (L = Is()), () => {
|
|
1883
1883
|
x.delete(e), x.size === 0 && (L?.(), L = null);
|
|
1884
1884
|
};
|
|
1885
1885
|
}
|
|
1886
|
-
function
|
|
1886
|
+
function Is() {
|
|
1887
1887
|
const e = () => {
|
|
1888
1888
|
for (const i of Array.from(x))
|
|
1889
1889
|
i();
|
|
@@ -1898,10 +1898,10 @@ function ys() {
|
|
|
1898
1898
|
window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
|
|
1899
1899
|
};
|
|
1900
1900
|
}
|
|
1901
|
-
function
|
|
1902
|
-
return
|
|
1901
|
+
function As() {
|
|
1902
|
+
return Xt()?.surface === "browser_extension_sdk_preview";
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Ss() {
|
|
1905
1905
|
const e = document.body?.cloneNode(!0);
|
|
1906
1906
|
return e instanceof HTMLElement ? (e.querySelectorAll(
|
|
1907
1907
|
[
|
|
@@ -1925,8 +1925,8 @@ function ws() {
|
|
|
1925
1925
|
s.name === "href" || s.name === "aria-label" || s.name === "role" || t.removeAttribute(s.name);
|
|
1926
1926
|
}), 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) ?? "") : "";
|
|
1927
1927
|
}
|
|
1928
|
-
function
|
|
1929
|
-
const e = document.querySelector(
|
|
1928
|
+
function Xt() {
|
|
1929
|
+
const e = document.querySelector(St);
|
|
1930
1930
|
if (!(e ?? document.querySelector(rt)))
|
|
1931
1931
|
return;
|
|
1932
1932
|
const s = e ? "browser_extension_sdk_preview" : "embedded_widget";
|
|
@@ -1936,28 +1936,28 @@ function zt() {
|
|
|
1936
1936
|
selectors: [
|
|
1937
1937
|
{
|
|
1938
1938
|
name: "widget_host",
|
|
1939
|
-
selector: s === "browser_extension_sdk_preview" ?
|
|
1939
|
+
selector: s === "browser_extension_sdk_preview" ? St : rt,
|
|
1940
1940
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
1941
1941
|
},
|
|
1942
1942
|
{
|
|
1943
1943
|
name: "widget_root",
|
|
1944
|
-
selector:
|
|
1944
|
+
selector: Ce,
|
|
1945
1945
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
1946
1946
|
},
|
|
1947
1947
|
{
|
|
1948
1948
|
name: "widget_panel",
|
|
1949
|
-
selector:
|
|
1949
|
+
selector: _e,
|
|
1950
1950
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
1951
1951
|
},
|
|
1952
1952
|
{
|
|
1953
1953
|
name: "widget_timeline",
|
|
1954
|
-
selector:
|
|
1954
|
+
selector: be,
|
|
1955
1955
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
1956
1956
|
}
|
|
1957
1957
|
]
|
|
1958
1958
|
};
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1960
|
+
function ks(e) {
|
|
1961
1961
|
try {
|
|
1962
1962
|
const t = JSON.parse(e);
|
|
1963
1963
|
return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
|
|
@@ -1965,16 +1965,16 @@ function Is(e) {
|
|
|
1965
1965
|
return { type: "error", message: "Invalid server event" };
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
|
-
function
|
|
1968
|
+
function Mt(e, t) {
|
|
1969
1969
|
if (!e || typeof e != "object")
|
|
1970
1970
|
return [];
|
|
1971
1971
|
const s = e[t];
|
|
1972
1972
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
1973
1973
|
}
|
|
1974
|
-
function
|
|
1974
|
+
function Es(e) {
|
|
1975
1975
|
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
|
|
1976
1976
|
}
|
|
1977
|
-
function
|
|
1977
|
+
function Rs(e) {
|
|
1978
1978
|
if (!e || typeof e != "object")
|
|
1979
1979
|
return null;
|
|
1980
1980
|
const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, c = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -1985,13 +1985,13 @@ function Ss(e) {
|
|
|
1985
1985
|
...c !== null ? { scribbleStyle: c } : {}
|
|
1986
1986
|
};
|
|
1987
1987
|
}
|
|
1988
|
-
function
|
|
1988
|
+
function Cs(e) {
|
|
1989
1989
|
if (!e || typeof e != "object")
|
|
1990
1990
|
return null;
|
|
1991
1991
|
const t = e.javascript;
|
|
1992
1992
|
return typeof t != "string" || !t.trim() ? null : { javascript: t };
|
|
1993
1993
|
}
|
|
1994
|
-
function
|
|
1994
|
+
function _s(e, t) {
|
|
1995
1995
|
return t ? e && typeof e == "object" ? {
|
|
1996
1996
|
...e,
|
|
1997
1997
|
helperError: t
|
|
@@ -2001,13 +2001,13 @@ function Es(e, t) {
|
|
|
2001
2001
|
helperError: t
|
|
2002
2002
|
} : e;
|
|
2003
2003
|
}
|
|
2004
|
-
function
|
|
2004
|
+
function bs(e) {
|
|
2005
2005
|
if (!e || typeof e != "object")
|
|
2006
2006
|
return e;
|
|
2007
2007
|
const t = e;
|
|
2008
2008
|
return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
|
|
2009
2009
|
}
|
|
2010
|
-
function
|
|
2010
|
+
function Ms() {
|
|
2011
2011
|
const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
|
|
2012
2012
|
if (t)
|
|
2013
2013
|
return t;
|
|
@@ -2017,7 +2017,7 @@ function _s() {
|
|
|
2017
2017
|
function B() {
|
|
2018
2018
|
return crypto.randomUUID();
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2020
|
+
function Ps(e) {
|
|
2021
2021
|
if (!e || typeof e != "object")
|
|
2022
2022
|
return null;
|
|
2023
2023
|
const t = e, s = typeof t.id == "string" ? t.id : null;
|
|
@@ -2028,14 +2028,14 @@ function Cs(e) {
|
|
|
2028
2028
|
avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
|
|
2029
2029
|
} : null;
|
|
2030
2030
|
}
|
|
2031
|
-
function
|
|
2031
|
+
function Us(e, t) {
|
|
2032
2032
|
return Array.isArray(e) ? lt(
|
|
2033
2033
|
ut(
|
|
2034
|
-
e.map((s) =>
|
|
2034
|
+
e.map((s) => Kt(s, t)).filter((s) => s !== null)
|
|
2035
2035
|
)
|
|
2036
2036
|
) : [];
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function Ds(e) {
|
|
2039
2039
|
return Array.isArray(e) ? e.flatMap((t) => {
|
|
2040
2040
|
if (!t || typeof t != "object")
|
|
2041
2041
|
return [];
|
|
@@ -2054,7 +2054,7 @@ function Ms(e) {
|
|
|
2054
2054
|
];
|
|
2055
2055
|
}) : [];
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2057
|
+
function Kt(e, t) {
|
|
2058
2058
|
if (!e || typeof e != "object")
|
|
2059
2059
|
return null;
|
|
2060
2060
|
const s = e, n = s.data;
|
|
@@ -2064,44 +2064,47 @@ function Gt(e, t) {
|
|
|
2064
2064
|
if (r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
2065
2065
|
return null;
|
|
2066
2066
|
if (r.type === "message") {
|
|
2067
|
-
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system"
|
|
2068
|
-
return {
|
|
2067
|
+
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
|
|
2069
2068
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2070
2069
|
role: i,
|
|
2071
|
-
content:
|
|
2070
|
+
content: Bs(r.content),
|
|
2072
2071
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2073
2072
|
respondsToUserMessageId: M(r) ?? void 0,
|
|
2074
|
-
...
|
|
2075
|
-
attachments:
|
|
2073
|
+
...C(r) ? { runId: C(r) } : {},
|
|
2074
|
+
attachments: Qt(r.attachments, t)
|
|
2076
2075
|
};
|
|
2076
|
+
return typeof r.clientMessageId == "string" && Object.defineProperty(o, "clientMessageId", {
|
|
2077
|
+
value: r.clientMessageId,
|
|
2078
|
+
enumerable: !1
|
|
2079
|
+
}), o;
|
|
2077
2080
|
}
|
|
2078
2081
|
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "tab_lifecycle_decision" ? {
|
|
2079
2082
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2080
2083
|
role: "tool",
|
|
2081
|
-
content:
|
|
2084
|
+
content: Ns(r),
|
|
2082
2085
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2083
2086
|
respondsToUserMessageId: M(r) ?? void 0,
|
|
2084
|
-
...
|
|
2087
|
+
...C(r) ? { runId: C(r) } : {},
|
|
2085
2088
|
dataType: String(r.type),
|
|
2086
2089
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
2087
|
-
callId:
|
|
2090
|
+
callId: Ls(r) ?? void 0,
|
|
2088
2091
|
loading: r.localExecutionStatus === "running"
|
|
2089
2092
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
2090
2093
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2091
2094
|
role: "system",
|
|
2092
|
-
content:
|
|
2095
|
+
content: vs(r),
|
|
2093
2096
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2094
2097
|
respondsToUserMessageId: M(r) ?? void 0,
|
|
2095
|
-
...
|
|
2098
|
+
...C(r) ? { runId: C(r) } : {},
|
|
2096
2099
|
dataType: String(r.type),
|
|
2097
2100
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
2098
2101
|
...typeof r.retryable == "boolean" ? { retryable: r.retryable } : {}
|
|
2099
2102
|
} : null;
|
|
2100
2103
|
}
|
|
2101
|
-
function
|
|
2104
|
+
function vs(e) {
|
|
2102
2105
|
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.";
|
|
2103
2106
|
}
|
|
2104
|
-
function
|
|
2107
|
+
function Ns(e) {
|
|
2105
2108
|
if (e.type === "web_search_call") {
|
|
2106
2109
|
const t = e.action;
|
|
2107
2110
|
if (t && typeof t == "object") {
|
|
@@ -2113,9 +2116,9 @@ function Us(e) {
|
|
|
2113
2116
|
}
|
|
2114
2117
|
return "Searching the web";
|
|
2115
2118
|
}
|
|
2116
|
-
return
|
|
2119
|
+
return Os(e);
|
|
2117
2120
|
}
|
|
2118
|
-
function
|
|
2121
|
+
function Os(e) {
|
|
2119
2122
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
2120
2123
|
return e.summary;
|
|
2121
2124
|
if (typeof e.arguments == "string")
|
|
@@ -2128,11 +2131,11 @@ function Ds(e) {
|
|
|
2128
2131
|
}
|
|
2129
2132
|
return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
|
|
2130
2133
|
}
|
|
2131
|
-
function
|
|
2134
|
+
function Ls(e) {
|
|
2132
2135
|
const t = e.callId ?? e.call_id;
|
|
2133
2136
|
return typeof t == "string" && t ? t : null;
|
|
2134
2137
|
}
|
|
2135
|
-
function
|
|
2138
|
+
function Bs(e) {
|
|
2136
2139
|
return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
|
|
2137
2140
|
if (!t || typeof t != "object")
|
|
2138
2141
|
return "";
|
|
@@ -2140,8 +2143,8 @@ function Ns(e) {
|
|
|
2140
2143
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
2141
2144
|
}).filter(Boolean).join("") : "";
|
|
2142
2145
|
}
|
|
2143
|
-
function
|
|
2144
|
-
const s =
|
|
2146
|
+
function qs(e, t) {
|
|
2147
|
+
const s = Jt(e, t), n = Ws(e, t), r = n.findIndex((o) => o.id === s.id);
|
|
2145
2148
|
if (r === -1)
|
|
2146
2149
|
return lt(
|
|
2147
2150
|
ut([...n, s])
|
|
@@ -2149,48 +2152,62 @@ function Os(e, t) {
|
|
|
2149
2152
|
const i = [...n];
|
|
2150
2153
|
return i[r] = s, lt(ut(i));
|
|
2151
2154
|
}
|
|
2152
|
-
function
|
|
2155
|
+
function xs(e, t) {
|
|
2153
2156
|
const s = t.map(
|
|
2154
|
-
(n) =>
|
|
2155
|
-
);
|
|
2156
|
-
return t.length > 0 ? s : e.filter(
|
|
2157
|
-
(n) => n.role === "user" && n.id.startsWith("local-")
|
|
2157
|
+
(n) => Jt(e, n)
|
|
2158
2158
|
);
|
|
2159
|
+
return t.length > 0 ? s : e.filter(mt);
|
|
2159
2160
|
}
|
|
2160
|
-
function
|
|
2161
|
+
function Jt(e, t) {
|
|
2161
2162
|
if (t.role !== "user" || !t.attachments?.length)
|
|
2162
2163
|
return t;
|
|
2163
2164
|
const s = e.find(
|
|
2164
|
-
(r) => r.role === "user" && (r.id === t.id || r
|
|
2165
|
+
(r) => r.role === "user" && (r.id === t.id || mt(r) && Yt(r, t))
|
|
2165
2166
|
);
|
|
2166
2167
|
if (!s?.attachments?.length)
|
|
2167
2168
|
return t;
|
|
2168
2169
|
const n = t.attachments.map((r) => {
|
|
2169
|
-
const i =
|
|
2170
|
-
return i ?
|
|
2170
|
+
const i = Fs(s.attachments ?? [], r);
|
|
2171
|
+
return i ? Hs(r, i) : r;
|
|
2171
2172
|
});
|
|
2172
2173
|
return { ...t, attachments: n };
|
|
2173
2174
|
}
|
|
2174
|
-
function
|
|
2175
|
+
function Fs(e, t) {
|
|
2175
2176
|
return t.id ? e.find((s) => s.id === t.id) ?? null : null;
|
|
2176
2177
|
}
|
|
2177
|
-
function
|
|
2178
|
+
function Hs(e, t) {
|
|
2178
2179
|
const { previewUrl: s } = t;
|
|
2179
2180
|
return s ? { ...e, previewUrl: s } : e;
|
|
2180
2181
|
}
|
|
2181
|
-
function
|
|
2182
|
+
function Ws(e, t) {
|
|
2182
2183
|
if (t.role !== "user")
|
|
2183
2184
|
return e;
|
|
2184
2185
|
const s = e.findIndex(
|
|
2185
|
-
(r) => r
|
|
2186
|
+
(r) => mt(r) && Yt(r, t)
|
|
2186
2187
|
);
|
|
2187
2188
|
if (s === -1)
|
|
2188
2189
|
return e;
|
|
2189
2190
|
const n = [...e];
|
|
2190
2191
|
return n.splice(s, 1), n;
|
|
2191
2192
|
}
|
|
2192
|
-
function
|
|
2193
|
-
const
|
|
2193
|
+
function Yt(e, t) {
|
|
2194
|
+
const s = Pt(e), n = Pt(t);
|
|
2195
|
+
return s && n ? s === n : e.content === t.content;
|
|
2196
|
+
}
|
|
2197
|
+
function mt(e) {
|
|
2198
|
+
return e.role === "user" && (e.id.startsWith("local-") || e.id.startsWith("optimistic-user-message:"));
|
|
2199
|
+
}
|
|
2200
|
+
function Pt(e) {
|
|
2201
|
+
const t = e.clientMessageId;
|
|
2202
|
+
if (t)
|
|
2203
|
+
return t;
|
|
2204
|
+
const n = ["local-", "optimistic-user-message:"].find(
|
|
2205
|
+
(r) => e.id.startsWith(r)
|
|
2206
|
+
);
|
|
2207
|
+
return n ? e.id.slice(n.length) : null;
|
|
2208
|
+
}
|
|
2209
|
+
function Ut(e) {
|
|
2210
|
+
const t = Vt(e);
|
|
2194
2211
|
if (t === null)
|
|
2195
2212
|
return !1;
|
|
2196
2213
|
for (let s = e.length - 1; s > t; s -= 1) {
|
|
@@ -2206,20 +2223,20 @@ function Mt(e) {
|
|
|
2206
2223
|
}
|
|
2207
2224
|
return !1;
|
|
2208
2225
|
}
|
|
2209
|
-
function
|
|
2210
|
-
const t =
|
|
2226
|
+
function js(e) {
|
|
2227
|
+
const t = Vt(e);
|
|
2211
2228
|
return t === null ? e.some((s) => s.role === "assistant") : e.slice(t + 1).some((s) => s.role === "assistant");
|
|
2212
2229
|
}
|
|
2213
|
-
function
|
|
2230
|
+
function Vt(e) {
|
|
2214
2231
|
for (let t = e.length - 1; t >= 0; t -= 1)
|
|
2215
2232
|
if (e[t].role === "user")
|
|
2216
2233
|
return t;
|
|
2217
2234
|
return null;
|
|
2218
2235
|
}
|
|
2219
|
-
function
|
|
2236
|
+
function $s(e) {
|
|
2220
2237
|
return e.role === "assistant" ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
|
|
2221
2238
|
}
|
|
2222
|
-
function
|
|
2239
|
+
function yt(e) {
|
|
2223
2240
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
2224
2241
|
const s = e[t];
|
|
2225
2242
|
if (!s || typeof s != "object")
|
|
@@ -2242,21 +2259,21 @@ function v(e) {
|
|
|
2242
2259
|
function at(e) {
|
|
2243
2260
|
return e?.retryable !== !0 ? !1 : e.type === "run_error" ? !0 : e.type === "run_status" && e.status === "interrupted";
|
|
2244
2261
|
}
|
|
2245
|
-
function
|
|
2262
|
+
function Dt(e) {
|
|
2246
2263
|
return e?.type === "run_status" && e.status === "interrupted" && e.reason === "backend_restart";
|
|
2247
2264
|
}
|
|
2248
|
-
function
|
|
2249
|
-
const s =
|
|
2265
|
+
function zs(e, t) {
|
|
2266
|
+
const s = yt(t);
|
|
2250
2267
|
if (s === null)
|
|
2251
2268
|
return !1;
|
|
2252
2269
|
const n = t[s], r = n && typeof n == "object" ? n.id : null;
|
|
2253
2270
|
if (typeof r != "string" || !r)
|
|
2254
2271
|
return !1;
|
|
2255
2272
|
const i = e.findIndex((o) => o.role === "user" && o.id === r);
|
|
2256
|
-
return i === -1 ? !1 : e.slice(i + 1).some(
|
|
2273
|
+
return i === -1 ? !1 : e.slice(i + 1).some($s);
|
|
2257
2274
|
}
|
|
2258
2275
|
function ct(e) {
|
|
2259
|
-
const t =
|
|
2276
|
+
const t = yt(e);
|
|
2260
2277
|
if (t === null)
|
|
2261
2278
|
return null;
|
|
2262
2279
|
const s = e[t];
|
|
@@ -2268,8 +2285,8 @@ function ct(e) {
|
|
|
2268
2285
|
const r = n.clientMessageId;
|
|
2269
2286
|
return typeof r == "string" ? r : null;
|
|
2270
2287
|
}
|
|
2271
|
-
function
|
|
2272
|
-
const t =
|
|
2288
|
+
function Gs(e) {
|
|
2289
|
+
const t = yt(e);
|
|
2273
2290
|
if (t === null)
|
|
2274
2291
|
return null;
|
|
2275
2292
|
for (let s = e.length - 1; s > t; s -= 1) {
|
|
@@ -2283,13 +2300,13 @@ function js(e) {
|
|
|
2283
2300
|
if (i.type === "message" && i.role === "assistant")
|
|
2284
2301
|
return null;
|
|
2285
2302
|
if (i.type === "run_error")
|
|
2286
|
-
return i.retryable !== !0 ? null :
|
|
2303
|
+
return i.retryable !== !0 ? null : vt(e, i) ?? ct(e);
|
|
2287
2304
|
if (i.type === "run_status")
|
|
2288
|
-
return i.status === "interrupted" && i.retryable === !0 ?
|
|
2305
|
+
return i.status === "interrupted" && i.retryable === !0 ? vt(e, i) ?? ct(e) : null;
|
|
2289
2306
|
}
|
|
2290
2307
|
return null;
|
|
2291
2308
|
}
|
|
2292
|
-
function
|
|
2309
|
+
function vt(e, t) {
|
|
2293
2310
|
if (typeof t.clientMessageId == "string")
|
|
2294
2311
|
return t.clientMessageId;
|
|
2295
2312
|
const s = M(t);
|
|
@@ -2298,7 +2315,7 @@ function Ut(e, t) {
|
|
|
2298
2315
|
const n = e.find((i) => I(i, "id") === s), r = v(n);
|
|
2299
2316
|
return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
|
|
2300
2317
|
}
|
|
2301
|
-
function
|
|
2318
|
+
function Xs(e, t) {
|
|
2302
2319
|
let s = 0;
|
|
2303
2320
|
for (const n of e) {
|
|
2304
2321
|
if (!n || typeof n != "object")
|
|
@@ -2311,31 +2328,31 @@ function $s(e, t) {
|
|
|
2311
2328
|
}
|
|
2312
2329
|
return s;
|
|
2313
2330
|
}
|
|
2314
|
-
function
|
|
2315
|
-
if (!t || !
|
|
2331
|
+
function Nt(e, t, s, n) {
|
|
2332
|
+
if (!t || !Ks(e))
|
|
2316
2333
|
return !1;
|
|
2317
2334
|
const r = e;
|
|
2318
|
-
return !(at(r) || s !== null && M(r) !== s || n !== null &&
|
|
2335
|
+
return !(at(r) || s !== null && M(r) !== s || n !== null && C(r) !== n);
|
|
2319
2336
|
}
|
|
2320
|
-
function
|
|
2337
|
+
function Ks(e) {
|
|
2321
2338
|
if (!e || typeof e != "object")
|
|
2322
2339
|
return !1;
|
|
2323
2340
|
const t = e;
|
|
2324
2341
|
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");
|
|
2325
2342
|
}
|
|
2326
|
-
function
|
|
2343
|
+
function Js(e) {
|
|
2327
2344
|
if (!e || typeof e != "object")
|
|
2328
2345
|
return !1;
|
|
2329
2346
|
const t = e;
|
|
2330
2347
|
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";
|
|
2331
2348
|
}
|
|
2332
2349
|
function lt(e) {
|
|
2333
|
-
return e.filter((t, s) =>
|
|
2350
|
+
return e.filter((t, s) => Tt(t) ? !en(e, s) && !Qs(e, s) && !tn(e, s) : Ys(t) ? t.retryable === !0 && Zs(e, s) ? !1 : !Vs(e, s) : !0);
|
|
2334
2351
|
}
|
|
2335
|
-
function
|
|
2352
|
+
function Ys(e) {
|
|
2336
2353
|
return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
|
|
2337
2354
|
}
|
|
2338
|
-
function
|
|
2355
|
+
function Tt(e) {
|
|
2339
2356
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2340
2357
|
}
|
|
2341
2358
|
function ut(e) {
|
|
@@ -2354,7 +2371,7 @@ function ut(e) {
|
|
|
2354
2371
|
n.has(i.id) || (r.push(i), i.role === "user" && r.push(...s.get(i.id) ?? []));
|
|
2355
2372
|
return r;
|
|
2356
2373
|
}
|
|
2357
|
-
function
|
|
2374
|
+
function Vs(e, t) {
|
|
2358
2375
|
const s = e[t];
|
|
2359
2376
|
for (let n = t + 1; n < e.length; n += 1) {
|
|
2360
2377
|
const r = e[n];
|
|
@@ -2365,7 +2382,7 @@ function Ks(e, t) {
|
|
|
2365
2382
|
}
|
|
2366
2383
|
return !1;
|
|
2367
2384
|
}
|
|
2368
|
-
function
|
|
2385
|
+
function Zs(e, t) {
|
|
2369
2386
|
const s = e[t];
|
|
2370
2387
|
if (!s.respondsToUserMessageId)
|
|
2371
2388
|
return !1;
|
|
@@ -2373,29 +2390,29 @@ function Js(e, t) {
|
|
|
2373
2390
|
const r = e[n];
|
|
2374
2391
|
if (r.role === "user")
|
|
2375
2392
|
return !1;
|
|
2376
|
-
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" ||
|
|
2393
|
+
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" || Tt(r)))
|
|
2377
2394
|
return !0;
|
|
2378
2395
|
}
|
|
2379
2396
|
return !1;
|
|
2380
2397
|
}
|
|
2381
|
-
function
|
|
2398
|
+
function Qs(e, t) {
|
|
2382
2399
|
const s = e[t];
|
|
2383
2400
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2384
2401
|
if (e[n].role === "assistant" && G(s, e[n]))
|
|
2385
2402
|
return !0;
|
|
2386
2403
|
return !1;
|
|
2387
2404
|
}
|
|
2388
|
-
function
|
|
2405
|
+
function tn(e, t) {
|
|
2389
2406
|
const s = e[t];
|
|
2390
2407
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2391
2408
|
if (e[n].role === "tool" && G(s, e[n]))
|
|
2392
2409
|
return !0;
|
|
2393
2410
|
return !1;
|
|
2394
2411
|
}
|
|
2395
|
-
function
|
|
2412
|
+
function en(e, t) {
|
|
2396
2413
|
const s = e[t];
|
|
2397
2414
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2398
|
-
if (
|
|
2415
|
+
if (Tt(e[n]) && G(s, e[n]))
|
|
2399
2416
|
return !0;
|
|
2400
2417
|
return !1;
|
|
2401
2418
|
}
|
|
@@ -2405,15 +2422,15 @@ function G(e, t) {
|
|
|
2405
2422
|
function I(e, t) {
|
|
2406
2423
|
return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
|
|
2407
2424
|
}
|
|
2408
|
-
function
|
|
2425
|
+
function sn(e, t) {
|
|
2409
2426
|
try {
|
|
2410
|
-
const s = window.localStorage.getItem(`${
|
|
2427
|
+
const s = window.localStorage.getItem(`${zt}${e}`);
|
|
2411
2428
|
if (!s)
|
|
2412
2429
|
return null;
|
|
2413
2430
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
2414
2431
|
if (t !== void 0 && r !== t)
|
|
2415
2432
|
return null;
|
|
2416
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
2433
|
+
const i = Array.isArray(n.messages) ? n.messages.map(gn).filter((o) => !!o) : [];
|
|
2417
2434
|
return {
|
|
2418
2435
|
sessionId: r,
|
|
2419
2436
|
messages: i
|
|
@@ -2422,33 +2439,33 @@ function Qs(e, t) {
|
|
|
2422
2439
|
return null;
|
|
2423
2440
|
}
|
|
2424
2441
|
}
|
|
2425
|
-
function
|
|
2442
|
+
function nn(e, t) {
|
|
2426
2443
|
try {
|
|
2427
2444
|
window.localStorage.setItem(
|
|
2428
|
-
`${
|
|
2445
|
+
`${zt}${e}`,
|
|
2429
2446
|
JSON.stringify({
|
|
2430
2447
|
sessionId: t.sessionId,
|
|
2431
|
-
messages: t.messages.slice(-
|
|
2448
|
+
messages: t.messages.slice(-Ke).map(mn)
|
|
2432
2449
|
})
|
|
2433
2450
|
);
|
|
2434
2451
|
} catch {
|
|
2435
2452
|
return;
|
|
2436
2453
|
}
|
|
2437
2454
|
}
|
|
2438
|
-
function
|
|
2455
|
+
function rn(e) {
|
|
2439
2456
|
try {
|
|
2440
2457
|
const t = window.localStorage.getItem(`${it}${e}`);
|
|
2441
2458
|
if (!t)
|
|
2442
2459
|
return [];
|
|
2443
2460
|
const s = JSON.parse(t);
|
|
2444
|
-
return Array.isArray(s) ? s.filter(
|
|
2461
|
+
return Array.isArray(s) ? s.filter(wt) : [];
|
|
2445
2462
|
} catch {
|
|
2446
2463
|
return [];
|
|
2447
2464
|
}
|
|
2448
2465
|
}
|
|
2449
2466
|
function U(e, t) {
|
|
2450
2467
|
try {
|
|
2451
|
-
const s = t.filter(
|
|
2468
|
+
const s = t.filter(wt);
|
|
2452
2469
|
if (s.length === 0) {
|
|
2453
2470
|
window.localStorage.removeItem(`${it}${e}`);
|
|
2454
2471
|
return;
|
|
@@ -2461,7 +2478,7 @@ function U(e, t) {
|
|
|
2461
2478
|
return;
|
|
2462
2479
|
}
|
|
2463
2480
|
}
|
|
2464
|
-
function
|
|
2481
|
+
function Zt(e, t) {
|
|
2465
2482
|
try {
|
|
2466
2483
|
const s = `${z}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
|
|
2467
2484
|
...o,
|
|
@@ -2477,28 +2494,28 @@ function Jt(e, t) {
|
|
|
2477
2494
|
} catch {
|
|
2478
2495
|
}
|
|
2479
2496
|
}
|
|
2480
|
-
function
|
|
2497
|
+
function on(e, t) {
|
|
2481
2498
|
try {
|
|
2482
2499
|
if (window.sessionStorage.getItem(`${z}${e}`) === null)
|
|
2483
2500
|
return;
|
|
2484
2501
|
} catch {
|
|
2485
2502
|
return;
|
|
2486
2503
|
}
|
|
2487
|
-
|
|
2504
|
+
Zt(e, t);
|
|
2488
2505
|
}
|
|
2489
|
-
function
|
|
2506
|
+
function an(e) {
|
|
2490
2507
|
try {
|
|
2491
2508
|
const t = `${z}${e}`, s = window.sessionStorage.getItem(t);
|
|
2492
2509
|
if (window.sessionStorage.removeItem(t), !s)
|
|
2493
2510
|
return [];
|
|
2494
2511
|
const n = JSON.parse(s);
|
|
2495
|
-
return Array.isArray(n) ? n.flatMap((r) =>
|
|
2512
|
+
return Array.isArray(n) ? n.flatMap((r) => ln(r) ? [{
|
|
2496
2513
|
...r.event,
|
|
2497
2514
|
page: S(),
|
|
2498
2515
|
rawOutput: {
|
|
2499
2516
|
pageContextRestarted: !0,
|
|
2500
2517
|
outcome: "unknown",
|
|
2501
|
-
message:
|
|
2518
|
+
message: cn(location.href),
|
|
2502
2519
|
currentUrl: location.href,
|
|
2503
2520
|
console: [],
|
|
2504
2521
|
metadata: {
|
|
@@ -2515,17 +2532,17 @@ function nn(e) {
|
|
|
2515
2532
|
return [];
|
|
2516
2533
|
}
|
|
2517
2534
|
}
|
|
2518
|
-
function
|
|
2535
|
+
function cn(e) {
|
|
2519
2536
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
2520
2537
|
Current URL: ${e}`;
|
|
2521
2538
|
}
|
|
2522
|
-
function
|
|
2539
|
+
function ln(e) {
|
|
2523
2540
|
if (!e || typeof e != "object")
|
|
2524
2541
|
return !1;
|
|
2525
2542
|
const t = e, s = t.event;
|
|
2526
|
-
return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" &&
|
|
2543
|
+
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";
|
|
2527
2544
|
}
|
|
2528
|
-
function
|
|
2545
|
+
function un(e, t) {
|
|
2529
2546
|
const s = new Set(
|
|
2530
2547
|
e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
2531
2548
|
);
|
|
@@ -2534,26 +2551,26 @@ function an(e, t) {
|
|
|
2534
2551
|
...t.filter((n) => !s.has(n.callId))
|
|
2535
2552
|
];
|
|
2536
2553
|
}
|
|
2537
|
-
function
|
|
2554
|
+
function dn(e) {
|
|
2538
2555
|
try {
|
|
2539
2556
|
window.sessionStorage.removeItem(`${z}${e}`);
|
|
2540
2557
|
} catch {
|
|
2541
2558
|
return;
|
|
2542
2559
|
}
|
|
2543
2560
|
}
|
|
2544
|
-
function
|
|
2561
|
+
function wt(e) {
|
|
2545
2562
|
if (!e || typeof e != "object")
|
|
2546
2563
|
return !1;
|
|
2547
2564
|
const t = e;
|
|
2548
|
-
return t.type === "chat.user_message" ? typeof t.content == "string" &&
|
|
2565
|
+
return t.type === "chat.user_message" ? typeof t.content == "string" && Ot(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? Ot(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;
|
|
2549
2566
|
}
|
|
2550
|
-
function
|
|
2567
|
+
function Ot(e) {
|
|
2551
2568
|
if (!e || typeof e != "object")
|
|
2552
2569
|
return !1;
|
|
2553
2570
|
const t = e;
|
|
2554
2571
|
return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
|
|
2555
2572
|
}
|
|
2556
|
-
function
|
|
2573
|
+
function Qt(e, t) {
|
|
2557
2574
|
if (!Array.isArray(e))
|
|
2558
2575
|
return;
|
|
2559
2576
|
const s = e.filter((r) => {
|
|
@@ -2561,24 +2578,24 @@ function Yt(e, t) {
|
|
|
2561
2578
|
return !1;
|
|
2562
2579
|
const i = r;
|
|
2563
2580
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
2564
|
-
}), n = t ? s.map((r) =>
|
|
2581
|
+
}), n = t ? s.map((r) => te(r, t)) : s;
|
|
2565
2582
|
return n.length > 0 ? n : void 0;
|
|
2566
2583
|
}
|
|
2567
|
-
function
|
|
2584
|
+
function te(e, t) {
|
|
2568
2585
|
return e.fileUrl?.startsWith("/") ? {
|
|
2569
2586
|
...e,
|
|
2570
2587
|
fileUrl: new URL(e.fileUrl, t).toString()
|
|
2571
2588
|
} : e;
|
|
2572
2589
|
}
|
|
2573
|
-
function
|
|
2574
|
-
if (
|
|
2590
|
+
function hn(e) {
|
|
2591
|
+
if (pn(e))
|
|
2575
2592
|
return {
|
|
2576
2593
|
headers: {
|
|
2577
2594
|
"ngrok-skip-browser-warning": "true"
|
|
2578
2595
|
}
|
|
2579
2596
|
};
|
|
2580
2597
|
}
|
|
2581
|
-
function
|
|
2598
|
+
function pn(e) {
|
|
2582
2599
|
try {
|
|
2583
2600
|
const t = new URL(e).hostname;
|
|
2584
2601
|
return t.endsWith(".ngrok-free.dev") || t.endsWith(".ngrok-free.app") || t.endsWith(".ngrok.app") || t.endsWith(".ngrok.io");
|
|
@@ -2586,14 +2603,14 @@ function un(e) {
|
|
|
2586
2603
|
return !1;
|
|
2587
2604
|
}
|
|
2588
2605
|
}
|
|
2589
|
-
function
|
|
2590
|
-
return e.type ||
|
|
2606
|
+
function Lt(e) {
|
|
2607
|
+
return e.type || fn(e.name) || "application/octet-stream";
|
|
2591
2608
|
}
|
|
2592
|
-
function
|
|
2609
|
+
function fn(e) {
|
|
2593
2610
|
const t = e.toLowerCase();
|
|
2594
2611
|
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;
|
|
2595
2612
|
}
|
|
2596
|
-
function
|
|
2613
|
+
function gn(e) {
|
|
2597
2614
|
if (!e || typeof e != "object")
|
|
2598
2615
|
return null;
|
|
2599
2616
|
const t = e;
|
|
@@ -2605,17 +2622,17 @@ function hn(e) {
|
|
|
2605
2622
|
respondsToUserMessageId: typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : void 0,
|
|
2606
2623
|
...typeof t.runId == "string" ? { runId: t.runId } : {},
|
|
2607
2624
|
dataType: typeof t.dataType == "string" ? t.dataType : void 0,
|
|
2608
|
-
attachments:
|
|
2625
|
+
attachments: Qt(t.attachments)?.map(It),
|
|
2609
2626
|
loading: typeof t.loading == "boolean" ? t.loading : void 0
|
|
2610
2627
|
};
|
|
2611
2628
|
}
|
|
2612
|
-
function
|
|
2629
|
+
function mn(e) {
|
|
2613
2630
|
return e.attachments?.length ? {
|
|
2614
2631
|
...e,
|
|
2615
|
-
attachments: e.attachments.map(
|
|
2632
|
+
attachments: e.attachments.map(It)
|
|
2616
2633
|
} : e;
|
|
2617
2634
|
}
|
|
2618
|
-
function
|
|
2635
|
+
function It(e) {
|
|
2619
2636
|
const {
|
|
2620
2637
|
dataUrl: t,
|
|
2621
2638
|
objectUrl: s,
|
|
@@ -2628,43 +2645,43 @@ function M(e) {
|
|
|
2628
2645
|
const t = e.respondsToUserMessageId;
|
|
2629
2646
|
return typeof t == "string" && t ? t : null;
|
|
2630
2647
|
}
|
|
2631
|
-
function
|
|
2648
|
+
function C(e) {
|
|
2632
2649
|
const t = e.runId;
|
|
2633
2650
|
return typeof t == "string" && t ? t : null;
|
|
2634
2651
|
}
|
|
2635
|
-
function
|
|
2652
|
+
function yn(e) {
|
|
2636
2653
|
const t = e?.timeoutMs;
|
|
2637
|
-
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 <=
|
|
2654
|
+
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 <= ss);
|
|
2638
2655
|
}
|
|
2639
|
-
function
|
|
2656
|
+
function ee(e) {
|
|
2640
2657
|
const t = {};
|
|
2641
2658
|
try {
|
|
2642
2659
|
new Headers(e).forEach((s, n) => {
|
|
2643
|
-
Object.keys(t).length < ft && (t[n] =
|
|
2660
|
+
Object.keys(t).length < ft && (t[n] = At(n, s));
|
|
2644
2661
|
});
|
|
2645
2662
|
} catch {
|
|
2646
2663
|
return {};
|
|
2647
2664
|
}
|
|
2648
2665
|
return t;
|
|
2649
2666
|
}
|
|
2650
|
-
function
|
|
2651
|
-
return
|
|
2667
|
+
function At(e, t) {
|
|
2668
|
+
return ae(e) ? X : E(j(t), ze);
|
|
2652
2669
|
}
|
|
2653
|
-
function
|
|
2670
|
+
function Tn(e, t) {
|
|
2654
2671
|
return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
|
|
2655
2672
|
}
|
|
2656
|
-
async function
|
|
2657
|
-
const r =
|
|
2673
|
+
async function wn(e, t, s, n) {
|
|
2674
|
+
const r = ee(e.headers);
|
|
2658
2675
|
n({
|
|
2659
2676
|
...t,
|
|
2660
2677
|
responseStatus: e.status,
|
|
2661
2678
|
responseHeaders: r,
|
|
2662
|
-
responseBody: await
|
|
2679
|
+
responseBody: await In(e),
|
|
2663
2680
|
durationMs: Date.now() - s
|
|
2664
2681
|
});
|
|
2665
2682
|
}
|
|
2666
|
-
async function
|
|
2667
|
-
if (!
|
|
2683
|
+
async function In(e) {
|
|
2684
|
+
if (!se(e.headers))
|
|
2668
2685
|
return;
|
|
2669
2686
|
let t = null, s = null;
|
|
2670
2687
|
try {
|
|
@@ -2673,7 +2690,7 @@ async function yn(e) {
|
|
|
2673
2690
|
const n = new Promise((c) => {
|
|
2674
2691
|
s = window.setTimeout(() => {
|
|
2675
2692
|
t?.cancel(), c("timeout");
|
|
2676
|
-
},
|
|
2693
|
+
}, Ge);
|
|
2677
2694
|
}), r = new TextDecoder();
|
|
2678
2695
|
let i = "", o = 0;
|
|
2679
2696
|
for (; ; ) {
|
|
@@ -2695,26 +2712,26 @@ async function yn(e) {
|
|
|
2695
2712
|
s !== null && window.clearTimeout(s);
|
|
2696
2713
|
}
|
|
2697
2714
|
}
|
|
2698
|
-
function
|
|
2699
|
-
if (
|
|
2715
|
+
function An(e, t) {
|
|
2716
|
+
if (se(new Headers(t)))
|
|
2700
2717
|
try {
|
|
2701
2718
|
return e.responseType === "" || e.responseType === "text" ? E(e.responseText ?? "") : void 0;
|
|
2702
2719
|
} catch {
|
|
2703
2720
|
return;
|
|
2704
2721
|
}
|
|
2705
2722
|
}
|
|
2706
|
-
function
|
|
2723
|
+
function Bt(e) {
|
|
2707
2724
|
if (typeof e == "string")
|
|
2708
2725
|
return E(e);
|
|
2709
2726
|
}
|
|
2710
|
-
function
|
|
2727
|
+
function Sn(e) {
|
|
2711
2728
|
return k({
|
|
2712
2729
|
...e,
|
|
2713
|
-
requestBody:
|
|
2714
|
-
responseBody:
|
|
2730
|
+
requestBody: qt(e.requestBody),
|
|
2731
|
+
responseBody: qt(e.responseBody)
|
|
2715
2732
|
});
|
|
2716
2733
|
}
|
|
2717
|
-
function
|
|
2734
|
+
function qt(e) {
|
|
2718
2735
|
if (typeof e != "string")
|
|
2719
2736
|
return e;
|
|
2720
2737
|
const t = e.trim();
|
|
@@ -2726,14 +2743,14 @@ function Lt(e) {
|
|
|
2726
2743
|
return j(e);
|
|
2727
2744
|
}
|
|
2728
2745
|
}
|
|
2729
|
-
function
|
|
2746
|
+
function se(e) {
|
|
2730
2747
|
if (!e)
|
|
2731
2748
|
return !1;
|
|
2732
2749
|
const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
|
|
2733
2750
|
return s !== null && Number.isInteger(n) && n >= 0 && n <= pt && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
|
|
2734
2751
|
}
|
|
2735
2752
|
function b(e, t = {}, s) {
|
|
2736
|
-
if (
|
|
2753
|
+
if (En(s))
|
|
2737
2754
|
return !0;
|
|
2738
2755
|
const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
2739
2756
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -2748,7 +2765,7 @@ function b(e, t = {}, s) {
|
|
|
2748
2765
|
return !0;
|
|
2749
2766
|
}
|
|
2750
2767
|
}
|
|
2751
|
-
function
|
|
2768
|
+
function kn(e, t) {
|
|
2752
2769
|
if (b(e))
|
|
2753
2770
|
return !0;
|
|
2754
2771
|
try {
|
|
@@ -2758,10 +2775,10 @@ function In(e, t) {
|
|
|
2758
2775
|
return !0;
|
|
2759
2776
|
}
|
|
2760
2777
|
}
|
|
2761
|
-
function
|
|
2778
|
+
function En(e) {
|
|
2762
2779
|
return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
|
|
2763
2780
|
}
|
|
2764
|
-
function
|
|
2781
|
+
function Rn(e) {
|
|
2765
2782
|
const t = {};
|
|
2766
2783
|
for (const s of e.trim().split(/[\r\n]+/)) {
|
|
2767
2784
|
const n = s.indexOf(":");
|
|
@@ -2770,7 +2787,7 @@ function Sn(e) {
|
|
|
2770
2787
|
if (Object.keys(t).length >= ft)
|
|
2771
2788
|
break;
|
|
2772
2789
|
const r = s.slice(0, n).trim();
|
|
2773
|
-
t[r] =
|
|
2790
|
+
t[r] = At(r, s.slice(n + 1).trim());
|
|
2774
2791
|
}
|
|
2775
2792
|
return t;
|
|
2776
2793
|
}
|
|
@@ -2788,31 +2805,31 @@ class F extends Error {
|
|
|
2788
2805
|
}
|
|
2789
2806
|
async function et(e, t) {
|
|
2790
2807
|
let s = null;
|
|
2791
|
-
for (let n = 0; n <
|
|
2808
|
+
for (let n = 0; n < Ct; n += 1)
|
|
2792
2809
|
try {
|
|
2793
2810
|
return await e();
|
|
2794
2811
|
} catch (r) {
|
|
2795
|
-
if (s = r, n >=
|
|
2812
|
+
if (s = r, n >= Ct - 1 || !_n(r))
|
|
2796
2813
|
throw r;
|
|
2797
|
-
await
|
|
2814
|
+
await Cn(n);
|
|
2798
2815
|
}
|
|
2799
2816
|
throw s instanceof Error ? s : new Error(t);
|
|
2800
2817
|
}
|
|
2801
|
-
function
|
|
2818
|
+
function Cn(e) {
|
|
2802
2819
|
return new Promise((t) => {
|
|
2803
|
-
window.setTimeout(t,
|
|
2820
|
+
window.setTimeout(t, $e[e] ?? 0);
|
|
2804
2821
|
});
|
|
2805
2822
|
}
|
|
2806
|
-
function
|
|
2807
|
-
return e instanceof F ?
|
|
2823
|
+
function _n(e) {
|
|
2824
|
+
return e instanceof F ? bn(e.status) : e instanceof TypeError;
|
|
2808
2825
|
}
|
|
2809
|
-
function
|
|
2826
|
+
function bn(e) {
|
|
2810
2827
|
return e === 408 || e === 409 || e === 429 || e >= 500;
|
|
2811
2828
|
}
|
|
2812
|
-
function
|
|
2829
|
+
function Mn(e) {
|
|
2813
2830
|
return e === 401 || e === 403;
|
|
2814
2831
|
}
|
|
2815
|
-
const X = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]",
|
|
2832
|
+
const X = "[REDACTED_SECRET]", R = "[REDACTED_TOKEN]", Pn = "[REDACTED_SIGNED_URL]", Un = 20, Dn = /^(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, ne = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, re = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, ie = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, oe = /\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, vn = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Nn = /\bhttps?:\/\/[^\s"'<>]+/gi, On = /[),.;\]]+$/;
|
|
2816
2833
|
function k(e) {
|
|
2817
2834
|
return W(e, 0, /* @__PURE__ */ new WeakSet());
|
|
2818
2835
|
}
|
|
@@ -2821,7 +2838,7 @@ function W(e, t, s) {
|
|
|
2821
2838
|
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : j(e);
|
|
2822
2839
|
if (e === null || typeof e != "object")
|
|
2823
2840
|
return e;
|
|
2824
|
-
if (t >=
|
|
2841
|
+
if (t >= Un)
|
|
2825
2842
|
return "[REDACTED_MAX_DEPTH]";
|
|
2826
2843
|
if (s.has(e))
|
|
2827
2844
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -2829,44 +2846,44 @@ function W(e, t, s) {
|
|
|
2829
2846
|
return e.map((r) => W(r, t + 1, s));
|
|
2830
2847
|
const n = {};
|
|
2831
2848
|
for (const [r, i] of Object.entries(e))
|
|
2832
|
-
|
|
2849
|
+
ae(r) ? n[r] = X : n[r] = r.toLowerCase() === "url" ? Ln(i) : W(i, t + 1, s);
|
|
2833
2850
|
return n;
|
|
2834
2851
|
}
|
|
2835
|
-
function
|
|
2852
|
+
function ae(e) {
|
|
2836
2853
|
const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
2837
2854
|
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");
|
|
2838
2855
|
}
|
|
2839
|
-
function
|
|
2840
|
-
return typeof e == "string" ?
|
|
2856
|
+
function Ln(e) {
|
|
2857
|
+
return typeof e == "string" ? ce(e) : W(e, 0, /* @__PURE__ */ new WeakSet());
|
|
2841
2858
|
}
|
|
2842
|
-
function
|
|
2859
|
+
function ce(e) {
|
|
2843
2860
|
try {
|
|
2844
2861
|
const t = new URL(e, location.href);
|
|
2845
2862
|
for (const s of Array.from(t.searchParams.keys()))
|
|
2846
|
-
|
|
2863
|
+
Dn.test(s) && t.searchParams.set(s, R);
|
|
2847
2864
|
return t.username && (t.username = R), t.password && (t.password = R), t.toString();
|
|
2848
2865
|
} catch {
|
|
2849
|
-
return
|
|
2866
|
+
return Bn(e);
|
|
2850
2867
|
}
|
|
2851
2868
|
}
|
|
2852
2869
|
function j(e) {
|
|
2853
|
-
return e.replace(
|
|
2870
|
+
return e.replace(vn, Pn).replace(Nn, qn).replace(ne, `Bearer ${R}`).replace(re, `Basic ${R}`).replace(ie, R).replace(oe, (t, s) => `${s}: ${X}`);
|
|
2854
2871
|
}
|
|
2855
|
-
function
|
|
2856
|
-
return e.replace(
|
|
2872
|
+
function Bn(e) {
|
|
2873
|
+
return e.replace(ne, `Bearer ${R}`).replace(re, `Basic ${R}`).replace(ie, R).replace(oe, (t, s) => `${s}: ${X}`);
|
|
2857
2874
|
}
|
|
2858
|
-
function
|
|
2859
|
-
const t = e.match(
|
|
2860
|
-
return `${
|
|
2875
|
+
function qn(e) {
|
|
2876
|
+
const t = e.match(On)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
|
|
2877
|
+
return `${ce(s)}${t}`;
|
|
2861
2878
|
}
|
|
2862
2879
|
export {
|
|
2863
|
-
|
|
2880
|
+
St as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
2864
2881
|
rt as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2882
|
+
_e as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
2883
|
+
Ce as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
2884
|
+
be as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
2885
|
+
Gt as PlunoProductAgent,
|
|
2886
|
+
Ye as calculateReconnectDelay,
|
|
2887
|
+
Gt as default,
|
|
2888
|
+
ms as getProductAgentOriginAccessErrorMessage
|
|
2872
2889
|
};
|