@pluno/product-agent-web 0.1.206 → 0.1.207
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/displayedErrors.d.ts +2 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +11 -8
- package/dist/product-agent-sdk.js +180 -176
- package/dist/product-agent-widget.js +3204 -3163
- package/package.json +1 -1
|
@@ -62,11 +62,11 @@ function It(s) {
|
|
|
62
62
|
s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Js(s) {
|
|
66
66
|
return s !== null && (typeof s == "object" || typeof s == "function");
|
|
67
67
|
}
|
|
68
68
|
function hs(s, e, t) {
|
|
69
|
-
const n = Reflect.get(s, "pluno"), i =
|
|
69
|
+
const n = Reflect.get(s, "pluno"), i = Js(n) ? n : {};
|
|
70
70
|
if (i !== n && !Reflect.set(s, "pluno", i))
|
|
71
71
|
return null;
|
|
72
72
|
const r = Object.getOwnPropertyDescriptor(i, e);
|
|
@@ -80,10 +80,10 @@ function hs(s, e, t) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const Xs = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
84
84
|
function vt(s, e) {
|
|
85
85
|
return e ? s.replace(
|
|
86
|
-
|
|
86
|
+
Xs,
|
|
87
87
|
(t, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
|
|
88
88
|
) : s;
|
|
89
89
|
}
|
|
@@ -187,11 +187,11 @@ function Dt(s, e, t, n) {
|
|
|
187
187
|
return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
const
|
|
190
|
+
const Ke = "pluno.productAgent.transportId", on = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", an = 50, ln = globalThis.setTimeout.bind(globalThis);
|
|
191
191
|
let le = null;
|
|
192
|
-
const
|
|
192
|
+
const Re = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Map();
|
|
193
193
|
async function cn(s = ps()) {
|
|
194
|
-
const e = s.randomUUID(), t = s.storage.getItem(
|
|
194
|
+
const e = s.randomUUID(), t = s.storage.getItem(Ke);
|
|
195
195
|
let n = t ?? s.randomUUID(), i = !1, r = !1;
|
|
196
196
|
const o = s.channel.subscribe((l) => {
|
|
197
197
|
if (!(l.senderId === e || l.transportId !== n)) {
|
|
@@ -209,7 +209,7 @@ async function cn(s = ps()) {
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
if (!t)
|
|
212
|
-
s.storage.setItem(
|
|
212
|
+
s.storage.setItem(Ke, n), i = !0;
|
|
213
213
|
else if (s.skipStoredIdentityCollisionCheck)
|
|
214
214
|
i = !0;
|
|
215
215
|
else
|
|
@@ -218,7 +218,7 @@ async function cn(s = ps()) {
|
|
|
218
218
|
i = !0;
|
|
219
219
|
break;
|
|
220
220
|
}
|
|
221
|
-
n = s.randomUUID(), s.storage.setItem(
|
|
221
|
+
n = s.randomUUID(), s.storage.setItem(Ke, n);
|
|
222
222
|
}
|
|
223
223
|
let a = !1;
|
|
224
224
|
return {
|
|
@@ -234,24 +234,24 @@ async function un(s = !1) {
|
|
|
234
234
|
skipStoredIdentityCollisionCheck: s
|
|
235
235
|
}), le.then((i) => {
|
|
236
236
|
const r = (o) => {
|
|
237
|
-
o.persisted || (i.release(), le = null,
|
|
237
|
+
o.persisted || (i.release(), le = null, Re.clear(), window.removeEventListener("pagehide", r));
|
|
238
238
|
};
|
|
239
239
|
window.addEventListener("pagehide", r);
|
|
240
240
|
}));
|
|
241
241
|
const e = await le, t = dn();
|
|
242
|
-
|
|
242
|
+
Re.add(t);
|
|
243
243
|
let n = !1;
|
|
244
244
|
return {
|
|
245
245
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
246
246
|
transportId: t === 0 ? e.transportId : `${e.transportId}.${t}`,
|
|
247
247
|
release: () => {
|
|
248
|
-
n || (n = !0,
|
|
248
|
+
n || (n = !0, Re.delete(t));
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
function dn() {
|
|
253
253
|
let s = 0;
|
|
254
|
-
for (;
|
|
254
|
+
for (; Re.has(s); )
|
|
255
255
|
s += 1;
|
|
256
256
|
return s;
|
|
257
257
|
}
|
|
@@ -267,13 +267,13 @@ function hn() {
|
|
|
267
267
|
return {
|
|
268
268
|
getItem: (s) => {
|
|
269
269
|
try {
|
|
270
|
-
return window.sessionStorage?.getItem(s) ??
|
|
270
|
+
return window.sessionStorage?.getItem(s) ?? Qe.get(s) ?? null;
|
|
271
271
|
} catch {
|
|
272
|
-
return
|
|
272
|
+
return Qe.get(s) ?? null;
|
|
273
273
|
}
|
|
274
274
|
},
|
|
275
275
|
setItem: (s, e) => {
|
|
276
|
-
|
|
276
|
+
Qe.set(s, e);
|
|
277
277
|
try {
|
|
278
278
|
window.sessionStorage?.setItem(s, e);
|
|
279
279
|
} catch {
|
|
@@ -297,7 +297,7 @@ function pn() {
|
|
|
297
297
|
}
|
|
298
298
|
function gn() {
|
|
299
299
|
const s = /* @__PURE__ */ new Set(), e = (t) => {
|
|
300
|
-
if (t.key !==
|
|
300
|
+
if (t.key !== Ge || !t.newValue)
|
|
301
301
|
return;
|
|
302
302
|
const n = JSON.parse(t.newValue);
|
|
303
303
|
for (const i of s)
|
|
@@ -306,9 +306,9 @@ function gn() {
|
|
|
306
306
|
return window.addEventListener("storage", e), {
|
|
307
307
|
postMessage: (t) => {
|
|
308
308
|
window.localStorage.setItem(
|
|
309
|
-
|
|
309
|
+
Ge,
|
|
310
310
|
JSON.stringify({ ...t, eventId: crypto.randomUUID() })
|
|
311
|
-
), window.localStorage.removeItem(
|
|
311
|
+
), window.localStorage.removeItem(Ge);
|
|
312
312
|
},
|
|
313
313
|
subscribe: (t) => (s.add(t), () => s.delete(t)),
|
|
314
314
|
close: () => {
|
|
@@ -343,7 +343,7 @@ const mn = [
|
|
|
343
343
|
], In = [
|
|
344
344
|
...mn,
|
|
345
345
|
...yn
|
|
346
|
-
],
|
|
346
|
+
], Ve = (s) => In.some((e) => e.value === s);
|
|
347
347
|
function qt(s, e) {
|
|
348
348
|
return s.filter((t, n) => {
|
|
349
349
|
const i = Ot(t);
|
|
@@ -369,7 +369,7 @@ function ms(s, e) {
|
|
|
369
369
|
function ys(s, e) {
|
|
370
370
|
return typeof s.respondsToUserMessageId == "string" && typeof e.respondsToUserMessageId == "string" ? s.respondsToUserMessageId === e.respondsToUserMessageId : typeof s.clientMessageId == "string" && typeof e.clientMessageId == "string" ? s.clientMessageId === e.clientMessageId : typeof s.runId == "string" && typeof e.runId == "string" && s.runId === e.runId;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function ke(s) {
|
|
373
373
|
return {
|
|
374
374
|
key: s,
|
|
375
375
|
status: "not_requested",
|
|
@@ -381,7 +381,7 @@ function Re(s) {
|
|
|
381
381
|
}
|
|
382
382
|
class xt {
|
|
383
383
|
constructor(e, t, n = (i, r) => r) {
|
|
384
|
-
this.loader = t, this.merge = n, this.state =
|
|
384
|
+
this.loader = t, this.merge = n, this.state = ke(e);
|
|
385
385
|
}
|
|
386
386
|
loader;
|
|
387
387
|
merge;
|
|
@@ -396,10 +396,10 @@ class xt {
|
|
|
396
396
|
return this.listeners.add(e), e(this.state), () => this.listeners.delete(e);
|
|
397
397
|
}
|
|
398
398
|
setKey(e) {
|
|
399
|
-
e !== this.state.key && (this.state =
|
|
399
|
+
e !== this.state.key && (this.state = ke(e), this.trailingLoad = null, this.publish());
|
|
400
400
|
}
|
|
401
401
|
reset() {
|
|
402
|
-
this.state =
|
|
402
|
+
this.state = ke(this.state.key), this.trailingLoad = null, this.publish();
|
|
403
403
|
}
|
|
404
404
|
invalidate() {
|
|
405
405
|
this.state = {
|
|
@@ -454,7 +454,7 @@ class xt {
|
|
|
454
454
|
for (const e of this.listeners) e(this.state);
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
|
-
function
|
|
457
|
+
function Ee(s) {
|
|
458
458
|
const e = {}, t = [];
|
|
459
459
|
for (const n of s.entities)
|
|
460
460
|
e[n.id] || t.push(n.id), e[n.id] = n;
|
|
@@ -499,7 +499,7 @@ class Mn {
|
|
|
499
499
|
constructor(e, t, n = 20) {
|
|
500
500
|
this.loadPage = t, this.limit = n, this.recentQuery = new xt(
|
|
501
501
|
`${e}:recent`,
|
|
502
|
-
async ({ cursor: i }) =>
|
|
502
|
+
async ({ cursor: i }) => Ee(
|
|
503
503
|
await this.loadPage({ cursor: i, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
504
504
|
entities: r.sessions,
|
|
505
505
|
nextCursor: r.nextCursor
|
|
@@ -508,7 +508,7 @@ class Mn {
|
|
|
508
508
|
Tn
|
|
509
509
|
), this.pinnedQuery = new xt(
|
|
510
510
|
`${e}:pinned`,
|
|
511
|
-
async () =>
|
|
511
|
+
async () => Ee({
|
|
512
512
|
entities: await this.loadAllPinned(),
|
|
513
513
|
nextCursor: null
|
|
514
514
|
})
|
|
@@ -532,7 +532,7 @@ class Mn {
|
|
|
532
532
|
...Ie(e.data)
|
|
533
533
|
], i = new Map(n.map((l) => [l.id, l])), r = Array.from(i.values()).map(
|
|
534
534
|
(l) => this.applyOverrides(l, this.completedRefreshSequence)
|
|
535
|
-
), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ?
|
|
535
|
+
), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ? Ee({
|
|
536
536
|
entities: [...o, ...r],
|
|
537
537
|
nextCursor: e.data?.nextCursor ?? null
|
|
538
538
|
}) : null;
|
|
@@ -825,14 +825,14 @@ class kn {
|
|
|
825
825
|
return null;
|
|
826
826
|
}
|
|
827
827
|
getDecisionKey(e) {
|
|
828
|
-
const t =
|
|
828
|
+
const t = Je(e.scope);
|
|
829
829
|
return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
|
|
830
830
|
}
|
|
831
831
|
getExactKey(e) {
|
|
832
|
-
return `${
|
|
832
|
+
return `${Je(e.scope)}:interaction:${e.key}`;
|
|
833
833
|
}
|
|
834
834
|
getCategoryKey(e) {
|
|
835
|
-
return `${
|
|
835
|
+
return `${Je(e.scope)}:category:${e.category}`;
|
|
836
836
|
}
|
|
837
837
|
}
|
|
838
838
|
function bo(s, e) {
|
|
@@ -847,7 +847,7 @@ function En(s, e) {
|
|
|
847
847
|
const n = JSON.parse(t);
|
|
848
848
|
return Array.isArray(n) ? n.filter(rt) : [];
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function Je(s) {
|
|
851
851
|
return `${s.level}:${s.key}`;
|
|
852
852
|
}
|
|
853
853
|
function Ss(s) {
|
|
@@ -865,8 +865,8 @@ const Cn = {
|
|
|
865
865
|
stopped: "⏹️"
|
|
866
866
|
}, _n = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
|
|
867
867
|
function Pn(s, e) {
|
|
868
|
-
if (!e) return
|
|
869
|
-
const t =
|
|
868
|
+
if (!e) return ve(s);
|
|
869
|
+
const t = ve(s), n = `${Cn[e]} Pluno`;
|
|
870
870
|
return t ? `${n}: ${t}` : n;
|
|
871
871
|
}
|
|
872
872
|
class Ro {
|
|
@@ -891,10 +891,10 @@ class Ro {
|
|
|
891
891
|
}
|
|
892
892
|
applyStatus(e) {
|
|
893
893
|
const t = this.titleDocument.getTitle();
|
|
894
|
-
t !== this.lastAppliedTitle && (this.baseTitle =
|
|
894
|
+
t !== this.lastAppliedTitle && (this.baseTitle = ve(t)), this.status = e, this.stopObserving || (this.stopObserving = this.titleDocument.observeTitle(() => this.handleTitleChanged())), this.applyTitle();
|
|
895
895
|
}
|
|
896
896
|
applyClear() {
|
|
897
|
-
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, n = this.lastAppliedTitle === null ?
|
|
897
|
+
const e = this.titleDocument.getTitle(), t = this.lastAppliedTitle !== null && e === this.lastAppliedTitle, n = this.lastAppliedTitle === null ? ve(e) : e;
|
|
898
898
|
this.status = null, this.lastAppliedTitle = null, this.stopObserving?.(), this.stopObserving = null, t ? this.titleDocument.setTitle(this.baseTitle) : n !== e && this.titleDocument.setTitle(n);
|
|
899
899
|
}
|
|
900
900
|
handleTitleChanged() {
|
|
@@ -923,7 +923,7 @@ function ko(s) {
|
|
|
923
923
|
}
|
|
924
924
|
};
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function ve(s) {
|
|
927
927
|
return s.replace(_n, "");
|
|
928
928
|
}
|
|
929
929
|
function Eo(s) {
|
|
@@ -978,7 +978,7 @@ class Co {
|
|
|
978
978
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
979
979
|
accountListeners = /* @__PURE__ */ new Set();
|
|
980
980
|
state;
|
|
981
|
-
sessionHistoryState =
|
|
981
|
+
sessionHistoryState = ke("unavailable");
|
|
982
982
|
model;
|
|
983
983
|
interactions = [];
|
|
984
984
|
account = null;
|
|
@@ -1246,9 +1246,12 @@ function Xe(s) {
|
|
|
1246
1246
|
messages: s.messages.map((e) => {
|
|
1247
1247
|
const t = {
|
|
1248
1248
|
...e,
|
|
1249
|
-
attachments: e.attachments?.map((
|
|
1250
|
-
}, n = e.assistantDraftItemId, i = e.clientMessageId;
|
|
1251
|
-
return
|
|
1249
|
+
attachments: e.attachments?.map((o) => ({ ...o }))
|
|
1250
|
+
}, n = e.assistantDraftItemId, i = e.clientMessageId, r = e.proactiveSuggestionClientMessageId;
|
|
1251
|
+
return r && Object.defineProperty(t, "proactiveSuggestionClientMessageId", {
|
|
1252
|
+
value: r,
|
|
1253
|
+
enumerable: !1
|
|
1254
|
+
}), n && Object.defineProperty(t, "assistantDraftItemId", {
|
|
1252
1255
|
value: n,
|
|
1253
1256
|
enumerable: !1
|
|
1254
1257
|
}), i && Object.defineProperty(t, "clientMessageId", {
|
|
@@ -1262,14 +1265,14 @@ function Xe(s) {
|
|
|
1262
1265
|
function Nt(s) {
|
|
1263
1266
|
return {
|
|
1264
1267
|
...s,
|
|
1265
|
-
data: s.data ?
|
|
1268
|
+
data: s.data ? Ee({
|
|
1266
1269
|
entities: Is(s.data).map((e) => ({ ...e })),
|
|
1267
1270
|
nextCursor: s.data.nextCursor
|
|
1268
1271
|
}) : null
|
|
1269
1272
|
};
|
|
1270
1273
|
}
|
|
1271
1274
|
const vn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Un = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Dn = ".pluno-pa-widget__panel", qn = ".pluno-pa-widget__timeline", On = "__plunoExtensionWidgetOwner";
|
|
1272
|
-
class
|
|
1275
|
+
class J extends Error {
|
|
1273
1276
|
constructor(e, t, n, i) {
|
|
1274
1277
|
super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
|
|
1275
1278
|
}
|
|
@@ -1311,9 +1314,10 @@ function Bt(s) {
|
|
|
1311
1314
|
const r = (l) => {
|
|
1312
1315
|
if (!l || typeof l != "object")
|
|
1313
1316
|
return null;
|
|
1314
|
-
const c = l, u = c.data, d = u && typeof u == "object" ? u : {}, g =
|
|
1317
|
+
const c = l, u = c.data, d = u && typeof u == "object" ? u : {}, g = Ue(l);
|
|
1315
1318
|
return {
|
|
1316
1319
|
id: typeof c.id == "string" ? c.id : null,
|
|
1320
|
+
streamId: d.type === "message" && d.role === "assistant" && typeof d.id == "string" ? d.id : null,
|
|
1317
1321
|
type: typeof d.type == "string" ? d.type : null,
|
|
1318
1322
|
role: typeof d.role == "string" ? d.role : null,
|
|
1319
1323
|
sessionId: typeof c.sessionId == "string" ? c.sessionId : null,
|
|
@@ -1325,9 +1329,9 @@ function Bt(s) {
|
|
|
1325
1329
|
visible: !!(g && !g.scheduledCheckInAt && g.toolName !== St && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
|
|
1326
1330
|
};
|
|
1327
1331
|
}, o = r(s.item);
|
|
1328
|
-
if (o?.id && (e.itemId = o.id, o.type && (e.itemType = o.type), o.role && (e.itemRole = o.role), o.sessionId && typeof e.sessionId != "string" && (e.sessionId = o.sessionId), o.runId && typeof e.runId != "string" && (e.runId = o.runId), o.respondsToUserMessageId && typeof e.respondsToUserMessageId != "string" && (e.respondsToUserMessageId = o.respondsToUserMessageId), o.status && (e.itemStatus = o.status), o.stage && (e.itemStage = o.stage), o.retryable && (e.itemRetryable = !0), o.visible && (e.visibleItemId = o.id)), Array.isArray(s.items)) {
|
|
1329
|
-
const l = s.items.map(r).filter((c) => c !== null && c.visible && !!c.id)
|
|
1330
|
-
e.visibleItemIds = JSON.stringify(l);
|
|
1332
|
+
if (o?.id && (e.itemId = o.id, o.type && (e.itemType = o.type), o.role && (e.itemRole = o.role), o.sessionId && typeof e.sessionId != "string" && (e.sessionId = o.sessionId), o.runId && typeof e.runId != "string" && (e.runId = o.runId), o.respondsToUserMessageId && typeof e.respondsToUserMessageId != "string" && (e.respondsToUserMessageId = o.respondsToUserMessageId), o.status && (e.itemStatus = o.status), o.stage && (e.itemStage = o.stage), o.retryable && (e.itemRetryable = !0), o.visible && (e.visibleItemId = o.id, o.streamId && (e.visibleItemAliases = JSON.stringify([[o.streamId, o.id]])))), Array.isArray(s.items)) {
|
|
1333
|
+
const l = s.items.map(r).filter((c) => c !== null && c.visible && !!c.id);
|
|
1334
|
+
e.visibleItemIds = JSON.stringify(l.map((c) => c.id)), e.visibleItemAliases = JSON.stringify(l.flatMap((c) => c.streamId ? [[c.streamId, c.id]] : []));
|
|
1331
1335
|
}
|
|
1332
1336
|
s.type === "chat.assistant_delta" && typeof s.itemId == "string" && (e.visibleItemId = s.itemId);
|
|
1333
1337
|
const a = s.session;
|
|
@@ -1345,7 +1349,7 @@ function Bt(s) {
|
|
|
1345
1349
|
}
|
|
1346
1350
|
return e;
|
|
1347
1351
|
}
|
|
1348
|
-
function
|
|
1352
|
+
function Se(s, e, t) {
|
|
1349
1353
|
if (typeof window > "u")
|
|
1350
1354
|
return;
|
|
1351
1355
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -1364,24 +1368,24 @@ function Je(s, e, t) {
|
|
|
1364
1368
|
};
|
|
1365
1369
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: i }));
|
|
1366
1370
|
}
|
|
1367
|
-
class
|
|
1371
|
+
class Te extends Error {
|
|
1368
1372
|
}
|
|
1369
1373
|
function Nn(s) {
|
|
1370
1374
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
1371
1375
|
}
|
|
1372
|
-
const Hn = "https://app.pluno.ai", Bn = 2e4, Wn = 1e4, Fn = 6e4, $n = 6e4, jn = 1e4, zn = 1e4, Kn = 3e3, Gn = 3e4, Qn = 1e3, ot = 3e4, Wt = 0.2, Vn = 6e4, Ft = 15e3,
|
|
1376
|
+
const Hn = "https://app.pluno.ai", Bn = 2e4, Wn = 1e4, Fn = 6e4, $n = 6e4, jn = 1e4, zn = 1e4, Kn = 3e3, Gn = 3e4, Qn = 1e3, ot = 3e4, Wt = 0.2, Vn = 6e4, Ft = 15e3, Jn = 6e4, Xn = 8, Yn = "Browser connection was interrupted.", $t = 15e3, Zn = "Pluno could not send this message. Try it again.", ei = "Still connecting to Pluno. Retrying automatically.", ti = 2e3, si = 1e3, ni = 100, jt = 8e3, zt = 3, ii = [300, 1e3], Ts = 50 * 1024 * 1024, ri = /* @__PURE__ */ new Set([
|
|
1373
1377
|
".jpeg:image/jpeg",
|
|
1374
1378
|
".jpg:image/jpeg",
|
|
1375
1379
|
".pdf:application/pdf",
|
|
1376
1380
|
".png:image/png",
|
|
1377
1381
|
".webp:image/webp"
|
|
1378
|
-
]), _o = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, oi = 2e3, ai = 1e3, ws = "Image is too large for model vision input.", li = 100, ci = 20, As = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.",
|
|
1382
|
+
]), _o = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, oi = 2e3, ai = 1e3, ws = "Image is too large for model vision input.", li = 100, ci = 20, As = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", ui = 100;
|
|
1379
1383
|
function di(s, e = 0) {
|
|
1380
1384
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
1381
1385
|
return Math.max(e, t);
|
|
1382
1386
|
}
|
|
1383
|
-
const
|
|
1384
|
-
let
|
|
1387
|
+
const Ce = /* @__PURE__ */ new Set();
|
|
1388
|
+
let we = null;
|
|
1385
1389
|
function hi(s, e = Math.random) {
|
|
1386
1390
|
const t = Math.min(ot, Qn * 2 ** s), n = 1 - Wt + e() * Wt * 2;
|
|
1387
1391
|
return Math.min(ot, Math.round(t * n));
|
|
@@ -1398,7 +1402,7 @@ function pi(s) {
|
|
|
1398
1402
|
}
|
|
1399
1403
|
}
|
|
1400
1404
|
function gi(s) {
|
|
1401
|
-
if (s instanceof
|
|
1405
|
+
if (s instanceof J)
|
|
1402
1406
|
return s.retryable;
|
|
1403
1407
|
if (s && typeof s == "object") {
|
|
1404
1408
|
const e = s.status;
|
|
@@ -1419,7 +1423,7 @@ function fi(s) {
|
|
|
1419
1423
|
}
|
|
1420
1424
|
return new Error(String(s));
|
|
1421
1425
|
}
|
|
1422
|
-
class
|
|
1426
|
+
class Ne {
|
|
1423
1427
|
constructor(e, t) {
|
|
1424
1428
|
this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new Mn(
|
|
1425
1429
|
e.clientId,
|
|
@@ -1462,9 +1466,9 @@ class Le {
|
|
|
1462
1466
|
activeIntervalMs: 3e3,
|
|
1463
1467
|
idleIntervalMs: 15e3,
|
|
1464
1468
|
maxFailureIntervalMs: 3e4
|
|
1465
|
-
}), this.personalModelSelectionOverride = e.productVariant === "personal" &&
|
|
1469
|
+
}), this.personalModelSelectionOverride = e.productVariant === "personal" && Ve(e.model) ? e.model : null, this.state = {
|
|
1466
1470
|
...this.state,
|
|
1467
|
-
starterPrompts:
|
|
1471
|
+
starterPrompts: Ji(e.initialStarterPrompts)
|
|
1468
1472
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
1469
1473
|
const n = e.restorePersistedState === !1 ? null : Br(e.clientId, e.expectedPersistedSessionId);
|
|
1470
1474
|
n && (this.state = {
|
|
@@ -1637,7 +1641,7 @@ class Le {
|
|
|
1637
1641
|
static async init(e) {
|
|
1638
1642
|
const t = e, n = await un(
|
|
1639
1643
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
1640
|
-
), i = new
|
|
1644
|
+
), i = new Ne({
|
|
1641
1645
|
...e,
|
|
1642
1646
|
backendUrl: Oi(e.backendUrl ?? Hn),
|
|
1643
1647
|
clientId: e.clientId ?? tr(),
|
|
@@ -1703,7 +1707,7 @@ class Le {
|
|
|
1703
1707
|
let a = null;
|
|
1704
1708
|
const l = new Promise((c, u) => {
|
|
1705
1709
|
a = window.setTimeout(() => {
|
|
1706
|
-
r.abort(), u(new
|
|
1710
|
+
r.abort(), u(new J("Pluno token provider timed out", !0));
|
|
1707
1711
|
}, Fn);
|
|
1708
1712
|
});
|
|
1709
1713
|
try {
|
|
@@ -1712,9 +1716,9 @@ class Le {
|
|
|
1712
1716
|
l
|
|
1713
1717
|
]);
|
|
1714
1718
|
if (r.signal.aborted || this.tokenAbortController !== r)
|
|
1715
|
-
throw new
|
|
1719
|
+
throw new J("Pluno token request was cancelled", !0);
|
|
1716
1720
|
if (!c)
|
|
1717
|
-
throw new
|
|
1721
|
+
throw new J("Pluno token provider did not return a token", !1);
|
|
1718
1722
|
return this.token = c, this.tokenExpiresAtMs = pi(c), c;
|
|
1719
1723
|
} finally {
|
|
1720
1724
|
a !== null && window.clearTimeout(a);
|
|
@@ -1739,7 +1743,7 @@ class Le {
|
|
|
1739
1743
|
if (this.token = await this.acquireToken("connect"), e !== this.connectionAttemptId || this.state.status === "closed")
|
|
1740
1744
|
return;
|
|
1741
1745
|
if (!this.token && !this.options.webSocketFactory)
|
|
1742
|
-
throw new
|
|
1746
|
+
throw new J("Pluno requires a token or tokenProvider", !1);
|
|
1743
1747
|
const t = Hi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
1744
1748
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
1745
1749
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
@@ -1790,12 +1794,12 @@ class Le {
|
|
|
1790
1794
|
b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
1791
1795
|
message: n.message,
|
|
1792
1796
|
reconnectAttempt: this.reconnectAttempts
|
|
1793
|
-
}), t instanceof
|
|
1797
|
+
}), t instanceof J && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
1794
1798
|
status: "reconnecting",
|
|
1795
1799
|
lastError: ei,
|
|
1796
1800
|
lastErrorCode: "connection_failed"
|
|
1797
1801
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
1798
|
-
t instanceof
|
|
1802
|
+
t instanceof J ? t.retryAfterMs : void 0
|
|
1799
1803
|
);
|
|
1800
1804
|
return;
|
|
1801
1805
|
}
|
|
@@ -1857,7 +1861,7 @@ class Le {
|
|
|
1857
1861
|
0
|
|
1858
1862
|
) > Ts))
|
|
1859
1863
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
1860
|
-
let r = i.map(
|
|
1864
|
+
let r = i.map(qe);
|
|
1861
1865
|
if (!n && r.length === 0)
|
|
1862
1866
|
return null;
|
|
1863
1867
|
if (this.pendingClientMessageId)
|
|
@@ -1953,7 +1957,7 @@ class Le {
|
|
|
1953
1957
|
content: n,
|
|
1954
1958
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1955
1959
|
pageContent: D && At() || void 0,
|
|
1956
|
-
attachments: r.length > 0 ? r.map(
|
|
1960
|
+
attachments: r.length > 0 ? r.map(qe) : void 0,
|
|
1957
1961
|
page: o,
|
|
1958
1962
|
model: this.options.model,
|
|
1959
1963
|
metadata: Kt(this.options.metadata)
|
|
@@ -1973,7 +1977,7 @@ class Le {
|
|
|
1973
1977
|
return this.options.model;
|
|
1974
1978
|
}
|
|
1975
1979
|
setModel(e) {
|
|
1976
|
-
this.options.model = e, this.options.productVariant === "personal" &&
|
|
1980
|
+
this.options.model = e, this.options.productVariant === "personal" && Ve(e) && (this.personalModelSelectionOverride = e);
|
|
1977
1981
|
}
|
|
1978
1982
|
retryLastMessage() {
|
|
1979
1983
|
const e = this.state.sessionId, t = this.retryableClientMessageId;
|
|
@@ -2044,23 +2048,23 @@ class Le {
|
|
|
2044
2048
|
};
|
|
2045
2049
|
let o;
|
|
2046
2050
|
if (this.options.persistAttachmentUpload)
|
|
2047
|
-
o = await
|
|
2051
|
+
o = await be(
|
|
2048
2052
|
() => this.options.persistAttachmentUpload(r, e),
|
|
2049
2053
|
"Failed to upload attachment"
|
|
2050
2054
|
);
|
|
2051
2055
|
else {
|
|
2052
|
-
const l = this.options.prepareAttachmentUpload ? await
|
|
2056
|
+
const l = this.options.prepareAttachmentUpload ? await be(
|
|
2053
2057
|
() => this.options.prepareAttachmentUpload(r),
|
|
2054
2058
|
"Failed to prepare attachment upload"
|
|
2055
2059
|
) : await this.prepareEmbedAttachmentUpload(r);
|
|
2056
|
-
await
|
|
2060
|
+
await be(async () => {
|
|
2057
2061
|
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
2058
2062
|
method: l.uploadMethod,
|
|
2059
2063
|
headers: l.uploadHeaders,
|
|
2060
2064
|
body: e
|
|
2061
2065
|
});
|
|
2062
2066
|
if (!c.ok)
|
|
2063
|
-
throw new
|
|
2067
|
+
throw new Pe("Failed to upload attachment", c.status);
|
|
2064
2068
|
return c;
|
|
2065
2069
|
}, "Failed to upload attachment"), o = l;
|
|
2066
2070
|
}
|
|
@@ -2093,7 +2097,7 @@ class Le {
|
|
|
2093
2097
|
}
|
|
2094
2098
|
async prepareEmbedAttachmentUpload(e) {
|
|
2095
2099
|
let t = !1;
|
|
2096
|
-
return await
|
|
2100
|
+
return await be(async () => {
|
|
2097
2101
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2098
2102
|
if (n.ok)
|
|
2099
2103
|
return await n.json();
|
|
@@ -2102,9 +2106,9 @@ class Le {
|
|
|
2102
2106
|
const i = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
2103
2107
|
if (i.ok)
|
|
2104
2108
|
return await i.json();
|
|
2105
|
-
throw new
|
|
2109
|
+
throw new Pe("Failed to prepare attachment upload", i.status);
|
|
2106
2110
|
}
|
|
2107
|
-
throw new
|
|
2111
|
+
throw new Pe("Failed to prepare attachment upload", n.status);
|
|
2108
2112
|
}, "Failed to prepare attachment upload");
|
|
2109
2113
|
}
|
|
2110
2114
|
async fetchEmbedAttachmentUpload(e, t) {
|
|
@@ -2137,7 +2141,7 @@ class Le {
|
|
|
2137
2141
|
stoppedCausalSequence: null,
|
|
2138
2142
|
toolCallIds: new Set(
|
|
2139
2143
|
this.state.messages.filter(
|
|
2140
|
-
(t) =>
|
|
2144
|
+
(t) => Me(
|
|
2141
2145
|
t,
|
|
2142
2146
|
e.respondsToUserMessageId,
|
|
2143
2147
|
e.runId
|
|
@@ -2538,7 +2542,7 @@ class Le {
|
|
|
2538
2542
|
try {
|
|
2539
2543
|
return await this.fetchSessionHistoryPageOnce(e, t, n);
|
|
2540
2544
|
} catch (o) {
|
|
2541
|
-
if (o instanceof
|
|
2545
|
+
if (o instanceof Te)
|
|
2542
2546
|
throw o;
|
|
2543
2547
|
b("web-sdk.history", "HTTP session history page failed; retrying", {
|
|
2544
2548
|
sessionId: e,
|
|
@@ -2552,7 +2556,7 @@ class Le {
|
|
|
2552
2556
|
async fetchSessionHistoryPageOnce(e, t, n, i = !1) {
|
|
2553
2557
|
const r = await this.acquireToken("history", { preferCached: i });
|
|
2554
2558
|
if (!r)
|
|
2555
|
-
throw new
|
|
2559
|
+
throw new Te("Product Agent history requires authentication");
|
|
2556
2560
|
this.token = r;
|
|
2557
2561
|
const o = new URLSearchParams({ limit: "200" });
|
|
2558
2562
|
n && o.set("cursor", n);
|
|
@@ -2566,11 +2570,11 @@ class Le {
|
|
|
2566
2570
|
});
|
|
2567
2571
|
if (!c.ok) {
|
|
2568
2572
|
const d = await c.text() || `History request failed (${c.status})`;
|
|
2569
|
-
throw Nn(c.status) ? new Error(d) : new
|
|
2573
|
+
throw Nn(c.status) ? new Error(d) : new Te(d);
|
|
2570
2574
|
}
|
|
2571
2575
|
const u = await c.json();
|
|
2572
2576
|
if (!u?.session || !Array.isArray(u.items))
|
|
2573
|
-
throw new
|
|
2577
|
+
throw new Te("Invalid Product Agent session history response");
|
|
2574
2578
|
return {
|
|
2575
2579
|
session: u.session,
|
|
2576
2580
|
items: u.items,
|
|
@@ -2621,7 +2625,7 @@ class Le {
|
|
|
2621
2625
|
return !1;
|
|
2622
2626
|
const t = this.socket;
|
|
2623
2627
|
try {
|
|
2624
|
-
return t.send(JSON.stringify(e)),
|
|
2628
|
+
return t.send(JSON.stringify(e)), Se("client_event", e.type, Bt(e)), !0;
|
|
2625
2629
|
} catch (n) {
|
|
2626
2630
|
return b("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
2627
2631
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -2648,7 +2652,7 @@ class Le {
|
|
|
2648
2652
|
...this.activeResponseRunId ? { runId: this.activeResponseRunId } : {},
|
|
2649
2653
|
...t
|
|
2650
2654
|
};
|
|
2651
|
-
if (this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
|
|
2655
|
+
if (Se("client_event", "runtime.health", { ...i, signalName: e }), this.options.productVariant === "customer_embedded" || !this.socket || this.socket.readyState !== WebSocket.OPEN || this.authenticatedSocket !== this.socket) {
|
|
2652
2656
|
this.queueHealthDiagnostic(i);
|
|
2653
2657
|
return;
|
|
2654
2658
|
}
|
|
@@ -2671,7 +2675,7 @@ class Le {
|
|
|
2671
2675
|
clientMessageId: e,
|
|
2672
2676
|
durationMs: Date.now() - n
|
|
2673
2677
|
});
|
|
2674
|
-
}, Math.max(0,
|
|
2678
|
+
}, Math.max(0, Jn - (Date.now() - n)));
|
|
2675
2679
|
this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
|
|
2676
2680
|
}
|
|
2677
2681
|
clearFirstResponseTimer(e) {
|
|
@@ -2880,7 +2884,7 @@ class Le {
|
|
|
2880
2884
|
}
|
|
2881
2885
|
rememberDurablyStoppedTurn(e, t) {
|
|
2882
2886
|
const n = C(t);
|
|
2883
|
-
if (!e || !n || !
|
|
2887
|
+
if (!e || !n || !_e(n) || this.findStoppedTurn(e, n))
|
|
2884
2888
|
return;
|
|
2885
2889
|
const i = O(n), r = k(n), o = typeof n.clientMessageId == "string" ? n.clientMessageId : i ? this.clientMessageIdsByUserMessageItemId.get(i) ?? null : null;
|
|
2886
2890
|
this.stoppedTurns.push({
|
|
@@ -2894,7 +2898,7 @@ class Le {
|
|
|
2894
2898
|
stoppedCausalSequence: P(n),
|
|
2895
2899
|
toolCallIds: new Set(
|
|
2896
2900
|
this.state.messages.filter(
|
|
2897
|
-
(a) =>
|
|
2901
|
+
(a) => Me(a, i, r)
|
|
2898
2902
|
).map((a) => a.callId).filter((a) => typeof a == "string")
|
|
2899
2903
|
)
|
|
2900
2904
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
@@ -2912,12 +2916,12 @@ class Le {
|
|
|
2912
2916
|
const n = typeof e.callId == "string" ? e.callId : null;
|
|
2913
2917
|
return !!(n && this.stoppedTurns.some((i) => i.toolCallIds.has(n)));
|
|
2914
2918
|
}
|
|
2915
|
-
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !
|
|
2919
|
+
return this.findStoppedTurnForEvent(e) ? e.type === "session.item" ? !_e(C(e.item)) : e.type !== "conversation.state" : !1;
|
|
2916
2920
|
}
|
|
2917
2921
|
filterStoppedSnapshotItems(e, t) {
|
|
2918
2922
|
return e.filter((n) => {
|
|
2919
2923
|
const i = C(n), r = i ? this.findStoppedTurn(t, i) : null;
|
|
2920
|
-
if (!r || i?.type === "message" && i.role === "user" ||
|
|
2924
|
+
if (!r || i?.type === "message" && i.role === "user" || _e(i))
|
|
2921
2925
|
return !0;
|
|
2922
2926
|
if (r.stoppedCausalSequence !== null) {
|
|
2923
2927
|
const o = i ? P(i) : null;
|
|
@@ -2931,7 +2935,7 @@ class Le {
|
|
|
2931
2935
|
});
|
|
2932
2936
|
}
|
|
2933
2937
|
handleServerEvent(e) {
|
|
2934
|
-
if (
|
|
2938
|
+
if (Se("server_event", e.type, Bt(e)), e.type === "session.subscribed") {
|
|
2935
2939
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
|
|
2936
2940
|
if (t && n && t === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
|
|
2937
2941
|
const i = this.pendingSessionSubscription;
|
|
@@ -3001,7 +3005,7 @@ class Le {
|
|
|
3001
3005
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
3002
3006
|
const t = sr(e.user);
|
|
3003
3007
|
this.authenticatedSocket !== this.socket && this.authenticatedUserId && t && t.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = t?.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();
|
|
3004
|
-
const n =
|
|
3008
|
+
const n = Xi(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
3005
3009
|
b("web-sdk.agent", "Received auth.ok appearance", {
|
|
3006
3010
|
hasAppearance: i,
|
|
3007
3011
|
rawAppearance: e.appearance,
|
|
@@ -3033,7 +3037,7 @@ class Le {
|
|
|
3033
3037
|
}
|
|
3034
3038
|
if (e.type === "scheduled_follow_ups.updated") {
|
|
3035
3039
|
typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
|
|
3036
|
-
activeScheduledFollowUps:
|
|
3040
|
+
activeScheduledFollowUps: Jt(
|
|
3037
3041
|
e.activeScheduledFollowUps
|
|
3038
3042
|
)
|
|
3039
3043
|
});
|
|
@@ -3090,7 +3094,7 @@ class Le {
|
|
|
3090
3094
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
3091
3095
|
messages: S,
|
|
3092
3096
|
...i ? {
|
|
3093
|
-
activeScheduledFollowUps:
|
|
3097
|
+
activeScheduledFollowUps: Jt(
|
|
3094
3098
|
e.activeScheduledFollowUps
|
|
3095
3099
|
)
|
|
3096
3100
|
} : {},
|
|
@@ -3197,7 +3201,7 @@ class Le {
|
|
|
3197
3201
|
o && (this.retryableClientMessageId = o);
|
|
3198
3202
|
return;
|
|
3199
3203
|
}
|
|
3200
|
-
const n =
|
|
3204
|
+
const n = Ue(e.item, this.options.backendUrl);
|
|
3201
3205
|
if (n) {
|
|
3202
3206
|
const i = vr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
3203
3207
|
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), F(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), kr(t) && this.clearRunAckResyncRetryTimer();
|
|
@@ -3211,7 +3215,7 @@ class Le {
|
|
|
3211
3215
|
o,
|
|
3212
3216
|
o.findIndex((d) => d.id === n.id)
|
|
3213
3217
|
)
|
|
3214
|
-
), c = a && (!this.state.assistantDraft || l), u =
|
|
3218
|
+
), c = a && (!this.state.assistantDraft || l), u = De(n) && (c || F(n) && !this.state.isThinking && this.activeClientMessageId === null);
|
|
3215
3219
|
this.setState({
|
|
3216
3220
|
messages: o,
|
|
3217
3221
|
...l ? {
|
|
@@ -3271,7 +3275,7 @@ class Le {
|
|
|
3271
3275
|
return;
|
|
3272
3276
|
const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !i || i === this.activeResponseRunId), l = Dt(
|
|
3273
3277
|
this.state.messages.filter(
|
|
3274
|
-
(c) => c.dataType !== "assistant_draft" || !
|
|
3278
|
+
(c) => c.dataType !== "assistant_draft" || !Me(
|
|
3275
3279
|
c,
|
|
3276
3280
|
n,
|
|
3277
3281
|
i
|
|
@@ -3426,7 +3430,7 @@ class Le {
|
|
|
3426
3430
|
if (this.options.productVariant !== "personal" || !e || typeof e != "object" || this.personalModelSelectionOverride !== null)
|
|
3427
3431
|
return;
|
|
3428
3432
|
const t = e.metadata, n = t && typeof t == "object" ? t.model : void 0;
|
|
3429
|
-
this.options.model =
|
|
3433
|
+
this.options.model = Ve(n) ? n : "gpt-5.6-sol";
|
|
3430
3434
|
}
|
|
3431
3435
|
updateAccountFallbackFromSession(e) {
|
|
3432
3436
|
const t = e && typeof e == "object" ? e.metadata : null, n = An(t);
|
|
@@ -3466,7 +3470,7 @@ class Le {
|
|
|
3466
3470
|
const i = C(e.item);
|
|
3467
3471
|
if (pe(i))
|
|
3468
3472
|
return;
|
|
3469
|
-
const r =
|
|
3473
|
+
const r = Ue(e.item, this.options.backendUrl);
|
|
3470
3474
|
r && this.rememberSessionTimeline(t, de(n, r));
|
|
3471
3475
|
return;
|
|
3472
3476
|
}
|
|
@@ -3515,7 +3519,7 @@ class Le {
|
|
|
3515
3519
|
if (e.type === "chat.assistant_done") {
|
|
3516
3520
|
const i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = Dt(
|
|
3517
3521
|
n.filter(
|
|
3518
|
-
(a) => a.dataType !== "assistant_draft" || !
|
|
3522
|
+
(a) => a.dataType !== "assistant_draft" || !Me(a, i, r)
|
|
3519
3523
|
),
|
|
3520
3524
|
i,
|
|
3521
3525
|
r,
|
|
@@ -3711,7 +3715,7 @@ class Le {
|
|
|
3711
3715
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
3712
3716
|
return;
|
|
3713
3717
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
3714
|
-
if (t >=
|
|
3718
|
+
if (t >= Xn) {
|
|
3715
3719
|
this.failPendingDelivery(e);
|
|
3716
3720
|
return;
|
|
3717
3721
|
}
|
|
@@ -4004,7 +4008,7 @@ class Le {
|
|
|
4004
4008
|
reason: "active_turn_phase_moved_backward",
|
|
4005
4009
|
previousPhase: this.lastProjectedTurnPhase,
|
|
4006
4010
|
nextPhase: o.turnPhase
|
|
4007
|
-
}), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), Wr(this.options.clientId, this.state), this.emit("state", this.getState()),
|
|
4011
|
+
}), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), Wr(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
|
|
4008
4012
|
status: this.state.status,
|
|
4009
4013
|
sessionId: this.state.sessionId,
|
|
4010
4014
|
messageCount: this.state.messages.length,
|
|
@@ -4529,13 +4533,13 @@ function Bi() {
|
|
|
4529
4533
|
};
|
|
4530
4534
|
}
|
|
4531
4535
|
function Wi(s) {
|
|
4532
|
-
return
|
|
4533
|
-
|
|
4536
|
+
return Ce.add(s), we || (we = Fi()), () => {
|
|
4537
|
+
Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
|
|
4534
4538
|
};
|
|
4535
4539
|
}
|
|
4536
4540
|
function Fi() {
|
|
4537
4541
|
const s = () => {
|
|
4538
|
-
for (const r of Array.from(
|
|
4542
|
+
for (const r of Array.from(Ce))
|
|
4539
4543
|
r();
|
|
4540
4544
|
}, e = window.history.pushState.bind(window.history), t = window.history.replaceState.bind(window.history), n = ((...r) => {
|
|
4541
4545
|
const o = e(...r);
|
|
@@ -4715,33 +4719,33 @@ function ji(s, e) {
|
|
|
4715
4719
|
const Pt = S(I, N);
|
|
4716
4720
|
kt.push(Pt), q.push(Pt.lines);
|
|
4717
4721
|
}
|
|
4718
|
-
const
|
|
4722
|
+
const We = [];
|
|
4719
4723
|
if (T.shadowRoot)
|
|
4720
4724
|
for (const I of Array.from(T.shadowRoot.children))
|
|
4721
|
-
I instanceof HTMLElement &&
|
|
4722
|
-
const ye = [...kt, ...
|
|
4725
|
+
I instanceof HTMLElement && We.push(S(I, N + 1));
|
|
4726
|
+
const ye = [...kt, ...We], Fe = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), Et = ne(
|
|
4723
4727
|
[ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
4724
|
-
).slice(0, 180), js = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), Ct = c.some((I) => T.hasAttribute(I)) || !!Z || js,
|
|
4725
|
-
if (
|
|
4728
|
+
).slice(0, 180), js = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), Ct = c.some((I) => T.hasAttribute(I)) || !!Z || js, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || Ct || Y) && (Fe || Y) && (!i.has(v) || Fe || Ct || Y), je = $e ? 1 : 0, ae = [];
|
|
4729
|
+
if ($e) {
|
|
4726
4730
|
const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? Et : ee;
|
|
4727
4731
|
ae.push(bs(T, l, o, R.slice(0, 180)));
|
|
4728
4732
|
}
|
|
4729
4733
|
for (const I of q)
|
|
4730
|
-
ae.push(...
|
|
4731
|
-
const
|
|
4732
|
-
if (
|
|
4733
|
-
const I =
|
|
4734
|
-
|
|
4734
|
+
ae.push(...Ae(I, je));
|
|
4735
|
+
const ze = We.flatMap((I) => I.lines);
|
|
4736
|
+
if (ze.length > 0) {
|
|
4737
|
+
const I = ze.slice(0, 20);
|
|
4738
|
+
ze.length > I.length && I.push("… shadow DOM omitted");
|
|
4735
4739
|
const R = v.includes("tooltip") || v.includes("popper") || v.includes("loader");
|
|
4736
4740
|
if (N < 2 && !R) {
|
|
4737
|
-
const z =
|
|
4738
|
-
ae.push(...
|
|
4741
|
+
const z = $e ? "#shadow-root" : `${v} #shadow-root`;
|
|
4742
|
+
ae.push(...Ae([z, ...Ae(I, 1)], je));
|
|
4739
4743
|
} else
|
|
4740
|
-
ae.push(...
|
|
4744
|
+
ae.push(...Ae(I, je));
|
|
4741
4745
|
}
|
|
4742
4746
|
return {
|
|
4743
4747
|
lines: ae,
|
|
4744
|
-
hasUsefulContent:
|
|
4748
|
+
hasUsefulContent: Fe,
|
|
4745
4749
|
textPreview: Et,
|
|
4746
4750
|
containsTextElement: n.has(v) || ye.some((I) => I.containsTextElement)
|
|
4747
4751
|
};
|
|
@@ -4846,7 +4850,7 @@ function Ki(s, e, t, n) {
|
|
|
4846
4850
|
function Qt(s) {
|
|
4847
4851
|
return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
|
|
4848
4852
|
}
|
|
4849
|
-
function
|
|
4853
|
+
function Ae(s, e) {
|
|
4850
4854
|
if (e === 0)
|
|
4851
4855
|
return s;
|
|
4852
4856
|
const t = " ".repeat(e);
|
|
@@ -4918,7 +4922,7 @@ function Vt(s, e) {
|
|
|
4918
4922
|
const t = s[e];
|
|
4919
4923
|
return Array.isArray(t) ? t.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
4920
4924
|
}
|
|
4921
|
-
function
|
|
4925
|
+
function Jt(s) {
|
|
4922
4926
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
4923
4927
|
if (!e || typeof e != "object")
|
|
4924
4928
|
return [];
|
|
@@ -4926,10 +4930,10 @@ function Xt(s) {
|
|
|
4926
4930
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
4927
4931
|
}) : [];
|
|
4928
4932
|
}
|
|
4929
|
-
function
|
|
4933
|
+
function Ji(s) {
|
|
4930
4934
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
4931
4935
|
}
|
|
4932
|
-
function
|
|
4936
|
+
function Xi(s) {
|
|
4933
4937
|
if (!s || typeof s != "object")
|
|
4934
4938
|
return null;
|
|
4935
4939
|
const e = s, t = e.appearance, n = t && typeof t == "object" ? t : e, i = typeof n.accentColor == "string" ? n.accentColor : null, r = 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;
|
|
@@ -4985,7 +4989,7 @@ function sr(s) {
|
|
|
4985
4989
|
}
|
|
4986
4990
|
function st(s, e) {
|
|
4987
4991
|
return Array.isArray(s) ? ht(
|
|
4988
|
-
s.map((t) =>
|
|
4992
|
+
s.map((t) => Ue(t, e)).filter((t) => t !== null)
|
|
4989
4993
|
) : [];
|
|
4990
4994
|
}
|
|
4991
4995
|
function nr(s) {
|
|
@@ -5009,7 +5013,7 @@ function nr(s) {
|
|
|
5009
5013
|
];
|
|
5010
5014
|
}) : [];
|
|
5011
5015
|
}
|
|
5012
|
-
function
|
|
5016
|
+
function Ue(s, e) {
|
|
5013
5017
|
if (!s || typeof s != "object")
|
|
5014
5018
|
return null;
|
|
5015
5019
|
const t = s, n = t.data;
|
|
@@ -5024,7 +5028,7 @@ function ve(s, e) {
|
|
|
5024
5028
|
role: "assistant",
|
|
5025
5029
|
...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
|
|
5026
5030
|
content: vt(
|
|
5027
|
-
|
|
5031
|
+
Xt(i.content),
|
|
5028
5032
|
e
|
|
5029
5033
|
),
|
|
5030
5034
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5041,7 +5045,7 @@ function ve(s, e) {
|
|
|
5041
5045
|
role: r,
|
|
5042
5046
|
...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
|
|
5043
5047
|
content: vt(
|
|
5044
|
-
|
|
5048
|
+
Xt(i.content),
|
|
5045
5049
|
e
|
|
5046
5050
|
),
|
|
5047
5051
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -5249,7 +5253,7 @@ function P(s) {
|
|
|
5249
5253
|
function E(s) {
|
|
5250
5254
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
5251
5255
|
}
|
|
5252
|
-
function
|
|
5256
|
+
function Xt(s) {
|
|
5253
5257
|
return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
|
|
5254
5258
|
if (!e || typeof e != "object")
|
|
5255
5259
|
return "";
|
|
@@ -5305,7 +5309,7 @@ function hr(s, e) {
|
|
|
5305
5309
|
(n) => n.dataType === "assistant_draft" && n.id === t ? e : n
|
|
5306
5310
|
) : s;
|
|
5307
5311
|
}
|
|
5308
|
-
function
|
|
5312
|
+
function Me(s, e, t) {
|
|
5309
5313
|
return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
|
|
5310
5314
|
}
|
|
5311
5315
|
function Yt(s, e, t, n) {
|
|
@@ -5415,7 +5419,7 @@ function gr(s, e) {
|
|
|
5415
5419
|
return i;
|
|
5416
5420
|
}
|
|
5417
5421
|
function ct(s) {
|
|
5418
|
-
const e =
|
|
5422
|
+
const e = X(s) ?? void 0, t = s.assistantDraftItemId, n = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", i = [
|
|
5419
5423
|
// Output-backed cards and their visible calls are separate durable rows. A distinct key keeps activity hydration
|
|
5420
5424
|
// from substituting the call for its output and then appending a duplicate output at the end of the timeline.
|
|
5421
5425
|
...s.callId ? [`${n ? "call-output" : "call"}:${s.callId}`] : [],
|
|
@@ -5428,7 +5432,7 @@ function ct(s) {
|
|
|
5428
5432
|
...i.length > 0 ? { activityKeys: i } : {},
|
|
5429
5433
|
...s.respondsToUserMessageId ? { respondsToUserMessageId: s.respondsToUserMessageId } : {},
|
|
5430
5434
|
...s.runId ? { runId: s.runId } : {},
|
|
5431
|
-
isOptimistic:
|
|
5435
|
+
isOptimistic: He(s),
|
|
5432
5436
|
isAssistantDraft: s.dataType === "assistant_draft",
|
|
5433
5437
|
isActivity: s.role === "tool" || s.phase === "commentary" || s.dataType === "assistant_draft",
|
|
5434
5438
|
isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
|
|
@@ -5438,14 +5442,14 @@ function Es(s, e) {
|
|
|
5438
5442
|
if (e.role !== "user" || !e.attachments?.length)
|
|
5439
5443
|
return e;
|
|
5440
5444
|
const t = s.find(
|
|
5441
|
-
(o) => o.role === "user" && (o.id === e.id ||
|
|
5445
|
+
(o) => o.role === "user" && (o.id === e.id || He(o) && Cs(o, e))
|
|
5442
5446
|
);
|
|
5443
5447
|
if (!t?.attachments?.length)
|
|
5444
5448
|
return e;
|
|
5445
5449
|
const n = e.attachments.map((o) => {
|
|
5446
5450
|
const a = fr(t.attachments ?? [], o);
|
|
5447
5451
|
return a ? mr(o, a) : o;
|
|
5448
|
-
}), i = { ...e, attachments: n }, r =
|
|
5452
|
+
}), i = { ...e, attachments: n }, r = X(e);
|
|
5449
5453
|
return r && Object.defineProperty(i, "clientMessageId", {
|
|
5450
5454
|
value: r,
|
|
5451
5455
|
enumerable: !1
|
|
@@ -5462,7 +5466,7 @@ function yr(s, e) {
|
|
|
5462
5466
|
if (e.role !== "user")
|
|
5463
5467
|
return s;
|
|
5464
5468
|
const t = s.findIndex(
|
|
5465
|
-
(i) =>
|
|
5469
|
+
(i) => He(i) && Cs(i, e)
|
|
5466
5470
|
);
|
|
5467
5471
|
if (t === -1)
|
|
5468
5472
|
return s;
|
|
@@ -5470,13 +5474,13 @@ function yr(s, e) {
|
|
|
5470
5474
|
return n.splice(t, 1), n;
|
|
5471
5475
|
}
|
|
5472
5476
|
function Cs(s, e) {
|
|
5473
|
-
const t =
|
|
5477
|
+
const t = X(s), n = X(e);
|
|
5474
5478
|
return t && n ? t === n : s.content === e.content;
|
|
5475
5479
|
}
|
|
5476
|
-
function
|
|
5480
|
+
function He(s) {
|
|
5477
5481
|
return s.role === "user" && (s.id.startsWith("local-") || s.id.startsWith("optimistic-user-message:"));
|
|
5478
5482
|
}
|
|
5479
|
-
function
|
|
5483
|
+
function X(s) {
|
|
5480
5484
|
const e = s.clientMessageId;
|
|
5481
5485
|
if (e)
|
|
5482
5486
|
return e;
|
|
@@ -5491,7 +5495,7 @@ function ss(s) {
|
|
|
5491
5495
|
return !1;
|
|
5492
5496
|
const t = s[e].id;
|
|
5493
5497
|
if (s.some(
|
|
5494
|
-
(i) => i.respondsToUserMessageId === t &&
|
|
5498
|
+
(i) => i.respondsToUserMessageId === t && De(i)
|
|
5495
5499
|
))
|
|
5496
5500
|
return !0;
|
|
5497
5501
|
for (let i = s.length - 1; i > e; i -= 1) {
|
|
@@ -5512,7 +5516,7 @@ function ss(s) {
|
|
|
5512
5516
|
function Ir(s, e, t) {
|
|
5513
5517
|
const n = new Set(
|
|
5514
5518
|
s.filter(
|
|
5515
|
-
(i) => i.role === "user" && e !== null &&
|
|
5519
|
+
(i) => i.role === "user" && e !== null && X(i) === e
|
|
5516
5520
|
).map((i) => i.id)
|
|
5517
5521
|
);
|
|
5518
5522
|
return s.some((i, r) => {
|
|
@@ -5540,11 +5544,11 @@ function Sr(s) {
|
|
|
5540
5544
|
}
|
|
5541
5545
|
function _s(s) {
|
|
5542
5546
|
for (let e = s.length - 1; e >= 0; e -= 1)
|
|
5543
|
-
if (s[e].role === "user" && !
|
|
5547
|
+
if (s[e].role === "user" && !He(s[e]))
|
|
5544
5548
|
return e;
|
|
5545
5549
|
return null;
|
|
5546
5550
|
}
|
|
5547
|
-
function
|
|
5551
|
+
function De(s) {
|
|
5548
5552
|
return F(s) ? !0 : s.role !== "system" ? !1 : s.dataType === "run_error" ? !0 : s.dataType === "run_status" && s.loading !== !0;
|
|
5549
5553
|
}
|
|
5550
5554
|
function ie(s) {
|
|
@@ -5592,8 +5596,8 @@ function Ar(s, e) {
|
|
|
5592
5596
|
return !1;
|
|
5593
5597
|
const r = s.findIndex((o) => o.role === "user" && o.id === i);
|
|
5594
5598
|
return r === -1 ? !1 : s.some((o) => o.respondsToUserMessageId === i) ? s.some(
|
|
5595
|
-
(o) => o.respondsToUserMessageId === i &&
|
|
5596
|
-
) : s.slice(r + 1).some(
|
|
5599
|
+
(o) => o.respondsToUserMessageId === i && De(o)
|
|
5600
|
+
) : s.slice(r + 1).some(De);
|
|
5597
5601
|
}
|
|
5598
5602
|
function ut(s) {
|
|
5599
5603
|
const e = ie(s);
|
|
@@ -5705,21 +5709,21 @@ function Pr(s, e, t, n) {
|
|
|
5705
5709
|
(l) => l.role === "user" && l.id === o
|
|
5706
5710
|
) : null;
|
|
5707
5711
|
return {
|
|
5708
|
-
clientMessageId: a ?
|
|
5712
|
+
clientMessageId: a ? X(a) : o ? null : n,
|
|
5709
5713
|
respondsToUserMessageId: o,
|
|
5710
5714
|
runId: t ?? r?.runId ?? null
|
|
5711
5715
|
};
|
|
5712
5716
|
}
|
|
5713
|
-
function
|
|
5717
|
+
function _e(s) {
|
|
5714
5718
|
return s?.type === "run_status" && s.status === "stopped";
|
|
5715
5719
|
}
|
|
5716
5720
|
function vr(s, e) {
|
|
5717
|
-
return F(e) ? "completed" :
|
|
5721
|
+
return F(e) ? "completed" : _e(s) ? "stopped" : !pe(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
|
|
5718
5722
|
}
|
|
5719
5723
|
function rs(s, e, t) {
|
|
5720
5724
|
const n = new Set(
|
|
5721
5725
|
s.filter(
|
|
5722
|
-
(i) => i.role === "user" && e !== null &&
|
|
5726
|
+
(i) => i.role === "user" && e !== null && X(i) === e
|
|
5723
5727
|
).map((i) => i.id)
|
|
5724
5728
|
);
|
|
5725
5729
|
return s.filter(
|
|
@@ -5855,7 +5859,7 @@ function Br(s, e) {
|
|
|
5855
5859
|
const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
5856
5860
|
if (e !== void 0 && i !== e)
|
|
5857
5861
|
return null;
|
|
5858
|
-
const r = Array.isArray(n.messages) ? n.messages.map(
|
|
5862
|
+
const r = Array.isArray(n.messages) ? n.messages.map(Xr).filter((o) => !!o) : [];
|
|
5859
5863
|
return {
|
|
5860
5864
|
sessionId: i,
|
|
5861
5865
|
messages: r
|
|
@@ -5910,7 +5914,7 @@ function V(s, e) {
|
|
|
5910
5914
|
}
|
|
5911
5915
|
function Us(s, e) {
|
|
5912
5916
|
try {
|
|
5913
|
-
const t = `${
|
|
5917
|
+
const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
|
|
5914
5918
|
...o,
|
|
5915
5919
|
storedAt: Date.now(),
|
|
5916
5920
|
unloadUrl: n,
|
|
@@ -5926,7 +5930,7 @@ function Us(s, e) {
|
|
|
5926
5930
|
}
|
|
5927
5931
|
function ls(s, e) {
|
|
5928
5932
|
try {
|
|
5929
|
-
if (window.sessionStorage.getItem(`${
|
|
5933
|
+
if (window.sessionStorage.getItem(`${Le}${s}`) === null)
|
|
5930
5934
|
return;
|
|
5931
5935
|
} catch {
|
|
5932
5936
|
return;
|
|
@@ -5935,7 +5939,7 @@ function ls(s, e) {
|
|
|
5935
5939
|
}
|
|
5936
5940
|
function $r(s) {
|
|
5937
5941
|
try {
|
|
5938
|
-
const e = `${
|
|
5942
|
+
const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
|
|
5939
5943
|
if (window.sessionStorage.removeItem(e), !t)
|
|
5940
5944
|
return [];
|
|
5941
5945
|
const n = JSON.parse(t);
|
|
@@ -5983,7 +5987,7 @@ function Kr(s, e) {
|
|
|
5983
5987
|
}
|
|
5984
5988
|
function Gr(s) {
|
|
5985
5989
|
try {
|
|
5986
|
-
window.sessionStorage.removeItem(`${
|
|
5990
|
+
window.sessionStorage.removeItem(`${Le}${s}`);
|
|
5987
5991
|
} catch {
|
|
5988
5992
|
return;
|
|
5989
5993
|
}
|
|
@@ -6018,7 +6022,7 @@ function qs(s, e) {
|
|
|
6018
6022
|
} : s;
|
|
6019
6023
|
}
|
|
6020
6024
|
function ft(s) {
|
|
6021
|
-
return s.type ||
|
|
6025
|
+
return s.type || Jr(s.name) || "application/octet-stream";
|
|
6022
6026
|
}
|
|
6023
6027
|
function Qr(s) {
|
|
6024
6028
|
Os({
|
|
@@ -6038,11 +6042,11 @@ function Vr(s) {
|
|
|
6038
6042
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
6039
6043
|
return t >= 0 ? e.slice(t) : "";
|
|
6040
6044
|
}
|
|
6041
|
-
function
|
|
6045
|
+
function Jr(s) {
|
|
6042
6046
|
const e = s.toLowerCase();
|
|
6043
6047
|
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;
|
|
6044
6048
|
}
|
|
6045
|
-
function
|
|
6049
|
+
function Xr(s) {
|
|
6046
6050
|
if (!s || typeof s != "object")
|
|
6047
6051
|
return null;
|
|
6048
6052
|
const e = s;
|
|
@@ -6060,17 +6064,17 @@ function Jr(s) {
|
|
|
6060
6064
|
scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
|
|
6061
6065
|
scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
|
|
6062
6066
|
securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
|
|
6063
|
-
attachments: Ds(e.attachments)?.map(
|
|
6067
|
+
attachments: Ds(e.attachments)?.map(qe),
|
|
6064
6068
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
6065
6069
|
};
|
|
6066
6070
|
}
|
|
6067
6071
|
function Yr(s) {
|
|
6068
6072
|
return s.attachments?.length ? {
|
|
6069
6073
|
...s,
|
|
6070
|
-
attachments: s.attachments.map(
|
|
6074
|
+
attachments: s.attachments.map(qe)
|
|
6071
6075
|
} : s;
|
|
6072
6076
|
}
|
|
6073
|
-
function
|
|
6077
|
+
function qe(s) {
|
|
6074
6078
|
const {
|
|
6075
6079
|
dataUrl: e,
|
|
6076
6080
|
objectUrl: t,
|
|
@@ -6104,7 +6108,7 @@ function xs(s) {
|
|
|
6104
6108
|
return e;
|
|
6105
6109
|
}
|
|
6106
6110
|
function Rt(s, e) {
|
|
6107
|
-
return Fs(s) ?
|
|
6111
|
+
return Fs(s) ? Be : W(xe(e), oi);
|
|
6108
6112
|
}
|
|
6109
6113
|
function eo(s, e) {
|
|
6110
6114
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
@@ -6175,11 +6179,11 @@ function ds(s) {
|
|
|
6175
6179
|
return s;
|
|
6176
6180
|
const e = s.trim();
|
|
6177
6181
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
6178
|
-
return
|
|
6182
|
+
return xe(s);
|
|
6179
6183
|
try {
|
|
6180
6184
|
return JSON.stringify(L(JSON.parse(s)));
|
|
6181
6185
|
} catch {
|
|
6182
|
-
return
|
|
6186
|
+
return xe(s);
|
|
6183
6187
|
}
|
|
6184
6188
|
}
|
|
6185
6189
|
function Ls(s) {
|
|
@@ -6236,13 +6240,13 @@ function W(s, e = Tt) {
|
|
|
6236
6240
|
function nt(s) {
|
|
6237
6241
|
return `${s}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
6238
6242
|
}
|
|
6239
|
-
class
|
|
6243
|
+
class Pe extends Error {
|
|
6240
6244
|
constructor(e, t) {
|
|
6241
6245
|
super(`${e} (${t})`), this.status = t, this.name = "AttachmentUploadHttpError";
|
|
6242
6246
|
}
|
|
6243
6247
|
status;
|
|
6244
6248
|
}
|
|
6245
|
-
async function
|
|
6249
|
+
async function be(s, e) {
|
|
6246
6250
|
let t = null;
|
|
6247
6251
|
for (let n = 0; n < zt; n += 1)
|
|
6248
6252
|
try {
|
|
@@ -6260,7 +6264,7 @@ function lo(s) {
|
|
|
6260
6264
|
});
|
|
6261
6265
|
}
|
|
6262
6266
|
function co(s) {
|
|
6263
|
-
return s instanceof
|
|
6267
|
+
return s instanceof Pe ? uo(s.status) : s instanceof TypeError;
|
|
6264
6268
|
}
|
|
6265
6269
|
function uo(s) {
|
|
6266
6270
|
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
@@ -6268,13 +6272,13 @@ function uo(s) {
|
|
|
6268
6272
|
function ho(s) {
|
|
6269
6273
|
return s === 401 || s === 403;
|
|
6270
6274
|
}
|
|
6271
|
-
const
|
|
6275
|
+
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", po = "[REDACTED_SIGNED_URL]", go = 20, fo = /^(access_token|accessToken|refresh_token|refreshToken|id_token|idToken|authToken|token|api_key|apiKey|apikey|key|secret|signature|sig|password|passwd|pwd|code|state|session|jwt|csrf|csrfToken|xsrf|xsrfToken)$/i, Ns = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Hs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Bs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ws = /\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, mo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, yo = /\bhttps?:\/\/[^\s"'<>]+/gi, Io = /[),.;\]]+$/;
|
|
6272
6276
|
function L(s) {
|
|
6273
|
-
return
|
|
6277
|
+
return Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6274
6278
|
}
|
|
6275
|
-
function
|
|
6279
|
+
function Oe(s, e, t) {
|
|
6276
6280
|
if (typeof s == "string")
|
|
6277
|
-
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s :
|
|
6281
|
+
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
|
|
6278
6282
|
if (s === null || typeof s != "object")
|
|
6279
6283
|
return s;
|
|
6280
6284
|
if (e >= go)
|
|
@@ -6282,10 +6286,10 @@ function qe(s, e, t) {
|
|
|
6282
6286
|
if (t.has(s))
|
|
6283
6287
|
return "[REDACTED_CIRCULAR]";
|
|
6284
6288
|
if (t.add(s), Array.isArray(s))
|
|
6285
|
-
return s.map((i) =>
|
|
6289
|
+
return s.map((i) => Oe(i, e + 1, t));
|
|
6286
6290
|
const n = {};
|
|
6287
6291
|
for (const [i, r] of Object.entries(s))
|
|
6288
|
-
i === "pageContent" ? n[i] = r : Fs(i) ? n[i] =
|
|
6292
|
+
i === "pageContent" ? n[i] = r : Fs(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? So(r) : Oe(r, e + 1, t);
|
|
6289
6293
|
return n;
|
|
6290
6294
|
}
|
|
6291
6295
|
function Fs(s) {
|
|
@@ -6293,7 +6297,7 @@ function Fs(s) {
|
|
|
6293
6297
|
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");
|
|
6294
6298
|
}
|
|
6295
6299
|
function So(s) {
|
|
6296
|
-
return typeof s == "string" ? $s(s) :
|
|
6300
|
+
return typeof s == "string" ? $s(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6297
6301
|
}
|
|
6298
6302
|
function $s(s) {
|
|
6299
6303
|
try {
|
|
@@ -6305,21 +6309,21 @@ function $s(s) {
|
|
|
6305
6309
|
return To(s);
|
|
6306
6310
|
}
|
|
6307
6311
|
}
|
|
6308
|
-
function
|
|
6309
|
-
return s.replace(mo, po).replace(yo, wo).replace(Ns, `Bearer ${$}`).replace(Hs, `Basic ${$}`).replace(Bs, $).replace(Ws, (e, t) => `${t}: ${
|
|
6312
|
+
function xe(s) {
|
|
6313
|
+
return s.replace(mo, po).replace(yo, wo).replace(Ns, `Bearer ${$}`).replace(Hs, `Basic ${$}`).replace(Bs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6310
6314
|
}
|
|
6311
6315
|
function To(s) {
|
|
6312
|
-
return s.replace(Ns, `Bearer ${$}`).replace(Hs, `Basic ${$}`).replace(Bs, $).replace(Ws, (e, t) => `${t}: ${
|
|
6316
|
+
return s.replace(Ns, `Bearer ${$}`).replace(Hs, `Basic ${$}`).replace(Bs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6313
6317
|
}
|
|
6314
6318
|
function wo(s) {
|
|
6315
6319
|
const e = s.match(Io)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
6316
6320
|
return `${$s(t)}${e}`;
|
|
6317
6321
|
}
|
|
6318
6322
|
const Po = Object.freeze({
|
|
6319
|
-
init: (s) =>
|
|
6323
|
+
init: (s) => Ne.init(s)
|
|
6320
6324
|
});
|
|
6321
6325
|
function vo(s) {
|
|
6322
|
-
return
|
|
6326
|
+
return Ne.init(s);
|
|
6323
6327
|
}
|
|
6324
6328
|
export {
|
|
6325
6329
|
Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
@@ -6331,13 +6335,13 @@ export {
|
|
|
6331
6335
|
kn as ProductAgentInteractionManager,
|
|
6332
6336
|
xt as ProductAgentQueryController,
|
|
6333
6337
|
Co as ProductAgentRemoteRuntimeClient,
|
|
6334
|
-
|
|
6338
|
+
Ne as ProductAgentSessionEngine,
|
|
6335
6339
|
Mn as ProductAgentSessionHistoryManager,
|
|
6336
6340
|
Ro as ProductAgentTaskPageTitleController,
|
|
6337
|
-
|
|
6341
|
+
J as ProductAgentTokenProviderError,
|
|
6338
6342
|
hi as calculateReconnectDelay,
|
|
6339
6343
|
bo as createLocalStorageInteractionDecisionStorage,
|
|
6340
|
-
|
|
6344
|
+
ke as createProductAgentQueryState,
|
|
6341
6345
|
vo as createProductAgentRuntime,
|
|
6342
6346
|
ko as createProductAgentTaskPageTitleDocument,
|
|
6343
6347
|
Po as default,
|
|
@@ -6345,7 +6349,7 @@ export {
|
|
|
6345
6349
|
Ni as getProductAgentOriginAccessErrorMessage,
|
|
6346
6350
|
Eo as isProductAgentRuntimeCommand,
|
|
6347
6351
|
Tn as mergeProductAgentEntityPages,
|
|
6348
|
-
|
|
6352
|
+
Ee as normalizeProductAgentEntityPage,
|
|
6349
6353
|
st as normalizeProductAgentSessionItems,
|
|
6350
6354
|
En as readLocalStorageInteractionDecisions,
|
|
6351
6355
|
Mo as resolveProductAgentComposerAction,
|