@pluno/product-agent-web 0.1.136 → 0.1.141
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 +13 -0
- package/dist/product-agent-sdk.js +604 -527
- package/dist/product-agent-widget.js +2430 -2261
- package/dist/widget.d.ts +9 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Ke = "pluno-product-agent-attachments";
|
|
2
2
|
const _t = "files";
|
|
3
|
-
async function
|
|
3
|
+
async function Je(e) {
|
|
4
4
|
const t = await Lt();
|
|
5
|
-
await
|
|
5
|
+
await Ze(t, "readwrite", (s) => s.put(e));
|
|
6
6
|
}
|
|
7
|
-
async function
|
|
7
|
+
async function Ve(e, t) {
|
|
8
8
|
const s = await Lt();
|
|
9
|
-
await
|
|
10
|
-
const r = await
|
|
9
|
+
await qt(s, "readwrite", async (n) => {
|
|
10
|
+
const r = await Bt(
|
|
11
11
|
n.get(e)
|
|
12
12
|
);
|
|
13
13
|
r && n.put({
|
|
@@ -16,26 +16,26 @@ async function Je(e, t) {
|
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
async function
|
|
19
|
+
async function Ye(e = 864e5) {
|
|
20
20
|
const t = await Lt(), s = Date.now() - e;
|
|
21
|
-
await
|
|
21
|
+
await qt(t, "readwrite", async (n) => {
|
|
22
22
|
const r = n.index("lastUsedAt");
|
|
23
|
-
(await
|
|
23
|
+
(await Bt(r.getAllKeys(IDBKeyRange.upperBound(s)))).forEach((o) => n.delete(o));
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
function Lt() {
|
|
27
27
|
return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((e, t) => {
|
|
28
|
-
const s = indexedDB.open(
|
|
28
|
+
const s = indexedDB.open(Ke, 1);
|
|
29
29
|
s.onupgradeneeded = () => {
|
|
30
30
|
const r = s.result.createObjectStore(_t, { keyPath: "attachmentId" });
|
|
31
31
|
r.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), r.createIndex("sessionId", "sessionId", { unique: !1 }), r.createIndex("origin", "origin", { unique: !1 });
|
|
32
32
|
}, s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Failed to open Product Agent attachment storage"));
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
async function
|
|
36
|
-
return await
|
|
35
|
+
async function Ze(e, t, s) {
|
|
36
|
+
return await qt(e, t, async (n) => await Bt(s(n)));
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function qt(e, t, s) {
|
|
39
39
|
return new Promise((n, r) => {
|
|
40
40
|
const i = e.transaction(_t, t), o = i.objectStore(_t);
|
|
41
41
|
let a, c = !1;
|
|
@@ -57,16 +57,16 @@ function Bt(e, t, s) {
|
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Bt(e) {
|
|
61
61
|
return new Promise((t, s) => {
|
|
62
62
|
e.onsuccess = () => t(e.result), e.onerror = () => s(e.error ?? new Error("Product Agent attachment storage request failed"));
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Qe(e) {
|
|
66
66
|
return e !== null && (typeof e == "object" || typeof e == "function");
|
|
67
67
|
}
|
|
68
68
|
function Ae(e, t, s) {
|
|
69
|
-
const n = Reflect.get(e, "pluno"), r =
|
|
69
|
+
const n = Reflect.get(e, "pluno"), r = Qe(n) ? n : {};
|
|
70
70
|
if (r !== n && !Reflect.set(e, "pluno", r))
|
|
71
71
|
return null;
|
|
72
72
|
const i = Object.getOwnPropertyDescriptor(r, t);
|
|
@@ -80,18 +80,18 @@ function Ae(e, t, s) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
const
|
|
84
|
-
function
|
|
83
|
+
const ts = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
|
|
84
|
+
function es(e, t) {
|
|
85
85
|
return t ? e.replace(
|
|
86
|
-
|
|
86
|
+
ts,
|
|
87
87
|
(s, n, r, i) => `${n}${new URL(r, t).toString()}${i}`
|
|
88
88
|
) : e;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
90
|
+
const St = "pluno.productAgent.transportId", ss = "pluno.productAgent.transportIdentity", At = "pluno.productAgent.transportIdentity.event", ns = 50, rs = globalThis.setTimeout.bind(globalThis);
|
|
91
91
|
let W = null;
|
|
92
|
-
const
|
|
93
|
-
async function
|
|
94
|
-
const t = e.randomUUID(), s = e.storage.getItem(
|
|
92
|
+
const et = /* @__PURE__ */ new Set(), Et = /* @__PURE__ */ new Map();
|
|
93
|
+
async function is(e = Ee()) {
|
|
94
|
+
const t = e.randomUUID(), s = e.storage.getItem(St);
|
|
95
95
|
let n = s ?? e.randomUUID(), r = !1, i = !1;
|
|
96
96
|
const o = e.channel.subscribe((c) => {
|
|
97
97
|
if (!(c.senderId === t || c.transportId !== n)) {
|
|
@@ -109,14 +109,14 @@ async function rs(e = Se()) {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
if (!s)
|
|
112
|
-
e.storage.setItem(
|
|
112
|
+
e.storage.setItem(St, n), r = !0;
|
|
113
113
|
else
|
|
114
114
|
for (; ; ) {
|
|
115
115
|
if (i = !1, e.channel.postMessage({ type: "probe", transportId: n, senderId: t }), await e.settle(), !i) {
|
|
116
116
|
r = !0;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
|
-
n = e.randomUUID(), e.storage.setItem(
|
|
119
|
+
n = e.randomUUID(), e.storage.setItem(St, n);
|
|
120
120
|
}
|
|
121
121
|
let a = !1;
|
|
122
122
|
return {
|
|
@@ -126,49 +126,49 @@ async function rs(e = Se()) {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
async function
|
|
130
|
-
W || (W =
|
|
129
|
+
async function os() {
|
|
130
|
+
W || (W = is(Ee()), W.then((n) => {
|
|
131
131
|
const r = (i) => {
|
|
132
|
-
i.persisted || (n.release(), W = null,
|
|
132
|
+
i.persisted || (n.release(), W = null, et.clear(), window.removeEventListener("pagehide", r));
|
|
133
133
|
};
|
|
134
134
|
window.addEventListener("pagehide", r);
|
|
135
135
|
}));
|
|
136
|
-
const e = await W, t =
|
|
137
|
-
|
|
136
|
+
const e = await W, t = as();
|
|
137
|
+
et.add(t);
|
|
138
138
|
let s = !1;
|
|
139
139
|
return {
|
|
140
140
|
// A stable per-tab base keeps reload routing intact, while slots isolate multiple live SDK instances in one tab.
|
|
141
141
|
transportId: t === 0 ? e.transportId : `${e.transportId}.${t}`,
|
|
142
142
|
release: () => {
|
|
143
|
-
s || (s = !0,
|
|
143
|
+
s || (s = !0, et.delete(t));
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function as() {
|
|
148
148
|
let e = 0;
|
|
149
|
-
for (;
|
|
149
|
+
for (; et.has(e); )
|
|
150
150
|
e += 1;
|
|
151
151
|
return e;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Ee() {
|
|
154
154
|
return {
|
|
155
|
-
storage:
|
|
156
|
-
channel:
|
|
155
|
+
storage: cs(),
|
|
156
|
+
channel: ls(),
|
|
157
157
|
randomUUID: () => crypto.randomUUID(),
|
|
158
|
-
settle: () => new Promise((e) =>
|
|
158
|
+
settle: () => new Promise((e) => rs(e, ns))
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function cs() {
|
|
162
162
|
return {
|
|
163
163
|
getItem: (e) => {
|
|
164
164
|
try {
|
|
165
|
-
return window.sessionStorage?.getItem(e) ??
|
|
165
|
+
return window.sessionStorage?.getItem(e) ?? Et.get(e) ?? null;
|
|
166
166
|
} catch {
|
|
167
|
-
return
|
|
167
|
+
return Et.get(e) ?? null;
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
setItem: (e, t) => {
|
|
171
|
-
|
|
171
|
+
Et.set(e, t);
|
|
172
172
|
try {
|
|
173
173
|
window.sessionStorage?.setItem(e, t);
|
|
174
174
|
} catch {
|
|
@@ -176,9 +176,9 @@ function as() {
|
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function ls() {
|
|
180
180
|
if (typeof BroadcastChannel < "u") {
|
|
181
|
-
const e = new BroadcastChannel(
|
|
181
|
+
const e = new BroadcastChannel(ss);
|
|
182
182
|
return {
|
|
183
183
|
postMessage: (t) => e.postMessage(t),
|
|
184
184
|
subscribe: (t) => {
|
|
@@ -188,9 +188,9 @@ function cs() {
|
|
|
188
188
|
close: () => e.close()
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
return
|
|
191
|
+
return us();
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function us() {
|
|
194
194
|
const e = /* @__PURE__ */ new Set(), t = (s) => {
|
|
195
195
|
if (s.key !== At || !s.newValue)
|
|
196
196
|
return;
|
|
@@ -211,18 +211,18 @@ function ls() {
|
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
function
|
|
214
|
+
const ds = globalThis.fetch.bind(globalThis), Ct = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', hs = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', ps = ".pluno-pa-widget__panel", fs = ".pluno-pa-widget__timeline", se = `${Ct}[data-pluno-sdk-preview-channel]`, gs = "https://app.pluno.ai", ms = "gpt-5.6-terra", ys = 2e4, Is = 1e4, Ts = 1e4, ws = 1e4, Ss = 1e4, As = 1e3, ne = 3e4, re = 0.2, ie = 6e4, Es = 15e3, V = 8, Rs = 15e3, bs = 2e3, Ms = 1e3, ks = 100, oe = 8e3, ae = 3, _s = [300, 1e3], Ht = 64e3, Rt = 4e3, Ft = 30, Cs = 2e3, Ps = 1e3, Re = "Image is too large for model vision input.", Us = 100, be = "pluno.productAgent.state.", Pt = "pluno.productAgent.pendingEvents.", ot = "pluno.productAgent.activeToolCalls.", Ds = 100;
|
|
215
|
+
function Y(e, t = 0) {
|
|
216
216
|
const s = e === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (e - 1));
|
|
217
217
|
return Math.max(t, s);
|
|
218
218
|
}
|
|
219
|
-
const
|
|
220
|
-
let
|
|
221
|
-
function
|
|
219
|
+
const st = /* @__PURE__ */ new Set();
|
|
220
|
+
let Z = null;
|
|
221
|
+
function xs(e, t = Math.random) {
|
|
222
222
|
const s = Math.min(ne, As * 2 ** e), n = 1 - re + t() * re * 2;
|
|
223
223
|
return Math.min(ne, Math.round(s * n));
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function Ns(e, t, s) {
|
|
226
226
|
return new Promise((n, r) => {
|
|
227
227
|
const i = setTimeout(() => r(new Error(s)), t);
|
|
228
228
|
e.then(
|
|
@@ -235,13 +235,13 @@ function xs(e, t, s) {
|
|
|
235
235
|
);
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
|
-
class
|
|
238
|
+
class Me {
|
|
239
239
|
constructor(t, s) {
|
|
240
240
|
this.options = t, this.transportIdentity = s, this.state = {
|
|
241
241
|
...this.state,
|
|
242
242
|
starterPrompts: gn(t.initialStarterPrompts)
|
|
243
243
|
};
|
|
244
|
-
const n = t.restorePersistedState === !1 ? null :
|
|
244
|
+
const n = t.restorePersistedState === !1 ? null : nr(t.clientId, t.expectedPersistedSessionId);
|
|
245
245
|
n && (this.state = {
|
|
246
246
|
...this.state,
|
|
247
247
|
...n,
|
|
@@ -254,10 +254,10 @@ class ke {
|
|
|
254
254
|
assistantDraftRunId: null,
|
|
255
255
|
isThinking: !1,
|
|
256
256
|
lastError: null
|
|
257
|
-
}), this.queuedClientEvents =
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
),
|
|
257
|
+
}), this.queuedClientEvents = ur(
|
|
258
|
+
ir(t.clientId),
|
|
259
|
+
ar(t.clientId)
|
|
260
|
+
), j(t.clientId, this.queuedClientEvents);
|
|
261
261
|
}
|
|
262
262
|
options;
|
|
263
263
|
listeners = {};
|
|
@@ -277,6 +277,8 @@ class ke {
|
|
|
277
277
|
queuedClientEvents = [];
|
|
278
278
|
pendingWarmupEvent = null;
|
|
279
279
|
pendingSessionHistoryRequests = /* @__PURE__ */ new Map();
|
|
280
|
+
pendingSessionPinRequests = /* @__PURE__ */ new Map();
|
|
281
|
+
pendingSessionRenameRequests = /* @__PURE__ */ new Map();
|
|
280
282
|
transportIdentity;
|
|
281
283
|
retryAttemptsByClientMessageId = {};
|
|
282
284
|
retryTimersByClientMessageId = {};
|
|
@@ -300,6 +302,7 @@ class ke {
|
|
|
300
302
|
activeBrowserToolCalls = /* @__PURE__ */ new Map();
|
|
301
303
|
pendingToolLoadingByCallId = /* @__PURE__ */ new Map();
|
|
302
304
|
terminalToolCallIds = /* @__PURE__ */ new Set();
|
|
305
|
+
nonTranscriptToolCallIds = /* @__PURE__ */ new Set();
|
|
303
306
|
pageLifecycleCleanup = null;
|
|
304
307
|
transientStarterPromptsRequestInFlight = !1;
|
|
305
308
|
transientStarterPromptsRequestAttempted = !1;
|
|
@@ -325,16 +328,16 @@ class ke {
|
|
|
325
328
|
lastErrorSecuritySettingsUrl: null
|
|
326
329
|
};
|
|
327
330
|
static async init(t) {
|
|
328
|
-
const s = await
|
|
331
|
+
const s = await os(), n = new Me({
|
|
329
332
|
...t,
|
|
330
|
-
backendUrl: Qs(t.backendUrl ??
|
|
333
|
+
backendUrl: Qs(t.backendUrl ?? gs),
|
|
331
334
|
clientId: t.clientId ?? wn(),
|
|
332
|
-
model: t.model ??
|
|
335
|
+
model: t.model ?? ms,
|
|
333
336
|
entrySurface: tn(t.entrySurface)
|
|
334
337
|
}, s);
|
|
335
338
|
try {
|
|
336
|
-
|
|
337
|
-
|
|
339
|
+
Ye().catch((r) => {
|
|
340
|
+
S("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
|
|
338
341
|
message: r instanceof Error ? r.message : String(r)
|
|
339
342
|
});
|
|
340
343
|
}), t.disableNetworkCapture || n.enableNetworkCapture(), n.startPageLifecycleRecovery(), n.startStarterPromptUrlWatcher(), t.autoConnect !== !1 && await n.connect();
|
|
@@ -360,20 +363,19 @@ class ke {
|
|
|
360
363
|
return;
|
|
361
364
|
this.connectionInProgress = !0;
|
|
362
365
|
const t = ++this.connectionAttemptId;
|
|
363
|
-
this.setState(
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
});
|
|
366
|
+
this.setState(
|
|
367
|
+
this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
|
|
368
|
+
);
|
|
367
369
|
try {
|
|
368
|
-
if (this.token = this.options.token ?? (this.options.tokenProvider ? await
|
|
370
|
+
if (this.token = this.options.token ?? (this.options.tokenProvider ? await Ns(this.options.tokenProvider(), Ts, "Pluno token provider timed out") : null), t !== this.connectionAttemptId || this.state.status === "closed")
|
|
369
371
|
return;
|
|
370
372
|
if (!this.token && !this.options.webSocketFactory)
|
|
371
373
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
372
374
|
const s = nn(this.options.backendUrl), n = this.options.webSocketFactory?.(s) ?? new WebSocket(s);
|
|
373
375
|
this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
|
|
374
|
-
this.socket === n && n.readyState === WebSocket.CONNECTING && (
|
|
375
|
-
},
|
|
376
|
-
this.socket !== n || (this.clearSocketConnectTimer(),
|
|
376
|
+
this.socket === n && n.readyState === WebSocket.CONNECTING && (S("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
377
|
+
}, ws), n.addEventListener("open", () => {
|
|
378
|
+
this.socket !== n || (this.clearSocketConnectTimer(), S("web-sdk.agent", "Pluno socket opened", {
|
|
377
379
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
378
380
|
isThinking: this.state.isThinking
|
|
379
381
|
}), !(this.token ? this.sendNow({
|
|
@@ -383,23 +385,23 @@ class ke {
|
|
|
383
385
|
transportId: this.transportIdentity.transportId,
|
|
384
386
|
pageUrl: location.href
|
|
385
387
|
}) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
|
|
386
|
-
this.socket === n && (
|
|
387
|
-
},
|
|
388
|
+
this.socket === n && (S("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.replaceTimedOutSocket(n));
|
|
389
|
+
}, Ss));
|
|
388
390
|
}), n.addEventListener("message", (r) => {
|
|
389
391
|
this.socket === n && this.handleServerEvent(fn(r.data));
|
|
390
392
|
}), n.addEventListener("close", (r) => {
|
|
391
|
-
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (
|
|
393
|
+
this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (S("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
|
|
392
394
|
code: typeof r?.code == "number" ? r.code : null,
|
|
393
395
|
reason: typeof r?.reason == "string" ? r.reason : "",
|
|
394
396
|
wasClean: typeof r?.wasClean == "boolean" ? r.wasClean : null,
|
|
395
397
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
396
398
|
isThinking: this.state.isThinking
|
|
397
|
-
}), this.
|
|
399
|
+
}), this.setReconnectingState(), this.scheduleReconnect()));
|
|
398
400
|
}), n.addEventListener("error", () => {
|
|
399
|
-
this.socket !== n || this.state.status === "closed" || (
|
|
401
|
+
this.socket !== n || this.state.status === "closed" || (S("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
|
|
400
402
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
401
403
|
isThinking: this.state.isThinking
|
|
402
|
-
}), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.
|
|
404
|
+
}), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
|
|
403
405
|
});
|
|
404
406
|
} catch (s) {
|
|
405
407
|
if (t === this.connectionAttemptId && this.state.status !== "closed") {
|
|
@@ -416,10 +418,10 @@ class ke {
|
|
|
416
418
|
}
|
|
417
419
|
}
|
|
418
420
|
disconnect() {
|
|
419
|
-
this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWarmupEvent = null, this.socket?.close(), this.socket = null;
|
|
421
|
+
this.connectionAttemptId += 1, this.setState({ status: "closed", isThinking: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.queuedClientEvents = [], this.pendingWarmupEvent = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
|
|
420
422
|
}
|
|
421
423
|
destroy() {
|
|
422
|
-
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(),
|
|
424
|
+
this.disconnect(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionUserFilesApi(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), dr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [];
|
|
423
425
|
for (const t of Object.values(this.listeners))
|
|
424
426
|
t?.clear();
|
|
425
427
|
}
|
|
@@ -428,7 +430,7 @@ class ke {
|
|
|
428
430
|
type: "runtime.warmup",
|
|
429
431
|
reason: t,
|
|
430
432
|
entrySurface: this.options.entrySurface,
|
|
431
|
-
page:
|
|
433
|
+
page: b()
|
|
432
434
|
};
|
|
433
435
|
this.sendNow(s) || (this.pendingWarmupEvent = s);
|
|
434
436
|
}
|
|
@@ -437,7 +439,7 @@ class ke {
|
|
|
437
439
|
let i = r.map(zt);
|
|
438
440
|
if (!n && i.length === 0)
|
|
439
441
|
return null;
|
|
440
|
-
const o =
|
|
442
|
+
const o = b(), a = s.clientMessageId ?? $(), c = {
|
|
441
443
|
id: `local-${a}`,
|
|
442
444
|
role: "user",
|
|
443
445
|
content: n,
|
|
@@ -466,14 +468,14 @@ class ke {
|
|
|
466
468
|
try {
|
|
467
469
|
const h = [];
|
|
468
470
|
for (const y of i) {
|
|
469
|
-
const
|
|
471
|
+
const k = y.id ? this.attachmentFiles.get(y.id) : void 0;
|
|
470
472
|
if (y.sandboxPath) {
|
|
471
473
|
h.push(y);
|
|
472
474
|
continue;
|
|
473
475
|
}
|
|
474
|
-
if (!
|
|
476
|
+
if (!k)
|
|
475
477
|
throw new Error(`Attachment bytes are unavailable for ${y.name}`);
|
|
476
|
-
h.push(await this.uploadAttachmentForMessage({ file:
|
|
478
|
+
h.push(await this.uploadAttachmentForMessage({ file: k, attachment: y }));
|
|
477
479
|
}
|
|
478
480
|
i = h;
|
|
479
481
|
} catch (h) {
|
|
@@ -495,7 +497,7 @@ class ke {
|
|
|
495
497
|
attachments: i.length > 0 ? i : void 0,
|
|
496
498
|
page: o,
|
|
497
499
|
model: this.options.model,
|
|
498
|
-
metadata:
|
|
500
|
+
metadata: ce(this.options.metadata)
|
|
499
501
|
};
|
|
500
502
|
return s.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.activeClientMessageId = a, this.activeUserMessageEvent = f, this.markThinkingProgress(), this.send(f), a;
|
|
501
503
|
}
|
|
@@ -504,26 +506,26 @@ class ke {
|
|
|
504
506
|
return !t || !s ? !1 : (this.retryAttemptsByClientMessageId[s] = 0, this.retryableClientMessageId = null, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: t, clientMessageId: s, automatic: !1 }), !0);
|
|
505
507
|
}
|
|
506
508
|
createLocalAttachment(t) {
|
|
507
|
-
const s =
|
|
509
|
+
const s = $(), n = {
|
|
508
510
|
id: s,
|
|
509
511
|
name: t.name || "attachment",
|
|
510
|
-
mimeType:
|
|
512
|
+
mimeType: Te(t),
|
|
511
513
|
sizeBytes: t.size
|
|
512
514
|
};
|
|
513
515
|
this.attachmentFiles.set(s, t), this.attachmentBlobCache.set(s, t);
|
|
514
516
|
const r = Date.now();
|
|
515
|
-
return
|
|
517
|
+
return Je({
|
|
516
518
|
attachmentId: s,
|
|
517
519
|
name: n.name,
|
|
518
520
|
mimeType: n.mimeType,
|
|
519
521
|
sizeBytes: n.sizeBytes,
|
|
520
522
|
blob: t,
|
|
521
|
-
origin:
|
|
523
|
+
origin: b().origin,
|
|
522
524
|
sessionId: this.state.sessionId ?? void 0,
|
|
523
525
|
createdAt: r,
|
|
524
526
|
lastUsedAt: r
|
|
525
527
|
}).catch((i) => {
|
|
526
|
-
|
|
528
|
+
S("web-sdk.attachments", "Failed to store Product Agent attachment", {
|
|
527
529
|
attachmentId: s,
|
|
528
530
|
name: n.name,
|
|
529
531
|
message: i instanceof Error ? i.message : String(i)
|
|
@@ -541,7 +543,7 @@ class ke {
|
|
|
541
543
|
file: t,
|
|
542
544
|
attachment: s
|
|
543
545
|
}) {
|
|
544
|
-
const n = this.state.sessionId, r =
|
|
546
|
+
const n = this.state.sessionId, r = Te(t), i = {
|
|
545
547
|
sessionId: n ?? void 0,
|
|
546
548
|
attachmentId: s.id,
|
|
547
549
|
clientId: this.options.clientId,
|
|
@@ -549,42 +551,42 @@ class ke {
|
|
|
549
551
|
name: t.name || "attachment",
|
|
550
552
|
mimeType: r,
|
|
551
553
|
sizeBytes: t.size,
|
|
552
|
-
page:
|
|
554
|
+
page: b(),
|
|
553
555
|
model: this.options.model,
|
|
554
|
-
metadata:
|
|
556
|
+
metadata: ce(this.options.metadata),
|
|
555
557
|
entrySurface: this.options.entrySurface
|
|
556
558
|
};
|
|
557
559
|
let o;
|
|
558
560
|
if (this.options.persistAttachmentUpload)
|
|
559
|
-
o = await
|
|
561
|
+
o = await tt(
|
|
560
562
|
() => this.options.persistAttachmentUpload(i, t),
|
|
561
563
|
"Failed to upload attachment"
|
|
562
564
|
);
|
|
563
565
|
else {
|
|
564
|
-
const c = this.options.prepareAttachmentUpload ? await
|
|
566
|
+
const c = this.options.prepareAttachmentUpload ? await tt(
|
|
565
567
|
() => this.options.prepareAttachmentUpload(i),
|
|
566
568
|
"Failed to prepare attachment upload"
|
|
567
569
|
) : await this.prepareEmbedAttachmentUpload(i);
|
|
568
|
-
await
|
|
570
|
+
await tt(async () => {
|
|
569
571
|
const l = await fetch(new URL(c.uploadUrl, this.options.backendUrl), {
|
|
570
572
|
method: c.uploadMethod,
|
|
571
573
|
headers: c.uploadHeaders,
|
|
572
574
|
body: t
|
|
573
575
|
});
|
|
574
576
|
if (!l.ok)
|
|
575
|
-
throw new
|
|
577
|
+
throw new nt("Failed to upload attachment", l.status);
|
|
576
578
|
return l;
|
|
577
579
|
}, "Failed to upload attachment"), o = c;
|
|
578
580
|
}
|
|
579
581
|
this.setState({ sessionId: o.sessionId });
|
|
580
|
-
const a =
|
|
581
|
-
return this.updateAttachmentInState(s.id, a), s.id &&
|
|
582
|
+
const a = Le(o.attachment, this.options.backendUrl);
|
|
583
|
+
return this.updateAttachmentInState(s.id, a), s.id && Ve(s.id, {
|
|
582
584
|
sessionId: o.sessionId,
|
|
583
585
|
fileUrl: a.fileUrl,
|
|
584
586
|
sandboxPath: a.sandboxPath,
|
|
585
587
|
lastUsedAt: Date.now()
|
|
586
588
|
}).catch((c) => {
|
|
587
|
-
|
|
589
|
+
S("web-sdk.attachments", "Failed to update persisted Product Agent attachment", {
|
|
588
590
|
attachmentId: s.id,
|
|
589
591
|
name: a.name,
|
|
590
592
|
message: c instanceof Error ? c.message : String(c)
|
|
@@ -604,18 +606,18 @@ class ke {
|
|
|
604
606
|
}
|
|
605
607
|
async prepareEmbedAttachmentUpload(t) {
|
|
606
608
|
let s = !1;
|
|
607
|
-
return await
|
|
609
|
+
return await tt(async () => {
|
|
608
610
|
const n = await this.fetchEmbedAttachmentUpload(t);
|
|
609
611
|
if (n.ok)
|
|
610
612
|
return await n.json();
|
|
611
|
-
if (
|
|
613
|
+
if (kr(n.status) && this.options.tokenProvider && !s) {
|
|
612
614
|
s = !0;
|
|
613
615
|
const r = await this.fetchEmbedAttachmentUpload(t);
|
|
614
616
|
if (r.ok)
|
|
615
617
|
return await r.json();
|
|
616
|
-
throw new
|
|
618
|
+
throw new nt("Failed to prepare attachment upload", r.status);
|
|
617
619
|
}
|
|
618
|
-
throw new
|
|
620
|
+
throw new nt("Failed to prepare attachment upload", n.status);
|
|
619
621
|
}, "Failed to prepare attachment upload");
|
|
620
622
|
}
|
|
621
623
|
async fetchEmbedAttachmentUpload(t) {
|
|
@@ -634,10 +636,10 @@ class ke {
|
|
|
634
636
|
}
|
|
635
637
|
startNewSession(t = {}) {
|
|
636
638
|
const s = t.notifyTransport !== !1;
|
|
637
|
-
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && this.state.isThinking && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.cleanupSessionUserFilesApi(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, s && this.send({
|
|
639
|
+
!this.options.keepRunsActiveOnSessionNavigation && s && this.state.sessionId && this.state.isThinking && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.cleanupSessionUserFilesApi(), this.queuedClientEvents = this.queuedClientEvents.filter((n) => n.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.retryableClientMessageId = null, this.lastUserMessagePageUrl = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), s && this.send({
|
|
638
640
|
type: "session.reset",
|
|
639
641
|
sessionId: this.state.sessionId ?? void 0,
|
|
640
|
-
page:
|
|
642
|
+
page: b()
|
|
641
643
|
}), this.setState({
|
|
642
644
|
sessionId: null,
|
|
643
645
|
starterPrompts: [...this.state.starterPrompts],
|
|
@@ -652,17 +654,18 @@ class ke {
|
|
|
652
654
|
});
|
|
653
655
|
}
|
|
654
656
|
listSessions(t = {}) {
|
|
655
|
-
const s =
|
|
657
|
+
const s = $(), n = new Promise((i, o) => {
|
|
656
658
|
const a = window.setTimeout(() => {
|
|
657
659
|
this.pendingSessionHistoryRequests.delete(s), o(new Error("Session history did not respond in time"));
|
|
658
|
-
},
|
|
660
|
+
}, oe);
|
|
659
661
|
this.pendingSessionHistoryRequests.set(s, { resolve: i, reject: o, timeout: a });
|
|
660
662
|
}), r = {
|
|
661
663
|
type: "sessions.list",
|
|
662
664
|
requestId: s,
|
|
663
|
-
page:
|
|
665
|
+
page: b(),
|
|
664
666
|
...t.cursor ? { cursor: t.cursor } : {},
|
|
665
|
-
...t.limit ? { limit: t.limit } : {}
|
|
667
|
+
...t.limit ? { limit: t.limit } : {},
|
|
668
|
+
...typeof t.pinned == "boolean" ? { pinned: t.pinned } : {}
|
|
666
669
|
};
|
|
667
670
|
if (!this.sendNow(r)) {
|
|
668
671
|
const i = this.pendingSessionHistoryRequests.get(s);
|
|
@@ -670,6 +673,20 @@ class ke {
|
|
|
670
673
|
}
|
|
671
674
|
return n;
|
|
672
675
|
}
|
|
676
|
+
setSessionPinned(t, s) {
|
|
677
|
+
return this.sendSessionMutation(
|
|
678
|
+
this.pendingSessionPinRequests,
|
|
679
|
+
{ type: "session.pin", requestId: $(), sessionId: t, pinned: s },
|
|
680
|
+
"Session pin did not respond in time"
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
renameSession(t, s) {
|
|
684
|
+
return this.sendSessionMutation(
|
|
685
|
+
this.pendingSessionRenameRequests,
|
|
686
|
+
{ type: "session.rename", requestId: $(), sessionId: t, title: s },
|
|
687
|
+
"Session rename did not respond in time"
|
|
688
|
+
);
|
|
689
|
+
}
|
|
673
690
|
loadSession(t) {
|
|
674
691
|
!this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && this.state.isThinking && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.clearThinkingWatchdog(), this.lastUserMessagePageUrl = null, this.setState({
|
|
675
692
|
sessionId: t,
|
|
@@ -684,11 +701,11 @@ class ke {
|
|
|
684
701
|
}), this.send({
|
|
685
702
|
type: "session.load",
|
|
686
703
|
sessionId: t,
|
|
687
|
-
page:
|
|
704
|
+
page: b()
|
|
688
705
|
});
|
|
689
706
|
}
|
|
690
707
|
send(t) {
|
|
691
|
-
this.sendNow(
|
|
708
|
+
this.sendNow(M(t)) || (this.queuedClientEvents.push(t), j(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
|
|
692
709
|
}
|
|
693
710
|
async getUploadToken() {
|
|
694
711
|
const t = this.options.token ?? await this.options.tokenProvider?.() ?? this.token ?? null;
|
|
@@ -703,11 +720,11 @@ class ke {
|
|
|
703
720
|
try {
|
|
704
721
|
return s.send(JSON.stringify(t)), !0;
|
|
705
722
|
} catch (n) {
|
|
706
|
-
return
|
|
723
|
+
return S("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
|
|
707
724
|
message: n instanceof Error ? n.message : String(n),
|
|
708
725
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
709
726
|
isThinking: this.state.isThinking
|
|
710
|
-
}), this.socket === s && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.
|
|
727
|
+
}), 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;
|
|
711
728
|
}
|
|
712
729
|
}
|
|
713
730
|
requestTransientStarterPrompts() {
|
|
@@ -716,7 +733,7 @@ class ke {
|
|
|
716
733
|
this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
|
|
717
734
|
const t = rn();
|
|
718
735
|
this.sendNow(
|
|
719
|
-
|
|
736
|
+
M({
|
|
720
737
|
type: "starter_prompts.page_context",
|
|
721
738
|
pageUrl: t.pageUrl,
|
|
722
739
|
pageTitle: t.pageTitle,
|
|
@@ -746,14 +763,14 @@ class ke {
|
|
|
746
763
|
if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
|
|
747
764
|
return;
|
|
748
765
|
const t = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
|
|
749
|
-
|
|
766
|
+
j(this.options.clientId, this.queuedClientEvents);
|
|
750
767
|
for (let s = 0; s < t.length; s += 1) {
|
|
751
768
|
const n = t[s];
|
|
752
|
-
if (!this.sendNow(
|
|
753
|
-
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)),
|
|
769
|
+
if (!this.sendNow(M(n))) {
|
|
770
|
+
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), j(this.options.clientId, this.queuedClientEvents);
|
|
754
771
|
return;
|
|
755
772
|
}
|
|
756
|
-
|
|
773
|
+
j(this.options.clientId, this.queuedClientEvents);
|
|
757
774
|
}
|
|
758
775
|
}
|
|
759
776
|
flushPendingWarmupEvent() {
|
|
@@ -775,26 +792,27 @@ class ke {
|
|
|
775
792
|
if (Ls(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
776
793
|
this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.flushQueuedClientEvents(), this.flushPendingWarmupEvent(), this.startHeartbeat();
|
|
777
794
|
const s = mn(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
778
|
-
|
|
795
|
+
S("web-sdk.agent", "Received auth.ok appearance", {
|
|
779
796
|
hasAppearance: n,
|
|
780
797
|
rawAppearance: t.appearance,
|
|
781
798
|
normalizedAppearance: s
|
|
782
799
|
}), this.runtimeHelperJavascript = yn(t.runtimeHelpers)?.javascript ?? null;
|
|
783
|
-
const r =
|
|
784
|
-
user:
|
|
785
|
-
status: "connected"
|
|
800
|
+
const r = de(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), o = t.starterPromptsLoading === !0, a = {
|
|
801
|
+
user: Sn(t.user),
|
|
802
|
+
status: "connected",
|
|
803
|
+
...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
|
|
786
804
|
};
|
|
787
805
|
(i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r, a.starterPromptsLoading = r.length > 0 ? !1 : o), i && r.length > 0 && (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0), (n || s) && (a.appearance = s), this.setState(a), i && r.length === 0 && !o && !cn() && this.requestTransientStarterPrompts(), this.state.sessionId && this.send({
|
|
788
806
|
type: "page.upsert",
|
|
789
807
|
sessionId: this.state.sessionId,
|
|
790
|
-
page:
|
|
808
|
+
page: b(),
|
|
791
809
|
model: this.options.model
|
|
792
810
|
});
|
|
793
811
|
return;
|
|
794
812
|
}
|
|
795
813
|
if (t.type === "starterPrompts.updated") {
|
|
796
814
|
this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
|
|
797
|
-
starterPrompts:
|
|
815
|
+
starterPrompts: de(t, "starterPrompts"),
|
|
798
816
|
starterPromptsLoading: !1
|
|
799
817
|
});
|
|
800
818
|
return;
|
|
@@ -804,33 +822,33 @@ class ke {
|
|
|
804
822
|
t.assistantDraft
|
|
805
823
|
), r = n !== void 0;
|
|
806
824
|
this.rememberUserMessageClientMessageIds(s);
|
|
807
|
-
const i =
|
|
825
|
+
const i = zn(s);
|
|
808
826
|
if (i) {
|
|
809
|
-
const h =
|
|
827
|
+
const h = Gn(s, i);
|
|
810
828
|
this.retryAttemptsByClientMessageId[i] = Math.max(
|
|
811
829
|
this.retryAttemptsByClientMessageId[i] ?? 0,
|
|
812
830
|
h
|
|
813
831
|
);
|
|
814
832
|
}
|
|
815
833
|
const o = s.filter((h) => {
|
|
816
|
-
const y =
|
|
817
|
-
return !
|
|
834
|
+
const y = q(h);
|
|
835
|
+
return !fe(y) && (!i || !Nt(y));
|
|
818
836
|
}), a = Ln(
|
|
819
837
|
this.state.messages,
|
|
820
|
-
|
|
821
|
-
), c =
|
|
822
|
-
(h) =>
|
|
823
|
-
|
|
838
|
+
An(o, this.options.backendUrl)
|
|
839
|
+
), c = pe(a), l = !r && s.some(
|
|
840
|
+
(h) => me(
|
|
841
|
+
q(h),
|
|
824
842
|
this.state.assistantDraft,
|
|
825
843
|
this.state.assistantDraftItemId,
|
|
826
844
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
827
845
|
this.state.assistantDraftRunId
|
|
828
846
|
)
|
|
829
|
-
), u = r ? n?.content ?? "" : this.state.assistantDraft, p = !!n?.content, I = c && (!u || l), m =
|
|
830
|
-
if (!c &&
|
|
847
|
+
), u = r ? n?.content ?? "" : this.state.assistantDraft, p = !!n?.content, I = c && (!u || l), m = Wn(a), d = I && m;
|
|
848
|
+
if (!c && jn(this.state.messages, s))
|
|
831
849
|
return;
|
|
832
|
-
this.lastUserMessagePageUrl =
|
|
833
|
-
const f = I ? null :
|
|
850
|
+
this.lastUserMessagePageUrl = $n(s);
|
|
851
|
+
const f = I ? null : Ot(s);
|
|
834
852
|
if (this.latestRecoverableClientMessageId = f, m && this.clearRetryTimers(), this.setState({
|
|
835
853
|
sessionId: E(t.session, "id") ?? this.state.sessionId,
|
|
836
854
|
messages: a,
|
|
@@ -876,16 +894,24 @@ class ke {
|
|
|
876
894
|
}));
|
|
877
895
|
return;
|
|
878
896
|
}
|
|
897
|
+
if (t.type === "session.pin.updated") {
|
|
898
|
+
this.resolvePendingSessionMutation(this.pendingSessionPinRequests, t);
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
if (t.type === "session.rename.updated") {
|
|
902
|
+
this.resolvePendingSessionMutation(this.pendingSessionRenameRequests, t);
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
879
905
|
if (t.type === "session.updated") {
|
|
880
906
|
this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: E(t.session, "id") ?? this.state.sessionId });
|
|
881
907
|
return;
|
|
882
908
|
}
|
|
883
909
|
if (t.type === "session.item") {
|
|
884
910
|
this.rememberUserMessageClientMessageIds([t.item]);
|
|
885
|
-
const s =
|
|
886
|
-
if (
|
|
911
|
+
const s = q(t.item);
|
|
912
|
+
if (Nt(s)) {
|
|
887
913
|
typeof s?.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(s.runId);
|
|
888
|
-
const r = E(t.item, "sessionId") ?? this.state.sessionId, i = s ?
|
|
914
|
+
const r = E(t.item, "sessionId") ?? this.state.sessionId, i = s ? O(s) : null, o = i ? this.clientMessageIdsByUserMessageItemId.get(i) : null, a = typeof s?.clientMessageId == "string" ? s.clientMessageId : o ?? (i ? null : this.activeClientMessageId ?? this.latestRecoverableClientMessageId);
|
|
889
915
|
if (r && a) {
|
|
890
916
|
this.retryAfterInterruptedRun(r, a);
|
|
891
917
|
return;
|
|
@@ -895,21 +921,21 @@ class ke {
|
|
|
895
921
|
return;
|
|
896
922
|
}
|
|
897
923
|
}
|
|
898
|
-
if (
|
|
924
|
+
if (fe(s))
|
|
899
925
|
return;
|
|
900
926
|
const n = Ue(t.item, this.options.backendUrl);
|
|
901
927
|
if (n) {
|
|
902
928
|
const r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
|
|
903
|
-
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)),
|
|
929
|
+
n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), N(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
904
930
|
const i = t.item.data;
|
|
905
|
-
|
|
906
|
-
const o =
|
|
931
|
+
Kn(i) && this.clearRunAckResyncRetryTimer();
|
|
932
|
+
const o = Ut(this.state.messages, n), a = pe(o), c = me(
|
|
907
933
|
i,
|
|
908
934
|
this.state.assistantDraft,
|
|
909
935
|
this.state.assistantDraftItemId,
|
|
910
936
|
this.state.assistantDraftRespondsToUserMessageId,
|
|
911
937
|
this.state.assistantDraftRunId
|
|
912
|
-
), l = a && (!this.state.assistantDraft || c), u = l &&
|
|
938
|
+
), l = a && (!this.state.assistantDraft || c), u = l && N(n);
|
|
913
939
|
this.setState({
|
|
914
940
|
messages: o,
|
|
915
941
|
...c ? {
|
|
@@ -936,7 +962,7 @@ class ke {
|
|
|
936
962
|
this.clearRunAckResyncRetryTimer();
|
|
937
963
|
const s = typeof t.delta == "string" ? t.delta : "", n = typeof t.itemId == "string" ? t.itemId : null, r = n !== null && this.state.assistantDraftItemId !== n, i = `${r ? "" : this.state.assistantDraft}${s}`, o = n ?? this.state.assistantDraftItemId ?? "assistant-draft", a = this.state.messages.find((p) => p.id === o), c = t.phase === "commentary" || t.phase === "final_answer" ? t.phase : r ? null : this.state.assistantDraftPhase, l = typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : this.state.assistantDraftRespondsToUserMessageId, u = typeof t.runId == "string" ? t.runId : this.state.assistantDraftRunId;
|
|
938
964
|
this.setState({
|
|
939
|
-
messages:
|
|
965
|
+
messages: Ut(this.state.messages, {
|
|
940
966
|
id: o,
|
|
941
967
|
role: "assistant",
|
|
942
968
|
content: i,
|
|
@@ -983,21 +1009,26 @@ class ke {
|
|
|
983
1009
|
}
|
|
984
1010
|
if (t.type === "tool.call") {
|
|
985
1011
|
this.clearRunAckResyncRetryTimer();
|
|
986
|
-
const s =
|
|
987
|
-
if (s)
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
)
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
)
|
|
1000
|
-
|
|
1012
|
+
const s = t.hiddenFromTranscript === !0 && typeof t.callId == "string" ? t.callId : null;
|
|
1013
|
+
if (s)
|
|
1014
|
+
this.nonTranscriptToolCallIds.add(s);
|
|
1015
|
+
else {
|
|
1016
|
+
const n = On(t);
|
|
1017
|
+
if (n) {
|
|
1018
|
+
const r = xn(
|
|
1019
|
+
this.state.messages,
|
|
1020
|
+
n
|
|
1021
|
+
);
|
|
1022
|
+
this.setState({
|
|
1023
|
+
messages: r,
|
|
1024
|
+
isThinking: !0
|
|
1025
|
+
}), this.emit(
|
|
1026
|
+
"message",
|
|
1027
|
+
r.find(
|
|
1028
|
+
(i) => i.callId === n.callId
|
|
1029
|
+
) ?? n
|
|
1030
|
+
);
|
|
1031
|
+
}
|
|
1001
1032
|
}
|
|
1002
1033
|
this.executeToolCall(t);
|
|
1003
1034
|
return;
|
|
@@ -1007,7 +1038,7 @@ class ke {
|
|
|
1007
1038
|
if (!s)
|
|
1008
1039
|
return;
|
|
1009
1040
|
const n = t.status === "queued" || t.status === "running";
|
|
1010
|
-
if (n && this.terminalToolCallIds.has(s))
|
|
1041
|
+
if (this.nonTranscriptToolCallIds.has(s) || n && this.terminalToolCallIds.has(s))
|
|
1011
1042
|
return;
|
|
1012
1043
|
n || this.terminalToolCallIds.add(s), this.state.messages.some(
|
|
1013
1044
|
(i) => i.callId === s
|
|
@@ -1020,6 +1051,8 @@ class ke {
|
|
|
1020
1051
|
window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(s), n.reject(new Error(typeof t.message == "string" ? t.message : "Pluno error"));
|
|
1021
1052
|
return;
|
|
1022
1053
|
}
|
|
1054
|
+
if (this.rejectPendingSessionMutation(this.pendingSessionPinRequests, t) || this.rejectPendingSessionMutation(this.pendingSessionRenameRequests, t))
|
|
1055
|
+
return;
|
|
1023
1056
|
const r = typeof t.sessionId == "string" ? t.sessionId : this.state.sessionId, i = typeof t.clientMessageId == "string" ? t.clientMessageId : null, o = t.retryable === !0 || t.code === "transient_model_error";
|
|
1024
1057
|
if (this.retryAfterRetryableError(t)) {
|
|
1025
1058
|
t.code !== "run_still_active" && typeof t.runId == "string" && this.retryableFailureRunIdsAwaitingDone.add(t.runId);
|
|
@@ -1052,10 +1085,10 @@ class ke {
|
|
|
1052
1085
|
if (this.retryTimersByClientMessageId[n] !== void 0)
|
|
1053
1086
|
return !0;
|
|
1054
1087
|
const i = this.retryAttemptsByClientMessageId[n] ?? 0;
|
|
1055
|
-
if (i >=
|
|
1088
|
+
if (i >= V)
|
|
1056
1089
|
return !1;
|
|
1057
1090
|
this.retryAttemptsByClientMessageId[n] = i + 1;
|
|
1058
|
-
const o =
|
|
1091
|
+
const o = Y(
|
|
1059
1092
|
i,
|
|
1060
1093
|
typeof t.retryAfterMs == "number" ? t.retryAfterMs : 0
|
|
1061
1094
|
);
|
|
@@ -1072,7 +1105,7 @@ class ke {
|
|
|
1072
1105
|
if (this.retryTimersByClientMessageId[s] !== void 0)
|
|
1073
1106
|
return;
|
|
1074
1107
|
const n = this.retryAttemptsByClientMessageId[s] ?? 0;
|
|
1075
|
-
if (n >=
|
|
1108
|
+
if (n >= V) {
|
|
1076
1109
|
this.retryableClientMessageId = s, this.setState({
|
|
1077
1110
|
isThinking: !1,
|
|
1078
1111
|
lastError: "Pluno could not finish this message. Try it again.",
|
|
@@ -1082,7 +1115,7 @@ class ke {
|
|
|
1082
1115
|
}
|
|
1083
1116
|
this.retryAttemptsByClientMessageId[s] = n + 1, this.activeClientMessageId = s, this.latestRecoverableClientMessageId = s, this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.retryTimersByClientMessageId[s] = window.setTimeout(() => {
|
|
1084
1117
|
delete this.retryTimersByClientMessageId[s], this.setState({ status: "connected", isThinking: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: t, clientMessageId: s, automatic: !0 });
|
|
1085
|
-
},
|
|
1118
|
+
}, Y(n));
|
|
1086
1119
|
}
|
|
1087
1120
|
clearRetryTimers() {
|
|
1088
1121
|
for (const t of Object.values(this.retryTimersByClientMessageId))
|
|
@@ -1091,7 +1124,7 @@ class ke {
|
|
|
1091
1124
|
}
|
|
1092
1125
|
rememberUserMessageClientMessageIds(t) {
|
|
1093
1126
|
for (const s of t) {
|
|
1094
|
-
const n = E(s, "id"), r =
|
|
1127
|
+
const n = E(s, "id"), r = q(s);
|
|
1095
1128
|
n && r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" && this.clientMessageIdsByUserMessageItemId.set(n, r.clientMessageId);
|
|
1096
1129
|
}
|
|
1097
1130
|
}
|
|
@@ -1100,6 +1133,32 @@ class ke {
|
|
|
1100
1133
|
window.clearTimeout(s.timeout), s.reject(new Error(t));
|
|
1101
1134
|
this.pendingSessionHistoryRequests.clear();
|
|
1102
1135
|
}
|
|
1136
|
+
sendSessionMutation(t, s, n) {
|
|
1137
|
+
const r = new Promise((i, o) => {
|
|
1138
|
+
const a = window.setTimeout(() => {
|
|
1139
|
+
t.delete(s.requestId), o(new Error(n));
|
|
1140
|
+
}, oe);
|
|
1141
|
+
t.set(s.requestId, { resolve: i, reject: o, timeout: a });
|
|
1142
|
+
});
|
|
1143
|
+
if (!this.sendNow(s)) {
|
|
1144
|
+
const i = t.get(s.requestId);
|
|
1145
|
+
return i && (window.clearTimeout(i.timeout), t.delete(s.requestId)), this.setState({ status: "reconnecting" }), this.scheduleReconnect(), Promise.reject(new Error("Pluno is reconnecting. Please try again."));
|
|
1146
|
+
}
|
|
1147
|
+
return r;
|
|
1148
|
+
}
|
|
1149
|
+
resolvePendingSessionMutation(t, s) {
|
|
1150
|
+
const n = typeof s.requestId == "string" ? s.requestId : null, r = n ? t.get(n) : null;
|
|
1151
|
+
!n || !r || (window.clearTimeout(r.timeout), t.delete(n), r.resolve());
|
|
1152
|
+
}
|
|
1153
|
+
rejectPendingSessionMutation(t, s) {
|
|
1154
|
+
const n = typeof s.requestId == "string" ? s.requestId : null, r = n ? t.get(n) : null;
|
|
1155
|
+
return !n || !r ? !1 : (window.clearTimeout(r.timeout), t.delete(n), r.reject(new Error(typeof s.message == "string" ? s.message : "Pluno error")), !0);
|
|
1156
|
+
}
|
|
1157
|
+
rejectPendingSessionMutationRequests(t, s) {
|
|
1158
|
+
for (const n of t.values())
|
|
1159
|
+
window.clearTimeout(n.timeout), n.reject(new Error(s));
|
|
1160
|
+
t.clear();
|
|
1161
|
+
}
|
|
1103
1162
|
markThinkingProgress() {
|
|
1104
1163
|
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(ie), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
1105
1164
|
}
|
|
@@ -1121,7 +1180,7 @@ class ke {
|
|
|
1121
1180
|
handleRunSteered(t) {
|
|
1122
1181
|
const s = typeof t.respondsToUserMessageId == "string" ? t.respondsToUserMessageId : null;
|
|
1123
1182
|
!this.state.isThinking || !s || this.setState({
|
|
1124
|
-
messages:
|
|
1183
|
+
messages: Vn(
|
|
1125
1184
|
this.state.messages,
|
|
1126
1185
|
s
|
|
1127
1186
|
)
|
|
@@ -1130,10 +1189,10 @@ class ke {
|
|
|
1130
1189
|
scheduleRunAckWatchdog(t) {
|
|
1131
1190
|
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
1132
1191
|
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
|
|
1133
|
-
},
|
|
1192
|
+
}, Rs);
|
|
1134
1193
|
}
|
|
1135
1194
|
recoverMissedRunAck(t) {
|
|
1136
|
-
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (
|
|
1195
|
+
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (S("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
1137
1196
|
sessionId: this.state.sessionId,
|
|
1138
1197
|
clientMessageId: t
|
|
1139
1198
|
}), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(t));
|
|
@@ -1141,12 +1200,12 @@ class ke {
|
|
|
1141
1200
|
scheduleRunAckResyncRetry(t) {
|
|
1142
1201
|
this.clearRunAckResyncRetryTimer();
|
|
1143
1202
|
const s = this.retryAttemptsByClientMessageId[t] ?? 0;
|
|
1144
|
-
s >=
|
|
1203
|
+
s >= V || (this.runAckResyncRetryTimer = window.setTimeout(() => {
|
|
1145
1204
|
this.runAckResyncRetryTimer = null, (this.retryAttemptsByClientMessageId[t] ?? 0) === s && (!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || this.latestRecoverableClientMessageId !== t || (this.retryAttemptsByClientMessageId[t] = s + 1, this.setState({
|
|
1146
1205
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
1147
1206
|
isThinking: !0,
|
|
1148
1207
|
lastError: null
|
|
1149
|
-
}),
|
|
1208
|
+
}), S("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
|
|
1150
1209
|
sessionId: this.state.sessionId,
|
|
1151
1210
|
clientMessageId: t
|
|
1152
1211
|
}), this.state.sessionId ? this.send({
|
|
@@ -1155,7 +1214,7 @@ class ke {
|
|
|
1155
1214
|
clientMessageId: t,
|
|
1156
1215
|
automatic: !0
|
|
1157
1216
|
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(ie)));
|
|
1158
|
-
},
|
|
1217
|
+
}, Y(s, bs)));
|
|
1159
1218
|
}
|
|
1160
1219
|
clearRunAckResyncRetryTimer() {
|
|
1161
1220
|
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
@@ -1168,7 +1227,7 @@ class ke {
|
|
|
1168
1227
|
return;
|
|
1169
1228
|
const t = this.activeClientMessageId;
|
|
1170
1229
|
if (!t) {
|
|
1171
|
-
|
|
1230
|
+
S("web-sdk.agent", "Pluno thinking watchdog stopped without a recoverable message id", {
|
|
1172
1231
|
sessionId: this.state.sessionId
|
|
1173
1232
|
}), this.setState({
|
|
1174
1233
|
isThinking: !1,
|
|
@@ -1178,8 +1237,8 @@ class ke {
|
|
|
1178
1237
|
return;
|
|
1179
1238
|
}
|
|
1180
1239
|
const s = this.thinkingWatchdogResyncAttemptsByClientMessageId[t] ?? 0, n = this.retryAttemptsByClientMessageId[t] ?? 0;
|
|
1181
|
-
if (n >=
|
|
1182
|
-
|
|
1240
|
+
if (n >= V) {
|
|
1241
|
+
S("web-sdk.agent", "Pluno run recovery retry exhausted", {
|
|
1183
1242
|
sessionId: this.state.sessionId,
|
|
1184
1243
|
clientMessageId: t
|
|
1185
1244
|
}), this.retryableClientMessageId = t, this.setState({
|
|
@@ -1190,18 +1249,18 @@ class ke {
|
|
|
1190
1249
|
return;
|
|
1191
1250
|
}
|
|
1192
1251
|
if (s < 1) {
|
|
1193
|
-
this.thinkingWatchdogResyncAttemptsByClientMessageId[t] = s + 1,
|
|
1252
|
+
this.thinkingWatchdogResyncAttemptsByClientMessageId[t] = s + 1, S("web-sdk.agent", "Pluno thinking watchdog resyncing session", {
|
|
1194
1253
|
sessionId: this.state.sessionId,
|
|
1195
1254
|
clientMessageId: t,
|
|
1196
1255
|
resyncAttempts: s + 1
|
|
1197
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
1256
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Es);
|
|
1198
1257
|
return;
|
|
1199
1258
|
}
|
|
1200
1259
|
this.setState({
|
|
1201
1260
|
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
1202
1261
|
isThinking: !0,
|
|
1203
1262
|
lastError: null
|
|
1204
|
-
}),
|
|
1263
|
+
}), S("web-sdk.agent", "Pluno thinking watchdog scheduling retry for last user message", {
|
|
1205
1264
|
sessionId: this.state.sessionId,
|
|
1206
1265
|
clientMessageId: t,
|
|
1207
1266
|
retryAttempts: n + 1
|
|
@@ -1212,15 +1271,15 @@ class ke {
|
|
|
1212
1271
|
clientMessageId: t,
|
|
1213
1272
|
automatic: !0
|
|
1214
1273
|
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.markThinkingProgress();
|
|
1215
|
-
},
|
|
1274
|
+
}, Y(n)));
|
|
1216
1275
|
}
|
|
1217
1276
|
resyncThinkingSession() {
|
|
1218
1277
|
this.state.sessionId ? this.send({
|
|
1219
1278
|
type: "page.upsert",
|
|
1220
1279
|
sessionId: this.state.sessionId,
|
|
1221
|
-
page:
|
|
1280
|
+
page: b(),
|
|
1222
1281
|
model: this.options.model
|
|
1223
|
-
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.
|
|
1282
|
+
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setReconnectingState(), this.scheduleReconnect());
|
|
1224
1283
|
}
|
|
1225
1284
|
async executeToolCall(t) {
|
|
1226
1285
|
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 = L(
|
|
@@ -1228,16 +1287,16 @@ class ke {
|
|
|
1228
1287
|
), o = t.rawInput;
|
|
1229
1288
|
if (!s || !n || !r)
|
|
1230
1289
|
return;
|
|
1231
|
-
const a = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
1232
|
-
if (
|
|
1290
|
+
const a = r === "execute_code", c = r === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
|
|
1291
|
+
if (!a && !c || !gr(o)) {
|
|
1233
1292
|
this.setToolMessageLoading(n, !1), this.send({
|
|
1234
1293
|
type: "tool.result",
|
|
1235
1294
|
sessionId: s,
|
|
1236
1295
|
callId: n,
|
|
1237
1296
|
toolName: r,
|
|
1238
1297
|
summary: i,
|
|
1239
|
-
rawInput:
|
|
1240
|
-
rawOutput:
|
|
1298
|
+
rawInput: M(o),
|
|
1299
|
+
rawOutput: M({
|
|
1241
1300
|
ok: !1,
|
|
1242
1301
|
toolName: r,
|
|
1243
1302
|
error: `Unsupported browser tool: ${r}`
|
|
@@ -1252,7 +1311,7 @@ class ke {
|
|
|
1252
1311
|
callId: n,
|
|
1253
1312
|
toolName: r,
|
|
1254
1313
|
summary: i,
|
|
1255
|
-
rawInput:
|
|
1314
|
+
rawInput: M(o),
|
|
1256
1315
|
rawOutput: {
|
|
1257
1316
|
ok: !1,
|
|
1258
1317
|
toolName: r,
|
|
@@ -1261,7 +1320,7 @@ class ke {
|
|
|
1261
1320
|
});
|
|
1262
1321
|
return;
|
|
1263
1322
|
}
|
|
1264
|
-
const
|
|
1323
|
+
const l = Hs(this.state.messages);
|
|
1265
1324
|
this.activeBrowserToolCalls.set(n, {
|
|
1266
1325
|
event: {
|
|
1267
1326
|
type: "tool.result",
|
|
@@ -1269,21 +1328,21 @@ class ke {
|
|
|
1269
1328
|
callId: n,
|
|
1270
1329
|
toolName: r,
|
|
1271
1330
|
summary: i,
|
|
1272
|
-
rawInput:
|
|
1331
|
+
rawInput: M(o),
|
|
1273
1332
|
rawOutput: null
|
|
1274
1333
|
},
|
|
1275
1334
|
startedAtMs: Date.now(),
|
|
1276
1335
|
startedAtUrl: location.href,
|
|
1277
1336
|
startedAtOrigin: location.origin
|
|
1278
|
-
}), this.installSessionUserFilesApi(
|
|
1279
|
-
let
|
|
1280
|
-
|
|
1337
|
+
}), this.installSessionUserFilesApi(l);
|
|
1338
|
+
let u = null, p;
|
|
1339
|
+
u = await this.executeRuntimeHelper(), p = await le(
|
|
1281
1340
|
o,
|
|
1282
1341
|
Ys(t.runtimeContext, this.options.backendUrl)
|
|
1283
|
-
).catch((
|
|
1342
|
+
).catch((I) => ({
|
|
1284
1343
|
ok: !1,
|
|
1285
1344
|
exception: {
|
|
1286
|
-
message:
|
|
1345
|
+
message: I instanceof Error ? I.message : String(I)
|
|
1287
1346
|
}
|
|
1288
1347
|
})), this.activeBrowserToolCalls.delete(n), this.setToolMessageLoading(n, !1), this.send({
|
|
1289
1348
|
type: "tool.result",
|
|
@@ -1291,12 +1350,12 @@ class ke {
|
|
|
1291
1350
|
callId: n,
|
|
1292
1351
|
toolName: r,
|
|
1293
1352
|
summary: o.summary,
|
|
1294
|
-
rawInput:
|
|
1295
|
-
rawOutput:
|
|
1296
|
-
}),
|
|
1353
|
+
rawInput: M(o),
|
|
1354
|
+
rawOutput: M(In(p, u))
|
|
1355
|
+
}), or(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1297
1356
|
}
|
|
1298
1357
|
setToolMessageLoading(t, s) {
|
|
1299
|
-
const n =
|
|
1358
|
+
const n = Nn(
|
|
1300
1359
|
this.state.messages,
|
|
1301
1360
|
t,
|
|
1302
1361
|
s
|
|
@@ -1307,7 +1366,7 @@ class ke {
|
|
|
1307
1366
|
if (this.pageLifecycleCleanup)
|
|
1308
1367
|
return;
|
|
1309
1368
|
const t = () => {
|
|
1310
|
-
|
|
1369
|
+
Oe(this.options.clientId, this.activeBrowserToolCalls.values());
|
|
1311
1370
|
};
|
|
1312
1371
|
window.addEventListener("pagehide", t), window.addEventListener("beforeunload", t), this.pageLifecycleCleanup = () => {
|
|
1313
1372
|
window.removeEventListener("pagehide", t), window.removeEventListener("beforeunload", t);
|
|
@@ -1322,39 +1381,39 @@ class ke {
|
|
|
1322
1381
|
async executeRuntimeHelper() {
|
|
1323
1382
|
if (!this.runtimeHelperJavascript?.trim())
|
|
1324
1383
|
return null;
|
|
1325
|
-
const t = await
|
|
1384
|
+
const t = await le({
|
|
1326
1385
|
javascript: this.runtimeHelperJavascript
|
|
1327
1386
|
});
|
|
1328
1387
|
return t.ok === !1 ? Tn(t) : null;
|
|
1329
1388
|
}
|
|
1330
1389
|
enableNetworkCapture() {
|
|
1331
|
-
this.networkCaptureCleanup || (this.networkCaptureCleanup =
|
|
1332
|
-
|
|
1390
|
+
this.networkCaptureCleanup || (this.networkCaptureCleanup = Os((t) => {
|
|
1391
|
+
Sr(t.url, this.options.backendUrl) || this.enqueueNetworkEvent(t);
|
|
1333
1392
|
}));
|
|
1334
1393
|
}
|
|
1335
1394
|
enqueueNetworkEvent(t) {
|
|
1336
|
-
this.queuedNetworkEvents.length >=
|
|
1395
|
+
this.queuedNetworkEvents.length >= ks || (this.queuedNetworkEvents.push(wr(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
1337
1396
|
this.networkBatchTimer = null;
|
|
1338
1397
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
1339
1398
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
1340
1399
|
type: "network.batch",
|
|
1341
1400
|
sessionId: this.state.sessionId ?? void 0,
|
|
1342
|
-
page:
|
|
1401
|
+
page: b(),
|
|
1343
1402
|
events: s
|
|
1344
1403
|
});
|
|
1345
|
-
},
|
|
1404
|
+
}, Ms)));
|
|
1346
1405
|
}
|
|
1347
1406
|
scheduleReconnect() {
|
|
1348
1407
|
if (this.reconnectTimer !== null || this.state.status === "closed")
|
|
1349
1408
|
return;
|
|
1350
|
-
const t =
|
|
1409
|
+
const t = xs(this.reconnectAttempts);
|
|
1351
1410
|
this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
|
|
1352
1411
|
this.reconnectTimer = null, this.connect().catch((s) => {
|
|
1353
|
-
|
|
1412
|
+
S("web-sdk.agent", "Pluno reconnect failed; retrying", {
|
|
1354
1413
|
message: s instanceof Error ? s.message : String(s),
|
|
1355
1414
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
1356
1415
|
isThinking: this.state.isThinking
|
|
1357
|
-
}), this.
|
|
1416
|
+
}), this.setReconnectingState(), this.scheduleReconnect();
|
|
1358
1417
|
});
|
|
1359
1418
|
}, t);
|
|
1360
1419
|
}
|
|
@@ -1362,9 +1421,9 @@ class ke {
|
|
|
1362
1421
|
this.stopHeartbeat(), this.heartbeatTimer = window.setInterval(() => {
|
|
1363
1422
|
const t = this.socket;
|
|
1364
1423
|
!t || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
|
|
1365
|
-
this.socket === t && (
|
|
1366
|
-
},
|
|
1367
|
-
},
|
|
1424
|
+
this.socket === t && (S("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(t));
|
|
1425
|
+
}, Is));
|
|
1426
|
+
}, ys);
|
|
1368
1427
|
}
|
|
1369
1428
|
stopHeartbeat() {
|
|
1370
1429
|
this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
|
|
@@ -1382,7 +1441,7 @@ class ke {
|
|
|
1382
1441
|
this.clearSocketConnectTimer(), this.clearSocketAuthTimer();
|
|
1383
1442
|
}
|
|
1384
1443
|
replaceTimedOutSocket(t) {
|
|
1385
|
-
this.socket !== t || this.state.status === "closed" || (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.
|
|
1444
|
+
this.socket !== t || this.state.status === "closed" || (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), t.readyState !== WebSocket.CLOSED && t.readyState !== WebSocket.CLOSING && t.close());
|
|
1386
1445
|
}
|
|
1387
1446
|
setState(t) {
|
|
1388
1447
|
this.state = {
|
|
@@ -1390,20 +1449,24 @@ class ke {
|
|
|
1390
1449
|
...t,
|
|
1391
1450
|
...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
|
|
1392
1451
|
...t.lastError !== void 0 && t.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
|
|
1393
|
-
},
|
|
1452
|
+
}, rr(this.options.clientId, this.state), this.emit("state", this.getState());
|
|
1453
|
+
}
|
|
1454
|
+
setReconnectingState() {
|
|
1455
|
+
const t = this.state.lastError !== null && !this.state.isThinking && this.state.lastErrorCode !== "connection_failed";
|
|
1456
|
+
this.setState(t ? { status: "reconnecting" } : { status: "reconnecting", lastError: null });
|
|
1394
1457
|
}
|
|
1395
1458
|
emit(t, s) {
|
|
1396
1459
|
this.listeners[t]?.forEach((r) => r(s));
|
|
1397
1460
|
}
|
|
1398
1461
|
}
|
|
1399
1462
|
const bt = /* @__PURE__ */ new WeakMap();
|
|
1400
|
-
function
|
|
1401
|
-
const t = window.__plunoProductAgentNetworkCapture ??
|
|
1463
|
+
function Os(e) {
|
|
1464
|
+
const t = window.__plunoProductAgentNetworkCapture ?? vs();
|
|
1402
1465
|
return t.subscribers.add(e), () => {
|
|
1403
1466
|
t.subscribers.delete(e), !(t.subscribers.size > 0) && (t.destroy(), window.__plunoProductAgentNetworkCapture === t && delete window.__plunoProductAgentNetworkCapture);
|
|
1404
1467
|
};
|
|
1405
1468
|
}
|
|
1406
|
-
function
|
|
1469
|
+
function vs() {
|
|
1407
1470
|
const e = /* @__PURE__ */ new Set(), t = (I) => {
|
|
1408
1471
|
e.forEach((m) => {
|
|
1409
1472
|
try {
|
|
@@ -1420,20 +1483,20 @@ function Os() {
|
|
|
1420
1483
|
throw y;
|
|
1421
1484
|
}
|
|
1422
1485
|
try {
|
|
1423
|
-
const y = m instanceof Request ? m : null,
|
|
1424
|
-
if (!
|
|
1486
|
+
const y = m instanceof Request ? m : null, k = mr(m, y), T = qe(d?.headers ?? y?.headers);
|
|
1487
|
+
if (!v(k, T, d?.body)) {
|
|
1425
1488
|
const H = {
|
|
1426
|
-
requestId:
|
|
1427
|
-
url:
|
|
1489
|
+
requestId: kt("fetch"),
|
|
1490
|
+
url: P(k, Rt),
|
|
1428
1491
|
method: (d?.method ?? y?.method ?? "GET").toUpperCase(),
|
|
1429
1492
|
requestHeaders: T,
|
|
1430
|
-
requestBody:
|
|
1493
|
+
requestBody: we(d?.body),
|
|
1431
1494
|
resourceType: "fetch",
|
|
1432
1495
|
startedAt: new Date(f).toISOString()
|
|
1433
1496
|
};
|
|
1434
1497
|
h.then(
|
|
1435
1498
|
(_) => {
|
|
1436
|
-
|
|
1499
|
+
yr(_, H, f, t).catch(() => {
|
|
1437
1500
|
t({
|
|
1438
1501
|
...H,
|
|
1439
1502
|
responseStatus: _.status,
|
|
@@ -1444,7 +1507,7 @@ function Os() {
|
|
|
1444
1507
|
(_) => {
|
|
1445
1508
|
t({
|
|
1446
1509
|
...H,
|
|
1447
|
-
errorText:
|
|
1510
|
+
errorText: P(_ instanceof Error ? _.message : String(_)),
|
|
1448
1511
|
durationMs: Date.now() - f
|
|
1449
1512
|
});
|
|
1450
1513
|
}
|
|
@@ -1454,28 +1517,28 @@ function Os() {
|
|
|
1454
1517
|
}
|
|
1455
1518
|
return h;
|
|
1456
1519
|
}, a = function(m, d, f, h, y) {
|
|
1457
|
-
const
|
|
1520
|
+
const k = n.call(this, m, d, f ?? !0, h ?? void 0, y ?? void 0), T = typeof d == "string" ? d : d.toString();
|
|
1458
1521
|
return bt.set(this, {
|
|
1459
|
-
requestId:
|
|
1522
|
+
requestId: kt("xhr"),
|
|
1460
1523
|
method: String(m ?? "GET").toUpperCase(),
|
|
1461
|
-
url:
|
|
1524
|
+
url: P(T, Rt),
|
|
1462
1525
|
requestHeaders: {},
|
|
1463
1526
|
startedAtMs: Date.now(),
|
|
1464
1527
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1465
|
-
excluded:
|
|
1466
|
-
}),
|
|
1528
|
+
excluded: v(T)
|
|
1529
|
+
}), k;
|
|
1467
1530
|
}, c = function(m, d) {
|
|
1468
1531
|
const f = r.call(this, m, d), h = bt.get(this);
|
|
1469
|
-
return h && Object.keys(h.requestHeaders).length < Ft && (h.requestHeaders[m] = Gt(m, d), h.excluded = h.excluded ||
|
|
1532
|
+
return h && Object.keys(h.requestHeaders).length < Ft && (h.requestHeaders[m] = Gt(m, d), h.excluded = h.excluded || v(h.url, h.requestHeaders)), f;
|
|
1470
1533
|
}, l = function(m) {
|
|
1471
1534
|
try {
|
|
1472
1535
|
const d = bt.get(this);
|
|
1473
|
-
d && (d.excluded = d.excluded ||
|
|
1536
|
+
d && (d.excluded = d.excluded || v(d.url, d.requestHeaders, m), d.requestBody = we(m), d.excluded || this.addEventListener(
|
|
1474
1537
|
"loadend",
|
|
1475
1538
|
() => {
|
|
1476
1539
|
queueMicrotask(() => {
|
|
1477
1540
|
try {
|
|
1478
|
-
const f =
|
|
1541
|
+
const f = Er(this.getAllResponseHeaders());
|
|
1479
1542
|
t({
|
|
1480
1543
|
requestId: d.requestId,
|
|
1481
1544
|
url: d.url,
|
|
@@ -1485,7 +1548,7 @@ function Os() {
|
|
|
1485
1548
|
resourceType: "xhr",
|
|
1486
1549
|
responseStatus: this.status,
|
|
1487
1550
|
responseHeaders: f,
|
|
1488
|
-
responseBody:
|
|
1551
|
+
responseBody: Tr(this, f),
|
|
1489
1552
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
1490
1553
|
startedAt: d.startedAt,
|
|
1491
1554
|
durationMs: Date.now() - d.startedAtMs
|
|
@@ -1522,12 +1585,12 @@ function Os() {
|
|
|
1522
1585
|
u = new PerformanceObserver((I) => {
|
|
1523
1586
|
for (const m of I.getEntries()) {
|
|
1524
1587
|
const d = m;
|
|
1525
|
-
if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" ||
|
|
1588
|
+
if (d.initiatorType === "fetch" || d.initiatorType === "xmlhttprequest" || v(d.name))
|
|
1526
1589
|
continue;
|
|
1527
1590
|
const f = performance.timeOrigin + d.startTime;
|
|
1528
1591
|
t({
|
|
1529
|
-
requestId:
|
|
1530
|
-
url:
|
|
1592
|
+
requestId: kt("resource"),
|
|
1593
|
+
url: P(d.name, Rt),
|
|
1531
1594
|
method: "GET",
|
|
1532
1595
|
resourceType: "resource",
|
|
1533
1596
|
responseStatus: d.responseStatus,
|
|
@@ -1566,7 +1629,7 @@ function Os() {
|
|
|
1566
1629
|
};
|
|
1567
1630
|
return window.__plunoProductAgentNetworkCapture = p, p;
|
|
1568
1631
|
}
|
|
1569
|
-
function
|
|
1632
|
+
function S(e, t, s) {
|
|
1570
1633
|
if (typeof window > "u")
|
|
1571
1634
|
return;
|
|
1572
1635
|
const n = window, r = {
|
|
@@ -1577,14 +1640,14 @@ function A(e, t, s) {
|
|
|
1577
1640
|
}, i = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
1578
1641
|
i.push(r), i.length > 120 && i.splice(0, i.length - 120), n.__plunoProductAgentDiagnostics__ = i, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...i], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: r }));
|
|
1579
1642
|
}
|
|
1580
|
-
function
|
|
1643
|
+
function ce(e) {
|
|
1581
1644
|
const t = typeof e == "function" ? e() : e;
|
|
1582
1645
|
return t && Object.keys(t).length > 0 ? t : void 0;
|
|
1583
1646
|
}
|
|
1584
1647
|
function Ls(e) {
|
|
1585
1648
|
return e.type === "conversation.state" || e.type === "session.updated" || e.type === "session.item" || e.type === "chat.assistant_delta" || e.type === "chat.assistant_done" || e.type === "tool.call";
|
|
1586
1649
|
}
|
|
1587
|
-
const
|
|
1650
|
+
const qs = 5e3, Bs = 12e4;
|
|
1588
1651
|
function Hs(e) {
|
|
1589
1652
|
const t = [];
|
|
1590
1653
|
for (const s of e)
|
|
@@ -1619,7 +1682,7 @@ async function js(e, t = {}) {
|
|
|
1619
1682
|
return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
|
|
1620
1683
|
type: "pluno.pageImages.inspectImage",
|
|
1621
1684
|
imageAttached: !1,
|
|
1622
|
-
imageAttachmentError:
|
|
1685
|
+
imageAttachmentError: Re
|
|
1623
1686
|
} : {
|
|
1624
1687
|
type: "pluno.pageImages.inspectImage",
|
|
1625
1688
|
imageAttached: !0,
|
|
@@ -1634,7 +1697,7 @@ async function js(e, t = {}) {
|
|
|
1634
1697
|
};
|
|
1635
1698
|
}
|
|
1636
1699
|
async function zs(e) {
|
|
1637
|
-
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:
|
|
1700
|
+
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: Re } : {
|
|
1638
1701
|
ok: !0,
|
|
1639
1702
|
mimeType: e.type,
|
|
1640
1703
|
sizeBytes: e.size,
|
|
@@ -1687,9 +1750,9 @@ function Vs(e) {
|
|
|
1687
1750
|
}, n.onerror = () => s(n.error ?? new Error("Failed to read Pluno user file")), n.readAsDataURL(e);
|
|
1688
1751
|
});
|
|
1689
1752
|
}
|
|
1690
|
-
async function
|
|
1753
|
+
async function le(e, t) {
|
|
1691
1754
|
const s = Object.getPrototypeOf(async function() {
|
|
1692
|
-
}).constructor, n = e.timeoutMs ??
|
|
1755
|
+
}).constructor, n = e.timeoutMs ?? qs, r = Date.now(), i = [];
|
|
1693
1756
|
let o;
|
|
1694
1757
|
const a = {
|
|
1695
1758
|
log: console.log,
|
|
@@ -1746,7 +1809,7 @@ function Ys(e, t) {
|
|
|
1746
1809
|
const r = () => {
|
|
1747
1810
|
if (!n)
|
|
1748
1811
|
throw new Error("sandboxFiles is only available during browser-code execution");
|
|
1749
|
-
}, i = async (a, c) => await
|
|
1812
|
+
}, i = async (a, c) => await ds(`${t.replace(/\/$/, "")}${a}`, c);
|
|
1750
1813
|
return {
|
|
1751
1814
|
value: Object.freeze({
|
|
1752
1815
|
upload: async (a) => {
|
|
@@ -1819,8 +1882,8 @@ function nn(e) {
|
|
|
1819
1882
|
const t = new URL("/api/product-agent/embed/ws", e);
|
|
1820
1883
|
return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
|
|
1821
1884
|
}
|
|
1822
|
-
function
|
|
1823
|
-
const e =
|
|
1885
|
+
function b() {
|
|
1886
|
+
const e = Pe();
|
|
1824
1887
|
return {
|
|
1825
1888
|
url: location.href,
|
|
1826
1889
|
title: document.title,
|
|
@@ -1836,13 +1899,13 @@ function rn() {
|
|
|
1836
1899
|
};
|
|
1837
1900
|
}
|
|
1838
1901
|
function on(e) {
|
|
1839
|
-
return
|
|
1840
|
-
|
|
1902
|
+
return st.add(e), Z || (Z = an()), () => {
|
|
1903
|
+
st.delete(e), st.size === 0 && (Z?.(), Z = null);
|
|
1841
1904
|
};
|
|
1842
1905
|
}
|
|
1843
1906
|
function an() {
|
|
1844
1907
|
const e = () => {
|
|
1845
|
-
for (const i of Array.from(
|
|
1908
|
+
for (const i of Array.from(st))
|
|
1846
1909
|
i();
|
|
1847
1910
|
}, t = window.history.pushState.bind(window.history), s = window.history.replaceState.bind(window.history), n = ((...i) => {
|
|
1848
1911
|
const o = t(...i);
|
|
@@ -1856,23 +1919,23 @@ function an() {
|
|
|
1856
1919
|
};
|
|
1857
1920
|
}
|
|
1858
1921
|
function cn() {
|
|
1859
|
-
return
|
|
1922
|
+
return Pe()?.surface === "browser_extension_sdk_preview";
|
|
1860
1923
|
}
|
|
1861
1924
|
function Wt() {
|
|
1862
1925
|
if (!document.body)
|
|
1863
1926
|
return "";
|
|
1864
1927
|
const e = [], t = [], s = (f, h) => {
|
|
1865
|
-
const y =
|
|
1928
|
+
const y = B(h);
|
|
1866
1929
|
!y || t.includes(y) || (e.push([f, y]), t.push(y));
|
|
1867
1930
|
};
|
|
1868
1931
|
s("Selected text", window.getSelection()?.toString() ?? "");
|
|
1869
1932
|
const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", r = Array.from(document.querySelectorAll(n)).filter(
|
|
1870
|
-
(f) =>
|
|
1933
|
+
(f) => ke(f) && !f.parentElement?.closest(n)
|
|
1871
1934
|
);
|
|
1872
1935
|
for (const f of r.slice(0, 3))
|
|
1873
|
-
s("Active overlay",
|
|
1874
|
-
const i = ln(), o = i ?
|
|
1875
|
-
s("Main page content", o), s("Additional visible page text",
|
|
1936
|
+
s("Active overlay", Mt(z(f), t));
|
|
1937
|
+
const i = ln(), o = i ? Mt(z(i), t) : "";
|
|
1938
|
+
s("Main page content", o), s("Additional visible page text", Mt(z(document.body), t));
|
|
1876
1939
|
const a = e.map(([f, h]) => `${f}:
|
|
1877
1940
|
${h}`).join(`
|
|
1878
1941
|
|
|
@@ -1883,10 +1946,10 @@ Visible page text:
|
|
|
1883
1946
|
`, p = 12e3 - l.length - u.length, I = Math.min(a.length, 7900), m = c.slice(0, p - I), d = a.slice(0, p - m.length);
|
|
1884
1947
|
return `${l}${m}${u}${d}`;
|
|
1885
1948
|
}
|
|
1886
|
-
function
|
|
1949
|
+
function z(e) {
|
|
1887
1950
|
return e.innerText ?? e.textContent ?? "";
|
|
1888
1951
|
}
|
|
1889
|
-
function
|
|
1952
|
+
function B(e) {
|
|
1890
1953
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\r\n?/g, `
|
|
1891
1954
|
`).split(`
|
|
1892
1955
|
`).map((t) => t.replace(/[ \t]+/g, " ").trim()).join(`
|
|
@@ -1894,18 +1957,18 @@ function q(e) {
|
|
|
1894
1957
|
|
|
1895
1958
|
`).trim();
|
|
1896
1959
|
}
|
|
1897
|
-
function
|
|
1898
|
-
let s =
|
|
1960
|
+
function Mt(e, t) {
|
|
1961
|
+
let s = B(e);
|
|
1899
1962
|
for (const n of t)
|
|
1900
1963
|
s = s.replace(n, "");
|
|
1901
|
-
return
|
|
1964
|
+
return B(s);
|
|
1902
1965
|
}
|
|
1903
|
-
function
|
|
1966
|
+
function ke(e) {
|
|
1904
1967
|
const t = window.getComputedStyle(e);
|
|
1905
1968
|
return t.display !== "none" && t.visibility !== "hidden" && e.getClientRects().length > 0;
|
|
1906
1969
|
}
|
|
1907
1970
|
function ln() {
|
|
1908
|
-
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(
|
|
1971
|
+
return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(ke).sort((e, t) => z(t).length - z(e).length)[0] ?? null;
|
|
1909
1972
|
}
|
|
1910
1973
|
function un(e, t) {
|
|
1911
1974
|
const s = /* @__PURE__ */ new Set([
|
|
@@ -1997,67 +2060,67 @@ function un(e, t) {
|
|
|
1997
2060
|
const D = T.getAttribute("data-testid") || T.getAttribute("data-test") || T.getAttribute("data-qa") || T.getAttribute("data-cy") || "";
|
|
1998
2061
|
return `${T.tagName.toLowerCase()}|${d(T)}|${D}`;
|
|
1999
2062
|
}, h = (T, D, H) => {
|
|
2000
|
-
const _ = (
|
|
2001
|
-
const
|
|
2002
|
-
if (m >= 1e3 && !
|
|
2063
|
+
const _ = (A, dt) => {
|
|
2064
|
+
const R = A.tagName.toLowerCase(), ht = window.getComputedStyle(A), G = u.has(A);
|
|
2065
|
+
if (m >= 1e3 && !G || H.has(A) || i.has(R) || A.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || ht.display === "none" || ht.visibility === "hidden")
|
|
2003
2066
|
return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
|
|
2004
2067
|
m += 1;
|
|
2005
|
-
const Xt = d(
|
|
2006
|
-
for (const g of
|
|
2068
|
+
const Xt = d(A), X = Ce(A), Ge = a.has(Xt) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(R) || R === "a" && A.hasAttribute("href"), pt = Array.from(A.children).filter((g) => g instanceof HTMLElement), K = /* @__PURE__ */ new Map();
|
|
2069
|
+
for (const g of pt) {
|
|
2007
2070
|
const w = f(g);
|
|
2008
|
-
|
|
2071
|
+
K.set(w, (K.get(w) ?? 0) + 1);
|
|
2009
2072
|
}
|
|
2010
|
-
const
|
|
2011
|
-
for (const g of
|
|
2012
|
-
const w = f(g),
|
|
2013
|
-
Kt.set(w,
|
|
2073
|
+
const ft = /* @__PURE__ */ new Map(), Kt = /* @__PURE__ */ new Map();
|
|
2074
|
+
for (const g of pt) {
|
|
2075
|
+
const w = f(g), x = Kt.get(w) ?? 0;
|
|
2076
|
+
Kt.set(w, x + 1), (K.get(w) ?? 0) > 8 && x >= 6 && !u.has(g) && ft.set(w, (ft.get(w) ?? 0) + 1);
|
|
2014
2077
|
}
|
|
2015
|
-
const Jt = /* @__PURE__ */ new Map(), Vt = /* @__PURE__ */ new Set(),
|
|
2016
|
-
for (const g of
|
|
2017
|
-
const w = f(g),
|
|
2018
|
-
if (Jt.set(w, te + 1),
|
|
2019
|
-
Vt.has(w) || (
|
|
2078
|
+
const Jt = /* @__PURE__ */ new Map(), Vt = /* @__PURE__ */ new Set(), gt = [], Yt = [];
|
|
2079
|
+
for (const g of pt) {
|
|
2080
|
+
const w = f(g), x = K.get(w) ?? 0, te = Jt.get(w) ?? 0;
|
|
2081
|
+
if (Jt.set(w, te + 1), x > 8 && te >= 6 && !u.has(g)) {
|
|
2082
|
+
Vt.has(w) || (gt.push([`… ${ft.get(w) ?? 0} similar siblings omitted`]), Vt.add(w));
|
|
2020
2083
|
continue;
|
|
2021
2084
|
}
|
|
2022
|
-
const ee = _(g,
|
|
2023
|
-
Yt.push(ee),
|
|
2085
|
+
const ee = _(g, dt);
|
|
2086
|
+
Yt.push(ee), gt.push(ee.lines);
|
|
2024
2087
|
}
|
|
2025
|
-
const
|
|
2026
|
-
if (
|
|
2027
|
-
for (const g of Array.from(
|
|
2028
|
-
g instanceof HTMLElement &&
|
|
2029
|
-
const
|
|
2030
|
-
[
|
|
2031
|
-
).slice(0, 180),
|
|
2032
|
-
if (
|
|
2033
|
-
const g =
|
|
2034
|
-
F.push(
|
|
2088
|
+
const mt = [];
|
|
2089
|
+
if (A.shadowRoot)
|
|
2090
|
+
for (const g of Array.from(A.shadowRoot.children))
|
|
2091
|
+
g instanceof HTMLElement && mt.push(_(g, dt + 1));
|
|
2092
|
+
const J = [...Yt, ...mt], yt = X.length > 0 || Ge || J.some((g) => g.hasUsefulContent), Zt = B(
|
|
2093
|
+
[X, ...J.map((g) => g.textPreview)].filter(Boolean).join(" ")
|
|
2094
|
+
).slice(0, 180), Xe = A.hasAttribute("contenteditable") && (X.length > 0 || !A.querySelector("[contenteditable]")), Qt = l.some((g) => A.hasAttribute(g)) || !!Xt || Xe, It = (A.getClientRects().length > 0 || ht.display === "contents") && (s.has(R) || Qt || G) && (yt || G) && (!r.has(R) || yt || Qt || G), Tt = It ? 1 : 0, F = [];
|
|
2095
|
+
if (It) {
|
|
2096
|
+
const g = J.some((x) => x.containsTextElement), w = n.has(R) && !g ? Zt : X;
|
|
2097
|
+
F.push(_e(A, c, o, w.slice(0, 180)));
|
|
2035
2098
|
}
|
|
2036
|
-
for (const g of
|
|
2037
|
-
F.push(...
|
|
2038
|
-
const
|
|
2039
|
-
if (
|
|
2040
|
-
const g =
|
|
2041
|
-
|
|
2042
|
-
const w =
|
|
2043
|
-
if (
|
|
2044
|
-
const
|
|
2045
|
-
F.push(...
|
|
2099
|
+
for (const g of gt)
|
|
2100
|
+
F.push(...Q(g, Tt));
|
|
2101
|
+
const wt = mt.flatMap((g) => g.lines);
|
|
2102
|
+
if (wt.length > 0) {
|
|
2103
|
+
const g = wt.slice(0, 20);
|
|
2104
|
+
wt.length > g.length && g.push("… shadow DOM omitted");
|
|
2105
|
+
const w = R.includes("tooltip") || R.includes("popper") || R.includes("loader");
|
|
2106
|
+
if (dt < 2 && !w) {
|
|
2107
|
+
const x = It ? "#shadow-root" : `${R} #shadow-root`;
|
|
2108
|
+
F.push(...Q([x, ...Q(g, 1)], Tt));
|
|
2046
2109
|
} else
|
|
2047
|
-
F.push(...
|
|
2110
|
+
F.push(...Q(g, Tt));
|
|
2048
2111
|
}
|
|
2049
2112
|
return {
|
|
2050
2113
|
lines: F,
|
|
2051
|
-
hasUsefulContent:
|
|
2114
|
+
hasUsefulContent: yt,
|
|
2052
2115
|
textPreview: Zt,
|
|
2053
|
-
containsTextElement: n.has(
|
|
2116
|
+
containsTextElement: n.has(R) || J.some((g) => g.containsTextElement)
|
|
2054
2117
|
};
|
|
2055
2118
|
};
|
|
2056
2119
|
return [`--- ${D} ---`, ..._(T, 0).lines].join(`
|
|
2057
2120
|
`);
|
|
2058
|
-
}, y = [],
|
|
2059
|
-
|
|
2060
|
-
${JSON.stringify(
|
|
2121
|
+
}, y = [], k = B(window.getSelection()?.toString() ?? "");
|
|
2122
|
+
k && y.push(`--- selected text ---
|
|
2123
|
+
${JSON.stringify(k)}`), p.length > 0 && y.push(hn(p, s, c, o));
|
|
2061
2124
|
for (const T of e.slice(0, 3))
|
|
2062
2125
|
y.push(h(T, "active overlay DOM", /* @__PURE__ */ new Set()));
|
|
2063
2126
|
if (t && y.push(h(t, "main DOM", /* @__PURE__ */ new Set())), document.body) {
|
|
@@ -2068,7 +2131,7 @@ ${JSON.stringify(M)}`), p.length > 0 && y.push(hn(p, s, c, o));
|
|
|
2068
2131
|
|
|
2069
2132
|
`);
|
|
2070
2133
|
}
|
|
2071
|
-
function
|
|
2134
|
+
function _e(e, t, s, n) {
|
|
2072
2135
|
const r = e.tagName.toLowerCase();
|
|
2073
2136
|
let i = r;
|
|
2074
2137
|
const o = e.getAttribute("id");
|
|
@@ -2106,7 +2169,7 @@ function dn() {
|
|
|
2106
2169
|
n = n.shadowRoot.activeElement;
|
|
2107
2170
|
n !== document.body && n !== document.documentElement && s(n, "focused");
|
|
2108
2171
|
const r = window.getSelection();
|
|
2109
|
-
r && !r.isCollapsed && (s(
|
|
2172
|
+
r && !r.isCollapsed && (s(ue(r.anchorNode), "selected text"), s(ue(r.focusNode), "selected text"));
|
|
2110
2173
|
const i = [
|
|
2111
2174
|
["[aria-selected='true']", "selected"],
|
|
2112
2175
|
["[aria-current]:not([aria-current='false'])", "current"],
|
|
@@ -2139,35 +2202,35 @@ function hn(e, t, s, n) {
|
|
|
2139
2202
|
const p = a.getRootNode();
|
|
2140
2203
|
a = a.parentElement ?? (p instanceof ShadowRoot && p.host instanceof HTMLElement ? p.host : null);
|
|
2141
2204
|
}
|
|
2142
|
-
const c = o.length > 6 ? [o[0], ...o.slice(-5)] : o, l = c.map((u, p) =>
|
|
2205
|
+
const c = o.length > 6 ? [o[0], ...o.slice(-5)] : o, l = c.map((u, p) => _e(
|
|
2143
2206
|
u,
|
|
2144
2207
|
s,
|
|
2145
2208
|
n,
|
|
2146
|
-
p === c.length - 1 ?
|
|
2209
|
+
p === c.length - 1 ? Ce(u).slice(0, 180) : ""
|
|
2147
2210
|
));
|
|
2148
2211
|
o.length > c.length && l.splice(1, 0, "…"), r.push(`${i.labels.join(", ")}: ${l.join(" > ")}`);
|
|
2149
2212
|
}
|
|
2150
2213
|
return r.join(`
|
|
2151
2214
|
`);
|
|
2152
2215
|
}
|
|
2153
|
-
function
|
|
2216
|
+
function ue(e) {
|
|
2154
2217
|
return e instanceof HTMLElement ? e : e?.parentElement instanceof HTMLElement ? e.parentElement : null;
|
|
2155
2218
|
}
|
|
2156
|
-
function
|
|
2219
|
+
function Q(e, t) {
|
|
2157
2220
|
if (t === 0)
|
|
2158
2221
|
return e;
|
|
2159
2222
|
const s = " ".repeat(t);
|
|
2160
2223
|
return e.map((n) => `${s}${n}`);
|
|
2161
2224
|
}
|
|
2162
|
-
function
|
|
2163
|
-
return
|
|
2225
|
+
function Ce(e) {
|
|
2226
|
+
return B(
|
|
2164
2227
|
Array.from(e.childNodes).filter((t) => t.nodeType === Node.TEXT_NODE).map((t) => t.textContent ?? "").join(" ")
|
|
2165
2228
|
);
|
|
2166
2229
|
}
|
|
2167
2230
|
function pn(e) {
|
|
2168
2231
|
return e.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(e) && !/[a-f0-9]{12,}/i.test(e) && !/:r[0-9a-z]+:/i.test(e);
|
|
2169
2232
|
}
|
|
2170
|
-
function
|
|
2233
|
+
function Pe() {
|
|
2171
2234
|
const e = document.querySelector(se);
|
|
2172
2235
|
if (!(e ?? document.querySelector(Ct)))
|
|
2173
2236
|
return;
|
|
@@ -2183,17 +2246,17 @@ function Ce() {
|
|
|
2183
2246
|
},
|
|
2184
2247
|
{
|
|
2185
2248
|
name: "widget_root",
|
|
2186
|
-
selector:
|
|
2249
|
+
selector: hs,
|
|
2187
2250
|
description: "Finds Pluno's widget root inside the widget host shadow root."
|
|
2188
2251
|
},
|
|
2189
2252
|
{
|
|
2190
2253
|
name: "widget_panel",
|
|
2191
|
-
selector:
|
|
2254
|
+
selector: ps,
|
|
2192
2255
|
description: "Finds Pluno's open chat panel inside the widget host shadow root."
|
|
2193
2256
|
},
|
|
2194
2257
|
{
|
|
2195
2258
|
name: "widget_timeline",
|
|
2196
|
-
selector:
|
|
2259
|
+
selector: fs,
|
|
2197
2260
|
description: "Finds Pluno's chat timeline inside the widget host shadow root."
|
|
2198
2261
|
}
|
|
2199
2262
|
]
|
|
@@ -2207,7 +2270,7 @@ function fn(e) {
|
|
|
2207
2270
|
return { type: "error", message: "Invalid server event" };
|
|
2208
2271
|
}
|
|
2209
2272
|
}
|
|
2210
|
-
function
|
|
2273
|
+
function de(e, t) {
|
|
2211
2274
|
if (!e || typeof e != "object")
|
|
2212
2275
|
return [];
|
|
2213
2276
|
const s = e[t];
|
|
@@ -2256,10 +2319,10 @@ function wn() {
|
|
|
2256
2319
|
const s = crypto.randomUUID();
|
|
2257
2320
|
return window.localStorage.setItem(e, s), s;
|
|
2258
2321
|
}
|
|
2259
|
-
function
|
|
2322
|
+
function $() {
|
|
2260
2323
|
return crypto.randomUUID();
|
|
2261
2324
|
}
|
|
2262
|
-
function
|
|
2325
|
+
function Sn(e) {
|
|
2263
2326
|
if (!e || typeof e != "object")
|
|
2264
2327
|
return null;
|
|
2265
2328
|
const t = e, s = typeof t.id == "string" ? t.id : null;
|
|
@@ -2270,8 +2333,8 @@ function An(e) {
|
|
|
2270
2333
|
avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
|
|
2271
2334
|
} : null;
|
|
2272
2335
|
}
|
|
2273
|
-
function
|
|
2274
|
-
return Array.isArray(e) ?
|
|
2336
|
+
function An(e, t) {
|
|
2337
|
+
return Array.isArray(e) ? vt(
|
|
2275
2338
|
e.map((s) => Ue(s, t)).filter((s) => s !== null)
|
|
2276
2339
|
) : [];
|
|
2277
2340
|
}
|
|
@@ -2284,12 +2347,14 @@ function En(e) {
|
|
|
2284
2347
|
{
|
|
2285
2348
|
id: n,
|
|
2286
2349
|
title: E(s, "title"),
|
|
2350
|
+
customTitle: E(s, "customTitle"),
|
|
2287
2351
|
firstUserMessage: E(s, "firstUserMessage"),
|
|
2288
2352
|
currentPage: s.currentPage ?? null,
|
|
2289
2353
|
createdAt: r,
|
|
2290
2354
|
updatedAt: i,
|
|
2291
2355
|
lastActiveAt: o,
|
|
2292
|
-
isActive: s.isActive === !0
|
|
2356
|
+
isActive: s.isActive === !0,
|
|
2357
|
+
isPinned: s.isPinned === !0
|
|
2293
2358
|
}
|
|
2294
2359
|
];
|
|
2295
2360
|
}) : [];
|
|
@@ -2301,23 +2366,21 @@ function Ue(e, t) {
|
|
|
2301
2366
|
if (!n || typeof n != "object")
|
|
2302
2367
|
return null;
|
|
2303
2368
|
const r = n;
|
|
2304
|
-
if (r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
2369
|
+
if (r.hiddenFromTranscript === !0 || r.type === "tab_lifecycle_decision" && r.decision === "keep")
|
|
2305
2370
|
return null;
|
|
2306
2371
|
if (r.type === "message") {
|
|
2307
|
-
if (r.hiddenFromTranscript === !0)
|
|
2308
|
-
return null;
|
|
2309
2372
|
const i = r.role === "assistant" ? "assistant" : r.role === "user" ? "user" : "system", o = {
|
|
2310
2373
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2311
2374
|
role: i,
|
|
2312
2375
|
...r.phase === "commentary" || r.phase === "final_answer" ? { phase: r.phase } : {},
|
|
2313
|
-
content:
|
|
2314
|
-
|
|
2376
|
+
content: es(
|
|
2377
|
+
Pn(r.content),
|
|
2315
2378
|
t
|
|
2316
2379
|
),
|
|
2317
2380
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2318
|
-
respondsToUserMessageId:
|
|
2381
|
+
respondsToUserMessageId: O(r) ?? void 0,
|
|
2319
2382
|
...C(r) ? { runId: C(r) } : {},
|
|
2320
|
-
attachments:
|
|
2383
|
+
attachments: ve(r.attachments, t)
|
|
2321
2384
|
};
|
|
2322
2385
|
return i === "assistant" && typeof r.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
|
|
2323
2386
|
value: r.id,
|
|
@@ -2328,37 +2391,37 @@ function Ue(e, t) {
|
|
|
2328
2391
|
}), o;
|
|
2329
2392
|
}
|
|
2330
2393
|
if (r.type === "function_call_output") {
|
|
2331
|
-
const i =
|
|
2394
|
+
const i = bn(r.output);
|
|
2332
2395
|
return i ? {
|
|
2333
2396
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2334
2397
|
role: "tool",
|
|
2335
2398
|
content: `Connect ${i.appName} to continue`,
|
|
2336
2399
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2337
|
-
respondsToUserMessageId:
|
|
2400
|
+
respondsToUserMessageId: O(r) ?? void 0,
|
|
2338
2401
|
...C(r) ? { runId: C(r) } : {},
|
|
2339
2402
|
dataType: "function_call_output",
|
|
2340
2403
|
toolName: "authenticate_pipedream_app",
|
|
2341
|
-
callId:
|
|
2404
|
+
callId: he(r) ?? void 0,
|
|
2342
2405
|
integrationAuthRequest: i
|
|
2343
2406
|
} : null;
|
|
2344
2407
|
}
|
|
2345
2408
|
return r.type === "function_call" || r.type === "tool_call" || r.type === "web_search_call" || r.type === "mcp_call" || r.type === "tab_lifecycle_decision" ? {
|
|
2346
2409
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2347
2410
|
role: "tool",
|
|
2348
|
-
content: r.type === "mcp_call" ?
|
|
2411
|
+
content: r.type === "mcp_call" ? Rn(r) : kn(r),
|
|
2349
2412
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2350
|
-
respondsToUserMessageId:
|
|
2413
|
+
respondsToUserMessageId: O(r) ?? void 0,
|
|
2351
2414
|
...C(r) ? { runId: C(r) } : {},
|
|
2352
2415
|
dataType: String(r.type),
|
|
2353
2416
|
toolName: r.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof r.name == "string" ? r.name : void 0,
|
|
2354
|
-
callId:
|
|
2417
|
+
callId: he(r) ?? void 0,
|
|
2355
2418
|
loading: r.localExecutionStatus === "queued" || r.localExecutionStatus === "running" ? !0 : typeof r.localExecutionStatus == "string" ? !1 : void 0
|
|
2356
2419
|
} : r.type === "run_status" || r.type === "run_error" ? r.type === "run_error" && r.stage === "tool_execution" ? null : {
|
|
2357
2420
|
id: String(s.id ?? crypto.randomUUID()),
|
|
2358
2421
|
role: "system",
|
|
2359
|
-
content:
|
|
2422
|
+
content: Mn(r),
|
|
2360
2423
|
createdAt: typeof s.createdAt == "string" ? s.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
2361
|
-
respondsToUserMessageId:
|
|
2424
|
+
respondsToUserMessageId: O(r) ?? void 0,
|
|
2362
2425
|
...C(r) ? { runId: C(r) } : {},
|
|
2363
2426
|
dataType: String(r.type),
|
|
2364
2427
|
loading: r.type === "run_status" && (r.status === "running" || r.status === "retrying"),
|
|
@@ -2367,11 +2430,11 @@ function Ue(e, t) {
|
|
|
2367
2430
|
...typeof r.securitySettingsUrl == "string" ? { securitySettingsUrl: r.securitySettingsUrl } : {}
|
|
2368
2431
|
} : null;
|
|
2369
2432
|
}
|
|
2370
|
-
function
|
|
2433
|
+
function Rn(e) {
|
|
2371
2434
|
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(" ");
|
|
2372
2435
|
return s ? `🔌 Using ${s}` : "🔌 Using connected integration";
|
|
2373
2436
|
}
|
|
2374
|
-
function
|
|
2437
|
+
function bn(e) {
|
|
2375
2438
|
if (typeof e != "string")
|
|
2376
2439
|
return null;
|
|
2377
2440
|
try {
|
|
@@ -2388,10 +2451,10 @@ function kn(e) {
|
|
|
2388
2451
|
return null;
|
|
2389
2452
|
}
|
|
2390
2453
|
}
|
|
2391
|
-
function
|
|
2454
|
+
function Mn(e) {
|
|
2392
2455
|
return e.type === "run_status" && e.status === "stopped" ? "Run stopped by user" : e.type === "run_status" && e.status === "steered" ? "Steered" : 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." : "Pluno run status changed.";
|
|
2393
2456
|
}
|
|
2394
|
-
function
|
|
2457
|
+
function kn(e) {
|
|
2395
2458
|
if (e.type === "web_search_call") {
|
|
2396
2459
|
const t = e.action;
|
|
2397
2460
|
if (t && typeof t == "object") {
|
|
@@ -2437,11 +2500,11 @@ function Cn(e) {
|
|
|
2437
2500
|
runId: typeof t.runId == "string" ? t.runId : null
|
|
2438
2501
|
};
|
|
2439
2502
|
}
|
|
2440
|
-
function
|
|
2503
|
+
function he(e) {
|
|
2441
2504
|
const t = e.callId ?? e.call_id;
|
|
2442
2505
|
return typeof t == "string" && t ? t : null;
|
|
2443
2506
|
}
|
|
2444
|
-
function
|
|
2507
|
+
function Pn(e) {
|
|
2445
2508
|
return typeof e == "string" ? e : Array.isArray(e) ? e.map((t) => {
|
|
2446
2509
|
if (!t || typeof t != "object")
|
|
2447
2510
|
return "";
|
|
@@ -2449,22 +2512,22 @@ function Un(e) {
|
|
|
2449
2512
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
2450
2513
|
}).filter(Boolean).join("") : "";
|
|
2451
2514
|
}
|
|
2452
|
-
function
|
|
2453
|
-
const s =
|
|
2454
|
-
|
|
2455
|
-
|
|
2515
|
+
function Ut(e, t) {
|
|
2516
|
+
const s = De(e, t), n = vn(
|
|
2517
|
+
Un(
|
|
2518
|
+
Fn(e, t),
|
|
2456
2519
|
s
|
|
2457
2520
|
),
|
|
2458
2521
|
s
|
|
2459
2522
|
), r = n.findIndex((o) => o.id === s.id);
|
|
2460
2523
|
if (r === -1)
|
|
2461
|
-
return
|
|
2524
|
+
return vt(
|
|
2462
2525
|
[...n, s]
|
|
2463
2526
|
);
|
|
2464
2527
|
const i = [...n];
|
|
2465
|
-
return i[r] = s,
|
|
2528
|
+
return i[r] = s, vt(i);
|
|
2466
2529
|
}
|
|
2467
|
-
function
|
|
2530
|
+
function Un(e, t) {
|
|
2468
2531
|
const s = t.assistantDraftItemId;
|
|
2469
2532
|
return s ? e.map(
|
|
2470
2533
|
(n) => n.dataType === "assistant_draft" && n.id === s ? t : n
|
|
@@ -2473,12 +2536,12 @@ function Pn(e, t) {
|
|
|
2473
2536
|
function Dn(e, t, s) {
|
|
2474
2537
|
return t !== null ? e.respondsToUserMessageId === t : s !== null && e.runId === s;
|
|
2475
2538
|
}
|
|
2476
|
-
function
|
|
2539
|
+
function xn(e, t) {
|
|
2477
2540
|
const s = e.findIndex(
|
|
2478
2541
|
(r) => !r.id.startsWith("transient-activity:") && r.callId === t.callId
|
|
2479
2542
|
);
|
|
2480
2543
|
if (s === -1)
|
|
2481
|
-
return
|
|
2544
|
+
return Ut(e, t);
|
|
2482
2545
|
const n = [...e];
|
|
2483
2546
|
return n[s] = {
|
|
2484
2547
|
...n[s],
|
|
@@ -2490,12 +2553,14 @@ function vn(e, t) {
|
|
|
2490
2553
|
...n[s].runId ? {} : { runId: t.runId }
|
|
2491
2554
|
}, n;
|
|
2492
2555
|
}
|
|
2493
|
-
function
|
|
2556
|
+
function Nn(e, t, s) {
|
|
2494
2557
|
let n = !1;
|
|
2495
2558
|
const r = e.map((i) => i.callId !== t || i.loading === s ? i : (n = !0, { ...i, loading: s }));
|
|
2496
2559
|
return n ? r : e;
|
|
2497
2560
|
}
|
|
2498
|
-
function
|
|
2561
|
+
function On(e) {
|
|
2562
|
+
if (e.hiddenFromTranscript === !0)
|
|
2563
|
+
return null;
|
|
2499
2564
|
const t = typeof e.callId == "string" ? e.callId : null, s = typeof e.toolName == "string" ? e.toolName : null;
|
|
2500
2565
|
return !t || !s ? null : {
|
|
2501
2566
|
id: `transient-activity:${t}`,
|
|
@@ -2512,7 +2577,7 @@ function Nn(e) {
|
|
|
2512
2577
|
loading: !0
|
|
2513
2578
|
};
|
|
2514
2579
|
}
|
|
2515
|
-
function
|
|
2580
|
+
function vn(e, t) {
|
|
2516
2581
|
if (t.id.startsWith("transient-activity:"))
|
|
2517
2582
|
return e;
|
|
2518
2583
|
const s = t.toolName === "tab_lifecycle";
|
|
@@ -2521,8 +2586,10 @@ function On(e, t) {
|
|
|
2521
2586
|
);
|
|
2522
2587
|
}
|
|
2523
2588
|
function Ln(e, t) {
|
|
2524
|
-
const s =
|
|
2525
|
-
(
|
|
2589
|
+
const s = qn(
|
|
2590
|
+
t.map(
|
|
2591
|
+
(c) => De(e, c)
|
|
2592
|
+
)
|
|
2526
2593
|
), n = new Map(s.map((c) => [c.id, c])), r = new Map(
|
|
2527
2594
|
s.flatMap((c) => {
|
|
2528
2595
|
const l = c.clientMessageId;
|
|
@@ -2552,39 +2619,49 @@ function Ln(e, t) {
|
|
|
2552
2619
|
o.has(c) || a.push(c);
|
|
2553
2620
|
return a;
|
|
2554
2621
|
}
|
|
2555
|
-
function
|
|
2622
|
+
function qn(e) {
|
|
2623
|
+
const t = new Set(
|
|
2624
|
+
e.flatMap(
|
|
2625
|
+
(s) => s.callId && !s.id.startsWith("transient-activity:") ? [s.callId] : []
|
|
2626
|
+
)
|
|
2627
|
+
);
|
|
2628
|
+
return e.filter(
|
|
2629
|
+
(s) => !(s.callId && s.id.startsWith("transient-activity:") && t.has(s.callId))
|
|
2630
|
+
);
|
|
2631
|
+
}
|
|
2632
|
+
function De(e, t) {
|
|
2556
2633
|
if (t.role !== "user" || !t.attachments?.length)
|
|
2557
2634
|
return t;
|
|
2558
2635
|
const s = e.find(
|
|
2559
|
-
(r) => r.role === "user" && (r.id === t.id || $t(r) &&
|
|
2636
|
+
(r) => r.role === "user" && (r.id === t.id || $t(r) && xe(r, t))
|
|
2560
2637
|
);
|
|
2561
2638
|
if (!s?.attachments?.length)
|
|
2562
2639
|
return t;
|
|
2563
2640
|
const n = t.attachments.map((r) => {
|
|
2564
2641
|
const i = Bn(s.attachments ?? [], r);
|
|
2565
|
-
return i ?
|
|
2642
|
+
return i ? Hn(r, i) : r;
|
|
2566
2643
|
});
|
|
2567
2644
|
return { ...t, attachments: n };
|
|
2568
2645
|
}
|
|
2569
2646
|
function Bn(e, t) {
|
|
2570
2647
|
return t.id ? e.find((s) => s.id === t.id) ?? null : null;
|
|
2571
2648
|
}
|
|
2572
|
-
function
|
|
2649
|
+
function Hn(e, t) {
|
|
2573
2650
|
const { previewUrl: s } = t;
|
|
2574
2651
|
return s ? { ...e, previewUrl: s } : e;
|
|
2575
2652
|
}
|
|
2576
|
-
function
|
|
2653
|
+
function Fn(e, t) {
|
|
2577
2654
|
if (t.role !== "user")
|
|
2578
2655
|
return e;
|
|
2579
2656
|
const s = e.findIndex(
|
|
2580
|
-
(r) => $t(r) &&
|
|
2657
|
+
(r) => $t(r) && xe(r, t)
|
|
2581
2658
|
);
|
|
2582
2659
|
if (s === -1)
|
|
2583
2660
|
return e;
|
|
2584
2661
|
const n = [...e];
|
|
2585
2662
|
return n.splice(s, 1), n;
|
|
2586
2663
|
}
|
|
2587
|
-
function
|
|
2664
|
+
function xe(e, t) {
|
|
2588
2665
|
const s = Dt(e), n = Dt(t);
|
|
2589
2666
|
return s && n ? s === n : e.content === t.content;
|
|
2590
2667
|
}
|
|
@@ -2600,18 +2677,18 @@ function Dt(e) {
|
|
|
2600
2677
|
);
|
|
2601
2678
|
return n ? e.id.slice(n.length) : null;
|
|
2602
2679
|
}
|
|
2603
|
-
function
|
|
2604
|
-
const t =
|
|
2680
|
+
function pe(e) {
|
|
2681
|
+
const t = Ne(e);
|
|
2605
2682
|
if (t === null)
|
|
2606
2683
|
return !1;
|
|
2607
2684
|
const s = e[t].id, n = e.some(
|
|
2608
|
-
(r) => r.respondsToUserMessageId === s &&
|
|
2685
|
+
(r) => r.respondsToUserMessageId === s && xt(r)
|
|
2609
2686
|
);
|
|
2610
2687
|
if (e.some((r) => r.respondsToUserMessageId === s))
|
|
2611
2688
|
return n;
|
|
2612
2689
|
for (let r = e.length - 1; r > t; r -= 1) {
|
|
2613
2690
|
const i = e[r];
|
|
2614
|
-
if (
|
|
2691
|
+
if (N(i))
|
|
2615
2692
|
return !0;
|
|
2616
2693
|
if (i.role === "system") {
|
|
2617
2694
|
if (i.dataType === "run_error")
|
|
@@ -2622,25 +2699,25 @@ function he(e) {
|
|
|
2622
2699
|
}
|
|
2623
2700
|
return !1;
|
|
2624
2701
|
}
|
|
2625
|
-
function
|
|
2626
|
-
const t =
|
|
2702
|
+
function Wn(e) {
|
|
2703
|
+
const t = Ne(e);
|
|
2627
2704
|
if (t === null)
|
|
2628
|
-
return e.some(
|
|
2705
|
+
return e.some(N);
|
|
2629
2706
|
const s = e[t].id;
|
|
2630
2707
|
return e.some((n) => n.respondsToUserMessageId === s) ? e.some(
|
|
2631
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
2632
|
-
) : e.slice(t + 1).some(
|
|
2708
|
+
(n) => n.respondsToUserMessageId === s && N(n)
|
|
2709
|
+
) : e.slice(t + 1).some(N);
|
|
2633
2710
|
}
|
|
2634
|
-
function
|
|
2711
|
+
function Ne(e) {
|
|
2635
2712
|
for (let t = e.length - 1; t >= 0; t -= 1)
|
|
2636
2713
|
if (e[t].role === "user")
|
|
2637
2714
|
return t;
|
|
2638
2715
|
return null;
|
|
2639
2716
|
}
|
|
2640
|
-
function
|
|
2641
|
-
return
|
|
2717
|
+
function xt(e) {
|
|
2718
|
+
return N(e) ? !0 : e.role !== "system" ? !1 : e.dataType === "run_error" ? !0 : e.dataType === "run_status" && e.loading !== !0;
|
|
2642
2719
|
}
|
|
2643
|
-
function
|
|
2720
|
+
function at(e) {
|
|
2644
2721
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
2645
2722
|
const s = e[t];
|
|
2646
2723
|
if (!s || typeof s != "object")
|
|
@@ -2654,30 +2731,30 @@ function ot(e) {
|
|
|
2654
2731
|
}
|
|
2655
2732
|
return null;
|
|
2656
2733
|
}
|
|
2657
|
-
function
|
|
2658
|
-
const t =
|
|
2734
|
+
function $n(e) {
|
|
2735
|
+
const t = at(e);
|
|
2659
2736
|
if (t === null)
|
|
2660
2737
|
return null;
|
|
2661
|
-
const n =
|
|
2738
|
+
const n = q(e[t])?.page;
|
|
2662
2739
|
if (!n || typeof n != "object")
|
|
2663
2740
|
return null;
|
|
2664
2741
|
const r = n.url;
|
|
2665
2742
|
return typeof r == "string" ? r : null;
|
|
2666
2743
|
}
|
|
2667
|
-
function
|
|
2744
|
+
function q(e) {
|
|
2668
2745
|
if (!e || typeof e != "object")
|
|
2669
2746
|
return null;
|
|
2670
2747
|
const t = e.data;
|
|
2671
2748
|
return t && typeof t == "object" ? t : null;
|
|
2672
2749
|
}
|
|
2673
|
-
function
|
|
2750
|
+
function Nt(e) {
|
|
2674
2751
|
return e?.retryable !== !0 ? !1 : e.type === "run_error" ? !0 : e.type === "run_status" && e.status === "interrupted";
|
|
2675
2752
|
}
|
|
2676
|
-
function
|
|
2753
|
+
function fe(e) {
|
|
2677
2754
|
return e?.type === "run_status" && e.status === "interrupted" && e.reason === "backend_restart";
|
|
2678
2755
|
}
|
|
2679
|
-
function
|
|
2680
|
-
const s =
|
|
2756
|
+
function jn(e, t) {
|
|
2757
|
+
const s = at(t);
|
|
2681
2758
|
if (s === null)
|
|
2682
2759
|
return !1;
|
|
2683
2760
|
const n = t[s], r = n && typeof n == "object" ? n.id : null;
|
|
@@ -2685,11 +2762,11 @@ function $n(e, t) {
|
|
|
2685
2762
|
return !1;
|
|
2686
2763
|
const i = e.findIndex((o) => o.role === "user" && o.id === r);
|
|
2687
2764
|
return i === -1 ? !1 : e.some((o) => o.respondsToUserMessageId === r) ? e.some(
|
|
2688
|
-
(o) => o.respondsToUserMessageId === r &&
|
|
2689
|
-
) : e.slice(i + 1).some(
|
|
2765
|
+
(o) => o.respondsToUserMessageId === r && xt(o)
|
|
2766
|
+
) : e.slice(i + 1).some(xt);
|
|
2690
2767
|
}
|
|
2691
|
-
function
|
|
2692
|
-
const t =
|
|
2768
|
+
function Ot(e) {
|
|
2769
|
+
const t = at(e);
|
|
2693
2770
|
if (t === null)
|
|
2694
2771
|
return null;
|
|
2695
2772
|
const s = e[t];
|
|
@@ -2701,8 +2778,8 @@ function Nt(e) {
|
|
|
2701
2778
|
const r = n.clientMessageId;
|
|
2702
2779
|
return typeof r == "string" ? r : null;
|
|
2703
2780
|
}
|
|
2704
|
-
function
|
|
2705
|
-
const t =
|
|
2781
|
+
function zn(e) {
|
|
2782
|
+
const t = at(e);
|
|
2706
2783
|
if (t === null)
|
|
2707
2784
|
return null;
|
|
2708
2785
|
for (let s = e.length - 1; s > t; s -= 1) {
|
|
@@ -2716,22 +2793,22 @@ function jn(e) {
|
|
|
2716
2793
|
if (i.type === "message" && i.role === "assistant")
|
|
2717
2794
|
return null;
|
|
2718
2795
|
if (i.type === "run_error")
|
|
2719
|
-
return i.retryable !== !0 ? null :
|
|
2796
|
+
return i.retryable !== !0 ? null : ge(e, i) ?? Ot(e);
|
|
2720
2797
|
if (i.type === "run_status")
|
|
2721
|
-
return i.status === "interrupted" && i.retryable === !0 ?
|
|
2798
|
+
return i.status === "interrupted" && i.retryable === !0 ? ge(e, i) ?? Ot(e) : null;
|
|
2722
2799
|
}
|
|
2723
2800
|
return null;
|
|
2724
2801
|
}
|
|
2725
|
-
function
|
|
2802
|
+
function ge(e, t) {
|
|
2726
2803
|
if (typeof t.clientMessageId == "string")
|
|
2727
2804
|
return t.clientMessageId;
|
|
2728
|
-
const s =
|
|
2805
|
+
const s = O(t);
|
|
2729
2806
|
if (!s)
|
|
2730
2807
|
return null;
|
|
2731
|
-
const n = e.find((i) => E(i, "id") === s), r =
|
|
2808
|
+
const n = e.find((i) => E(i, "id") === s), r = q(n);
|
|
2732
2809
|
return r?.type === "message" && r.role === "user" && typeof r.clientMessageId == "string" ? r.clientMessageId : null;
|
|
2733
2810
|
}
|
|
2734
|
-
function
|
|
2811
|
+
function Gn(e, t) {
|
|
2735
2812
|
let s = 0;
|
|
2736
2813
|
for (const n of e) {
|
|
2737
2814
|
if (!n || typeof n != "object")
|
|
@@ -2744,65 +2821,65 @@ function zn(e, t) {
|
|
|
2744
2821
|
}
|
|
2745
2822
|
return s;
|
|
2746
2823
|
}
|
|
2747
|
-
function
|
|
2748
|
-
if (!t || !
|
|
2824
|
+
function me(e, t, s, n, r) {
|
|
2825
|
+
if (!t || !Xn(e))
|
|
2749
2826
|
return !1;
|
|
2750
2827
|
const i = e;
|
|
2751
|
-
return !(
|
|
2828
|
+
return !(Nt(i) || s !== null && typeof i.id == "string" && i.id !== s || (n !== null ? O(i) !== n : r !== null && C(i) !== r));
|
|
2752
2829
|
}
|
|
2753
|
-
function
|
|
2830
|
+
function Xn(e) {
|
|
2754
2831
|
if (!e || typeof e != "object")
|
|
2755
2832
|
return !1;
|
|
2756
2833
|
const t = e;
|
|
2757
2834
|
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" || t.status === "failed");
|
|
2758
2835
|
}
|
|
2759
|
-
function
|
|
2836
|
+
function N(e) {
|
|
2760
2837
|
return e.role === "assistant" && e.phase !== "commentary";
|
|
2761
2838
|
}
|
|
2762
|
-
function
|
|
2839
|
+
function Kn(e) {
|
|
2763
2840
|
if (!e || typeof e != "object")
|
|
2764
2841
|
return !1;
|
|
2765
2842
|
const t = e;
|
|
2766
2843
|
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";
|
|
2767
2844
|
}
|
|
2768
|
-
function
|
|
2769
|
-
return e.filter((t, s) =>
|
|
2845
|
+
function vt(e) {
|
|
2846
|
+
return e.filter((t, s) => ct(t) ? !sr(e, s) && !tr(e, s) && !er(e, s) : Jn(t) ? t.retryable === !0 && Qn(e, s) ? !1 : !Zn(e, s) : !0);
|
|
2770
2847
|
}
|
|
2771
|
-
function
|
|
2848
|
+
function Jn(e) {
|
|
2772
2849
|
return e.role === "system" && (e.dataType === "run_error" || e.dataType === "run_status" && e.steered !== !0);
|
|
2773
2850
|
}
|
|
2774
|
-
function
|
|
2851
|
+
function ct(e) {
|
|
2775
2852
|
return e.role === "system" && e.dataType === "run_status" && e.loading === !0;
|
|
2776
2853
|
}
|
|
2777
|
-
function
|
|
2854
|
+
function Vn(e, t) {
|
|
2778
2855
|
const s = [...e].reverse().find(
|
|
2779
|
-
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== t &&
|
|
2856
|
+
(n) => n.respondsToUserMessageId !== void 0 && n.respondsToUserMessageId !== t && ye(n) && !Yn(
|
|
2780
2857
|
e,
|
|
2781
2858
|
n.respondsToUserMessageId
|
|
2782
2859
|
)
|
|
2783
2860
|
)?.respondsToUserMessageId;
|
|
2784
2861
|
return s ? e.map(
|
|
2785
|
-
(n) => n.respondsToUserMessageId === s &&
|
|
2862
|
+
(n) => n.respondsToUserMessageId === s && ye(n) ? { ...n, steered: !0 } : n
|
|
2786
2863
|
) : e;
|
|
2787
2864
|
}
|
|
2788
|
-
function
|
|
2789
|
-
return e.role === "tool" ||
|
|
2865
|
+
function ye(e) {
|
|
2866
|
+
return e.role === "tool" || ct(e) ? !0 : e.role === "assistant" && e.phase === "commentary";
|
|
2790
2867
|
}
|
|
2791
|
-
function
|
|
2868
|
+
function Yn(e, t) {
|
|
2792
2869
|
return e.some(
|
|
2793
|
-
(s) => s.respondsToUserMessageId === t && (
|
|
2870
|
+
(s) => s.respondsToUserMessageId === t && (N(s) || s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.loading !== !0))
|
|
2794
2871
|
);
|
|
2795
2872
|
}
|
|
2796
|
-
function
|
|
2873
|
+
function Zn(e, t) {
|
|
2797
2874
|
const s = e[t];
|
|
2798
2875
|
for (let n = t + 1; n < e.length; n += 1) {
|
|
2799
2876
|
const r = e[n];
|
|
2800
|
-
if (r.role === "assistant" &&
|
|
2877
|
+
if (r.role === "assistant" && lt(s, r))
|
|
2801
2878
|
return !0;
|
|
2802
2879
|
}
|
|
2803
2880
|
return !1;
|
|
2804
2881
|
}
|
|
2805
|
-
function
|
|
2882
|
+
function Qn(e, t) {
|
|
2806
2883
|
const s = e[t];
|
|
2807
2884
|
if (!s.respondsToUserMessageId)
|
|
2808
2885
|
return !1;
|
|
@@ -2810,37 +2887,37 @@ function Zn(e, t) {
|
|
|
2810
2887
|
const r = e[n];
|
|
2811
2888
|
if (r.role === "user")
|
|
2812
2889
|
return !1;
|
|
2813
|
-
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" ||
|
|
2890
|
+
if (r.respondsToUserMessageId === s.respondsToUserMessageId && (r.role === "assistant" || r.role === "tool" || ct(r)))
|
|
2814
2891
|
return !0;
|
|
2815
2892
|
}
|
|
2816
2893
|
return !1;
|
|
2817
2894
|
}
|
|
2818
|
-
function
|
|
2895
|
+
function tr(e, t) {
|
|
2819
2896
|
const s = e[t];
|
|
2820
2897
|
return e.some(
|
|
2821
|
-
(n, r) => r !== t && n.role === "assistant" &&
|
|
2898
|
+
(n, r) => r !== t && n.role === "assistant" && lt(s, n)
|
|
2822
2899
|
);
|
|
2823
2900
|
}
|
|
2824
|
-
function
|
|
2901
|
+
function er(e, t) {
|
|
2825
2902
|
const s = e[t];
|
|
2826
2903
|
return e.some(
|
|
2827
|
-
(n, r) => r !== t && n.role === "tool" &&
|
|
2904
|
+
(n, r) => r !== t && n.role === "tool" && lt(s, n)
|
|
2828
2905
|
);
|
|
2829
2906
|
}
|
|
2830
|
-
function
|
|
2907
|
+
function sr(e, t) {
|
|
2831
2908
|
const s = e[t];
|
|
2832
2909
|
for (let n = t + 1; n < e.length; n += 1)
|
|
2833
|
-
if (
|
|
2910
|
+
if (ct(e[n]) && lt(s, e[n]))
|
|
2834
2911
|
return !0;
|
|
2835
2912
|
return !1;
|
|
2836
2913
|
}
|
|
2837
|
-
function
|
|
2914
|
+
function lt(e, t) {
|
|
2838
2915
|
return !!(e.respondsToUserMessageId && e.respondsToUserMessageId === t.respondsToUserMessageId);
|
|
2839
2916
|
}
|
|
2840
2917
|
function E(e, t) {
|
|
2841
2918
|
return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
|
|
2842
2919
|
}
|
|
2843
|
-
function
|
|
2920
|
+
function nr(e, t) {
|
|
2844
2921
|
try {
|
|
2845
2922
|
const s = window.localStorage.getItem(`${be}${e}`);
|
|
2846
2923
|
if (!s)
|
|
@@ -2848,7 +2925,7 @@ function sr(e, t) {
|
|
|
2848
2925
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
2849
2926
|
if (t !== void 0 && r !== t)
|
|
2850
2927
|
return null;
|
|
2851
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
2928
|
+
const i = Array.isArray(n.messages) ? n.messages.map(pr).filter((o) => !!o) : [];
|
|
2852
2929
|
return {
|
|
2853
2930
|
sessionId: r,
|
|
2854
2931
|
messages: i
|
|
@@ -2857,22 +2934,22 @@ function sr(e, t) {
|
|
|
2857
2934
|
return null;
|
|
2858
2935
|
}
|
|
2859
2936
|
}
|
|
2860
|
-
function
|
|
2937
|
+
function rr(e, t) {
|
|
2861
2938
|
try {
|
|
2862
2939
|
window.localStorage.setItem(
|
|
2863
2940
|
`${be}${e}`,
|
|
2864
2941
|
JSON.stringify({
|
|
2865
2942
|
sessionId: t.sessionId,
|
|
2866
|
-
messages: t.messages.slice(-
|
|
2943
|
+
messages: t.messages.slice(-Us).map(fr)
|
|
2867
2944
|
})
|
|
2868
2945
|
);
|
|
2869
2946
|
} catch {
|
|
2870
2947
|
return;
|
|
2871
2948
|
}
|
|
2872
2949
|
}
|
|
2873
|
-
function
|
|
2950
|
+
function ir(e) {
|
|
2874
2951
|
try {
|
|
2875
|
-
const t = window.localStorage.getItem(`${
|
|
2952
|
+
const t = window.localStorage.getItem(`${Pt}${e}`);
|
|
2876
2953
|
if (!t)
|
|
2877
2954
|
return [];
|
|
2878
2955
|
const s = JSON.parse(t);
|
|
@@ -2881,24 +2958,24 @@ function rr(e) {
|
|
|
2881
2958
|
return [];
|
|
2882
2959
|
}
|
|
2883
2960
|
}
|
|
2884
|
-
function
|
|
2961
|
+
function j(e, t) {
|
|
2885
2962
|
try {
|
|
2886
2963
|
const s = t.filter(jt);
|
|
2887
2964
|
if (s.length === 0) {
|
|
2888
|
-
window.localStorage.removeItem(`${
|
|
2965
|
+
window.localStorage.removeItem(`${Pt}${e}`);
|
|
2889
2966
|
return;
|
|
2890
2967
|
}
|
|
2891
2968
|
window.localStorage.setItem(
|
|
2892
|
-
`${
|
|
2969
|
+
`${Pt}${e}`,
|
|
2893
2970
|
JSON.stringify(s.slice(-25))
|
|
2894
2971
|
);
|
|
2895
2972
|
} catch {
|
|
2896
2973
|
return;
|
|
2897
2974
|
}
|
|
2898
2975
|
}
|
|
2899
|
-
function
|
|
2976
|
+
function Oe(e, t) {
|
|
2900
2977
|
try {
|
|
2901
|
-
const s = `${
|
|
2978
|
+
const s = `${ot}${e}`, n = location.href, r = location.origin, i = Array.from(t, (o) => ({
|
|
2902
2979
|
...o,
|
|
2903
2980
|
storedAt: Date.now(),
|
|
2904
2981
|
unloadUrl: n,
|
|
@@ -2912,28 +2989,28 @@ function xe(e, t) {
|
|
|
2912
2989
|
} catch {
|
|
2913
2990
|
}
|
|
2914
2991
|
}
|
|
2915
|
-
function
|
|
2992
|
+
function or(e, t) {
|
|
2916
2993
|
try {
|
|
2917
|
-
if (window.sessionStorage.getItem(`${
|
|
2994
|
+
if (window.sessionStorage.getItem(`${ot}${e}`) === null)
|
|
2918
2995
|
return;
|
|
2919
2996
|
} catch {
|
|
2920
2997
|
return;
|
|
2921
2998
|
}
|
|
2922
|
-
|
|
2999
|
+
Oe(e, t);
|
|
2923
3000
|
}
|
|
2924
|
-
function
|
|
3001
|
+
function ar(e) {
|
|
2925
3002
|
try {
|
|
2926
|
-
const t = `${
|
|
3003
|
+
const t = `${ot}${e}`, s = window.sessionStorage.getItem(t);
|
|
2927
3004
|
if (window.sessionStorage.removeItem(t), !s)
|
|
2928
3005
|
return [];
|
|
2929
3006
|
const n = JSON.parse(s);
|
|
2930
|
-
return Array.isArray(n) ? n.flatMap((r) =>
|
|
3007
|
+
return Array.isArray(n) ? n.flatMap((r) => lr(r) ? [{
|
|
2931
3008
|
...r.event,
|
|
2932
|
-
page:
|
|
3009
|
+
page: b(),
|
|
2933
3010
|
rawOutput: {
|
|
2934
3011
|
pageContextRestarted: !0,
|
|
2935
3012
|
outcome: "unknown",
|
|
2936
|
-
message:
|
|
3013
|
+
message: cr(location.href),
|
|
2937
3014
|
currentUrl: location.href,
|
|
2938
3015
|
console: [],
|
|
2939
3016
|
metadata: {
|
|
@@ -2950,17 +3027,17 @@ function or(e) {
|
|
|
2950
3027
|
return [];
|
|
2951
3028
|
}
|
|
2952
3029
|
}
|
|
2953
|
-
function
|
|
3030
|
+
function cr(e) {
|
|
2954
3031
|
return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
|
|
2955
3032
|
Current URL: ${e}`;
|
|
2956
3033
|
}
|
|
2957
|
-
function
|
|
3034
|
+
function lr(e) {
|
|
2958
3035
|
if (!e || typeof e != "object")
|
|
2959
3036
|
return !1;
|
|
2960
3037
|
const t = e, s = t.event;
|
|
2961
3038
|
return typeof t.startedAtMs == "number" && typeof t.startedAtUrl == "string" && t.startedAtOrigin === location.origin && t.unloadOrigin === location.origin && typeof t.unloadUrl == "string" && jt(s) && s.type === "tool.result";
|
|
2962
3039
|
}
|
|
2963
|
-
function
|
|
3040
|
+
function ur(e, t) {
|
|
2964
3041
|
const s = new Set(
|
|
2965
3042
|
e.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
|
|
2966
3043
|
);
|
|
@@ -2969,9 +3046,9 @@ function lr(e, t) {
|
|
|
2969
3046
|
...t.filter((n) => !s.has(n.callId))
|
|
2970
3047
|
];
|
|
2971
3048
|
}
|
|
2972
|
-
function
|
|
3049
|
+
function dr(e) {
|
|
2973
3050
|
try {
|
|
2974
|
-
window.sessionStorage.removeItem(`${
|
|
3051
|
+
window.sessionStorage.removeItem(`${ot}${e}`);
|
|
2975
3052
|
} catch {
|
|
2976
3053
|
return;
|
|
2977
3054
|
}
|
|
@@ -2980,15 +3057,15 @@ function jt(e) {
|
|
|
2980
3057
|
if (!e || typeof e != "object")
|
|
2981
3058
|
return !1;
|
|
2982
3059
|
const t = e;
|
|
2983
|
-
return t.type === "chat.user_message" ? typeof t.content == "string" &&
|
|
3060
|
+
return t.type === "chat.user_message" ? typeof t.content == "string" && Ie(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? Ie(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && (t.toolName === "execute_code" || t.toolName === "execute_code_in_browser_tab") : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" && (t.reason === "user_requested" || t.reason === "new_chat" || t.reason === "session_switch") : !1;
|
|
2984
3061
|
}
|
|
2985
|
-
function
|
|
3062
|
+
function Ie(e) {
|
|
2986
3063
|
if (!e || typeof e != "object")
|
|
2987
3064
|
return !1;
|
|
2988
3065
|
const t = e;
|
|
2989
3066
|
return typeof t.url == "string" && typeof t.title == "string" && typeof t.origin == "string";
|
|
2990
3067
|
}
|
|
2991
|
-
function
|
|
3068
|
+
function ve(e, t) {
|
|
2992
3069
|
if (!Array.isArray(e))
|
|
2993
3070
|
return;
|
|
2994
3071
|
const s = e.filter((r) => {
|
|
@@ -2996,23 +3073,23 @@ function Ne(e, t) {
|
|
|
2996
3073
|
return !1;
|
|
2997
3074
|
const i = r;
|
|
2998
3075
|
return typeof i.name == "string" && typeof i.mimeType == "string" && typeof i.sizeBytes == "number";
|
|
2999
|
-
}), n = t ? s.map((r) =>
|
|
3076
|
+
}), n = t ? s.map((r) => Le(r, t)) : s;
|
|
3000
3077
|
return n.length > 0 ? n : void 0;
|
|
3001
3078
|
}
|
|
3002
|
-
function
|
|
3079
|
+
function Le(e, t) {
|
|
3003
3080
|
return e.fileUrl?.startsWith("/") ? {
|
|
3004
3081
|
...e,
|
|
3005
3082
|
fileUrl: new URL(e.fileUrl, t).toString()
|
|
3006
3083
|
} : e;
|
|
3007
3084
|
}
|
|
3008
|
-
function
|
|
3009
|
-
return e.type ||
|
|
3085
|
+
function Te(e) {
|
|
3086
|
+
return e.type || hr(e.name) || "application/octet-stream";
|
|
3010
3087
|
}
|
|
3011
|
-
function
|
|
3088
|
+
function hr(e) {
|
|
3012
3089
|
const t = e.toLowerCase();
|
|
3013
3090
|
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;
|
|
3014
3091
|
}
|
|
3015
|
-
function
|
|
3092
|
+
function pr(e) {
|
|
3016
3093
|
if (!e || typeof e != "object")
|
|
3017
3094
|
return null;
|
|
3018
3095
|
const t = e;
|
|
@@ -3025,11 +3102,11 @@ function hr(e) {
|
|
|
3025
3102
|
...typeof t.runId == "string" ? { runId: t.runId } : {},
|
|
3026
3103
|
dataType: typeof t.dataType == "string" ? t.dataType : void 0,
|
|
3027
3104
|
securitySettingsUrl: typeof t.securitySettingsUrl == "string" ? t.securitySettingsUrl : void 0,
|
|
3028
|
-
attachments:
|
|
3105
|
+
attachments: ve(t.attachments)?.map(zt),
|
|
3029
3106
|
loading: typeof t.loading == "boolean" ? t.loading : void 0
|
|
3030
3107
|
};
|
|
3031
3108
|
}
|
|
3032
|
-
function
|
|
3109
|
+
function fr(e) {
|
|
3033
3110
|
return e.attachments?.length ? {
|
|
3034
3111
|
...e,
|
|
3035
3112
|
attachments: e.attachments.map(zt)
|
|
@@ -3044,7 +3121,7 @@ function zt(e) {
|
|
|
3044
3121
|
} = e;
|
|
3045
3122
|
return r;
|
|
3046
3123
|
}
|
|
3047
|
-
function
|
|
3124
|
+
function O(e) {
|
|
3048
3125
|
const t = e.respondsToUserMessageId;
|
|
3049
3126
|
return typeof t == "string" && t ? t : null;
|
|
3050
3127
|
}
|
|
@@ -3052,11 +3129,11 @@ function C(e) {
|
|
|
3052
3129
|
const t = e.runId;
|
|
3053
3130
|
return typeof t == "string" && t ? t : null;
|
|
3054
3131
|
}
|
|
3055
|
-
function
|
|
3132
|
+
function gr(e) {
|
|
3056
3133
|
const t = e?.timeoutMs;
|
|
3057
|
-
return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <=
|
|
3134
|
+
return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string" && (t === void 0 || typeof t == "number" && Number.isInteger(t) && t > 0 && t <= Bs);
|
|
3058
3135
|
}
|
|
3059
|
-
function
|
|
3136
|
+
function qe(e) {
|
|
3060
3137
|
const t = {};
|
|
3061
3138
|
try {
|
|
3062
3139
|
new Headers(e).forEach((s, n) => {
|
|
@@ -3068,22 +3145,22 @@ function Le(e) {
|
|
|
3068
3145
|
return t;
|
|
3069
3146
|
}
|
|
3070
3147
|
function Gt(e, t) {
|
|
3071
|
-
return
|
|
3148
|
+
return je(e) ? ut : P(it(t), Cs);
|
|
3072
3149
|
}
|
|
3073
|
-
function
|
|
3150
|
+
function mr(e, t) {
|
|
3074
3151
|
return typeof e == "string" ? e : e instanceof URL ? e.toString() : t?.url ?? "";
|
|
3075
3152
|
}
|
|
3076
|
-
async function
|
|
3077
|
-
const r =
|
|
3153
|
+
async function yr(e, t, s, n) {
|
|
3154
|
+
const r = qe(e.headers);
|
|
3078
3155
|
n({
|
|
3079
3156
|
...t,
|
|
3080
3157
|
responseStatus: e.status,
|
|
3081
3158
|
responseHeaders: r,
|
|
3082
|
-
responseBody: await
|
|
3159
|
+
responseBody: await Ir(e),
|
|
3083
3160
|
durationMs: Date.now() - s
|
|
3084
3161
|
});
|
|
3085
3162
|
}
|
|
3086
|
-
async function
|
|
3163
|
+
async function Ir(e) {
|
|
3087
3164
|
if (!Be(e.headers))
|
|
3088
3165
|
return;
|
|
3089
3166
|
let t = null, s = null;
|
|
@@ -3093,7 +3170,7 @@ async function yr(e) {
|
|
|
3093
3170
|
const n = new Promise((a) => {
|
|
3094
3171
|
s = window.setTimeout(() => {
|
|
3095
3172
|
t?.cancel(), a("timeout");
|
|
3096
|
-
},
|
|
3173
|
+
}, Ps);
|
|
3097
3174
|
}), r = new TextDecoder();
|
|
3098
3175
|
let i = "", o = 0;
|
|
3099
3176
|
for (; ; ) {
|
|
@@ -3102,10 +3179,10 @@ async function yr(e) {
|
|
|
3102
3179
|
return;
|
|
3103
3180
|
const { done: c, value: l } = a;
|
|
3104
3181
|
if (c)
|
|
3105
|
-
return
|
|
3182
|
+
return P(i + r.decode());
|
|
3106
3183
|
const u = Ht - o;
|
|
3107
3184
|
if (l.byteLength > u)
|
|
3108
|
-
return i += r.decode(l.subarray(0, Math.max(u, 0)), { stream: !0 }), t.cancel(), `${
|
|
3185
|
+
return i += r.decode(l.subarray(0, Math.max(u, 0)), { stream: !0 }), t.cancel(), `${P(i)}... [truncated]`;
|
|
3109
3186
|
o += l.byteLength, i += r.decode(l, { stream: !0 });
|
|
3110
3187
|
}
|
|
3111
3188
|
} catch {
|
|
@@ -3115,35 +3192,35 @@ async function yr(e) {
|
|
|
3115
3192
|
s !== null && window.clearTimeout(s);
|
|
3116
3193
|
}
|
|
3117
3194
|
}
|
|
3118
|
-
function
|
|
3195
|
+
function Tr(e, t) {
|
|
3119
3196
|
if (Be(new Headers(t)))
|
|
3120
3197
|
try {
|
|
3121
|
-
return e.responseType === "" || e.responseType === "text" ?
|
|
3198
|
+
return e.responseType === "" || e.responseType === "text" ? P(e.responseText ?? "") : void 0;
|
|
3122
3199
|
} catch {
|
|
3123
3200
|
return;
|
|
3124
3201
|
}
|
|
3125
3202
|
}
|
|
3126
|
-
function
|
|
3203
|
+
function we(e) {
|
|
3127
3204
|
if (typeof e == "string")
|
|
3128
|
-
return
|
|
3205
|
+
return P(e);
|
|
3129
3206
|
}
|
|
3130
|
-
function
|
|
3131
|
-
return
|
|
3207
|
+
function wr(e) {
|
|
3208
|
+
return M({
|
|
3132
3209
|
...e,
|
|
3133
|
-
requestBody:
|
|
3134
|
-
responseBody:
|
|
3210
|
+
requestBody: Se(e.requestBody),
|
|
3211
|
+
responseBody: Se(e.responseBody)
|
|
3135
3212
|
});
|
|
3136
3213
|
}
|
|
3137
|
-
function
|
|
3214
|
+
function Se(e) {
|
|
3138
3215
|
if (typeof e != "string")
|
|
3139
3216
|
return e;
|
|
3140
3217
|
const t = e.trim();
|
|
3141
3218
|
if (!t.startsWith("{") && !t.startsWith("["))
|
|
3142
|
-
return
|
|
3219
|
+
return it(e);
|
|
3143
3220
|
try {
|
|
3144
|
-
return JSON.stringify(
|
|
3221
|
+
return JSON.stringify(M(JSON.parse(e)));
|
|
3145
3222
|
} catch {
|
|
3146
|
-
return
|
|
3223
|
+
return it(e);
|
|
3147
3224
|
}
|
|
3148
3225
|
}
|
|
3149
3226
|
function Be(e) {
|
|
@@ -3152,7 +3229,7 @@ function Be(e) {
|
|
|
3152
3229
|
const t = e.get("content-type")?.toLowerCase() ?? "", s = e.get("content-length"), n = Number(s);
|
|
3153
3230
|
return s !== null && Number.isInteger(n) && n >= 0 && n <= Ht && (t.startsWith("text/") || t.includes("json") || t.includes("javascript"));
|
|
3154
3231
|
}
|
|
3155
|
-
function
|
|
3232
|
+
function v(e, t = {}, s) {
|
|
3156
3233
|
if (Ar(s))
|
|
3157
3234
|
return !0;
|
|
3158
3235
|
const n = Object.entries(t).find(([r]) => r.toLowerCase() === "content-type")?.[1]?.toLowerCase();
|
|
@@ -3168,8 +3245,8 @@ function O(e, t = {}, s) {
|
|
|
3168
3245
|
return !0;
|
|
3169
3246
|
}
|
|
3170
3247
|
}
|
|
3171
|
-
function
|
|
3172
|
-
if (
|
|
3248
|
+
function Sr(e, t) {
|
|
3249
|
+
if (v(e))
|
|
3173
3250
|
return !0;
|
|
3174
3251
|
try {
|
|
3175
3252
|
const s = new URL(e, location.href), n = new URL(t);
|
|
@@ -3181,7 +3258,7 @@ function wr(e, t) {
|
|
|
3181
3258
|
function Ar(e) {
|
|
3182
3259
|
return e instanceof FormData || e instanceof Blob || e instanceof ArrayBuffer || ArrayBuffer.isView(e) || typeof ReadableStream < "u" && e instanceof ReadableStream;
|
|
3183
3260
|
}
|
|
3184
|
-
function
|
|
3261
|
+
function Er(e) {
|
|
3185
3262
|
const t = {};
|
|
3186
3263
|
for (const s of e.trim().split(/[\r\n]+/)) {
|
|
3187
3264
|
const n = s.indexOf(":");
|
|
@@ -3194,99 +3271,99 @@ function Sr(e) {
|
|
|
3194
3271
|
}
|
|
3195
3272
|
return t;
|
|
3196
3273
|
}
|
|
3197
|
-
function
|
|
3274
|
+
function P(e, t = Ht) {
|
|
3198
3275
|
return e.length <= t ? e : `${e.slice(0, t)}... [truncated ${e.length - t} chars]`;
|
|
3199
3276
|
}
|
|
3200
|
-
function
|
|
3277
|
+
function kt(e) {
|
|
3201
3278
|
return `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
3202
3279
|
}
|
|
3203
|
-
class
|
|
3280
|
+
class nt extends Error {
|
|
3204
3281
|
constructor(t, s) {
|
|
3205
3282
|
super(`${t} (${s})`), this.status = s, this.name = "AttachmentUploadHttpError";
|
|
3206
3283
|
}
|
|
3207
3284
|
status;
|
|
3208
3285
|
}
|
|
3209
|
-
async function
|
|
3286
|
+
async function tt(e, t) {
|
|
3210
3287
|
let s = null;
|
|
3211
|
-
for (let n = 0; n <
|
|
3288
|
+
for (let n = 0; n < ae; n += 1)
|
|
3212
3289
|
try {
|
|
3213
3290
|
return await e();
|
|
3214
3291
|
} catch (r) {
|
|
3215
|
-
if (s = r, n >=
|
|
3292
|
+
if (s = r, n >= ae - 1 || !br(r))
|
|
3216
3293
|
throw r;
|
|
3217
|
-
await
|
|
3294
|
+
await Rr(n);
|
|
3218
3295
|
}
|
|
3219
3296
|
throw s instanceof Error ? s : new Error(t);
|
|
3220
3297
|
}
|
|
3221
|
-
function
|
|
3298
|
+
function Rr(e) {
|
|
3222
3299
|
return new Promise((t) => {
|
|
3223
3300
|
window.setTimeout(t, _s[e] ?? 0);
|
|
3224
3301
|
});
|
|
3225
3302
|
}
|
|
3226
3303
|
function br(e) {
|
|
3227
|
-
return e instanceof
|
|
3304
|
+
return e instanceof nt ? Mr(e.status) : e instanceof TypeError;
|
|
3228
3305
|
}
|
|
3229
|
-
function
|
|
3306
|
+
function Mr(e) {
|
|
3230
3307
|
return e === 408 || e === 409 || e === 429 || e >= 500;
|
|
3231
3308
|
}
|
|
3232
|
-
function
|
|
3309
|
+
function kr(e) {
|
|
3233
3310
|
return e === 401 || e === 403;
|
|
3234
3311
|
}
|
|
3235
|
-
const
|
|
3236
|
-
function
|
|
3237
|
-
return
|
|
3312
|
+
const ut = "[REDACTED_SECRET]", U = "[REDACTED_TOKEN]", _r = "[REDACTED_SIGNED_URL]", Cr = 20, Pr = /^(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, He = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Fe = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, We = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, $e = /\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, Ur = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Dr = /\bhttps?:\/\/[^\s"'<>]+/gi, xr = /[),.;\]]+$/;
|
|
3313
|
+
function M(e) {
|
|
3314
|
+
return rt(e, 0, /* @__PURE__ */ new WeakSet());
|
|
3238
3315
|
}
|
|
3239
|
-
function
|
|
3316
|
+
function rt(e, t, s) {
|
|
3240
3317
|
if (typeof e == "string")
|
|
3241
|
-
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e :
|
|
3318
|
+
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : it(e);
|
|
3242
3319
|
if (e === null || typeof e != "object")
|
|
3243
3320
|
return e;
|
|
3244
|
-
if (t >=
|
|
3321
|
+
if (t >= Cr)
|
|
3245
3322
|
return "[REDACTED_MAX_DEPTH]";
|
|
3246
3323
|
if (s.has(e))
|
|
3247
3324
|
return "[REDACTED_CIRCULAR]";
|
|
3248
3325
|
if (s.add(e), Array.isArray(e))
|
|
3249
|
-
return e.map((r) =>
|
|
3326
|
+
return e.map((r) => rt(r, t + 1, s));
|
|
3250
3327
|
const n = {};
|
|
3251
3328
|
for (const [r, i] of Object.entries(e))
|
|
3252
|
-
r === "pageContent" ? n[r] = i :
|
|
3329
|
+
r === "pageContent" ? n[r] = i : je(r) ? n[r] = ut : n[r] = r.toLowerCase() === "url" ? Nr(i) : rt(i, t + 1, s);
|
|
3253
3330
|
return n;
|
|
3254
3331
|
}
|
|
3255
|
-
function
|
|
3332
|
+
function je(e) {
|
|
3256
3333
|
const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
3257
3334
|
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");
|
|
3258
3335
|
}
|
|
3259
|
-
function
|
|
3260
|
-
return typeof e == "string" ?
|
|
3336
|
+
function Nr(e) {
|
|
3337
|
+
return typeof e == "string" ? ze(e) : rt(e, 0, /* @__PURE__ */ new WeakSet());
|
|
3261
3338
|
}
|
|
3262
|
-
function
|
|
3339
|
+
function ze(e) {
|
|
3263
3340
|
try {
|
|
3264
3341
|
const t = new URL(e, location.href);
|
|
3265
3342
|
for (const s of Array.from(t.searchParams.keys()))
|
|
3266
|
-
|
|
3267
|
-
return t.username && (t.username =
|
|
3343
|
+
Pr.test(s) && t.searchParams.set(s, U);
|
|
3344
|
+
return t.username && (t.username = U), t.password && (t.password = U), t.toString();
|
|
3268
3345
|
} catch {
|
|
3269
|
-
return
|
|
3346
|
+
return Or(e);
|
|
3270
3347
|
}
|
|
3271
3348
|
}
|
|
3272
|
-
function
|
|
3273
|
-
return e.replace(Ur,
|
|
3349
|
+
function it(e) {
|
|
3350
|
+
return e.replace(Ur, _r).replace(Dr, vr).replace(He, `Bearer ${U}`).replace(Fe, `Basic ${U}`).replace(We, U).replace($e, (t, s) => `${s}: ${ut}`);
|
|
3274
3351
|
}
|
|
3275
|
-
function
|
|
3276
|
-
return e.replace(
|
|
3352
|
+
function Or(e) {
|
|
3353
|
+
return e.replace(He, `Bearer ${U}`).replace(Fe, `Basic ${U}`).replace(We, U).replace($e, (t, s) => `${s}: ${ut}`);
|
|
3277
3354
|
}
|
|
3278
|
-
function
|
|
3279
|
-
const t = e.match(
|
|
3280
|
-
return `${
|
|
3355
|
+
function vr(e) {
|
|
3356
|
+
const t = e.match(xr)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
|
|
3357
|
+
return `${ze(s)}${t}`;
|
|
3281
3358
|
}
|
|
3282
3359
|
export {
|
|
3283
3360
|
se as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
3284
3361
|
Ct as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3362
|
+
ps as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
3363
|
+
hs as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
3364
|
+
fs as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
3365
|
+
Me as PlunoProductAgent,
|
|
3366
|
+
xs as calculateReconnectDelay,
|
|
3367
|
+
Me as default,
|
|
3291
3368
|
sn as getProductAgentOriginAccessErrorMessage
|
|
3292
3369
|
};
|