@pluno/product-agent-web 0.1.27 → 0.1.29
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 +10 -0
- package/dist/product-agent-sdk.js +233 -164
- package/dist/product-agent-widget.js +36 -30
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -105,8 +105,12 @@ export declare class PlunoProductAgent {
|
|
|
105
105
|
private retryAttemptsByClientMessageId;
|
|
106
106
|
private retryTimersByClientMessageId;
|
|
107
107
|
private thinkingWatchdogTimer;
|
|
108
|
+
private runAckWatchdogTimer;
|
|
109
|
+
private runAckResyncRetryTimer;
|
|
108
110
|
private activeClientMessageId;
|
|
109
111
|
private activeUserMessageEvent;
|
|
112
|
+
private latestRecoverableClientMessageId;
|
|
113
|
+
private runAckRecoveryRetryAttemptsByClientMessageId;
|
|
110
114
|
private thinkingWatchdogResyncAttemptsByClientMessageId;
|
|
111
115
|
private thinkingWatchdogRetryAttemptsByClientMessageId;
|
|
112
116
|
private runtimeHelperJavascript;
|
|
@@ -132,6 +136,12 @@ export declare class PlunoProductAgent {
|
|
|
132
136
|
private markThinkingProgress;
|
|
133
137
|
private scheduleThinkingWatchdog;
|
|
134
138
|
private clearThinkingWatchdog;
|
|
139
|
+
private handleRunAck;
|
|
140
|
+
private scheduleRunAckWatchdog;
|
|
141
|
+
private recoverMissedRunAck;
|
|
142
|
+
private scheduleRunAckResyncRetry;
|
|
143
|
+
private clearRunAckResyncRetryTimer;
|
|
144
|
+
private clearRunAckTimers;
|
|
135
145
|
private recoverStuckThinking;
|
|
136
146
|
private resyncThinkingSession;
|
|
137
147
|
private executeToolCall;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const I = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', V = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Y = ".pluno-pa-widget__panel", Z = ".pluno-pa-widget__timeline", N = `${I}[data-pluno-sdk-preview-channel]`, Q = "https://app.pluno.ai", tt = "gpt-5.4", et = 2e4, st = 2e3, p = 6e4, nt = 15e3, D = 2, rt = 15e3, it = 5e3, ot = 1e3, _ = 1e5, at = 100, x = "pluno.productAgent.state.", E = "pluno.productAgent.pendingEvents.", O = "pluno.productAgent.transportId";
|
|
2
|
+
class L {
|
|
3
3
|
constructor(t) {
|
|
4
|
-
this.options = t, this.transportId =
|
|
4
|
+
this.options = t, this.transportId = It(), this.state = {
|
|
5
5
|
...this.state,
|
|
6
|
-
starterPrompts:
|
|
6
|
+
starterPrompts: yt(t.initialStarterPrompts)
|
|
7
7
|
};
|
|
8
|
-
const s = t.restorePersistedState === !1 ? null :
|
|
8
|
+
const s = t.restorePersistedState === !1 ? null : xt(t.clientId, t.expectedPersistedSessionId);
|
|
9
9
|
s && (this.state = {
|
|
10
10
|
...this.state,
|
|
11
11
|
...s,
|
|
@@ -14,7 +14,7 @@ class W {
|
|
|
14
14
|
assistantDraft: "",
|
|
15
15
|
isThinking: !1,
|
|
16
16
|
lastError: null
|
|
17
|
-
}), this.queuedClientEvents =
|
|
17
|
+
}), this.queuedClientEvents = Bt(t.clientId);
|
|
18
18
|
}
|
|
19
19
|
options;
|
|
20
20
|
listeners = {};
|
|
@@ -30,8 +30,12 @@ class W {
|
|
|
30
30
|
retryAttemptsByClientMessageId = {};
|
|
31
31
|
retryTimersByClientMessageId = {};
|
|
32
32
|
thinkingWatchdogTimer = null;
|
|
33
|
+
runAckWatchdogTimer = null;
|
|
34
|
+
runAckResyncRetryTimer = null;
|
|
33
35
|
activeClientMessageId = null;
|
|
34
36
|
activeUserMessageEvent = null;
|
|
37
|
+
latestRecoverableClientMessageId = null;
|
|
38
|
+
runAckRecoveryRetryAttemptsByClientMessageId = {};
|
|
35
39
|
thinkingWatchdogResyncAttemptsByClientMessageId = {};
|
|
36
40
|
thinkingWatchdogRetryAttemptsByClientMessageId = {};
|
|
37
41
|
runtimeHelperJavascript = null;
|
|
@@ -48,10 +52,10 @@ class W {
|
|
|
48
52
|
lastErrorCode: null
|
|
49
53
|
};
|
|
50
54
|
static async init(t) {
|
|
51
|
-
const s = new
|
|
55
|
+
const s = new L({
|
|
52
56
|
...t,
|
|
53
|
-
backendUrl:
|
|
54
|
-
clientId: t.clientId ??
|
|
57
|
+
backendUrl: dt(t.backendUrl ?? Q),
|
|
58
|
+
clientId: t.clientId ?? _t(),
|
|
55
59
|
model: t.model ?? tt
|
|
56
60
|
});
|
|
57
61
|
try {
|
|
@@ -78,7 +82,7 @@ class W {
|
|
|
78
82
|
return;
|
|
79
83
|
if (this.setState({ status: (this.state.status === "closed", "connecting"), lastError: null }), this.token = this.options.token ?? await this.options.tokenProvider?.() ?? null, !this.token && !this.options.webSocketFactory)
|
|
80
84
|
throw new Error("Pluno requires a token or tokenProvider");
|
|
81
|
-
const t =
|
|
85
|
+
const t = ht(this.options.backendUrl), s = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
|
|
82
86
|
this.socket = s, s.addEventListener("open", () => {
|
|
83
87
|
this.socket === s && (u("web-sdk.agent", "Pluno socket opened", {
|
|
84
88
|
queuedClientEventCount: this.queuedClientEvents.length,
|
|
@@ -118,7 +122,7 @@ class W {
|
|
|
118
122
|
const n = t.trim(), r = s.attachments ?? [];
|
|
119
123
|
if (!n && r.length === 0)
|
|
120
124
|
return;
|
|
121
|
-
const i =
|
|
125
|
+
const i = f(), a = Et(), o = {
|
|
122
126
|
id: `local-${a}`,
|
|
123
127
|
role: "user",
|
|
124
128
|
content: n,
|
|
@@ -139,7 +143,7 @@ class W {
|
|
|
139
143
|
attachments: r.length > 0 ? r : void 0,
|
|
140
144
|
page: i,
|
|
141
145
|
model: this.options.model,
|
|
142
|
-
metadata:
|
|
146
|
+
metadata: ct(this.options.metadata)
|
|
143
147
|
};
|
|
144
148
|
this.activeClientMessageId = a, this.activeUserMessageEvent = c, this.markThinkingProgress(), this.send(c);
|
|
145
149
|
}
|
|
@@ -150,7 +154,7 @@ class W {
|
|
|
150
154
|
this.state.sessionId && this.state.isThinking && this.sendNow({ type: "run.stop", sessionId: this.state.sessionId }), this.queuedClientEvents = this.queuedClientEvents.filter((t) => t.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.send({
|
|
151
155
|
type: "session.reset",
|
|
152
156
|
sessionId: this.state.sessionId ?? void 0,
|
|
153
|
-
page:
|
|
157
|
+
page: f()
|
|
154
158
|
}), this.setState({
|
|
155
159
|
sessionId: null,
|
|
156
160
|
starterPrompts: [...this.state.starterPrompts],
|
|
@@ -161,7 +165,7 @@ class W {
|
|
|
161
165
|
});
|
|
162
166
|
}
|
|
163
167
|
send(t) {
|
|
164
|
-
this.sendNow(
|
|
168
|
+
this.sendNow(y(t)) || (this.queuedClientEvents.push(t), T(this.options.clientId, this.queuedClientEvents), this.setState({ status: "reconnecting" }), this.scheduleReconnect());
|
|
165
169
|
}
|
|
166
170
|
sendNow(t) {
|
|
167
171
|
if (!this.socket || this.socket.readyState !== WebSocket.OPEN)
|
|
@@ -184,7 +188,7 @@ class W {
|
|
|
184
188
|
T(this.options.clientId, this.queuedClientEvents);
|
|
185
189
|
for (let s = 0; s < t.length; s += 1) {
|
|
186
190
|
const n = t[s];
|
|
187
|
-
if (!this.sendNow(
|
|
191
|
+
if (!this.sendNow(y(n))) {
|
|
188
192
|
this.queuedClientEvents.unshift(n, ...t.slice(s + 1)), T(this.options.clientId, this.queuedClientEvents);
|
|
189
193
|
return;
|
|
190
194
|
}
|
|
@@ -192,48 +196,57 @@ class W {
|
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
handleServerEvent(t) {
|
|
195
|
-
if (
|
|
196
|
-
|
|
199
|
+
if (t.type === "run.ack") {
|
|
200
|
+
this.handleRunAck(t);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (lt(t) && this.markThinkingProgress(), t.type === "auth.ok") {
|
|
204
|
+
const s = mt(t), n = Object.prototype.hasOwnProperty.call(t, "appearance");
|
|
197
205
|
u("web-sdk.agent", "Received auth.ok appearance", {
|
|
198
206
|
hasAppearance: n,
|
|
199
207
|
rawAppearance: t.appearance,
|
|
200
208
|
normalizedAppearance: s
|
|
201
|
-
}), this.runtimeHelperJavascript =
|
|
202
|
-
const r =
|
|
203
|
-
user:
|
|
209
|
+
}), this.runtimeHelperJavascript = Tt(t.runtimeHelpers)?.javascript ?? null;
|
|
210
|
+
const r = ft(t, "starterPrompts"), i = Object.prototype.hasOwnProperty.call(t, "starterPrompts"), a = {
|
|
211
|
+
user: St(t.user),
|
|
204
212
|
status: "connected"
|
|
205
213
|
};
|
|
206
214
|
(i || this.state.starterPrompts.length === 0) && (a.starterPrompts = r), (n || s) && (a.appearance = s), this.setState(a), this.state.sessionId && this.send({
|
|
207
215
|
type: "page.upsert",
|
|
208
216
|
sessionId: this.state.sessionId,
|
|
209
|
-
page:
|
|
217
|
+
page: f(),
|
|
210
218
|
model: this.options.model
|
|
211
219
|
});
|
|
212
220
|
return;
|
|
213
221
|
}
|
|
214
222
|
if (t.type === "conversation.state") {
|
|
215
|
-
const s = Array.isArray(t.items) ? t.items : [];
|
|
216
|
-
|
|
223
|
+
const s = Array.isArray(t.items) ? t.items : [], n = Ot(s), r = n ? null : Wt(s);
|
|
224
|
+
this.latestRecoverableClientMessageId = r, Ut(s) && this.clearRetryTimers(), this.setState({
|
|
217
225
|
sessionId: q(t.session, "id") ?? this.state.sessionId,
|
|
218
|
-
messages:
|
|
219
|
-
...
|
|
220
|
-
}),
|
|
226
|
+
messages: At(s),
|
|
227
|
+
...n ? { assistantDraft: "", isThinking: !1 } : r ? { assistantDraft: "", isThinking: !0, lastError: null } : {}
|
|
228
|
+
}), n ? this.clearThinkingWatchdog() : r && (this.activeClientMessageId = r, this.markThinkingProgress());
|
|
221
229
|
return;
|
|
222
230
|
}
|
|
223
231
|
if (t.type === "session.updated") {
|
|
224
|
-
this.setState({ sessionId: q(t.session, "id") ?? this.state.sessionId });
|
|
232
|
+
this.clearRunAckResyncRetryTimer(), this.setState({ sessionId: q(t.session, "id") ?? this.state.sessionId });
|
|
225
233
|
return;
|
|
226
234
|
}
|
|
227
235
|
if (t.type === "session.item") {
|
|
228
236
|
const s = B(t.item);
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
if (s) {
|
|
238
|
+
s.role === "assistant" && (this.clearRetryTimers(), this.clearRunAckResyncRetryTimer());
|
|
239
|
+
const n = t.item.data;
|
|
240
|
+
qt(n) && this.clearRunAckResyncRetryTimer(), this.setState({
|
|
241
|
+
messages: Nt(this.state.messages, s),
|
|
242
|
+
assistantDraft: s.role === "assistant" ? "" : this.state.assistantDraft,
|
|
243
|
+
...S(n) ? { assistantDraft: "", isThinking: !1 } : {}
|
|
244
|
+
}), S(n) && this.clearThinkingWatchdog(), this.emit("message", s);
|
|
245
|
+
}
|
|
234
246
|
return;
|
|
235
247
|
}
|
|
236
248
|
if (t.type === "chat.assistant_delta") {
|
|
249
|
+
this.clearRunAckResyncRetryTimer();
|
|
237
250
|
const s = typeof t.delta == "string" ? t.delta : "";
|
|
238
251
|
this.setState({ assistantDraft: `${this.state.assistantDraft}${s}`, isThinking: !0 }), this.markThinkingProgress(), this.emit("delta", s);
|
|
239
252
|
return;
|
|
@@ -244,7 +257,7 @@ class W {
|
|
|
244
257
|
return;
|
|
245
258
|
}
|
|
246
259
|
if (t.type === "tool.call") {
|
|
247
|
-
this.executeToolCall(t);
|
|
260
|
+
this.clearRunAckResyncRetryTimer(), this.executeToolCall(t);
|
|
248
261
|
return;
|
|
249
262
|
}
|
|
250
263
|
if (t.type === "error") {
|
|
@@ -282,7 +295,7 @@ class W {
|
|
|
282
295
|
this.retryTimersByClientMessageId = {};
|
|
283
296
|
}
|
|
284
297
|
markThinkingProgress() {
|
|
285
|
-
!this.state.isThinking || this.state.status === "closed" || this.scheduleThinkingWatchdog(
|
|
298
|
+
!this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(p), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
|
|
286
299
|
}
|
|
287
300
|
scheduleThinkingWatchdog(t) {
|
|
288
301
|
this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
|
|
@@ -290,7 +303,44 @@ class W {
|
|
|
290
303
|
}, t);
|
|
291
304
|
}
|
|
292
305
|
clearThinkingWatchdog() {
|
|
293
|
-
this.thinkingWatchdogTimer !== null && (window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = null), this.activeClientMessageId = null, this.activeUserMessageEvent = null;
|
|
306
|
+
this.thinkingWatchdogTimer !== null && (window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = null), this.clearRunAckTimers(), this.activeClientMessageId = null, this.activeUserMessageEvent = null;
|
|
307
|
+
}
|
|
308
|
+
handleRunAck(t) {
|
|
309
|
+
const s = typeof t.clientMessageId == "string" ? t.clientMessageId : null;
|
|
310
|
+
!this.state.isThinking || !s || s !== this.activeClientMessageId || (this.clearRunAckResyncRetryTimer(), this.scheduleRunAckWatchdog(s));
|
|
311
|
+
}
|
|
312
|
+
scheduleRunAckWatchdog(t) {
|
|
313
|
+
this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
|
|
314
|
+
this.runAckWatchdogTimer = null, this.recoverMissedRunAck(t);
|
|
315
|
+
}, rt);
|
|
316
|
+
}
|
|
317
|
+
recoverMissedRunAck(t) {
|
|
318
|
+
!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || (u("web-sdk.agent", "Pluno run ack missed; resyncing session", {
|
|
319
|
+
sessionId: this.state.sessionId,
|
|
320
|
+
clientMessageId: t
|
|
321
|
+
}), this.resyncThinkingSession(), this.scheduleRunAckResyncRetry(t));
|
|
322
|
+
}
|
|
323
|
+
scheduleRunAckResyncRetry(t) {
|
|
324
|
+
this.clearRunAckResyncRetryTimer(), this.runAckResyncRetryTimer = window.setTimeout(() => {
|
|
325
|
+
this.runAckResyncRetryTimer = null, !((this.runAckRecoveryRetryAttemptsByClientMessageId[t] ?? 0) >= 1) && (!this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== t || this.latestRecoverableClientMessageId !== t || (this.runAckRecoveryRetryAttemptsByClientMessageId[t] = 1, this.thinkingWatchdogRetryAttemptsByClientMessageId[t] = D, this.setState({
|
|
326
|
+
status: this.state.status === "reconnecting" ? "reconnecting" : "connected",
|
|
327
|
+
isThinking: !0,
|
|
328
|
+
lastError: null
|
|
329
|
+
}), u("web-sdk.agent", "Pluno run ack recovery retrying last user message", {
|
|
330
|
+
sessionId: this.state.sessionId,
|
|
331
|
+
clientMessageId: t
|
|
332
|
+
}), this.state.sessionId ? this.send({
|
|
333
|
+
type: "chat.retry_last_user_message",
|
|
334
|
+
sessionId: this.state.sessionId,
|
|
335
|
+
clientMessageId: t
|
|
336
|
+
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(p)));
|
|
337
|
+
}, it);
|
|
338
|
+
}
|
|
339
|
+
clearRunAckResyncRetryTimer() {
|
|
340
|
+
this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
|
|
341
|
+
}
|
|
342
|
+
clearRunAckTimers() {
|
|
343
|
+
this.runAckWatchdogTimer !== null && (window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = null), this.clearRunAckResyncRetryTimer(), this.latestRecoverableClientMessageId = null;
|
|
294
344
|
}
|
|
295
345
|
recoverStuckThinking() {
|
|
296
346
|
if (!this.state.isThinking || this.state.status === "closed")
|
|
@@ -299,7 +349,7 @@ class W {
|
|
|
299
349
|
if (!t) {
|
|
300
350
|
u("web-sdk.agent", "Pluno thinking watchdog resyncing without active message id", {
|
|
301
351
|
sessionId: this.state.sessionId
|
|
302
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
352
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(p);
|
|
303
353
|
return;
|
|
304
354
|
}
|
|
305
355
|
const s = this.thinkingWatchdogResyncAttemptsByClientMessageId[t] ?? 0, n = this.thinkingWatchdogRetryAttemptsByClientMessageId[t] ?? 0;
|
|
@@ -311,12 +361,12 @@ class W {
|
|
|
311
361
|
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(nt);
|
|
312
362
|
return;
|
|
313
363
|
}
|
|
314
|
-
if (n >=
|
|
364
|
+
if (n >= D) {
|
|
315
365
|
u("web-sdk.agent", "Pluno thinking watchdog retry limit reached; continuing resync", {
|
|
316
366
|
sessionId: this.state.sessionId,
|
|
317
367
|
clientMessageId: t,
|
|
318
368
|
retryAttempts: n
|
|
319
|
-
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(
|
|
369
|
+
}), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(p);
|
|
320
370
|
return;
|
|
321
371
|
}
|
|
322
372
|
this.thinkingWatchdogRetryAttemptsByClientMessageId[t] = n + 1, this.setState({
|
|
@@ -331,21 +381,21 @@ class W {
|
|
|
331
381
|
type: "chat.retry_last_user_message",
|
|
332
382
|
sessionId: this.state.sessionId,
|
|
333
383
|
clientMessageId: t
|
|
334
|
-
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(
|
|
384
|
+
}) : this.activeUserMessageEvent && this.send(this.activeUserMessageEvent), this.scheduleThinkingWatchdog(p);
|
|
335
385
|
}
|
|
336
386
|
resyncThinkingSession() {
|
|
337
387
|
this.state.sessionId ? this.send({
|
|
338
388
|
type: "page.upsert",
|
|
339
389
|
sessionId: this.state.sessionId,
|
|
340
|
-
page:
|
|
390
|
+
page: f(),
|
|
341
391
|
model: this.options.model
|
|
342
392
|
}) : (!this.socket || this.socket.readyState !== WebSocket.OPEN) && (this.setState({ status: "reconnecting", lastError: null }), this.scheduleReconnect());
|
|
343
393
|
}
|
|
344
394
|
async executeToolCall(t) {
|
|
345
395
|
const s = typeof t.sessionId == "string" ? t.sessionId : null, n = typeof t.callId == "string" ? t.callId : null, r = t.rawInput;
|
|
346
|
-
if (!s || !n || !
|
|
396
|
+
if (!s || !n || !Gt(r))
|
|
347
397
|
return;
|
|
348
|
-
const i = await this.executeRuntimeHelper(), a = await
|
|
398
|
+
const i = await this.executeRuntimeHelper(), a = await U(r).catch((o) => ({
|
|
349
399
|
ok: !1,
|
|
350
400
|
exception: {
|
|
351
401
|
message: o instanceof Error ? o.message : String(o)
|
|
@@ -357,14 +407,14 @@ class W {
|
|
|
357
407
|
callId: n,
|
|
358
408
|
toolName: "execute_code",
|
|
359
409
|
summary: r.summary,
|
|
360
|
-
rawInput:
|
|
361
|
-
rawOutput:
|
|
410
|
+
rawInput: y(r),
|
|
411
|
+
rawOutput: y(kt(a, i))
|
|
362
412
|
});
|
|
363
413
|
}
|
|
364
414
|
async executeRuntimeHelper() {
|
|
365
415
|
if (!this.runtimeHelperJavascript?.trim())
|
|
366
416
|
return null;
|
|
367
|
-
const t = await
|
|
417
|
+
const t = await U({
|
|
368
418
|
javascript: this.runtimeHelperJavascript
|
|
369
419
|
});
|
|
370
420
|
return t.ok === !1 ? wt(t) : null;
|
|
@@ -374,28 +424,28 @@ class W {
|
|
|
374
424
|
return;
|
|
375
425
|
const t = window.fetch.bind(window), s = XMLHttpRequest.prototype.open, n = XMLHttpRequest.prototype.setRequestHeader, r = XMLHttpRequest.prototype.send;
|
|
376
426
|
window.fetch = async (i, a) => {
|
|
377
|
-
const o = Date.now(), c = new Date(o).toISOString(), l = i instanceof Request ? i : null,
|
|
427
|
+
const o = Date.now(), c = new Date(o).toISOString(), l = i instanceof Request ? i : null, m = typeof i == "string" ? i : i instanceof URL ? i.toString() : l?.url ?? "", b = (a?.method ?? l?.method ?? "GET").toUpperCase(), M = H(new Headers(a?.headers ?? l?.headers ?? void 0)), P = await Ft(l, a);
|
|
378
428
|
try {
|
|
379
429
|
const d = await t(i, a);
|
|
380
430
|
return this.enqueueNetworkEvent({
|
|
381
|
-
requestId:
|
|
382
|
-
url:
|
|
383
|
-
method:
|
|
384
|
-
requestHeaders:
|
|
431
|
+
requestId: k("fetch"),
|
|
432
|
+
url: m,
|
|
433
|
+
method: b,
|
|
434
|
+
requestHeaders: M,
|
|
385
435
|
requestBody: P,
|
|
386
436
|
resourceType: "fetch",
|
|
387
437
|
responseStatus: d.status,
|
|
388
|
-
responseHeaders:
|
|
389
|
-
responseBody: await
|
|
438
|
+
responseHeaders: H(d.headers),
|
|
439
|
+
responseBody: await zt(d),
|
|
390
440
|
startedAt: c,
|
|
391
441
|
durationMs: Date.now() - o
|
|
392
442
|
}), d;
|
|
393
443
|
} catch (d) {
|
|
394
444
|
throw this.enqueueNetworkEvent({
|
|
395
|
-
requestId:
|
|
396
|
-
url:
|
|
397
|
-
method:
|
|
398
|
-
requestHeaders:
|
|
445
|
+
requestId: k("fetch"),
|
|
446
|
+
url: m,
|
|
447
|
+
method: b,
|
|
448
|
+
requestHeaders: M,
|
|
399
449
|
requestBody: P,
|
|
400
450
|
resourceType: "fetch",
|
|
401
451
|
errorText: d instanceof Error ? d.message : String(d),
|
|
@@ -403,15 +453,15 @@ class W {
|
|
|
403
453
|
durationMs: Date.now() - o
|
|
404
454
|
}), d;
|
|
405
455
|
}
|
|
406
|
-
}, XMLHttpRequest.prototype.open = function(a, o, c, l,
|
|
456
|
+
}, XMLHttpRequest.prototype.open = function(a, o, c, l, m) {
|
|
407
457
|
return this.__plunoMeta = {
|
|
408
|
-
requestId:
|
|
458
|
+
requestId: k("xhr"),
|
|
409
459
|
method: String(a ?? "GET").toUpperCase(),
|
|
410
460
|
url: typeof o == "string" ? o : o.toString(),
|
|
411
461
|
requestHeaders: {},
|
|
412
462
|
startedAtMs: Date.now(),
|
|
413
463
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
414
|
-
}, s.call(this, a, o, c ?? !0, l ?? void 0,
|
|
464
|
+
}, s.call(this, a, o, c ?? !0, l ?? void 0, m ?? void 0);
|
|
415
465
|
}, XMLHttpRequest.prototype.setRequestHeader = function(a, o) {
|
|
416
466
|
const c = this.__plunoMeta;
|
|
417
467
|
if (c) {
|
|
@@ -421,7 +471,7 @@ class W {
|
|
|
421
471
|
return n.call(this, a, o);
|
|
422
472
|
}, XMLHttpRequest.prototype.send = function(a) {
|
|
423
473
|
const o = window.__plunoProductAgentInstance, c = this.__plunoMeta ?? {
|
|
424
|
-
requestId:
|
|
474
|
+
requestId: k("xhr"),
|
|
425
475
|
method: "GET",
|
|
426
476
|
url: "",
|
|
427
477
|
requestHeaders: {},
|
|
@@ -439,8 +489,8 @@ class W {
|
|
|
439
489
|
requestBody: typeof this.__plunoMeta.requestBody == "string" ? this.__plunoMeta.requestBody : void 0,
|
|
440
490
|
resourceType: "xhr",
|
|
441
491
|
responseStatus: this.status,
|
|
442
|
-
responseHeaders:
|
|
443
|
-
responseBody:
|
|
492
|
+
responseHeaders: Jt(this.getAllResponseHeaders()),
|
|
493
|
+
responseBody: Xt(this),
|
|
444
494
|
errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
|
|
445
495
|
startedAt: String(this.__plunoMeta.startedAt),
|
|
446
496
|
durationMs: Date.now() - Number(this.__plunoMeta.startedAtMs ?? Date.now())
|
|
@@ -453,16 +503,16 @@ class W {
|
|
|
453
503
|
};
|
|
454
504
|
}
|
|
455
505
|
enqueueNetworkEvent(t) {
|
|
456
|
-
this.queuedNetworkEvents.push(
|
|
506
|
+
this.queuedNetworkEvents.push(y(t)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
|
|
457
507
|
this.networkBatchTimer = null;
|
|
458
508
|
const s = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
|
|
459
509
|
s.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
|
|
460
510
|
type: "network.batch",
|
|
461
511
|
sessionId: this.state.sessionId ?? void 0,
|
|
462
|
-
page:
|
|
512
|
+
page: f(),
|
|
463
513
|
events: s
|
|
464
514
|
});
|
|
465
|
-
},
|
|
515
|
+
}, ot));
|
|
466
516
|
}
|
|
467
517
|
scheduleReconnect() {
|
|
468
518
|
this.reconnectTimer !== null || this.state.status === "closed" || (this.reconnectTimer = window.setTimeout(() => {
|
|
@@ -488,7 +538,7 @@ class W {
|
|
|
488
538
|
...this.state,
|
|
489
539
|
...t,
|
|
490
540
|
...t.lastError === null && t.lastErrorCode === void 0 ? { lastErrorCode: null } : {}
|
|
491
|
-
},
|
|
541
|
+
}, Lt(this.options.clientId, this.state), this.emit("state", this.getState());
|
|
492
542
|
}
|
|
493
543
|
emit(t, s) {
|
|
494
544
|
this.listeners[t]?.forEach((r) => r(s));
|
|
@@ -505,17 +555,17 @@ function u(e, t, s) {
|
|
|
505
555
|
}, i = n.__plunoProductAgentDiagnostics__ ?? [];
|
|
506
556
|
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 }));
|
|
507
557
|
}
|
|
508
|
-
function
|
|
558
|
+
function ct(e) {
|
|
509
559
|
const t = typeof e == "function" ? e() : e;
|
|
510
560
|
return t && Object.keys(t).length > 0 ? t : void 0;
|
|
511
561
|
}
|
|
512
|
-
function
|
|
562
|
+
function lt(e) {
|
|
513
563
|
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";
|
|
514
564
|
}
|
|
515
|
-
const
|
|
516
|
-
async function
|
|
565
|
+
const ut = 5e3;
|
|
566
|
+
async function U(e) {
|
|
517
567
|
const t = Object.getPrototypeOf(async function() {
|
|
518
|
-
}).constructor, s =
|
|
568
|
+
}).constructor, s = ut, n = Date.now(), r = [], i = {
|
|
519
569
|
log: console.log,
|
|
520
570
|
info: console.info,
|
|
521
571
|
warn: console.warn,
|
|
@@ -559,15 +609,15 @@ async function D(e) {
|
|
|
559
609
|
console.log = i.log, console.info = i.info, console.warn = i.warn, console.error = i.error;
|
|
560
610
|
}
|
|
561
611
|
}
|
|
562
|
-
function
|
|
612
|
+
function dt(e) {
|
|
563
613
|
return e.replace(/\/+$/, "");
|
|
564
614
|
}
|
|
565
|
-
function
|
|
615
|
+
function ht(e) {
|
|
566
616
|
const t = new URL("/api/product-agent/embed/ws", e);
|
|
567
617
|
return t.protocol = t.protocol === "https:" ? "wss:" : "ws:", t.toString();
|
|
568
618
|
}
|
|
569
|
-
function
|
|
570
|
-
const e =
|
|
619
|
+
function f() {
|
|
620
|
+
const e = gt();
|
|
571
621
|
return {
|
|
572
622
|
url: location.href,
|
|
573
623
|
title: document.title,
|
|
@@ -575,9 +625,9 @@ function g() {
|
|
|
575
625
|
...e ? { plunoProductAgentUi: e } : {}
|
|
576
626
|
};
|
|
577
627
|
}
|
|
578
|
-
function
|
|
579
|
-
const e = document.querySelector(
|
|
580
|
-
if (!(e ?? document.querySelector(
|
|
628
|
+
function gt() {
|
|
629
|
+
const e = document.querySelector(N);
|
|
630
|
+
if (!(e ?? document.querySelector(I)))
|
|
581
631
|
return;
|
|
582
632
|
const s = e ? "browser_extension_sdk_preview" : "embedded_widget";
|
|
583
633
|
return {
|
|
@@ -586,7 +636,7 @@ function ht() {
|
|
|
586
636
|
selectors: [
|
|
587
637
|
{
|
|
588
638
|
name: "widget_host",
|
|
589
|
-
selector: s === "browser_extension_sdk_preview" ?
|
|
639
|
+
selector: s === "browser_extension_sdk_preview" ? N : I,
|
|
590
640
|
description: "Finds Pluno's shadow-host element in the host page DOM."
|
|
591
641
|
},
|
|
592
642
|
{
|
|
@@ -615,16 +665,16 @@ function pt(e) {
|
|
|
615
665
|
return { type: "error", message: "Invalid server event" };
|
|
616
666
|
}
|
|
617
667
|
}
|
|
618
|
-
function
|
|
668
|
+
function ft(e, t) {
|
|
619
669
|
if (!e || typeof e != "object")
|
|
620
670
|
return [];
|
|
621
671
|
const s = e[t];
|
|
622
672
|
return Array.isArray(s) ? s.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
|
|
623
673
|
}
|
|
624
|
-
function
|
|
674
|
+
function yt(e) {
|
|
625
675
|
return Array.isArray(e) ? e.filter((t) => typeof t == "string" && t.trim().length > 0) : [];
|
|
626
676
|
}
|
|
627
|
-
function
|
|
677
|
+
function mt(e) {
|
|
628
678
|
if (!e || typeof e != "object")
|
|
629
679
|
return null;
|
|
630
680
|
const t = e, s = t.appearance, n = s && typeof s == "object" ? s : t, r = typeof n.accentColor == "string" ? n.accentColor : null, i = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, a = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, o = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
|
|
@@ -635,13 +685,13 @@ function yt(e) {
|
|
|
635
685
|
...o !== null ? { scribbleStyle: o } : {}
|
|
636
686
|
};
|
|
637
687
|
}
|
|
638
|
-
function
|
|
688
|
+
function Tt(e) {
|
|
639
689
|
if (!e || typeof e != "object")
|
|
640
690
|
return null;
|
|
641
691
|
const t = e.javascript;
|
|
642
692
|
return typeof t != "string" || !t.trim() ? null : { javascript: t };
|
|
643
693
|
}
|
|
644
|
-
function
|
|
694
|
+
function kt(e, t) {
|
|
645
695
|
return t ? e && typeof e == "object" ? {
|
|
646
696
|
...e,
|
|
647
697
|
helperError: t
|
|
@@ -657,24 +707,24 @@ function wt(e) {
|
|
|
657
707
|
const t = e;
|
|
658
708
|
return typeof t.exception?.message == "string" ? t.exception.message : typeof t.error == "string" ? t.error : e;
|
|
659
709
|
}
|
|
660
|
-
function
|
|
710
|
+
function _t() {
|
|
661
711
|
const e = "pluno.productAgent.clientId", t = window.localStorage.getItem(e);
|
|
662
712
|
if (t)
|
|
663
713
|
return t;
|
|
664
714
|
const s = crypto.randomUUID();
|
|
665
715
|
return window.localStorage.setItem(e, s), s;
|
|
666
716
|
}
|
|
667
|
-
function
|
|
668
|
-
const e = window.sessionStorage.getItem(
|
|
717
|
+
function It() {
|
|
718
|
+
const e = window.sessionStorage.getItem(O);
|
|
669
719
|
if (e)
|
|
670
720
|
return e;
|
|
671
721
|
const t = crypto.randomUUID();
|
|
672
|
-
return window.sessionStorage.setItem(
|
|
722
|
+
return window.sessionStorage.setItem(O, t), t;
|
|
673
723
|
}
|
|
674
|
-
function
|
|
724
|
+
function Et() {
|
|
675
725
|
return crypto.randomUUID();
|
|
676
726
|
}
|
|
677
|
-
function
|
|
727
|
+
function St(e) {
|
|
678
728
|
if (!e || typeof e != "object")
|
|
679
729
|
return null;
|
|
680
730
|
const t = e, s = typeof t.id == "string" ? t.id : null;
|
|
@@ -685,7 +735,7 @@ function Et(e) {
|
|
|
685
735
|
avatarUrl: typeof t.avatarUrl == "string" ? t.avatarUrl : null
|
|
686
736
|
} : null;
|
|
687
737
|
}
|
|
688
|
-
function
|
|
738
|
+
function At(e) {
|
|
689
739
|
return Array.isArray(e) ? A(
|
|
690
740
|
e.map(B).filter((t) => t !== null)
|
|
691
741
|
) : [];
|
|
@@ -714,17 +764,17 @@ function B(e) {
|
|
|
714
764
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
715
765
|
dataType: String(n.type),
|
|
716
766
|
toolName: typeof n.name == "string" ? n.name : void 0,
|
|
717
|
-
callId:
|
|
767
|
+
callId: Mt(n) ?? void 0,
|
|
718
768
|
loading: n.localExecutionStatus === "running"
|
|
719
769
|
} : n.type === "run_status" || n.type === "run_error" ? n.type === "run_status" && (n.status === "running" || n.status === "retrying") || n.type === "run_error" && n.stage === "tool_execution" ? null : {
|
|
720
770
|
id: String(t.id ?? crypto.randomUUID()),
|
|
721
771
|
role: "system",
|
|
722
|
-
content:
|
|
772
|
+
content: Rt(n),
|
|
723
773
|
createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
|
|
724
774
|
dataType: String(n.type)
|
|
725
775
|
} : null;
|
|
726
776
|
}
|
|
727
|
-
function
|
|
777
|
+
function Rt(e) {
|
|
728
778
|
return typeof e.message == "string" && e.message.trim().length > 0 ? e.message.replace(/Product Agent/g, "Pluno") : e.type === "run_status" && e.status === "interrupted" ? "Pluno was interrupted before it could finish this message." : e.type === "run_status" && e.status === "stopped" ? "Pluno stopped." : "Pluno run status changed.";
|
|
729
779
|
}
|
|
730
780
|
function Ct(e) {
|
|
@@ -739,9 +789,9 @@ function Ct(e) {
|
|
|
739
789
|
}
|
|
740
790
|
return "Searching the web";
|
|
741
791
|
}
|
|
742
|
-
return
|
|
792
|
+
return bt(e);
|
|
743
793
|
}
|
|
744
|
-
function
|
|
794
|
+
function bt(e) {
|
|
745
795
|
if (typeof e.summary == "string" && e.summary.trim().length > 0)
|
|
746
796
|
return e.summary;
|
|
747
797
|
if (typeof e.arguments == "string")
|
|
@@ -754,7 +804,7 @@ function Rt(e) {
|
|
|
754
804
|
}
|
|
755
805
|
return typeof e.name == "string" && e.name.trim().length > 0 ? e.name : "Run tool";
|
|
756
806
|
}
|
|
757
|
-
function
|
|
807
|
+
function Mt(e) {
|
|
758
808
|
const t = e.callId ?? e.call_id;
|
|
759
809
|
return typeof t == "string" && t ? t : null;
|
|
760
810
|
}
|
|
@@ -766,14 +816,14 @@ function Pt(e) {
|
|
|
766
816
|
return typeof s.text == "string" ? s.text : typeof s.content == "string" ? s.content : "";
|
|
767
817
|
}).filter(Boolean).join("") : "";
|
|
768
818
|
}
|
|
769
|
-
function
|
|
770
|
-
const s =
|
|
819
|
+
function Nt(e, t) {
|
|
820
|
+
const s = Dt(e, t), n = s.findIndex((i) => i.id === t.id);
|
|
771
821
|
if (n === -1)
|
|
772
822
|
return A([...s, t]);
|
|
773
823
|
const r = [...s];
|
|
774
824
|
return r[n] = t, A(r);
|
|
775
825
|
}
|
|
776
|
-
function
|
|
826
|
+
function Dt(e, t) {
|
|
777
827
|
if (t.role !== "user")
|
|
778
828
|
return e;
|
|
779
829
|
const s = e.findIndex(
|
|
@@ -784,15 +834,15 @@ function Nt(e, t) {
|
|
|
784
834
|
const n = [...e];
|
|
785
835
|
return n.splice(s, 1), n;
|
|
786
836
|
}
|
|
787
|
-
function
|
|
788
|
-
const t =
|
|
789
|
-
return t === null ? !1 : e.slice(t + 1).some((s) => !s || typeof s != "object" ? !1 :
|
|
837
|
+
function Ot(e) {
|
|
838
|
+
const t = R(e);
|
|
839
|
+
return t === null ? !1 : e.slice(t + 1).some((s) => !s || typeof s != "object" ? !1 : S(s.data));
|
|
790
840
|
}
|
|
791
|
-
function
|
|
792
|
-
const t =
|
|
793
|
-
return t === null ? e.some((s) => !s || typeof s != "object" ? !1 :
|
|
841
|
+
function Ut(e) {
|
|
842
|
+
const t = R(e);
|
|
843
|
+
return t === null ? e.some((s) => !s || typeof s != "object" ? !1 : W(s.data)) : e.slice(t + 1).some((s) => !s || typeof s != "object" ? !1 : W(s.data));
|
|
794
844
|
}
|
|
795
|
-
function
|
|
845
|
+
function R(e) {
|
|
796
846
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
797
847
|
const s = e[t];
|
|
798
848
|
if (!s || typeof s != "object")
|
|
@@ -806,25 +856,44 @@ function j(e) {
|
|
|
806
856
|
}
|
|
807
857
|
return null;
|
|
808
858
|
}
|
|
809
|
-
function
|
|
859
|
+
function Wt(e) {
|
|
860
|
+
const t = R(e);
|
|
861
|
+
if (t === null)
|
|
862
|
+
return null;
|
|
863
|
+
const s = e[t];
|
|
864
|
+
if (!s || typeof s != "object")
|
|
865
|
+
return null;
|
|
866
|
+
const n = s.data;
|
|
867
|
+
if (!n || typeof n != "object")
|
|
868
|
+
return null;
|
|
869
|
+
const r = n.clientMessageId;
|
|
870
|
+
return typeof r == "string" ? r : null;
|
|
871
|
+
}
|
|
872
|
+
function W(e) {
|
|
810
873
|
if (!e || typeof e != "object")
|
|
811
874
|
return !1;
|
|
812
875
|
const t = e;
|
|
813
876
|
return t.type === "message" && t.role === "assistant";
|
|
814
877
|
}
|
|
815
|
-
function
|
|
878
|
+
function S(e) {
|
|
816
879
|
if (!e || typeof e != "object")
|
|
817
880
|
return !1;
|
|
818
881
|
const t = e;
|
|
819
882
|
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");
|
|
820
883
|
}
|
|
884
|
+
function qt(e) {
|
|
885
|
+
if (!e || typeof e != "object")
|
|
886
|
+
return !1;
|
|
887
|
+
const t = e;
|
|
888
|
+
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";
|
|
889
|
+
}
|
|
821
890
|
function A(e) {
|
|
822
|
-
return e.filter((t, s) =>
|
|
891
|
+
return e.filter((t, s) => vt(t) ? !Ht(e, s) : !0);
|
|
823
892
|
}
|
|
824
|
-
function
|
|
893
|
+
function vt(e) {
|
|
825
894
|
return e.role === "system" && (e.dataType === "run_status" || e.dataType === "run_error");
|
|
826
895
|
}
|
|
827
|
-
function
|
|
896
|
+
function Ht(e, t) {
|
|
828
897
|
for (let s = t + 1; s < e.length; s += 1) {
|
|
829
898
|
const n = e[s];
|
|
830
899
|
if (n.role === "user")
|
|
@@ -837,15 +906,15 @@ function Ut(e, t) {
|
|
|
837
906
|
function q(e, t) {
|
|
838
907
|
return e && typeof e == "object" && typeof e[t] == "string" ? e[t] : null;
|
|
839
908
|
}
|
|
840
|
-
function
|
|
909
|
+
function xt(e, t) {
|
|
841
910
|
try {
|
|
842
|
-
const s = window.localStorage.getItem(`${
|
|
911
|
+
const s = window.localStorage.getItem(`${x}${e}`);
|
|
843
912
|
if (!s)
|
|
844
913
|
return null;
|
|
845
914
|
const n = JSON.parse(s), r = typeof n.sessionId == "string" ? n.sessionId : null;
|
|
846
915
|
if (t !== void 0 && r !== t)
|
|
847
916
|
return null;
|
|
848
|
-
const i = Array.isArray(n.messages) ? n.messages.map(
|
|
917
|
+
const i = Array.isArray(n.messages) ? n.messages.map($t).filter((a) => !!a) : [];
|
|
849
918
|
return {
|
|
850
919
|
sessionId: r,
|
|
851
920
|
messages: i
|
|
@@ -854,33 +923,33 @@ function qt(e, t) {
|
|
|
854
923
|
return null;
|
|
855
924
|
}
|
|
856
925
|
}
|
|
857
|
-
function
|
|
926
|
+
function Lt(e, t) {
|
|
858
927
|
try {
|
|
859
928
|
window.localStorage.setItem(
|
|
860
|
-
`${
|
|
929
|
+
`${x}${e}`,
|
|
861
930
|
JSON.stringify({
|
|
862
931
|
sessionId: t.sessionId,
|
|
863
|
-
messages: t.messages.slice(-
|
|
932
|
+
messages: t.messages.slice(-at)
|
|
864
933
|
})
|
|
865
934
|
);
|
|
866
935
|
} catch {
|
|
867
936
|
return;
|
|
868
937
|
}
|
|
869
938
|
}
|
|
870
|
-
function
|
|
939
|
+
function Bt(e) {
|
|
871
940
|
try {
|
|
872
941
|
const t = window.localStorage.getItem(`${E}${e}`);
|
|
873
942
|
if (!t)
|
|
874
943
|
return [];
|
|
875
944
|
const s = JSON.parse(t);
|
|
876
|
-
return Array.isArray(s) ? s.filter(
|
|
945
|
+
return Array.isArray(s) ? s.filter(j) : [];
|
|
877
946
|
} catch {
|
|
878
947
|
return [];
|
|
879
948
|
}
|
|
880
949
|
}
|
|
881
950
|
function T(e, t) {
|
|
882
951
|
try {
|
|
883
|
-
const s = t.filter(
|
|
952
|
+
const s = t.filter(j);
|
|
884
953
|
if (s.length === 0) {
|
|
885
954
|
window.localStorage.removeItem(`${E}${e}`);
|
|
886
955
|
return;
|
|
@@ -893,13 +962,13 @@ function T(e, t) {
|
|
|
893
962
|
return;
|
|
894
963
|
}
|
|
895
964
|
}
|
|
896
|
-
function
|
|
965
|
+
function j(e) {
|
|
897
966
|
if (!e || typeof e != "object")
|
|
898
967
|
return !1;
|
|
899
968
|
const t = e;
|
|
900
|
-
return t.type === "chat.user_message" ? typeof t.content == "string" &&
|
|
969
|
+
return t.type === "chat.user_message" ? typeof t.content == "string" && v(t.page) : t.type === "page.upsert" || t.type === "session.reset" || t.type === "network.batch" ? v(t.page) : t.type === "tool.result" ? typeof t.sessionId == "string" && typeof t.callId == "string" && t.toolName === "execute_code" : t.type === "chat.retry_last_user_message" ? typeof t.sessionId == "string" && typeof t.clientMessageId == "string" : t.type === "run.stop" ? typeof t.sessionId == "string" : !1;
|
|
901
970
|
}
|
|
902
|
-
function
|
|
971
|
+
function v(e) {
|
|
903
972
|
if (!e || typeof e != "object")
|
|
904
973
|
return !1;
|
|
905
974
|
const t = e;
|
|
@@ -912,14 +981,14 @@ function $(e) {
|
|
|
912
981
|
if (!s || typeof s != "object")
|
|
913
982
|
return !1;
|
|
914
983
|
const n = s;
|
|
915
|
-
return typeof n.name == "string" &&
|
|
984
|
+
return typeof n.name == "string" && jt(n.mimeType) && typeof n.sizeBytes == "number" && typeof n.dataUrl == "string";
|
|
916
985
|
});
|
|
917
986
|
return t.length > 0 ? t : void 0;
|
|
918
987
|
}
|
|
919
|
-
function
|
|
988
|
+
function jt(e) {
|
|
920
989
|
return e === "image/png" || e === "image/jpeg" || e === "image/webp" || e === "image/gif" || e === "application/pdf";
|
|
921
990
|
}
|
|
922
|
-
function
|
|
991
|
+
function $t(e) {
|
|
923
992
|
if (!e || typeof e != "object")
|
|
924
993
|
return null;
|
|
925
994
|
const t = e;
|
|
@@ -933,35 +1002,35 @@ function Wt(e) {
|
|
|
933
1002
|
loading: typeof t.loading == "boolean" ? t.loading : void 0
|
|
934
1003
|
};
|
|
935
1004
|
}
|
|
936
|
-
function
|
|
1005
|
+
function Gt(e) {
|
|
937
1006
|
return !!e && typeof e == "object" && typeof e.summary == "string" && typeof e.javascript == "string";
|
|
938
1007
|
}
|
|
939
|
-
function
|
|
1008
|
+
function H(e) {
|
|
940
1009
|
const t = {};
|
|
941
1010
|
return e?.forEach((s, n) => {
|
|
942
1011
|
t[n] = s;
|
|
943
1012
|
}), t;
|
|
944
1013
|
}
|
|
945
|
-
async function
|
|
1014
|
+
async function Ft(e, t) {
|
|
946
1015
|
if (typeof t?.body < "u")
|
|
947
1016
|
return G(t.body);
|
|
948
1017
|
if (e)
|
|
949
1018
|
try {
|
|
950
|
-
return
|
|
1019
|
+
return g(await e.clone().text());
|
|
951
1020
|
} catch {
|
|
952
1021
|
return;
|
|
953
1022
|
}
|
|
954
1023
|
}
|
|
955
|
-
async function
|
|
1024
|
+
async function zt(e) {
|
|
956
1025
|
try {
|
|
957
|
-
return
|
|
1026
|
+
return g(await e.clone().text());
|
|
958
1027
|
} catch (t) {
|
|
959
1028
|
return { error: t instanceof Error ? t.message : "unavailable" };
|
|
960
1029
|
}
|
|
961
1030
|
}
|
|
962
|
-
function
|
|
1031
|
+
function Xt(e) {
|
|
963
1032
|
try {
|
|
964
|
-
return e.responseType === "" || e.responseType === "text" ?
|
|
1033
|
+
return e.responseType === "" || e.responseType === "text" ? g(e.responseText ?? "") : e.responseType === "json" ? g(JSON.stringify(e.response)) : `[unsupported xhr responseType: ${e.responseType || "unknown"}]`;
|
|
965
1034
|
} catch (t) {
|
|
966
1035
|
return { error: t instanceof Error ? t.message : "unavailable" };
|
|
967
1036
|
}
|
|
@@ -969,23 +1038,23 @@ function $t(e) {
|
|
|
969
1038
|
function G(e) {
|
|
970
1039
|
if (!(e === null || typeof e > "u")) {
|
|
971
1040
|
if (typeof e == "string")
|
|
972
|
-
return
|
|
1041
|
+
return g(e);
|
|
973
1042
|
if (e instanceof URLSearchParams)
|
|
974
|
-
return
|
|
1043
|
+
return g(e.toString());
|
|
975
1044
|
if (e instanceof FormData) {
|
|
976
1045
|
const t = [];
|
|
977
|
-
return e.forEach((s, n) => t.push([n, s instanceof File ? `[file:${s.name}]` : String(s)])),
|
|
1046
|
+
return e.forEach((s, n) => t.push([n, s instanceof File ? `[file:${s.name}]` : String(s)])), g(JSON.stringify(t));
|
|
978
1047
|
}
|
|
979
1048
|
if (e instanceof Blob)
|
|
980
1049
|
return `[blob:${e.type || "application/octet-stream"}:${e.size}]`;
|
|
981
1050
|
try {
|
|
982
|
-
return
|
|
1051
|
+
return g(JSON.stringify(e));
|
|
983
1052
|
} catch {
|
|
984
1053
|
return `[unserializable body: ${Object.prototype.toString.call(e)}]`;
|
|
985
1054
|
}
|
|
986
1055
|
}
|
|
987
1056
|
}
|
|
988
|
-
function
|
|
1057
|
+
function Jt(e) {
|
|
989
1058
|
const t = {};
|
|
990
1059
|
for (const s of e.trim().split(/[\r\n]+/)) {
|
|
991
1060
|
const n = s.indexOf(":");
|
|
@@ -993,65 +1062,65 @@ function Gt(e) {
|
|
|
993
1062
|
}
|
|
994
1063
|
return t;
|
|
995
1064
|
}
|
|
996
|
-
function
|
|
1065
|
+
function g(e) {
|
|
997
1066
|
return e.length <= _ ? e : `${e.slice(0, _)}... [truncated ${e.length - _} chars]`;
|
|
998
1067
|
}
|
|
999
|
-
function
|
|
1068
|
+
function k(e) {
|
|
1000
1069
|
return `${e}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1001
1070
|
}
|
|
1002
|
-
const C = "[REDACTED_SECRET]", h = "[REDACTED_TOKEN]",
|
|
1003
|
-
function
|
|
1004
|
-
return
|
|
1071
|
+
const C = "[REDACTED_SECRET]", h = "[REDACTED_TOKEN]", Kt = "[REDACTED_SIGNED_URL]", Vt = 20, Yt = /^(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, F = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, z = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, X = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, J = /\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, Zt = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Qt = /\bhttps?:\/\/[^\s"'<>]+/gi, te = /[),.;\]]+$/;
|
|
1072
|
+
function y(e) {
|
|
1073
|
+
return w(e, 0, /* @__PURE__ */ new WeakSet());
|
|
1005
1074
|
}
|
|
1006
|
-
function
|
|
1075
|
+
function w(e, t, s) {
|
|
1007
1076
|
if (typeof e == "string")
|
|
1008
|
-
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e :
|
|
1077
|
+
return e.startsWith("data:image/") || e.startsWith("data:application/pdf;") ? e : ne(e);
|
|
1009
1078
|
if (e === null || typeof e != "object")
|
|
1010
1079
|
return e;
|
|
1011
|
-
if (t >=
|
|
1080
|
+
if (t >= Vt)
|
|
1012
1081
|
return "[REDACTED_MAX_DEPTH]";
|
|
1013
1082
|
if (s.has(e))
|
|
1014
1083
|
return "[REDACTED_CIRCULAR]";
|
|
1015
1084
|
if (s.add(e), Array.isArray(e))
|
|
1016
|
-
return e.map((r) =>
|
|
1085
|
+
return e.map((r) => w(r, t + 1, s));
|
|
1017
1086
|
const n = {};
|
|
1018
1087
|
for (const [r, i] of Object.entries(e))
|
|
1019
|
-
|
|
1088
|
+
ee(r) ? n[r] = C : n[r] = r.toLowerCase() === "url" ? se(i) : w(i, t + 1, s);
|
|
1020
1089
|
return n;
|
|
1021
1090
|
}
|
|
1022
|
-
function
|
|
1091
|
+
function ee(e) {
|
|
1023
1092
|
const t = e.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
1024
1093
|
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");
|
|
1025
1094
|
}
|
|
1026
|
-
function
|
|
1027
|
-
return typeof e == "string" ? K(e) :
|
|
1095
|
+
function se(e) {
|
|
1096
|
+
return typeof e == "string" ? K(e) : w(e, 0, /* @__PURE__ */ new WeakSet());
|
|
1028
1097
|
}
|
|
1029
1098
|
function K(e) {
|
|
1030
1099
|
try {
|
|
1031
1100
|
const t = new URL(e, location.href);
|
|
1032
1101
|
for (const s of Array.from(t.searchParams.keys()))
|
|
1033
|
-
|
|
1102
|
+
Yt.test(s) && t.searchParams.set(s, h);
|
|
1034
1103
|
return t.username && (t.username = h), t.password && (t.password = h), t.toString();
|
|
1035
1104
|
} catch {
|
|
1036
|
-
return
|
|
1105
|
+
return re(e);
|
|
1037
1106
|
}
|
|
1038
1107
|
}
|
|
1039
|
-
function
|
|
1040
|
-
return e.replace(
|
|
1108
|
+
function ne(e) {
|
|
1109
|
+
return e.replace(Zt, Kt).replace(Qt, ie).replace(F, `Bearer ${h}`).replace(z, `Basic ${h}`).replace(X, h).replace(J, (t, s) => `${s}: ${C}`);
|
|
1041
1110
|
}
|
|
1042
|
-
function
|
|
1111
|
+
function re(e) {
|
|
1043
1112
|
return e.replace(F, `Bearer ${h}`).replace(z, `Basic ${h}`).replace(X, h).replace(J, (t, s) => `${s}: ${C}`);
|
|
1044
1113
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const t = e.match(
|
|
1114
|
+
function ie(e) {
|
|
1115
|
+
const t = e.match(te)?.[0] ?? "", s = t ? e.slice(0, -t.length) : e;
|
|
1047
1116
|
return `${K(s)}${t}`;
|
|
1048
1117
|
}
|
|
1049
1118
|
export {
|
|
1050
|
-
|
|
1051
|
-
|
|
1119
|
+
N as PLUNO_PRODUCT_AGENT_SDK_PREVIEW_HOST_SELECTOR,
|
|
1120
|
+
I as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
|
|
1052
1121
|
Y as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
|
|
1053
1122
|
V as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
|
|
1054
1123
|
Z as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
|
|
1055
|
-
|
|
1056
|
-
|
|
1124
|
+
L as PlunoProductAgent,
|
|
1125
|
+
L as default
|
|
1057
1126
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlunoProductAgent as
|
|
1
|
+
import { PlunoProductAgent as jt } from "./product-agent-sdk.js";
|
|
2
2
|
const Kt = "#7c3aed";
|
|
3
3
|
function Yt(e) {
|
|
4
4
|
const t = en(e);
|
|
@@ -78,15 +78,15 @@ function Yt(e) {
|
|
|
78
78
|
function Xt(e) {
|
|
79
79
|
return `data:image/svg+xml,${encodeURIComponent(Yt(e))}`;
|
|
80
80
|
}
|
|
81
|
-
const X = "#2c2a1e",
|
|
81
|
+
const X = "#2c2a1e", qe = [253, 250, 241], je = 3.5;
|
|
82
82
|
function bt(e) {
|
|
83
83
|
const t = wt(e);
|
|
84
|
-
if (Ke(ae(t),
|
|
84
|
+
if (Ke(ae(t), qe) >= je)
|
|
85
85
|
return t;
|
|
86
86
|
let o = ae(t);
|
|
87
87
|
const a = ae(X);
|
|
88
88
|
for (let i = 0; i < 6; i += 1)
|
|
89
|
-
if (o = tn(o, a, 0.22), Ke(o,
|
|
89
|
+
if (o = tn(o, a, 0.22), Ke(o, qe) >= je)
|
|
90
90
|
return Le(o);
|
|
91
91
|
return Le(o);
|
|
92
92
|
}
|
|
@@ -427,7 +427,7 @@ async function Vn(e = {}) {
|
|
|
427
427
|
return u.token;
|
|
428
428
|
}), R = window.fetch.bind(window);
|
|
429
429
|
let w;
|
|
430
|
-
w = await
|
|
430
|
+
w = await jt.init({
|
|
431
431
|
token: t.token,
|
|
432
432
|
tokenProvider: I,
|
|
433
433
|
backendUrl: t.backendUrl,
|
|
@@ -442,8 +442,8 @@ async function Vn(e = {}) {
|
|
|
442
442
|
webSocketFactory: t.webSocketFactory,
|
|
443
443
|
autoConnect: t.loginRequired ? !1 : void 0
|
|
444
444
|
});
|
|
445
|
-
const H = Vo(t), ge = new Set(H.openToolGroupKeys),
|
|
446
|
-
let he = H.sharePromptsDisabled || await
|
|
445
|
+
const H = Vo(t), ge = new Set(H.openToolGroupKeys), q = new Set(H.seenShareCandidateIds), ie = new Set(q);
|
|
446
|
+
let he = H.sharePromptsDisabled || await qo(t), F = t.movableLauncher ? H.launcherPosition : null, Oe = F !== null, G = null, me = !1;
|
|
447
447
|
const Ut = () => {
|
|
448
448
|
me || typeof document > "u" || (gt(o, t.accentColor), n.isConnected || p.body?.appendChild(n));
|
|
449
449
|
}, Be = new MutationObserver(Ut);
|
|
@@ -461,7 +461,7 @@ async function Vn(e = {}) {
|
|
|
461
461
|
composerValue: g.value,
|
|
462
462
|
openToolGroupKeys: [...ge],
|
|
463
463
|
launcherPosition: Oe ? F : null,
|
|
464
|
-
seenShareCandidateIds: [...
|
|
464
|
+
seenShareCandidateIds: [...q].slice(-xt),
|
|
465
465
|
sharePromptsDisabled: he
|
|
466
466
|
});
|
|
467
467
|
}, W = (r, u = {}) => {
|
|
@@ -506,7 +506,7 @@ async function Vn(e = {}) {
|
|
|
506
506
|
};
|
|
507
507
|
let ze = () => {
|
|
508
508
|
};
|
|
509
|
-
window.addEventListener("resize", Ue), t.movableLauncher && d ? (re(), ze =
|
|
509
|
+
window.addEventListener("resize", Ue), t.movableLauncher && d ? (re(), ze = jn({
|
|
510
510
|
root: a,
|
|
511
511
|
launcher: c,
|
|
512
512
|
launcherDragHandle: d,
|
|
@@ -530,7 +530,7 @@ async function Vn(e = {}) {
|
|
|
530
530
|
be = !1;
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
-
},
|
|
533
|
+
}, j = (r = "", u = !0) => {
|
|
534
534
|
Ge(), G !== null && (window.clearTimeout(G), G = null), f.hidden = !1, v.hidden = !1, a.classList.remove("pluno-pa-widget--closing");
|
|
535
535
|
const A = re(), ne = at(a, A, t.position);
|
|
536
536
|
if (Fe(ne, A), W("Opening launcher at clamped open panel position", { openPanelPosition: ne, visibleLauncherPosition: A }), !u) {
|
|
@@ -548,18 +548,18 @@ async function Vn(e = {}) {
|
|
|
548
548
|
}, 220);
|
|
549
549
|
};
|
|
550
550
|
c.addEventListener("submit", (r) => {
|
|
551
|
-
r.preventDefault(),
|
|
551
|
+
r.preventDefault(), j(s.value), s.value = "";
|
|
552
552
|
}), d?.addEventListener("click", (r) => {
|
|
553
553
|
r.preventDefault(), r.stopPropagation();
|
|
554
554
|
}), c.addEventListener("click", (r) => {
|
|
555
|
-
r.target === s && !d || (
|
|
555
|
+
r.target === s && !d || (j(s.value), s.value = "");
|
|
556
556
|
}), s.addEventListener("focus", () => {
|
|
557
|
-
|
|
557
|
+
j(s.value), s.value = "";
|
|
558
558
|
}), s.addEventListener("input", () => {
|
|
559
559
|
if (!s.value)
|
|
560
560
|
return;
|
|
561
561
|
const r = s.value;
|
|
562
|
-
|
|
562
|
+
j(r), s.value = "";
|
|
563
563
|
}), v.addEventListener("click", zt);
|
|
564
564
|
const O = () => {
|
|
565
565
|
h.disabled = $(t.billingStatus) || !w.getState().isThinking && g.value.trim().length === 0 && b.length === 0;
|
|
@@ -626,7 +626,7 @@ async function Vn(e = {}) {
|
|
|
626
626
|
}
|
|
627
627
|
}), a.addEventListener("click", (r) => {
|
|
628
628
|
(r.target instanceof Element ? r.target : null)?.closest("a[href]") && M();
|
|
629
|
-
}), H.composerValue && (g.value = H.composerValue, oe(g)), H.isOpen &&
|
|
629
|
+
}), H.composerValue && (g.value = H.composerValue, oe(g)), H.isOpen && j(g.value, !1);
|
|
630
630
|
const $e = () => i;
|
|
631
631
|
let we = w.getState().appearance !== null, le = null, te = null, K = null, He = w.getState().isThinking, Y = null, _e = null, We = () => {
|
|
632
632
|
};
|
|
@@ -654,16 +654,16 @@ async function Vn(e = {}) {
|
|
|
654
654
|
draftingCandidateId: le,
|
|
655
655
|
error: te,
|
|
656
656
|
onSeen: (u) => {
|
|
657
|
-
|
|
657
|
+
q.add(u.id), M();
|
|
658
658
|
},
|
|
659
659
|
onDraft: (u) => {
|
|
660
|
-
|
|
660
|
+
qt(u);
|
|
661
661
|
},
|
|
662
662
|
onDismiss: (u) => {
|
|
663
|
-
|
|
663
|
+
q.add(u.id), ie.add(u.id), M(), te = null, T(w.getState());
|
|
664
664
|
},
|
|
665
665
|
onDisable: (u) => {
|
|
666
|
-
he = !0,
|
|
666
|
+
he = !0, q.add(u.id), ie.add(u.id), M(), jo(t, !0), te = null, T(w.getState());
|
|
667
667
|
}
|
|
668
668
|
} : void 0
|
|
669
669
|
);
|
|
@@ -693,13 +693,13 @@ async function Vn(e = {}) {
|
|
|
693
693
|
), O());
|
|
694
694
|
},
|
|
695
695
|
openPanel: () => {
|
|
696
|
-
|
|
696
|
+
j(g.value, !1);
|
|
697
697
|
},
|
|
698
698
|
destroy: () => {
|
|
699
699
|
me = !0, Be.disconnect(), window.removeEventListener("resize", Ue), ze(), C !== null && window.clearTimeout(C), We(), K?.remove(), w.destroy(), n.remove();
|
|
700
700
|
}
|
|
701
701
|
};
|
|
702
|
-
async function
|
|
702
|
+
async function qt(r) {
|
|
703
703
|
if (!le) {
|
|
704
704
|
le = r.id, te = null, T(w.getState());
|
|
705
705
|
try {
|
|
@@ -708,7 +708,7 @@ async function Vn(e = {}) {
|
|
|
708
708
|
const u = await t.socialPostDraftHandler(r);
|
|
709
709
|
if (!u.linkedinPost || !u.xPost)
|
|
710
710
|
throw new Error("Pluno did not return a complete social post draft.");
|
|
711
|
-
|
|
711
|
+
q.add(r.id), ie.add(r.id), M(), K?.remove(), K = Io(u, {
|
|
712
712
|
socialPostRewardsUrl: t.socialPostRewardsUrl,
|
|
713
713
|
onClose: () => {
|
|
714
714
|
K?.remove(), K = null;
|
|
@@ -745,12 +745,12 @@ function tt(e, t) {
|
|
|
745
745
|
function nt(e, t, n) {
|
|
746
746
|
e.classList.toggle("pluno-pa-widget--dark", n.colorScheme === "dark"), e.classList.toggle("pluno-pa-widget--light", n.colorScheme !== "dark"), e.classList.toggle("pluno-pa-widget--scribble", n.scribbleStyle);
|
|
747
747
|
const o = n.scribbleStyle ? bt(n.accentColor) : n.accentColor;
|
|
748
|
-
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? Nn : n.fontFamily, n.scribbleStyle &&
|
|
748
|
+
e.style.setProperty("--pluno-pa-accent", o), e.style.fontFamily = n.scribbleStyle ? Nn : n.fontFamily, n.scribbleStyle && qn(e.ownerDocument);
|
|
749
749
|
const a = Array.from(e.querySelectorAll(".pluno-pa-widget__character"));
|
|
750
750
|
for (const i of a)
|
|
751
751
|
i.src = t;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function qn(e) {
|
|
754
754
|
if (e.getElementById(Qe))
|
|
755
755
|
return;
|
|
756
756
|
const t = e.createElement("style");
|
|
@@ -762,7 +762,7 @@ function jn(e) {
|
|
|
762
762
|
src: url("https://fonts.gstatic.com/s/architectsdaughter/v20/KtkxAKiDZI_td1Lkx62xHZHDtgO_Y-bvTYlg4-7jA-U.woff2") format("woff2");
|
|
763
763
|
}`, e.head.appendChild(t), e.fonts?.load('16px "Architects Daughter"');
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function jn({
|
|
766
766
|
root: e,
|
|
767
767
|
launcher: t,
|
|
768
768
|
launcherDragHandle: n,
|
|
@@ -1530,8 +1530,8 @@ function Fo(e, t, n, o) {
|
|
|
1530
1530
|
const i = document.createElement("img");
|
|
1531
1531
|
i.className = "pluno-pa-widget__character pluno-pa-widget__character--tool-group", i.src = o, i.alt = "", i.setAttribute("aria-hidden", "true"), a.appendChild(i);
|
|
1532
1532
|
const l = document.createElement("details"), p = zo(e);
|
|
1533
|
-
l.open = t.has(p), l.addEventListener("toggle", () => {
|
|
1534
|
-
l.open ? t.add(p) : t.delete(p), n();
|
|
1533
|
+
l.open = t.has(p), a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.addEventListener("toggle", () => {
|
|
1534
|
+
a.classList.toggle("pluno-pa-widget__tool-group--open", l.open), l.open ? t.add(p) : t.delete(p), n();
|
|
1535
1535
|
});
|
|
1536
1536
|
const c = document.createElement("summary");
|
|
1537
1537
|
c.className = "pluno-pa-widget__tool-summary", e.some((f) => f.loading) && c.appendChild(Me());
|
|
@@ -1568,7 +1568,7 @@ function Rt() {
|
|
|
1568
1568
|
return n.textContent = "Thinking...", e.appendChild(n), e;
|
|
1569
1569
|
}
|
|
1570
1570
|
function zo(e) {
|
|
1571
|
-
return `tools:${e
|
|
1571
|
+
return `tools:${e[0]?.id ?? ""}`;
|
|
1572
1572
|
}
|
|
1573
1573
|
function Me() {
|
|
1574
1574
|
const e = document.createElement("span");
|
|
@@ -3151,6 +3151,12 @@ function gt(e, t) {
|
|
|
3151
3151
|
align-items: center;
|
|
3152
3152
|
margin-bottom: -8px;
|
|
3153
3153
|
}
|
|
3154
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__assistant-marker:not(.pluno-pa-widget__thinking-marker) {
|
|
3155
|
+
margin-bottom: -12px;
|
|
3156
|
+
}
|
|
3157
|
+
.pluno-pa-widget--scribble .pluno-pa-widget__tool-group.pluno-pa-widget__tool-group--open {
|
|
3158
|
+
align-items: flex-start;
|
|
3159
|
+
}
|
|
3154
3160
|
.pluno-pa-widget--scribble .pluno-pa-widget__tool-group details {
|
|
3155
3161
|
transform: translateY(-3px);
|
|
3156
3162
|
}
|
|
@@ -3408,7 +3414,7 @@ function Vo(e) {
|
|
|
3408
3414
|
return ht();
|
|
3409
3415
|
}
|
|
3410
3416
|
}
|
|
3411
|
-
async function
|
|
3417
|
+
async function qo(e) {
|
|
3412
3418
|
if (e.loadSharePromptsDisabled)
|
|
3413
3419
|
return e.loadSharePromptsDisabled();
|
|
3414
3420
|
try {
|
|
@@ -3417,7 +3423,7 @@ async function jo(e) {
|
|
|
3417
3423
|
return !1;
|
|
3418
3424
|
}
|
|
3419
3425
|
}
|
|
3420
|
-
function
|
|
3426
|
+
function jo(e, t) {
|
|
3421
3427
|
if (e.persistSharePromptsDisabled) {
|
|
3422
3428
|
Promise.resolve(e.persistSharePromptsDisabled(t)).catch(() => {
|
|
3423
3429
|
});
|
package/package.json
CHANGED