@pluno/product-agent-web 0.1.188 → 0.1.190
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 +8 -0
- package/dist/product-agent-sdk.js +994 -915
- package/dist/product-agent-widget.js +2902 -2722
- package/dist/widget.d.ts +8 -4
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const Ts = "pluno-product-agent-attachments";
|
|
2
|
-
const
|
|
3
|
-
async function
|
|
4
|
-
const e = await
|
|
5
|
-
await
|
|
6
|
-
}
|
|
7
|
-
async function
|
|
8
|
-
const s = await
|
|
9
|
-
await
|
|
10
|
-
const r = await
|
|
2
|
+
const Ve = "files";
|
|
3
|
+
async function ws(t) {
|
|
4
|
+
const e = await st();
|
|
5
|
+
await Rs(e, "readwrite", (s) => s.put(t));
|
|
6
|
+
}
|
|
7
|
+
async function Ms(t, e) {
|
|
8
|
+
const s = await st();
|
|
9
|
+
await nt(s, "readwrite", async (n) => {
|
|
10
|
+
const r = await rt(
|
|
11
11
|
n.get(t)
|
|
12
12
|
);
|
|
13
13
|
r && n.put({
|
|
@@ -16,28 +16,28 @@ async function ws(t, e) {
|
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
20
|
-
const e = await
|
|
21
|
-
await
|
|
19
|
+
async function As(t = 864e5) {
|
|
20
|
+
const e = await st(), s = Date.now() - t;
|
|
21
|
+
await nt(e, "readwrite", async (n) => {
|
|
22
22
|
const r = n.index("lastUsedAt");
|
|
23
|
-
(await
|
|
23
|
+
(await rt(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function st() {
|
|
27
27
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((t, e) => {
|
|
28
28
|
const s = indexedDB.open(Ts, 1);
|
|
29
29
|
s.onupgradeneeded = () => {
|
|
30
|
-
const r = s.result.createObjectStore(
|
|
30
|
+
const r = s.result.createObjectStore(Ve, { 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 Rs(t, e, s) {
|
|
36
|
+
return await nt(t, e, async (n) => await rt(s(n)));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function nt(t, e, s) {
|
|
39
39
|
return new Promise((n, r) => {
|
|
40
|
-
const i = t.transaction(
|
|
40
|
+
const i = t.transaction(Ve, e), o = i.objectStore(Ve);
|
|
41
41
|
let a, l = !1;
|
|
42
42
|
s(o).then((c) => {
|
|
43
43
|
a = c;
|
|
@@ -57,16 +57,16 @@ function st(t, e, s) {
|
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function rt(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 Es(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 Ht(t, e, s) {
|
|
69
|
+
const n = Reflect.get(t, "pluno"), r = Es(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,15 +80,15 @@ function Wt(t, e, s) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
83
|
+
const ks = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
84
|
+
function Cs(t, e) {
|
|
85
85
|
return e ? t.replace(
|
|
86
|
-
|
|
86
|
+
ks,
|
|
87
87
|
(s, n, r, i) => `${n}${new URL(r, e).toString()}${i}`
|
|
88
88
|
) : t;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
91
|
-
function
|
|
90
|
+
const bs = "suggest_share_on_socials";
|
|
91
|
+
function _s(t) {
|
|
92
92
|
let e = t;
|
|
93
93
|
if (typeof t == "string")
|
|
94
94
|
try {
|
|
@@ -96,65 +96,65 @@ function bs(t) {
|
|
|
96
96
|
} catch {
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
|
-
const s =
|
|
99
|
+
const s = Ps(e);
|
|
100
100
|
return s ? typeof s.showSharePrompt == "boolean" ? s.showSharePrompt : s.ok === !0 && typeof s.message == "string" && s.message.includes("social-sharing prompt") ? !0 : null : null;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Ps(t) {
|
|
103
103
|
return t && typeof t == "object" && !Array.isArray(t) ? t : null;
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
107
|
-
return (t.type === "function_call" || t.type === "tool_call") && t.name ===
|
|
105
|
+
const Us = "save_runtime_captured_skill";
|
|
106
|
+
function vs(t) {
|
|
107
|
+
return (t.type === "function_call" || t.type === "tool_call") && t.name === Us;
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Ds(t, e, s) {
|
|
110
110
|
const n = e.map((u) => ({ item: u, identity: s(u) })), r = new Set(
|
|
111
111
|
n.flatMap(
|
|
112
112
|
({ identity: u }) => u.isActivity && !u.isTransient ? u.activityKeys ?? [] : []
|
|
113
113
|
)
|
|
114
114
|
), i = n.filter(
|
|
115
|
-
({ identity: u }) => !(u.isTransient && u.activityKeys?.some((
|
|
116
|
-
), o = new Map(i.map(({ item: u, identity:
|
|
115
|
+
({ identity: u }) => !(u.isTransient && u.activityKeys?.some((p) => r.has(p)))
|
|
116
|
+
), o = new Map(i.map(({ item: u, identity: p }) => [p.id, u])), a = new Map(
|
|
117
117
|
i.flatMap(
|
|
118
|
-
({ item: u, identity:
|
|
118
|
+
({ item: u, identity: p }) => p.optimisticKey ? [[p.optimisticKey, u]] : []
|
|
119
119
|
)
|
|
120
120
|
), l = new Map(
|
|
121
121
|
i.flatMap(
|
|
122
|
-
({ item: u, identity:
|
|
122
|
+
({ item: u, identity: p }) => p.assistantDraftKey ? [[p.assistantDraftKey, u]] : []
|
|
123
123
|
)
|
|
124
124
|
), c = /* @__PURE__ */ new Map();
|
|
125
|
-
for (const { item: u, identity:
|
|
126
|
-
for (const g of
|
|
127
|
-
const
|
|
128
|
-
(!
|
|
125
|
+
for (const { item: u, identity: p } of i)
|
|
126
|
+
for (const g of p.activityKeys ?? []) {
|
|
127
|
+
const y = c.get(g);
|
|
128
|
+
(!y || s(y).isTransient) && c.set(g, u);
|
|
129
129
|
}
|
|
130
|
-
const d = new Set(i.map(({ identity: u }) => u.id)),
|
|
130
|
+
const d = new Set(i.map(({ identity: u }) => u.id)), h = new Set(
|
|
131
131
|
i.flatMap(({ identity: u }) => u.runId ? [u.runId] : [])
|
|
132
|
-
),
|
|
132
|
+
), m = /* @__PURE__ */ new Set(), f = [];
|
|
133
133
|
for (const u of t) {
|
|
134
|
-
const
|
|
135
|
-
let g = o.get(
|
|
136
|
-
if (
|
|
137
|
-
f.push(g),
|
|
134
|
+
const p = s(u);
|
|
135
|
+
let g = o.get(p.id);
|
|
136
|
+
if (p.isOptimistic && p.optimisticKey ? g = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? g = l.get(p.assistantDraftKey) : p.isActivity && (g = p.activityKeys?.map((M) => c.get(M)).find((M) => M !== void 0) ?? g), g && !m.has(g)) {
|
|
137
|
+
f.push(g), m.add(g);
|
|
138
138
|
continue;
|
|
139
139
|
}
|
|
140
|
-
const
|
|
141
|
-
(
|
|
140
|
+
const y = p.respondsToUserMessageId !== void 0 && d.has(p.respondsToUserMessageId) || p.runId !== void 0 && h.has(p.runId);
|
|
141
|
+
(p.isOptimistic || (p.isAssistantDraft || p.isActivity) && y) && f.push(u);
|
|
142
142
|
}
|
|
143
143
|
for (const { item: u } of i)
|
|
144
|
-
|
|
144
|
+
m.has(u) || f.push(u);
|
|
145
145
|
return f;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function Os(t, e, s, n) {
|
|
148
148
|
return t.filter((r) => {
|
|
149
149
|
const i = n(r);
|
|
150
150
|
return !i.isActivity || !i.isTransient ? !0 : e !== null && i.respondsToUserMessageId !== void 0 ? i.respondsToUserMessageId !== e : s === null || i.runId !== s;
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
let
|
|
155
|
-
const Te = /* @__PURE__ */ new Set(),
|
|
156
|
-
async function
|
|
157
|
-
const e = t.randomUUID(), s = t.storage.getItem(
|
|
153
|
+
const xe = "pluno.productAgent.transportId", qs = "pluno.productAgent.transportIdentity", Be = "pluno.productAgent.transportIdentity.event", Ls = 50, Ns = globalThis.setTimeout.bind(globalThis);
|
|
154
|
+
let oe = null;
|
|
155
|
+
const Te = /* @__PURE__ */ new Set(), We = /* @__PURE__ */ new Map();
|
|
156
|
+
async function xs(t = $t()) {
|
|
157
|
+
const e = t.randomUUID(), s = t.storage.getItem(xe);
|
|
158
158
|
let n = s ?? t.randomUUID(), r = !1, i = !1;
|
|
159
159
|
const o = t.channel.subscribe((l) => {
|
|
160
160
|
if (!(l.senderId === e || l.transportId !== n)) {
|
|
@@ -172,7 +172,7 @@ async function Ns(t = Ht()) {
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
if (!s)
|
|
175
|
-
t.storage.setItem(
|
|
175
|
+
t.storage.setItem(xe, n), r = !0;
|
|
176
176
|
else if (t.skipStoredIdentityCollisionCheck)
|
|
177
177
|
r = !0;
|
|
178
178
|
else
|
|
@@ -181,7 +181,7 @@ async function Ns(t = Ht()) {
|
|
|
181
181
|
r = !0;
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
|
-
n = t.randomUUID(), t.storage.setItem(
|
|
184
|
+
n = t.randomUUID(), t.storage.setItem(xe, n);
|
|
185
185
|
}
|
|
186
186
|
let a = !1;
|
|
187
187
|
return {
|
|
@@ -191,17 +191,17 @@ async function Ns(t = Ht()) {
|
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
async function
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
async function Bs(t = !1) {
|
|
195
|
+
oe || (oe = xs({
|
|
196
|
+
...$t(),
|
|
197
197
|
skipStoredIdentityCollisionCheck: t
|
|
198
|
-
}),
|
|
198
|
+
}), oe.then((r) => {
|
|
199
199
|
const i = (o) => {
|
|
200
|
-
o.persisted || (r.release(),
|
|
200
|
+
o.persisted || (r.release(), oe = null, Te.clear(), window.removeEventListener("pagehide", i));
|
|
201
201
|
};
|
|
202
202
|
window.addEventListener("pagehide", i);
|
|
203
203
|
}));
|
|
204
|
-
const e = await
|
|
204
|
+
const e = await oe, s = Ws();
|
|
205
205
|
Te.add(s);
|
|
206
206
|
let n = !1;
|
|
207
207
|
return {
|
|
@@ -212,31 +212,31 @@ async function xs(t = !1) {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function Ws() {
|
|
216
216
|
let t = 0;
|
|
217
217
|
for (; Te.has(t); )
|
|
218
218
|
t += 1;
|
|
219
219
|
return t;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function $t() {
|
|
222
222
|
return {
|
|
223
|
-
storage:
|
|
224
|
-
channel:
|
|
223
|
+
storage: Hs(),
|
|
224
|
+
channel: $s(),
|
|
225
225
|
randomUUID: () => crypto.randomUUID(),
|
|
226
|
-
settle: () => new Promise((t) =>
|
|
226
|
+
settle: () => new Promise((t) => Ns(t, Ls))
|
|
227
227
|
};
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function Hs() {
|
|
230
230
|
return {
|
|
231
231
|
getItem: (t) => {
|
|
232
232
|
try {
|
|
233
|
-
return window.sessionStorage?.getItem(t) ??
|
|
233
|
+
return window.sessionStorage?.getItem(t) ?? We.get(t) ?? null;
|
|
234
234
|
} catch {
|
|
235
|
-
return
|
|
235
|
+
return We.get(t) ?? null;
|
|
236
236
|
}
|
|
237
237
|
},
|
|
238
238
|
setItem: (t, e) => {
|
|
239
|
-
|
|
239
|
+
We.set(t, e);
|
|
240
240
|
try {
|
|
241
241
|
window.sessionStorage?.setItem(t, e);
|
|
242
242
|
} catch {
|
|
@@ -244,9 +244,9 @@ function Ws() {
|
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function $s() {
|
|
248
248
|
if (typeof BroadcastChannel < "u") {
|
|
249
|
-
const t = new BroadcastChannel(
|
|
249
|
+
const t = new BroadcastChannel(qs);
|
|
250
250
|
return {
|
|
251
251
|
postMessage: (e) => t.postMessage(e),
|
|
252
252
|
subscribe: (e) => {
|
|
@@ -256,11 +256,11 @@ function Hs() {
|
|
|
256
256
|
close: () => t.close()
|
|
257
257
|
};
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return Fs();
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function Fs() {
|
|
262
262
|
const t = /* @__PURE__ */ new Set(), e = (s) => {
|
|
263
|
-
if (s.key !==
|
|
263
|
+
if (s.key !== Be || !s.newValue)
|
|
264
264
|
return;
|
|
265
265
|
const n = JSON.parse(s.newValue);
|
|
266
266
|
for (const r of t)
|
|
@@ -269,9 +269,9 @@ function $s() {
|
|
|
269
269
|
return window.addEventListener("storage", e), {
|
|
270
270
|
postMessage: (s) => {
|
|
271
271
|
window.localStorage.setItem(
|
|
272
|
-
|
|
272
|
+
Be,
|
|
273
273
|
JSON.stringify({ ...s, eventId: crypto.randomUUID() })
|
|
274
|
-
), window.localStorage.removeItem(
|
|
274
|
+
), window.localStorage.removeItem(Be);
|
|
275
275
|
},
|
|
276
276
|
subscribe: (s) => (t.add(s), () => t.delete(s)),
|
|
277
277
|
close: () => {
|
|
@@ -279,7 +279,7 @@ function $s() {
|
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
|
-
const
|
|
282
|
+
const Ft = "schedule_follow_up";
|
|
283
283
|
function js(t) {
|
|
284
284
|
let e = t;
|
|
285
285
|
if (typeof e == "string")
|
|
@@ -291,22 +291,22 @@ function js(t) {
|
|
|
291
291
|
if (!e || typeof e != "object")
|
|
292
292
|
return null;
|
|
293
293
|
const s = e;
|
|
294
|
-
return s.ok !== !0 || s.toolName !==
|
|
294
|
+
return s.ok !== !0 || s.toolName !== Ft || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : {
|
|
295
295
|
id: typeof s.taskId == "string" && s.taskId ? s.taskId : null,
|
|
296
296
|
dueAt: s.dueAt
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const zs = [
|
|
300
300
|
{ value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
|
|
301
301
|
{ value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
|
|
302
302
|
{ value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
|
|
303
|
-
],
|
|
303
|
+
], Ks = [
|
|
304
304
|
{ value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
|
|
305
305
|
{ value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
|
|
306
|
-
],
|
|
307
|
-
...
|
|
308
|
-
...
|
|
309
|
-
],
|
|
306
|
+
], Gs = [
|
|
307
|
+
...zs,
|
|
308
|
+
...Ks
|
|
309
|
+
], He = (t) => Gs.some((e) => e.value === t), Vs = globalThis.fetch.bind(globalThis), Xe = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Xs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Js = ".pluno-pa-widget__panel", Qs = ".pluno-pa-widget__timeline", ft = `${Xe}[data-pluno-sdk-preview-channel]`;
|
|
310
310
|
let Ys = 0;
|
|
311
311
|
function mt(t) {
|
|
312
312
|
const e = {};
|
|
@@ -346,7 +346,7 @@ function mt(t) {
|
|
|
346
346
|
}
|
|
347
347
|
return e;
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function $e(t, e, s) {
|
|
350
350
|
if (typeof window > "u")
|
|
351
351
|
return;
|
|
352
352
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -365,26 +365,26 @@ function He(t, e, s) {
|
|
|
365
365
|
};
|
|
366
366
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: r }));
|
|
367
367
|
}
|
|
368
|
-
class
|
|
368
|
+
class ge extends Error {
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function Zs(t) {
|
|
371
371
|
return t === 408 || t === 425 || t === 429 || t >= 500;
|
|
372
372
|
}
|
|
373
|
-
const
|
|
373
|
+
const en = "https://app.pluno.ai", tn = 2e4, sn = 1e4, nn = 1e4, rn = 1e4, on = 1e4, an = 3e3, ln = 3e4, cn = 1e3, yt = 3e4, It = 0.2, St = 6e4, Tt = 15e3, ae = 8, wt = "Browser connection was interrupted.", Mt = 15e3, un = "Pluno could not send this message. Try it again.", At = 2e3, dn = 1e3, hn = 100, Rt = 8e3, Et = 3, pn = [300, 1e3], jt = 50 * 1024 * 1024, gn = /* @__PURE__ */ new Set([
|
|
374
374
|
".jpeg:image/jpeg",
|
|
375
375
|
".jpg:image/jpeg",
|
|
376
376
|
".pdf:application/pdf",
|
|
377
377
|
".png:image/png",
|
|
378
378
|
".webp:image/webp"
|
|
379
|
-
]),
|
|
380
|
-
function
|
|
379
|
+
]), bi = ".pdf,.png,.jpg,.jpeg,.webp", it = 64e3, Fe = 4e3, ot = 30, fn = 2e3, mn = 1e3, zt = "Image is too large for model vision input.", yn = 100, Kt = "pluno.productAgent.state.", Je = "pluno.productAgent.pendingEvents.", _e = "pluno.productAgent.activeToolCalls.", In = 100;
|
|
380
|
+
function le(t, e = 0) {
|
|
381
381
|
const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
382
382
|
return Math.max(e, s);
|
|
383
383
|
}
|
|
384
|
-
const
|
|
385
|
-
let
|
|
386
|
-
function
|
|
387
|
-
const s = Math.min(yt,
|
|
384
|
+
const we = /* @__PURE__ */ new Set();
|
|
385
|
+
let fe = null;
|
|
386
|
+
function Sn(t, e = Math.random) {
|
|
387
|
+
const s = Math.min(yt, cn * 2 ** t), n = 1 - It + e() * It * 2;
|
|
388
388
|
return Math.min(yt, Math.round(s * n));
|
|
389
389
|
}
|
|
390
390
|
function Tn(t, e, s) {
|
|
@@ -400,19 +400,19 @@ function Tn(t, e, s) {
|
|
|
400
400
|
);
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
class
|
|
403
|
+
class Gt {
|
|
404
404
|
constructor(e, s) {
|
|
405
|
-
this.options = e, this.transportIdentity = s, this.personalModelSelectionOverride = e.productVariant === "personal" &&
|
|
405
|
+
this.options = e, this.transportIdentity = s, this.personalModelSelectionOverride = e.productVariant === "personal" && He(e.model) ? e.model : null, this.state = {
|
|
406
406
|
...this.state,
|
|
407
|
-
starterPrompts:
|
|
407
|
+
starterPrompts: Zn(e.initialStarterPrompts)
|
|
408
408
|
};
|
|
409
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
409
|
+
const n = e.restorePersistedState === !1 ? null : Gr(e.clientId, e.expectedPersistedSessionId);
|
|
410
410
|
n && (this.state = {
|
|
411
411
|
...this.state,
|
|
412
412
|
...n,
|
|
413
413
|
// Paint the readable same-session cache immediately while the complete transcript is revalidated. Tool
|
|
414
414
|
// activity is deliberately not restored here because it hydrates after the transcript is visible.
|
|
415
|
-
messages: n.messages.filter(
|
|
415
|
+
messages: n.messages.filter(os),
|
|
416
416
|
isLoadingSession: n.sessionId !== null,
|
|
417
417
|
status: "idle",
|
|
418
418
|
user: null,
|
|
@@ -427,14 +427,14 @@ class Kt {
|
|
|
427
427
|
taskStatus: null,
|
|
428
428
|
isRetrying: !1,
|
|
429
429
|
lastError: null
|
|
430
|
-
}), this.queuedClientEvents =
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
}), this.queuedClientEvents = Zr(
|
|
431
|
+
Xr(e.clientId),
|
|
432
|
+
Jr(e.clientId)
|
|
433
433
|
);
|
|
434
434
|
const r = [...this.queuedClientEvents].reverse().find(
|
|
435
435
|
(i) => i.type === "chat.user_message" && typeof i.clientMessageId == "string"
|
|
436
436
|
);
|
|
437
|
-
r?.clientMessageId && (this.pendingClientMessageId = r.clientMessageId, this.pendingUserMessageEvent = r, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"),
|
|
437
|
+
r?.clientMessageId && (this.pendingClientMessageId = r.clientMessageId, this.pendingUserMessageEvent = r, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"), V(e.clientId, this.queuedClientEvents);
|
|
438
438
|
}
|
|
439
439
|
options;
|
|
440
440
|
listeners = {};
|
|
@@ -500,6 +500,7 @@ class Kt {
|
|
|
500
500
|
lastUserMessagePageUrl = null;
|
|
501
501
|
thinkingWatchdogResyncAttemptsByClientMessageId = {};
|
|
502
502
|
retryableClientMessageId = null;
|
|
503
|
+
stagedProactiveSuggestionQuestionMessageId = null;
|
|
503
504
|
runtimeHelperJavascript = null;
|
|
504
505
|
attachmentFiles = /* @__PURE__ */ new Map();
|
|
505
506
|
sessionBrowserApisCleanup = null;
|
|
@@ -522,6 +523,7 @@ class Kt {
|
|
|
522
523
|
starterPromptsLoading: !1,
|
|
523
524
|
appearance: null,
|
|
524
525
|
messages: [],
|
|
526
|
+
activeScheduledFollowUps: null,
|
|
525
527
|
isLoadingSession: !1,
|
|
526
528
|
assistantDraft: "",
|
|
527
529
|
assistantDraftItemId: null,
|
|
@@ -538,18 +540,18 @@ class Kt {
|
|
|
538
540
|
lastErrorSecuritySettingsUrl: null
|
|
539
541
|
};
|
|
540
542
|
static async init(e) {
|
|
541
|
-
const s = e, n = await
|
|
543
|
+
const s = e, n = await Bs(
|
|
542
544
|
s.skipStoredTransportIdentityCollisionCheck === !0
|
|
543
|
-
), r = new
|
|
545
|
+
), r = new Gt({
|
|
544
546
|
...e,
|
|
545
|
-
backendUrl:
|
|
546
|
-
clientId: e.clientId ??
|
|
547
|
+
backendUrl: xn(e.backendUrl ?? en),
|
|
548
|
+
clientId: e.clientId ?? rr(),
|
|
547
549
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
548
|
-
entrySurface:
|
|
550
|
+
entrySurface: Bn(e.entrySurface)
|
|
549
551
|
}, n);
|
|
550
552
|
try {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
+
As().catch((i) => {
|
|
554
|
+
A("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
553
555
|
message: i instanceof Error ? i.message : String(i)
|
|
554
556
|
});
|
|
555
557
|
}), s.disableNetworkCapture || r.enableNetworkCapture(), r.startPageLifecycleRecovery(), r.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await r.connect();
|
|
@@ -570,6 +572,21 @@ class Kt {
|
|
|
570
572
|
messages: [...this.state.messages]
|
|
571
573
|
};
|
|
572
574
|
}
|
|
575
|
+
stageProactiveSuggestionQuestion(e) {
|
|
576
|
+
const s = e.trim();
|
|
577
|
+
if (!s)
|
|
578
|
+
return;
|
|
579
|
+
const n = this.stagedProactiveSuggestionQuestionMessageId ?? `local-proactive-suggestion-edit-${x()}`;
|
|
580
|
+
this.stagedProactiveSuggestionQuestionMessageId = n;
|
|
581
|
+
const r = {
|
|
582
|
+
id: n,
|
|
583
|
+
role: "assistant",
|
|
584
|
+
phase: "final_answer",
|
|
585
|
+
content: s,
|
|
586
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
587
|
+
}, i = this.state.messages.findIndex((a) => a.id === n), o = [...this.state.messages];
|
|
588
|
+
i >= 0 ? o[i] = r : o.push(r), this.setState({ messages: o }), this.emit("message", r);
|
|
589
|
+
}
|
|
573
590
|
async connect() {
|
|
574
591
|
if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
|
|
575
592
|
return;
|
|
@@ -579,15 +596,15 @@ class Kt {
|
|
|
579
596
|
this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
|
|
580
597
|
);
|
|
581
598
|
try {
|
|
582
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await Tn(this.options.tokenProvider(),
|
|
599
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await Tn(this.options.tokenProvider(), nn, "Pluno token provider timed out") : null), e !== this.connectionAttemptId || this.state.status === "closed")
|
|
583
600
|
return;
|
|
584
601
|
if (!this.token && !this.options.webSocketFactory)
|
|
585
602
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
586
|
-
const s =
|
|
603
|
+
const s = $n(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
|
|
587
604
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
588
|
-
this.socket === n && n.readyState === WebSocket.CONNECTING && (
|
|
589
|
-
},
|
|
590
|
-
this.socket !== n || (this.clearSocketConnectTimer(),
|
|
605
|
+
this.socket === n && n.readyState === WebSocket.CONNECTING && (A("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
606
|
+
}, rn), n.addEventListener("open", () => {
|
|
607
|
+
this.socket !== n || (this.clearSocketConnectTimer(), A("web-sdk.agent", "Pluno socket opened", {
|
|
591
608
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
592
609
|
isThinking: this.state.isThinking
|
|
593
610
|
}), !(this.token ? this.sendNow({
|
|
@@ -597,19 +614,19 @@ class Kt {
|
|
|
597
614
|
transportId: this.transportIdentity.transportId,
|
|
598
615
|
pageUrl: location.href
|
|
599
616
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
600
|
-
this.socket === n && (
|
|
601
|
-
},
|
|
617
|
+
this.socket === n && (A("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
618
|
+
}, on));
|
|
602
619
|
}), n.addEventListener("message", (r) => {
|
|
603
|
-
this.socket === n && this.handleServerEvent(
|
|
620
|
+
this.socket === n && this.handleServerEvent(Qn(r.data));
|
|
604
621
|
}), n.addEventListener("sendfailure", (r) => {
|
|
605
622
|
if (this.socket !== n)
|
|
606
623
|
return;
|
|
607
624
|
const i = Yn(r?.detail?.data);
|
|
608
625
|
i?.type === "chat.user_message" && i.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
609
626
|
(o) => o.type === "chat.user_message" && o.clientMessageId === i.clientMessageId
|
|
610
|
-
) && (this.queuedClientEvents.push(i),
|
|
627
|
+
) && (this.queuedClientEvents.push(i), V(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();
|
|
611
628
|
}), n.addEventListener("close", (r) => {
|
|
612
|
-
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (
|
|
629
|
+
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (A("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
613
630
|
code: typeof r?.code == "number" ? r.code : null,
|
|
614
631
|
reason: typeof r?.reason == "string" ? r.reason : "",
|
|
615
632
|
wasClean: typeof r?.wasClean == "boolean" ? r.wasClean : null,
|
|
@@ -617,7 +634,7 @@ class Kt {
|
|
|
617
634
|
isThinking: this.state.isThinking
|
|
618
635
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
619
636
|
}), n.addEventListener("error", () => {
|
|
620
|
-
this.socket !== n || this.state.status === "closed" || (
|
|
637
|
+
this.socket !== n || this.state.status === "closed" || (A("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
621
638
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
622
639
|
isThinking: this.state.isThinking
|
|
623
640
|
}), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
|
|
@@ -640,7 +657,7 @@ class Kt {
|
|
|
640
657
|
this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
641
658
|
}
|
|
642
659
|
destroy() {
|
|
643
|
-
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
660
|
+
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), ei(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
|
|
644
661
|
for (const e of Object.values(this.listeners))
|
|
645
662
|
e?.clear();
|
|
646
663
|
}
|
|
@@ -648,7 +665,7 @@ class Kt {
|
|
|
648
665
|
const s = b(), n = `${this.state.sessionId ?? "draft"}:${s.url}`, r = e === "composer_input" && this.pendingComposerWarmup?.scope === n ? this.pendingComposerWarmup : null, i = {
|
|
649
666
|
type: "runtime.warmup",
|
|
650
667
|
reason: e,
|
|
651
|
-
...e === "composer_input" ? { warmupId: r?.event.warmupId ??
|
|
668
|
+
...e === "composer_input" ? { warmupId: r?.event.warmupId ?? x() } : {},
|
|
652
669
|
entrySurface: this.options.entrySurface,
|
|
653
670
|
sessionId: this.state.sessionId ?? void 0,
|
|
654
671
|
page: s,
|
|
@@ -679,23 +696,40 @@ class Kt {
|
|
|
679
696
|
}
|
|
680
697
|
async sendMessage(e, s = {}) {
|
|
681
698
|
const n = e.trim(), r = s.attachments ?? [];
|
|
682
|
-
if (this.options.productVariant === "customer_embedded" && (r.forEach(
|
|
683
|
-
(
|
|
699
|
+
if (this.options.productVariant === "customer_embedded" && (r.forEach(us), r.reduce(
|
|
700
|
+
(T, N) => T + N.sizeBytes,
|
|
684
701
|
0
|
|
685
702
|
) > jt))
|
|
686
703
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
687
|
-
let i = r.map(
|
|
704
|
+
let i = r.map(ke);
|
|
688
705
|
if (!n && i.length === 0)
|
|
689
706
|
return null;
|
|
690
707
|
if (this.pendingClientMessageId)
|
|
691
708
|
throw new Error("Wait for the current message to finish sending before sending another.");
|
|
692
|
-
const o = b(), a = s.clientMessageId ??
|
|
709
|
+
const o = b(), a = s.clientMessageId ?? x(), l = s.proactiveSuggestionQuestion?.trim(), c = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
|
|
710
|
+
(S) => S.id === this.stagedProactiveSuggestionQuestionMessageId
|
|
711
|
+
) ?? null : null, d = l ? {
|
|
712
|
+
id: `local-proactive-suggestion-question-${a}`,
|
|
713
|
+
role: "assistant",
|
|
714
|
+
phase: "final_answer",
|
|
715
|
+
content: l,
|
|
716
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
717
|
+
} : null, h = {
|
|
693
718
|
id: `local-${a}`,
|
|
694
719
|
role: "user",
|
|
695
720
|
content: n,
|
|
696
721
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
697
722
|
...r.length > 0 ? { attachments: r } : {}
|
|
698
|
-
},
|
|
723
|
+
}, m = this.state.messages.some((S) => S.id === h.id || S.clientMessageId === a), f = this.state.isThinking, u = this.state.taskStatus, p = this.state.pendingMessageStatus, g = this.state.turnPhase, y = this.state.messages, M = m ? this.state.messages : [
|
|
724
|
+
...this.state.messages.map(
|
|
725
|
+
(S) => c && S.id === c.id ? {
|
|
726
|
+
...S,
|
|
727
|
+
id: `local-proactive-suggestion-question-${a}`
|
|
728
|
+
} : S
|
|
729
|
+
),
|
|
730
|
+
...!c && d ? [d] : [],
|
|
731
|
+
h
|
|
732
|
+
], w = {
|
|
699
733
|
assistantDraft: this.state.assistantDraft,
|
|
700
734
|
assistantDraftItemId: this.state.assistantDraftItemId,
|
|
701
735
|
assistantDraftPhase: this.state.assistantDraftPhase,
|
|
@@ -704,8 +738,8 @@ class Kt {
|
|
|
704
738
|
lastError: this.state.lastError
|
|
705
739
|
};
|
|
706
740
|
this.setState({
|
|
707
|
-
messages:
|
|
708
|
-
...
|
|
741
|
+
messages: M,
|
|
742
|
+
...f ? {} : {
|
|
709
743
|
assistantDraft: "",
|
|
710
744
|
assistantDraftItemId: null,
|
|
711
745
|
assistantDraftPhase: null,
|
|
@@ -713,56 +747,57 @@ class Kt {
|
|
|
713
747
|
assistantDraftRunId: null
|
|
714
748
|
},
|
|
715
749
|
pendingMessageStatus: "sending",
|
|
716
|
-
turnPhase:
|
|
717
|
-
isThinking:
|
|
750
|
+
turnPhase: f ? g : "sending",
|
|
751
|
+
isThinking: f,
|
|
718
752
|
taskStatus: "working",
|
|
719
753
|
isRetrying: !1,
|
|
720
754
|
lastError: null
|
|
721
|
-
}),
|
|
755
|
+
}), m || (d && !c && this.emit("message", d), this.emit("message", h));
|
|
722
756
|
try {
|
|
723
|
-
const
|
|
724
|
-
for (const
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
727
|
-
|
|
757
|
+
const S = [];
|
|
758
|
+
for (const T of i) {
|
|
759
|
+
const N = T.id ? this.attachmentFiles.get(T.id) : void 0;
|
|
760
|
+
if (T.sandboxPath || T.storageKey) {
|
|
761
|
+
S.push(T);
|
|
728
762
|
continue;
|
|
729
763
|
}
|
|
730
|
-
if (!
|
|
731
|
-
throw new Error(`Attachment bytes are unavailable for ${
|
|
732
|
-
|
|
764
|
+
if (!N)
|
|
765
|
+
throw new Error(`Attachment bytes are unavailable for ${T.name}`);
|
|
766
|
+
S.push(await this.uploadAttachmentForMessage({ file: N, attachment: T }));
|
|
733
767
|
}
|
|
734
|
-
i =
|
|
735
|
-
} catch (
|
|
768
|
+
i = S;
|
|
769
|
+
} catch (S) {
|
|
736
770
|
throw this.setState({
|
|
737
|
-
...
|
|
738
|
-
...
|
|
739
|
-
pendingMessageStatus:
|
|
740
|
-
turnPhase:
|
|
741
|
-
taskStatus:
|
|
742
|
-
}),
|
|
771
|
+
...m ? {} : { messages: y },
|
|
772
|
+
...f ? {} : { ...w, isThinking: !1 },
|
|
773
|
+
pendingMessageStatus: p,
|
|
774
|
+
turnPhase: g,
|
|
775
|
+
taskStatus: u
|
|
776
|
+
}), S;
|
|
743
777
|
}
|
|
744
778
|
this.retryableClientMessageId = null;
|
|
745
|
-
const
|
|
779
|
+
const D = !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, U = {
|
|
746
780
|
type: "chat.user_message",
|
|
747
781
|
sessionId: this.state.sessionId ?? void 0,
|
|
748
782
|
clientMessageId: a,
|
|
749
783
|
initiatedBy: s.initiatedBy,
|
|
750
|
-
invocation:
|
|
784
|
+
invocation: Wn(s.invocation ?? s.initiatedBy),
|
|
751
785
|
entrySurface: this.options.entrySurface,
|
|
752
786
|
content: n,
|
|
753
|
-
|
|
754
|
-
|
|
787
|
+
proactiveSuggestionQuestion: s.proactiveSuggestionQuestion,
|
|
788
|
+
pageContent: D && at() || void 0,
|
|
789
|
+
attachments: i.length > 0 ? i.map(ke) : void 0,
|
|
755
790
|
page: o,
|
|
756
791
|
model: this.options.model,
|
|
757
792
|
metadata: kt(this.options.metadata)
|
|
758
793
|
};
|
|
759
|
-
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent =
|
|
794
|
+
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = U, this.stagedProactiveSuggestionQuestionMessageId = null, this.send(U), this.schedulePendingDeliveryAck(a), a;
|
|
760
795
|
}
|
|
761
796
|
getModel() {
|
|
762
797
|
return this.options.model;
|
|
763
798
|
}
|
|
764
799
|
setModel(e) {
|
|
765
|
-
this.options.model = e, this.options.productVariant === "personal" &&
|
|
800
|
+
this.options.model = e, this.options.productVariant === "personal" && He(e) && (this.personalModelSelectionOverride = e);
|
|
766
801
|
}
|
|
767
802
|
retryLastMessage() {
|
|
768
803
|
const e = this.state.sessionId, s = this.retryableClientMessageId;
|
|
@@ -777,19 +812,19 @@ class Kt {
|
|
|
777
812
|
lastErrorCode: null
|
|
778
813
|
}), this.send(n), this.schedulePendingDeliveryAck(s), !0;
|
|
779
814
|
}
|
|
780
|
-
return e ? (this.retryAttemptsByClientMessageId[s] = 0, this.recoveryExhaustionRequestedClientMessageIds.delete(s), this.retryableClientMessageId = null, this.activeClientMessageId = 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;
|
|
815
|
+
return e ? (this.retryAttemptsByClientMessageId[s] = 0, this.recoveryExhaustionRequestedClientMessageIds.delete(s), this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.activeClientMessageId = 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;
|
|
781
816
|
}
|
|
782
817
|
createLocalAttachment(e) {
|
|
783
|
-
this.options.productVariant === "customer_embedded" &&
|
|
784
|
-
const s =
|
|
818
|
+
this.options.productVariant === "customer_embedded" && ti(e);
|
|
819
|
+
const s = x(), n = {
|
|
785
820
|
id: s,
|
|
786
821
|
name: e.name || "attachment",
|
|
787
|
-
mimeType:
|
|
822
|
+
mimeType: tt(e),
|
|
788
823
|
sizeBytes: e.size
|
|
789
824
|
};
|
|
790
825
|
this.attachmentFiles.set(s, e);
|
|
791
826
|
const r = Date.now();
|
|
792
|
-
return
|
|
827
|
+
return ws({
|
|
793
828
|
attachmentId: s,
|
|
794
829
|
name: n.name,
|
|
795
830
|
mimeType: n.mimeType,
|
|
@@ -800,7 +835,7 @@ class Kt {
|
|
|
800
835
|
createdAt: r,
|
|
801
836
|
lastUsedAt: r
|
|
802
837
|
}).catch((i) => {
|
|
803
|
-
|
|
838
|
+
A("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
804
839
|
attachmentId: s,
|
|
805
840
|
name: n.name,
|
|
806
841
|
message: i instanceof Error ? i.message : String(i)
|
|
@@ -818,7 +853,7 @@ class Kt {
|
|
|
818
853
|
file: e,
|
|
819
854
|
attachment: s
|
|
820
855
|
}) {
|
|
821
|
-
const n = this.state.sessionId, r =
|
|
856
|
+
const n = this.state.sessionId, r = tt(e), i = {
|
|
822
857
|
sessionId: n ?? void 0,
|
|
823
858
|
attachmentId: s.id,
|
|
824
859
|
clientId: this.options.clientId,
|
|
@@ -833,36 +868,36 @@ class Kt {
|
|
|
833
868
|
};
|
|
834
869
|
let o;
|
|
835
870
|
if (this.options.persistAttachmentUpload)
|
|
836
|
-
o = await
|
|
871
|
+
o = await Se(
|
|
837
872
|
() => this.options.persistAttachmentUpload(i, e),
|
|
838
873
|
"Failed to upload attachment"
|
|
839
874
|
);
|
|
840
875
|
else {
|
|
841
|
-
const l = this.options.prepareAttachmentUpload ? await
|
|
876
|
+
const l = this.options.prepareAttachmentUpload ? await Se(
|
|
842
877
|
() => this.options.prepareAttachmentUpload(i),
|
|
843
878
|
"Failed to prepare attachment upload"
|
|
844
879
|
) : await this.prepareEmbedAttachmentUpload(i);
|
|
845
|
-
await
|
|
880
|
+
await Se(async () => {
|
|
846
881
|
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
847
882
|
method: l.uploadMethod,
|
|
848
883
|
headers: l.uploadHeaders,
|
|
849
884
|
body: e
|
|
850
885
|
});
|
|
851
886
|
if (!c.ok)
|
|
852
|
-
throw new
|
|
887
|
+
throw new Ae("Failed to upload attachment", c.status);
|
|
853
888
|
return c;
|
|
854
889
|
}, "Failed to upload attachment"), o = l;
|
|
855
890
|
}
|
|
856
891
|
this.setState({ sessionId: o.sessionId });
|
|
857
|
-
const a =
|
|
858
|
-
return this.updateAttachmentInState(s.id, a), s.id &&
|
|
892
|
+
const a = cs(o.attachment, this.options.backendUrl);
|
|
893
|
+
return this.updateAttachmentInState(s.id, a), s.id && Ms(s.id, {
|
|
859
894
|
sessionId: o.sessionId,
|
|
860
895
|
fileUrl: a.fileUrl,
|
|
861
896
|
sandboxPath: a.sandboxPath,
|
|
862
897
|
storageKey: a.storageKey,
|
|
863
898
|
lastUsedAt: Date.now()
|
|
864
899
|
}).catch((l) => {
|
|
865
|
-
|
|
900
|
+
A("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
866
901
|
attachmentId: s.id,
|
|
867
902
|
name: a.name,
|
|
868
903
|
message: l instanceof Error ? l.message : String(l)
|
|
@@ -882,18 +917,18 @@ class Kt {
|
|
|
882
917
|
}
|
|
883
918
|
async prepareEmbedAttachmentUpload(e) {
|
|
884
919
|
let s = !1;
|
|
885
|
-
return await
|
|
920
|
+
return await Se(async () => {
|
|
886
921
|
const n = await this.fetchEmbedAttachmentUpload(e);
|
|
887
922
|
if (n.ok)
|
|
888
923
|
return await n.json();
|
|
889
|
-
if (
|
|
924
|
+
if (Ii(n.status) && this.options.tokenProvider && !s) {
|
|
890
925
|
s = !0;
|
|
891
926
|
const r = await this.fetchEmbedAttachmentUpload(e);
|
|
892
927
|
if (r.ok)
|
|
893
928
|
return await r.json();
|
|
894
|
-
throw new
|
|
929
|
+
throw new Ae("Failed to prepare attachment upload", r.status);
|
|
895
930
|
}
|
|
896
|
-
throw new
|
|
931
|
+
throw new Ae("Failed to prepare attachment upload", n.status);
|
|
897
932
|
}, "Failed to prepare attachment upload");
|
|
898
933
|
}
|
|
899
934
|
async fetchEmbedAttachmentUpload(e) {
|
|
@@ -911,7 +946,7 @@ class Kt {
|
|
|
911
946
|
if (!this.state.sessionId)
|
|
912
947
|
return;
|
|
913
948
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
914
|
-
const e =
|
|
949
|
+
const e = Nr(
|
|
915
950
|
this.state.messages,
|
|
916
951
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
917
952
|
this.state.assistantDraftRunId,
|
|
@@ -924,7 +959,7 @@ class Kt {
|
|
|
924
959
|
stoppedCausalSequence: null,
|
|
925
960
|
toolCallIds: new Set(
|
|
926
961
|
this.state.messages.filter(
|
|
927
|
-
(s) =>
|
|
962
|
+
(s) => Ke(
|
|
928
963
|
s,
|
|
929
964
|
e.respondsToUserMessageId,
|
|
930
965
|
e.runId
|
|
@@ -934,8 +969,8 @@ class Kt {
|
|
|
934
969
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
935
970
|
for (const [s, n] of this.activeBrowserToolCalls)
|
|
936
971
|
n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(s);
|
|
937
|
-
|
|
938
|
-
messages:
|
|
972
|
+
Nt(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
|
|
973
|
+
messages: qt(
|
|
939
974
|
this.state.messages,
|
|
940
975
|
e.clientMessageId,
|
|
941
976
|
e.runId
|
|
@@ -951,7 +986,7 @@ class Kt {
|
|
|
951
986
|
}
|
|
952
987
|
startNewSession(e = {}) {
|
|
953
988
|
const s = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
|
|
954
|
-
!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.rememberCurrentRunAsDetached(), 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.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.personalModelSelectionOverride = null, this.options.model = void 0), s && this.send({
|
|
989
|
+
!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.rememberCurrentRunAsDetached(), 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.stagedProactiveSuggestionQuestionMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.personalModelSelectionOverride = null, this.options.model = void 0), s && this.send({
|
|
955
990
|
type: "session.reset",
|
|
956
991
|
sessionId: this.state.sessionId ?? void 0,
|
|
957
992
|
warmupId: n ?? void 0,
|
|
@@ -960,6 +995,7 @@ class Kt {
|
|
|
960
995
|
sessionId: null,
|
|
961
996
|
starterPrompts: [...this.state.starterPrompts],
|
|
962
997
|
messages: [],
|
|
998
|
+
activeScheduledFollowUps: null,
|
|
963
999
|
isLoadingSession: !1,
|
|
964
1000
|
assistantDraft: "",
|
|
965
1001
|
assistantDraftItemId: null,
|
|
@@ -974,7 +1010,7 @@ class Kt {
|
|
|
974
1010
|
});
|
|
975
1011
|
}
|
|
976
1012
|
listSessions(e = {}) {
|
|
977
|
-
const s =
|
|
1013
|
+
const s = x(), n = new Promise((i, o) => {
|
|
978
1014
|
const a = window.setTimeout(() => {
|
|
979
1015
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
980
1016
|
}, Rt);
|
|
@@ -996,19 +1032,19 @@ class Kt {
|
|
|
996
1032
|
setSessionPinned(e, s) {
|
|
997
1033
|
return this.sendSessionMutation(
|
|
998
1034
|
this.pendingSessionPinRequests,
|
|
999
|
-
{ type: "session.pin", requestId:
|
|
1035
|
+
{ type: "session.pin", requestId: x(), sessionId: e, pinned: s },
|
|
1000
1036
|
"Session pin did not respond in time"
|
|
1001
1037
|
);
|
|
1002
1038
|
}
|
|
1003
1039
|
renameSession(e, s) {
|
|
1004
1040
|
return this.sendSessionMutation(
|
|
1005
1041
|
this.pendingSessionRenameRequests,
|
|
1006
|
-
{ type: "session.rename", requestId:
|
|
1042
|
+
{ type: "session.rename", requestId: x(), sessionId: e, title: s },
|
|
1007
1043
|
"Session rename did not respond in time"
|
|
1008
1044
|
);
|
|
1009
1045
|
}
|
|
1010
1046
|
loadSession(e) {
|
|
1011
|
-
const s =
|
|
1047
|
+
const s = x(), n = this.activeComposerWarmupId;
|
|
1012
1048
|
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !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({
|
|
1013
1049
|
type: "session.reset",
|
|
1014
1050
|
warmupId: n,
|
|
@@ -1016,6 +1052,7 @@ class Kt {
|
|
|
1016
1052
|
}), this.clearThinkingWatchdog(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.options.productVariant === "personal" && this.state.sessionId !== e && (this.personalModelSelectionOverride = null, this.options.model = void 0), this.clearSessionLoadRequest(), this.sessionLoadRequestId = s, this.sessionActivityRequestId = null, this.setState({
|
|
1017
1053
|
sessionId: e,
|
|
1018
1054
|
messages: [],
|
|
1055
|
+
activeScheduledFollowUps: null,
|
|
1019
1056
|
isLoadingSession: !0,
|
|
1020
1057
|
assistantDraft: "",
|
|
1021
1058
|
assistantDraftItemId: null,
|
|
@@ -1055,7 +1092,8 @@ class Kt {
|
|
|
1055
1092
|
type: "conversation.state",
|
|
1056
1093
|
requestId: s,
|
|
1057
1094
|
session: r.session,
|
|
1058
|
-
items: r.items
|
|
1095
|
+
items: r.items,
|
|
1096
|
+
...r.activeScheduledFollowUps !== void 0 ? { activeScheduledFollowUps: r.activeScheduledFollowUps } : {}
|
|
1059
1097
|
});
|
|
1060
1098
|
for (const o of i)
|
|
1061
1099
|
this.handleServerEvent(o);
|
|
@@ -1065,7 +1103,7 @@ class Kt {
|
|
|
1065
1103
|
}
|
|
1066
1104
|
subscribeToSessionBeforeHistory(e) {
|
|
1067
1105
|
this.pendingSessionSubscription?.resolve(!1);
|
|
1068
|
-
const s =
|
|
1106
|
+
const s = x(), n = new Promise((r) => {
|
|
1069
1107
|
this.pendingSessionSubscription = { requestId: s, sessionId: e, resolve: r };
|
|
1070
1108
|
});
|
|
1071
1109
|
return this.send({
|
|
@@ -1079,7 +1117,7 @@ class Kt {
|
|
|
1079
1117
|
async autoLoadSessionActivity(e) {
|
|
1080
1118
|
let s = null;
|
|
1081
1119
|
do {
|
|
1082
|
-
const n =
|
|
1120
|
+
const n = x();
|
|
1083
1121
|
this.sessionActivityRequestId = n;
|
|
1084
1122
|
let r;
|
|
1085
1123
|
try {
|
|
@@ -1105,7 +1143,7 @@ class Kt {
|
|
|
1105
1143
|
try {
|
|
1106
1144
|
const o = this.options.token ?? await this.options.tokenProvider?.() ?? this.token;
|
|
1107
1145
|
if (!o)
|
|
1108
|
-
throw new
|
|
1146
|
+
throw new ge("Product Agent history requires authentication");
|
|
1109
1147
|
this.token = o;
|
|
1110
1148
|
const a = new URLSearchParams();
|
|
1111
1149
|
s === "activity" && a.set("limit", "200"), n && a.set("cursor", n);
|
|
@@ -1118,21 +1156,22 @@ class Kt {
|
|
|
1118
1156
|
signal: AbortSignal.timeout(15e3)
|
|
1119
1157
|
});
|
|
1120
1158
|
if (!d.ok) {
|
|
1121
|
-
const
|
|
1122
|
-
throw
|
|
1159
|
+
const m = await d.text() || `History request failed (${d.status})`;
|
|
1160
|
+
throw Zs(d.status) ? new Error(m) : new ge(m);
|
|
1123
1161
|
}
|
|
1124
|
-
const
|
|
1125
|
-
if (!
|
|
1126
|
-
throw new
|
|
1162
|
+
const h = await d.json();
|
|
1163
|
+
if (!h?.session || !Array.isArray(h.items))
|
|
1164
|
+
throw new ge("Invalid Product Agent session history response");
|
|
1127
1165
|
return {
|
|
1128
|
-
session:
|
|
1129
|
-
items:
|
|
1130
|
-
nextCursor: typeof
|
|
1166
|
+
session: h.session,
|
|
1167
|
+
items: h.items,
|
|
1168
|
+
nextCursor: typeof h.nextCursor == "string" ? h.nextCursor : null,
|
|
1169
|
+
...Object.prototype.hasOwnProperty.call(h, "activeScheduledFollowUps") ? { activeScheduledFollowUps: h.activeScheduledFollowUps } : {}
|
|
1131
1170
|
};
|
|
1132
1171
|
} catch (o) {
|
|
1133
|
-
if (o instanceof
|
|
1172
|
+
if (o instanceof ge)
|
|
1134
1173
|
throw o;
|
|
1135
|
-
|
|
1174
|
+
A("web-sdk.history", "HTTP session history page failed; retrying", {
|
|
1136
1175
|
sessionId: e,
|
|
1137
1176
|
hasCursor: !!n,
|
|
1138
1177
|
retryDelayMs: i,
|
|
@@ -1146,7 +1185,7 @@ class Kt {
|
|
|
1146
1185
|
return;
|
|
1147
1186
|
const i = n instanceof Error ? n.message : String(n);
|
|
1148
1187
|
if (r) {
|
|
1149
|
-
this.sessionActivityRequestId = null,
|
|
1188
|
+
this.sessionActivityRequestId = null, A("web-sdk.history", "Background session activity hydration stopped", {
|
|
1150
1189
|
sessionId: s,
|
|
1151
1190
|
message: i
|
|
1152
1191
|
});
|
|
@@ -1158,7 +1197,7 @@ class Kt {
|
|
|
1158
1197
|
message: i,
|
|
1159
1198
|
requestId: e,
|
|
1160
1199
|
sessionId: s
|
|
1161
|
-
}),
|
|
1200
|
+
}), A("web-sdk.history", "HTTP session history page failed permanently", {
|
|
1162
1201
|
sessionId: s,
|
|
1163
1202
|
message: i
|
|
1164
1203
|
});
|
|
@@ -1166,7 +1205,7 @@ class Kt {
|
|
|
1166
1205
|
send(e) {
|
|
1167
1206
|
this.sendNow(q(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
|
|
1168
1207
|
(r) => r.type === "chat.user_message" && r.clientMessageId === e.clientMessageId
|
|
1169
|
-
) || this.queuedClientEvents.push(e),
|
|
1208
|
+
) || this.queuedClientEvents.push(e), V(this.options.clientId, this.queuedClientEvents), this.setState({
|
|
1170
1209
|
status: "reconnecting",
|
|
1171
1210
|
...e.type === "chat.user_message" && e.clientMessageId === this.pendingClientMessageId ? { pendingMessageStatus: "reconnecting" } : {}
|
|
1172
1211
|
}), this.scheduleReconnect());
|
|
@@ -1182,9 +1221,9 @@ class Kt {
|
|
|
1182
1221
|
return !1;
|
|
1183
1222
|
const s = this.socket;
|
|
1184
1223
|
try {
|
|
1185
|
-
return s.send(JSON.stringify(e)),
|
|
1224
|
+
return s.send(JSON.stringify(e)), $e("client_event", e.type, mt(e)), !0;
|
|
1186
1225
|
} catch (n) {
|
|
1187
|
-
return
|
|
1226
|
+
return A("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
1188
1227
|
message: n instanceof Error ? n.message : String(n),
|
|
1189
1228
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1190
1229
|
isThinking: this.state.isThinking
|
|
@@ -1216,7 +1255,7 @@ class Kt {
|
|
|
1216
1255
|
}
|
|
1217
1256
|
}));
|
|
1218
1257
|
} catch (r) {
|
|
1219
|
-
|
|
1258
|
+
A("web-sdk.agent", "Pluno health signal send failed", {
|
|
1220
1259
|
name: e,
|
|
1221
1260
|
message: r instanceof Error ? r.message : String(r)
|
|
1222
1261
|
});
|
|
@@ -1226,7 +1265,7 @@ class Kt {
|
|
|
1226
1265
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
1227
1266
|
return;
|
|
1228
1267
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
1229
|
-
const e =
|
|
1268
|
+
const e = Fn();
|
|
1230
1269
|
this.sendNow(
|
|
1231
1270
|
q({
|
|
1232
1271
|
type: "starter_prompts.page_context",
|
|
@@ -1243,7 +1282,7 @@ class Kt {
|
|
|
1243
1282
|
const e = location.href;
|
|
1244
1283
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
1245
1284
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
1246
|
-
},
|
|
1285
|
+
}, In));
|
|
1247
1286
|
}
|
|
1248
1287
|
refreshStarterPromptsForCurrentUrl() {
|
|
1249
1288
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -1258,18 +1297,18 @@ class Kt {
|
|
|
1258
1297
|
if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
|
|
1259
1298
|
return;
|
|
1260
1299
|
const e = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
|
|
1261
|
-
|
|
1300
|
+
V(this.options.clientId, this.queuedClientEvents);
|
|
1262
1301
|
for (let s = 0; s < e.length; s += 1) {
|
|
1263
1302
|
const n = e[s];
|
|
1264
1303
|
if (!this.sendNow(q(n))) {
|
|
1265
|
-
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)),
|
|
1304
|
+
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)), V(this.options.clientId, this.queuedClientEvents);
|
|
1266
1305
|
return;
|
|
1267
1306
|
}
|
|
1268
|
-
|
|
1307
|
+
V(this.options.clientId, this.queuedClientEvents);
|
|
1269
1308
|
}
|
|
1270
1309
|
}
|
|
1271
1310
|
resetForAuthenticationScopeChange() {
|
|
1272
|
-
this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [],
|
|
1311
|
+
this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [], V(this.options.clientId, this.queuedClientEvents), this.pendingWidgetLifecycleEvents = [], this.backgroundSessionIds.clear(), this.backgroundClientMessageIds.clear(), this.deferredSessionUpdatedSessionIds.clear(), this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
|
|
1273
1312
|
}
|
|
1274
1313
|
flushPendingWidgetLifecycleEvents() {
|
|
1275
1314
|
if (this.authenticatedSocket !== this.socket || this.socket?.readyState !== WebSocket.OPEN || this.pendingWidgetLifecycleEvents.length === 0)
|
|
@@ -1290,8 +1329,8 @@ class Kt {
|
|
|
1290
1329
|
return;
|
|
1291
1330
|
this.clearPendingWarmupAckTimer();
|
|
1292
1331
|
const s = Math.min(
|
|
1293
|
-
|
|
1294
|
-
|
|
1332
|
+
an * 2 ** e.retryAttempt,
|
|
1333
|
+
ln
|
|
1295
1334
|
);
|
|
1296
1335
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
1297
1336
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -1304,26 +1343,26 @@ class Kt {
|
|
|
1304
1343
|
return [...this.stoppedTurns].reverse().find((o) => o.sessionId !== e ? !1 : r && o.respondsToUserMessageId ? r === o.respondsToUserMessageId : n && o.clientMessageId ? n === o.clientMessageId : !!(i && o.runId && i === o.runId)) ?? null;
|
|
1305
1344
|
}
|
|
1306
1345
|
findStoppedTurnForEvent(e) {
|
|
1307
|
-
const s = e.type === "session.item" ?
|
|
1346
|
+
const s = e.type === "session.item" ? P(e.item) : null;
|
|
1308
1347
|
return this.findStoppedTurn(
|
|
1309
|
-
|
|
1348
|
+
G(e) ?? this.state.sessionId,
|
|
1310
1349
|
s ?? e
|
|
1311
1350
|
);
|
|
1312
1351
|
}
|
|
1313
1352
|
rememberDurablyStoppedTurn(e, s, n) {
|
|
1314
|
-
if (!e || !s || !
|
|
1353
|
+
if (!e || !s || !Me(s) || this.findStoppedTurn(e, s))
|
|
1315
1354
|
return;
|
|
1316
|
-
const r = L(s), i =
|
|
1355
|
+
const r = L(s), i = C(s), o = typeof s.clientMessageId == "string" ? s.clientMessageId : r ? this.clientMessageIdsByUserMessageItemId.get(r) ?? null : null;
|
|
1317
1356
|
this.stoppedTurns.push({
|
|
1318
1357
|
sessionId: e,
|
|
1319
1358
|
clientMessageId: o,
|
|
1320
1359
|
respondsToUserMessageId: r,
|
|
1321
1360
|
runId: i,
|
|
1322
1361
|
stoppedAt: n,
|
|
1323
|
-
stoppedCausalSequence:
|
|
1362
|
+
stoppedCausalSequence: v(s),
|
|
1324
1363
|
toolCallIds: new Set(
|
|
1325
1364
|
this.state.messages.filter(
|
|
1326
|
-
(a) =>
|
|
1365
|
+
(a) => Ke(a, r, i)
|
|
1327
1366
|
).map((a) => a.callId).filter((a) => typeof a == "string")
|
|
1328
1367
|
)
|
|
1329
1368
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
@@ -1333,26 +1372,26 @@ class Kt {
|
|
|
1333
1372
|
const n = typeof e.callId == "string" ? e.callId : null;
|
|
1334
1373
|
return !!(n && this.stoppedTurns.some((r) => r.toolCallIds.has(n)));
|
|
1335
1374
|
}
|
|
1336
|
-
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !
|
|
1375
|
+
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !Me(P(e.item)) : e.type !== "conversation.state" : !1;
|
|
1337
1376
|
}
|
|
1338
1377
|
filterStoppedSnapshotItems(e, s) {
|
|
1339
1378
|
return e.filter((n) => {
|
|
1340
|
-
const r =
|
|
1341
|
-
if (!i || r?.type === "message" && r.role === "user" ||
|
|
1379
|
+
const r = P(n), i = r ? this.findStoppedTurn(s, r) : null;
|
|
1380
|
+
if (!i || r?.type === "message" && r.role === "user" || Me(r))
|
|
1342
1381
|
return !0;
|
|
1343
1382
|
if (i.stoppedCausalSequence !== null) {
|
|
1344
|
-
const o = r ?
|
|
1383
|
+
const o = r ? v(r) : null;
|
|
1345
1384
|
return o === null || o <= i.stoppedCausalSequence;
|
|
1346
1385
|
}
|
|
1347
1386
|
if (i.stoppedAt) {
|
|
1348
|
-
const o =
|
|
1387
|
+
const o = R(n, "createdAt");
|
|
1349
1388
|
return !!(o && Date.parse(o) <= Date.parse(i.stoppedAt));
|
|
1350
1389
|
}
|
|
1351
1390
|
return !1;
|
|
1352
1391
|
});
|
|
1353
1392
|
}
|
|
1354
1393
|
handleServerEvent(e) {
|
|
1355
|
-
if (
|
|
1394
|
+
if ($e("server_event", e.type, mt(e)), e.type === "session.subscribed") {
|
|
1356
1395
|
const s = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
1357
1396
|
if (s && n && s === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
|
|
1358
1397
|
const r = this.pendingSessionSubscription;
|
|
@@ -1365,14 +1404,14 @@ class Kt {
|
|
|
1365
1404
|
this.pendingSessionSubscription = null, s.resolve(!1), n && (this.sessionHistoryHydration = null, this.handleServerEvent({ ...e, requestId: n.requestId }));
|
|
1366
1405
|
return;
|
|
1367
1406
|
}
|
|
1368
|
-
if (this.sessionHistoryHydration &&
|
|
1407
|
+
if (this.sessionHistoryHydration && me(e) && G(e) === this.sessionHistoryHydration.sessionId) {
|
|
1369
1408
|
this.sessionHistoryHydration.bufferedEvents.push(e);
|
|
1370
1409
|
return;
|
|
1371
1410
|
}
|
|
1372
1411
|
if (e.type === "session.item" && this.rememberDurablyStoppedTurn(
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1412
|
+
R(e.item, "sessionId") ?? this.state.sessionId,
|
|
1413
|
+
P(e.item),
|
|
1414
|
+
R(e.item, "createdAt")
|
|
1376
1415
|
), !(e.type === "session.updated" && typeof e.warmupId == "string" && e.warmupId !== this.activeComposerWarmupId)) {
|
|
1377
1416
|
if (e.type === "run.ack" && typeof e.sessionId == "string" && typeof e.clientMessageId == "string" && this.detachedClientMessageIds.delete(e.clientMessageId) && e.sessionId !== this.state.sessionId) {
|
|
1378
1417
|
this.detachedSessionIds.add(e.sessionId), this.deferredDetachedSessionEvents.delete(e.sessionId);
|
|
@@ -1386,14 +1425,14 @@ class Kt {
|
|
|
1386
1425
|
if (e.type === "run.ack") {
|
|
1387
1426
|
if (this.shouldIgnoreStoppedTurnEvent(e))
|
|
1388
1427
|
return;
|
|
1389
|
-
const s =
|
|
1428
|
+
const s = G(e), n = typeof e.clientMessageId == "string" ? e.clientMessageId : null, r = s ? this.deferredDetachedSessionEvents.get(s) ?? [] : [];
|
|
1390
1429
|
s && this.deferredDetachedSessionEvents.delete(s), 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);
|
|
1391
1430
|
for (const i of r)
|
|
1392
1431
|
this.handleServerEvent(i);
|
|
1393
1432
|
return;
|
|
1394
1433
|
}
|
|
1395
1434
|
if (e.type === "session.updated" && this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId === null && this.backgroundClientMessageIds.size > 0) {
|
|
1396
|
-
const s =
|
|
1435
|
+
const s = G(e);
|
|
1397
1436
|
if (s) {
|
|
1398
1437
|
this.deferredSessionUpdatedSessionIds.add(s);
|
|
1399
1438
|
return;
|
|
@@ -1415,22 +1454,22 @@ class Kt {
|
|
|
1415
1454
|
this.activeResponseRunId = s, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
1416
1455
|
return;
|
|
1417
1456
|
}
|
|
1418
|
-
if (
|
|
1457
|
+
if (An(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
1419
1458
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0;
|
|
1420
|
-
const s =
|
|
1459
|
+
const s = ir(e.user);
|
|
1421
1460
|
this.authenticatedSocket !== this.socket && this.authenticatedUserId && s && s.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = s?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
|
|
1422
|
-
const n =
|
|
1423
|
-
|
|
1461
|
+
const n = er(e), r = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
1462
|
+
A("web-sdk.agent", "Received auth.ok appearance", {
|
|
1424
1463
|
hasAppearance: r,
|
|
1425
1464
|
rawAppearance: e.appearance,
|
|
1426
1465
|
normalizedAppearance: n
|
|
1427
|
-
}), this.runtimeHelperJavascript =
|
|
1466
|
+
}), this.runtimeHelperJavascript = tr(e.runtimeHelpers)?.javascript ?? null;
|
|
1428
1467
|
const i = _t(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
|
|
1429
1468
|
user: s,
|
|
1430
1469
|
status: "connected",
|
|
1431
1470
|
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
1432
1471
|
};
|
|
1433
|
-
(o || this.state.starterPrompts.length === 0) && (l.starterPrompts = i, l.starterPromptsLoading = i.length > 0 ? !1 : a), o && i.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (r || n) && (l.appearance = n), this.setState(l), o && i.length === 0 && !a && !
|
|
1472
|
+
(o || this.state.starterPrompts.length === 0) && (l.starterPrompts = i, l.starterPromptsLoading = i.length > 0 ? !1 : a), o && i.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (r || n) && (l.appearance = n), this.setState(l), o && i.length === 0 && !a && !ye() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
1434
1473
|
type: "page.upsert",
|
|
1435
1474
|
sessionId: this.state.sessionId,
|
|
1436
1475
|
page: b(),
|
|
@@ -1445,112 +1484,128 @@ class Kt {
|
|
|
1445
1484
|
});
|
|
1446
1485
|
return;
|
|
1447
1486
|
}
|
|
1487
|
+
if (e.type === "scheduled_follow_ups.updated") {
|
|
1488
|
+
typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
|
|
1489
|
+
activeScheduledFollowUps: Pt(
|
|
1490
|
+
e.activeScheduledFollowUps
|
|
1491
|
+
)
|
|
1492
|
+
});
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1448
1495
|
if (e.type === "conversation.state") {
|
|
1449
|
-
const s = Array.isArray(e.items) ? e.items : [], n =
|
|
1450
|
-
|
|
1496
|
+
const s = Array.isArray(e.items) ? e.items : [], n = Object.prototype.hasOwnProperty.call(
|
|
1497
|
+
e,
|
|
1498
|
+
"activeScheduledFollowUps"
|
|
1499
|
+
), r = R(e.session, "id") ?? this.state.sessionId, i = typeof e.requestId == "string" ? e.requestId : null, o = this.state.isLoadingSession && this.sessionLoadRequestId === null && i === null && r === this.state.sessionId && this.canLoadSessionHistoryOverHttp();
|
|
1500
|
+
if (i && i !== this.sessionLoadRequestId || this.state.isLoadingSession && this.sessionLoadRequestId !== null && i === null || this.state.isLoadingSession && r !== this.state.sessionId)
|
|
1451
1501
|
return;
|
|
1452
|
-
this.updatePersonalModelFromSession(e.session),
|
|
1453
|
-
for (const
|
|
1502
|
+
this.updatePersonalModelFromSession(e.session), r === this.state.sessionId && this.clearSessionLoadRequest();
|
|
1503
|
+
for (const k of s)
|
|
1454
1504
|
this.rememberDurablyStoppedTurn(
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1505
|
+
r,
|
|
1506
|
+
P(k),
|
|
1507
|
+
R(k, "createdAt")
|
|
1458
1508
|
);
|
|
1459
|
-
const
|
|
1460
|
-
clientMessageId:
|
|
1461
|
-
respondsToUserMessageId:
|
|
1462
|
-
runId:
|
|
1463
|
-
}),
|
|
1464
|
-
|
|
1465
|
-
let
|
|
1509
|
+
const a = se(s), l = a === null ? null : s[a], c = P(l), d = this.findStoppedTurn(r, {
|
|
1510
|
+
clientMessageId: c?.clientMessageId,
|
|
1511
|
+
respondsToUserMessageId: R(l, "id"),
|
|
1512
|
+
runId: c?.runId
|
|
1513
|
+
}), h = this.filterStoppedSnapshotItems(s, r), m = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, f = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, u = e.isRetrying === !0, p = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
1514
|
+
m && f && (this.pendingClientMessageId = f);
|
|
1515
|
+
let g = pr(
|
|
1466
1516
|
e.assistantDraft
|
|
1467
1517
|
);
|
|
1468
|
-
|
|
1469
|
-
respondsToUserMessageId:
|
|
1470
|
-
runId:
|
|
1471
|
-
}) && (
|
|
1472
|
-
const
|
|
1473
|
-
this.rememberUserMessageClientMessageIds(
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
const
|
|
1477
|
-
this.retryAttemptsByClientMessageId[
|
|
1478
|
-
this.retryAttemptsByClientMessageId[
|
|
1479
|
-
|
|
1518
|
+
g && this.findStoppedTurn(r, {
|
|
1519
|
+
respondsToUserMessageId: g.respondsToUserMessageId,
|
|
1520
|
+
runId: g.runId
|
|
1521
|
+
}) && (g = void 0);
|
|
1522
|
+
const y = g !== void 0;
|
|
1523
|
+
this.rememberUserMessageClientMessageIds(h);
|
|
1524
|
+
const M = Ur(h);
|
|
1525
|
+
if (M) {
|
|
1526
|
+
const k = vr(h, M);
|
|
1527
|
+
this.retryAttemptsByClientMessageId[M] = Math.max(
|
|
1528
|
+
this.retryAttemptsByClientMessageId[M] ?? 0,
|
|
1529
|
+
k
|
|
1480
1530
|
);
|
|
1481
1531
|
}
|
|
1482
|
-
const
|
|
1483
|
-
const O =
|
|
1484
|
-
return
|
|
1485
|
-
}),
|
|
1532
|
+
const w = h.filter((k) => {
|
|
1533
|
+
const O = P(k);
|
|
1534
|
+
return Dt(O) ? !1 : !O || !M || !Ee(O) ? !0 : Ze(h, O) !== M;
|
|
1535
|
+
}), U = Zt(
|
|
1486
1536
|
this.state.messages,
|
|
1487
|
-
|
|
1488
|
-
),
|
|
1489
|
-
(
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1537
|
+
Ut(w, this.options.backendUrl)
|
|
1538
|
+
), S = vt(U), T = y ? g?.content ?? "" : this.state.assistantDraft, N = y ? g?.itemId ?? null : this.state.assistantDraftItemId, _ = y ? g?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, ne = y ? g?.runId ?? null : this.state.assistantDraftRunId, $ = h.some(
|
|
1539
|
+
(k, O) => Ot(
|
|
1540
|
+
P(k),
|
|
1541
|
+
T,
|
|
1542
|
+
N,
|
|
1543
|
+
_,
|
|
1544
|
+
ne,
|
|
1545
|
+
Dr(h, O)
|
|
1496
1546
|
)
|
|
1497
|
-
),
|
|
1498
|
-
if (!
|
|
1547
|
+
), he = y ? g?.content ?? "" : this.state.assistantDraft, z = !!g?.content && !$, K = S && (!he || $), Q = br(U), Y = K && Q ? "completed" : d ? "stopped" : K ? "failed" : null;
|
|
1548
|
+
if (!S && Pr(this.state.messages, h))
|
|
1499
1549
|
return;
|
|
1500
|
-
this.lastUserMessagePageUrl =
|
|
1501
|
-
const
|
|
1502
|
-
if (this.latestRecoverableClientMessageId =
|
|
1503
|
-
sessionId:
|
|
1504
|
-
messages:
|
|
1550
|
+
this.lastUserMessagePageUrl = _r(h);
|
|
1551
|
+
const F = K || d ? null : Ye(h);
|
|
1552
|
+
if (this.latestRecoverableClientMessageId = F, Q && this.clearRetryTimers(), this.setState({
|
|
1553
|
+
sessionId: R(e.session, "id") ?? this.state.sessionId,
|
|
1554
|
+
messages: U,
|
|
1555
|
+
...n ? {
|
|
1556
|
+
activeScheduledFollowUps: Pt(
|
|
1557
|
+
e.activeScheduledFollowUps
|
|
1558
|
+
)
|
|
1559
|
+
} : {},
|
|
1505
1560
|
isLoadingSession: !1,
|
|
1506
|
-
...
|
|
1507
|
-
...
|
|
1508
|
-
isRetrying:
|
|
1509
|
-
...
|
|
1510
|
-
|
|
1561
|
+
...m ? { pendingMessageStatus: m } : {},
|
|
1562
|
+
...p ? { turnPhase: p } : {},
|
|
1563
|
+
isRetrying: u,
|
|
1564
|
+
...Y && this.state.taskStatus === "working" ? { taskStatus: Y } : {},
|
|
1565
|
+
...$ ? {
|
|
1511
1566
|
assistantDraft: "",
|
|
1512
1567
|
assistantDraftItemId: null,
|
|
1513
1568
|
assistantDraftPhase: null,
|
|
1514
1569
|
assistantDraftRespondsToUserMessageId: null,
|
|
1515
1570
|
assistantDraftRunId: null
|
|
1516
|
-
} :
|
|
1517
|
-
assistantDraft:
|
|
1518
|
-
assistantDraftItemId:
|
|
1519
|
-
assistantDraftPhase:
|
|
1520
|
-
assistantDraftRespondsToUserMessageId:
|
|
1521
|
-
assistantDraftRunId:
|
|
1571
|
+
} : y ? {
|
|
1572
|
+
assistantDraft: g?.content ?? "",
|
|
1573
|
+
assistantDraftItemId: g?.itemId ?? null,
|
|
1574
|
+
assistantDraftPhase: g?.phase ?? null,
|
|
1575
|
+
assistantDraftRespondsToUserMessageId: g?.respondsToUserMessageId ?? null,
|
|
1576
|
+
assistantDraftRunId: g?.runId ?? null
|
|
1522
1577
|
} : {},
|
|
1523
|
-
...
|
|
1578
|
+
...z ? {
|
|
1524
1579
|
isThinking: !0,
|
|
1525
1580
|
turnPhase: "thinking",
|
|
1526
1581
|
lastError: null
|
|
1527
|
-
} :
|
|
1582
|
+
} : K ? {
|
|
1528
1583
|
isThinking: !1,
|
|
1529
1584
|
status: "connected",
|
|
1530
1585
|
lastError: null,
|
|
1531
1586
|
lastErrorCode: null,
|
|
1532
1587
|
lastErrorSecuritySettingsUrl: null
|
|
1533
|
-
} :
|
|
1588
|
+
} : F ? {
|
|
1534
1589
|
isThinking: !0,
|
|
1535
|
-
turnPhase:
|
|
1590
|
+
turnPhase: p ?? this.state.turnPhase ?? "starting",
|
|
1536
1591
|
lastError: null
|
|
1537
1592
|
} : {}
|
|
1538
|
-
}),
|
|
1593
|
+
}), K)
|
|
1539
1594
|
this.retryableClientMessageId = null, this.clearThinkingWatchdog();
|
|
1540
|
-
else if (!
|
|
1541
|
-
if (
|
|
1542
|
-
this.activeClientMessageId =
|
|
1543
|
-
const
|
|
1544
|
-
this.activeResponseUserMessageId =
|
|
1595
|
+
else if (!d && (z || F)) {
|
|
1596
|
+
if (F) {
|
|
1597
|
+
this.activeClientMessageId = F;
|
|
1598
|
+
const k = se(h), O = k === null ? null : h[k];
|
|
1599
|
+
this.activeResponseUserMessageId = R(O, "id");
|
|
1545
1600
|
}
|
|
1546
1601
|
this.markThinkingProgress();
|
|
1547
1602
|
}
|
|
1548
|
-
if (
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1603
|
+
if (M) {
|
|
1604
|
+
const k = R(e.session, "id") ?? this.state.sessionId;
|
|
1605
|
+
k && this.retryAfterInterruptedRun(k, M);
|
|
1551
1606
|
}
|
|
1552
|
-
|
|
1553
|
-
this.autoLoadSessionActivity(
|
|
1607
|
+
o && r && window.setTimeout(() => {
|
|
1608
|
+
this.autoLoadSessionActivity(r);
|
|
1554
1609
|
}, 0);
|
|
1555
1610
|
return;
|
|
1556
1611
|
}
|
|
@@ -1558,19 +1613,19 @@ class Kt {
|
|
|
1558
1613
|
const s = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
1559
1614
|
if (!s || n !== this.state.sessionId)
|
|
1560
1615
|
return;
|
|
1561
|
-
const r =
|
|
1616
|
+
const r = Ut(
|
|
1562
1617
|
Array.isArray(e.items) ? e.items : [],
|
|
1563
1618
|
this.options.backendUrl
|
|
1564
1619
|
);
|
|
1565
1620
|
s === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
1566
|
-
messages:
|
|
1621
|
+
messages: Mr(this.state.messages, r)
|
|
1567
1622
|
});
|
|
1568
1623
|
return;
|
|
1569
1624
|
}
|
|
1570
1625
|
if (e.type === "sessions.page") {
|
|
1571
1626
|
const s = typeof e.requestId == "string" ? e.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
|
|
1572
1627
|
s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
|
|
1573
|
-
sessions:
|
|
1628
|
+
sessions: or(e.sessions),
|
|
1574
1629
|
nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
|
|
1575
1630
|
}));
|
|
1576
1631
|
return;
|
|
@@ -1585,7 +1640,7 @@ class Kt {
|
|
|
1585
1640
|
}
|
|
1586
1641
|
if (e.type === "session.updated") {
|
|
1587
1642
|
this.clearRunAckResyncRetryTimer();
|
|
1588
|
-
const s =
|
|
1643
|
+
const s = R(e.session, "id");
|
|
1589
1644
|
s && typeof e.warmupId == "string" && e.warmupId === this.pendingComposerWarmup?.event.warmupId && (this.pendingComposerWarmup.event = {
|
|
1590
1645
|
...this.pendingComposerWarmup.event,
|
|
1591
1646
|
sessionId: s
|
|
@@ -1596,10 +1651,10 @@ class Kt {
|
|
|
1596
1651
|
}
|
|
1597
1652
|
if (e.type === "session.item") {
|
|
1598
1653
|
this.rememberUserMessageClientMessageIds([e.item]);
|
|
1599
|
-
const s =
|
|
1600
|
-
if (
|
|
1654
|
+
const s = P(e.item);
|
|
1655
|
+
if (Ee(s)) {
|
|
1601
1656
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
1602
|
-
const r =
|
|
1657
|
+
const r = R(e.item, "sessionId") ?? this.state.sessionId, i = s ? L(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
1603
1658
|
if (r && a) {
|
|
1604
1659
|
this.retryAfterInterruptedRun(r, a);
|
|
1605
1660
|
return;
|
|
@@ -1609,23 +1664,23 @@ class Kt {
|
|
|
1609
1664
|
return;
|
|
1610
1665
|
}
|
|
1611
1666
|
}
|
|
1612
|
-
if (
|
|
1667
|
+
if (Dt(s))
|
|
1613
1668
|
return;
|
|
1614
1669
|
const n = Yt(e.item, this.options.backendUrl);
|
|
1615
1670
|
if (n) {
|
|
1616
|
-
const r =
|
|
1617
|
-
n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)),
|
|
1618
|
-
const o =
|
|
1671
|
+
const r = xr(s, n), i = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
1672
|
+
n.callId && i !== void 0 && (n.loading = i, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), qr(s) && this.clearRunAckResyncRetryTimer();
|
|
1673
|
+
const o = Qe(this.state.messages, n), a = vt(o), l = Ot(
|
|
1619
1674
|
s,
|
|
1620
1675
|
this.state.assistantDraft,
|
|
1621
1676
|
this.state.assistantDraftItemId,
|
|
1622
1677
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
1623
1678
|
this.state.assistantDraftRunId,
|
|
1624
|
-
|
|
1679
|
+
rs(
|
|
1625
1680
|
o,
|
|
1626
|
-
o.findIndex((
|
|
1681
|
+
o.findIndex((h) => h.id === n.id)
|
|
1627
1682
|
)
|
|
1628
|
-
), c = a && (!this.state.assistantDraft || l), d =
|
|
1683
|
+
), c = a && (!this.state.assistantDraft || l), d = Re(n) && (c || W(n) && !this.state.isThinking && this.activeClientMessageId === null);
|
|
1629
1684
|
this.setState({
|
|
1630
1685
|
messages: o,
|
|
1631
1686
|
...l ? {
|
|
@@ -1652,9 +1707,9 @@ class Kt {
|
|
|
1652
1707
|
}
|
|
1653
1708
|
if (e.type === "chat.assistant_delta") {
|
|
1654
1709
|
this.clearRunAckResyncRetryTimer();
|
|
1655
|
-
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((
|
|
1710
|
+
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((h) => h.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, d = typeof e.runId == "string" ? e.runId : this.state.assistantDraftRunId;
|
|
1656
1711
|
this.activeClientMessageId && (this.activeResponseUserMessageId = c, this.activeResponseRunId = d), this.setState({
|
|
1657
|
-
messages:
|
|
1712
|
+
messages: Qe(this.state.messages, {
|
|
1658
1713
|
id: o,
|
|
1659
1714
|
role: "assistant",
|
|
1660
1715
|
content: i,
|
|
@@ -1683,9 +1738,9 @@ class Kt {
|
|
|
1683
1738
|
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;
|
|
1684
1739
|
if (!(n && this.state.assistantDraftRespondsToUserMessageId ? n === this.state.assistantDraftRespondsToUserMessageId : !r || !this.state.assistantDraftRunId || r === this.state.assistantDraftRunId))
|
|
1685
1740
|
return;
|
|
1686
|
-
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 =
|
|
1741
|
+
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 = Os(
|
|
1687
1742
|
this.state.messages.filter(
|
|
1688
|
-
(c) => c.dataType !== "assistant_draft" || !
|
|
1743
|
+
(c) => c.dataType !== "assistant_draft" || !Ke(
|
|
1689
1744
|
c,
|
|
1690
1745
|
n,
|
|
1691
1746
|
r
|
|
@@ -1693,11 +1748,11 @@ class Kt {
|
|
|
1693
1748
|
),
|
|
1694
1749
|
n,
|
|
1695
1750
|
r,
|
|
1696
|
-
|
|
1751
|
+
es
|
|
1697
1752
|
);
|
|
1698
1753
|
this.setState({
|
|
1699
1754
|
sessionId: s,
|
|
1700
|
-
messages:
|
|
1755
|
+
messages: yr(
|
|
1701
1756
|
l,
|
|
1702
1757
|
typeof e.responseId == "string" ? e.responseId : null,
|
|
1703
1758
|
n,
|
|
@@ -1720,9 +1775,9 @@ class Kt {
|
|
|
1720
1775
|
if (s)
|
|
1721
1776
|
this.nonTranscriptToolCallIds.add(s);
|
|
1722
1777
|
else {
|
|
1723
|
-
const n =
|
|
1778
|
+
const n = Tr(e);
|
|
1724
1779
|
if (n) {
|
|
1725
|
-
const r =
|
|
1780
|
+
const r = Ir(
|
|
1726
1781
|
this.state.messages,
|
|
1727
1782
|
n
|
|
1728
1783
|
);
|
|
@@ -1783,20 +1838,20 @@ class Kt {
|
|
|
1783
1838
|
return;
|
|
1784
1839
|
}
|
|
1785
1840
|
o && r && i && (this.retryableClientMessageId = i);
|
|
1786
|
-
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l =
|
|
1841
|
+
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Hn(a.message);
|
|
1787
1842
|
l && console.error(l);
|
|
1788
|
-
const c = i ?? this.activeClientMessageId, d = typeof e.runId == "string" ? e.runId : null,
|
|
1843
|
+
const c = i ?? this.activeClientMessageId, d = typeof e.runId == "string" ? e.runId : null, h = qt(
|
|
1789
1844
|
this.state.messages,
|
|
1790
1845
|
c,
|
|
1791
1846
|
d
|
|
1792
|
-
),
|
|
1793
|
-
|
|
1847
|
+
), m = Cr(
|
|
1848
|
+
h,
|
|
1794
1849
|
c,
|
|
1795
1850
|
d
|
|
1796
1851
|
);
|
|
1797
1852
|
this.setState({
|
|
1798
|
-
status:
|
|
1799
|
-
messages:
|
|
1853
|
+
status: m ? "connected" : "error",
|
|
1854
|
+
messages: h,
|
|
1800
1855
|
assistantDraft: "",
|
|
1801
1856
|
assistantDraftItemId: null,
|
|
1802
1857
|
assistantDraftPhase: null,
|
|
@@ -1805,9 +1860,9 @@ class Kt {
|
|
|
1805
1860
|
isThinking: !1,
|
|
1806
1861
|
...this.state.taskStatus === "working" ? { taskStatus: "failed" } : {},
|
|
1807
1862
|
isRetrying: !1,
|
|
1808
|
-
lastError:
|
|
1809
|
-
lastErrorCode:
|
|
1810
|
-
lastErrorSecuritySettingsUrl:
|
|
1863
|
+
lastError: m ? null : a.message,
|
|
1864
|
+
lastErrorCode: m ? null : typeof e.code == "string" ? e.code : null,
|
|
1865
|
+
lastErrorSecuritySettingsUrl: m ? null : typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : null
|
|
1811
1866
|
}), this.clearThinkingWatchdog(), this.emit("error", a);
|
|
1812
1867
|
}
|
|
1813
1868
|
}
|
|
@@ -1818,24 +1873,24 @@ class Kt {
|
|
|
1818
1873
|
if (this.options.productVariant !== "personal" || !e || typeof e != "object" || this.personalModelSelectionOverride !== null)
|
|
1819
1874
|
return;
|
|
1820
1875
|
const s = e.metadata, n = s && typeof s == "object" ? s.model : void 0;
|
|
1821
|
-
this.options.model =
|
|
1876
|
+
this.options.model = He(n) ? n : "gpt-5.6-sol";
|
|
1822
1877
|
}
|
|
1823
1878
|
shouldIgnoreBackgroundSessionEvent(e) {
|
|
1824
|
-
if (!this.options.keepRunsActiveOnSessionNavigation || !
|
|
1879
|
+
if (!this.options.keepRunsActiveOnSessionNavigation || !me(e))
|
|
1825
1880
|
return !1;
|
|
1826
|
-
const s =
|
|
1881
|
+
const s = G(e);
|
|
1827
1882
|
return s ? this.deferredSessionUpdatedSessionIds.has(s) ? !0 : this.state.sessionId ? s !== this.state.sessionId : this.backgroundSessionIds.has(s) : !1;
|
|
1828
1883
|
}
|
|
1829
1884
|
shouldIgnoreDetachedSessionEvent(e) {
|
|
1830
|
-
if (this.options.keepRunsActiveOnSessionNavigation || !
|
|
1885
|
+
if (this.options.keepRunsActiveOnSessionNavigation || !me(e))
|
|
1831
1886
|
return !1;
|
|
1832
|
-
const s =
|
|
1887
|
+
const s = G(e);
|
|
1833
1888
|
return !!(s && this.detachedSessionIds.has(s));
|
|
1834
1889
|
}
|
|
1835
1890
|
shouldDeferDetachedSessionEvent(e) {
|
|
1836
|
-
if (this.options.keepRunsActiveOnSessionNavigation || e.type === "run.ack" || !
|
|
1891
|
+
if (this.options.keepRunsActiveOnSessionNavigation || e.type === "run.ack" || !me(e))
|
|
1837
1892
|
return !1;
|
|
1838
|
-
const s =
|
|
1893
|
+
const s = G(e);
|
|
1839
1894
|
if (!s || s === this.state.sessionId || this.detachedClientMessageIds.size === 0 && !this.deferredDetachedSessionEvents.has(s))
|
|
1840
1895
|
return !1;
|
|
1841
1896
|
const n = this.deferredDetachedSessionEvents.get(s) ?? [];
|
|
@@ -1858,7 +1913,7 @@ class Kt {
|
|
|
1858
1913
|
const s = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
1859
1914
|
if (!(e.retryable === !0 || e.code === "transient_model_error") || !s || !n || e.code === "run_recovery_exhausted")
|
|
1860
1915
|
return !1;
|
|
1861
|
-
if (
|
|
1916
|
+
if (ye())
|
|
1862
1917
|
return this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
|
|
1863
1918
|
if (e.code === "run_still_active") {
|
|
1864
1919
|
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) {
|
|
@@ -1872,10 +1927,10 @@ class Kt {
|
|
|
1872
1927
|
if (this.retryTimersByClientMessageId[n] !== void 0)
|
|
1873
1928
|
return !0;
|
|
1874
1929
|
const i = this.retryAttemptsByClientMessageId[n] ?? 0;
|
|
1875
|
-
if (i >=
|
|
1930
|
+
if (i >= ae)
|
|
1876
1931
|
return !1;
|
|
1877
1932
|
this.retryAttemptsByClientMessageId[n] = i + 1;
|
|
1878
|
-
const o =
|
|
1933
|
+
const o = le(
|
|
1879
1934
|
i,
|
|
1880
1935
|
typeof e.retryAfterMs == "number" ? e.retryAfterMs : 0
|
|
1881
1936
|
);
|
|
@@ -1889,23 +1944,23 @@ class Kt {
|
|
|
1889
1944
|
}, o), !0;
|
|
1890
1945
|
}
|
|
1891
1946
|
retryAfterInterruptedRun(e, s) {
|
|
1892
|
-
if (
|
|
1947
|
+
if (ye()) {
|
|
1893
1948
|
this.retryableClientMessageId = s, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null });
|
|
1894
1949
|
return;
|
|
1895
1950
|
}
|
|
1896
1951
|
if (this.retryTimersByClientMessageId[s] !== void 0)
|
|
1897
1952
|
return;
|
|
1898
1953
|
const n = this.retryAttemptsByClientMessageId[s] ?? 0;
|
|
1899
|
-
if (n >=
|
|
1954
|
+
if (n >= ae) {
|
|
1900
1955
|
this.requestSessionRecoveryExhaustion(e, s);
|
|
1901
1956
|
return;
|
|
1902
1957
|
}
|
|
1903
1958
|
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(() => {
|
|
1904
1959
|
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 });
|
|
1905
|
-
},
|
|
1960
|
+
}, le(n));
|
|
1906
1961
|
}
|
|
1907
1962
|
requestSessionRecoveryExhaustion(e, s) {
|
|
1908
|
-
this.retryableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.recoveryExhaustionRequestedClientMessageIds.has(s) ? this.resyncThinkingSession() : (this.recoveryExhaustionRequestedClientMessageIds.add(s), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !0 })), this.scheduleThinkingWatchdog(
|
|
1963
|
+
this.retryableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.recoveryExhaustionRequestedClientMessageIds.has(s) ? this.resyncThinkingSession() : (this.recoveryExhaustionRequestedClientMessageIds.add(s), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !0 })), this.scheduleThinkingWatchdog(Tt);
|
|
1909
1964
|
}
|
|
1910
1965
|
clearRetryTimers() {
|
|
1911
1966
|
for (const e of Object.values(this.retryTimersByClientMessageId))
|
|
@@ -1914,10 +1969,10 @@ class Kt {
|
|
|
1914
1969
|
}
|
|
1915
1970
|
rememberUserMessageClientMessageIds(e) {
|
|
1916
1971
|
for (const s of e) {
|
|
1917
|
-
const n =
|
|
1972
|
+
const n = R(s, "id"), r = P(s);
|
|
1918
1973
|
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(
|
|
1919
1974
|
r.clientMessageId,
|
|
1920
|
-
|
|
1975
|
+
R(s, "sessionId") ?? this.state.sessionId,
|
|
1921
1976
|
n,
|
|
1922
1977
|
null
|
|
1923
1978
|
), r.clientMessageId === this.activeClientMessageId && (this.activeResponseUserMessageId = n));
|
|
@@ -1959,7 +2014,7 @@ class Kt {
|
|
|
1959
2014
|
e.clear();
|
|
1960
2015
|
}
|
|
1961
2016
|
markThinkingProgress() {
|
|
1962
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
2017
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(St), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
1963
2018
|
}
|
|
1964
2019
|
scheduleThinkingWatchdog(e) {
|
|
1965
2020
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -2003,7 +2058,7 @@ class Kt {
|
|
|
2003
2058
|
}), this.markThinkingProgress();
|
|
2004
2059
|
}
|
|
2005
2060
|
schedulePendingDeliveryAck(e) {
|
|
2006
|
-
this.clearPendingDeliveryTimers(), !
|
|
2061
|
+
this.clearPendingDeliveryTimers(), !ye() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
|
|
2007
2062
|
this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
|
|
2008
2063
|
}, Mt));
|
|
2009
2064
|
}
|
|
@@ -2011,13 +2066,13 @@ class Kt {
|
|
|
2011
2066
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
2012
2067
|
return;
|
|
2013
2068
|
const s = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
2014
|
-
if (s >=
|
|
2069
|
+
if (s >= ae) {
|
|
2015
2070
|
this.failPendingDelivery(e);
|
|
2016
2071
|
return;
|
|
2017
2072
|
}
|
|
2018
2073
|
s === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = s + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
2019
2074
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
2020
|
-
},
|
|
2075
|
+
}, le(s, At));
|
|
2021
2076
|
}
|
|
2022
2077
|
failPendingDelivery(e) {
|
|
2023
2078
|
if (this.pendingClientMessageId !== e)
|
|
@@ -2029,7 +2084,7 @@ class Kt {
|
|
|
2029
2084
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
2030
2085
|
isRetrying: !1,
|
|
2031
2086
|
...this.state.isThinking ? {} : { taskStatus: "failed" },
|
|
2032
|
-
lastError:
|
|
2087
|
+
lastError: un,
|
|
2033
2088
|
lastErrorCode: "message_delivery_failed"
|
|
2034
2089
|
});
|
|
2035
2090
|
}
|
|
@@ -2044,7 +2099,7 @@ class Kt {
|
|
|
2044
2099
|
s,
|
|
2045
2100
|
typeof e.runId == "string" ? e.runId : null
|
|
2046
2101
|
), !(!this.state.isThinking || !s) && this.setState({
|
|
2047
|
-
messages:
|
|
2102
|
+
messages: Wr(
|
|
2048
2103
|
this.state.messages,
|
|
2049
2104
|
s
|
|
2050
2105
|
)
|
|
@@ -2056,7 +2111,7 @@ class Kt {
|
|
|
2056
2111
|
}, Mt);
|
|
2057
2112
|
}
|
|
2058
2113
|
recoverMissedRunAck(e) {
|
|
2059
|
-
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (
|
|
2114
|
+
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (A("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
2060
2115
|
sessionId: this.state.sessionId,
|
|
2061
2116
|
clientMessageId: e
|
|
2062
2117
|
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(e));
|
|
@@ -2064,12 +2119,12 @@ class Kt {
|
|
|
2064
2119
|
scheduleRunAckResyncRetry(e) {
|
|
2065
2120
|
this.clearRunAckResyncRetryTimer();
|
|
2066
2121
|
const s = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
2067
|
-
s >=
|
|
2122
|
+
s >= ae || (this.runAckResyncRetryTimer = window.setTimeout(() => {
|
|
2068
2123
|
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({
|
|
2069
2124
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
2070
2125
|
isThinking: !0,
|
|
2071
2126
|
lastError: null
|
|
2072
|
-
}),
|
|
2127
|
+
}), A("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
|
|
2073
2128
|
sessionId: this.state.sessionId,
|
|
2074
2129
|
clientMessageId: e
|
|
2075
2130
|
}), this.state.sessionId ? this.send({
|
|
@@ -2077,8 +2132,8 @@ class Kt {
|
|
|
2077
2132
|
sessionId: this.state.sessionId,
|
|
2078
2133
|
clientMessageId: e,
|
|
2079
2134
|
automatic: !0
|
|
2080
|
-
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(
|
|
2081
|
-
},
|
|
2135
|
+
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(St)));
|
|
2136
|
+
}, le(s, At)));
|
|
2082
2137
|
}
|
|
2083
2138
|
clearRunAckResyncRetryTimer() {
|
|
2084
2139
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -2091,13 +2146,13 @@ class Kt {
|
|
|
2091
2146
|
return;
|
|
2092
2147
|
const e = this.activeClientMessageId;
|
|
2093
2148
|
if (!e) {
|
|
2094
|
-
|
|
2149
|
+
A("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
|
|
2095
2150
|
sessionId: this.state.sessionId
|
|
2096
2151
|
}), this.reportHealthSignal("run_recovery_exhausted", {
|
|
2097
2152
|
reason: "missing_client_message_id"
|
|
2098
2153
|
}), this.setState({
|
|
2099
2154
|
messages: this.state.messages.filter(
|
|
2100
|
-
(r) => !
|
|
2155
|
+
(r) => !J(r)
|
|
2101
2156
|
),
|
|
2102
2157
|
isThinking: !1,
|
|
2103
2158
|
taskStatus: "failed",
|
|
@@ -2107,8 +2162,8 @@ class Kt {
|
|
|
2107
2162
|
return;
|
|
2108
2163
|
}
|
|
2109
2164
|
const s = this.thinkingWatchdogResyncAttemptsByClientMessageId[e] ?? 0, n = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
2110
|
-
if (n >=
|
|
2111
|
-
|
|
2165
|
+
if (n >= ae) {
|
|
2166
|
+
A("web-sdk.agent", "Pluno run recovery retry exhausted", {
|
|
2112
2167
|
sessionId: this.state.sessionId,
|
|
2113
2168
|
clientMessageId: e
|
|
2114
2169
|
}), this.state.sessionId ? this.requestSessionRecoveryExhaustion(this.state.sessionId, e) : (this.setState({
|
|
@@ -2120,18 +2175,18 @@ class Kt {
|
|
|
2120
2175
|
return;
|
|
2121
2176
|
}
|
|
2122
2177
|
if (s < 1) {
|
|
2123
|
-
this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = s + 1,
|
|
2178
|
+
this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = s + 1, A("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
|
|
2124
2179
|
sessionId: this.state.sessionId,
|
|
2125
2180
|
clientMessageId: e,
|
|
2126
2181
|
resyncAttempts: s + 1
|
|
2127
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
2182
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Tt);
|
|
2128
2183
|
return;
|
|
2129
2184
|
}
|
|
2130
2185
|
this.setState({
|
|
2131
2186
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
2132
2187
|
isThinking: !0,
|
|
2133
2188
|
lastError: null
|
|
2134
|
-
}),
|
|
2189
|
+
}), A("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
|
|
2135
2190
|
sessionId: this.state.sessionId,
|
|
2136
2191
|
clientMessageId: e,
|
|
2137
2192
|
retryAttempts: n + 1
|
|
@@ -2142,7 +2197,7 @@ class Kt {
|
|
|
2142
2197
|
clientMessageId: e,
|
|
2143
2198
|
automatic: !0
|
|
2144
2199
|
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.markThinkingProgress();
|
|
2145
|
-
},
|
|
2200
|
+
}, le(n)));
|
|
2146
2201
|
}
|
|
2147
2202
|
resyncThinkingSession() {
|
|
2148
2203
|
this.state.sessionId ? this.send({
|
|
@@ -2153,13 +2208,13 @@ class Kt {
|
|
|
2153
2208
|
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
|
|
2154
2209
|
}
|
|
2155
2210
|
async executeToolCall(e) {
|
|
2156
|
-
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 =
|
|
2211
|
+
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 = ee(
|
|
2157
2212
|
typeof e.summary == "string" ? e.summary : "Running browser tool"
|
|
2158
2213
|
), o = e.rawInput;
|
|
2159
2214
|
if (!s || !n || !r)
|
|
2160
2215
|
return;
|
|
2161
2216
|
const a = r === "execute_code", l = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
2162
|
-
if (!a && !l || !
|
|
2217
|
+
if (!a && !l || !oi(o)) {
|
|
2163
2218
|
this.setToolMessageLoading(n, !1), this.send({
|
|
2164
2219
|
type: "tool.result",
|
|
2165
2220
|
sessionId: s,
|
|
@@ -2208,11 +2263,11 @@ class Kt {
|
|
|
2208
2263
|
let c = null, d;
|
|
2209
2264
|
c = await this.executeRuntimeHelper(), d = await Ct(
|
|
2210
2265
|
o,
|
|
2211
|
-
|
|
2212
|
-
).catch((
|
|
2266
|
+
Ln(e.runtimeContext, this.options.backendUrl)
|
|
2267
|
+
).catch((h) => ({
|
|
2213
2268
|
ok: !1,
|
|
2214
2269
|
exception: {
|
|
2215
|
-
message:
|
|
2270
|
+
message: h instanceof Error ? h.message : String(h)
|
|
2216
2271
|
}
|
|
2217
2272
|
})), this.activeBrowserToolCalls.has(n) && (this.activeBrowserToolCalls.delete(n), this.setToolMessageLoading(n, !1), this.send({
|
|
2218
2273
|
type: "tool.result",
|
|
@@ -2221,11 +2276,11 @@ class Kt {
|
|
|
2221
2276
|
toolName: r,
|
|
2222
2277
|
summary: o.summary,
|
|
2223
2278
|
rawInput: q(o),
|
|
2224
|
-
rawOutput: q(
|
|
2225
|
-
}),
|
|
2279
|
+
rawOutput: q(sr(d, c))
|
|
2280
|
+
}), Nt(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
2226
2281
|
}
|
|
2227
2282
|
setToolMessageLoading(e, s) {
|
|
2228
|
-
const n =
|
|
2283
|
+
const n = Sr(
|
|
2229
2284
|
this.state.messages,
|
|
2230
2285
|
e,
|
|
2231
2286
|
s
|
|
@@ -2236,17 +2291,17 @@ class Kt {
|
|
|
2236
2291
|
if (this.pageLifecycleCleanup)
|
|
2237
2292
|
return;
|
|
2238
2293
|
const e = () => {
|
|
2239
|
-
|
|
2294
|
+
as(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
2240
2295
|
};
|
|
2241
2296
|
window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
|
|
2242
2297
|
window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
|
|
2243
2298
|
};
|
|
2244
2299
|
}
|
|
2245
2300
|
installSessionBrowserApis() {
|
|
2246
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
2301
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = kn();
|
|
2247
2302
|
}
|
|
2248
2303
|
cleanupSessionBrowserApis() {
|
|
2249
|
-
this.sessionBrowserApisCleanup && (
|
|
2304
|
+
this.sessionBrowserApisCleanup && (On(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
2250
2305
|
}
|
|
2251
2306
|
async executeRuntimeHelper() {
|
|
2252
2307
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -2254,15 +2309,15 @@ class Kt {
|
|
|
2254
2309
|
const e = await Ct({
|
|
2255
2310
|
javascript: this.runtimeHelperJavascript
|
|
2256
2311
|
});
|
|
2257
|
-
return e.ok === !1 ?
|
|
2312
|
+
return e.ok === !1 ? nr(e) : null;
|
|
2258
2313
|
}
|
|
2259
2314
|
enableNetworkCapture() {
|
|
2260
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
2261
|
-
|
|
2315
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = wn((e) => {
|
|
2316
|
+
hi(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
2262
2317
|
}));
|
|
2263
2318
|
}
|
|
2264
2319
|
enqueueNetworkEvent(e) {
|
|
2265
|
-
this.queuedNetworkEvents.length >=
|
|
2320
|
+
this.queuedNetworkEvents.length >= hn || (this.queuedNetworkEvents.push(di(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
2266
2321
|
this.networkBatchTimer = null;
|
|
2267
2322
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
2268
2323
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -2271,15 +2326,15 @@ class Kt {
|
|
|
2271
2326
|
page: b(),
|
|
2272
2327
|
events: s
|
|
2273
2328
|
});
|
|
2274
|
-
},
|
|
2329
|
+
}, dn)));
|
|
2275
2330
|
}
|
|
2276
2331
|
scheduleReconnect() {
|
|
2277
2332
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
2278
2333
|
return;
|
|
2279
|
-
const e =
|
|
2334
|
+
const e = Sn(this.reconnectAttempts);
|
|
2280
2335
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
2281
2336
|
this.reconnectTimer = null, this.connect().catch((s) => {
|
|
2282
|
-
|
|
2337
|
+
A("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
2283
2338
|
message: s instanceof Error ? s.message : String(s),
|
|
2284
2339
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
2285
2340
|
isThinking: this.state.isThinking
|
|
@@ -2291,9 +2346,9 @@ class Kt {
|
|
|
2291
2346
|
this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
|
|
2292
2347
|
const e = this.socket;
|
|
2293
2348
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
2294
|
-
this.socket === e && (
|
|
2295
|
-
},
|
|
2296
|
-
},
|
|
2349
|
+
this.socket === e && (A("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
2350
|
+
}, sn));
|
|
2351
|
+
}, tn);
|
|
2297
2352
|
}
|
|
2298
2353
|
stopHeartbeat() {
|
|
2299
2354
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -2331,7 +2386,7 @@ class Kt {
|
|
|
2331
2386
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
2332
2387
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
2333
2388
|
};
|
|
2334
|
-
this.state = o,
|
|
2389
|
+
this.state = o, Vr(this.options.clientId, this.state), this.emit("state", this.getState()), $e("state", this.state.status, {
|
|
2335
2390
|
status: this.state.status,
|
|
2336
2391
|
sessionId: this.state.sessionId,
|
|
2337
2392
|
messageCount: this.state.messages.length,
|
|
@@ -2354,55 +2409,55 @@ class Kt {
|
|
|
2354
2409
|
}
|
|
2355
2410
|
}
|
|
2356
2411
|
const je = /* @__PURE__ */ new WeakMap();
|
|
2357
|
-
function
|
|
2358
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
2412
|
+
function wn(t) {
|
|
2413
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Mn();
|
|
2359
2414
|
return e.subscribers.add(t), () => {
|
|
2360
2415
|
e.subscribers.delete(t), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
2361
2416
|
};
|
|
2362
2417
|
}
|
|
2363
|
-
function
|
|
2364
|
-
const t = /* @__PURE__ */ new Set(), e = (
|
|
2418
|
+
function Mn() {
|
|
2419
|
+
const t = /* @__PURE__ */ new Set(), e = (m) => {
|
|
2365
2420
|
t.forEach((f) => {
|
|
2366
2421
|
try {
|
|
2367
|
-
f(
|
|
2422
|
+
f(m);
|
|
2368
2423
|
} catch {
|
|
2369
2424
|
}
|
|
2370
2425
|
});
|
|
2371
2426
|
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(f, u) {
|
|
2372
|
-
const
|
|
2427
|
+
const p = Date.now();
|
|
2373
2428
|
let g;
|
|
2374
2429
|
try {
|
|
2375
2430
|
g = s.call(this, f, u);
|
|
2376
|
-
} catch (
|
|
2377
|
-
throw
|
|
2431
|
+
} catch (y) {
|
|
2432
|
+
throw y;
|
|
2378
2433
|
}
|
|
2379
2434
|
try {
|
|
2380
|
-
const
|
|
2381
|
-
if (!
|
|
2382
|
-
const
|
|
2383
|
-
requestId:
|
|
2384
|
-
url:
|
|
2385
|
-
method: (u?.method ??
|
|
2386
|
-
requestHeaders:
|
|
2387
|
-
requestBody:
|
|
2435
|
+
const y = f instanceof Request ? f : null, M = ai(f, y), w = ds(u?.headers ?? y?.headers);
|
|
2436
|
+
if (!Z(M, w, u?.body)) {
|
|
2437
|
+
const U = {
|
|
2438
|
+
requestId: Ge("fetch"),
|
|
2439
|
+
url: B(M, Fe),
|
|
2440
|
+
method: (u?.method ?? y?.method ?? "GET").toUpperCase(),
|
|
2441
|
+
requestHeaders: w,
|
|
2442
|
+
requestBody: Bt(u?.body),
|
|
2388
2443
|
resourceType: "fetch",
|
|
2389
|
-
startedAt: new Date(
|
|
2444
|
+
startedAt: new Date(p).toISOString()
|
|
2390
2445
|
};
|
|
2391
2446
|
g.then(
|
|
2392
|
-
(
|
|
2393
|
-
|
|
2447
|
+
(S) => {
|
|
2448
|
+
li(S, U, p, e).catch(() => {
|
|
2394
2449
|
e({
|
|
2395
|
-
...
|
|
2396
|
-
responseStatus:
|
|
2397
|
-
durationMs: Date.now() -
|
|
2450
|
+
...U,
|
|
2451
|
+
responseStatus: S.status,
|
|
2452
|
+
durationMs: Date.now() - p
|
|
2398
2453
|
});
|
|
2399
2454
|
});
|
|
2400
2455
|
},
|
|
2401
|
-
(
|
|
2456
|
+
(S) => {
|
|
2402
2457
|
e({
|
|
2403
|
-
...
|
|
2404
|
-
errorText:
|
|
2405
|
-
durationMs: Date.now() -
|
|
2458
|
+
...U,
|
|
2459
|
+
errorText: B(S instanceof Error ? S.message : String(S)),
|
|
2460
|
+
durationMs: Date.now() - p
|
|
2406
2461
|
});
|
|
2407
2462
|
}
|
|
2408
2463
|
);
|
|
@@ -2410,29 +2465,29 @@ function wn() {
|
|
|
2410
2465
|
} catch {
|
|
2411
2466
|
}
|
|
2412
2467
|
return g;
|
|
2413
|
-
}, a = function(f, u,
|
|
2414
|
-
const
|
|
2468
|
+
}, a = function(f, u, p, g, y) {
|
|
2469
|
+
const M = n.call(this, f, u, p ?? !0, g ?? void 0, y ?? void 0), w = typeof u == "string" ? u : u.toString();
|
|
2415
2470
|
return je.set(this, {
|
|
2416
|
-
requestId:
|
|
2471
|
+
requestId: Ge("xhr"),
|
|
2417
2472
|
method: String(f ?? "GET").toUpperCase(),
|
|
2418
|
-
url:
|
|
2473
|
+
url: B(w, Fe),
|
|
2419
2474
|
requestHeaders: {},
|
|
2420
2475
|
startedAtMs: Date.now(),
|
|
2421
2476
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2422
|
-
excluded:
|
|
2423
|
-
}),
|
|
2477
|
+
excluded: Z(w)
|
|
2478
|
+
}), M;
|
|
2424
2479
|
}, l = function(f, u) {
|
|
2425
|
-
const
|
|
2426
|
-
return g && Object.keys(g.requestHeaders).length <
|
|
2480
|
+
const p = r.call(this, f, u), g = je.get(this);
|
|
2481
|
+
return g && Object.keys(g.requestHeaders).length < ot && (g.requestHeaders[f] = ct(f, u), g.excluded = g.excluded || Z(g.url, g.requestHeaders)), p;
|
|
2427
2482
|
}, c = function(f) {
|
|
2428
2483
|
try {
|
|
2429
2484
|
const u = je.get(this);
|
|
2430
|
-
u && (u.excluded = u.excluded ||
|
|
2485
|
+
u && (u.excluded = u.excluded || Z(u.url, u.requestHeaders, f), u.requestBody = Bt(f), u.excluded || this.addEventListener(
|
|
2431
2486
|
"loadend",
|
|
2432
2487
|
() => {
|
|
2433
2488
|
queueMicrotask(() => {
|
|
2434
2489
|
try {
|
|
2435
|
-
const
|
|
2490
|
+
const p = gi(this.getAllResponseHeaders());
|
|
2436
2491
|
e({
|
|
2437
2492
|
requestId: u.requestId,
|
|
2438
2493
|
url: u.url,
|
|
@@ -2441,8 +2496,8 @@ function wn() {
|
|
|
2441
2496
|
requestBody: u.requestBody,
|
|
2442
2497
|
resourceType: "xhr",
|
|
2443
2498
|
responseStatus: this.status,
|
|
2444
|
-
responseHeaders:
|
|
2445
|
-
responseBody:
|
|
2499
|
+
responseHeaders: p,
|
|
2500
|
+
responseBody: ui(this, p),
|
|
2446
2501
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
2447
2502
|
startedAt: u.startedAt,
|
|
2448
2503
|
durationMs: Date.now() - u.startedAtMs
|
|
@@ -2476,19 +2531,19 @@ function wn() {
|
|
|
2476
2531
|
}
|
|
2477
2532
|
let d = null;
|
|
2478
2533
|
if (typeof PerformanceObserver < "u") {
|
|
2479
|
-
d = new PerformanceObserver((
|
|
2480
|
-
for (const f of
|
|
2534
|
+
d = new PerformanceObserver((m) => {
|
|
2535
|
+
for (const f of m.getEntries()) {
|
|
2481
2536
|
const u = f;
|
|
2482
|
-
if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" ||
|
|
2537
|
+
if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" || Z(u.name))
|
|
2483
2538
|
continue;
|
|
2484
|
-
const
|
|
2539
|
+
const p = performance.timeOrigin + u.startTime;
|
|
2485
2540
|
e({
|
|
2486
|
-
requestId:
|
|
2487
|
-
url:
|
|
2541
|
+
requestId: Ge("resource"),
|
|
2542
|
+
url: B(u.name, Fe),
|
|
2488
2543
|
method: "GET",
|
|
2489
2544
|
resourceType: "resource",
|
|
2490
2545
|
responseStatus: u.responseStatus,
|
|
2491
|
-
startedAt: new Date(
|
|
2546
|
+
startedAt: new Date(p).toISOString(),
|
|
2492
2547
|
durationMs: u.duration
|
|
2493
2548
|
});
|
|
2494
2549
|
}
|
|
@@ -2499,7 +2554,7 @@ function wn() {
|
|
|
2499
2554
|
d.disconnect(), d = null;
|
|
2500
2555
|
}
|
|
2501
2556
|
}
|
|
2502
|
-
const
|
|
2557
|
+
const h = {
|
|
2503
2558
|
subscribers: t,
|
|
2504
2559
|
destroy: () => {
|
|
2505
2560
|
d?.disconnect();
|
|
@@ -2521,9 +2576,9 @@ function wn() {
|
|
|
2521
2576
|
}
|
|
2522
2577
|
}
|
|
2523
2578
|
};
|
|
2524
|
-
return window.__plunoProductAgentNetworkCapture =
|
|
2579
|
+
return window.__plunoProductAgentNetworkCapture = h, h;
|
|
2525
2580
|
}
|
|
2526
|
-
function
|
|
2581
|
+
function A(t, e, s) {
|
|
2527
2582
|
if (typeof window > "u")
|
|
2528
2583
|
return;
|
|
2529
2584
|
const n = window, r = {
|
|
@@ -2538,13 +2593,13 @@ function kt(t) {
|
|
|
2538
2593
|
const e = typeof t == "function" ? t() : t;
|
|
2539
2594
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
2540
2595
|
}
|
|
2541
|
-
function
|
|
2596
|
+
function An(t) {
|
|
2542
2597
|
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";
|
|
2543
2598
|
}
|
|
2544
|
-
function
|
|
2545
|
-
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";
|
|
2599
|
+
function me(t) {
|
|
2600
|
+
return t.type === "run.steered" || t.type === "run.ack" || t.type === "run.model_started" || t.type === "conversation.state" || t.type === "scheduled_follow_ups.updated" || 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";
|
|
2546
2601
|
}
|
|
2547
|
-
function
|
|
2602
|
+
function G(t) {
|
|
2548
2603
|
if (typeof t.sessionId == "string")
|
|
2549
2604
|
return t.sessionId;
|
|
2550
2605
|
if (t.session && typeof t.session == "object") {
|
|
@@ -2559,31 +2614,31 @@ function K(t) {
|
|
|
2559
2614
|
}
|
|
2560
2615
|
return null;
|
|
2561
2616
|
}
|
|
2562
|
-
const
|
|
2563
|
-
function
|
|
2617
|
+
const Rn = 5e3, En = 12e4;
|
|
2618
|
+
function kn() {
|
|
2564
2619
|
const t = [
|
|
2565
|
-
|
|
2566
|
-
|
|
2620
|
+
bn(),
|
|
2621
|
+
Cn()
|
|
2567
2622
|
].filter((e) => typeof e == "function");
|
|
2568
2623
|
return () => {
|
|
2569
2624
|
for (const e of t.reverse())
|
|
2570
2625
|
e();
|
|
2571
2626
|
};
|
|
2572
2627
|
}
|
|
2573
|
-
function kn() {
|
|
2574
|
-
return Wt(globalThis, "getPageSnapshot", async () => ot());
|
|
2575
|
-
}
|
|
2576
2628
|
function Cn() {
|
|
2577
|
-
return
|
|
2578
|
-
|
|
2629
|
+
return Ht(globalThis, "getPageSnapshot", async () => at());
|
|
2630
|
+
}
|
|
2631
|
+
function bn() {
|
|
2632
|
+
return Ht(globalThis, "pageImages", {
|
|
2633
|
+
inspectImage: async (e, s) => await _n(e, s)
|
|
2579
2634
|
});
|
|
2580
2635
|
}
|
|
2581
|
-
async function
|
|
2582
|
-
const s =
|
|
2636
|
+
async function _n(t, e = {}) {
|
|
2637
|
+
const s = Dn(e.name), n = await Pn(t);
|
|
2583
2638
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
2584
2639
|
type: "pluno.pageImages.inspectImage",
|
|
2585
2640
|
imageAttached: !1,
|
|
2586
|
-
imageAttachmentError:
|
|
2641
|
+
imageAttachmentError: zt
|
|
2587
2642
|
} : {
|
|
2588
2643
|
type: "pluno.pageImages.inspectImage",
|
|
2589
2644
|
imageAttached: !0,
|
|
@@ -2597,15 +2652,15 @@ async function bn(t, e = {}) {
|
|
|
2597
2652
|
imageAttachmentError: n.error
|
|
2598
2653
|
};
|
|
2599
2654
|
}
|
|
2600
|
-
async function
|
|
2601
|
-
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:
|
|
2655
|
+
async function Pn(t) {
|
|
2656
|
+
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: zt } : {
|
|
2602
2657
|
ok: !0,
|
|
2603
2658
|
mimeType: t.type,
|
|
2604
2659
|
sizeBytes: t.size,
|
|
2605
|
-
dataUrl: await
|
|
2606
|
-
} : { 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." } :
|
|
2660
|
+
dataUrl: await qn(t)
|
|
2661
|
+
} : { 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." } : Un(t);
|
|
2607
2662
|
}
|
|
2608
|
-
function
|
|
2663
|
+
function Un(t) {
|
|
2609
2664
|
if (!t.startsWith("data:") || !t.includes(","))
|
|
2610
2665
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
2611
2666
|
const [e, s] = t.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), r = n[0] ?? "";
|
|
@@ -2616,7 +2671,7 @@ function Pn(t) {
|
|
|
2616
2671
|
const i = s.replace(/[ \t\r\n\f]+/g, "");
|
|
2617
2672
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(i))
|
|
2618
2673
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
2619
|
-
const o =
|
|
2674
|
+
const o = vn(i);
|
|
2620
2675
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
2621
2676
|
ok: !0,
|
|
2622
2677
|
mimeType: r,
|
|
@@ -2624,22 +2679,22 @@ function Pn(t) {
|
|
|
2624
2679
|
dataUrl: `data:${r};base64,${i}`
|
|
2625
2680
|
};
|
|
2626
2681
|
}
|
|
2627
|
-
function
|
|
2682
|
+
function vn(t) {
|
|
2628
2683
|
if (t.length === 0 || t.length % 4 !== 0)
|
|
2629
2684
|
return null;
|
|
2630
2685
|
const e = t.length - t.replace(/=+$/, "").length;
|
|
2631
2686
|
return e > 2 ? null : t.length / 4 * 3 - e;
|
|
2632
2687
|
}
|
|
2633
|
-
function
|
|
2688
|
+
function Dn(t) {
|
|
2634
2689
|
return (typeof t == "string" ? t.trim() : "") || "Page image";
|
|
2635
2690
|
}
|
|
2636
|
-
function
|
|
2691
|
+
function On(t) {
|
|
2637
2692
|
try {
|
|
2638
2693
|
t();
|
|
2639
2694
|
} catch {
|
|
2640
2695
|
}
|
|
2641
2696
|
}
|
|
2642
|
-
function
|
|
2697
|
+
function qn(t) {
|
|
2643
2698
|
return new Promise((e, s) => {
|
|
2644
2699
|
const n = new FileReader();
|
|
2645
2700
|
n.onload = () => {
|
|
@@ -2653,7 +2708,7 @@ function On(t) {
|
|
|
2653
2708
|
}
|
|
2654
2709
|
async function Ct(t, e) {
|
|
2655
2710
|
const s = Object.getPrototypeOf(async function() {
|
|
2656
|
-
}).constructor, n = t.timeoutMs ??
|
|
2711
|
+
}).constructor, n = t.timeoutMs ?? Rn, r = Date.now(), i = [];
|
|
2657
2712
|
let o;
|
|
2658
2713
|
const a = {
|
|
2659
2714
|
log: console.log,
|
|
@@ -2667,11 +2722,11 @@ async function Ct(t, e) {
|
|
|
2667
2722
|
try {
|
|
2668
2723
|
const c = /* @__PURE__ */ Symbol("execute_code_timeout"), d = await Promise.race([
|
|
2669
2724
|
new s("sandboxFiles", t.javascript)(e?.value),
|
|
2670
|
-
new Promise((
|
|
2671
|
-
o = window.setTimeout(() =>
|
|
2725
|
+
new Promise((h) => {
|
|
2726
|
+
o = window.setTimeout(() => h(c), n);
|
|
2672
2727
|
})
|
|
2673
2728
|
]);
|
|
2674
|
-
return d === c ?
|
|
2729
|
+
return d === c ? Nn(n) : {
|
|
2675
2730
|
ok: !0,
|
|
2676
2731
|
result: d,
|
|
2677
2732
|
console: i,
|
|
@@ -2700,7 +2755,7 @@ async function Ct(t, e) {
|
|
|
2700
2755
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
2701
2756
|
}
|
|
2702
2757
|
}
|
|
2703
|
-
function
|
|
2758
|
+
function Ln(t, e) {
|
|
2704
2759
|
if (!t || typeof t != "object")
|
|
2705
2760
|
return;
|
|
2706
2761
|
const s = t.sandboxFilesToken;
|
|
@@ -2710,7 +2765,7 @@ function qn(t, e) {
|
|
|
2710
2765
|
const r = () => {
|
|
2711
2766
|
if (!n)
|
|
2712
2767
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
2713
|
-
}, i = async (a, l) => await
|
|
2768
|
+
}, i = async (a, l) => await Vs(`${e.replace(/\/$/, "")}${a}`, l);
|
|
2714
2769
|
return {
|
|
2715
2770
|
value: Object.freeze({
|
|
2716
2771
|
upload: async (a) => {
|
|
@@ -2733,8 +2788,8 @@ function qn(t, e) {
|
|
|
2733
2788
|
);
|
|
2734
2789
|
if (!l.ok)
|
|
2735
2790
|
throw new Error(`sandboxFiles.download failed (${l.status})`);
|
|
2736
|
-
const c = await l.blob(),
|
|
2737
|
-
return new File([c],
|
|
2791
|
+
const c = await l.blob(), h = (l.headers.get("content-disposition") ?? "").match(/filename="([^"]+)"/i)?.[1];
|
|
2792
|
+
return new File([c], h || a.split("/").pop() || "file", {
|
|
2738
2793
|
type: c.type
|
|
2739
2794
|
});
|
|
2740
2795
|
}
|
|
@@ -2744,7 +2799,7 @@ function qn(t, e) {
|
|
|
2744
2799
|
}
|
|
2745
2800
|
};
|
|
2746
2801
|
}
|
|
2747
|
-
function
|
|
2802
|
+
function Nn(t) {
|
|
2748
2803
|
return {
|
|
2749
2804
|
ok: !1,
|
|
2750
2805
|
exception: {
|
|
@@ -2758,10 +2813,10 @@ function Ln(t) {
|
|
|
2758
2813
|
}
|
|
2759
2814
|
};
|
|
2760
2815
|
}
|
|
2761
|
-
function
|
|
2816
|
+
function xn(t) {
|
|
2762
2817
|
return t.replace(/\/+$/, "");
|
|
2763
2818
|
}
|
|
2764
|
-
function
|
|
2819
|
+
function Bn(t) {
|
|
2765
2820
|
const e = {
|
|
2766
2821
|
sidepanel: "extension_sidepanel",
|
|
2767
2822
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -2773,18 +2828,18 @@ function xn(t) {
|
|
|
2773
2828
|
};
|
|
2774
2829
|
return t && t in e ? e[t] : t ?? "embedded_custom_ui";
|
|
2775
2830
|
}
|
|
2776
|
-
function
|
|
2831
|
+
function Wn(t) {
|
|
2777
2832
|
return t === "pluno" ? "scheduled_continuation" : t ?? "user";
|
|
2778
2833
|
}
|
|
2779
|
-
function
|
|
2834
|
+
function Hn(t, e = location.origin) {
|
|
2780
2835
|
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;
|
|
2781
2836
|
}
|
|
2782
|
-
function
|
|
2837
|
+
function $n(t) {
|
|
2783
2838
|
const e = new URL("/api/product-agent/embed/ws", t);
|
|
2784
2839
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
2785
2840
|
}
|
|
2786
2841
|
function b() {
|
|
2787
|
-
const t =
|
|
2842
|
+
const t = Qt();
|
|
2788
2843
|
return {
|
|
2789
2844
|
url: location.href,
|
|
2790
2845
|
title: document.title,
|
|
@@ -2792,21 +2847,21 @@ function b() {
|
|
|
2792
2847
|
...t ? { plunoProductAgentUi: t } : {}
|
|
2793
2848
|
};
|
|
2794
2849
|
}
|
|
2795
|
-
function
|
|
2850
|
+
function Fn() {
|
|
2796
2851
|
return {
|
|
2797
2852
|
pageUrl: location.href,
|
|
2798
2853
|
pageTitle: document.title,
|
|
2799
|
-
htmlContent:
|
|
2854
|
+
htmlContent: at()
|
|
2800
2855
|
};
|
|
2801
2856
|
}
|
|
2802
2857
|
function jn(t) {
|
|
2803
|
-
return
|
|
2804
|
-
|
|
2858
|
+
return we.add(t), fe || (fe = zn()), () => {
|
|
2859
|
+
we.delete(t), we.size === 0 && (fe?.(), fe = null);
|
|
2805
2860
|
};
|
|
2806
2861
|
}
|
|
2807
|
-
function
|
|
2862
|
+
function zn() {
|
|
2808
2863
|
const t = () => {
|
|
2809
|
-
for (const i of Array.from(
|
|
2864
|
+
for (const i of Array.from(we))
|
|
2810
2865
|
i();
|
|
2811
2866
|
}, e = window.history.pushState.bind(window.history), s = window.history.replaceState.bind(window.history), n = ((...i) => {
|
|
2812
2867
|
const o = e(...i);
|
|
@@ -2819,38 +2874,38 @@ function Fn() {
|
|
|
2819
2874
|
window.history.pushState === n && (window.history.pushState = e), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", t), window.removeEventListener("hashchange", t);
|
|
2820
2875
|
};
|
|
2821
2876
|
}
|
|
2822
|
-
function
|
|
2823
|
-
return
|
|
2877
|
+
function ye() {
|
|
2878
|
+
return Qt()?.surface === "browser_extension_sdk_preview";
|
|
2824
2879
|
}
|
|
2825
|
-
function
|
|
2880
|
+
function at() {
|
|
2826
2881
|
if (!document.body)
|
|
2827
2882
|
return "";
|
|
2828
|
-
const t = [], e = [], s = (
|
|
2829
|
-
const
|
|
2830
|
-
!
|
|
2883
|
+
const t = [], e = [], s = (p, g) => {
|
|
2884
|
+
const y = te(g);
|
|
2885
|
+
!y || e.includes(y) || (t.push([p, y]), e.push(y));
|
|
2831
2886
|
};
|
|
2832
2887
|
s("Selected text", window.getSelection()?.toString() ?? "");
|
|
2833
2888
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", r = Array.from(document.querySelectorAll(n)).filter(
|
|
2834
|
-
(
|
|
2889
|
+
(p) => Vt(p) && !p.parentElement?.closest(n)
|
|
2835
2890
|
);
|
|
2836
|
-
for (const
|
|
2837
|
-
s("Active overlay",
|
|
2838
|
-
const i =
|
|
2839
|
-
s("Main page content", o), s("Additional visible page text",
|
|
2840
|
-
const a = t.map(([
|
|
2891
|
+
for (const p of r.slice(0, 3))
|
|
2892
|
+
s("Active overlay", ze(ue(p), e));
|
|
2893
|
+
const i = Kn(), o = i ? ze(ue(i), e) : "";
|
|
2894
|
+
s("Main page content", o), s("Additional visible page text", ze(ue(document.body), e));
|
|
2895
|
+
const a = t.map(([p, g]) => `${p}:
|
|
2841
2896
|
${g}`).join(`
|
|
2842
2897
|
|
|
2843
|
-
`).trim().slice(0, 12e3), l =
|
|
2898
|
+
`).trim().slice(0, 12e3), l = Gn(r, i).trim(), c = `Simplified DOM outline:
|
|
2844
2899
|
`, d = `
|
|
2845
2900
|
|
|
2846
2901
|
Visible page text:
|
|
2847
|
-
`,
|
|
2902
|
+
`, h = 12e3 - c.length - d.length, m = Math.min(a.length, 7900), f = l.slice(0, h - m), u = a.slice(0, h - f.length);
|
|
2848
2903
|
return `${c}${f}${d}${u}`;
|
|
2849
2904
|
}
|
|
2850
|
-
function
|
|
2905
|
+
function ue(t) {
|
|
2851
2906
|
return t.innerText ?? t.textContent ?? "";
|
|
2852
2907
|
}
|
|
2853
|
-
function
|
|
2908
|
+
function te(t) {
|
|
2854
2909
|
return (t ?? "").replace(/\u00a0/g, " ").replace(/\r\n?/g, `
|
|
2855
2910
|
`).split(`
|
|
2856
2911
|
`).map((e) => e.replace(/[ \t]+/g, " ").trim()).join(`
|
|
@@ -2858,20 +2913,20 @@ function Z(t) {
|
|
|
2858
2913
|
|
|
2859
2914
|
`).trim();
|
|
2860
2915
|
}
|
|
2861
|
-
function
|
|
2862
|
-
let s =
|
|
2916
|
+
function ze(t, e) {
|
|
2917
|
+
let s = te(t);
|
|
2863
2918
|
for (const n of e)
|
|
2864
2919
|
s = s.replace(n, "");
|
|
2865
|
-
return
|
|
2920
|
+
return te(s);
|
|
2866
2921
|
}
|
|
2867
|
-
function
|
|
2922
|
+
function Vt(t) {
|
|
2868
2923
|
const e = window.getComputedStyle(t);
|
|
2869
2924
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
2870
2925
|
}
|
|
2871
|
-
function
|
|
2872
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
2926
|
+
function Kn() {
|
|
2927
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Vt).sort((t, e) => ue(e).length - ue(t).length)[0] ?? null;
|
|
2873
2928
|
}
|
|
2874
|
-
function
|
|
2929
|
+
function Gn(t, e) {
|
|
2875
2930
|
const s = /* @__PURE__ */ new Set([
|
|
2876
2931
|
"main",
|
|
2877
2932
|
"nav",
|
|
@@ -2951,92 +3006,92 @@ function Kn(t, e) {
|
|
|
2951
3006
|
"data-test",
|
|
2952
3007
|
"data-qa",
|
|
2953
3008
|
"data-cy"
|
|
2954
|
-
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets:
|
|
2955
|
-
e &&
|
|
3009
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: h } = Vn(), m = new Set(t);
|
|
3010
|
+
e && m.add(e);
|
|
2956
3011
|
let f = 0;
|
|
2957
|
-
const u = (
|
|
2958
|
-
const
|
|
2959
|
-
return
|
|
2960
|
-
},
|
|
2961
|
-
const
|
|
2962
|
-
return `${
|
|
2963
|
-
}, g = (
|
|
2964
|
-
const
|
|
2965
|
-
const
|
|
2966
|
-
if (f >= 1e3 &&
|
|
3012
|
+
const u = (w) => {
|
|
3013
|
+
const D = w.getAttribute("role");
|
|
3014
|
+
return D && !o.has(D) ? D : "";
|
|
3015
|
+
}, p = (w) => {
|
|
3016
|
+
const D = w.getAttribute("data-testid") || w.getAttribute("data-test") || w.getAttribute("data-qa") || w.getAttribute("data-cy") || "";
|
|
3017
|
+
return `${w.tagName.toLowerCase()}|${u(w)}|${D}`;
|
|
3018
|
+
}, g = (w, D, U) => {
|
|
3019
|
+
const S = (T, N) => {
|
|
3020
|
+
const _ = T.tagName.toLowerCase(), ne = window.getComputedStyle(T), $ = d.has(T);
|
|
3021
|
+
if (f >= 1e3 && !$ || U.has(T) || i.has(_) || T.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ne.display === "none" || ne.visibility === "hidden")
|
|
2967
3022
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
2968
3023
|
f += 1;
|
|
2969
|
-
const
|
|
2970
|
-
for (const I of
|
|
2971
|
-
const
|
|
2972
|
-
|
|
3024
|
+
const he = u(T), z = Jt(T), K = a.has(he) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(_) || _ === "a" && T.hasAttribute("href"), Q = Array.from(T.children).filter((I) => I instanceof HTMLElement), re = /* @__PURE__ */ new Map();
|
|
3025
|
+
for (const I of Q) {
|
|
3026
|
+
const E = p(I);
|
|
3027
|
+
re.set(E, (re.get(E) ?? 0) + 1);
|
|
2973
3028
|
}
|
|
2974
|
-
const
|
|
2975
|
-
for (const I of
|
|
2976
|
-
const
|
|
2977
|
-
|
|
3029
|
+
const Y = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
|
|
3030
|
+
for (const I of Q) {
|
|
3031
|
+
const E = p(I), j = F.get(E) ?? 0;
|
|
3032
|
+
F.set(E, j + 1), (re.get(E) ?? 0) > 8 && j >= 6 && !d.has(I) && Y.set(E, (Y.get(E) ?? 0) + 1);
|
|
2978
3033
|
}
|
|
2979
|
-
const
|
|
2980
|
-
for (const I of
|
|
2981
|
-
const
|
|
2982
|
-
if (
|
|
2983
|
-
|
|
3034
|
+
const k = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set(), ve = [], ut = [];
|
|
3035
|
+
for (const I of Q) {
|
|
3036
|
+
const E = p(I), j = re.get(E) ?? 0, pt = k.get(E) ?? 0;
|
|
3037
|
+
if (k.set(E, pt + 1), j > 8 && pt >= 6 && !d.has(I)) {
|
|
3038
|
+
O.has(E) || (ve.push([`… ${Y.get(E) ?? 0} similar siblings omitted`]), O.add(E));
|
|
2984
3039
|
continue;
|
|
2985
3040
|
}
|
|
2986
|
-
const gt =
|
|
2987
|
-
ut.push(gt),
|
|
3041
|
+
const gt = S(I, N);
|
|
3042
|
+
ut.push(gt), ve.push(gt.lines);
|
|
2988
3043
|
}
|
|
2989
|
-
const
|
|
2990
|
-
if (
|
|
2991
|
-
for (const I of Array.from(
|
|
2992
|
-
I instanceof HTMLElement &&
|
|
2993
|
-
const
|
|
2994
|
-
[
|
|
2995
|
-
).slice(0, 180),
|
|
2996
|
-
if (
|
|
2997
|
-
const I =
|
|
2998
|
-
|
|
3044
|
+
const De = [];
|
|
3045
|
+
if (T.shadowRoot)
|
|
3046
|
+
for (const I of Array.from(T.shadowRoot.children))
|
|
3047
|
+
I instanceof HTMLElement && De.push(S(I, N + 1));
|
|
3048
|
+
const pe = [...ut, ...De], Oe = z.length > 0 || K || pe.some((I) => I.hasUsefulContent), dt = te(
|
|
3049
|
+
[z, ...pe.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
3050
|
+
).slice(0, 180), Ss = T.hasAttribute("contenteditable") && (z.length > 0 || !T.querySelector("[contenteditable]")), ht = c.some((I) => T.hasAttribute(I)) || !!he || Ss, qe = (T.getClientRects().length > 0 || ne.display === "contents") && (s.has(_) || ht || $) && (Oe || $) && (!r.has(_) || Oe || ht || $), Le = qe ? 1 : 0, ie = [];
|
|
3051
|
+
if (qe) {
|
|
3052
|
+
const I = pe.some((j) => j.containsTextElement), E = n.has(_) && !I ? dt : z;
|
|
3053
|
+
ie.push(Xt(T, l, o, E.slice(0, 180)));
|
|
2999
3054
|
}
|
|
3000
|
-
for (const I of
|
|
3001
|
-
|
|
3002
|
-
const
|
|
3003
|
-
if (
|
|
3004
|
-
const I =
|
|
3005
|
-
|
|
3006
|
-
const
|
|
3007
|
-
if (
|
|
3008
|
-
const j =
|
|
3009
|
-
|
|
3055
|
+
for (const I of ve)
|
|
3056
|
+
ie.push(...Ie(I, Le));
|
|
3057
|
+
const Ne = De.flatMap((I) => I.lines);
|
|
3058
|
+
if (Ne.length > 0) {
|
|
3059
|
+
const I = Ne.slice(0, 20);
|
|
3060
|
+
Ne.length > I.length && I.push("… shadow DOM omitted");
|
|
3061
|
+
const E = _.includes("tooltip") || _.includes("popper") || _.includes("loader");
|
|
3062
|
+
if (N < 2 && !E) {
|
|
3063
|
+
const j = qe ? "#shadow-root" : `${_} #shadow-root`;
|
|
3064
|
+
ie.push(...Ie([j, ...Ie(I, 1)], Le));
|
|
3010
3065
|
} else
|
|
3011
|
-
|
|
3066
|
+
ie.push(...Ie(I, Le));
|
|
3012
3067
|
}
|
|
3013
3068
|
return {
|
|
3014
|
-
lines:
|
|
3015
|
-
hasUsefulContent:
|
|
3069
|
+
lines: ie,
|
|
3070
|
+
hasUsefulContent: Oe,
|
|
3016
3071
|
textPreview: dt,
|
|
3017
|
-
containsTextElement: n.has(
|
|
3072
|
+
containsTextElement: n.has(_) || pe.some((I) => I.containsTextElement)
|
|
3018
3073
|
};
|
|
3019
3074
|
};
|
|
3020
|
-
return [`--- ${
|
|
3075
|
+
return [`--- ${D} ---`, ...S(w, 0).lines].join(`
|
|
3021
3076
|
`);
|
|
3022
|
-
},
|
|
3023
|
-
|
|
3024
|
-
${JSON.stringify(
|
|
3025
|
-
for (const
|
|
3026
|
-
|
|
3027
|
-
if (e &&
|
|
3028
|
-
const
|
|
3029
|
-
|
|
3030
|
-
}
|
|
3031
|
-
return
|
|
3077
|
+
}, y = [], M = te(window.getSelection()?.toString() ?? "");
|
|
3078
|
+
M && y.push(`--- selected text ---
|
|
3079
|
+
${JSON.stringify(M)}`), h.length > 0 && y.push(Xn(h, s, l, o));
|
|
3080
|
+
for (const w of t.slice(0, 3))
|
|
3081
|
+
y.push(g(w, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
3082
|
+
if (e && y.push(g(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
3083
|
+
const w = e || t.length ? "other visible DOM" : "visible DOM";
|
|
3084
|
+
y.push(g(document.body, w, m));
|
|
3085
|
+
}
|
|
3086
|
+
return y.join(`
|
|
3032
3087
|
|
|
3033
3088
|
`);
|
|
3034
3089
|
}
|
|
3035
|
-
function
|
|
3090
|
+
function Xt(t, e, s, n) {
|
|
3036
3091
|
const r = t.tagName.toLowerCase();
|
|
3037
3092
|
let i = r;
|
|
3038
3093
|
const o = t.getAttribute("id");
|
|
3039
|
-
o &&
|
|
3094
|
+
o && Jn(o) && (i += `#${o}`);
|
|
3040
3095
|
for (const a of e) {
|
|
3041
3096
|
const l = t.getAttribute(a);
|
|
3042
3097
|
l && l.length <= 160 && (a !== "role" || !s.has(l)) && (i += `[${a}=${JSON.stringify(l)}]`);
|
|
@@ -3049,7 +3104,7 @@ function Vt(t, e, s, n) {
|
|
|
3049
3104
|
t.hasAttribute(a) && (i += `[${a}]`);
|
|
3050
3105
|
return `${i}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
3051
3106
|
}
|
|
3052
|
-
function
|
|
3107
|
+
function Vn() {
|
|
3053
3108
|
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), s = (a, l) => {
|
|
3054
3109
|
if (!a)
|
|
3055
3110
|
return;
|
|
@@ -3058,11 +3113,11 @@ function Gn() {
|
|
|
3058
3113
|
return;
|
|
3059
3114
|
const d = e.get(a) ?? /* @__PURE__ */ new Set();
|
|
3060
3115
|
d.add(l), e.set(a, d);
|
|
3061
|
-
let
|
|
3062
|
-
for (;
|
|
3063
|
-
t.add(
|
|
3064
|
-
const
|
|
3065
|
-
|
|
3116
|
+
let h = a;
|
|
3117
|
+
for (; h; ) {
|
|
3118
|
+
t.add(h);
|
|
3119
|
+
const m = h.getRootNode();
|
|
3120
|
+
h = h.parentElement ?? (m instanceof ShadowRoot && m.host instanceof HTMLElement ? m.host : null);
|
|
3066
3121
|
}
|
|
3067
3122
|
};
|
|
3068
3123
|
let n = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
@@ -3082,8 +3137,8 @@ function Gn() {
|
|
|
3082
3137
|
for (let a = 0; a < o.length; a += 1) {
|
|
3083
3138
|
const l = o[a];
|
|
3084
3139
|
for (const [c, d] of i)
|
|
3085
|
-
for (const
|
|
3086
|
-
s(
|
|
3140
|
+
for (const h of Array.from(l.querySelectorAll(c)))
|
|
3141
|
+
s(h, d);
|
|
3087
3142
|
for (const c of Array.from(l.querySelectorAll("*")))
|
|
3088
3143
|
c.shadowRoot && o.push(c.shadowRoot);
|
|
3089
3144
|
}
|
|
@@ -3092,7 +3147,7 @@ function Gn() {
|
|
|
3092
3147
|
priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
|
|
3093
3148
|
};
|
|
3094
3149
|
}
|
|
3095
|
-
function
|
|
3150
|
+
function Xn(t, e, s, n) {
|
|
3096
3151
|
const r = ["--- active/current elements ---"];
|
|
3097
3152
|
for (const i of t) {
|
|
3098
3153
|
const o = [];
|
|
@@ -3100,14 +3155,14 @@ function Vn(t, e, s, n) {
|
|
|
3100
3155
|
for (; a; ) {
|
|
3101
3156
|
const d = a.tagName.toLowerCase();
|
|
3102
3157
|
(a === i.element || e.has(d) || a.hasAttribute("id") || a.hasAttribute("role") || a.hasAttribute("aria-label")) && o.unshift(a);
|
|
3103
|
-
const
|
|
3104
|
-
a = a.parentElement ?? (
|
|
3158
|
+
const h = a.getRootNode();
|
|
3159
|
+
a = a.parentElement ?? (h instanceof ShadowRoot && h.host instanceof HTMLElement ? h.host : null);
|
|
3105
3160
|
}
|
|
3106
|
-
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((d,
|
|
3161
|
+
const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((d, h) => Xt(
|
|
3107
3162
|
d,
|
|
3108
3163
|
s,
|
|
3109
3164
|
n,
|
|
3110
|
-
|
|
3165
|
+
h === l.length - 1 ? Jt(d).slice(0, 180) : ""
|
|
3111
3166
|
));
|
|
3112
3167
|
o.length > l.length && c.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${c.join(" > ")}`);
|
|
3113
3168
|
}
|
|
@@ -3117,23 +3172,23 @@ function Vn(t, e, s, n) {
|
|
|
3117
3172
|
function bt(t) {
|
|
3118
3173
|
return t instanceof HTMLElement ? t : t?.parentElement instanceof HTMLElement ? t.parentElement : null;
|
|
3119
3174
|
}
|
|
3120
|
-
function
|
|
3175
|
+
function Ie(t, e) {
|
|
3121
3176
|
if (e === 0)
|
|
3122
3177
|
return t;
|
|
3123
3178
|
const s = " ".repeat(e);
|
|
3124
3179
|
return t.map((n) => `${s}${n}`);
|
|
3125
3180
|
}
|
|
3126
|
-
function
|
|
3127
|
-
return
|
|
3181
|
+
function Jt(t) {
|
|
3182
|
+
return te(
|
|
3128
3183
|
Array.from(t.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
3129
3184
|
);
|
|
3130
3185
|
}
|
|
3131
|
-
function
|
|
3186
|
+
function Jn(t) {
|
|
3132
3187
|
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);
|
|
3133
3188
|
}
|
|
3134
|
-
function
|
|
3189
|
+
function Qt() {
|
|
3135
3190
|
const t = document.querySelector(ft);
|
|
3136
|
-
if (!(t ?? document.querySelector(
|
|
3191
|
+
if (!(t ?? document.querySelector(Xe)))
|
|
3137
3192
|
return;
|
|
3138
3193
|
const s = t ? "browser_extension_sdk_preview" : "embedded_widget";
|
|
3139
3194
|
return {
|
|
@@ -3142,28 +3197,28 @@ function Jt() {
|
|
|
3142
3197
|
selectors: [
|
|
3143
3198
|
{
|
|
3144
3199
|
name: "widget_host",
|
|
3145
|
-
selector: s === "browser_extension_sdk_preview" ? ft :
|
|
3200
|
+
selector: s === "browser_extension_sdk_preview" ? ft : Xe,
|
|
3146
3201
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
3147
3202
|
},
|
|
3148
3203
|
{
|
|
3149
3204
|
name: "widget_root",
|
|
3150
|
-
selector:
|
|
3205
|
+
selector: Xs,
|
|
3151
3206
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
3152
3207
|
},
|
|
3153
3208
|
{
|
|
3154
3209
|
name: "widget_panel",
|
|
3155
|
-
selector:
|
|
3210
|
+
selector: Js,
|
|
3156
3211
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
3157
3212
|
},
|
|
3158
3213
|
{
|
|
3159
3214
|
name: "widget_timeline",
|
|
3160
|
-
selector:
|
|
3215
|
+
selector: Qs,
|
|
3161
3216
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
3162
3217
|
}
|
|
3163
3218
|
]
|
|
3164
3219
|
};
|
|
3165
3220
|
}
|
|
3166
|
-
function
|
|
3221
|
+
function Qn(t) {
|
|
3167
3222
|
try {
|
|
3168
3223
|
const e = JSON.parse(t);
|
|
3169
3224
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -3187,10 +3242,18 @@ function _t(t, e) {
|
|
|
3187
3242
|
const s = t[e];
|
|
3188
3243
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
3189
3244
|
}
|
|
3190
|
-
function
|
|
3191
|
-
return Array.isArray(t) ? t.
|
|
3245
|
+
function Pt(t) {
|
|
3246
|
+
return Array.isArray(t) ? t.flatMap((e) => {
|
|
3247
|
+
if (!e || typeof e != "object")
|
|
3248
|
+
return [];
|
|
3249
|
+
const s = e;
|
|
3250
|
+
return typeof s.taskId != "string" || !s.taskId || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? [] : [{ taskId: s.taskId, dueAt: s.dueAt }];
|
|
3251
|
+
}) : [];
|
|
3192
3252
|
}
|
|
3193
3253
|
function Zn(t) {
|
|
3254
|
+
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
3255
|
+
}
|
|
3256
|
+
function er(t) {
|
|
3194
3257
|
if (!t || typeof t != "object")
|
|
3195
3258
|
return null;
|
|
3196
3259
|
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;
|
|
@@ -3201,13 +3264,13 @@ function Zn(t) {
|
|
|
3201
3264
|
...a !== null ? { scribbleStyle: a } : {}
|
|
3202
3265
|
};
|
|
3203
3266
|
}
|
|
3204
|
-
function
|
|
3267
|
+
function tr(t) {
|
|
3205
3268
|
if (!t || typeof t != "object")
|
|
3206
3269
|
return null;
|
|
3207
3270
|
const e = t.javascript;
|
|
3208
3271
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
3209
3272
|
}
|
|
3210
|
-
function
|
|
3273
|
+
function sr(t, e) {
|
|
3211
3274
|
return e ? t && typeof t == "object" ? {
|
|
3212
3275
|
...t,
|
|
3213
3276
|
helperError: e
|
|
@@ -3217,23 +3280,23 @@ function tr(t, e) {
|
|
|
3217
3280
|
helperError: e
|
|
3218
3281
|
} : t;
|
|
3219
3282
|
}
|
|
3220
|
-
function
|
|
3283
|
+
function nr(t) {
|
|
3221
3284
|
if (!t || typeof t != "object")
|
|
3222
3285
|
return t;
|
|
3223
3286
|
const e = t;
|
|
3224
3287
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : t;
|
|
3225
3288
|
}
|
|
3226
|
-
function
|
|
3289
|
+
function rr() {
|
|
3227
3290
|
const t = "pluno.productAgent.clientId", e = window.localStorage.getItem(t);
|
|
3228
3291
|
if (e)
|
|
3229
3292
|
return e;
|
|
3230
3293
|
const s = crypto.randomUUID();
|
|
3231
3294
|
return window.localStorage.setItem(t, s), s;
|
|
3232
3295
|
}
|
|
3233
|
-
function
|
|
3296
|
+
function x() {
|
|
3234
3297
|
return crypto.randomUUID();
|
|
3235
3298
|
}
|
|
3236
|
-
function
|
|
3299
|
+
function ir(t) {
|
|
3237
3300
|
if (!t || typeof t != "object")
|
|
3238
3301
|
return null;
|
|
3239
3302
|
const e = t, s = typeof e.id == "string" ? e.id : null;
|
|
@@ -3244,22 +3307,22 @@ function rr(t) {
|
|
|
3244
3307
|
avatarUrl: typeof e.avatarUrl == "string" ? e.avatarUrl : null
|
|
3245
3308
|
} : null;
|
|
3246
3309
|
}
|
|
3247
|
-
function
|
|
3248
|
-
return Array.isArray(t) ?
|
|
3310
|
+
function Ut(t, e) {
|
|
3311
|
+
return Array.isArray(t) ? et(
|
|
3249
3312
|
t.map((s) => Yt(s, e)).filter((s) => s !== null)
|
|
3250
3313
|
) : [];
|
|
3251
3314
|
}
|
|
3252
|
-
function
|
|
3315
|
+
function or(t) {
|
|
3253
3316
|
return Array.isArray(t) ? t.flatMap((e) => {
|
|
3254
3317
|
if (!e || typeof e != "object")
|
|
3255
3318
|
return [];
|
|
3256
|
-
const s = e, n =
|
|
3319
|
+
const s = e, n = R(s, "id"), r = R(s, "createdAt"), i = R(s, "updatedAt"), o = R(s, "lastActiveAt");
|
|
3257
3320
|
return !n || !r || !i || !o ? [] : [
|
|
3258
3321
|
{
|
|
3259
3322
|
id: n,
|
|
3260
|
-
title:
|
|
3261
|
-
customTitle:
|
|
3262
|
-
firstUserMessage:
|
|
3323
|
+
title: R(s, "title"),
|
|
3324
|
+
customTitle: R(s, "customTitle"),
|
|
3325
|
+
firstUserMessage: R(s, "firstUserMessage"),
|
|
3263
3326
|
currentPage: s.currentPage ?? null,
|
|
3264
3327
|
createdAt: r,
|
|
3265
3328
|
updatedAt: i,
|
|
@@ -3277,22 +3340,22 @@ function Yt(t, e) {
|
|
|
3277
3340
|
if (!n || typeof n != "object")
|
|
3278
3341
|
return null;
|
|
3279
3342
|
const r = n;
|
|
3280
|
-
if (r.hiddenFromTranscript === !0 ||
|
|
3343
|
+
if (r.hiddenFromTranscript === !0 || vs(r) || r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
3281
3344
|
return null;
|
|
3282
3345
|
if (r.type === "message") {
|
|
3283
3346
|
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
|
|
3284
3347
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3285
3348
|
role: i,
|
|
3286
3349
|
...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
|
|
3287
|
-
content:
|
|
3288
|
-
|
|
3350
|
+
content: Cs(
|
|
3351
|
+
gr(r.content),
|
|
3289
3352
|
e
|
|
3290
3353
|
),
|
|
3291
3354
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3292
|
-
...
|
|
3355
|
+
...v(r) !== null ? { causalSequence: v(r) } : {},
|
|
3293
3356
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3294
|
-
...
|
|
3295
|
-
attachments:
|
|
3357
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3358
|
+
attachments: ls(r.attachments, e)
|
|
3296
3359
|
};
|
|
3297
3360
|
return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
3298
3361
|
value: r.id,
|
|
@@ -3300,10 +3363,13 @@ function Yt(t, e) {
|
|
|
3300
3363
|
}), typeof r.clientMessageId == "string" && Object.defineProperty(o, "clientMessageId", {
|
|
3301
3364
|
value: r.clientMessageId,
|
|
3302
3365
|
enumerable: !1
|
|
3366
|
+
}), typeof r.proactiveSuggestionClientMessageId == "string" && Object.defineProperty(o, "proactiveSuggestionClientMessageId", {
|
|
3367
|
+
value: r.proactiveSuggestionClientMessageId,
|
|
3368
|
+
enumerable: !1
|
|
3303
3369
|
}), o;
|
|
3304
3370
|
}
|
|
3305
3371
|
if (r.type === "function_call_output") {
|
|
3306
|
-
const i =
|
|
3372
|
+
const i = _s(r.output);
|
|
3307
3373
|
if (i !== null)
|
|
3308
3374
|
return {
|
|
3309
3375
|
id: String(s.id ?? crypto.randomUUID()),
|
|
@@ -3311,10 +3377,10 @@ function Yt(t, e) {
|
|
|
3311
3377
|
content: "",
|
|
3312
3378
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3313
3379
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3314
|
-
...
|
|
3380
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3315
3381
|
dataType: "function_call_output",
|
|
3316
|
-
toolName:
|
|
3317
|
-
callId:
|
|
3382
|
+
toolName: bs,
|
|
3383
|
+
callId: ce(r) ?? void 0,
|
|
3318
3384
|
sharePromptAllowed: i
|
|
3319
3385
|
};
|
|
3320
3386
|
const o = js(r.output);
|
|
@@ -3325,60 +3391,60 @@ function Yt(t, e) {
|
|
|
3325
3391
|
content: "",
|
|
3326
3392
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3327
3393
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3328
|
-
...
|
|
3394
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3329
3395
|
dataType: "scheduled_check_in",
|
|
3330
|
-
toolName:
|
|
3331
|
-
callId:
|
|
3396
|
+
toolName: Ft,
|
|
3397
|
+
callId: ce(r) ?? void 0,
|
|
3332
3398
|
scheduledCheckInId: o.id ?? void 0,
|
|
3333
3399
|
scheduledCheckInAt: o.dueAt
|
|
3334
3400
|
};
|
|
3335
|
-
const a =
|
|
3401
|
+
const a = lr(r.output), l = cr(r.output);
|
|
3336
3402
|
return a ? {
|
|
3337
3403
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3338
3404
|
role: "tool",
|
|
3339
3405
|
content: `Connect ${a.appName} to continue`,
|
|
3340
3406
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3341
|
-
...
|
|
3407
|
+
...v(r) !== null ? { causalSequence: v(r) } : {},
|
|
3342
3408
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3343
|
-
...
|
|
3409
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3344
3410
|
dataType: "function_call_output",
|
|
3345
3411
|
toolName: "authenticate_pipedream_app",
|
|
3346
|
-
callId:
|
|
3412
|
+
callId: ce(r) ?? void 0,
|
|
3347
3413
|
integrationAuthRequest: a
|
|
3348
3414
|
} : l ? {
|
|
3349
3415
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3350
3416
|
role: "tool",
|
|
3351
3417
|
content: "Connect WhatsApp to continue",
|
|
3352
3418
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3353
|
-
...
|
|
3419
|
+
...v(r) !== null ? { causalSequence: v(r) } : {},
|
|
3354
3420
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3355
|
-
...
|
|
3421
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3356
3422
|
dataType: "function_call_output",
|
|
3357
3423
|
toolName: "request_personal_channel_connection",
|
|
3358
|
-
callId:
|
|
3424
|
+
callId: ce(r) ?? void 0,
|
|
3359
3425
|
personalChannelConnectionRequest: l
|
|
3360
3426
|
} : null;
|
|
3361
3427
|
}
|
|
3362
3428
|
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
|
|
3363
3429
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3364
3430
|
role: "tool",
|
|
3365
|
-
content: r.type === "mcp_call" ?
|
|
3431
|
+
content: r.type === "mcp_call" ? ar(r) : dr(r),
|
|
3366
3432
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3367
|
-
...
|
|
3433
|
+
...v(r) !== null ? { causalSequence: v(r) } : {},
|
|
3368
3434
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3369
|
-
...
|
|
3435
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3370
3436
|
dataType: String(r.type),
|
|
3371
3437
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
3372
|
-
callId:
|
|
3438
|
+
callId: ce(r) ?? void 0,
|
|
3373
3439
|
loading: r.localExecutionStatus === "queued" || r.localExecutionStatus === "running" ? !0 : typeof r.localExecutionStatus == "string" ? !1 : void 0
|
|
3374
3440
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
3375
3441
|
id: String(s.id ?? crypto.randomUUID()),
|
|
3376
3442
|
role: "system",
|
|
3377
|
-
content:
|
|
3443
|
+
content: ur(r),
|
|
3378
3444
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
3379
|
-
...
|
|
3445
|
+
...v(r) !== null ? { causalSequence: v(r) } : {},
|
|
3380
3446
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
3381
|
-
...
|
|
3447
|
+
...C(r) ? { runId: C(r) } : {},
|
|
3382
3448
|
dataType: String(r.type),
|
|
3383
3449
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
3384
3450
|
...r.type === "run_status" && r.status === "steered" ? { steered: !0 } : {},
|
|
@@ -3386,11 +3452,11 @@ function Yt(t, e) {
|
|
|
3386
3452
|
...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
|
|
3387
3453
|
} : null;
|
|
3388
3454
|
}
|
|
3389
|
-
function
|
|
3455
|
+
function ar(t) {
|
|
3390
3456
|
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(" ");
|
|
3391
3457
|
return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
|
|
3392
3458
|
}
|
|
3393
|
-
function
|
|
3459
|
+
function lr(t) {
|
|
3394
3460
|
if (typeof t != "string")
|
|
3395
3461
|
return null;
|
|
3396
3462
|
try {
|
|
@@ -3407,7 +3473,7 @@ function ar(t) {
|
|
|
3407
3473
|
return null;
|
|
3408
3474
|
}
|
|
3409
3475
|
}
|
|
3410
|
-
function
|
|
3476
|
+
function cr(t) {
|
|
3411
3477
|
if (typeof t != "string")
|
|
3412
3478
|
return null;
|
|
3413
3479
|
try {
|
|
@@ -3422,10 +3488,10 @@ function lr(t) {
|
|
|
3422
3488
|
return null;
|
|
3423
3489
|
}
|
|
3424
3490
|
}
|
|
3425
|
-
function
|
|
3491
|
+
function ur(t) {
|
|
3426
3492
|
return t.type === "run_status" && t.status === "steered" ? "Steered" : typeof t.message == "string" && t.message.trim().length > 0 ? t.message : "";
|
|
3427
3493
|
}
|
|
3428
|
-
function
|
|
3494
|
+
function dr(t) {
|
|
3429
3495
|
if (t.type === "web_search_call") {
|
|
3430
3496
|
const e = t.action;
|
|
3431
3497
|
if (e && typeof e == "object") {
|
|
@@ -3437,26 +3503,26 @@ function ur(t) {
|
|
|
3437
3503
|
}
|
|
3438
3504
|
return "🔎 Searching the web";
|
|
3439
3505
|
}
|
|
3440
|
-
return
|
|
3506
|
+
return hr(t);
|
|
3441
3507
|
}
|
|
3442
|
-
function
|
|
3508
|
+
function hr(t) {
|
|
3443
3509
|
if (typeof t.summary == "string" && t.summary.trim().length > 0)
|
|
3444
|
-
return
|
|
3510
|
+
return ee(t.summary);
|
|
3445
3511
|
if (typeof t.arguments == "string")
|
|
3446
3512
|
try {
|
|
3447
3513
|
const e = JSON.parse(t.arguments);
|
|
3448
3514
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
3449
|
-
return
|
|
3515
|
+
return ee(e.summary);
|
|
3450
3516
|
} catch {
|
|
3451
|
-
return typeof t.name == "string" && t.name.trim().length > 0 ?
|
|
3517
|
+
return typeof t.name == "string" && t.name.trim().length > 0 ? ee(t.name) : "🛠️ Run tool";
|
|
3452
3518
|
}
|
|
3453
|
-
return typeof t.name == "string" && t.name.trim().length > 0 ?
|
|
3519
|
+
return typeof t.name == "string" && t.name.trim().length > 0 ? ee(t.name) : "🛠️ Run tool";
|
|
3454
3520
|
}
|
|
3455
|
-
function
|
|
3521
|
+
function ee(t) {
|
|
3456
3522
|
const e = t.trim() || "Run tool", s = e.codePointAt(0) ?? 0;
|
|
3457
3523
|
return s >= 126976 && s <= 129791 || s >= 9728 && s <= 10175 || s >= 127462 && s <= 127487 ? e : `🛠️ ${e}`;
|
|
3458
3524
|
}
|
|
3459
|
-
function
|
|
3525
|
+
function pr(t) {
|
|
3460
3526
|
if (t == null)
|
|
3461
3527
|
return t;
|
|
3462
3528
|
if (typeof t != "object")
|
|
@@ -3471,14 +3537,14 @@ function hr(t) {
|
|
|
3471
3537
|
runId: typeof e.runId == "string" ? e.runId : null
|
|
3472
3538
|
};
|
|
3473
3539
|
}
|
|
3474
|
-
function
|
|
3540
|
+
function ce(t) {
|
|
3475
3541
|
const e = t.callId ?? t.call_id;
|
|
3476
3542
|
return typeof e == "string" && e ? e : null;
|
|
3477
3543
|
}
|
|
3478
|
-
function
|
|
3544
|
+
function v(t) {
|
|
3479
3545
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
3480
3546
|
}
|
|
3481
|
-
function
|
|
3547
|
+
function gr(t) {
|
|
3482
3548
|
return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => {
|
|
3483
3549
|
if (!e || typeof e != "object")
|
|
3484
3550
|
return "";
|
|
@@ -3486,31 +3552,44 @@ function pr(t) {
|
|
|
3486
3552
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
3487
3553
|
}).filter(Boolean).join("") : "";
|
|
3488
3554
|
}
|
|
3489
|
-
function
|
|
3490
|
-
const s =
|
|
3491
|
-
|
|
3492
|
-
|
|
3555
|
+
function Qe(t, e) {
|
|
3556
|
+
const s = ts(t, e), n = wr(
|
|
3557
|
+
mr(
|
|
3558
|
+
kr(
|
|
3559
|
+
fr(t, e),
|
|
3560
|
+
e
|
|
3561
|
+
),
|
|
3493
3562
|
s
|
|
3494
3563
|
),
|
|
3495
3564
|
s
|
|
3496
3565
|
), r = n.findIndex((o) => o.id === s.id);
|
|
3497
3566
|
if (r === -1)
|
|
3498
|
-
return
|
|
3567
|
+
return et(
|
|
3499
3568
|
[...n, s]
|
|
3500
3569
|
);
|
|
3501
3570
|
const i = [...n];
|
|
3502
|
-
return i[r] = s,
|
|
3571
|
+
return i[r] = s, et(i);
|
|
3503
3572
|
}
|
|
3504
|
-
function
|
|
3573
|
+
function fr(t, e) {
|
|
3574
|
+
const s = e.proactiveSuggestionClientMessageId;
|
|
3575
|
+
if (!s)
|
|
3576
|
+
return t;
|
|
3577
|
+
const n = `local-proactive-suggestion-question-${s}`, r = t.findIndex((o) => o.id === n);
|
|
3578
|
+
if (r < 0)
|
|
3579
|
+
return t;
|
|
3580
|
+
const i = [...t];
|
|
3581
|
+
return i[r] = e, i;
|
|
3582
|
+
}
|
|
3583
|
+
function mr(t, e) {
|
|
3505
3584
|
const s = e.assistantDraftItemId;
|
|
3506
3585
|
return s ? t.map(
|
|
3507
3586
|
(n) => n.dataType === "assistant_draft" && n.id === s ? e : n
|
|
3508
3587
|
) : t;
|
|
3509
3588
|
}
|
|
3510
|
-
function
|
|
3589
|
+
function Ke(t, e, s) {
|
|
3511
3590
|
return e !== null ? t.respondsToUserMessageId === e : s !== null && t.runId === s;
|
|
3512
3591
|
}
|
|
3513
|
-
function
|
|
3592
|
+
function yr(t, e, s, n) {
|
|
3514
3593
|
if (s === null) return t;
|
|
3515
3594
|
let r = -1;
|
|
3516
3595
|
for (let o = t.length - 1; o >= 0; o -= 1) {
|
|
@@ -3527,12 +3606,12 @@ function fr(t, e, s, n) {
|
|
|
3527
3606
|
respondsToUserMessageId: s
|
|
3528
3607
|
}, i;
|
|
3529
3608
|
}
|
|
3530
|
-
function
|
|
3609
|
+
function Ir(t, e) {
|
|
3531
3610
|
const s = t.findIndex(
|
|
3532
3611
|
(r) => !r.id.startsWith("transient-activity:") && r.callId === e.callId
|
|
3533
3612
|
);
|
|
3534
3613
|
if (s === -1)
|
|
3535
|
-
return
|
|
3614
|
+
return Qe(t, e);
|
|
3536
3615
|
const n = [...t];
|
|
3537
3616
|
return n[s] = {
|
|
3538
3617
|
...n[s],
|
|
@@ -3544,19 +3623,19 @@ function mr(t, e) {
|
|
|
3544
3623
|
...n[s].runId ? {} : { runId: e.runId }
|
|
3545
3624
|
}, n;
|
|
3546
3625
|
}
|
|
3547
|
-
function
|
|
3626
|
+
function Sr(t, e, s) {
|
|
3548
3627
|
let n = !1;
|
|
3549
3628
|
const r = t.map((i) => i.callId !== e || i.loading === s ? i : (n = !0, { ...i, loading: s }));
|
|
3550
3629
|
return n ? r : t;
|
|
3551
3630
|
}
|
|
3552
|
-
function
|
|
3631
|
+
function Tr(t) {
|
|
3553
3632
|
if (t.hiddenFromTranscript === !0)
|
|
3554
3633
|
return null;
|
|
3555
3634
|
const e = typeof t.callId == "string" ? t.callId : null, s = typeof t.toolName == "string" ? t.toolName : null;
|
|
3556
3635
|
return !e || !s ? null : {
|
|
3557
3636
|
id: `transient-activity:${e}`,
|
|
3558
3637
|
role: "tool",
|
|
3559
|
-
content:
|
|
3638
|
+
content: ee(
|
|
3560
3639
|
typeof t.summary == "string" ? t.summary : "Running browser tool"
|
|
3561
3640
|
),
|
|
3562
3641
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3569,7 +3648,7 @@ function Ir(t) {
|
|
|
3569
3648
|
loading: !0
|
|
3570
3649
|
};
|
|
3571
3650
|
}
|
|
3572
|
-
function
|
|
3651
|
+
function wr(t, e) {
|
|
3573
3652
|
if (e.id.startsWith("transient-activity:"))
|
|
3574
3653
|
return t;
|
|
3575
3654
|
const s = e.toolName === "tab_lifecycle";
|
|
@@ -3578,32 +3657,32 @@ function Tr(t, e) {
|
|
|
3578
3657
|
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);
|
|
3579
3658
|
return r === -1 ? t : t.flatMap((i, o) => n(i) ? o === r ? [e] : [] : i.id === e.id ? [] : [i]);
|
|
3580
3659
|
}
|
|
3581
|
-
function
|
|
3582
|
-
return
|
|
3660
|
+
function Zt(t, e) {
|
|
3661
|
+
return Ds(
|
|
3583
3662
|
t,
|
|
3584
3663
|
e.map(
|
|
3585
|
-
(s) =>
|
|
3664
|
+
(s) => ts(t, s)
|
|
3586
3665
|
),
|
|
3587
|
-
|
|
3666
|
+
es
|
|
3588
3667
|
);
|
|
3589
3668
|
}
|
|
3590
|
-
function
|
|
3669
|
+
function Mr(t, e) {
|
|
3591
3670
|
const s = new Map(t.map((n) => [n.id, n]));
|
|
3592
3671
|
for (const n of e)
|
|
3593
3672
|
s.set(n.id, n);
|
|
3594
|
-
return
|
|
3673
|
+
return Zt(
|
|
3595
3674
|
t,
|
|
3596
3675
|
[...s.values()]
|
|
3597
|
-
).sort(
|
|
3676
|
+
).sort(Ar);
|
|
3598
3677
|
}
|
|
3599
|
-
function
|
|
3678
|
+
function Ar(t, e) {
|
|
3600
3679
|
if ((t.respondsToUserMessageId !== void 0 && t.respondsToUserMessageId === e.respondsToUserMessageId || t.respondsToUserMessageId === void 0 && e.respondsToUserMessageId === void 0 && t.runId !== void 0 && t.runId === e.runId) && t.causalSequence !== void 0 && e.causalSequence !== void 0 && t.causalSequence !== e.causalSequence)
|
|
3601
3680
|
return t.causalSequence - e.causalSequence;
|
|
3602
3681
|
const n = Date.parse(t.createdAt) - Date.parse(e.createdAt);
|
|
3603
3682
|
return Number.isNaN(n) ? 0 : n;
|
|
3604
3683
|
}
|
|
3605
|
-
function
|
|
3606
|
-
const e =
|
|
3684
|
+
function es(t) {
|
|
3685
|
+
const e = X(t) ?? void 0, s = t.assistantDraftItemId, n = [
|
|
3607
3686
|
...t.callId ? [`call:${t.callId}`] : [],
|
|
3608
3687
|
...t.runId && (t.toolName === "browser_tabs" || t.toolName === "tab_lifecycle") ? [`tab-lifecycle:${t.runId}`] : []
|
|
3609
3688
|
];
|
|
@@ -3614,55 +3693,55 @@ function Zt(t) {
|
|
|
3614
3693
|
...n.length > 0 ? { activityKeys: n } : {},
|
|
3615
3694
|
...t.respondsToUserMessageId ? { respondsToUserMessageId: t.respondsToUserMessageId } : {},
|
|
3616
3695
|
...t.runId ? { runId: t.runId } : {},
|
|
3617
|
-
isOptimistic:
|
|
3696
|
+
isOptimistic: Pe(t),
|
|
3618
3697
|
isAssistantDraft: t.dataType === "assistant_draft",
|
|
3619
3698
|
isActivity: t.role === "tool" || t.phase === "commentary" || t.dataType === "assistant_draft",
|
|
3620
3699
|
isTransient: t.id.startsWith("transient-activity:") || t.dataType === "assistant_draft"
|
|
3621
3700
|
};
|
|
3622
3701
|
}
|
|
3623
|
-
function
|
|
3702
|
+
function ts(t, e) {
|
|
3624
3703
|
if (e.role !== "user" || !e.attachments?.length)
|
|
3625
3704
|
return e;
|
|
3626
3705
|
const s = t.find(
|
|
3627
|
-
(o) => o.role === "user" && (o.id === e.id ||
|
|
3706
|
+
(o) => o.role === "user" && (o.id === e.id || Pe(o) && ss(o, e))
|
|
3628
3707
|
);
|
|
3629
3708
|
if (!s?.attachments?.length)
|
|
3630
3709
|
return e;
|
|
3631
3710
|
const n = e.attachments.map((o) => {
|
|
3632
|
-
const a =
|
|
3633
|
-
return a ?
|
|
3634
|
-
}), r = { ...e, attachments: n }, i =
|
|
3711
|
+
const a = Rr(s.attachments ?? [], o);
|
|
3712
|
+
return a ? Er(o, a) : o;
|
|
3713
|
+
}), r = { ...e, attachments: n }, i = X(e);
|
|
3635
3714
|
return i && Object.defineProperty(r, "clientMessageId", {
|
|
3636
3715
|
value: i,
|
|
3637
3716
|
enumerable: !1
|
|
3638
3717
|
}), r;
|
|
3639
3718
|
}
|
|
3640
|
-
function
|
|
3719
|
+
function Rr(t, e) {
|
|
3641
3720
|
return e.id ? t.find((s) => s.id === e.id) ?? null : null;
|
|
3642
3721
|
}
|
|
3643
|
-
function
|
|
3722
|
+
function Er(t, e) {
|
|
3644
3723
|
const { previewUrl: s } = e;
|
|
3645
3724
|
return s ? { ...t, previewUrl: s } : t;
|
|
3646
3725
|
}
|
|
3647
|
-
function
|
|
3726
|
+
function kr(t, e) {
|
|
3648
3727
|
if (e.role !== "user")
|
|
3649
3728
|
return t;
|
|
3650
3729
|
const s = t.findIndex(
|
|
3651
|
-
(r) =>
|
|
3730
|
+
(r) => Pe(r) && ss(r, e)
|
|
3652
3731
|
);
|
|
3653
3732
|
if (s === -1)
|
|
3654
3733
|
return t;
|
|
3655
3734
|
const n = [...t];
|
|
3656
3735
|
return n.splice(s, 1), n;
|
|
3657
3736
|
}
|
|
3658
|
-
function
|
|
3659
|
-
const s =
|
|
3737
|
+
function ss(t, e) {
|
|
3738
|
+
const s = X(t), n = X(e);
|
|
3660
3739
|
return s && n ? s === n : t.content === e.content;
|
|
3661
3740
|
}
|
|
3662
|
-
function
|
|
3741
|
+
function Pe(t) {
|
|
3663
3742
|
return t.role === "user" && (t.id.startsWith("local-") || t.id.startsWith("optimistic-user-message:"));
|
|
3664
3743
|
}
|
|
3665
|
-
function
|
|
3744
|
+
function X(t) {
|
|
3666
3745
|
const e = t.clientMessageId;
|
|
3667
3746
|
if (e)
|
|
3668
3747
|
return e;
|
|
@@ -3671,19 +3750,19 @@ function V(t) {
|
|
|
3671
3750
|
);
|
|
3672
3751
|
return n ? t.id.slice(n.length) : null;
|
|
3673
3752
|
}
|
|
3674
|
-
function
|
|
3675
|
-
const e =
|
|
3753
|
+
function vt(t) {
|
|
3754
|
+
const e = ns(t);
|
|
3676
3755
|
if (e === null)
|
|
3677
3756
|
return !1;
|
|
3678
3757
|
const s = t[e].id;
|
|
3679
3758
|
if (t.some(
|
|
3680
|
-
(r) => r.respondsToUserMessageId === s &&
|
|
3759
|
+
(r) => r.respondsToUserMessageId === s && Re(r)
|
|
3681
3760
|
))
|
|
3682
3761
|
return !0;
|
|
3683
3762
|
for (let r = t.length - 1; r > e; r -= 1) {
|
|
3684
3763
|
const i = t[r];
|
|
3685
3764
|
if (!i.respondsToUserMessageId) {
|
|
3686
|
-
if (
|
|
3765
|
+
if (W(i))
|
|
3687
3766
|
return !0;
|
|
3688
3767
|
if (i.role === "system") {
|
|
3689
3768
|
if (i.dataType === "run_error")
|
|
@@ -3695,10 +3774,10 @@ function Ut(t) {
|
|
|
3695
3774
|
}
|
|
3696
3775
|
return !1;
|
|
3697
3776
|
}
|
|
3698
|
-
function
|
|
3777
|
+
function Cr(t, e, s) {
|
|
3699
3778
|
const n = new Set(
|
|
3700
3779
|
t.filter(
|
|
3701
|
-
(r) => r.role === "user" && e !== null &&
|
|
3780
|
+
(r) => r.role === "user" && e !== null && X(r) === e
|
|
3702
3781
|
).map((r) => r.id)
|
|
3703
3782
|
);
|
|
3704
3783
|
return t.some((r, i) => {
|
|
@@ -3709,31 +3788,31 @@ function Er(t, e, s) {
|
|
|
3709
3788
|
if (s && r.runId === s) {
|
|
3710
3789
|
if (n.size === 0)
|
|
3711
3790
|
return !0;
|
|
3712
|
-
const o =
|
|
3791
|
+
const o = rs(t, i);
|
|
3713
3792
|
return !r.respondsToUserMessageId && o !== null && n.has(o);
|
|
3714
3793
|
}
|
|
3715
3794
|
return !1;
|
|
3716
3795
|
});
|
|
3717
3796
|
}
|
|
3718
|
-
function
|
|
3719
|
-
const e =
|
|
3797
|
+
function br(t) {
|
|
3798
|
+
const e = ns(t);
|
|
3720
3799
|
if (e === null)
|
|
3721
|
-
return t.some(
|
|
3800
|
+
return t.some(W);
|
|
3722
3801
|
const s = t[e].id;
|
|
3723
3802
|
return t.some((n) => n.respondsToUserMessageId === s) ? t.some(
|
|
3724
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
3725
|
-
) : t.slice(e + 1).some(
|
|
3803
|
+
(n) => n.respondsToUserMessageId === s && W(n)
|
|
3804
|
+
) : t.slice(e + 1).some(W);
|
|
3726
3805
|
}
|
|
3727
|
-
function
|
|
3806
|
+
function ns(t) {
|
|
3728
3807
|
for (let e = t.length - 1; e >= 0; e -= 1)
|
|
3729
|
-
if (t[e].role === "user" && !
|
|
3808
|
+
if (t[e].role === "user" && !Pe(t[e]))
|
|
3730
3809
|
return e;
|
|
3731
3810
|
return null;
|
|
3732
3811
|
}
|
|
3733
|
-
function
|
|
3734
|
-
return
|
|
3812
|
+
function Re(t) {
|
|
3813
|
+
return W(t) ? !0 : t.role !== "system" ? !1 : t.dataType === "run_error" ? !0 : t.dataType === "run_status" && t.loading !== !0;
|
|
3735
3814
|
}
|
|
3736
|
-
function
|
|
3815
|
+
function se(t) {
|
|
3737
3816
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
3738
3817
|
const s = t[e];
|
|
3739
3818
|
if (!s || typeof s != "object")
|
|
@@ -3747,30 +3826,30 @@ function ee(t) {
|
|
|
3747
3826
|
}
|
|
3748
3827
|
return null;
|
|
3749
3828
|
}
|
|
3750
|
-
function
|
|
3751
|
-
const e =
|
|
3829
|
+
function _r(t) {
|
|
3830
|
+
const e = se(t);
|
|
3752
3831
|
if (e === null)
|
|
3753
3832
|
return null;
|
|
3754
|
-
const n =
|
|
3833
|
+
const n = P(t[e])?.page;
|
|
3755
3834
|
if (!n || typeof n != "object")
|
|
3756
3835
|
return null;
|
|
3757
3836
|
const r = n.url;
|
|
3758
3837
|
return typeof r == "string" ? r : null;
|
|
3759
3838
|
}
|
|
3760
|
-
function
|
|
3839
|
+
function P(t) {
|
|
3761
3840
|
if (!t || typeof t != "object")
|
|
3762
3841
|
return null;
|
|
3763
3842
|
const e = t.data;
|
|
3764
3843
|
return e && typeof e == "object" ? e : null;
|
|
3765
3844
|
}
|
|
3766
|
-
function
|
|
3845
|
+
function Ee(t) {
|
|
3767
3846
|
return t?.retryable !== !0 ? !1 : t.type === "run_error" ? !0 : t.type === "run_status" && t.status === "interrupted";
|
|
3768
3847
|
}
|
|
3769
|
-
function
|
|
3848
|
+
function Dt(t) {
|
|
3770
3849
|
return t?.type === "run_status" && t.status === "interrupted" && t.reason === "backend_restart";
|
|
3771
3850
|
}
|
|
3772
|
-
function
|
|
3773
|
-
const s =
|
|
3851
|
+
function Pr(t, e) {
|
|
3852
|
+
const s = se(e);
|
|
3774
3853
|
if (s === null)
|
|
3775
3854
|
return !1;
|
|
3776
3855
|
const n = e[s], r = n && typeof n == "object" ? n.id : null;
|
|
@@ -3778,11 +3857,11 @@ function br(t, e) {
|
|
|
3778
3857
|
return !1;
|
|
3779
3858
|
const i = t.findIndex((o) => o.role === "user" && o.id === r);
|
|
3780
3859
|
return i === -1 ? !1 : t.some((o) => o.respondsToUserMessageId === r) ? t.some(
|
|
3781
|
-
(o) => o.respondsToUserMessageId === r &&
|
|
3782
|
-
) : t.slice(i + 1).some(
|
|
3860
|
+
(o) => o.respondsToUserMessageId === r && Re(o)
|
|
3861
|
+
) : t.slice(i + 1).some(Re);
|
|
3783
3862
|
}
|
|
3784
3863
|
function Ye(t) {
|
|
3785
|
-
const e =
|
|
3864
|
+
const e = se(t);
|
|
3786
3865
|
if (e === null)
|
|
3787
3866
|
return null;
|
|
3788
3867
|
const s = t[e];
|
|
@@ -3794,8 +3873,8 @@ function Ye(t) {
|
|
|
3794
3873
|
const r = n.clientMessageId;
|
|
3795
3874
|
return typeof r == "string" ? r : null;
|
|
3796
3875
|
}
|
|
3797
|
-
function
|
|
3798
|
-
const e =
|
|
3876
|
+
function Ur(t) {
|
|
3877
|
+
const e = se(t);
|
|
3799
3878
|
if (e === null)
|
|
3800
3879
|
return null;
|
|
3801
3880
|
for (let s = t.length - 1; s > e; s -= 1) {
|
|
@@ -3809,22 +3888,22 @@ function _r(t) {
|
|
|
3809
3888
|
if (i.type === "message" && i.role === "assistant")
|
|
3810
3889
|
return null;
|
|
3811
3890
|
if (i.type === "run_error")
|
|
3812
|
-
return i.retryable !== !0 ? null :
|
|
3891
|
+
return i.retryable !== !0 ? null : Ze(t, i) ?? Ye(t);
|
|
3813
3892
|
if (i.type === "run_status")
|
|
3814
|
-
return i.status === "interrupted" && i.retryable === !0 ?
|
|
3893
|
+
return i.status === "interrupted" && i.retryable === !0 ? Ze(t, i) ?? Ye(t) : null;
|
|
3815
3894
|
}
|
|
3816
3895
|
return null;
|
|
3817
3896
|
}
|
|
3818
|
-
function
|
|
3897
|
+
function Ze(t, e) {
|
|
3819
3898
|
if (typeof e.clientMessageId == "string")
|
|
3820
3899
|
return e.clientMessageId;
|
|
3821
3900
|
const s = L(e);
|
|
3822
3901
|
if (!s)
|
|
3823
3902
|
return null;
|
|
3824
|
-
const n = t.find((i) =>
|
|
3903
|
+
const n = t.find((i) => R(i, "id") === s), r = P(n);
|
|
3825
3904
|
return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
|
|
3826
3905
|
}
|
|
3827
|
-
function
|
|
3906
|
+
function vr(t, e) {
|
|
3828
3907
|
let s = 0;
|
|
3829
3908
|
for (const n of t) {
|
|
3830
3909
|
if (!n || typeof n != "object")
|
|
@@ -3837,93 +3916,93 @@ function Pr(t, e) {
|
|
|
3837
3916
|
}
|
|
3838
3917
|
return s;
|
|
3839
3918
|
}
|
|
3840
|
-
function
|
|
3841
|
-
if (!e || !
|
|
3919
|
+
function Ot(t, e, s, n, r, i) {
|
|
3920
|
+
if (!e || !Or(t))
|
|
3842
3921
|
return !1;
|
|
3843
3922
|
const o = t;
|
|
3844
|
-
if (
|
|
3923
|
+
if (Ee(o) || s !== null && typeof o.id == "string" && o.id !== s)
|
|
3845
3924
|
return !1;
|
|
3846
3925
|
const a = L(o);
|
|
3847
|
-
return n !== null ? a !== null ? a === n : r !== null &&
|
|
3926
|
+
return n !== null ? a !== null ? a === n : r !== null && C(o) === r && i === n : r === null || C(o) === r;
|
|
3848
3927
|
}
|
|
3849
|
-
function
|
|
3928
|
+
function Dr(t, e) {
|
|
3850
3929
|
for (let s = e - 1; s >= 0; s -= 1) {
|
|
3851
|
-
const n =
|
|
3930
|
+
const n = P(t[s]);
|
|
3852
3931
|
if (n?.type === "message" && n.role === "user")
|
|
3853
|
-
return
|
|
3932
|
+
return R(t[s], "id");
|
|
3854
3933
|
}
|
|
3855
3934
|
return null;
|
|
3856
3935
|
}
|
|
3857
|
-
function
|
|
3936
|
+
function rs(t, e) {
|
|
3858
3937
|
for (let s = e - 1; s >= 0; s -= 1)
|
|
3859
3938
|
if (t[s].role === "user")
|
|
3860
3939
|
return t[s].id;
|
|
3861
3940
|
return null;
|
|
3862
3941
|
}
|
|
3863
|
-
function
|
|
3942
|
+
function Or(t) {
|
|
3864
3943
|
if (!t || typeof t != "object")
|
|
3865
3944
|
return !1;
|
|
3866
3945
|
const e = t;
|
|
3867
3946
|
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");
|
|
3868
3947
|
}
|
|
3869
|
-
function
|
|
3948
|
+
function W(t) {
|
|
3870
3949
|
return t.role === "assistant" && t.phase !== "commentary";
|
|
3871
3950
|
}
|
|
3872
|
-
function
|
|
3951
|
+
function qr(t) {
|
|
3873
3952
|
if (!t || typeof t != "object")
|
|
3874
3953
|
return !1;
|
|
3875
3954
|
const e = t;
|
|
3876
3955
|
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";
|
|
3877
3956
|
}
|
|
3878
|
-
function
|
|
3879
|
-
return t.filter((e, s) =>
|
|
3957
|
+
function et(t) {
|
|
3958
|
+
return t.filter((e, s) => J(e) ? !Kr(t, s) && !is(t, s) && !jr(t, s) && !zr(t, s) : Lr(e) ? e.retryable === !0 && Fr(t, s) ? !1 : !$r(t, s) : !0);
|
|
3880
3959
|
}
|
|
3881
|
-
function
|
|
3960
|
+
function Lr(t) {
|
|
3882
3961
|
return t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.steered !== !0);
|
|
3883
3962
|
}
|
|
3884
|
-
function
|
|
3963
|
+
function J(t) {
|
|
3885
3964
|
return t.role === "system" && t.dataType === "run_status" && t.loading === !0;
|
|
3886
3965
|
}
|
|
3887
|
-
function
|
|
3966
|
+
function Nr(t, e, s, n) {
|
|
3888
3967
|
const r = t.findIndex(
|
|
3889
|
-
(l, c) =>
|
|
3968
|
+
(l, c) => J(l) && !is(t, c)
|
|
3890
3969
|
), i = r === -1 ? null : t[r], o = e ?? i?.respondsToUserMessageId ?? null, a = o ? t.find(
|
|
3891
3970
|
(l) => l.role === "user" && l.id === o
|
|
3892
3971
|
) : null;
|
|
3893
3972
|
return {
|
|
3894
|
-
clientMessageId: a ?
|
|
3973
|
+
clientMessageId: a ? X(a) : o ? null : n,
|
|
3895
3974
|
respondsToUserMessageId: o,
|
|
3896
3975
|
runId: s ?? i?.runId ?? null
|
|
3897
3976
|
};
|
|
3898
3977
|
}
|
|
3899
|
-
function
|
|
3978
|
+
function Me(t) {
|
|
3900
3979
|
return t?.type === "run_status" && t.status === "stopped";
|
|
3901
3980
|
}
|
|
3902
|
-
function
|
|
3903
|
-
return
|
|
3981
|
+
function xr(t, e) {
|
|
3982
|
+
return W(e) ? "completed" : Me(t) ? "stopped" : !Ee(t) && (t?.type === "run_error" || t?.type === "run_status" && (t.status === "failed" || t.status === "interrupted")) ? "failed" : null;
|
|
3904
3983
|
}
|
|
3905
|
-
function
|
|
3984
|
+
function qt(t, e, s) {
|
|
3906
3985
|
const n = new Set(
|
|
3907
3986
|
t.filter(
|
|
3908
|
-
(r) => r.role === "user" && e !== null &&
|
|
3987
|
+
(r) => r.role === "user" && e !== null && X(r) === e
|
|
3909
3988
|
).map((r) => r.id)
|
|
3910
3989
|
);
|
|
3911
3990
|
return t.filter(
|
|
3912
|
-
(r) => !
|
|
3991
|
+
(r) => !J(r) || (n.size > 0 ? !r.respondsToUserMessageId || !n.has(r.respondsToUserMessageId) : !s || r.runId !== s)
|
|
3913
3992
|
);
|
|
3914
3993
|
}
|
|
3915
|
-
function
|
|
3994
|
+
function is(t, e) {
|
|
3916
3995
|
return t.some(
|
|
3917
|
-
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) &&
|
|
3996
|
+
(s, n) => n !== e && s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0 && s.steered !== !0) && Br(
|
|
3918
3997
|
t,
|
|
3919
3998
|
e,
|
|
3920
3999
|
n
|
|
3921
4000
|
)
|
|
3922
4001
|
);
|
|
3923
4002
|
}
|
|
3924
|
-
function
|
|
4003
|
+
function Br(t, e, s) {
|
|
3925
4004
|
const n = t[e], r = t[s];
|
|
3926
|
-
if (
|
|
4005
|
+
if (de(n, r))
|
|
3927
4006
|
return !0;
|
|
3928
4007
|
if (!n.respondsToUserMessageId || r.respondsToUserMessageId || !n.runId || n.runId !== r.runId)
|
|
3929
4008
|
return !1;
|
|
@@ -3932,35 +4011,35 @@ function Nr(t, e, s) {
|
|
|
3932
4011
|
return t[i].id === n.respondsToUserMessageId;
|
|
3933
4012
|
return !1;
|
|
3934
4013
|
}
|
|
3935
|
-
function
|
|
4014
|
+
function Wr(t, e) {
|
|
3936
4015
|
const s = [...t].reverse().find(
|
|
3937
|
-
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e &&
|
|
4016
|
+
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== e && Lt(n) && !Hr(
|
|
3938
4017
|
t,
|
|
3939
4018
|
n.respondsToUserMessageId
|
|
3940
4019
|
)
|
|
3941
4020
|
)?.respondsToUserMessageId;
|
|
3942
4021
|
return s ? t.map(
|
|
3943
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
4022
|
+
(n) => n.respondsToUserMessageId === s && Lt(n) ? { ...n, steered: !0 } : n
|
|
3944
4023
|
) : t;
|
|
3945
4024
|
}
|
|
3946
|
-
function
|
|
3947
|
-
return t.role === "tool" ||
|
|
4025
|
+
function Lt(t) {
|
|
4026
|
+
return t.role === "tool" || J(t) ? !0 : t.role === "assistant" && t.phase === "commentary";
|
|
3948
4027
|
}
|
|
3949
|
-
function
|
|
4028
|
+
function Hr(t, e) {
|
|
3950
4029
|
return t.some(
|
|
3951
|
-
(s) => s.respondsToUserMessageId === e && (
|
|
4030
|
+
(s) => s.respondsToUserMessageId === e && (W(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
|
|
3952
4031
|
);
|
|
3953
4032
|
}
|
|
3954
|
-
function
|
|
4033
|
+
function $r(t, e) {
|
|
3955
4034
|
const s = t[e];
|
|
3956
4035
|
for (let n = e + 1; n < t.length; n += 1) {
|
|
3957
4036
|
const r = t[n];
|
|
3958
|
-
if (r.role === "assistant" &&
|
|
4037
|
+
if (r.role === "assistant" && de(s, r))
|
|
3959
4038
|
return !0;
|
|
3960
4039
|
}
|
|
3961
4040
|
return !1;
|
|
3962
4041
|
}
|
|
3963
|
-
function
|
|
4042
|
+
function Fr(t, e) {
|
|
3964
4043
|
const s = t[e];
|
|
3965
4044
|
if (!s.respondsToUserMessageId)
|
|
3966
4045
|
return !1;
|
|
@@ -3968,45 +4047,45 @@ function Hr(t, e) {
|
|
|
3968
4047
|
const r = t[n];
|
|
3969
4048
|
if (r.role === "user")
|
|
3970
4049
|
return !1;
|
|
3971
|
-
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" ||
|
|
4050
|
+
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" || J(r)))
|
|
3972
4051
|
return !0;
|
|
3973
4052
|
}
|
|
3974
4053
|
return !1;
|
|
3975
4054
|
}
|
|
3976
|
-
function
|
|
4055
|
+
function jr(t, e) {
|
|
3977
4056
|
const s = t[e];
|
|
3978
4057
|
return t.some(
|
|
3979
|
-
(n, r) => r !== e && n.role === "assistant" &&
|
|
4058
|
+
(n, r) => r !== e && n.role === "assistant" && de(s, n)
|
|
3980
4059
|
);
|
|
3981
4060
|
}
|
|
3982
|
-
function
|
|
4061
|
+
function zr(t, e) {
|
|
3983
4062
|
const s = t[e];
|
|
3984
4063
|
return t.some(
|
|
3985
|
-
(n, r) => r !== e && n.role === "tool" &&
|
|
4064
|
+
(n, r) => r !== e && n.role === "tool" && de(s, n)
|
|
3986
4065
|
);
|
|
3987
4066
|
}
|
|
3988
|
-
function
|
|
4067
|
+
function Kr(t, e) {
|
|
3989
4068
|
const s = t[e];
|
|
3990
4069
|
for (let n = e + 1; n < t.length; n += 1)
|
|
3991
|
-
if (
|
|
4070
|
+
if (J(t[n]) && de(s, t[n]))
|
|
3992
4071
|
return !0;
|
|
3993
4072
|
return !1;
|
|
3994
4073
|
}
|
|
3995
|
-
function
|
|
4074
|
+
function de(t, e) {
|
|
3996
4075
|
return !!(t.respondsToUserMessageId && t.respondsToUserMessageId === e.respondsToUserMessageId);
|
|
3997
4076
|
}
|
|
3998
|
-
function
|
|
4077
|
+
function R(t, e) {
|
|
3999
4078
|
return t && typeof t == "object" && typeof t[e] == "string" ? t[e] : null;
|
|
4000
4079
|
}
|
|
4001
|
-
function
|
|
4080
|
+
function Gr(t, e) {
|
|
4002
4081
|
try {
|
|
4003
|
-
const s = window.localStorage.getItem(`${
|
|
4082
|
+
const s = window.localStorage.getItem(`${Kt}${t}`);
|
|
4004
4083
|
if (!s)
|
|
4005
4084
|
return null;
|
|
4006
4085
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
4007
4086
|
if (e !== void 0 && r !== e)
|
|
4008
4087
|
return null;
|
|
4009
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
4088
|
+
const i = Array.isArray(n.messages) ? n.messages.map(ri).filter((o) => !!o) : [];
|
|
4010
4089
|
return {
|
|
4011
4090
|
sessionId: r,
|
|
4012
4091
|
messages: i
|
|
@@ -4015,51 +4094,51 @@ function zr(t, e) {
|
|
|
4015
4094
|
return null;
|
|
4016
4095
|
}
|
|
4017
4096
|
}
|
|
4018
|
-
function
|
|
4097
|
+
function os(t) {
|
|
4019
4098
|
return t.role === "user" || t.role === "assistant" || t.dataType === "run_status" || t.dataType === "run_error";
|
|
4020
4099
|
}
|
|
4021
|
-
function
|
|
4100
|
+
function Vr(t, e) {
|
|
4022
4101
|
try {
|
|
4023
4102
|
window.localStorage.setItem(
|
|
4024
|
-
`${
|
|
4103
|
+
`${Kt}${t}`,
|
|
4025
4104
|
JSON.stringify({
|
|
4026
4105
|
sessionId: e.sessionId,
|
|
4027
|
-
messages: e.messages.filter(
|
|
4106
|
+
messages: e.messages.filter(os).slice(-yn).map(ii)
|
|
4028
4107
|
})
|
|
4029
4108
|
);
|
|
4030
4109
|
} catch {
|
|
4031
4110
|
return;
|
|
4032
4111
|
}
|
|
4033
4112
|
}
|
|
4034
|
-
function
|
|
4113
|
+
function Xr(t) {
|
|
4035
4114
|
try {
|
|
4036
|
-
const e = window.localStorage.getItem(`${
|
|
4115
|
+
const e = window.localStorage.getItem(`${Je}${t}`);
|
|
4037
4116
|
if (!e)
|
|
4038
4117
|
return [];
|
|
4039
4118
|
const s = JSON.parse(e);
|
|
4040
|
-
return Array.isArray(s) ? s.filter(
|
|
4119
|
+
return Array.isArray(s) ? s.filter(lt) : [];
|
|
4041
4120
|
} catch {
|
|
4042
4121
|
return [];
|
|
4043
4122
|
}
|
|
4044
4123
|
}
|
|
4045
|
-
function
|
|
4124
|
+
function V(t, e) {
|
|
4046
4125
|
try {
|
|
4047
|
-
const s = e.filter(
|
|
4126
|
+
const s = e.filter(lt);
|
|
4048
4127
|
if (s.length === 0) {
|
|
4049
|
-
window.localStorage.removeItem(`${
|
|
4128
|
+
window.localStorage.removeItem(`${Je}${t}`);
|
|
4050
4129
|
return;
|
|
4051
4130
|
}
|
|
4052
4131
|
window.localStorage.setItem(
|
|
4053
|
-
`${
|
|
4132
|
+
`${Je}${t}`,
|
|
4054
4133
|
JSON.stringify(s.slice(-25))
|
|
4055
4134
|
);
|
|
4056
4135
|
} catch {
|
|
4057
4136
|
return;
|
|
4058
4137
|
}
|
|
4059
4138
|
}
|
|
4060
|
-
function
|
|
4139
|
+
function as(t, e) {
|
|
4061
4140
|
try {
|
|
4062
|
-
const s = `${
|
|
4141
|
+
const s = `${_e}${t}`, n = location.href, r = location.origin, i = Array.from(e, (o) => ({
|
|
4063
4142
|
...o,
|
|
4064
4143
|
storedAt: Date.now(),
|
|
4065
4144
|
unloadUrl: n,
|
|
@@ -4073,28 +4152,28 @@ function os(t, e) {
|
|
|
4073
4152
|
} catch {
|
|
4074
4153
|
}
|
|
4075
4154
|
}
|
|
4076
|
-
function
|
|
4155
|
+
function Nt(t, e) {
|
|
4077
4156
|
try {
|
|
4078
|
-
if (window.sessionStorage.getItem(`${
|
|
4157
|
+
if (window.sessionStorage.getItem(`${_e}${t}`) === null)
|
|
4079
4158
|
return;
|
|
4080
4159
|
} catch {
|
|
4081
4160
|
return;
|
|
4082
4161
|
}
|
|
4083
|
-
|
|
4162
|
+
as(t, e);
|
|
4084
4163
|
}
|
|
4085
|
-
function
|
|
4164
|
+
function Jr(t) {
|
|
4086
4165
|
try {
|
|
4087
|
-
const e = `${
|
|
4166
|
+
const e = `${_e}${t}`, s = window.sessionStorage.getItem(e);
|
|
4088
4167
|
if (window.sessionStorage.removeItem(e), !s)
|
|
4089
4168
|
return [];
|
|
4090
4169
|
const n = JSON.parse(s);
|
|
4091
|
-
return Array.isArray(n) ? n.flatMap((r) =>
|
|
4170
|
+
return Array.isArray(n) ? n.flatMap((r) => Yr(r) ? [{
|
|
4092
4171
|
...r.event,
|
|
4093
4172
|
page: b(),
|
|
4094
4173
|
rawOutput: {
|
|
4095
4174
|
pageContextRestarted: !0,
|
|
4096
4175
|
outcome: "unknown",
|
|
4097
|
-
message:
|
|
4176
|
+
message: Qr(location.href),
|
|
4098
4177
|
currentUrl: location.href,
|
|
4099
4178
|
console: [],
|
|
4100
4179
|
metadata: {
|
|
@@ -4111,17 +4190,17 @@ function Vr(t) {
|
|
|
4111
4190
|
return [];
|
|
4112
4191
|
}
|
|
4113
4192
|
}
|
|
4114
|
-
function
|
|
4193
|
+
function Qr(t) {
|
|
4115
4194
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
4116
4195
|
Current URL: ${t}`;
|
|
4117
4196
|
}
|
|
4118
|
-
function
|
|
4197
|
+
function Yr(t) {
|
|
4119
4198
|
if (!t || typeof t != "object")
|
|
4120
4199
|
return !1;
|
|
4121
4200
|
const e = t, s = e.event;
|
|
4122
|
-
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" &&
|
|
4201
|
+
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && lt(s) && s.type === "tool.result";
|
|
4123
4202
|
}
|
|
4124
|
-
function
|
|
4203
|
+
function Zr(t, e) {
|
|
4125
4204
|
const s = new Set(
|
|
4126
4205
|
t.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
4127
4206
|
);
|
|
@@ -4130,26 +4209,26 @@ function Yr(t, e) {
|
|
|
4130
4209
|
...e.filter((n) => !s.has(n.callId))
|
|
4131
4210
|
];
|
|
4132
4211
|
}
|
|
4133
|
-
function
|
|
4212
|
+
function ei(t) {
|
|
4134
4213
|
try {
|
|
4135
|
-
window.sessionStorage.removeItem(`${
|
|
4214
|
+
window.sessionStorage.removeItem(`${_e}${t}`);
|
|
4136
4215
|
} catch {
|
|
4137
4216
|
return;
|
|
4138
4217
|
}
|
|
4139
4218
|
}
|
|
4140
|
-
function
|
|
4219
|
+
function lt(t) {
|
|
4141
4220
|
if (!t || typeof t != "object")
|
|
4142
4221
|
return !1;
|
|
4143
4222
|
const e = t;
|
|
4144
|
-
return e.type === "chat.user_message" ? typeof e.content == "string" &&
|
|
4223
|
+
return e.type === "chat.user_message" ? typeof e.content == "string" && xt(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? xt(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;
|
|
4145
4224
|
}
|
|
4146
|
-
function
|
|
4225
|
+
function xt(t) {
|
|
4147
4226
|
if (!t || typeof t != "object")
|
|
4148
4227
|
return !1;
|
|
4149
4228
|
const e = t;
|
|
4150
4229
|
return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
|
|
4151
4230
|
}
|
|
4152
|
-
function
|
|
4231
|
+
function ls(t, e) {
|
|
4153
4232
|
if (!Array.isArray(t))
|
|
4154
4233
|
return;
|
|
4155
4234
|
const s = t.filter((r) => {
|
|
@@ -4157,41 +4236,41 @@ function as(t, e) {
|
|
|
4157
4236
|
return !1;
|
|
4158
4237
|
const i = r;
|
|
4159
4238
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
4160
|
-
}), n = e ? s.map((r) =>
|
|
4239
|
+
}), n = e ? s.map((r) => cs(r, e)) : s;
|
|
4161
4240
|
return n.length > 0 ? n : void 0;
|
|
4162
4241
|
}
|
|
4163
|
-
function
|
|
4242
|
+
function cs(t, e) {
|
|
4164
4243
|
return t.fileUrl?.startsWith("/") ? {
|
|
4165
4244
|
...t,
|
|
4166
4245
|
fileUrl: new URL(t.fileUrl, e).toString()
|
|
4167
4246
|
} : t;
|
|
4168
4247
|
}
|
|
4169
|
-
function
|
|
4170
|
-
return t.type ||
|
|
4248
|
+
function tt(t) {
|
|
4249
|
+
return t.type || ni(t.name) || "application/octet-stream";
|
|
4171
4250
|
}
|
|
4172
|
-
function
|
|
4173
|
-
|
|
4251
|
+
function ti(t) {
|
|
4252
|
+
us({
|
|
4174
4253
|
name: t.name,
|
|
4175
|
-
mimeType:
|
|
4254
|
+
mimeType: tt(t),
|
|
4176
4255
|
sizeBytes: t.size
|
|
4177
4256
|
});
|
|
4178
4257
|
}
|
|
4179
|
-
function
|
|
4180
|
-
const e =
|
|
4181
|
-
if (!
|
|
4258
|
+
function us(t) {
|
|
4259
|
+
const e = si(t.name), s = t.mimeType.trim().toLowerCase();
|
|
4260
|
+
if (!gn.has(`${e}:${s}`))
|
|
4182
4261
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
4183
4262
|
if (t.sizeBytes <= 0 || t.sizeBytes >= jt)
|
|
4184
4263
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
4185
4264
|
}
|
|
4186
|
-
function
|
|
4265
|
+
function si(t) {
|
|
4187
4266
|
const e = t.trim().toLowerCase(), s = e.lastIndexOf(".");
|
|
4188
4267
|
return s >= 0 ? e.slice(s) : "";
|
|
4189
4268
|
}
|
|
4190
|
-
function
|
|
4269
|
+
function ni(t) {
|
|
4191
4270
|
const e = t.toLowerCase();
|
|
4192
4271
|
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;
|
|
4193
4272
|
}
|
|
4194
|
-
function
|
|
4273
|
+
function ri(t) {
|
|
4195
4274
|
if (!t || typeof t != "object")
|
|
4196
4275
|
return null;
|
|
4197
4276
|
const e = t;
|
|
@@ -4209,17 +4288,17 @@ function si(t) {
|
|
|
4209
4288
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
4210
4289
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
4211
4290
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
4212
|
-
attachments:
|
|
4291
|
+
attachments: ls(e.attachments)?.map(ke),
|
|
4213
4292
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
4214
4293
|
};
|
|
4215
4294
|
}
|
|
4216
|
-
function
|
|
4295
|
+
function ii(t) {
|
|
4217
4296
|
return t.attachments?.length ? {
|
|
4218
4297
|
...t,
|
|
4219
|
-
attachments: t.attachments.map(
|
|
4298
|
+
attachments: t.attachments.map(ke)
|
|
4220
4299
|
} : t;
|
|
4221
4300
|
}
|
|
4222
|
-
function
|
|
4301
|
+
function ke(t) {
|
|
4223
4302
|
const {
|
|
4224
4303
|
dataUrl: e,
|
|
4225
4304
|
objectUrl: s,
|
|
@@ -4233,43 +4312,43 @@ function L(t) {
|
|
|
4233
4312
|
const e = t.respondsToUserMessageId;
|
|
4234
4313
|
return typeof e == "string" && e ? e : null;
|
|
4235
4314
|
}
|
|
4236
|
-
function
|
|
4315
|
+
function C(t) {
|
|
4237
4316
|
const e = t.runId;
|
|
4238
4317
|
return typeof e == "string" && e ? e : null;
|
|
4239
4318
|
}
|
|
4240
|
-
function
|
|
4319
|
+
function oi(t) {
|
|
4241
4320
|
const e = t?.timeoutMs;
|
|
4242
|
-
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 <=
|
|
4321
|
+
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 <= En);
|
|
4243
4322
|
}
|
|
4244
|
-
function
|
|
4323
|
+
function ds(t) {
|
|
4245
4324
|
const e = {};
|
|
4246
4325
|
try {
|
|
4247
4326
|
new Headers(t).forEach((s, n) => {
|
|
4248
|
-
Object.keys(e).length <
|
|
4327
|
+
Object.keys(e).length < ot && (e[n] = ct(n, s));
|
|
4249
4328
|
});
|
|
4250
4329
|
} catch {
|
|
4251
4330
|
return {};
|
|
4252
4331
|
}
|
|
4253
4332
|
return e;
|
|
4254
4333
|
}
|
|
4255
|
-
function
|
|
4256
|
-
return
|
|
4334
|
+
function ct(t, e) {
|
|
4335
|
+
return ys(t) ? Ue : B(be(e), fn);
|
|
4257
4336
|
}
|
|
4258
|
-
function
|
|
4337
|
+
function ai(t, e) {
|
|
4259
4338
|
return typeof t == "string" ? t : t instanceof URL ? t.toString() : e?.url ?? "";
|
|
4260
4339
|
}
|
|
4261
|
-
async function
|
|
4262
|
-
const r =
|
|
4340
|
+
async function li(t, e, s, n) {
|
|
4341
|
+
const r = ds(t.headers);
|
|
4263
4342
|
n({
|
|
4264
4343
|
...e,
|
|
4265
4344
|
responseStatus: t.status,
|
|
4266
4345
|
responseHeaders: r,
|
|
4267
|
-
responseBody: await
|
|
4346
|
+
responseBody: await ci(t),
|
|
4268
4347
|
durationMs: Date.now() - s
|
|
4269
4348
|
});
|
|
4270
4349
|
}
|
|
4271
|
-
async function
|
|
4272
|
-
if (!
|
|
4350
|
+
async function ci(t) {
|
|
4351
|
+
if (!hs(t.headers))
|
|
4273
4352
|
return;
|
|
4274
4353
|
let e = null, s = null;
|
|
4275
4354
|
try {
|
|
@@ -4278,7 +4357,7 @@ async function ai(t) {
|
|
|
4278
4357
|
const n = new Promise((a) => {
|
|
4279
4358
|
s = window.setTimeout(() => {
|
|
4280
4359
|
e?.cancel(), a("timeout");
|
|
4281
|
-
},
|
|
4360
|
+
}, mn);
|
|
4282
4361
|
}), r = new TextDecoder();
|
|
4283
4362
|
let i = "", o = 0;
|
|
4284
4363
|
for (; ; ) {
|
|
@@ -4287,10 +4366,10 @@ async function ai(t) {
|
|
|
4287
4366
|
return;
|
|
4288
4367
|
const { done: l, value: c } = a;
|
|
4289
4368
|
if (l)
|
|
4290
|
-
return
|
|
4291
|
-
const d =
|
|
4369
|
+
return B(i + r.decode());
|
|
4370
|
+
const d = it - o;
|
|
4292
4371
|
if (c.byteLength > d)
|
|
4293
|
-
return i += r.decode(c.subarray(0, Math.max(d, 0)), { stream: !0 }), e.cancel(), `${
|
|
4372
|
+
return i += r.decode(c.subarray(0, Math.max(d, 0)), { stream: !0 }), e.cancel(), `${B(i)}... [truncated]`;
|
|
4294
4373
|
o += c.byteLength, i += r.decode(c, { stream: !0 });
|
|
4295
4374
|
}
|
|
4296
4375
|
} catch {
|
|
@@ -4300,45 +4379,45 @@ async function ai(t) {
|
|
|
4300
4379
|
s !== null && window.clearTimeout(s);
|
|
4301
4380
|
}
|
|
4302
4381
|
}
|
|
4303
|
-
function
|
|
4304
|
-
if (
|
|
4382
|
+
function ui(t, e) {
|
|
4383
|
+
if (hs(new Headers(e)))
|
|
4305
4384
|
try {
|
|
4306
|
-
return t.responseType === "" || t.responseType === "text" ?
|
|
4385
|
+
return t.responseType === "" || t.responseType === "text" ? B(t.responseText ?? "") : void 0;
|
|
4307
4386
|
} catch {
|
|
4308
4387
|
return;
|
|
4309
4388
|
}
|
|
4310
4389
|
}
|
|
4311
|
-
function
|
|
4390
|
+
function Bt(t) {
|
|
4312
4391
|
if (typeof t == "string")
|
|
4313
|
-
return
|
|
4392
|
+
return B(t);
|
|
4314
4393
|
}
|
|
4315
|
-
function
|
|
4394
|
+
function di(t) {
|
|
4316
4395
|
return q({
|
|
4317
4396
|
...t,
|
|
4318
|
-
requestBody:
|
|
4319
|
-
responseBody:
|
|
4397
|
+
requestBody: Wt(t.requestBody),
|
|
4398
|
+
responseBody: Wt(t.responseBody)
|
|
4320
4399
|
});
|
|
4321
4400
|
}
|
|
4322
|
-
function
|
|
4401
|
+
function Wt(t) {
|
|
4323
4402
|
if (typeof t != "string")
|
|
4324
4403
|
return t;
|
|
4325
4404
|
const e = t.trim();
|
|
4326
4405
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
4327
|
-
return
|
|
4406
|
+
return be(t);
|
|
4328
4407
|
try {
|
|
4329
4408
|
return JSON.stringify(q(JSON.parse(t)));
|
|
4330
4409
|
} catch {
|
|
4331
|
-
return
|
|
4410
|
+
return be(t);
|
|
4332
4411
|
}
|
|
4333
4412
|
}
|
|
4334
|
-
function
|
|
4413
|
+
function hs(t) {
|
|
4335
4414
|
if (!t)
|
|
4336
4415
|
return !1;
|
|
4337
4416
|
const e = t.get("content-type")?.toLowerCase() ?? "", s = t.get("content-length"), n = Number(s);
|
|
4338
|
-
return s !== null && Number.isInteger(n) && n >= 0 && n <=
|
|
4417
|
+
return s !== null && Number.isInteger(n) && n >= 0 && n <= it && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
4339
4418
|
}
|
|
4340
|
-
function
|
|
4341
|
-
if (
|
|
4419
|
+
function Z(t, e = {}, s) {
|
|
4420
|
+
if (pi(s))
|
|
4342
4421
|
return !0;
|
|
4343
4422
|
const n = Object.entries(e).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
4344
4423
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -4353,8 +4432,8 @@ function Y(t, e = {}, s) {
|
|
|
4353
4432
|
return !0;
|
|
4354
4433
|
}
|
|
4355
4434
|
}
|
|
4356
|
-
function
|
|
4357
|
-
if (
|
|
4435
|
+
function hi(t, e) {
|
|
4436
|
+
if (Z(t))
|
|
4358
4437
|
return !0;
|
|
4359
4438
|
try {
|
|
4360
4439
|
const s = new URL(t, location.href), n = new URL(e);
|
|
@@ -4363,117 +4442,117 @@ function ui(t, e) {
|
|
|
4363
4442
|
return !0;
|
|
4364
4443
|
}
|
|
4365
4444
|
}
|
|
4366
|
-
function
|
|
4445
|
+
function pi(t) {
|
|
4367
4446
|
return t instanceof FormData || t instanceof Blob || t instanceof ArrayBuffer || ArrayBuffer.isView(t) || typeof ReadableStream < "u" && t instanceof ReadableStream;
|
|
4368
4447
|
}
|
|
4369
|
-
function
|
|
4448
|
+
function gi(t) {
|
|
4370
4449
|
const e = {};
|
|
4371
4450
|
for (const s of t.trim().split(/[\r\n]+/)) {
|
|
4372
4451
|
const n = s.indexOf(":");
|
|
4373
4452
|
if (n <= 0)
|
|
4374
4453
|
continue;
|
|
4375
|
-
if (Object.keys(e).length >=
|
|
4454
|
+
if (Object.keys(e).length >= ot)
|
|
4376
4455
|
break;
|
|
4377
4456
|
const r = s.slice(0, n).trim();
|
|
4378
|
-
e[r] =
|
|
4457
|
+
e[r] = ct(r, s.slice(n + 1).trim());
|
|
4379
4458
|
}
|
|
4380
4459
|
return e;
|
|
4381
4460
|
}
|
|
4382
|
-
function
|
|
4461
|
+
function B(t, e = it) {
|
|
4383
4462
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
4384
4463
|
}
|
|
4385
|
-
function
|
|
4464
|
+
function Ge(t) {
|
|
4386
4465
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
4387
4466
|
}
|
|
4388
|
-
class
|
|
4467
|
+
class Ae extends Error {
|
|
4389
4468
|
constructor(e, s) {
|
|
4390
4469
|
super(`${e} (${s})`), this.status = s, this.name = "AttachmentUploadHttpError";
|
|
4391
4470
|
}
|
|
4392
4471
|
status;
|
|
4393
4472
|
}
|
|
4394
|
-
async function
|
|
4473
|
+
async function Se(t, e) {
|
|
4395
4474
|
let s = null;
|
|
4396
4475
|
for (let n = 0; n < Et; n += 1)
|
|
4397
4476
|
try {
|
|
4398
4477
|
return await t();
|
|
4399
4478
|
} catch (r) {
|
|
4400
|
-
if (s = r, n >= Et - 1 || !
|
|
4479
|
+
if (s = r, n >= Et - 1 || !mi(r))
|
|
4401
4480
|
throw r;
|
|
4402
|
-
await
|
|
4481
|
+
await fi(n);
|
|
4403
4482
|
}
|
|
4404
4483
|
throw s instanceof Error ? s : new Error(e);
|
|
4405
4484
|
}
|
|
4406
|
-
function
|
|
4485
|
+
function fi(t) {
|
|
4407
4486
|
return new Promise((e) => {
|
|
4408
|
-
window.setTimeout(e,
|
|
4487
|
+
window.setTimeout(e, pn[t] ?? 0);
|
|
4409
4488
|
});
|
|
4410
4489
|
}
|
|
4411
|
-
function
|
|
4412
|
-
return t instanceof
|
|
4490
|
+
function mi(t) {
|
|
4491
|
+
return t instanceof Ae ? yi(t.status) : t instanceof TypeError;
|
|
4413
4492
|
}
|
|
4414
|
-
function
|
|
4493
|
+
function yi(t) {
|
|
4415
4494
|
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
4416
4495
|
}
|
|
4417
|
-
function
|
|
4496
|
+
function Ii(t) {
|
|
4418
4497
|
return t === 401 || t === 403;
|
|
4419
4498
|
}
|
|
4420
|
-
const
|
|
4499
|
+
const Ue = "[REDACTED_SECRET]", H = "[REDACTED_TOKEN]", Si = "[REDACTED_SIGNED_URL]", Ti = 20, wi = /^(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, ps = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, gs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, fs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, ms = /\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, Mi = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ai = /\bhttps?:\/\/[^\s"'<>]+/gi, Ri = /[),.;\]]+$/;
|
|
4421
4500
|
function q(t) {
|
|
4422
|
-
return
|
|
4501
|
+
return Ce(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4423
4502
|
}
|
|
4424
|
-
function
|
|
4503
|
+
function Ce(t, e, s) {
|
|
4425
4504
|
if (typeof t == "string")
|
|
4426
|
-
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t :
|
|
4505
|
+
return t.startsWith("data:image/") || t.startsWith("data:application/pdf;") ? t : be(t);
|
|
4427
4506
|
if (t === null || typeof t != "object")
|
|
4428
4507
|
return t;
|
|
4429
|
-
if (e >=
|
|
4508
|
+
if (e >= Ti)
|
|
4430
4509
|
return "[REDACTED_MAX_DEPTH]";
|
|
4431
4510
|
if (s.has(t))
|
|
4432
4511
|
return "[REDACTED_CIRCULAR]";
|
|
4433
4512
|
if (s.add(t), Array.isArray(t))
|
|
4434
|
-
return t.map((r) =>
|
|
4513
|
+
return t.map((r) => Ce(r, e + 1, s));
|
|
4435
4514
|
const n = {};
|
|
4436
4515
|
for (const [r, i] of Object.entries(t))
|
|
4437
|
-
r === "pageContent" ? n[r] = i :
|
|
4516
|
+
r === "pageContent" ? n[r] = i : ys(r) ? n[r] = Ue : n[r] = r.toLowerCase() === "url" ? Ei(i) : Ce(i, e + 1, s);
|
|
4438
4517
|
return n;
|
|
4439
4518
|
}
|
|
4440
|
-
function
|
|
4519
|
+
function ys(t) {
|
|
4441
4520
|
const e = t.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
4442
4521
|
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");
|
|
4443
4522
|
}
|
|
4444
|
-
function
|
|
4445
|
-
return typeof t == "string" ?
|
|
4523
|
+
function Ei(t) {
|
|
4524
|
+
return typeof t == "string" ? Is(t) : Ce(t, 0, /* @__PURE__ */ new WeakSet());
|
|
4446
4525
|
}
|
|
4447
|
-
function
|
|
4526
|
+
function Is(t) {
|
|
4448
4527
|
try {
|
|
4449
4528
|
const e = new URL(t, location.href);
|
|
4450
4529
|
for (const s of Array.from(e.searchParams.keys()))
|
|
4451
|
-
|
|
4452
|
-
return e.username && (e.username =
|
|
4530
|
+
wi.test(s) && e.searchParams.set(s, H);
|
|
4531
|
+
return e.username && (e.username = H), e.password && (e.password = H), e.toString();
|
|
4453
4532
|
} catch {
|
|
4454
|
-
return
|
|
4533
|
+
return ki(t);
|
|
4455
4534
|
}
|
|
4456
4535
|
}
|
|
4457
|
-
function
|
|
4458
|
-
return t.replace(
|
|
4536
|
+
function be(t) {
|
|
4537
|
+
return t.replace(Mi, Si).replace(Ai, Ci).replace(ps, `Bearer ${H}`).replace(gs, `Basic ${H}`).replace(fs, H).replace(ms, (e, s) => `${s}: ${Ue}`);
|
|
4459
4538
|
}
|
|
4460
|
-
function
|
|
4461
|
-
return t.replace(
|
|
4539
|
+
function ki(t) {
|
|
4540
|
+
return t.replace(ps, `Bearer ${H}`).replace(gs, `Basic ${H}`).replace(fs, H).replace(ms, (e, s) => `${s}: ${Ue}`);
|
|
4462
4541
|
}
|
|
4463
|
-
function
|
|
4464
|
-
const e = t.match(
|
|
4465
|
-
return `${
|
|
4542
|
+
function Ci(t) {
|
|
4543
|
+
const e = t.match(Ri)?.[0] ?? "", s = e ? t.slice(0, -e.length) : t;
|
|
4544
|
+
return `${Is(s)}${e}`;
|
|
4466
4545
|
}
|
|
4467
4546
|
export {
|
|
4468
4547
|
ft as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4548
|
+
Xe as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
4549
|
+
Js as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
4550
|
+
Xs as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
4551
|
+
Qs as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
4552
|
+
bi as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
4553
|
+
Gt as PlunoProductAgent,
|
|
4554
|
+
Sn as calculateReconnectDelay,
|
|
4555
|
+
Gt as default,
|
|
4556
|
+
Hn as getProductAgentOriginAccessErrorMessage,
|
|
4557
|
+
ti as validateProductAgentProviderInputFile
|
|
4479
4558
|
};
|