@pluno/product-agent-web 0.1.210 → 0.1.211

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.
@@ -1,16 +1,187 @@
1
- function hs(s) {
1
+ class Qs {
2
+ constructor(e, t, n) {
3
+ this.handlers = e, this.accept = t, this.errorAdapter = n;
4
+ }
5
+ handlers;
6
+ accept;
7
+ errorAdapter;
8
+ disposed = !1;
9
+ run(e) {
10
+ for (const t of e) this.runEffect(t);
11
+ }
12
+ dispose() {
13
+ this.disposed = !0;
14
+ }
15
+ runEffect(e) {
16
+ const t = this.handlers[e.kind];
17
+ Promise.resolve().then(() => {
18
+ if (!this.disposed)
19
+ return t(e.input);
20
+ }).then(
21
+ (n) => {
22
+ this.disposed || this.accept({
23
+ type: "effect.completed",
24
+ effectId: e.id,
25
+ effectKind: e.kind,
26
+ output: n
27
+ });
28
+ },
29
+ (n) => {
30
+ this.disposed || this.accept({
31
+ type: "effect.failed",
32
+ effectId: e.id,
33
+ effectKind: e.kind,
34
+ error: this.errorAdapter(n)
35
+ });
36
+ }
37
+ );
38
+ }
39
+ }
40
+ class Js {
41
+ state;
42
+ reducer;
43
+ selector;
44
+ effectRunner;
45
+ listeners = /* @__PURE__ */ new Set();
46
+ queue = [];
47
+ draining = !1;
48
+ disposed = !1;
49
+ constructor(e) {
50
+ this.state = e.initialState, this.reducer = e.reducer, this.selector = e.selector, this.effectRunner = new Qs(
51
+ e.effectHandlers,
52
+ (t) => this.acceptEffectResult(t),
53
+ e.errorAdapter
54
+ );
55
+ }
56
+ dispatch(e) {
57
+ return this.disposed ? Promise.reject(new Error("Product Agent engine is disposed.")) : new Promise((t, n) => {
58
+ this.queue.push({ source: "command", value: e, resolve: t, reject: n }), this.drain();
59
+ });
60
+ }
61
+ accept(e) {
62
+ this.disposed || (this.queue.push({ source: "event", value: e }), this.drain());
63
+ }
64
+ getState() {
65
+ return this.state;
66
+ }
67
+ getProjection() {
68
+ return this.selector(this.state);
69
+ }
70
+ subscribe(e) {
71
+ if (this.disposed) throw new Error("Product Agent engine is disposed.");
72
+ return this.listeners.add(e), e(this.getProjection()), () => this.listeners.delete(e);
73
+ }
74
+ dispose() {
75
+ if (this.disposed) return;
76
+ this.disposed = !0, this.effectRunner.dispose(), this.listeners.clear();
77
+ const e = this.queue.splice(0);
78
+ for (const t of e)
79
+ t.source === "command" && t.reject(new Error("Product Agent engine is disposed."));
80
+ }
81
+ acceptEffectResult(e) {
82
+ this.disposed || (this.queue.push({ source: "event", value: e }), this.drain());
83
+ }
84
+ drain() {
85
+ if (!(this.draining || this.disposed)) {
86
+ this.draining = !0;
87
+ try {
88
+ for (; this.queue.length > 0 && !this.disposed; ) {
89
+ const e = this.queue.shift();
90
+ if (e)
91
+ try {
92
+ const t = this.reducer(this.state, {
93
+ source: e.source,
94
+ value: e.value
95
+ }), n = t.state !== this.state;
96
+ this.state = t.state, n && this.publish(), this.effectRunner.run(t.effects), e.source === "command" && e.resolve();
97
+ } catch (t) {
98
+ if (e.source === "command") e.reject(t);
99
+ else throw t;
100
+ }
101
+ }
102
+ } finally {
103
+ this.draining = !1;
104
+ }
105
+ }
106
+ }
107
+ publish() {
108
+ const e = this.getProjection();
109
+ for (const t of this.listeners) t(e);
110
+ }
111
+ }
112
+ function it(s) {
113
+ if (s === null || typeof s == "string" || typeof s == "boolean") return !0;
114
+ if (typeof s == "number") return Number.isFinite(s);
115
+ if (Array.isArray(s)) return s.every(it);
116
+ if (typeof s != "object") return !1;
117
+ const e = Object.getPrototypeOf(s);
118
+ return e !== Object.prototype && e !== null ? !1 : Object.values(s).every(it);
119
+ }
120
+ function Xs(s) {
121
+ if (s.details !== void 0 && !it(s.details))
122
+ throw new TypeError("Product Agent transported error details must be JSON-safe.");
123
+ return {
124
+ code: s.code,
125
+ message: s.message,
126
+ retryable: s.retryable,
127
+ ...s.details === void 0 ? {} : { details: s.details }
128
+ };
129
+ }
130
+ const Ys = Object.freeze({
131
+ modelSelection: "legacy",
132
+ directory: "legacy",
133
+ conversation: "legacy",
134
+ account: "legacy",
135
+ interactions: "legacy",
136
+ browserExecution: "legacy"
137
+ });
138
+ function Ut(s, e) {
139
+ const t = Ys[s], n = e[t];
140
+ if (!n) throw new Error(`No ${t} implementation for ${s}.`);
141
+ return n();
142
+ }
143
+ class Zs {
144
+ // Stage 3 installs the Stage 1 engine/runner without shadow copies of legacy product slices.
145
+ engine = new Js({
146
+ initialState: Object.freeze({ revision: 0, slices: Object.freeze({}) }),
147
+ reducer: (e) => ({ state: e, effects: [] }),
148
+ selector: (e) => e,
149
+ effectHandlers: {},
150
+ errorAdapter: (e) => Xs({
151
+ code: "runtime_error",
152
+ message: e instanceof Error ? e.message : String(e),
153
+ retryable: !1
154
+ })
155
+ });
156
+ disposed = !1;
157
+ get isDisposed() {
158
+ return this.disposed;
159
+ }
160
+ route(e, t) {
161
+ if (this.disposed) throw new Error("Product Agent runtime is disposed.");
162
+ return Ut(e, t);
163
+ }
164
+ project(e, t) {
165
+ return Ut(e, t);
166
+ }
167
+ dispose() {
168
+ this.disposed = !0, this.engine.dispose();
169
+ }
170
+ }
171
+ const Dt = 500;
172
+ function fs(s) {
2
173
  const e = s.replace(/\n\s*at\s[\s\S]*$/, "").replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/g, "[REDACTED]").replace(/\b(?:set-cookie|cookie)\s*[:=]\s*[^\n]+/gi, "cookie=[REDACTED]").replace(/\bdata:[^\s<>"']+/gi, "[DATA]").replace(/\b(?:https?:\/\/|www\.)[^\s<>"']+/gi, "[URL]").replace(/\b(?:Bearer|Basic)\s+[^\s,;"']+/gi, "[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?/g, "[REDACTED]").replace(/\b(?:sk|pk|ghp|gho|github_pat|xoxb|xoxp)[-_][A-Za-z0-9_-]{8,}/g, "[REDACTED]").replace(/\b((?:access|refresh|id|auth)[_-]?token|api[_-]?key|client[_-]?secret|password|passwd|pwd|secret|token|jwt|authorization|cookie|set-cookie)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;}&]+)/gi, "$1=[REDACTED]").replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "[EMAIL]").replace(/(?:[A-Z]:[\\/]|\\\\|(?:~|\.\.?)?\/|[\w.-]+[\\/])[^\s<>"']+/gi, "[FILE]").replace(new RegExp("(?<![\\w.])(?:[\\w.-]+\\.[A-Z][A-Z0-9]{0,15}|\\.[A-Z][\\w.-]*)\\b", "gi"), "[FILE]").replace(/\s+/g, " ").trim();
3
- return e.length > 500 ? `${e.slice(0, 499)}…` : e;
174
+ return e.length > Dt ? `${e.slice(0, Dt - 1)}…` : e;
4
175
  }
5
- const Ks = "pluno-product-agent-attachments", Gs = 1, it = "files", Qs = 1440 * 60 * 1e3;
6
- async function Vs(s) {
7
- const e = await mt();
8
- await Ys(e, "readwrite", (t) => t.put(s));
176
+ const en = "pluno-product-agent-attachments", tn = 1, rt = "files", sn = 1440 * 60 * 1e3;
177
+ async function nn(s) {
178
+ const e = await yt();
179
+ await an(e, "readwrite", (t) => t.put(s));
9
180
  }
10
- async function Xs(s, e) {
11
- const t = await mt();
12
- await yt(t, "readwrite", async (n) => {
13
- const i = await It(
181
+ async function rn(s, e) {
182
+ const t = await yt();
183
+ await It(t, "readwrite", async (n) => {
184
+ const i = await St(
14
185
  n.get(s)
15
186
  );
16
187
  i && n.put({
@@ -19,28 +190,28 @@ async function Xs(s, e) {
19
190
  });
20
191
  });
21
192
  }
22
- async function Js(s = Qs) {
23
- const e = await mt(), t = Date.now() - s;
24
- await yt(e, "readwrite", async (n) => {
193
+ async function on(s = sn) {
194
+ const e = await yt(), t = Date.now() - s;
195
+ await It(e, "readwrite", async (n) => {
25
196
  const i = n.index("lastUsedAt");
26
- (await It(i.getAllKeys(IDBKeyRange.upperBound(t)))).forEach((o) => n.delete(o));
197
+ (await St(i.getAllKeys(IDBKeyRange.upperBound(t)))).forEach((o) => n.delete(o));
27
198
  });
28
199
  }
29
- function mt() {
200
+ function yt() {
30
201
  return typeof indexedDB > "u" ? Promise.reject(new Error("Product Agent attachment storage is unavailable")) : new Promise((s, e) => {
31
- const t = indexedDB.open(Ks, Gs);
202
+ const t = indexedDB.open(en, tn);
32
203
  t.onupgradeneeded = () => {
33
- const i = t.result.createObjectStore(it, { keyPath: "attachmentId" });
204
+ const i = t.result.createObjectStore(rt, { keyPath: "attachmentId" });
34
205
  i.createIndex("lastUsedAt", "lastUsedAt", { unique: !1 }), i.createIndex("sessionId", "sessionId", { unique: !1 }), i.createIndex("origin", "origin", { unique: !1 });
35
206
  }, t.onsuccess = () => s(t.result), t.onerror = () => e(t.error ?? new Error("Failed to open Product Agent attachment storage"));
36
207
  });
37
208
  }
38
- async function Ys(s, e, t) {
39
- return await yt(s, e, async (n) => await It(t(n)));
209
+ async function an(s, e, t) {
210
+ return await It(s, e, async (n) => await St(t(n)));
40
211
  }
41
- function yt(s, e, t) {
212
+ function It(s, e, t) {
42
213
  return new Promise((n, i) => {
43
- const r = s.transaction(it, e), o = r.objectStore(it);
214
+ const r = s.transaction(rt, e), o = r.objectStore(rt);
44
215
  let a, l = !1;
45
216
  t(o).then((c) => {
46
217
  a = c;
@@ -60,16 +231,16 @@ function yt(s, e, t) {
60
231
  };
61
232
  });
62
233
  }
63
- function It(s) {
234
+ function St(s) {
64
235
  return new Promise((e, t) => {
65
236
  s.onsuccess = () => e(s.result), s.onerror = () => t(s.error ?? new Error("Product Agent attachment storage request failed"));
66
237
  });
67
238
  }
68
- function Zs(s) {
239
+ function ln(s) {
69
240
  return s !== null && (typeof s == "object" || typeof s == "function");
70
241
  }
71
- function ps(s, e, t) {
72
- const n = Reflect.get(s, "pluno"), i = Zs(n) ? n : {};
242
+ function ms(s, e, t) {
243
+ const n = Reflect.get(s, "pluno"), i = ln(n) ? n : {};
73
244
  if (i !== n && !Reflect.set(s, "pluno", i))
74
245
  return null;
75
246
  const r = Object.getOwnPropertyDescriptor(i, e);
@@ -83,25 +254,25 @@ function ps(s, e, t) {
83
254
  }
84
255
  };
85
256
  }
86
- const en = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
87
- function vt(s, e) {
257
+ const cn = /(\]\()(\/api\/product-agent\/attachments\/download\?[^)\s]+)(\))/g;
258
+ function qt(s, e) {
88
259
  return e ? s.replace(
89
- en,
260
+ cn,
90
261
  (t, n, i, r) => `${n}${new URL(i, e).toString()}${r}`
91
262
  ) : s;
92
263
  }
93
- const St = "suggest_share_on_socials";
94
- function tn(s) {
264
+ const Tt = "suggest_share_on_socials";
265
+ function un(s) {
95
266
  for (let e = s.length - 1; e >= 0; e -= 1) {
96
267
  const t = s[e];
97
- if (t.role !== "tool" || t.toolName !== St || t.sharePromptAllowed !== void 0)
268
+ if (t.role !== "tool" || t.toolName !== Tt || t.sharePromptAllowed !== void 0)
98
269
  continue;
99
- if (nn(s, e, t.callId) !== !0)
270
+ if (hn(s, e, t.callId) !== !0)
100
271
  return null;
101
- const n = Ut(s, e, "assistant");
272
+ const n = Ot(s, e, "assistant");
102
273
  if (!n)
103
274
  return null;
104
- const i = Ut(s, n.index, "user");
275
+ const i = Ot(s, n.index, "user");
105
276
  return i ? {
106
277
  id: `share:${t.callId ?? t.id}`,
107
278
  userPrompt: i.content,
@@ -110,7 +281,7 @@ function tn(s) {
110
281
  }
111
282
  return null;
112
283
  }
113
- function sn(s) {
284
+ function dn(s) {
114
285
  let e = s;
115
286
  if (typeof s == "string")
116
287
  try {
@@ -118,10 +289,10 @@ function sn(s) {
118
289
  } catch {
119
290
  return null;
120
291
  }
121
- const t = rn(e);
292
+ const t = pn(e);
122
293
  return t ? typeof t.showSharePrompt == "boolean" ? t.showSharePrompt : t.ok === !0 && typeof t.message == "string" && t.message.includes("social-sharing prompt") ? !0 : null : null;
123
294
  }
124
- function nn(s, e, t) {
295
+ function hn(s, e, t) {
125
296
  if (!t)
126
297
  return null;
127
298
  for (let n = e + 1; n < s.length; n += 1) {
@@ -131,7 +302,7 @@ function nn(s, e, t) {
131
302
  }
132
303
  return null;
133
304
  }
134
- function Ut(s, e, t) {
305
+ function Ot(s, e, t) {
135
306
  for (let n = e - 1; n >= 0; n -= 1) {
136
307
  const i = s[n];
137
308
  if (i.role === t && i.content.trim())
@@ -139,14 +310,14 @@ function Ut(s, e, t) {
139
310
  }
140
311
  return null;
141
312
  }
142
- function rn(s) {
313
+ function pn(s) {
143
314
  return s && typeof s == "object" && !Array.isArray(s) ? s : null;
144
315
  }
145
- const on = "save_runtime_captured_skill";
146
- function an(s) {
147
- return (s.type === "function_call" || s.type === "tool_call") && s.name === on;
316
+ const gn = "save_runtime_captured_skill";
317
+ function fn(s) {
318
+ return (s.type === "function_call" || s.type === "tool_call") && s.name === gn;
148
319
  }
149
- function ln(s, e, t) {
320
+ function mn(s, e, t) {
150
321
  const n = e.map((h) => ({ item: h, identity: t(h) })), i = new Set(
151
322
  n.flatMap(
152
323
  ({ identity: h }) => h.isActivity && !h.isTransient ? h.activityKeys ?? [] : []
@@ -184,16 +355,16 @@ function ln(s, e, t) {
184
355
  g.has(h) || f.push(h);
185
356
  return f;
186
357
  }
187
- function Dt(s, e, t, n) {
358
+ function xt(s, e, t, n) {
188
359
  return s.filter((i) => {
189
360
  const r = n(i);
190
361
  return !r.isActivity || !r.isTransient ? !0 : e !== null && r.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId !== e : t === null || r.runId !== t;
191
362
  });
192
363
  }
193
- const Ke = "pluno.productAgent.transportId", cn = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", un = 50, dn = globalThis.setTimeout.bind(globalThis);
364
+ const Ke = "pluno.productAgent.transportId", yn = "pluno.productAgent.transportIdentity", Ge = "pluno.productAgent.transportIdentity.event", In = 50, Sn = globalThis.setTimeout.bind(globalThis);
194
365
  let le = null;
195
- const Re = /* @__PURE__ */ new Set(), Qe = /* @__PURE__ */ new Map();
196
- async function hn(s = gs()) {
366
+ const Re = /* @__PURE__ */ new Set(), Ve = /* @__PURE__ */ new Map();
367
+ async function Tn(s = ys()) {
197
368
  const e = s.randomUUID(), t = s.storage.getItem(Ke);
198
369
  let n = t ?? s.randomUUID(), i = !1, r = !1;
199
370
  const o = s.channel.subscribe((l) => {
@@ -231,9 +402,9 @@ async function hn(s = gs()) {
231
402
  }
232
403
  };
233
404
  }
234
- async function pn(s = !1) {
235
- le || (le = hn({
236
- ...gs(),
405
+ async function wn(s = !1) {
406
+ le || (le = Tn({
407
+ ...ys(),
237
408
  skipStoredIdentityCollisionCheck: s
238
409
  }), le.then((i) => {
239
410
  const r = (o) => {
@@ -241,7 +412,7 @@ async function pn(s = !1) {
241
412
  };
242
413
  window.addEventListener("pagehide", r);
243
414
  }));
244
- const e = await le, t = gn();
415
+ const e = await le, t = An();
245
416
  Re.add(t);
246
417
  let n = !1;
247
418
  return {
@@ -252,31 +423,31 @@ async function pn(s = !1) {
252
423
  }
253
424
  };
254
425
  }
255
- function gn() {
426
+ function An() {
256
427
  let s = 0;
257
428
  for (; Re.has(s); )
258
429
  s += 1;
259
430
  return s;
260
431
  }
261
- function gs() {
432
+ function ys() {
262
433
  return {
263
- storage: fn(),
264
- channel: mn(),
434
+ storage: Mn(),
435
+ channel: bn(),
265
436
  randomUUID: () => crypto.randomUUID(),
266
- settle: () => new Promise((s) => dn(s, un))
437
+ settle: () => new Promise((s) => Sn(s, In))
267
438
  };
268
439
  }
269
- function fn() {
440
+ function Mn() {
270
441
  return {
271
442
  getItem: (s) => {
272
443
  try {
273
- return window.sessionStorage?.getItem(s) ?? Qe.get(s) ?? null;
444
+ return window.sessionStorage?.getItem(s) ?? Ve.get(s) ?? null;
274
445
  } catch {
275
- return Qe.get(s) ?? null;
446
+ return Ve.get(s) ?? null;
276
447
  }
277
448
  },
278
449
  setItem: (s, e) => {
279
- Qe.set(s, e);
450
+ Ve.set(s, e);
280
451
  try {
281
452
  window.sessionStorage?.setItem(s, e);
282
453
  } catch {
@@ -284,9 +455,9 @@ function fn() {
284
455
  }
285
456
  };
286
457
  }
287
- function mn() {
458
+ function bn() {
288
459
  if (typeof BroadcastChannel < "u") {
289
- const s = new BroadcastChannel(cn);
460
+ const s = new BroadcastChannel(yn);
290
461
  return {
291
462
  postMessage: (e) => s.postMessage(e),
292
463
  subscribe: (e) => {
@@ -296,9 +467,9 @@ function mn() {
296
467
  close: () => s.close()
297
468
  };
298
469
  }
299
- return yn();
470
+ return Rn();
300
471
  }
301
- function yn() {
472
+ function Rn() {
302
473
  const s = /* @__PURE__ */ new Set(), e = (t) => {
303
474
  if (t.key !== Ge || !t.newValue)
304
475
  return;
@@ -319,8 +490,8 @@ function yn() {
319
490
  }
320
491
  };
321
492
  }
322
- const fs = "schedule_follow_up";
323
- function In(s) {
493
+ const Is = "schedule_follow_up";
494
+ function En(s) {
324
495
  let e = s;
325
496
  if (typeof e == "string")
326
497
  try {
@@ -331,45 +502,45 @@ function In(s) {
331
502
  if (!e || typeof e != "object")
332
503
  return null;
333
504
  const t = e;
334
- return t.ok !== !0 || t.toolName !== fs || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
505
+ return t.ok !== !0 || t.toolName !== Is || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? null : {
335
506
  id: typeof t.taskId == "string" && t.taskId ? t.taskId : null,
336
507
  dueAt: t.dueAt
337
508
  };
338
509
  }
339
- const Sn = [
510
+ const kn = [
340
511
  { value: "gpt-5.6-sol", label: "gpt-5.6-sol", price: "$$" },
341
512
  { value: "anthropic/claude-sonnet-5", label: "Claude Sonnet 5", price: "$$" },
342
513
  { value: "deepseek/deepseek-v4-flash", label: "DeepSeek V4 Flash", price: "$" }
343
- ], Tn = [
514
+ ], Cn = [
344
515
  { value: "anthropic/claude-opus-5", label: "Claude Opus 5", price: "$$$" },
345
516
  { value: "gpt-5.6-terra", label: "gpt-5.6-terra", price: "$$" }
346
- ], wn = [
347
- ...Sn,
348
- ...Tn
349
- ], Ve = (s) => wn.some((e) => e.value === s);
350
- function qt(s, e) {
517
+ ], _n = [
518
+ ...kn,
519
+ ...Cn
520
+ ], Qe = (s) => _n.some((e) => e.value === s);
521
+ function Lt(s, e) {
351
522
  return s.filter((t, n) => {
352
- const i = Ot(t);
353
- return ms(i) ? !s.slice(n + 1).some((r) => {
354
- const o = Ot(r);
355
- return ys(i, o) && Is(i, o);
523
+ const i = Nt(t);
524
+ return Ss(i) ? !s.slice(n + 1).some((r) => {
525
+ const o = Nt(r);
526
+ return Ts(i, o) && ws(i, o);
356
527
  }) : !0;
357
528
  });
358
529
  }
359
- function ms(s) {
530
+ function Ss(s) {
360
531
  return s.type === "run_status" && s.status === "stopped" && s.reason === "task_tab_closed";
361
532
  }
362
- function An(s, e) {
363
- return s.reason === "task_tab_closed" && Is(s, e) && ys(s, e);
533
+ function Pn(s, e) {
534
+ return s.reason === "task_tab_closed" && ws(s, e) && Ts(s, e);
364
535
  }
365
- function Ot(s) {
536
+ function Nt(s) {
366
537
  return s.data && typeof s.data == "object" ? s.data : {};
367
538
  }
368
- function ys(s, e) {
539
+ function Ts(s, e) {
369
540
  const t = typeof s.runId == "string" ? s.runId : null, n = typeof e.runId == "string" ? e.runId : null;
370
- return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !ms(e) : e.type === "run_error";
541
+ return t && n && t === n ? !1 : e.type === "message" ? e.role === "assistant" : e.type === "run_status" ? !Ss(e) : e.type === "run_error";
371
542
  }
372
- function Is(s, e) {
543
+ function ws(s, e) {
373
544
  return typeof s.respondsToUserMessageId == "string" && typeof e.respondsToUserMessageId == "string" ? s.respondsToUserMessageId === e.respondsToUserMessageId : typeof s.clientMessageId == "string" && typeof e.clientMessageId == "string" ? s.clientMessageId === e.clientMessageId : typeof s.runId == "string" && typeof e.runId == "string" && s.runId === e.runId;
374
545
  }
375
546
  function Ee(s) {
@@ -382,7 +553,7 @@ function Ee(s) {
382
553
  updatedAt: null
383
554
  };
384
555
  }
385
- class xt {
556
+ class Ht {
386
557
  constructor(e, t, n = (i, r) => r) {
387
558
  this.loader = t, this.merge = n, this.state = Ee(e);
388
559
  }
@@ -467,28 +638,28 @@ function ke(s) {
467
638
  nextCursor: s.nextCursor
468
639
  };
469
640
  }
470
- function Mn(s, e, t) {
641
+ function vn(s, e, t) {
471
642
  if (t === "replace" || s === null) return e;
472
643
  const n = { ...s.entitiesById, ...e.entitiesById }, i = [...s.ids];
473
644
  for (const r of e.ids)
474
645
  s.entitiesById[r] || i.push(r);
475
646
  return { entitiesById: n, ids: i, nextCursor: e.nextCursor };
476
647
  }
477
- function Ss(s) {
648
+ function As(s) {
478
649
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
479
650
  }
480
- function ko(s) {
651
+ function Oo(s) {
481
652
  return s.visible ? s.minimized ? { state: "minimized" } : { state: s.open ? "visible_open" : "visible_closed" } : { state: "hidden" };
482
653
  }
483
- function bn(s, e) {
654
+ function Un(s, e) {
484
655
  return e === "limit_exceeded" ? { allowed: !1, reason: "credits_exhausted", actions: ["upgrade", "earn_credits"] } : e === "subscription_required" || e === "subscription_inactive" || e === "payment_issue" || e === "subscription_invalid" || e === "payment_required" ? { allowed: !1, reason: "payment_issue", actions: ["upgrade"] } : s ?? { allowed: !0, reason: "allowed", actions: [] };
485
656
  }
486
- function Rn(s) {
657
+ function Dn(s) {
487
658
  if (!s || typeof s != "object") return !1;
488
659
  const e = s.paidCreditFallbackModel;
489
660
  return typeof e == "string" && e.length > 0;
490
661
  }
491
- function Co(s) {
662
+ function xo(s) {
492
663
  const e = s.hasDraftMessage || s.hasPreSubmittedAttachment;
493
664
  return s.hasRunningAssistantTurn && !e ? {
494
665
  action: "stop",
@@ -498,9 +669,9 @@ function Co(s) {
498
669
  disabled: !e || !s.canSubmitMessage
499
670
  };
500
671
  }
501
- class En {
672
+ class qn {
502
673
  constructor(e, t, n = 20) {
503
- this.loadPage = t, this.limit = n, this.recentQuery = new xt(
674
+ this.loadPage = t, this.limit = n, this.recentQuery = new Ht(
504
675
  `${e}:recent`,
505
676
  async ({ cursor: i }) => ke(
506
677
  await this.loadPage({ cursor: i, limit: this.limit, pinned: !1 }).then((r) => ({
@@ -508,8 +679,8 @@ class En {
508
679
  nextCursor: r.nextCursor
509
680
  }))
510
681
  ),
511
- Mn
512
- ), this.pinnedQuery = new xt(
682
+ vn
683
+ ), this.pinnedQuery = new Ht(
513
684
  `${e}:pinned`,
514
685
  async () => ke({
515
686
  entities: await this.loadAllPinned(),
@@ -541,7 +712,7 @@ class En {
541
712
  }) : null;
542
713
  return {
543
714
  key: e.key.slice(0, -7),
544
- status: kn(e, t),
715
+ status: On(e, t),
545
716
  data: a,
546
717
  error: e.error ?? t.error,
547
718
  requestId: Math.max(e.requestId, t.requestId),
@@ -650,10 +821,10 @@ class En {
650
821
  function Ie(s) {
651
822
  return s ? s.ids.map((e) => s.entitiesById[e]).filter((e) => !!e) : [];
652
823
  }
653
- function kn(s, e) {
824
+ function On(s, e) {
654
825
  return s.status === "error" || e.status === "error" ? "error" : s.status === "loading" || e.status === "loading" ? "loading" : s.status === "refreshing" || e.status === "refreshing" ? "refreshing" : s.status === "loading_more" ? "loading_more" : s.status === "ready" || e.status === "ready" ? "ready" : "not_requested";
655
826
  }
656
- class Lt {
827
+ class Bt {
657
828
  constructor(e) {
658
829
  this.options = e;
659
830
  }
@@ -697,7 +868,7 @@ class Lt {
697
868
  this.schedule(r, e);
698
869
  }
699
870
  }
700
- class Cn {
871
+ class xn {
701
872
  constructor(e) {
702
873
  this.options = e;
703
874
  }
@@ -749,10 +920,10 @@ class Cn {
749
920
  );
750
921
  }
751
922
  }
752
- class _n {
923
+ class Ln {
753
924
  constructor(e, t = null) {
754
925
  this.storage = e, t && (this.decisions = new Map(
755
- t.filter(rt).map((n) => [this.getDecisionKey(n), n])
926
+ t.filter(ot).map((n) => [this.getDecisionKey(n), n])
756
927
  ), this.initialized = !0);
757
928
  }
758
929
  storage;
@@ -764,7 +935,7 @@ class _n {
764
935
  if (this.initialized) return;
765
936
  const e = await this.storage.load();
766
937
  this.decisions = new Map(
767
- e.filter(rt).map((t) => [this.getDecisionKey(t), t])
938
+ e.filter(ot).map((t) => [this.getDecisionKey(t), t])
768
939
  ), this.initialized = !0;
769
940
  }
770
941
  isEligible(e, t = Date.now()) {
@@ -802,7 +973,7 @@ class _n {
802
973
  async applyAction(e, t, n) {
803
974
  if (!e.allowedActions.includes(t))
804
975
  throw new Error(`Interaction ${e.key} does not allow ${t}.`);
805
- if (!Ts(t))
976
+ if (!Ms(t))
806
977
  throw new Error(`Interaction action ${t} is not a persistence decision.`);
807
978
  const i = n.now ?? /* @__PURE__ */ new Date(), r = {
808
979
  promptKey: e.key,
@@ -828,51 +999,51 @@ class _n {
828
999
  return null;
829
1000
  }
830
1001
  getDecisionKey(e) {
831
- const t = Xe(e.scope);
1002
+ const t = Je(e.scope);
832
1003
  return e.action === "dont_show_again" ? `${t}:category:${e.category}` : `${t}:interaction:${e.promptKey}`;
833
1004
  }
834
1005
  getExactKey(e) {
835
- return `${Xe(e.scope)}:interaction:${e.key}`;
1006
+ return `${Je(e.scope)}:interaction:${e.key}`;
836
1007
  }
837
1008
  getCategoryKey(e) {
838
- return `${Xe(e.scope)}:category:${e.category}`;
1009
+ return `${Je(e.scope)}:category:${e.category}`;
839
1010
  }
840
1011
  }
841
- function _o(s, e) {
1012
+ function Lo(s, e) {
842
1013
  return {
843
- load: async () => Pn(s, e),
1014
+ load: async () => Nn(s, e),
844
1015
  save: async (t) => s.setItem(e, JSON.stringify(t))
845
1016
  };
846
1017
  }
847
- function Pn(s, e) {
1018
+ function Nn(s, e) {
848
1019
  const t = s.getItem(e);
849
1020
  if (!t) return [];
850
1021
  const n = JSON.parse(t);
851
- return Array.isArray(n) ? n.filter(rt) : [];
1022
+ return Array.isArray(n) ? n.filter(ot) : [];
852
1023
  }
853
- function Xe(s) {
1024
+ function Je(s) {
854
1025
  return `${s.level}:${s.key}`;
855
1026
  }
856
- function Ts(s) {
1027
+ function Ms(s) {
857
1028
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
858
1029
  }
859
- function rt(s) {
1030
+ function ot(s) {
860
1031
  if (!s || typeof s != "object") return !1;
861
1032
  const e = s;
862
- return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ts(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
1033
+ return typeof e.promptKey == "string" && typeof e.category == "string" && typeof e.decidedAt == "string" && (e.nextEligibleAt === null || typeof e.nextEligibleAt == "string") && Ms(e.action) && !!(e.scope && typeof e.scope == "object" && typeof e.scope.level == "string" && typeof e.scope.key == "string");
863
1034
  }
864
- const vn = {
1035
+ const Hn = {
865
1036
  working: "⏳",
866
1037
  completed: "✅",
867
1038
  failed: "❗",
868
1039
  stopped: "⏹️"
869
- }, Un = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
870
- function Dn(s, e) {
1040
+ }, Bn = /^(?:⌛|⏳|✅|❗|⏹️) Pluno(?:: )?/;
1041
+ function Fn(s, e) {
871
1042
  if (!e) return ve(s);
872
- const t = ve(s), n = `${vn[e]} Pluno`;
1043
+ const t = ve(s), n = `${Hn[e]} Pluno`;
873
1044
  return t ? `${n}: ${t}` : n;
874
1045
  }
875
- class Po {
1046
+ class No {
876
1047
  constructor(e) {
877
1048
  this.titleDocument = e;
878
1049
  }
@@ -906,11 +1077,11 @@ class Po {
906
1077
  applyTitle() {
907
1078
  if (!this.status)
908
1079
  return;
909
- const e = Dn(this.baseTitle, this.status);
1080
+ const e = Fn(this.baseTitle, this.status);
910
1081
  this.lastAppliedTitle = e, this.titleDocument.getTitle() !== e && this.titleDocument.setTitle(e);
911
1082
  }
912
1083
  }
913
- function vo(s) {
1084
+ function Ho(s) {
914
1085
  return {
915
1086
  getTitle: () => s.title,
916
1087
  setTitle: (e) => {
@@ -927,9 +1098,9 @@ function vo(s) {
927
1098
  };
928
1099
  }
929
1100
  function ve(s) {
930
- return s.replace(Un, "");
1101
+ return s.replace(Bn, "");
931
1102
  }
932
- const qn = {
1103
+ const Wn = {
933
1104
  "duplicate-message-item": "A canonical message rendered more than once.",
934
1105
  "duplicate-canonical-item": "A canonical session item rendered more than once.",
935
1106
  "duplicate-tool-call": "A tool call rendered more than once.",
@@ -940,10 +1111,10 @@ const qn = {
940
1111
  "terminal-history-not-append-only": "An established terminal outcome disappeared or changed order.",
941
1112
  "runtime-transcript-not-rendered": "A nonempty runtime transcript is displaying starter prompts."
942
1113
  };
943
- function On(s) {
944
- return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(qn, s.slice(13));
1114
+ function $n(s) {
1115
+ return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Wn, s.slice(13));
945
1116
  }
946
- function Uo(s) {
1117
+ function Bo(s) {
947
1118
  if (!s || typeof s != "object" || !("type" in s)) return !1;
948
1119
  const e = s;
949
1120
  switch (e.type) {
@@ -957,7 +1128,7 @@ function Uo(s) {
957
1128
  case "runtime.report_displayed_error":
958
1129
  return (e.reason === "conversation_error" || e.reason === "attachment_error" || e.reason === "history_error" || e.reason === "action_error") && typeof e.errorFingerprint == "string" && /^fnv1a-[0-9a-f]{8}$/.test(e.errorFingerprint) && (e.displayedMessage === void 0 || typeof e.displayedMessage == "string" && e.displayedMessage.length <= 500);
959
1130
  case "runtime.report_invalid_state_transition":
960
- return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || On(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
1131
+ return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll" || $n(e.reason)) && (e.clientMessageId === void 0 || typeof e.clientMessageId == "string");
961
1132
  case "runtime.widget_lifecycle":
962
1133
  return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
963
1134
  case "session.load":
@@ -984,9 +1155,9 @@ function Uo(s) {
984
1155
  return !1;
985
1156
  }
986
1157
  }
987
- class Do {
1158
+ class Fo {
988
1159
  constructor(e, t, n) {
989
- this.adapter = t, this.state = Je(e), this.model = n;
1160
+ this.adapter = t, this.state = Xe(e), this.model = n;
990
1161
  }
991
1162
  adapter;
992
1163
  listeners = {};
@@ -1007,12 +1178,12 @@ class Do {
1007
1178
  return n.add(t), this.listeners[e] = n, () => n.delete(t);
1008
1179
  }
1009
1180
  getState() {
1010
- return Je(this.state);
1181
+ return Xe(this.state);
1011
1182
  }
1012
1183
  updateProjection(e, t, n, i, r) {
1013
1184
  if (!this.destroyed) {
1014
- if (this.state = Je(e), t !== void 0 && (this.model = t), n) {
1015
- this.sessionHistoryState = Nt(n);
1185
+ if (this.state = Xe(e), t !== void 0 && (this.model = t), n) {
1186
+ this.sessionHistoryState = Ft(n);
1016
1187
  for (const o of this.sessionHistoryListeners)
1017
1188
  o(this.getSessionHistoryState());
1018
1189
  }
@@ -1057,7 +1228,7 @@ class Do {
1057
1228
  type: "runtime.report_displayed_error",
1058
1229
  reason: e,
1059
1230
  errorFingerprint: t,
1060
- ...n ? { displayedMessage: hs(n) } : {}
1231
+ ...n ? { displayedMessage: fs(n) } : {}
1061
1232
  }).catch(() => {
1062
1233
  });
1063
1234
  }
@@ -1172,12 +1343,12 @@ class Do {
1172
1343
  await this.dispatch({ type: "session.list", ...e });
1173
1344
  const t = this.sessionHistoryState.data;
1174
1345
  return {
1175
- sessions: Ss(t),
1346
+ sessions: As(t),
1176
1347
  nextCursor: t?.nextCursor ?? null
1177
1348
  };
1178
1349
  }
1179
1350
  getSessionHistoryState() {
1180
- return Nt(this.sessionHistoryState);
1351
+ return Ft(this.sessionHistoryState);
1181
1352
  }
1182
1353
  subscribeSessionHistory(e) {
1183
1354
  return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
@@ -1256,7 +1427,7 @@ class Do {
1256
1427
  for (const i of n ?? []) i(t);
1257
1428
  }
1258
1429
  }
1259
- function Je(s) {
1430
+ function Xe(s) {
1260
1431
  return {
1261
1432
  ...s,
1262
1433
  starterPrompts: [...s.starterPrompts],
@@ -1280,17 +1451,17 @@ function Je(s) {
1280
1451
  activeScheduledFollowUps: s.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
1281
1452
  };
1282
1453
  }
1283
- function Nt(s) {
1454
+ function Ft(s) {
1284
1455
  return {
1285
1456
  ...s,
1286
1457
  data: s.data ? ke({
1287
- entities: Ss(s.data).map((e) => ({ ...e })),
1458
+ entities: As(s.data).map((e) => ({ ...e })),
1288
1459
  nextCursor: s.data.nextCursor
1289
1460
  }) : null
1290
1461
  };
1291
1462
  }
1292
- const xn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', Ln = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Nn = ".pluno-pa-widget__panel", Hn = ".pluno-pa-widget__timeline", Bn = "__plunoExtensionWidgetOwner";
1293
- class X extends Error {
1463
+ const jn = globalThis.fetch.bind(globalThis), Wt = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', zn = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', Kn = ".pluno-pa-widget__panel", Gn = ".pluno-pa-widget__timeline", Vn = "__plunoExtensionWidgetOwner";
1464
+ class J extends Error {
1294
1465
  constructor(e, t, n, i) {
1295
1466
  super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
1296
1467
  }
@@ -1298,11 +1469,11 @@ class X extends Error {
1298
1469
  status;
1299
1470
  retryAfterMs;
1300
1471
  }
1301
- function Fn(s) {
1472
+ function Qn(s) {
1302
1473
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
1303
1474
  }
1304
- let Wn = 0;
1305
- function Bt(s) {
1475
+ let Jn = 0;
1476
+ function $t(s) {
1306
1477
  const e = {};
1307
1478
  for (const l of [
1308
1479
  "type",
@@ -1345,7 +1516,7 @@ function Bt(s) {
1345
1516
  stage: typeof d.stage == "string" ? d.stage : null,
1346
1517
  retryable: d.retryable === !0,
1347
1518
  visible: !!(g && // Recovery-only failures are intentionally hidden, not missing transcript items.
1348
- !(d.type === "run_error" && d.retryable === !0) && !g.scheduledCheckInAt && g.toolName !== St && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
1519
+ !(d.type === "run_error" && d.retryable === !0) && !g.scheduledCheckInAt && g.toolName !== Tt && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
1349
1520
  };
1350
1521
  }, o = r(s.item);
1351
1522
  if (o?.id && (e.itemId = o.id, o.type && (e.itemType = o.type), o.role && (e.itemRole = o.role), o.sessionId && typeof e.sessionId != "string" && (e.sessionId = o.sessionId), o.runId && typeof e.runId != "string" && (e.runId = o.runId), o.respondsToUserMessageId && typeof e.respondsToUserMessageId != "string" && (e.respondsToUserMessageId = o.respondsToUserMessageId), o.status && (e.itemStatus = o.status), o.stage && (e.itemStage = o.stage), o.retryable && (e.itemRetryable = !0), o.visible && (e.visibleItemId = o.id, o.streamId && (e.visibleItemAliases = JSON.stringify([[o.streamId, o.id]])))), Array.isArray(s.items)) {
@@ -1380,7 +1551,7 @@ function Se(s, e, t) {
1380
1551
  source: "web_sdk",
1381
1552
  category: s,
1382
1553
  name: e,
1383
- sequence: ++Wn,
1554
+ sequence: ++Jn,
1384
1555
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
1385
1556
  monotonicMs: performance.now(),
1386
1557
  data: t
@@ -1389,27 +1560,27 @@ function Se(s, e, t) {
1389
1560
  }
1390
1561
  class Te extends Error {
1391
1562
  }
1392
- function $n(s) {
1563
+ function Xn(s) {
1393
1564
  return s === 408 || s === 425 || s === 429 || s >= 500;
1394
1565
  }
1395
- const jn = "https://app.pluno.ai", zn = 2e4, Kn = 1e4, Gn = 6e4, Qn = 6e4, Vn = 1e4, Xn = 1e4, Jn = 3e3, Yn = 3e4, Zn = 1e3, ot = 3e4, Ft = 0.2, ei = 6e4, Wt = 15e3, ti = 6e4, si = 8, ni = "Browser connection was interrupted.", $t = 15e3, ii = "Pluno could not send this message. Try it again.", ri = "Still connecting to Pluno. Retrying automatically.", oi = 2e3, ai = 1e3, li = 100, jt = 8e3, zt = 3, ci = [300, 1e3], ws = 50 * 1024 * 1024, ui = /* @__PURE__ */ new Set([
1566
+ const Yn = "https://app.pluno.ai", Zn = 2e4, ei = 1e4, ti = 6e4, si = 6e4, ni = 1e4, ii = 1e4, ri = 3e3, oi = 3e4, ai = 1e3, at = 3e4, jt = 0.2, li = 6e4, zt = 15e3, ci = 6e4, ui = 8, di = "Browser connection was interrupted.", Kt = 15e3, hi = "Pluno could not send this message. Try it again.", pi = "Still connecting to Pluno. Retrying automatically.", gi = 2e3, fi = 1e3, mi = 100, Gt = 8e3, Vt = 3, yi = [300, 1e3], bs = 50 * 1024 * 1024, Ii = /* @__PURE__ */ new Set([
1396
1567
  ".jpeg:image/jpeg",
1397
1568
  ".jpg:image/jpeg",
1398
1569
  ".pdf:application/pdf",
1399
1570
  ".png:image/png",
1400
1571
  ".webp:image/webp"
1401
- ]), qo = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, di = 2e3, hi = 1e3, As = "Image is too large for model vision input.", pi = 100, gi = 20, Ms = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", fi = 100;
1402
- function mi(s, e = 0) {
1572
+ ]), Wo = ".pdf,.png,.jpg,.jpeg,.webp", wt = 64e3, Ye = 4e3, At = 30, Si = 2e3, Ti = 1e3, Rs = "Image is too large for model vision input.", wi = 100, Ai = 20, Es = "pluno.productAgent.state.", lt = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", Mi = 100;
1573
+ function bi(s, e = 0) {
1403
1574
  const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
1404
1575
  return Math.max(e, t);
1405
1576
  }
1406
1577
  const Ce = /* @__PURE__ */ new Set();
1407
1578
  let we = null;
1408
- function yi(s, e = Math.random) {
1409
- const t = Math.min(ot, Zn * 2 ** s), n = 1 - Ft + e() * Ft * 2;
1410
- return Math.min(ot, Math.round(t * n));
1579
+ function Ri(s, e = Math.random) {
1580
+ const t = Math.min(at, ai * 2 ** s), n = 1 - jt + e() * jt * 2;
1581
+ return Math.min(at, Math.round(t * n));
1411
1582
  }
1412
- function Ii(s) {
1583
+ function Ei(s) {
1413
1584
  const e = s.split(".")[1];
1414
1585
  if (!e)
1415
1586
  return null;
@@ -1420,8 +1591,8 @@ function Ii(s) {
1420
1591
  return null;
1421
1592
  }
1422
1593
  }
1423
- function Si(s) {
1424
- if (s instanceof X)
1594
+ function ki(s) {
1595
+ if (s instanceof J)
1425
1596
  return s.retryable;
1426
1597
  if (s && typeof s == "object") {
1427
1598
  const e = s.status;
@@ -1430,7 +1601,7 @@ function Si(s) {
1430
1601
  }
1431
1602
  return !0;
1432
1603
  }
1433
- function Ti(s) {
1604
+ function Ci(s) {
1434
1605
  if (s instanceof Error)
1435
1606
  return s;
1436
1607
  if (s && typeof s == "object") {
@@ -1444,10 +1615,10 @@ function Ti(s) {
1444
1615
  }
1445
1616
  class Ne {
1446
1617
  constructor(e, t) {
1447
- this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new En(
1618
+ this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new qn(
1448
1619
  e.clientId,
1449
1620
  async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
1450
- ), this.sessionRecoveryPoller = new Lt({
1621
+ ), this.sessionRecoveryPoller = new Bt({
1451
1622
  poll: async ({ sessionId: r }) => await this.fetchSessionHistoryPageOnce(
1452
1623
  r,
1453
1624
  "transcript",
@@ -1459,7 +1630,7 @@ class Ne {
1459
1630
  activeIntervalMs: 3e3,
1460
1631
  idleIntervalMs: 15e3,
1461
1632
  maxFailureIntervalMs: 3e4
1462
- }), this.sessionActivityRecovery = new Cn({
1633
+ }), this.sessionActivityRecovery = new xn({
1463
1634
  fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
1464
1635
  r,
1465
1636
  "activity",
@@ -1478,24 +1649,24 @@ class Ne {
1478
1649
  },
1479
1650
  getItemId: (r) => A(r, "id"),
1480
1651
  maxPagesPerPoll: 3
1481
- }), this.sessionActivityRecoveryPoller = new Lt({
1652
+ }), this.sessionActivityRecoveryPoller = new Bt({
1482
1653
  poll: async ({ sessionId: r }) => await this.sessionActivityRecovery.poll(r),
1483
1654
  apply: async (r) => await this.sessionActivityRecovery.apply(r),
1484
1655
  isActiveTurn: () => this.state.isThinking || this.state.pendingMessageStatus !== null,
1485
1656
  activeIntervalMs: 3e3,
1486
1657
  idleIntervalMs: 15e3,
1487
1658
  maxFailureIntervalMs: 3e4
1488
- }), this.personalModelSelectionOverride = e.productVariant === "personal" && Ve(e.model) ? e.model : null, this.state = {
1659
+ }), this.personalModelSelectionOverride = e.productVariant === "personal" && Qe(e.model) ? e.model : null, this.state = {
1489
1660
  ...this.state,
1490
- starterPrompts: tr(e.initialStarterPrompts)
1661
+ starterPrompts: cr(e.initialStarterPrompts)
1491
1662
  }, this.account = e.initialAccount ? { ...e.initialAccount } : null;
1492
- const n = e.restorePersistedState === !1 ? null : zr(e.clientId, e.expectedPersistedSessionId);
1663
+ const n = e.restorePersistedState === !1 ? null : Zr(e.clientId, e.expectedPersistedSessionId);
1493
1664
  n && (this.state = {
1494
1665
  ...this.state,
1495
1666
  ...n,
1496
1667
  // Paint the readable same-session cache immediately while the complete transcript is revalidated. Tool
1497
1668
  // activity is deliberately not restored here because it hydrates after the transcript is visible.
1498
- messages: n.messages.filter(gt),
1669
+ messages: n.messages.filter(ft),
1499
1670
  isLoadingSession: n.sessionId !== null,
1500
1671
  status: "idle",
1501
1672
  user: null,
@@ -1510,16 +1681,17 @@ class Ne {
1510
1681
  taskStatus: null,
1511
1682
  isRetrying: !1,
1512
1683
  lastError: null
1513
- }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Jr(
1514
- Gr(e.clientId),
1515
- Qr(e.clientId)
1684
+ }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = ro(
1685
+ to(e.clientId),
1686
+ so(e.clientId)
1516
1687
  );
1517
1688
  const i = [...this.queuedClientEvents].reverse().find(
1518
1689
  (r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
1519
1690
  );
1520
- i?.clientMessageId && (this.pendingClientMessageId = i.clientMessageId, this.pendingUserMessageEvent = i, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"), V(e.clientId, this.queuedClientEvents);
1691
+ i?.clientMessageId && (this.pendingClientMessageId = i.clientMessageId, this.pendingUserMessageEvent = i, this.state.pendingMessageStatus = "reconnecting", this.state.turnPhase = "sending"), Q(e.clientId, this.queuedClientEvents);
1521
1692
  }
1522
1693
  options;
1694
+ clientRuntime = new Zs();
1523
1695
  listeners = {};
1524
1696
  socket = null;
1525
1697
  reconnectTimer = null;
@@ -1558,7 +1730,7 @@ class Ne {
1558
1730
  accountRefresh = null;
1559
1731
  runtimeInteractions = [];
1560
1732
  interactionListeners = /* @__PURE__ */ new Set();
1561
- interactionManager = new _n(
1733
+ interactionManager = new Ln(
1562
1734
  { load: async () => [], save: async () => {
1563
1735
  } },
1564
1736
  []
@@ -1658,17 +1830,17 @@ class Ne {
1658
1830
  lastErrorSecuritySettingsUrl: null
1659
1831
  };
1660
1832
  static async init(e) {
1661
- const t = e, n = await pn(
1833
+ const t = e, n = await wn(
1662
1834
  t.skipStoredTransportIdentityCollisionCheck === !0
1663
1835
  ), i = new Ne({
1664
1836
  ...e,
1665
- backendUrl: Bi(e.backendUrl ?? jn),
1666
- clientId: e.clientId ?? or(),
1837
+ backendUrl: Vi(e.backendUrl ?? Yn),
1838
+ clientId: e.clientId ?? gr(),
1667
1839
  productVariant: e.productVariant ?? "customer_embedded",
1668
- entrySurface: Fi(e.entrySurface)
1840
+ entrySurface: Qi(e.entrySurface)
1669
1841
  }, n);
1670
1842
  try {
1671
- Js().catch((r) => {
1843
+ on().catch((r) => {
1672
1844
  b("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
1673
1845
  message: r instanceof Error ? r.message : String(r)
1674
1846
  });
@@ -1683,28 +1855,30 @@ class Ne {
1683
1855
  return n.add(t), this.listeners[e] = n, () => n.delete(t);
1684
1856
  }
1685
1857
  getState() {
1686
- return {
1858
+ return this.clientRuntime.project("conversation", { legacy: () => ({
1687
1859
  ...this.state,
1688
1860
  activeResponseUserMessageId: this.activeResponseUserMessageId,
1689
1861
  starterPrompts: [...this.state.starterPrompts],
1690
1862
  appearance: this.state.appearance ? { ...this.state.appearance } : null,
1691
1863
  messages: [...this.state.messages]
1692
- };
1864
+ }) });
1693
1865
  }
1694
1866
  stageProactiveSuggestionQuestion(e) {
1695
- const t = e.trim();
1696
- if (!t)
1697
- return;
1698
- const n = this.stagedProactiveSuggestionQuestionMessageId ?? `local-proactive-suggestion-edit-${x()}`;
1699
- this.stagedProactiveSuggestionQuestionMessageId = n;
1700
- const i = {
1701
- id: n,
1702
- role: "assistant",
1703
- phase: "final_answer",
1704
- content: t,
1705
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
1706
- }, r = this.state.messages.findIndex((a) => a.id === n), o = [...this.state.messages];
1707
- r >= 0 ? o[r] = i : o.push(i), this.setState({ messages: o }), this.emit("message", i);
1867
+ return this.clientRuntime.route("conversation", { legacy: () => {
1868
+ const t = e.trim();
1869
+ if (!t)
1870
+ return;
1871
+ const n = this.stagedProactiveSuggestionQuestionMessageId ?? `local-proactive-suggestion-edit-${x()}`;
1872
+ this.stagedProactiveSuggestionQuestionMessageId = n;
1873
+ const i = {
1874
+ id: n,
1875
+ role: "assistant",
1876
+ phase: "final_answer",
1877
+ content: t,
1878
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
1879
+ }, r = this.state.messages.findIndex((a) => a.id === n), o = [...this.state.messages];
1880
+ r >= 0 ? o[r] = i : o.push(i), this.setState({ messages: o }), this.emit("message", i);
1881
+ } });
1708
1882
  }
1709
1883
  invalidateProviderToken() {
1710
1884
  this.options.token || (this.token = null, this.tokenExpiresAtMs = null);
@@ -1714,7 +1888,7 @@ class Ne {
1714
1888
  return this.options.token;
1715
1889
  if (!this.options.tokenProvider)
1716
1890
  return this.token;
1717
- const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Qn > n;
1891
+ const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - si > n;
1718
1892
  if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
1719
1893
  return this.token;
1720
1894
  if (this.tokenRequest && !t.forceRefresh)
@@ -1726,8 +1900,8 @@ class Ne {
1726
1900
  let a = null;
1727
1901
  const l = new Promise((c, u) => {
1728
1902
  a = window.setTimeout(() => {
1729
- r.abort(), u(new X("Pluno token provider timed out", !0));
1730
- }, Gn);
1903
+ r.abort(), u(new J("Pluno token provider timed out", !0));
1904
+ }, ti);
1731
1905
  });
1732
1906
  try {
1733
1907
  const c = await Promise.race([
@@ -1735,10 +1909,10 @@ class Ne {
1735
1909
  l
1736
1910
  ]);
1737
1911
  if (r.signal.aborted || this.tokenAbortController !== r)
1738
- throw new X("Pluno token request was cancelled", !0);
1912
+ throw new J("Pluno token request was cancelled", !0);
1739
1913
  if (!c)
1740
- throw new X("Pluno token provider did not return a token", !1);
1741
- return this.token = c, this.tokenExpiresAtMs = Ii(c), c;
1914
+ throw new J("Pluno token provider did not return a token", !1);
1915
+ return this.token = c, this.tokenExpiresAtMs = Ei(c), c;
1742
1916
  } finally {
1743
1917
  a !== null && window.clearTimeout(a);
1744
1918
  }
@@ -1751,112 +1925,120 @@ class Ne {
1751
1925
  }
1752
1926
  }
1753
1927
  async connect() {
1754
- if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
1755
- return;
1756
- this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0), this.connectionInProgress = !0;
1757
- const e = ++this.connectionAttemptId;
1758
- this.setState(
1759
- this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
1760
- );
1761
- try {
1762
- if (this.token = await this.acquireToken("connect"), e !== this.connectionAttemptId || this.state.status === "closed")
1928
+ return this.clientRuntime.route("conversation", { legacy: async () => {
1929
+ if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
1763
1930
  return;
1764
- if (!this.token && !this.options.webSocketFactory)
1765
- throw new X("Pluno requires a token or tokenProvider", !1);
1766
- const t = ji(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1767
- this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
1768
- this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
1769
- }, Vn), n.addEventListener("open", () => {
1770
- this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
1771
- queuedClientEventCount: this.queuedClientEvents.length,
1772
- isThinking: this.state.isThinking
1773
- }), !(this.token ? this.sendNow({
1774
- type: "auth.session",
1775
- token: this.token,
1776
- clientId: this.options.clientId,
1777
- transportId: this.transportIdentity.transportId,
1778
- pageUrl: location.href
1779
- }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
1780
- this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
1781
- }, Xn));
1782
- }), n.addEventListener("message", (i) => {
1783
- this.socket === n && this.handleServerEvent(Zi(i.data));
1784
- }), n.addEventListener("sendfailure", (i) => {
1785
- if (this.socket !== n)
1931
+ this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0), this.connectionInProgress = !0;
1932
+ const e = ++this.connectionAttemptId;
1933
+ this.setState(
1934
+ this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
1935
+ );
1936
+ try {
1937
+ if (this.token = await this.acquireToken("connect"), e !== this.connectionAttemptId || this.state.status === "closed")
1786
1938
  return;
1787
- const r = er(i?.detail?.data);
1788
- r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
1789
- (o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
1790
- ) && (this.queuedClientEvents.push(r), V(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
1791
- }), n.addEventListener("close", (i) => {
1792
- this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (b("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
1793
- code: typeof i?.code == "number" ? i.code : null,
1794
- reason: typeof i?.reason == "string" ? i.reason : "",
1795
- wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : null,
1796
- queuedClientEventCount: this.queuedClientEvents.length,
1797
- isThinking: this.state.isThinking
1798
- }), (typeof i?.code != "number" || i.code !== 1e3) && this.reportTransportDiagnostic("socket_closed", {
1799
- closeCode: typeof i?.code == "number" ? i.code : void 0,
1800
- wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : void 0
1801
- }), this.setReconnectingState(), this.scheduleReconnect()));
1802
- }), n.addEventListener("error", () => {
1803
- this.socket !== n || this.state.status === "closed" || (b("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
1804
- queuedClientEventCount: this.queuedClientEvents.length,
1805
- isThinking: this.state.isThinking
1806
- }), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
1807
- });
1808
- } catch (t) {
1809
- if (e !== this.connectionAttemptId || this.state.status === "closed")
1810
- return;
1811
- const n = Ti(t);
1812
- if (Si(t)) {
1813
- b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
1814
- message: n.message,
1815
- reconnectAttempt: this.reconnectAttempts
1816
- }), t instanceof X && this.reportTransportDiagnostic("auth_timeout"), this.setState({
1817
- status: "reconnecting",
1818
- lastError: ri,
1939
+ if (!this.token && !this.options.webSocketFactory)
1940
+ throw new J("Pluno requires a token or tokenProvider", !1);
1941
+ const t = Yi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1942
+ this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
1943
+ this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
1944
+ }, ni), n.addEventListener("open", () => {
1945
+ this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
1946
+ queuedClientEventCount: this.queuedClientEvents.length,
1947
+ isThinking: this.state.isThinking
1948
+ }), !(this.token ? this.sendNow({
1949
+ type: "auth.session",
1950
+ token: this.token,
1951
+ clientId: this.options.clientId,
1952
+ transportId: this.transportIdentity.transportId,
1953
+ pageUrl: location.href
1954
+ }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
1955
+ this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
1956
+ }, ii));
1957
+ }), n.addEventListener("message", (i) => {
1958
+ this.socket === n && this.handleServerEvent(ar(i.data));
1959
+ }), n.addEventListener("sendfailure", (i) => {
1960
+ if (this.socket !== n)
1961
+ return;
1962
+ const r = lr(i?.detail?.data);
1963
+ r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
1964
+ (o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
1965
+ ) && (this.queuedClientEvents.push(r), Q(this.options.clientId, this.queuedClientEvents), this.setState({ pendingMessageStatus: "reconnecting" })), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close();
1966
+ }), n.addEventListener("close", (i) => {
1967
+ this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (b("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
1968
+ code: typeof i?.code == "number" ? i.code : null,
1969
+ reason: typeof i?.reason == "string" ? i.reason : "",
1970
+ wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : null,
1971
+ queuedClientEventCount: this.queuedClientEvents.length,
1972
+ isThinking: this.state.isThinking
1973
+ }), (typeof i?.code != "number" || i.code !== 1e3) && this.reportTransportDiagnostic("socket_closed", {
1974
+ closeCode: typeof i?.code == "number" ? i.code : void 0,
1975
+ wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : void 0
1976
+ }), this.setReconnectingState(), this.scheduleReconnect()));
1977
+ }), n.addEventListener("error", () => {
1978
+ this.socket !== n || this.state.status === "closed" || (b("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
1979
+ queuedClientEventCount: this.queuedClientEvents.length,
1980
+ isThinking: this.state.isThinking
1981
+ }), this.reportTransportDiagnostic("socket_error"), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.setReconnectingState(), this.scheduleReconnect(), n.readyState !== WebSocket.CLOSED && n.readyState !== WebSocket.CLOSING && n.close());
1982
+ });
1983
+ } catch (t) {
1984
+ if (e !== this.connectionAttemptId || this.state.status === "closed")
1985
+ return;
1986
+ const n = Ci(t);
1987
+ if (ki(t)) {
1988
+ b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
1989
+ message: n.message,
1990
+ reconnectAttempt: this.reconnectAttempts
1991
+ }), t instanceof J && this.reportTransportDiagnostic("auth_timeout"), this.setState({
1992
+ status: "reconnecting",
1993
+ lastError: pi,
1994
+ lastErrorCode: "connection_failed"
1995
+ }), this.emit("error", n), this.scheduleReconnect(
1996
+ t instanceof J ? t.retryAfterMs : void 0
1997
+ );
1998
+ return;
1999
+ }
2000
+ throw this.setState({
2001
+ status: "error",
2002
+ lastError: n.message,
1819
2003
  lastErrorCode: "connection_failed"
1820
- }), this.emit("error", n), this.scheduleReconnect(
1821
- t instanceof X ? t.retryAfterMs : void 0
1822
- );
1823
- return;
2004
+ }), this.emit("error", n), n;
2005
+ } finally {
2006
+ this.connectionInProgress = !1;
1824
2007
  }
1825
- throw this.setState({
1826
- status: "error",
1827
- lastError: n.message,
1828
- lastErrorCode: "connection_failed"
1829
- }), this.emit("error", n), n;
1830
- } finally {
1831
- this.connectionInProgress = !1;
1832
- }
2008
+ } });
1833
2009
  }
1834
2010
  disconnect() {
1835
- this.stopSessionRecoveryPolling(), this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
2011
+ return this.clientRuntime.route("conversation", { legacy: () => {
2012
+ this.stopSessionRecoveryPolling(), this.connectionAttemptId += 1, this.setState({ status: "closed", pendingMessageStatus: null, isThinking: !1, isRetrying: !1 }), this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.clearStarterPromptUrlRefreshTimer(), this.clearRetryTimers(), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.clearSessionLoadRequest(), this.rejectPendingSessionHistoryRequests("Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionPinRequests, "Pluno disconnected."), this.rejectPendingSessionMutationRequests(this.pendingSessionRenameRequests, "Pluno disconnected."), this.tokenAbortController?.abort(), this.tokenAbortController = null, this.tokenRequest = null, this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null), this.clientDiagnosticsRetryTimer !== null && (window.clearTimeout(this.clientDiagnosticsRetryTimer), this.clientDiagnosticsRetryTimer = null), this.pendingTransportDiagnostics = [], this.pendingHealthDiagnostics = [], this.queuedClientEvents = [], this.pendingWidgetLifecycleEvents = [], this.clearPendingWarmupAckTimer(), this.pendingPassiveWarmupEvent = null, this.pendingComposerWarmup = null, this.activeComposerWarmupId = null, this.activeComposerWarmupScope = null, this.nonTranscriptToolCallIds.clear(), this.socket?.close(), this.socket = null;
2013
+ } });
1836
2014
  }
1837
2015
  destroy() {
1838
- this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Yr(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
1839
- for (const e of Object.values(this.listeners))
1840
- e?.clear();
1841
- this.accountListeners.clear(), this.interactionListeners.clear();
2016
+ if (!this.clientRuntime.isDisposed) {
2017
+ this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), oo(this.options.clientId), this.transportIdentity.release(), this.networkCaptureCleanup?.(), this.networkCaptureCleanup = null, this.networkBatchTimer !== null && (window.clearTimeout(this.networkBatchTimer), this.networkBatchTimer = null), this.queuedNetworkEvents = [], this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear();
2018
+ for (const e of Object.values(this.listeners))
2019
+ e?.clear();
2020
+ this.accountListeners.clear(), this.interactionListeners.clear(), this.clientRuntime.dispose();
2021
+ }
1842
2022
  }
1843
2023
  warmup(e = "panel_open") {
1844
- const t = _(), n = `${this.state.sessionId ?? "draft"}:${t.url}`, i = e === "composer_input" && this.pendingComposerWarmup?.scope === n ? this.pendingComposerWarmup : null, r = {
1845
- type: "runtime.warmup",
1846
- reason: e,
1847
- ...e === "composer_input" ? { warmupId: i?.event.warmupId ?? x() } : {},
1848
- entrySurface: this.options.entrySurface,
1849
- sessionId: this.state.sessionId ?? void 0,
1850
- page: t,
1851
- model: this.options.model
1852
- };
1853
- if (e === "composer_input") {
1854
- if (this.options.productVariant === "customer_embedded") {
1855
- this.sendNow(r) || (this.pendingPassiveWarmupEvent = r);
1856
- return;
1857
- }
1858
- i || (this.clearPendingComposerWarmup(), this.pendingComposerWarmup = { event: r, scope: n, retryAttempt: 0, acknowledged: !1 }, this.activeComposerWarmupId = r.warmupId ?? null, this.activeComposerWarmupScope = n), this.flushPendingComposerWarmup();
1859
- } else this.sendNow(r) || (this.pendingPassiveWarmupEvent = r);
2024
+ return this.clientRuntime.route("conversation", { legacy: () => {
2025
+ const t = _(), n = `${this.state.sessionId ?? "draft"}:${t.url}`, i = e === "composer_input" && this.pendingComposerWarmup?.scope === n ? this.pendingComposerWarmup : null, r = {
2026
+ type: "runtime.warmup",
2027
+ reason: e,
2028
+ ...e === "composer_input" ? { warmupId: i?.event.warmupId ?? x() } : {},
2029
+ entrySurface: this.options.entrySurface,
2030
+ sessionId: this.state.sessionId ?? void 0,
2031
+ page: t,
2032
+ model: this.options.model
2033
+ };
2034
+ if (e === "composer_input") {
2035
+ if (this.options.productVariant === "customer_embedded") {
2036
+ this.sendNow(r) || (this.pendingPassiveWarmupEvent = r);
2037
+ return;
2038
+ }
2039
+ i || (this.clearPendingComposerWarmup(), this.pendingComposerWarmup = { event: r, scope: n, retryAttempt: 0, acknowledged: !1 }, this.activeComposerWarmupId = r.warmupId ?? null, this.activeComposerWarmupScope = n), this.flushPendingComposerWarmup();
2040
+ } else this.sendNow(r) || (this.pendingPassiveWarmupEvent = r);
2041
+ } });
1860
2042
  }
1861
2043
  recordWidgetLifecycle(e, t) {
1862
2044
  const n = {
@@ -1874,114 +2056,116 @@ class Ne {
1874
2056
  this.authenticatedSocket === this.socket && this.sendNow(n) || (this.pendingWidgetLifecycleEvents.push(n), this.pendingWidgetLifecycleEvents.length > 20 && this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length - 20));
1875
2057
  }
1876
2058
  async sendMessage(e, t = {}) {
1877
- const n = e.trim(), i = t.attachments ?? [];
1878
- if (this.options.productVariant === "customer_embedded" && (i.forEach(xs), i.reduce(
1879
- (T, N) => T + N.sizeBytes,
1880
- 0
1881
- ) > ws))
1882
- throw new Error("Embedded attachments must total at most 50 MB per message");
1883
- let r = i.map(qe);
1884
- if (!n && r.length === 0)
1885
- return null;
1886
- if (this.pendingClientMessageId)
1887
- throw new Error("Wait for the current message to finish sending before sending another.");
1888
- const o = _(), a = t.clientMessageId ?? x(), l = t.proactiveSuggestionQuestion?.trim(), c = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
1889
- (S) => S.id === this.stagedProactiveSuggestionQuestionMessageId
1890
- ) ?? null : null, u = l ? {
1891
- id: `local-proactive-suggestion-question-${a}`,
1892
- role: "assistant",
1893
- phase: "final_answer",
1894
- content: l,
1895
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
1896
- } : null, d = {
1897
- id: `local-${a}`,
1898
- role: "user",
1899
- content: n,
1900
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1901
- ...i.length > 0 ? { attachments: i } : {}
1902
- }, g = this.state.messages.some((S) => S.id === d.id || S.clientMessageId === a), f = this.state.isThinking, h = this.state.taskStatus, p = this.state.pendingMessageStatus, y = this.state.turnPhase, m = this.state.messages, M = g ? this.state.messages : [
1903
- ...this.state.messages.map(
1904
- (S) => c && S.id === c.id ? {
1905
- ...S,
1906
- id: `local-proactive-suggestion-question-${a}`
1907
- } : S
1908
- ),
1909
- ...!c && u ? [u] : [],
1910
- d
1911
- ], w = {
1912
- assistantDraft: this.state.assistantDraft,
1913
- assistantDraftItemId: this.state.assistantDraftItemId,
1914
- assistantDraftPhase: this.state.assistantDraftPhase,
1915
- assistantDraftRespondsToUserMessageId: this.state.assistantDraftRespondsToUserMessageId,
1916
- assistantDraftRunId: this.state.assistantDraftRunId,
1917
- lastError: this.state.lastError
1918
- };
1919
- this.setState({
1920
- messages: M,
1921
- ...f ? {} : {
1922
- assistantDraft: "",
1923
- assistantDraftItemId: null,
1924
- assistantDraftPhase: null,
1925
- assistantDraftRespondsToUserMessageId: null,
1926
- assistantDraftRunId: null
1927
- },
1928
- pendingMessageStatus: "sending",
1929
- turnPhase: f ? y : "sending",
1930
- isThinking: f,
1931
- taskStatus: "working",
1932
- isRetrying: !1,
1933
- lastError: null
1934
- }), this.startFirstResponseTimer(a, t.submittedAt), g || (this.sessionHistoryManager.addOptimistic({
1935
- id: d.id,
1936
- title: null,
1937
- customTitle: null,
1938
- firstUserMessage: d.content,
1939
- currentPage: o,
1940
- createdAt: d.createdAt,
1941
- updatedAt: d.createdAt,
1942
- lastActiveAt: d.createdAt,
1943
- isActive: !0,
1944
- isPinned: !1
1945
- }), u && !c && this.emit("message", u), this.emit("message", d));
1946
- try {
1947
- const S = [];
1948
- for (const T of r) {
1949
- const N = T.id ? this.attachmentFiles.get(T.id) : void 0;
1950
- if (T.sandboxPath || T.storageKey) {
1951
- S.push(T);
1952
- continue;
2059
+ return this.clientRuntime.route("conversation", { legacy: async () => {
2060
+ const n = e.trim(), i = t.attachments ?? [];
2061
+ if (this.options.productVariant === "customer_embedded" && (i.forEach(Hs), i.reduce(
2062
+ (T, N) => T + N.sizeBytes,
2063
+ 0
2064
+ ) > bs))
2065
+ throw new Error("Embedded attachments must total at most 50 MB per message");
2066
+ let r = i.map(qe);
2067
+ if (!n && r.length === 0)
2068
+ return null;
2069
+ if (this.pendingClientMessageId)
2070
+ throw new Error("Wait for the current message to finish sending before sending another.");
2071
+ const o = _(), a = t.clientMessageId ?? x(), l = t.proactiveSuggestionQuestion?.trim(), c = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
2072
+ (S) => S.id === this.stagedProactiveSuggestionQuestionMessageId
2073
+ ) ?? null : null, u = l ? {
2074
+ id: `local-proactive-suggestion-question-${a}`,
2075
+ role: "assistant",
2076
+ phase: "final_answer",
2077
+ content: l,
2078
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
2079
+ } : null, d = {
2080
+ id: `local-${a}`,
2081
+ role: "user",
2082
+ content: n,
2083
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2084
+ ...i.length > 0 ? { attachments: i } : {}
2085
+ }, g = this.state.messages.some((S) => S.id === d.id || S.clientMessageId === a), f = this.state.isThinking, h = this.state.taskStatus, p = this.state.pendingMessageStatus, y = this.state.turnPhase, m = this.state.messages, M = g ? this.state.messages : [
2086
+ ...this.state.messages.map(
2087
+ (S) => c && S.id === c.id ? {
2088
+ ...S,
2089
+ id: `local-proactive-suggestion-question-${a}`
2090
+ } : S
2091
+ ),
2092
+ ...!c && u ? [u] : [],
2093
+ d
2094
+ ], w = {
2095
+ assistantDraft: this.state.assistantDraft,
2096
+ assistantDraftItemId: this.state.assistantDraftItemId,
2097
+ assistantDraftPhase: this.state.assistantDraftPhase,
2098
+ assistantDraftRespondsToUserMessageId: this.state.assistantDraftRespondsToUserMessageId,
2099
+ assistantDraftRunId: this.state.assistantDraftRunId,
2100
+ lastError: this.state.lastError
2101
+ };
2102
+ this.setState({
2103
+ messages: M,
2104
+ ...f ? {} : {
2105
+ assistantDraft: "",
2106
+ assistantDraftItemId: null,
2107
+ assistantDraftPhase: null,
2108
+ assistantDraftRespondsToUserMessageId: null,
2109
+ assistantDraftRunId: null
2110
+ },
2111
+ pendingMessageStatus: "sending",
2112
+ turnPhase: f ? y : "sending",
2113
+ isThinking: f,
2114
+ taskStatus: "working",
2115
+ isRetrying: !1,
2116
+ lastError: null
2117
+ }), this.startFirstResponseTimer(a, t.submittedAt), g || (this.sessionHistoryManager.addOptimistic({
2118
+ id: d.id,
2119
+ title: null,
2120
+ customTitle: null,
2121
+ firstUserMessage: d.content,
2122
+ currentPage: o,
2123
+ createdAt: d.createdAt,
2124
+ updatedAt: d.createdAt,
2125
+ lastActiveAt: d.createdAt,
2126
+ isActive: !0,
2127
+ isPinned: !1
2128
+ }), u && !c && this.emit("message", u), this.emit("message", d));
2129
+ try {
2130
+ const S = [];
2131
+ for (const T of r) {
2132
+ const N = T.id ? this.attachmentFiles.get(T.id) : void 0;
2133
+ if (T.sandboxPath || T.storageKey) {
2134
+ S.push(T);
2135
+ continue;
2136
+ }
2137
+ if (!N)
2138
+ throw new Error(`Attachment bytes are unavailable for ${T.name}`);
2139
+ S.push(await this.uploadAttachmentForMessage({ file: N, attachment: T }));
1953
2140
  }
1954
- if (!N)
1955
- throw new Error(`Attachment bytes are unavailable for ${T.name}`);
1956
- S.push(await this.uploadAttachmentForMessage({ file: N, attachment: T }));
2141
+ r = S;
2142
+ } catch (S) {
2143
+ throw this.clearFirstResponseTimer(a), g || this.sessionHistoryManager.removeOptimistic(d.id), this.setState({
2144
+ ...g ? {} : { messages: m },
2145
+ ...f ? {} : { ...w, isThinking: !1 },
2146
+ pendingMessageStatus: p,
2147
+ turnPhase: y,
2148
+ taskStatus: h
2149
+ }), S;
1957
2150
  }
1958
- r = S;
1959
- } catch (S) {
1960
- throw this.clearFirstResponseTimer(a), g || this.sessionHistoryManager.removeOptimistic(d.id), this.setState({
1961
- ...g ? {} : { messages: m },
1962
- ...f ? {} : { ...w, isThinking: !1 },
1963
- pendingMessageStatus: p,
1964
- turnPhase: y,
1965
- taskStatus: h
1966
- }), S;
1967
- }
1968
- this.retryableClientMessageId = null;
1969
- const D = !t.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, H = {
1970
- type: "chat.user_message",
1971
- sessionId: this.state.sessionId ?? void 0,
1972
- clientMessageId: a,
1973
- initiatedBy: t.initiatedBy,
1974
- invocation: Wi(t.invocation ?? t.initiatedBy),
1975
- entrySurface: this.options.entrySurface,
1976
- content: n,
1977
- proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
1978
- pageContent: D && At() || void 0,
1979
- attachments: r.length > 0 ? r.map(qe) : void 0,
1980
- page: o,
1981
- model: this.options.model,
1982
- metadata: Kt(this.options.metadata)
1983
- };
1984
- return t.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = H, this.stagedProactiveSuggestionQuestionMessageId = null, this.send(H), this.schedulePendingDeliveryAck(a), a;
2151
+ this.retryableClientMessageId = null;
2152
+ const D = !t.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, H = {
2153
+ type: "chat.user_message",
2154
+ sessionId: this.state.sessionId ?? void 0,
2155
+ clientMessageId: a,
2156
+ initiatedBy: t.initiatedBy,
2157
+ invocation: Ji(t.invocation ?? t.initiatedBy),
2158
+ entrySurface: this.options.entrySurface,
2159
+ content: n,
2160
+ proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
2161
+ pageContent: D && Mt() || void 0,
2162
+ attachments: r.length > 0 ? r.map(qe) : void 0,
2163
+ page: o,
2164
+ model: this.options.model,
2165
+ metadata: Qt(this.options.metadata)
2166
+ };
2167
+ return t.initiatedBy || (this.lastUserMessagePageUrl = o.url), this.pendingClientMessageId = a, this.pendingUserMessageEvent = H, this.stagedProactiveSuggestionQuestionMessageId = null, this.send(H), this.schedulePendingDeliveryAck(a), a;
2168
+ } });
1985
2169
  }
1986
2170
  reportInvalidStateTransition(e, t) {
1987
2171
  this.reportHealthSignal("invalid_state_transition", {
@@ -1993,41 +2177,45 @@ class Ne {
1993
2177
  this.reportHealthSignal("user_visible_error", {
1994
2178
  reason: e,
1995
2179
  errorFingerprint: t,
1996
- ...n ? { displayedMessage: hs(n) } : {}
2180
+ ...n ? { displayedMessage: fs(n) } : {}
1997
2181
  });
1998
2182
  }
1999
2183
  getModel() {
2000
- return this.options.model;
2184
+ return this.clientRuntime.project("modelSelection", { legacy: () => this.options.model });
2001
2185
  }
2002
2186
  setModel(e) {
2003
- this.options.model = e, this.options.productVariant === "personal" && Ve(e) && (this.personalModelSelectionOverride = e);
2187
+ return this.clientRuntime.route("modelSelection", { legacy: () => {
2188
+ this.options.model = e, this.options.productVariant === "personal" && Qe(e) && (this.personalModelSelectionOverride = e);
2189
+ } });
2004
2190
  }
2005
2191
  retryLastMessage() {
2006
- const e = this.state.sessionId, t = this.retryableClientMessageId;
2007
- if (!t)
2008
- return !1;
2009
- if (this.failedUserMessageEvent?.clientMessageId === t) {
2010
- const n = this.failedUserMessageEvent;
2011
- return this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.retryAttemptsByClientMessageId[t] = 0, this.pendingClientMessageId = t, this.pendingUserMessageEvent = n, this.setState({
2012
- status: "connected",
2013
- pendingMessageStatus: "sending",
2014
- lastError: null,
2015
- lastErrorCode: null
2016
- }), this.send(n), this.schedulePendingDeliveryAck(t), !0;
2017
- }
2018
- return e ? (this.retryAttemptsByClientMessageId[t] = 0, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.activeClientMessageId = t, this.latestRecoverableClientMessageId = t, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: t, automatic: !1 }), !0) : !1;
2192
+ return this.clientRuntime.route("conversation", { legacy: () => {
2193
+ const e = this.state.sessionId, t = this.retryableClientMessageId;
2194
+ if (!t)
2195
+ return !1;
2196
+ if (this.failedUserMessageEvent?.clientMessageId === t) {
2197
+ const n = this.failedUserMessageEvent;
2198
+ return this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.retryAttemptsByClientMessageId[t] = 0, this.pendingClientMessageId = t, this.pendingUserMessageEvent = n, this.setState({
2199
+ status: "connected",
2200
+ pendingMessageStatus: "sending",
2201
+ lastError: null,
2202
+ lastErrorCode: null
2203
+ }), this.send(n), this.schedulePendingDeliveryAck(t), !0;
2204
+ }
2205
+ return e ? (this.retryAttemptsByClientMessageId[t] = 0, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.activeClientMessageId = t, this.latestRecoverableClientMessageId = t, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), this.markThinkingProgress(), this.send({ type: "chat.retry_last_user_message", sessionId: e, clientMessageId: t, automatic: !1 }), !0) : !1;
2206
+ } });
2019
2207
  }
2020
2208
  createLocalAttachment(e) {
2021
- this.options.productVariant === "customer_embedded" && Zr(e);
2209
+ this.options.productVariant === "customer_embedded" && ao(e);
2022
2210
  const t = x(), n = {
2023
2211
  id: t,
2024
2212
  name: e.name || "attachment",
2025
- mimeType: ft(e),
2213
+ mimeType: mt(e),
2026
2214
  sizeBytes: e.size
2027
2215
  };
2028
2216
  this.attachmentFiles.set(t, e);
2029
2217
  const i = Date.now();
2030
- return Vs({
2218
+ return nn({
2031
2219
  attachmentId: t,
2032
2220
  name: n.name,
2033
2221
  mimeType: n.mimeType,
@@ -2056,7 +2244,7 @@ class Ne {
2056
2244
  file: e,
2057
2245
  attachment: t
2058
2246
  }) {
2059
- const n = this.state.sessionId, i = ft(e), r = {
2247
+ const n = this.state.sessionId, i = mt(e), r = {
2060
2248
  sessionId: n ?? void 0,
2061
2249
  attachmentId: t.id,
2062
2250
  clientId: this.options.clientId,
@@ -2066,7 +2254,7 @@ class Ne {
2066
2254
  sizeBytes: e.size,
2067
2255
  page: _(),
2068
2256
  model: this.options.model,
2069
- metadata: Kt(this.options.metadata),
2257
+ metadata: Qt(this.options.metadata),
2070
2258
  entrySurface: this.options.entrySurface
2071
2259
  };
2072
2260
  let o;
@@ -2092,8 +2280,8 @@ class Ne {
2092
2280
  }, "Failed to upload attachment"), o = l;
2093
2281
  }
2094
2282
  this.setState({ sessionId: o.sessionId });
2095
- const a = Os(o.attachment, this.options.backendUrl);
2096
- return this.updateAttachmentInState(t.id, a), t.id && Xs(t.id, {
2283
+ const a = Ns(o.attachment, this.options.backendUrl);
2284
+ return this.updateAttachmentInState(t.id, a), t.id && rn(t.id, {
2097
2285
  sessionId: o.sessionId,
2098
2286
  fileUrl: a.fileUrl,
2099
2287
  sandboxPath: a.sandboxPath,
@@ -2124,7 +2312,7 @@ class Ne {
2124
2312
  const n = await this.fetchEmbedAttachmentUpload(e, !1);
2125
2313
  if (n.ok)
2126
2314
  return await n.json();
2127
- if (yo(n.status) && this.options.tokenProvider && !t) {
2315
+ if (Ro(n.status) && this.options.tokenProvider && !t) {
2128
2316
  t = !0;
2129
2317
  const i = await this.fetchEmbedAttachmentUpload(e, !0);
2130
2318
  if (i.ok)
@@ -2146,174 +2334,188 @@ class Ne {
2146
2334
  });
2147
2335
  }
2148
2336
  stop() {
2149
- if (!this.state.sessionId)
2150
- return;
2151
- this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
2152
- const e = Or(
2153
- this.state.messages,
2154
- this.state.assistantDraftRespondsToUserMessageId,
2155
- this.state.assistantDraftRunId,
2156
- this.activeClientMessageId
2157
- );
2158
- this.stoppedTurns.push({
2159
- sessionId: this.state.sessionId,
2160
- ...e,
2161
- reason: "user_requested",
2162
- stoppedItemId: null,
2163
- stoppedAt: null,
2164
- stoppedCausalSequence: null,
2165
- toolCallIds: new Set(
2166
- this.state.messages.filter(
2167
- (t) => Me(
2168
- t,
2169
- e.respondsToUserMessageId,
2170
- e.runId
2171
- )
2172
- ).map((t) => t.callId).filter((t) => typeof t == "string")
2173
- )
2174
- }), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
2175
- for (const [t, n] of this.activeBrowserToolCalls)
2176
- n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(t);
2177
- ls(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
2178
- messages: rs(
2337
+ return this.clientRuntime.route("conversation", { legacy: () => {
2338
+ if (!this.state.sessionId)
2339
+ return;
2340
+ this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
2341
+ const e = $r(
2179
2342
  this.state.messages,
2180
- e.clientMessageId,
2181
- e.runId
2182
- ),
2183
- pendingMessageStatus: null,
2184
- isThinking: !1,
2185
- ...this.state.taskStatus === "working" ? { taskStatus: "stopped" } : {},
2186
- isRetrying: !1,
2187
- lastError: null,
2188
- lastErrorCode: null,
2189
- lastErrorSecuritySettingsUrl: null
2190
- }), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.clearThinkingWatchdog();
2343
+ this.state.assistantDraftRespondsToUserMessageId,
2344
+ this.state.assistantDraftRunId,
2345
+ this.activeClientMessageId
2346
+ );
2347
+ this.stoppedTurns.push({
2348
+ sessionId: this.state.sessionId,
2349
+ ...e,
2350
+ reason: "user_requested",
2351
+ stoppedItemId: null,
2352
+ stoppedAt: null,
2353
+ stoppedCausalSequence: null,
2354
+ toolCallIds: new Set(
2355
+ this.state.messages.filter(
2356
+ (t) => Me(
2357
+ t,
2358
+ e.respondsToUserMessageId,
2359
+ e.runId
2360
+ )
2361
+ ).map((t) => t.callId).filter((t) => typeof t == "string")
2362
+ )
2363
+ }), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
2364
+ for (const [t, n] of this.activeBrowserToolCalls)
2365
+ n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(t);
2366
+ ds(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
2367
+ messages: ls(
2368
+ this.state.messages,
2369
+ e.clientMessageId,
2370
+ e.runId
2371
+ ),
2372
+ pendingMessageStatus: null,
2373
+ isThinking: !1,
2374
+ ...this.state.taskStatus === "working" ? { taskStatus: "stopped" } : {},
2375
+ isRetrying: !1,
2376
+ lastError: null,
2377
+ lastErrorCode: null,
2378
+ lastErrorSecuritySettingsUrl: null
2379
+ }), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.clearThinkingWatchdog();
2380
+ } });
2191
2381
  }
2192
2382
  startNewSession(e = {}) {
2193
- this.stopSessionRecoveryPolling();
2194
- const t = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
2195
- !this.options.keepRunsActiveOnSessionNavigation && t && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.rememberCurrentRunAsDetached(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((i) => i.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.personalModelSelectionOverride = null, this.options.model = void 0), t && this.send({
2196
- type: "session.reset",
2197
- sessionId: this.state.sessionId ?? void 0,
2198
- warmupId: n ?? void 0,
2199
- page: _()
2200
- }), this.setState({
2201
- sessionId: null,
2202
- starterPrompts: [...this.state.starterPrompts],
2203
- messages: [],
2204
- activeScheduledFollowUps: null,
2205
- isLoadingSession: !1,
2206
- assistantDraft: "",
2207
- assistantDraftItemId: null,
2208
- assistantDraftPhase: null,
2209
- assistantDraftRespondsToUserMessageId: null,
2210
- assistantDraftRunId: null,
2211
- pendingMessageStatus: null,
2212
- isThinking: !1,
2213
- taskStatus: null,
2214
- isRetrying: !1,
2215
- lastError: null
2216
- });
2383
+ return this.clientRuntime.route("directory", { legacy: () => {
2384
+ this.stopSessionRecoveryPolling();
2385
+ const t = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
2386
+ !this.options.keepRunsActiveOnSessionNavigation && t && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "new_chat" }), this.rememberCurrentRunAsBackground(), this.rememberCurrentRunAsDetached(), this.clearPendingComposerWarmup(), this.cleanupSessionBrowserApis(), this.queuedClientEvents = this.queuedClientEvents.filter((i) => i.type !== "chat.user_message"), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.stagedProactiveSuggestionQuestionMessageId = null, this.lastUserMessagePageUrl = null, this.clearSessionLoadRequest(), this.sessionActivityRequestId = null, this.retryAttemptsByClientMessageId = {}, this.thinkingWatchdogResyncAttemptsByClientMessageId = {}, this.nonTranscriptToolCallIds.clear(), this.options.productVariant === "personal" && (this.personalModelSelectionOverride = null, this.options.model = void 0), t && this.send({
2387
+ type: "session.reset",
2388
+ sessionId: this.state.sessionId ?? void 0,
2389
+ warmupId: n ?? void 0,
2390
+ page: _()
2391
+ }), this.setState({
2392
+ sessionId: null,
2393
+ starterPrompts: [...this.state.starterPrompts],
2394
+ messages: [],
2395
+ activeScheduledFollowUps: null,
2396
+ isLoadingSession: !1,
2397
+ assistantDraft: "",
2398
+ assistantDraftItemId: null,
2399
+ assistantDraftPhase: null,
2400
+ assistantDraftRespondsToUserMessageId: null,
2401
+ assistantDraftRunId: null,
2402
+ pendingMessageStatus: null,
2403
+ isThinking: !1,
2404
+ taskStatus: null,
2405
+ isRetrying: !1,
2406
+ lastError: null
2407
+ });
2408
+ } });
2217
2409
  }
2218
2410
  listSessions(e = {}) {
2219
- const t = x(), n = new Promise((r, o) => {
2220
- const a = window.setTimeout(() => {
2221
- this.pendingSessionHistoryRequests.delete(t), o(new Error("Session history did not respond in time"));
2222
- }, jt);
2223
- this.pendingSessionHistoryRequests.set(t, { resolve: r, reject: o, timeout: a });
2224
- }), i = {
2225
- type: "sessions.list",
2226
- requestId: t,
2227
- page: _(),
2228
- ...e.cursor ? { cursor: e.cursor } : {},
2229
- ...e.limit ? { limit: e.limit } : {},
2230
- ...typeof e.pinned == "boolean" ? { pinned: e.pinned } : {}
2231
- };
2232
- if (!this.sendNow(i)) {
2233
- const r = this.pendingSessionHistoryRequests.get(t);
2234
- return r && (window.clearTimeout(r.timeout), this.pendingSessionHistoryRequests.delete(t)), this.setState({ status: "reconnecting" }), this.scheduleReconnect(), Promise.reject(new Error("Pluno is reconnecting. Please try again."));
2235
- }
2236
- return n;
2411
+ return this.clientRuntime.route("directory", { legacy: () => {
2412
+ const t = x(), n = new Promise((r, o) => {
2413
+ const a = window.setTimeout(() => {
2414
+ this.pendingSessionHistoryRequests.delete(t), o(new Error("Session history did not respond in time"));
2415
+ }, Gt);
2416
+ this.pendingSessionHistoryRequests.set(t, { resolve: r, reject: o, timeout: a });
2417
+ }), i = {
2418
+ type: "sessions.list",
2419
+ requestId: t,
2420
+ page: _(),
2421
+ ...e.cursor ? { cursor: e.cursor } : {},
2422
+ ...e.limit ? { limit: e.limit } : {},
2423
+ ...typeof e.pinned == "boolean" ? { pinned: e.pinned } : {}
2424
+ };
2425
+ if (!this.sendNow(i)) {
2426
+ const r = this.pendingSessionHistoryRequests.get(t);
2427
+ return r && (window.clearTimeout(r.timeout), this.pendingSessionHistoryRequests.delete(t)), this.setState({ status: "reconnecting" }), this.scheduleReconnect(), Promise.reject(new Error("Pluno is reconnecting. Please try again."));
2428
+ }
2429
+ return n;
2430
+ } });
2237
2431
  }
2238
2432
  getSessionHistoryState() {
2239
- return this.sessionHistoryManager.getState();
2433
+ return this.clientRuntime.project("directory", { legacy: () => this.sessionHistoryManager.getState() });
2240
2434
  }
2241
2435
  subscribeSessionHistory(e) {
2242
- return this.sessionHistoryManager.subscribe(e);
2436
+ return this.clientRuntime.project("directory", { legacy: () => this.sessionHistoryManager.subscribe(e) });
2243
2437
  }
2244
2438
  refreshSessionHistory() {
2245
- return this.sessionHistoryManager.refresh();
2439
+ return this.clientRuntime.route("directory", { legacy: () => this.sessionHistoryManager.refresh() });
2246
2440
  }
2247
2441
  loadMoreSessionHistory() {
2248
- const e = this.sessionHistoryManager.getState().data?.nextCursor ?? null;
2249
- return e ? this.sessionHistoryManager.loadMore(e) : Promise.resolve();
2442
+ return this.clientRuntime.route("directory", { legacy: () => {
2443
+ const e = this.sessionHistoryManager.getState().data?.nextCursor ?? null;
2444
+ return e ? this.sessionHistoryManager.loadMore(e) : Promise.resolve();
2445
+ } });
2250
2446
  }
2251
2447
  setSessionPinned(e, t) {
2252
- const n = this.sessionHistoryManager.getEntity(e)?.isPinned === !0, i = this.sessionHistoryManager.setPinned(e, t);
2253
- return this.sendSessionMutation(
2254
- this.pendingSessionPinRequests,
2255
- { type: "session.pin", requestId: x(), sessionId: e, pinned: t },
2256
- "Session pin did not respond in time"
2257
- ).then(() => {
2258
- this.sessionHistoryManager.confirmPinned(e, i), this.sessionHistoryManager.refresh();
2259
- }).catch((r) => {
2260
- throw this.sessionHistoryManager.rollbackPinned(e, i, n), r;
2261
- });
2448
+ return this.clientRuntime.route("directory", { legacy: () => {
2449
+ const n = this.sessionHistoryManager.getEntity(e)?.isPinned === !0, i = this.sessionHistoryManager.setPinned(e, t);
2450
+ return this.sendSessionMutation(
2451
+ this.pendingSessionPinRequests,
2452
+ { type: "session.pin", requestId: x(), sessionId: e, pinned: t },
2453
+ "Session pin did not respond in time"
2454
+ ).then(() => {
2455
+ this.sessionHistoryManager.confirmPinned(e, i), this.sessionHistoryManager.refresh();
2456
+ }).catch((r) => {
2457
+ throw this.sessionHistoryManager.rollbackPinned(e, i, n), r;
2458
+ });
2459
+ } });
2262
2460
  }
2263
2461
  renameSession(e, t) {
2264
- const n = this.sessionHistoryManager.getEntity(e)?.customTitle ?? null;
2265
- return this.sessionHistoryManager.setTitle(e, t), this.sendSessionMutation(
2266
- this.pendingSessionRenameRequests,
2267
- { type: "session.rename", requestId: x(), sessionId: e, title: t },
2268
- "Session rename did not respond in time"
2269
- ).then(() => {
2270
- this.sessionHistoryManager.confirmTitle(e), this.sessionHistoryManager.refresh();
2271
- }).catch((i) => {
2272
- throw this.sessionHistoryManager.setTitle(e, n), this.sessionHistoryManager.confirmTitle(e), i;
2273
- });
2462
+ return this.clientRuntime.route("directory", { legacy: () => {
2463
+ const n = this.sessionHistoryManager.getEntity(e)?.customTitle ?? null;
2464
+ return this.sessionHistoryManager.setTitle(e, t), this.sendSessionMutation(
2465
+ this.pendingSessionRenameRequests,
2466
+ { type: "session.rename", requestId: x(), sessionId: e, title: t },
2467
+ "Session rename did not respond in time"
2468
+ ).then(() => {
2469
+ this.sessionHistoryManager.confirmTitle(e), this.sessionHistoryManager.refresh();
2470
+ }).catch((i) => {
2471
+ throw this.sessionHistoryManager.setTitle(e, n), this.sessionHistoryManager.confirmTitle(e), i;
2472
+ });
2473
+ } });
2274
2474
  }
2275
2475
  getInteractions() {
2276
- return this.runtimeInteractions.map((e) => ({ ...e }));
2476
+ return this.clientRuntime.project("interactions", { legacy: () => this.runtimeInteractions.map((e) => ({ ...e })) });
2277
2477
  }
2278
2478
  subscribeInteractions(e) {
2279
- return this.interactionListeners.add(e), e(this.getInteractions()), this.refreshRuntimeInteractions(), () => this.interactionListeners.delete(e);
2479
+ return this.clientRuntime.project("interactions", { legacy: () => (this.interactionListeners.add(e), e(this.getInteractions()), this.refreshRuntimeInteractions(), () => this.interactionListeners.delete(e)) });
2280
2480
  }
2281
2481
  async actOnInteraction(e, t, n, i = {}) {
2282
- const r = this.runtimeInteractions.find((o) => o.id === e);
2283
- if (!r || r.revision !== n || r.status !== "presentable")
2284
- throw new Error("This interaction is no longer available.");
2285
- if (!r.allowedActions.includes(t))
2286
- throw new Error("This action is not available for the interaction.");
2287
- if (Fn(t) && await this.interactionManager.act(
2288
- {
2289
- key: r.id,
2290
- category: r.category,
2291
- scope: r.scope,
2292
- allowedActions: r.allowedActions
2293
- },
2294
- t,
2295
- { snoozeUntil: i.snoozeUntil ? new Date(i.snoozeUntil) : void 0 }
2296
- ), r.kind === "integration_connection" && t === "connect") {
2297
- const o = r.payload.request;
2298
- this.integrationAuthStatusByRequestId.set(o.authRequestId, "checking"), this.integrationAuthErrorByRequestId.delete(o.authRequestId), this.rebuildRuntimeInteractions();
2299
- try {
2300
- await this.options.runtimeAdapters?.integrationAuthHandler?.(o);
2301
- const a = await this.options.runtimeAdapters?.integrationAuthStatusLoader?.(o) ?? "completed";
2302
- this.integrationAuthStatusByRequestId.set(o.authRequestId, a);
2303
- } catch (a) {
2304
- this.integrationAuthStatusByRequestId.set(o.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(
2305
- o.authRequestId,
2306
- a instanceof Error ? a.message : "Connection failed"
2307
- );
2482
+ return this.clientRuntime.route("interactions", { legacy: async () => {
2483
+ const r = this.runtimeInteractions.find((o) => o.id === e);
2484
+ if (!r || r.revision !== n || r.status !== "presentable")
2485
+ throw new Error("This interaction is no longer available.");
2486
+ if (!r.allowedActions.includes(t))
2487
+ throw new Error("This action is not available for the interaction.");
2488
+ if (Qn(t) && await this.interactionManager.act(
2489
+ {
2490
+ key: r.id,
2491
+ category: r.category,
2492
+ scope: r.scope,
2493
+ allowedActions: r.allowedActions
2494
+ },
2495
+ t,
2496
+ { snoozeUntil: i.snoozeUntil ? new Date(i.snoozeUntil) : void 0 }
2497
+ ), r.kind === "integration_connection" && t === "connect") {
2498
+ const o = r.payload.request;
2499
+ this.integrationAuthStatusByRequestId.set(o.authRequestId, "checking"), this.integrationAuthErrorByRequestId.delete(o.authRequestId), this.rebuildRuntimeInteractions();
2500
+ try {
2501
+ await this.options.runtimeAdapters?.integrationAuthHandler?.(o);
2502
+ const a = await this.options.runtimeAdapters?.integrationAuthStatusLoader?.(o) ?? "completed";
2503
+ this.integrationAuthStatusByRequestId.set(o.authRequestId, a);
2504
+ } catch (a) {
2505
+ this.integrationAuthStatusByRequestId.set(o.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(
2506
+ o.authRequestId,
2507
+ a instanceof Error ? a.message : "Connection failed"
2508
+ );
2509
+ }
2510
+ this.rebuildRuntimeInteractions();
2511
+ return;
2308
2512
  }
2309
- this.rebuildRuntimeInteractions();
2310
- return;
2311
- }
2312
- if (r.kind === "personal_channel_connection" && t === "connect") {
2313
- const o = r.payload.request;
2314
- await this.options.runtimeAdapters?.personalChannelConnectionHandler?.(o);
2315
- }
2316
- r.kind === "tab_group_permission" && (t === "enable" && await this.options.runtimeAdapters?.tabGroups?.enable(), t === "later" && await this.options.runtimeAdapters?.tabGroups?.dismiss()), await this.refreshRuntimeInteractions();
2513
+ if (r.kind === "personal_channel_connection" && t === "connect") {
2514
+ const o = r.payload.request;
2515
+ await this.options.runtimeAdapters?.personalChannelConnectionHandler?.(o);
2516
+ }
2517
+ r.kind === "tab_group_permission" && (t === "enable" && await this.options.runtimeAdapters?.tabGroups?.enable(), t === "later" && await this.options.runtimeAdapters?.tabGroups?.dismiss()), await this.refreshRuntimeInteractions();
2518
+ } });
2317
2519
  }
2318
2520
  async refreshRuntimeInteractions() {
2319
2521
  const e = this.options.runtimeAdapters?.tabGroups;
@@ -2335,7 +2537,7 @@ class Ne {
2335
2537
  this.rebuildRuntimeInteractions();
2336
2538
  }
2337
2539
  rebuildRuntimeInteractions() {
2338
- const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? tn(this.state.messages) : null;
2540
+ const e = [], t = this.options.productVariant === "personal" && (this.options.entrySurface === "main_web_chat" || this.options.entrySurface === "automation") ? un(this.state.messages) : null;
2339
2541
  if (t) {
2340
2542
  const r = {
2341
2543
  key: t.id,
@@ -2442,13 +2644,13 @@ class Ne {
2442
2644
  for (const r of this.interactionListeners) r(this.getInteractions());
2443
2645
  }
2444
2646
  getAccount() {
2445
- return this.account ? { ...this.account } : null;
2647
+ return this.clientRuntime.project("account", { legacy: () => this.account ? { ...this.account } : null });
2446
2648
  }
2447
2649
  subscribeAccount(e) {
2448
- return this.accountListeners.add(e), e(this.getAccount()), () => this.accountListeners.delete(e);
2650
+ return this.clientRuntime.project("account", { legacy: () => (this.accountListeners.add(e), e(this.getAccount()), () => this.accountListeners.delete(e)) });
2449
2651
  }
2450
2652
  refreshAccount() {
2451
- return this.options.accountLoader ? this.accountRefresh ? this.accountRefresh : (this.accountRefresh = this.options.accountLoader().then((e) => {
2653
+ return this.clientRuntime.route("account", { legacy: () => this.options.accountLoader ? this.accountRefresh ? this.accountRefresh : (this.accountRefresh = this.options.accountLoader().then((e) => {
2452
2654
  e && (this.account = {
2453
2655
  ...e,
2454
2656
  usingPaidCreditFallback: this.usingPaidCreditFallback
@@ -2456,40 +2658,42 @@ class Ne {
2456
2658
  for (const t of this.accountListeners) t(this.getAccount());
2457
2659
  }).finally(() => {
2458
2660
  this.accountRefresh = null;
2459
- }), this.accountRefresh) : Promise.resolve();
2661
+ }), this.accountRefresh) : Promise.resolve() });
2460
2662
  }
2461
2663
  loadSession(e) {
2462
- const t = x(), n = this.activeComposerWarmupId;
2463
- this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
2464
- const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = Dr(i ?? []);
2465
- !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), n && this.send({
2466
- type: "session.reset",
2467
- warmupId: n,
2468
- page: _()
2469
- }), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.options.productVariant === "personal" && this.state.sessionId !== e && (this.personalModelSelectionOverride = null, this.options.model = void 0), this.clearSessionLoadRequest(), this.sessionLoadRequestId = t, this.sessionActivityRequestId = null, this.setState({
2470
- sessionId: e,
2471
- // A session-keyed timeline can render immediately while the subscription handshake and authoritative
2472
- // history reload preserve the live-event race guarantees for this selected chat.
2473
- messages: i ?? [],
2474
- activeScheduledFollowUps: null,
2475
- isLoadingSession: !0,
2476
- assistantDraft: r?.content ?? "",
2477
- assistantDraftItemId: r?.id ?? null,
2478
- assistantDraftPhase: r?.phase ?? null,
2479
- assistantDraftRespondsToUserMessageId: r?.respondsToUserMessageId ?? null,
2480
- assistantDraftRunId: r?.runId ?? null,
2481
- pendingMessageStatus: null,
2482
- isThinking: o,
2483
- taskStatus: o ? "working" : null,
2484
- isRetrying: !1,
2485
- lastError: null,
2486
- lastErrorCode: null
2487
- }), this.canLoadSessionHistoryOverHttp() ? (this.state.status === "reconnecting" && this.startSessionRecoveryPolling(), this.loadSessionHistoryOverHttp(e, t)) : this.send({
2488
- type: "session.load",
2489
- requestId: t,
2490
- sessionId: e,
2491
- page: _()
2492
- });
2664
+ return this.clientRuntime.route("directory", { legacy: () => {
2665
+ const t = x(), n = this.activeComposerWarmupId;
2666
+ this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
2667
+ const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = Fr(i ?? []);
2668
+ !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId !== e && this.rememberCurrentRunAsDetached(), this.detachedSessionIds.delete(e), this.deferredDetachedSessionEvents.delete(e), !this.options.keepRunsActiveOnSessionNavigation && this.state.sessionId && (this.state.isThinking || this.state.pendingMessageStatus !== null) && this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "session_switch" }), this.options.keepRunsActiveOnSessionNavigation && (this.rememberCurrentRunAsBackground(), this.backgroundSessionIds.delete(e), this.deferredSessionUpdatedSessionIds.delete(e)), this.clearPendingComposerWarmup(), n && this.send({
2669
+ type: "session.reset",
2670
+ warmupId: n,
2671
+ page: _()
2672
+ }), this.clearThinkingWatchdog(), this.clearAllFirstResponseTimers(), this.clearPendingDeliveryTimers(), this.pendingClientMessageId = null, this.pendingUserMessageEvent = null, this.failedUserMessageEvent = null, this.lastUserMessagePageUrl = null, this.options.productVariant === "personal" && this.state.sessionId !== e && (this.personalModelSelectionOverride = null, this.options.model = void 0), this.clearSessionLoadRequest(), this.sessionLoadRequestId = t, this.sessionActivityRequestId = null, this.setState({
2673
+ sessionId: e,
2674
+ // A session-keyed timeline can render immediately while the subscription handshake and authoritative
2675
+ // history reload preserve the live-event race guarantees for this selected chat.
2676
+ messages: i ?? [],
2677
+ activeScheduledFollowUps: null,
2678
+ isLoadingSession: !0,
2679
+ assistantDraft: r?.content ?? "",
2680
+ assistantDraftItemId: r?.id ?? null,
2681
+ assistantDraftPhase: r?.phase ?? null,
2682
+ assistantDraftRespondsToUserMessageId: r?.respondsToUserMessageId ?? null,
2683
+ assistantDraftRunId: r?.runId ?? null,
2684
+ pendingMessageStatus: null,
2685
+ isThinking: o,
2686
+ taskStatus: o ? "working" : null,
2687
+ isRetrying: !1,
2688
+ lastError: null,
2689
+ lastErrorCode: null
2690
+ }), this.canLoadSessionHistoryOverHttp() ? (this.state.status === "reconnecting" && this.startSessionRecoveryPolling(), this.loadSessionHistoryOverHttp(e, t)) : this.send({
2691
+ type: "session.load",
2692
+ requestId: t,
2693
+ sessionId: e,
2694
+ page: _()
2695
+ });
2696
+ } });
2493
2697
  }
2494
2698
  canLoadSessionHistoryOverHttp() {
2495
2699
  return !this.options.token && !this.options.tokenProvider ? !1 : this.options.productVariant === "customer_embedded" || !!this.options.runtimeCommunityId;
@@ -2595,7 +2799,7 @@ class Ne {
2595
2799
  });
2596
2800
  if (!c.ok) {
2597
2801
  const d = await c.text() || `History request failed (${c.status})`;
2598
- throw $n(c.status) ? new Error(d) : new Te(d);
2802
+ throw Xn(c.status) ? new Error(d) : new Te(d);
2599
2803
  }
2600
2804
  const u = await c.json();
2601
2805
  if (!u?.session || !Array.isArray(u.items))
@@ -2632,7 +2836,7 @@ class Ne {
2632
2836
  send(e) {
2633
2837
  this.sendNow(L(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
2634
2838
  (i) => i.type === "chat.user_message" && i.clientMessageId === e.clientMessageId
2635
- ) || this.queuedClientEvents.push(e), V(this.options.clientId, this.queuedClientEvents), this.setState({
2839
+ ) || this.queuedClientEvents.push(e), Q(this.options.clientId, this.queuedClientEvents), this.setState({
2636
2840
  status: "reconnecting",
2637
2841
  ...e.type === "chat.user_message" && e.clientMessageId === this.pendingClientMessageId ? { pendingMessageStatus: "reconnecting" } : {}
2638
2842
  }), this.scheduleReconnect());
@@ -2650,7 +2854,7 @@ class Ne {
2650
2854
  return !1;
2651
2855
  const t = this.socket;
2652
2856
  try {
2653
- return t.send(JSON.stringify(e)), Se("client_event", e.type, Bt(e)), !0;
2857
+ return t.send(JSON.stringify(e)), Se("client_event", e.type, $t(e)), !0;
2654
2858
  } catch (n) {
2655
2859
  return b("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
2656
2860
  message: n instanceof Error ? n.message : String(n),
@@ -2700,7 +2904,7 @@ class Ne {
2700
2904
  clientMessageId: e,
2701
2905
  durationMs: Date.now() - n
2702
2906
  });
2703
- }, Math.max(0, ti - (Date.now() - n)));
2907
+ }, Math.max(0, ci - (Date.now() - n)));
2704
2908
  this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
2705
2909
  }
2706
2910
  clearFirstResponseTimer(e) {
@@ -2810,7 +3014,7 @@ class Ne {
2810
3014
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
2811
3015
  return;
2812
3016
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
2813
- const e = zi();
3017
+ const e = Zi();
2814
3018
  this.sendNow(
2815
3019
  L({
2816
3020
  type: "starter_prompts.page_context",
@@ -2821,13 +3025,13 @@ class Ne {
2821
3025
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
2822
3026
  }
2823
3027
  startStarterPromptUrlWatcher() {
2824
- this.locationChangeCleanup || (this.locationChangeCleanup = Ki(() => this.handleStarterPromptUrlChange()));
3028
+ this.locationChangeCleanup || (this.locationChangeCleanup = er(() => this.handleStarterPromptUrlChange()));
2825
3029
  }
2826
3030
  handleStarterPromptUrlChange() {
2827
3031
  const e = location.href;
2828
3032
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
2829
3033
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
2830
- }, fi));
3034
+ }, Mi));
2831
3035
  }
2832
3036
  refreshStarterPromptsForCurrentUrl() {
2833
3037
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -2842,22 +3046,22 @@ class Ne {
2842
3046
  if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
2843
3047
  return;
2844
3048
  const e = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
2845
- V(this.options.clientId, this.queuedClientEvents);
3049
+ Q(this.options.clientId, this.queuedClientEvents);
2846
3050
  for (let t = 0; t < e.length; t += 1) {
2847
3051
  const n = e[t];
2848
3052
  if (!this.sendNow(L(n))) {
2849
- this.queuedClientEvents.unshift(n, ...e.slice(t + 1)), V(this.options.clientId, this.queuedClientEvents);
3053
+ this.queuedClientEvents.unshift(n, ...e.slice(t + 1)), Q(this.options.clientId, this.queuedClientEvents);
2850
3054
  return;
2851
3055
  }
2852
- V(this.options.clientId, this.queuedClientEvents);
3056
+ Q(this.options.clientId, this.queuedClientEvents);
2853
3057
  }
2854
3058
  }
2855
3059
  resetForAuthenticationScopeChange() {
2856
- this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [], V(this.options.clientId, this.queuedClientEvents), this.pendingWidgetLifecycleEvents = [], this.backgroundSessionIds.clear(), this.backgroundClientMessageIds.clear(), this.deferredSessionUpdatedSessionIds.clear(), this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear(), this.sessionTimelineCache.clear();
3060
+ this.startNewSession({ notifyTransport: !1 }), this.queuedClientEvents = [], Q(this.options.clientId, this.queuedClientEvents), this.pendingWidgetLifecycleEvents = [], this.backgroundSessionIds.clear(), this.backgroundClientMessageIds.clear(), this.deferredSessionUpdatedSessionIds.clear(), this.detachedSessionIds.clear(), this.detachedClientMessageIds.clear(), this.deferredDetachedSessionEvents.clear(), this.sessionTimelineCache.clear();
2857
3061
  }
2858
3062
  rememberSessionTimeline(e, t) {
2859
3063
  const n = [...t];
2860
- for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > gi; ) {
3064
+ for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > Ai; ) {
2861
3065
  const i = this.sessionTimelineCache.keys().next().value;
2862
3066
  if (!i)
2863
3067
  break;
@@ -2887,8 +3091,8 @@ class Ne {
2887
3091
  return;
2888
3092
  this.clearPendingWarmupAckTimer();
2889
3093
  const t = Math.min(
2890
- Jn * 2 ** e.retryAttempt,
2891
- Yn
3094
+ ri * 2 ** e.retryAttempt,
3095
+ oi
2892
3096
  );
2893
3097
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
2894
3098
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -2932,7 +3136,7 @@ class Ne {
2932
3136
  if (!e || !t)
2933
3137
  return;
2934
3138
  const n = this.findStoppedTurn(e, t);
2935
- !n || n.reason !== "task_tab_closed" || An(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
3139
+ !n || n.reason !== "task_tab_closed" || Pn(n, t) && (this.stoppedTurns.splice(this.stoppedTurns.indexOf(n), 1), n.stoppedItemId && this.setState({
2936
3140
  messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
2937
3141
  }));
2938
3142
  }
@@ -2960,7 +3164,7 @@ class Ne {
2960
3164
  });
2961
3165
  }
2962
3166
  handleServerEvent(e) {
2963
- if (Se("server_event", e.type, Bt(e)), e.type === "session.subscribed") {
3167
+ if (Se("server_event", e.type, $t(e)), e.type === "session.subscribed") {
2964
3168
  const t = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
2965
3169
  if (t && n && t === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
2966
3170
  const i = this.pendingSessionSubscription;
@@ -3011,7 +3215,7 @@ class Ne {
3011
3215
  }
3012
3216
  }
3013
3217
  if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
3014
- if (bi(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
3218
+ if (Ui(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
3015
3219
  this.handleRunSteered(e);
3016
3220
  return;
3017
3221
  }
@@ -3026,17 +3230,17 @@ class Ne {
3026
3230
  this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
3027
3231
  return;
3028
3232
  }
3029
- if (Mi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3233
+ if (vi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3030
3234
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
3031
- const t = ar(e.user);
3235
+ const t = fr(e.user);
3032
3236
  this.authenticatedSocket !== this.socket && this.authenticatedUserId && t && t.id !== this.authenticatedUserId && this.resetForAuthenticationScopeChange(), this.authenticatedUserId = t?.id ?? null, this.authenticatedSocket = this.socket, this.flushPendingWidgetLifecycleEvents(), this.flushPendingComposerWarmup(), this.flushQueuedClientEvents(), this.pendingClientMessageId && (this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(this.pendingClientMessageId)), this.flushPendingPassiveWarmup(), this.startHeartbeat();
3033
- const n = sr(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3237
+ const n = ur(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3034
3238
  b("web-sdk.agent", "Received auth.ok appearance", {
3035
3239
  hasAppearance: i,
3036
3240
  rawAppearance: e.appearance,
3037
3241
  normalizedAppearance: n
3038
- }), this.runtimeHelperJavascript = nr(e.runtimeHelpers)?.javascript ?? null;
3039
- const r = Vt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
3242
+ }), this.runtimeHelperJavascript = dr(e.runtimeHelpers)?.javascript ?? null;
3243
+ const r = Yt(e, "starterPrompts"), o = Object.prototype.hasOwnProperty.call(e, "starterPrompts"), a = e.starterPromptsLoading === !0, l = {
3040
3244
  user: t,
3041
3245
  status: "connected",
3042
3246
  ...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
@@ -3055,21 +3259,21 @@ class Ne {
3055
3259
  }
3056
3260
  if (e.type === "starterPrompts.updated") {
3057
3261
  this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
3058
- starterPrompts: Vt(e, "starterPrompts"),
3262
+ starterPrompts: Yt(e, "starterPrompts"),
3059
3263
  starterPromptsLoading: !1
3060
3264
  });
3061
3265
  return;
3062
3266
  }
3063
3267
  if (e.type === "scheduled_follow_ups.updated") {
3064
3268
  typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
3065
- activeScheduledFollowUps: Xt(
3269
+ activeScheduledFollowUps: Zt(
3066
3270
  e.activeScheduledFollowUps
3067
3271
  )
3068
3272
  });
3069
3273
  return;
3070
3274
  }
3071
3275
  if (e.type === "conversation.state") {
3072
- const t = Array.isArray(e.items) ? e.items : [], n = qt(t), i = Object.prototype.hasOwnProperty.call(
3276
+ const t = Array.isArray(e.items) ? e.items : [], n = Lt(t), i = Object.prototype.hasOwnProperty.call(
3073
3277
  e,
3074
3278
  "activeScheduledFollowUps"
3075
3279
  ), r = A(e.session, "id") ?? this.state.sessionId, o = typeof e.requestId == "string" ? e.requestId : null, a = this.state.isLoadingSession && this.sessionLoadRequestId === null && o === null && r === this.state.sessionId && this.canLoadSessionHistoryOverHttp();
@@ -3086,7 +3290,7 @@ class Ne {
3086
3290
  runId: u?.runId
3087
3291
  }), g = this.filterStoppedSnapshotItems(n, r), f = e.pendingMessageStatus === "sending" ? "sending" : e.pendingMessageStatus === "queued" ? "reconnecting" : null, h = typeof e.pendingClientMessageId == "string" ? e.pendingClientMessageId : null, p = e.isRetrying === !0, y = e.turnPhase === "sending" || e.turnPhase === "starting" || e.turnPhase === "thinking" ? e.turnPhase : null;
3088
3292
  f && h && (this.pendingClientMessageId = h);
3089
- let m = fr(
3293
+ let m = Mr(
3090
3294
  e.assistantDraft
3091
3295
  );
3092
3296
  m && this.findStoppedTurn(r, {
@@ -3095,31 +3299,31 @@ class Ne {
3095
3299
  }) && (m = void 0);
3096
3300
  const M = m !== void 0;
3097
3301
  this.rememberUserMessageClientMessageIds(g);
3098
- const w = Cr(g), D = g.filter((U) => {
3302
+ const w = xr(g), D = g.filter((U) => {
3099
3303
  const q = C(U);
3100
- return Er(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
3101
- }), S = lt(
3304
+ return qr(q) ? !1 : !q || !w || !pe(q) ? !0 : ht(g, q) !== w;
3305
+ }), S = ct(
3102
3306
  this.state.messages,
3103
3307
  st(D, this.options.backendUrl)
3104
- ), T = ss(S), N = M ? m?.content ?? "" : this.state.assistantDraft, v = M ? m?.itemId ?? null : this.state.assistantDraftItemId, re = M ? m?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, Y = M ? m?.runId ?? null : this.state.assistantDraftRunId, Z = g.some(
3105
- (U, q) => ns(
3308
+ ), T = rs(S), N = M ? m?.content ?? "" : this.state.assistantDraft, v = M ? m?.itemId ?? null : this.state.assistantDraftItemId, re = M ? m?.respondsToUserMessageId ?? null : this.state.assistantDraftRespondsToUserMessageId, Y = M ? m?.runId ?? null : this.state.assistantDraftRunId, Z = g.some(
3309
+ (U, q) => os(
3106
3310
  C(U),
3107
3311
  N,
3108
3312
  v,
3109
3313
  re,
3110
3314
  Y,
3111
- _r(g, q)
3315
+ Lr(g, q)
3112
3316
  )
3113
- ), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q = br(S), oe = B && Q ? "completed" : d ? "stopped" : B ? "failed" : null;
3114
- if (!T && kr(this.state.messages, g))
3317
+ ), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), V = Ur(S), oe = B && V ? "completed" : d ? "stopped" : B ? "failed" : null;
3318
+ if (!T && Or(this.state.messages, g))
3115
3319
  return;
3116
- this.lastUserMessagePageUrl = Rr(g);
3117
- const j = B || d ? null : ut(g);
3118
- if (this.latestRecoverableClientMessageId = j, Q && this.clearRetryTimers(), this.setState({
3320
+ this.lastUserMessagePageUrl = Dr(g);
3321
+ const j = B || d ? null : dt(g);
3322
+ if (this.latestRecoverableClientMessageId = j, V && this.clearRetryTimers(), this.setState({
3119
3323
  sessionId: A(e.session, "id") ?? this.state.sessionId,
3120
3324
  messages: S,
3121
3325
  ...i ? {
3122
- activeScheduledFollowUps: Xt(
3326
+ activeScheduledFollowUps: Zt(
3123
3327
  e.activeScheduledFollowUps
3124
3328
  )
3125
3329
  } : {},
@@ -3186,14 +3390,14 @@ class Ne {
3186
3390
  this.options.backendUrl
3187
3391
  );
3188
3392
  t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
3189
- messages: Sr(this.state.messages, i)
3393
+ messages: kr(this.state.messages, i)
3190
3394
  });
3191
3395
  return;
3192
3396
  }
3193
3397
  if (e.type === "sessions.page") {
3194
3398
  const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
3195
3399
  t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
3196
- sessions: lr(e.sessions),
3400
+ sessions: mr(e.sessions),
3197
3401
  nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
3198
3402
  }));
3199
3403
  return;
@@ -3228,15 +3432,15 @@ class Ne {
3228
3432
  }
3229
3433
  const n = Ue(e.item, this.options.backendUrl);
3230
3434
  if (n) {
3231
- const i = xr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3232
- n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), vr(t) && this.clearRunAckResyncRetryTimer();
3233
- const o = de(this.state.messages, n), a = ss(o), l = ns(
3435
+ const i = jr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3436
+ n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), Hr(t) && this.clearRunAckResyncRetryTimer();
3437
+ const o = de(this.state.messages, n), a = rs(o), l = os(
3234
3438
  t,
3235
3439
  this.state.assistantDraft,
3236
3440
  this.state.assistantDraftItemId,
3237
3441
  this.state.assistantDraftRespondsToUserMessageId,
3238
3442
  this.state.assistantDraftRunId,
3239
- vs(
3443
+ qs(
3240
3444
  o,
3241
3445
  o.findIndex((d) => d.id === n.id)
3242
3446
  )
@@ -3298,7 +3502,7 @@ class Ne {
3298
3502
  const t = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, i = typeof e.runId == "string" ? e.runId : null;
3299
3503
  if (!(n && this.state.assistantDraftRespondsToUserMessageId ? n === this.state.assistantDraftRespondsToUserMessageId : !i || !this.state.assistantDraftRunId || i === this.state.assistantDraftRunId))
3300
3504
  return;
3301
- const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !i || i === this.activeResponseRunId), l = Dt(
3505
+ const o = n ? this.clientMessageIdsByUserMessageItemId.get(n) ?? null : null, a = !this.activeClientMessageId || (o ? o === this.activeClientMessageId : this.activeResponseUserMessageId ? !n || n === this.activeResponseUserMessageId : !this.activeResponseRunId || !i || i === this.activeResponseRunId), l = xt(
3302
3506
  this.state.messages.filter(
3303
3507
  (c) => c.dataType !== "assistant_draft" || !Me(
3304
3508
  c,
@@ -3308,11 +3512,11 @@ class Ne {
3308
3512
  ),
3309
3513
  n,
3310
3514
  i,
3311
- ct
3515
+ ut
3312
3516
  );
3313
3517
  this.setState({
3314
3518
  sessionId: t,
3315
- messages: Yt(
3519
+ messages: ts(
3316
3520
  l,
3317
3521
  typeof e.responseId == "string" ? e.responseId : null,
3318
3522
  n,
@@ -3335,9 +3539,9 @@ class Ne {
3335
3539
  if (t)
3336
3540
  this.nonTranscriptToolCallIds.add(t);
3337
3541
  else {
3338
- const n = ts(e);
3542
+ const n = is(e);
3339
3543
  if (n) {
3340
- const i = Zt(
3544
+ const i = ss(
3341
3545
  this.state.messages,
3342
3546
  n
3343
3547
  );
@@ -3405,13 +3609,13 @@ class Ne {
3405
3609
  return;
3406
3610
  }
3407
3611
  o && i && r && (this.retryableClientMessageId = r);
3408
- const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = $i(a.message);
3612
+ const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Xi(a.message);
3409
3613
  l && console.error(l);
3410
- const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = rs(
3614
+ const c = r ?? this.activeClientMessageId, u = typeof e.runId == "string" ? e.runId : null, d = ls(
3411
3615
  this.state.messages,
3412
3616
  c,
3413
3617
  u
3414
- ), g = Mr(
3618
+ ), g = vr(
3415
3619
  d,
3416
3620
  c,
3417
3621
  u
@@ -3442,7 +3646,7 @@ class Ne {
3442
3646
  }
3443
3647
  applyAccountSubmissionError(e) {
3444
3648
  if (!this.account || !e) return;
3445
- const t = bn(this.account.submissionGate, e);
3649
+ const t = Un(this.account.submissionGate, e);
3446
3650
  if (!(t === this.account.submissionGate || t.allowed)) {
3447
3651
  this.account = {
3448
3652
  ...this.account,
@@ -3455,10 +3659,10 @@ class Ne {
3455
3659
  if (this.options.productVariant !== "personal" || !e || typeof e != "object" || this.personalModelSelectionOverride !== null)
3456
3660
  return;
3457
3661
  const t = e.metadata, n = t && typeof t == "object" ? t.model : void 0;
3458
- this.options.model = Ve(n) ? n : "gpt-5.6-sol";
3662
+ this.options.model = Qe(n) ? n : "gpt-5.6-sol";
3459
3663
  }
3460
3664
  updateAccountFallbackFromSession(e) {
3461
- const t = e && typeof e == "object" ? e.metadata : null, n = Rn(t);
3665
+ const t = e && typeof e == "object" ? e.metadata : null, n = Dn(t);
3462
3666
  if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
3463
3667
  this.account = { ...this.account, usingPaidCreditFallback: n };
3464
3668
  for (const i of this.accountListeners) i(this.getAccount());
@@ -3478,7 +3682,7 @@ class Ne {
3478
3682
  return;
3479
3683
  const n = this.sessionTimelineCache.get(t);
3480
3684
  if (e.type === "conversation.state") {
3481
- const i = qt(
3685
+ const i = Lt(
3482
3686
  Array.isArray(e.items) ? e.items : []
3483
3687
  ), r = st(
3484
3688
  this.filterStoppedSnapshotItems(i, t),
@@ -3486,7 +3690,7 @@ class Ne {
3486
3690
  );
3487
3691
  (n || r.length > 0) && this.rememberSessionTimeline(
3488
3692
  t,
3489
- n ? lt(n, r) : r
3693
+ n ? ct(n, r) : r
3490
3694
  );
3491
3695
  return;
3492
3696
  }
@@ -3500,10 +3704,10 @@ class Ne {
3500
3704
  return;
3501
3705
  }
3502
3706
  if (e.type === "tool.call") {
3503
- const i = e.hiddenFromTranscript === !0 ? null : ts(e);
3707
+ const i = e.hiddenFromTranscript === !0 ? null : is(e);
3504
3708
  i && this.rememberSessionTimeline(
3505
3709
  t,
3506
- Zt(n, i)
3710
+ ss(n, i)
3507
3711
  );
3508
3712
  return;
3509
3713
  }
@@ -3515,7 +3719,7 @@ class Ne {
3515
3719
  return;
3516
3720
  this.rememberSessionTimeline(
3517
3721
  t,
3518
- es(
3722
+ ns(
3519
3723
  n,
3520
3724
  e.callId,
3521
3725
  i
@@ -3542,17 +3746,17 @@ class Ne {
3542
3746
  return;
3543
3747
  }
3544
3748
  if (e.type === "chat.assistant_done") {
3545
- const i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = Dt(
3749
+ const i = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : null, r = typeof e.runId == "string" ? e.runId : null, o = xt(
3546
3750
  n.filter(
3547
3751
  (a) => a.dataType !== "assistant_draft" || !Me(a, i, r)
3548
3752
  ),
3549
3753
  i,
3550
3754
  r,
3551
- ct
3755
+ ut
3552
3756
  );
3553
3757
  this.rememberSessionTimeline(
3554
3758
  t,
3555
- Yt(
3759
+ ts(
3556
3760
  o,
3557
3761
  typeof e.responseId == "string" ? e.responseId : null,
3558
3762
  i,
@@ -3567,7 +3771,7 @@ class Ne {
3567
3771
  return;
3568
3772
  this.rememberSessionTimeline(
3569
3773
  t,
3570
- os(
3774
+ cs(
3571
3775
  n,
3572
3776
  i,
3573
3777
  null,
@@ -3576,9 +3780,9 @@ class Ne {
3576
3780
  );
3577
3781
  return;
3578
3782
  }
3579
- e.type === "error" && typeof e.requestId != "string" && !is(e, t) && this.rememberSessionTimeline(
3783
+ e.type === "error" && typeof e.requestId != "string" && !as(e, t) && this.rememberSessionTimeline(
3580
3784
  t,
3581
- qr(n, e)
3785
+ Wr(n, e)
3582
3786
  );
3583
3787
  }
3584
3788
  }
@@ -3612,7 +3816,7 @@ class Ne {
3612
3816
  }
3613
3817
  handleRetryableRecoveryError(e) {
3614
3818
  const t = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
3615
- if (!is(e, t) || !n)
3819
+ if (!as(e, t) || !n)
3616
3820
  return !1;
3617
3821
  if (et())
3618
3822
  return this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
@@ -3653,7 +3857,7 @@ class Ne {
3653
3857
  const i = new Promise((r, o) => {
3654
3858
  const a = window.setTimeout(() => {
3655
3859
  e.delete(t.requestId), o(new Error(n));
3656
- }, jt);
3860
+ }, Gt);
3657
3861
  e.set(t.requestId, { resolve: r, reject: o, timeout: a });
3658
3862
  });
3659
3863
  if (!this.sendNow(t)) {
@@ -3676,7 +3880,7 @@ class Ne {
3676
3880
  e.clear();
3677
3881
  }
3678
3882
  markThinkingProgress() {
3679
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(ei), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3883
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(li), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3680
3884
  }
3681
3885
  scheduleThinkingWatchdog(e) {
3682
3886
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -3734,19 +3938,19 @@ class Ne {
3734
3938
  schedulePendingDeliveryAck(e) {
3735
3939
  this.clearPendingDeliveryTimers(), !et() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
3736
3940
  this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
3737
- }, $t));
3941
+ }, Kt));
3738
3942
  }
3739
3943
  retryPendingDelivery(e) {
3740
3944
  if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
3741
3945
  return;
3742
3946
  const t = this.retryAttemptsByClientMessageId[e] ?? 0;
3743
- if (t >= si) {
3947
+ if (t >= ui) {
3744
3948
  this.failPendingDelivery(e);
3745
3949
  return;
3746
3950
  }
3747
3951
  t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
3748
3952
  this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
3749
- }, mi(t, oi));
3953
+ }, bi(t, gi));
3750
3954
  }
3751
3955
  failPendingDelivery(e) {
3752
3956
  if (this.pendingClientMessageId !== e)
@@ -3759,7 +3963,7 @@ class Ne {
3759
3963
  ...this.state.isThinking ? {} : { turnPhase: null },
3760
3964
  isRetrying: !1,
3761
3965
  ...this.state.isThinking ? {} : { taskStatus: "failed" },
3762
- lastError: ii,
3966
+ lastError: hi,
3763
3967
  lastErrorCode: "message_delivery_failed"
3764
3968
  });
3765
3969
  }
@@ -3771,7 +3975,7 @@ class Ne {
3771
3975
  if (this.state.isThinking && t) {
3772
3976
  const r = this.state.assistantDraftRespondsToUserMessageId !== null && this.state.assistantDraftRespondsToUserMessageId !== t;
3773
3977
  this.setState({
3774
- messages: os(
3978
+ messages: cs(
3775
3979
  this.state.messages,
3776
3980
  t,
3777
3981
  n,
@@ -3797,13 +4001,13 @@ class Ne {
3797
4001
  scheduleRunAckWatchdog(e) {
3798
4002
  this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
3799
4003
  this.runAckWatchdogTimer = null, this.recoverMissedRunAck(e);
3800
- }, $t);
4004
+ }, Kt);
3801
4005
  }
3802
4006
  recoverMissedRunAck(e) {
3803
4007
  !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (b("web-sdk.agent", "Pluno run ack missed; resyncing session", {
3804
4008
  sessionId: this.state.sessionId,
3805
4009
  clientMessageId: e
3806
- }), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt));
4010
+ }), this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(zt));
3807
4011
  }
3808
4012
  clearRunAckResyncRetryTimer() {
3809
4013
  this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
@@ -3826,7 +4030,7 @@ class Ne {
3826
4030
  ),
3827
4031
  isThinking: !1,
3828
4032
  taskStatus: "failed",
3829
- lastError: ni,
4033
+ lastError: di,
3830
4034
  lastErrorCode: "run_recovery_exhausted"
3831
4035
  }), this.clearThinkingWatchdog();
3832
4036
  return;
@@ -3836,7 +4040,7 @@ class Ne {
3836
4040
  sessionId: this.state.sessionId,
3837
4041
  clientMessageId: e,
3838
4042
  resyncAttempts: t + 1
3839
- }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt);
4043
+ }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(zt);
3840
4044
  }
3841
4045
  resyncThinkingSession() {
3842
4046
  this.state.sessionId ? this.send({
@@ -3853,7 +4057,7 @@ class Ne {
3853
4057
  if (!t || !n || !i)
3854
4058
  return;
3855
4059
  const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
3856
- if (!a && !l || !io(o)) {
4060
+ if (!a && !l || !po(o)) {
3857
4061
  this.setToolMessageLoading(n, !1), this.send({
3858
4062
  type: "tool.result",
3859
4063
  sessionId: t,
@@ -3900,9 +4104,9 @@ class Ne {
3900
4104
  startedAtOrigin: location.origin
3901
4105
  }), this.installSessionBrowserApis();
3902
4106
  let c = null, u;
3903
- c = await this.executeRuntimeHelper(), u = await Gt(
4107
+ c = await this.executeRuntimeHelper(), u = await Jt(
3904
4108
  o,
3905
- Ni(e.runtimeContext, this.options.backendUrl)
4109
+ Ki(e.runtimeContext, this.options.backendUrl)
3906
4110
  ).catch((d) => ({
3907
4111
  ok: !1,
3908
4112
  exception: {
@@ -3915,11 +4119,11 @@ class Ne {
3915
4119
  toolName: i,
3916
4120
  summary: o.summary,
3917
4121
  rawInput: L(o),
3918
- rawOutput: L(ir(u, c))
3919
- }), ls(this.options.clientId, this.activeBrowserToolCalls.values()));
4122
+ rawOutput: L(hr(u, c))
4123
+ }), ds(this.options.clientId, this.activeBrowserToolCalls.values()));
3920
4124
  }
3921
4125
  setToolMessageLoading(e, t) {
3922
- const n = es(
4126
+ const n = ns(
3923
4127
  this.state.messages,
3924
4128
  e,
3925
4129
  t
@@ -3930,33 +4134,33 @@ class Ne {
3930
4134
  if (this.pageLifecycleCleanup)
3931
4135
  return;
3932
4136
  const e = () => {
3933
- Ds(this.options.clientId, this.activeBrowserToolCalls.values());
4137
+ xs(this.options.clientId, this.activeBrowserToolCalls.values());
3934
4138
  };
3935
4139
  window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
3936
4140
  window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
3937
4141
  };
3938
4142
  }
3939
4143
  installSessionBrowserApis() {
3940
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ci();
4144
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = xi();
3941
4145
  }
3942
4146
  cleanupSessionBrowserApis() {
3943
- this.sessionBrowserApisCleanup && (xi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
4147
+ this.sessionBrowserApisCleanup && (ji(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
3944
4148
  }
3945
4149
  async executeRuntimeHelper() {
3946
4150
  if (!this.runtimeHelperJavascript?.trim())
3947
4151
  return null;
3948
- const e = await Gt({
4152
+ const e = await Jt({
3949
4153
  javascript: this.runtimeHelperJavascript
3950
4154
  });
3951
- return e.ok === !1 ? rr(e) : null;
4155
+ return e.ok === !1 ? pr(e) : null;
3952
4156
  }
3953
4157
  enableNetworkCapture() {
3954
- this.networkCaptureCleanup || (this.networkCaptureCleanup = wi((e) => {
3955
- uo(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
4158
+ this.networkCaptureCleanup || (this.networkCaptureCleanup = _i((e) => {
4159
+ So(e.url, this.options.backendUrl) || this.enqueueNetworkEvent(e);
3956
4160
  }));
3957
4161
  }
3958
4162
  enqueueNetworkEvent(e) {
3959
- this.queuedNetworkEvents.length >= li || (this.queuedNetworkEvents.push(co(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
4163
+ this.queuedNetworkEvents.length >= mi || (this.queuedNetworkEvents.push(Io(e)), this.networkBatchTimer === null && (this.networkBatchTimer = window.setTimeout(() => {
3960
4164
  this.networkBatchTimer = null;
3961
4165
  const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
3962
4166
  t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -3965,14 +4169,14 @@ class Ne {
3965
4169
  page: _(),
3966
4170
  events: t
3967
4171
  });
3968
- }, ai)));
4172
+ }, fi)));
3969
4173
  }
3970
4174
  scheduleReconnect(e = 0) {
3971
4175
  if (this.reconnectTimer !== null || this.state.status === "closed")
3972
4176
  return;
3973
4177
  const t = Math.min(
3974
- ot,
3975
- Math.max(yi(this.reconnectAttempts), e)
4178
+ at,
4179
+ Math.max(Ri(this.reconnectAttempts), e)
3976
4180
  );
3977
4181
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
3978
4182
  this.reconnectTimer = null, this.connect().catch((n) => {
@@ -3989,8 +4193,8 @@ class Ne {
3989
4193
  const e = this.socket;
3990
4194
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
3991
4195
  this.socket === e && (b("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
3992
- }, Kn));
3993
- }, zn);
4196
+ }, ei));
4197
+ }, Zn);
3994
4198
  }
3995
4199
  stopHeartbeat() {
3996
4200
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -4028,12 +4232,12 @@ class Ne {
4028
4232
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
4029
4233
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
4030
4234
  }, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
4031
- u && u === this.lastProjectedTurnClientMessageId && c && Ri(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
4235
+ u && u === this.lastProjectedTurnClientMessageId && c && Di(this.lastProjectedTurnPhase, o.turnPhase) && this.reportHealthSignal("invalid_state_transition", {
4032
4236
  clientMessageId: u,
4033
4237
  reason: "active_turn_phase_moved_backward",
4034
4238
  previousPhase: this.lastProjectedTurnPhase,
4035
4239
  nextPhase: o.turnPhase
4036
- }), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), Kr(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
4240
+ }), this.state = o, this.lastProjectedTurnClientMessageId = u, this.lastProjectedTurnPhase = o.turnPhase, o.sessionId && (o.sessionId === a && c !== l || o.sessionId !== a && c) && this.sessionHistoryManager.setActivity(o.sessionId, c), this.rebuildRuntimeInteractions(), e.messages !== void 0 && this.refreshRuntimeInteractions(), this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages), eo(this.options.clientId, this.state), this.emit("state", this.getState()), Se("state", this.state.status, {
4037
4241
  status: this.state.status,
4038
4242
  sessionId: this.state.sessionId,
4039
4243
  messageCount: this.state.messages.length,
@@ -4061,7 +4265,7 @@ class Ne {
4061
4265
  this.transportIdentity.transportId
4062
4266
  ].join(":"), n = `${e}:${t}`;
4063
4267
  if (this.sessionRecoveryScope !== n) {
4064
- const i = [...this.state.messages].reverse().find((r) => !gt(r) && !r.id.startsWith("transient-activity:"));
4268
+ const i = [...this.state.messages].reverse().find((r) => !ft(r) && !r.id.startsWith("transient-activity:"));
4065
4269
  this.sessionActivityRecovery.reset(i?.id ?? null), this.sessionRecoveryScope = n;
4066
4270
  }
4067
4271
  this.sessionRecoveryPoller.start(e, t), this.sessionActivityRecoveryPoller.start(e, t);
@@ -4092,13 +4296,13 @@ class Ne {
4092
4296
  }
4093
4297
  }
4094
4298
  const Ze = /* @__PURE__ */ new WeakMap();
4095
- function wi(s) {
4096
- const e = window.__plunoProductAgentNetworkCapture ?? Ai();
4299
+ function _i(s) {
4300
+ const e = window.__plunoProductAgentNetworkCapture ?? Pi();
4097
4301
  return e.subscribers.add(s), () => {
4098
4302
  e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
4099
4303
  };
4100
4304
  }
4101
- function Ai() {
4305
+ function Pi() {
4102
4306
  const s = /* @__PURE__ */ new Set(), e = (g) => {
4103
4307
  s.forEach((f) => {
4104
4308
  try {
@@ -4115,20 +4319,20 @@ function Ai() {
4115
4319
  throw m;
4116
4320
  }
4117
4321
  try {
4118
- const m = f instanceof Request ? f : null, M = ro(f, m), w = Ls(h?.headers ?? m?.headers);
4322
+ const m = f instanceof Request ? f : null, M = go(f, m), w = Bs(h?.headers ?? m?.headers);
4119
4323
  if (!te(M, w, h?.body)) {
4120
4324
  const H = {
4121
4325
  requestId: nt("fetch"),
4122
4326
  url: F(M, Ye),
4123
4327
  method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
4124
4328
  requestHeaders: w,
4125
- requestBody: us(h?.body),
4329
+ requestBody: ps(h?.body),
4126
4330
  resourceType: "fetch",
4127
4331
  startedAt: new Date(p).toISOString()
4128
4332
  };
4129
4333
  y.then(
4130
4334
  (S) => {
4131
- oo(S, H, p, e).catch(() => {
4335
+ fo(S, H, p, e).catch(() => {
4132
4336
  e({
4133
4337
  ...H,
4134
4338
  responseStatus: S.status,
@@ -4161,16 +4365,16 @@ function Ai() {
4161
4365
  }), M;
4162
4366
  }, l = function(f, h) {
4163
4367
  const p = i.call(this, f, h), y = Ze.get(this);
4164
- return y && Object.keys(y.requestHeaders).length < wt && (y.requestHeaders[f] = Rt(f, h), y.excluded = y.excluded || te(y.url, y.requestHeaders)), p;
4368
+ return y && Object.keys(y.requestHeaders).length < At && (y.requestHeaders[f] = Et(f, h), y.excluded = y.excluded || te(y.url, y.requestHeaders)), p;
4165
4369
  }, c = function(f) {
4166
4370
  try {
4167
4371
  const h = Ze.get(this);
4168
- h && (h.excluded = h.excluded || te(h.url, h.requestHeaders, f), h.requestBody = us(f), h.excluded || this.addEventListener(
4372
+ h && (h.excluded = h.excluded || te(h.url, h.requestHeaders, f), h.requestBody = ps(f), h.excluded || this.addEventListener(
4169
4373
  "loadend",
4170
4374
  () => {
4171
4375
  queueMicrotask(() => {
4172
4376
  try {
4173
- const p = po(this.getAllResponseHeaders());
4377
+ const p = wo(this.getAllResponseHeaders());
4174
4378
  e({
4175
4379
  requestId: h.requestId,
4176
4380
  url: h.url,
@@ -4180,7 +4384,7 @@ function Ai() {
4180
4384
  resourceType: "xhr",
4181
4385
  responseStatus: this.status,
4182
4386
  responseHeaders: p,
4183
- responseBody: lo(this, p),
4387
+ responseBody: yo(this, p),
4184
4388
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
4185
4389
  startedAt: h.startedAt,
4186
4390
  durationMs: Date.now() - h.startedAtMs
@@ -4272,14 +4476,14 @@ function b(s, e, t) {
4272
4476
  }, r = n.__plunoProductAgentDiagnostics__ ?? [];
4273
4477
  r.push(i), r.length > 120 && r.splice(0, r.length - 120), n.__plunoProductAgentDiagnostics__ = r, n.__PLUNO_PRODUCT_AGENT_DIAGNOSTICS__ = () => [...r], window.dispatchEvent(new CustomEvent("product-agent:preview-diagnostic", { detail: i }));
4274
4478
  }
4275
- function Kt(s) {
4479
+ function Qt(s) {
4276
4480
  const e = typeof s == "function" ? s() : s;
4277
4481
  return e && Object.keys(e).length > 0 ? e : void 0;
4278
4482
  }
4279
- function Mi(s) {
4483
+ function vi(s) {
4280
4484
  return s.type === "run.model_started" || s.type === "conversation.state" || s.type === "session.updated" || s.type === "session.item" || s.type === "chat.assistant_delta" || s.type === "chat.assistant_done" || s.type === "tool.call";
4281
4485
  }
4282
- function bi(s) {
4486
+ function Ui(s) {
4283
4487
  if (s.type === "chat.assistant_delta")
4284
4488
  return typeof s.delta == "string" && s.delta.trim().length > 0;
4285
4489
  if (s.type === "tool.call")
@@ -4289,7 +4493,7 @@ function bi(s) {
4289
4493
  const e = C(s.item);
4290
4494
  return e ? e.type === "message" && e.role === "assistant" ? typeof e.content == "string" && e.content.trim().length > 0 : e.type === "tool_call" || e.type === "function_call" : !1;
4291
4495
  }
4292
- function Ri(s, e) {
4496
+ function Di(s, e) {
4293
4497
  if (!s || !e)
4294
4498
  return !1;
4295
4499
  const t = {
@@ -4317,31 +4521,31 @@ function K(s) {
4317
4521
  }
4318
4522
  return null;
4319
4523
  }
4320
- const Ei = 5e3, ki = 12e4;
4321
- function Ci() {
4524
+ const qi = 5e3, Oi = 12e4;
4525
+ function xi() {
4322
4526
  const s = [
4323
- Pi(),
4324
- _i()
4527
+ Ni(),
4528
+ Li()
4325
4529
  ].filter((e) => typeof e == "function");
4326
4530
  return () => {
4327
4531
  for (const e of s.reverse())
4328
4532
  e();
4329
4533
  };
4330
4534
  }
4331
- function _i() {
4332
- return ps(globalThis, "getPageSnapshot", async () => At());
4535
+ function Li() {
4536
+ return ms(globalThis, "getPageSnapshot", async () => Mt());
4333
4537
  }
4334
- function Pi() {
4335
- return ps(globalThis, "pageImages", {
4336
- inspectImage: async (e, t) => await vi(e, t)
4538
+ function Ni() {
4539
+ return ms(globalThis, "pageImages", {
4540
+ inspectImage: async (e, t) => await Hi(e, t)
4337
4541
  });
4338
4542
  }
4339
- async function vi(s, e = {}) {
4340
- const t = Oi(e.name), n = await Ui(s);
4543
+ async function Hi(s, e = {}) {
4544
+ const t = $i(e.name), n = await Bi(s);
4341
4545
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
4342
4546
  type: "pluno.pageImages.inspectImage",
4343
4547
  imageAttached: !1,
4344
- imageAttachmentError: As
4548
+ imageAttachmentError: Rs
4345
4549
  } : {
4346
4550
  type: "pluno.pageImages.inspectImage",
4347
4551
  imageAttached: !0,
@@ -4355,15 +4559,15 @@ async function vi(s, e = {}) {
4355
4559
  imageAttachmentError: n.error
4356
4560
  };
4357
4561
  }
4358
- async function Ui(s) {
4359
- return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: As } : {
4562
+ async function Bi(s) {
4563
+ return s instanceof Blob ? s.type.startsWith("image/") ? s.size === 0 ? { ok: !1, error: "Page image is empty." } : s.size > 8 * 1024 * 1024 ? { ok: !1, error: Rs } : {
4360
4564
  ok: !0,
4361
4565
  mimeType: s.type,
4362
4566
  sizeBytes: s.size,
4363
- dataUrl: await Li(s)
4364
- } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Di(s);
4567
+ dataUrl: await zi(s)
4568
+ } : { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : typeof s != "string" ? { ok: !1, error: "Page image must be an image Blob or complete data:image/* URL." } : Fi(s);
4365
4569
  }
4366
- function Di(s) {
4570
+ function Fi(s) {
4367
4571
  if (!s.startsWith("data:") || !s.includes(","))
4368
4572
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
4369
4573
  const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
@@ -4374,7 +4578,7 @@ function Di(s) {
4374
4578
  const r = t.replace(/[ \t\r\n\f]+/g, "");
4375
4579
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
4376
4580
  return { ok: !1, error: "Page image data URL has invalid base64." };
4377
- const o = qi(r);
4581
+ const o = Wi(r);
4378
4582
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
4379
4583
  ok: !0,
4380
4584
  mimeType: i,
@@ -4382,22 +4586,22 @@ function Di(s) {
4382
4586
  dataUrl: `data:${i};base64,${r}`
4383
4587
  };
4384
4588
  }
4385
- function qi(s) {
4589
+ function Wi(s) {
4386
4590
  if (s.length === 0 || s.length % 4 !== 0)
4387
4591
  return null;
4388
4592
  const e = s.length - s.replace(/=+$/, "").length;
4389
4593
  return e > 2 ? null : s.length / 4 * 3 - e;
4390
4594
  }
4391
- function Oi(s) {
4595
+ function $i(s) {
4392
4596
  return (typeof s == "string" ? s.trim() : "") || "Page image";
4393
4597
  }
4394
- function xi(s) {
4598
+ function ji(s) {
4395
4599
  try {
4396
4600
  s();
4397
4601
  } catch {
4398
4602
  }
4399
4603
  }
4400
- function Li(s) {
4604
+ function zi(s) {
4401
4605
  return new Promise((e, t) => {
4402
4606
  const n = new FileReader();
4403
4607
  n.onload = () => {
@@ -4409,9 +4613,9 @@ function Li(s) {
4409
4613
  }, n.onerror = () => t(n.error ?? new Error("Failed to read page image")), n.readAsDataURL(s);
4410
4614
  });
4411
4615
  }
4412
- async function Gt(s, e) {
4616
+ async function Jt(s, e) {
4413
4617
  const t = Object.getPrototypeOf(async function() {
4414
- }).constructor, n = s.timeoutMs ?? Ei, i = Date.now(), r = [];
4618
+ }).constructor, n = s.timeoutMs ?? qi, i = Date.now(), r = [];
4415
4619
  let o;
4416
4620
  const a = {
4417
4621
  log: console.log,
@@ -4429,7 +4633,7 @@ async function Gt(s, e) {
4429
4633
  o = window.setTimeout(() => d(c), n);
4430
4634
  })
4431
4635
  ]);
4432
- return u === c ? Hi(n) : {
4636
+ return u === c ? Gi(n) : {
4433
4637
  ok: !0,
4434
4638
  result: u,
4435
4639
  console: r,
@@ -4458,7 +4662,7 @@ async function Gt(s, e) {
4458
4662
  e?.deactivate(), o !== void 0 && window.clearTimeout(o), console.log = a.log, console.info = a.info, console.warn = a.warn, console.error = a.error;
4459
4663
  }
4460
4664
  }
4461
- function Ni(s, e) {
4665
+ function Ki(s, e) {
4462
4666
  if (!s || typeof s != "object")
4463
4667
  return;
4464
4668
  const t = s.sandboxFilesToken;
@@ -4468,7 +4672,7 @@ function Ni(s, e) {
4468
4672
  const i = () => {
4469
4673
  if (!n)
4470
4674
  throw new Error("sandboxFiles is only available during browser-code execution");
4471
- }, r = async (a, l) => await xn(`${e.replace(/\/$/, "")}${a}`, l);
4675
+ }, r = async (a, l) => await jn(`${e.replace(/\/$/, "")}${a}`, l);
4472
4676
  return {
4473
4677
  value: Object.freeze({
4474
4678
  upload: async (a) => {
@@ -4502,7 +4706,7 @@ function Ni(s, e) {
4502
4706
  }
4503
4707
  };
4504
4708
  }
4505
- function Hi(s) {
4709
+ function Gi(s) {
4506
4710
  return {
4507
4711
  ok: !1,
4508
4712
  exception: {
@@ -4516,10 +4720,10 @@ function Hi(s) {
4516
4720
  }
4517
4721
  };
4518
4722
  }
4519
- function Bi(s) {
4723
+ function Vi(s) {
4520
4724
  return s.replace(/\/+$/, "");
4521
4725
  }
4522
- function Fi(s) {
4726
+ function Qi(s) {
4523
4727
  const e = {
4524
4728
  sidepanel: "extension_sidepanel",
4525
4729
  browser_extension_page_ui: "extension_widget",
@@ -4531,18 +4735,18 @@ function Fi(s) {
4531
4735
  };
4532
4736
  return s && s in e ? e[s] : s ?? "embedded_custom_ui";
4533
4737
  }
4534
- function Wi(s) {
4738
+ function Ji(s) {
4535
4739
  return s === "pluno" ? "scheduled_continuation" : s ?? "user";
4536
4740
  }
4537
- function $i(s, e = location.origin) {
4741
+ function Xi(s, e = location.origin) {
4538
4742
  return /origin (?:is not allowed|does not match browser origin)/i.test(s) ? `Pluno widget blocked on ${e}: this domain is not allowed. Add ${e} in Pluno under Integration > Domains.` : null;
4539
4743
  }
4540
- function ji(s) {
4744
+ function Yi(s) {
4541
4745
  const e = new URL("/api/product-agent/embed/ws", s);
4542
4746
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
4543
4747
  }
4544
4748
  function _() {
4545
- const s = ks();
4749
+ const s = Ps();
4546
4750
  return {
4547
4751
  url: location.href,
4548
4752
  title: document.title,
@@ -4550,19 +4754,19 @@ function _() {
4550
4754
  ...s ? { plunoProductAgentUi: s } : {}
4551
4755
  };
4552
4756
  }
4553
- function zi() {
4757
+ function Zi() {
4554
4758
  return {
4555
4759
  pageUrl: location.href,
4556
4760
  pageTitle: document.title,
4557
- htmlContent: At()
4761
+ htmlContent: Mt()
4558
4762
  };
4559
4763
  }
4560
- function Ki(s) {
4561
- return Ce.add(s), we || (we = Gi()), () => {
4764
+ function er(s) {
4765
+ return Ce.add(s), we || (we = tr()), () => {
4562
4766
  Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
4563
4767
  };
4564
4768
  }
4565
- function Gi() {
4769
+ function tr() {
4566
4770
  const s = () => {
4567
4771
  for (const r of Array.from(Ce))
4568
4772
  r();
@@ -4578,9 +4782,9 @@ function Gi() {
4578
4782
  };
4579
4783
  }
4580
4784
  function et() {
4581
- return ks()?.surface === "browser_extension_sdk_preview";
4785
+ return Ps()?.surface === "browser_extension_sdk_preview";
4582
4786
  }
4583
- function At() {
4787
+ function Mt() {
4584
4788
  if (!document.body)
4585
4789
  return "";
4586
4790
  const s = [], e = [], t = (p, y) => {
@@ -4589,16 +4793,16 @@ function At() {
4589
4793
  };
4590
4794
  t("Selected text", window.getSelection()?.toString() ?? "");
4591
4795
  const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
4592
- (p) => bs(p) && !p.parentElement?.closest(n)
4796
+ (p) => ks(p) && !p.parentElement?.closest(n)
4593
4797
  );
4594
4798
  for (const p of i.slice(0, 3))
4595
4799
  t("Active overlay", tt(he(p), e));
4596
- const r = Qi(), o = r ? tt(he(r), e) : "";
4800
+ const r = sr(), o = r ? tt(he(r), e) : "";
4597
4801
  t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
4598
4802
  const a = s.map(([p, y]) => `${p}:
4599
4803
  ${y}`).join(`
4600
4804
 
4601
- `).trim().slice(0, 12e3), l = Vi(i, r).trim(), c = `Simplified DOM outline:
4805
+ `).trim().slice(0, 12e3), l = nr(i, r).trim(), c = `Simplified DOM outline:
4602
4806
  `, u = `
4603
4807
 
4604
4808
  Visible page text:
@@ -4622,14 +4826,14 @@ function tt(s, e) {
4622
4826
  t = t.replace(n, "");
4623
4827
  return ne(t);
4624
4828
  }
4625
- function bs(s) {
4829
+ function ks(s) {
4626
4830
  const e = window.getComputedStyle(s);
4627
4831
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
4628
4832
  }
4629
- function Qi() {
4630
- return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(bs).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
4833
+ function sr() {
4834
+ return Array.from(document.querySelectorAll("main, [role='main'], article")).filter(ks).sort((s, e) => he(e).length - he(s).length)[0] ?? null;
4631
4835
  }
4632
- function Vi(s, e) {
4836
+ function nr(s, e) {
4633
4837
  const t = /* @__PURE__ */ new Set([
4634
4838
  "main",
4635
4839
  "nav",
@@ -4709,7 +4913,7 @@ function Vi(s, e) {
4709
4913
  "data-test",
4710
4914
  "data-qa",
4711
4915
  "data-cy"
4712
- ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = Xi(), g = new Set(s);
4916
+ ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = ir(), g = new Set(s);
4713
4917
  e && g.add(e);
4714
4918
  let f = 0;
4715
4919
  const h = (w) => {
@@ -4724,36 +4928,36 @@ function Vi(s, e) {
4724
4928
  if (f >= 1e3 && !Y || H.has(T) || r.has(v) || T.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || re.display === "none" || re.visibility === "hidden")
4725
4929
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
4726
4930
  f += 1;
4727
- const Z = h(T), ee = Es(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), Q = /* @__PURE__ */ new Map();
4931
+ const Z = h(T), ee = _s(T), fe = a.has(Z) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(v) || v === "a" && T.hasAttribute("href"), B = Array.from(T.children).filter((I) => I instanceof HTMLElement), V = /* @__PURE__ */ new Map();
4728
4932
  for (const I of B) {
4729
4933
  const R = p(I);
4730
- Q.set(R, (Q.get(R) ?? 0) + 1);
4934
+ V.set(R, (V.get(R) ?? 0) + 1);
4731
4935
  }
4732
4936
  const me = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
4733
4937
  for (const I of B) {
4734
4938
  const R = p(I), z = oe.get(R) ?? 0;
4735
- oe.set(R, z + 1), (Q.get(R) ?? 0) > 8 && z >= 6 && !u.has(I) && me.set(R, (me.get(R) ?? 0) + 1);
4939
+ oe.set(R, z + 1), (V.get(R) ?? 0) > 8 && z >= 6 && !u.has(I) && me.set(R, (me.get(R) ?? 0) + 1);
4736
4940
  }
4737
- const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], Et = [];
4941
+ const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], kt = [];
4738
4942
  for (const I of B) {
4739
- const R = p(I), z = Q.get(R) ?? 0, _t = j.get(R) ?? 0;
4740
- if (j.set(R, _t + 1), z > 8 && _t >= 6 && !u.has(I)) {
4943
+ const R = p(I), z = V.get(R) ?? 0, Pt = j.get(R) ?? 0;
4944
+ if (j.set(R, Pt + 1), z > 8 && Pt >= 6 && !u.has(I)) {
4741
4945
  U.has(R) || (q.push([`… ${me.get(R) ?? 0} similar siblings omitted`]), U.add(R));
4742
4946
  continue;
4743
4947
  }
4744
- const Pt = S(I, N);
4745
- Et.push(Pt), q.push(Pt.lines);
4948
+ const vt = S(I, N);
4949
+ kt.push(vt), q.push(vt.lines);
4746
4950
  }
4747
4951
  const Fe = [];
4748
4952
  if (T.shadowRoot)
4749
4953
  for (const I of Array.from(T.shadowRoot.children))
4750
4954
  I instanceof HTMLElement && Fe.push(S(I, N + 1));
4751
- const ye = [...Et, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), kt = ne(
4955
+ const ye = [...kt, ...Fe], We = ee.length > 0 || fe || ye.some((I) => I.hasUsefulContent), Ct = ne(
4752
4956
  [ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
4753
- ).slice(0, 180), zs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), Ct = c.some((I) => T.hasAttribute(I)) || !!Z || zs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || Ct || Y) && (We || Y) && (!i.has(v) || We || Ct || Y), je = $e ? 1 : 0, ae = [];
4957
+ ).slice(0, 180), Vs = T.hasAttribute("contenteditable") && (ee.length > 0 || !T.querySelector("[contenteditable]")), _t = c.some((I) => T.hasAttribute(I)) || !!Z || Vs, $e = (T.getClientRects().length > 0 || re.display === "contents") && (t.has(v) || _t || Y) && (We || Y) && (!i.has(v) || We || _t || Y), je = $e ? 1 : 0, ae = [];
4754
4958
  if ($e) {
4755
- const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? kt : ee;
4756
- ae.push(Rs(T, l, o, R.slice(0, 180)));
4959
+ const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? Ct : ee;
4960
+ ae.push(Cs(T, l, o, R.slice(0, 180)));
4757
4961
  }
4758
4962
  for (const I of q)
4759
4963
  ae.push(...Ae(I, je));
@@ -4771,7 +4975,7 @@ function Vi(s, e) {
4771
4975
  return {
4772
4976
  lines: ae,
4773
4977
  hasUsefulContent: We,
4774
- textPreview: kt,
4978
+ textPreview: Ct,
4775
4979
  containsTextElement: n.has(v) || ye.some((I) => I.containsTextElement)
4776
4980
  };
4777
4981
  };
@@ -4779,7 +4983,7 @@ function Vi(s, e) {
4779
4983
  `);
4780
4984
  }, m = [], M = ne(window.getSelection()?.toString() ?? "");
4781
4985
  M && m.push(`--- selected text ---
4782
- ${JSON.stringify(M)}`), d.length > 0 && m.push(Ji(d, t, l, o));
4986
+ ${JSON.stringify(M)}`), d.length > 0 && m.push(rr(d, t, l, o));
4783
4987
  for (const w of s.slice(0, 3))
4784
4988
  m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
4785
4989
  if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -4790,11 +4994,11 @@ ${JSON.stringify(M)}`), d.length > 0 && m.push(Ji(d, t, l, o));
4790
4994
 
4791
4995
  `);
4792
4996
  }
4793
- function Rs(s, e, t, n) {
4997
+ function Cs(s, e, t, n) {
4794
4998
  const i = s.tagName.toLowerCase();
4795
4999
  let r = i;
4796
5000
  const o = s.getAttribute("id");
4797
- o && Yi(o) && (r += `#${o}`);
5001
+ o && or(o) && (r += `#${o}`);
4798
5002
  for (const a of e) {
4799
5003
  const l = s.getAttribute(a);
4800
5004
  l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
@@ -4807,7 +5011,7 @@ function Rs(s, e, t, n) {
4807
5011
  s.hasAttribute(a) && (r += `[${a}]`);
4808
5012
  return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
4809
5013
  }
4810
- function Xi() {
5014
+ function ir() {
4811
5015
  const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
4812
5016
  if (!a)
4813
5017
  return;
@@ -4828,7 +5032,7 @@ function Xi() {
4828
5032
  n = n.shadowRoot.activeElement;
4829
5033
  n !== document.body && n !== document.documentElement && t(n, "focused");
4830
5034
  const i = window.getSelection();
4831
- i && !i.isCollapsed && (t(Qt(i.anchorNode), "selected text"), t(Qt(i.focusNode), "selected text"));
5035
+ i && !i.isCollapsed && (t(Xt(i.anchorNode), "selected text"), t(Xt(i.focusNode), "selected text"));
4832
5036
  const r = [
4833
5037
  ["[aria-selected='true']", "selected"],
4834
5038
  ["[aria-current]:not([aria-current='false'])", "current"],
@@ -4850,7 +5054,7 @@ function Xi() {
4850
5054
  priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
4851
5055
  };
4852
5056
  }
4853
- function Ji(s, e, t, n) {
5057
+ function rr(s, e, t, n) {
4854
5058
  const i = ["--- active/current elements ---"];
4855
5059
  for (const r of s) {
4856
5060
  const o = [];
@@ -4861,18 +5065,18 @@ function Ji(s, e, t, n) {
4861
5065
  const d = a.getRootNode();
4862
5066
  a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
4863
5067
  }
4864
- const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => Rs(
5068
+ const l = o.length > 6 ? [o[0], ...o.slice(-5)] : o, c = l.map((u, d) => Cs(
4865
5069
  u,
4866
5070
  t,
4867
5071
  n,
4868
- d === l.length - 1 ? Es(u).slice(0, 180) : ""
5072
+ d === l.length - 1 ? _s(u).slice(0, 180) : ""
4869
5073
  ));
4870
5074
  o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
4871
5075
  }
4872
5076
  return i.join(`
4873
5077
  `);
4874
5078
  }
4875
- function Qt(s) {
5079
+ function Xt(s) {
4876
5080
  return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
4877
5081
  }
4878
5082
  function Ae(s, e) {
@@ -4881,17 +5085,17 @@ function Ae(s, e) {
4881
5085
  const t = " ".repeat(e);
4882
5086
  return s.map((n) => `${t}${n}`);
4883
5087
  }
4884
- function Es(s) {
5088
+ function _s(s) {
4885
5089
  return ne(
4886
5090
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
4887
5091
  );
4888
5092
  }
4889
- function Yi(s) {
5093
+ function or(s) {
4890
5094
  return s.length <= 64 && /^[A-Za-z_][A-Za-z0-9_:.-]*$/.test(s) && !/[a-f0-9]{12,}/i.test(s) && !/:r[0-9a-z]+:/i.test(s);
4891
5095
  }
4892
- function ks() {
4893
- const s = Array.from(document.querySelectorAll(Ht)), e = s.find(
4894
- (r) => typeof r[Bn] == "string"
5096
+ function Ps() {
5097
+ const s = Array.from(document.querySelectorAll(Wt)), e = s.find(
5098
+ (r) => typeof r[Vn] == "string"
4895
5099
  );
4896
5100
  if (!(e ?? s[0]))
4897
5101
  return;
@@ -4902,28 +5106,28 @@ function ks() {
4902
5106
  selectors: [
4903
5107
  {
4904
5108
  name: "widget_host",
4905
- selector: Ht,
5109
+ selector: Wt,
4906
5110
  description: "Finds Pluno's shadow-host element in the host page DOM."
4907
5111
  },
4908
5112
  {
4909
5113
  name: "widget_root",
4910
- selector: Ln,
5114
+ selector: zn,
4911
5115
  description: "Finds Pluno's widget root inside the widget host shadow root."
4912
5116
  },
4913
5117
  {
4914
5118
  name: "widget_panel",
4915
- selector: Nn,
5119
+ selector: Kn,
4916
5120
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
4917
5121
  },
4918
5122
  {
4919
5123
  name: "widget_timeline",
4920
- selector: Hn,
5124
+ selector: Gn,
4921
5125
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
4922
5126
  }
4923
5127
  ]
4924
5128
  };
4925
5129
  }
4926
- function Zi(s) {
5130
+ function ar(s) {
4927
5131
  try {
4928
5132
  const e = JSON.parse(s);
4929
5133
  return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
@@ -4931,7 +5135,7 @@ function Zi(s) {
4931
5135
  return { type: "error", message: "Invalid server event" };
4932
5136
  }
4933
5137
  }
4934
- function er(s) {
5138
+ function lr(s) {
4935
5139
  if (typeof s != "string")
4936
5140
  return null;
4937
5141
  try {
@@ -4941,13 +5145,13 @@ function er(s) {
4941
5145
  return null;
4942
5146
  }
4943
5147
  }
4944
- function Vt(s, e) {
5148
+ function Yt(s, e) {
4945
5149
  if (!s || typeof s != "object")
4946
5150
  return [];
4947
5151
  const t = s[e];
4948
5152
  return Array.isArray(t) ? t.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
4949
5153
  }
4950
- function Xt(s) {
5154
+ function Zt(s) {
4951
5155
  return Array.isArray(s) ? s.flatMap((e) => {
4952
5156
  if (!e || typeof e != "object")
4953
5157
  return [];
@@ -4955,10 +5159,10 @@ function Xt(s) {
4955
5159
  return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
4956
5160
  }) : [];
4957
5161
  }
4958
- function tr(s) {
5162
+ function cr(s) {
4959
5163
  return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
4960
5164
  }
4961
- function sr(s) {
5165
+ function ur(s) {
4962
5166
  if (!s || typeof s != "object")
4963
5167
  return null;
4964
5168
  const e = s, t = e.appearance, n = t && typeof t == "object" ? t : e, i = typeof n.accentColor == "string" ? n.accentColor : null, r = n.colorScheme === "dark" ? "dark" : n.colorScheme === "light" ? "light" : null, o = typeof n.fontFamily == "string" && n.fontFamily.trim() ? n.fontFamily : null, a = typeof n.scribbleStyle == "boolean" ? n.scribbleStyle : null;
@@ -4969,13 +5173,13 @@ function sr(s) {
4969
5173
  ...a !== null ? { scribbleStyle: a } : {}
4970
5174
  };
4971
5175
  }
4972
- function nr(s) {
5176
+ function dr(s) {
4973
5177
  if (!s || typeof s != "object")
4974
5178
  return null;
4975
5179
  const e = s.javascript;
4976
5180
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
4977
5181
  }
4978
- function ir(s, e) {
5182
+ function hr(s, e) {
4979
5183
  return e ? s && typeof s == "object" ? {
4980
5184
  ...s,
4981
5185
  helperError: e
@@ -4985,13 +5189,13 @@ function ir(s, e) {
4985
5189
  helperError: e
4986
5190
  } : s;
4987
5191
  }
4988
- function rr(s) {
5192
+ function pr(s) {
4989
5193
  if (!s || typeof s != "object")
4990
5194
  return s;
4991
5195
  const e = s;
4992
5196
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
4993
5197
  }
4994
- function or() {
5198
+ function gr() {
4995
5199
  const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
4996
5200
  if (e)
4997
5201
  return e;
@@ -5001,7 +5205,7 @@ function or() {
5001
5205
  function x() {
5002
5206
  return crypto.randomUUID();
5003
5207
  }
5004
- function ar(s) {
5208
+ function fr(s) {
5005
5209
  if (!s || typeof s != "object")
5006
5210
  return null;
5007
5211
  const e = s, t = typeof e.id == "string" ? e.id : null;
@@ -5013,11 +5217,11 @@ function ar(s) {
5013
5217
  } : null;
5014
5218
  }
5015
5219
  function st(s, e) {
5016
- return Array.isArray(s) ? ht(
5220
+ return Array.isArray(s) ? pt(
5017
5221
  s.map((t) => Ue(t, e)).filter((t) => t !== null)
5018
5222
  ) : [];
5019
5223
  }
5020
- function lr(s) {
5224
+ function mr(s) {
5021
5225
  return Array.isArray(s) ? s.flatMap((e) => {
5022
5226
  if (!e || typeof e != "object")
5023
5227
  return [];
@@ -5045,15 +5249,15 @@ function Ue(s, e) {
5045
5249
  if (!n || typeof n != "object")
5046
5250
  return null;
5047
5251
  const i = n;
5048
- if (i.hiddenFromTranscript === !0 || an(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
5252
+ if (i.hiddenFromTranscript === !0 || fn(i) || i.type === "tab_lifecycle_decision" && i.decision === "keep")
5049
5253
  return null;
5050
5254
  if (i.type === "assistant_draft")
5051
5255
  return {
5052
5256
  id: typeof i.id == "string" ? i.id : String(t.id ?? crypto.randomUUID()),
5053
5257
  role: "assistant",
5054
5258
  ...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
5055
- content: vt(
5056
- Jt(i.content),
5259
+ content: qt(
5260
+ es(i.content),
5057
5261
  e
5058
5262
  ),
5059
5263
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
@@ -5069,8 +5273,8 @@ function Ue(s, e) {
5069
5273
  id: String(t.id ?? crypto.randomUUID()),
5070
5274
  role: r,
5071
5275
  ...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
5072
- content: vt(
5073
- Jt(i.content),
5276
+ content: qt(
5277
+ es(i.content),
5074
5278
  e
5075
5279
  ),
5076
5280
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
@@ -5078,7 +5282,7 @@ function Ue(s, e) {
5078
5282
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5079
5283
  respondsToUserMessageId: O(i) ?? void 0,
5080
5284
  ...E(i) ? { runId: E(i) } : {},
5081
- attachments: qs(i.attachments, e),
5285
+ attachments: Ls(i.attachments, e),
5082
5286
  ...i.steered === !0 ? { steered: !0 } : {}
5083
5287
  };
5084
5288
  return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
@@ -5093,7 +5297,7 @@ function Ue(s, e) {
5093
5297
  }), o;
5094
5298
  }
5095
5299
  if (i.type === "function_call_output") {
5096
- const r = sn(i.output);
5300
+ const r = dn(i.output);
5097
5301
  if (r !== null)
5098
5302
  return {
5099
5303
  id: String(t.id ?? crypto.randomUUID()),
@@ -5104,11 +5308,11 @@ function Ue(s, e) {
5104
5308
  respondsToUserMessageId: O(i) ?? void 0,
5105
5309
  ...E(i) ? { runId: E(i) } : {},
5106
5310
  dataType: "function_call_output",
5107
- toolName: St,
5311
+ toolName: Tt,
5108
5312
  callId: ue(i) ?? void 0,
5109
5313
  sharePromptAllowed: r
5110
5314
  };
5111
- const o = In(i.output);
5315
+ const o = En(i.output);
5112
5316
  if (o)
5113
5317
  return {
5114
5318
  id: String(t.id ?? crypto.randomUUID()),
@@ -5119,12 +5323,12 @@ function Ue(s, e) {
5119
5323
  respondsToUserMessageId: O(i) ?? void 0,
5120
5324
  ...E(i) ? { runId: E(i) } : {},
5121
5325
  dataType: "scheduled_check_in",
5122
- toolName: fs,
5326
+ toolName: Is,
5123
5327
  callId: ue(i) ?? void 0,
5124
5328
  scheduledCheckInId: o.id ?? void 0,
5125
5329
  scheduledCheckInAt: o.dueAt
5126
5330
  };
5127
- const a = ur(i.output), l = dr(i.output);
5331
+ const a = Ir(i.output), l = Sr(i.output);
5128
5332
  return a ? {
5129
5333
  id: String(t.id ?? crypto.randomUUID()),
5130
5334
  role: "tool",
@@ -5156,7 +5360,7 @@ function Ue(s, e) {
5156
5360
  return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
5157
5361
  id: String(t.id ?? crypto.randomUUID()),
5158
5362
  role: "tool",
5159
- content: i.type === "mcp_call" ? cr(i) : pr(i),
5363
+ content: i.type === "mcp_call" ? yr(i) : wr(i),
5160
5364
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5161
5365
  ...k(i) !== null ? { displaySequence: k(i) } : {},
5162
5366
  ...P(i) !== null ? { causalSequence: P(i) } : {},
@@ -5170,7 +5374,7 @@ function Ue(s, e) {
5170
5374
  } : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
5171
5375
  id: String(t.id ?? crypto.randomUUID()),
5172
5376
  role: "system",
5173
- content: hr(i),
5377
+ content: Tr(i),
5174
5378
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5175
5379
  ...k(i) !== null ? { displaySequence: k(i) } : {},
5176
5380
  ...P(i) !== null ? { causalSequence: P(i) } : {},
@@ -5183,11 +5387,11 @@ function Ue(s, e) {
5183
5387
  ...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
5184
5388
  } : null;
5185
5389
  }
5186
- function cr(s) {
5390
+ function yr(s) {
5187
5391
  const t = (typeof s.server_label == "string" ? s.server_label : "").replace(/^pipedream_/, "").split(/[_-]+/).filter(Boolean).map((n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`).join(" ");
5188
5392
  return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
5189
5393
  }
5190
- function ur(s) {
5394
+ function Ir(s) {
5191
5395
  if (typeof s != "string")
5192
5396
  return null;
5193
5397
  try {
@@ -5204,7 +5408,7 @@ function ur(s) {
5204
5408
  return null;
5205
5409
  }
5206
5410
  }
5207
- function dr(s) {
5411
+ function Sr(s) {
5208
5412
  if (typeof s != "string")
5209
5413
  return null;
5210
5414
  try {
@@ -5219,10 +5423,10 @@ function dr(s) {
5219
5423
  return null;
5220
5424
  }
5221
5425
  }
5222
- function hr(s) {
5426
+ function Tr(s) {
5223
5427
  return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
5224
5428
  }
5225
- function pr(s) {
5429
+ function wr(s) {
5226
5430
  if (s.type === "web_search_call") {
5227
5431
  const e = s.action;
5228
5432
  if (e && typeof e == "object") {
@@ -5234,9 +5438,9 @@ function pr(s) {
5234
5438
  }
5235
5439
  return "🔎 Searching the web";
5236
5440
  }
5237
- return gr(s);
5441
+ return Ar(s);
5238
5442
  }
5239
- function gr(s) {
5443
+ function Ar(s) {
5240
5444
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
5241
5445
  return se(s.summary);
5242
5446
  if (typeof s.arguments == "string")
@@ -5253,7 +5457,7 @@ function se(s) {
5253
5457
  const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
5254
5458
  return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
5255
5459
  }
5256
- function fr(s) {
5460
+ function Mr(s) {
5257
5461
  if (s == null)
5258
5462
  return s;
5259
5463
  if (typeof s != "object")
@@ -5278,7 +5482,7 @@ function P(s) {
5278
5482
  function k(s) {
5279
5483
  return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
5280
5484
  }
5281
- function Jt(s) {
5485
+ function es(s) {
5282
5486
  return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
5283
5487
  if (!e || typeof e != "object")
5284
5488
  return "";
@@ -5287,13 +5491,13 @@ function Jt(s) {
5287
5491
  }).filter(Boolean).join("") : "";
5288
5492
  }
5289
5493
  function de(s, e) {
5290
- const t = Cs(
5494
+ const t = vs(
5291
5495
  s,
5292
- Mt(s, e)
5293
- ), n = Ir(
5294
- yr(
5295
- Ar(
5296
- mr(s, e),
5496
+ bt(s, e)
5497
+ ), n = Er(
5498
+ Rr(
5499
+ Pr(
5500
+ br(s, e),
5297
5501
  e
5298
5502
  ),
5299
5503
  t
@@ -5301,13 +5505,13 @@ function de(s, e) {
5301
5505
  t
5302
5506
  ), i = n.findIndex((o) => o.id === t.id);
5303
5507
  if (i === -1)
5304
- return ht(
5508
+ return pt(
5305
5509
  [...n, t]
5306
5510
  );
5307
5511
  const r = [...n];
5308
- return r[i] = t, ht(r);
5512
+ return r[i] = t, pt(r);
5309
5513
  }
5310
- function Mt(s, e, t = !0) {
5514
+ function bt(s, e, t = !0) {
5311
5515
  const n = s.find(
5312
5516
  (r) => r.id === e.id || e.callId !== void 0 && r.callId === e.callId || e.assistantDraftItemId !== void 0 && (r.id === e.assistantDraftItemId || r.assistantDraftItemId === e.assistantDraftItemId)
5313
5517
  );
@@ -5318,7 +5522,7 @@ function Mt(s, e, t = !0) {
5318
5522
  const i = s.flatMap((r) => (e.respondsToUserMessageId !== void 0 ? r.respondsToUserMessageId === e.respondsToUserMessageId : e.runId !== void 0 && r.respondsToUserMessageId === void 0 && r.runId === e.runId) && r.displaySequence !== void 0 ? [r.displaySequence] : []);
5319
5523
  return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
5320
5524
  }
5321
- function mr(s, e) {
5525
+ function br(s, e) {
5322
5526
  const t = e.proactiveSuggestionClientMessageId;
5323
5527
  if (!t)
5324
5528
  return s;
@@ -5328,7 +5532,7 @@ function mr(s, e) {
5328
5532
  const r = [...s];
5329
5533
  return r[i] = e, r;
5330
5534
  }
5331
- function yr(s, e) {
5535
+ function Rr(s, e) {
5332
5536
  const t = e.assistantDraftItemId;
5333
5537
  return t ? s.map(
5334
5538
  (n) => n.dataType === "assistant_draft" && n.id === t ? e : n
@@ -5337,7 +5541,7 @@ function yr(s, e) {
5337
5541
  function Me(s, e, t) {
5338
5542
  return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
5339
5543
  }
5340
- function Yt(s, e, t, n) {
5544
+ function ts(s, e, t, n) {
5341
5545
  if (t === null) return s;
5342
5546
  let i = -1;
5343
5547
  for (let o = s.length - 1; o >= 0; o -= 1) {
@@ -5354,7 +5558,7 @@ function Yt(s, e, t, n) {
5354
5558
  respondsToUserMessageId: t
5355
5559
  }, r;
5356
5560
  }
5357
- function Zt(s, e) {
5561
+ function ss(s, e) {
5358
5562
  const t = s.findIndex(
5359
5563
  (i) => !i.id.startsWith("transient-activity:") && i.callId === e.callId
5360
5564
  );
@@ -5371,12 +5575,12 @@ function Zt(s, e) {
5371
5575
  ...n[t].runId ? {} : { runId: e.runId }
5372
5576
  }, n;
5373
5577
  }
5374
- function es(s, e, t) {
5578
+ function ns(s, e, t) {
5375
5579
  let n = !1;
5376
5580
  const i = s.map((r) => r.callId !== e || r.loading === t ? r : (n = !0, { ...r, loading: t }));
5377
5581
  return n ? i : s;
5378
5582
  }
5379
- function ts(s) {
5583
+ function is(s) {
5380
5584
  if (s.hiddenFromTranscript === !0)
5381
5585
  return null;
5382
5586
  const e = typeof s.callId == "string" ? s.callId : null, t = typeof s.toolName == "string" ? s.toolName : null;
@@ -5396,7 +5600,7 @@ function ts(s) {
5396
5600
  loading: !0
5397
5601
  };
5398
5602
  }
5399
- function Ir(s, e) {
5603
+ function Er(s, e) {
5400
5604
  if (e.id.startsWith("transient-activity:"))
5401
5605
  return s;
5402
5606
  const t = e.toolName === "tab_lifecycle";
@@ -5405,30 +5609,30 @@ function Ir(s, e) {
5405
5609
  const n = (r) => r.id === `transient-activity:${e.callId}` && r.callId === e.callId || t && r.id.startsWith("transient-activity:") && r.toolName === "browser_tabs" && !!r.runId && r.runId === e.runId, i = s.findIndex(n);
5406
5610
  return i === -1 ? s : s.flatMap((r, o) => n(r) ? o === i ? [e] : [] : r.id === e.id ? [] : [r]);
5407
5611
  }
5408
- function lt(s, e) {
5612
+ function ct(s, e) {
5409
5613
  const t = [];
5410
5614
  for (const n of e) {
5411
5615
  const i = [...s, ...t];
5412
5616
  t.push(
5413
- Cs(
5617
+ vs(
5414
5618
  i,
5415
- Mt(i, n, !1)
5619
+ bt(i, n, !1)
5416
5620
  )
5417
5621
  );
5418
5622
  }
5419
- return ln(
5623
+ return mn(
5420
5624
  s,
5421
5625
  t,
5422
- ct
5626
+ ut
5423
5627
  );
5424
5628
  }
5425
- function Sr(s, e) {
5629
+ function kr(s, e) {
5426
5630
  const t = new Map(s.map((r) => [r.id, r])), n = e.map(
5427
- (r) => Mt(s, r, !1)
5631
+ (r) => bt(s, r, !1)
5428
5632
  );
5429
5633
  for (const r of n)
5430
5634
  t.set(r.id, r);
5431
- const i = lt(
5635
+ const i = ct(
5432
5636
  s,
5433
5637
  [...t.values()]
5434
5638
  );
@@ -5443,8 +5647,8 @@ function Sr(s, e) {
5443
5647
  }
5444
5648
  return i;
5445
5649
  }
5446
- function ct(s) {
5447
- const e = J(s) ?? void 0, t = s.assistantDraftItemId, n = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", i = [
5650
+ function ut(s) {
5651
+ const e = X(s) ?? void 0, t = s.assistantDraftItemId, n = s.dataType === "function_call_output" || s.dataType === "scheduled_check_in", i = [
5448
5652
  // Output-backed cards and their visible calls are separate durable rows. A distinct key keeps activity hydration
5449
5653
  // from substituting the call for its output and then appending a duplicate output at the end of the timeline.
5450
5654
  ...s.callId ? [`${n ? "call-output" : "call"}:${s.callId}`] : [],
@@ -5463,49 +5667,49 @@ function ct(s) {
5463
5667
  isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
5464
5668
  };
5465
5669
  }
5466
- function Cs(s, e) {
5670
+ function vs(s, e) {
5467
5671
  if (e.role !== "user" || !e.attachments?.length)
5468
5672
  return e;
5469
5673
  const t = s.find(
5470
- (o) => o.role === "user" && (o.id === e.id || He(o) && _s(o, e))
5674
+ (o) => o.role === "user" && (o.id === e.id || He(o) && Us(o, e))
5471
5675
  );
5472
5676
  if (!t?.attachments?.length)
5473
5677
  return e;
5474
5678
  const n = e.attachments.map((o) => {
5475
- const a = Tr(t.attachments ?? [], o);
5476
- return a ? wr(o, a) : o;
5477
- }), i = { ...e, attachments: n }, r = J(e);
5679
+ const a = Cr(t.attachments ?? [], o);
5680
+ return a ? _r(o, a) : o;
5681
+ }), i = { ...e, attachments: n }, r = X(e);
5478
5682
  return r && Object.defineProperty(i, "clientMessageId", {
5479
5683
  value: r,
5480
5684
  enumerable: !1
5481
5685
  }), i;
5482
5686
  }
5483
- function Tr(s, e) {
5687
+ function Cr(s, e) {
5484
5688
  return e.id ? s.find((t) => t.id === e.id) ?? null : null;
5485
5689
  }
5486
- function wr(s, e) {
5690
+ function _r(s, e) {
5487
5691
  const { previewUrl: t } = e;
5488
5692
  return t ? { ...s, previewUrl: t } : s;
5489
5693
  }
5490
- function Ar(s, e) {
5694
+ function Pr(s, e) {
5491
5695
  if (e.role !== "user")
5492
5696
  return s;
5493
5697
  const t = s.findIndex(
5494
- (i) => He(i) && _s(i, e)
5698
+ (i) => He(i) && Us(i, e)
5495
5699
  );
5496
5700
  if (t === -1)
5497
5701
  return s;
5498
5702
  const n = [...s];
5499
5703
  return n.splice(t, 1), n;
5500
5704
  }
5501
- function _s(s, e) {
5502
- const t = J(s), n = J(e);
5705
+ function Us(s, e) {
5706
+ const t = X(s), n = X(e);
5503
5707
  return t && n ? t === n : s.content === e.content;
5504
5708
  }
5505
5709
  function He(s) {
5506
5710
  return s.role === "user" && (s.id.startsWith("local-") || s.id.startsWith("optimistic-user-message:"));
5507
5711
  }
5508
- function J(s) {
5712
+ function X(s) {
5509
5713
  const e = s.clientMessageId;
5510
5714
  if (e)
5511
5715
  return e;
@@ -5514,8 +5718,8 @@ function J(s) {
5514
5718
  );
5515
5719
  return n ? s.id.slice(n.length) : null;
5516
5720
  }
5517
- function ss(s) {
5518
- const e = Ps(s);
5721
+ function rs(s) {
5722
+ const e = Ds(s);
5519
5723
  if (e === null)
5520
5724
  return !1;
5521
5725
  const t = s[e].id;
@@ -5538,10 +5742,10 @@ function ss(s) {
5538
5742
  }
5539
5743
  return !1;
5540
5744
  }
5541
- function Mr(s, e, t) {
5745
+ function vr(s, e, t) {
5542
5746
  const n = new Set(
5543
5747
  s.filter(
5544
- (i) => i.role === "user" && e !== null && J(i) === e
5748
+ (i) => i.role === "user" && e !== null && X(i) === e
5545
5749
  ).map((i) => i.id)
5546
5750
  );
5547
5751
  return s.some((i, r) => {
@@ -5552,14 +5756,14 @@ function Mr(s, e, t) {
5552
5756
  if (t && i.runId === t) {
5553
5757
  if (n.size === 0)
5554
5758
  return !0;
5555
- const o = vs(s, r);
5759
+ const o = qs(s, r);
5556
5760
  return !i.respondsToUserMessageId && o !== null && n.has(o);
5557
5761
  }
5558
5762
  return !1;
5559
5763
  });
5560
5764
  }
5561
- function br(s) {
5562
- const e = Ps(s);
5765
+ function Ur(s) {
5766
+ const e = Ds(s);
5563
5767
  if (e === null)
5564
5768
  return s.some(W);
5565
5769
  const t = s[e].id;
@@ -5567,7 +5771,7 @@ function br(s) {
5567
5771
  (n) => n.respondsToUserMessageId === t && W(n)
5568
5772
  ) : s.slice(e + 1).some(W);
5569
5773
  }
5570
- function Ps(s) {
5774
+ function Ds(s) {
5571
5775
  for (let e = s.length - 1; e >= 0; e -= 1)
5572
5776
  if (s[e].role === "user" && !He(s[e]))
5573
5777
  return e;
@@ -5590,7 +5794,7 @@ function ie(s) {
5590
5794
  }
5591
5795
  return null;
5592
5796
  }
5593
- function Rr(s) {
5797
+ function Dr(s) {
5594
5798
  const e = ie(s);
5595
5799
  if (e === null)
5596
5800
  return null;
@@ -5609,10 +5813,10 @@ function C(s) {
5609
5813
  function pe(s) {
5610
5814
  return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
5611
5815
  }
5612
- function Er(s) {
5816
+ function qr(s) {
5613
5817
  return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
5614
5818
  }
5615
- function kr(s, e) {
5819
+ function Or(s, e) {
5616
5820
  const t = ie(e);
5617
5821
  if (t === null)
5618
5822
  return !1;
@@ -5624,7 +5828,7 @@ function kr(s, e) {
5624
5828
  (o) => o.respondsToUserMessageId === i && De(o)
5625
5829
  ) : s.slice(r + 1).some(De);
5626
5830
  }
5627
- function ut(s) {
5831
+ function dt(s) {
5628
5832
  const e = ie(s);
5629
5833
  if (e === null)
5630
5834
  return null;
@@ -5637,7 +5841,7 @@ function ut(s) {
5637
5841
  const i = n.clientMessageId;
5638
5842
  return typeof i == "string" ? i : null;
5639
5843
  }
5640
- function Cr(s) {
5844
+ function xr(s) {
5641
5845
  const e = ie(s);
5642
5846
  if (e === null)
5643
5847
  return null;
@@ -5652,13 +5856,13 @@ function Cr(s) {
5652
5856
  if (r.type === "message" && r.role === "assistant")
5653
5857
  return null;
5654
5858
  if (r.type === "run_error")
5655
- return r.retryable !== !0 ? null : dt(s, r) ?? ut(s);
5859
+ return r.retryable !== !0 ? null : ht(s, r) ?? dt(s);
5656
5860
  if (r.type === "run_status")
5657
- return r.status === "interrupted" && r.retryable === !0 ? dt(s, r) ?? ut(s) : null;
5861
+ return r.status === "interrupted" && r.retryable === !0 ? ht(s, r) ?? dt(s) : null;
5658
5862
  }
5659
5863
  return null;
5660
5864
  }
5661
- function dt(s, e) {
5865
+ function ht(s, e) {
5662
5866
  if (typeof e.clientMessageId == "string")
5663
5867
  return e.clientMessageId;
5664
5868
  const t = O(e);
@@ -5667,8 +5871,8 @@ function dt(s, e) {
5667
5871
  const n = s.find((r) => A(r, "id") === t), i = C(n);
5668
5872
  return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
5669
5873
  }
5670
- function ns(s, e, t, n, i, r) {
5671
- if (!e || !Pr(s))
5874
+ function os(s, e, t, n, i, r) {
5875
+ if (!e || !Nr(s))
5672
5876
  return !1;
5673
5877
  const o = s;
5674
5878
  if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
@@ -5676,7 +5880,7 @@ function ns(s, e, t, n, i, r) {
5676
5880
  const a = O(o);
5677
5881
  return n !== null ? a !== null ? a === n : i !== null && E(o) === i && r === n : i === null || E(o) === i;
5678
5882
  }
5679
- function _r(s, e) {
5883
+ function Lr(s, e) {
5680
5884
  for (let t = e - 1; t >= 0; t -= 1) {
5681
5885
  const n = C(s[t]);
5682
5886
  if (n?.type === "message" && n.role === "user")
@@ -5684,13 +5888,13 @@ function _r(s, e) {
5684
5888
  }
5685
5889
  return null;
5686
5890
  }
5687
- function vs(s, e) {
5891
+ function qs(s, e) {
5688
5892
  for (let t = e - 1; t >= 0; t -= 1)
5689
5893
  if (s[t].role === "user")
5690
5894
  return s[t].id;
5691
5895
  return null;
5692
5896
  }
5693
- function Pr(s) {
5897
+ function Nr(s) {
5694
5898
  if (!s || typeof s != "object")
5695
5899
  return !1;
5696
5900
  const e = s;
@@ -5699,42 +5903,42 @@ function Pr(s) {
5699
5903
  function W(s) {
5700
5904
  return s.role === "assistant" && s.phase !== "commentary";
5701
5905
  }
5702
- function vr(s) {
5906
+ function Hr(s) {
5703
5907
  if (!s || typeof s != "object")
5704
5908
  return !1;
5705
5909
  const e = s;
5706
5910
  return e.type === "message" && e.role === "user" ? !1 : e.type === "message" || e.type === "function_call" || e.type === "function_call_output" || e.type === "run_error" || e.type === "run_status";
5707
5911
  }
5708
- function ht(s) {
5709
- return s.filter((e, t) => G(e) ? !jr(s, t) && !Us(s, t) && !Wr(s, t) && !$r(s, t) : Ur(e) ? e.retryable === !0 && Fr(s, t) ? !1 : !Br(s, t) : !0);
5912
+ function pt(s) {
5913
+ return s.filter((e, t) => G(e) ? !Yr(s, t) && !Os(s, t) && !Jr(s, t) && !Xr(s, t) : Br(e) ? e.retryable === !0 && Qr(s, t) ? !1 : !Vr(s, t) : !0);
5710
5914
  }
5711
- function Ur(s) {
5915
+ function Br(s) {
5712
5916
  return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
5713
5917
  }
5714
5918
  function G(s) {
5715
5919
  return s.role === "system" && s.dataType === "run_status" && s.loading === !0;
5716
5920
  }
5717
- function pt(s) {
5921
+ function gt(s) {
5718
5922
  return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
5719
5923
  }
5720
- function Dr(s) {
5721
- return s.some(pt);
5924
+ function Fr(s) {
5925
+ return s.some(gt);
5722
5926
  }
5723
- function is(s, e) {
5927
+ function as(s, e) {
5724
5928
  return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
5725
5929
  }
5726
- function qr(s, e) {
5727
- const t = [...s].reverse().find(pt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
5728
- return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : pt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
5930
+ function Wr(s, e) {
5931
+ const t = [...s].reverse().find(gt), n = typeof e.respondsToUserMessageId == "string" ? e.respondsToUserMessageId : t?.respondsToUserMessageId ?? null, i = typeof e.runId == "string" ? e.runId : t?.runId ?? null;
5932
+ return s.flatMap((r) => (n ? r.respondsToUserMessageId === n || !r.respondsToUserMessageId && i !== null && r.runId === i : i ? r.runId === i : gt(r)) ? r.dataType === "assistant_draft" || G(r) ? [] : r.loading === !0 ? [{ ...r, loading: !1 }] : [r] : [r]);
5729
5933
  }
5730
- function Or(s, e, t, n) {
5934
+ function $r(s, e, t, n) {
5731
5935
  const i = s.findIndex(
5732
- (l, c) => G(l) && !Us(s, c)
5936
+ (l, c) => G(l) && !Os(s, c)
5733
5937
  ), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
5734
5938
  (l) => l.role === "user" && l.id === o
5735
5939
  ) : null;
5736
5940
  return {
5737
- clientMessageId: a ? J(a) : o ? null : n,
5941
+ clientMessageId: a ? X(a) : o ? null : n,
5738
5942
  respondsToUserMessageId: o,
5739
5943
  runId: t ?? r?.runId ?? null
5740
5944
  };
@@ -5742,29 +5946,29 @@ function Or(s, e, t, n) {
5742
5946
  function _e(s) {
5743
5947
  return s?.type === "run_status" && s.status === "stopped";
5744
5948
  }
5745
- function xr(s, e) {
5949
+ function jr(s, e) {
5746
5950
  return W(e) ? "completed" : _e(s) ? "stopped" : !pe(s) && (s?.type === "run_error" || s?.type === "run_status" && (s.status === "failed" || s.status === "interrupted")) ? "failed" : null;
5747
5951
  }
5748
- function rs(s, e, t) {
5952
+ function ls(s, e, t) {
5749
5953
  const n = new Set(
5750
5954
  s.filter(
5751
- (i) => i.role === "user" && e !== null && J(i) === e
5955
+ (i) => i.role === "user" && e !== null && X(i) === e
5752
5956
  ).map((i) => i.id)
5753
5957
  );
5754
5958
  return s.filter(
5755
5959
  (i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
5756
5960
  );
5757
5961
  }
5758
- function Us(s, e) {
5962
+ function Os(s, e) {
5759
5963
  return s.some(
5760
- (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Lr(
5964
+ (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && zr(
5761
5965
  s,
5762
5966
  e,
5763
5967
  n
5764
5968
  )
5765
5969
  );
5766
5970
  }
5767
- function Lr(s, e, t) {
5971
+ function zr(s, e, t) {
5768
5972
  const n = s[e], i = s[t];
5769
5973
  if (ge(n, i))
5770
5974
  return !0;
@@ -5775,20 +5979,20 @@ function Lr(s, e, t) {
5775
5979
  return s[r].id === n.respondsToUserMessageId;
5776
5980
  return !1;
5777
5981
  }
5778
- function os(s, e, t, n) {
5982
+ function cs(s, e, t, n) {
5779
5983
  const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
5780
- (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !Hr(
5984
+ (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && us(l) && !Gr(
5781
5985
  s,
5782
5986
  l.respondsToUserMessageId
5783
5987
  )
5784
- )?.respondsToUserMessageId ?? Nr(
5988
+ )?.respondsToUserMessageId ?? Kr(
5785
5989
  s,
5786
5990
  e
5787
5991
  );
5788
5992
  if (!i)
5789
5993
  return s;
5790
5994
  let r = !1;
5791
- const o = s.map((l) => l.respondsToUserMessageId !== i || !as(l) ? l : (r = !0, { ...l, steered: !0 }));
5995
+ const o = s.map((l) => l.respondsToUserMessageId !== i || !us(l) ? l : (r = !0, { ...l, steered: !0 }));
5792
5996
  if (r)
5793
5997
  return o;
5794
5998
  const a = s.find(
@@ -5810,7 +6014,7 @@ function os(s, e, t, n) {
5810
6014
  }
5811
6015
  ];
5812
6016
  }
5813
- function Nr(s, e) {
6017
+ function Kr(s, e) {
5814
6018
  const t = s.findIndex(
5815
6019
  (n) => n.role === "user" && n.id === e
5816
6020
  );
@@ -5821,15 +6025,15 @@ function Nr(s, e) {
5821
6025
  return s[n].id;
5822
6026
  return null;
5823
6027
  }
5824
- function as(s) {
6028
+ function us(s) {
5825
6029
  return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
5826
6030
  }
5827
- function Hr(s, e) {
6031
+ function Gr(s, e) {
5828
6032
  return s.some(
5829
6033
  (t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
5830
6034
  );
5831
6035
  }
5832
- function Br(s, e) {
6036
+ function Vr(s, e) {
5833
6037
  const t = s[e];
5834
6038
  for (let n = e + 1; n < s.length; n += 1) {
5835
6039
  const i = s[n];
@@ -5838,7 +6042,7 @@ function Br(s, e) {
5838
6042
  }
5839
6043
  return !1;
5840
6044
  }
5841
- function Fr(s, e) {
6045
+ function Qr(s, e) {
5842
6046
  const t = s[e];
5843
6047
  if (!t.respondsToUserMessageId)
5844
6048
  return !1;
@@ -5851,19 +6055,19 @@ function Fr(s, e) {
5851
6055
  }
5852
6056
  return !1;
5853
6057
  }
5854
- function Wr(s, e) {
6058
+ function Jr(s, e) {
5855
6059
  const t = s[e];
5856
6060
  return s.some(
5857
6061
  (n, i) => i !== e && n.role === "assistant" && ge(t, n)
5858
6062
  );
5859
6063
  }
5860
- function $r(s, e) {
6064
+ function Xr(s, e) {
5861
6065
  const t = s[e];
5862
6066
  return s.some(
5863
6067
  (n, i) => i !== e && n.role === "tool" && ge(t, n)
5864
6068
  );
5865
6069
  }
5866
- function jr(s, e) {
6070
+ function Yr(s, e) {
5867
6071
  const t = s[e];
5868
6072
  for (let n = e + 1; n < s.length; n += 1)
5869
6073
  if (G(s[n]) && ge(t, s[n]))
@@ -5876,15 +6080,15 @@ function ge(s, e) {
5876
6080
  function A(s, e) {
5877
6081
  return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
5878
6082
  }
5879
- function zr(s, e) {
6083
+ function Zr(s, e) {
5880
6084
  try {
5881
- const t = window.localStorage.getItem(`${Ms}${s}`);
6085
+ const t = window.localStorage.getItem(`${Es}${s}`);
5882
6086
  if (!t)
5883
6087
  return null;
5884
6088
  const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
5885
6089
  if (e !== void 0 && i !== e)
5886
6090
  return null;
5887
- const r = Array.isArray(n.messages) ? n.messages.map(so).filter((o) => !!o) : [];
6091
+ const r = Array.isArray(n.messages) ? n.messages.map(uo).filter((o) => !!o) : [];
5888
6092
  return {
5889
6093
  sessionId: i,
5890
6094
  messages: r
@@ -5893,51 +6097,51 @@ function zr(s, e) {
5893
6097
  return null;
5894
6098
  }
5895
6099
  }
5896
- function gt(s) {
6100
+ function ft(s) {
5897
6101
  return s.role === "user" || s.role === "assistant" || // Live activity is part of the readable conversation cache. Keeping it across host navigation prevents a
5898
6102
  // running tool or commentary history from disappearing while authoritative hydration is still in flight.
5899
6103
  s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
5900
6104
  }
5901
- function Kr(s, e) {
6105
+ function eo(s, e) {
5902
6106
  try {
5903
6107
  window.localStorage.setItem(
5904
- `${Ms}${s}`,
6108
+ `${Es}${s}`,
5905
6109
  JSON.stringify({
5906
6110
  sessionId: e.sessionId,
5907
- messages: e.messages.filter(gt).slice(-pi).map(no)
6111
+ messages: e.messages.filter(ft).slice(-wi).map(ho)
5908
6112
  })
5909
6113
  );
5910
6114
  } catch {
5911
6115
  return;
5912
6116
  }
5913
6117
  }
5914
- function Gr(s) {
6118
+ function to(s) {
5915
6119
  try {
5916
- const e = window.localStorage.getItem(`${at}${s}`);
6120
+ const e = window.localStorage.getItem(`${lt}${s}`);
5917
6121
  if (!e)
5918
6122
  return [];
5919
6123
  const t = JSON.parse(e);
5920
- return Array.isArray(t) ? t.filter(bt) : [];
6124
+ return Array.isArray(t) ? t.filter(Rt) : [];
5921
6125
  } catch {
5922
6126
  return [];
5923
6127
  }
5924
6128
  }
5925
- function V(s, e) {
6129
+ function Q(s, e) {
5926
6130
  try {
5927
- const t = e.filter(bt);
6131
+ const t = e.filter(Rt);
5928
6132
  if (t.length === 0) {
5929
- window.localStorage.removeItem(`${at}${s}`);
6133
+ window.localStorage.removeItem(`${lt}${s}`);
5930
6134
  return;
5931
6135
  }
5932
6136
  window.localStorage.setItem(
5933
- `${at}${s}`,
6137
+ `${lt}${s}`,
5934
6138
  JSON.stringify(t.slice(-25))
5935
6139
  );
5936
6140
  } catch {
5937
6141
  return;
5938
6142
  }
5939
6143
  }
5940
- function Ds(s, e) {
6144
+ function xs(s, e) {
5941
6145
  try {
5942
6146
  const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
5943
6147
  ...o,
@@ -5953,28 +6157,28 @@ function Ds(s, e) {
5953
6157
  } catch {
5954
6158
  }
5955
6159
  }
5956
- function ls(s, e) {
6160
+ function ds(s, e) {
5957
6161
  try {
5958
6162
  if (window.sessionStorage.getItem(`${Le}${s}`) === null)
5959
6163
  return;
5960
6164
  } catch {
5961
6165
  return;
5962
6166
  }
5963
- Ds(s, e);
6167
+ xs(s, e);
5964
6168
  }
5965
- function Qr(s) {
6169
+ function so(s) {
5966
6170
  try {
5967
6171
  const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
5968
6172
  if (window.sessionStorage.removeItem(e), !t)
5969
6173
  return [];
5970
6174
  const n = JSON.parse(t);
5971
- return Array.isArray(n) ? n.flatMap((i) => Xr(i) ? [{
6175
+ return Array.isArray(n) ? n.flatMap((i) => io(i) ? [{
5972
6176
  ...i.event,
5973
6177
  page: _(),
5974
6178
  rawOutput: {
5975
6179
  pageContextRestarted: !0,
5976
6180
  outcome: "unknown",
5977
- message: Vr(location.href),
6181
+ message: no(location.href),
5978
6182
  currentUrl: location.href,
5979
6183
  console: [],
5980
6184
  metadata: {
@@ -5991,17 +6195,17 @@ function Qr(s) {
5991
6195
  return [];
5992
6196
  }
5993
6197
  }
5994
- function Vr(s) {
6198
+ function no(s) {
5995
6199
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
5996
6200
  Current URL: ${s}`;
5997
6201
  }
5998
- function Xr(s) {
6202
+ function io(s) {
5999
6203
  if (!s || typeof s != "object")
6000
6204
  return !1;
6001
6205
  const e = s, t = e.event;
6002
- return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && bt(t) && t.type === "tool.result";
6206
+ return typeof e.startedAtMs == "number" && typeof e.startedAtUrl == "string" && e.startedAtOrigin === location.origin && e.unloadOrigin === location.origin && typeof e.unloadUrl == "string" && Rt(t) && t.type === "tool.result";
6003
6207
  }
6004
- function Jr(s, e) {
6208
+ function ro(s, e) {
6005
6209
  const t = new Set(
6006
6210
  s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
6007
6211
  );
@@ -6010,26 +6214,26 @@ function Jr(s, e) {
6010
6214
  ...e.filter((n) => !t.has(n.callId))
6011
6215
  ];
6012
6216
  }
6013
- function Yr(s) {
6217
+ function oo(s) {
6014
6218
  try {
6015
6219
  window.sessionStorage.removeItem(`${Le}${s}`);
6016
6220
  } catch {
6017
6221
  return;
6018
6222
  }
6019
6223
  }
6020
- function bt(s) {
6224
+ function Rt(s) {
6021
6225
  if (!s || typeof s != "object")
6022
6226
  return !1;
6023
6227
  const e = s;
6024
- return e.type === "chat.user_message" ? typeof e.content == "string" && cs(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? cs(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
6228
+ return e.type === "chat.user_message" ? typeof e.content == "string" && hs(e.page) : e.type === "page.upsert" || e.type === "session.reset" || e.type === "network.batch" ? hs(e.page) : e.type === "tool.result" ? typeof e.sessionId == "string" && typeof e.callId == "string" && (e.toolName === "execute_code" || e.toolName === "execute_code_in_browser_tab") : e.type === "chat.retry_last_user_message" ? typeof e.sessionId == "string" && typeof e.clientMessageId == "string" : e.type === "run.stop" ? typeof e.sessionId == "string" && (e.reason === "user_requested" || e.reason === "new_chat" || e.reason === "session_switch") : !1;
6025
6229
  }
6026
- function cs(s) {
6230
+ function hs(s) {
6027
6231
  if (!s || typeof s != "object")
6028
6232
  return !1;
6029
6233
  const e = s;
6030
6234
  return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
6031
6235
  }
6032
- function qs(s, e) {
6236
+ function Ls(s, e) {
6033
6237
  if (!Array.isArray(s))
6034
6238
  return;
6035
6239
  const t = s.filter((i) => {
@@ -6037,41 +6241,41 @@ function qs(s, e) {
6037
6241
  return !1;
6038
6242
  const r = i;
6039
6243
  return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
6040
- }), n = e ? t.map((i) => Os(i, e)) : t;
6244
+ }), n = e ? t.map((i) => Ns(i, e)) : t;
6041
6245
  return n.length > 0 ? n : void 0;
6042
6246
  }
6043
- function Os(s, e) {
6247
+ function Ns(s, e) {
6044
6248
  return s.fileUrl?.startsWith("/") ? {
6045
6249
  ...s,
6046
6250
  fileUrl: new URL(s.fileUrl, e).toString()
6047
6251
  } : s;
6048
6252
  }
6049
- function ft(s) {
6050
- return s.type || to(s.name) || "application/octet-stream";
6253
+ function mt(s) {
6254
+ return s.type || co(s.name) || "application/octet-stream";
6051
6255
  }
6052
- function Zr(s) {
6053
- xs({
6256
+ function ao(s) {
6257
+ Hs({
6054
6258
  name: s.name,
6055
- mimeType: ft(s),
6259
+ mimeType: mt(s),
6056
6260
  sizeBytes: s.size
6057
6261
  });
6058
6262
  }
6059
- function xs(s) {
6060
- const e = eo(s.name), t = s.mimeType.trim().toLowerCase();
6061
- if (!ui.has(`${e}:${t}`))
6263
+ function Hs(s) {
6264
+ const e = lo(s.name), t = s.mimeType.trim().toLowerCase();
6265
+ if (!Ii.has(`${e}:${t}`))
6062
6266
  throw new Error("This attachment type is not supported by the embedded model provider");
6063
- if (s.sizeBytes <= 0 || s.sizeBytes >= ws)
6267
+ if (s.sizeBytes <= 0 || s.sizeBytes >= bs)
6064
6268
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
6065
6269
  }
6066
- function eo(s) {
6270
+ function lo(s) {
6067
6271
  const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
6068
6272
  return t >= 0 ? e.slice(t) : "";
6069
6273
  }
6070
- function to(s) {
6274
+ function co(s) {
6071
6275
  const e = s.toLowerCase();
6072
6276
  return e.endsWith(".png") ? "image/png" : e.endsWith(".jpg") || e.endsWith(".jpeg") ? "image/jpeg" : e.endsWith(".webp") ? "image/webp" : e.endsWith(".gif") ? "image/gif" : e.endsWith(".pdf") ? "application/pdf" : null;
6073
6277
  }
6074
- function so(s) {
6278
+ function uo(s) {
6075
6279
  if (!s || typeof s != "object")
6076
6280
  return null;
6077
6281
  const e = s;
@@ -6089,11 +6293,11 @@ function so(s) {
6089
6293
  scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
6090
6294
  scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
6091
6295
  securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
6092
- attachments: qs(e.attachments)?.map(qe),
6296
+ attachments: Ls(e.attachments)?.map(qe),
6093
6297
  loading: typeof e.loading == "boolean" ? e.loading : void 0
6094
6298
  };
6095
6299
  }
6096
- function no(s) {
6300
+ function ho(s) {
6097
6301
  return s.attachments?.length ? {
6098
6302
  ...s,
6099
6303
  attachments: s.attachments.map(qe)
@@ -6117,39 +6321,39 @@ function E(s) {
6117
6321
  const e = s.runId;
6118
6322
  return typeof e == "string" && e ? e : null;
6119
6323
  }
6120
- function io(s) {
6324
+ function po(s) {
6121
6325
  const e = s?.timeoutMs;
6122
- return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= ki);
6326
+ return !!s && typeof s == "object" && typeof s.summary == "string" && typeof s.javascript == "string" && (e === void 0 || typeof e == "number" && Number.isInteger(e) && e > 0 && e <= Oi);
6123
6327
  }
6124
- function Ls(s) {
6328
+ function Bs(s) {
6125
6329
  const e = {};
6126
6330
  try {
6127
6331
  new Headers(s).forEach((t, n) => {
6128
- Object.keys(e).length < wt && (e[n] = Rt(n, t));
6332
+ Object.keys(e).length < At && (e[n] = Et(n, t));
6129
6333
  });
6130
6334
  } catch {
6131
6335
  return {};
6132
6336
  }
6133
6337
  return e;
6134
6338
  }
6135
- function Rt(s, e) {
6136
- return $s(s) ? Be : F(xe(e), di);
6339
+ function Et(s, e) {
6340
+ return Ks(s) ? Be : F(xe(e), Si);
6137
6341
  }
6138
- function ro(s, e) {
6342
+ function go(s, e) {
6139
6343
  return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
6140
6344
  }
6141
- async function oo(s, e, t, n) {
6142
- const i = Ls(s.headers);
6345
+ async function fo(s, e, t, n) {
6346
+ const i = Bs(s.headers);
6143
6347
  n({
6144
6348
  ...e,
6145
6349
  responseStatus: s.status,
6146
6350
  responseHeaders: i,
6147
- responseBody: await ao(s),
6351
+ responseBody: await mo(s),
6148
6352
  durationMs: Date.now() - t
6149
6353
  });
6150
6354
  }
6151
- async function ao(s) {
6152
- if (!Ns(s.headers))
6355
+ async function mo(s) {
6356
+ if (!Fs(s.headers))
6153
6357
  return;
6154
6358
  let e = null, t = null;
6155
6359
  try {
@@ -6158,7 +6362,7 @@ async function ao(s) {
6158
6362
  const n = new Promise((a) => {
6159
6363
  t = window.setTimeout(() => {
6160
6364
  e?.cancel(), a("timeout");
6161
- }, hi);
6365
+ }, Ti);
6162
6366
  }), i = new TextDecoder();
6163
6367
  let r = "", o = 0;
6164
6368
  for (; ; ) {
@@ -6168,7 +6372,7 @@ async function ao(s) {
6168
6372
  const { done: l, value: c } = a;
6169
6373
  if (l)
6170
6374
  return F(r + i.decode());
6171
- const u = Tt - o;
6375
+ const u = wt - o;
6172
6376
  if (c.byteLength > u)
6173
6377
  return r += i.decode(c.subarray(0, Math.max(u, 0)), { stream: !0 }), e.cancel(), `${F(r)}... [truncated]`;
6174
6378
  o += c.byteLength, r += i.decode(c, { stream: !0 });
@@ -6180,26 +6384,26 @@ async function ao(s) {
6180
6384
  t !== null && window.clearTimeout(t);
6181
6385
  }
6182
6386
  }
6183
- function lo(s, e) {
6184
- if (Ns(new Headers(e)))
6387
+ function yo(s, e) {
6388
+ if (Fs(new Headers(e)))
6185
6389
  try {
6186
6390
  return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
6187
6391
  } catch {
6188
6392
  return;
6189
6393
  }
6190
6394
  }
6191
- function us(s) {
6395
+ function ps(s) {
6192
6396
  if (typeof s == "string")
6193
6397
  return F(s);
6194
6398
  }
6195
- function co(s) {
6399
+ function Io(s) {
6196
6400
  return L({
6197
6401
  ...s,
6198
- requestBody: ds(s.requestBody),
6199
- responseBody: ds(s.responseBody)
6402
+ requestBody: gs(s.requestBody),
6403
+ responseBody: gs(s.responseBody)
6200
6404
  });
6201
6405
  }
6202
- function ds(s) {
6406
+ function gs(s) {
6203
6407
  if (typeof s != "string")
6204
6408
  return s;
6205
6409
  const e = s.trim();
@@ -6211,14 +6415,14 @@ function ds(s) {
6211
6415
  return xe(s);
6212
6416
  }
6213
6417
  }
6214
- function Ns(s) {
6418
+ function Fs(s) {
6215
6419
  if (!s)
6216
6420
  return !1;
6217
6421
  const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
6218
- return t !== null && Number.isInteger(n) && n >= 0 && n <= Tt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
6422
+ return t !== null && Number.isInteger(n) && n >= 0 && n <= wt && (e.startsWith("text/") || e.includes("json") || e.includes("javascript"));
6219
6423
  }
6220
6424
  function te(s, e = {}, t) {
6221
- if (ho(t))
6425
+ if (To(t))
6222
6426
  return !0;
6223
6427
  const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
6224
6428
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -6233,7 +6437,7 @@ function te(s, e = {}, t) {
6233
6437
  return !0;
6234
6438
  }
6235
6439
  }
6236
- function uo(s, e) {
6440
+ function So(s, e) {
6237
6441
  if (te(s))
6238
6442
  return !0;
6239
6443
  try {
@@ -6243,23 +6447,23 @@ function uo(s, e) {
6243
6447
  return !0;
6244
6448
  }
6245
6449
  }
6246
- function ho(s) {
6450
+ function To(s) {
6247
6451
  return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
6248
6452
  }
6249
- function po(s) {
6453
+ function wo(s) {
6250
6454
  const e = {};
6251
6455
  for (const t of s.trim().split(/[\r\n]+/)) {
6252
6456
  const n = t.indexOf(":");
6253
6457
  if (n <= 0)
6254
6458
  continue;
6255
- if (Object.keys(e).length >= wt)
6459
+ if (Object.keys(e).length >= At)
6256
6460
  break;
6257
6461
  const i = t.slice(0, n).trim();
6258
- e[i] = Rt(i, t.slice(n + 1).trim());
6462
+ e[i] = Et(i, t.slice(n + 1).trim());
6259
6463
  }
6260
6464
  return e;
6261
6465
  }
6262
- function F(s, e = Tt) {
6466
+ function F(s, e = wt) {
6263
6467
  return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
6264
6468
  }
6265
6469
  function nt(s) {
@@ -6273,31 +6477,31 @@ class Pe extends Error {
6273
6477
  }
6274
6478
  async function be(s, e) {
6275
6479
  let t = null;
6276
- for (let n = 0; n < zt; n += 1)
6480
+ for (let n = 0; n < Vt; n += 1)
6277
6481
  try {
6278
6482
  return await s();
6279
6483
  } catch (i) {
6280
- if (t = i, n >= zt - 1 || !fo(i))
6484
+ if (t = i, n >= Vt - 1 || !Mo(i))
6281
6485
  throw i;
6282
- await go(n);
6486
+ await Ao(n);
6283
6487
  }
6284
6488
  throw t instanceof Error ? t : new Error(e);
6285
6489
  }
6286
- function go(s) {
6490
+ function Ao(s) {
6287
6491
  return new Promise((e) => {
6288
- window.setTimeout(e, ci[s] ?? 0);
6492
+ window.setTimeout(e, yi[s] ?? 0);
6289
6493
  });
6290
6494
  }
6291
- function fo(s) {
6292
- return s instanceof Pe ? mo(s.status) : s instanceof TypeError;
6495
+ function Mo(s) {
6496
+ return s instanceof Pe ? bo(s.status) : s instanceof TypeError;
6293
6497
  }
6294
- function mo(s) {
6498
+ function bo(s) {
6295
6499
  return s === 408 || s === 409 || s === 429 || s >= 500;
6296
6500
  }
6297
- function yo(s) {
6501
+ function Ro(s) {
6298
6502
  return s === 401 || s === 403;
6299
6503
  }
6300
- const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", Io = "[REDACTED_SIGNED_URL]", So = 20, To = /^(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, Hs = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, Bs = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, Fs = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, Ws = /\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, wo = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Ao = /\bhttps?:\/\/[^\s"'<>]+/gi, Mo = /[),.;\]]+$/;
6504
+ const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", Eo = "[REDACTED_SIGNED_URL]", ko = 20, Co = /^(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, Ws = /\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/gi, $s = /\bBasic\s+[A-Za-z0-9+/=-]{12,}/gi, js = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g, zs = /\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, _o = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, Po = /\bhttps?:\/\/[^\s"'<>]+/gi, vo = /[),.;\]]+$/;
6301
6505
  function L(s) {
6302
6506
  return Oe(s, 0, /* @__PURE__ */ new WeakSet());
6303
6507
  }
@@ -6306,7 +6510,7 @@ function Oe(s, e, t) {
6306
6510
  return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
6307
6511
  if (s === null || typeof s != "object")
6308
6512
  return s;
6309
- if (e >= So)
6513
+ if (e >= ko)
6310
6514
  return "[REDACTED_MAX_DEPTH]";
6311
6515
  if (t.has(s))
6312
6516
  return "[REDACTED_CIRCULAR]";
@@ -6314,71 +6518,71 @@ function Oe(s, e, t) {
6314
6518
  return s.map((i) => Oe(i, e + 1, t));
6315
6519
  const n = {};
6316
6520
  for (const [i, r] of Object.entries(s))
6317
- i === "pageContent" ? n[i] = r : $s(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? bo(r) : Oe(r, e + 1, t);
6521
+ i === "pageContent" ? n[i] = r : Ks(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? Uo(r) : Oe(r, e + 1, t);
6318
6522
  return n;
6319
6523
  }
6320
- function $s(s) {
6524
+ function Ks(s) {
6321
6525
  const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
6322
6526
  return e.includes("authorization") || e.includes("cookie") || e.includes("password") || e.includes("passwd") || e === "pwd" || e.includes("secret") || e === "token" || e.endsWith("token") || e.includes("apikey") || e.includes("csrf") || e.includes("xsrf") || e === "jwt" || e === "session" || e === "signature" || e.includes("privatekey");
6323
6527
  }
6324
- function bo(s) {
6325
- return typeof s == "string" ? js(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
6528
+ function Uo(s) {
6529
+ return typeof s == "string" ? Gs(s) : Oe(s, 0, /* @__PURE__ */ new WeakSet());
6326
6530
  }
6327
- function js(s) {
6531
+ function Gs(s) {
6328
6532
  try {
6329
6533
  const e = new URL(s, location.href);
6330
6534
  for (const t of Array.from(e.searchParams.keys()))
6331
- To.test(t) && e.searchParams.set(t, $);
6535
+ Co.test(t) && e.searchParams.set(t, $);
6332
6536
  return e.username && (e.username = $), e.password && (e.password = $), e.toString();
6333
6537
  } catch {
6334
- return Ro(s);
6538
+ return Do(s);
6335
6539
  }
6336
6540
  }
6337
6541
  function xe(s) {
6338
- return s.replace(wo, Io).replace(Ao, Eo).replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
6542
+ return s.replace(_o, Eo).replace(Po, qo).replace(Ws, `Bearer ${$}`).replace($s, `Basic ${$}`).replace(js, $).replace(zs, (e, t) => `${t}: ${Be}`);
6339
6543
  }
6340
- function Ro(s) {
6341
- return s.replace(Hs, `Bearer ${$}`).replace(Bs, `Basic ${$}`).replace(Fs, $).replace(Ws, (e, t) => `${t}: ${Be}`);
6544
+ function Do(s) {
6545
+ return s.replace(Ws, `Bearer ${$}`).replace($s, `Basic ${$}`).replace(js, $).replace(zs, (e, t) => `${t}: ${Be}`);
6342
6546
  }
6343
- function Eo(s) {
6344
- const e = s.match(Mo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6345
- return `${js(t)}${e}`;
6547
+ function qo(s) {
6548
+ const e = s.match(vo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6549
+ return `${Gs(t)}${e}`;
6346
6550
  }
6347
- const Oo = Object.freeze({
6551
+ const $o = Object.freeze({
6348
6552
  init: (s) => Ne.init(s)
6349
6553
  });
6350
- function xo(s) {
6554
+ function jo(s) {
6351
6555
  return Ne.init(s);
6352
6556
  }
6353
6557
  export {
6354
- Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
6355
- Nn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6356
- Ln as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6357
- Hn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6358
- qo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6359
- Oo as PlunoProductAgent,
6360
- _n as ProductAgentInteractionManager,
6361
- xt as ProductAgentQueryController,
6362
- Do as ProductAgentRemoteRuntimeClient,
6558
+ Wt as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
6559
+ Kn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6560
+ zn as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6561
+ Gn as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6562
+ Wo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6563
+ $o as PlunoProductAgent,
6564
+ Ln as ProductAgentInteractionManager,
6565
+ Ht as ProductAgentQueryController,
6566
+ Fo as ProductAgentRemoteRuntimeClient,
6363
6567
  Ne as ProductAgentSessionEngine,
6364
- En as ProductAgentSessionHistoryManager,
6365
- Po as ProductAgentTaskPageTitleController,
6366
- X as ProductAgentTokenProviderError,
6367
- yi as calculateReconnectDelay,
6368
- _o as createLocalStorageInteractionDecisionStorage,
6568
+ qn as ProductAgentSessionHistoryManager,
6569
+ No as ProductAgentTaskPageTitleController,
6570
+ J as ProductAgentTokenProviderError,
6571
+ Ri as calculateReconnectDelay,
6572
+ Lo as createLocalStorageInteractionDecisionStorage,
6369
6573
  Ee as createProductAgentQueryState,
6370
- xo as createProductAgentRuntime,
6371
- vo as createProductAgentTaskPageTitleDocument,
6372
- Oo as default,
6373
- Dn as formatProductAgentTaskPageTitle,
6374
- $i as getProductAgentOriginAccessErrorMessage,
6375
- Uo as isProductAgentRuntimeCommand,
6376
- Mn as mergeProductAgentEntityPages,
6574
+ jo as createProductAgentRuntime,
6575
+ Ho as createProductAgentTaskPageTitleDocument,
6576
+ $o as default,
6577
+ Fn as formatProductAgentTaskPageTitle,
6578
+ Xi as getProductAgentOriginAccessErrorMessage,
6579
+ Bo as isProductAgentRuntimeCommand,
6580
+ vn as mergeProductAgentEntityPages,
6377
6581
  ke as normalizeProductAgentEntityPage,
6378
6582
  st as normalizeProductAgentSessionItems,
6379
- Pn as readLocalStorageInteractionDecisions,
6380
- Co as resolveProductAgentComposerAction,
6381
- ko as resolveProductAgentWidgetPresentation,
6382
- Ss as selectProductAgentQueryEntities,
6383
- Zr as validateProductAgentProviderInputFile
6583
+ Nn as readLocalStorageInteractionDecisions,
6584
+ xo as resolveProductAgentComposerAction,
6585
+ Oo as resolveProductAgentWidgetPresentation,
6586
+ As as selectProductAgentQueryEntities,
6587
+ ao as validateProductAgentProviderInputFile
6384
6588
  };