@pluno/product-agent-web 0.1.131 → 0.1.132
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-sdk.js +162 -148
- package/package.json +1 -1
|
@@ -81,7 +81,7 @@ function Te(e, t, s) {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
const It = "pluno.productAgent.transportId", Ze = "pluno.productAgent.transportIdentity", Tt = "pluno.productAgent.transportIdentity.event", Qe = 50, ts = globalThis.setTimeout.bind(globalThis);
|
|
84
|
-
let
|
|
84
|
+
let $ = null;
|
|
85
85
|
const Q = /* @__PURE__ */ new Set(), wt = /* @__PURE__ */ new Map();
|
|
86
86
|
async function es(e = we()) {
|
|
87
87
|
const t = e.randomUUID(), s = e.storage.getItem(It);
|
|
@@ -120,13 +120,13 @@ async function es(e = we()) {
|
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
async function ss() {
|
|
123
|
-
|
|
123
|
+
$ || ($ = es(we()), $.then((n) => {
|
|
124
124
|
const r = (i) => {
|
|
125
|
-
i.persisted || (n.release(),
|
|
125
|
+
i.persisted || (n.release(), $ = null, Q.clear(), window.removeEventListener("pagehide", r));
|
|
126
126
|
};
|
|
127
127
|
window.addEventListener("pagehide", r);
|
|
128
128
|
}));
|
|
129
|
-
const e = await
|
|
129
|
+
const e = await $, t = ns();
|
|
130
130
|
Q.add(t);
|
|
131
131
|
let s = !1;
|
|
132
132
|
return {
|
|
@@ -204,7 +204,7 @@ function os() {
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
const as = globalThis.fetch.bind(globalThis), Mt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', cs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ls = ".pluno-pa-widget__panel", us = ".pluno-pa-widget__timeline", te = `${Mt}[data-pluno-sdk-preview-channel]`, ds = "https://app.pluno.ai", hs = "gpt-5.6-terra", ps = 2e4, fs = 1e4, gs = 1e4, ms = 1e4, ys = 1e4, Is = 1e3, ee = 3e4, se = 0.2, ne = 6e4, Ts = 15e3, K = 8, ws = 15e3,
|
|
207
|
+
const as = globalThis.fetch.bind(globalThis), Mt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', cs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ls = ".pluno-pa-widget__panel", us = ".pluno-pa-widget__timeline", te = `${Mt}[data-pluno-sdk-preview-channel]`, ds = "https://app.pluno.ai", hs = "gpt-5.6-terra", ps = 2e4, fs = 1e4, gs = 1e4, ms = 1e4, ys = 1e4, Is = 1e3, ee = 3e4, se = 0.2, ne = 6e4, Ts = 15e3, K = 8, ws = 15e3, Ss = 2e3, As = 1e3, bs = 100, Es = 8e3, re = 3, ks = [300, 1e3], Lt = 64e3, St = 4e3, Bt = 30, Rs = 2e3, _s = 1e3, Se = "Image is too large for model vision input.", Ms = 100, Ae = "pluno.productAgent.state.", Ct = "pluno.productAgent.pendingEvents.", rt = "pluno.productAgent.activeToolCalls.", Cs = 100;
|
|
208
208
|
function V(e, t = 0) {
|
|
209
209
|
const s = e === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (e - 1));
|
|
210
210
|
return Math.max(t, s);
|
|
@@ -250,7 +250,7 @@ class be {
|
|
|
250
250
|
}), this.queuedClientEvents = nr(
|
|
251
251
|
Zn(t.clientId),
|
|
252
252
|
tr(t.clientId)
|
|
253
|
-
),
|
|
253
|
+
), W(t.clientId, this.queuedClientEvents);
|
|
254
254
|
}
|
|
255
255
|
options;
|
|
256
256
|
listeners = {};
|
|
@@ -326,7 +326,7 @@ class be {
|
|
|
326
326
|
}, s);
|
|
327
327
|
try {
|
|
328
328
|
Ke().catch((r) => {
|
|
329
|
-
|
|
329
|
+
S("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
330
330
|
message: r instanceof Error ? r.message : String(r)
|
|
331
331
|
});
|
|
332
332
|
}), t.disableNetworkCapture || n.enableNetworkCapture(), n.startPageLifecycleRecovery(), n.startStarterPromptUrlWatcher(), t.autoConnect !== !1 && await n.connect();
|
|
@@ -363,9 +363,9 @@ class be {
|
|
|
363
363
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
364
364
|
const s = tn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
|
|
365
365
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
366
|
-
this.socket === n && n.readyState === WebSocket.CONNECTING && (
|
|
366
|
+
this.socket === n && n.readyState === WebSocket.CONNECTING && (S("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
367
367
|
}, ms), n.addEventListener("open", () => {
|
|
368
|
-
this.socket !== n || (this.clearSocketConnectTimer(),
|
|
368
|
+
this.socket !== n || (this.clearSocketConnectTimer(), S("web-sdk.agent", "Pluno socket opened", {
|
|
369
369
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
370
370
|
isThinking: this.state.isThinking
|
|
371
371
|
}), !(this.token ? this.sendNow({
|
|
@@ -375,12 +375,12 @@ class be {
|
|
|
375
375
|
transportId: this.transportIdentity.transportId,
|
|
376
376
|
pageUrl: location.href
|
|
377
377
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
378
|
-
this.socket === n && (
|
|
378
|
+
this.socket === n && (S("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
379
379
|
}, ys));
|
|
380
380
|
}), n.addEventListener("message", (r) => {
|
|
381
381
|
this.socket === n && this.handleServerEvent(dn(r.data));
|
|
382
382
|
}), n.addEventListener("close", (r) => {
|
|
383
|
-
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (
|
|
383
|
+
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (S("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
384
384
|
code: typeof r?.code == "number" ? r.code : null,
|
|
385
385
|
reason: typeof r?.reason == "string" ? r.reason : "",
|
|
386
386
|
wasClean: typeof r?.wasClean == "boolean" ? r.wasClean : null,
|
|
@@ -388,7 +388,7 @@ class be {
|
|
|
388
388
|
isThinking: this.state.isThinking
|
|
389
389
|
}), this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect()));
|
|
390
390
|
}), n.addEventListener("error", () => {
|
|
391
|
-
this.socket !== n || this.state.status === "closed" || (
|
|
391
|
+
this.socket !== n || this.state.status === "closed" || (S("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
392
392
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
393
393
|
isThinking: this.state.isThinking
|
|
394
394
|
}), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
|
|
@@ -449,14 +449,14 @@ class be {
|
|
|
449
449
|
try {
|
|
450
450
|
const u = [];
|
|
451
451
|
for (const h of i) {
|
|
452
|
-
const
|
|
452
|
+
const f = h.id ? this.attachmentFiles.get(h.id) : void 0;
|
|
453
453
|
if (h.sandboxPath) {
|
|
454
454
|
u.push(h);
|
|
455
455
|
continue;
|
|
456
456
|
}
|
|
457
|
-
if (!
|
|
457
|
+
if (!f)
|
|
458
458
|
throw new Error(`Attachment bytes are unavailable for ${h.name}`);
|
|
459
|
-
u.push(await this.uploadAttachmentForMessage({ file:
|
|
459
|
+
u.push(await this.uploadAttachmentForMessage({ file: f, attachment: h }));
|
|
460
460
|
}
|
|
461
461
|
i = u;
|
|
462
462
|
} catch (u) {
|
|
@@ -466,7 +466,7 @@ class be {
|
|
|
466
466
|
}), u;
|
|
467
467
|
}
|
|
468
468
|
this.retryableClientMessageId = null;
|
|
469
|
-
const y = !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url,
|
|
469
|
+
const y = !s.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, m = {
|
|
470
470
|
type: "chat.user_message",
|
|
471
471
|
sessionId: this.state.sessionId ?? void 0,
|
|
472
472
|
clientMessageId: a,
|
|
@@ -480,7 +480,7 @@ class be {
|
|
|
480
480
|
model: this.options.model,
|
|
481
481
|
metadata: ie(this.options.metadata)
|
|
482
482
|
};
|
|
483
|
-
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.activeClientMessageId = a, this.activeUserMessageEvent =
|
|
483
|
+
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.activeClientMessageId = a, this.activeUserMessageEvent = m, this.markThinkingProgress(), this.send(m), a;
|
|
484
484
|
}
|
|
485
485
|
retryLastMessage() {
|
|
486
486
|
const t = this.state.sessionId, s = this.retryableClientMessageId;
|
|
@@ -506,7 +506,7 @@ class be {
|
|
|
506
506
|
createdAt: r,
|
|
507
507
|
lastUsedAt: r
|
|
508
508
|
}).catch((i) => {
|
|
509
|
-
|
|
509
|
+
S("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
510
510
|
attachmentId: s,
|
|
511
511
|
name: n.name,
|
|
512
512
|
message: i instanceof Error ? i.message : String(i)
|
|
@@ -557,7 +557,7 @@ class be {
|
|
|
557
557
|
sandboxPath: a.sandboxPath,
|
|
558
558
|
lastUsedAt: Date.now()
|
|
559
559
|
}).catch((c) => {
|
|
560
|
-
|
|
560
|
+
S("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
561
561
|
attachmentId: s.id,
|
|
562
562
|
name: a.name,
|
|
563
563
|
message: c instanceof Error ? c.message : String(c)
|
|
@@ -661,7 +661,7 @@ class be {
|
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
663
|
send(t) {
|
|
664
|
-
this.sendNow(k(t)) || (this.queuedClientEvents.push(t),
|
|
664
|
+
this.sendNow(k(t)) || (this.queuedClientEvents.push(t), W(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
|
|
665
665
|
}
|
|
666
666
|
async getUploadToken() {
|
|
667
667
|
const t = this.options.token ?? await this.options.tokenProvider?.() ?? this.token ?? null;
|
|
@@ -676,7 +676,7 @@ class be {
|
|
|
676
676
|
try {
|
|
677
677
|
return s.send(JSON.stringify(t)), !0;
|
|
678
678
|
} catch (n) {
|
|
679
|
-
return
|
|
679
|
+
return S("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
680
680
|
message: n instanceof Error ? n.message : String(n),
|
|
681
681
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
682
682
|
isThinking: this.state.isThinking
|
|
@@ -719,14 +719,14 @@ class be {
|
|
|
719
719
|
if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
|
|
720
720
|
return;
|
|
721
721
|
const t = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
|
|
722
|
-
|
|
722
|
+
W(this.options.clientId, this.queuedClientEvents);
|
|
723
723
|
for (let s = 0; s < t.length; s += 1) {
|
|
724
724
|
const n = t[s];
|
|
725
725
|
if (!this.sendNow(k(n))) {
|
|
726
|
-
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)),
|
|
726
|
+
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), W(this.options.clientId, this.queuedClientEvents);
|
|
727
727
|
return;
|
|
728
728
|
}
|
|
729
|
-
|
|
729
|
+
W(this.options.clientId, this.queuedClientEvents);
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
handleServerEvent(t) {
|
|
@@ -741,7 +741,7 @@ class be {
|
|
|
741
741
|
if (vs(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
742
742
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.startHeartbeat();
|
|
743
743
|
const s = pn(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
744
|
-
|
|
744
|
+
S("web-sdk.agent", "Received auth.ok appearance", {
|
|
745
745
|
hasAppearance: n,
|
|
746
746
|
rawAppearance: t.appearance,
|
|
747
747
|
normalizedAppearance: s
|
|
@@ -772,32 +772,32 @@ class be {
|
|
|
772
772
|
this.rememberUserMessageClientMessageIds(s);
|
|
773
773
|
const i = Hn(s);
|
|
774
774
|
if (i) {
|
|
775
|
-
const
|
|
775
|
+
const f = Fn(s, i);
|
|
776
776
|
this.retryAttemptsByClientMessageId[i] = Math.max(
|
|
777
777
|
this.retryAttemptsByClientMessageId[i] ?? 0,
|
|
778
|
-
|
|
778
|
+
f
|
|
779
779
|
);
|
|
780
780
|
}
|
|
781
|
-
const o = s.filter((
|
|
782
|
-
const
|
|
783
|
-
return !he(
|
|
781
|
+
const o = s.filter((f) => {
|
|
782
|
+
const I = L(f);
|
|
783
|
+
return !he(I) && (!i || !Pt(I));
|
|
784
784
|
}), a = Dn(
|
|
785
785
|
this.state.messages,
|
|
786
786
|
Tn(o, this.options.backendUrl)
|
|
787
787
|
), c = de(a), l = !r && s.some(
|
|
788
|
-
(
|
|
789
|
-
L(
|
|
788
|
+
(f) => fe(
|
|
789
|
+
L(f),
|
|
790
790
|
this.state.assistantDraft,
|
|
791
791
|
this.state.assistantDraftItemId,
|
|
792
792
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
793
793
|
this.state.assistantDraftRunId
|
|
794
794
|
)
|
|
795
|
-
), d = r ? n?.content ?? "" : this.state.assistantDraft, p = !!n?.content, y = c && (!d || l);
|
|
795
|
+
), d = r ? n?.content ?? "" : this.state.assistantDraft, p = !!n?.content, y = c && (!d || l), m = Nn(a), u = y && m;
|
|
796
796
|
if (!c && qn(this.state.messages, s))
|
|
797
797
|
return;
|
|
798
798
|
this.lastUserMessagePageUrl = Bn(s);
|
|
799
|
-
const
|
|
800
|
-
if (this.latestRecoverableClientMessageId =
|
|
799
|
+
const h = y ? null : Ut(s);
|
|
800
|
+
if (this.latestRecoverableClientMessageId = h, m && this.clearRetryTimers(), this.setState({
|
|
801
801
|
sessionId: b(t.session, "id") ?? this.state.sessionId,
|
|
802
802
|
messages: a,
|
|
803
803
|
...r ? {
|
|
@@ -817,14 +817,20 @@ class be {
|
|
|
817
817
|
isThinking: !0,
|
|
818
818
|
lastError: null
|
|
819
819
|
} : y ? {
|
|
820
|
-
isThinking: !1
|
|
821
|
-
|
|
820
|
+
isThinking: !1,
|
|
821
|
+
...u ? {
|
|
822
|
+
status: "connected",
|
|
823
|
+
lastError: null,
|
|
824
|
+
lastErrorCode: null,
|
|
825
|
+
lastErrorSecuritySettingsUrl: null
|
|
826
|
+
} : {}
|
|
827
|
+
} : h ? {
|
|
822
828
|
isThinking: !0,
|
|
823
829
|
lastError: null
|
|
824
830
|
} : {}
|
|
825
|
-
}), y ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : (p ||
|
|
826
|
-
const
|
|
827
|
-
|
|
831
|
+
}), y ? (this.retryableClientMessageId = null, this.clearThinkingWatchdog()) : (p || h) && (h && (this.activeClientMessageId = h), this.markThinkingProgress()), i) {
|
|
832
|
+
const f = b(t.session, "id") ?? this.state.sessionId;
|
|
833
|
+
f && this.retryAfterInterruptedRun(f, i);
|
|
828
834
|
}
|
|
829
835
|
return;
|
|
830
836
|
}
|
|
@@ -860,7 +866,7 @@ class be {
|
|
|
860
866
|
const n = Me(t.item, this.options.backendUrl);
|
|
861
867
|
if (n) {
|
|
862
868
|
const r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
863
|
-
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)),
|
|
869
|
+
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), q(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
864
870
|
const i = t.item.data;
|
|
865
871
|
Wn(i) && this.clearRunAckResyncRetryTimer();
|
|
866
872
|
const o = Ce(this.state.messages, n), a = de(o), c = fe(
|
|
@@ -869,7 +875,7 @@ class be {
|
|
|
869
875
|
this.state.assistantDraftItemId,
|
|
870
876
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
871
877
|
this.state.assistantDraftRunId
|
|
872
|
-
), l = a && (!this.state.assistantDraft || c);
|
|
878
|
+
), l = a && (!this.state.assistantDraft || c), d = l && q(n);
|
|
873
879
|
this.setState({
|
|
874
880
|
messages: o,
|
|
875
881
|
...c ? {
|
|
@@ -879,7 +885,15 @@ class be {
|
|
|
879
885
|
assistantDraftRespondsToUserMessageId: null,
|
|
880
886
|
assistantDraftRunId: null
|
|
881
887
|
} : {},
|
|
882
|
-
...l ? {
|
|
888
|
+
...l ? {
|
|
889
|
+
isThinking: !1
|
|
890
|
+
} : {},
|
|
891
|
+
...d ? {
|
|
892
|
+
status: "connected",
|
|
893
|
+
lastError: null,
|
|
894
|
+
lastErrorCode: null,
|
|
895
|
+
lastErrorSecuritySettingsUrl: null
|
|
896
|
+
} : {}
|
|
883
897
|
}), l && this.clearThinkingWatchdog(), this.emit("message", n);
|
|
884
898
|
}
|
|
885
899
|
return;
|
|
@@ -1056,7 +1070,7 @@ class be {
|
|
|
1056
1070
|
}, ws);
|
|
1057
1071
|
}
|
|
1058
1072
|
recoverMissedRunAck(t) {
|
|
1059
|
-
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (
|
|
1073
|
+
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (S("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
1060
1074
|
sessionId: this.state.sessionId,
|
|
1061
1075
|
clientMessageId: t
|
|
1062
1076
|
}), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(t));
|
|
@@ -1069,7 +1083,7 @@ class be {
|
|
|
1069
1083
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
1070
1084
|
isThinking: !0,
|
|
1071
1085
|
lastError: null
|
|
1072
|
-
}),
|
|
1086
|
+
}), S("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
|
|
1073
1087
|
sessionId: this.state.sessionId,
|
|
1074
1088
|
clientMessageId: t
|
|
1075
1089
|
}), this.state.sessionId ? this.send({
|
|
@@ -1078,7 +1092,7 @@ class be {
|
|
|
1078
1092
|
clientMessageId: t,
|
|
1079
1093
|
automatic: !0
|
|
1080
1094
|
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(ne)));
|
|
1081
|
-
}, V(s,
|
|
1095
|
+
}, V(s, Ss)));
|
|
1082
1096
|
}
|
|
1083
1097
|
clearRunAckResyncRetryTimer() {
|
|
1084
1098
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -1091,7 +1105,7 @@ class be {
|
|
|
1091
1105
|
return;
|
|
1092
1106
|
const t = this.activeClientMessageId;
|
|
1093
1107
|
if (!t) {
|
|
1094
|
-
|
|
1108
|
+
S("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
|
|
1095
1109
|
sessionId: this.state.sessionId
|
|
1096
1110
|
}), this.setState({
|
|
1097
1111
|
isThinking: !1,
|
|
@@ -1102,7 +1116,7 @@ class be {
|
|
|
1102
1116
|
}
|
|
1103
1117
|
const s = this.thinkingWatchdogResyncAttemptsByClientMessageId[t] ?? 0, n = this.retryAttemptsByClientMessageId[t] ?? 0;
|
|
1104
1118
|
if (n >= K) {
|
|
1105
|
-
|
|
1119
|
+
S("web-sdk.agent", "Pluno run recovery retry exhausted", {
|
|
1106
1120
|
sessionId: this.state.sessionId,
|
|
1107
1121
|
clientMessageId: t
|
|
1108
1122
|
}), this.retryableClientMessageId = t, this.setState({
|
|
@@ -1113,7 +1127,7 @@ class be {
|
|
|
1113
1127
|
return;
|
|
1114
1128
|
}
|
|
1115
1129
|
if (s < 1) {
|
|
1116
|
-
this.thinkingWatchdogResyncAttemptsByClientMessageId[t] = s + 1,
|
|
1130
|
+
this.thinkingWatchdogResyncAttemptsByClientMessageId[t] = s + 1, S("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
|
|
1117
1131
|
sessionId: this.state.sessionId,
|
|
1118
1132
|
clientMessageId: t,
|
|
1119
1133
|
resyncAttempts: s + 1
|
|
@@ -1124,7 +1138,7 @@ class be {
|
|
|
1124
1138
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
1125
1139
|
isThinking: !0,
|
|
1126
1140
|
lastError: null
|
|
1127
|
-
}),
|
|
1141
|
+
}), S("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
|
|
1128
1142
|
sessionId: this.state.sessionId,
|
|
1129
1143
|
clientMessageId: t,
|
|
1130
1144
|
retryAttempts: n + 1
|
|
@@ -1265,7 +1279,7 @@ class be {
|
|
|
1265
1279
|
page: _(),
|
|
1266
1280
|
events: s
|
|
1267
1281
|
});
|
|
1268
|
-
},
|
|
1282
|
+
}, As)));
|
|
1269
1283
|
}
|
|
1270
1284
|
scheduleReconnect() {
|
|
1271
1285
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
@@ -1273,7 +1287,7 @@ class be {
|
|
|
1273
1287
|
const t = Ps(this.reconnectAttempts);
|
|
1274
1288
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
1275
1289
|
this.reconnectTimer = null, this.connect().catch((s) => {
|
|
1276
|
-
|
|
1290
|
+
S("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
1277
1291
|
message: s instanceof Error ? s.message : String(s),
|
|
1278
1292
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1279
1293
|
isThinking: this.state.isThinking
|
|
@@ -1285,7 +1299,7 @@ class be {
|
|
|
1285
1299
|
this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
|
|
1286
1300
|
const t = this.socket;
|
|
1287
1301
|
!t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
1288
|
-
this.socket === t && (
|
|
1302
|
+
this.socket === t && (S("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
|
|
1289
1303
|
}, fs));
|
|
1290
1304
|
}, ps);
|
|
1291
1305
|
}
|
|
@@ -1319,7 +1333,7 @@ class be {
|
|
|
1319
1333
|
this.listeners[t]?.forEach((r) => r(s));
|
|
1320
1334
|
}
|
|
1321
1335
|
}
|
|
1322
|
-
const
|
|
1336
|
+
const At = /* @__PURE__ */ new WeakMap();
|
|
1323
1337
|
function Ds(e) {
|
|
1324
1338
|
const t = window.__plunoProductAgentNetworkCapture ?? xs();
|
|
1325
1339
|
return t.subscribers.add(e), () => {
|
|
@@ -1328,37 +1342,37 @@ function Ds(e) {
|
|
|
1328
1342
|
}
|
|
1329
1343
|
function xs() {
|
|
1330
1344
|
const e = /* @__PURE__ */ new Set(), t = (y) => {
|
|
1331
|
-
e.forEach((
|
|
1345
|
+
e.forEach((m) => {
|
|
1332
1346
|
try {
|
|
1333
|
-
|
|
1347
|
+
m(y);
|
|
1334
1348
|
} catch {
|
|
1335
1349
|
}
|
|
1336
1350
|
});
|
|
1337
|
-
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(
|
|
1351
|
+
}, s = window.fetch, n = XMLHttpRequest.prototype.open, r = XMLHttpRequest.prototype.setRequestHeader, i = XMLHttpRequest.prototype.send, o = function(m, u) {
|
|
1338
1352
|
const h = Date.now();
|
|
1339
|
-
let
|
|
1353
|
+
let f;
|
|
1340
1354
|
try {
|
|
1341
|
-
|
|
1342
|
-
} catch (
|
|
1343
|
-
throw
|
|
1355
|
+
f = s.call(this, m, u);
|
|
1356
|
+
} catch (I) {
|
|
1357
|
+
throw I;
|
|
1344
1358
|
}
|
|
1345
1359
|
try {
|
|
1346
|
-
const
|
|
1347
|
-
if (!O(x,
|
|
1348
|
-
const
|
|
1360
|
+
const I = m instanceof Request ? m : null, x = lr(m, I), T = Ne(u?.headers ?? I?.headers);
|
|
1361
|
+
if (!O(x, T, u?.body)) {
|
|
1362
|
+
const H = {
|
|
1349
1363
|
requestId: kt("fetch"),
|
|
1350
|
-
url: C(x,
|
|
1351
|
-
method: (u?.method ??
|
|
1352
|
-
requestHeaders:
|
|
1364
|
+
url: C(x, St),
|
|
1365
|
+
method: (u?.method ?? I?.method ?? "GET").toUpperCase(),
|
|
1366
|
+
requestHeaders: T,
|
|
1353
1367
|
requestBody: ye(u?.body),
|
|
1354
1368
|
resourceType: "fetch",
|
|
1355
1369
|
startedAt: new Date(h).toISOString()
|
|
1356
1370
|
};
|
|
1357
|
-
|
|
1371
|
+
f.then(
|
|
1358
1372
|
(R) => {
|
|
1359
|
-
ur(R,
|
|
1373
|
+
ur(R, H, h, t).catch(() => {
|
|
1360
1374
|
t({
|
|
1361
|
-
...
|
|
1375
|
+
...H,
|
|
1362
1376
|
responseStatus: R.status,
|
|
1363
1377
|
durationMs: Date.now() - h
|
|
1364
1378
|
});
|
|
@@ -1366,7 +1380,7 @@ function xs() {
|
|
|
1366
1380
|
},
|
|
1367
1381
|
(R) => {
|
|
1368
1382
|
t({
|
|
1369
|
-
...
|
|
1383
|
+
...H,
|
|
1370
1384
|
errorText: C(R instanceof Error ? R.message : String(R)),
|
|
1371
1385
|
durationMs: Date.now() - h
|
|
1372
1386
|
});
|
|
@@ -1375,25 +1389,25 @@ function xs() {
|
|
|
1375
1389
|
}
|
|
1376
1390
|
} catch {
|
|
1377
1391
|
}
|
|
1378
|
-
return
|
|
1379
|
-
}, a = function(
|
|
1380
|
-
const x = n.call(this,
|
|
1381
|
-
return
|
|
1392
|
+
return f;
|
|
1393
|
+
}, a = function(m, u, h, f, I) {
|
|
1394
|
+
const x = n.call(this, m, u, h ?? !0, f ?? void 0, I ?? void 0), T = typeof u == "string" ? u : u.toString();
|
|
1395
|
+
return At.set(this, {
|
|
1382
1396
|
requestId: kt("xhr"),
|
|
1383
|
-
method: String(
|
|
1384
|
-
url: C(
|
|
1397
|
+
method: String(m ?? "GET").toUpperCase(),
|
|
1398
|
+
url: C(T, St),
|
|
1385
1399
|
requestHeaders: {},
|
|
1386
1400
|
startedAtMs: Date.now(),
|
|
1387
1401
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1388
|
-
excluded: O(
|
|
1402
|
+
excluded: O(T)
|
|
1389
1403
|
}), x;
|
|
1390
|
-
}, c = function(
|
|
1391
|
-
const h = r.call(this,
|
|
1392
|
-
return
|
|
1393
|
-
}, l = function(
|
|
1404
|
+
}, c = function(m, u) {
|
|
1405
|
+
const h = r.call(this, m, u), f = At.get(this);
|
|
1406
|
+
return f && Object.keys(f.requestHeaders).length < Bt && (f.requestHeaders[m] = jt(m, u), f.excluded = f.excluded || O(f.url, f.requestHeaders)), h;
|
|
1407
|
+
}, l = function(m) {
|
|
1394
1408
|
try {
|
|
1395
|
-
const u =
|
|
1396
|
-
u && (u.excluded = u.excluded || O(u.url, u.requestHeaders,
|
|
1409
|
+
const u = At.get(this);
|
|
1410
|
+
u && (u.excluded = u.excluded || O(u.url, u.requestHeaders, m), u.requestBody = ye(m), u.excluded || this.addEventListener(
|
|
1397
1411
|
"loadend",
|
|
1398
1412
|
() => {
|
|
1399
1413
|
queueMicrotask(() => {
|
|
@@ -1422,7 +1436,7 @@ function xs() {
|
|
|
1422
1436
|
));
|
|
1423
1437
|
} catch {
|
|
1424
1438
|
}
|
|
1425
|
-
return i.call(this,
|
|
1439
|
+
return i.call(this, m ?? null);
|
|
1426
1440
|
};
|
|
1427
1441
|
try {
|
|
1428
1442
|
window.fetch = o;
|
|
@@ -1443,14 +1457,14 @@ function xs() {
|
|
|
1443
1457
|
let d = null;
|
|
1444
1458
|
if (typeof PerformanceObserver < "u") {
|
|
1445
1459
|
d = new PerformanceObserver((y) => {
|
|
1446
|
-
for (const
|
|
1447
|
-
const u =
|
|
1460
|
+
for (const m of y.getEntries()) {
|
|
1461
|
+
const u = m;
|
|
1448
1462
|
if (u.initiatorType === "fetch" || u.initiatorType === "xmlhttprequest" || O(u.name))
|
|
1449
1463
|
continue;
|
|
1450
1464
|
const h = performance.timeOrigin + u.startTime;
|
|
1451
1465
|
t({
|
|
1452
1466
|
requestId: kt("resource"),
|
|
1453
|
-
url: C(u.name,
|
|
1467
|
+
url: C(u.name, St),
|
|
1454
1468
|
method: "GET",
|
|
1455
1469
|
resourceType: "resource",
|
|
1456
1470
|
responseStatus: u.responseStatus,
|
|
@@ -1489,7 +1503,7 @@ function xs() {
|
|
|
1489
1503
|
};
|
|
1490
1504
|
return window.__plunoProductAgentNetworkCapture = p, p;
|
|
1491
1505
|
}
|
|
1492
|
-
function
|
|
1506
|
+
function S(e, t, s) {
|
|
1493
1507
|
if (typeof window > "u")
|
|
1494
1508
|
return;
|
|
1495
1509
|
const n = window, r = {
|
|
@@ -1542,7 +1556,7 @@ async function Fs(e, t = {}) {
|
|
|
1542
1556
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
1543
1557
|
type: "pluno.pageImages.inspectImage",
|
|
1544
1558
|
imageAttached: !1,
|
|
1545
|
-
imageAttachmentError:
|
|
1559
|
+
imageAttachmentError: Se
|
|
1546
1560
|
} : {
|
|
1547
1561
|
type: "pluno.pageImages.inspectImage",
|
|
1548
1562
|
imageAttached: !0,
|
|
@@ -1557,7 +1571,7 @@ async function Fs(e, t = {}) {
|
|
|
1557
1571
|
};
|
|
1558
1572
|
}
|
|
1559
1573
|
async function $s(e) {
|
|
1560
|
-
return e instanceof Blob ? e.type.startsWith("image/") ? e.size === 0 ? { ok: !1, error: "Page image is empty." } : e.size > 8 * 1024 * 1024 ? { ok: !1, error:
|
|
1574
|
+
return e instanceof Blob ? e.type.startsWith("image/") ? e.size === 0 ? { ok: !1, error: "Page image is empty." } : e.size > 8 * 1024 * 1024 ? { ok: !1, error: Se } : {
|
|
1561
1575
|
ok: !0,
|
|
1562
1576
|
mimeType: e.type,
|
|
1563
1577
|
sizeBytes: e.size,
|
|
@@ -1784,29 +1798,29 @@ function rn() {
|
|
|
1784
1798
|
function qt() {
|
|
1785
1799
|
if (!document.body)
|
|
1786
1800
|
return "";
|
|
1787
|
-
const e = [], t = [], s = (h,
|
|
1788
|
-
const
|
|
1789
|
-
!
|
|
1801
|
+
const e = [], t = [], s = (h, f) => {
|
|
1802
|
+
const I = B(f);
|
|
1803
|
+
!I || t.includes(I) || (e.push([h, I]), t.push(I));
|
|
1790
1804
|
};
|
|
1791
1805
|
s("Selected text", window.getSelection()?.toString() ?? "");
|
|
1792
1806
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", r = Array.from(document.querySelectorAll(n)).filter(
|
|
1793
1807
|
(h) => Ee(h) && !h.parentElement?.closest(n)
|
|
1794
1808
|
);
|
|
1795
1809
|
for (const h of r.slice(0, 3))
|
|
1796
|
-
s("Active overlay", bt(
|
|
1797
|
-
const i = on(), o = i ? bt(
|
|
1798
|
-
s("Main page content", o), s("Additional visible page text", bt(
|
|
1799
|
-
const a = e.map(([h,
|
|
1800
|
-
${
|
|
1810
|
+
s("Active overlay", bt(j(h), t));
|
|
1811
|
+
const i = on(), o = i ? bt(j(i), t) : "";
|
|
1812
|
+
s("Main page content", o), s("Additional visible page text", bt(j(document.body), t));
|
|
1813
|
+
const a = e.map(([h, f]) => `${h}:
|
|
1814
|
+
${f}`).join(`
|
|
1801
1815
|
|
|
1802
1816
|
`).trim().slice(0, 12e3), c = an(r, i).trim(), l = `Simplified DOM outline:
|
|
1803
1817
|
`, d = `
|
|
1804
1818
|
|
|
1805
1819
|
Visible page text:
|
|
1806
|
-
`, p = 12e3 - l.length - d.length, y = Math.min(a.length, 7900),
|
|
1807
|
-
return `${l}${
|
|
1820
|
+
`, p = 12e3 - l.length - d.length, y = Math.min(a.length, 7900), m = c.slice(0, p - y), u = a.slice(0, p - m.length);
|
|
1821
|
+
return `${l}${m}${d}${u}`;
|
|
1808
1822
|
}
|
|
1809
|
-
function
|
|
1823
|
+
function j(e) {
|
|
1810
1824
|
return e.innerText ?? e.textContent ?? "";
|
|
1811
1825
|
}
|
|
1812
1826
|
function B(e) {
|
|
@@ -1828,7 +1842,7 @@ function Ee(e) {
|
|
|
1828
1842
|
return t.display !== "none" && t.visibility !== "hidden" && e.getClientRects().length > 0;
|
|
1829
1843
|
}
|
|
1830
1844
|
function on() {
|
|
1831
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ee).sort((e, t) =>
|
|
1845
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(Ee).sort((e, t) => j(t).length - j(e).length)[0] ?? null;
|
|
1832
1846
|
}
|
|
1833
1847
|
function an(e, t) {
|
|
1834
1848
|
const s = /* @__PURE__ */ new Set([
|
|
@@ -1912,20 +1926,20 @@ function an(e, t) {
|
|
|
1912
1926
|
"data-cy"
|
|
1913
1927
|
], l = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: d, priorityTargets: p } = cn(), y = new Set(e);
|
|
1914
1928
|
t && y.add(t);
|
|
1915
|
-
let
|
|
1916
|
-
const u = (
|
|
1917
|
-
const U =
|
|
1929
|
+
let m = 0;
|
|
1930
|
+
const u = (T) => {
|
|
1931
|
+
const U = T.getAttribute("role");
|
|
1918
1932
|
return U && !o.has(U) ? U : "";
|
|
1919
|
-
}, h = (
|
|
1920
|
-
const U =
|
|
1921
|
-
return `${
|
|
1922
|
-
},
|
|
1923
|
-
const R = (
|
|
1924
|
-
const E =
|
|
1925
|
-
if (
|
|
1933
|
+
}, h = (T) => {
|
|
1934
|
+
const U = T.getAttribute("data-testid") || T.getAttribute("data-test") || T.getAttribute("data-qa") || T.getAttribute("data-cy") || "";
|
|
1935
|
+
return `${T.tagName.toLowerCase()}|${u(T)}|${U}`;
|
|
1936
|
+
}, f = (T, U, H) => {
|
|
1937
|
+
const R = (A, ct) => {
|
|
1938
|
+
const E = A.tagName.toLowerCase(), lt = window.getComputedStyle(A), z = d.has(A);
|
|
1939
|
+
if (m >= 1e3 && !z || H.has(A) || i.has(E) || A.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || lt.display === "none" || lt.visibility === "hidden")
|
|
1926
1940
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
1927
|
-
|
|
1928
|
-
const zt = u(
|
|
1941
|
+
m += 1;
|
|
1942
|
+
const zt = u(A), G = Re(A), je = a.has(zt) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(E) || E === "a" && A.hasAttribute("href"), ut = Array.from(A.children).filter((g) => g instanceof HTMLElement), X = /* @__PURE__ */ new Map();
|
|
1929
1943
|
for (const g of ut) {
|
|
1930
1944
|
const w = h(g);
|
|
1931
1945
|
X.set(w, (X.get(w) ?? 0) + 1);
|
|
@@ -1946,18 +1960,18 @@ function an(e, t) {
|
|
|
1946
1960
|
Kt.push(Qt), ht.push(Qt.lines);
|
|
1947
1961
|
}
|
|
1948
1962
|
const pt = [];
|
|
1949
|
-
if (
|
|
1950
|
-
for (const g of Array.from(
|
|
1963
|
+
if (A.shadowRoot)
|
|
1964
|
+
for (const g of Array.from(A.shadowRoot.children))
|
|
1951
1965
|
g instanceof HTMLElement && pt.push(R(g, ct + 1));
|
|
1952
1966
|
const J = [...Kt, ...pt], ft = G.length > 0 || je || J.some((g) => g.hasUsefulContent), Vt = B(
|
|
1953
1967
|
[G, ...J.map((g) => g.textPreview)].filter(Boolean).join(" ")
|
|
1954
|
-
).slice(0, 180), ze =
|
|
1968
|
+
).slice(0, 180), ze = A.hasAttribute("contenteditable") && (G.length > 0 || !A.querySelector("[contenteditable]")), Yt = l.some((g) => A.hasAttribute(g)) || !!zt || ze, gt = (A.getClientRects().length > 0 || lt.display === "contents") && (s.has(E) || Yt || z) && (ft || z) && (!r.has(E) || ft || Yt || z), mt = gt ? 1 : 0, F = [];
|
|
1955
1969
|
if (gt) {
|
|
1956
1970
|
const g = J.some((D) => D.containsTextElement), w = n.has(E) && !g ? Vt : G;
|
|
1957
|
-
|
|
1971
|
+
F.push(ke(A, c, o, w.slice(0, 180)));
|
|
1958
1972
|
}
|
|
1959
1973
|
for (const g of ht)
|
|
1960
|
-
|
|
1974
|
+
F.push(...Z(g, mt));
|
|
1961
1975
|
const yt = pt.flatMap((g) => g.lines);
|
|
1962
1976
|
if (yt.length > 0) {
|
|
1963
1977
|
const g = yt.slice(0, 20);
|
|
@@ -1965,29 +1979,29 @@ function an(e, t) {
|
|
|
1965
1979
|
const w = E.includes("tooltip") || E.includes("popper") || E.includes("loader");
|
|
1966
1980
|
if (ct < 2 && !w) {
|
|
1967
1981
|
const D = gt ? "#shadow-root" : `${E} #shadow-root`;
|
|
1968
|
-
|
|
1982
|
+
F.push(...Z([D, ...Z(g, 1)], mt));
|
|
1969
1983
|
} else
|
|
1970
|
-
|
|
1984
|
+
F.push(...Z(g, mt));
|
|
1971
1985
|
}
|
|
1972
1986
|
return {
|
|
1973
|
-
lines:
|
|
1987
|
+
lines: F,
|
|
1974
1988
|
hasUsefulContent: ft,
|
|
1975
1989
|
textPreview: Vt,
|
|
1976
1990
|
containsTextElement: n.has(E) || J.some((g) => g.containsTextElement)
|
|
1977
1991
|
};
|
|
1978
1992
|
};
|
|
1979
|
-
return [`--- ${U} ---`, ...R(
|
|
1993
|
+
return [`--- ${U} ---`, ...R(T, 0).lines].join(`
|
|
1980
1994
|
`);
|
|
1981
|
-
},
|
|
1982
|
-
x &&
|
|
1983
|
-
${JSON.stringify(x)}`), p.length > 0 &&
|
|
1984
|
-
for (const
|
|
1985
|
-
|
|
1986
|
-
if (t &&
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1989
|
-
}
|
|
1990
|
-
return
|
|
1995
|
+
}, I = [], x = B(window.getSelection()?.toString() ?? "");
|
|
1996
|
+
x && I.push(`--- selected text ---
|
|
1997
|
+
${JSON.stringify(x)}`), p.length > 0 && I.push(ln(p, s, c, o));
|
|
1998
|
+
for (const T of e.slice(0, 3))
|
|
1999
|
+
I.push(f(T, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
2000
|
+
if (t && I.push(f(t, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
2001
|
+
const T = t || e.length ? "other visible DOM" : "visible DOM";
|
|
2002
|
+
I.push(f(document.body, T, y));
|
|
2003
|
+
}
|
|
2004
|
+
return I.join(`
|
|
1991
2005
|
|
|
1992
2006
|
`);
|
|
1993
2007
|
}
|
|
@@ -2250,7 +2264,7 @@ function Me(e, t) {
|
|
|
2250
2264
|
}), o;
|
|
2251
2265
|
}
|
|
2252
2266
|
if (r.type === "function_call_output") {
|
|
2253
|
-
const i =
|
|
2267
|
+
const i = An(r.output);
|
|
2254
2268
|
return i ? {
|
|
2255
2269
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2256
2270
|
role: "tool",
|
|
@@ -2267,7 +2281,7 @@ function Me(e, t) {
|
|
|
2267
2281
|
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
|
|
2268
2282
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2269
2283
|
role: "tool",
|
|
2270
|
-
content: r.type === "mcp_call" ?
|
|
2284
|
+
content: r.type === "mcp_call" ? Sn(r) : En(r),
|
|
2271
2285
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2272
2286
|
respondsToUserMessageId: v(r) ?? void 0,
|
|
2273
2287
|
...M(r) ? { runId: M(r) } : {},
|
|
@@ -2288,11 +2302,11 @@ function Me(e, t) {
|
|
|
2288
2302
|
...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
|
|
2289
2303
|
} : null;
|
|
2290
2304
|
}
|
|
2291
|
-
function
|
|
2305
|
+
function Sn(e) {
|
|
2292
2306
|
const s = (typeof e.server_label == "string" ? e.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
|
|
2293
2307
|
return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
|
|
2294
2308
|
}
|
|
2295
|
-
function
|
|
2309
|
+
function An(e) {
|
|
2296
2310
|
if (typeof e != "string")
|
|
2297
2311
|
return null;
|
|
2298
2312
|
try {
|
|
@@ -2485,7 +2499,7 @@ function de(e) {
|
|
|
2485
2499
|
return !1;
|
|
2486
2500
|
for (let s = e.length - 1; s > t; s -= 1) {
|
|
2487
2501
|
const n = e[s];
|
|
2488
|
-
if (
|
|
2502
|
+
if (q(n))
|
|
2489
2503
|
return !0;
|
|
2490
2504
|
if (n.role === "system") {
|
|
2491
2505
|
if (n.dataType === "run_error")
|
|
@@ -2498,7 +2512,7 @@ function de(e) {
|
|
|
2498
2512
|
}
|
|
2499
2513
|
function Nn(e) {
|
|
2500
2514
|
const t = De(e);
|
|
2501
|
-
return t === null ? e.some(
|
|
2515
|
+
return t === null ? e.some(q) : e.slice(t + 1).some(q);
|
|
2502
2516
|
}
|
|
2503
2517
|
function De(e) {
|
|
2504
2518
|
for (let t = e.length - 1; t >= 0; t -= 1)
|
|
@@ -2507,7 +2521,7 @@ function De(e) {
|
|
|
2507
2521
|
return null;
|
|
2508
2522
|
}
|
|
2509
2523
|
function Ln(e) {
|
|
2510
|
-
return
|
|
2524
|
+
return q(e) ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
|
|
2511
2525
|
}
|
|
2512
2526
|
function it(e) {
|
|
2513
2527
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
@@ -2623,7 +2637,7 @@ function $n(e) {
|
|
|
2623
2637
|
const t = e;
|
|
2624
2638
|
return t.type === "message" && t.role === "assistant" ? !0 : t.type === "run_error" ? t.stage !== "tool_execution" : t.type === "run_status" && (t.status === "stopped" || t.status === "interrupted");
|
|
2625
2639
|
}
|
|
2626
|
-
function
|
|
2640
|
+
function q(e) {
|
|
2627
2641
|
return e.role === "assistant" && e.phase !== "commentary";
|
|
2628
2642
|
}
|
|
2629
2643
|
function Wn(e) {
|
|
@@ -2710,7 +2724,7 @@ function b(e, t) {
|
|
|
2710
2724
|
}
|
|
2711
2725
|
function Vn(e, t) {
|
|
2712
2726
|
try {
|
|
2713
|
-
const s = window.localStorage.getItem(`${
|
|
2727
|
+
const s = window.localStorage.getItem(`${Ae}${e}`);
|
|
2714
2728
|
if (!s)
|
|
2715
2729
|
return null;
|
|
2716
2730
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
@@ -2728,7 +2742,7 @@ function Vn(e, t) {
|
|
|
2728
2742
|
function Yn(e, t) {
|
|
2729
2743
|
try {
|
|
2730
2744
|
window.localStorage.setItem(
|
|
2731
|
-
`${
|
|
2745
|
+
`${Ae}${e}`,
|
|
2732
2746
|
JSON.stringify({
|
|
2733
2747
|
sessionId: t.sessionId,
|
|
2734
2748
|
messages: t.messages.slice(-Ms).map(ar)
|
|
@@ -2749,7 +2763,7 @@ function Zn(e) {
|
|
|
2749
2763
|
return [];
|
|
2750
2764
|
}
|
|
2751
2765
|
}
|
|
2752
|
-
function
|
|
2766
|
+
function W(e, t) {
|
|
2753
2767
|
try {
|
|
2754
2768
|
const s = t.filter($t);
|
|
2755
2769
|
if (s.length === 0) {
|
|
@@ -3100,7 +3114,7 @@ function Tr(e) {
|
|
|
3100
3114
|
function wr(e) {
|
|
3101
3115
|
return e === 401 || e === 403;
|
|
3102
3116
|
}
|
|
3103
|
-
const at = "[REDACTED_SECRET]", P = "[REDACTED_TOKEN]",
|
|
3117
|
+
const at = "[REDACTED_SECRET]", P = "[REDACTED_TOKEN]", Sr = "[REDACTED_SIGNED_URL]", Ar = 20, br = /^(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, Be = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, qe = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, He = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Fe = /\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, Er = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, kr = /\bhttps?:\/\/[^\s"'<>]+/gi, Rr = /[),.;\]]+$/;
|
|
3104
3118
|
function k(e) {
|
|
3105
3119
|
return st(e, 0, /* @__PURE__ */ new WeakSet());
|
|
3106
3120
|
}
|
|
@@ -3109,7 +3123,7 @@ function st(e, t, s) {
|
|
|
3109
3123
|
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : nt(e);
|
|
3110
3124
|
if (e === null || typeof e != "object")
|
|
3111
3125
|
return e;
|
|
3112
|
-
if (t >=
|
|
3126
|
+
if (t >= Ar)
|
|
3113
3127
|
return "[REDACTED_MAX_DEPTH]";
|
|
3114
3128
|
if (s.has(e))
|
|
3115
3129
|
return "[REDACTED_CIRCULAR]";
|
|
@@ -3138,7 +3152,7 @@ function We(e) {
|
|
|
3138
3152
|
}
|
|
3139
3153
|
}
|
|
3140
3154
|
function nt(e) {
|
|
3141
|
-
return e.replace(Er,
|
|
3155
|
+
return e.replace(Er, Sr).replace(kr, Cr).replace(Be, `Bearer ${P}`).replace(qe, `Basic ${P}`).replace(He, P).replace(Fe, (t, s) => `${s}: ${at}`);
|
|
3142
3156
|
}
|
|
3143
3157
|
function Mr(e) {
|
|
3144
3158
|
return e.replace(Be, `Bearer ${P}`).replace(qe, `Basic ${P}`).replace(He, P).replace(Fe, (t, s) => `${s}: ${at}`);
|
package/package.json
CHANGED