@pluno/product-agent-web 0.1.65 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/product-agent-sdk.js +153 -149
- package/dist/product-agent-widget.js +398 -396
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ async function at(e) {
|
|
|
4
4
|
const t = await D();
|
|
5
5
|
await lt(t, "readwrite", (s) => s.put(e));
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
7
|
+
async function bt(e) {
|
|
8
8
|
const t = await D(), s = await lt(
|
|
9
9
|
t,
|
|
10
10
|
"readonly",
|
|
@@ -27,7 +27,7 @@ async function ct(e, t) {
|
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
async function
|
|
30
|
+
async function Ct(e = 864e5) {
|
|
31
31
|
const t = await D(), s = Date.now() - e;
|
|
32
32
|
await $(t, "readwrite", async (n) => {
|
|
33
33
|
const r = n.index("lastUsedAt");
|
|
@@ -73,15 +73,15 @@ function z(e) {
|
|
|
73
73
|
e.onsuccess = () => t(e.result), e.onerror = () => s(e.error ?? new Error("Product Agent attachment storage request failed"));
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
const B = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]',
|
|
76
|
+
const B = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Mt = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Dt = ".pluno-pa-widget__panel", Nt = ".pluno-pa-widget__timeline", J = `${B}[data-pluno-sdk-preview-channel]`, qt = "https://app.pluno.ai", Ot = "gpt-5.4", Ft = 2e4, Lt = 2e3, E = 6e4, Ht = 15e3, V = 2, Wt = 15e3, Bt = 5e3, vt = 1e3, xt = 8e3, jt = 15e3, Y = 3, $t = [300, 1e3], F = 1e5, zt = 200 * 1024 * 1024, Gt = "Image is too large for model vision input.", Xt = 100, ut = "pluno.productAgent.state.", v = "pluno.productAgent.pendingEvents.", Z = "pluno.productAgent.transportId", Kt = 100, b = /* @__PURE__ */ new Set();
|
|
77
77
|
let R = null;
|
|
78
78
|
class dt {
|
|
79
79
|
constructor(t) {
|
|
80
|
-
this.options = t, this.transportId =
|
|
80
|
+
this.options = t, this.transportId = ye(), this.state = {
|
|
81
81
|
...this.state,
|
|
82
|
-
starterPrompts:
|
|
82
|
+
starterPrompts: de(t.initialStarterPrompts)
|
|
83
83
|
};
|
|
84
|
-
const s = t.restorePersistedState === !1 ? null :
|
|
84
|
+
const s = t.restorePersistedState === !1 ? null : Be(t.clientId, t.expectedPersistedSessionId);
|
|
85
85
|
s && (this.state = {
|
|
86
86
|
...this.state,
|
|
87
87
|
...s,
|
|
@@ -92,7 +92,7 @@ class dt {
|
|
|
92
92
|
assistantDraftRunId: null,
|
|
93
93
|
isThinking: !1,
|
|
94
94
|
lastError: null
|
|
95
|
-
}), this.queuedClientEvents =
|
|
95
|
+
}), this.queuedClientEvents = xe(t.clientId);
|
|
96
96
|
}
|
|
97
97
|
options;
|
|
98
98
|
listeners = {};
|
|
@@ -145,11 +145,11 @@ class dt {
|
|
|
145
145
|
const s = new dt({
|
|
146
146
|
...t,
|
|
147
147
|
backendUrl: se(t.backendUrl ?? qt),
|
|
148
|
-
clientId: t.clientId ??
|
|
148
|
+
clientId: t.clientId ?? me(),
|
|
149
149
|
model: t.model ?? Ot
|
|
150
150
|
});
|
|
151
151
|
try {
|
|
152
|
-
|
|
152
|
+
Ct().catch((n) => {
|
|
153
153
|
g("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
154
154
|
message: n instanceof Error ? n.message : String(n)
|
|
155
155
|
});
|
|
@@ -176,7 +176,7 @@ class dt {
|
|
|
176
176
|
return;
|
|
177
177
|
if (this.setState({ status: (this.state.status === "closed", "connecting"), lastError: null }), this.token = this.options.token ?? await this.options.tokenProvider?.() ?? null, !this.token && !this.options.webSocketFactory)
|
|
178
178
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
179
|
-
const t =
|
|
179
|
+
const t = re(this.options.backendUrl), s = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
180
180
|
this.socket = s, s.addEventListener("open", () => {
|
|
181
181
|
this.socket === s && (g("web-sdk.agent", "Pluno socket opened", {
|
|
182
182
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
@@ -189,7 +189,7 @@ class dt {
|
|
|
189
189
|
pageUrl: location.href
|
|
190
190
|
}), this.flushQueuedClientEvents(), this.startHeartbeat(), this.setState({ status: "connected", lastError: null }));
|
|
191
191
|
}), s.addEventListener("message", (n) => {
|
|
192
|
-
this.socket === s && this.handleServerEvent(
|
|
192
|
+
this.socket === s && this.handleServerEvent(ue(n.data));
|
|
193
193
|
}), s.addEventListener("close", (n) => {
|
|
194
194
|
this.socket === s && (this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (g("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
195
195
|
code: typeof n?.code == "number" ? n.code : null,
|
|
@@ -332,10 +332,10 @@ class dt {
|
|
|
332
332
|
body: t
|
|
333
333
|
});
|
|
334
334
|
if (!l.ok)
|
|
335
|
-
throw new
|
|
335
|
+
throw new C("Failed to upload attachment", l.status);
|
|
336
336
|
return l;
|
|
337
337
|
}, "Failed to upload attachment"), this.setState({ sessionId: d.sessionId });
|
|
338
|
-
const h =
|
|
338
|
+
const h = It(d.attachment, this.options.backendUrl);
|
|
339
339
|
return this.updateAttachmentInState(s.id, h), s.id && ct(s.id, {
|
|
340
340
|
sessionId: d.sessionId,
|
|
341
341
|
fileUrl: h.fileUrl,
|
|
@@ -380,14 +380,14 @@ class dt {
|
|
|
380
380
|
const n = await this.fetchEmbedAttachmentUpload(t);
|
|
381
381
|
if (n.ok)
|
|
382
382
|
return await n.json();
|
|
383
|
-
if (
|
|
383
|
+
if (ss(n.status) && this.options.tokenProvider && !s) {
|
|
384
384
|
s = !0;
|
|
385
385
|
const r = await this.fetchEmbedAttachmentUpload(t);
|
|
386
386
|
if (r.ok)
|
|
387
387
|
return await r.json();
|
|
388
|
-
throw new
|
|
388
|
+
throw new C("Failed to prepare attachment upload", r.status);
|
|
389
389
|
}
|
|
390
|
-
throw new
|
|
390
|
+
throw new C("Failed to prepare attachment upload", n.status);
|
|
391
391
|
}, "Failed to prepare attachment upload");
|
|
392
392
|
}
|
|
393
393
|
async fetchEmbedAttachmentUpload(t) {
|
|
@@ -481,7 +481,7 @@ class dt {
|
|
|
481
481
|
if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
|
|
482
482
|
return;
|
|
483
483
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
484
|
-
const t =
|
|
484
|
+
const t = ie();
|
|
485
485
|
this.sendNow(
|
|
486
486
|
T({
|
|
487
487
|
type: "starter_prompts.page_context",
|
|
@@ -492,7 +492,7 @@ class dt {
|
|
|
492
492
|
) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
|
|
493
493
|
}
|
|
494
494
|
startStarterPromptUrlWatcher() {
|
|
495
|
-
this.locationChangeCleanup || (this.locationChangeCleanup =
|
|
495
|
+
this.locationChangeCleanup || (this.locationChangeCleanup = oe(() => this.handleStarterPromptUrlChange()));
|
|
496
496
|
}
|
|
497
497
|
handleStarterPromptUrlChange() {
|
|
498
498
|
const t = location.href;
|
|
@@ -529,17 +529,17 @@ class dt {
|
|
|
529
529
|
return;
|
|
530
530
|
}
|
|
531
531
|
if (Jt(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
532
|
-
const s =
|
|
532
|
+
const s = he(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
533
533
|
g("web-sdk.agent", "Received auth.ok appearance", {
|
|
534
534
|
hasAppearance: n,
|
|
535
535
|
rawAppearance: t.appearance,
|
|
536
536
|
normalizedAppearance: s
|
|
537
|
-
}), this.runtimeHelperJavascript =
|
|
537
|
+
}), this.runtimeHelperJavascript = pe(t.runtimeHelpers)?.javascript ?? null;
|
|
538
538
|
const r = st(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, c = {
|
|
539
|
-
user:
|
|
539
|
+
user: we(t.user),
|
|
540
540
|
status: "connected"
|
|
541
541
|
};
|
|
542
|
-
(i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !
|
|
542
|
+
(i || this.state.starterPrompts.length === 0) && (c.starterPrompts = r, c.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (c.appearance = s), this.setState(c), i && r.length === 0 && !o && !ce() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
543
543
|
type: "page.upsert",
|
|
544
544
|
sessionId: this.state.sessionId,
|
|
545
545
|
page: y(),
|
|
@@ -555,15 +555,15 @@ class dt {
|
|
|
555
555
|
return;
|
|
556
556
|
}
|
|
557
557
|
if (t.type === "conversation.state") {
|
|
558
|
-
const s = Array.isArray(t.items) ? t.items : [], n =
|
|
558
|
+
const s = Array.isArray(t.items) ? t.items : [], n = Pe(
|
|
559
559
|
this.state.messages,
|
|
560
|
-
|
|
560
|
+
Te(s, this.options.backendUrl)
|
|
561
561
|
), r = nt(n);
|
|
562
|
-
if (!r &&
|
|
562
|
+
if (!r && De(this.state.messages, s))
|
|
563
563
|
return;
|
|
564
|
-
const i = r ? null :
|
|
564
|
+
const i = r ? null : Ne(s);
|
|
565
565
|
this.latestRecoverableClientMessageId = i, Me(n) && this.clearRetryTimers(), this.setState({
|
|
566
|
-
sessionId:
|
|
566
|
+
sessionId: A(t.session, "id") ?? this.state.sessionId,
|
|
567
567
|
messages: n,
|
|
568
568
|
...r ? { assistantDraft: "", assistantDraftRespondsToUserMessageId: null, assistantDraftRunId: null, isThinking: !1 } : i ? {
|
|
569
569
|
assistantDraft: "",
|
|
@@ -578,13 +578,13 @@ class dt {
|
|
|
578
578
|
if (t.type === "sessions.page") {
|
|
579
579
|
const s = typeof t.requestId == "string" ? t.requestId : null, n = s ? this.pendingSessionHistoryRequests.get(s) : null;
|
|
580
580
|
s && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.resolve({
|
|
581
|
-
sessions:
|
|
581
|
+
sessions: Ae(t.sessions),
|
|
582
582
|
nextCursor: typeof t.nextCursor == "string" ? t.nextCursor : null
|
|
583
583
|
}));
|
|
584
584
|
return;
|
|
585
585
|
}
|
|
586
586
|
if (t.type === "session.updated") {
|
|
587
|
-
this.clearRunAckResyncRetryTimer(), this.setState({ sessionId:
|
|
587
|
+
this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: A(t.session, "id") ?? this.state.sessionId });
|
|
588
588
|
return;
|
|
589
589
|
}
|
|
590
590
|
if (t.type === "session.item") {
|
|
@@ -592,8 +592,8 @@ class dt {
|
|
|
592
592
|
if (s) {
|
|
593
593
|
s.role === "assistant" && (this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
594
594
|
const n = t.item.data;
|
|
595
|
-
|
|
596
|
-
const r =
|
|
595
|
+
qe(n) && this.clearRunAckResyncRetryTimer();
|
|
596
|
+
const r = _e(this.state.messages, s), i = nt(r);
|
|
597
597
|
this.setState({
|
|
598
598
|
messages: r,
|
|
599
599
|
assistantDraft: s.role === "assistant" ? "" : this.state.assistantDraft,
|
|
@@ -638,8 +638,8 @@ class dt {
|
|
|
638
638
|
}
|
|
639
639
|
if (this.retryAfterRetryableError(t))
|
|
640
640
|
return;
|
|
641
|
-
const r = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error");
|
|
642
|
-
this.setState({
|
|
641
|
+
const r = new Error(typeof t.message == "string" ? t.message.replace(/Product Agent/g, "Pluno") : "Pluno error"), i = ne(r.message);
|
|
642
|
+
i && console.error(i), this.setState({
|
|
643
643
|
status: "error",
|
|
644
644
|
isThinking: !1,
|
|
645
645
|
lastError: r.message,
|
|
@@ -775,7 +775,7 @@ class dt {
|
|
|
775
775
|
const s = typeof t.sessionId == "string" ? t.sessionId : null, n = typeof t.callId == "string" ? t.callId : null, r = typeof t.toolName == "string" ? t.toolName : null, i = typeof t.summary == "string" ? t.summary : "Running browser tool", o = t.rawInput;
|
|
776
776
|
if (!s || !n || !r)
|
|
777
777
|
return;
|
|
778
|
-
if (r !== "execute_code" || !
|
|
778
|
+
if (r !== "execute_code" || !Ke(o)) {
|
|
779
779
|
this.send({
|
|
780
780
|
type: "tool.result",
|
|
781
781
|
sessionId: s,
|
|
@@ -806,7 +806,7 @@ class dt {
|
|
|
806
806
|
toolName: r,
|
|
807
807
|
summary: o.summary,
|
|
808
808
|
rawInput: T(o),
|
|
809
|
-
rawOutput: T(
|
|
809
|
+
rawOutput: T(ge(d, a))
|
|
810
810
|
});
|
|
811
811
|
}
|
|
812
812
|
installSessionUserFilesApi(t) {
|
|
@@ -821,14 +821,14 @@ class dt {
|
|
|
821
821
|
const t = await et({
|
|
822
822
|
javascript: this.runtimeHelperJavascript
|
|
823
823
|
});
|
|
824
|
-
return t.ok === !1 ?
|
|
824
|
+
return t.ok === !1 ? fe(t) : null;
|
|
825
825
|
}
|
|
826
826
|
enableNetworkCapture() {
|
|
827
827
|
if (this.networkCaptureCleanup)
|
|
828
828
|
return;
|
|
829
829
|
const t = window.fetch.bind(window), s = XMLHttpRequest.prototype.open, n = XMLHttpRequest.prototype.setRequestHeader, r = XMLHttpRequest.prototype.send;
|
|
830
830
|
window.fetch = async (i, o) => {
|
|
831
|
-
const c = Date.now(), a = new Date(c).toISOString(), d = i instanceof Request ? i : null, h = typeof i == "string" ? i : i instanceof URL ? i.toString() : d?.url ?? "", l = (o?.method ?? d?.method ?? "GET").toUpperCase(), u = ot(new Headers(o?.headers ?? d?.headers ?? void 0)), f = await
|
|
831
|
+
const c = Date.now(), a = new Date(c).toISOString(), d = i instanceof Request ? i : null, h = typeof i == "string" ? i : i instanceof URL ? i.toString() : d?.url ?? "", l = (o?.method ?? d?.method ?? "GET").toUpperCase(), u = ot(new Headers(o?.headers ?? d?.headers ?? void 0)), f = await Je(d, o);
|
|
832
832
|
try {
|
|
833
833
|
const p = await t(i, o);
|
|
834
834
|
return this.enqueueNetworkEvent({
|
|
@@ -840,7 +840,7 @@ class dt {
|
|
|
840
840
|
resourceType: "fetch",
|
|
841
841
|
responseStatus: p.status,
|
|
842
842
|
responseHeaders: ot(p.headers),
|
|
843
|
-
responseBody: await
|
|
843
|
+
responseBody: await Ve(p),
|
|
844
844
|
startedAt: a,
|
|
845
845
|
durationMs: Date.now() - c
|
|
846
846
|
}), p;
|
|
@@ -893,8 +893,8 @@ class dt {
|
|
|
893
893
|
requestBody: typeof this.__plunoMeta.requestBody == "string" ? this.__plunoMeta.requestBody : void 0,
|
|
894
894
|
resourceType: "xhr",
|
|
895
895
|
responseStatus: this.status,
|
|
896
|
-
responseHeaders:
|
|
897
|
-
responseBody:
|
|
896
|
+
responseHeaders: Ze(this.getAllResponseHeaders()),
|
|
897
|
+
responseBody: Ye(this),
|
|
898
898
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
899
899
|
startedAt: String(this.__plunoMeta.startedAt),
|
|
900
900
|
durationMs: Date.now() - Number(this.__plunoMeta.startedAtMs ?? Date.now())
|
|
@@ -942,7 +942,7 @@ class dt {
|
|
|
942
942
|
...this.state,
|
|
943
943
|
...t,
|
|
944
944
|
...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {}
|
|
945
|
-
},
|
|
945
|
+
}, ve(this.options.clientId, this.state), this.emit("state", this.getState());
|
|
946
946
|
}
|
|
947
947
|
emit(t, s) {
|
|
948
948
|
this.listeners[t]?.forEach((r) => r(s));
|
|
@@ -998,7 +998,7 @@ function Zt(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
998
998
|
const p = s.get(u.id);
|
|
999
999
|
if (p)
|
|
1000
1000
|
return p;
|
|
1001
|
-
const S = await
|
|
1001
|
+
const S = await bt(u.id).then((m) => m?.blob ?? null).catch((m) => (g("web-sdk.attachments", "Failed to load Product Agent attachment from IndexedDB", {
|
|
1002
1002
|
attachmentId: u.id,
|
|
1003
1003
|
name: u.name,
|
|
1004
1004
|
message: m instanceof Error ? m.message : String(m)
|
|
@@ -1007,7 +1007,7 @@ function Zt(e, t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map()) {
|
|
|
1007
1007
|
return s.set(u.id, S), S;
|
|
1008
1008
|
if (!u.fileUrl)
|
|
1009
1009
|
throw new Error(`Pluno user file is missing content: ${l}`);
|
|
1010
|
-
const q = await fetch(u.fileUrl,
|
|
1010
|
+
const q = await fetch(u.fileUrl, je(u.fileUrl));
|
|
1011
1011
|
if (!q.ok)
|
|
1012
1012
|
throw new Error(`Failed to load Pluno user file: ${l}`);
|
|
1013
1013
|
const O = await q.blob();
|
|
@@ -1170,7 +1170,10 @@ function ee(e) {
|
|
|
1170
1170
|
function se(e) {
|
|
1171
1171
|
return e.replace(/\/+$/, "");
|
|
1172
1172
|
}
|
|
1173
|
-
function ne(e) {
|
|
1173
|
+
function ne(e, t = location.origin) {
|
|
1174
|
+
return /origin (?:is not allowed|does not match browser origin)/i.test(e) ? `Pluno widget blocked on ${t}: this domain is not allowed. Add ${t} in Pluno under Integration > Domains.` : null;
|
|
1175
|
+
}
|
|
1176
|
+
function re(e) {
|
|
1174
1177
|
const t = new URL("/api/product-agent/embed/ws", e);
|
|
1175
1178
|
return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
|
|
1176
1179
|
}
|
|
@@ -1183,21 +1186,21 @@ function y() {
|
|
|
1183
1186
|
...e ? { plunoProductAgentUi: e } : {}
|
|
1184
1187
|
};
|
|
1185
1188
|
}
|
|
1186
|
-
function
|
|
1189
|
+
function ie() {
|
|
1187
1190
|
return {
|
|
1188
1191
|
pageUrl: location.href,
|
|
1189
1192
|
pageTitle: document.title,
|
|
1190
|
-
htmlContent:
|
|
1193
|
+
htmlContent: le()
|
|
1191
1194
|
};
|
|
1192
1195
|
}
|
|
1193
|
-
function
|
|
1194
|
-
return
|
|
1195
|
-
|
|
1196
|
+
function oe(e) {
|
|
1197
|
+
return b.add(e), R || (R = ae()), () => {
|
|
1198
|
+
b.delete(e), b.size === 0 && (R?.(), R = null);
|
|
1196
1199
|
};
|
|
1197
1200
|
}
|
|
1198
|
-
function
|
|
1201
|
+
function ae() {
|
|
1199
1202
|
const e = () => {
|
|
1200
|
-
for (const i of Array.from(
|
|
1203
|
+
for (const i of Array.from(b))
|
|
1201
1204
|
i();
|
|
1202
1205
|
}, t = window.history.pushState.bind(window.history), s = window.history.replaceState.bind(window.history), n = ((...i) => {
|
|
1203
1206
|
const o = t(...i);
|
|
@@ -1210,10 +1213,10 @@ function oe() {
|
|
|
1210
1213
|
window.history.pushState === n && (window.history.pushState = t), window.history.replaceState === r && (window.history.replaceState = s), window.removeEventListener("popstate", e), window.removeEventListener("hashchange", e);
|
|
1211
1214
|
};
|
|
1212
1215
|
}
|
|
1213
|
-
function
|
|
1216
|
+
function ce() {
|
|
1214
1217
|
return ht()?.surface === "browser_extension_sdk_preview";
|
|
1215
1218
|
}
|
|
1216
|
-
function
|
|
1219
|
+
function le() {
|
|
1217
1220
|
const e = document.body?.cloneNode(!0);
|
|
1218
1221
|
return e instanceof HTMLElement ? (e.querySelectorAll(
|
|
1219
1222
|
[
|
|
@@ -1253,7 +1256,7 @@ function ht() {
|
|
|
1253
1256
|
},
|
|
1254
1257
|
{
|
|
1255
1258
|
name: "widget_root",
|
|
1256
|
-
selector:
|
|
1259
|
+
selector: Mt,
|
|
1257
1260
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
1258
1261
|
},
|
|
1259
1262
|
{
|
|
@@ -1269,7 +1272,7 @@ function ht() {
|
|
|
1269
1272
|
]
|
|
1270
1273
|
};
|
|
1271
1274
|
}
|
|
1272
|
-
function
|
|
1275
|
+
function ue(e) {
|
|
1273
1276
|
try {
|
|
1274
1277
|
const t = JSON.parse(e);
|
|
1275
1278
|
return t && typeof t == "object" ? t : { type: "error", message: "Invalid server event" };
|
|
@@ -1283,10 +1286,10 @@ function st(e, t) {
|
|
|
1283
1286
|
const s = e[t];
|
|
1284
1287
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
1285
1288
|
}
|
|
1286
|
-
function
|
|
1289
|
+
function de(e) {
|
|
1287
1290
|
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
|
|
1288
1291
|
}
|
|
1289
|
-
function
|
|
1292
|
+
function he(e) {
|
|
1290
1293
|
if (!e || typeof e != "object")
|
|
1291
1294
|
return null;
|
|
1292
1295
|
const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, 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, c = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -1297,13 +1300,13 @@ function de(e) {
|
|
|
1297
1300
|
...c !== null ? { scribbleStyle: c } : {}
|
|
1298
1301
|
};
|
|
1299
1302
|
}
|
|
1300
|
-
function
|
|
1303
|
+
function pe(e) {
|
|
1301
1304
|
if (!e || typeof e != "object")
|
|
1302
1305
|
return null;
|
|
1303
1306
|
const t = e.javascript;
|
|
1304
1307
|
return typeof t != "string" || !t.trim() ? null : { javascript: t };
|
|
1305
1308
|
}
|
|
1306
|
-
function
|
|
1309
|
+
function ge(e, t) {
|
|
1307
1310
|
return t ? e && typeof e == "object" ? {
|
|
1308
1311
|
...e,
|
|
1309
1312
|
helperError: t
|
|
@@ -1313,20 +1316,20 @@ function pe(e, t) {
|
|
|
1313
1316
|
helperError: t
|
|
1314
1317
|
} : e;
|
|
1315
1318
|
}
|
|
1316
|
-
function
|
|
1319
|
+
function fe(e) {
|
|
1317
1320
|
if (!e || typeof e != "object")
|
|
1318
1321
|
return e;
|
|
1319
1322
|
const t = e;
|
|
1320
1323
|
return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
|
|
1321
1324
|
}
|
|
1322
|
-
function
|
|
1325
|
+
function me() {
|
|
1323
1326
|
const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
|
|
1324
1327
|
if (t)
|
|
1325
1328
|
return t;
|
|
1326
1329
|
const s = crypto.randomUUID();
|
|
1327
1330
|
return window.localStorage.setItem(e, s), s;
|
|
1328
1331
|
}
|
|
1329
|
-
function
|
|
1332
|
+
function ye() {
|
|
1330
1333
|
const e = window.sessionStorage.getItem(Z);
|
|
1331
1334
|
if (e)
|
|
1332
1335
|
return e;
|
|
@@ -1336,7 +1339,7 @@ function me() {
|
|
|
1336
1339
|
function _() {
|
|
1337
1340
|
return crypto.randomUUID();
|
|
1338
1341
|
}
|
|
1339
|
-
function
|
|
1342
|
+
function we(e) {
|
|
1340
1343
|
if (!e || typeof e != "object")
|
|
1341
1344
|
return null;
|
|
1342
1345
|
const t = e, s = typeof t.id == "string" ? t.id : null;
|
|
@@ -1347,23 +1350,23 @@ function ye(e) {
|
|
|
1347
1350
|
avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
|
|
1348
1351
|
} : null;
|
|
1349
1352
|
}
|
|
1350
|
-
function
|
|
1353
|
+
function Te(e, t) {
|
|
1351
1354
|
return Array.isArray(e) ? x(
|
|
1352
1355
|
j(
|
|
1353
1356
|
e.map((s) => pt(s, t)).filter((s) => s !== null)
|
|
1354
1357
|
)
|
|
1355
1358
|
) : [];
|
|
1356
1359
|
}
|
|
1357
|
-
function
|
|
1360
|
+
function Ae(e) {
|
|
1358
1361
|
return Array.isArray(e) ? e.flatMap((t) => {
|
|
1359
1362
|
if (!t || typeof t != "object")
|
|
1360
1363
|
return [];
|
|
1361
|
-
const s = t, n =
|
|
1364
|
+
const s = t, n = A(s, "id"), r = A(s, "createdAt"), i = A(s, "updatedAt"), o = A(s, "lastActiveAt");
|
|
1362
1365
|
return !n || !r || !i || !o ? [] : [
|
|
1363
1366
|
{
|
|
1364
1367
|
id: n,
|
|
1365
|
-
title:
|
|
1366
|
-
firstUserMessage:
|
|
1368
|
+
title: A(s, "title"),
|
|
1369
|
+
firstUserMessage: A(s, "firstUserMessage"),
|
|
1367
1370
|
currentPage: s.currentPage ?? null,
|
|
1368
1371
|
createdAt: r,
|
|
1369
1372
|
updatedAt: i,
|
|
@@ -1384,23 +1387,23 @@ function pt(e, t) {
|
|
|
1384
1387
|
return {
|
|
1385
1388
|
id: String(s.id ?? crypto.randomUUID()),
|
|
1386
1389
|
role: i,
|
|
1387
|
-
content:
|
|
1390
|
+
content: Re(r.content),
|
|
1388
1391
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
1389
1392
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
1390
1393
|
...k(r) ? { runId: k(r) } : {},
|
|
1391
|
-
attachments:
|
|
1394
|
+
attachments: At(r.attachments, t)
|
|
1392
1395
|
};
|
|
1393
1396
|
}
|
|
1394
1397
|
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" ? {
|
|
1395
1398
|
id: String(s.id ?? crypto.randomUUID()),
|
|
1396
1399
|
role: "tool",
|
|
1397
|
-
content:
|
|
1400
|
+
content: Se(r),
|
|
1398
1401
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
1399
1402
|
respondsToUserMessageId: L(r) ?? void 0,
|
|
1400
1403
|
...k(r) ? { runId: k(r) } : {},
|
|
1401
1404
|
dataType: String(r.type),
|
|
1402
1405
|
toolName: typeof r.name == "string" ? r.name : void 0,
|
|
1403
|
-
callId:
|
|
1406
|
+
callId: Ee(r) ?? void 0,
|
|
1404
1407
|
loading: r.localExecutionStatus === "running"
|
|
1405
1408
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
1406
1409
|
id: String(s.id ?? crypto.randomUUID()),
|
|
@@ -1416,7 +1419,7 @@ function pt(e, t) {
|
|
|
1416
1419
|
function Ie(e) {
|
|
1417
1420
|
return typeof e.message == "string" && e.message.trim().length > 0 ? e.message.replace(/Product Agent/g, "Pluno") : e.type === "run_status" && e.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : e.type === "run_status" && e.status === "stopped" ? "Pluno stopped." : "Pluno run status changed.";
|
|
1418
1421
|
}
|
|
1419
|
-
function
|
|
1422
|
+
function Se(e) {
|
|
1420
1423
|
if (e.type === "web_search_call") {
|
|
1421
1424
|
const t = e.action;
|
|
1422
1425
|
if (t && typeof t == "object") {
|
|
@@ -1428,9 +1431,9 @@ function Ae(e) {
|
|
|
1428
1431
|
}
|
|
1429
1432
|
return "Searching the web";
|
|
1430
1433
|
}
|
|
1431
|
-
return
|
|
1434
|
+
return ke(e);
|
|
1432
1435
|
}
|
|
1433
|
-
function
|
|
1436
|
+
function ke(e) {
|
|
1434
1437
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
1435
1438
|
return e.summary;
|
|
1436
1439
|
if (typeof e.arguments == "string")
|
|
@@ -1443,11 +1446,11 @@ function Se(e) {
|
|
|
1443
1446
|
}
|
|
1444
1447
|
return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
|
|
1445
1448
|
}
|
|
1446
|
-
function
|
|
1449
|
+
function Ee(e) {
|
|
1447
1450
|
const t = e.callId ?? e.call_id;
|
|
1448
1451
|
return typeof t == "string" && t ? t : null;
|
|
1449
1452
|
}
|
|
1450
|
-
function
|
|
1453
|
+
function Re(e) {
|
|
1451
1454
|
return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
|
|
1452
1455
|
if (!t || typeof t != "object")
|
|
1453
1456
|
return "";
|
|
@@ -1455,7 +1458,7 @@ function Ee(e) {
|
|
|
1455
1458
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
1456
1459
|
}).filter(Boolean).join("") : "";
|
|
1457
1460
|
}
|
|
1458
|
-
function
|
|
1461
|
+
function _e(e, t) {
|
|
1459
1462
|
const s = gt(e, t), n = Ce(e, t), r = n.findIndex((o) => o.id === s.id);
|
|
1460
1463
|
if (r === -1)
|
|
1461
1464
|
return x(
|
|
@@ -1464,7 +1467,7 @@ function Re(e, t) {
|
|
|
1464
1467
|
const i = [...n];
|
|
1465
1468
|
return i[r] = s, x(j(i));
|
|
1466
1469
|
}
|
|
1467
|
-
function
|
|
1470
|
+
function Pe(e, t) {
|
|
1468
1471
|
return t.map((s) => gt(e, s));
|
|
1469
1472
|
}
|
|
1470
1473
|
function gt(e, t) {
|
|
@@ -1476,15 +1479,15 @@ function gt(e, t) {
|
|
|
1476
1479
|
if (!s?.attachments?.length)
|
|
1477
1480
|
return t;
|
|
1478
1481
|
const n = t.attachments.map((r) => {
|
|
1479
|
-
const i =
|
|
1480
|
-
return i ?
|
|
1482
|
+
const i = Ue(s.attachments ?? [], r);
|
|
1483
|
+
return i ? be(r, i) : r;
|
|
1481
1484
|
});
|
|
1482
1485
|
return { ...t, attachments: n };
|
|
1483
1486
|
}
|
|
1484
|
-
function
|
|
1487
|
+
function Ue(e, t) {
|
|
1485
1488
|
return t.id ? e.find((s) => s.id === t.id) ?? null : null;
|
|
1486
1489
|
}
|
|
1487
|
-
function
|
|
1490
|
+
function be(e, t) {
|
|
1488
1491
|
const { previewUrl: s } = t;
|
|
1489
1492
|
return s ? { ...e, previewUrl: s } : e;
|
|
1490
1493
|
}
|
|
@@ -1530,7 +1533,7 @@ function yt(e) {
|
|
|
1530
1533
|
}
|
|
1531
1534
|
return null;
|
|
1532
1535
|
}
|
|
1533
|
-
function
|
|
1536
|
+
function De(e, t) {
|
|
1534
1537
|
const s = yt(t);
|
|
1535
1538
|
if (s === null)
|
|
1536
1539
|
return !1;
|
|
@@ -1540,7 +1543,7 @@ function be(e, t) {
|
|
|
1540
1543
|
const i = e.findIndex((o) => o.role === "user" && o.id === r);
|
|
1541
1544
|
return i === -1 ? !1 : e.slice(i + 1).some(mt);
|
|
1542
1545
|
}
|
|
1543
|
-
function
|
|
1546
|
+
function Ne(e) {
|
|
1544
1547
|
const t = yt(e);
|
|
1545
1548
|
if (t === null)
|
|
1546
1549
|
return null;
|
|
@@ -1553,16 +1556,16 @@ function De(e) {
|
|
|
1553
1556
|
const r = n.clientMessageId;
|
|
1554
1557
|
return typeof r == "string" ? r : null;
|
|
1555
1558
|
}
|
|
1556
|
-
function
|
|
1559
|
+
function qe(e) {
|
|
1557
1560
|
if (!e || typeof e != "object")
|
|
1558
1561
|
return !1;
|
|
1559
1562
|
const t = e;
|
|
1560
1563
|
return t.type === "message" && t.role === "user" ? !1 : t.type === "message" || t.type === "function_call" || t.type === "function_call_output" || t.type === "run_error" || t.type === "run_status";
|
|
1561
1564
|
}
|
|
1562
1565
|
function x(e) {
|
|
1563
|
-
return e.filter((t, s) => wt(t) ? !
|
|
1566
|
+
return e.filter((t, s) => wt(t) ? !We(e, s) && !Le(e, s) && !He(e, s) : Oe(t) ? !Fe(e, s) : !0);
|
|
1564
1567
|
}
|
|
1565
|
-
function
|
|
1568
|
+
function Oe(e) {
|
|
1566
1569
|
return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
|
|
1567
1570
|
}
|
|
1568
1571
|
function wt(e) {
|
|
@@ -1584,7 +1587,7 @@ function j(e) {
|
|
|
1584
1587
|
n.has(i.id) || (r.push(i), i.role === "user" && r.push(...s.get(i.id) ?? []));
|
|
1585
1588
|
return r;
|
|
1586
1589
|
}
|
|
1587
|
-
function
|
|
1590
|
+
function Fe(e, t) {
|
|
1588
1591
|
const s = e[t];
|
|
1589
1592
|
for (let n = t + 1; n < e.length; n += 1) {
|
|
1590
1593
|
const r = e[n];
|
|
@@ -1595,21 +1598,21 @@ function Oe(e, t) {
|
|
|
1595
1598
|
}
|
|
1596
1599
|
return !1;
|
|
1597
1600
|
}
|
|
1598
|
-
function
|
|
1601
|
+
function Le(e, t) {
|
|
1599
1602
|
const s = e[t];
|
|
1600
1603
|
for (let n = t + 1; n < e.length; n += 1)
|
|
1601
1604
|
if (e[n].role === "assistant" && N(s, e[n]))
|
|
1602
1605
|
return !0;
|
|
1603
1606
|
return !1;
|
|
1604
1607
|
}
|
|
1605
|
-
function
|
|
1608
|
+
function He(e, t) {
|
|
1606
1609
|
const s = e[t];
|
|
1607
1610
|
for (let n = t + 1; n < e.length; n += 1)
|
|
1608
1611
|
if (e[n].role === "tool" && N(s, e[n]))
|
|
1609
1612
|
return !0;
|
|
1610
1613
|
return !1;
|
|
1611
1614
|
}
|
|
1612
|
-
function
|
|
1615
|
+
function We(e, t) {
|
|
1613
1616
|
const s = e[t];
|
|
1614
1617
|
for (let n = t + 1; n < e.length; n += 1)
|
|
1615
1618
|
if (wt(e[n]) && N(s, e[n]))
|
|
@@ -1619,10 +1622,10 @@ function He(e, t) {
|
|
|
1619
1622
|
function N(e, t) {
|
|
1620
1623
|
return !e.runId || !t.runId ? !0 : e.runId === t.runId;
|
|
1621
1624
|
}
|
|
1622
|
-
function
|
|
1625
|
+
function A(e, t) {
|
|
1623
1626
|
return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
|
|
1624
1627
|
}
|
|
1625
|
-
function
|
|
1628
|
+
function Be(e, t) {
|
|
1626
1629
|
try {
|
|
1627
1630
|
const s = window.localStorage.getItem(`${ut}${e}`);
|
|
1628
1631
|
if (!s)
|
|
@@ -1630,7 +1633,7 @@ function We(e, t) {
|
|
|
1630
1633
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
1631
1634
|
if (t !== void 0 && r !== t)
|
|
1632
1635
|
return null;
|
|
1633
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
1636
|
+
const i = Array.isArray(n.messages) ? n.messages.map(Ge).filter((o) => !!o) : [];
|
|
1634
1637
|
return {
|
|
1635
1638
|
sessionId: r,
|
|
1636
1639
|
messages: i
|
|
@@ -1639,20 +1642,20 @@ function We(e, t) {
|
|
|
1639
1642
|
return null;
|
|
1640
1643
|
}
|
|
1641
1644
|
}
|
|
1642
|
-
function
|
|
1645
|
+
function ve(e, t) {
|
|
1643
1646
|
try {
|
|
1644
1647
|
window.localStorage.setItem(
|
|
1645
1648
|
`${ut}${e}`,
|
|
1646
1649
|
JSON.stringify({
|
|
1647
1650
|
sessionId: t.sessionId,
|
|
1648
|
-
messages: t.messages.slice(-Xt).map(
|
|
1651
|
+
messages: t.messages.slice(-Xt).map(Xe)
|
|
1649
1652
|
})
|
|
1650
1653
|
);
|
|
1651
1654
|
} catch {
|
|
1652
1655
|
return;
|
|
1653
1656
|
}
|
|
1654
1657
|
}
|
|
1655
|
-
function
|
|
1658
|
+
function xe(e) {
|
|
1656
1659
|
try {
|
|
1657
1660
|
const t = window.localStorage.getItem(`${v}${e}`);
|
|
1658
1661
|
if (!t)
|
|
@@ -1690,7 +1693,7 @@ function rt(e) {
|
|
|
1690
1693
|
const t = e;
|
|
1691
1694
|
return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
|
|
1692
1695
|
}
|
|
1693
|
-
function
|
|
1696
|
+
function At(e, t) {
|
|
1694
1697
|
if (!Array.isArray(e))
|
|
1695
1698
|
return;
|
|
1696
1699
|
const s = e.filter((r) => {
|
|
@@ -1698,24 +1701,24 @@ function It(e, t) {
|
|
|
1698
1701
|
return !1;
|
|
1699
1702
|
const i = r;
|
|
1700
1703
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
1701
|
-
}), n = t ? s.map((r) =>
|
|
1704
|
+
}), n = t ? s.map((r) => It(r, t)) : s;
|
|
1702
1705
|
return n.length > 0 ? n : void 0;
|
|
1703
1706
|
}
|
|
1704
|
-
function
|
|
1707
|
+
function It(e, t) {
|
|
1705
1708
|
return e.fileUrl?.startsWith("/") ? {
|
|
1706
1709
|
...e,
|
|
1707
1710
|
fileUrl: new URL(e.fileUrl, t).toString()
|
|
1708
1711
|
} : e;
|
|
1709
1712
|
}
|
|
1710
|
-
function
|
|
1711
|
-
if (
|
|
1713
|
+
function je(e) {
|
|
1714
|
+
if ($e(e))
|
|
1712
1715
|
return {
|
|
1713
1716
|
headers: {
|
|
1714
1717
|
"ngrok-skip-browser-warning": "true"
|
|
1715
1718
|
}
|
|
1716
1719
|
};
|
|
1717
1720
|
}
|
|
1718
|
-
function
|
|
1721
|
+
function $e(e) {
|
|
1719
1722
|
try {
|
|
1720
1723
|
const t = new URL(e).hostname;
|
|
1721
1724
|
return t.endsWith(".ngrok-free.dev") || t.endsWith(".ngrok-free.app") || t.endsWith(".ngrok.app") || t.endsWith(".ngrok.io");
|
|
@@ -1724,13 +1727,13 @@ function je(e) {
|
|
|
1724
1727
|
}
|
|
1725
1728
|
}
|
|
1726
1729
|
function it(e) {
|
|
1727
|
-
return e.type ||
|
|
1730
|
+
return e.type || ze(e.name) || "application/octet-stream";
|
|
1728
1731
|
}
|
|
1729
|
-
function
|
|
1732
|
+
function ze(e) {
|
|
1730
1733
|
const t = e.toLowerCase();
|
|
1731
1734
|
return t.endsWith(".png") ? "image/png" : t.endsWith(".jpg") || t.endsWith(".jpeg") ? "image/jpeg" : t.endsWith(".webp") ? "image/webp" : t.endsWith(".gif") ? "image/gif" : t.endsWith(".pdf") ? "application/pdf" : null;
|
|
1732
1735
|
}
|
|
1733
|
-
function
|
|
1736
|
+
function Ge(e) {
|
|
1734
1737
|
if (!e || typeof e != "object")
|
|
1735
1738
|
return null;
|
|
1736
1739
|
const t = e;
|
|
@@ -1742,11 +1745,11 @@ function ze(e) {
|
|
|
1742
1745
|
respondsToUserMessageId: typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : void 0,
|
|
1743
1746
|
...typeof t.runId == "string" ? { runId: t.runId } : {},
|
|
1744
1747
|
dataType: typeof t.dataType == "string" ? t.dataType : void 0,
|
|
1745
|
-
attachments:
|
|
1748
|
+
attachments: At(t.attachments)?.map(G),
|
|
1746
1749
|
loading: typeof t.loading == "boolean" ? t.loading : void 0
|
|
1747
1750
|
};
|
|
1748
1751
|
}
|
|
1749
|
-
function
|
|
1752
|
+
function Xe(e) {
|
|
1750
1753
|
return e.attachments?.length ? {
|
|
1751
1754
|
...e,
|
|
1752
1755
|
attachments: e.attachments.map(G)
|
|
@@ -1769,7 +1772,7 @@ function k(e) {
|
|
|
1769
1772
|
const t = e.runId;
|
|
1770
1773
|
return typeof t == "string" && t ? t : null;
|
|
1771
1774
|
}
|
|
1772
|
-
function
|
|
1775
|
+
function Ke(e) {
|
|
1773
1776
|
return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string";
|
|
1774
1777
|
}
|
|
1775
1778
|
function ot(e) {
|
|
@@ -1778,26 +1781,26 @@ function ot(e) {
|
|
|
1778
1781
|
t[n] = s;
|
|
1779
1782
|
}), t;
|
|
1780
1783
|
}
|
|
1781
|
-
async function
|
|
1784
|
+
async function Je(e, t) {
|
|
1782
1785
|
if (typeof t?.body < "u")
|
|
1783
1786
|
return St(t.body);
|
|
1784
1787
|
if (e)
|
|
1785
1788
|
try {
|
|
1786
|
-
return
|
|
1789
|
+
return I(await e.clone().text());
|
|
1787
1790
|
} catch {
|
|
1788
1791
|
return;
|
|
1789
1792
|
}
|
|
1790
1793
|
}
|
|
1791
|
-
async function
|
|
1794
|
+
async function Ve(e) {
|
|
1792
1795
|
try {
|
|
1793
|
-
return
|
|
1796
|
+
return I(await e.clone().text());
|
|
1794
1797
|
} catch (t) {
|
|
1795
1798
|
return { error: t instanceof Error ? t.message : "unavailable" };
|
|
1796
1799
|
}
|
|
1797
1800
|
}
|
|
1798
|
-
function
|
|
1801
|
+
function Ye(e) {
|
|
1799
1802
|
try {
|
|
1800
|
-
return e.responseType === "" || e.responseType === "text" ?
|
|
1803
|
+
return e.responseType === "" || e.responseType === "text" ? I(e.responseText ?? "") : e.responseType === "json" ? I(JSON.stringify(e.response)) : `[unsupported xhr responseType: ${e.responseType || "unknown"}]`;
|
|
1801
1804
|
} catch (t) {
|
|
1802
1805
|
return { error: t instanceof Error ? t.message : "unavailable" };
|
|
1803
1806
|
}
|
|
@@ -1805,23 +1808,23 @@ function Ve(e) {
|
|
|
1805
1808
|
function St(e) {
|
|
1806
1809
|
if (!(e === null || typeof e > "u")) {
|
|
1807
1810
|
if (typeof e == "string")
|
|
1808
|
-
return
|
|
1811
|
+
return I(e);
|
|
1809
1812
|
if (e instanceof URLSearchParams)
|
|
1810
|
-
return
|
|
1813
|
+
return I(e.toString());
|
|
1811
1814
|
if (e instanceof FormData) {
|
|
1812
1815
|
const t = [];
|
|
1813
|
-
return e.forEach((s, n) => t.push([n, s instanceof File ? `[file:${s.name}]` : String(s)])),
|
|
1816
|
+
return e.forEach((s, n) => t.push([n, s instanceof File ? `[file:${s.name}]` : String(s)])), I(JSON.stringify(t));
|
|
1814
1817
|
}
|
|
1815
1818
|
if (e instanceof Blob)
|
|
1816
1819
|
return `[blob:${e.type || "application/octet-stream"}:${e.size}]`;
|
|
1817
1820
|
try {
|
|
1818
|
-
return
|
|
1821
|
+
return I(JSON.stringify(e));
|
|
1819
1822
|
} catch {
|
|
1820
1823
|
return `[unserializable body: ${Object.prototype.toString.call(e)}]`;
|
|
1821
1824
|
}
|
|
1822
1825
|
}
|
|
1823
1826
|
}
|
|
1824
|
-
function
|
|
1827
|
+
function Ze(e) {
|
|
1825
1828
|
const t = {};
|
|
1826
1829
|
for (const s of e.trim().split(/[\r\n]+/)) {
|
|
1827
1830
|
const n = s.indexOf(":");
|
|
@@ -1829,13 +1832,13 @@ function Ye(e) {
|
|
|
1829
1832
|
}
|
|
1830
1833
|
return t;
|
|
1831
1834
|
}
|
|
1832
|
-
function
|
|
1835
|
+
function I(e) {
|
|
1833
1836
|
return e.length <= F ? e : `${e.slice(0, F)}... [truncated ${e.length - F} chars]`;
|
|
1834
1837
|
}
|
|
1835
1838
|
function U(e) {
|
|
1836
1839
|
return `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1837
1840
|
}
|
|
1838
|
-
class
|
|
1841
|
+
class C extends Error {
|
|
1839
1842
|
constructor(t, s) {
|
|
1840
1843
|
super(`${t} (${s})`), this.status = s, this.name = "AttachmentUploadHttpError";
|
|
1841
1844
|
}
|
|
@@ -1847,79 +1850,80 @@ async function H(e, t) {
|
|
|
1847
1850
|
try {
|
|
1848
1851
|
return await e();
|
|
1849
1852
|
} catch (r) {
|
|
1850
|
-
if (s = r, n >= Y - 1 || !
|
|
1853
|
+
if (s = r, n >= Y - 1 || !ts(r))
|
|
1851
1854
|
throw r;
|
|
1852
|
-
await
|
|
1855
|
+
await Qe(n);
|
|
1853
1856
|
}
|
|
1854
1857
|
throw s instanceof Error ? s : new Error(t);
|
|
1855
1858
|
}
|
|
1856
|
-
function
|
|
1859
|
+
function Qe(e) {
|
|
1857
1860
|
return new Promise((t) => {
|
|
1858
1861
|
window.setTimeout(t, $t[e] ?? 0);
|
|
1859
1862
|
});
|
|
1860
1863
|
}
|
|
1861
|
-
function Qe(e) {
|
|
1862
|
-
return e instanceof M ? ts(e.status) : e instanceof TypeError;
|
|
1863
|
-
}
|
|
1864
1864
|
function ts(e) {
|
|
1865
|
-
return e
|
|
1865
|
+
return e instanceof C ? es(e.status) : e instanceof TypeError;
|
|
1866
1866
|
}
|
|
1867
1867
|
function es(e) {
|
|
1868
|
+
return e === 408 || e === 409 || e === 429 || e >= 500;
|
|
1869
|
+
}
|
|
1870
|
+
function ss(e) {
|
|
1868
1871
|
return e === 401 || e === 403;
|
|
1869
1872
|
}
|
|
1870
|
-
const X = "[REDACTED_SECRET]", w = "[REDACTED_TOKEN]",
|
|
1873
|
+
const X = "[REDACTED_SECRET]", w = "[REDACTED_TOKEN]", ns = "[REDACTED_SIGNED_URL]", rs = 20, is = /^(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, kt = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Et = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Rt = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, _t = /\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, os = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, as = /\bhttps?:\/\/[^\s"'<>]+/gi, cs = /[),.;\]]+$/;
|
|
1871
1874
|
function T(e) {
|
|
1872
|
-
return
|
|
1875
|
+
return M(e, 0, /* @__PURE__ */ new WeakSet());
|
|
1873
1876
|
}
|
|
1874
|
-
function
|
|
1877
|
+
function M(e, t, s) {
|
|
1875
1878
|
if (typeof e == "string")
|
|
1876
|
-
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e :
|
|
1879
|
+
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : ds(e);
|
|
1877
1880
|
if (e === null || typeof e != "object")
|
|
1878
1881
|
return e;
|
|
1879
|
-
if (t >=
|
|
1882
|
+
if (t >= rs)
|
|
1880
1883
|
return "[REDACTED_MAX_DEPTH]";
|
|
1881
1884
|
if (s.has(e))
|
|
1882
1885
|
return "[REDACTED_CIRCULAR]";
|
|
1883
1886
|
if (s.add(e), Array.isArray(e))
|
|
1884
|
-
return e.map((r) =>
|
|
1887
|
+
return e.map((r) => M(r, t + 1, s));
|
|
1885
1888
|
const n = {};
|
|
1886
1889
|
for (const [r, i] of Object.entries(e))
|
|
1887
|
-
|
|
1890
|
+
ls(r) ? n[r] = X : n[r] = r.toLowerCase() === "url" ? us(i) : M(i, t + 1, s);
|
|
1888
1891
|
return n;
|
|
1889
1892
|
}
|
|
1890
|
-
function
|
|
1893
|
+
function ls(e) {
|
|
1891
1894
|
const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
1892
1895
|
return t.includes("authorization") || t.includes("cookie") || t.includes("password") || t.includes("passwd") || t === "pwd" || t.includes("secret") || t === "token" || t.endsWith("token") || t.includes("apikey") || t.includes("csrf") || t.includes("xsrf") || t === "jwt" || t === "session" || t === "signature" || t.includes("privatekey");
|
|
1893
1896
|
}
|
|
1894
|
-
function
|
|
1895
|
-
return typeof e == "string" ? Pt(e) :
|
|
1897
|
+
function us(e) {
|
|
1898
|
+
return typeof e == "string" ? Pt(e) : M(e, 0, /* @__PURE__ */ new WeakSet());
|
|
1896
1899
|
}
|
|
1897
1900
|
function Pt(e) {
|
|
1898
1901
|
try {
|
|
1899
1902
|
const t = new URL(e, location.href);
|
|
1900
1903
|
for (const s of Array.from(t.searchParams.keys()))
|
|
1901
|
-
|
|
1904
|
+
is.test(s) && t.searchParams.set(s, w);
|
|
1902
1905
|
return t.username && (t.username = w), t.password && (t.password = w), t.toString();
|
|
1903
1906
|
} catch {
|
|
1904
|
-
return
|
|
1907
|
+
return hs(e);
|
|
1905
1908
|
}
|
|
1906
1909
|
}
|
|
1907
|
-
function us(e) {
|
|
1908
|
-
return e.replace(is, ss).replace(os, hs).replace(kt, `Bearer ${w}`).replace(Et, `Basic ${w}`).replace(Rt, w).replace(_t, (t, s) => `${s}: ${X}`);
|
|
1909
|
-
}
|
|
1910
1910
|
function ds(e) {
|
|
1911
|
-
return e.replace(kt, `Bearer ${w}`).replace(Et, `Basic ${w}`).replace(Rt, w).replace(_t, (t, s) => `${s}: ${X}`);
|
|
1911
|
+
return e.replace(os, ns).replace(as, ps).replace(kt, `Bearer ${w}`).replace(Et, `Basic ${w}`).replace(Rt, w).replace(_t, (t, s) => `${s}: ${X}`);
|
|
1912
1912
|
}
|
|
1913
1913
|
function hs(e) {
|
|
1914
|
-
|
|
1914
|
+
return e.replace(kt, `Bearer ${w}`).replace(Et, `Basic ${w}`).replace(Rt, w).replace(_t, (t, s) => `${s}: ${X}`);
|
|
1915
|
+
}
|
|
1916
|
+
function ps(e) {
|
|
1917
|
+
const t = e.match(cs)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
|
|
1915
1918
|
return `${Pt(s)}${t}`;
|
|
1916
1919
|
}
|
|
1917
1920
|
export {
|
|
1918
1921
|
J as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
1919
1922
|
B as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
1920
1923
|
Dt as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
1921
|
-
|
|
1924
|
+
Mt as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
1922
1925
|
Nt as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
1923
1926
|
dt as PlunoProductAgent,
|
|
1924
|
-
dt as default
|
|
1927
|
+
dt as default,
|
|
1928
|
+
ne as getProductAgentOriginAccessErrorMessage
|
|
1925
1929
|
};
|