@pluno/product-agent-web 0.1.159 → 0.1.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/product-agent-sdk.js +153 -119
- package/dist/product-agent-widget.js +225 -189
- package/dist/widget.d.ts +1 -0
- package/package.json +1 -1
|
@@ -133,7 +133,7 @@ function ms(t, e, s, n) {
|
|
|
133
133
|
}
|
|
134
134
|
const be = "pluno.productAgent.transportId", ys = "pluno.productAgent.transportIdentity", Ce = "pluno.productAgent.transportIdentity.event", Is = 50, Ts = globalThis.setTimeout.bind(globalThis);
|
|
135
135
|
let z = null;
|
|
136
|
-
const le = /* @__PURE__ */ new Set(),
|
|
136
|
+
const le = /* @__PURE__ */ new Set(), _e = /* @__PURE__ */ new Map();
|
|
137
137
|
async function ws(t = Pt()) {
|
|
138
138
|
const e = t.randomUUID(), s = t.storage.getItem(be);
|
|
139
139
|
let n = s ?? t.randomUUID(), r = !1, i = !1;
|
|
@@ -206,13 +206,13 @@ function As() {
|
|
|
206
206
|
return {
|
|
207
207
|
getItem: (t) => {
|
|
208
208
|
try {
|
|
209
|
-
return window.sessionStorage?.getItem(t) ??
|
|
209
|
+
return window.sessionStorage?.getItem(t) ?? _e.get(t) ?? null;
|
|
210
210
|
} catch {
|
|
211
|
-
return
|
|
211
|
+
return _e.get(t) ?? null;
|
|
212
212
|
}
|
|
213
213
|
},
|
|
214
214
|
setItem: (t, e) => {
|
|
215
|
-
|
|
215
|
+
_e.set(t, e);
|
|
216
216
|
try {
|
|
217
217
|
window.sessionStorage?.setItem(t, e);
|
|
218
218
|
} catch {
|
|
@@ -269,7 +269,7 @@ function bs(t) {
|
|
|
269
269
|
const s = e;
|
|
270
270
|
return s.ok !== !0 || s.toolName !== Dt || typeof s.dueAt != "string" || Number.isNaN(Date.parse(s.dueAt)) ? null : s.dueAt;
|
|
271
271
|
}
|
|
272
|
-
const Cs = globalThis.fetch.bind(globalThis), Le = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]',
|
|
272
|
+
const Cs = globalThis.fetch.bind(globalThis), Le = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', _s = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ks = ".pluno-pa-widget__panel", Us = ".pluno-pa-widget__timeline", ut = `${Le}[data-pluno-sdk-preview-channel]`;
|
|
273
273
|
let Ps = 0;
|
|
274
274
|
function dt(t) {
|
|
275
275
|
const e = {};
|
|
@@ -308,7 +308,7 @@ function dt(t) {
|
|
|
308
308
|
}
|
|
309
309
|
return e;
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function ke(t, e, s) {
|
|
312
312
|
if (typeof window > "u")
|
|
313
313
|
return;
|
|
314
314
|
const n = window.__PLUNO_PRODUCT_AGENT_TRACE_ID__;
|
|
@@ -327,13 +327,13 @@ function _e(t, e, s) {
|
|
|
327
327
|
};
|
|
328
328
|
window.dispatchEvent(new CustomEvent("product-agent:trace", { detail: r }));
|
|
329
329
|
}
|
|
330
|
-
const Ds = "https://app.pluno.ai", vs = "gpt-5.6-terra",
|
|
330
|
+
const Ds = "https://app.pluno.ai", vs = "gpt-5.6-terra", Os = 2e4, Ns = 1e4, xs = 1e4, Ls = 1e4, qs = 1e4, Bs = 1e3, ht = 3e4, pt = 0.2, gt = 6e4, Hs = 15e3, K = 8, Ws = "Pluno could not finish this message. Try it again.", js = "Browser connection was interrupted.", ft = 15e3, Fs = "Pluno could not send this message. Try it again.", mt = 2e3, $s = 1e3, zs = 100, yt = 8e3, It = 3, Ks = [300, 1e3], vt = 50 * 1024 * 1024, Gs = /* @__PURE__ */ new Set([
|
|
331
331
|
".jpeg:image/jpeg",
|
|
332
332
|
".jpg:image/jpeg",
|
|
333
333
|
".pdf:application/pdf",
|
|
334
334
|
".png:image/png",
|
|
335
335
|
".webp:image/webp"
|
|
336
|
-
]), oi = ".pdf,.png,.jpg,.jpeg,.webp",
|
|
336
|
+
]), oi = ".pdf,.png,.jpg,.jpeg,.webp", Ve = 64e3, Ue = 4e3, Je = 30, Xs = 2e3, Vs = 1e3, Ot = "Image is too large for model vision input.", Js = 100, Nt = "pluno.productAgent.state.", qe = "pluno.productAgent.pendingEvents.", pe = "pluno.productAgent.activeToolCalls.", Ys = 100;
|
|
337
337
|
function G(t, e = 0) {
|
|
338
338
|
const s = t === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (t - 1));
|
|
339
339
|
return Math.max(e, s);
|
|
@@ -361,7 +361,7 @@ class xt {
|
|
|
361
361
|
constructor(e, s) {
|
|
362
362
|
this.options = e, this.transportIdentity = s, this.state = {
|
|
363
363
|
...this.state,
|
|
364
|
-
starterPrompts:
|
|
364
|
+
starterPrompts: On(e.initialStarterPrompts)
|
|
365
365
|
};
|
|
366
366
|
const n = e.restorePersistedState === !1 ? null : Rr(e.clientId, e.expectedPersistedSessionId);
|
|
367
367
|
n && (this.state = {
|
|
@@ -380,7 +380,7 @@ class xt {
|
|
|
380
380
|
lastError: null
|
|
381
381
|
}), this.queuedClientEvents = Pr(
|
|
382
382
|
br(e.clientId),
|
|
383
|
-
|
|
383
|
+
_r(e.clientId)
|
|
384
384
|
);
|
|
385
385
|
const r = [...this.queuedClientEvents].reverse().find(
|
|
386
386
|
(i) => i.type === "chat.user_message" && typeof i.clientMessageId == "string"
|
|
@@ -473,6 +473,7 @@ class xt {
|
|
|
473
473
|
backendUrl: Tn(e.backendUrl ?? Ds),
|
|
474
474
|
clientId: e.clientId ?? Bn(),
|
|
475
475
|
model: e.model ?? vs,
|
|
476
|
+
productVariant: e.productVariant ?? "customer_embedded",
|
|
476
477
|
entrySurface: wn(e.entrySurface)
|
|
477
478
|
}, s);
|
|
478
479
|
try {
|
|
@@ -584,7 +585,7 @@ class xt {
|
|
|
584
585
|
}
|
|
585
586
|
async sendMessage(e, s = {}) {
|
|
586
587
|
const n = e.trim(), r = s.attachments ?? [];
|
|
587
|
-
if (
|
|
588
|
+
if (this.options.productVariant === "customer_embedded" && (r.forEach(Jt), r.reduce(
|
|
588
589
|
(T, f) => T + f.sizeBytes,
|
|
589
590
|
0
|
|
590
591
|
) > vt))
|
|
@@ -675,7 +676,7 @@ class xt {
|
|
|
675
676
|
return e ? (this.retryAttemptsByClientMessageId[s] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = s, this.browserConnectionInterruptedClientMessageIds.delete(s), this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: s, automatic: !1 }), !0) : !1;
|
|
676
677
|
}
|
|
677
678
|
createLocalAttachment(e) {
|
|
678
|
-
this.options.
|
|
679
|
+
this.options.productVariant === "customer_embedded" && vr(e);
|
|
679
680
|
const s = X(), n = {
|
|
680
681
|
id: s,
|
|
681
682
|
name: e.name || "attachment",
|
|
@@ -749,7 +750,7 @@ class xt {
|
|
|
749
750
|
}, "Failed to upload attachment"), o = l;
|
|
750
751
|
}
|
|
751
752
|
this.setState({ sessionId: o.sessionId });
|
|
752
|
-
const a =
|
|
753
|
+
const a = Vt(o.attachment, this.options.backendUrl);
|
|
753
754
|
return this.updateAttachmentInState(s.id, a), s.id && cs(s.id, {
|
|
754
755
|
sessionId: o.sessionId,
|
|
755
756
|
fileUrl: a.fileUrl,
|
|
@@ -781,7 +782,7 @@ class xt {
|
|
|
781
782
|
const n = await this.fetchEmbedAttachmentUpload(e);
|
|
782
783
|
if (n.ok)
|
|
783
784
|
return await n.json();
|
|
784
|
-
if (
|
|
785
|
+
if (Jr(n.status) && this.options.tokenProvider && !s) {
|
|
785
786
|
s = !0;
|
|
786
787
|
const r = await this.fetchEmbedAttachmentUpload(e);
|
|
787
788
|
if (r.ok)
|
|
@@ -897,7 +898,7 @@ class xt {
|
|
|
897
898
|
});
|
|
898
899
|
}
|
|
899
900
|
send(e) {
|
|
900
|
-
this.sendNow(
|
|
901
|
+
this.sendNow(k(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
|
|
901
902
|
(r) => r.type === "chat.user_message" && r.clientMessageId === e.clientMessageId
|
|
902
903
|
) || this.queuedClientEvents.push(e), L(this.options.clientId, this.queuedClientEvents), this.setState({
|
|
903
904
|
status: "reconnecting",
|
|
@@ -915,7 +916,7 @@ class xt {
|
|
|
915
916
|
return !1;
|
|
916
917
|
const s = this.socket;
|
|
917
918
|
try {
|
|
918
|
-
return s.send(JSON.stringify(e)),
|
|
919
|
+
return s.send(JSON.stringify(e)), ke("client_event", e.type, dt(e)), !0;
|
|
919
920
|
} catch (n) {
|
|
920
921
|
return M("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
921
922
|
message: n instanceof Error ? n.message : String(n),
|
|
@@ -924,13 +925,36 @@ class xt {
|
|
|
924
925
|
}), this.socket === s && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect()), s.readyState !== WebSocket.CLOSED && s.readyState !== WebSocket.CLOSING && s.close(), !1;
|
|
925
926
|
}
|
|
926
927
|
}
|
|
928
|
+
reportHealthSignal(e, s = {}) {
|
|
929
|
+
if (!(!this.socket || this.socket.readyState !== WebSocket.OPEN))
|
|
930
|
+
try {
|
|
931
|
+
this.socket.send(JSON.stringify({
|
|
932
|
+
type: "runtime.health",
|
|
933
|
+
signal: {
|
|
934
|
+
id: crypto.randomUUID(),
|
|
935
|
+
name: e,
|
|
936
|
+
occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
937
|
+
source: "web_sdk",
|
|
938
|
+
entrySurface: this.options.entrySurface,
|
|
939
|
+
...this.state.sessionId ? { sessionId: this.state.sessionId } : {},
|
|
940
|
+
...this.activeResponseRunId ? { runId: this.activeResponseRunId } : {},
|
|
941
|
+
...s
|
|
942
|
+
}
|
|
943
|
+
}));
|
|
944
|
+
} catch (n) {
|
|
945
|
+
M("web-sdk.agent", "Pluno health signal send failed", {
|
|
946
|
+
name: e,
|
|
947
|
+
message: n instanceof Error ? n.message : String(n)
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
}
|
|
927
951
|
requestTransientStarterPrompts() {
|
|
928
952
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
929
953
|
return;
|
|
930
954
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
931
955
|
const e = Rn();
|
|
932
956
|
this.sendNow(
|
|
933
|
-
|
|
957
|
+
k({
|
|
934
958
|
type: "starter_prompts.page_context",
|
|
935
959
|
pageUrl: e.pageUrl,
|
|
936
960
|
pageTitle: e.pageTitle,
|
|
@@ -963,7 +987,7 @@ class xt {
|
|
|
963
987
|
L(this.options.clientId, this.queuedClientEvents);
|
|
964
988
|
for (let s = 0; s < e.length; s += 1) {
|
|
965
989
|
const n = e[s];
|
|
966
|
-
if (!this.sendNow(
|
|
990
|
+
if (!this.sendNow(k(n))) {
|
|
967
991
|
this.queuedClientEvents.unshift(n, ...e.slice(s + 1)), L(this.options.clientId, this.queuedClientEvents);
|
|
968
992
|
return;
|
|
969
993
|
}
|
|
@@ -974,7 +998,7 @@ class xt {
|
|
|
974
998
|
!this.pendingWarmupEvent || !this.sendNow(this.pendingWarmupEvent) || (this.pendingWarmupEvent = null);
|
|
975
999
|
}
|
|
976
1000
|
handleServerEvent(e) {
|
|
977
|
-
if (
|
|
1001
|
+
if (ke("server_event", e.type, dt(e)), e.type === "run.ack") {
|
|
978
1002
|
const s = De(e), n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
|
|
979
1003
|
s && n && this.backgroundClientMessageIds.delete(n) ? (this.backgroundSessionIds.add(s), this.deferredSessionUpdatedSessionIds.delete(s)) : s && (n === this.activeClientMessageId || n === this.pendingClientMessageId) && this.deferredSessionUpdatedSessionIds.delete(s) && this.state.sessionId === null && this.setState({ sessionId: s }), this.handleRunAck(e);
|
|
980
1004
|
return;
|
|
@@ -997,7 +1021,7 @@ class xt {
|
|
|
997
1021
|
}
|
|
998
1022
|
if (sn(e) && this.markThinkingProgress(), e.type === "auth.ok") {
|
|
999
1023
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingWarmupEvent(), this.startHeartbeat();
|
|
1000
|
-
const s =
|
|
1024
|
+
const s = Nn(e), n = Object.prototype.hasOwnProperty.call(e, "appearance");
|
|
1001
1025
|
M("web-sdk.agent", "Received auth.ok appearance", {
|
|
1002
1026
|
hasAppearance: n,
|
|
1003
1027
|
rawAppearance: e.appearance,
|
|
@@ -1131,7 +1155,7 @@ class xt {
|
|
|
1131
1155
|
const s = H(e.item);
|
|
1132
1156
|
if (We(s)) {
|
|
1133
1157
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
1134
|
-
const r = E(e.item, "sessionId") ?? this.state.sessionId, i = s ?
|
|
1158
|
+
const r = E(e.item, "sessionId") ?? this.state.sessionId, i = s ? N(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
1135
1159
|
if (r && a) {
|
|
1136
1160
|
this.retryAfterInterruptedRun(r, a);
|
|
1137
1161
|
return;
|
|
@@ -1371,7 +1395,11 @@ class xt {
|
|
|
1371
1395
|
return;
|
|
1372
1396
|
const n = this.retryAttemptsByClientMessageId[s] ?? 0;
|
|
1373
1397
|
if (n >= K) {
|
|
1374
|
-
this.
|
|
1398
|
+
this.reportHealthSignal("run_recovery_exhausted", {
|
|
1399
|
+
clientMessageId: s,
|
|
1400
|
+
retryAttempts: n,
|
|
1401
|
+
reason: "retry_budget_exhausted"
|
|
1402
|
+
}), this.retryableClientMessageId = s, this.setState({
|
|
1375
1403
|
messages: oe(
|
|
1376
1404
|
this.state.messages,
|
|
1377
1405
|
s,
|
|
@@ -1491,7 +1519,7 @@ class xt {
|
|
|
1491
1519
|
this.failPendingDelivery(e);
|
|
1492
1520
|
return;
|
|
1493
1521
|
}
|
|
1494
|
-
this.retryAttemptsByClientMessageId[e] = s + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
1522
|
+
s === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = s + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
|
|
1495
1523
|
this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
|
|
1496
1524
|
}, G(s, mt));
|
|
1497
1525
|
}
|
|
@@ -1532,7 +1560,7 @@ class xt {
|
|
|
1532
1560
|
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (M("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
1533
1561
|
sessionId: this.state.sessionId,
|
|
1534
1562
|
clientMessageId: e
|
|
1535
|
-
}), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(e));
|
|
1563
|
+
}), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(e));
|
|
1536
1564
|
}
|
|
1537
1565
|
scheduleRunAckResyncRetry(e) {
|
|
1538
1566
|
this.clearRunAckResyncRetryTimer();
|
|
@@ -1566,6 +1594,8 @@ class xt {
|
|
|
1566
1594
|
if (!e) {
|
|
1567
1595
|
M("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
|
|
1568
1596
|
sessionId: this.state.sessionId
|
|
1597
|
+
}), this.reportHealthSignal("run_recovery_exhausted", {
|
|
1598
|
+
reason: "missing_client_message_id"
|
|
1569
1599
|
}), this.setState({
|
|
1570
1600
|
isThinking: !1,
|
|
1571
1601
|
lastError: this.getRunRecoveryExhaustedErrorMessage(null),
|
|
@@ -1578,6 +1608,10 @@ class xt {
|
|
|
1578
1608
|
M("web-sdk.agent", "Pluno run recovery retry exhausted", {
|
|
1579
1609
|
sessionId: this.state.sessionId,
|
|
1580
1610
|
clientMessageId: e
|
|
1611
|
+
}), this.reportHealthSignal("run_recovery_exhausted", {
|
|
1612
|
+
clientMessageId: e,
|
|
1613
|
+
retryAttempts: n,
|
|
1614
|
+
reason: "retry_budget_exhausted"
|
|
1581
1615
|
}), this.retryableClientMessageId = e, this.setState({
|
|
1582
1616
|
messages: oe(
|
|
1583
1617
|
this.state.messages,
|
|
@@ -1637,8 +1671,8 @@ class xt {
|
|
|
1637
1671
|
callId: n,
|
|
1638
1672
|
toolName: r,
|
|
1639
1673
|
summary: i,
|
|
1640
|
-
rawInput:
|
|
1641
|
-
rawOutput:
|
|
1674
|
+
rawInput: k(o),
|
|
1675
|
+
rawOutput: k({
|
|
1642
1676
|
ok: !1,
|
|
1643
1677
|
toolName: r,
|
|
1644
1678
|
error: `Unsupported browser tool: ${r}`
|
|
@@ -1653,7 +1687,7 @@ class xt {
|
|
|
1653
1687
|
callId: n,
|
|
1654
1688
|
toolName: r,
|
|
1655
1689
|
summary: i,
|
|
1656
|
-
rawInput:
|
|
1690
|
+
rawInput: k(o),
|
|
1657
1691
|
rawOutput: {
|
|
1658
1692
|
ok: !1,
|
|
1659
1693
|
toolName: r,
|
|
@@ -1669,7 +1703,7 @@ class xt {
|
|
|
1669
1703
|
callId: n,
|
|
1670
1704
|
toolName: r,
|
|
1671
1705
|
summary: i,
|
|
1672
|
-
rawInput:
|
|
1706
|
+
rawInput: k(o),
|
|
1673
1707
|
rawOutput: null
|
|
1674
1708
|
},
|
|
1675
1709
|
startedAtMs: Date.now(),
|
|
@@ -1691,8 +1725,8 @@ class xt {
|
|
|
1691
1725
|
callId: n,
|
|
1692
1726
|
toolName: r,
|
|
1693
1727
|
summary: o.summary,
|
|
1694
|
-
rawInput:
|
|
1695
|
-
rawOutput:
|
|
1728
|
+
rawInput: k(o),
|
|
1729
|
+
rawOutput: k(Ln(h, c))
|
|
1696
1730
|
}), Cr(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1697
1731
|
}
|
|
1698
1732
|
setToolMessageLoading(e, s) {
|
|
@@ -1763,8 +1797,8 @@ class xt {
|
|
|
1763
1797
|
const e = this.socket;
|
|
1764
1798
|
!e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
1765
1799
|
this.socket === e && (M("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
|
|
1766
|
-
},
|
|
1767
|
-
},
|
|
1800
|
+
}, Ns));
|
|
1801
|
+
}, Os);
|
|
1768
1802
|
}
|
|
1769
1803
|
stopHeartbeat() {
|
|
1770
1804
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -1790,7 +1824,7 @@ class xt {
|
|
|
1790
1824
|
...e,
|
|
1791
1825
|
...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
1792
1826
|
...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
1793
|
-
}, Er(this.options.clientId, this.state), this.emit("state", this.getState()),
|
|
1827
|
+
}, Er(this.options.clientId, this.state), this.emit("state", this.getState()), ke("state", this.state.status, {
|
|
1794
1828
|
status: this.state.status,
|
|
1795
1829
|
sessionId: this.state.sessionId,
|
|
1796
1830
|
messageCount: this.state.messages.length,
|
|
@@ -1843,11 +1877,11 @@ function tn() {
|
|
|
1843
1877
|
const m = y instanceof Request ? y : null, T = Br(y, m), f = Yt(u?.headers ?? m?.headers);
|
|
1844
1878
|
if (!q(T, f, u?.body)) {
|
|
1845
1879
|
const F = {
|
|
1846
|
-
requestId:
|
|
1880
|
+
requestId: Ne("fetch"),
|
|
1847
1881
|
url: P(T, Ue),
|
|
1848
1882
|
method: (u?.method ?? m?.method ?? "GET").toUpperCase(),
|
|
1849
1883
|
requestHeaders: f,
|
|
1850
|
-
requestBody:
|
|
1884
|
+
requestBody: _t(u?.body),
|
|
1851
1885
|
resourceType: "fetch",
|
|
1852
1886
|
startedAt: new Date(d).toISOString()
|
|
1853
1887
|
};
|
|
@@ -1876,7 +1910,7 @@ function tn() {
|
|
|
1876
1910
|
}, a = function(y, u, d, g, m) {
|
|
1877
1911
|
const T = n.call(this, y, u, d ?? !0, g ?? void 0, m ?? void 0), f = typeof u == "string" ? u : u.toString();
|
|
1878
1912
|
return Pe.set(this, {
|
|
1879
|
-
requestId:
|
|
1913
|
+
requestId: Ne("xhr"),
|
|
1880
1914
|
method: String(y ?? "GET").toUpperCase(),
|
|
1881
1915
|
url: P(f, Ue),
|
|
1882
1916
|
requestHeaders: {},
|
|
@@ -1886,11 +1920,11 @@ function tn() {
|
|
|
1886
1920
|
}), T;
|
|
1887
1921
|
}, l = function(y, u) {
|
|
1888
1922
|
const d = r.call(this, y, u), g = Pe.get(this);
|
|
1889
|
-
return g && Object.keys(g.requestHeaders).length <
|
|
1923
|
+
return g && Object.keys(g.requestHeaders).length < Je && (g.requestHeaders[y] = et(y, u), g.excluded = g.excluded || q(g.url, g.requestHeaders)), d;
|
|
1890
1924
|
}, c = function(y) {
|
|
1891
1925
|
try {
|
|
1892
1926
|
const u = Pe.get(this);
|
|
1893
|
-
u && (u.excluded = u.excluded || q(u.url, u.requestHeaders, y), u.requestBody =
|
|
1927
|
+
u && (u.excluded = u.excluded || q(u.url, u.requestHeaders, y), u.requestBody = _t(y), u.excluded || this.addEventListener(
|
|
1894
1928
|
"loadend",
|
|
1895
1929
|
() => {
|
|
1896
1930
|
queueMicrotask(() => {
|
|
@@ -1946,7 +1980,7 @@ function tn() {
|
|
|
1946
1980
|
continue;
|
|
1947
1981
|
const d = performance.timeOrigin + u.startTime;
|
|
1948
1982
|
e({
|
|
1949
|
-
requestId:
|
|
1983
|
+
requestId: Ne("resource"),
|
|
1950
1984
|
url: P(u.name, Ue),
|
|
1951
1985
|
method: "GET",
|
|
1952
1986
|
resourceType: "resource",
|
|
@@ -2046,7 +2080,7 @@ async function un(t, e = {}) {
|
|
|
2046
2080
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
2047
2081
|
type: "pluno.pageImages.inspectImage",
|
|
2048
2082
|
imageAttached: !1,
|
|
2049
|
-
imageAttachmentError:
|
|
2083
|
+
imageAttachmentError: Ot
|
|
2050
2084
|
} : {
|
|
2051
2085
|
type: "pluno.pageImages.inspectImage",
|
|
2052
2086
|
imageAttached: !0,
|
|
@@ -2061,7 +2095,7 @@ async function un(t, e = {}) {
|
|
|
2061
2095
|
};
|
|
2062
2096
|
}
|
|
2063
2097
|
async function dn(t) {
|
|
2064
|
-
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error:
|
|
2098
|
+
return t instanceof Blob ? t.type.startsWith("image/") ? t.size === 0 ? { ok: !1, error: "Page image is empty." } : t.size > 8 * 1024 * 1024 ? { ok: !1, error: Ot } : {
|
|
2065
2099
|
ok: !0,
|
|
2066
2100
|
mimeType: t.type,
|
|
2067
2101
|
sizeBytes: t.size,
|
|
@@ -2297,20 +2331,20 @@ function Ye() {
|
|
|
2297
2331
|
(d) => Lt(d) && !d.parentElement?.closest(n)
|
|
2298
2332
|
);
|
|
2299
2333
|
for (const d of r.slice(0, 3))
|
|
2300
|
-
s("Active overlay", ve(
|
|
2301
|
-
const i = Cn(), o = i ? ve(
|
|
2302
|
-
s("Main page content", o), s("Additional visible page text", ve(
|
|
2334
|
+
s("Active overlay", ve(V(d), e));
|
|
2335
|
+
const i = Cn(), o = i ? ve(V(i), e) : "";
|
|
2336
|
+
s("Main page content", o), s("Additional visible page text", ve(V(document.body), e));
|
|
2303
2337
|
const a = t.map(([d, g]) => `${d}:
|
|
2304
2338
|
${g}`).join(`
|
|
2305
2339
|
|
|
2306
|
-
`).trim().slice(0, 12e3), l =
|
|
2340
|
+
`).trim().slice(0, 12e3), l = _n(r, i).trim(), c = `Simplified DOM outline:
|
|
2307
2341
|
`, h = `
|
|
2308
2342
|
|
|
2309
2343
|
Visible page text:
|
|
2310
2344
|
`, p = 12e3 - c.length - h.length, w = Math.min(a.length, 7900), y = l.slice(0, p - w), u = a.slice(0, p - y.length);
|
|
2311
2345
|
return `${c}${y}${h}${u}`;
|
|
2312
2346
|
}
|
|
2313
|
-
function
|
|
2347
|
+
function V(t) {
|
|
2314
2348
|
return t.innerText ?? t.textContent ?? "";
|
|
2315
2349
|
}
|
|
2316
2350
|
function W(t) {
|
|
@@ -2332,9 +2366,9 @@ function Lt(t) {
|
|
|
2332
2366
|
return e.display !== "none" && e.visibility !== "hidden" && t.getClientRects().length > 0;
|
|
2333
2367
|
}
|
|
2334
2368
|
function Cn() {
|
|
2335
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Lt).sort((t, e) =>
|
|
2369
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Lt).sort((t, e) => V(e).length - V(t).length)[0] ?? null;
|
|
2336
2370
|
}
|
|
2337
|
-
function
|
|
2371
|
+
function _n(t, e) {
|
|
2338
2372
|
const s = /* @__PURE__ */ new Set([
|
|
2339
2373
|
"main",
|
|
2340
2374
|
"nav",
|
|
@@ -2414,7 +2448,7 @@ function kn(t, e) {
|
|
|
2414
2448
|
"data-test",
|
|
2415
2449
|
"data-qa",
|
|
2416
2450
|
"data-cy"
|
|
2417
|
-
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: h, priorityTargets: p } =
|
|
2451
|
+
], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: h, priorityTargets: p } = kn(), w = new Set(t);
|
|
2418
2452
|
e && w.add(e);
|
|
2419
2453
|
let y = 0;
|
|
2420
2454
|
const u = (f) => {
|
|
@@ -2512,7 +2546,7 @@ function qt(t, e, s, n) {
|
|
|
2512
2546
|
t.hasAttribute(a) && (i += `[${a}]`);
|
|
2513
2547
|
return `${i}${n ? ` ${JSON.stringify(n)}` : ""}`;
|
|
2514
2548
|
}
|
|
2515
|
-
function
|
|
2549
|
+
function kn() {
|
|
2516
2550
|
const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), s = (a, l) => {
|
|
2517
2551
|
if (!a)
|
|
2518
2552
|
return;
|
|
@@ -2610,12 +2644,12 @@ function Ht() {
|
|
|
2610
2644
|
},
|
|
2611
2645
|
{
|
|
2612
2646
|
name: "widget_root",
|
|
2613
|
-
selector:
|
|
2647
|
+
selector: _s,
|
|
2614
2648
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
2615
2649
|
},
|
|
2616
2650
|
{
|
|
2617
2651
|
name: "widget_panel",
|
|
2618
|
-
selector:
|
|
2652
|
+
selector: ks,
|
|
2619
2653
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
2620
2654
|
},
|
|
2621
2655
|
{
|
|
@@ -2650,10 +2684,10 @@ function Mt(t, e) {
|
|
|
2650
2684
|
const s = t[e];
|
|
2651
2685
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
2652
2686
|
}
|
|
2653
|
-
function
|
|
2687
|
+
function On(t) {
|
|
2654
2688
|
return Array.isArray(t) ? t.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
|
|
2655
2689
|
}
|
|
2656
|
-
function
|
|
2690
|
+
function Nn(t) {
|
|
2657
2691
|
if (!t || typeof t != "object")
|
|
2658
2692
|
return null;
|
|
2659
2693
|
const e = t, s = e.appearance, n = s && typeof s == "object" ? s : e, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -2748,13 +2782,13 @@ function Wt(t, e) {
|
|
|
2748
2782
|
role: i,
|
|
2749
2783
|
...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
|
|
2750
2784
|
content: gs(
|
|
2751
|
-
|
|
2785
|
+
Vn(r.content),
|
|
2752
2786
|
e
|
|
2753
2787
|
),
|
|
2754
2788
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2755
|
-
...
|
|
2756
|
-
respondsToUserMessageId:
|
|
2757
|
-
...
|
|
2789
|
+
...O(r) !== null ? { causalSequence: O(r) } : {},
|
|
2790
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2791
|
+
..._(r) ? { runId: _(r) } : {},
|
|
2758
2792
|
attachments: Xt(r.attachments, e)
|
|
2759
2793
|
};
|
|
2760
2794
|
return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
@@ -2773,11 +2807,11 @@ function Wt(t, e) {
|
|
|
2773
2807
|
role: "tool",
|
|
2774
2808
|
content: "",
|
|
2775
2809
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2776
|
-
respondsToUserMessageId:
|
|
2777
|
-
...
|
|
2810
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2811
|
+
..._(r) ? { runId: _(r) } : {},
|
|
2778
2812
|
dataType: "scheduled_check_in",
|
|
2779
2813
|
toolName: Dt,
|
|
2780
|
-
callId:
|
|
2814
|
+
callId: Oe(r) ?? void 0,
|
|
2781
2815
|
scheduledCheckInAt: i
|
|
2782
2816
|
};
|
|
2783
2817
|
const o = $n(r.output);
|
|
@@ -2786,12 +2820,12 @@ function Wt(t, e) {
|
|
|
2786
2820
|
role: "tool",
|
|
2787
2821
|
content: `Connect ${o.appName} to continue`,
|
|
2788
2822
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2789
|
-
...
|
|
2790
|
-
respondsToUserMessageId:
|
|
2791
|
-
...
|
|
2823
|
+
...O(r) !== null ? { causalSequence: O(r) } : {},
|
|
2824
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2825
|
+
..._(r) ? { runId: _(r) } : {},
|
|
2792
2826
|
dataType: "function_call_output",
|
|
2793
2827
|
toolName: "authenticate_pipedream_app",
|
|
2794
|
-
callId:
|
|
2828
|
+
callId: Oe(r) ?? void 0,
|
|
2795
2829
|
integrationAuthRequest: o
|
|
2796
2830
|
} : null;
|
|
2797
2831
|
}
|
|
@@ -2800,21 +2834,21 @@ function Wt(t, e) {
|
|
|
2800
2834
|
role: "tool",
|
|
2801
2835
|
content: r.type === "mcp_call" ? Fn(r) : Kn(r),
|
|
2802
2836
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2803
|
-
...
|
|
2804
|
-
respondsToUserMessageId:
|
|
2805
|
-
...
|
|
2837
|
+
...O(r) !== null ? { causalSequence: O(r) } : {},
|
|
2838
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2839
|
+
..._(r) ? { runId: _(r) } : {},
|
|
2806
2840
|
dataType: String(r.type),
|
|
2807
2841
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
2808
|
-
callId:
|
|
2842
|
+
callId: Oe(r) ?? void 0,
|
|
2809
2843
|
loading: r.localExecutionStatus === "queued" || r.localExecutionStatus === "running" ? !0 : typeof r.localExecutionStatus == "string" ? !1 : void 0
|
|
2810
2844
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
2811
2845
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2812
2846
|
role: "system",
|
|
2813
2847
|
content: zn(r),
|
|
2814
2848
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2815
|
-
...
|
|
2816
|
-
respondsToUserMessageId:
|
|
2817
|
-
...
|
|
2849
|
+
...O(r) !== null ? { causalSequence: O(r) } : {},
|
|
2850
|
+
respondsToUserMessageId: N(r) ?? void 0,
|
|
2851
|
+
..._(r) ? { runId: _(r) } : {},
|
|
2818
2852
|
dataType: String(r.type),
|
|
2819
2853
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
2820
2854
|
...r.type === "run_status" && r.status === "steered" ? { steered: !0 } : {},
|
|
@@ -2892,14 +2926,14 @@ function Xn(t) {
|
|
|
2892
2926
|
runId: typeof e.runId == "string" ? e.runId : null
|
|
2893
2927
|
};
|
|
2894
2928
|
}
|
|
2895
|
-
function
|
|
2929
|
+
function Oe(t) {
|
|
2896
2930
|
const e = t.callId ?? t.call_id;
|
|
2897
2931
|
return typeof e == "string" && e ? e : null;
|
|
2898
2932
|
}
|
|
2899
|
-
function
|
|
2933
|
+
function O(t) {
|
|
2900
2934
|
return typeof t.causalSequence == "number" && Number.isSafeInteger(t.causalSequence) ? t.causalSequence : null;
|
|
2901
2935
|
}
|
|
2902
|
-
function
|
|
2936
|
+
function Vn(t) {
|
|
2903
2937
|
return typeof t == "string" ? t : Array.isArray(t) ? t.map((e) => {
|
|
2904
2938
|
if (!e || typeof e != "object")
|
|
2905
2939
|
return "";
|
|
@@ -2909,7 +2943,7 @@ function Jn(t) {
|
|
|
2909
2943
|
}
|
|
2910
2944
|
function Be(t, e) {
|
|
2911
2945
|
const s = Ft(t, e), n = sr(
|
|
2912
|
-
|
|
2946
|
+
Jn(
|
|
2913
2947
|
or(t, e),
|
|
2914
2948
|
s
|
|
2915
2949
|
),
|
|
@@ -2922,7 +2956,7 @@ function Be(t, e) {
|
|
|
2922
2956
|
const i = [...n];
|
|
2923
2957
|
return i[r] = s, $e(i);
|
|
2924
2958
|
}
|
|
2925
|
-
function
|
|
2959
|
+
function Jn(t, e) {
|
|
2926
2960
|
const s = e.assistantDraftItemId;
|
|
2927
2961
|
return s ? t.map(
|
|
2928
2962
|
(n) => n.dataType === "assistant_draft" && n.id === s ? e : n
|
|
@@ -3009,7 +3043,7 @@ function nr(t, e) {
|
|
|
3009
3043
|
);
|
|
3010
3044
|
}
|
|
3011
3045
|
function jt(t) {
|
|
3012
|
-
const e =
|
|
3046
|
+
const e = J(t) ?? void 0, s = t.assistantDraftItemId, n = [
|
|
3013
3047
|
...t.callId ? [`call:${t.callId}`] : [],
|
|
3014
3048
|
...t.runId && (t.toolName === "browser_tabs" || t.toolName === "tab_lifecycle") ? [`tab-lifecycle:${t.runId}`] : []
|
|
3015
3049
|
];
|
|
@@ -3059,13 +3093,13 @@ function or(t, e) {
|
|
|
3059
3093
|
return n.splice(s, 1), n;
|
|
3060
3094
|
}
|
|
3061
3095
|
function $t(t, e) {
|
|
3062
|
-
const s =
|
|
3096
|
+
const s = J(t), n = J(e);
|
|
3063
3097
|
return s && n ? s === n : t.content === e.content;
|
|
3064
3098
|
}
|
|
3065
3099
|
function ge(t) {
|
|
3066
3100
|
return t.role === "user" && (t.id.startsWith("local-") || t.id.startsWith("optimistic-user-message:"));
|
|
3067
3101
|
}
|
|
3068
|
-
function
|
|
3102
|
+
function J(t) {
|
|
3069
3103
|
const e = t.clientMessageId;
|
|
3070
3104
|
if (e)
|
|
3071
3105
|
return e;
|
|
@@ -3199,7 +3233,7 @@ function ur(t) {
|
|
|
3199
3233
|
function Fe(t, e) {
|
|
3200
3234
|
if (typeof e.clientMessageId == "string")
|
|
3201
3235
|
return e.clientMessageId;
|
|
3202
|
-
const s =
|
|
3236
|
+
const s = N(e);
|
|
3203
3237
|
if (!s)
|
|
3204
3238
|
return null;
|
|
3205
3239
|
const n = t.find((i) => E(i, "id") === s), r = H(n);
|
|
@@ -3222,7 +3256,7 @@ function Et(t, e, s, n, r) {
|
|
|
3222
3256
|
if (!e || !hr(t))
|
|
3223
3257
|
return !1;
|
|
3224
3258
|
const i = t;
|
|
3225
|
-
return !(We(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ?
|
|
3259
|
+
return !(We(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? N(i) !== n : r !== null && _(i) !== r));
|
|
3226
3260
|
}
|
|
3227
3261
|
function hr(t) {
|
|
3228
3262
|
if (!t || typeof t != "object")
|
|
@@ -3255,14 +3289,14 @@ function fr(t, e, s, n) {
|
|
|
3255
3289
|
(l) => l.role === "user" && l.id === o
|
|
3256
3290
|
) : null;
|
|
3257
3291
|
return {
|
|
3258
|
-
clientMessageId: a ?
|
|
3292
|
+
clientMessageId: a ? J(a) : o ? null : n,
|
|
3259
3293
|
runId: s ?? i?.runId ?? null
|
|
3260
3294
|
};
|
|
3261
3295
|
}
|
|
3262
3296
|
function oe(t, e, s) {
|
|
3263
3297
|
const n = new Set(
|
|
3264
3298
|
t.filter(
|
|
3265
|
-
(r) => r.role === "user" && e !== null &&
|
|
3299
|
+
(r) => r.role === "user" && e !== null && J(r) === e
|
|
3266
3300
|
).map((r) => r.id)
|
|
3267
3301
|
);
|
|
3268
3302
|
return t.filter(
|
|
@@ -3357,7 +3391,7 @@ function E(t, e) {
|
|
|
3357
3391
|
}
|
|
3358
3392
|
function Rr(t, e) {
|
|
3359
3393
|
try {
|
|
3360
|
-
const s = window.localStorage.getItem(`${
|
|
3394
|
+
const s = window.localStorage.getItem(`${Nt}${t}`);
|
|
3361
3395
|
if (!s)
|
|
3362
3396
|
return null;
|
|
3363
3397
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
@@ -3375,10 +3409,10 @@ function Rr(t, e) {
|
|
|
3375
3409
|
function Er(t, e) {
|
|
3376
3410
|
try {
|
|
3377
3411
|
window.localStorage.setItem(
|
|
3378
|
-
`${
|
|
3412
|
+
`${Nt}${t}`,
|
|
3379
3413
|
JSON.stringify({
|
|
3380
3414
|
sessionId: e.sessionId,
|
|
3381
|
-
messages: e.messages.slice(-
|
|
3415
|
+
messages: e.messages.slice(-Js).map(Lr)
|
|
3382
3416
|
})
|
|
3383
3417
|
);
|
|
3384
3418
|
} catch {
|
|
@@ -3436,7 +3470,7 @@ function Cr(t, e) {
|
|
|
3436
3470
|
}
|
|
3437
3471
|
Gt(t, e);
|
|
3438
3472
|
}
|
|
3439
|
-
function
|
|
3473
|
+
function _r(t) {
|
|
3440
3474
|
try {
|
|
3441
3475
|
const e = `${pe}${t}`, s = window.sessionStorage.getItem(e);
|
|
3442
3476
|
if (window.sessionStorage.removeItem(e), !s)
|
|
@@ -3448,7 +3482,7 @@ function kr(t) {
|
|
|
3448
3482
|
rawOutput: {
|
|
3449
3483
|
pageContextRestarted: !0,
|
|
3450
3484
|
outcome: "unknown",
|
|
3451
|
-
message:
|
|
3485
|
+
message: kr(location.href),
|
|
3452
3486
|
currentUrl: location.href,
|
|
3453
3487
|
console: [],
|
|
3454
3488
|
metadata: {
|
|
@@ -3465,7 +3499,7 @@ function kr(t) {
|
|
|
3465
3499
|
return [];
|
|
3466
3500
|
}
|
|
3467
3501
|
}
|
|
3468
|
-
function
|
|
3502
|
+
function kr(t) {
|
|
3469
3503
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
3470
3504
|
Current URL: ${t}`;
|
|
3471
3505
|
}
|
|
@@ -3511,37 +3545,37 @@ function Xt(t, e) {
|
|
|
3511
3545
|
return !1;
|
|
3512
3546
|
const i = r;
|
|
3513
3547
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
3514
|
-
}), n = e ? s.map((r) =>
|
|
3548
|
+
}), n = e ? s.map((r) => Vt(r, e)) : s;
|
|
3515
3549
|
return n.length > 0 ? n : void 0;
|
|
3516
3550
|
}
|
|
3517
|
-
function
|
|
3551
|
+
function Vt(t, e) {
|
|
3518
3552
|
return t.fileUrl?.startsWith("/") ? {
|
|
3519
3553
|
...t,
|
|
3520
3554
|
fileUrl: new URL(t.fileUrl, e).toString()
|
|
3521
3555
|
} : t;
|
|
3522
3556
|
}
|
|
3523
3557
|
function ze(t) {
|
|
3524
|
-
return t.type ||
|
|
3558
|
+
return t.type || Nr(t.name) || "application/octet-stream";
|
|
3525
3559
|
}
|
|
3526
3560
|
function vr(t) {
|
|
3527
|
-
|
|
3561
|
+
Jt({
|
|
3528
3562
|
name: t.name,
|
|
3529
3563
|
mimeType: ze(t),
|
|
3530
3564
|
sizeBytes: t.size
|
|
3531
3565
|
});
|
|
3532
3566
|
}
|
|
3533
|
-
function
|
|
3534
|
-
const e =
|
|
3567
|
+
function Jt(t) {
|
|
3568
|
+
const e = Or(t.name), s = t.mimeType.trim().toLowerCase();
|
|
3535
3569
|
if (!Gs.has(`${e}:${s}`))
|
|
3536
3570
|
throw new Error("This attachment type is not supported by the embedded model provider");
|
|
3537
3571
|
if (t.sizeBytes <= 0 || t.sizeBytes >= vt)
|
|
3538
3572
|
throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
|
|
3539
3573
|
}
|
|
3540
|
-
function
|
|
3574
|
+
function Or(t) {
|
|
3541
3575
|
const e = t.trim().toLowerCase(), s = e.lastIndexOf(".");
|
|
3542
3576
|
return s >= 0 ? e.slice(s) : "";
|
|
3543
3577
|
}
|
|
3544
|
-
function
|
|
3578
|
+
function Nr(t) {
|
|
3545
3579
|
const e = t.toLowerCase();
|
|
3546
3580
|
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;
|
|
3547
3581
|
}
|
|
@@ -3581,11 +3615,11 @@ function Ze(t) {
|
|
|
3581
3615
|
} = t;
|
|
3582
3616
|
return r;
|
|
3583
3617
|
}
|
|
3584
|
-
function
|
|
3618
|
+
function N(t) {
|
|
3585
3619
|
const e = t.respondsToUserMessageId;
|
|
3586
3620
|
return typeof e == "string" && e ? e : null;
|
|
3587
3621
|
}
|
|
3588
|
-
function
|
|
3622
|
+
function _(t) {
|
|
3589
3623
|
const e = t.runId;
|
|
3590
3624
|
return typeof e == "string" && e ? e : null;
|
|
3591
3625
|
}
|
|
@@ -3597,7 +3631,7 @@ function Yt(t) {
|
|
|
3597
3631
|
const e = {};
|
|
3598
3632
|
try {
|
|
3599
3633
|
new Headers(t).forEach((s, n) => {
|
|
3600
|
-
Object.keys(e).length <
|
|
3634
|
+
Object.keys(e).length < Je && (e[n] = et(n, s));
|
|
3601
3635
|
});
|
|
3602
3636
|
} catch {
|
|
3603
3637
|
return {};
|
|
@@ -3630,7 +3664,7 @@ async function Wr(t) {
|
|
|
3630
3664
|
const n = new Promise((a) => {
|
|
3631
3665
|
s = window.setTimeout(() => {
|
|
3632
3666
|
e?.cancel(), a("timeout");
|
|
3633
|
-
},
|
|
3667
|
+
}, Vs);
|
|
3634
3668
|
}), r = new TextDecoder();
|
|
3635
3669
|
let i = "", o = 0;
|
|
3636
3670
|
for (; ; ) {
|
|
@@ -3640,7 +3674,7 @@ async function Wr(t) {
|
|
|
3640
3674
|
const { done: l, value: c } = a;
|
|
3641
3675
|
if (l)
|
|
3642
3676
|
return P(i + r.decode());
|
|
3643
|
-
const h =
|
|
3677
|
+
const h = Ve - o;
|
|
3644
3678
|
if (c.byteLength > h)
|
|
3645
3679
|
return i += r.decode(c.subarray(0, Math.max(h, 0)), { stream: !0 }), e.cancel(), `${P(i)}... [truncated]`;
|
|
3646
3680
|
o += c.byteLength, i += r.decode(c, { stream: !0 });
|
|
@@ -3660,25 +3694,25 @@ function jr(t, e) {
|
|
|
3660
3694
|
return;
|
|
3661
3695
|
}
|
|
3662
3696
|
}
|
|
3663
|
-
function
|
|
3697
|
+
function _t(t) {
|
|
3664
3698
|
if (typeof t == "string")
|
|
3665
3699
|
return P(t);
|
|
3666
3700
|
}
|
|
3667
3701
|
function Fr(t) {
|
|
3668
|
-
return
|
|
3702
|
+
return k({
|
|
3669
3703
|
...t,
|
|
3670
|
-
requestBody:
|
|
3671
|
-
responseBody:
|
|
3704
|
+
requestBody: kt(t.requestBody),
|
|
3705
|
+
responseBody: kt(t.responseBody)
|
|
3672
3706
|
});
|
|
3673
3707
|
}
|
|
3674
|
-
function
|
|
3708
|
+
function kt(t) {
|
|
3675
3709
|
if (typeof t != "string")
|
|
3676
3710
|
return t;
|
|
3677
3711
|
const e = t.trim();
|
|
3678
3712
|
if (!e.startsWith("{") && !e.startsWith("["))
|
|
3679
3713
|
return he(t);
|
|
3680
3714
|
try {
|
|
3681
|
-
return JSON.stringify(
|
|
3715
|
+
return JSON.stringify(k(JSON.parse(t)));
|
|
3682
3716
|
} catch {
|
|
3683
3717
|
return he(t);
|
|
3684
3718
|
}
|
|
@@ -3687,7 +3721,7 @@ function Qt(t) {
|
|
|
3687
3721
|
if (!t)
|
|
3688
3722
|
return !1;
|
|
3689
3723
|
const e = t.get("content-type")?.toLowerCase() ?? "", s = t.get("content-length"), n = Number(s);
|
|
3690
|
-
return s !== null && Number.isInteger(n) && n >= 0 && n <=
|
|
3724
|
+
return s !== null && Number.isInteger(n) && n >= 0 && n <= Ve && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
|
|
3691
3725
|
}
|
|
3692
3726
|
function q(t, e = {}, s) {
|
|
3693
3727
|
if (zr(s))
|
|
@@ -3724,17 +3758,17 @@ function Kr(t) {
|
|
|
3724
3758
|
const n = s.indexOf(":");
|
|
3725
3759
|
if (n <= 0)
|
|
3726
3760
|
continue;
|
|
3727
|
-
if (Object.keys(e).length >=
|
|
3761
|
+
if (Object.keys(e).length >= Je)
|
|
3728
3762
|
break;
|
|
3729
3763
|
const r = s.slice(0, n).trim();
|
|
3730
3764
|
e[r] = et(r, s.slice(n + 1).trim());
|
|
3731
3765
|
}
|
|
3732
3766
|
return e;
|
|
3733
3767
|
}
|
|
3734
|
-
function P(t, e =
|
|
3768
|
+
function P(t, e = Ve) {
|
|
3735
3769
|
return t.length <= e ? t : `${t.slice(0, e)}... [truncated ${t.length - e} chars]`;
|
|
3736
3770
|
}
|
|
3737
|
-
function
|
|
3771
|
+
function Ne(t) {
|
|
3738
3772
|
return `${t}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
3739
3773
|
}
|
|
3740
3774
|
class ue extends Error {
|
|
@@ -3761,16 +3795,16 @@ function Gr(t) {
|
|
|
3761
3795
|
});
|
|
3762
3796
|
}
|
|
3763
3797
|
function Xr(t) {
|
|
3764
|
-
return t instanceof ue ?
|
|
3798
|
+
return t instanceof ue ? Vr(t.status) : t instanceof TypeError;
|
|
3765
3799
|
}
|
|
3766
|
-
function
|
|
3800
|
+
function Vr(t) {
|
|
3767
3801
|
return t === 408 || t === 409 || t === 429 || t >= 500;
|
|
3768
3802
|
}
|
|
3769
|
-
function
|
|
3803
|
+
function Jr(t) {
|
|
3770
3804
|
return t === 401 || t === 403;
|
|
3771
3805
|
}
|
|
3772
3806
|
const fe = "[REDACTED_SECRET]", D = "[REDACTED_TOKEN]", Yr = "[REDACTED_SIGNED_URL]", Qr = 20, Zr = /^(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, Zt = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, es = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, ts = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, ss = /\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, ei = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, ti = /\bhttps?:\/\/[^\s"'<>]+/gi, si = /[),.;\]]+$/;
|
|
3773
|
-
function
|
|
3807
|
+
function k(t) {
|
|
3774
3808
|
return de(t, 0, /* @__PURE__ */ new WeakSet());
|
|
3775
3809
|
}
|
|
3776
3810
|
function de(t, e, s) {
|
|
@@ -3819,8 +3853,8 @@ function ii(t) {
|
|
|
3819
3853
|
export {
|
|
3820
3854
|
ut as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
3821
3855
|
Le as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
3822
|
-
|
|
3823
|
-
|
|
3856
|
+
ks as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
3857
|
+
_s as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
3824
3858
|
Us as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
3825
3859
|
oi as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
|
|
3826
3860
|
xt as PlunoProductAgent,
|