@pluno/product-agent-web 0.1.211 → 0.1.214
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 +1 -0
- package/dist/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +61 -43
- package/dist/product-agent-sdk.js +166 -145
- package/dist/product-agent-widget.js +1978 -1921
- package/dist/runtimeClient.d.ts +4 -0
- package/dist/uiInvariants.d.ts +4 -0
- package/package.json +1 -1
|
@@ -344,7 +344,7 @@ function mn(s, e, t) {
|
|
|
344
344
|
for (const h of s) {
|
|
345
345
|
const p = t(h);
|
|
346
346
|
let y = o.get(p.id);
|
|
347
|
-
if (p.isOptimistic && p.optimisticKey ? y = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? y = l.get(p.assistantDraftKey) : p.isActivity && (y = p.activityKeys?.map((
|
|
347
|
+
if (p.isOptimistic && p.optimisticKey ? y = a.get(p.optimisticKey) : p.isAssistantDraft && p.assistantDraftKey ? y = l.get(p.assistantDraftKey) : p.isActivity && (y = p.activityKeys?.map((b) => c.get(b)).find((b) => b !== void 0) ?? y), y && !g.has(y)) {
|
|
348
348
|
f.push(y), g.add(y);
|
|
349
349
|
continue;
|
|
350
350
|
}
|
|
@@ -431,13 +431,13 @@ function An() {
|
|
|
431
431
|
}
|
|
432
432
|
function ys() {
|
|
433
433
|
return {
|
|
434
|
-
storage:
|
|
435
|
-
channel:
|
|
434
|
+
storage: bn(),
|
|
435
|
+
channel: Mn(),
|
|
436
436
|
randomUUID: () => crypto.randomUUID(),
|
|
437
437
|
settle: () => new Promise((s) => Sn(s, In))
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function bn() {
|
|
441
441
|
return {
|
|
442
442
|
getItem: (s) => {
|
|
443
443
|
try {
|
|
@@ -455,7 +455,7 @@ function Mn() {
|
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Mn() {
|
|
459
459
|
if (typeof BroadcastChannel < "u") {
|
|
460
460
|
const s = new BroadcastChannel(yn);
|
|
461
461
|
return {
|
|
@@ -491,7 +491,7 @@ function Rn() {
|
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
const Is = "schedule_follow_up";
|
|
494
|
-
function
|
|
494
|
+
function kn(s) {
|
|
495
495
|
let e = s;
|
|
496
496
|
if (typeof e == "string")
|
|
497
497
|
try {
|
|
@@ -507,7 +507,7 @@ function En(s) {
|
|
|
507
507
|
dueAt: t.dueAt
|
|
508
508
|
};
|
|
509
509
|
}
|
|
510
|
-
const
|
|
510
|
+
const En = [
|
|
511
511
|
{ value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
|
|
512
512
|
{ value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
|
|
513
513
|
{ value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
|
|
@@ -515,7 +515,7 @@ const kn = [
|
|
|
515
515
|
{ value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
|
|
516
516
|
{ value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
|
|
517
517
|
], _n = [
|
|
518
|
-
...
|
|
518
|
+
...En,
|
|
519
519
|
...Cn
|
|
520
520
|
], Qe = (s) => _n.some((e) => e.value === s);
|
|
521
521
|
function Lt(s, e) {
|
|
@@ -543,7 +543,7 @@ function Ts(s, e) {
|
|
|
543
543
|
function ws(s, e) {
|
|
544
544
|
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;
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function ke(s) {
|
|
547
547
|
return {
|
|
548
548
|
key: s,
|
|
549
549
|
status: "not_requested",
|
|
@@ -555,7 +555,7 @@ function Ee(s) {
|
|
|
555
555
|
}
|
|
556
556
|
class Ht {
|
|
557
557
|
constructor(e, t, n = (i, r) => r) {
|
|
558
|
-
this.loader = t, this.merge = n, this.state =
|
|
558
|
+
this.loader = t, this.merge = n, this.state = ke(e);
|
|
559
559
|
}
|
|
560
560
|
loader;
|
|
561
561
|
merge;
|
|
@@ -570,10 +570,10 @@ class Ht {
|
|
|
570
570
|
return this.listeners.add(e), e(this.state), () => this.listeners.delete(e);
|
|
571
571
|
}
|
|
572
572
|
setKey(e) {
|
|
573
|
-
e !== this.state.key && (this.state =
|
|
573
|
+
e !== this.state.key && (this.state = ke(e), this.trailingLoad = null, this.publish());
|
|
574
574
|
}
|
|
575
575
|
reset() {
|
|
576
|
-
this.state =
|
|
576
|
+
this.state = ke(this.state.key), this.trailingLoad = null, this.publish();
|
|
577
577
|
}
|
|
578
578
|
invalidate() {
|
|
579
579
|
this.state = {
|
|
@@ -628,7 +628,7 @@ class Ht {
|
|
|
628
628
|
for (const e of this.listeners) e(this.state);
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
function
|
|
631
|
+
function Ee(s) {
|
|
632
632
|
const e = {}, t = [];
|
|
633
633
|
for (const n of s.entities)
|
|
634
634
|
e[n.id] || t.push(n.id), e[n.id] = n;
|
|
@@ -673,7 +673,7 @@ class qn {
|
|
|
673
673
|
constructor(e, t, n = 20) {
|
|
674
674
|
this.loadPage = t, this.limit = n, this.recentQuery = new Ht(
|
|
675
675
|
`${e}:recent`,
|
|
676
|
-
async ({ cursor: i }) =>
|
|
676
|
+
async ({ cursor: i }) => Ee(
|
|
677
677
|
await this.loadPage({ cursor: i, limit: this.limit, pinned: !1 }).then((r) => ({
|
|
678
678
|
entities: r.sessions,
|
|
679
679
|
nextCursor: r.nextCursor
|
|
@@ -682,7 +682,7 @@ class qn {
|
|
|
682
682
|
vn
|
|
683
683
|
), this.pinnedQuery = new Ht(
|
|
684
684
|
`${e}:pinned`,
|
|
685
|
-
async () =>
|
|
685
|
+
async () => Ee({
|
|
686
686
|
entities: await this.loadAllPinned(),
|
|
687
687
|
nextCursor: null
|
|
688
688
|
})
|
|
@@ -706,7 +706,7 @@ class qn {
|
|
|
706
706
|
...Ie(e.data)
|
|
707
707
|
], i = new Map(n.map((l) => [l.id, l])), r = Array.from(i.values()).map(
|
|
708
708
|
(l) => this.applyOverrides(l, this.completedRefreshSequence)
|
|
709
|
-
), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ?
|
|
709
|
+
), o = Array.from(this.optimisticEntities.values()).filter((l) => !i.has(l.id)).reverse(), a = e.data || t.data || o.length > 0 ? Ee({
|
|
710
710
|
entities: [...o, ...r],
|
|
711
711
|
nextCursor: e.data?.nextCursor ?? null
|
|
712
712
|
}) : null;
|
|
@@ -973,7 +973,7 @@ class Ln {
|
|
|
973
973
|
async applyAction(e, t, n) {
|
|
974
974
|
if (!e.allowedActions.includes(t))
|
|
975
975
|
throw new Error(`Interaction ${e.key} does not allow ${t}.`);
|
|
976
|
-
if (!
|
|
976
|
+
if (!bs(t))
|
|
977
977
|
throw new Error(`Interaction action ${t} is not a persistence decision.`);
|
|
978
978
|
const i = n.now ?? /* @__PURE__ */ new Date(), r = {
|
|
979
979
|
promptKey: e.key,
|
|
@@ -1024,13 +1024,13 @@ function Nn(s, e) {
|
|
|
1024
1024
|
function Je(s) {
|
|
1025
1025
|
return `${s.level}:${s.key}`;
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function bs(s) {
|
|
1028
1028
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
1029
1029
|
}
|
|
1030
1030
|
function ot(s) {
|
|
1031
1031
|
if (!s || typeof s != "object") return !1;
|
|
1032
1032
|
const e = s;
|
|
1033
|
-
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") &&
|
|
1033
|
+
return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && bs(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
|
|
1034
1034
|
}
|
|
1035
1035
|
const Hn = {
|
|
1036
1036
|
working: "⏳",
|
|
@@ -1109,7 +1109,9 @@ const Wn = {
|
|
|
1109
1109
|
"foreign-session-item-visible": "The visible transcript contains state owned by another session.",
|
|
1110
1110
|
"terminal-response-reactivated": "A terminal response became active again.",
|
|
1111
1111
|
"terminal-history-not-append-only": "An established terminal outcome disappeared or changed order.",
|
|
1112
|
-
"runtime-transcript-not-rendered": "A nonempty runtime transcript is displaying starter prompts."
|
|
1112
|
+
"runtime-transcript-not-rendered": "A nonempty runtime transcript is displaying starter prompts.",
|
|
1113
|
+
"thinking-groups-without-user-message": "Multiple thinking groups appeared without a user message between them.",
|
|
1114
|
+
"thinking-without-progress": "Thinking remained visible without progress for five minutes."
|
|
1113
1115
|
};
|
|
1114
1116
|
function $n(s) {
|
|
1115
1117
|
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Wn, s.slice(13));
|
|
@@ -1150,7 +1152,7 @@ function Bo(s) {
|
|
|
1150
1152
|
case "conversation.fail_staged":
|
|
1151
1153
|
return typeof e.clientMessageId == "string" && typeof e.message == "string";
|
|
1152
1154
|
case "conversation.send":
|
|
1153
|
-
return typeof e.content == "string" && typeof e.clientMessageId == "string" && (e.attachments === void 0 || Array.isArray(e.attachments));
|
|
1155
|
+
return typeof e.content == "string" && typeof e.clientMessageId == "string" && (e.automationOnboarding === void 0 || typeof e.automationOnboarding == "boolean") && (e.attachments === void 0 || Array.isArray(e.attachments));
|
|
1154
1156
|
default:
|
|
1155
1157
|
return !1;
|
|
1156
1158
|
}
|
|
@@ -1166,11 +1168,12 @@ class Fo {
|
|
|
1166
1168
|
interactionListeners = /* @__PURE__ */ new Set();
|
|
1167
1169
|
accountListeners = /* @__PURE__ */ new Set();
|
|
1168
1170
|
state;
|
|
1169
|
-
sessionHistoryState =
|
|
1171
|
+
sessionHistoryState = ke("unavailable");
|
|
1170
1172
|
model;
|
|
1171
1173
|
interactions = [];
|
|
1172
1174
|
account = null;
|
|
1173
1175
|
stagedProactiveSuggestionClientMessageId = null;
|
|
1176
|
+
unacknowledgedSubmissions = /* @__PURE__ */ new Map();
|
|
1174
1177
|
operationQueue = Promise.resolve();
|
|
1175
1178
|
destroyed = !1;
|
|
1176
1179
|
on(e, t) {
|
|
@@ -1182,7 +1185,17 @@ class Fo {
|
|
|
1182
1185
|
}
|
|
1183
1186
|
updateProjection(e, t, n, i, r) {
|
|
1184
1187
|
if (!this.destroyed) {
|
|
1185
|
-
|
|
1188
|
+
this.state = Xe(e);
|
|
1189
|
+
for (const [o, a] of this.unacknowledgedSubmissions) {
|
|
1190
|
+
if (e.user?.id !== a.userId || a.sessionId !== null && e.sessionId !== a.sessionId || e.messages.some(
|
|
1191
|
+
(l) => l.clientMessageId === o
|
|
1192
|
+
)) {
|
|
1193
|
+
this.unacknowledgedSubmissions.delete(o);
|
|
1194
|
+
continue;
|
|
1195
|
+
}
|
|
1196
|
+
a.sessionId ??= e.sessionId, this.state.messages.push(a.message), this.state.pendingMessageStatus = "sending", this.state.turnPhase ??= "sending", this.state.taskStatus ??= "working";
|
|
1197
|
+
}
|
|
1198
|
+
if (t !== void 0 && (this.model = t), n) {
|
|
1186
1199
|
this.sessionHistoryState = Ft(n);
|
|
1187
1200
|
for (const o of this.sessionHistoryListeners)
|
|
1188
1201
|
o(this.getSessionHistoryState());
|
|
@@ -1203,7 +1216,7 @@ class Fo {
|
|
|
1203
1216
|
}
|
|
1204
1217
|
destroy() {
|
|
1205
1218
|
if (!this.destroyed) {
|
|
1206
|
-
this.destroyed = !0, this.attachmentFiles.clear(), this.sessionHistoryListeners.clear(), this.interactionListeners.clear(), this.accountListeners.clear();
|
|
1219
|
+
this.destroyed = !0, this.unacknowledgedSubmissions.clear(), this.attachmentFiles.clear(), this.sessionHistoryListeners.clear(), this.interactionListeners.clear(), this.accountListeners.clear();
|
|
1207
1220
|
for (const e of Object.values(this.listeners)) e?.clear();
|
|
1208
1221
|
this.adapter.onDisconnect?.();
|
|
1209
1222
|
}
|
|
@@ -1243,7 +1256,11 @@ class Fo {
|
|
|
1243
1256
|
...i.length > 0 ? { attachments: i } : {},
|
|
1244
1257
|
clientMessageId: r
|
|
1245
1258
|
};
|
|
1246
|
-
return this.
|
|
1259
|
+
return this.unacknowledgedSubmissions.set(r, {
|
|
1260
|
+
message: { ...l, attachments: l.attachments?.map((c) => ({ ...c })) },
|
|
1261
|
+
sessionId: a.sessionId,
|
|
1262
|
+
userId: a.user?.id
|
|
1263
|
+
}), this.state = {
|
|
1247
1264
|
...this.state,
|
|
1248
1265
|
messages: [...this.state.messages, l],
|
|
1249
1266
|
pendingMessageStatus: "sending",
|
|
@@ -1290,13 +1307,14 @@ class Fo {
|
|
|
1290
1307
|
initiatedBy: t.initiatedBy,
|
|
1291
1308
|
invocation: t.invocation,
|
|
1292
1309
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
1310
|
+
...t.automationOnboarding ? { automationOnboarding: !0 } : {},
|
|
1293
1311
|
attachments: o.length > 0 ? o : void 0
|
|
1294
1312
|
});
|
|
1295
1313
|
for (const c of t.attachments ?? [])
|
|
1296
1314
|
c.id && this.attachmentFiles.delete(c.id);
|
|
1297
1315
|
return r === this.stagedProactiveSuggestionClientMessageId && (this.stagedProactiveSuggestionClientMessageId = null), l?.clientMessageId ?? r;
|
|
1298
1316
|
} catch (l) {
|
|
1299
|
-
throw this.state = {
|
|
1317
|
+
throw this.unacknowledgedSubmissions.delete(r), this.state = {
|
|
1300
1318
|
...this.state,
|
|
1301
1319
|
messages: this.state.messages.filter(
|
|
1302
1320
|
(c) => c.id !== `local-${r}` && c.id !== `optimistic-user-message:${r}`
|
|
@@ -1332,11 +1350,11 @@ class Fo {
|
|
|
1332
1350
|
};
|
|
1333
1351
|
}
|
|
1334
1352
|
stop() {
|
|
1335
|
-
return this.dispatch({ type: "run.stop" }).then(() => {
|
|
1353
|
+
return this.unacknowledgedSubmissions.clear(), this.dispatch({ type: "run.stop" }).then(() => {
|
|
1336
1354
|
});
|
|
1337
1355
|
}
|
|
1338
1356
|
startNewSession(e = {}) {
|
|
1339
|
-
return e.notifyTransport === !1 ? Promise.resolve() : this.dispatch({ type: "session.new" }).then(() => {
|
|
1357
|
+
return this.unacknowledgedSubmissions.clear(), e.notifyTransport === !1 ? Promise.resolve() : this.dispatch({ type: "session.new" }).then(() => {
|
|
1340
1358
|
});
|
|
1341
1359
|
}
|
|
1342
1360
|
async listSessions(e = {}) {
|
|
@@ -1396,7 +1414,7 @@ class Fo {
|
|
|
1396
1414
|
return Promise.resolve();
|
|
1397
1415
|
}
|
|
1398
1416
|
loadSession(e) {
|
|
1399
|
-
return this.dispatch({ type: "session.load", sessionId: e }).then(() => {
|
|
1417
|
+
return this.unacknowledgedSubmissions.clear(), this.dispatch({ type: "session.load", sessionId: e }).then(() => {
|
|
1400
1418
|
});
|
|
1401
1419
|
}
|
|
1402
1420
|
stageProactiveSuggestionQuestion(e) {
|
|
@@ -1454,7 +1472,7 @@ function Xe(s) {
|
|
|
1454
1472
|
function Ft(s) {
|
|
1455
1473
|
return {
|
|
1456
1474
|
...s,
|
|
1457
|
-
data: s.data ?
|
|
1475
|
+
data: s.data ? Ee({
|
|
1458
1476
|
entities: As(s.data).map((e) => ({ ...e })),
|
|
1459
1477
|
nextCursor: s.data.nextCursor
|
|
1460
1478
|
}) : null
|
|
@@ -1563,14 +1581,14 @@ class Te extends Error {
|
|
|
1563
1581
|
function Xn(s) {
|
|
1564
1582
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
1565
1583
|
}
|
|
1566
|
-
const Yn = "https://app.pluno.ai", Zn = 2e4, ei = 1e4, ti = 6e4, si = 6e4, ni = 1e4, ii = 1e4, ri = 3e3, oi = 3e4, ai = 1e3, at = 3e4, jt = 0.2, li = 6e4, zt = 15e3, ci = 6e4, ui = 8, di = "Browser connection was interrupted.", Kt = 15e3, hi = "Pluno could not send this message. Try it again.", pi = "Still connecting to Pluno. Retrying automatically.", gi = 2e3, fi = 1e3, mi = 100, Gt = 8e3, Vt = 3, yi = [300, 1e3],
|
|
1584
|
+
const Yn = "https://app.pluno.ai", Zn = 2e4, ei = 1e4, ti = 6e4, si = 6e4, ni = 1e4, ii = 1e4, ri = 3e3, oi = 3e4, ai = 1e3, at = 3e4, jt = 0.2, li = 6e4, zt = 15e3, ci = 6e4, ui = 8, di = "Browser connection was interrupted.", Kt = 15e3, hi = "Pluno could not send this message. Try it again.", pi = "Still connecting to Pluno. Retrying automatically.", gi = 2e3, fi = 1e3, mi = 100, Gt = 8e3, Vt = 3, yi = [300, 1e3], Ms = 50 * 1024 * 1024, Ii = /* @__PURE__ */ new Set([
|
|
1567
1585
|
".jpeg:image/jpeg",
|
|
1568
1586
|
".jpg:image/jpeg",
|
|
1569
1587
|
".pdf:application/pdf",
|
|
1570
1588
|
".png:image/png",
|
|
1571
1589
|
".webp:image/webp"
|
|
1572
|
-
]), Wo = ".pdf,.png,.jpg,.jpeg,.webp", wt = 64e3, Ye = 4e3, At = 30, Si = 2e3, Ti = 1e3, Rs = "Image is too large for model vision input.", wi = 100, Ai = 20,
|
|
1573
|
-
function
|
|
1590
|
+
]), Wo = ".pdf,.png,.jpg,.jpeg,.webp", wt = 64e3, Ye = 4e3, At = 30, Si = 2e3, Ti = 1e3, Rs = "Image is too large for model vision input.", wi = 100, Ai = 20, ks = "pluno.productAgent.state.", lt = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", bi = 100;
|
|
1591
|
+
function Mi(s, e = 0) {
|
|
1574
1592
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
1575
1593
|
return Math.max(e, t);
|
|
1576
1594
|
}
|
|
@@ -1580,7 +1598,7 @@ function Ri(s, e = Math.random) {
|
|
|
1580
1598
|
const t = Math.min(at, ai * 2 ** s), n = 1 - jt + e() * jt * 2;
|
|
1581
1599
|
return Math.min(at, Math.round(t * n));
|
|
1582
1600
|
}
|
|
1583
|
-
function
|
|
1601
|
+
function ki(s) {
|
|
1584
1602
|
const e = s.split(".")[1];
|
|
1585
1603
|
if (!e)
|
|
1586
1604
|
return null;
|
|
@@ -1591,7 +1609,7 @@ function Ei(s) {
|
|
|
1591
1609
|
return null;
|
|
1592
1610
|
}
|
|
1593
1611
|
}
|
|
1594
|
-
function
|
|
1612
|
+
function Ei(s) {
|
|
1595
1613
|
if (s instanceof J)
|
|
1596
1614
|
return s.retryable;
|
|
1597
1615
|
if (s && typeof s == "object") {
|
|
@@ -1841,7 +1859,7 @@ class Ne {
|
|
|
1841
1859
|
}, n);
|
|
1842
1860
|
try {
|
|
1843
1861
|
on().catch((r) => {
|
|
1844
|
-
|
|
1862
|
+
M("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
1845
1863
|
message: r instanceof Error ? r.message : String(r)
|
|
1846
1864
|
});
|
|
1847
1865
|
}), t.disableNetworkCapture || i.enableNetworkCapture(), i.startPageLifecycleRecovery(), i.startStarterPromptUrlWatcher(), e.autoConnect !== !1 && await i.connect();
|
|
@@ -1912,7 +1930,7 @@ class Ne {
|
|
|
1912
1930
|
throw new J("Pluno token request was cancelled", !0);
|
|
1913
1931
|
if (!c)
|
|
1914
1932
|
throw new J("Pluno token provider did not return a token", !1);
|
|
1915
|
-
return this.token = c, this.tokenExpiresAtMs =
|
|
1933
|
+
return this.token = c, this.tokenExpiresAtMs = ki(c), c;
|
|
1916
1934
|
} finally {
|
|
1917
1935
|
a !== null && window.clearTimeout(a);
|
|
1918
1936
|
}
|
|
@@ -1940,9 +1958,9 @@ class Ne {
|
|
|
1940
1958
|
throw new J("Pluno requires a token or tokenProvider", !1);
|
|
1941
1959
|
const t = Yi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
1942
1960
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
1943
|
-
this.socket === n && n.readyState === WebSocket.CONNECTING && (
|
|
1961
|
+
this.socket === n && n.readyState === WebSocket.CONNECTING && (M("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
1944
1962
|
}, ni), n.addEventListener("open", () => {
|
|
1945
|
-
this.socket !== n || (this.clearSocketConnectTimer(),
|
|
1963
|
+
this.socket !== n || (this.clearSocketConnectTimer(), M("web-sdk.agent", "Pluno socket opened", {
|
|
1946
1964
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1947
1965
|
isThinking: this.state.isThinking
|
|
1948
1966
|
}), !(this.token ? this.sendNow({
|
|
@@ -1952,7 +1970,7 @@ class Ne {
|
|
|
1952
1970
|
transportId: this.transportIdentity.transportId,
|
|
1953
1971
|
pageUrl: location.href
|
|
1954
1972
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
1955
|
-
this.socket === n && (
|
|
1973
|
+
this.socket === n && (M("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
1956
1974
|
}, ii));
|
|
1957
1975
|
}), n.addEventListener("message", (i) => {
|
|
1958
1976
|
this.socket === n && this.handleServerEvent(ar(i.data));
|
|
@@ -1964,7 +1982,7 @@ class Ne {
|
|
|
1964
1982
|
(o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
|
|
1965
1983
|
) && (this.queuedClientEvents.push(r), Q(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();
|
|
1966
1984
|
}), n.addEventListener("close", (i) => {
|
|
1967
|
-
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (
|
|
1985
|
+
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (M("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
1968
1986
|
code: typeof i?.code == "number" ? i.code : null,
|
|
1969
1987
|
reason: typeof i?.reason == "string" ? i.reason : "",
|
|
1970
1988
|
wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : null,
|
|
@@ -1975,7 +1993,7 @@ class Ne {
|
|
|
1975
1993
|
wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : void 0
|
|
1976
1994
|
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
1977
1995
|
}), n.addEventListener("error", () => {
|
|
1978
|
-
this.socket !== n || this.state.status === "closed" || (
|
|
1996
|
+
this.socket !== n || this.state.status === "closed" || (M("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
1979
1997
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1980
1998
|
isThinking: this.state.isThinking
|
|
1981
1999
|
}), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
|
|
@@ -1984,8 +2002,8 @@ class Ne {
|
|
|
1984
2002
|
if (e !== this.connectionAttemptId || this.state.status === "closed")
|
|
1985
2003
|
return;
|
|
1986
2004
|
const n = Ci(t);
|
|
1987
|
-
if (
|
|
1988
|
-
|
|
2005
|
+
if (Ei(t)) {
|
|
2006
|
+
M("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
1989
2007
|
message: n.message,
|
|
1990
2008
|
reconnectAttempt: this.reconnectAttempts
|
|
1991
2009
|
}), t instanceof J && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
@@ -2061,7 +2079,7 @@ class Ne {
|
|
|
2061
2079
|
if (this.options.productVariant === "customer_embedded" && (i.forEach(Hs), i.reduce(
|
|
2062
2080
|
(T, N) => T + N.sizeBytes,
|
|
2063
2081
|
0
|
|
2064
|
-
) >
|
|
2082
|
+
) > Ms))
|
|
2065
2083
|
throw new Error("Embedded attachments must total at most 50 MB per message");
|
|
2066
2084
|
let r = i.map(qe);
|
|
2067
2085
|
if (!n && r.length === 0)
|
|
@@ -2082,7 +2100,7 @@ class Ne {
|
|
|
2082
2100
|
content: n,
|
|
2083
2101
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2084
2102
|
...i.length > 0 ? { attachments: i } : {}
|
|
2085
|
-
}, g = this.state.messages.some((S) => S.id === d.id || S.clientMessageId === a), f = this.state.isThinking, h = this.state.taskStatus, p = this.state.pendingMessageStatus, y = this.state.turnPhase, m = this.state.messages,
|
|
2103
|
+
}, g = this.state.messages.some((S) => S.id === d.id || S.clientMessageId === a), f = this.state.isThinking, h = this.state.taskStatus, p = this.state.pendingMessageStatus, y = this.state.turnPhase, m = this.state.messages, b = g ? this.state.messages : [
|
|
2086
2104
|
...this.state.messages.map(
|
|
2087
2105
|
(S) => c && S.id === c.id ? {
|
|
2088
2106
|
...S,
|
|
@@ -2100,7 +2118,7 @@ class Ne {
|
|
|
2100
2118
|
lastError: this.state.lastError
|
|
2101
2119
|
};
|
|
2102
2120
|
this.setState({
|
|
2103
|
-
messages:
|
|
2121
|
+
messages: b,
|
|
2104
2122
|
...f ? {} : {
|
|
2105
2123
|
assistantDraft: "",
|
|
2106
2124
|
assistantDraftItemId: null,
|
|
@@ -2158,11 +2176,14 @@ class Ne {
|
|
|
2158
2176
|
entrySurface: this.options.entrySurface,
|
|
2159
2177
|
content: n,
|
|
2160
2178
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
2161
|
-
pageContent: D &&
|
|
2179
|
+
pageContent: D && bt() || void 0,
|
|
2162
2180
|
attachments: r.length > 0 ? r.map(qe) : void 0,
|
|
2163
2181
|
page: o,
|
|
2164
2182
|
model: this.options.model,
|
|
2165
|
-
metadata:
|
|
2183
|
+
metadata: {
|
|
2184
|
+
...Qt(this.options.metadata),
|
|
2185
|
+
...t.automationOnboarding ? { automationOnboarding: !0 } : {}
|
|
2186
|
+
}
|
|
2166
2187
|
};
|
|
2167
2188
|
return t.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = H, this.stagedProactiveSuggestionQuestionMessageId = null, this.send(H), this.schedulePendingDeliveryAck(a), a;
|
|
2168
2189
|
} });
|
|
@@ -2226,7 +2247,7 @@ class Ne {
|
|
|
2226
2247
|
createdAt: i,
|
|
2227
2248
|
lastUsedAt: i
|
|
2228
2249
|
}).catch((r) => {
|
|
2229
|
-
|
|
2250
|
+
M("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
2230
2251
|
attachmentId: t,
|
|
2231
2252
|
name: n.name,
|
|
2232
2253
|
message: r instanceof Error ? r.message : String(r)
|
|
@@ -2259,16 +2280,16 @@ class Ne {
|
|
|
2259
2280
|
};
|
|
2260
2281
|
let o;
|
|
2261
2282
|
if (this.options.persistAttachmentUpload)
|
|
2262
|
-
o = await
|
|
2283
|
+
o = await Me(
|
|
2263
2284
|
() => this.options.persistAttachmentUpload(r, e),
|
|
2264
2285
|
"Failed to upload attachment"
|
|
2265
2286
|
);
|
|
2266
2287
|
else {
|
|
2267
|
-
const l = this.options.prepareAttachmentUpload ? await
|
|
2288
|
+
const l = this.options.prepareAttachmentUpload ? await Me(
|
|
2268
2289
|
() => this.options.prepareAttachmentUpload(r),
|
|
2269
2290
|
"Failed to prepare attachment upload"
|
|
2270
2291
|
) : await this.prepareEmbedAttachmentUpload(r);
|
|
2271
|
-
await
|
|
2292
|
+
await Me(async () => {
|
|
2272
2293
|
const c = await fetch(new URL(l.uploadUrl, this.options.backendUrl), {
|
|
2273
2294
|
method: l.uploadMethod,
|
|
2274
2295
|
headers: l.uploadHeaders,
|
|
@@ -2288,7 +2309,7 @@ class Ne {
|
|
|
2288
2309
|
storageKey: a.storageKey,
|
|
2289
2310
|
lastUsedAt: Date.now()
|
|
2290
2311
|
}).catch((l) => {
|
|
2291
|
-
|
|
2312
|
+
M("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
2292
2313
|
attachmentId: t.id,
|
|
2293
2314
|
name: a.name,
|
|
2294
2315
|
message: l instanceof Error ? l.message : String(l)
|
|
@@ -2308,7 +2329,7 @@ class Ne {
|
|
|
2308
2329
|
}
|
|
2309
2330
|
async prepareEmbedAttachmentUpload(e) {
|
|
2310
2331
|
let t = !1;
|
|
2311
|
-
return await
|
|
2332
|
+
return await Me(async () => {
|
|
2312
2333
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2313
2334
|
if (n.ok)
|
|
2314
2335
|
return await n.json();
|
|
@@ -2353,7 +2374,7 @@ class Ne {
|
|
|
2353
2374
|
stoppedCausalSequence: null,
|
|
2354
2375
|
toolCallIds: new Set(
|
|
2355
2376
|
this.state.messages.filter(
|
|
2356
|
-
(t) =>
|
|
2377
|
+
(t) => be(
|
|
2357
2378
|
t,
|
|
2358
2379
|
e.respondsToUserMessageId,
|
|
2359
2380
|
e.runId
|
|
@@ -2773,7 +2794,7 @@ class Ne {
|
|
|
2773
2794
|
} catch (o) {
|
|
2774
2795
|
if (o instanceof Te)
|
|
2775
2796
|
throw o;
|
|
2776
|
-
|
|
2797
|
+
M("web-sdk.history", "HTTP session history page failed; retrying", {
|
|
2777
2798
|
sessionId: e,
|
|
2778
2799
|
hasCursor: !!n,
|
|
2779
2800
|
retryDelayMs: r,
|
|
@@ -2816,7 +2837,7 @@ class Ne {
|
|
|
2816
2837
|
return;
|
|
2817
2838
|
const r = n instanceof Error ? n.message : String(n);
|
|
2818
2839
|
if (i) {
|
|
2819
|
-
this.sessionActivityRequestId = null,
|
|
2840
|
+
this.sessionActivityRequestId = null, M("web-sdk.history", "Background session activity hydration stopped", {
|
|
2820
2841
|
sessionId: t,
|
|
2821
2842
|
message: r
|
|
2822
2843
|
});
|
|
@@ -2828,7 +2849,7 @@ class Ne {
|
|
|
2828
2849
|
message: r,
|
|
2829
2850
|
requestId: e,
|
|
2830
2851
|
sessionId: t
|
|
2831
|
-
}),
|
|
2852
|
+
}), M("web-sdk.history", "HTTP session history page failed permanently", {
|
|
2832
2853
|
sessionId: t,
|
|
2833
2854
|
message: r
|
|
2834
2855
|
});
|
|
@@ -2856,7 +2877,7 @@ class Ne {
|
|
|
2856
2877
|
try {
|
|
2857
2878
|
return t.send(JSON.stringify(e)), Se("client_event", e.type, $t(e)), !0;
|
|
2858
2879
|
} catch (n) {
|
|
2859
|
-
return
|
|
2880
|
+
return M("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
2860
2881
|
message: n instanceof Error ? n.message : String(n),
|
|
2861
2882
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
2862
2883
|
isThinking: this.state.isThinking
|
|
@@ -2891,7 +2912,7 @@ class Ne {
|
|
|
2891
2912
|
signal: i
|
|
2892
2913
|
}));
|
|
2893
2914
|
} catch (r) {
|
|
2894
|
-
|
|
2915
|
+
M("web-sdk.agent", "Pluno health signal send failed", {
|
|
2895
2916
|
name: e,
|
|
2896
2917
|
message: r instanceof Error ? r.message : String(r)
|
|
2897
2918
|
}), this.queueHealthDiagnostic(i);
|
|
@@ -3031,7 +3052,7 @@ class Ne {
|
|
|
3031
3052
|
const e = location.href;
|
|
3032
3053
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
3033
3054
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
3034
|
-
},
|
|
3055
|
+
}, bi));
|
|
3035
3056
|
}
|
|
3036
3057
|
refreshStarterPromptsForCurrentUrl() {
|
|
3037
3058
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -3115,7 +3136,7 @@ class Ne {
|
|
|
3115
3136
|
const n = C(t);
|
|
3116
3137
|
if (!e || !n || !_e(n) || this.findStoppedTurn(e, n))
|
|
3117
3138
|
return;
|
|
3118
|
-
const i = O(n), r =
|
|
3139
|
+
const i = O(n), r = k(n), o = typeof n.clientMessageId == "string" ? n.clientMessageId : i ? this.clientMessageIdsByUserMessageItemId.get(i) ?? null : null;
|
|
3119
3140
|
this.stoppedTurns.push({
|
|
3120
3141
|
sessionId: e,
|
|
3121
3142
|
clientMessageId: o,
|
|
@@ -3127,7 +3148,7 @@ class Ne {
|
|
|
3127
3148
|
stoppedCausalSequence: P(n),
|
|
3128
3149
|
toolCallIds: new Set(
|
|
3129
3150
|
this.state.messages.filter(
|
|
3130
|
-
(a) =>
|
|
3151
|
+
(a) => be(a, i, r)
|
|
3131
3152
|
).map((a) => a.callId).filter((a) => typeof a == "string")
|
|
3132
3153
|
)
|
|
3133
3154
|
}), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
|
|
@@ -3235,7 +3256,7 @@ class Ne {
|
|
|
3235
3256
|
const t = fr(e.user);
|
|
3236
3257
|
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();
|
|
3237
3258
|
const n = ur(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
3238
|
-
|
|
3259
|
+
M("web-sdk.agent", "Received auth.ok appearance", {
|
|
3239
3260
|
hasAppearance: i,
|
|
3240
3261
|
rawAppearance: e.appearance,
|
|
3241
3262
|
normalizedAppearance: n
|
|
@@ -3290,14 +3311,14 @@ class Ne {
|
|
|
3290
3311
|
runId: u?.runId
|
|
3291
3312
|
}), g = this.filterStoppedSnapshotItems(n, r), f = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, h = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, p = e.isRetrying === !0, y = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
|
|
3292
3313
|
f && h && (this.pendingClientMessageId = h);
|
|
3293
|
-
let m =
|
|
3314
|
+
let m = br(
|
|
3294
3315
|
e.assistantDraft
|
|
3295
3316
|
);
|
|
3296
3317
|
m && this.findStoppedTurn(r, {
|
|
3297
3318
|
respondsToUserMessageId: m.respondsToUserMessageId,
|
|
3298
3319
|
runId: m.runId
|
|
3299
3320
|
}) && (m = void 0);
|
|
3300
|
-
const
|
|
3321
|
+
const b = m !== void 0;
|
|
3301
3322
|
this.rememberUserMessageClientMessageIds(g);
|
|
3302
3323
|
const w = xr(g), D = g.filter((U) => {
|
|
3303
3324
|
const q = C(U);
|
|
@@ -3305,7 +3326,7 @@ class Ne {
|
|
|
3305
3326
|
}), S = ct(
|
|
3306
3327
|
this.state.messages,
|
|
3307
3328
|
st(D, this.options.backendUrl)
|
|
3308
|
-
), T = rs(S), N =
|
|
3329
|
+
), T = rs(S), N = b ? m?.content ?? "" : this.state.assistantDraft, v = b ? m?.itemId ?? null : this.state.assistantDraftItemId, re = b ? m?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, Y = b ? m?.runId ?? null : this.state.assistantDraftRunId, Z = g.some(
|
|
3309
3330
|
(U, q) => os(
|
|
3310
3331
|
C(U),
|
|
3311
3332
|
N,
|
|
@@ -3314,7 +3335,7 @@ class Ne {
|
|
|
3314
3335
|
Y,
|
|
3315
3336
|
Lr(g, q)
|
|
3316
3337
|
)
|
|
3317
|
-
), ee =
|
|
3338
|
+
), ee = b ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), V = Ur(S), oe = B && V ? "completed" : d ? "stopped" : B ? "failed" : null;
|
|
3318
3339
|
if (!T && Or(this.state.messages, g))
|
|
3319
3340
|
return;
|
|
3320
3341
|
this.lastUserMessagePageUrl = Dr(g);
|
|
@@ -3339,7 +3360,7 @@ class Ne {
|
|
|
3339
3360
|
assistantDraftPhase: null,
|
|
3340
3361
|
assistantDraftRespondsToUserMessageId: null,
|
|
3341
3362
|
assistantDraftRunId: null
|
|
3342
|
-
} :
|
|
3363
|
+
} : b ? {
|
|
3343
3364
|
assistantDraft: m?.content ?? "",
|
|
3344
3365
|
assistantDraftItemId: m?.itemId ?? null,
|
|
3345
3366
|
assistantDraftPhase: m?.phase ?? null,
|
|
@@ -3390,7 +3411,7 @@ class Ne {
|
|
|
3390
3411
|
this.options.backendUrl
|
|
3391
3412
|
);
|
|
3392
3413
|
t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
3393
|
-
messages:
|
|
3414
|
+
messages: Er(this.state.messages, i)
|
|
3394
3415
|
});
|
|
3395
3416
|
return;
|
|
3396
3417
|
}
|
|
@@ -3504,7 +3525,7 @@ class Ne {
|
|
|
3504
3525
|
return;
|
|
3505
3526
|
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 = xt(
|
|
3506
3527
|
this.state.messages.filter(
|
|
3507
|
-
(c) => c.dataType !== "assistant_draft" || !
|
|
3528
|
+
(c) => c.dataType !== "assistant_draft" || !be(
|
|
3508
3529
|
c,
|
|
3509
3530
|
n,
|
|
3510
3531
|
i
|
|
@@ -3748,7 +3769,7 @@ class Ne {
|
|
|
3748
3769
|
if (e.type === "chat.assistant_done") {
|
|
3749
3770
|
const i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = xt(
|
|
3750
3771
|
n.filter(
|
|
3751
|
-
(a) => a.dataType !== "assistant_draft" || !
|
|
3772
|
+
(a) => a.dataType !== "assistant_draft" || !be(a, i, r)
|
|
3752
3773
|
),
|
|
3753
3774
|
i,
|
|
3754
3775
|
r,
|
|
@@ -3950,7 +3971,7 @@ class Ne {
|
|
|
3950
3971
|
}
|
|
3951
3972
|
t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
3952
3973
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
3953
|
-
},
|
|
3974
|
+
}, Mi(t, gi));
|
|
3954
3975
|
}
|
|
3955
3976
|
failPendingDelivery(e) {
|
|
3956
3977
|
if (this.pendingClientMessageId !== e)
|
|
@@ -4004,7 +4025,7 @@ class Ne {
|
|
|
4004
4025
|
}, Kt);
|
|
4005
4026
|
}
|
|
4006
4027
|
recoverMissedRunAck(e) {
|
|
4007
|
-
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (
|
|
4028
|
+
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (M("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
4008
4029
|
sessionId: this.state.sessionId,
|
|
4009
4030
|
clientMessageId: e
|
|
4010
4031
|
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(zt));
|
|
@@ -4020,7 +4041,7 @@ class Ne {
|
|
|
4020
4041
|
return;
|
|
4021
4042
|
const e = this.activeClientMessageId;
|
|
4022
4043
|
if (!e) {
|
|
4023
|
-
|
|
4044
|
+
M("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
|
|
4024
4045
|
sessionId: this.state.sessionId
|
|
4025
4046
|
}), this.reportHealthSignal("run_recovery_exhausted", {
|
|
4026
4047
|
reason: "missing_client_message_id"
|
|
@@ -4036,7 +4057,7 @@ class Ne {
|
|
|
4036
4057
|
return;
|
|
4037
4058
|
}
|
|
4038
4059
|
const t = this.thinkingWatchdogResyncAttemptsByClientMessageId[e] ?? 0;
|
|
4039
|
-
this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = t + 1,
|
|
4060
|
+
this.thinkingWatchdogResyncAttemptsByClientMessageId[e] = t + 1, M("web-sdk.agent", "Pluno thinking watchdog resyncing authoritative session state", {
|
|
4040
4061
|
sessionId: this.state.sessionId,
|
|
4041
4062
|
clientMessageId: e,
|
|
4042
4063
|
resyncAttempts: t + 1
|
|
@@ -4180,7 +4201,7 @@ class Ne {
|
|
|
4180
4201
|
);
|
|
4181
4202
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
4182
4203
|
this.reconnectTimer = null, this.connect().catch((n) => {
|
|
4183
|
-
|
|
4204
|
+
M("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
4184
4205
|
message: n instanceof Error ? n.message : String(n),
|
|
4185
4206
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
4186
4207
|
isThinking: this.state.isThinking
|
|
@@ -4192,7 +4213,7 @@ class Ne {
|
|
|
4192
4213
|
this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
|
|
4193
4214
|
const e = this.socket;
|
|
4194
4215
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
4195
|
-
this.socket === e && (
|
|
4216
|
+
this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
4196
4217
|
}, ei));
|
|
4197
4218
|
}, Zn);
|
|
4198
4219
|
}
|
|
@@ -4319,11 +4340,11 @@ function Pi() {
|
|
|
4319
4340
|
throw m;
|
|
4320
4341
|
}
|
|
4321
4342
|
try {
|
|
4322
|
-
const m = f instanceof Request ? f : null,
|
|
4323
|
-
if (!te(
|
|
4343
|
+
const m = f instanceof Request ? f : null, b = go(f, m), w = Bs(h?.headers ?? m?.headers);
|
|
4344
|
+
if (!te(b, w, h?.body)) {
|
|
4324
4345
|
const H = {
|
|
4325
4346
|
requestId: nt("fetch"),
|
|
4326
|
-
url: F(
|
|
4347
|
+
url: F(b, Ye),
|
|
4327
4348
|
method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
4328
4349
|
requestHeaders: w,
|
|
4329
4350
|
requestBody: ps(h?.body),
|
|
@@ -4353,7 +4374,7 @@ function Pi() {
|
|
|
4353
4374
|
}
|
|
4354
4375
|
return y;
|
|
4355
4376
|
}, a = function(f, h, p, y, m) {
|
|
4356
|
-
const
|
|
4377
|
+
const b = n.call(this, f, h, p ?? !0, y ?? void 0, m ?? void 0), w = typeof h == "string" ? h : h.toString();
|
|
4357
4378
|
return Ze.set(this, {
|
|
4358
4379
|
requestId: nt("xhr"),
|
|
4359
4380
|
method: String(f ?? "GET").toUpperCase(),
|
|
@@ -4362,10 +4383,10 @@ function Pi() {
|
|
|
4362
4383
|
startedAtMs: Date.now(),
|
|
4363
4384
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4364
4385
|
excluded: te(w)
|
|
4365
|
-
}),
|
|
4386
|
+
}), b;
|
|
4366
4387
|
}, l = function(f, h) {
|
|
4367
4388
|
const p = i.call(this, f, h), y = Ze.get(this);
|
|
4368
|
-
return y && Object.keys(y.requestHeaders).length < At && (y.requestHeaders[f] =
|
|
4389
|
+
return y && Object.keys(y.requestHeaders).length < At && (y.requestHeaders[f] = kt(f, h), y.excluded = y.excluded || te(y.url, y.requestHeaders)), p;
|
|
4369
4390
|
}, c = function(f) {
|
|
4370
4391
|
try {
|
|
4371
4392
|
const h = Ze.get(this);
|
|
@@ -4465,7 +4486,7 @@ function Pi() {
|
|
|
4465
4486
|
};
|
|
4466
4487
|
return window.__plunoProductAgentNetworkCapture = d, d;
|
|
4467
4488
|
}
|
|
4468
|
-
function
|
|
4489
|
+
function M(s, e, t) {
|
|
4469
4490
|
if (typeof window > "u")
|
|
4470
4491
|
return;
|
|
4471
4492
|
const n = window, i = {
|
|
@@ -4533,7 +4554,7 @@ function xi() {
|
|
|
4533
4554
|
};
|
|
4534
4555
|
}
|
|
4535
4556
|
function Li() {
|
|
4536
|
-
return ms(globalThis, "getPageSnapshot", async () =>
|
|
4557
|
+
return ms(globalThis, "getPageSnapshot", async () => bt());
|
|
4537
4558
|
}
|
|
4538
4559
|
function Ni() {
|
|
4539
4560
|
return ms(globalThis, "pageImages", {
|
|
@@ -4758,7 +4779,7 @@ function Zi() {
|
|
|
4758
4779
|
return {
|
|
4759
4780
|
pageUrl: location.href,
|
|
4760
4781
|
pageTitle: document.title,
|
|
4761
|
-
htmlContent:
|
|
4782
|
+
htmlContent: bt()
|
|
4762
4783
|
};
|
|
4763
4784
|
}
|
|
4764
4785
|
function er(s) {
|
|
@@ -4784,7 +4805,7 @@ function tr() {
|
|
|
4784
4805
|
function et() {
|
|
4785
4806
|
return Ps()?.surface === "browser_extension_sdk_preview";
|
|
4786
4807
|
}
|
|
4787
|
-
function
|
|
4808
|
+
function bt() {
|
|
4788
4809
|
if (!document.body)
|
|
4789
4810
|
return "";
|
|
4790
4811
|
const s = [], e = [], t = (p, y) => {
|
|
@@ -4793,7 +4814,7 @@ function Mt() {
|
|
|
4793
4814
|
};
|
|
4794
4815
|
t("Selected text", window.getSelection()?.toString() ?? "");
|
|
4795
4816
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
|
|
4796
|
-
(p) =>
|
|
4817
|
+
(p) => Es(p) && !p.parentElement?.closest(n)
|
|
4797
4818
|
);
|
|
4798
4819
|
for (const p of i.slice(0, 3))
|
|
4799
4820
|
t("Active overlay", tt(he(p), e));
|
|
@@ -4826,12 +4847,12 @@ function tt(s, e) {
|
|
|
4826
4847
|
t = t.replace(n, "");
|
|
4827
4848
|
return ne(t);
|
|
4828
4849
|
}
|
|
4829
|
-
function
|
|
4850
|
+
function Es(s) {
|
|
4830
4851
|
const e = window.getComputedStyle(s);
|
|
4831
4852
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
4832
4853
|
}
|
|
4833
4854
|
function sr() {
|
|
4834
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
4855
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Es).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
|
|
4835
4856
|
}
|
|
4836
4857
|
function nr(s, e) {
|
|
4837
4858
|
const t = /* @__PURE__ */ new Set([
|
|
@@ -4938,7 +4959,7 @@ function nr(s, e) {
|
|
|
4938
4959
|
const R = p(I), z = oe.get(R) ?? 0;
|
|
4939
4960
|
oe.set(R, z + 1), (V.get(R) ?? 0) > 8 && z >= 6 && !u.has(I) && me.set(R, (me.get(R) ?? 0) + 1);
|
|
4940
4961
|
}
|
|
4941
|
-
const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [],
|
|
4962
|
+
const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], Et = [];
|
|
4942
4963
|
for (const I of B) {
|
|
4943
4964
|
const R = p(I), z = V.get(R) ?? 0, Pt = j.get(R) ?? 0;
|
|
4944
4965
|
if (j.set(R, Pt + 1), z > 8 && Pt >= 6 && !u.has(I)) {
|
|
@@ -4946,13 +4967,13 @@ function nr(s, e) {
|
|
|
4946
4967
|
continue;
|
|
4947
4968
|
}
|
|
4948
4969
|
const vt = S(I, N);
|
|
4949
|
-
|
|
4970
|
+
Et.push(vt), q.push(vt.lines);
|
|
4950
4971
|
}
|
|
4951
4972
|
const Fe = [];
|
|
4952
4973
|
if (T.shadowRoot)
|
|
4953
4974
|
for (const I of Array.from(T.shadowRoot.children))
|
|
4954
4975
|
I instanceof HTMLElement && Fe.push(S(I, N + 1));
|
|
4955
|
-
const ye = [...
|
|
4976
|
+
const ye = [...Et, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), Ct = ne(
|
|
4956
4977
|
[ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
|
|
4957
4978
|
).slice(0, 180), Vs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), _t = c.some((I) => T.hasAttribute(I)) || !!Z || Vs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || _t || Y) && (We || Y) && (!i.has(v) || We || _t || Y), je = $e ? 1 : 0, ae = [];
|
|
4958
4979
|
if ($e) {
|
|
@@ -4981,9 +5002,9 @@ function nr(s, e) {
|
|
|
4981
5002
|
};
|
|
4982
5003
|
return [`--- ${D} ---`, ...S(w, 0).lines].join(`
|
|
4983
5004
|
`);
|
|
4984
|
-
}, m = [],
|
|
4985
|
-
|
|
4986
|
-
${JSON.stringify(
|
|
5005
|
+
}, m = [], b = ne(window.getSelection()?.toString() ?? "");
|
|
5006
|
+
b && m.push(`--- selected text ---
|
|
5007
|
+
${JSON.stringify(b)}`), d.length > 0 && m.push(rr(d, t, l, o));
|
|
4987
5008
|
for (const w of s.slice(0, 3))
|
|
4988
5009
|
m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
4989
5010
|
if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -5261,10 +5282,10 @@ function Ue(s, e) {
|
|
|
5261
5282
|
e
|
|
5262
5283
|
),
|
|
5263
5284
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5264
|
-
...
|
|
5285
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5265
5286
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5266
5287
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5267
|
-
...
|
|
5288
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5268
5289
|
dataType: "assistant_draft",
|
|
5269
5290
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5270
5291
|
};
|
|
@@ -5278,10 +5299,10 @@ function Ue(s, e) {
|
|
|
5278
5299
|
e
|
|
5279
5300
|
),
|
|
5280
5301
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5281
|
-
...
|
|
5302
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5282
5303
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5283
5304
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5284
|
-
...
|
|
5305
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5285
5306
|
attachments: Ls(i.attachments, e),
|
|
5286
5307
|
...i.steered === !0 ? { steered: !0 } : {}
|
|
5287
5308
|
};
|
|
@@ -5304,24 +5325,24 @@ function Ue(s, e) {
|
|
|
5304
5325
|
role: "tool",
|
|
5305
5326
|
content: "",
|
|
5306
5327
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5307
|
-
...
|
|
5328
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5308
5329
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5309
|
-
...
|
|
5330
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5310
5331
|
dataType: "function_call_output",
|
|
5311
5332
|
toolName: Tt,
|
|
5312
5333
|
callId: ue(i) ?? void 0,
|
|
5313
5334
|
sharePromptAllowed: r
|
|
5314
5335
|
};
|
|
5315
|
-
const o =
|
|
5336
|
+
const o = kn(i.output);
|
|
5316
5337
|
if (o)
|
|
5317
5338
|
return {
|
|
5318
5339
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5319
5340
|
role: "tool",
|
|
5320
5341
|
content: "",
|
|
5321
5342
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5322
|
-
...
|
|
5343
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5323
5344
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5324
|
-
...
|
|
5345
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5325
5346
|
dataType: "scheduled_check_in",
|
|
5326
5347
|
toolName: Is,
|
|
5327
5348
|
callId: ue(i) ?? void 0,
|
|
@@ -5334,10 +5355,10 @@ function Ue(s, e) {
|
|
|
5334
5355
|
role: "tool",
|
|
5335
5356
|
content: `Connect ${a.appName} to continue`,
|
|
5336
5357
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5337
|
-
...
|
|
5358
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5338
5359
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5339
5360
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5340
|
-
...
|
|
5361
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5341
5362
|
dataType: "function_call_output",
|
|
5342
5363
|
toolName: "authenticate_pipedream_app",
|
|
5343
5364
|
callId: ue(i) ?? void 0,
|
|
@@ -5347,10 +5368,10 @@ function Ue(s, e) {
|
|
|
5347
5368
|
role: "tool",
|
|
5348
5369
|
content: "Connect WhatsApp to continue",
|
|
5349
5370
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5350
|
-
...
|
|
5371
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5351
5372
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5352
5373
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5353
|
-
...
|
|
5374
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5354
5375
|
dataType: "function_call_output",
|
|
5355
5376
|
toolName: "request_personal_channel_connection",
|
|
5356
5377
|
callId: ue(i) ?? void 0,
|
|
@@ -5362,10 +5383,10 @@ function Ue(s, e) {
|
|
|
5362
5383
|
role: "tool",
|
|
5363
5384
|
content: i.type === "mcp_call" ? yr(i) : wr(i),
|
|
5364
5385
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5365
|
-
...
|
|
5386
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5366
5387
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5367
5388
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5368
|
-
...
|
|
5389
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5369
5390
|
dataType: String(i.type),
|
|
5370
5391
|
toolName: i.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof i.name == "string" ? i.name : void 0,
|
|
5371
5392
|
callId: ue(i) ?? void 0,
|
|
@@ -5376,10 +5397,10 @@ function Ue(s, e) {
|
|
|
5376
5397
|
role: "system",
|
|
5377
5398
|
content: Tr(i),
|
|
5378
5399
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5379
|
-
...
|
|
5400
|
+
...E(i) !== null ? { displaySequence: E(i) } : {},
|
|
5380
5401
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
5381
5402
|
respondsToUserMessageId: O(i) ?? void 0,
|
|
5382
|
-
...
|
|
5403
|
+
...k(i) ? { runId: k(i) } : {},
|
|
5383
5404
|
dataType: String(i.type),
|
|
5384
5405
|
loading: i.steered !== !0 && i.type === "run_status" && (i.status === "running" || i.status === "retrying"),
|
|
5385
5406
|
...i.steered === !0 || i.type === "run_status" && i.status === "steered" ? { steered: !0 } : {},
|
|
@@ -5457,7 +5478,7 @@ function se(s) {
|
|
|
5457
5478
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
5458
5479
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
5459
5480
|
}
|
|
5460
|
-
function
|
|
5481
|
+
function br(s) {
|
|
5461
5482
|
if (s == null)
|
|
5462
5483
|
return s;
|
|
5463
5484
|
if (typeof s != "object")
|
|
@@ -5479,7 +5500,7 @@ function ue(s) {
|
|
|
5479
5500
|
function P(s) {
|
|
5480
5501
|
return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
|
|
5481
5502
|
}
|
|
5482
|
-
function
|
|
5503
|
+
function E(s) {
|
|
5483
5504
|
return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
|
|
5484
5505
|
}
|
|
5485
5506
|
function es(s) {
|
|
@@ -5493,11 +5514,11 @@ function es(s) {
|
|
|
5493
5514
|
function de(s, e) {
|
|
5494
5515
|
const t = vs(
|
|
5495
5516
|
s,
|
|
5496
|
-
|
|
5497
|
-
), n =
|
|
5517
|
+
Mt(s, e)
|
|
5518
|
+
), n = kr(
|
|
5498
5519
|
Rr(
|
|
5499
5520
|
Pr(
|
|
5500
|
-
|
|
5521
|
+
Mr(s, e),
|
|
5501
5522
|
e
|
|
5502
5523
|
),
|
|
5503
5524
|
t
|
|
@@ -5511,7 +5532,7 @@ function de(s, e) {
|
|
|
5511
5532
|
const r = [...n];
|
|
5512
5533
|
return r[i] = t, pt(r);
|
|
5513
5534
|
}
|
|
5514
|
-
function
|
|
5535
|
+
function Mt(s, e, t = !0) {
|
|
5515
5536
|
const n = s.find(
|
|
5516
5537
|
(r) => r.id === e.id || e.callId !== void 0 && r.callId === e.callId || e.assistantDraftItemId !== void 0 && (r.id === e.assistantDraftItemId || r.assistantDraftItemId === e.assistantDraftItemId)
|
|
5517
5538
|
);
|
|
@@ -5522,7 +5543,7 @@ function bt(s, e, t = !0) {
|
|
|
5522
5543
|
const i = s.flatMap((r) => (e.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId === e.respondsToUserMessageId : e.runId !== void 0 && r.respondsToUserMessageId === void 0 && r.runId === e.runId) && r.displaySequence !== void 0 ? [r.displaySequence] : []);
|
|
5523
5544
|
return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
|
|
5524
5545
|
}
|
|
5525
|
-
function
|
|
5546
|
+
function Mr(s, e) {
|
|
5526
5547
|
const t = e.proactiveSuggestionClientMessageId;
|
|
5527
5548
|
if (!t)
|
|
5528
5549
|
return s;
|
|
@@ -5538,7 +5559,7 @@ function Rr(s, e) {
|
|
|
5538
5559
|
(n) => n.dataType === "assistant_draft" && n.id === t ? e : n
|
|
5539
5560
|
) : s;
|
|
5540
5561
|
}
|
|
5541
|
-
function
|
|
5562
|
+
function be(s, e, t) {
|
|
5542
5563
|
return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
|
|
5543
5564
|
}
|
|
5544
5565
|
function ts(s, e, t, n) {
|
|
@@ -5600,7 +5621,7 @@ function is(s) {
|
|
|
5600
5621
|
loading: !0
|
|
5601
5622
|
};
|
|
5602
5623
|
}
|
|
5603
|
-
function
|
|
5624
|
+
function kr(s, e) {
|
|
5604
5625
|
if (e.id.startsWith("transient-activity:"))
|
|
5605
5626
|
return s;
|
|
5606
5627
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -5616,7 +5637,7 @@ function ct(s, e) {
|
|
|
5616
5637
|
t.push(
|
|
5617
5638
|
vs(
|
|
5618
5639
|
i,
|
|
5619
|
-
|
|
5640
|
+
Mt(i, n, !1)
|
|
5620
5641
|
)
|
|
5621
5642
|
);
|
|
5622
5643
|
}
|
|
@@ -5626,9 +5647,9 @@ function ct(s, e) {
|
|
|
5626
5647
|
ut
|
|
5627
5648
|
);
|
|
5628
5649
|
}
|
|
5629
|
-
function
|
|
5650
|
+
function Er(s, e) {
|
|
5630
5651
|
const t = new Map(s.map((r) => [r.id, r])), n = e.map(
|
|
5631
|
-
(r) =>
|
|
5652
|
+
(r) => Mt(s, r, !1)
|
|
5632
5653
|
);
|
|
5633
5654
|
for (const r of n)
|
|
5634
5655
|
t.set(r.id, r);
|
|
@@ -5878,7 +5899,7 @@ function os(s, e, t, n, i, r) {
|
|
|
5878
5899
|
if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
5879
5900
|
return !1;
|
|
5880
5901
|
const a = O(o);
|
|
5881
|
-
return n !== null ? a !== null ? a === n : i !== null &&
|
|
5902
|
+
return n !== null ? a !== null ? a === n : i !== null && k(o) === i && r === n : i === null || k(o) === i;
|
|
5882
5903
|
}
|
|
5883
5904
|
function Lr(s, e) {
|
|
5884
5905
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
@@ -6082,7 +6103,7 @@ function A(s, e) {
|
|
|
6082
6103
|
}
|
|
6083
6104
|
function Zr(s, e) {
|
|
6084
6105
|
try {
|
|
6085
|
-
const t = window.localStorage.getItem(`${
|
|
6106
|
+
const t = window.localStorage.getItem(`${ks}${s}`);
|
|
6086
6107
|
if (!t)
|
|
6087
6108
|
return null;
|
|
6088
6109
|
const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
@@ -6105,7 +6126,7 @@ function ft(s) {
|
|
|
6105
6126
|
function eo(s, e) {
|
|
6106
6127
|
try {
|
|
6107
6128
|
window.localStorage.setItem(
|
|
6108
|
-
`${
|
|
6129
|
+
`${ks}${s}`,
|
|
6109
6130
|
JSON.stringify({
|
|
6110
6131
|
sessionId: e.sessionId,
|
|
6111
6132
|
messages: e.messages.filter(ft).slice(-wi).map(ho)
|
|
@@ -6264,7 +6285,7 @@ function Hs(s) {
|
|
|
6264
6285
|
const e = lo(s.name), t = s.mimeType.trim().toLowerCase();
|
|
6265
6286
|
if (!Ii.has(`${e}:${t}`))
|
|
6266
6287
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
6267
|
-
if (s.sizeBytes <= 0 || s.sizeBytes >=
|
|
6288
|
+
if (s.sizeBytes <= 0 || s.sizeBytes >= Ms)
|
|
6268
6289
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
6269
6290
|
}
|
|
6270
6291
|
function lo(s) {
|
|
@@ -6317,7 +6338,7 @@ function O(s) {
|
|
|
6317
6338
|
const e = s.respondsToUserMessageId;
|
|
6318
6339
|
return typeof e == "string" && e ? e : null;
|
|
6319
6340
|
}
|
|
6320
|
-
function
|
|
6341
|
+
function k(s) {
|
|
6321
6342
|
const e = s.runId;
|
|
6322
6343
|
return typeof e == "string" && e ? e : null;
|
|
6323
6344
|
}
|
|
@@ -6329,14 +6350,14 @@ function Bs(s) {
|
|
|
6329
6350
|
const e = {};
|
|
6330
6351
|
try {
|
|
6331
6352
|
new Headers(s).forEach((t, n) => {
|
|
6332
|
-
Object.keys(e).length < At && (e[n] =
|
|
6353
|
+
Object.keys(e).length < At && (e[n] = kt(n, t));
|
|
6333
6354
|
});
|
|
6334
6355
|
} catch {
|
|
6335
6356
|
return {};
|
|
6336
6357
|
}
|
|
6337
6358
|
return e;
|
|
6338
6359
|
}
|
|
6339
|
-
function
|
|
6360
|
+
function kt(s, e) {
|
|
6340
6361
|
return Ks(s) ? Be : F(xe(e), Si);
|
|
6341
6362
|
}
|
|
6342
6363
|
function go(s, e) {
|
|
@@ -6459,7 +6480,7 @@ function wo(s) {
|
|
|
6459
6480
|
if (Object.keys(e).length >= At)
|
|
6460
6481
|
break;
|
|
6461
6482
|
const i = t.slice(0, n).trim();
|
|
6462
|
-
e[i] =
|
|
6483
|
+
e[i] = kt(i, t.slice(n + 1).trim());
|
|
6463
6484
|
}
|
|
6464
6485
|
return e;
|
|
6465
6486
|
}
|
|
@@ -6475,13 +6496,13 @@ class Pe extends Error {
|
|
|
6475
6496
|
}
|
|
6476
6497
|
status;
|
|
6477
6498
|
}
|
|
6478
|
-
async function
|
|
6499
|
+
async function Me(s, e) {
|
|
6479
6500
|
let t = null;
|
|
6480
6501
|
for (let n = 0; n < Vt; n += 1)
|
|
6481
6502
|
try {
|
|
6482
6503
|
return await s();
|
|
6483
6504
|
} catch (i) {
|
|
6484
|
-
if (t = i, n >= Vt - 1 || !
|
|
6505
|
+
if (t = i, n >= Vt - 1 || !bo(i))
|
|
6485
6506
|
throw i;
|
|
6486
6507
|
await Ao(n);
|
|
6487
6508
|
}
|
|
@@ -6492,16 +6513,16 @@ function Ao(s) {
|
|
|
6492
6513
|
window.setTimeout(e, yi[s] ?? 0);
|
|
6493
6514
|
});
|
|
6494
6515
|
}
|
|
6495
|
-
function Mo(s) {
|
|
6496
|
-
return s instanceof Pe ? bo(s.status) : s instanceof TypeError;
|
|
6497
|
-
}
|
|
6498
6516
|
function bo(s) {
|
|
6517
|
+
return s instanceof Pe ? Mo(s.status) : s instanceof TypeError;
|
|
6518
|
+
}
|
|
6519
|
+
function Mo(s) {
|
|
6499
6520
|
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
6500
6521
|
}
|
|
6501
6522
|
function Ro(s) {
|
|
6502
6523
|
return s === 401 || s === 403;
|
|
6503
6524
|
}
|
|
6504
|
-
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]",
|
|
6525
|
+
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", ko = "[REDACTED_SIGNED_URL]", Eo = 20, Co = /^(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, Ws = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, $s = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, js = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, zs = /\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, _o = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Po = /\bhttps?:\/\/[^\s"'<>]+/gi, vo = /[),.;\]]+$/;
|
|
6505
6526
|
function L(s) {
|
|
6506
6527
|
return Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6507
6528
|
}
|
|
@@ -6510,7 +6531,7 @@ function Oe(s, e, t) {
|
|
|
6510
6531
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
|
|
6511
6532
|
if (s === null || typeof s != "object")
|
|
6512
6533
|
return s;
|
|
6513
|
-
if (e >=
|
|
6534
|
+
if (e >= Eo)
|
|
6514
6535
|
return "[REDACTED_MAX_DEPTH]";
|
|
6515
6536
|
if (t.has(s))
|
|
6516
6537
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -6539,7 +6560,7 @@ function Gs(s) {
|
|
|
6539
6560
|
}
|
|
6540
6561
|
}
|
|
6541
6562
|
function xe(s) {
|
|
6542
|
-
return s.replace(_o,
|
|
6563
|
+
return s.replace(_o, ko).replace(Po, qo).replace(Ws, `Bearer ${$}`).replace($s, `Basic ${$}`).replace(js, $).replace(zs, (e, t) => `${t}: ${Be}`);
|
|
6543
6564
|
}
|
|
6544
6565
|
function Do(s) {
|
|
6545
6566
|
return s.replace(Ws, `Bearer ${$}`).replace($s, `Basic ${$}`).replace(js, $).replace(zs, (e, t) => `${t}: ${Be}`);
|
|
@@ -6570,7 +6591,7 @@ export {
|
|
|
6570
6591
|
J as ProductAgentTokenProviderError,
|
|
6571
6592
|
Ri as calculateReconnectDelay,
|
|
6572
6593
|
Lo as createLocalStorageInteractionDecisionStorage,
|
|
6573
|
-
|
|
6594
|
+
ke as createProductAgentQueryState,
|
|
6574
6595
|
jo as createProductAgentRuntime,
|
|
6575
6596
|
Ho as createProductAgentTaskPageTitleDocument,
|
|
6576
6597
|
$o as default,
|
|
@@ -6578,7 +6599,7 @@ export {
|
|
|
6578
6599
|
Xi as getProductAgentOriginAccessErrorMessage,
|
|
6579
6600
|
Bo as isProductAgentRuntimeCommand,
|
|
6580
6601
|
vn as mergeProductAgentEntityPages,
|
|
6581
|
-
|
|
6602
|
+
Ee as normalizeProductAgentEntityPage,
|
|
6582
6603
|
st as normalizeProductAgentSessionItems,
|
|
6583
6604
|
Nn as readLocalStorageInteractionDecisions,
|
|
6584
6605
|
xo as resolveProductAgentComposerAction,
|