@pluno/product-agent-web 0.1.164 → 0.1.166
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 +11 -0
- package/dist/product-agent-sdk.js +895 -808
- package/dist/product-agent-widget.js +2760 -2643
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ds = "pluno-product-agent-attachments";
|
|
2
2
|
const Be = "files";
|
|
3
|
-
async function
|
|
4
|
-
const e = await
|
|
5
|
-
await
|
|
3
|
+
async function hs(t) {
|
|
4
|
+
const e = await Ve();
|
|
5
|
+
await fs(e, "readwrite", (s) => s.put(t));
|
|
6
6
|
}
|
|
7
7
|
async function ps(t, e) {
|
|
8
|
-
const s = await
|
|
9
|
-
await
|
|
10
|
-
const r = await
|
|
8
|
+
const s = await Ve();
|
|
9
|
+
await Je(s, "readwrite", async (n) => {
|
|
10
|
+
const r = await Ye(
|
|
11
11
|
n.get(t)
|
|
12
12
|
);
|
|
13
13
|
r && n.put({
|
|
@@ -16,26 +16,26 @@ async function ps(t, e) {
|
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
20
|
-
const e = await
|
|
21
|
-
await
|
|
19
|
+
async function gs(t = 864e5) {
|
|
20
|
+
const e = await Ve(), s = Date.now() - t;
|
|
21
|
+
await Je(e, "readwrite", async (n) => {
|
|
22
22
|
const r = n.index("lastUsedAt");
|
|
23
|
-
(await
|
|
23
|
+
(await Ye(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Ve() {
|
|
27
27
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
|
|
28
|
-
const s = indexedDB.open(
|
|
28
|
+
const s = indexedDB.open(ds, 1);
|
|
29
29
|
s.onupgradeneeded = () => {
|
|
30
30
|
const r = s.result.createObjectStore(Be, { keyPath: "attachmentId" });
|
|
31
31
|
r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
|
|
32
32
|
}, s.onsuccess = () => t(s.result), s.onerror = () => e(s.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
36
|
-
return await
|
|
35
|
+
async function fs(t, e, s) {
|
|
36
|
+
return await Je(t, e, async (n) => await Ye(s(n)));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Je(t, e, s) {
|
|
39
39
|
return new Promise((n, r) => {
|
|
40
40
|
const i = t.transaction(Be, e), o = i.objectStore(Be);
|
|
41
41
|
let a, l = !1;
|
|
@@ -57,16 +57,16 @@ function Ve(t, e, s) {
|
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Ye(t) {
|
|
61
61
|
return new Promise((e, s) => {
|
|
62
62
|
t.onsuccess = () => e(t.result), t.onerror = () => s(t.error ?? new Error("Product Agent attachment storage request failed"));
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function ms(t) {
|
|
66
66
|
return t !== null && (typeof t == "object" || typeof t == "function");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const n = Reflect.get(t, "pluno"), r =
|
|
68
|
+
function Ot(t, e, s) {
|
|
69
|
+
const n = Reflect.get(t, "pluno"), r = ms(n) ? n : {};
|
|
70
70
|
if (r !== n && !Reflect.set(t, "pluno", r))
|
|
71
71
|
return null;
|
|
72
72
|
const i = Object.getOwnPropertyDescriptor(r, e);
|
|
@@ -80,16 +80,16 @@ function vt(t, e, s) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
83
|
+
const ys = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
84
|
+
function Is(t, e) {
|
|
85
85
|
return e ? t.replace(
|
|
86
|
-
|
|
86
|
+
ys,
|
|
87
87
|
(s, n, r, i) => `${n}${new URL(r, e).toString()}${i}`
|
|
88
88
|
) : t;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
function
|
|
92
|
-
return (t.type === "function_call" || t.type === "tool_call") && t.name ===
|
|
90
|
+
const Ts = "save_runtime_captured_skill";
|
|
91
|
+
function Ss(t) {
|
|
92
|
+
return (t.type === "function_call" || t.type === "tool_call") && t.name === Ts;
|
|
93
93
|
}
|
|
94
94
|
function ws(t, e, s) {
|
|
95
95
|
const n = e.map((u) => ({ item: u, identity: s(u) })), r = new Set(
|
|
@@ -108,38 +108,38 @@ function ws(t, e, s) {
|
|
|
108
108
|
)
|
|
109
109
|
), c = /* @__PURE__ */ new Map();
|
|
110
110
|
for (const { item: u, identity: d } of i)
|
|
111
|
-
for (const
|
|
112
|
-
const I = c.get(
|
|
113
|
-
(!I || s(I).isTransient) && c.set(
|
|
111
|
+
for (const p of d.activityKeys ?? []) {
|
|
112
|
+
const I = c.get(p);
|
|
113
|
+
(!I || s(I).isTransient) && c.set(p, u);
|
|
114
114
|
}
|
|
115
|
-
const
|
|
115
|
+
const h = new Set(i.map(({ identity: u }) => u.id)), g = new Set(
|
|
116
116
|
i.flatMap(({ identity: u }) => u.runId ? [u.runId] : [])
|
|
117
|
-
), T = /* @__PURE__ */ new Set(),
|
|
117
|
+
), T = /* @__PURE__ */ new Set(), f = [];
|
|
118
118
|
for (const u of t) {
|
|
119
119
|
const d = s(u);
|
|
120
|
-
let
|
|
121
|
-
if (d.isOptimistic && d.optimisticKey ?
|
|
122
|
-
|
|
120
|
+
let p = o.get(d.id);
|
|
121
|
+
if (d.isOptimistic && d.optimisticKey ? p = a.get(d.optimisticKey) : d.isAssistantDraft && d.assistantDraftKey ? p = l.get(d.assistantDraftKey) : d.isActivity && (p = d.activityKeys?.map((S) => c.get(S)).find((S) => S !== void 0) ?? p), p && !T.has(p)) {
|
|
122
|
+
f.push(p), T.add(p);
|
|
123
123
|
continue;
|
|
124
124
|
}
|
|
125
|
-
const I = d.respondsToUserMessageId !== void 0 &&
|
|
126
|
-
(d.isOptimistic || (d.isAssistantDraft || d.isActivity) && I) &&
|
|
125
|
+
const I = d.respondsToUserMessageId !== void 0 && h.has(d.respondsToUserMessageId) || d.runId !== void 0 && g.has(d.runId);
|
|
126
|
+
(d.isOptimistic || (d.isAssistantDraft || d.isActivity) && I) && f.push(u);
|
|
127
127
|
}
|
|
128
128
|
for (const { item: u } of i)
|
|
129
|
-
T.has(u) ||
|
|
130
|
-
return
|
|
129
|
+
T.has(u) || f.push(u);
|
|
130
|
+
return f;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Ms(t, e, s, n) {
|
|
133
133
|
return t.filter((r) => {
|
|
134
134
|
const i = n(r);
|
|
135
135
|
return !i.isActivity || !i.isTransient ? !0 : e !== null && i.respondsToUserMessageId !== void 0 ? i.respondsToUserMessageId !== e : s === null || i.runId !== s;
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
const
|
|
139
|
-
let
|
|
140
|
-
const
|
|
141
|
-
async function
|
|
142
|
-
const e = t.randomUUID(), s = t.storage.getItem(
|
|
138
|
+
const _e = "pluno.productAgent.transportId", As = "pluno.productAgent.transportIdentity", ke = "pluno.productAgent.transportIdentity.event", Rs = 50, Es = globalThis.setTimeout.bind(globalThis);
|
|
139
|
+
let Q = null;
|
|
140
|
+
const he = /* @__PURE__ */ new Set(), Pe = /* @__PURE__ */ new Map();
|
|
141
|
+
async function Cs(t = Lt()) {
|
|
142
|
+
const e = t.randomUUID(), s = t.storage.getItem(_e);
|
|
143
143
|
let n = s ?? t.randomUUID(), r = !1, i = !1;
|
|
144
144
|
const o = t.channel.subscribe((l) => {
|
|
145
145
|
if (!(l.senderId === e || l.transportId !== n)) {
|
|
@@ -157,14 +157,14 @@ async function Es(t = Nt()) {
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
if (!s)
|
|
160
|
-
t.storage.setItem(
|
|
160
|
+
t.storage.setItem(_e, n), r = !0;
|
|
161
161
|
else
|
|
162
162
|
for (; ; ) {
|
|
163
163
|
if (i = !1, t.channel.postMessage({ type: "probe", transportId: n, senderId: e }), await t.settle(), !i) {
|
|
164
164
|
r = !0;
|
|
165
165
|
break;
|
|
166
166
|
}
|
|
167
|
-
n = t.randomUUID(), t.storage.setItem(
|
|
167
|
+
n = t.randomUUID(), t.storage.setItem(_e, n);
|
|
168
168
|
}
|
|
169
169
|
let a = !1;
|
|
170
170
|
return {
|
|
@@ -174,49 +174,49 @@ async function Es(t = Nt()) {
|
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
async function
|
|
178
|
-
|
|
177
|
+
async function bs() {
|
|
178
|
+
Q || (Q = Cs(Lt()), Q.then((n) => {
|
|
179
179
|
const r = (i) => {
|
|
180
|
-
i.persisted || (n.release(),
|
|
180
|
+
i.persisted || (n.release(), Q = null, he.clear(), window.removeEventListener("pagehide", r));
|
|
181
181
|
};
|
|
182
182
|
window.addEventListener("pagehide", r);
|
|
183
183
|
}));
|
|
184
|
-
const t = await
|
|
185
|
-
|
|
184
|
+
const t = await Q, e = _s();
|
|
185
|
+
he.add(e);
|
|
186
186
|
let s = !1;
|
|
187
187
|
return {
|
|
188
188
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
189
189
|
transportId: e === 0 ? t.transportId : `${t.transportId}.${e}`,
|
|
190
190
|
release: () => {
|
|
191
|
-
s || (s = !0,
|
|
191
|
+
s || (s = !0, he.delete(e));
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function _s() {
|
|
196
196
|
let t = 0;
|
|
197
|
-
for (;
|
|
197
|
+
for (; he.has(t); )
|
|
198
198
|
t += 1;
|
|
199
199
|
return t;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Lt() {
|
|
202
202
|
return {
|
|
203
|
-
storage:
|
|
204
|
-
channel:
|
|
203
|
+
storage: ks(),
|
|
204
|
+
channel: Ps(),
|
|
205
205
|
randomUUID: () => crypto.randomUUID(),
|
|
206
|
-
settle: () => new Promise((t) =>
|
|
206
|
+
settle: () => new Promise((t) => Es(t, Rs))
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function ks() {
|
|
210
210
|
return {
|
|
211
211
|
getItem: (t) => {
|
|
212
212
|
try {
|
|
213
|
-
return window.sessionStorage?.getItem(t) ??
|
|
213
|
+
return window.sessionStorage?.getItem(t) ?? Pe.get(t) ?? null;
|
|
214
214
|
} catch {
|
|
215
|
-
return
|
|
215
|
+
return Pe.get(t) ?? null;
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
218
|
setItem: (t, e) => {
|
|
219
|
-
|
|
219
|
+
Pe.set(t, e);
|
|
220
220
|
try {
|
|
221
221
|
window.sessionStorage?.setItem(t, e);
|
|
222
222
|
} catch {
|
|
@@ -224,9 +224,9 @@ function _s() {
|
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Ps() {
|
|
228
228
|
if (typeof BroadcastChannel < "u") {
|
|
229
|
-
const t = new BroadcastChannel(
|
|
229
|
+
const t = new BroadcastChannel(As);
|
|
230
230
|
return {
|
|
231
231
|
postMessage: (e) => t.postMessage(e),
|
|
232
232
|
subscribe: (e) => {
|
|
@@ -236,11 +236,11 @@ function ks() {
|
|
|
236
236
|
close: () => t.close()
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
return
|
|
239
|
+
return Us();
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Us() {
|
|
242
242
|
const t = /* @__PURE__ */ new Set(), e = (s) => {
|
|
243
|
-
if (s.key !==
|
|
243
|
+
if (s.key !== ke || !s.newValue)
|
|
244
244
|
return;
|
|
245
245
|
const n = JSON.parse(s.newValue);
|
|
246
246
|
for (const r of t)
|
|
@@ -249,9 +249,9 @@ function Ps() {
|
|
|
249
249
|
return window.addEventListener("storage", e), {
|
|
250
250
|
postMessage: (s) => {
|
|
251
251
|
window.localStorage.setItem(
|
|
252
|
-
|
|
252
|
+
ke,
|
|
253
253
|
JSON.stringify({ ...s, eventId: crypto.randomUUID() })
|
|
254
|
-
), window.localStorage.removeItem(
|
|
254
|
+
), window.localStorage.removeItem(ke);
|
|
255
255
|
},
|
|
256
256
|
subscribe: (s) => (t.add(s), () => t.delete(s)),
|
|
257
257
|
close: () => {
|
|
@@ -259,8 +259,8 @@ function Ps() {
|
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
function
|
|
262
|
+
const Nt = "schedule_follow_up";
|
|
263
|
+
function Ds(t) {
|
|
264
264
|
let e = t;
|
|
265
265
|
if (typeof e == "string")
|
|
266
266
|
try {
|
|
@@ -271,11 +271,11 @@ function Us(t) {
|
|
|
271
271
|
if (!e || typeof e != "object")
|
|
272
272
|
return null;
|
|
273
273
|
const s = e;
|
|
274
|
-
return s.ok !== !0 || s.toolName !==
|
|
274
|
+
return s.ok !== !0 || s.toolName !== Nt || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
|
|
275
275
|
}
|
|
276
|
-
const
|
|
277
|
-
let
|
|
278
|
-
function
|
|
276
|
+
const vs = globalThis.fetch.bind(globalThis), We = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Os = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Ls = ".pluno-pa-widget__panel", Ns = ".pluno-pa-widget__timeline", ht = `${We}[data-pluno-sdk-preview-channel]`;
|
|
277
|
+
let qs = 0;
|
|
278
|
+
function pt(t) {
|
|
279
279
|
const e = {};
|
|
280
280
|
for (const o of [
|
|
281
281
|
"type",
|
|
@@ -313,7 +313,7 @@ function ht(t) {
|
|
|
313
313
|
}
|
|
314
314
|
return e;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function Ue(t, e, s) {
|
|
317
317
|
if (typeof window > "u")
|
|
318
318
|
return;
|
|
319
319
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -325,31 +325,31 @@ function Pe(t, e, s) {
|
|
|
325
325
|
source: "web_sdk",
|
|
326
326
|
category: t,
|
|
327
327
|
name: e,
|
|
328
|
-
sequence: ++
|
|
328
|
+
sequence: ++qs,
|
|
329
329
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
330
330
|
monotonicMs: performance.now(),
|
|
331
331
|
data: s
|
|
332
332
|
};
|
|
333
333
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: r }));
|
|
334
334
|
}
|
|
335
|
-
const
|
|
335
|
+
const xs = "https://app.pluno.ai", Bs = "gpt-5.6-terra", Ws = 2e4, Hs = 1e4, $s = 1e4, js = 1e4, Fs = 1e4, zs = 3e3, Ks = 3e4, Gs = 1e3, gt = 3e4, ft = 0.2, mt = 6e4, Xs = 15e3, Z = 8, Vs = "Pluno could not finish this message. Try it again.", Js = "Browser connection was interrupted.", yt = 15e3, Ys = "Pluno could not send this message. Try it again.", It = 2e3, Qs = 1e3, Zs = 100, Tt = 8e3, en = 8e3, St = 3, tn = [300, 1e3], qt = 50 * 1024 * 1024, sn = /* @__PURE__ */ new Set([
|
|
336
336
|
".jpeg:image/jpeg",
|
|
337
337
|
".jpg:image/jpeg",
|
|
338
338
|
".pdf:application/pdf",
|
|
339
339
|
".png:image/png",
|
|
340
340
|
".webp:image/webp"
|
|
341
|
-
]),
|
|
342
|
-
function
|
|
341
|
+
]), pi = ".pdf,.png,.jpg,.jpeg,.webp", Qe = 64e3, De = 4e3, Ze = 30, nn = 2e3, rn = 1e3, xt = "Image is too large for model vision input.", on = 100, Bt = "pluno.productAgent.state.", He = "pluno.productAgent.pendingEvents.", ye = "pluno.productAgent.activeToolCalls.", an = 100;
|
|
342
|
+
function ee(t, e = 0) {
|
|
343
343
|
const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
344
344
|
return Math.max(e, s);
|
|
345
345
|
}
|
|
346
346
|
const pe = /* @__PURE__ */ new Set();
|
|
347
|
-
let
|
|
348
|
-
function
|
|
349
|
-
const s = Math.min(gt,
|
|
347
|
+
let oe = null;
|
|
348
|
+
function ln(t, e = Math.random) {
|
|
349
|
+
const s = Math.min(gt, Gs * 2 ** t), n = 1 - ft + e() * ft * 2;
|
|
350
350
|
return Math.min(gt, Math.round(s * n));
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function cn(t, e, s) {
|
|
353
353
|
return new Promise((n, r) => {
|
|
354
354
|
const i = setTimeout(() => r(new Error(s)), e);
|
|
355
355
|
t.then(
|
|
@@ -362,13 +362,13 @@ function an(t, e, s) {
|
|
|
362
362
|
);
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
|
-
class
|
|
365
|
+
class Wt {
|
|
366
366
|
constructor(e, s) {
|
|
367
367
|
this.options = e, this.transportIdentity = s, this.state = {
|
|
368
368
|
...this.state,
|
|
369
|
-
starterPrompts:
|
|
369
|
+
starterPrompts: jn(e.initialStarterPrompts)
|
|
370
370
|
};
|
|
371
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
371
|
+
const n = e.restorePersistedState === !1 ? null : Dr(e.clientId, e.expectedPersistedSessionId);
|
|
372
372
|
n && (this.state = {
|
|
373
373
|
...this.state,
|
|
374
374
|
...n,
|
|
@@ -385,13 +385,13 @@ class qt {
|
|
|
385
385
|
isRetrying: !1,
|
|
386
386
|
lastError: null
|
|
387
387
|
}), this.queuedClientEvents = xr(
|
|
388
|
-
|
|
389
|
-
|
|
388
|
+
Or(e.clientId),
|
|
389
|
+
Lr(e.clientId)
|
|
390
390
|
);
|
|
391
391
|
const r = [...this.queuedClientEvents].reverse().find(
|
|
392
392
|
(i) => i.type === "chat.user_message" && typeof i.clientMessageId == "string"
|
|
393
393
|
);
|
|
394
|
-
r?.clientMessageId && (this.pendingClientMessageId = r.clientMessageId, this.pendingUserMessageEvent = r, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"),
|
|
394
|
+
r?.clientMessageId && (this.pendingClientMessageId = r.clientMessageId, this.pendingUserMessageEvent = r, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"), F(e.clientId, this.queuedClientEvents);
|
|
395
395
|
}
|
|
396
396
|
options;
|
|
397
397
|
listeners = {};
|
|
@@ -417,6 +417,12 @@ class qt {
|
|
|
417
417
|
pendingSessionHistoryRequests = /* @__PURE__ */ new Map();
|
|
418
418
|
pendingSessionPinRequests = /* @__PURE__ */ new Map();
|
|
419
419
|
pendingSessionRenameRequests = /* @__PURE__ */ new Map();
|
|
420
|
+
sessionLoadRequestId = null;
|
|
421
|
+
sessionLoadRequestTimer = null;
|
|
422
|
+
sessionItemsRequestId = null;
|
|
423
|
+
sessionItemsCursor = null;
|
|
424
|
+
hasLoadedOlderSessionItems = !1;
|
|
425
|
+
loadedOlderSessionItemIds = /* @__PURE__ */ new Set();
|
|
420
426
|
transportIdentity;
|
|
421
427
|
retryAttemptsByClientMessageId = {};
|
|
422
428
|
retryTimersByClientMessageId = {};
|
|
@@ -467,6 +473,9 @@ class qt {
|
|
|
467
473
|
starterPromptsLoading: !1,
|
|
468
474
|
appearance: null,
|
|
469
475
|
messages: [],
|
|
476
|
+
isLoadingSession: !1,
|
|
477
|
+
isLoadingOlderMessages: !1,
|
|
478
|
+
hasOlderMessages: !1,
|
|
470
479
|
assistantDraft: "",
|
|
471
480
|
assistantDraftItemId: null,
|
|
472
481
|
assistantDraftPhase: null,
|
|
@@ -481,16 +490,16 @@ class qt {
|
|
|
481
490
|
lastErrorSecuritySettingsUrl: null
|
|
482
491
|
};
|
|
483
492
|
static async init(e) {
|
|
484
|
-
const s = await
|
|
493
|
+
const s = await bs(), n = new Wt({
|
|
485
494
|
...e,
|
|
486
|
-
backendUrl:
|
|
487
|
-
clientId: e.clientId ??
|
|
495
|
+
backendUrl: _n(e.backendUrl ?? xs),
|
|
496
|
+
clientId: e.clientId ?? Xn(),
|
|
488
497
|
model: e.model ?? Bs,
|
|
489
498
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
490
|
-
entrySurface:
|
|
499
|
+
entrySurface: kn(e.entrySurface)
|
|
491
500
|
}, s);
|
|
492
501
|
try {
|
|
493
|
-
|
|
502
|
+
gs().catch((r) => {
|
|
494
503
|
R("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
495
504
|
message: r instanceof Error ? r.message : String(r)
|
|
496
505
|
});
|
|
@@ -521,14 +530,14 @@ class qt {
|
|
|
521
530
|
this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
|
|
522
531
|
);
|
|
523
532
|
try {
|
|
524
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await
|
|
533
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await cn(this.options.tokenProvider(), $s, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
|
|
525
534
|
return;
|
|
526
535
|
if (!this.token && !this.options.webSocketFactory)
|
|
527
536
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
528
|
-
const s =
|
|
537
|
+
const s = Dn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
|
|
529
538
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
530
539
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (R("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
531
|
-
},
|
|
540
|
+
}, js), n.addEventListener("open", () => {
|
|
532
541
|
this.socket !== n || (this.clearSocketConnectTimer(), R("web-sdk.agent", "Pluno socket opened", {
|
|
533
542
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
534
543
|
isThinking: this.state.isThinking
|
|
@@ -540,16 +549,16 @@ class qt {
|
|
|
540
549
|
pageUrl: location.href
|
|
541
550
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
542
551
|
this.socket === n && (R("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
543
|
-
},
|
|
552
|
+
}, Fs));
|
|
544
553
|
}), n.addEventListener("message", (r) => {
|
|
545
|
-
this.socket === n && this.handleServerEvent(
|
|
554
|
+
this.socket === n && this.handleServerEvent(Hn(r.data));
|
|
546
555
|
}), n.addEventListener("sendfailure", (r) => {
|
|
547
556
|
if (this.socket !== n)
|
|
548
557
|
return;
|
|
549
|
-
const i =
|
|
558
|
+
const i = $n(r?.detail?.data);
|
|
550
559
|
i?.type === "chat.user_message" && i.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
551
560
|
(o) => o.type === "chat.user_message" && o.clientMessageId === i.clientMessageId
|
|
552
|
-
) && (this.queuedClientEvents.push(i),
|
|
561
|
+
) && (this.queuedClientEvents.push(i), F(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
|
|
553
562
|
}), n.addEventListener("close", (r) => {
|
|
554
563
|
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (this.rememberBrowserConnectionInterruptionForActiveRun(), R("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
555
564
|
code: typeof r?.code == "number" ? r.code : null,
|
|
@@ -579,18 +588,18 @@ class qt {
|
|
|
579
588
|
}
|
|
580
589
|
}
|
|
581
590
|
disconnect() {
|
|
582
|
-
this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
591
|
+
this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
583
592
|
}
|
|
584
593
|
destroy() {
|
|
585
|
-
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
594
|
+
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Br(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
586
595
|
for (const e of Object.values(this.listeners))
|
|
587
596
|
e?.clear();
|
|
588
597
|
}
|
|
589
598
|
warmup(e = "panel_open") {
|
|
590
|
-
const s =
|
|
599
|
+
const s = _(), n = `${this.state.sessionId ?? "draft"}:${s.url}`, r = e === "composer_input" && this.pendingComposerWarmup?.scope === n ? this.pendingComposerWarmup : null, i = {
|
|
591
600
|
type: "runtime.warmup",
|
|
592
601
|
reason: e,
|
|
593
|
-
...e === "composer_input" ? { warmupId: r?.event.warmupId ??
|
|
602
|
+
...e === "composer_input" ? { warmupId: r?.event.warmupId ?? $() } : {},
|
|
594
603
|
entrySurface: this.options.entrySurface,
|
|
595
604
|
sessionId: this.state.sessionId ?? void 0,
|
|
596
605
|
page: s
|
|
@@ -605,23 +614,23 @@ class qt {
|
|
|
605
614
|
}
|
|
606
615
|
async sendMessage(e, s = {}) {
|
|
607
616
|
const n = e.trim(), r = s.attachments ?? [];
|
|
608
|
-
if (this.options.productVariant === "customer_embedded" && (r.forEach(
|
|
609
|
-
(m,
|
|
617
|
+
if (this.options.productVariant === "customer_embedded" && (r.forEach(es), r.reduce(
|
|
618
|
+
(m, C) => m + C.sizeBytes,
|
|
610
619
|
0
|
|
611
|
-
) >
|
|
620
|
+
) > qt))
|
|
612
621
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
613
|
-
let i = r.map(
|
|
622
|
+
let i = r.map(st);
|
|
614
623
|
if (!n && i.length === 0)
|
|
615
624
|
return null;
|
|
616
625
|
if (this.pendingClientMessageId)
|
|
617
626
|
throw new Error("Wait for the current message to finish sending before sending another.");
|
|
618
|
-
const o =
|
|
627
|
+
const o = _(), a = s.clientMessageId ?? $(), l = {
|
|
619
628
|
id: `local-${a}`,
|
|
620
629
|
role: "user",
|
|
621
630
|
content: n,
|
|
622
631
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
623
632
|
...r.length > 0 ? { attachments: r } : {}
|
|
624
|
-
}, c = this.state.messages.some((
|
|
633
|
+
}, c = this.state.messages.some((S) => S.id === l.id || S.clientMessageId === a), h = this.state.isThinking, g = this.state.pendingMessageStatus, T = this.state.turnPhase, f = this.state.messages, u = c ? this.state.messages : [...this.state.messages, l], d = {
|
|
625
634
|
assistantDraft: this.state.assistantDraft,
|
|
626
635
|
assistantDraftItemId: this.state.assistantDraftItemId,
|
|
627
636
|
assistantDraftPhase: this.state.assistantDraftPhase,
|
|
@@ -631,7 +640,7 @@ class qt {
|
|
|
631
640
|
};
|
|
632
641
|
this.setState({
|
|
633
642
|
messages: u,
|
|
634
|
-
...
|
|
643
|
+
...h ? {} : {
|
|
635
644
|
assistantDraft: "",
|
|
636
645
|
assistantDraftItemId: null,
|
|
637
646
|
assistantDraftPhase: null,
|
|
@@ -639,46 +648,46 @@ class qt {
|
|
|
639
648
|
assistantDraftRunId: null
|
|
640
649
|
},
|
|
641
650
|
pendingMessageStatus: "sending",
|
|
642
|
-
turnPhase:
|
|
643
|
-
isThinking:
|
|
651
|
+
turnPhase: h ? T : "sending",
|
|
652
|
+
isThinking: h,
|
|
644
653
|
isRetrying: !1,
|
|
645
654
|
lastError: null
|
|
646
655
|
}), c || this.emit("message", l);
|
|
647
656
|
try {
|
|
648
|
-
const
|
|
657
|
+
const S = [];
|
|
649
658
|
for (const m of i) {
|
|
650
|
-
const
|
|
659
|
+
const C = m.id ? this.attachmentFiles.get(m.id) : void 0;
|
|
651
660
|
if (m.sandboxPath || m.storageKey) {
|
|
652
|
-
|
|
661
|
+
S.push(m);
|
|
653
662
|
continue;
|
|
654
663
|
}
|
|
655
|
-
if (!
|
|
664
|
+
if (!C)
|
|
656
665
|
throw new Error(`Attachment bytes are unavailable for ${m.name}`);
|
|
657
|
-
|
|
666
|
+
S.push(await this.uploadAttachmentForMessage({ file: C, attachment: m }));
|
|
658
667
|
}
|
|
659
|
-
i =
|
|
660
|
-
} catch (
|
|
668
|
+
i = S;
|
|
669
|
+
} catch (S) {
|
|
661
670
|
throw this.setState({
|
|
662
|
-
...c ? {} : { messages:
|
|
663
|
-
...
|
|
671
|
+
...c ? {} : { messages: f },
|
|
672
|
+
...h ? {} : { ...d, isThinking: !1 },
|
|
664
673
|
pendingMessageStatus: g,
|
|
665
674
|
turnPhase: T
|
|
666
|
-
}),
|
|
675
|
+
}), S;
|
|
667
676
|
}
|
|
668
677
|
this.retryableClientMessageId = null;
|
|
669
|
-
const
|
|
678
|
+
const p = !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, I = {
|
|
670
679
|
type: "chat.user_message",
|
|
671
680
|
sessionId: this.state.sessionId ?? void 0,
|
|
672
681
|
clientMessageId: a,
|
|
673
682
|
initiatedBy: s.initiatedBy,
|
|
674
|
-
invocation:
|
|
683
|
+
invocation: Pn(s.invocation ?? s.initiatedBy),
|
|
675
684
|
entrySurface: this.options.entrySurface,
|
|
676
685
|
content: n,
|
|
677
|
-
pageContent:
|
|
686
|
+
pageContent: p && et() || void 0,
|
|
678
687
|
attachments: i.length > 0 ? i : void 0,
|
|
679
688
|
page: o,
|
|
680
689
|
model: this.options.model,
|
|
681
|
-
metadata:
|
|
690
|
+
metadata: wt(this.options.metadata)
|
|
682
691
|
};
|
|
683
692
|
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = I, this.browserConnectionInterruptedClientMessageIds.delete(a), this.send(I), this.schedulePendingDeliveryAck(a), a;
|
|
684
693
|
}
|
|
@@ -698,22 +707,22 @@ class qt {
|
|
|
698
707
|
return e ? (this.retryAttemptsByClientMessageId[s] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = s, this.browserConnectionInterruptedClientMessageIds.delete(s), this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !1 }), !0) : !1;
|
|
699
708
|
}
|
|
700
709
|
createLocalAttachment(e) {
|
|
701
|
-
this.options.productVariant === "customer_embedded" &&
|
|
702
|
-
const s =
|
|
710
|
+
this.options.productVariant === "customer_embedded" && Wr(e);
|
|
711
|
+
const s = $(), n = {
|
|
703
712
|
id: s,
|
|
704
713
|
name: e.name || "attachment",
|
|
705
|
-
mimeType:
|
|
714
|
+
mimeType: Xe(e),
|
|
706
715
|
sizeBytes: e.size
|
|
707
716
|
};
|
|
708
717
|
this.attachmentFiles.set(s, e);
|
|
709
718
|
const r = Date.now();
|
|
710
|
-
return
|
|
719
|
+
return hs({
|
|
711
720
|
attachmentId: s,
|
|
712
721
|
name: n.name,
|
|
713
722
|
mimeType: n.mimeType,
|
|
714
723
|
sizeBytes: n.sizeBytes,
|
|
715
724
|
blob: e,
|
|
716
|
-
origin:
|
|
725
|
+
origin: _().origin,
|
|
717
726
|
sessionId: this.state.sessionId ?? void 0,
|
|
718
727
|
createdAt: r,
|
|
719
728
|
lastUsedAt: r
|
|
@@ -736,7 +745,7 @@ class qt {
|
|
|
736
745
|
file: e,
|
|
737
746
|
attachment: s
|
|
738
747
|
}) {
|
|
739
|
-
const n = this.state.sessionId, r =
|
|
748
|
+
const n = this.state.sessionId, r = Xe(e), i = {
|
|
740
749
|
sessionId: n ?? void 0,
|
|
741
750
|
attachmentId: s.id,
|
|
742
751
|
clientId: this.options.clientId,
|
|
@@ -744,35 +753,35 @@ class qt {
|
|
|
744
753
|
name: e.name || "attachment",
|
|
745
754
|
mimeType: r,
|
|
746
755
|
sizeBytes: e.size,
|
|
747
|
-
page:
|
|
756
|
+
page: _(),
|
|
748
757
|
model: this.options.model,
|
|
749
|
-
metadata:
|
|
758
|
+
metadata: wt(this.options.metadata),
|
|
750
759
|
entrySurface: this.options.entrySurface
|
|
751
760
|
};
|
|
752
761
|
let o;
|
|
753
762
|
if (this.options.persistAttachmentUpload)
|
|
754
|
-
o = await
|
|
763
|
+
o = await de(
|
|
755
764
|
() => this.options.persistAttachmentUpload(i, e),
|
|
756
765
|
"Failed to upload attachment"
|
|
757
766
|
);
|
|
758
767
|
else {
|
|
759
|
-
const l = this.options.prepareAttachmentUpload ? await
|
|
768
|
+
const l = this.options.prepareAttachmentUpload ? await de(
|
|
760
769
|
() => this.options.prepareAttachmentUpload(i),
|
|
761
770
|
"Failed to prepare attachment upload"
|
|
762
771
|
) : await this.prepareEmbedAttachmentUpload(i);
|
|
763
|
-
await
|
|
772
|
+
await de(async () => {
|
|
764
773
|
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
765
774
|
method: l.uploadMethod,
|
|
766
775
|
headers: l.uploadHeaders,
|
|
767
776
|
body: e
|
|
768
777
|
});
|
|
769
778
|
if (!c.ok)
|
|
770
|
-
throw new
|
|
779
|
+
throw new ge("Failed to upload attachment", c.status);
|
|
771
780
|
return c;
|
|
772
781
|
}, "Failed to upload attachment"), o = l;
|
|
773
782
|
}
|
|
774
783
|
this.setState({ sessionId: o.sessionId });
|
|
775
|
-
const a =
|
|
784
|
+
const a = Zt(o.attachment, this.options.backendUrl);
|
|
776
785
|
return this.updateAttachmentInState(s.id, a), s.id && ps(s.id, {
|
|
777
786
|
sessionId: o.sessionId,
|
|
778
787
|
fileUrl: a.fileUrl,
|
|
@@ -800,18 +809,18 @@ class qt {
|
|
|
800
809
|
}
|
|
801
810
|
async prepareEmbedAttachmentUpload(e) {
|
|
802
811
|
let s = !1;
|
|
803
|
-
return await
|
|
812
|
+
return await de(async () => {
|
|
804
813
|
const n = await this.fetchEmbedAttachmentUpload(e);
|
|
805
814
|
if (n.ok)
|
|
806
815
|
return await n.json();
|
|
807
|
-
if (
|
|
816
|
+
if (ni(n.status) && this.options.tokenProvider && !s) {
|
|
808
817
|
s = !0;
|
|
809
818
|
const r = await this.fetchEmbedAttachmentUpload(e);
|
|
810
819
|
if (r.ok)
|
|
811
820
|
return await r.json();
|
|
812
|
-
throw new
|
|
821
|
+
throw new ge("Failed to prepare attachment upload", r.status);
|
|
813
822
|
}
|
|
814
|
-
throw new
|
|
823
|
+
throw new ge("Failed to prepare attachment upload", n.status);
|
|
815
824
|
}, "Failed to prepare attachment upload");
|
|
816
825
|
}
|
|
817
826
|
async fetchEmbedAttachmentUpload(e) {
|
|
@@ -829,7 +838,7 @@ class qt {
|
|
|
829
838
|
if (!this.state.sessionId)
|
|
830
839
|
return;
|
|
831
840
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
832
|
-
const e =
|
|
841
|
+
const e = Ar(
|
|
833
842
|
this.state.messages,
|
|
834
843
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
835
844
|
this.state.assistantDraftRunId,
|
|
@@ -842,7 +851,7 @@ class qt {
|
|
|
842
851
|
stoppedCausalSequence: null,
|
|
843
852
|
toolCallIds: new Set(
|
|
844
853
|
this.state.messages.filter(
|
|
845
|
-
(s) =>
|
|
854
|
+
(s) => Ne(
|
|
846
855
|
s,
|
|
847
856
|
e.respondsToUserMessageId,
|
|
848
857
|
e.runId
|
|
@@ -852,8 +861,8 @@ class qt {
|
|
|
852
861
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
853
862
|
for (const [s, n] of this.activeBrowserToolCalls)
|
|
854
863
|
n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(s);
|
|
855
|
-
|
|
856
|
-
messages:
|
|
864
|
+
Pt(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
|
|
865
|
+
messages: ue(
|
|
857
866
|
this.state.messages,
|
|
858
867
|
e.clientMessageId,
|
|
859
868
|
e.runId
|
|
@@ -868,15 +877,18 @@ class qt {
|
|
|
868
877
|
}
|
|
869
878
|
startNewSession(e = {}) {
|
|
870
879
|
const s = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
|
|
871
|
-
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((r) => r.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), s && this.send({
|
|
880
|
+
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((r) => r.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionItemsRequestId = null, this.sessionItemsCursor = null, this.hasLoadedOlderSessionItems = !1, this.loadedOlderSessionItemIds.clear(), this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), s && this.send({
|
|
872
881
|
type: "session.reset",
|
|
873
882
|
sessionId: this.state.sessionId ?? void 0,
|
|
874
883
|
warmupId: n ?? void 0,
|
|
875
|
-
page:
|
|
884
|
+
page: _()
|
|
876
885
|
}), this.setState({
|
|
877
886
|
sessionId: null,
|
|
878
887
|
starterPrompts: [...this.state.starterPrompts],
|
|
879
888
|
messages: [],
|
|
889
|
+
isLoadingSession: !1,
|
|
890
|
+
isLoadingOlderMessages: !1,
|
|
891
|
+
hasOlderMessages: !1,
|
|
880
892
|
assistantDraft: "",
|
|
881
893
|
assistantDraftItemId: null,
|
|
882
894
|
assistantDraftPhase: null,
|
|
@@ -889,7 +901,7 @@ class qt {
|
|
|
889
901
|
});
|
|
890
902
|
}
|
|
891
903
|
listSessions(e = {}) {
|
|
892
|
-
const s =
|
|
904
|
+
const s = $(), n = new Promise((i, o) => {
|
|
893
905
|
const a = window.setTimeout(() => {
|
|
894
906
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
895
907
|
}, Tt);
|
|
@@ -897,7 +909,7 @@ class qt {
|
|
|
897
909
|
}), r = {
|
|
898
910
|
type: "sessions.list",
|
|
899
911
|
requestId: s,
|
|
900
|
-
page:
|
|
912
|
+
page: _(),
|
|
901
913
|
...e.cursor ? { cursor: e.cursor } : {},
|
|
902
914
|
...e.limit ? { limit: e.limit } : {},
|
|
903
915
|
...typeof e.pinned == "boolean" ? { pinned: e.pinned } : {}
|
|
@@ -911,25 +923,34 @@ class qt {
|
|
|
911
923
|
setSessionPinned(e, s) {
|
|
912
924
|
return this.sendSessionMutation(
|
|
913
925
|
this.pendingSessionPinRequests,
|
|
914
|
-
{ type: "session.pin", requestId:
|
|
926
|
+
{ type: "session.pin", requestId: $(), sessionId: e, pinned: s },
|
|
915
927
|
"Session pin did not respond in time"
|
|
916
928
|
);
|
|
917
929
|
}
|
|
918
930
|
renameSession(e, s) {
|
|
919
931
|
return this.sendSessionMutation(
|
|
920
932
|
this.pendingSessionRenameRequests,
|
|
921
|
-
{ type: "session.rename", requestId:
|
|
933
|
+
{ type: "session.rename", requestId: $(), sessionId: e, title: s },
|
|
922
934
|
"Session rename did not respond in time"
|
|
923
935
|
);
|
|
924
936
|
}
|
|
925
937
|
loadSession(e) {
|
|
926
|
-
const s = this.activeComposerWarmupId;
|
|
927
|
-
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(),
|
|
938
|
+
const s = $(), n = this.activeComposerWarmupId;
|
|
939
|
+
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), n && this.send({
|
|
928
940
|
type: "session.reset",
|
|
929
|
-
warmupId:
|
|
930
|
-
page:
|
|
931
|
-
}), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.
|
|
941
|
+
warmupId: n,
|
|
942
|
+
page: _()
|
|
943
|
+
}), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionLoadRequestId = s, this.sessionLoadRequestTimer = window.setTimeout(() => {
|
|
944
|
+
this.sessionLoadRequestId === s && (this.clearSessionLoadRequest(), this.setState({
|
|
945
|
+
isLoadingSession: !1,
|
|
946
|
+
lastError: "This chat took too long to load. Please try again."
|
|
947
|
+
}));
|
|
948
|
+
}, en), this.sessionItemsRequestId = null, this.sessionItemsCursor = null, this.hasLoadedOlderSessionItems = !1, this.loadedOlderSessionItemIds.clear(), this.setState({
|
|
932
949
|
sessionId: e,
|
|
950
|
+
messages: [],
|
|
951
|
+
isLoadingSession: !0,
|
|
952
|
+
isLoadingOlderMessages: !1,
|
|
953
|
+
hasOlderMessages: !1,
|
|
933
954
|
assistantDraft: "",
|
|
934
955
|
assistantDraftItemId: null,
|
|
935
956
|
assistantDraftPhase: null,
|
|
@@ -942,14 +963,28 @@ class qt {
|
|
|
942
963
|
lastErrorCode: null
|
|
943
964
|
}), this.send({
|
|
944
965
|
type: "session.load",
|
|
966
|
+
requestId: s,
|
|
945
967
|
sessionId: e,
|
|
946
|
-
page:
|
|
968
|
+
page: _()
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
loadOlderMessages() {
|
|
972
|
+
if (!this.state.sessionId || !this.sessionItemsCursor || this.state.isLoadingSession || this.state.isLoadingOlderMessages)
|
|
973
|
+
return;
|
|
974
|
+
const e = $();
|
|
975
|
+
this.sessionItemsRequestId = e, this.setState({ isLoadingOlderMessages: !0, lastError: null, lastErrorCode: null }), this.send({
|
|
976
|
+
type: "session.items.list",
|
|
977
|
+
requestId: e,
|
|
978
|
+
sessionId: this.state.sessionId,
|
|
979
|
+
cursor: this.sessionItemsCursor,
|
|
980
|
+
limit: 50,
|
|
981
|
+
page: _()
|
|
947
982
|
});
|
|
948
983
|
}
|
|
949
984
|
send(e) {
|
|
950
985
|
this.sendNow(v(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
|
|
951
986
|
(r) => r.type === "chat.user_message" && r.clientMessageId === e.clientMessageId
|
|
952
|
-
) || this.queuedClientEvents.push(e),
|
|
987
|
+
) || this.queuedClientEvents.push(e), F(this.options.clientId, this.queuedClientEvents), this.setState({
|
|
953
988
|
status: "reconnecting",
|
|
954
989
|
...e.type === "chat.user_message" && e.clientMessageId === this.pendingClientMessageId ? { pendingMessageStatus: "reconnecting" } : {}
|
|
955
990
|
}), this.scheduleReconnect());
|
|
@@ -965,7 +1000,7 @@ class qt {
|
|
|
965
1000
|
return !1;
|
|
966
1001
|
const s = this.socket;
|
|
967
1002
|
try {
|
|
968
|
-
return s.send(JSON.stringify(e)),
|
|
1003
|
+
return s.send(JSON.stringify(e)), Ue("client_event", e.type, pt(e)), !0;
|
|
969
1004
|
} catch (n) {
|
|
970
1005
|
return R("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
971
1006
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -1009,7 +1044,7 @@ class qt {
|
|
|
1009
1044
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
1010
1045
|
return;
|
|
1011
1046
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
1012
|
-
const e =
|
|
1047
|
+
const e = vn();
|
|
1013
1048
|
this.sendNow(
|
|
1014
1049
|
v({
|
|
1015
1050
|
type: "starter_prompts.page_context",
|
|
@@ -1020,13 +1055,13 @@ class qt {
|
|
|
1020
1055
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
1021
1056
|
}
|
|
1022
1057
|
startStarterPromptUrlWatcher() {
|
|
1023
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
1058
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = On(() => this.handleStarterPromptUrlChange()));
|
|
1024
1059
|
}
|
|
1025
1060
|
handleStarterPromptUrlChange() {
|
|
1026
1061
|
const e = location.href;
|
|
1027
1062
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
1028
1063
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
1029
|
-
},
|
|
1064
|
+
}, an));
|
|
1030
1065
|
}
|
|
1031
1066
|
refreshStarterPromptsForCurrentUrl() {
|
|
1032
1067
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -1041,14 +1076,14 @@ class qt {
|
|
|
1041
1076
|
if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
|
|
1042
1077
|
return;
|
|
1043
1078
|
const e = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
|
|
1044
|
-
|
|
1079
|
+
F(this.options.clientId, this.queuedClientEvents);
|
|
1045
1080
|
for (let s = 0; s < e.length; s += 1) {
|
|
1046
1081
|
const n = e[s];
|
|
1047
1082
|
if (!this.sendNow(v(n))) {
|
|
1048
|
-
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)),
|
|
1083
|
+
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)), F(this.options.clientId, this.queuedClientEvents);
|
|
1049
1084
|
return;
|
|
1050
1085
|
}
|
|
1051
|
-
|
|
1086
|
+
F(this.options.clientId, this.queuedClientEvents);
|
|
1052
1087
|
}
|
|
1053
1088
|
}
|
|
1054
1089
|
flushPendingPassiveWarmup() {
|
|
@@ -1060,8 +1095,8 @@ class qt {
|
|
|
1060
1095
|
return;
|
|
1061
1096
|
this.clearPendingWarmupAckTimer();
|
|
1062
1097
|
const s = Math.min(
|
|
1063
|
-
|
|
1064
|
-
|
|
1098
|
+
zs * 2 ** e.retryAttempt,
|
|
1099
|
+
Ks
|
|
1065
1100
|
);
|
|
1066
1101
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
1067
1102
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -1076,24 +1111,24 @@ class qt {
|
|
|
1076
1111
|
findStoppedTurnForEvent(e) {
|
|
1077
1112
|
const s = e.type === "session.item" ? P(e.item) : null;
|
|
1078
1113
|
return this.findStoppedTurn(
|
|
1079
|
-
|
|
1114
|
+
ae(e) ?? this.state.sessionId,
|
|
1080
1115
|
s ?? e
|
|
1081
1116
|
);
|
|
1082
1117
|
}
|
|
1083
1118
|
rememberDurablyStoppedTurn(e, s, n) {
|
|
1084
|
-
if (!e || !s || !
|
|
1119
|
+
if (!e || !s || !qe(s) || this.findStoppedTurn(e, s))
|
|
1085
1120
|
return;
|
|
1086
|
-
const r =
|
|
1121
|
+
const r = N(s), i = U(s), o = typeof s.clientMessageId == "string" ? s.clientMessageId : r ? this.clientMessageIdsByUserMessageItemId.get(r) ?? null : null;
|
|
1087
1122
|
this.stoppedTurns.push({
|
|
1088
1123
|
sessionId: e,
|
|
1089
1124
|
clientMessageId: o,
|
|
1090
1125
|
respondsToUserMessageId: r,
|
|
1091
1126
|
runId: i,
|
|
1092
1127
|
stoppedAt: n,
|
|
1093
|
-
stoppedCausalSequence:
|
|
1128
|
+
stoppedCausalSequence: L(s),
|
|
1094
1129
|
toolCallIds: new Set(
|
|
1095
1130
|
this.state.messages.filter(
|
|
1096
|
-
(a) =>
|
|
1131
|
+
(a) => Ne(a, r, i)
|
|
1097
1132
|
).map((a) => a.callId).filter((a) => typeof a == "string")
|
|
1098
1133
|
)
|
|
1099
1134
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
@@ -1103,29 +1138,29 @@ class qt {
|
|
|
1103
1138
|
const n = typeof e.callId == "string" ? e.callId : null;
|
|
1104
1139
|
return !!(n && this.stoppedTurns.some((r) => r.toolCallIds.has(n)));
|
|
1105
1140
|
}
|
|
1106
|
-
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !
|
|
1141
|
+
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !qe(P(e.item)) : e.type !== "conversation.state" : !1;
|
|
1107
1142
|
}
|
|
1108
1143
|
filterStoppedSnapshotItems(e, s) {
|
|
1109
1144
|
return e.filter((n) => {
|
|
1110
1145
|
const r = P(n), i = r ? this.findStoppedTurn(s, r) : null;
|
|
1111
|
-
if (!i || r?.type === "message" && r.role === "user" ||
|
|
1146
|
+
if (!i || r?.type === "message" && r.role === "user" || qe(r))
|
|
1112
1147
|
return !0;
|
|
1113
1148
|
if (i.stoppedCausalSequence !== null) {
|
|
1114
|
-
const o = r ?
|
|
1149
|
+
const o = r ? L(r) : null;
|
|
1115
1150
|
return o === null || o <= i.stoppedCausalSequence;
|
|
1116
1151
|
}
|
|
1117
1152
|
if (i.stoppedAt) {
|
|
1118
|
-
const o =
|
|
1153
|
+
const o = w(n, "createdAt");
|
|
1119
1154
|
return !!(o && Date.parse(o) <= Date.parse(i.stoppedAt));
|
|
1120
1155
|
}
|
|
1121
1156
|
return !1;
|
|
1122
1157
|
});
|
|
1123
1158
|
}
|
|
1124
1159
|
handleServerEvent(e) {
|
|
1125
|
-
if (
|
|
1126
|
-
|
|
1160
|
+
if (Ue("server_event", e.type, pt(e)), e.type === "session.item" && this.rememberDurablyStoppedTurn(
|
|
1161
|
+
w(e.item, "sessionId") ?? this.state.sessionId,
|
|
1127
1162
|
P(e.item),
|
|
1128
|
-
|
|
1163
|
+
w(e.item, "createdAt")
|
|
1129
1164
|
), !(e.type === "session.updated" && typeof e.warmupId == "string" && e.warmupId !== this.activeComposerWarmupId)) {
|
|
1130
1165
|
if (e.type === "runtime.warmup_ack" && typeof e.warmupId == "string" && e.warmupId === this.pendingComposerWarmup?.event.warmupId) {
|
|
1131
1166
|
this.clearPendingWarmupAckTimer(), this.pendingComposerWarmup.acknowledged = !0;
|
|
@@ -1134,12 +1169,12 @@ class qt {
|
|
|
1134
1169
|
if (e.type === "run.ack") {
|
|
1135
1170
|
if (this.shouldIgnoreStoppedTurnEvent(e))
|
|
1136
1171
|
return;
|
|
1137
|
-
const s =
|
|
1172
|
+
const s = ae(e), n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
1138
1173
|
s && n && this.backgroundClientMessageIds.delete(n) ? (this.backgroundSessionIds.add(s), this.deferredSessionUpdatedSessionIds.delete(s)) : s && (n === this.activeClientMessageId || n === this.pendingClientMessageId) && this.deferredSessionUpdatedSessionIds.delete(s) && this.state.sessionId === null && this.setState({ sessionId: s }), this.handleRunAck(e);
|
|
1139
1174
|
return;
|
|
1140
1175
|
}
|
|
1141
1176
|
if (e.type === "session.updated" && this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId === null && this.backgroundClientMessageIds.size > 0) {
|
|
1142
|
-
const s =
|
|
1177
|
+
const s = ae(e);
|
|
1143
1178
|
if (s) {
|
|
1144
1179
|
this.deferredSessionUpdatedSessionIds.add(s);
|
|
1145
1180
|
return;
|
|
@@ -1161,23 +1196,23 @@ class qt {
|
|
|
1161
1196
|
this.activeResponseRunId = s, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
1162
1197
|
return;
|
|
1163
1198
|
}
|
|
1164
|
-
if (
|
|
1199
|
+
if (hn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
1165
1200
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
1166
|
-
const s =
|
|
1201
|
+
const s = Fn(e), n = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
1167
1202
|
R("web-sdk.agent", "Received auth.ok appearance", {
|
|
1168
1203
|
hasAppearance: n,
|
|
1169
1204
|
rawAppearance: e.appearance,
|
|
1170
1205
|
normalizedAppearance: s
|
|
1171
|
-
}), this.runtimeHelperJavascript =
|
|
1206
|
+
}), this.runtimeHelperJavascript = zn(e.runtimeHelpers)?.javascript ?? null;
|
|
1172
1207
|
const r = Rt(e, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), o = e.starterPromptsLoading === !0, a = {
|
|
1173
|
-
user:
|
|
1208
|
+
user: Vn(e.user),
|
|
1174
1209
|
status: "connected",
|
|
1175
1210
|
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
1176
1211
|
};
|
|
1177
|
-
(i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !
|
|
1212
|
+
(i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !le() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
1178
1213
|
type: "page.upsert",
|
|
1179
1214
|
sessionId: this.state.sessionId,
|
|
1180
|
-
page:
|
|
1215
|
+
page: _(),
|
|
1181
1216
|
model: this.options.model
|
|
1182
1217
|
});
|
|
1183
1218
|
return;
|
|
@@ -1190,111 +1225,138 @@ class qt {
|
|
|
1190
1225
|
return;
|
|
1191
1226
|
}
|
|
1192
1227
|
if (e.type === "conversation.state") {
|
|
1193
|
-
const s = Array.isArray(e.items) ? e.items : [], n =
|
|
1228
|
+
const s = Array.isArray(e.items) ? e.items : [], n = w(e.session, "id") ?? this.state.sessionId, r = typeof e.requestId == "string" ? e.requestId : null;
|
|
1229
|
+
if (r && r !== this.sessionLoadRequestId || this.state.isLoadingSession && n !== this.state.sessionId)
|
|
1230
|
+
return;
|
|
1231
|
+
n === this.state.sessionId && (this.clearSessionLoadRequest(), !this.hasLoadedOlderSessionItems && this.sessionItemsRequestId === null && (this.sessionItemsCursor = typeof e.itemsNextCursor == "string" ? e.itemsNextCursor : null));
|
|
1194
1232
|
for (const E of s)
|
|
1195
1233
|
this.rememberDurablyStoppedTurn(
|
|
1196
1234
|
n,
|
|
1197
1235
|
P(E),
|
|
1198
|
-
|
|
1236
|
+
w(E, "createdAt")
|
|
1199
1237
|
);
|
|
1200
|
-
const
|
|
1201
|
-
clientMessageId:
|
|
1202
|
-
respondsToUserMessageId:
|
|
1203
|
-
runId:
|
|
1204
|
-
}),
|
|
1205
|
-
|
|
1206
|
-
let
|
|
1238
|
+
const i = X(s), o = i === null ? null : s[i], a = P(o), l = this.findStoppedTurn(n, {
|
|
1239
|
+
clientMessageId: a?.clientMessageId,
|
|
1240
|
+
respondsToUserMessageId: w(o, "id"),
|
|
1241
|
+
runId: a?.runId
|
|
1242
|
+
}), c = this.filterStoppedSnapshotItems(s, n), h = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, g = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, T = e.isRetrying === !0, f = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
1243
|
+
h && g && (this.pendingClientMessageId = g);
|
|
1244
|
+
let u = sr(
|
|
1207
1245
|
e.assistantDraft
|
|
1208
1246
|
);
|
|
1209
|
-
|
|
1210
|
-
respondsToUserMessageId:
|
|
1211
|
-
runId:
|
|
1212
|
-
}) && (
|
|
1213
|
-
const
|
|
1214
|
-
this.rememberUserMessageClientMessageIds(
|
|
1215
|
-
const
|
|
1216
|
-
if (
|
|
1217
|
-
const E =
|
|
1218
|
-
this.retryAttemptsByClientMessageId[
|
|
1219
|
-
this.retryAttemptsByClientMessageId[
|
|
1247
|
+
u && this.findStoppedTurn(n, {
|
|
1248
|
+
respondsToUserMessageId: u.respondsToUserMessageId,
|
|
1249
|
+
runId: u.runId
|
|
1250
|
+
}) && (u = void 0);
|
|
1251
|
+
const d = u !== void 0;
|
|
1252
|
+
this.rememberUserMessageClientMessageIds(c);
|
|
1253
|
+
const p = Ir(c);
|
|
1254
|
+
if (p) {
|
|
1255
|
+
const E = Tr(c, p);
|
|
1256
|
+
this.retryAttemptsByClientMessageId[p] = Math.max(
|
|
1257
|
+
this.retryAttemptsByClientMessageId[p] ?? 0,
|
|
1220
1258
|
E
|
|
1221
1259
|
);
|
|
1222
1260
|
}
|
|
1223
|
-
const
|
|
1261
|
+
const I = c.filter((E) => {
|
|
1224
1262
|
const D = P(E);
|
|
1225
|
-
return
|
|
1226
|
-
}),
|
|
1263
|
+
return bt(D) ? !1 : !D || !p || !Fe(D) ? !0 : Ke(c, D) !== p;
|
|
1264
|
+
}), S = ur(
|
|
1265
|
+
this.state.messages,
|
|
1266
|
+
Et(I, this.options.backendUrl)
|
|
1267
|
+
), m = this.hasLoadedOlderSessionItems ? dr(
|
|
1227
1268
|
this.state.messages,
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1269
|
+
S,
|
|
1270
|
+
this.loadedOlderSessionItemIds
|
|
1271
|
+
) : S, C = Ct(m), B = !d && c.some(
|
|
1272
|
+
(E) => _t(
|
|
1231
1273
|
P(E),
|
|
1232
1274
|
this.state.assistantDraft,
|
|
1233
1275
|
this.state.assistantDraftItemId,
|
|
1234
1276
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
1235
1277
|
this.state.assistantDraftRunId
|
|
1236
1278
|
)
|
|
1237
|
-
),
|
|
1238
|
-
if (!
|
|
1279
|
+
), k = d ? u?.content ?? "" : this.state.assistantDraft, M = !!u?.content, W = C && (!k || B), b = fr(m), J = W && b;
|
|
1280
|
+
if (!C && yr(this.state.messages, c))
|
|
1239
1281
|
return;
|
|
1240
|
-
this.lastUserMessagePageUrl =
|
|
1241
|
-
const
|
|
1242
|
-
if (this.latestRecoverableClientMessageId =
|
|
1243
|
-
sessionId:
|
|
1244
|
-
messages:
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
...
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1282
|
+
this.lastUserMessagePageUrl = mr(c);
|
|
1283
|
+
const O = W || l ? null : ze(c);
|
|
1284
|
+
if (this.latestRecoverableClientMessageId = O, b && this.clearRetryTimers(), this.setState({
|
|
1285
|
+
sessionId: w(e.session, "id") ?? this.state.sessionId,
|
|
1286
|
+
messages: m,
|
|
1287
|
+
isLoadingSession: !1,
|
|
1288
|
+
isLoadingOlderMessages: this.sessionItemsRequestId !== null,
|
|
1289
|
+
hasOlderMessages: this.sessionItemsCursor !== null,
|
|
1290
|
+
...h ? { pendingMessageStatus: h } : {},
|
|
1291
|
+
...f ? { turnPhase: f } : {},
|
|
1292
|
+
isRetrying: T,
|
|
1293
|
+
...d ? {
|
|
1294
|
+
assistantDraft: u?.content ?? "",
|
|
1295
|
+
assistantDraftItemId: u?.itemId ?? null,
|
|
1296
|
+
assistantDraftPhase: u?.phase ?? null,
|
|
1297
|
+
assistantDraftRespondsToUserMessageId: u?.respondsToUserMessageId ?? null,
|
|
1298
|
+
assistantDraftRunId: u?.runId ?? null
|
|
1299
|
+
} : B ? {
|
|
1255
1300
|
assistantDraft: "",
|
|
1256
1301
|
assistantDraftItemId: null,
|
|
1257
1302
|
assistantDraftPhase: null,
|
|
1258
1303
|
assistantDraftRespondsToUserMessageId: null,
|
|
1259
1304
|
assistantDraftRunId: null
|
|
1260
1305
|
} : {},
|
|
1261
|
-
...
|
|
1306
|
+
...M ? {
|
|
1262
1307
|
isThinking: !0,
|
|
1263
1308
|
turnPhase: "thinking",
|
|
1264
1309
|
lastError: null
|
|
1265
|
-
} :
|
|
1310
|
+
} : W ? {
|
|
1266
1311
|
isThinking: !1,
|
|
1267
|
-
...
|
|
1312
|
+
...J ? {
|
|
1268
1313
|
status: "connected",
|
|
1269
1314
|
lastError: null,
|
|
1270
1315
|
lastErrorCode: null,
|
|
1271
1316
|
lastErrorSecuritySettingsUrl: null
|
|
1272
1317
|
} : {}
|
|
1273
|
-
} :
|
|
1318
|
+
} : O ? {
|
|
1274
1319
|
isThinking: !0,
|
|
1275
|
-
turnPhase:
|
|
1320
|
+
turnPhase: f ?? this.state.turnPhase ?? "starting",
|
|
1276
1321
|
lastError: null
|
|
1277
1322
|
} : {}
|
|
1278
|
-
}),
|
|
1323
|
+
}), W)
|
|
1279
1324
|
this.retryableClientMessageId = null, this.clearThinkingWatchdog();
|
|
1280
|
-
else if (!
|
|
1281
|
-
if (
|
|
1282
|
-
this.activeClientMessageId =
|
|
1283
|
-
const E =
|
|
1284
|
-
this.activeResponseUserMessageId =
|
|
1325
|
+
else if (!l && (M || O)) {
|
|
1326
|
+
if (O) {
|
|
1327
|
+
this.activeClientMessageId = O;
|
|
1328
|
+
const E = X(c), D = E === null ? null : c[E];
|
|
1329
|
+
this.activeResponseUserMessageId = w(D, "id");
|
|
1285
1330
|
}
|
|
1286
1331
|
this.markThinkingProgress();
|
|
1287
1332
|
}
|
|
1288
|
-
if (
|
|
1289
|
-
const E =
|
|
1290
|
-
E && this.retryAfterInterruptedRun(E,
|
|
1333
|
+
if (p) {
|
|
1334
|
+
const E = w(e.session, "id") ?? this.state.sessionId;
|
|
1335
|
+
E && this.retryAfterInterruptedRun(E, p);
|
|
1291
1336
|
}
|
|
1292
1337
|
return;
|
|
1293
1338
|
}
|
|
1339
|
+
if (e.type === "session.items.page") {
|
|
1340
|
+
const s = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
1341
|
+
if (!s || s !== this.sessionItemsRequestId || n !== this.state.sessionId)
|
|
1342
|
+
return;
|
|
1343
|
+
const r = Et(
|
|
1344
|
+
Array.isArray(e.items) ? e.items : [],
|
|
1345
|
+
this.options.backendUrl
|
|
1346
|
+
), i = new Set(r.map((o) => o.id));
|
|
1347
|
+
for (const o of i)
|
|
1348
|
+
this.loadedOlderSessionItemIds.add(o);
|
|
1349
|
+
this.sessionItemsRequestId = null, this.sessionItemsCursor = typeof e.nextCursor == "string" ? e.nextCursor : null, this.hasLoadedOlderSessionItems = !0, this.setState({
|
|
1350
|
+
messages: [...r, ...this.state.messages.filter((o) => !i.has(o.id))],
|
|
1351
|
+
isLoadingOlderMessages: !1,
|
|
1352
|
+
hasOlderMessages: this.sessionItemsCursor !== null
|
|
1353
|
+
});
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1294
1356
|
if (e.type === "sessions.page") {
|
|
1295
1357
|
const s = typeof e.requestId == "string" ? e.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
|
|
1296
1358
|
s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
|
|
1297
|
-
sessions:
|
|
1359
|
+
sessions: Jn(e.sessions),
|
|
1298
1360
|
nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
|
|
1299
1361
|
}));
|
|
1300
1362
|
return;
|
|
@@ -1309,7 +1371,7 @@ class qt {
|
|
|
1309
1371
|
}
|
|
1310
1372
|
if (e.type === "session.updated") {
|
|
1311
1373
|
this.clearRunAckResyncRetryTimer();
|
|
1312
|
-
const s =
|
|
1374
|
+
const s = w(e.session, "id");
|
|
1313
1375
|
s && typeof e.warmupId == "string" && e.warmupId === this.pendingComposerWarmup?.event.warmupId && (this.pendingComposerWarmup.event = {
|
|
1314
1376
|
...this.pendingComposerWarmup.event,
|
|
1315
1377
|
sessionId: s
|
|
@@ -1321,9 +1383,9 @@ class qt {
|
|
|
1321
1383
|
if (e.type === "session.item") {
|
|
1322
1384
|
this.rememberUserMessageClientMessageIds([e.item]);
|
|
1323
1385
|
const s = P(e.item);
|
|
1324
|
-
if (
|
|
1386
|
+
if (Fe(s)) {
|
|
1325
1387
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
1326
|
-
const r =
|
|
1388
|
+
const r = w(e.item, "sessionId") ?? this.state.sessionId, i = s ? N(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
1327
1389
|
if (r && a) {
|
|
1328
1390
|
this.retryAfterInterruptedRun(r, a);
|
|
1329
1391
|
return;
|
|
@@ -1333,21 +1395,21 @@ class qt {
|
|
|
1333
1395
|
return;
|
|
1334
1396
|
}
|
|
1335
1397
|
}
|
|
1336
|
-
if (
|
|
1398
|
+
if (bt(s))
|
|
1337
1399
|
return;
|
|
1338
|
-
const n =
|
|
1400
|
+
const n = zt(e.item, this.options.backendUrl);
|
|
1339
1401
|
if (n) {
|
|
1340
1402
|
const r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
1341
|
-
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)),
|
|
1403
|
+
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), j(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
1342
1404
|
const i = e.item.data;
|
|
1343
|
-
|
|
1344
|
-
const o =
|
|
1405
|
+
wr(i) && this.clearRunAckResyncRetryTimer();
|
|
1406
|
+
const o = $e(this.state.messages, n), a = Ct(o), l = _t(
|
|
1345
1407
|
i,
|
|
1346
1408
|
this.state.assistantDraft,
|
|
1347
1409
|
this.state.assistantDraftItemId,
|
|
1348
1410
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
1349
1411
|
this.state.assistantDraftRunId
|
|
1350
|
-
), c = a && (!this.state.assistantDraft || l),
|
|
1412
|
+
), c = a && (!this.state.assistantDraft || l), h = j(n) && (c || !this.state.isThinking && this.activeClientMessageId === null);
|
|
1351
1413
|
this.setState({
|
|
1352
1414
|
messages: o,
|
|
1353
1415
|
...l ? {
|
|
@@ -1361,7 +1423,7 @@ class qt {
|
|
|
1361
1423
|
isThinking: !1,
|
|
1362
1424
|
isRetrying: !1
|
|
1363
1425
|
} : {},
|
|
1364
|
-
...
|
|
1426
|
+
...h ? {
|
|
1365
1427
|
status: "connected",
|
|
1366
1428
|
lastError: null,
|
|
1367
1429
|
lastErrorCode: null,
|
|
@@ -1373,9 +1435,9 @@ class qt {
|
|
|
1373
1435
|
}
|
|
1374
1436
|
if (e.type === "chat.assistant_delta") {
|
|
1375
1437
|
this.clearRunAckResyncRetryTimer();
|
|
1376
|
-
const s = typeof e.delta == "string" ? e.delta : "", n = typeof e.itemId == "string" ? e.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((g) => g.id === o), l = e.phase === "commentary" || e.phase === "final_answer" ? e.phase : r ? null : this.state.assistantDraftPhase, c = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId,
|
|
1377
|
-
this.activeClientMessageId && (this.activeResponseUserMessageId = c, this.activeResponseRunId =
|
|
1378
|
-
messages:
|
|
1438
|
+
const s = typeof e.delta == "string" ? e.delta : "", n = typeof e.itemId == "string" ? e.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((g) => g.id === o), l = e.phase === "commentary" || e.phase === "final_answer" ? e.phase : r ? null : this.state.assistantDraftPhase, c = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId, h = typeof e.runId == "string" ? e.runId : this.state.assistantDraftRunId;
|
|
1439
|
+
this.activeClientMessageId && (this.activeResponseUserMessageId = c, this.activeResponseRunId = h), this.setState({
|
|
1440
|
+
messages: $e(this.state.messages, {
|
|
1379
1441
|
id: o,
|
|
1380
1442
|
role: "assistant",
|
|
1381
1443
|
content: i,
|
|
@@ -1384,13 +1446,13 @@ class qt {
|
|
|
1384
1446
|
dataType: "assistant_draft",
|
|
1385
1447
|
...l ? { phase: l } : {},
|
|
1386
1448
|
...c ? { respondsToUserMessageId: c } : {},
|
|
1387
|
-
...
|
|
1449
|
+
...h ? { runId: h } : {}
|
|
1388
1450
|
}),
|
|
1389
1451
|
assistantDraft: i,
|
|
1390
1452
|
assistantDraftItemId: n ?? this.state.assistantDraftItemId,
|
|
1391
1453
|
assistantDraftPhase: l,
|
|
1392
1454
|
assistantDraftRespondsToUserMessageId: c,
|
|
1393
|
-
assistantDraftRunId:
|
|
1455
|
+
assistantDraftRunId: h,
|
|
1394
1456
|
isThinking: !0,
|
|
1395
1457
|
isRetrying: !1
|
|
1396
1458
|
}), this.markThinkingProgress(), this.emit("delta", s);
|
|
@@ -1403,9 +1465,9 @@ class qt {
|
|
|
1403
1465
|
const s = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null;
|
|
1404
1466
|
if (!(n && this.state.assistantDraftRespondsToUserMessageId ? n === this.state.assistantDraftRespondsToUserMessageId : !r || !this.state.assistantDraftRunId || r === this.state.assistantDraftRunId))
|
|
1405
1467
|
return;
|
|
1406
|
-
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l =
|
|
1468
|
+
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !r || r === this.activeResponseRunId), l = Ms(
|
|
1407
1469
|
this.state.messages.filter(
|
|
1408
|
-
(c) => c.dataType !== "assistant_draft" || !
|
|
1470
|
+
(c) => c.dataType !== "assistant_draft" || !Ne(
|
|
1409
1471
|
c,
|
|
1410
1472
|
n,
|
|
1411
1473
|
r
|
|
@@ -1413,11 +1475,11 @@ class qt {
|
|
|
1413
1475
|
),
|
|
1414
1476
|
n,
|
|
1415
1477
|
r,
|
|
1416
|
-
|
|
1478
|
+
Kt
|
|
1417
1479
|
);
|
|
1418
1480
|
this.setState({
|
|
1419
1481
|
sessionId: s,
|
|
1420
|
-
messages:
|
|
1482
|
+
messages: ir(
|
|
1421
1483
|
l,
|
|
1422
1484
|
typeof e.responseId == "string" ? e.responseId : null,
|
|
1423
1485
|
n,
|
|
@@ -1439,9 +1501,9 @@ class qt {
|
|
|
1439
1501
|
if (s)
|
|
1440
1502
|
this.nonTranscriptToolCallIds.add(s);
|
|
1441
1503
|
else {
|
|
1442
|
-
const n =
|
|
1504
|
+
const n = lr(e);
|
|
1443
1505
|
if (n) {
|
|
1444
|
-
const r =
|
|
1506
|
+
const r = or(
|
|
1445
1507
|
this.state.messages,
|
|
1446
1508
|
n
|
|
1447
1509
|
);
|
|
@@ -1472,7 +1534,22 @@ class qt {
|
|
|
1472
1534
|
return;
|
|
1473
1535
|
}
|
|
1474
1536
|
if (e.type === "error") {
|
|
1475
|
-
const s = typeof e.requestId == "string" ? e.requestId : null
|
|
1537
|
+
const s = typeof e.requestId == "string" ? e.requestId : null;
|
|
1538
|
+
if (s && s === this.sessionLoadRequestId) {
|
|
1539
|
+
this.clearSessionLoadRequest(), this.setState({
|
|
1540
|
+
isLoadingSession: !1,
|
|
1541
|
+
lastError: typeof e.message == "string" ? e.message : "Could not load this chat."
|
|
1542
|
+
});
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
if (s && s === this.sessionItemsRequestId) {
|
|
1546
|
+
this.sessionItemsRequestId = null, this.setState({
|
|
1547
|
+
isLoadingOlderMessages: !1,
|
|
1548
|
+
lastError: typeof e.message == "string" ? e.message : "Could not load older messages."
|
|
1549
|
+
});
|
|
1550
|
+
return;
|
|
1551
|
+
}
|
|
1552
|
+
const n = s ? this.pendingSessionHistoryRequests.get(s) : null;
|
|
1476
1553
|
if (s && n) {
|
|
1477
1554
|
window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.reject(new Error(typeof e.message == "string" ? e.message : "Pluno error"));
|
|
1478
1555
|
return;
|
|
@@ -1494,9 +1571,9 @@ class qt {
|
|
|
1494
1571
|
return;
|
|
1495
1572
|
}
|
|
1496
1573
|
o && r && i && (this.retryableClientMessageId = i);
|
|
1497
|
-
const a = new Error(typeof e.message == "string" ? e.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), l =
|
|
1574
|
+
const a = new Error(typeof e.message == "string" ? e.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), l = Un(a.message);
|
|
1498
1575
|
l && console.error(l), this.setState({
|
|
1499
|
-
messages:
|
|
1576
|
+
messages: ue(
|
|
1500
1577
|
this.state.messages,
|
|
1501
1578
|
i ?? this.activeClientMessageId,
|
|
1502
1579
|
typeof e.runId == "string" ? e.runId : null
|
|
@@ -1513,9 +1590,9 @@ class qt {
|
|
|
1513
1590
|
}
|
|
1514
1591
|
}
|
|
1515
1592
|
shouldIgnoreBackgroundSessionEvent(e) {
|
|
1516
|
-
if (!this.options.keepRunsActiveOnSessionNavigation || !
|
|
1593
|
+
if (!this.options.keepRunsActiveOnSessionNavigation || !pn(e))
|
|
1517
1594
|
return !1;
|
|
1518
|
-
const s =
|
|
1595
|
+
const s = ae(e);
|
|
1519
1596
|
return s ? this.deferredSessionUpdatedSessionIds.has(s) ? !0 : this.state.sessionId ? s !== this.state.sessionId : this.backgroundSessionIds.has(s) : !1;
|
|
1520
1597
|
}
|
|
1521
1598
|
rememberCurrentRunAsBackground() {
|
|
@@ -1525,7 +1602,7 @@ class qt {
|
|
|
1525
1602
|
const s = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
1526
1603
|
if (!(e.retryable === !0 || e.code === "transient_model_error") || !s || !n || e.code === "run_recovery_exhausted")
|
|
1527
1604
|
return !1;
|
|
1528
|
-
if (
|
|
1605
|
+
if (le())
|
|
1529
1606
|
return this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
|
|
1530
1607
|
if (e.code === "run_still_active") {
|
|
1531
1608
|
if (this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[n] === void 0) {
|
|
@@ -1539,10 +1616,10 @@ class qt {
|
|
|
1539
1616
|
if (this.retryTimersByClientMessageId[n] !== void 0)
|
|
1540
1617
|
return !0;
|
|
1541
1618
|
const i = this.retryAttemptsByClientMessageId[n] ?? 0;
|
|
1542
|
-
if (i >=
|
|
1619
|
+
if (i >= Z)
|
|
1543
1620
|
return !1;
|
|
1544
1621
|
this.retryAttemptsByClientMessageId[n] = i + 1;
|
|
1545
|
-
const o =
|
|
1622
|
+
const o = ee(
|
|
1546
1623
|
i,
|
|
1547
1624
|
typeof e.retryAfterMs == "number" ? e.retryAfterMs : 0
|
|
1548
1625
|
);
|
|
@@ -1556,20 +1633,20 @@ class qt {
|
|
|
1556
1633
|
}, o), !0;
|
|
1557
1634
|
}
|
|
1558
1635
|
retryAfterInterruptedRun(e, s) {
|
|
1559
|
-
if (
|
|
1636
|
+
if (le()) {
|
|
1560
1637
|
this.retryableClientMessageId = s, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null });
|
|
1561
1638
|
return;
|
|
1562
1639
|
}
|
|
1563
1640
|
if (this.retryTimersByClientMessageId[s] !== void 0)
|
|
1564
1641
|
return;
|
|
1565
1642
|
const n = this.retryAttemptsByClientMessageId[s] ?? 0;
|
|
1566
|
-
if (n >=
|
|
1643
|
+
if (n >= Z) {
|
|
1567
1644
|
this.reportHealthSignal("run_recovery_exhausted", {
|
|
1568
1645
|
clientMessageId: s,
|
|
1569
1646
|
retryAttempts: n,
|
|
1570
1647
|
reason: "retry_budget_exhausted"
|
|
1571
1648
|
}), this.retryableClientMessageId = s, this.setState({
|
|
1572
|
-
messages:
|
|
1649
|
+
messages: ue(
|
|
1573
1650
|
this.state.messages,
|
|
1574
1651
|
s,
|
|
1575
1652
|
null
|
|
@@ -1583,7 +1660,7 @@ class qt {
|
|
|
1583
1660
|
}
|
|
1584
1661
|
this.retryAttemptsByClientMessageId[s] = n + 1, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[s] = window.setTimeout(() => {
|
|
1585
1662
|
delete this.retryTimersByClientMessageId[s], this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !0 });
|
|
1586
|
-
},
|
|
1663
|
+
}, ee(n));
|
|
1587
1664
|
}
|
|
1588
1665
|
clearRetryTimers() {
|
|
1589
1666
|
for (const e of Object.values(this.retryTimersByClientMessageId))
|
|
@@ -1592,10 +1669,10 @@ class qt {
|
|
|
1592
1669
|
}
|
|
1593
1670
|
rememberUserMessageClientMessageIds(e) {
|
|
1594
1671
|
for (const s of e) {
|
|
1595
|
-
const n =
|
|
1672
|
+
const n = w(s, "id"), r = P(s);
|
|
1596
1673
|
n && r?.type === "message" && r.role === "user" && r.optimistic !== !0 && !n.startsWith("optimistic-user-message:") && typeof r.clientMessageId == "string" && (this.clientMessageIdsByUserMessageItemId.set(n, r.clientMessageId), r.clientMessageId === this.pendingClientMessageId && this.promotePendingDelivery(
|
|
1597
1674
|
r.clientMessageId,
|
|
1598
|
-
|
|
1675
|
+
w(s, "sessionId") ?? this.state.sessionId,
|
|
1599
1676
|
n,
|
|
1600
1677
|
null
|
|
1601
1678
|
), r.clientMessageId === this.activeClientMessageId && (this.activeResponseUserMessageId = n));
|
|
@@ -1606,6 +1683,9 @@ class qt {
|
|
|
1606
1683
|
window.clearTimeout(s.timeout), s.reject(new Error(e));
|
|
1607
1684
|
this.pendingSessionHistoryRequests.clear();
|
|
1608
1685
|
}
|
|
1686
|
+
clearSessionLoadRequest() {
|
|
1687
|
+
this.sessionLoadRequestTimer !== null && (window.clearTimeout(this.sessionLoadRequestTimer), this.sessionLoadRequestTimer = null), this.sessionLoadRequestId = null;
|
|
1688
|
+
}
|
|
1609
1689
|
sendSessionMutation(e, s, n) {
|
|
1610
1690
|
const r = new Promise((i, o) => {
|
|
1611
1691
|
const a = window.setTimeout(() => {
|
|
@@ -1677,7 +1757,7 @@ class qt {
|
|
|
1677
1757
|
}), this.markThinkingProgress();
|
|
1678
1758
|
}
|
|
1679
1759
|
schedulePendingDeliveryAck(e) {
|
|
1680
|
-
this.clearPendingDeliveryTimers(), !
|
|
1760
|
+
this.clearPendingDeliveryTimers(), !le() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
|
|
1681
1761
|
this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
|
|
1682
1762
|
}, yt));
|
|
1683
1763
|
}
|
|
@@ -1685,13 +1765,13 @@ class qt {
|
|
|
1685
1765
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
1686
1766
|
return;
|
|
1687
1767
|
const s = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
1688
|
-
if (s >=
|
|
1768
|
+
if (s >= Z) {
|
|
1689
1769
|
this.failPendingDelivery(e);
|
|
1690
1770
|
return;
|
|
1691
1771
|
}
|
|
1692
1772
|
s === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = s + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
1693
1773
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
1694
|
-
},
|
|
1774
|
+
}, ee(s, It));
|
|
1695
1775
|
}
|
|
1696
1776
|
failPendingDelivery(e) {
|
|
1697
1777
|
if (this.pendingClientMessageId !== e)
|
|
@@ -1702,7 +1782,7 @@ class qt {
|
|
|
1702
1782
|
// A failed follow-up delivery must not hide an older acknowledged response that is still active.
|
|
1703
1783
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
1704
1784
|
isRetrying: !1,
|
|
1705
|
-
lastError:
|
|
1785
|
+
lastError: Ys,
|
|
1706
1786
|
lastErrorCode: "message_delivery_failed"
|
|
1707
1787
|
});
|
|
1708
1788
|
}
|
|
@@ -1717,7 +1797,7 @@ class qt {
|
|
|
1717
1797
|
s,
|
|
1718
1798
|
typeof e.runId == "string" ? e.runId : null
|
|
1719
1799
|
), !(!this.state.isThinking || !s) && this.setState({
|
|
1720
|
-
messages:
|
|
1800
|
+
messages: Er(
|
|
1721
1801
|
this.state.messages,
|
|
1722
1802
|
s
|
|
1723
1803
|
)
|
|
@@ -1737,7 +1817,7 @@ class qt {
|
|
|
1737
1817
|
scheduleRunAckResyncRetry(e) {
|
|
1738
1818
|
this.clearRunAckResyncRetryTimer();
|
|
1739
1819
|
const s = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
1740
|
-
s >=
|
|
1820
|
+
s >= Z || (this.runAckResyncRetryTimer = window.setTimeout(() => {
|
|
1741
1821
|
this.runAckResyncRetryTimer = null, (this.retryAttemptsByClientMessageId[e] ?? 0) === s && (!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || this.latestRecoverableClientMessageId !== e || (this.retryAttemptsByClientMessageId[e] = s + 1, this.setState({
|
|
1742
1822
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
1743
1823
|
isThinking: !0,
|
|
@@ -1751,7 +1831,7 @@ class qt {
|
|
|
1751
1831
|
clientMessageId: e,
|
|
1752
1832
|
automatic: !0
|
|
1753
1833
|
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(mt)));
|
|
1754
|
-
},
|
|
1834
|
+
}, ee(s, It)));
|
|
1755
1835
|
}
|
|
1756
1836
|
clearRunAckResyncRetryTimer() {
|
|
1757
1837
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -1776,7 +1856,7 @@ class qt {
|
|
|
1776
1856
|
return;
|
|
1777
1857
|
}
|
|
1778
1858
|
const s = this.thinkingWatchdogResyncAttemptsByClientMessageId[e] ?? 0, n = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
1779
|
-
if (n >=
|
|
1859
|
+
if (n >= Z) {
|
|
1780
1860
|
R("web-sdk.agent", "Pluno run recovery retry exhausted", {
|
|
1781
1861
|
sessionId: this.state.sessionId,
|
|
1782
1862
|
clientMessageId: e
|
|
@@ -1785,7 +1865,7 @@ class qt {
|
|
|
1785
1865
|
retryAttempts: n,
|
|
1786
1866
|
reason: "retry_budget_exhausted"
|
|
1787
1867
|
}), this.retryableClientMessageId = e, this.setState({
|
|
1788
|
-
messages:
|
|
1868
|
+
messages: ue(
|
|
1789
1869
|
this.state.messages,
|
|
1790
1870
|
e,
|
|
1791
1871
|
null
|
|
@@ -1801,7 +1881,7 @@ class qt {
|
|
|
1801
1881
|
sessionId: this.state.sessionId,
|
|
1802
1882
|
clientMessageId: e,
|
|
1803
1883
|
resyncAttempts: s + 1
|
|
1804
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
1884
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Xs);
|
|
1805
1885
|
return;
|
|
1806
1886
|
}
|
|
1807
1887
|
this.setState({
|
|
@@ -1819,24 +1899,24 @@ class qt {
|
|
|
1819
1899
|
clientMessageId: e,
|
|
1820
1900
|
automatic: !0
|
|
1821
1901
|
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.markThinkingProgress();
|
|
1822
|
-
},
|
|
1902
|
+
}, ee(n)));
|
|
1823
1903
|
}
|
|
1824
1904
|
resyncThinkingSession() {
|
|
1825
1905
|
this.state.sessionId ? this.send({
|
|
1826
1906
|
type: "page.upsert",
|
|
1827
1907
|
sessionId: this.state.sessionId,
|
|
1828
|
-
page:
|
|
1908
|
+
page: _(),
|
|
1829
1909
|
model: this.options.model
|
|
1830
1910
|
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
|
|
1831
1911
|
}
|
|
1832
1912
|
async executeToolCall(e) {
|
|
1833
|
-
const s = typeof e.sessionId == "string" ? e.sessionId : null, n = typeof e.callId == "string" ? e.callId : null, r = typeof e.toolName == "string" ? e.toolName : null, i =
|
|
1913
|
+
const s = typeof e.sessionId == "string" ? e.sessionId : null, n = typeof e.callId == "string" ? e.callId : null, r = typeof e.toolName == "string" ? e.toolName : null, i = K(
|
|
1834
1914
|
typeof e.summary == "string" ? e.summary : "Running browser tool"
|
|
1835
1915
|
), o = e.rawInput;
|
|
1836
1916
|
if (!s || !n || !r)
|
|
1837
1917
|
return;
|
|
1838
1918
|
const a = r === "execute_code", l = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
1839
|
-
if (!a && !l || !
|
|
1919
|
+
if (!a && !l || !zr(o)) {
|
|
1840
1920
|
this.setToolMessageLoading(n, !1), this.send({
|
|
1841
1921
|
type: "tool.result",
|
|
1842
1922
|
sessionId: s,
|
|
@@ -1882,10 +1962,10 @@ class qt {
|
|
|
1882
1962
|
startedAtUrl: location.href,
|
|
1883
1963
|
startedAtOrigin: location.origin
|
|
1884
1964
|
}), this.installSessionBrowserApis();
|
|
1885
|
-
let c = null,
|
|
1886
|
-
c = await this.executeRuntimeHelper(),
|
|
1965
|
+
let c = null, h;
|
|
1966
|
+
c = await this.executeRuntimeHelper(), h = await Mt(
|
|
1887
1967
|
o,
|
|
1888
|
-
|
|
1968
|
+
Cn(e.runtimeContext, this.options.backendUrl)
|
|
1889
1969
|
).catch((g) => ({
|
|
1890
1970
|
ok: !1,
|
|
1891
1971
|
exception: {
|
|
@@ -1898,11 +1978,11 @@ class qt {
|
|
|
1898
1978
|
toolName: r,
|
|
1899
1979
|
summary: o.summary,
|
|
1900
1980
|
rawInput: v(o),
|
|
1901
|
-
rawOutput: v(
|
|
1902
|
-
}),
|
|
1981
|
+
rawOutput: v(Kn(h, c))
|
|
1982
|
+
}), Pt(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
1903
1983
|
}
|
|
1904
1984
|
setToolMessageLoading(e, s) {
|
|
1905
|
-
const n =
|
|
1985
|
+
const n = ar(
|
|
1906
1986
|
this.state.messages,
|
|
1907
1987
|
e,
|
|
1908
1988
|
s
|
|
@@ -1913,17 +1993,17 @@ class qt {
|
|
|
1913
1993
|
if (this.pageLifecycleCleanup)
|
|
1914
1994
|
return;
|
|
1915
1995
|
const e = () => {
|
|
1916
|
-
|
|
1996
|
+
Yt(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1917
1997
|
};
|
|
1918
1998
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
1919
1999
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
1920
2000
|
};
|
|
1921
2001
|
}
|
|
1922
2002
|
installSessionBrowserApis() {
|
|
1923
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
2003
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = mn();
|
|
1924
2004
|
}
|
|
1925
2005
|
cleanupSessionBrowserApis() {
|
|
1926
|
-
this.sessionBrowserApisCleanup && (
|
|
2006
|
+
this.sessionBrowserApisCleanup && (Rn(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
1927
2007
|
}
|
|
1928
2008
|
async executeRuntimeHelper() {
|
|
1929
2009
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -1931,29 +2011,29 @@ class qt {
|
|
|
1931
2011
|
const e = await Mt({
|
|
1932
2012
|
javascript: this.runtimeHelperJavascript
|
|
1933
2013
|
});
|
|
1934
|
-
return e.ok === !1 ?
|
|
2014
|
+
return e.ok === !1 ? Gn(e) : null;
|
|
1935
2015
|
}
|
|
1936
2016
|
enableNetworkCapture() {
|
|
1937
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
1938
|
-
|
|
2017
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = un((e) => {
|
|
2018
|
+
Yr(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
1939
2019
|
}));
|
|
1940
2020
|
}
|
|
1941
2021
|
enqueueNetworkEvent(e) {
|
|
1942
|
-
this.queuedNetworkEvents.length >=
|
|
2022
|
+
this.queuedNetworkEvents.length >= Zs || (this.queuedNetworkEvents.push(Jr(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
1943
2023
|
this.networkBatchTimer = null;
|
|
1944
2024
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
1945
2025
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
1946
2026
|
type: "network.batch",
|
|
1947
2027
|
sessionId: this.state.sessionId ?? void 0,
|
|
1948
|
-
page:
|
|
2028
|
+
page: _(),
|
|
1949
2029
|
events: s
|
|
1950
2030
|
});
|
|
1951
|
-
},
|
|
2031
|
+
}, Qs)));
|
|
1952
2032
|
}
|
|
1953
2033
|
scheduleReconnect() {
|
|
1954
2034
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
1955
2035
|
return;
|
|
1956
|
-
const e =
|
|
2036
|
+
const e = ln(this.reconnectAttempts);
|
|
1957
2037
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
1958
2038
|
this.reconnectTimer = null, this.connect().catch((s) => {
|
|
1959
2039
|
R("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
@@ -1969,8 +2049,8 @@ class qt {
|
|
|
1969
2049
|
const e = this.socket;
|
|
1970
2050
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
1971
2051
|
this.socket === e && (R("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
1972
|
-
},
|
|
1973
|
-
},
|
|
2052
|
+
}, Hs));
|
|
2053
|
+
}, Ws);
|
|
1974
2054
|
}
|
|
1975
2055
|
stopHeartbeat() {
|
|
1976
2056
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -2005,7 +2085,7 @@ class qt {
|
|
|
2005
2085
|
turnPhase: r,
|
|
2006
2086
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
2007
2087
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
2008
|
-
},
|
|
2088
|
+
}, vr(this.options.clientId, this.state), this.emit("state", this.getState()), Ue("state", this.state.status, {
|
|
2009
2089
|
status: this.state.status,
|
|
2010
2090
|
sessionId: this.state.sessionId,
|
|
2011
2091
|
messageCount: this.state.messages.length,
|
|
@@ -2026,61 +2106,61 @@ class qt {
|
|
|
2026
2106
|
this.state.isThinking && this.activeClientMessageId ? this.browserConnectionInterruptedClientMessageIds.add(this.activeClientMessageId) : this.pendingClientMessageId && this.browserConnectionInterruptedClientMessageIds.add(this.pendingClientMessageId);
|
|
2027
2107
|
}
|
|
2028
2108
|
getRunRecoveryExhaustedErrorMessage(e) {
|
|
2029
|
-
return e && this.browserConnectionInterruptedClientMessageIds.has(e) ?
|
|
2109
|
+
return e && this.browserConnectionInterruptedClientMessageIds.has(e) ? Js : Vs;
|
|
2030
2110
|
}
|
|
2031
2111
|
emit(e, s) {
|
|
2032
2112
|
this.listeners[e]?.forEach((r) => r(s));
|
|
2033
2113
|
}
|
|
2034
2114
|
}
|
|
2035
|
-
const
|
|
2036
|
-
function
|
|
2037
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
2115
|
+
const ve = /* @__PURE__ */ new WeakMap();
|
|
2116
|
+
function un(t) {
|
|
2117
|
+
const e = window.__plunoProductAgentNetworkCapture ?? dn();
|
|
2038
2118
|
return e.subscribers.add(t), () => {
|
|
2039
2119
|
e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
2040
2120
|
};
|
|
2041
2121
|
}
|
|
2042
|
-
function
|
|
2122
|
+
function dn() {
|
|
2043
2123
|
const t = /* @__PURE__ */ new Set(), e = (T) => {
|
|
2044
|
-
t.forEach((
|
|
2124
|
+
t.forEach((f) => {
|
|
2045
2125
|
try {
|
|
2046
|
-
|
|
2126
|
+
f(T);
|
|
2047
2127
|
} catch {
|
|
2048
2128
|
}
|
|
2049
2129
|
});
|
|
2050
|
-
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(
|
|
2130
|
+
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(f, u) {
|
|
2051
2131
|
const d = Date.now();
|
|
2052
|
-
let
|
|
2132
|
+
let p;
|
|
2053
2133
|
try {
|
|
2054
|
-
|
|
2134
|
+
p = s.call(this, f, u);
|
|
2055
2135
|
} catch (I) {
|
|
2056
2136
|
throw I;
|
|
2057
2137
|
}
|
|
2058
2138
|
try {
|
|
2059
|
-
const I =
|
|
2060
|
-
if (!
|
|
2139
|
+
const I = f instanceof Request ? f : null, S = Kr(f, I), m = ts(u?.headers ?? I?.headers);
|
|
2140
|
+
if (!z(S, m, u?.body)) {
|
|
2061
2141
|
const B = {
|
|
2062
|
-
requestId:
|
|
2063
|
-
url:
|
|
2142
|
+
requestId: xe("fetch"),
|
|
2143
|
+
url: q(S, De),
|
|
2064
2144
|
method: (u?.method ?? I?.method ?? "GET").toUpperCase(),
|
|
2065
2145
|
requestHeaders: m,
|
|
2066
|
-
requestBody:
|
|
2146
|
+
requestBody: Dt(u?.body),
|
|
2067
2147
|
resourceType: "fetch",
|
|
2068
2148
|
startedAt: new Date(d).toISOString()
|
|
2069
2149
|
};
|
|
2070
|
-
|
|
2071
|
-
(
|
|
2072
|
-
|
|
2150
|
+
p.then(
|
|
2151
|
+
(k) => {
|
|
2152
|
+
Gr(k, B, d, e).catch(() => {
|
|
2073
2153
|
e({
|
|
2074
2154
|
...B,
|
|
2075
|
-
responseStatus:
|
|
2155
|
+
responseStatus: k.status,
|
|
2076
2156
|
durationMs: Date.now() - d
|
|
2077
2157
|
});
|
|
2078
2158
|
});
|
|
2079
2159
|
},
|
|
2080
|
-
(
|
|
2160
|
+
(k) => {
|
|
2081
2161
|
e({
|
|
2082
2162
|
...B,
|
|
2083
|
-
errorText:
|
|
2163
|
+
errorText: q(k instanceof Error ? k.message : String(k)),
|
|
2084
2164
|
durationMs: Date.now() - d
|
|
2085
2165
|
});
|
|
2086
2166
|
}
|
|
@@ -2088,30 +2168,30 @@ function cn() {
|
|
|
2088
2168
|
}
|
|
2089
2169
|
} catch {
|
|
2090
2170
|
}
|
|
2091
|
-
return
|
|
2092
|
-
}, a = function(
|
|
2093
|
-
const
|
|
2094
|
-
return
|
|
2095
|
-
requestId:
|
|
2096
|
-
method: String(
|
|
2097
|
-
url:
|
|
2171
|
+
return p;
|
|
2172
|
+
}, a = function(f, u, d, p, I) {
|
|
2173
|
+
const S = n.call(this, f, u, d ?? !0, p ?? void 0, I ?? void 0), m = typeof u == "string" ? u : u.toString();
|
|
2174
|
+
return ve.set(this, {
|
|
2175
|
+
requestId: xe("xhr"),
|
|
2176
|
+
method: String(f ?? "GET").toUpperCase(),
|
|
2177
|
+
url: q(m, De),
|
|
2098
2178
|
requestHeaders: {},
|
|
2099
2179
|
startedAtMs: Date.now(),
|
|
2100
2180
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2101
|
-
excluded:
|
|
2102
|
-
}),
|
|
2103
|
-
}, l = function(
|
|
2104
|
-
const d = r.call(this,
|
|
2105
|
-
return
|
|
2106
|
-
}, c = function(
|
|
2181
|
+
excluded: z(m)
|
|
2182
|
+
}), S;
|
|
2183
|
+
}, l = function(f, u) {
|
|
2184
|
+
const d = r.call(this, f, u), p = ve.get(this);
|
|
2185
|
+
return p && Object.keys(p.requestHeaders).length < Ze && (p.requestHeaders[f] = nt(f, u), p.excluded = p.excluded || z(p.url, p.requestHeaders)), d;
|
|
2186
|
+
}, c = function(f) {
|
|
2107
2187
|
try {
|
|
2108
|
-
const u =
|
|
2109
|
-
u && (u.excluded = u.excluded ||
|
|
2188
|
+
const u = ve.get(this);
|
|
2189
|
+
u && (u.excluded = u.excluded || z(u.url, u.requestHeaders, f), u.requestBody = Dt(f), u.excluded || this.addEventListener(
|
|
2110
2190
|
"loadend",
|
|
2111
2191
|
() => {
|
|
2112
2192
|
queueMicrotask(() => {
|
|
2113
2193
|
try {
|
|
2114
|
-
const d =
|
|
2194
|
+
const d = Zr(this.getAllResponseHeaders());
|
|
2115
2195
|
e({
|
|
2116
2196
|
requestId: u.requestId,
|
|
2117
2197
|
url: u.url,
|
|
@@ -2121,7 +2201,7 @@ function cn() {
|
|
|
2121
2201
|
resourceType: "xhr",
|
|
2122
2202
|
responseStatus: this.status,
|
|
2123
2203
|
responseHeaders: d,
|
|
2124
|
-
responseBody:
|
|
2204
|
+
responseBody: Vr(this, d),
|
|
2125
2205
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
2126
2206
|
startedAt: u.startedAt,
|
|
2127
2207
|
durationMs: Date.now() - u.startedAtMs
|
|
@@ -2135,7 +2215,7 @@ function cn() {
|
|
|
2135
2215
|
));
|
|
2136
2216
|
} catch {
|
|
2137
2217
|
}
|
|
2138
|
-
return i.call(this,
|
|
2218
|
+
return i.call(this, f ?? null);
|
|
2139
2219
|
};
|
|
2140
2220
|
try {
|
|
2141
2221
|
window.fetch = o;
|
|
@@ -2153,17 +2233,17 @@ function cn() {
|
|
|
2153
2233
|
XMLHttpRequest.prototype.send = c;
|
|
2154
2234
|
} catch {
|
|
2155
2235
|
}
|
|
2156
|
-
let
|
|
2236
|
+
let h = null;
|
|
2157
2237
|
if (typeof PerformanceObserver < "u") {
|
|
2158
|
-
|
|
2159
|
-
for (const
|
|
2160
|
-
const u =
|
|
2161
|
-
if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" ||
|
|
2238
|
+
h = new PerformanceObserver((T) => {
|
|
2239
|
+
for (const f of T.getEntries()) {
|
|
2240
|
+
const u = f;
|
|
2241
|
+
if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" || z(u.name))
|
|
2162
2242
|
continue;
|
|
2163
2243
|
const d = performance.timeOrigin + u.startTime;
|
|
2164
2244
|
e({
|
|
2165
|
-
requestId:
|
|
2166
|
-
url:
|
|
2245
|
+
requestId: xe("resource"),
|
|
2246
|
+
url: q(u.name, De),
|
|
2167
2247
|
method: "GET",
|
|
2168
2248
|
resourceType: "resource",
|
|
2169
2249
|
responseStatus: u.responseStatus,
|
|
@@ -2173,15 +2253,15 @@ function cn() {
|
|
|
2173
2253
|
}
|
|
2174
2254
|
});
|
|
2175
2255
|
try {
|
|
2176
|
-
|
|
2256
|
+
h.observe({ type: "resource", buffered: !0 });
|
|
2177
2257
|
} catch {
|
|
2178
|
-
|
|
2258
|
+
h.disconnect(), h = null;
|
|
2179
2259
|
}
|
|
2180
2260
|
}
|
|
2181
2261
|
const g = {
|
|
2182
2262
|
subscribers: t,
|
|
2183
2263
|
destroy: () => {
|
|
2184
|
-
|
|
2264
|
+
h?.disconnect();
|
|
2185
2265
|
try {
|
|
2186
2266
|
window.fetch === o && (window.fetch = s);
|
|
2187
2267
|
} catch {
|
|
@@ -2213,17 +2293,17 @@ function R(t, e, s) {
|
|
|
2213
2293
|
}, i = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
2214
2294
|
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 }));
|
|
2215
2295
|
}
|
|
2216
|
-
function
|
|
2296
|
+
function wt(t) {
|
|
2217
2297
|
const e = typeof t == "function" ? t() : t;
|
|
2218
2298
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
2219
2299
|
}
|
|
2220
|
-
function
|
|
2300
|
+
function hn(t) {
|
|
2221
2301
|
return t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call";
|
|
2222
2302
|
}
|
|
2223
|
-
function
|
|
2303
|
+
function pn(t) {
|
|
2224
2304
|
return t.type === "run.steered" || t.type === "run.ack" || t.type === "run.model_started" || t.type === "conversation.state" || t.type === "session.updated" || t.type === "session.item" || t.type === "chat.assistant_delta" || t.type === "chat.assistant_done" || t.type === "tool.call" || t.type === "tool.status" || t.type === "error" && typeof t.requestId != "string";
|
|
2225
2305
|
}
|
|
2226
|
-
function
|
|
2306
|
+
function ae(t) {
|
|
2227
2307
|
if (typeof t.sessionId == "string")
|
|
2228
2308
|
return t.sessionId;
|
|
2229
2309
|
if (t.session && typeof t.session == "object") {
|
|
@@ -2238,31 +2318,31 @@ function oe(t) {
|
|
|
2238
2318
|
}
|
|
2239
2319
|
return null;
|
|
2240
2320
|
}
|
|
2241
|
-
const
|
|
2242
|
-
function
|
|
2321
|
+
const gn = 5e3, fn = 12e4;
|
|
2322
|
+
function mn() {
|
|
2243
2323
|
const t = [
|
|
2244
|
-
|
|
2245
|
-
|
|
2324
|
+
In(),
|
|
2325
|
+
yn()
|
|
2246
2326
|
].filter((e) => typeof e == "function");
|
|
2247
2327
|
return () => {
|
|
2248
2328
|
for (const e of t.reverse())
|
|
2249
2329
|
e();
|
|
2250
2330
|
};
|
|
2251
2331
|
}
|
|
2252
|
-
function
|
|
2253
|
-
return
|
|
2332
|
+
function yn() {
|
|
2333
|
+
return Ot(globalThis, "getPageSnapshot", async () => et());
|
|
2254
2334
|
}
|
|
2255
|
-
function
|
|
2256
|
-
return
|
|
2257
|
-
inspectImage: async (e, s) => await
|
|
2335
|
+
function In() {
|
|
2336
|
+
return Ot(globalThis, "pageImages", {
|
|
2337
|
+
inspectImage: async (e, s) => await Tn(e, s)
|
|
2258
2338
|
});
|
|
2259
2339
|
}
|
|
2260
|
-
async function
|
|
2261
|
-
const s =
|
|
2340
|
+
async function Tn(t, e = {}) {
|
|
2341
|
+
const s = An(e.name), n = await Sn(t);
|
|
2262
2342
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
2263
2343
|
type: "pluno.pageImages.inspectImage",
|
|
2264
2344
|
imageAttached: !1,
|
|
2265
|
-
imageAttachmentError:
|
|
2345
|
+
imageAttachmentError: xt
|
|
2266
2346
|
} : {
|
|
2267
2347
|
type: "pluno.pageImages.inspectImage",
|
|
2268
2348
|
imageAttached: !0,
|
|
@@ -2276,15 +2356,15 @@ async function yn(t, e = {}) {
|
|
|
2276
2356
|
imageAttachmentError: n.error
|
|
2277
2357
|
};
|
|
2278
2358
|
}
|
|
2279
|
-
async function
|
|
2280
|
-
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error:
|
|
2359
|
+
async function Sn(t) {
|
|
2360
|
+
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error: xt } : {
|
|
2281
2361
|
ok: !0,
|
|
2282
2362
|
mimeType: t.type,
|
|
2283
2363
|
sizeBytes: t.size,
|
|
2284
|
-
dataUrl: await
|
|
2285
|
-
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } :
|
|
2364
|
+
dataUrl: await En(t)
|
|
2365
|
+
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof t != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : wn(t);
|
|
2286
2366
|
}
|
|
2287
|
-
function
|
|
2367
|
+
function wn(t) {
|
|
2288
2368
|
if (!t.startsWith("data:") || !t.includes(","))
|
|
2289
2369
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
2290
2370
|
const [e, s] = t.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), r = n[0] ?? "";
|
|
@@ -2295,7 +2375,7 @@ function Tn(t) {
|
|
|
2295
2375
|
const i = s.replace(/[ \t\r\n\f]+/g, "");
|
|
2296
2376
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
|
|
2297
2377
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
2298
|
-
const o =
|
|
2378
|
+
const o = Mn(i);
|
|
2299
2379
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
2300
2380
|
ok: !0,
|
|
2301
2381
|
mimeType: r,
|
|
@@ -2303,22 +2383,22 @@ function Tn(t) {
|
|
|
2303
2383
|
dataUrl: `data:${r};base64,${i}`
|
|
2304
2384
|
};
|
|
2305
2385
|
}
|
|
2306
|
-
function
|
|
2386
|
+
function Mn(t) {
|
|
2307
2387
|
if (t.length === 0 || t.length % 4 !== 0)
|
|
2308
2388
|
return null;
|
|
2309
2389
|
const e = t.length - t.replace(/=+$/, "").length;
|
|
2310
2390
|
return e > 2 ? null : t.length / 4 * 3 - e;
|
|
2311
2391
|
}
|
|
2312
|
-
function
|
|
2392
|
+
function An(t) {
|
|
2313
2393
|
return (typeof t == "string" ? t.trim() : "") || "Page image";
|
|
2314
2394
|
}
|
|
2315
|
-
function
|
|
2395
|
+
function Rn(t) {
|
|
2316
2396
|
try {
|
|
2317
2397
|
t();
|
|
2318
2398
|
} catch {
|
|
2319
2399
|
}
|
|
2320
2400
|
}
|
|
2321
|
-
function
|
|
2401
|
+
function En(t) {
|
|
2322
2402
|
return new Promise((e, s) => {
|
|
2323
2403
|
const n = new FileReader();
|
|
2324
2404
|
n.onload = () => {
|
|
@@ -2332,27 +2412,27 @@ function An(t) {
|
|
|
2332
2412
|
}
|
|
2333
2413
|
async function Mt(t, e) {
|
|
2334
2414
|
const s = Object.getPrototypeOf(async function() {
|
|
2335
|
-
}).constructor, n = t.timeoutMs ??
|
|
2415
|
+
}).constructor, n = t.timeoutMs ?? gn, r = Date.now(), i = [];
|
|
2336
2416
|
let o;
|
|
2337
2417
|
const a = {
|
|
2338
2418
|
log: console.log,
|
|
2339
2419
|
info: console.info,
|
|
2340
2420
|
warn: console.warn,
|
|
2341
2421
|
error: console.error
|
|
2342
|
-
}, l = (c) => (...
|
|
2343
|
-
i.push({ level: c, args:
|
|
2422
|
+
}, l = (c) => (...h) => {
|
|
2423
|
+
i.push({ level: c, args: h }), a[c](...h);
|
|
2344
2424
|
};
|
|
2345
2425
|
console.log = l("log"), console.info = l("info"), console.warn = l("warn"), console.error = l("error");
|
|
2346
2426
|
try {
|
|
2347
|
-
const c = /* @__PURE__ */ Symbol("execute_code_timeout"),
|
|
2427
|
+
const c = /* @__PURE__ */ Symbol("execute_code_timeout"), h = await Promise.race([
|
|
2348
2428
|
new s("sandboxFiles", t.javascript)(e?.value),
|
|
2349
2429
|
new Promise((g) => {
|
|
2350
2430
|
o = window.setTimeout(() => g(c), n);
|
|
2351
2431
|
})
|
|
2352
2432
|
]);
|
|
2353
|
-
return
|
|
2433
|
+
return h === c ? bn(n) : {
|
|
2354
2434
|
ok: !0,
|
|
2355
|
-
result:
|
|
2435
|
+
result: h,
|
|
2356
2436
|
console: i,
|
|
2357
2437
|
metadata: {
|
|
2358
2438
|
durationMs: Date.now() - r,
|
|
@@ -2379,7 +2459,7 @@ async function Mt(t, e) {
|
|
|
2379
2459
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
2380
2460
|
}
|
|
2381
2461
|
}
|
|
2382
|
-
function
|
|
2462
|
+
function Cn(t, e) {
|
|
2383
2463
|
if (!t || typeof t != "object")
|
|
2384
2464
|
return;
|
|
2385
2465
|
const s = t.sandboxFilesToken;
|
|
@@ -2389,20 +2469,20 @@ function Rn(t, e) {
|
|
|
2389
2469
|
const r = () => {
|
|
2390
2470
|
if (!n)
|
|
2391
2471
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
2392
|
-
}, i = async (a, l) => await
|
|
2472
|
+
}, i = async (a, l) => await vs(`${e.replace(/\/$/, "")}${a}`, l);
|
|
2393
2473
|
return {
|
|
2394
2474
|
value: Object.freeze({
|
|
2395
2475
|
upload: async (a) => {
|
|
2396
2476
|
if (r(), !(a instanceof Blob))
|
|
2397
2477
|
throw new TypeError("sandboxFiles.upload expects a File or Blob");
|
|
2398
|
-
const l = a instanceof File && a.name ? a.name : "file", c = `?name=${encodeURIComponent(l)}&size_bytes=${a.size}`,
|
|
2478
|
+
const l = a instanceof File && a.name ? a.name : "file", c = `?name=${encodeURIComponent(l)}&size_bytes=${a.size}`, h = await i(`/api/product-agent/attachments/sandbox-files${c}`, {
|
|
2399
2479
|
method: "PUT",
|
|
2400
2480
|
headers: { Authorization: `Bearer ${s}` },
|
|
2401
2481
|
body: a
|
|
2402
2482
|
});
|
|
2403
|
-
if (!
|
|
2404
|
-
throw new Error(`sandboxFiles.upload failed (${
|
|
2405
|
-
return String((await
|
|
2483
|
+
if (!h.ok)
|
|
2484
|
+
throw new Error(`sandboxFiles.upload failed (${h.status})`);
|
|
2485
|
+
return String((await h.json()).path);
|
|
2406
2486
|
},
|
|
2407
2487
|
download: async (a) => {
|
|
2408
2488
|
r();
|
|
@@ -2423,7 +2503,7 @@ function Rn(t, e) {
|
|
|
2423
2503
|
}
|
|
2424
2504
|
};
|
|
2425
2505
|
}
|
|
2426
|
-
function
|
|
2506
|
+
function bn(t) {
|
|
2427
2507
|
return {
|
|
2428
2508
|
ok: !1,
|
|
2429
2509
|
exception: {
|
|
@@ -2437,10 +2517,10 @@ function En(t) {
|
|
|
2437
2517
|
}
|
|
2438
2518
|
};
|
|
2439
2519
|
}
|
|
2440
|
-
function
|
|
2520
|
+
function _n(t) {
|
|
2441
2521
|
return t.replace(/\/+$/, "");
|
|
2442
2522
|
}
|
|
2443
|
-
function
|
|
2523
|
+
function kn(t) {
|
|
2444
2524
|
const e = {
|
|
2445
2525
|
sidepanel: "extension_sidepanel",
|
|
2446
2526
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -2452,18 +2532,18 @@ function bn(t) {
|
|
|
2452
2532
|
};
|
|
2453
2533
|
return t && t in e ? e[t] : t ?? "embedded_custom_ui";
|
|
2454
2534
|
}
|
|
2455
|
-
function
|
|
2535
|
+
function Pn(t) {
|
|
2456
2536
|
return t === "pluno" ? "scheduled_continuation" : t ?? "user";
|
|
2457
2537
|
}
|
|
2458
|
-
function
|
|
2538
|
+
function Un(t, e = location.origin) {
|
|
2459
2539
|
return /origin (?:is not allowed|does not match browser origin)/i.test(t) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
|
|
2460
2540
|
}
|
|
2461
|
-
function
|
|
2541
|
+
function Dn(t) {
|
|
2462
2542
|
const e = new URL("/api/product-agent/embed/ws", t);
|
|
2463
2543
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
2464
2544
|
}
|
|
2465
|
-
function
|
|
2466
|
-
const t =
|
|
2545
|
+
function _() {
|
|
2546
|
+
const t = Ft();
|
|
2467
2547
|
return {
|
|
2468
2548
|
url: location.href,
|
|
2469
2549
|
title: document.title,
|
|
@@ -2471,19 +2551,19 @@ function k() {
|
|
|
2471
2551
|
...t ? { plunoProductAgentUi: t } : {}
|
|
2472
2552
|
};
|
|
2473
2553
|
}
|
|
2474
|
-
function
|
|
2554
|
+
function vn() {
|
|
2475
2555
|
return {
|
|
2476
2556
|
pageUrl: location.href,
|
|
2477
2557
|
pageTitle: document.title,
|
|
2478
|
-
htmlContent:
|
|
2558
|
+
htmlContent: et()
|
|
2479
2559
|
};
|
|
2480
2560
|
}
|
|
2481
|
-
function
|
|
2482
|
-
return pe.add(t),
|
|
2483
|
-
pe.delete(t), pe.size === 0 && (
|
|
2561
|
+
function On(t) {
|
|
2562
|
+
return pe.add(t), oe || (oe = Ln()), () => {
|
|
2563
|
+
pe.delete(t), pe.size === 0 && (oe?.(), oe = null);
|
|
2484
2564
|
};
|
|
2485
2565
|
}
|
|
2486
|
-
function
|
|
2566
|
+
function Ln() {
|
|
2487
2567
|
const t = () => {
|
|
2488
2568
|
for (const i of Array.from(pe))
|
|
2489
2569
|
i();
|
|
@@ -2498,38 +2578,38 @@ function vn() {
|
|
|
2498
2578
|
window.history.pushState === n && (window.history.pushState = e), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", t), window.removeEventListener("hashchange", t);
|
|
2499
2579
|
};
|
|
2500
2580
|
}
|
|
2501
|
-
function
|
|
2502
|
-
return
|
|
2581
|
+
function le() {
|
|
2582
|
+
return Ft()?.surface === "browser_extension_sdk_preview";
|
|
2503
2583
|
}
|
|
2504
|
-
function
|
|
2584
|
+
function et() {
|
|
2505
2585
|
if (!document.body)
|
|
2506
2586
|
return "";
|
|
2507
|
-
const t = [], e = [], s = (d,
|
|
2508
|
-
const I =
|
|
2587
|
+
const t = [], e = [], s = (d, p) => {
|
|
2588
|
+
const I = G(p);
|
|
2509
2589
|
!I || e.includes(I) || (t.push([d, I]), e.push(I));
|
|
2510
2590
|
};
|
|
2511
2591
|
s("Selected text", window.getSelection()?.toString() ?? "");
|
|
2512
2592
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", r = Array.from(document.querySelectorAll(n)).filter(
|
|
2513
|
-
(d) =>
|
|
2593
|
+
(d) => Ht(d) && !d.parentElement?.closest(n)
|
|
2514
2594
|
);
|
|
2515
2595
|
for (const d of r.slice(0, 3))
|
|
2516
|
-
s("Active overlay",
|
|
2517
|
-
const i = Nn(), o = i ?
|
|
2518
|
-
s("Main page content", o), s("Additional visible page text",
|
|
2519
|
-
const a = t.map(([d,
|
|
2520
|
-
${
|
|
2596
|
+
s("Active overlay", Oe(te(d), e));
|
|
2597
|
+
const i = Nn(), o = i ? Oe(te(i), e) : "";
|
|
2598
|
+
s("Main page content", o), s("Additional visible page text", Oe(te(document.body), e));
|
|
2599
|
+
const a = t.map(([d, p]) => `${d}:
|
|
2600
|
+
${p}`).join(`
|
|
2521
2601
|
|
|
2522
|
-
`).trim().slice(0, 12e3), l =
|
|
2523
|
-
`,
|
|
2602
|
+
`).trim().slice(0, 12e3), l = qn(r, i).trim(), c = `Simplified DOM outline:
|
|
2603
|
+
`, h = `
|
|
2524
2604
|
|
|
2525
2605
|
Visible page text:
|
|
2526
|
-
`, g = 12e3 - c.length -
|
|
2527
|
-
return `${c}${
|
|
2606
|
+
`, g = 12e3 - c.length - h.length, T = Math.min(a.length, 7900), f = l.slice(0, g - T), u = a.slice(0, g - f.length);
|
|
2607
|
+
return `${c}${f}${h}${u}`;
|
|
2528
2608
|
}
|
|
2529
|
-
function
|
|
2609
|
+
function te(t) {
|
|
2530
2610
|
return t.innerText ?? t.textContent ?? "";
|
|
2531
2611
|
}
|
|
2532
|
-
function
|
|
2612
|
+
function G(t) {
|
|
2533
2613
|
return (t ?? "").replace(/\u00a0/g, " ").replace(/\r\n?/g, `
|
|
2534
2614
|
`).split(`
|
|
2535
2615
|
`).map((e) => e.replace(/[ \t]+/g, " ").trim()).join(`
|
|
@@ -2537,20 +2617,20 @@ function z(t) {
|
|
|
2537
2617
|
|
|
2538
2618
|
`).trim();
|
|
2539
2619
|
}
|
|
2540
|
-
function
|
|
2541
|
-
let s =
|
|
2620
|
+
function Oe(t, e) {
|
|
2621
|
+
let s = G(t);
|
|
2542
2622
|
for (const n of e)
|
|
2543
2623
|
s = s.replace(n, "");
|
|
2544
|
-
return
|
|
2624
|
+
return G(s);
|
|
2545
2625
|
}
|
|
2546
|
-
function
|
|
2626
|
+
function Ht(t) {
|
|
2547
2627
|
const e = window.getComputedStyle(t);
|
|
2548
2628
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
2549
2629
|
}
|
|
2550
2630
|
function Nn() {
|
|
2551
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
2631
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ht).sort((t, e) => te(e).length - te(t).length)[0] ?? null;
|
|
2552
2632
|
}
|
|
2553
|
-
function
|
|
2633
|
+
function qn(t, e) {
|
|
2554
2634
|
const s = /* @__PURE__ */ new Set([
|
|
2555
2635
|
"main",
|
|
2556
2636
|
"nav",
|
|
@@ -2630,92 +2710,92 @@ function On(t, e) {
|
|
|
2630
2710
|
"data-test",
|
|
2631
2711
|
"data-qa",
|
|
2632
2712
|
"data-cy"
|
|
2633
|
-
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements:
|
|
2713
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: h, priorityTargets: g } = xn(), T = new Set(t);
|
|
2634
2714
|
e && T.add(e);
|
|
2635
|
-
let
|
|
2715
|
+
let f = 0;
|
|
2636
2716
|
const u = (m) => {
|
|
2637
|
-
const
|
|
2638
|
-
return
|
|
2717
|
+
const C = m.getAttribute("role");
|
|
2718
|
+
return C && !o.has(C) ? C : "";
|
|
2639
2719
|
}, d = (m) => {
|
|
2640
|
-
const
|
|
2641
|
-
return `${m.tagName.toLowerCase()}|${u(m)}|${
|
|
2642
|
-
},
|
|
2643
|
-
const
|
|
2644
|
-
const
|
|
2645
|
-
if (
|
|
2720
|
+
const C = m.getAttribute("data-testid") || m.getAttribute("data-test") || m.getAttribute("data-qa") || m.getAttribute("data-cy") || "";
|
|
2721
|
+
return `${m.tagName.toLowerCase()}|${u(m)}|${C}`;
|
|
2722
|
+
}, p = (m, C, B) => {
|
|
2723
|
+
const k = (M, W) => {
|
|
2724
|
+
const b = M.tagName.toLowerCase(), J = window.getComputedStyle(M), O = h.has(M);
|
|
2725
|
+
if (f >= 1e3 && !O || B.has(M) || i.has(b) || M.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || J.display === "none" || J.visibility === "hidden")
|
|
2646
2726
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
2647
|
-
|
|
2648
|
-
const
|
|
2649
|
-
for (const y of
|
|
2727
|
+
f += 1;
|
|
2728
|
+
const E = u(M), D = jt(M), cs = a.has(E) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(b) || b === "a" && M.hasAttribute("href"), Se = Array.from(M.children).filter((y) => y instanceof HTMLElement), re = /* @__PURE__ */ new Map();
|
|
2729
|
+
for (const y of Se) {
|
|
2650
2730
|
const A = d(y);
|
|
2651
|
-
|
|
2731
|
+
re.set(A, (re.get(A) ?? 0) + 1);
|
|
2652
2732
|
}
|
|
2653
2733
|
const we = /* @__PURE__ */ new Map(), rt = /* @__PURE__ */ new Map();
|
|
2654
|
-
for (const y of
|
|
2655
|
-
const A = d(y),
|
|
2656
|
-
rt.set(A,
|
|
2734
|
+
for (const y of Se) {
|
|
2735
|
+
const A = d(y), H = rt.get(A) ?? 0;
|
|
2736
|
+
rt.set(A, H + 1), (re.get(A) ?? 0) > 8 && H >= 6 && !h.has(y) && we.set(A, (we.get(A) ?? 0) + 1);
|
|
2657
2737
|
}
|
|
2658
|
-
const it = /* @__PURE__ */ new Map(), ot = /* @__PURE__ */ new Set(),
|
|
2659
|
-
for (const y of
|
|
2660
|
-
const A = d(y),
|
|
2661
|
-
if (it.set(A, ut + 1),
|
|
2662
|
-
ot.has(A) || (
|
|
2738
|
+
const it = /* @__PURE__ */ new Map(), ot = /* @__PURE__ */ new Set(), Me = [], at = [];
|
|
2739
|
+
for (const y of Se) {
|
|
2740
|
+
const A = d(y), H = re.get(A) ?? 0, ut = it.get(A) ?? 0;
|
|
2741
|
+
if (it.set(A, ut + 1), H > 8 && ut >= 6 && !h.has(y)) {
|
|
2742
|
+
ot.has(A) || (Me.push([`… ${we.get(A) ?? 0} similar siblings omitted`]), ot.add(A));
|
|
2663
2743
|
continue;
|
|
2664
2744
|
}
|
|
2665
|
-
const dt =
|
|
2666
|
-
at.push(dt),
|
|
2745
|
+
const dt = k(y, W);
|
|
2746
|
+
at.push(dt), Me.push(dt.lines);
|
|
2667
2747
|
}
|
|
2668
|
-
const
|
|
2748
|
+
const Ae = [];
|
|
2669
2749
|
if (M.shadowRoot)
|
|
2670
2750
|
for (const y of Array.from(M.shadowRoot.children))
|
|
2671
|
-
y instanceof HTMLElement &&
|
|
2672
|
-
const
|
|
2673
|
-
[
|
|
2674
|
-
).slice(0, 180),
|
|
2675
|
-
if (
|
|
2676
|
-
const y =
|
|
2677
|
-
|
|
2751
|
+
y instanceof HTMLElement && Ae.push(k(y, W + 1));
|
|
2752
|
+
const ie = [...at, ...Ae], Re = D.length > 0 || cs || ie.some((y) => y.hasUsefulContent), lt = G(
|
|
2753
|
+
[D, ...ie.map((y) => y.textPreview)].filter(Boolean).join(" ")
|
|
2754
|
+
).slice(0, 180), us = M.hasAttribute("contenteditable") && (D.length > 0 || !M.querySelector("[contenteditable]")), ct = c.some((y) => M.hasAttribute(y)) || !!E || us, Ee = (M.getClientRects().length > 0 || J.display === "contents") && (s.has(b) || ct || O) && (Re || O) && (!r.has(b) || Re || ct || O), Ce = Ee ? 1 : 0, Y = [];
|
|
2755
|
+
if (Ee) {
|
|
2756
|
+
const y = ie.some((H) => H.containsTextElement), A = n.has(b) && !y ? lt : D;
|
|
2757
|
+
Y.push($t(M, l, o, A.slice(0, 180)));
|
|
2678
2758
|
}
|
|
2679
|
-
for (const y of
|
|
2680
|
-
|
|
2681
|
-
const
|
|
2682
|
-
if (
|
|
2683
|
-
const y =
|
|
2684
|
-
|
|
2685
|
-
const A =
|
|
2686
|
-
if (
|
|
2687
|
-
const
|
|
2688
|
-
|
|
2759
|
+
for (const y of Me)
|
|
2760
|
+
Y.push(...ce(y, Ce));
|
|
2761
|
+
const be = Ae.flatMap((y) => y.lines);
|
|
2762
|
+
if (be.length > 0) {
|
|
2763
|
+
const y = be.slice(0, 20);
|
|
2764
|
+
be.length > y.length && y.push("… shadow DOM omitted");
|
|
2765
|
+
const A = b.includes("tooltip") || b.includes("popper") || b.includes("loader");
|
|
2766
|
+
if (W < 2 && !A) {
|
|
2767
|
+
const H = Ee ? "#shadow-root" : `${b} #shadow-root`;
|
|
2768
|
+
Y.push(...ce([H, ...ce(y, 1)], Ce));
|
|
2689
2769
|
} else
|
|
2690
|
-
|
|
2770
|
+
Y.push(...ce(y, Ce));
|
|
2691
2771
|
}
|
|
2692
2772
|
return {
|
|
2693
|
-
lines:
|
|
2694
|
-
hasUsefulContent:
|
|
2773
|
+
lines: Y,
|
|
2774
|
+
hasUsefulContent: Re,
|
|
2695
2775
|
textPreview: lt,
|
|
2696
|
-
containsTextElement: n.has(
|
|
2776
|
+
containsTextElement: n.has(b) || ie.some((y) => y.containsTextElement)
|
|
2697
2777
|
};
|
|
2698
2778
|
};
|
|
2699
|
-
return [`--- ${
|
|
2779
|
+
return [`--- ${C} ---`, ...k(m, 0).lines].join(`
|
|
2700
2780
|
`);
|
|
2701
|
-
}, I = [],
|
|
2702
|
-
|
|
2703
|
-
${JSON.stringify(
|
|
2781
|
+
}, I = [], S = G(window.getSelection()?.toString() ?? "");
|
|
2782
|
+
S && I.push(`--- selected text ---
|
|
2783
|
+
${JSON.stringify(S)}`), g.length > 0 && I.push(Bn(g, s, l, o));
|
|
2704
2784
|
for (const m of t.slice(0, 3))
|
|
2705
|
-
I.push(
|
|
2706
|
-
if (e && I.push(
|
|
2785
|
+
I.push(p(m, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
2786
|
+
if (e && I.push(p(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
2707
2787
|
const m = e || t.length ? "other visible DOM" : "visible DOM";
|
|
2708
|
-
I.push(
|
|
2788
|
+
I.push(p(document.body, m, T));
|
|
2709
2789
|
}
|
|
2710
2790
|
return I.join(`
|
|
2711
2791
|
|
|
2712
2792
|
`);
|
|
2713
2793
|
}
|
|
2714
|
-
function
|
|
2794
|
+
function $t(t, e, s, n) {
|
|
2715
2795
|
const r = t.tagName.toLowerCase();
|
|
2716
2796
|
let i = r;
|
|
2717
2797
|
const o = t.getAttribute("id");
|
|
2718
|
-
o &&
|
|
2798
|
+
o && Wn(o) && (i += `#${o}`);
|
|
2719
2799
|
for (const a of e) {
|
|
2720
2800
|
const l = t.getAttribute(a);
|
|
2721
2801
|
l && l.length <= 160 && (a !== "role" || !s.has(l)) && (i += `[${a}=${JSON.stringify(l)}]`);
|
|
@@ -2735,8 +2815,8 @@ function xn() {
|
|
|
2735
2815
|
const c = window.getComputedStyle(a);
|
|
2736
2816
|
if (c.display === "none" || c.visibility === "hidden")
|
|
2737
2817
|
return;
|
|
2738
|
-
const
|
|
2739
|
-
|
|
2818
|
+
const h = e.get(a) ?? /* @__PURE__ */ new Set();
|
|
2819
|
+
h.add(l), e.set(a, h);
|
|
2740
2820
|
let g = a;
|
|
2741
2821
|
for (; g; ) {
|
|
2742
2822
|
t.add(g);
|
|
@@ -2760,9 +2840,9 @@ function xn() {
|
|
|
2760
2840
|
], o = [document];
|
|
2761
2841
|
for (let a = 0; a < o.length; a += 1) {
|
|
2762
2842
|
const l = o[a];
|
|
2763
|
-
for (const [c,
|
|
2843
|
+
for (const [c, h] of i)
|
|
2764
2844
|
for (const g of Array.from(l.querySelectorAll(c)))
|
|
2765
|
-
s(g,
|
|
2845
|
+
s(g, h);
|
|
2766
2846
|
for (const c of Array.from(l.querySelectorAll("*")))
|
|
2767
2847
|
c.shadowRoot && o.push(c.shadowRoot);
|
|
2768
2848
|
}
|
|
@@ -2771,22 +2851,22 @@ function xn() {
|
|
|
2771
2851
|
priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
|
|
2772
2852
|
};
|
|
2773
2853
|
}
|
|
2774
|
-
function
|
|
2854
|
+
function Bn(t, e, s, n) {
|
|
2775
2855
|
const r = ["--- active/current elements ---"];
|
|
2776
2856
|
for (const i of t) {
|
|
2777
2857
|
const o = [];
|
|
2778
2858
|
let a = i.element;
|
|
2779
2859
|
for (; a; ) {
|
|
2780
|
-
const
|
|
2781
|
-
(a === i.element || e.has(
|
|
2860
|
+
const h = a.tagName.toLowerCase();
|
|
2861
|
+
(a === i.element || e.has(h) || a.hasAttribute("id") || a.hasAttribute("role") || a.hasAttribute("aria-label")) && o.unshift(a);
|
|
2782
2862
|
const g = a.getRootNode();
|
|
2783
2863
|
a = a.parentElement ?? (g instanceof ShadowRoot && g.host instanceof HTMLElement ? g.host : null);
|
|
2784
2864
|
}
|
|
2785
|
-
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((
|
|
2786
|
-
|
|
2865
|
+
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((h, g) => $t(
|
|
2866
|
+
h,
|
|
2787
2867
|
s,
|
|
2788
2868
|
n,
|
|
2789
|
-
g === l.length - 1 ?
|
|
2869
|
+
g === l.length - 1 ? jt(h).slice(0, 180) : ""
|
|
2790
2870
|
));
|
|
2791
2871
|
o.length > l.length && c.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${c.join(" > ")}`);
|
|
2792
2872
|
}
|
|
@@ -2796,23 +2876,23 @@ function Ln(t, e, s, n) {
|
|
|
2796
2876
|
function At(t) {
|
|
2797
2877
|
return t instanceof HTMLElement ? t : t?.parentElement instanceof HTMLElement ? t.parentElement : null;
|
|
2798
2878
|
}
|
|
2799
|
-
function
|
|
2879
|
+
function ce(t, e) {
|
|
2800
2880
|
if (e === 0)
|
|
2801
2881
|
return t;
|
|
2802
2882
|
const s = " ".repeat(e);
|
|
2803
2883
|
return t.map((n) => `${s}${n}`);
|
|
2804
2884
|
}
|
|
2805
|
-
function
|
|
2806
|
-
return
|
|
2885
|
+
function jt(t) {
|
|
2886
|
+
return G(
|
|
2807
2887
|
Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
2808
2888
|
);
|
|
2809
2889
|
}
|
|
2810
|
-
function
|
|
2890
|
+
function Wn(t) {
|
|
2811
2891
|
return t.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(t) && !/[a-f0-9]{12,}/i.test(t) && !/:r[0-9a-z]+:/i.test(t);
|
|
2812
2892
|
}
|
|
2813
|
-
function
|
|
2814
|
-
const t = document.querySelector(
|
|
2815
|
-
if (!(t ?? document.querySelector(
|
|
2893
|
+
function Ft() {
|
|
2894
|
+
const t = document.querySelector(ht);
|
|
2895
|
+
if (!(t ?? document.querySelector(We)))
|
|
2816
2896
|
return;
|
|
2817
2897
|
const s = t ? "browser_extension_sdk_preview" : "embedded_widget";
|
|
2818
2898
|
return {
|
|
@@ -2821,28 +2901,28 @@ function jt() {
|
|
|
2821
2901
|
selectors: [
|
|
2822
2902
|
{
|
|
2823
2903
|
name: "widget_host",
|
|
2824
|
-
selector: s === "browser_extension_sdk_preview" ?
|
|
2904
|
+
selector: s === "browser_extension_sdk_preview" ? ht : We,
|
|
2825
2905
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
2826
2906
|
},
|
|
2827
2907
|
{
|
|
2828
2908
|
name: "widget_root",
|
|
2829
|
-
selector:
|
|
2909
|
+
selector: Os,
|
|
2830
2910
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
2831
2911
|
},
|
|
2832
2912
|
{
|
|
2833
2913
|
name: "widget_panel",
|
|
2834
|
-
selector:
|
|
2914
|
+
selector: Ls,
|
|
2835
2915
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
2836
2916
|
},
|
|
2837
2917
|
{
|
|
2838
2918
|
name: "widget_timeline",
|
|
2839
|
-
selector:
|
|
2919
|
+
selector: Ns,
|
|
2840
2920
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
2841
2921
|
}
|
|
2842
2922
|
]
|
|
2843
2923
|
};
|
|
2844
2924
|
}
|
|
2845
|
-
function
|
|
2925
|
+
function Hn(t) {
|
|
2846
2926
|
try {
|
|
2847
2927
|
const e = JSON.parse(t);
|
|
2848
2928
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -2850,7 +2930,7 @@ function qn(t) {
|
|
|
2850
2930
|
return { type: "error", message: "Invalid server event" };
|
|
2851
2931
|
}
|
|
2852
2932
|
}
|
|
2853
|
-
function
|
|
2933
|
+
function $n(t) {
|
|
2854
2934
|
if (typeof t != "string")
|
|
2855
2935
|
return null;
|
|
2856
2936
|
try {
|
|
@@ -2866,10 +2946,10 @@ function Rt(t, e) {
|
|
|
2866
2946
|
const s = t[e];
|
|
2867
2947
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
2868
2948
|
}
|
|
2869
|
-
function
|
|
2949
|
+
function jn(t) {
|
|
2870
2950
|
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
2871
2951
|
}
|
|
2872
|
-
function
|
|
2952
|
+
function Fn(t) {
|
|
2873
2953
|
if (!t || typeof t != "object")
|
|
2874
2954
|
return null;
|
|
2875
2955
|
const e = t, s = e.appearance, n = s && typeof s == "object" ? s : e, 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, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -2880,13 +2960,13 @@ function $n(t) {
|
|
|
2880
2960
|
...a !== null ? { scribbleStyle: a } : {}
|
|
2881
2961
|
};
|
|
2882
2962
|
}
|
|
2883
|
-
function
|
|
2963
|
+
function zn(t) {
|
|
2884
2964
|
if (!t || typeof t != "object")
|
|
2885
2965
|
return null;
|
|
2886
2966
|
const e = t.javascript;
|
|
2887
2967
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
2888
2968
|
}
|
|
2889
|
-
function
|
|
2969
|
+
function Kn(t, e) {
|
|
2890
2970
|
return e ? t && typeof t == "object" ? {
|
|
2891
2971
|
...t,
|
|
2892
2972
|
helperError: e
|
|
@@ -2896,23 +2976,23 @@ function Fn(t, e) {
|
|
|
2896
2976
|
helperError: e
|
|
2897
2977
|
} : t;
|
|
2898
2978
|
}
|
|
2899
|
-
function
|
|
2979
|
+
function Gn(t) {
|
|
2900
2980
|
if (!t || typeof t != "object")
|
|
2901
2981
|
return t;
|
|
2902
2982
|
const e = t;
|
|
2903
2983
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : t;
|
|
2904
2984
|
}
|
|
2905
|
-
function
|
|
2985
|
+
function Xn() {
|
|
2906
2986
|
const t = "pluno.productAgent.clientId", e = window.localStorage.getItem(t);
|
|
2907
2987
|
if (e)
|
|
2908
2988
|
return e;
|
|
2909
2989
|
const s = crypto.randomUUID();
|
|
2910
2990
|
return window.localStorage.setItem(t, s), s;
|
|
2911
2991
|
}
|
|
2912
|
-
function
|
|
2992
|
+
function $() {
|
|
2913
2993
|
return crypto.randomUUID();
|
|
2914
2994
|
}
|
|
2915
|
-
function
|
|
2995
|
+
function Vn(t) {
|
|
2916
2996
|
if (!t || typeof t != "object")
|
|
2917
2997
|
return null;
|
|
2918
2998
|
const e = t, s = typeof e.id == "string" ? e.id : null;
|
|
@@ -2923,22 +3003,22 @@ function Gn(t) {
|
|
|
2923
3003
|
avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
|
|
2924
3004
|
} : null;
|
|
2925
3005
|
}
|
|
2926
|
-
function
|
|
2927
|
-
return Array.isArray(t) ?
|
|
2928
|
-
t.map((s) =>
|
|
3006
|
+
function Et(t, e) {
|
|
3007
|
+
return Array.isArray(t) ? Ge(
|
|
3008
|
+
t.map((s) => zt(s, e)).filter((s) => s !== null)
|
|
2929
3009
|
) : [];
|
|
2930
3010
|
}
|
|
2931
|
-
function
|
|
3011
|
+
function Jn(t) {
|
|
2932
3012
|
return Array.isArray(t) ? t.flatMap((e) => {
|
|
2933
3013
|
if (!e || typeof e != "object")
|
|
2934
3014
|
return [];
|
|
2935
|
-
const s = e, n =
|
|
3015
|
+
const s = e, n = w(s, "id"), r = w(s, "createdAt"), i = w(s, "updatedAt"), o = w(s, "lastActiveAt");
|
|
2936
3016
|
return !n || !r || !i || !o ? [] : [
|
|
2937
3017
|
{
|
|
2938
3018
|
id: n,
|
|
2939
|
-
title:
|
|
2940
|
-
customTitle:
|
|
2941
|
-
firstUserMessage:
|
|
3019
|
+
title: w(s, "title"),
|
|
3020
|
+
customTitle: w(s, "customTitle"),
|
|
3021
|
+
firstUserMessage: w(s, "firstUserMessage"),
|
|
2942
3022
|
currentPage: s.currentPage ?? null,
|
|
2943
3023
|
createdAt: r,
|
|
2944
3024
|
updatedAt: i,
|
|
@@ -2949,29 +3029,29 @@ function Vn(t) {
|
|
|
2949
3029
|
];
|
|
2950
3030
|
}) : [];
|
|
2951
3031
|
}
|
|
2952
|
-
function
|
|
3032
|
+
function zt(t, e) {
|
|
2953
3033
|
if (!t || typeof t != "object")
|
|
2954
3034
|
return null;
|
|
2955
3035
|
const s = t, n = s.data;
|
|
2956
3036
|
if (!n || typeof n != "object")
|
|
2957
3037
|
return null;
|
|
2958
3038
|
const r = n;
|
|
2959
|
-
if (r.hiddenFromTranscript === !0 ||
|
|
3039
|
+
if (r.hiddenFromTranscript === !0 || Ss(r) || r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
2960
3040
|
return null;
|
|
2961
3041
|
if (r.type === "message") {
|
|
2962
3042
|
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
|
|
2963
3043
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2964
3044
|
role: i,
|
|
2965
3045
|
...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
|
|
2966
|
-
content:
|
|
2967
|
-
|
|
3046
|
+
content: Is(
|
|
3047
|
+
nr(r.content),
|
|
2968
3048
|
e
|
|
2969
3049
|
),
|
|
2970
3050
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2971
|
-
...
|
|
2972
|
-
respondsToUserMessageId:
|
|
3051
|
+
...L(r) !== null ? { causalSequence: L(r) } : {},
|
|
3052
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2973
3053
|
...U(r) ? { runId: U(r) } : {},
|
|
2974
|
-
attachments:
|
|
3054
|
+
attachments: Qt(r.attachments, e)
|
|
2975
3055
|
};
|
|
2976
3056
|
return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
2977
3057
|
value: r.id,
|
|
@@ -2982,54 +3062,54 @@ function Ft(t, e) {
|
|
|
2982
3062
|
}), o;
|
|
2983
3063
|
}
|
|
2984
3064
|
if (r.type === "function_call_output") {
|
|
2985
|
-
const i =
|
|
3065
|
+
const i = Ds(r.output);
|
|
2986
3066
|
if (i)
|
|
2987
3067
|
return {
|
|
2988
3068
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2989
3069
|
role: "tool",
|
|
2990
3070
|
content: "",
|
|
2991
3071
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2992
|
-
respondsToUserMessageId:
|
|
3072
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2993
3073
|
...U(r) ? { runId: U(r) } : {},
|
|
2994
3074
|
dataType: "scheduled_check_in",
|
|
2995
|
-
toolName:
|
|
2996
|
-
callId:
|
|
3075
|
+
toolName: Nt,
|
|
3076
|
+
callId: Le(r) ?? void 0,
|
|
2997
3077
|
scheduledCheckInAt: i
|
|
2998
3078
|
};
|
|
2999
|
-
const o =
|
|
3079
|
+
const o = Qn(r.output);
|
|
3000
3080
|
return o ? {
|
|
3001
3081
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3002
3082
|
role: "tool",
|
|
3003
3083
|
content: `Connect ${o.appName} to continue`,
|
|
3004
3084
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3005
|
-
...
|
|
3006
|
-
respondsToUserMessageId:
|
|
3085
|
+
...L(r) !== null ? { causalSequence: L(r) } : {},
|
|
3086
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
3007
3087
|
...U(r) ? { runId: U(r) } : {},
|
|
3008
3088
|
dataType: "function_call_output",
|
|
3009
3089
|
toolName: "authenticate_pipedream_app",
|
|
3010
|
-
callId:
|
|
3090
|
+
callId: Le(r) ?? void 0,
|
|
3011
3091
|
integrationAuthRequest: o
|
|
3012
3092
|
} : null;
|
|
3013
3093
|
}
|
|
3014
3094
|
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
|
|
3015
3095
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3016
3096
|
role: "tool",
|
|
3017
|
-
content: r.type === "mcp_call" ?
|
|
3097
|
+
content: r.type === "mcp_call" ? Yn(r) : er(r),
|
|
3018
3098
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3019
|
-
...
|
|
3020
|
-
respondsToUserMessageId:
|
|
3099
|
+
...L(r) !== null ? { causalSequence: L(r) } : {},
|
|
3100
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
3021
3101
|
...U(r) ? { runId: U(r) } : {},
|
|
3022
3102
|
dataType: String(r.type),
|
|
3023
3103
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
3024
|
-
callId:
|
|
3104
|
+
callId: Le(r) ?? void 0,
|
|
3025
3105
|
loading: r.localExecutionStatus === "queued" || r.localExecutionStatus === "running" ? !0 : typeof r.localExecutionStatus == "string" ? !1 : void 0
|
|
3026
3106
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
3027
3107
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3028
3108
|
role: "system",
|
|
3029
|
-
content:
|
|
3109
|
+
content: Zn(r),
|
|
3030
3110
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3031
|
-
...
|
|
3032
|
-
respondsToUserMessageId:
|
|
3111
|
+
...L(r) !== null ? { causalSequence: L(r) } : {},
|
|
3112
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
3033
3113
|
...U(r) ? { runId: U(r) } : {},
|
|
3034
3114
|
dataType: String(r.type),
|
|
3035
3115
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
@@ -3038,11 +3118,11 @@ function Ft(t, e) {
|
|
|
3038
3118
|
...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
|
|
3039
3119
|
} : null;
|
|
3040
3120
|
}
|
|
3041
|
-
function
|
|
3121
|
+
function Yn(t) {
|
|
3042
3122
|
const s = (typeof t.server_label == "string" ? t.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
|
|
3043
3123
|
return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
|
|
3044
3124
|
}
|
|
3045
|
-
function
|
|
3125
|
+
function Qn(t) {
|
|
3046
3126
|
if (typeof t != "string")
|
|
3047
3127
|
return null;
|
|
3048
3128
|
try {
|
|
@@ -3059,10 +3139,10 @@ function Yn(t) {
|
|
|
3059
3139
|
return null;
|
|
3060
3140
|
}
|
|
3061
3141
|
}
|
|
3062
|
-
function
|
|
3142
|
+
function Zn(t) {
|
|
3063
3143
|
return t.type === "run_status" && t.status === "stopped" ? "Run stopped by user" : t.type === "run_status" && t.status === "steered" ? "Steered" : typeof t.message == "string" && t.message.trim().length > 0 ? t.message.replace(/Product Agent/g, "Pluno") : t.type === "run_status" && t.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : "Pluno run status changed.";
|
|
3064
3144
|
}
|
|
3065
|
-
function
|
|
3145
|
+
function er(t) {
|
|
3066
3146
|
if (t.type === "web_search_call") {
|
|
3067
3147
|
const e = t.action;
|
|
3068
3148
|
if (e && typeof e == "object") {
|
|
@@ -3074,26 +3154,26 @@ function Zn(t) {
|
|
|
3074
3154
|
}
|
|
3075
3155
|
return "🔎 Searching the web";
|
|
3076
3156
|
}
|
|
3077
|
-
return
|
|
3157
|
+
return tr(t);
|
|
3078
3158
|
}
|
|
3079
|
-
function
|
|
3159
|
+
function tr(t) {
|
|
3080
3160
|
if (typeof t.summary == "string" && t.summary.trim().length > 0)
|
|
3081
|
-
return
|
|
3161
|
+
return K(t.summary);
|
|
3082
3162
|
if (typeof t.arguments == "string")
|
|
3083
3163
|
try {
|
|
3084
3164
|
const e = JSON.parse(t.arguments);
|
|
3085
3165
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
3086
|
-
return
|
|
3166
|
+
return K(e.summary);
|
|
3087
3167
|
} catch {
|
|
3088
|
-
return typeof t.name == "string" && t.name.trim().length > 0 ?
|
|
3168
|
+
return typeof t.name == "string" && t.name.trim().length > 0 ? K(t.name) : "🛠️ Run tool";
|
|
3089
3169
|
}
|
|
3090
|
-
return typeof t.name == "string" && t.name.trim().length > 0 ?
|
|
3170
|
+
return typeof t.name == "string" && t.name.trim().length > 0 ? K(t.name) : "🛠️ Run tool";
|
|
3091
3171
|
}
|
|
3092
|
-
function
|
|
3172
|
+
function K(t) {
|
|
3093
3173
|
const e = t.trim() || "Run tool", s = e.codePointAt(0) ?? 0;
|
|
3094
3174
|
return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? e : `🛠️ ${e}`;
|
|
3095
3175
|
}
|
|
3096
|
-
function
|
|
3176
|
+
function sr(t) {
|
|
3097
3177
|
if (t == null)
|
|
3098
3178
|
return t;
|
|
3099
3179
|
if (typeof t != "object")
|
|
@@ -3108,14 +3188,14 @@ function tr(t) {
|
|
|
3108
3188
|
runId: typeof e.runId == "string" ? e.runId : null
|
|
3109
3189
|
};
|
|
3110
3190
|
}
|
|
3111
|
-
function
|
|
3191
|
+
function Le(t) {
|
|
3112
3192
|
const e = t.callId ?? t.call_id;
|
|
3113
3193
|
return typeof e == "string" && e ? e : null;
|
|
3114
3194
|
}
|
|
3115
|
-
function
|
|
3195
|
+
function L(t) {
|
|
3116
3196
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
3117
3197
|
}
|
|
3118
|
-
function
|
|
3198
|
+
function nr(t) {
|
|
3119
3199
|
return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => {
|
|
3120
3200
|
if (!e || typeof e != "object")
|
|
3121
3201
|
return "";
|
|
@@ -3123,31 +3203,31 @@ function sr(t) {
|
|
|
3123
3203
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
3124
3204
|
}).filter(Boolean).join("") : "";
|
|
3125
3205
|
}
|
|
3126
|
-
function
|
|
3127
|
-
const s =
|
|
3128
|
-
|
|
3129
|
-
|
|
3206
|
+
function $e(t, e) {
|
|
3207
|
+
const s = Gt(t, e), n = cr(
|
|
3208
|
+
rr(
|
|
3209
|
+
gr(t, e),
|
|
3130
3210
|
s
|
|
3131
3211
|
),
|
|
3132
3212
|
s
|
|
3133
3213
|
), r = n.findIndex((o) => o.id === s.id);
|
|
3134
3214
|
if (r === -1)
|
|
3135
|
-
return
|
|
3215
|
+
return Ge(
|
|
3136
3216
|
[...n, s]
|
|
3137
3217
|
);
|
|
3138
3218
|
const i = [...n];
|
|
3139
|
-
return i[r] = s,
|
|
3219
|
+
return i[r] = s, Ge(i);
|
|
3140
3220
|
}
|
|
3141
|
-
function
|
|
3221
|
+
function rr(t, e) {
|
|
3142
3222
|
const s = e.assistantDraftItemId;
|
|
3143
3223
|
return s ? t.map(
|
|
3144
3224
|
(n) => n.dataType === "assistant_draft" && n.id === s ? e : n
|
|
3145
3225
|
) : t;
|
|
3146
3226
|
}
|
|
3147
|
-
function
|
|
3227
|
+
function Ne(t, e, s) {
|
|
3148
3228
|
return e !== null ? t.respondsToUserMessageId === e : s !== null && t.runId === s;
|
|
3149
3229
|
}
|
|
3150
|
-
function
|
|
3230
|
+
function ir(t, e, s, n) {
|
|
3151
3231
|
if (s === null) return t;
|
|
3152
3232
|
let r = -1;
|
|
3153
3233
|
for (let o = t.length - 1; o >= 0; o -= 1) {
|
|
@@ -3164,12 +3244,12 @@ function rr(t, e, s, n) {
|
|
|
3164
3244
|
respondsToUserMessageId: s
|
|
3165
3245
|
}, i;
|
|
3166
3246
|
}
|
|
3167
|
-
function
|
|
3247
|
+
function or(t, e) {
|
|
3168
3248
|
const s = t.findIndex(
|
|
3169
3249
|
(r) => !r.id.startsWith("transient-activity:") && r.callId === e.callId
|
|
3170
3250
|
);
|
|
3171
3251
|
if (s === -1)
|
|
3172
|
-
return
|
|
3252
|
+
return $e(t, e);
|
|
3173
3253
|
const n = [...t];
|
|
3174
3254
|
return n[s] = {
|
|
3175
3255
|
...n[s],
|
|
@@ -3181,19 +3261,19 @@ function ir(t, e) {
|
|
|
3181
3261
|
...n[s].runId ? {} : { runId: e.runId }
|
|
3182
3262
|
}, n;
|
|
3183
3263
|
}
|
|
3184
|
-
function
|
|
3264
|
+
function ar(t, e, s) {
|
|
3185
3265
|
let n = !1;
|
|
3186
3266
|
const r = t.map((i) => i.callId !== e || i.loading === s ? i : (n = !0, { ...i, loading: s }));
|
|
3187
3267
|
return n ? r : t;
|
|
3188
3268
|
}
|
|
3189
|
-
function
|
|
3269
|
+
function lr(t) {
|
|
3190
3270
|
if (t.hiddenFromTranscript === !0)
|
|
3191
3271
|
return null;
|
|
3192
3272
|
const e = typeof t.callId == "string" ? t.callId : null, s = typeof t.toolName == "string" ? t.toolName : null;
|
|
3193
3273
|
return !e || !s ? null : {
|
|
3194
3274
|
id: `transient-activity:${e}`,
|
|
3195
3275
|
role: "tool",
|
|
3196
|
-
content:
|
|
3276
|
+
content: K(
|
|
3197
3277
|
typeof t.summary == "string" ? t.summary : "Running browser tool"
|
|
3198
3278
|
),
|
|
3199
3279
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3206,7 +3286,7 @@ function ar(t) {
|
|
|
3206
3286
|
loading: !0
|
|
3207
3287
|
};
|
|
3208
3288
|
}
|
|
3209
|
-
function
|
|
3289
|
+
function cr(t, e) {
|
|
3210
3290
|
if (e.id.startsWith("transient-activity:"))
|
|
3211
3291
|
return t;
|
|
3212
3292
|
const s = e.toolName === "tab_lifecycle";
|
|
@@ -3215,17 +3295,24 @@ function lr(t, e) {
|
|
|
3215
3295
|
const n = (i) => i.id === `transient-activity:${e.callId}` && i.callId === e.callId || s && i.id.startsWith("transient-activity:") && i.toolName === "browser_tabs" && !!i.runId && i.runId === e.runId, r = t.findIndex(n);
|
|
3216
3296
|
return r === -1 ? t : t.flatMap((i, o) => n(i) ? o === r ? [e] : [] : i.id === e.id ? [] : [i]);
|
|
3217
3297
|
}
|
|
3218
|
-
function
|
|
3298
|
+
function ur(t, e) {
|
|
3219
3299
|
return ws(
|
|
3220
3300
|
t,
|
|
3221
3301
|
e.map(
|
|
3222
|
-
(s) =>
|
|
3302
|
+
(s) => Gt(t, s)
|
|
3223
3303
|
),
|
|
3224
|
-
|
|
3304
|
+
Kt
|
|
3225
3305
|
);
|
|
3226
3306
|
}
|
|
3227
|
-
function
|
|
3228
|
-
const
|
|
3307
|
+
function dr(t, e, s) {
|
|
3308
|
+
const n = new Map(e.map((i) => [i.id, i]));
|
|
3309
|
+
return [
|
|
3310
|
+
...t.filter((i) => s.has(i.id)).map((i) => n.get(i.id) ?? i),
|
|
3311
|
+
...e.filter((i) => !s.has(i.id))
|
|
3312
|
+
];
|
|
3313
|
+
}
|
|
3314
|
+
function Kt(t) {
|
|
3315
|
+
const e = se(t) ?? void 0, s = t.assistantDraftItemId, n = [
|
|
3229
3316
|
...t.callId ? [`call:${t.callId}`] : [],
|
|
3230
3317
|
...t.runId && (t.toolName === "browser_tabs" || t.toolName === "tab_lifecycle") ? [`tab-lifecycle:${t.runId}`] : []
|
|
3231
3318
|
];
|
|
@@ -3236,52 +3323,52 @@ function zt(t) {
|
|
|
3236
3323
|
...n.length > 0 ? { activityKeys: n } : {},
|
|
3237
3324
|
...t.respondsToUserMessageId ? { respondsToUserMessageId: t.respondsToUserMessageId } : {},
|
|
3238
3325
|
...t.runId ? { runId: t.runId } : {},
|
|
3239
|
-
isOptimistic:
|
|
3326
|
+
isOptimistic: Ie(t),
|
|
3240
3327
|
isAssistantDraft: t.dataType === "assistant_draft",
|
|
3241
3328
|
isActivity: t.role === "tool" || t.phase === "commentary" || t.dataType === "assistant_draft",
|
|
3242
3329
|
isTransient: t.id.startsWith("transient-activity:") || t.dataType === "assistant_draft"
|
|
3243
3330
|
};
|
|
3244
3331
|
}
|
|
3245
|
-
function
|
|
3332
|
+
function Gt(t, e) {
|
|
3246
3333
|
if (e.role !== "user" || !e.attachments?.length)
|
|
3247
3334
|
return e;
|
|
3248
3335
|
const s = t.find(
|
|
3249
|
-
(r) => r.role === "user" && (r.id === e.id ||
|
|
3336
|
+
(r) => r.role === "user" && (r.id === e.id || Ie(r) && Xt(r, e))
|
|
3250
3337
|
);
|
|
3251
3338
|
if (!s?.attachments?.length)
|
|
3252
3339
|
return e;
|
|
3253
3340
|
const n = e.attachments.map((r) => {
|
|
3254
|
-
const i =
|
|
3255
|
-
return i ?
|
|
3341
|
+
const i = hr(s.attachments ?? [], r);
|
|
3342
|
+
return i ? pr(r, i) : r;
|
|
3256
3343
|
});
|
|
3257
3344
|
return { ...e, attachments: n };
|
|
3258
3345
|
}
|
|
3259
|
-
function
|
|
3346
|
+
function hr(t, e) {
|
|
3260
3347
|
return e.id ? t.find((s) => s.id === e.id) ?? null : null;
|
|
3261
3348
|
}
|
|
3262
|
-
function
|
|
3349
|
+
function pr(t, e) {
|
|
3263
3350
|
const { previewUrl: s } = e;
|
|
3264
3351
|
return s ? { ...t, previewUrl: s } : t;
|
|
3265
3352
|
}
|
|
3266
|
-
function
|
|
3353
|
+
function gr(t, e) {
|
|
3267
3354
|
if (e.role !== "user")
|
|
3268
3355
|
return t;
|
|
3269
3356
|
const s = t.findIndex(
|
|
3270
|
-
(r) =>
|
|
3357
|
+
(r) => Ie(r) && Xt(r, e)
|
|
3271
3358
|
);
|
|
3272
3359
|
if (s === -1)
|
|
3273
3360
|
return t;
|
|
3274
3361
|
const n = [...t];
|
|
3275
3362
|
return n.splice(s, 1), n;
|
|
3276
3363
|
}
|
|
3277
|
-
function
|
|
3278
|
-
const s =
|
|
3364
|
+
function Xt(t, e) {
|
|
3365
|
+
const s = se(t), n = se(e);
|
|
3279
3366
|
return s && n ? s === n : t.content === e.content;
|
|
3280
3367
|
}
|
|
3281
|
-
function
|
|
3368
|
+
function Ie(t) {
|
|
3282
3369
|
return t.role === "user" && (t.id.startsWith("local-") || t.id.startsWith("optimistic-user-message:"));
|
|
3283
3370
|
}
|
|
3284
|
-
function
|
|
3371
|
+
function se(t) {
|
|
3285
3372
|
const e = t.clientMessageId;
|
|
3286
3373
|
if (e)
|
|
3287
3374
|
return e;
|
|
@@ -3290,18 +3377,18 @@ function ee(t) {
|
|
|
3290
3377
|
);
|
|
3291
3378
|
return n ? t.id.slice(n.length) : null;
|
|
3292
3379
|
}
|
|
3293
|
-
function
|
|
3294
|
-
const e =
|
|
3380
|
+
function Ct(t) {
|
|
3381
|
+
const e = Vt(t);
|
|
3295
3382
|
if (e === null)
|
|
3296
3383
|
return !1;
|
|
3297
3384
|
const s = t[e].id, n = t.some(
|
|
3298
|
-
(r) => r.respondsToUserMessageId === s &&
|
|
3385
|
+
(r) => r.respondsToUserMessageId === s && je(r)
|
|
3299
3386
|
);
|
|
3300
3387
|
if (t.some((r) => r.respondsToUserMessageId === s))
|
|
3301
3388
|
return n;
|
|
3302
3389
|
for (let r = t.length - 1; r > e; r -= 1) {
|
|
3303
3390
|
const i = t[r];
|
|
3304
|
-
if (
|
|
3391
|
+
if (j(i))
|
|
3305
3392
|
return !0;
|
|
3306
3393
|
if (i.role === "system") {
|
|
3307
3394
|
if (i.dataType === "run_error")
|
|
@@ -3312,25 +3399,25 @@ function Et(t) {
|
|
|
3312
3399
|
}
|
|
3313
3400
|
return !1;
|
|
3314
3401
|
}
|
|
3315
|
-
function
|
|
3316
|
-
const e =
|
|
3402
|
+
function fr(t) {
|
|
3403
|
+
const e = Vt(t);
|
|
3317
3404
|
if (e === null)
|
|
3318
|
-
return t.some(
|
|
3405
|
+
return t.some(j);
|
|
3319
3406
|
const s = t[e].id;
|
|
3320
3407
|
return t.some((n) => n.respondsToUserMessageId === s) ? t.some(
|
|
3321
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
3322
|
-
) : t.slice(e + 1).some(
|
|
3408
|
+
(n) => n.respondsToUserMessageId === s && j(n)
|
|
3409
|
+
) : t.slice(e + 1).some(j);
|
|
3323
3410
|
}
|
|
3324
|
-
function
|
|
3411
|
+
function Vt(t) {
|
|
3325
3412
|
for (let e = t.length - 1; e >= 0; e -= 1)
|
|
3326
|
-
if (t[e].role === "user" && !
|
|
3413
|
+
if (t[e].role === "user" && !Ie(t[e]))
|
|
3327
3414
|
return e;
|
|
3328
3415
|
return null;
|
|
3329
3416
|
}
|
|
3330
|
-
function
|
|
3331
|
-
return
|
|
3417
|
+
function je(t) {
|
|
3418
|
+
return j(t) ? !0 : t.role !== "system" ? !1 : t.dataType === "run_error" ? !0 : t.dataType === "run_status" && t.loading !== !0;
|
|
3332
3419
|
}
|
|
3333
|
-
function
|
|
3420
|
+
function X(t) {
|
|
3334
3421
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
3335
3422
|
const s = t[e];
|
|
3336
3423
|
if (!s || typeof s != "object")
|
|
@@ -3344,8 +3431,8 @@ function K(t) {
|
|
|
3344
3431
|
}
|
|
3345
3432
|
return null;
|
|
3346
3433
|
}
|
|
3347
|
-
function
|
|
3348
|
-
const e =
|
|
3434
|
+
function mr(t) {
|
|
3435
|
+
const e = X(t);
|
|
3349
3436
|
if (e === null)
|
|
3350
3437
|
return null;
|
|
3351
3438
|
const n = P(t[e])?.page;
|
|
@@ -3360,14 +3447,14 @@ function P(t) {
|
|
|
3360
3447
|
const e = t.data;
|
|
3361
3448
|
return e && typeof e == "object" ? e : null;
|
|
3362
3449
|
}
|
|
3363
|
-
function
|
|
3450
|
+
function Fe(t) {
|
|
3364
3451
|
return t?.retryable !== !0 ? !1 : t.type === "run_error" ? !0 : t.type === "run_status" && t.status === "interrupted";
|
|
3365
3452
|
}
|
|
3366
|
-
function
|
|
3453
|
+
function bt(t) {
|
|
3367
3454
|
return t?.type === "run_status" && t.status === "interrupted" && t.reason === "backend_restart";
|
|
3368
3455
|
}
|
|
3369
|
-
function
|
|
3370
|
-
const s =
|
|
3456
|
+
function yr(t, e) {
|
|
3457
|
+
const s = X(e);
|
|
3371
3458
|
if (s === null)
|
|
3372
3459
|
return !1;
|
|
3373
3460
|
const n = e[s], r = n && typeof n == "object" ? n.id : null;
|
|
@@ -3375,11 +3462,11 @@ function fr(t, e) {
|
|
|
3375
3462
|
return !1;
|
|
3376
3463
|
const i = t.findIndex((o) => o.role === "user" && o.id === r);
|
|
3377
3464
|
return i === -1 ? !1 : t.some((o) => o.respondsToUserMessageId === r) ? t.some(
|
|
3378
|
-
(o) => o.respondsToUserMessageId === r &&
|
|
3379
|
-
) : t.slice(i + 1).some(
|
|
3465
|
+
(o) => o.respondsToUserMessageId === r && je(o)
|
|
3466
|
+
) : t.slice(i + 1).some(je);
|
|
3380
3467
|
}
|
|
3381
|
-
function
|
|
3382
|
-
const e =
|
|
3468
|
+
function ze(t) {
|
|
3469
|
+
const e = X(t);
|
|
3383
3470
|
if (e === null)
|
|
3384
3471
|
return null;
|
|
3385
3472
|
const s = t[e];
|
|
@@ -3391,8 +3478,8 @@ function Fe(t) {
|
|
|
3391
3478
|
const r = n.clientMessageId;
|
|
3392
3479
|
return typeof r == "string" ? r : null;
|
|
3393
3480
|
}
|
|
3394
|
-
function
|
|
3395
|
-
const e =
|
|
3481
|
+
function Ir(t) {
|
|
3482
|
+
const e = X(t);
|
|
3396
3483
|
if (e === null)
|
|
3397
3484
|
return null;
|
|
3398
3485
|
for (let s = t.length - 1; s > e; s -= 1) {
|
|
@@ -3406,22 +3493,22 @@ function mr(t) {
|
|
|
3406
3493
|
if (i.type === "message" && i.role === "assistant")
|
|
3407
3494
|
return null;
|
|
3408
3495
|
if (i.type === "run_error")
|
|
3409
|
-
return i.retryable !== !0 ? null :
|
|
3496
|
+
return i.retryable !== !0 ? null : Ke(t, i) ?? ze(t);
|
|
3410
3497
|
if (i.type === "run_status")
|
|
3411
|
-
return i.status === "interrupted" && i.retryable === !0 ?
|
|
3498
|
+
return i.status === "interrupted" && i.retryable === !0 ? Ke(t, i) ?? ze(t) : null;
|
|
3412
3499
|
}
|
|
3413
3500
|
return null;
|
|
3414
3501
|
}
|
|
3415
|
-
function
|
|
3502
|
+
function Ke(t, e) {
|
|
3416
3503
|
if (typeof e.clientMessageId == "string")
|
|
3417
3504
|
return e.clientMessageId;
|
|
3418
|
-
const s =
|
|
3505
|
+
const s = N(e);
|
|
3419
3506
|
if (!s)
|
|
3420
3507
|
return null;
|
|
3421
|
-
const n = t.find((i) =>
|
|
3508
|
+
const n = t.find((i) => w(i, "id") === s), r = P(n);
|
|
3422
3509
|
return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
|
|
3423
3510
|
}
|
|
3424
|
-
function
|
|
3511
|
+
function Tr(t, e) {
|
|
3425
3512
|
let s = 0;
|
|
3426
3513
|
for (const n of t) {
|
|
3427
3514
|
if (!n || typeof n != "object")
|
|
@@ -3434,73 +3521,73 @@ function yr(t, e) {
|
|
|
3434
3521
|
}
|
|
3435
3522
|
return s;
|
|
3436
3523
|
}
|
|
3437
|
-
function
|
|
3438
|
-
if (!e || !
|
|
3524
|
+
function _t(t, e, s, n, r) {
|
|
3525
|
+
if (!e || !Sr(t))
|
|
3439
3526
|
return !1;
|
|
3440
3527
|
const i = t;
|
|
3441
|
-
return !(
|
|
3528
|
+
return !(Fe(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? N(i) !== n : r !== null && U(i) !== r));
|
|
3442
3529
|
}
|
|
3443
|
-
function
|
|
3530
|
+
function Sr(t) {
|
|
3444
3531
|
if (!t || typeof t != "object")
|
|
3445
3532
|
return !1;
|
|
3446
3533
|
const e = t;
|
|
3447
3534
|
return e.type === "message" && e.role === "assistant" ? !0 : e.type === "run_error" ? e.stage !== "tool_execution" : e.type === "run_status" && (e.status === "stopped" || e.status === "interrupted" || e.status === "failed");
|
|
3448
3535
|
}
|
|
3449
|
-
function
|
|
3536
|
+
function j(t) {
|
|
3450
3537
|
return t.role === "assistant" && t.phase !== "commentary";
|
|
3451
3538
|
}
|
|
3452
|
-
function
|
|
3539
|
+
function wr(t) {
|
|
3453
3540
|
if (!t || typeof t != "object")
|
|
3454
3541
|
return !1;
|
|
3455
3542
|
const e = t;
|
|
3456
3543
|
return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
|
|
3457
3544
|
}
|
|
3458
|
-
function
|
|
3459
|
-
return t.filter((e, s) =>
|
|
3545
|
+
function Ge(t) {
|
|
3546
|
+
return t.filter((e, s) => V(e) ? !Ur(t, s) && !Jt(t, s) && !kr(t, s) && !Pr(t, s) : Mr(e) ? e.retryable === !0 && _r(t, s) ? !1 : !br(t, s) : !0);
|
|
3460
3547
|
}
|
|
3461
|
-
function
|
|
3548
|
+
function Mr(t) {
|
|
3462
3549
|
return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
|
|
3463
3550
|
}
|
|
3464
|
-
function
|
|
3551
|
+
function V(t) {
|
|
3465
3552
|
return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
|
|
3466
3553
|
}
|
|
3467
|
-
function
|
|
3554
|
+
function Ar(t, e, s, n) {
|
|
3468
3555
|
const r = t.findIndex(
|
|
3469
|
-
(l, c) =>
|
|
3556
|
+
(l, c) => V(l) && !Jt(t, c)
|
|
3470
3557
|
), i = r === -1 ? null : t[r], o = e ?? i?.respondsToUserMessageId ?? null, a = o ? t.find(
|
|
3471
3558
|
(l) => l.role === "user" && l.id === o
|
|
3472
3559
|
) : null;
|
|
3473
3560
|
return {
|
|
3474
|
-
clientMessageId: a ?
|
|
3561
|
+
clientMessageId: a ? se(a) : o ? null : n,
|
|
3475
3562
|
respondsToUserMessageId: o,
|
|
3476
3563
|
runId: s ?? i?.runId ?? null
|
|
3477
3564
|
};
|
|
3478
3565
|
}
|
|
3479
|
-
function
|
|
3566
|
+
function qe(t) {
|
|
3480
3567
|
return t?.type === "run_status" && t.status === "stopped";
|
|
3481
3568
|
}
|
|
3482
|
-
function
|
|
3569
|
+
function ue(t, e, s) {
|
|
3483
3570
|
const n = new Set(
|
|
3484
3571
|
t.filter(
|
|
3485
|
-
(r) => r.role === "user" && e !== null &&
|
|
3572
|
+
(r) => r.role === "user" && e !== null && se(r) === e
|
|
3486
3573
|
).map((r) => r.id)
|
|
3487
3574
|
);
|
|
3488
3575
|
return t.filter(
|
|
3489
|
-
(r) => !
|
|
3576
|
+
(r) => !V(r) || (n.size > 0 ? !r.respondsToUserMessageId || !n.has(r.respondsToUserMessageId) : !s || r.runId !== s)
|
|
3490
3577
|
);
|
|
3491
3578
|
}
|
|
3492
|
-
function
|
|
3579
|
+
function Jt(t, e) {
|
|
3493
3580
|
return t.some(
|
|
3494
|
-
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) &&
|
|
3581
|
+
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && Rr(
|
|
3495
3582
|
t,
|
|
3496
3583
|
e,
|
|
3497
3584
|
n
|
|
3498
3585
|
)
|
|
3499
3586
|
);
|
|
3500
3587
|
}
|
|
3501
|
-
function
|
|
3588
|
+
function Rr(t, e, s) {
|
|
3502
3589
|
const n = t[e], r = t[s];
|
|
3503
|
-
if (
|
|
3590
|
+
if (ne(n, r))
|
|
3504
3591
|
return !0;
|
|
3505
3592
|
if (!n.respondsToUserMessageId || r.respondsToUserMessageId || !n.runId || n.runId !== r.runId)
|
|
3506
3593
|
return !1;
|
|
@@ -3509,35 +3596,35 @@ function Mr(t, e, s) {
|
|
|
3509
3596
|
return t[i].id === n.respondsToUserMessageId;
|
|
3510
3597
|
return !1;
|
|
3511
3598
|
}
|
|
3512
|
-
function
|
|
3599
|
+
function Er(t, e) {
|
|
3513
3600
|
const s = [...t].reverse().find(
|
|
3514
|
-
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e &&
|
|
3601
|
+
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && kt(n) && !Cr(
|
|
3515
3602
|
t,
|
|
3516
3603
|
n.respondsToUserMessageId
|
|
3517
3604
|
)
|
|
3518
3605
|
)?.respondsToUserMessageId;
|
|
3519
3606
|
return s ? t.map(
|
|
3520
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
3607
|
+
(n) => n.respondsToUserMessageId === s && kt(n) ? { ...n, steered: !0 } : n
|
|
3521
3608
|
) : t;
|
|
3522
3609
|
}
|
|
3523
|
-
function
|
|
3524
|
-
return t.role === "tool" ||
|
|
3610
|
+
function kt(t) {
|
|
3611
|
+
return t.role === "tool" || V(t) ? !0 : t.role === "assistant" && t.phase === "commentary";
|
|
3525
3612
|
}
|
|
3526
|
-
function
|
|
3613
|
+
function Cr(t, e) {
|
|
3527
3614
|
return t.some(
|
|
3528
|
-
(s) => s.respondsToUserMessageId === e && (
|
|
3615
|
+
(s) => s.respondsToUserMessageId === e && (j(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
|
|
3529
3616
|
);
|
|
3530
3617
|
}
|
|
3531
|
-
function
|
|
3618
|
+
function br(t, e) {
|
|
3532
3619
|
const s = t[e];
|
|
3533
3620
|
for (let n = e + 1; n < t.length; n += 1) {
|
|
3534
3621
|
const r = t[n];
|
|
3535
|
-
if (r.role === "assistant" &&
|
|
3622
|
+
if (r.role === "assistant" && ne(s, r))
|
|
3536
3623
|
return !0;
|
|
3537
3624
|
}
|
|
3538
3625
|
return !1;
|
|
3539
3626
|
}
|
|
3540
|
-
function
|
|
3627
|
+
function _r(t, e) {
|
|
3541
3628
|
const s = t[e];
|
|
3542
3629
|
if (!s.respondsToUserMessageId)
|
|
3543
3630
|
return !1;
|
|
@@ -3545,37 +3632,37 @@ function Cr(t, e) {
|
|
|
3545
3632
|
const r = t[n];
|
|
3546
3633
|
if (r.role === "user")
|
|
3547
3634
|
return !1;
|
|
3548
|
-
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" ||
|
|
3635
|
+
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" || V(r)))
|
|
3549
3636
|
return !0;
|
|
3550
3637
|
}
|
|
3551
3638
|
return !1;
|
|
3552
3639
|
}
|
|
3553
|
-
function
|
|
3640
|
+
function kr(t, e) {
|
|
3554
3641
|
const s = t[e];
|
|
3555
3642
|
return t.some(
|
|
3556
|
-
(n, r) => r !== e && n.role === "assistant" &&
|
|
3643
|
+
(n, r) => r !== e && n.role === "assistant" && ne(s, n)
|
|
3557
3644
|
);
|
|
3558
3645
|
}
|
|
3559
|
-
function
|
|
3646
|
+
function Pr(t, e) {
|
|
3560
3647
|
const s = t[e];
|
|
3561
3648
|
return t.some(
|
|
3562
|
-
(n, r) => r !== e && n.role === "tool" &&
|
|
3649
|
+
(n, r) => r !== e && n.role === "tool" && ne(s, n)
|
|
3563
3650
|
);
|
|
3564
3651
|
}
|
|
3565
|
-
function
|
|
3652
|
+
function Ur(t, e) {
|
|
3566
3653
|
const s = t[e];
|
|
3567
3654
|
for (let n = e + 1; n < t.length; n += 1)
|
|
3568
|
-
if (
|
|
3655
|
+
if (V(t[n]) && ne(s, t[n]))
|
|
3569
3656
|
return !0;
|
|
3570
3657
|
return !1;
|
|
3571
3658
|
}
|
|
3572
|
-
function
|
|
3659
|
+
function ne(t, e) {
|
|
3573
3660
|
return !!(t.respondsToUserMessageId && t.respondsToUserMessageId === e.respondsToUserMessageId);
|
|
3574
3661
|
}
|
|
3575
|
-
function
|
|
3662
|
+
function w(t, e) {
|
|
3576
3663
|
return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
|
|
3577
3664
|
}
|
|
3578
|
-
function
|
|
3665
|
+
function Dr(t, e) {
|
|
3579
3666
|
try {
|
|
3580
3667
|
const s = window.localStorage.getItem(`${Bt}${t}`);
|
|
3581
3668
|
if (!s)
|
|
@@ -3583,7 +3670,7 @@ function Pr(t, e) {
|
|
|
3583
3670
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
3584
3671
|
if (e !== void 0 && r !== e)
|
|
3585
3672
|
return null;
|
|
3586
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
3673
|
+
const i = Array.isArray(n.messages) ? n.messages.map(jr).filter((o) => !!o) : [];
|
|
3587
3674
|
return {
|
|
3588
3675
|
sessionId: r,
|
|
3589
3676
|
messages: i
|
|
@@ -3592,48 +3679,48 @@ function Pr(t, e) {
|
|
|
3592
3679
|
return null;
|
|
3593
3680
|
}
|
|
3594
3681
|
}
|
|
3595
|
-
function
|
|
3682
|
+
function vr(t, e) {
|
|
3596
3683
|
try {
|
|
3597
3684
|
window.localStorage.setItem(
|
|
3598
3685
|
`${Bt}${t}`,
|
|
3599
3686
|
JSON.stringify({
|
|
3600
3687
|
sessionId: e.sessionId,
|
|
3601
|
-
messages: e.messages.slice(-
|
|
3688
|
+
messages: e.messages.slice(-on).map(Fr)
|
|
3602
3689
|
})
|
|
3603
3690
|
);
|
|
3604
3691
|
} catch {
|
|
3605
3692
|
return;
|
|
3606
3693
|
}
|
|
3607
3694
|
}
|
|
3608
|
-
function
|
|
3695
|
+
function Or(t) {
|
|
3609
3696
|
try {
|
|
3610
|
-
const e = window.localStorage.getItem(`${
|
|
3697
|
+
const e = window.localStorage.getItem(`${He}${t}`);
|
|
3611
3698
|
if (!e)
|
|
3612
3699
|
return [];
|
|
3613
3700
|
const s = JSON.parse(e);
|
|
3614
|
-
return Array.isArray(s) ? s.filter(
|
|
3701
|
+
return Array.isArray(s) ? s.filter(tt) : [];
|
|
3615
3702
|
} catch {
|
|
3616
3703
|
return [];
|
|
3617
3704
|
}
|
|
3618
3705
|
}
|
|
3619
|
-
function
|
|
3706
|
+
function F(t, e) {
|
|
3620
3707
|
try {
|
|
3621
|
-
const s = e.filter(
|
|
3708
|
+
const s = e.filter(tt);
|
|
3622
3709
|
if (s.length === 0) {
|
|
3623
|
-
window.localStorage.removeItem(`${
|
|
3710
|
+
window.localStorage.removeItem(`${He}${t}`);
|
|
3624
3711
|
return;
|
|
3625
3712
|
}
|
|
3626
3713
|
window.localStorage.setItem(
|
|
3627
|
-
`${
|
|
3714
|
+
`${He}${t}`,
|
|
3628
3715
|
JSON.stringify(s.slice(-25))
|
|
3629
3716
|
);
|
|
3630
3717
|
} catch {
|
|
3631
3718
|
return;
|
|
3632
3719
|
}
|
|
3633
3720
|
}
|
|
3634
|
-
function
|
|
3721
|
+
function Yt(t, e) {
|
|
3635
3722
|
try {
|
|
3636
|
-
const s = `${
|
|
3723
|
+
const s = `${ye}${t}`, n = location.href, r = location.origin, i = Array.from(e, (o) => ({
|
|
3637
3724
|
...o,
|
|
3638
3725
|
storedAt: Date.now(),
|
|
3639
3726
|
unloadUrl: n,
|
|
@@ -3647,24 +3734,24 @@ function Jt(t, e) {
|
|
|
3647
3734
|
} catch {
|
|
3648
3735
|
}
|
|
3649
3736
|
}
|
|
3650
|
-
function
|
|
3737
|
+
function Pt(t, e) {
|
|
3651
3738
|
try {
|
|
3652
|
-
if (window.sessionStorage.getItem(`${
|
|
3739
|
+
if (window.sessionStorage.getItem(`${ye}${t}`) === null)
|
|
3653
3740
|
return;
|
|
3654
3741
|
} catch {
|
|
3655
3742
|
return;
|
|
3656
3743
|
}
|
|
3657
|
-
|
|
3744
|
+
Yt(t, e);
|
|
3658
3745
|
}
|
|
3659
|
-
function
|
|
3746
|
+
function Lr(t) {
|
|
3660
3747
|
try {
|
|
3661
|
-
const e = `${
|
|
3748
|
+
const e = `${ye}${t}`, s = window.sessionStorage.getItem(e);
|
|
3662
3749
|
if (window.sessionStorage.removeItem(e), !s)
|
|
3663
3750
|
return [];
|
|
3664
3751
|
const n = JSON.parse(s);
|
|
3665
|
-
return Array.isArray(n) ? n.flatMap((r) =>
|
|
3752
|
+
return Array.isArray(n) ? n.flatMap((r) => qr(r) ? [{
|
|
3666
3753
|
...r.event,
|
|
3667
|
-
page:
|
|
3754
|
+
page: _(),
|
|
3668
3755
|
rawOutput: {
|
|
3669
3756
|
pageContextRestarted: !0,
|
|
3670
3757
|
outcome: "unknown",
|
|
@@ -3689,11 +3776,11 @@ function Nr(t) {
|
|
|
3689
3776
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
3690
3777
|
Current URL: ${t}`;
|
|
3691
3778
|
}
|
|
3692
|
-
function
|
|
3779
|
+
function qr(t) {
|
|
3693
3780
|
if (!t || typeof t != "object")
|
|
3694
3781
|
return !1;
|
|
3695
3782
|
const e = t, s = e.event;
|
|
3696
|
-
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" &&
|
|
3783
|
+
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && tt(s) && s.type === "tool.result";
|
|
3697
3784
|
}
|
|
3698
3785
|
function xr(t, e) {
|
|
3699
3786
|
const s = new Set(
|
|
@@ -3704,26 +3791,26 @@ function xr(t, e) {
|
|
|
3704
3791
|
...e.filter((n) => !s.has(n.callId))
|
|
3705
3792
|
];
|
|
3706
3793
|
}
|
|
3707
|
-
function
|
|
3794
|
+
function Br(t) {
|
|
3708
3795
|
try {
|
|
3709
|
-
window.sessionStorage.removeItem(`${
|
|
3796
|
+
window.sessionStorage.removeItem(`${ye}${t}`);
|
|
3710
3797
|
} catch {
|
|
3711
3798
|
return;
|
|
3712
3799
|
}
|
|
3713
3800
|
}
|
|
3714
|
-
function
|
|
3801
|
+
function tt(t) {
|
|
3715
3802
|
if (!t || typeof t != "object")
|
|
3716
3803
|
return !1;
|
|
3717
3804
|
const e = t;
|
|
3718
|
-
return e.type === "chat.user_message" ? typeof e.content == "string" &&
|
|
3805
|
+
return e.type === "chat.user_message" ? typeof e.content == "string" && Ut(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? Ut(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
|
|
3719
3806
|
}
|
|
3720
|
-
function
|
|
3807
|
+
function Ut(t) {
|
|
3721
3808
|
if (!t || typeof t != "object")
|
|
3722
3809
|
return !1;
|
|
3723
3810
|
const e = t;
|
|
3724
3811
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
3725
3812
|
}
|
|
3726
|
-
function
|
|
3813
|
+
function Qt(t, e) {
|
|
3727
3814
|
if (!Array.isArray(t))
|
|
3728
3815
|
return;
|
|
3729
3816
|
const s = t.filter((r) => {
|
|
@@ -3731,41 +3818,41 @@ function Yt(t, e) {
|
|
|
3731
3818
|
return !1;
|
|
3732
3819
|
const i = r;
|
|
3733
3820
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
3734
|
-
}), n = e ? s.map((r) =>
|
|
3821
|
+
}), n = e ? s.map((r) => Zt(r, e)) : s;
|
|
3735
3822
|
return n.length > 0 ? n : void 0;
|
|
3736
3823
|
}
|
|
3737
|
-
function
|
|
3824
|
+
function Zt(t, e) {
|
|
3738
3825
|
return t.fileUrl?.startsWith("/") ? {
|
|
3739
3826
|
...t,
|
|
3740
3827
|
fileUrl: new URL(t.fileUrl, e).toString()
|
|
3741
3828
|
} : t;
|
|
3742
3829
|
}
|
|
3743
|
-
function
|
|
3744
|
-
return t.type ||
|
|
3830
|
+
function Xe(t) {
|
|
3831
|
+
return t.type || $r(t.name) || "application/octet-stream";
|
|
3745
3832
|
}
|
|
3746
|
-
function
|
|
3747
|
-
|
|
3833
|
+
function Wr(t) {
|
|
3834
|
+
es({
|
|
3748
3835
|
name: t.name,
|
|
3749
|
-
mimeType:
|
|
3836
|
+
mimeType: Xe(t),
|
|
3750
3837
|
sizeBytes: t.size
|
|
3751
3838
|
});
|
|
3752
3839
|
}
|
|
3753
|
-
function
|
|
3754
|
-
const e =
|
|
3755
|
-
if (!
|
|
3840
|
+
function es(t) {
|
|
3841
|
+
const e = Hr(t.name), s = t.mimeType.trim().toLowerCase();
|
|
3842
|
+
if (!sn.has(`${e}:${s}`))
|
|
3756
3843
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
3757
|
-
if (t.sizeBytes <= 0 || t.sizeBytes >=
|
|
3844
|
+
if (t.sizeBytes <= 0 || t.sizeBytes >= qt)
|
|
3758
3845
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
3759
3846
|
}
|
|
3760
|
-
function
|
|
3847
|
+
function Hr(t) {
|
|
3761
3848
|
const e = t.trim().toLowerCase(), s = e.lastIndexOf(".");
|
|
3762
3849
|
return s >= 0 ? e.slice(s) : "";
|
|
3763
3850
|
}
|
|
3764
|
-
function
|
|
3851
|
+
function $r(t) {
|
|
3765
3852
|
const e = t.toLowerCase();
|
|
3766
3853
|
return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
|
|
3767
3854
|
}
|
|
3768
|
-
function
|
|
3855
|
+
function jr(t) {
|
|
3769
3856
|
if (!t || typeof t != "object")
|
|
3770
3857
|
return null;
|
|
3771
3858
|
const e = t;
|
|
@@ -3782,17 +3869,17 @@ function Hr(t) {
|
|
|
3782
3869
|
dataType: typeof e.dataType == "string" ? e.dataType : void 0,
|
|
3783
3870
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
3784
3871
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
3785
|
-
attachments:
|
|
3872
|
+
attachments: Qt(e.attachments)?.map(st),
|
|
3786
3873
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
3787
3874
|
};
|
|
3788
3875
|
}
|
|
3789
|
-
function
|
|
3876
|
+
function Fr(t) {
|
|
3790
3877
|
return t.attachments?.length ? {
|
|
3791
3878
|
...t,
|
|
3792
|
-
attachments: t.attachments.map(
|
|
3879
|
+
attachments: t.attachments.map(st)
|
|
3793
3880
|
} : t;
|
|
3794
3881
|
}
|
|
3795
|
-
function
|
|
3882
|
+
function st(t) {
|
|
3796
3883
|
const {
|
|
3797
3884
|
dataUrl: e,
|
|
3798
3885
|
objectUrl: s,
|
|
@@ -3801,7 +3888,7 @@ function tt(t) {
|
|
|
3801
3888
|
} = t;
|
|
3802
3889
|
return r;
|
|
3803
3890
|
}
|
|
3804
|
-
function
|
|
3891
|
+
function N(t) {
|
|
3805
3892
|
const e = t.respondsToUserMessageId;
|
|
3806
3893
|
return typeof e == "string" && e ? e : null;
|
|
3807
3894
|
}
|
|
@@ -3809,39 +3896,39 @@ function U(t) {
|
|
|
3809
3896
|
const e = t.runId;
|
|
3810
3897
|
return typeof e == "string" && e ? e : null;
|
|
3811
3898
|
}
|
|
3812
|
-
function
|
|
3899
|
+
function zr(t) {
|
|
3813
3900
|
const e = t?.timeoutMs;
|
|
3814
|
-
return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <=
|
|
3901
|
+
return !!t && typeof t == "object" && typeof t.summary == "string" && typeof t.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= fn);
|
|
3815
3902
|
}
|
|
3816
|
-
function
|
|
3903
|
+
function ts(t) {
|
|
3817
3904
|
const e = {};
|
|
3818
3905
|
try {
|
|
3819
3906
|
new Headers(t).forEach((s, n) => {
|
|
3820
|
-
Object.keys(e).length <
|
|
3907
|
+
Object.keys(e).length < Ze && (e[n] = nt(n, s));
|
|
3821
3908
|
});
|
|
3822
3909
|
} catch {
|
|
3823
3910
|
return {};
|
|
3824
3911
|
}
|
|
3825
3912
|
return e;
|
|
3826
3913
|
}
|
|
3827
|
-
function
|
|
3828
|
-
return
|
|
3914
|
+
function nt(t, e) {
|
|
3915
|
+
return as(t) ? Te : q(me(e), nn);
|
|
3829
3916
|
}
|
|
3830
|
-
function
|
|
3917
|
+
function Kr(t, e) {
|
|
3831
3918
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
3832
3919
|
}
|
|
3833
|
-
async function
|
|
3834
|
-
const r =
|
|
3920
|
+
async function Gr(t, e, s, n) {
|
|
3921
|
+
const r = ts(t.headers);
|
|
3835
3922
|
n({
|
|
3836
3923
|
...e,
|
|
3837
3924
|
responseStatus: t.status,
|
|
3838
3925
|
responseHeaders: r,
|
|
3839
|
-
responseBody: await
|
|
3926
|
+
responseBody: await Xr(t),
|
|
3840
3927
|
durationMs: Date.now() - s
|
|
3841
3928
|
});
|
|
3842
3929
|
}
|
|
3843
|
-
async function
|
|
3844
|
-
if (!
|
|
3930
|
+
async function Xr(t) {
|
|
3931
|
+
if (!ss(t.headers))
|
|
3845
3932
|
return;
|
|
3846
3933
|
let e = null, s = null;
|
|
3847
3934
|
try {
|
|
@@ -3850,7 +3937,7 @@ async function Kr(t) {
|
|
|
3850
3937
|
const n = new Promise((a) => {
|
|
3851
3938
|
s = window.setTimeout(() => {
|
|
3852
3939
|
e?.cancel(), a("timeout");
|
|
3853
|
-
},
|
|
3940
|
+
}, rn);
|
|
3854
3941
|
}), r = new TextDecoder();
|
|
3855
3942
|
let i = "", o = 0;
|
|
3856
3943
|
for (; ; ) {
|
|
@@ -3859,10 +3946,10 @@ async function Kr(t) {
|
|
|
3859
3946
|
return;
|
|
3860
3947
|
const { done: l, value: c } = a;
|
|
3861
3948
|
if (l)
|
|
3862
|
-
return
|
|
3863
|
-
const
|
|
3864
|
-
if (c.byteLength >
|
|
3865
|
-
return i += r.decode(c.subarray(0, Math.max(
|
|
3949
|
+
return q(i + r.decode());
|
|
3950
|
+
const h = Qe - o;
|
|
3951
|
+
if (c.byteLength > h)
|
|
3952
|
+
return i += r.decode(c.subarray(0, Math.max(h, 0)), { stream: !0 }), e.cancel(), `${q(i)}... [truncated]`;
|
|
3866
3953
|
o += c.byteLength, i += r.decode(c, { stream: !0 });
|
|
3867
3954
|
}
|
|
3868
3955
|
} catch {
|
|
@@ -3872,45 +3959,45 @@ async function Kr(t) {
|
|
|
3872
3959
|
s !== null && window.clearTimeout(s);
|
|
3873
3960
|
}
|
|
3874
3961
|
}
|
|
3875
|
-
function
|
|
3876
|
-
if (
|
|
3962
|
+
function Vr(t, e) {
|
|
3963
|
+
if (ss(new Headers(e)))
|
|
3877
3964
|
try {
|
|
3878
|
-
return t.responseType === "" || t.responseType === "text" ?
|
|
3965
|
+
return t.responseType === "" || t.responseType === "text" ? q(t.responseText ?? "") : void 0;
|
|
3879
3966
|
} catch {
|
|
3880
3967
|
return;
|
|
3881
3968
|
}
|
|
3882
3969
|
}
|
|
3883
|
-
function
|
|
3970
|
+
function Dt(t) {
|
|
3884
3971
|
if (typeof t == "string")
|
|
3885
|
-
return
|
|
3972
|
+
return q(t);
|
|
3886
3973
|
}
|
|
3887
|
-
function
|
|
3974
|
+
function Jr(t) {
|
|
3888
3975
|
return v({
|
|
3889
3976
|
...t,
|
|
3890
|
-
requestBody:
|
|
3891
|
-
responseBody:
|
|
3977
|
+
requestBody: vt(t.requestBody),
|
|
3978
|
+
responseBody: vt(t.responseBody)
|
|
3892
3979
|
});
|
|
3893
3980
|
}
|
|
3894
|
-
function
|
|
3981
|
+
function vt(t) {
|
|
3895
3982
|
if (typeof t != "string")
|
|
3896
3983
|
return t;
|
|
3897
3984
|
const e = t.trim();
|
|
3898
3985
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
3899
|
-
return
|
|
3986
|
+
return me(t);
|
|
3900
3987
|
try {
|
|
3901
3988
|
return JSON.stringify(v(JSON.parse(t)));
|
|
3902
3989
|
} catch {
|
|
3903
|
-
return
|
|
3990
|
+
return me(t);
|
|
3904
3991
|
}
|
|
3905
3992
|
}
|
|
3906
|
-
function
|
|
3993
|
+
function ss(t) {
|
|
3907
3994
|
if (!t)
|
|
3908
3995
|
return !1;
|
|
3909
3996
|
const e = t.get("content-type")?.toLowerCase() ?? "", s = t.get("content-length"), n = Number(s);
|
|
3910
|
-
return s !== null && Number.isInteger(n) && n >= 0 && n <=
|
|
3997
|
+
return s !== null && Number.isInteger(n) && n >= 0 && n <= Qe && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
3911
3998
|
}
|
|
3912
|
-
function
|
|
3913
|
-
if (
|
|
3999
|
+
function z(t, e = {}, s) {
|
|
4000
|
+
if (Qr(s))
|
|
3914
4001
|
return !0;
|
|
3915
4002
|
const n = Object.entries(e).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
3916
4003
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -3925,8 +4012,8 @@ function j(t, e = {}, s) {
|
|
|
3925
4012
|
return !0;
|
|
3926
4013
|
}
|
|
3927
4014
|
}
|
|
3928
|
-
function
|
|
3929
|
-
if (
|
|
4015
|
+
function Yr(t, e) {
|
|
4016
|
+
if (z(t))
|
|
3930
4017
|
return !0;
|
|
3931
4018
|
try {
|
|
3932
4019
|
const s = new URL(t, location.href), n = new URL(e);
|
|
@@ -3935,117 +4022,117 @@ function Vr(t, e) {
|
|
|
3935
4022
|
return !0;
|
|
3936
4023
|
}
|
|
3937
4024
|
}
|
|
3938
|
-
function
|
|
4025
|
+
function Qr(t) {
|
|
3939
4026
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
3940
4027
|
}
|
|
3941
|
-
function
|
|
4028
|
+
function Zr(t) {
|
|
3942
4029
|
const e = {};
|
|
3943
4030
|
for (const s of t.trim().split(/[\r\n]+/)) {
|
|
3944
4031
|
const n = s.indexOf(":");
|
|
3945
4032
|
if (n <= 0)
|
|
3946
4033
|
continue;
|
|
3947
|
-
if (Object.keys(e).length >=
|
|
4034
|
+
if (Object.keys(e).length >= Ze)
|
|
3948
4035
|
break;
|
|
3949
4036
|
const r = s.slice(0, n).trim();
|
|
3950
|
-
e[r] =
|
|
4037
|
+
e[r] = nt(r, s.slice(n + 1).trim());
|
|
3951
4038
|
}
|
|
3952
4039
|
return e;
|
|
3953
4040
|
}
|
|
3954
|
-
function
|
|
4041
|
+
function q(t, e = Qe) {
|
|
3955
4042
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
3956
4043
|
}
|
|
3957
|
-
function
|
|
4044
|
+
function xe(t) {
|
|
3958
4045
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
3959
4046
|
}
|
|
3960
|
-
class
|
|
4047
|
+
class ge extends Error {
|
|
3961
4048
|
constructor(e, s) {
|
|
3962
4049
|
super(`${e} (${s})`), this.status = s, this.name = "AttachmentUploadHttpError";
|
|
3963
4050
|
}
|
|
3964
4051
|
status;
|
|
3965
4052
|
}
|
|
3966
|
-
async function
|
|
4053
|
+
async function de(t, e) {
|
|
3967
4054
|
let s = null;
|
|
3968
|
-
for (let n = 0; n <
|
|
4055
|
+
for (let n = 0; n < St; n += 1)
|
|
3969
4056
|
try {
|
|
3970
4057
|
return await t();
|
|
3971
4058
|
} catch (r) {
|
|
3972
|
-
if (s = r, n >=
|
|
4059
|
+
if (s = r, n >= St - 1 || !ti(r))
|
|
3973
4060
|
throw r;
|
|
3974
|
-
await
|
|
4061
|
+
await ei(n);
|
|
3975
4062
|
}
|
|
3976
4063
|
throw s instanceof Error ? s : new Error(e);
|
|
3977
4064
|
}
|
|
3978
|
-
function
|
|
4065
|
+
function ei(t) {
|
|
3979
4066
|
return new Promise((e) => {
|
|
3980
|
-
window.setTimeout(e,
|
|
4067
|
+
window.setTimeout(e, tn[t] ?? 0);
|
|
3981
4068
|
});
|
|
3982
4069
|
}
|
|
3983
|
-
function
|
|
3984
|
-
return t instanceof
|
|
4070
|
+
function ti(t) {
|
|
4071
|
+
return t instanceof ge ? si(t.status) : t instanceof TypeError;
|
|
3985
4072
|
}
|
|
3986
|
-
function
|
|
4073
|
+
function si(t) {
|
|
3987
4074
|
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
3988
4075
|
}
|
|
3989
|
-
function
|
|
4076
|
+
function ni(t) {
|
|
3990
4077
|
return t === 401 || t === 403;
|
|
3991
4078
|
}
|
|
3992
|
-
const
|
|
4079
|
+
const Te = "[REDACTED_SECRET]", x = "[REDACTED_TOKEN]", ri = "[REDACTED_SIGNED_URL]", ii = 20, oi = /^(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, ns = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, rs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, is = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, os = /\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, ai = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, li = /\bhttps?:\/\/[^\s"'<>]+/gi, ci = /[),.;\]]+$/;
|
|
3993
4080
|
function v(t) {
|
|
3994
|
-
return
|
|
4081
|
+
return fe(t, 0, /* @__PURE__ */ new WeakSet());
|
|
3995
4082
|
}
|
|
3996
|
-
function
|
|
4083
|
+
function fe(t, e, s) {
|
|
3997
4084
|
if (typeof t == "string")
|
|
3998
|
-
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t :
|
|
4085
|
+
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : me(t);
|
|
3999
4086
|
if (t === null || typeof t != "object")
|
|
4000
4087
|
return t;
|
|
4001
|
-
if (e >=
|
|
4088
|
+
if (e >= ii)
|
|
4002
4089
|
return "[REDACTED_MAX_DEPTH]";
|
|
4003
4090
|
if (s.has(t))
|
|
4004
4091
|
return "[REDACTED_CIRCULAR]";
|
|
4005
4092
|
if (s.add(t), Array.isArray(t))
|
|
4006
|
-
return t.map((r) =>
|
|
4093
|
+
return t.map((r) => fe(r, e + 1, s));
|
|
4007
4094
|
const n = {};
|
|
4008
4095
|
for (const [r, i] of Object.entries(t))
|
|
4009
|
-
r === "pageContent" ? n[r] = i :
|
|
4096
|
+
r === "pageContent" ? n[r] = i : as(r) ? n[r] = Te : n[r] = r.toLowerCase() === "url" ? ui(i) : fe(i, e + 1, s);
|
|
4010
4097
|
return n;
|
|
4011
4098
|
}
|
|
4012
|
-
function
|
|
4099
|
+
function as(t) {
|
|
4013
4100
|
const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
4014
4101
|
return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
|
|
4015
4102
|
}
|
|
4016
|
-
function
|
|
4017
|
-
return typeof t == "string" ?
|
|
4103
|
+
function ui(t) {
|
|
4104
|
+
return typeof t == "string" ? ls(t) : fe(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4018
4105
|
}
|
|
4019
|
-
function
|
|
4106
|
+
function ls(t) {
|
|
4020
4107
|
try {
|
|
4021
4108
|
const e = new URL(t, location.href);
|
|
4022
4109
|
for (const s of Array.from(e.searchParams.keys()))
|
|
4023
|
-
|
|
4024
|
-
return e.username && (e.username =
|
|
4110
|
+
oi.test(s) && e.searchParams.set(s, x);
|
|
4111
|
+
return e.username && (e.username = x), e.password && (e.password = x), e.toString();
|
|
4025
4112
|
} catch {
|
|
4026
|
-
return
|
|
4113
|
+
return di(t);
|
|
4027
4114
|
}
|
|
4028
4115
|
}
|
|
4029
|
-
function
|
|
4030
|
-
return t.replace(
|
|
4116
|
+
function me(t) {
|
|
4117
|
+
return t.replace(ai, ri).replace(li, hi).replace(ns, `Bearer ${x}`).replace(rs, `Basic ${x}`).replace(is, x).replace(os, (e, s) => `${s}: ${Te}`);
|
|
4031
4118
|
}
|
|
4032
|
-
function
|
|
4033
|
-
return t.replace(
|
|
4119
|
+
function di(t) {
|
|
4120
|
+
return t.replace(ns, `Bearer ${x}`).replace(rs, `Basic ${x}`).replace(is, x).replace(os, (e, s) => `${s}: ${Te}`);
|
|
4034
4121
|
}
|
|
4035
|
-
function
|
|
4036
|
-
const e = t.match(
|
|
4037
|
-
return `${
|
|
4122
|
+
function hi(t) {
|
|
4123
|
+
const e = t.match(ci)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
|
|
4124
|
+
return `${ls(s)}${e}`;
|
|
4038
4125
|
}
|
|
4039
4126
|
export {
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4127
|
+
ht as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
4128
|
+
We as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
4129
|
+
Ls as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
4130
|
+
Os as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
4131
|
+
Ns as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
4132
|
+
pi as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
4133
|
+
Wt as PlunoProductAgent,
|
|
4134
|
+
ln as calculateReconnectDelay,
|
|
4135
|
+
Wt as default,
|
|
4136
|
+
Un as getProductAgentOriginAccessErrorMessage,
|
|
4137
|
+
Wr as validateProductAgentProviderInputFile
|
|
4051
4138
|
};
|