@pluno/product-agent-web 0.1.208 → 0.1.210
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/product-agent-runtime.cjs +1 -1
- package/dist/product-agent-runtime.js +336 -322
- package/dist/product-agent-sdk.js +301 -284
- package/dist/product-agent-widget.js +2956 -2797
- package/dist/uiFlightRecorder.d.ts +42 -0
- package/dist/uiInvariants.d.ts +31 -0
- package/package.json +1 -1
|
@@ -477,7 +477,7 @@ function Mn(s, e, t) {
|
|
|
477
477
|
function Ss(s) {
|
|
478
478
|
return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function ko(s) {
|
|
481
481
|
return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
|
|
482
482
|
}
|
|
483
483
|
function bn(s, e) {
|
|
@@ -488,7 +488,7 @@ function Rn(s) {
|
|
|
488
488
|
const e = s.paidCreditFallbackModel;
|
|
489
489
|
return typeof e == "string" && e.length > 0;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function Co(s) {
|
|
492
492
|
const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
|
|
493
493
|
return s.hasRunningAssistantTurn && !e ? {
|
|
494
494
|
action: "stop",
|
|
@@ -838,7 +838,7 @@ class _n {
|
|
|
838
838
|
return `${Xe(e.scope)}:category:${e.category}`;
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function _o(s, e) {
|
|
842
842
|
return {
|
|
843
843
|
load: async () => Pn(s, e),
|
|
844
844
|
save: async (t) => s.setItem(e, JSON.stringify(t))
|
|
@@ -872,7 +872,7 @@ function Dn(s, e) {
|
|
|
872
872
|
const t = ve(s), n = `${vn[e]} Pluno`;
|
|
873
873
|
return t ? `${n}: ${t}` : n;
|
|
874
874
|
}
|
|
875
|
-
class
|
|
875
|
+
class Po {
|
|
876
876
|
constructor(e) {
|
|
877
877
|
this.titleDocument = e;
|
|
878
878
|
}
|
|
@@ -910,7 +910,7 @@ class Co {
|
|
|
910
910
|
this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function vo(s) {
|
|
914
914
|
return {
|
|
915
915
|
getTitle: () => s.title,
|
|
916
916
|
setTitle: (e) => {
|
|
@@ -929,7 +929,21 @@ function _o(s) {
|
|
|
929
929
|
function ve(s) {
|
|
930
930
|
return s.replace(Un, "");
|
|
931
931
|
}
|
|
932
|
-
|
|
932
|
+
const qn = {
|
|
933
|
+
"duplicate-message-item": "A canonical message rendered more than once.",
|
|
934
|
+
"duplicate-canonical-item": "A canonical session item rendered more than once.",
|
|
935
|
+
"duplicate-tool-call": "A tool call rendered more than once.",
|
|
936
|
+
"duplicate-attachment": "An attachment rendered more than once.",
|
|
937
|
+
"duplicate-terminal-outcome": "A response rendered more than one terminal outcome.",
|
|
938
|
+
"foreign-session-item-visible": "The visible transcript contains state owned by another session.",
|
|
939
|
+
"terminal-response-reactivated": "A terminal response became active again.",
|
|
940
|
+
"terminal-history-not-append-only": "An established terminal outcome disappeared or changed order.",
|
|
941
|
+
"runtime-transcript-not-rendered": "A nonempty runtime transcript is displaying starter prompts."
|
|
942
|
+
};
|
|
943
|
+
function On(s) {
|
|
944
|
+
return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(qn, s.slice(13));
|
|
945
|
+
}
|
|
946
|
+
function Uo(s) {
|
|
933
947
|
if (!s || typeof s != "object" || !("type" in s)) return !1;
|
|
934
948
|
const e = s;
|
|
935
949
|
switch (e.type) {
|
|
@@ -943,7 +957,7 @@ function Po(s) {
|
|
|
943
957
|
case "runtime.report_displayed_error":
|
|
944
958
|
return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
|
|
945
959
|
case "runtime.report_invalid_state_transition":
|
|
946
|
-
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll") && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
960
|
+
return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || On(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
|
|
947
961
|
case "runtime.widget_lifecycle":
|
|
948
962
|
return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
|
|
949
963
|
case "session.load":
|
|
@@ -970,7 +984,7 @@ function Po(s) {
|
|
|
970
984
|
return !1;
|
|
971
985
|
}
|
|
972
986
|
}
|
|
973
|
-
class
|
|
987
|
+
class Do {
|
|
974
988
|
constructor(e, t, n) {
|
|
975
989
|
this.adapter = t, this.state = Je(e), this.model = n;
|
|
976
990
|
}
|
|
@@ -1275,7 +1289,7 @@ function Nt(s) {
|
|
|
1275
1289
|
}) : null
|
|
1276
1290
|
};
|
|
1277
1291
|
}
|
|
1278
|
-
const
|
|
1292
|
+
const xn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ln = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Nn = ".pluno-pa-widget__panel", Hn = ".pluno-pa-widget__timeline", Bn = "__plunoExtensionWidgetOwner";
|
|
1279
1293
|
class X extends Error {
|
|
1280
1294
|
constructor(e, t, n, i) {
|
|
1281
1295
|
super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
|
|
@@ -1284,10 +1298,10 @@ class X extends Error {
|
|
|
1284
1298
|
status;
|
|
1285
1299
|
retryAfterMs;
|
|
1286
1300
|
}
|
|
1287
|
-
function
|
|
1301
|
+
function Fn(s) {
|
|
1288
1302
|
return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
|
|
1289
1303
|
}
|
|
1290
|
-
let
|
|
1304
|
+
let Wn = 0;
|
|
1291
1305
|
function Bt(s) {
|
|
1292
1306
|
const e = {};
|
|
1293
1307
|
for (const l of [
|
|
@@ -1330,7 +1344,8 @@ function Bt(s) {
|
|
|
1330
1344
|
status: typeof d.status == "string" ? d.status : null,
|
|
1331
1345
|
stage: typeof d.stage == "string" ? d.stage : null,
|
|
1332
1346
|
retryable: d.retryable === !0,
|
|
1333
|
-
visible: !!(g &&
|
|
1347
|
+
visible: !!(g && // Recovery-only failures are intentionally hidden, not missing transcript items.
|
|
1348
|
+
!(d.type === "run_error" && d.retryable === !0) && !g.scheduledCheckInAt && g.toolName !== St && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
|
|
1334
1349
|
};
|
|
1335
1350
|
}, o = r(s.item);
|
|
1336
1351
|
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)) {
|
|
@@ -1365,7 +1380,7 @@ function Se(s, e, t) {
|
|
|
1365
1380
|
source: "web_sdk",
|
|
1366
1381
|
category: s,
|
|
1367
1382
|
name: e,
|
|
1368
|
-
sequence: ++
|
|
1383
|
+
sequence: ++Wn,
|
|
1369
1384
|
wallTime: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1370
1385
|
monotonicMs: performance.now(),
|
|
1371
1386
|
data: t
|
|
@@ -1374,27 +1389,27 @@ function Se(s, e, t) {
|
|
|
1374
1389
|
}
|
|
1375
1390
|
class Te extends Error {
|
|
1376
1391
|
}
|
|
1377
|
-
function
|
|
1392
|
+
function $n(s) {
|
|
1378
1393
|
return s === 408 || s === 425 || s === 429 || s >= 500;
|
|
1379
1394
|
}
|
|
1380
|
-
const
|
|
1395
|
+
const jn = "https://app.pluno.ai", zn = 2e4, Kn = 1e4, Gn = 6e4, Qn = 6e4, Vn = 1e4, Xn = 1e4, Jn = 3e3, Yn = 3e4, Zn = 1e3, ot = 3e4, Ft = 0.2, ei = 6e4, Wt = 15e3, ti = 6e4, si = 8, ni = "Browser connection was interrupted.", $t = 15e3, ii = "Pluno could not send this message. Try it again.", ri = "Still connecting to Pluno. Retrying automatically.", oi = 2e3, ai = 1e3, li = 100, jt = 8e3, zt = 3, ci = [300, 1e3], ws = 50 * 1024 * 1024, ui = /* @__PURE__ */ new Set([
|
|
1381
1396
|
".jpeg:image/jpeg",
|
|
1382
1397
|
".jpg:image/jpeg",
|
|
1383
1398
|
".pdf:application/pdf",
|
|
1384
1399
|
".png:image/png",
|
|
1385
1400
|
".webp:image/webp"
|
|
1386
|
-
]),
|
|
1387
|
-
function
|
|
1401
|
+
]), qo = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, di = 2e3, hi = 1e3, As = "Image is too large for model vision input.", pi = 100, gi = 20, Ms = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", fi = 100;
|
|
1402
|
+
function mi(s, e = 0) {
|
|
1388
1403
|
const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
|
|
1389
1404
|
return Math.max(e, t);
|
|
1390
1405
|
}
|
|
1391
1406
|
const Ce = /* @__PURE__ */ new Set();
|
|
1392
1407
|
let we = null;
|
|
1393
|
-
function
|
|
1394
|
-
const t = Math.min(ot,
|
|
1408
|
+
function yi(s, e = Math.random) {
|
|
1409
|
+
const t = Math.min(ot, Zn * 2 ** s), n = 1 - Ft + e() * Ft * 2;
|
|
1395
1410
|
return Math.min(ot, Math.round(t * n));
|
|
1396
1411
|
}
|
|
1397
|
-
function
|
|
1412
|
+
function Ii(s) {
|
|
1398
1413
|
const e = s.split(".")[1];
|
|
1399
1414
|
if (!e)
|
|
1400
1415
|
return null;
|
|
@@ -1405,7 +1420,7 @@ function mi(s) {
|
|
|
1405
1420
|
return null;
|
|
1406
1421
|
}
|
|
1407
1422
|
}
|
|
1408
|
-
function
|
|
1423
|
+
function Si(s) {
|
|
1409
1424
|
if (s instanceof X)
|
|
1410
1425
|
return s.retryable;
|
|
1411
1426
|
if (s && typeof s == "object") {
|
|
@@ -1415,7 +1430,7 @@ function yi(s) {
|
|
|
1415
1430
|
}
|
|
1416
1431
|
return !0;
|
|
1417
1432
|
}
|
|
1418
|
-
function
|
|
1433
|
+
function Ti(s) {
|
|
1419
1434
|
if (s instanceof Error)
|
|
1420
1435
|
return s;
|
|
1421
1436
|
if (s && typeof s == "object") {
|
|
@@ -1472,9 +1487,9 @@ class Ne {
|
|
|
1472
1487
|
maxFailureIntervalMs: 3e4
|
|
1473
1488
|
}), this.personalModelSelectionOverride = e.productVariant === "personal" && Ve(e.model) ? e.model : null, this.state = {
|
|
1474
1489
|
...this.state,
|
|
1475
|
-
starterPrompts:
|
|
1490
|
+
starterPrompts: tr(e.initialStarterPrompts)
|
|
1476
1491
|
}, this.account = e.initialAccount ? { ...e.initialAccount } : null;
|
|
1477
|
-
const n = e.restorePersistedState === !1 ? null :
|
|
1492
|
+
const n = e.restorePersistedState === !1 ? null : zr(e.clientId, e.expectedPersistedSessionId);
|
|
1478
1493
|
n && (this.state = {
|
|
1479
1494
|
...this.state,
|
|
1480
1495
|
...n,
|
|
@@ -1495,9 +1510,9 @@ class Ne {
|
|
|
1495
1510
|
taskStatus: null,
|
|
1496
1511
|
isRetrying: !1,
|
|
1497
1512
|
lastError: null
|
|
1498
|
-
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents =
|
|
1499
|
-
|
|
1500
|
-
|
|
1513
|
+
}, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Jr(
|
|
1514
|
+
Gr(e.clientId),
|
|
1515
|
+
Qr(e.clientId)
|
|
1501
1516
|
);
|
|
1502
1517
|
const i = [...this.queuedClientEvents].reverse().find(
|
|
1503
1518
|
(r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
|
|
@@ -1647,10 +1662,10 @@ class Ne {
|
|
|
1647
1662
|
t.skipStoredTransportIdentityCollisionCheck === !0
|
|
1648
1663
|
), i = new Ne({
|
|
1649
1664
|
...e,
|
|
1650
|
-
backendUrl:
|
|
1651
|
-
clientId: e.clientId ??
|
|
1665
|
+
backendUrl: Bi(e.backendUrl ?? jn),
|
|
1666
|
+
clientId: e.clientId ?? or(),
|
|
1652
1667
|
productVariant: e.productVariant ?? "customer_embedded",
|
|
1653
|
-
entrySurface:
|
|
1668
|
+
entrySurface: Fi(e.entrySurface)
|
|
1654
1669
|
}, n);
|
|
1655
1670
|
try {
|
|
1656
1671
|
Js().catch((r) => {
|
|
@@ -1699,7 +1714,7 @@ class Ne {
|
|
|
1699
1714
|
return this.options.token;
|
|
1700
1715
|
if (!this.options.tokenProvider)
|
|
1701
1716
|
return this.token;
|
|
1702
|
-
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs -
|
|
1717
|
+
const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Qn > n;
|
|
1703
1718
|
if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
|
|
1704
1719
|
return this.token;
|
|
1705
1720
|
if (this.tokenRequest && !t.forceRefresh)
|
|
@@ -1712,7 +1727,7 @@ class Ne {
|
|
|
1712
1727
|
const l = new Promise((c, u) => {
|
|
1713
1728
|
a = window.setTimeout(() => {
|
|
1714
1729
|
r.abort(), u(new X("Pluno token provider timed out", !0));
|
|
1715
|
-
},
|
|
1730
|
+
}, Gn);
|
|
1716
1731
|
});
|
|
1717
1732
|
try {
|
|
1718
1733
|
const c = await Promise.race([
|
|
@@ -1723,7 +1738,7 @@ class Ne {
|
|
|
1723
1738
|
throw new X("Pluno token request was cancelled", !0);
|
|
1724
1739
|
if (!c)
|
|
1725
1740
|
throw new X("Pluno token provider did not return a token", !1);
|
|
1726
|
-
return this.token = c, this.tokenExpiresAtMs =
|
|
1741
|
+
return this.token = c, this.tokenExpiresAtMs = Ii(c), c;
|
|
1727
1742
|
} finally {
|
|
1728
1743
|
a !== null && window.clearTimeout(a);
|
|
1729
1744
|
}
|
|
@@ -1748,10 +1763,10 @@ class Ne {
|
|
|
1748
1763
|
return;
|
|
1749
1764
|
if (!this.token && !this.options.webSocketFactory)
|
|
1750
1765
|
throw new X("Pluno requires a token or tokenProvider", !1);
|
|
1751
|
-
const t =
|
|
1766
|
+
const t = ji(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
1752
1767
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
1753
1768
|
this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
|
|
1754
|
-
},
|
|
1769
|
+
}, Vn), n.addEventListener("open", () => {
|
|
1755
1770
|
this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
|
|
1756
1771
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1757
1772
|
isThinking: this.state.isThinking
|
|
@@ -1763,13 +1778,13 @@ class Ne {
|
|
|
1763
1778
|
pageUrl: location.href
|
|
1764
1779
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
1765
1780
|
this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
|
|
1766
|
-
},
|
|
1781
|
+
}, Xn));
|
|
1767
1782
|
}), n.addEventListener("message", (i) => {
|
|
1768
|
-
this.socket === n && this.handleServerEvent(
|
|
1783
|
+
this.socket === n && this.handleServerEvent(Zi(i.data));
|
|
1769
1784
|
}), n.addEventListener("sendfailure", (i) => {
|
|
1770
1785
|
if (this.socket !== n)
|
|
1771
1786
|
return;
|
|
1772
|
-
const r =
|
|
1787
|
+
const r = er(i?.detail?.data);
|
|
1773
1788
|
r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
|
|
1774
1789
|
(o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
|
|
1775
1790
|
) && (this.queuedClientEvents.push(r), V(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
|
|
@@ -1793,14 +1808,14 @@ class Ne {
|
|
|
1793
1808
|
} catch (t) {
|
|
1794
1809
|
if (e !== this.connectionAttemptId || this.state.status === "closed")
|
|
1795
1810
|
return;
|
|
1796
|
-
const n =
|
|
1797
|
-
if (
|
|
1811
|
+
const n = Ti(t);
|
|
1812
|
+
if (Si(t)) {
|
|
1798
1813
|
b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
|
|
1799
1814
|
message: n.message,
|
|
1800
1815
|
reconnectAttempt: this.reconnectAttempts
|
|
1801
1816
|
}), t instanceof X && this.reportTransportDiagnostic("auth_timeout"), this.setState({
|
|
1802
1817
|
status: "reconnecting",
|
|
1803
|
-
lastError:
|
|
1818
|
+
lastError: ri,
|
|
1804
1819
|
lastErrorCode: "connection_failed"
|
|
1805
1820
|
}), this.emit("error", n), this.scheduleReconnect(
|
|
1806
1821
|
t instanceof X ? t.retryAfterMs : void 0
|
|
@@ -1820,7 +1835,7 @@ class Ne {
|
|
|
1820
1835
|
this.stopSessionRecoveryPolling(), this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
1821
1836
|
}
|
|
1822
1837
|
destroy() {
|
|
1823
|
-
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
1838
|
+
this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Yr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
|
|
1824
1839
|
for (const e of Object.values(this.listeners))
|
|
1825
1840
|
e?.clear();
|
|
1826
1841
|
this.accountListeners.clear(), this.interactionListeners.clear();
|
|
@@ -1956,7 +1971,7 @@ class Ne {
|
|
|
1956
1971
|
sessionId: this.state.sessionId ?? void 0,
|
|
1957
1972
|
clientMessageId: a,
|
|
1958
1973
|
initiatedBy: t.initiatedBy,
|
|
1959
|
-
invocation:
|
|
1974
|
+
invocation: Wi(t.invocation ?? t.initiatedBy),
|
|
1960
1975
|
entrySurface: this.options.entrySurface,
|
|
1961
1976
|
content: n,
|
|
1962
1977
|
proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
|
|
@@ -2003,7 +2018,7 @@ class Ne {
|
|
|
2003
2018
|
return e ? (this.retryAttemptsByClientMessageId[t] = 0, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.activeClientMessageId = t, this.latestRecoverableClientMessageId = t, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: t, automatic: !1 }), !0) : !1;
|
|
2004
2019
|
}
|
|
2005
2020
|
createLocalAttachment(e) {
|
|
2006
|
-
this.options.productVariant === "customer_embedded" &&
|
|
2021
|
+
this.options.productVariant === "customer_embedded" && Zr(e);
|
|
2007
2022
|
const t = x(), n = {
|
|
2008
2023
|
id: t,
|
|
2009
2024
|
name: e.name || "attachment",
|
|
@@ -2109,7 +2124,7 @@ class Ne {
|
|
|
2109
2124
|
const n = await this.fetchEmbedAttachmentUpload(e, !1);
|
|
2110
2125
|
if (n.ok)
|
|
2111
2126
|
return await n.json();
|
|
2112
|
-
if (
|
|
2127
|
+
if (yo(n.status) && this.options.tokenProvider && !t) {
|
|
2113
2128
|
t = !0;
|
|
2114
2129
|
const i = await this.fetchEmbedAttachmentUpload(e, !0);
|
|
2115
2130
|
if (i.ok)
|
|
@@ -2134,7 +2149,7 @@ class Ne {
|
|
|
2134
2149
|
if (!this.state.sessionId)
|
|
2135
2150
|
return;
|
|
2136
2151
|
this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
|
|
2137
|
-
const e =
|
|
2152
|
+
const e = Or(
|
|
2138
2153
|
this.state.messages,
|
|
2139
2154
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
2140
2155
|
this.state.assistantDraftRunId,
|
|
@@ -2269,7 +2284,7 @@ class Ne {
|
|
|
2269
2284
|
throw new Error("This interaction is no longer available.");
|
|
2270
2285
|
if (!r.allowedActions.includes(t))
|
|
2271
2286
|
throw new Error("This action is not available for the interaction.");
|
|
2272
|
-
if (
|
|
2287
|
+
if (Fn(t) && await this.interactionManager.act(
|
|
2273
2288
|
{
|
|
2274
2289
|
key: r.id,
|
|
2275
2290
|
category: r.category,
|
|
@@ -2282,7 +2297,9 @@ class Ne {
|
|
|
2282
2297
|
const o = r.payload.request;
|
|
2283
2298
|
this.integrationAuthStatusByRequestId.set(o.authRequestId, "checking"), this.integrationAuthErrorByRequestId.delete(o.authRequestId), this.rebuildRuntimeInteractions();
|
|
2284
2299
|
try {
|
|
2285
|
-
await this.options.runtimeAdapters?.integrationAuthHandler?.(o)
|
|
2300
|
+
await this.options.runtimeAdapters?.integrationAuthHandler?.(o);
|
|
2301
|
+
const a = await this.options.runtimeAdapters?.integrationAuthStatusLoader?.(o) ?? "completed";
|
|
2302
|
+
this.integrationAuthStatusByRequestId.set(o.authRequestId, a);
|
|
2286
2303
|
} catch (a) {
|
|
2287
2304
|
this.integrationAuthStatusByRequestId.set(o.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(
|
|
2288
2305
|
o.authRequestId,
|
|
@@ -2444,7 +2461,7 @@ class Ne {
|
|
|
2444
2461
|
loadSession(e) {
|
|
2445
2462
|
const t = x(), n = this.activeComposerWarmupId;
|
|
2446
2463
|
this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
|
|
2447
|
-
const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o =
|
|
2464
|
+
const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = Dr(i ?? []);
|
|
2448
2465
|
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), n && this.send({
|
|
2449
2466
|
type: "session.reset",
|
|
2450
2467
|
warmupId: n,
|
|
@@ -2578,7 +2595,7 @@ class Ne {
|
|
|
2578
2595
|
});
|
|
2579
2596
|
if (!c.ok) {
|
|
2580
2597
|
const d = await c.text() || `History request failed (${c.status})`;
|
|
2581
|
-
throw
|
|
2598
|
+
throw $n(c.status) ? new Error(d) : new Te(d);
|
|
2582
2599
|
}
|
|
2583
2600
|
const u = await c.json();
|
|
2584
2601
|
if (!u?.session || !Array.isArray(u.items))
|
|
@@ -2683,7 +2700,7 @@ class Ne {
|
|
|
2683
2700
|
clientMessageId: e,
|
|
2684
2701
|
durationMs: Date.now() - n
|
|
2685
2702
|
});
|
|
2686
|
-
}, Math.max(0,
|
|
2703
|
+
}, Math.max(0, ti - (Date.now() - n)));
|
|
2687
2704
|
this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
|
|
2688
2705
|
}
|
|
2689
2706
|
clearFirstResponseTimer(e) {
|
|
@@ -2793,7 +2810,7 @@ class Ne {
|
|
|
2793
2810
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
2794
2811
|
return;
|
|
2795
2812
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
2796
|
-
const e =
|
|
2813
|
+
const e = zi();
|
|
2797
2814
|
this.sendNow(
|
|
2798
2815
|
L({
|
|
2799
2816
|
type: "starter_prompts.page_context",
|
|
@@ -2804,13 +2821,13 @@ class Ne {
|
|
|
2804
2821
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
2805
2822
|
}
|
|
2806
2823
|
startStarterPromptUrlWatcher() {
|
|
2807
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
2824
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = Ki(() => this.handleStarterPromptUrlChange()));
|
|
2808
2825
|
}
|
|
2809
2826
|
handleStarterPromptUrlChange() {
|
|
2810
2827
|
const e = location.href;
|
|
2811
2828
|
e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
|
|
2812
2829
|
this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
|
|
2813
|
-
},
|
|
2830
|
+
}, fi));
|
|
2814
2831
|
}
|
|
2815
2832
|
refreshStarterPromptsForCurrentUrl() {
|
|
2816
2833
|
this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
|
|
@@ -2840,7 +2857,7 @@ class Ne {
|
|
|
2840
2857
|
}
|
|
2841
2858
|
rememberSessionTimeline(e, t) {
|
|
2842
2859
|
const n = [...t];
|
|
2843
|
-
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size >
|
|
2860
|
+
for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > gi; ) {
|
|
2844
2861
|
const i = this.sessionTimelineCache.keys().next().value;
|
|
2845
2862
|
if (!i)
|
|
2846
2863
|
break;
|
|
@@ -2870,8 +2887,8 @@ class Ne {
|
|
|
2870
2887
|
return;
|
|
2871
2888
|
this.clearPendingWarmupAckTimer();
|
|
2872
2889
|
const t = Math.min(
|
|
2873
|
-
|
|
2874
|
-
|
|
2890
|
+
Jn * 2 ** e.retryAttempt,
|
|
2891
|
+
Yn
|
|
2875
2892
|
);
|
|
2876
2893
|
e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
|
|
2877
2894
|
this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
|
|
@@ -2994,7 +3011,7 @@ class Ne {
|
|
|
2994
3011
|
}
|
|
2995
3012
|
}
|
|
2996
3013
|
if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
|
|
2997
|
-
if (
|
|
3014
|
+
if (bi(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
|
|
2998
3015
|
this.handleRunSteered(e);
|
|
2999
3016
|
return;
|
|
3000
3017
|
}
|
|
@@ -3009,16 +3026,16 @@ class Ne {
|
|
|
3009
3026
|
this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
|
|
3010
3027
|
return;
|
|
3011
3028
|
}
|
|
3012
|
-
if (
|
|
3029
|
+
if (Mi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
3013
3030
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
|
|
3014
|
-
const t =
|
|
3031
|
+
const t = ar(e.user);
|
|
3015
3032
|
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();
|
|
3016
|
-
const n =
|
|
3033
|
+
const n = sr(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
3017
3034
|
b("web-sdk.agent", "Received auth.ok appearance", {
|
|
3018
3035
|
hasAppearance: i,
|
|
3019
3036
|
rawAppearance: e.appearance,
|
|
3020
3037
|
normalizedAppearance: n
|
|
3021
|
-
}), this.runtimeHelperJavascript =
|
|
3038
|
+
}), this.runtimeHelperJavascript = nr(e.runtimeHelpers)?.javascript ?? null;
|
|
3022
3039
|
const r = Vt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
|
|
3023
3040
|
user: t,
|
|
3024
3041
|
status: "connected",
|
|
@@ -3069,7 +3086,7 @@ class Ne {
|
|
|
3069
3086
|
runId: u?.runId
|
|
3070
3087
|
}), 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;
|
|
3071
3088
|
f && h && (this.pendingClientMessageId = h);
|
|
3072
|
-
let m =
|
|
3089
|
+
let m = fr(
|
|
3073
3090
|
e.assistantDraft
|
|
3074
3091
|
);
|
|
3075
3092
|
m && this.findStoppedTurn(r, {
|
|
@@ -3078,9 +3095,9 @@ class Ne {
|
|
|
3078
3095
|
}) && (m = void 0);
|
|
3079
3096
|
const M = m !== void 0;
|
|
3080
3097
|
this.rememberUserMessageClientMessageIds(g);
|
|
3081
|
-
const w =
|
|
3098
|
+
const w = Cr(g), D = g.filter((U) => {
|
|
3082
3099
|
const q = C(U);
|
|
3083
|
-
return
|
|
3100
|
+
return Er(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
|
|
3084
3101
|
}), S = lt(
|
|
3085
3102
|
this.state.messages,
|
|
3086
3103
|
st(D, this.options.backendUrl)
|
|
@@ -3091,12 +3108,12 @@ class Ne {
|
|
|
3091
3108
|
v,
|
|
3092
3109
|
re,
|
|
3093
3110
|
Y,
|
|
3094
|
-
|
|
3111
|
+
_r(g, q)
|
|
3095
3112
|
)
|
|
3096
|
-
), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q =
|
|
3097
|
-
if (!T &&
|
|
3113
|
+
), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q = br(S), oe = B && Q ? "completed" : d ? "stopped" : B ? "failed" : null;
|
|
3114
|
+
if (!T && kr(this.state.messages, g))
|
|
3098
3115
|
return;
|
|
3099
|
-
this.lastUserMessagePageUrl =
|
|
3116
|
+
this.lastUserMessagePageUrl = Rr(g);
|
|
3100
3117
|
const j = B || d ? null : ut(g);
|
|
3101
3118
|
if (this.latestRecoverableClientMessageId = j, Q && this.clearRetryTimers(), this.setState({
|
|
3102
3119
|
sessionId: A(e.session, "id") ?? this.state.sessionId,
|
|
@@ -3169,14 +3186,14 @@ class Ne {
|
|
|
3169
3186
|
this.options.backendUrl
|
|
3170
3187
|
);
|
|
3171
3188
|
t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
|
|
3172
|
-
messages:
|
|
3189
|
+
messages: Sr(this.state.messages, i)
|
|
3173
3190
|
});
|
|
3174
3191
|
return;
|
|
3175
3192
|
}
|
|
3176
3193
|
if (e.type === "sessions.page") {
|
|
3177
3194
|
const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
|
|
3178
3195
|
t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
|
|
3179
|
-
sessions:
|
|
3196
|
+
sessions: lr(e.sessions),
|
|
3180
3197
|
nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
|
|
3181
3198
|
}));
|
|
3182
3199
|
return;
|
|
@@ -3211,8 +3228,8 @@ class Ne {
|
|
|
3211
3228
|
}
|
|
3212
3229
|
const n = Ue(e.item, this.options.backendUrl);
|
|
3213
3230
|
if (n) {
|
|
3214
|
-
const i =
|
|
3215
|
-
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()),
|
|
3231
|
+
const i = xr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
3232
|
+
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), vr(t) && this.clearRunAckResyncRetryTimer();
|
|
3216
3233
|
const o = de(this.state.messages, n), a = ss(o), l = ns(
|
|
3217
3234
|
t,
|
|
3218
3235
|
this.state.assistantDraft,
|
|
@@ -3388,13 +3405,13 @@ class Ne {
|
|
|
3388
3405
|
return;
|
|
3389
3406
|
}
|
|
3390
3407
|
o && i && r && (this.retryableClientMessageId = r);
|
|
3391
|
-
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l =
|
|
3408
|
+
const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = $i(a.message);
|
|
3392
3409
|
l && console.error(l);
|
|
3393
3410
|
const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = rs(
|
|
3394
3411
|
this.state.messages,
|
|
3395
3412
|
c,
|
|
3396
3413
|
u
|
|
3397
|
-
), g =
|
|
3414
|
+
), g = Mr(
|
|
3398
3415
|
d,
|
|
3399
3416
|
c,
|
|
3400
3417
|
u
|
|
@@ -3561,7 +3578,7 @@ class Ne {
|
|
|
3561
3578
|
}
|
|
3562
3579
|
e.type === "error" && typeof e.requestId != "string" && !is(e, t) && this.rememberSessionTimeline(
|
|
3563
3580
|
t,
|
|
3564
|
-
|
|
3581
|
+
qr(n, e)
|
|
3565
3582
|
);
|
|
3566
3583
|
}
|
|
3567
3584
|
}
|
|
@@ -3659,7 +3676,7 @@ class Ne {
|
|
|
3659
3676
|
e.clear();
|
|
3660
3677
|
}
|
|
3661
3678
|
markThinkingProgress() {
|
|
3662
|
-
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(
|
|
3679
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(ei), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
3663
3680
|
}
|
|
3664
3681
|
scheduleThinkingWatchdog(e) {
|
|
3665
3682
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -3723,13 +3740,13 @@ class Ne {
|
|
|
3723
3740
|
if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
|
|
3724
3741
|
return;
|
|
3725
3742
|
const t = this.retryAttemptsByClientMessageId[e] ?? 0;
|
|
3726
|
-
if (t >=
|
|
3743
|
+
if (t >= si) {
|
|
3727
3744
|
this.failPendingDelivery(e);
|
|
3728
3745
|
return;
|
|
3729
3746
|
}
|
|
3730
3747
|
t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
3731
3748
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
3732
|
-
},
|
|
3749
|
+
}, mi(t, oi));
|
|
3733
3750
|
}
|
|
3734
3751
|
failPendingDelivery(e) {
|
|
3735
3752
|
if (this.pendingClientMessageId !== e)
|
|
@@ -3742,7 +3759,7 @@ class Ne {
|
|
|
3742
3759
|
...this.state.isThinking ? {} : { turnPhase: null },
|
|
3743
3760
|
isRetrying: !1,
|
|
3744
3761
|
...this.state.isThinking ? {} : { taskStatus: "failed" },
|
|
3745
|
-
lastError:
|
|
3762
|
+
lastError: ii,
|
|
3746
3763
|
lastErrorCode: "message_delivery_failed"
|
|
3747
3764
|
});
|
|
3748
3765
|
}
|
|
@@ -3809,7 +3826,7 @@ class Ne {
|
|
|
3809
3826
|
),
|
|
3810
3827
|
isThinking: !1,
|
|
3811
3828
|
taskStatus: "failed",
|
|
3812
|
-
lastError:
|
|
3829
|
+
lastError: ni,
|
|
3813
3830
|
lastErrorCode: "run_recovery_exhausted"
|
|
3814
3831
|
}), this.clearThinkingWatchdog();
|
|
3815
3832
|
return;
|
|
@@ -3836,7 +3853,7 @@ class Ne {
|
|
|
3836
3853
|
if (!t || !n || !i)
|
|
3837
3854
|
return;
|
|
3838
3855
|
const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
3839
|
-
if (!a && !l || !
|
|
3856
|
+
if (!a && !l || !io(o)) {
|
|
3840
3857
|
this.setToolMessageLoading(n, !1), this.send({
|
|
3841
3858
|
type: "tool.result",
|
|
3842
3859
|
sessionId: t,
|
|
@@ -3885,7 +3902,7 @@ class Ne {
|
|
|
3885
3902
|
let c = null, u;
|
|
3886
3903
|
c = await this.executeRuntimeHelper(), u = await Gt(
|
|
3887
3904
|
o,
|
|
3888
|
-
|
|
3905
|
+
Ni(e.runtimeContext, this.options.backendUrl)
|
|
3889
3906
|
).catch((d) => ({
|
|
3890
3907
|
ok: !1,
|
|
3891
3908
|
exception: {
|
|
@@ -3898,7 +3915,7 @@ class Ne {
|
|
|
3898
3915
|
toolName: i,
|
|
3899
3916
|
summary: o.summary,
|
|
3900
3917
|
rawInput: L(o),
|
|
3901
|
-
rawOutput: L(
|
|
3918
|
+
rawOutput: L(ir(u, c))
|
|
3902
3919
|
}), ls(this.options.clientId, this.activeBrowserToolCalls.values()));
|
|
3903
3920
|
}
|
|
3904
3921
|
setToolMessageLoading(e, t) {
|
|
@@ -3920,10 +3937,10 @@ class Ne {
|
|
|
3920
3937
|
};
|
|
3921
3938
|
}
|
|
3922
3939
|
installSessionBrowserApis() {
|
|
3923
|
-
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup =
|
|
3940
|
+
this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ci();
|
|
3924
3941
|
}
|
|
3925
3942
|
cleanupSessionBrowserApis() {
|
|
3926
|
-
this.sessionBrowserApisCleanup && (
|
|
3943
|
+
this.sessionBrowserApisCleanup && (xi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
|
|
3927
3944
|
}
|
|
3928
3945
|
async executeRuntimeHelper() {
|
|
3929
3946
|
if (!this.runtimeHelperJavascript?.trim())
|
|
@@ -3931,15 +3948,15 @@ class Ne {
|
|
|
3931
3948
|
const e = await Gt({
|
|
3932
3949
|
javascript: this.runtimeHelperJavascript
|
|
3933
3950
|
});
|
|
3934
|
-
return e.ok === !1 ?
|
|
3951
|
+
return e.ok === !1 ? rr(e) : null;
|
|
3935
3952
|
}
|
|
3936
3953
|
enableNetworkCapture() {
|
|
3937
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
3938
|
-
|
|
3954
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = wi((e) => {
|
|
3955
|
+
uo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
|
|
3939
3956
|
}));
|
|
3940
3957
|
}
|
|
3941
3958
|
enqueueNetworkEvent(e) {
|
|
3942
|
-
this.queuedNetworkEvents.length >=
|
|
3959
|
+
this.queuedNetworkEvents.length >= li || (this.queuedNetworkEvents.push(co(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
3943
3960
|
this.networkBatchTimer = null;
|
|
3944
3961
|
const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
3945
3962
|
t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
@@ -3948,14 +3965,14 @@ class Ne {
|
|
|
3948
3965
|
page: _(),
|
|
3949
3966
|
events: t
|
|
3950
3967
|
});
|
|
3951
|
-
},
|
|
3968
|
+
}, ai)));
|
|
3952
3969
|
}
|
|
3953
3970
|
scheduleReconnect(e = 0) {
|
|
3954
3971
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
3955
3972
|
return;
|
|
3956
3973
|
const t = Math.min(
|
|
3957
3974
|
ot,
|
|
3958
|
-
Math.max(
|
|
3975
|
+
Math.max(yi(this.reconnectAttempts), e)
|
|
3959
3976
|
);
|
|
3960
3977
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
3961
3978
|
this.reconnectTimer = null, this.connect().catch((n) => {
|
|
@@ -3972,8 +3989,8 @@ class Ne {
|
|
|
3972
3989
|
const e = this.socket;
|
|
3973
3990
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
3974
3991
|
this.socket === e && (b("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
3975
|
-
},
|
|
3976
|
-
},
|
|
3992
|
+
}, Kn));
|
|
3993
|
+
}, zn);
|
|
3977
3994
|
}
|
|
3978
3995
|
stopHeartbeat() {
|
|
3979
3996
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -4011,12 +4028,12 @@ class Ne {
|
|
|
4011
4028
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
4012
4029
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
4013
4030
|
}, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
|
|
4014
|
-
u && u === this.lastProjectedTurnClientMessageId && c &&
|
|
4031
|
+
u && u === this.lastProjectedTurnClientMessageId && c && Ri(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
|
|
4015
4032
|
clientMessageId: u,
|
|
4016
4033
|
reason: "active_turn_phase_moved_backward",
|
|
4017
4034
|
previousPhase: this.lastProjectedTurnPhase,
|
|
4018
4035
|
nextPhase: o.turnPhase
|
|
4019
|
-
}), 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),
|
|
4036
|
+
}), 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), Kr(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
|
|
4020
4037
|
status: this.state.status,
|
|
4021
4038
|
sessionId: this.state.sessionId,
|
|
4022
4039
|
messageCount: this.state.messages.length,
|
|
@@ -4075,13 +4092,13 @@ class Ne {
|
|
|
4075
4092
|
}
|
|
4076
4093
|
}
|
|
4077
4094
|
const Ze = /* @__PURE__ */ new WeakMap();
|
|
4078
|
-
function
|
|
4079
|
-
const e = window.__plunoProductAgentNetworkCapture ??
|
|
4095
|
+
function wi(s) {
|
|
4096
|
+
const e = window.__plunoProductAgentNetworkCapture ?? Ai();
|
|
4080
4097
|
return e.subscribers.add(s), () => {
|
|
4081
4098
|
e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
|
|
4082
4099
|
};
|
|
4083
4100
|
}
|
|
4084
|
-
function
|
|
4101
|
+
function Ai() {
|
|
4085
4102
|
const s = /* @__PURE__ */ new Set(), e = (g) => {
|
|
4086
4103
|
s.forEach((f) => {
|
|
4087
4104
|
try {
|
|
@@ -4098,7 +4115,7 @@ function Ti() {
|
|
|
4098
4115
|
throw m;
|
|
4099
4116
|
}
|
|
4100
4117
|
try {
|
|
4101
|
-
const m = f instanceof Request ? f : null, M =
|
|
4118
|
+
const m = f instanceof Request ? f : null, M = ro(f, m), w = Ls(h?.headers ?? m?.headers);
|
|
4102
4119
|
if (!te(M, w, h?.body)) {
|
|
4103
4120
|
const H = {
|
|
4104
4121
|
requestId: nt("fetch"),
|
|
@@ -4111,7 +4128,7 @@ function Ti() {
|
|
|
4111
4128
|
};
|
|
4112
4129
|
y.then(
|
|
4113
4130
|
(S) => {
|
|
4114
|
-
|
|
4131
|
+
oo(S, H, p, e).catch(() => {
|
|
4115
4132
|
e({
|
|
4116
4133
|
...H,
|
|
4117
4134
|
responseStatus: S.status,
|
|
@@ -4153,7 +4170,7 @@ function Ti() {
|
|
|
4153
4170
|
() => {
|
|
4154
4171
|
queueMicrotask(() => {
|
|
4155
4172
|
try {
|
|
4156
|
-
const p =
|
|
4173
|
+
const p = po(this.getAllResponseHeaders());
|
|
4157
4174
|
e({
|
|
4158
4175
|
requestId: h.requestId,
|
|
4159
4176
|
url: h.url,
|
|
@@ -4163,7 +4180,7 @@ function Ti() {
|
|
|
4163
4180
|
resourceType: "xhr",
|
|
4164
4181
|
responseStatus: this.status,
|
|
4165
4182
|
responseHeaders: p,
|
|
4166
|
-
responseBody:
|
|
4183
|
+
responseBody: lo(this, p),
|
|
4167
4184
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
4168
4185
|
startedAt: h.startedAt,
|
|
4169
4186
|
durationMs: Date.now() - h.startedAtMs
|
|
@@ -4259,10 +4276,10 @@ function Kt(s) {
|
|
|
4259
4276
|
const e = typeof s == "function" ? s() : s;
|
|
4260
4277
|
return e && Object.keys(e).length > 0 ? e : void 0;
|
|
4261
4278
|
}
|
|
4262
|
-
function
|
|
4279
|
+
function Mi(s) {
|
|
4263
4280
|
return s.type === "run.model_started" || s.type === "conversation.state" || s.type === "session.updated" || s.type === "session.item" || s.type === "chat.assistant_delta" || s.type === "chat.assistant_done" || s.type === "tool.call";
|
|
4264
4281
|
}
|
|
4265
|
-
function
|
|
4282
|
+
function bi(s) {
|
|
4266
4283
|
if (s.type === "chat.assistant_delta")
|
|
4267
4284
|
return typeof s.delta == "string" && s.delta.trim().length > 0;
|
|
4268
4285
|
if (s.type === "tool.call")
|
|
@@ -4272,7 +4289,7 @@ function Ai(s) {
|
|
|
4272
4289
|
const e = C(s.item);
|
|
4273
4290
|
return e ? e.type === "message" && e.role === "assistant" ? typeof e.content == "string" && e.content.trim().length > 0 : e.type === "tool_call" || e.type === "function_call" : !1;
|
|
4274
4291
|
}
|
|
4275
|
-
function
|
|
4292
|
+
function Ri(s, e) {
|
|
4276
4293
|
if (!s || !e)
|
|
4277
4294
|
return !1;
|
|
4278
4295
|
const t = {
|
|
@@ -4300,27 +4317,27 @@ function K(s) {
|
|
|
4300
4317
|
}
|
|
4301
4318
|
return null;
|
|
4302
4319
|
}
|
|
4303
|
-
const
|
|
4304
|
-
function
|
|
4320
|
+
const Ei = 5e3, ki = 12e4;
|
|
4321
|
+
function Ci() {
|
|
4305
4322
|
const s = [
|
|
4306
|
-
|
|
4307
|
-
|
|
4323
|
+
Pi(),
|
|
4324
|
+
_i()
|
|
4308
4325
|
].filter((e) => typeof e == "function");
|
|
4309
4326
|
return () => {
|
|
4310
4327
|
for (const e of s.reverse())
|
|
4311
4328
|
e();
|
|
4312
4329
|
};
|
|
4313
4330
|
}
|
|
4314
|
-
function
|
|
4331
|
+
function _i() {
|
|
4315
4332
|
return ps(globalThis, "getPageSnapshot", async () => At());
|
|
4316
4333
|
}
|
|
4317
|
-
function
|
|
4334
|
+
function Pi() {
|
|
4318
4335
|
return ps(globalThis, "pageImages", {
|
|
4319
|
-
inspectImage: async (e, t) => await
|
|
4336
|
+
inspectImage: async (e, t) => await vi(e, t)
|
|
4320
4337
|
});
|
|
4321
4338
|
}
|
|
4322
|
-
async function
|
|
4323
|
-
const t =
|
|
4339
|
+
async function vi(s, e = {}) {
|
|
4340
|
+
const t = Oi(e.name), n = await Ui(s);
|
|
4324
4341
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
4325
4342
|
type: "pluno.pageImages.inspectImage",
|
|
4326
4343
|
imageAttached: !1,
|
|
@@ -4338,15 +4355,15 @@ async function _i(s, e = {}) {
|
|
|
4338
4355
|
imageAttachmentError: n.error
|
|
4339
4356
|
};
|
|
4340
4357
|
}
|
|
4341
|
-
async function
|
|
4358
|
+
async function Ui(s) {
|
|
4342
4359
|
return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: As } : {
|
|
4343
4360
|
ok: !0,
|
|
4344
4361
|
mimeType: s.type,
|
|
4345
4362
|
sizeBytes: s.size,
|
|
4346
|
-
dataUrl: await
|
|
4347
|
-
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } :
|
|
4363
|
+
dataUrl: await Li(s)
|
|
4364
|
+
} : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Di(s);
|
|
4348
4365
|
}
|
|
4349
|
-
function
|
|
4366
|
+
function Di(s) {
|
|
4350
4367
|
if (!s.startsWith("data:") || !s.includes(","))
|
|
4351
4368
|
return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
|
|
4352
4369
|
const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
|
|
@@ -4357,7 +4374,7 @@ function vi(s) {
|
|
|
4357
4374
|
const r = t.replace(/[ \t\r\n\f]+/g, "");
|
|
4358
4375
|
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
|
|
4359
4376
|
return { ok: !1, error: "Page image data URL has invalid base64." };
|
|
4360
|
-
const o =
|
|
4377
|
+
const o = qi(r);
|
|
4361
4378
|
return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
|
|
4362
4379
|
ok: !0,
|
|
4363
4380
|
mimeType: i,
|
|
@@ -4365,22 +4382,22 @@ function vi(s) {
|
|
|
4365
4382
|
dataUrl: `data:${i};base64,${r}`
|
|
4366
4383
|
};
|
|
4367
4384
|
}
|
|
4368
|
-
function
|
|
4385
|
+
function qi(s) {
|
|
4369
4386
|
if (s.length === 0 || s.length % 4 !== 0)
|
|
4370
4387
|
return null;
|
|
4371
4388
|
const e = s.length - s.replace(/=+$/, "").length;
|
|
4372
4389
|
return e > 2 ? null : s.length / 4 * 3 - e;
|
|
4373
4390
|
}
|
|
4374
|
-
function
|
|
4391
|
+
function Oi(s) {
|
|
4375
4392
|
return (typeof s == "string" ? s.trim() : "") || "Page image";
|
|
4376
4393
|
}
|
|
4377
|
-
function
|
|
4394
|
+
function xi(s) {
|
|
4378
4395
|
try {
|
|
4379
4396
|
s();
|
|
4380
4397
|
} catch {
|
|
4381
4398
|
}
|
|
4382
4399
|
}
|
|
4383
|
-
function
|
|
4400
|
+
function Li(s) {
|
|
4384
4401
|
return new Promise((e, t) => {
|
|
4385
4402
|
const n = new FileReader();
|
|
4386
4403
|
n.onload = () => {
|
|
@@ -4394,7 +4411,7 @@ function Oi(s) {
|
|
|
4394
4411
|
}
|
|
4395
4412
|
async function Gt(s, e) {
|
|
4396
4413
|
const t = Object.getPrototypeOf(async function() {
|
|
4397
|
-
}).constructor, n = s.timeoutMs ??
|
|
4414
|
+
}).constructor, n = s.timeoutMs ?? Ei, i = Date.now(), r = [];
|
|
4398
4415
|
let o;
|
|
4399
4416
|
const a = {
|
|
4400
4417
|
log: console.log,
|
|
@@ -4412,7 +4429,7 @@ async function Gt(s, e) {
|
|
|
4412
4429
|
o = window.setTimeout(() => d(c), n);
|
|
4413
4430
|
})
|
|
4414
4431
|
]);
|
|
4415
|
-
return u === c ?
|
|
4432
|
+
return u === c ? Hi(n) : {
|
|
4416
4433
|
ok: !0,
|
|
4417
4434
|
result: u,
|
|
4418
4435
|
console: r,
|
|
@@ -4441,7 +4458,7 @@ async function Gt(s, e) {
|
|
|
4441
4458
|
e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
|
|
4442
4459
|
}
|
|
4443
4460
|
}
|
|
4444
|
-
function
|
|
4461
|
+
function Ni(s, e) {
|
|
4445
4462
|
if (!s || typeof s != "object")
|
|
4446
4463
|
return;
|
|
4447
4464
|
const t = s.sandboxFilesToken;
|
|
@@ -4451,7 +4468,7 @@ function xi(s, e) {
|
|
|
4451
4468
|
const i = () => {
|
|
4452
4469
|
if (!n)
|
|
4453
4470
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
4454
|
-
}, r = async (a, l) => await
|
|
4471
|
+
}, r = async (a, l) => await xn(`${e.replace(/\/$/, "")}${a}`, l);
|
|
4455
4472
|
return {
|
|
4456
4473
|
value: Object.freeze({
|
|
4457
4474
|
upload: async (a) => {
|
|
@@ -4485,7 +4502,7 @@ function xi(s, e) {
|
|
|
4485
4502
|
}
|
|
4486
4503
|
};
|
|
4487
4504
|
}
|
|
4488
|
-
function
|
|
4505
|
+
function Hi(s) {
|
|
4489
4506
|
return {
|
|
4490
4507
|
ok: !1,
|
|
4491
4508
|
exception: {
|
|
@@ -4499,10 +4516,10 @@ function Li(s) {
|
|
|
4499
4516
|
}
|
|
4500
4517
|
};
|
|
4501
4518
|
}
|
|
4502
|
-
function
|
|
4519
|
+
function Bi(s) {
|
|
4503
4520
|
return s.replace(/\/+$/, "");
|
|
4504
4521
|
}
|
|
4505
|
-
function
|
|
4522
|
+
function Fi(s) {
|
|
4506
4523
|
const e = {
|
|
4507
4524
|
sidepanel: "extension_sidepanel",
|
|
4508
4525
|
browser_extension_page_ui: "extension_widget",
|
|
@@ -4514,13 +4531,13 @@ function Hi(s) {
|
|
|
4514
4531
|
};
|
|
4515
4532
|
return s && s in e ? e[s] : s ?? "embedded_custom_ui";
|
|
4516
4533
|
}
|
|
4517
|
-
function
|
|
4534
|
+
function Wi(s) {
|
|
4518
4535
|
return s === "pluno" ? "scheduled_continuation" : s ?? "user";
|
|
4519
4536
|
}
|
|
4520
|
-
function
|
|
4537
|
+
function $i(s, e = location.origin) {
|
|
4521
4538
|
return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
|
|
4522
4539
|
}
|
|
4523
|
-
function
|
|
4540
|
+
function ji(s) {
|
|
4524
4541
|
const e = new URL("/api/product-agent/embed/ws", s);
|
|
4525
4542
|
return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
|
|
4526
4543
|
}
|
|
@@ -4533,19 +4550,19 @@ function _() {
|
|
|
4533
4550
|
...s ? { plunoProductAgentUi: s } : {}
|
|
4534
4551
|
};
|
|
4535
4552
|
}
|
|
4536
|
-
function
|
|
4553
|
+
function zi() {
|
|
4537
4554
|
return {
|
|
4538
4555
|
pageUrl: location.href,
|
|
4539
4556
|
pageTitle: document.title,
|
|
4540
4557
|
htmlContent: At()
|
|
4541
4558
|
};
|
|
4542
4559
|
}
|
|
4543
|
-
function
|
|
4544
|
-
return Ce.add(s), we || (we =
|
|
4560
|
+
function Ki(s) {
|
|
4561
|
+
return Ce.add(s), we || (we = Gi()), () => {
|
|
4545
4562
|
Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
|
|
4546
4563
|
};
|
|
4547
4564
|
}
|
|
4548
|
-
function
|
|
4565
|
+
function Gi() {
|
|
4549
4566
|
const s = () => {
|
|
4550
4567
|
for (const r of Array.from(Ce))
|
|
4551
4568
|
r();
|
|
@@ -4576,12 +4593,12 @@ function At() {
|
|
|
4576
4593
|
);
|
|
4577
4594
|
for (const p of i.slice(0, 3))
|
|
4578
4595
|
t("Active overlay", tt(he(p), e));
|
|
4579
|
-
const r =
|
|
4596
|
+
const r = Qi(), o = r ? tt(he(r), e) : "";
|
|
4580
4597
|
t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
|
|
4581
4598
|
const a = s.map(([p, y]) => `${p}:
|
|
4582
4599
|
${y}`).join(`
|
|
4583
4600
|
|
|
4584
|
-
`).trim().slice(0, 12e3), l =
|
|
4601
|
+
`).trim().slice(0, 12e3), l = Vi(i, r).trim(), c = `Simplified DOM outline:
|
|
4585
4602
|
`, u = `
|
|
4586
4603
|
|
|
4587
4604
|
Visible page text:
|
|
@@ -4609,10 +4626,10 @@ function bs(s) {
|
|
|
4609
4626
|
const e = window.getComputedStyle(s);
|
|
4610
4627
|
return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
|
|
4611
4628
|
}
|
|
4612
|
-
function
|
|
4629
|
+
function Qi() {
|
|
4613
4630
|
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(bs).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
|
|
4614
4631
|
}
|
|
4615
|
-
function
|
|
4632
|
+
function Vi(s, e) {
|
|
4616
4633
|
const t = /* @__PURE__ */ new Set([
|
|
4617
4634
|
"main",
|
|
4618
4635
|
"nav",
|
|
@@ -4692,7 +4709,7 @@ function Gi(s, e) {
|
|
|
4692
4709
|
"data-test",
|
|
4693
4710
|
"data-qa",
|
|
4694
4711
|
"data-cy"
|
|
4695
|
-
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } =
|
|
4712
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = Xi(), g = new Set(s);
|
|
4696
4713
|
e && g.add(e);
|
|
4697
4714
|
let f = 0;
|
|
4698
4715
|
const h = (w) => {
|
|
@@ -4762,7 +4779,7 @@ function Gi(s, e) {
|
|
|
4762
4779
|
`);
|
|
4763
4780
|
}, m = [], M = ne(window.getSelection()?.toString() ?? "");
|
|
4764
4781
|
M && m.push(`--- selected text ---
|
|
4765
|
-
${JSON.stringify(M)}`), d.length > 0 && m.push(
|
|
4782
|
+
${JSON.stringify(M)}`), d.length > 0 && m.push(Ji(d, t, l, o));
|
|
4766
4783
|
for (const w of s.slice(0, 3))
|
|
4767
4784
|
m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
4768
4785
|
if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -4777,7 +4794,7 @@ function Rs(s, e, t, n) {
|
|
|
4777
4794
|
const i = s.tagName.toLowerCase();
|
|
4778
4795
|
let r = i;
|
|
4779
4796
|
const o = s.getAttribute("id");
|
|
4780
|
-
o &&
|
|
4797
|
+
o && Yi(o) && (r += `#${o}`);
|
|
4781
4798
|
for (const a of e) {
|
|
4782
4799
|
const l = s.getAttribute(a);
|
|
4783
4800
|
l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
|
|
@@ -4790,7 +4807,7 @@ function Rs(s, e, t, n) {
|
|
|
4790
4807
|
s.hasAttribute(a) && (r += `[${a}]`);
|
|
4791
4808
|
return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
4792
4809
|
}
|
|
4793
|
-
function
|
|
4810
|
+
function Xi() {
|
|
4794
4811
|
const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
|
|
4795
4812
|
if (!a)
|
|
4796
4813
|
return;
|
|
@@ -4833,7 +4850,7 @@ function Qi() {
|
|
|
4833
4850
|
priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
|
|
4834
4851
|
};
|
|
4835
4852
|
}
|
|
4836
|
-
function
|
|
4853
|
+
function Ji(s, e, t, n) {
|
|
4837
4854
|
const i = ["--- active/current elements ---"];
|
|
4838
4855
|
for (const r of s) {
|
|
4839
4856
|
const o = [];
|
|
@@ -4869,12 +4886,12 @@ function Es(s) {
|
|
|
4869
4886
|
Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
|
|
4870
4887
|
);
|
|
4871
4888
|
}
|
|
4872
|
-
function
|
|
4889
|
+
function Yi(s) {
|
|
4873
4890
|
return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
|
|
4874
4891
|
}
|
|
4875
4892
|
function ks() {
|
|
4876
4893
|
const s = Array.from(document.querySelectorAll(Ht)), e = s.find(
|
|
4877
|
-
(r) => typeof r[
|
|
4894
|
+
(r) => typeof r[Bn] == "string"
|
|
4878
4895
|
);
|
|
4879
4896
|
if (!(e ?? s[0]))
|
|
4880
4897
|
return;
|
|
@@ -4890,23 +4907,23 @@ function ks() {
|
|
|
4890
4907
|
},
|
|
4891
4908
|
{
|
|
4892
4909
|
name: "widget_root",
|
|
4893
|
-
selector:
|
|
4910
|
+
selector: Ln,
|
|
4894
4911
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
4895
4912
|
},
|
|
4896
4913
|
{
|
|
4897
4914
|
name: "widget_panel",
|
|
4898
|
-
selector:
|
|
4915
|
+
selector: Nn,
|
|
4899
4916
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
4900
4917
|
},
|
|
4901
4918
|
{
|
|
4902
4919
|
name: "widget_timeline",
|
|
4903
|
-
selector:
|
|
4920
|
+
selector: Hn,
|
|
4904
4921
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
4905
4922
|
}
|
|
4906
4923
|
]
|
|
4907
4924
|
};
|
|
4908
4925
|
}
|
|
4909
|
-
function
|
|
4926
|
+
function Zi(s) {
|
|
4910
4927
|
try {
|
|
4911
4928
|
const e = JSON.parse(s);
|
|
4912
4929
|
return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
|
|
@@ -4914,7 +4931,7 @@ function Ji(s) {
|
|
|
4914
4931
|
return { type: "error", message: "Invalid server event" };
|
|
4915
4932
|
}
|
|
4916
4933
|
}
|
|
4917
|
-
function
|
|
4934
|
+
function er(s) {
|
|
4918
4935
|
if (typeof s != "string")
|
|
4919
4936
|
return null;
|
|
4920
4937
|
try {
|
|
@@ -4938,10 +4955,10 @@ function Xt(s) {
|
|
|
4938
4955
|
return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
|
|
4939
4956
|
}) : [];
|
|
4940
4957
|
}
|
|
4941
|
-
function
|
|
4958
|
+
function tr(s) {
|
|
4942
4959
|
return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
4943
4960
|
}
|
|
4944
|
-
function
|
|
4961
|
+
function sr(s) {
|
|
4945
4962
|
if (!s || typeof s != "object")
|
|
4946
4963
|
return null;
|
|
4947
4964
|
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;
|
|
@@ -4952,13 +4969,13 @@ function er(s) {
|
|
|
4952
4969
|
...a !== null ? { scribbleStyle: a } : {}
|
|
4953
4970
|
};
|
|
4954
4971
|
}
|
|
4955
|
-
function
|
|
4972
|
+
function nr(s) {
|
|
4956
4973
|
if (!s || typeof s != "object")
|
|
4957
4974
|
return null;
|
|
4958
4975
|
const e = s.javascript;
|
|
4959
4976
|
return typeof e != "string" || !e.trim() ? null : { javascript: e };
|
|
4960
4977
|
}
|
|
4961
|
-
function
|
|
4978
|
+
function ir(s, e) {
|
|
4962
4979
|
return e ? s && typeof s == "object" ? {
|
|
4963
4980
|
...s,
|
|
4964
4981
|
helperError: e
|
|
@@ -4968,13 +4985,13 @@ function sr(s, e) {
|
|
|
4968
4985
|
helperError: e
|
|
4969
4986
|
} : s;
|
|
4970
4987
|
}
|
|
4971
|
-
function
|
|
4988
|
+
function rr(s) {
|
|
4972
4989
|
if (!s || typeof s != "object")
|
|
4973
4990
|
return s;
|
|
4974
4991
|
const e = s;
|
|
4975
4992
|
return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
|
|
4976
4993
|
}
|
|
4977
|
-
function
|
|
4994
|
+
function or() {
|
|
4978
4995
|
const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
|
|
4979
4996
|
if (e)
|
|
4980
4997
|
return e;
|
|
@@ -4984,7 +5001,7 @@ function ir() {
|
|
|
4984
5001
|
function x() {
|
|
4985
5002
|
return crypto.randomUUID();
|
|
4986
5003
|
}
|
|
4987
|
-
function
|
|
5004
|
+
function ar(s) {
|
|
4988
5005
|
if (!s || typeof s != "object")
|
|
4989
5006
|
return null;
|
|
4990
5007
|
const e = s, t = typeof e.id == "string" ? e.id : null;
|
|
@@ -5000,7 +5017,7 @@ function st(s, e) {
|
|
|
5000
5017
|
s.map((t) => Ue(t, e)).filter((t) => t !== null)
|
|
5001
5018
|
) : [];
|
|
5002
5019
|
}
|
|
5003
|
-
function
|
|
5020
|
+
function lr(s) {
|
|
5004
5021
|
return Array.isArray(s) ? s.flatMap((e) => {
|
|
5005
5022
|
if (!e || typeof e != "object")
|
|
5006
5023
|
return [];
|
|
@@ -5107,7 +5124,7 @@ function Ue(s, e) {
|
|
|
5107
5124
|
scheduledCheckInId: o.id ?? void 0,
|
|
5108
5125
|
scheduledCheckInAt: o.dueAt
|
|
5109
5126
|
};
|
|
5110
|
-
const a =
|
|
5127
|
+
const a = ur(i.output), l = dr(i.output);
|
|
5111
5128
|
return a ? {
|
|
5112
5129
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5113
5130
|
role: "tool",
|
|
@@ -5139,7 +5156,7 @@ function Ue(s, e) {
|
|
|
5139
5156
|
return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
|
|
5140
5157
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5141
5158
|
role: "tool",
|
|
5142
|
-
content: i.type === "mcp_call" ?
|
|
5159
|
+
content: i.type === "mcp_call" ? cr(i) : pr(i),
|
|
5143
5160
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5144
5161
|
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5145
5162
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
@@ -5153,7 +5170,7 @@ function Ue(s, e) {
|
|
|
5153
5170
|
} : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
|
|
5154
5171
|
id: String(t.id ?? crypto.randomUUID()),
|
|
5155
5172
|
role: "system",
|
|
5156
|
-
content:
|
|
5173
|
+
content: hr(i),
|
|
5157
5174
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
5158
5175
|
...k(i) !== null ? { displaySequence: k(i) } : {},
|
|
5159
5176
|
...P(i) !== null ? { causalSequence: P(i) } : {},
|
|
@@ -5166,11 +5183,11 @@ function Ue(s, e) {
|
|
|
5166
5183
|
...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
|
|
5167
5184
|
} : null;
|
|
5168
5185
|
}
|
|
5169
|
-
function
|
|
5186
|
+
function cr(s) {
|
|
5170
5187
|
const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
|
|
5171
5188
|
return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
|
|
5172
5189
|
}
|
|
5173
|
-
function
|
|
5190
|
+
function ur(s) {
|
|
5174
5191
|
if (typeof s != "string")
|
|
5175
5192
|
return null;
|
|
5176
5193
|
try {
|
|
@@ -5187,7 +5204,7 @@ function lr(s) {
|
|
|
5187
5204
|
return null;
|
|
5188
5205
|
}
|
|
5189
5206
|
}
|
|
5190
|
-
function
|
|
5207
|
+
function dr(s) {
|
|
5191
5208
|
if (typeof s != "string")
|
|
5192
5209
|
return null;
|
|
5193
5210
|
try {
|
|
@@ -5202,10 +5219,10 @@ function cr(s) {
|
|
|
5202
5219
|
return null;
|
|
5203
5220
|
}
|
|
5204
5221
|
}
|
|
5205
|
-
function
|
|
5222
|
+
function hr(s) {
|
|
5206
5223
|
return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
|
|
5207
5224
|
}
|
|
5208
|
-
function
|
|
5225
|
+
function pr(s) {
|
|
5209
5226
|
if (s.type === "web_search_call") {
|
|
5210
5227
|
const e = s.action;
|
|
5211
5228
|
if (e && typeof e == "object") {
|
|
@@ -5217,9 +5234,9 @@ function dr(s) {
|
|
|
5217
5234
|
}
|
|
5218
5235
|
return "🔎 Searching the web";
|
|
5219
5236
|
}
|
|
5220
|
-
return
|
|
5237
|
+
return gr(s);
|
|
5221
5238
|
}
|
|
5222
|
-
function
|
|
5239
|
+
function gr(s) {
|
|
5223
5240
|
if (typeof s.summary == "string" && s.summary.trim().length > 0)
|
|
5224
5241
|
return se(s.summary);
|
|
5225
5242
|
if (typeof s.arguments == "string")
|
|
@@ -5236,7 +5253,7 @@ function se(s) {
|
|
|
5236
5253
|
const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
|
|
5237
5254
|
return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
|
|
5238
5255
|
}
|
|
5239
|
-
function
|
|
5256
|
+
function fr(s) {
|
|
5240
5257
|
if (s == null)
|
|
5241
5258
|
return s;
|
|
5242
5259
|
if (typeof s != "object")
|
|
@@ -5273,10 +5290,10 @@ function de(s, e) {
|
|
|
5273
5290
|
const t = Cs(
|
|
5274
5291
|
s,
|
|
5275
5292
|
Mt(s, e)
|
|
5276
|
-
), n =
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5293
|
+
), n = Ir(
|
|
5294
|
+
yr(
|
|
5295
|
+
Ar(
|
|
5296
|
+
mr(s, e),
|
|
5280
5297
|
e
|
|
5281
5298
|
),
|
|
5282
5299
|
t
|
|
@@ -5301,7 +5318,7 @@ function Mt(s, e, t = !0) {
|
|
|
5301
5318
|
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] : []);
|
|
5302
5319
|
return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
|
|
5303
5320
|
}
|
|
5304
|
-
function
|
|
5321
|
+
function mr(s, e) {
|
|
5305
5322
|
const t = e.proactiveSuggestionClientMessageId;
|
|
5306
5323
|
if (!t)
|
|
5307
5324
|
return s;
|
|
@@ -5311,7 +5328,7 @@ function gr(s, e) {
|
|
|
5311
5328
|
const r = [...s];
|
|
5312
5329
|
return r[i] = e, r;
|
|
5313
5330
|
}
|
|
5314
|
-
function
|
|
5331
|
+
function yr(s, e) {
|
|
5315
5332
|
const t = e.assistantDraftItemId;
|
|
5316
5333
|
return t ? s.map(
|
|
5317
5334
|
(n) => n.dataType === "assistant_draft" && n.id === t ? e : n
|
|
@@ -5379,7 +5396,7 @@ function ts(s) {
|
|
|
5379
5396
|
loading: !0
|
|
5380
5397
|
};
|
|
5381
5398
|
}
|
|
5382
|
-
function
|
|
5399
|
+
function Ir(s, e) {
|
|
5383
5400
|
if (e.id.startsWith("transient-activity:"))
|
|
5384
5401
|
return s;
|
|
5385
5402
|
const t = e.toolName === "tab_lifecycle";
|
|
@@ -5405,7 +5422,7 @@ function lt(s, e) {
|
|
|
5405
5422
|
ct
|
|
5406
5423
|
);
|
|
5407
5424
|
}
|
|
5408
|
-
function
|
|
5425
|
+
function Sr(s, e) {
|
|
5409
5426
|
const t = new Map(s.map((r) => [r.id, r])), n = e.map(
|
|
5410
5427
|
(r) => Mt(s, r, !1)
|
|
5411
5428
|
);
|
|
@@ -5455,22 +5472,22 @@ function Cs(s, e) {
|
|
|
5455
5472
|
if (!t?.attachments?.length)
|
|
5456
5473
|
return e;
|
|
5457
5474
|
const n = e.attachments.map((o) => {
|
|
5458
|
-
const a =
|
|
5459
|
-
return a ?
|
|
5475
|
+
const a = Tr(t.attachments ?? [], o);
|
|
5476
|
+
return a ? wr(o, a) : o;
|
|
5460
5477
|
}), i = { ...e, attachments: n }, r = J(e);
|
|
5461
5478
|
return r && Object.defineProperty(i, "clientMessageId", {
|
|
5462
5479
|
value: r,
|
|
5463
5480
|
enumerable: !1
|
|
5464
5481
|
}), i;
|
|
5465
5482
|
}
|
|
5466
|
-
function
|
|
5483
|
+
function Tr(s, e) {
|
|
5467
5484
|
return e.id ? s.find((t) => t.id === e.id) ?? null : null;
|
|
5468
5485
|
}
|
|
5469
|
-
function
|
|
5486
|
+
function wr(s, e) {
|
|
5470
5487
|
const { previewUrl: t } = e;
|
|
5471
5488
|
return t ? { ...s, previewUrl: t } : s;
|
|
5472
5489
|
}
|
|
5473
|
-
function
|
|
5490
|
+
function Ar(s, e) {
|
|
5474
5491
|
if (e.role !== "user")
|
|
5475
5492
|
return s;
|
|
5476
5493
|
const t = s.findIndex(
|
|
@@ -5521,7 +5538,7 @@ function ss(s) {
|
|
|
5521
5538
|
}
|
|
5522
5539
|
return !1;
|
|
5523
5540
|
}
|
|
5524
|
-
function
|
|
5541
|
+
function Mr(s, e, t) {
|
|
5525
5542
|
const n = new Set(
|
|
5526
5543
|
s.filter(
|
|
5527
5544
|
(i) => i.role === "user" && e !== null && J(i) === e
|
|
@@ -5541,7 +5558,7 @@ function wr(s, e, t) {
|
|
|
5541
5558
|
return !1;
|
|
5542
5559
|
});
|
|
5543
5560
|
}
|
|
5544
|
-
function
|
|
5561
|
+
function br(s) {
|
|
5545
5562
|
const e = Ps(s);
|
|
5546
5563
|
if (e === null)
|
|
5547
5564
|
return s.some(W);
|
|
@@ -5573,7 +5590,7 @@ function ie(s) {
|
|
|
5573
5590
|
}
|
|
5574
5591
|
return null;
|
|
5575
5592
|
}
|
|
5576
|
-
function
|
|
5593
|
+
function Rr(s) {
|
|
5577
5594
|
const e = ie(s);
|
|
5578
5595
|
if (e === null)
|
|
5579
5596
|
return null;
|
|
@@ -5592,10 +5609,10 @@ function C(s) {
|
|
|
5592
5609
|
function pe(s) {
|
|
5593
5610
|
return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
|
|
5594
5611
|
}
|
|
5595
|
-
function
|
|
5612
|
+
function Er(s) {
|
|
5596
5613
|
return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
|
|
5597
5614
|
}
|
|
5598
|
-
function
|
|
5615
|
+
function kr(s, e) {
|
|
5599
5616
|
const t = ie(e);
|
|
5600
5617
|
if (t === null)
|
|
5601
5618
|
return !1;
|
|
@@ -5620,7 +5637,7 @@ function ut(s) {
|
|
|
5620
5637
|
const i = n.clientMessageId;
|
|
5621
5638
|
return typeof i == "string" ? i : null;
|
|
5622
5639
|
}
|
|
5623
|
-
function
|
|
5640
|
+
function Cr(s) {
|
|
5624
5641
|
const e = ie(s);
|
|
5625
5642
|
if (e === null)
|
|
5626
5643
|
return null;
|
|
@@ -5651,7 +5668,7 @@ function dt(s, e) {
|
|
|
5651
5668
|
return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
|
|
5652
5669
|
}
|
|
5653
5670
|
function ns(s, e, t, n, i, r) {
|
|
5654
|
-
if (!e || !
|
|
5671
|
+
if (!e || !Pr(s))
|
|
5655
5672
|
return !1;
|
|
5656
5673
|
const o = s;
|
|
5657
5674
|
if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
|
|
@@ -5659,7 +5676,7 @@ function ns(s, e, t, n, i, r) {
|
|
|
5659
5676
|
const a = O(o);
|
|
5660
5677
|
return n !== null ? a !== null ? a === n : i !== null && E(o) === i && r === n : i === null || E(o) === i;
|
|
5661
5678
|
}
|
|
5662
|
-
function
|
|
5679
|
+
function _r(s, e) {
|
|
5663
5680
|
for (let t = e - 1; t >= 0; t -= 1) {
|
|
5664
5681
|
const n = C(s[t]);
|
|
5665
5682
|
if (n?.type === "message" && n.role === "user")
|
|
@@ -5673,7 +5690,7 @@ function vs(s, e) {
|
|
|
5673
5690
|
return s[t].id;
|
|
5674
5691
|
return null;
|
|
5675
5692
|
}
|
|
5676
|
-
function
|
|
5693
|
+
function Pr(s) {
|
|
5677
5694
|
if (!s || typeof s != "object")
|
|
5678
5695
|
return !1;
|
|
5679
5696
|
const e = s;
|
|
@@ -5682,16 +5699,16 @@ function Cr(s) {
|
|
|
5682
5699
|
function W(s) {
|
|
5683
5700
|
return s.role === "assistant" && s.phase !== "commentary";
|
|
5684
5701
|
}
|
|
5685
|
-
function
|
|
5702
|
+
function vr(s) {
|
|
5686
5703
|
if (!s || typeof s != "object")
|
|
5687
5704
|
return !1;
|
|
5688
5705
|
const e = s;
|
|
5689
5706
|
return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
|
|
5690
5707
|
}
|
|
5691
5708
|
function ht(s) {
|
|
5692
|
-
return s.filter((e, t) => G(e) ? !
|
|
5709
|
+
return s.filter((e, t) => G(e) ? !jr(s, t) && !Us(s, t) && !Wr(s, t) && !$r(s, t) : Ur(e) ? e.retryable === !0 && Fr(s, t) ? !1 : !Br(s, t) : !0);
|
|
5693
5710
|
}
|
|
5694
|
-
function
|
|
5711
|
+
function Ur(s) {
|
|
5695
5712
|
return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
|
|
5696
5713
|
}
|
|
5697
5714
|
function G(s) {
|
|
@@ -5700,17 +5717,17 @@ function G(s) {
|
|
|
5700
5717
|
function pt(s) {
|
|
5701
5718
|
return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
|
|
5702
5719
|
}
|
|
5703
|
-
function
|
|
5720
|
+
function Dr(s) {
|
|
5704
5721
|
return s.some(pt);
|
|
5705
5722
|
}
|
|
5706
5723
|
function is(s, e) {
|
|
5707
5724
|
return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
|
|
5708
5725
|
}
|
|
5709
|
-
function
|
|
5726
|
+
function qr(s, e) {
|
|
5710
5727
|
const t = [...s].reverse().find(pt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
|
|
5711
5728
|
return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : pt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
|
|
5712
5729
|
}
|
|
5713
|
-
function
|
|
5730
|
+
function Or(s, e, t, n) {
|
|
5714
5731
|
const i = s.findIndex(
|
|
5715
5732
|
(l, c) => G(l) && !Us(s, c)
|
|
5716
5733
|
), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
|
|
@@ -5725,7 +5742,7 @@ function Dr(s, e, t, n) {
|
|
|
5725
5742
|
function _e(s) {
|
|
5726
5743
|
return s?.type === "run_status" && s.status === "stopped";
|
|
5727
5744
|
}
|
|
5728
|
-
function
|
|
5745
|
+
function xr(s, e) {
|
|
5729
5746
|
return W(e) ? "completed" : _e(s) ? "stopped" : !pe(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
|
|
5730
5747
|
}
|
|
5731
5748
|
function rs(s, e, t) {
|
|
@@ -5740,14 +5757,14 @@ function rs(s, e, t) {
|
|
|
5740
5757
|
}
|
|
5741
5758
|
function Us(s, e) {
|
|
5742
5759
|
return s.some(
|
|
5743
|
-
(t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) &&
|
|
5760
|
+
(t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Lr(
|
|
5744
5761
|
s,
|
|
5745
5762
|
e,
|
|
5746
5763
|
n
|
|
5747
5764
|
)
|
|
5748
5765
|
);
|
|
5749
5766
|
}
|
|
5750
|
-
function
|
|
5767
|
+
function Lr(s, e, t) {
|
|
5751
5768
|
const n = s[e], i = s[t];
|
|
5752
5769
|
if (ge(n, i))
|
|
5753
5770
|
return !0;
|
|
@@ -5760,11 +5777,11 @@ function Or(s, e, t) {
|
|
|
5760
5777
|
}
|
|
5761
5778
|
function os(s, e, t, n) {
|
|
5762
5779
|
const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
|
|
5763
|
-
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !
|
|
5780
|
+
(l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !Hr(
|
|
5764
5781
|
s,
|
|
5765
5782
|
l.respondsToUserMessageId
|
|
5766
5783
|
)
|
|
5767
|
-
)?.respondsToUserMessageId ??
|
|
5784
|
+
)?.respondsToUserMessageId ?? Nr(
|
|
5768
5785
|
s,
|
|
5769
5786
|
e
|
|
5770
5787
|
);
|
|
@@ -5793,7 +5810,7 @@ function os(s, e, t, n) {
|
|
|
5793
5810
|
}
|
|
5794
5811
|
];
|
|
5795
5812
|
}
|
|
5796
|
-
function
|
|
5813
|
+
function Nr(s, e) {
|
|
5797
5814
|
const t = s.findIndex(
|
|
5798
5815
|
(n) => n.role === "user" && n.id === e
|
|
5799
5816
|
);
|
|
@@ -5807,12 +5824,12 @@ function xr(s, e) {
|
|
|
5807
5824
|
function as(s) {
|
|
5808
5825
|
return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
|
|
5809
5826
|
}
|
|
5810
|
-
function
|
|
5827
|
+
function Hr(s, e) {
|
|
5811
5828
|
return s.some(
|
|
5812
5829
|
(t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
|
|
5813
5830
|
);
|
|
5814
5831
|
}
|
|
5815
|
-
function
|
|
5832
|
+
function Br(s, e) {
|
|
5816
5833
|
const t = s[e];
|
|
5817
5834
|
for (let n = e + 1; n < s.length; n += 1) {
|
|
5818
5835
|
const i = s[n];
|
|
@@ -5821,7 +5838,7 @@ function Nr(s, e) {
|
|
|
5821
5838
|
}
|
|
5822
5839
|
return !1;
|
|
5823
5840
|
}
|
|
5824
|
-
function
|
|
5841
|
+
function Fr(s, e) {
|
|
5825
5842
|
const t = s[e];
|
|
5826
5843
|
if (!t.respondsToUserMessageId)
|
|
5827
5844
|
return !1;
|
|
@@ -5834,19 +5851,19 @@ function Hr(s, e) {
|
|
|
5834
5851
|
}
|
|
5835
5852
|
return !1;
|
|
5836
5853
|
}
|
|
5837
|
-
function
|
|
5854
|
+
function Wr(s, e) {
|
|
5838
5855
|
const t = s[e];
|
|
5839
5856
|
return s.some(
|
|
5840
5857
|
(n, i) => i !== e && n.role === "assistant" && ge(t, n)
|
|
5841
5858
|
);
|
|
5842
5859
|
}
|
|
5843
|
-
function
|
|
5860
|
+
function $r(s, e) {
|
|
5844
5861
|
const t = s[e];
|
|
5845
5862
|
return s.some(
|
|
5846
5863
|
(n, i) => i !== e && n.role === "tool" && ge(t, n)
|
|
5847
5864
|
);
|
|
5848
5865
|
}
|
|
5849
|
-
function
|
|
5866
|
+
function jr(s, e) {
|
|
5850
5867
|
const t = s[e];
|
|
5851
5868
|
for (let n = e + 1; n < s.length; n += 1)
|
|
5852
5869
|
if (G(s[n]) && ge(t, s[n]))
|
|
@@ -5859,7 +5876,7 @@ function ge(s, e) {
|
|
|
5859
5876
|
function A(s, e) {
|
|
5860
5877
|
return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
|
|
5861
5878
|
}
|
|
5862
|
-
function
|
|
5879
|
+
function zr(s, e) {
|
|
5863
5880
|
try {
|
|
5864
5881
|
const t = window.localStorage.getItem(`${Ms}${s}`);
|
|
5865
5882
|
if (!t)
|
|
@@ -5867,7 +5884,7 @@ function $r(s, e) {
|
|
|
5867
5884
|
const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
5868
5885
|
if (e !== void 0 && i !== e)
|
|
5869
5886
|
return null;
|
|
5870
|
-
const r = Array.isArray(n.messages) ? n.messages.map(
|
|
5887
|
+
const r = Array.isArray(n.messages) ? n.messages.map(so).filter((o) => !!o) : [];
|
|
5871
5888
|
return {
|
|
5872
5889
|
sessionId: i,
|
|
5873
5890
|
messages: r
|
|
@@ -5881,20 +5898,20 @@ function gt(s) {
|
|
|
5881
5898
|
// running tool or commentary history from disappearing while authoritative hydration is still in flight.
|
|
5882
5899
|
s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
|
|
5883
5900
|
}
|
|
5884
|
-
function
|
|
5901
|
+
function Kr(s, e) {
|
|
5885
5902
|
try {
|
|
5886
5903
|
window.localStorage.setItem(
|
|
5887
5904
|
`${Ms}${s}`,
|
|
5888
5905
|
JSON.stringify({
|
|
5889
5906
|
sessionId: e.sessionId,
|
|
5890
|
-
messages: e.messages.filter(gt).slice(-
|
|
5907
|
+
messages: e.messages.filter(gt).slice(-pi).map(no)
|
|
5891
5908
|
})
|
|
5892
5909
|
);
|
|
5893
5910
|
} catch {
|
|
5894
5911
|
return;
|
|
5895
5912
|
}
|
|
5896
5913
|
}
|
|
5897
|
-
function
|
|
5914
|
+
function Gr(s) {
|
|
5898
5915
|
try {
|
|
5899
5916
|
const e = window.localStorage.getItem(`${at}${s}`);
|
|
5900
5917
|
if (!e)
|
|
@@ -5945,19 +5962,19 @@ function ls(s, e) {
|
|
|
5945
5962
|
}
|
|
5946
5963
|
Ds(s, e);
|
|
5947
5964
|
}
|
|
5948
|
-
function
|
|
5965
|
+
function Qr(s) {
|
|
5949
5966
|
try {
|
|
5950
5967
|
const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
|
|
5951
5968
|
if (window.sessionStorage.removeItem(e), !t)
|
|
5952
5969
|
return [];
|
|
5953
5970
|
const n = JSON.parse(t);
|
|
5954
|
-
return Array.isArray(n) ? n.flatMap((i) =>
|
|
5971
|
+
return Array.isArray(n) ? n.flatMap((i) => Xr(i) ? [{
|
|
5955
5972
|
...i.event,
|
|
5956
5973
|
page: _(),
|
|
5957
5974
|
rawOutput: {
|
|
5958
5975
|
pageContextRestarted: !0,
|
|
5959
5976
|
outcome: "unknown",
|
|
5960
|
-
message:
|
|
5977
|
+
message: Vr(location.href),
|
|
5961
5978
|
currentUrl: location.href,
|
|
5962
5979
|
console: [],
|
|
5963
5980
|
metadata: {
|
|
@@ -5974,17 +5991,17 @@ function Kr(s) {
|
|
|
5974
5991
|
return [];
|
|
5975
5992
|
}
|
|
5976
5993
|
}
|
|
5977
|
-
function
|
|
5994
|
+
function Vr(s) {
|
|
5978
5995
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
5979
5996
|
Current URL: ${s}`;
|
|
5980
5997
|
}
|
|
5981
|
-
function
|
|
5998
|
+
function Xr(s) {
|
|
5982
5999
|
if (!s || typeof s != "object")
|
|
5983
6000
|
return !1;
|
|
5984
6001
|
const e = s, t = e.event;
|
|
5985
6002
|
return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && bt(t) && t.type === "tool.result";
|
|
5986
6003
|
}
|
|
5987
|
-
function
|
|
6004
|
+
function Jr(s, e) {
|
|
5988
6005
|
const t = new Set(
|
|
5989
6006
|
s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
5990
6007
|
);
|
|
@@ -5993,7 +6010,7 @@ function Vr(s, e) {
|
|
|
5993
6010
|
...e.filter((n) => !t.has(n.callId))
|
|
5994
6011
|
];
|
|
5995
6012
|
}
|
|
5996
|
-
function
|
|
6013
|
+
function Yr(s) {
|
|
5997
6014
|
try {
|
|
5998
6015
|
window.sessionStorage.removeItem(`${Le}${s}`);
|
|
5999
6016
|
} catch {
|
|
@@ -6030,9 +6047,9 @@ function Os(s, e) {
|
|
|
6030
6047
|
} : s;
|
|
6031
6048
|
}
|
|
6032
6049
|
function ft(s) {
|
|
6033
|
-
return s.type ||
|
|
6050
|
+
return s.type || to(s.name) || "application/octet-stream";
|
|
6034
6051
|
}
|
|
6035
|
-
function
|
|
6052
|
+
function Zr(s) {
|
|
6036
6053
|
xs({
|
|
6037
6054
|
name: s.name,
|
|
6038
6055
|
mimeType: ft(s),
|
|
@@ -6040,21 +6057,21 @@ function Jr(s) {
|
|
|
6040
6057
|
});
|
|
6041
6058
|
}
|
|
6042
6059
|
function xs(s) {
|
|
6043
|
-
const e =
|
|
6044
|
-
if (!
|
|
6060
|
+
const e = eo(s.name), t = s.mimeType.trim().toLowerCase();
|
|
6061
|
+
if (!ui.has(`${e}:${t}`))
|
|
6045
6062
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
6046
6063
|
if (s.sizeBytes <= 0 || s.sizeBytes >= ws)
|
|
6047
6064
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
6048
6065
|
}
|
|
6049
|
-
function
|
|
6066
|
+
function eo(s) {
|
|
6050
6067
|
const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
|
|
6051
6068
|
return t >= 0 ? e.slice(t) : "";
|
|
6052
6069
|
}
|
|
6053
|
-
function
|
|
6070
|
+
function to(s) {
|
|
6054
6071
|
const e = s.toLowerCase();
|
|
6055
6072
|
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;
|
|
6056
6073
|
}
|
|
6057
|
-
function
|
|
6074
|
+
function so(s) {
|
|
6058
6075
|
if (!s || typeof s != "object")
|
|
6059
6076
|
return null;
|
|
6060
6077
|
const e = s;
|
|
@@ -6076,7 +6093,7 @@ function eo(s) {
|
|
|
6076
6093
|
loading: typeof e.loading == "boolean" ? e.loading : void 0
|
|
6077
6094
|
};
|
|
6078
6095
|
}
|
|
6079
|
-
function
|
|
6096
|
+
function no(s) {
|
|
6080
6097
|
return s.attachments?.length ? {
|
|
6081
6098
|
...s,
|
|
6082
6099
|
attachments: s.attachments.map(qe)
|
|
@@ -6100,9 +6117,9 @@ function E(s) {
|
|
|
6100
6117
|
const e = s.runId;
|
|
6101
6118
|
return typeof e == "string" && e ? e : null;
|
|
6102
6119
|
}
|
|
6103
|
-
function
|
|
6120
|
+
function io(s) {
|
|
6104
6121
|
const e = s?.timeoutMs;
|
|
6105
|
-
return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <=
|
|
6122
|
+
return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= ki);
|
|
6106
6123
|
}
|
|
6107
6124
|
function Ls(s) {
|
|
6108
6125
|
const e = {};
|
|
@@ -6116,22 +6133,22 @@ function Ls(s) {
|
|
|
6116
6133
|
return e;
|
|
6117
6134
|
}
|
|
6118
6135
|
function Rt(s, e) {
|
|
6119
|
-
return $s(s) ? Be : F(xe(e),
|
|
6136
|
+
return $s(s) ? Be : F(xe(e), di);
|
|
6120
6137
|
}
|
|
6121
|
-
function
|
|
6138
|
+
function ro(s, e) {
|
|
6122
6139
|
return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
|
|
6123
6140
|
}
|
|
6124
|
-
async function
|
|
6141
|
+
async function oo(s, e, t, n) {
|
|
6125
6142
|
const i = Ls(s.headers);
|
|
6126
6143
|
n({
|
|
6127
6144
|
...e,
|
|
6128
6145
|
responseStatus: s.status,
|
|
6129
6146
|
responseHeaders: i,
|
|
6130
|
-
responseBody: await
|
|
6147
|
+
responseBody: await ao(s),
|
|
6131
6148
|
durationMs: Date.now() - t
|
|
6132
6149
|
});
|
|
6133
6150
|
}
|
|
6134
|
-
async function
|
|
6151
|
+
async function ao(s) {
|
|
6135
6152
|
if (!Ns(s.headers))
|
|
6136
6153
|
return;
|
|
6137
6154
|
let e = null, t = null;
|
|
@@ -6141,7 +6158,7 @@ async function ro(s) {
|
|
|
6141
6158
|
const n = new Promise((a) => {
|
|
6142
6159
|
t = window.setTimeout(() => {
|
|
6143
6160
|
e?.cancel(), a("timeout");
|
|
6144
|
-
},
|
|
6161
|
+
}, hi);
|
|
6145
6162
|
}), i = new TextDecoder();
|
|
6146
6163
|
let r = "", o = 0;
|
|
6147
6164
|
for (; ; ) {
|
|
@@ -6163,7 +6180,7 @@ async function ro(s) {
|
|
|
6163
6180
|
t !== null && window.clearTimeout(t);
|
|
6164
6181
|
}
|
|
6165
6182
|
}
|
|
6166
|
-
function
|
|
6183
|
+
function lo(s, e) {
|
|
6167
6184
|
if (Ns(new Headers(e)))
|
|
6168
6185
|
try {
|
|
6169
6186
|
return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
|
|
@@ -6175,7 +6192,7 @@ function us(s) {
|
|
|
6175
6192
|
if (typeof s == "string")
|
|
6176
6193
|
return F(s);
|
|
6177
6194
|
}
|
|
6178
|
-
function
|
|
6195
|
+
function co(s) {
|
|
6179
6196
|
return L({
|
|
6180
6197
|
...s,
|
|
6181
6198
|
requestBody: ds(s.requestBody),
|
|
@@ -6201,7 +6218,7 @@ function Ns(s) {
|
|
|
6201
6218
|
return t !== null && Number.isInteger(n) && n >= 0 && n <= Tt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
6202
6219
|
}
|
|
6203
6220
|
function te(s, e = {}, t) {
|
|
6204
|
-
if (
|
|
6221
|
+
if (ho(t))
|
|
6205
6222
|
return !0;
|
|
6206
6223
|
const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
6207
6224
|
if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
|
|
@@ -6216,7 +6233,7 @@ function te(s, e = {}, t) {
|
|
|
6216
6233
|
return !0;
|
|
6217
6234
|
}
|
|
6218
6235
|
}
|
|
6219
|
-
function
|
|
6236
|
+
function uo(s, e) {
|
|
6220
6237
|
if (te(s))
|
|
6221
6238
|
return !0;
|
|
6222
6239
|
try {
|
|
@@ -6226,10 +6243,10 @@ function lo(s, e) {
|
|
|
6226
6243
|
return !0;
|
|
6227
6244
|
}
|
|
6228
6245
|
}
|
|
6229
|
-
function
|
|
6246
|
+
function ho(s) {
|
|
6230
6247
|
return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
|
|
6231
6248
|
}
|
|
6232
|
-
function
|
|
6249
|
+
function po(s) {
|
|
6233
6250
|
const e = {};
|
|
6234
6251
|
for (const t of s.trim().split(/[\r\n]+/)) {
|
|
6235
6252
|
const n = t.indexOf(":");
|
|
@@ -6260,27 +6277,27 @@ async function be(s, e) {
|
|
|
6260
6277
|
try {
|
|
6261
6278
|
return await s();
|
|
6262
6279
|
} catch (i) {
|
|
6263
|
-
if (t = i, n >= zt - 1 || !
|
|
6280
|
+
if (t = i, n >= zt - 1 || !fo(i))
|
|
6264
6281
|
throw i;
|
|
6265
|
-
await
|
|
6282
|
+
await go(n);
|
|
6266
6283
|
}
|
|
6267
6284
|
throw t instanceof Error ? t : new Error(e);
|
|
6268
6285
|
}
|
|
6269
|
-
function
|
|
6286
|
+
function go(s) {
|
|
6270
6287
|
return new Promise((e) => {
|
|
6271
|
-
window.setTimeout(e,
|
|
6288
|
+
window.setTimeout(e, ci[s] ?? 0);
|
|
6272
6289
|
});
|
|
6273
6290
|
}
|
|
6274
|
-
function
|
|
6275
|
-
return s instanceof Pe ?
|
|
6291
|
+
function fo(s) {
|
|
6292
|
+
return s instanceof Pe ? mo(s.status) : s instanceof TypeError;
|
|
6276
6293
|
}
|
|
6277
|
-
function
|
|
6294
|
+
function mo(s) {
|
|
6278
6295
|
return s === 408 || s === 409 || s === 429 || s >= 500;
|
|
6279
6296
|
}
|
|
6280
|
-
function
|
|
6297
|
+
function yo(s) {
|
|
6281
6298
|
return s === 401 || s === 403;
|
|
6282
6299
|
}
|
|
6283
|
-
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]",
|
|
6300
|
+
const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", Io = "[REDACTED_SIGNED_URL]", So = 20, To = /^(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, Hs = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Bs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Fs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, 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, wo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ao = /\bhttps?:\/\/[^\s"'<>]+/gi, Mo = /[),.;\]]+$/;
|
|
6284
6301
|
function L(s) {
|
|
6285
6302
|
return Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6286
6303
|
}
|
|
@@ -6289,7 +6306,7 @@ function Oe(s, e, t) {
|
|
|
6289
6306
|
return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
|
|
6290
6307
|
if (s === null || typeof s != "object")
|
|
6291
6308
|
return s;
|
|
6292
|
-
if (e >=
|
|
6309
|
+
if (e >= So)
|
|
6293
6310
|
return "[REDACTED_MAX_DEPTH]";
|
|
6294
6311
|
if (t.has(s))
|
|
6295
6312
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -6297,71 +6314,71 @@ function Oe(s, e, t) {
|
|
|
6297
6314
|
return s.map((i) => Oe(i, e + 1, t));
|
|
6298
6315
|
const n = {};
|
|
6299
6316
|
for (const [i, r] of Object.entries(s))
|
|
6300
|
-
i === "pageContent" ? n[i] = r : $s(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ?
|
|
6317
|
+
i === "pageContent" ? n[i] = r : $s(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? bo(r) : Oe(r, e + 1, t);
|
|
6301
6318
|
return n;
|
|
6302
6319
|
}
|
|
6303
6320
|
function $s(s) {
|
|
6304
6321
|
const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
6305
6322
|
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");
|
|
6306
6323
|
}
|
|
6307
|
-
function
|
|
6324
|
+
function bo(s) {
|
|
6308
6325
|
return typeof s == "string" ? js(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
|
|
6309
6326
|
}
|
|
6310
6327
|
function js(s) {
|
|
6311
6328
|
try {
|
|
6312
6329
|
const e = new URL(s, location.href);
|
|
6313
6330
|
for (const t of Array.from(e.searchParams.keys()))
|
|
6314
|
-
|
|
6331
|
+
To.test(t) && e.searchParams.set(t, $);
|
|
6315
6332
|
return e.username && (e.username = $), e.password && (e.password = $), e.toString();
|
|
6316
6333
|
} catch {
|
|
6317
|
-
return
|
|
6334
|
+
return Ro(s);
|
|
6318
6335
|
}
|
|
6319
6336
|
}
|
|
6320
6337
|
function xe(s) {
|
|
6321
|
-
return s.replace(
|
|
6338
|
+
return s.replace(wo, Io).replace(Ao, Eo).replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6322
6339
|
}
|
|
6323
|
-
function
|
|
6340
|
+
function Ro(s) {
|
|
6324
6341
|
return s.replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
|
|
6325
6342
|
}
|
|
6326
|
-
function
|
|
6327
|
-
const e = s.match(
|
|
6343
|
+
function Eo(s) {
|
|
6344
|
+
const e = s.match(Mo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
|
|
6328
6345
|
return `${js(t)}${e}`;
|
|
6329
6346
|
}
|
|
6330
|
-
const
|
|
6347
|
+
const Oo = Object.freeze({
|
|
6331
6348
|
init: (s) => Ne.init(s)
|
|
6332
6349
|
});
|
|
6333
|
-
function
|
|
6350
|
+
function xo(s) {
|
|
6334
6351
|
return Ne.init(s);
|
|
6335
6352
|
}
|
|
6336
6353
|
export {
|
|
6337
6354
|
Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6355
|
+
Nn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
6356
|
+
Ln as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
6357
|
+
Hn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
6358
|
+
qo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
6359
|
+
Oo as PlunoProductAgent,
|
|
6343
6360
|
_n as ProductAgentInteractionManager,
|
|
6344
6361
|
xt as ProductAgentQueryController,
|
|
6345
|
-
|
|
6362
|
+
Do as ProductAgentRemoteRuntimeClient,
|
|
6346
6363
|
Ne as ProductAgentSessionEngine,
|
|
6347
6364
|
En as ProductAgentSessionHistoryManager,
|
|
6348
|
-
|
|
6365
|
+
Po as ProductAgentTaskPageTitleController,
|
|
6349
6366
|
X as ProductAgentTokenProviderError,
|
|
6350
|
-
|
|
6351
|
-
|
|
6367
|
+
yi as calculateReconnectDelay,
|
|
6368
|
+
_o as createLocalStorageInteractionDecisionStorage,
|
|
6352
6369
|
Ee as createProductAgentQueryState,
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6370
|
+
xo as createProductAgentRuntime,
|
|
6371
|
+
vo as createProductAgentTaskPageTitleDocument,
|
|
6372
|
+
Oo as default,
|
|
6356
6373
|
Dn as formatProductAgentTaskPageTitle,
|
|
6357
|
-
|
|
6358
|
-
|
|
6374
|
+
$i as getProductAgentOriginAccessErrorMessage,
|
|
6375
|
+
Uo as isProductAgentRuntimeCommand,
|
|
6359
6376
|
Mn as mergeProductAgentEntityPages,
|
|
6360
6377
|
ke as normalizeProductAgentEntityPage,
|
|
6361
6378
|
st as normalizeProductAgentSessionItems,
|
|
6362
6379
|
Pn as readLocalStorageInteractionDecisions,
|
|
6363
|
-
|
|
6364
|
-
|
|
6380
|
+
Co as resolveProductAgentComposerAction,
|
|
6381
|
+
ko as resolveProductAgentWidgetPresentation,
|
|
6365
6382
|
Ss as selectProductAgentQueryEntities,
|
|
6366
|
-
|
|
6383
|
+
Zr as validateProductAgentProviderInputFile
|
|
6367
6384
|
};
|