@pluno/product-agent-web 0.1.209 → 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 Ro(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 Eo(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 Eo(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 ko(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 Co {
1046
+ class No {
876
1047
  constructor(e) {
877
1048
  this.titleDocument = e;
878
1049
  }
@@ -906,11 +1077,11 @@ class Co {
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 _o(s) {
1084
+ function Ho(s) {
914
1085
  return {
915
1086
  getTitle: () => s.title,
916
1087
  setTitle: (e) => {
@@ -927,9 +1098,23 @@ function _o(s) {
927
1098
  };
928
1099
  }
929
1100
  function ve(s) {
930
- return s.replace(Un, "");
1101
+ return s.replace(Bn, "");
1102
+ }
1103
+ const Wn = {
1104
+ "duplicate-message-item": "A canonical message rendered more than once.",
1105
+ "duplicate-canonical-item": "A canonical session item rendered more than once.",
1106
+ "duplicate-tool-call": "A tool call rendered more than once.",
1107
+ "duplicate-attachment": "An attachment rendered more than once.",
1108
+ "duplicate-terminal-outcome": "A response rendered more than one terminal outcome.",
1109
+ "foreign-session-item-visible": "The visible transcript contains state owned by another session.",
1110
+ "terminal-response-reactivated": "A terminal response became active again.",
1111
+ "terminal-history-not-append-only": "An established terminal outcome disappeared or changed order.",
1112
+ "runtime-transcript-not-rendered": "A nonempty runtime transcript is displaying starter prompts."
1113
+ };
1114
+ function $n(s) {
1115
+ return typeof s == "string" && s.startsWith("ui_invariant:") && Object.prototype.hasOwnProperty.call(Wn, s.slice(13));
931
1116
  }
932
- function Po(s) {
1117
+ function Bo(s) {
933
1118
  if (!s || typeof s != "object" || !("type" in s)) return !1;
934
1119
  const e = s;
935
1120
  switch (e.type) {
@@ -943,7 +1128,7 @@ function Po(s) {
943
1128
  case "runtime.report_displayed_error":
944
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);
945
1130
  case "runtime.report_invalid_state_transition":
946
- return (e.reason === "submitted_turn_returned_to_welcome_without_new_chat" || e.reason === "new_messages_button_without_user_scroll") && (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");
947
1132
  case "runtime.widget_lifecycle":
948
1133
  return (e.action === "opened" || e.action === "closed" || e.action === "minimized") && typeof e.trigger == "string";
949
1134
  case "session.load":
@@ -970,9 +1155,9 @@ function Po(s) {
970
1155
  return !1;
971
1156
  }
972
1157
  }
973
- class vo {
1158
+ class Fo {
974
1159
  constructor(e, t, n) {
975
- this.adapter = t, this.state = Je(e), this.model = n;
1160
+ this.adapter = t, this.state = Xe(e), this.model = n;
976
1161
  }
977
1162
  adapter;
978
1163
  listeners = {};
@@ -993,12 +1178,12 @@ class vo {
993
1178
  return n.add(t), this.listeners[e] = n, () => n.delete(t);
994
1179
  }
995
1180
  getState() {
996
- return Je(this.state);
1181
+ return Xe(this.state);
997
1182
  }
998
1183
  updateProjection(e, t, n, i, r) {
999
1184
  if (!this.destroyed) {
1000
- if (this.state = Je(e), t !== void 0 && (this.model = t), n) {
1001
- this.sessionHistoryState = Nt(n);
1185
+ if (this.state = Xe(e), t !== void 0 && (this.model = t), n) {
1186
+ this.sessionHistoryState = Ft(n);
1002
1187
  for (const o of this.sessionHistoryListeners)
1003
1188
  o(this.getSessionHistoryState());
1004
1189
  }
@@ -1043,7 +1228,7 @@ class vo {
1043
1228
  type: "runtime.report_displayed_error",
1044
1229
  reason: e,
1045
1230
  errorFingerprint: t,
1046
- ...n ? { displayedMessage: hs(n) } : {}
1231
+ ...n ? { displayedMessage: fs(n) } : {}
1047
1232
  }).catch(() => {
1048
1233
  });
1049
1234
  }
@@ -1158,12 +1343,12 @@ class vo {
1158
1343
  await this.dispatch({ type: "session.list", ...e });
1159
1344
  const t = this.sessionHistoryState.data;
1160
1345
  return {
1161
- sessions: Ss(t),
1346
+ sessions: As(t),
1162
1347
  nextCursor: t?.nextCursor ?? null
1163
1348
  };
1164
1349
  }
1165
1350
  getSessionHistoryState() {
1166
- return Nt(this.sessionHistoryState);
1351
+ return Ft(this.sessionHistoryState);
1167
1352
  }
1168
1353
  subscribeSessionHistory(e) {
1169
1354
  return this.sessionHistoryListeners.add(e), e(this.getSessionHistoryState()), () => this.sessionHistoryListeners.delete(e);
@@ -1242,7 +1427,7 @@ class vo {
1242
1427
  for (const i of n ?? []) i(t);
1243
1428
  }
1244
1429
  }
1245
- function Je(s) {
1430
+ function Xe(s) {
1246
1431
  return {
1247
1432
  ...s,
1248
1433
  starterPrompts: [...s.starterPrompts],
@@ -1266,17 +1451,17 @@ function Je(s) {
1266
1451
  activeScheduledFollowUps: s.activeScheduledFollowUps?.map((e) => ({ ...e })) ?? null
1267
1452
  };
1268
1453
  }
1269
- function Nt(s) {
1454
+ function Ft(s) {
1270
1455
  return {
1271
1456
  ...s,
1272
1457
  data: s.data ? ke({
1273
- entities: Ss(s.data).map((e) => ({ ...e })),
1458
+ entities: As(s.data).map((e) => ({ ...e })),
1274
1459
  nextCursor: s.data.nextCursor
1275
1460
  }) : null
1276
1461
  };
1277
1462
  }
1278
- const qn = globalThis.fetch.bind(globalThis), Ht = '.pluno-pa-widget-host[data-pluno-product-agent-ui="widget"]', On = '.pluno-pa-widget[data-pluno-product-agent-ui-root="widget"]', xn = ".pluno-pa-widget__panel", Ln = ".pluno-pa-widget__timeline", Nn = "__plunoExtensionWidgetOwner";
1279
- 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 {
1280
1465
  constructor(e, t, n, i) {
1281
1466
  super(e), this.retryable = t, this.status = n, this.retryAfterMs = i, this.name = "ProductAgentTokenProviderError";
1282
1467
  }
@@ -1284,11 +1469,11 @@ class X extends Error {
1284
1469
  status;
1285
1470
  retryAfterMs;
1286
1471
  }
1287
- function Hn(s) {
1472
+ function Qn(s) {
1288
1473
  return s === "dismiss" || s === "later" || s === "snooze" || s === "never" || s === "dont_show_again";
1289
1474
  }
1290
- let Bn = 0;
1291
- function Bt(s) {
1475
+ let Jn = 0;
1476
+ function $t(s) {
1292
1477
  const e = {};
1293
1478
  for (const l of [
1294
1479
  "type",
@@ -1330,7 +1515,8 @@ function Bt(s) {
1330
1515
  status: typeof d.status == "string" ? d.status : null,
1331
1516
  stage: typeof d.stage == "string" ? d.stage : null,
1332
1517
  retryable: d.retryable === !0,
1333
- visible: !!(g && !g.scheduledCheckInAt && g.toolName !== St && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
1518
+ visible: !!(g && // Recovery-only failures are intentionally hidden, not missing transcript items.
1519
+ !(d.type === "run_error" && d.retryable === !0) && !g.scheduledCheckInAt && g.toolName !== Tt && (d.type !== "run_status" || ["failed", "interrupted", "stopped"].includes(String(d.status))))
1334
1520
  };
1335
1521
  }, o = r(s.item);
1336
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)) {
@@ -1365,7 +1551,7 @@ function Se(s, e, t) {
1365
1551
  source: "web_sdk",
1366
1552
  category: s,
1367
1553
  name: e,
1368
- sequence: ++Bn,
1554
+ sequence: ++Jn,
1369
1555
  wallTime: (/* @__PURE__ */ new Date()).toISOString(),
1370
1556
  monotonicMs: performance.now(),
1371
1557
  data: t
@@ -1374,27 +1560,27 @@ function Se(s, e, t) {
1374
1560
  }
1375
1561
  class Te extends Error {
1376
1562
  }
1377
- function Fn(s) {
1563
+ function Xn(s) {
1378
1564
  return s === 408 || s === 425 || s === 429 || s >= 500;
1379
1565
  }
1380
- const Wn = "https://app.pluno.ai", $n = 2e4, jn = 1e4, zn = 6e4, Kn = 6e4, Gn = 1e4, Qn = 1e4, Vn = 3e3, Xn = 3e4, Jn = 1e3, ot = 3e4, Ft = 0.2, Yn = 6e4, Wt = 15e3, Zn = 6e4, ei = 8, ti = "Browser connection was interrupted.", $t = 15e3, si = "Pluno could not send this message. Try it again.", ni = "Still connecting to Pluno. Retrying automatically.", ii = 2e3, ri = 1e3, oi = 100, jt = 8e3, zt = 3, ai = [300, 1e3], ws = 50 * 1024 * 1024, li = /* @__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([
1381
1567
  ".jpeg:image/jpeg",
1382
1568
  ".jpg:image/jpeg",
1383
1569
  ".pdf:application/pdf",
1384
1570
  ".png:image/png",
1385
1571
  ".webp:image/webp"
1386
- ]), Uo = ".pdf,.png,.jpg,.jpeg,.webp", Tt = 64e3, Ye = 4e3, wt = 30, ci = 2e3, ui = 1e3, As = "Image is too large for model vision input.", di = 100, hi = 20, Ms = "pluno.productAgent.state.", at = "pluno.productAgent.pendingEvents.", Le = "pluno.productAgent.activeToolCalls.", pi = 100;
1387
- function gi(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) {
1388
1574
  const t = s === 0 ? 0 : Math.min(3e4, 1e3 * 2 ** (s - 1));
1389
1575
  return Math.max(e, t);
1390
1576
  }
1391
1577
  const Ce = /* @__PURE__ */ new Set();
1392
1578
  let we = null;
1393
- function fi(s, e = Math.random) {
1394
- const t = Math.min(ot, Jn * 2 ** s), n = 1 - Ft + e() * Ft * 2;
1395
- 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));
1396
1582
  }
1397
- function mi(s) {
1583
+ function Ei(s) {
1398
1584
  const e = s.split(".")[1];
1399
1585
  if (!e)
1400
1586
  return null;
@@ -1405,8 +1591,8 @@ function mi(s) {
1405
1591
  return null;
1406
1592
  }
1407
1593
  }
1408
- function yi(s) {
1409
- if (s instanceof X)
1594
+ function ki(s) {
1595
+ if (s instanceof J)
1410
1596
  return s.retryable;
1411
1597
  if (s && typeof s == "object") {
1412
1598
  const e = s.status;
@@ -1415,7 +1601,7 @@ function yi(s) {
1415
1601
  }
1416
1602
  return !0;
1417
1603
  }
1418
- function Ii(s) {
1604
+ function Ci(s) {
1419
1605
  if (s instanceof Error)
1420
1606
  return s;
1421
1607
  if (s && typeof s == "object") {
@@ -1429,10 +1615,10 @@ function Ii(s) {
1429
1615
  }
1430
1616
  class Ne {
1431
1617
  constructor(e, t) {
1432
- this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new En(
1618
+ this.options = e, this.transportIdentity = t, this.sessionHistoryManager = new qn(
1433
1619
  e.clientId,
1434
1620
  async ({ cursor: r, limit: o, pinned: a }) => await this.listSessions({ cursor: r, limit: o, pinned: a })
1435
- ), this.sessionRecoveryPoller = new Lt({
1621
+ ), this.sessionRecoveryPoller = new Bt({
1436
1622
  poll: async ({ sessionId: r }) => await this.fetchSessionHistoryPageOnce(
1437
1623
  r,
1438
1624
  "transcript",
@@ -1444,7 +1630,7 @@ class Ne {
1444
1630
  activeIntervalMs: 3e3,
1445
1631
  idleIntervalMs: 15e3,
1446
1632
  maxFailureIntervalMs: 3e4
1447
- }), this.sessionActivityRecovery = new Cn({
1633
+ }), this.sessionActivityRecovery = new xn({
1448
1634
  fetchPage: async (r, o) => await this.fetchSessionHistoryPageOnce(
1449
1635
  r,
1450
1636
  "activity",
@@ -1463,24 +1649,24 @@ class Ne {
1463
1649
  },
1464
1650
  getItemId: (r) => A(r, "id"),
1465
1651
  maxPagesPerPoll: 3
1466
- }), this.sessionActivityRecoveryPoller = new Lt({
1652
+ }), this.sessionActivityRecoveryPoller = new Bt({
1467
1653
  poll: async ({ sessionId: r }) => await this.sessionActivityRecovery.poll(r),
1468
1654
  apply: async (r) => await this.sessionActivityRecovery.apply(r),
1469
1655
  isActiveTurn: () => this.state.isThinking || this.state.pendingMessageStatus !== null,
1470
1656
  activeIntervalMs: 3e3,
1471
1657
  idleIntervalMs: 15e3,
1472
1658
  maxFailureIntervalMs: 3e4
1473
- }), 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 = {
1474
1660
  ...this.state,
1475
- starterPrompts: Zi(e.initialStarterPrompts)
1661
+ starterPrompts: cr(e.initialStarterPrompts)
1476
1662
  }, this.account = e.initialAccount ? { ...e.initialAccount } : null;
1477
- const n = e.restorePersistedState === !1 ? null : $r(e.clientId, e.expectedPersistedSessionId);
1663
+ const n = e.restorePersistedState === !1 ? null : Zr(e.clientId, e.expectedPersistedSessionId);
1478
1664
  n && (this.state = {
1479
1665
  ...this.state,
1480
1666
  ...n,
1481
1667
  // Paint the readable same-session cache immediately while the complete transcript is revalidated. Tool
1482
1668
  // activity is deliberately not restored here because it hydrates after the transcript is visible.
1483
- messages: n.messages.filter(gt),
1669
+ messages: n.messages.filter(ft),
1484
1670
  isLoadingSession: n.sessionId !== null,
1485
1671
  status: "idle",
1486
1672
  user: null,
@@ -1495,16 +1681,17 @@ class Ne {
1495
1681
  taskStatus: null,
1496
1682
  isRetrying: !1,
1497
1683
  lastError: null
1498
- }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = Vr(
1499
- zr(e.clientId),
1500
- Kr(e.clientId)
1684
+ }, n.sessionId && this.rememberSessionTimeline(n.sessionId, this.state.messages)), this.queuedClientEvents = ro(
1685
+ to(e.clientId),
1686
+ so(e.clientId)
1501
1687
  );
1502
1688
  const i = [...this.queuedClientEvents].reverse().find(
1503
1689
  (r) => r.type === "chat.user_message" && typeof r.clientMessageId == "string"
1504
1690
  );
1505
- 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);
1506
1692
  }
1507
1693
  options;
1694
+ clientRuntime = new Zs();
1508
1695
  listeners = {};
1509
1696
  socket = null;
1510
1697
  reconnectTimer = null;
@@ -1543,7 +1730,7 @@ class Ne {
1543
1730
  accountRefresh = null;
1544
1731
  runtimeInteractions = [];
1545
1732
  interactionListeners = /* @__PURE__ */ new Set();
1546
- interactionManager = new _n(
1733
+ interactionManager = new Ln(
1547
1734
  { load: async () => [], save: async () => {
1548
1735
  } },
1549
1736
  []
@@ -1643,17 +1830,17 @@ class Ne {
1643
1830
  lastErrorSecuritySettingsUrl: null
1644
1831
  };
1645
1832
  static async init(e) {
1646
- const t = e, n = await pn(
1833
+ const t = e, n = await wn(
1647
1834
  t.skipStoredTransportIdentityCollisionCheck === !0
1648
1835
  ), i = new Ne({
1649
1836
  ...e,
1650
- backendUrl: Ni(e.backendUrl ?? Wn),
1651
- clientId: e.clientId ?? ir(),
1837
+ backendUrl: Vi(e.backendUrl ?? Yn),
1838
+ clientId: e.clientId ?? gr(),
1652
1839
  productVariant: e.productVariant ?? "customer_embedded",
1653
- entrySurface: Hi(e.entrySurface)
1840
+ entrySurface: Qi(e.entrySurface)
1654
1841
  }, n);
1655
1842
  try {
1656
- Js().catch((r) => {
1843
+ on().catch((r) => {
1657
1844
  b("web-sdk.attachments", "Failed to delete stale Product Agent attachments", {
1658
1845
  message: r instanceof Error ? r.message : String(r)
1659
1846
  });
@@ -1668,28 +1855,30 @@ class Ne {
1668
1855
  return n.add(t), this.listeners[e] = n, () => n.delete(t);
1669
1856
  }
1670
1857
  getState() {
1671
- return {
1858
+ return this.clientRuntime.project("conversation", { legacy: () => ({
1672
1859
  ...this.state,
1673
1860
  activeResponseUserMessageId: this.activeResponseUserMessageId,
1674
1861
  starterPrompts: [...this.state.starterPrompts],
1675
1862
  appearance: this.state.appearance ? { ...this.state.appearance } : null,
1676
1863
  messages: [...this.state.messages]
1677
- };
1864
+ }) });
1678
1865
  }
1679
1866
  stageProactiveSuggestionQuestion(e) {
1680
- const t = e.trim();
1681
- if (!t)
1682
- return;
1683
- const n = this.stagedProactiveSuggestionQuestionMessageId ?? `local-proactive-suggestion-edit-${x()}`;
1684
- this.stagedProactiveSuggestionQuestionMessageId = n;
1685
- const i = {
1686
- id: n,
1687
- role: "assistant",
1688
- phase: "final_answer",
1689
- content: t,
1690
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
1691
- }, r = this.state.messages.findIndex((a) => a.id === n), o = [...this.state.messages];
1692
- 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
+ } });
1693
1882
  }
1694
1883
  invalidateProviderToken() {
1695
1884
  this.options.token || (this.token = null, this.tokenExpiresAtMs = null);
@@ -1699,7 +1888,7 @@ class Ne {
1699
1888
  return this.options.token;
1700
1889
  if (!this.options.tokenProvider)
1701
1890
  return this.token;
1702
- const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - Kn > n;
1891
+ const n = Date.now(), i = this.token !== null && this.tokenExpiresAtMs !== null && this.tokenExpiresAtMs - si > n;
1703
1892
  if (!t.forceRefresh && (i || t.preferCached && this.token !== null))
1704
1893
  return this.token;
1705
1894
  if (this.tokenRequest && !t.forceRefresh)
@@ -1711,8 +1900,8 @@ class Ne {
1711
1900
  let a = null;
1712
1901
  const l = new Promise((c, u) => {
1713
1902
  a = window.setTimeout(() => {
1714
- r.abort(), u(new X("Pluno token provider timed out", !0));
1715
- }, zn);
1903
+ r.abort(), u(new J("Pluno token provider timed out", !0));
1904
+ }, ti);
1716
1905
  });
1717
1906
  try {
1718
1907
  const c = await Promise.race([
@@ -1720,10 +1909,10 @@ class Ne {
1720
1909
  l
1721
1910
  ]);
1722
1911
  if (r.signal.aborted || this.tokenAbortController !== r)
1723
- throw new X("Pluno token request was cancelled", !0);
1912
+ throw new J("Pluno token request was cancelled", !0);
1724
1913
  if (!c)
1725
- throw new X("Pluno token provider did not return a token", !1);
1726
- return this.token = c, this.tokenExpiresAtMs = mi(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;
1727
1916
  } finally {
1728
1917
  a !== null && window.clearTimeout(a);
1729
1918
  }
@@ -1736,112 +1925,120 @@ class Ne {
1736
1925
  }
1737
1926
  }
1738
1927
  async connect() {
1739
- if (this.connectionInProgress || this.socket?.readyState === WebSocket.OPEN || this.socket?.readyState === WebSocket.CONNECTING)
1740
- return;
1741
- this.reconnectTimer !== null && (window.clearTimeout(this.reconnectTimer), this.reconnectTimer = null, this.reconnectAttempts = 0), this.connectionInProgress = !0;
1742
- const e = ++this.connectionAttemptId;
1743
- this.setState(
1744
- this.state.status === "reconnecting" ? { status: "reconnecting" } : { status: "connecting", lastError: null }
1745
- );
1746
- try {
1747
- 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)
1748
1930
  return;
1749
- if (!this.token && !this.options.webSocketFactory)
1750
- throw new X("Pluno requires a token or tokenProvider", !1);
1751
- const t = Wi(this.options.backendUrl), n = this.options.webSocketFactory?.(t) ?? new WebSocket(t);
1752
- this.socket = n, this.socketConnectTimer = window.setTimeout(() => {
1753
- this.socket === n && n.readyState === WebSocket.CONNECTING && (b("web-sdk.agent", "Pluno socket opening timed out; reconnecting"), this.reportTransportDiagnostic("connect_timeout"), this.replaceTimedOutSocket(n));
1754
- }, Gn), n.addEventListener("open", () => {
1755
- this.socket !== n || (this.clearSocketConnectTimer(), b("web-sdk.agent", "Pluno socket opened", {
1756
- queuedClientEventCount: this.queuedClientEvents.length,
1757
- isThinking: this.state.isThinking
1758
- }), !(this.token ? this.sendNow({
1759
- type: "auth.session",
1760
- token: this.token,
1761
- clientId: this.options.clientId,
1762
- transportId: this.transportIdentity.transportId,
1763
- pageUrl: location.href
1764
- }) : !0)) || (this.socketAuthTimer = window.setTimeout(() => {
1765
- this.socket === n && (b("web-sdk.agent", "Pluno socket authentication timed out; reconnecting"), this.reportTransportDiagnostic("auth_timeout"), this.replaceTimedOutSocket(n));
1766
- }, Qn));
1767
- }), n.addEventListener("message", (i) => {
1768
- this.socket === n && this.handleServerEvent(Ji(i.data));
1769
- }), n.addEventListener("sendfailure", (i) => {
1770
- 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")
1771
1938
  return;
1772
- const r = Yi(i?.detail?.data);
1773
- r?.type === "chat.user_message" && r.clientMessageId === this.pendingClientMessageId && !this.queuedClientEvents.some(
1774
- (o) => o.type === "chat.user_message" && o.clientMessageId === r.clientMessageId
1775
- ) && (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();
1776
- }), n.addEventListener("close", (i) => {
1777
- this.socket === n && (this.clearSocketPhaseTimers(), this.stopHeartbeat(), this.socket = null, this.state.status !== "closed" && (b("web-sdk.agent", "Pluno socket closed; scheduling reconnect", {
1778
- code: typeof i?.code == "number" ? i.code : null,
1779
- reason: typeof i?.reason == "string" ? i.reason : "",
1780
- wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : null,
1781
- queuedClientEventCount: this.queuedClientEvents.length,
1782
- isThinking: this.state.isThinking
1783
- }), (typeof i?.code != "number" || i.code !== 1e3) && this.reportTransportDiagnostic("socket_closed", {
1784
- closeCode: typeof i?.code == "number" ? i.code : void 0,
1785
- wasClean: typeof i?.wasClean == "boolean" ? i.wasClean : void 0
1786
- }), this.setReconnectingState(), this.scheduleReconnect()));
1787
- }), n.addEventListener("error", () => {
1788
- this.socket !== n || this.state.status === "closed" || (b("web-sdk.agent", "Pluno socket error; scheduling reconnect", {
1789
- queuedClientEventCount: this.queuedClientEvents.length,
1790
- isThinking: this.state.isThinking
1791
- }), 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());
1792
- });
1793
- } catch (t) {
1794
- if (e !== this.connectionAttemptId || this.state.status === "closed")
1795
- return;
1796
- const n = Ii(t);
1797
- if (yi(t)) {
1798
- b("web-sdk.agent", "Pluno connection attempt failed; retrying", {
1799
- message: n.message,
1800
- reconnectAttempt: this.reconnectAttempts
1801
- }), t instanceof X && this.reportTransportDiagnostic("auth_timeout"), this.setState({
1802
- status: "reconnecting",
1803
- lastError: ni,
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,
1804
2003
  lastErrorCode: "connection_failed"
1805
- }), this.emit("error", n), this.scheduleReconnect(
1806
- t instanceof X ? t.retryAfterMs : void 0
1807
- );
1808
- return;
2004
+ }), this.emit("error", n), n;
2005
+ } finally {
2006
+ this.connectionInProgress = !1;
1809
2007
  }
1810
- throw this.setState({
1811
- status: "error",
1812
- lastError: n.message,
1813
- lastErrorCode: "connection_failed"
1814
- }), this.emit("error", n), n;
1815
- } finally {
1816
- this.connectionInProgress = !1;
1817
- }
2008
+ } });
1818
2009
  }
1819
2010
  disconnect() {
1820
- 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
+ } });
1821
2014
  }
1822
2015
  destroy() {
1823
- this.disconnect(), this.clearAllFirstResponseTimers(), this.locationChangeCleanup?.(), this.locationChangeCleanup = null, this.cleanupSessionBrowserApis(), this.pageLifecycleCleanup?.(), this.pageLifecycleCleanup = null, this.activeBrowserToolCalls.clear(), Xr(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();
1824
- for (const e of Object.values(this.listeners))
1825
- e?.clear();
1826
- 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
+ }
1827
2022
  }
1828
2023
  warmup(e = "panel_open") {
1829
- const t = _(), n = `${this.state.sessionId ?? "draft"}:${t.url}`, i = e === "composer_input" && this.pendingComposerWarmup?.scope === n ? this.pendingComposerWarmup : null, r = {
1830
- type: "runtime.warmup",
1831
- reason: e,
1832
- ...e === "composer_input" ? { warmupId: i?.event.warmupId ?? x() } : {},
1833
- entrySurface: this.options.entrySurface,
1834
- sessionId: this.state.sessionId ?? void 0,
1835
- page: t,
1836
- model: this.options.model
1837
- };
1838
- if (e === "composer_input") {
1839
- if (this.options.productVariant === "customer_embedded") {
1840
- this.sendNow(r) || (this.pendingPassiveWarmupEvent = r);
1841
- return;
1842
- }
1843
- i || (this.clearPendingComposerWarmup(), this.pendingComposerWarmup = { event: r, scope: n, retryAttempt: 0, acknowledged: !1 }, this.activeComposerWarmupId = r.warmupId ?? null, this.activeComposerWarmupScope = n), this.flushPendingComposerWarmup();
1844
- } 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
+ } });
1845
2042
  }
1846
2043
  recordWidgetLifecycle(e, t) {
1847
2044
  const n = {
@@ -1859,114 +2056,116 @@ class Ne {
1859
2056
  this.authenticatedSocket === this.socket && this.sendNow(n) || (this.pendingWidgetLifecycleEvents.push(n), this.pendingWidgetLifecycleEvents.length > 20 && this.pendingWidgetLifecycleEvents.splice(0, this.pendingWidgetLifecycleEvents.length - 20));
1860
2057
  }
1861
2058
  async sendMessage(e, t = {}) {
1862
- const n = e.trim(), i = t.attachments ?? [];
1863
- if (this.options.productVariant === "customer_embedded" && (i.forEach(xs), i.reduce(
1864
- (T, N) => T + N.sizeBytes,
1865
- 0
1866
- ) > ws))
1867
- throw new Error("Embedded attachments must total at most 50 MB per message");
1868
- let r = i.map(qe);
1869
- if (!n && r.length === 0)
1870
- return null;
1871
- if (this.pendingClientMessageId)
1872
- throw new Error("Wait for the current message to finish sending before sending another.");
1873
- const o = _(), a = t.clientMessageId ?? x(), l = t.proactiveSuggestionQuestion?.trim(), c = this.stagedProactiveSuggestionQuestionMessageId ? this.state.messages.find(
1874
- (S) => S.id === this.stagedProactiveSuggestionQuestionMessageId
1875
- ) ?? null : null, u = l ? {
1876
- id: `local-proactive-suggestion-question-${a}`,
1877
- role: "assistant",
1878
- phase: "final_answer",
1879
- content: l,
1880
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
1881
- } : null, d = {
1882
- id: `local-${a}`,
1883
- role: "user",
1884
- content: n,
1885
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
1886
- ...i.length > 0 ? { attachments: i } : {}
1887
- }, 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 : [
1888
- ...this.state.messages.map(
1889
- (S) => c && S.id === c.id ? {
1890
- ...S,
1891
- id: `local-proactive-suggestion-question-${a}`
1892
- } : S
1893
- ),
1894
- ...!c && u ? [u] : [],
1895
- d
1896
- ], w = {
1897
- assistantDraft: this.state.assistantDraft,
1898
- assistantDraftItemId: this.state.assistantDraftItemId,
1899
- assistantDraftPhase: this.state.assistantDraftPhase,
1900
- assistantDraftRespondsToUserMessageId: this.state.assistantDraftRespondsToUserMessageId,
1901
- assistantDraftRunId: this.state.assistantDraftRunId,
1902
- lastError: this.state.lastError
1903
- };
1904
- this.setState({
1905
- messages: M,
1906
- ...f ? {} : {
1907
- assistantDraft: "",
1908
- assistantDraftItemId: null,
1909
- assistantDraftPhase: null,
1910
- assistantDraftRespondsToUserMessageId: null,
1911
- assistantDraftRunId: null
1912
- },
1913
- pendingMessageStatus: "sending",
1914
- turnPhase: f ? y : "sending",
1915
- isThinking: f,
1916
- taskStatus: "working",
1917
- isRetrying: !1,
1918
- lastError: null
1919
- }), this.startFirstResponseTimer(a, t.submittedAt), g || (this.sessionHistoryManager.addOptimistic({
1920
- id: d.id,
1921
- title: null,
1922
- customTitle: null,
1923
- firstUserMessage: d.content,
1924
- currentPage: o,
1925
- createdAt: d.createdAt,
1926
- updatedAt: d.createdAt,
1927
- lastActiveAt: d.createdAt,
1928
- isActive: !0,
1929
- isPinned: !1
1930
- }), u && !c && this.emit("message", u), this.emit("message", d));
1931
- try {
1932
- const S = [];
1933
- for (const T of r) {
1934
- const N = T.id ? this.attachmentFiles.get(T.id) : void 0;
1935
- if (T.sandboxPath || T.storageKey) {
1936
- S.push(T);
1937
- 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 }));
1938
2140
  }
1939
- if (!N)
1940
- throw new Error(`Attachment bytes are unavailable for ${T.name}`);
1941
- 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;
1942
2150
  }
1943
- r = S;
1944
- } catch (S) {
1945
- throw this.clearFirstResponseTimer(a), g || this.sessionHistoryManager.removeOptimistic(d.id), this.setState({
1946
- ...g ? {} : { messages: m },
1947
- ...f ? {} : { ...w, isThinking: !1 },
1948
- pendingMessageStatus: p,
1949
- turnPhase: y,
1950
- taskStatus: h
1951
- }), S;
1952
- }
1953
- this.retryableClientMessageId = null;
1954
- const D = !t.initiatedBy && this.options.capturePageContent !== !1 && this.lastUserMessagePageUrl !== o.url, H = {
1955
- type: "chat.user_message",
1956
- sessionId: this.state.sessionId ?? void 0,
1957
- clientMessageId: a,
1958
- initiatedBy: t.initiatedBy,
1959
- invocation: Bi(t.invocation ?? t.initiatedBy),
1960
- entrySurface: this.options.entrySurface,
1961
- content: n,
1962
- proactiveSuggestionQuestion: t.proactiveSuggestionQuestion,
1963
- pageContent: D && At() || void 0,
1964
- attachments: r.length > 0 ? r.map(qe) : void 0,
1965
- page: o,
1966
- model: this.options.model,
1967
- metadata: Kt(this.options.metadata)
1968
- };
1969
- 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
+ } });
1970
2169
  }
1971
2170
  reportInvalidStateTransition(e, t) {
1972
2171
  this.reportHealthSignal("invalid_state_transition", {
@@ -1978,41 +2177,45 @@ class Ne {
1978
2177
  this.reportHealthSignal("user_visible_error", {
1979
2178
  reason: e,
1980
2179
  errorFingerprint: t,
1981
- ...n ? { displayedMessage: hs(n) } : {}
2180
+ ...n ? { displayedMessage: fs(n) } : {}
1982
2181
  });
1983
2182
  }
1984
2183
  getModel() {
1985
- return this.options.model;
2184
+ return this.clientRuntime.project("modelSelection", { legacy: () => this.options.model });
1986
2185
  }
1987
2186
  setModel(e) {
1988
- 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
+ } });
1989
2190
  }
1990
2191
  retryLastMessage() {
1991
- const e = this.state.sessionId, t = this.retryableClientMessageId;
1992
- if (!t)
1993
- return !1;
1994
- if (this.failedUserMessageEvent?.clientMessageId === t) {
1995
- const n = this.failedUserMessageEvent;
1996
- return this.failedUserMessageEvent = null, this.retryableClientMessageId = null, this.retryAttemptsByClientMessageId[t] = 0, this.pendingClientMessageId = t, this.pendingUserMessageEvent = n, this.setState({
1997
- status: "connected",
1998
- pendingMessageStatus: "sending",
1999
- lastError: null,
2000
- lastErrorCode: null
2001
- }), this.send(n), this.schedulePendingDeliveryAck(t), !0;
2002
- }
2003
- 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
+ } });
2004
2207
  }
2005
2208
  createLocalAttachment(e) {
2006
- this.options.productVariant === "customer_embedded" && Jr(e);
2209
+ this.options.productVariant === "customer_embedded" && ao(e);
2007
2210
  const t = x(), n = {
2008
2211
  id: t,
2009
2212
  name: e.name || "attachment",
2010
- mimeType: ft(e),
2213
+ mimeType: mt(e),
2011
2214
  sizeBytes: e.size
2012
2215
  };
2013
2216
  this.attachmentFiles.set(t, e);
2014
2217
  const i = Date.now();
2015
- return Vs({
2218
+ return nn({
2016
2219
  attachmentId: t,
2017
2220
  name: n.name,
2018
2221
  mimeType: n.mimeType,
@@ -2041,7 +2244,7 @@ class Ne {
2041
2244
  file: e,
2042
2245
  attachment: t
2043
2246
  }) {
2044
- const n = this.state.sessionId, i = ft(e), r = {
2247
+ const n = this.state.sessionId, i = mt(e), r = {
2045
2248
  sessionId: n ?? void 0,
2046
2249
  attachmentId: t.id,
2047
2250
  clientId: this.options.clientId,
@@ -2051,7 +2254,7 @@ class Ne {
2051
2254
  sizeBytes: e.size,
2052
2255
  page: _(),
2053
2256
  model: this.options.model,
2054
- metadata: Kt(this.options.metadata),
2257
+ metadata: Qt(this.options.metadata),
2055
2258
  entrySurface: this.options.entrySurface
2056
2259
  };
2057
2260
  let o;
@@ -2077,8 +2280,8 @@ class Ne {
2077
2280
  }, "Failed to upload attachment"), o = l;
2078
2281
  }
2079
2282
  this.setState({ sessionId: o.sessionId });
2080
- const a = Os(o.attachment, this.options.backendUrl);
2081
- 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, {
2082
2285
  sessionId: o.sessionId,
2083
2286
  fileUrl: a.fileUrl,
2084
2287
  sandboxPath: a.sandboxPath,
@@ -2109,7 +2312,7 @@ class Ne {
2109
2312
  const n = await this.fetchEmbedAttachmentUpload(e, !1);
2110
2313
  if (n.ok)
2111
2314
  return await n.json();
2112
- if (fo(n.status) && this.options.tokenProvider && !t) {
2315
+ if (Ro(n.status) && this.options.tokenProvider && !t) {
2113
2316
  t = !0;
2114
2317
  const i = await this.fetchEmbedAttachmentUpload(e, !0);
2115
2318
  if (i.ok)
@@ -2131,174 +2334,188 @@ class Ne {
2131
2334
  });
2132
2335
  }
2133
2336
  stop() {
2134
- if (!this.state.sessionId)
2135
- return;
2136
- this.send({ type: "run.stop", sessionId: this.state.sessionId, reason: "user_requested" });
2137
- const e = Dr(
2138
- this.state.messages,
2139
- this.state.assistantDraftRespondsToUserMessageId,
2140
- this.state.assistantDraftRunId,
2141
- this.activeClientMessageId
2142
- );
2143
- this.stoppedTurns.push({
2144
- sessionId: this.state.sessionId,
2145
- ...e,
2146
- reason: "user_requested",
2147
- stoppedItemId: null,
2148
- stoppedAt: null,
2149
- stoppedCausalSequence: null,
2150
- toolCallIds: new Set(
2151
- this.state.messages.filter(
2152
- (t) => Me(
2153
- t,
2154
- e.respondsToUserMessageId,
2155
- e.runId
2156
- )
2157
- ).map((t) => t.callId).filter((t) => typeof t == "string")
2158
- )
2159
- }), this.stoppedTurns.splice(0, Math.max(0, this.stoppedTurns.length - 20));
2160
- for (const [t, n] of this.activeBrowserToolCalls)
2161
- n.event.sessionId === this.state.sessionId && this.activeBrowserToolCalls.delete(t);
2162
- ls(this.options.clientId, this.activeBrowserToolCalls.values()), this.setState({
2163
- 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(
2164
2342
  this.state.messages,
2165
- e.clientMessageId,
2166
- e.runId
2167
- ),
2168
- pendingMessageStatus: null,
2169
- isThinking: !1,
2170
- ...this.state.taskStatus === "working" ? { taskStatus: "stopped" } : {},
2171
- isRetrying: !1,
2172
- lastError: null,
2173
- lastErrorCode: null,
2174
- lastErrorSecuritySettingsUrl: null
2175
- }), 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
+ } });
2176
2381
  }
2177
2382
  startNewSession(e = {}) {
2178
- this.stopSessionRecoveryPolling();
2179
- const t = e.notifyTransport !== !1, n = this.activeComposerWarmupId;
2180
- !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({
2181
- type: "session.reset",
2182
- sessionId: this.state.sessionId ?? void 0,
2183
- warmupId: n ?? void 0,
2184
- page: _()
2185
- }), this.setState({
2186
- sessionId: null,
2187
- starterPrompts: [...this.state.starterPrompts],
2188
- messages: [],
2189
- activeScheduledFollowUps: null,
2190
- isLoadingSession: !1,
2191
- assistantDraft: "",
2192
- assistantDraftItemId: null,
2193
- assistantDraftPhase: null,
2194
- assistantDraftRespondsToUserMessageId: null,
2195
- assistantDraftRunId: null,
2196
- pendingMessageStatus: null,
2197
- isThinking: !1,
2198
- taskStatus: null,
2199
- isRetrying: !1,
2200
- lastError: null
2201
- });
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
+ } });
2202
2409
  }
2203
2410
  listSessions(e = {}) {
2204
- const t = x(), n = new Promise((r, o) => {
2205
- const a = window.setTimeout(() => {
2206
- this.pendingSessionHistoryRequests.delete(t), o(new Error("Session history did not respond in time"));
2207
- }, jt);
2208
- this.pendingSessionHistoryRequests.set(t, { resolve: r, reject: o, timeout: a });
2209
- }), i = {
2210
- type: "sessions.list",
2211
- requestId: t,
2212
- page: _(),
2213
- ...e.cursor ? { cursor: e.cursor } : {},
2214
- ...e.limit ? { limit: e.limit } : {},
2215
- ...typeof e.pinned == "boolean" ? { pinned: e.pinned } : {}
2216
- };
2217
- if (!this.sendNow(i)) {
2218
- const r = this.pendingSessionHistoryRequests.get(t);
2219
- 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."));
2220
- }
2221
- 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
+ } });
2222
2431
  }
2223
2432
  getSessionHistoryState() {
2224
- return this.sessionHistoryManager.getState();
2433
+ return this.clientRuntime.project("directory", { legacy: () => this.sessionHistoryManager.getState() });
2225
2434
  }
2226
2435
  subscribeSessionHistory(e) {
2227
- return this.sessionHistoryManager.subscribe(e);
2436
+ return this.clientRuntime.project("directory", { legacy: () => this.sessionHistoryManager.subscribe(e) });
2228
2437
  }
2229
2438
  refreshSessionHistory() {
2230
- return this.sessionHistoryManager.refresh();
2439
+ return this.clientRuntime.route("directory", { legacy: () => this.sessionHistoryManager.refresh() });
2231
2440
  }
2232
2441
  loadMoreSessionHistory() {
2233
- const e = this.sessionHistoryManager.getState().data?.nextCursor ?? null;
2234
- 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
+ } });
2235
2446
  }
2236
2447
  setSessionPinned(e, t) {
2237
- const n = this.sessionHistoryManager.getEntity(e)?.isPinned === !0, i = this.sessionHistoryManager.setPinned(e, t);
2238
- return this.sendSessionMutation(
2239
- this.pendingSessionPinRequests,
2240
- { type: "session.pin", requestId: x(), sessionId: e, pinned: t },
2241
- "Session pin did not respond in time"
2242
- ).then(() => {
2243
- this.sessionHistoryManager.confirmPinned(e, i), this.sessionHistoryManager.refresh();
2244
- }).catch((r) => {
2245
- throw this.sessionHistoryManager.rollbackPinned(e, i, n), r;
2246
- });
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
+ } });
2247
2460
  }
2248
2461
  renameSession(e, t) {
2249
- const n = this.sessionHistoryManager.getEntity(e)?.customTitle ?? null;
2250
- return this.sessionHistoryManager.setTitle(e, t), this.sendSessionMutation(
2251
- this.pendingSessionRenameRequests,
2252
- { type: "session.rename", requestId: x(), sessionId: e, title: t },
2253
- "Session rename did not respond in time"
2254
- ).then(() => {
2255
- this.sessionHistoryManager.confirmTitle(e), this.sessionHistoryManager.refresh();
2256
- }).catch((i) => {
2257
- throw this.sessionHistoryManager.setTitle(e, n), this.sessionHistoryManager.confirmTitle(e), i;
2258
- });
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
+ } });
2259
2474
  }
2260
2475
  getInteractions() {
2261
- return this.runtimeInteractions.map((e) => ({ ...e }));
2476
+ return this.clientRuntime.project("interactions", { legacy: () => this.runtimeInteractions.map((e) => ({ ...e })) });
2262
2477
  }
2263
2478
  subscribeInteractions(e) {
2264
- 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)) });
2265
2480
  }
2266
2481
  async actOnInteraction(e, t, n, i = {}) {
2267
- const r = this.runtimeInteractions.find((o) => o.id === e);
2268
- if (!r || r.revision !== n || r.status !== "presentable")
2269
- throw new Error("This interaction is no longer available.");
2270
- if (!r.allowedActions.includes(t))
2271
- throw new Error("This action is not available for the interaction.");
2272
- if (Hn(t) && await this.interactionManager.act(
2273
- {
2274
- key: r.id,
2275
- category: r.category,
2276
- scope: r.scope,
2277
- allowedActions: r.allowedActions
2278
- },
2279
- t,
2280
- { snoozeUntil: i.snoozeUntil ? new Date(i.snoozeUntil) : void 0 }
2281
- ), r.kind === "integration_connection" && t === "connect") {
2282
- const o = r.payload.request;
2283
- this.integrationAuthStatusByRequestId.set(o.authRequestId, "checking"), this.integrationAuthErrorByRequestId.delete(o.authRequestId), this.rebuildRuntimeInteractions();
2284
- try {
2285
- await this.options.runtimeAdapters?.integrationAuthHandler?.(o);
2286
- const a = await this.options.runtimeAdapters?.integrationAuthStatusLoader?.(o) ?? "completed";
2287
- this.integrationAuthStatusByRequestId.set(o.authRequestId, a);
2288
- } catch (a) {
2289
- this.integrationAuthStatusByRequestId.set(o.authRequestId, "error"), this.integrationAuthErrorByRequestId.set(
2290
- o.authRequestId,
2291
- a instanceof Error ? a.message : "Connection failed"
2292
- );
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;
2293
2512
  }
2294
- this.rebuildRuntimeInteractions();
2295
- return;
2296
- }
2297
- if (r.kind === "personal_channel_connection" && t === "connect") {
2298
- const o = r.payload.request;
2299
- await this.options.runtimeAdapters?.personalChannelConnectionHandler?.(o);
2300
- }
2301
- 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
+ } });
2302
2519
  }
2303
2520
  async refreshRuntimeInteractions() {
2304
2521
  const e = this.options.runtimeAdapters?.tabGroups;
@@ -2320,7 +2537,7 @@ class Ne {
2320
2537
  this.rebuildRuntimeInteractions();
2321
2538
  }
2322
2539
  rebuildRuntimeInteractions() {
2323
- 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;
2324
2541
  if (t) {
2325
2542
  const r = {
2326
2543
  key: t.id,
@@ -2427,13 +2644,13 @@ class Ne {
2427
2644
  for (const r of this.interactionListeners) r(this.getInteractions());
2428
2645
  }
2429
2646
  getAccount() {
2430
- return this.account ? { ...this.account } : null;
2647
+ return this.clientRuntime.project("account", { legacy: () => this.account ? { ...this.account } : null });
2431
2648
  }
2432
2649
  subscribeAccount(e) {
2433
- 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)) });
2434
2651
  }
2435
2652
  refreshAccount() {
2436
- 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) => {
2437
2654
  e && (this.account = {
2438
2655
  ...e,
2439
2656
  usingPaidCreditFallback: this.usingPaidCreditFallback
@@ -2441,40 +2658,42 @@ class Ne {
2441
2658
  for (const t of this.accountListeners) t(this.getAccount());
2442
2659
  }).finally(() => {
2443
2660
  this.accountRefresh = null;
2444
- }), this.accountRefresh) : Promise.resolve();
2661
+ }), this.accountRefresh) : Promise.resolve() });
2445
2662
  }
2446
2663
  loadSession(e) {
2447
- const t = x(), n = this.activeComposerWarmupId;
2448
- this.state.sessionId && this.rememberSessionTimeline(this.state.sessionId, this.state.messages);
2449
- const i = this.getCachedSessionTimeline(e), r = [...i ?? []].reverse().find((a) => a.dataType === "assistant_draft" && a.steered !== !0), o = vr(i ?? []);
2450
- !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({
2451
- type: "session.reset",
2452
- warmupId: n,
2453
- page: _()
2454
- }), 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({
2455
- sessionId: e,
2456
- // A session-keyed timeline can render immediately while the subscription handshake and authoritative
2457
- // history reload preserve the live-event race guarantees for this selected chat.
2458
- messages: i ?? [],
2459
- activeScheduledFollowUps: null,
2460
- isLoadingSession: !0,
2461
- assistantDraft: r?.content ?? "",
2462
- assistantDraftItemId: r?.id ?? null,
2463
- assistantDraftPhase: r?.phase ?? null,
2464
- assistantDraftRespondsToUserMessageId: r?.respondsToUserMessageId ?? null,
2465
- assistantDraftRunId: r?.runId ?? null,
2466
- pendingMessageStatus: null,
2467
- isThinking: o,
2468
- taskStatus: o ? "working" : null,
2469
- isRetrying: !1,
2470
- lastError: null,
2471
- lastErrorCode: null
2472
- }), this.canLoadSessionHistoryOverHttp() ? (this.state.status === "reconnecting" && this.startSessionRecoveryPolling(), this.loadSessionHistoryOverHttp(e, t)) : this.send({
2473
- type: "session.load",
2474
- requestId: t,
2475
- sessionId: e,
2476
- page: _()
2477
- });
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
+ } });
2478
2697
  }
2479
2698
  canLoadSessionHistoryOverHttp() {
2480
2699
  return !this.options.token && !this.options.tokenProvider ? !1 : this.options.productVariant === "customer_embedded" || !!this.options.runtimeCommunityId;
@@ -2580,7 +2799,7 @@ class Ne {
2580
2799
  });
2581
2800
  if (!c.ok) {
2582
2801
  const d = await c.text() || `History request failed (${c.status})`;
2583
- throw Fn(c.status) ? new Error(d) : new Te(d);
2802
+ throw Xn(c.status) ? new Error(d) : new Te(d);
2584
2803
  }
2585
2804
  const u = await c.json();
2586
2805
  if (!u?.session || !Array.isArray(u.items))
@@ -2617,7 +2836,7 @@ class Ne {
2617
2836
  send(e) {
2618
2837
  this.sendNow(L(e)) || (e.type === "chat.user_message" && typeof e.clientMessageId == "string" && this.queuedClientEvents.some(
2619
2838
  (i) => i.type === "chat.user_message" && i.clientMessageId === e.clientMessageId
2620
- ) || 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({
2621
2840
  status: "reconnecting",
2622
2841
  ...e.type === "chat.user_message" && e.clientMessageId === this.pendingClientMessageId ? { pendingMessageStatus: "reconnecting" } : {}
2623
2842
  }), this.scheduleReconnect());
@@ -2635,7 +2854,7 @@ class Ne {
2635
2854
  return !1;
2636
2855
  const t = this.socket;
2637
2856
  try {
2638
- 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;
2639
2858
  } catch (n) {
2640
2859
  return b("web-sdk.agent", "Pluno socket send failed; scheduling reconnect", {
2641
2860
  message: n instanceof Error ? n.message : String(n),
@@ -2685,7 +2904,7 @@ class Ne {
2685
2904
  clientMessageId: e,
2686
2905
  durationMs: Date.now() - n
2687
2906
  });
2688
- }, Math.max(0, Zn - (Date.now() - n)));
2907
+ }, Math.max(0, ci - (Date.now() - n)));
2689
2908
  this.firstResponseTimersByClientMessageId.set(e, { submittedAt: n, timer: i });
2690
2909
  }
2691
2910
  clearFirstResponseTimer(e) {
@@ -2795,7 +3014,7 @@ class Ne {
2795
3014
  if (this.state.starterPromptsLoading || this.transientStarterPromptsRequestInFlight || this.transientStarterPromptsRequestAttempted)
2796
3015
  return;
2797
3016
  this.transientStarterPromptsRequestInFlight = !0, this.transientStarterPromptsRequestAttempted = !0, this.setState({ starterPromptsLoading: !0 });
2798
- const e = $i();
3017
+ const e = Zi();
2799
3018
  this.sendNow(
2800
3019
  L({
2801
3020
  type: "starter_prompts.page_context",
@@ -2806,13 +3025,13 @@ class Ne {
2806
3025
  ) || (this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !1, this.setState({ starterPromptsLoading: !1 }));
2807
3026
  }
2808
3027
  startStarterPromptUrlWatcher() {
2809
- this.locationChangeCleanup || (this.locationChangeCleanup = ji(() => this.handleStarterPromptUrlChange()));
3028
+ this.locationChangeCleanup || (this.locationChangeCleanup = er(() => this.handleStarterPromptUrlChange()));
2810
3029
  }
2811
3030
  handleStarterPromptUrlChange() {
2812
3031
  const e = location.href;
2813
3032
  e !== this.lastStarterPromptPageUrl && (this.activeComposerWarmupScope && !this.activeComposerWarmupScope.endsWith(`:${e}`) && this.clearPendingComposerWarmup(), this.lastStarterPromptPageUrl = e, this.clearStarterPromptUrlRefreshTimer(), this.starterPromptUrlRefreshTimer = window.setTimeout(() => {
2814
3033
  this.starterPromptUrlRefreshTimer = null, this.refreshStarterPromptsForCurrentUrl();
2815
- }, pi));
3034
+ }, Mi));
2816
3035
  }
2817
3036
  refreshStarterPromptsForCurrentUrl() {
2818
3037
  this.socket?.readyState !== WebSocket.OPEN || this.state.status === "closed" || (this.setState({ starterPromptsLoading: this.state.messages.length === 0 }), this.sendNow({
@@ -2827,22 +3046,22 @@ class Ne {
2827
3046
  if (this.socket?.readyState !== WebSocket.OPEN || this.queuedClientEvents.length === 0)
2828
3047
  return;
2829
3048
  const e = this.queuedClientEvents.splice(0, this.queuedClientEvents.length);
2830
- V(this.options.clientId, this.queuedClientEvents);
3049
+ Q(this.options.clientId, this.queuedClientEvents);
2831
3050
  for (let t = 0; t < e.length; t += 1) {
2832
3051
  const n = e[t];
2833
3052
  if (!this.sendNow(L(n))) {
2834
- 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);
2835
3054
  return;
2836
3055
  }
2837
- V(this.options.clientId, this.queuedClientEvents);
3056
+ Q(this.options.clientId, this.queuedClientEvents);
2838
3057
  }
2839
3058
  }
2840
3059
  resetForAuthenticationScopeChange() {
2841
- 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();
2842
3061
  }
2843
3062
  rememberSessionTimeline(e, t) {
2844
3063
  const n = [...t];
2845
- for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > hi; ) {
3064
+ for (this.sessionTimelineCache.delete(e), this.sessionTimelineCache.set(e, n); this.sessionTimelineCache.size > Ai; ) {
2846
3065
  const i = this.sessionTimelineCache.keys().next().value;
2847
3066
  if (!i)
2848
3067
  break;
@@ -2872,8 +3091,8 @@ class Ne {
2872
3091
  return;
2873
3092
  this.clearPendingWarmupAckTimer();
2874
3093
  const t = Math.min(
2875
- Vn * 2 ** e.retryAttempt,
2876
- Xn
3094
+ ri * 2 ** e.retryAttempt,
3095
+ oi
2877
3096
  );
2878
3097
  e.retryAttempt += 1, this.pendingWarmupAckTimer = window.setTimeout(() => {
2879
3098
  this.pendingWarmupAckTimer = null, this.flushPendingComposerWarmup();
@@ -2917,7 +3136,7 @@ class Ne {
2917
3136
  if (!e || !t)
2918
3137
  return;
2919
3138
  const n = this.findStoppedTurn(e, t);
2920
- !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({
2921
3140
  messages: this.state.messages.filter((i) => i.id !== n.stoppedItemId)
2922
3141
  }));
2923
3142
  }
@@ -2945,7 +3164,7 @@ class Ne {
2945
3164
  });
2946
3165
  }
2947
3166
  handleServerEvent(e) {
2948
- 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") {
2949
3168
  const t = typeof e.requestId == "string" ? e.requestId : null, n = typeof e.sessionId == "string" ? e.sessionId : null;
2950
3169
  if (t && n && t === this.pendingSessionSubscription?.requestId && n === this.pendingSessionSubscription.sessionId) {
2951
3170
  const i = this.pendingSessionSubscription;
@@ -2996,7 +3215,7 @@ class Ne {
2996
3215
  }
2997
3216
  }
2998
3217
  if (!this.shouldIgnoreStoppedTurnEvent(e) && (this.updateInactiveSessionTimelineCache(e), !this.shouldIgnoreBackgroundSessionEvent(e))) {
2999
- if (Ai(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
3218
+ if (Ui(e) && this.clearFirstResponseTimer(this.activeClientMessageId), e.type === "run.steered") {
3000
3219
  this.handleRunSteered(e);
3001
3220
  return;
3002
3221
  }
@@ -3011,17 +3230,17 @@ class Ne {
3011
3230
  this.activeResponseRunId = t, this.setState({ turnPhase: "thinking", lastError: null }), this.markThinkingProgress();
3012
3231
  return;
3013
3232
  }
3014
- if (wi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3233
+ if (vi(e) && this.markThinkingProgress(), e.type === "auth.ok") {
3015
3234
  this.clearSocketAuthTimer(), this.reconnectAttempts = 0, this.transportDiagnosticEpisodes.clear();
3016
- const t = rr(e.user);
3235
+ const t = fr(e.user);
3017
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();
3018
- const n = er(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3237
+ const n = ur(e), i = Object.prototype.hasOwnProperty.call(e, "appearance");
3019
3238
  b("web-sdk.agent", "Received auth.ok appearance", {
3020
3239
  hasAppearance: i,
3021
3240
  rawAppearance: e.appearance,
3022
3241
  normalizedAppearance: n
3023
- }), this.runtimeHelperJavascript = tr(e.runtimeHelpers)?.javascript ?? null;
3024
- 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 = {
3025
3244
  user: t,
3026
3245
  status: "connected",
3027
3246
  ...this.state.lastErrorCode === "connection_failed" ? { lastError: null, lastErrorCode: null } : {}
@@ -3040,21 +3259,21 @@ class Ne {
3040
3259
  }
3041
3260
  if (e.type === "starterPrompts.updated") {
3042
3261
  this.transientStarterPromptsRequestInFlight = !1, this.transientStarterPromptsRequestAttempted = !0, this.setState({
3043
- starterPrompts: Vt(e, "starterPrompts"),
3262
+ starterPrompts: Yt(e, "starterPrompts"),
3044
3263
  starterPromptsLoading: !1
3045
3264
  });
3046
3265
  return;
3047
3266
  }
3048
3267
  if (e.type === "scheduled_follow_ups.updated") {
3049
3268
  typeof e.sessionId == "string" && e.sessionId === this.state.sessionId && this.setState({
3050
- activeScheduledFollowUps: Xt(
3269
+ activeScheduledFollowUps: Zt(
3051
3270
  e.activeScheduledFollowUps
3052
3271
  )
3053
3272
  });
3054
3273
  return;
3055
3274
  }
3056
3275
  if (e.type === "conversation.state") {
3057
- 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(
3058
3277
  e,
3059
3278
  "activeScheduledFollowUps"
3060
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();
@@ -3071,7 +3290,7 @@ class Ne {
3071
3290
  runId: u?.runId
3072
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;
3073
3292
  f && h && (this.pendingClientMessageId = h);
3074
- let m = pr(
3293
+ let m = Mr(
3075
3294
  e.assistantDraft
3076
3295
  );
3077
3296
  m && this.findStoppedTurn(r, {
@@ -3080,31 +3299,31 @@ class Ne {
3080
3299
  }) && (m = void 0);
3081
3300
  const M = m !== void 0;
3082
3301
  this.rememberUserMessageClientMessageIds(g);
3083
- const w = Er(g), D = g.filter((U) => {
3302
+ const w = xr(g), D = g.filter((U) => {
3084
3303
  const q = C(U);
3085
- return br(q) ? !1 : !q || !w || !pe(q) ? !0 : dt(g, q) !== w;
3086
- }), S = lt(
3304
+ return qr(q) ? !1 : !q || !w || !pe(q) ? !0 : ht(g, q) !== w;
3305
+ }), S = ct(
3087
3306
  this.state.messages,
3088
3307
  st(D, this.options.backendUrl)
3089
- ), 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(
3090
- (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(
3091
3310
  C(U),
3092
3311
  N,
3093
3312
  v,
3094
3313
  re,
3095
3314
  Y,
3096
- kr(g, q)
3315
+ Lr(g, q)
3097
3316
  )
3098
- ), ee = M ? m?.content ?? "" : this.state.assistantDraft, fe = !!m?.content && !Z, B = T && (!ee || Z), Q = Ar(S), oe = B && Q ? "completed" : d ? "stopped" : B ? "failed" : null;
3099
- if (!T && Rr(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))
3100
3319
  return;
3101
- this.lastUserMessagePageUrl = Mr(g);
3102
- const j = B || d ? null : ut(g);
3103
- 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({
3104
3323
  sessionId: A(e.session, "id") ?? this.state.sessionId,
3105
3324
  messages: S,
3106
3325
  ...i ? {
3107
- activeScheduledFollowUps: Xt(
3326
+ activeScheduledFollowUps: Zt(
3108
3327
  e.activeScheduledFollowUps
3109
3328
  )
3110
3329
  } : {},
@@ -3171,14 +3390,14 @@ class Ne {
3171
3390
  this.options.backendUrl
3172
3391
  );
3173
3392
  t === this.sessionActivityRequestId && (this.sessionActivityRequestId = null), this.setState({
3174
- messages: yr(this.state.messages, i)
3393
+ messages: kr(this.state.messages, i)
3175
3394
  });
3176
3395
  return;
3177
3396
  }
3178
3397
  if (e.type === "sessions.page") {
3179
3398
  const t = typeof e.requestId == "string" ? e.requestId : null, n = t ? this.pendingSessionHistoryRequests.get(t) : null;
3180
3399
  t && n && (window.clearTimeout(n.timeout), this.pendingSessionHistoryRequests.delete(t), n.resolve({
3181
- sessions: or(e.sessions),
3400
+ sessions: mr(e.sessions),
3182
3401
  nextCursor: typeof e.nextCursor == "string" ? e.nextCursor : null
3183
3402
  }));
3184
3403
  return;
@@ -3213,15 +3432,15 @@ class Ne {
3213
3432
  }
3214
3433
  const n = Ue(e.item, this.options.backendUrl);
3215
3434
  if (n) {
3216
- const i = qr(t, n), r = n.callId ? this.pendingToolLoadingByCallId.get(n.callId) : void 0;
3217
- n.callId && r !== void 0 && (n.loading = r, this.pendingToolLoadingByCallId.delete(n.callId)), W(n) && (this.retryableClientMessageId = null, this.clearRetryTimers(), this.clearRunAckResyncRetryTimer()), _r(t) && this.clearRunAckResyncRetryTimer();
3218
- 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(
3219
3438
  t,
3220
3439
  this.state.assistantDraft,
3221
3440
  this.state.assistantDraftItemId,
3222
3441
  this.state.assistantDraftRespondsToUserMessageId,
3223
3442
  this.state.assistantDraftRunId,
3224
- vs(
3443
+ qs(
3225
3444
  o,
3226
3445
  o.findIndex((d) => d.id === n.id)
3227
3446
  )
@@ -3283,7 +3502,7 @@ class Ne {
3283
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;
3284
3503
  if (!(n && this.state.assistantDraftRespondsToUserMessageId ? n === this.state.assistantDraftRespondsToUserMessageId : !i || !this.state.assistantDraftRunId || i === this.state.assistantDraftRunId))
3285
3504
  return;
3286
- 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(
3287
3506
  this.state.messages.filter(
3288
3507
  (c) => c.dataType !== "assistant_draft" || !Me(
3289
3508
  c,
@@ -3293,11 +3512,11 @@ class Ne {
3293
3512
  ),
3294
3513
  n,
3295
3514
  i,
3296
- ct
3515
+ ut
3297
3516
  );
3298
3517
  this.setState({
3299
3518
  sessionId: t,
3300
- messages: Yt(
3519
+ messages: ts(
3301
3520
  l,
3302
3521
  typeof e.responseId == "string" ? e.responseId : null,
3303
3522
  n,
@@ -3320,9 +3539,9 @@ class Ne {
3320
3539
  if (t)
3321
3540
  this.nonTranscriptToolCallIds.add(t);
3322
3541
  else {
3323
- const n = ts(e);
3542
+ const n = is(e);
3324
3543
  if (n) {
3325
- const i = Zt(
3544
+ const i = ss(
3326
3545
  this.state.messages,
3327
3546
  n
3328
3547
  );
@@ -3390,13 +3609,13 @@ class Ne {
3390
3609
  return;
3391
3610
  }
3392
3611
  o && i && r && (this.retryableClientMessageId = r);
3393
- const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Fi(a.message);
3612
+ const a = new Error(typeof e.message == "string" ? e.message : "Pluno error"), l = Xi(a.message);
3394
3613
  l && console.error(l);
3395
- 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(
3396
3615
  this.state.messages,
3397
3616
  c,
3398
3617
  u
3399
- ), g = wr(
3618
+ ), g = vr(
3400
3619
  d,
3401
3620
  c,
3402
3621
  u
@@ -3427,7 +3646,7 @@ class Ne {
3427
3646
  }
3428
3647
  applyAccountSubmissionError(e) {
3429
3648
  if (!this.account || !e) return;
3430
- const t = bn(this.account.submissionGate, e);
3649
+ const t = Un(this.account.submissionGate, e);
3431
3650
  if (!(t === this.account.submissionGate || t.allowed)) {
3432
3651
  this.account = {
3433
3652
  ...this.account,
@@ -3440,10 +3659,10 @@ class Ne {
3440
3659
  if (this.options.productVariant !== "personal" || !e || typeof e != "object" || this.personalModelSelectionOverride !== null)
3441
3660
  return;
3442
3661
  const t = e.metadata, n = t && typeof t == "object" ? t.model : void 0;
3443
- this.options.model = Ve(n) ? n : "gpt-5.6-sol";
3662
+ this.options.model = Qe(n) ? n : "gpt-5.6-sol";
3444
3663
  }
3445
3664
  updateAccountFallbackFromSession(e) {
3446
- 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);
3447
3666
  if (this.usingPaidCreditFallback !== n && (this.usingPaidCreditFallback = n, !!this.account)) {
3448
3667
  this.account = { ...this.account, usingPaidCreditFallback: n };
3449
3668
  for (const i of this.accountListeners) i(this.getAccount());
@@ -3463,7 +3682,7 @@ class Ne {
3463
3682
  return;
3464
3683
  const n = this.sessionTimelineCache.get(t);
3465
3684
  if (e.type === "conversation.state") {
3466
- const i = qt(
3685
+ const i = Lt(
3467
3686
  Array.isArray(e.items) ? e.items : []
3468
3687
  ), r = st(
3469
3688
  this.filterStoppedSnapshotItems(i, t),
@@ -3471,7 +3690,7 @@ class Ne {
3471
3690
  );
3472
3691
  (n || r.length > 0) && this.rememberSessionTimeline(
3473
3692
  t,
3474
- n ? lt(n, r) : r
3693
+ n ? ct(n, r) : r
3475
3694
  );
3476
3695
  return;
3477
3696
  }
@@ -3485,10 +3704,10 @@ class Ne {
3485
3704
  return;
3486
3705
  }
3487
3706
  if (e.type === "tool.call") {
3488
- const i = e.hiddenFromTranscript === !0 ? null : ts(e);
3707
+ const i = e.hiddenFromTranscript === !0 ? null : is(e);
3489
3708
  i && this.rememberSessionTimeline(
3490
3709
  t,
3491
- Zt(n, i)
3710
+ ss(n, i)
3492
3711
  );
3493
3712
  return;
3494
3713
  }
@@ -3500,7 +3719,7 @@ class Ne {
3500
3719
  return;
3501
3720
  this.rememberSessionTimeline(
3502
3721
  t,
3503
- es(
3722
+ ns(
3504
3723
  n,
3505
3724
  e.callId,
3506
3725
  i
@@ -3527,17 +3746,17 @@ class Ne {
3527
3746
  return;
3528
3747
  }
3529
3748
  if (e.type === "chat.assistant_done") {
3530
- 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(
3531
3750
  n.filter(
3532
3751
  (a) => a.dataType !== "assistant_draft" || !Me(a, i, r)
3533
3752
  ),
3534
3753
  i,
3535
3754
  r,
3536
- ct
3755
+ ut
3537
3756
  );
3538
3757
  this.rememberSessionTimeline(
3539
3758
  t,
3540
- Yt(
3759
+ ts(
3541
3760
  o,
3542
3761
  typeof e.responseId == "string" ? e.responseId : null,
3543
3762
  i,
@@ -3552,7 +3771,7 @@ class Ne {
3552
3771
  return;
3553
3772
  this.rememberSessionTimeline(
3554
3773
  t,
3555
- os(
3774
+ cs(
3556
3775
  n,
3557
3776
  i,
3558
3777
  null,
@@ -3561,9 +3780,9 @@ class Ne {
3561
3780
  );
3562
3781
  return;
3563
3782
  }
3564
- 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(
3565
3784
  t,
3566
- Ur(n, e)
3785
+ Wr(n, e)
3567
3786
  );
3568
3787
  }
3569
3788
  }
@@ -3597,7 +3816,7 @@ class Ne {
3597
3816
  }
3598
3817
  handleRetryableRecoveryError(e) {
3599
3818
  const t = typeof e.sessionId == "string" ? e.sessionId : this.state.sessionId, n = typeof e.clientMessageId == "string" ? e.clientMessageId : null;
3600
- if (!is(e, t) || !n)
3819
+ if (!as(e, t) || !n)
3601
3820
  return !1;
3602
3821
  if (et())
3603
3822
  return this.retryableClientMessageId = n, this.activeClientMessageId = n, this.latestRecoverableClientMessageId = n, this.setState({ status: "connected", isThinking: !0, isRetrying: !0, lastError: null, lastErrorCode: null }), !0;
@@ -3638,7 +3857,7 @@ class Ne {
3638
3857
  const i = new Promise((r, o) => {
3639
3858
  const a = window.setTimeout(() => {
3640
3859
  e.delete(t.requestId), o(new Error(n));
3641
- }, jt);
3860
+ }, Gt);
3642
3861
  e.set(t.requestId, { resolve: r, reject: o, timeout: a });
3643
3862
  });
3644
3863
  if (!this.sendNow(t)) {
@@ -3661,7 +3880,7 @@ class Ne {
3661
3880
  e.clear();
3662
3881
  }
3663
3882
  markThinkingProgress() {
3664
- !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(Yn), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3883
+ !this.state.isThinking || this.state.status === "closed" || (this.scheduleThinkingWatchdog(li), this.activeClientMessageId && this.scheduleRunAckWatchdog(this.activeClientMessageId));
3665
3884
  }
3666
3885
  scheduleThinkingWatchdog(e) {
3667
3886
  this.thinkingWatchdogTimer !== null && window.clearTimeout(this.thinkingWatchdogTimer), this.thinkingWatchdogTimer = window.setTimeout(() => {
@@ -3719,19 +3938,19 @@ class Ne {
3719
3938
  schedulePendingDeliveryAck(e) {
3720
3939
  this.clearPendingDeliveryTimers(), !et() && (this.pendingDeliveryAckTimer = window.setTimeout(() => {
3721
3940
  this.pendingDeliveryAckTimer = null, this.retryPendingDelivery(e);
3722
- }, $t));
3941
+ }, Kt));
3723
3942
  }
3724
3943
  retryPendingDelivery(e) {
3725
3944
  if (this.state.status === "closed" || this.pendingClientMessageId !== e || !this.pendingUserMessageEvent)
3726
3945
  return;
3727
3946
  const t = this.retryAttemptsByClientMessageId[e] ?? 0;
3728
- if (t >= ei) {
3947
+ if (t >= ui) {
3729
3948
  this.failPendingDelivery(e);
3730
3949
  return;
3731
3950
  }
3732
3951
  t === 0 && this.reportHealthSignal("run_ack_missed", { clientMessageId: e }), this.retryAttemptsByClientMessageId[e] = t + 1, this.setState({ pendingMessageStatus: "reconnecting" }), this.pendingDeliveryRetryTimer = window.setTimeout(() => {
3733
3952
  this.pendingDeliveryRetryTimer = null, !(this.pendingClientMessageId !== e || !this.pendingUserMessageEvent) && (this.send(this.pendingUserMessageEvent), this.setState({ pendingMessageStatus: "sending" }), this.schedulePendingDeliveryAck(e));
3734
- }, gi(t, ii));
3953
+ }, bi(t, gi));
3735
3954
  }
3736
3955
  failPendingDelivery(e) {
3737
3956
  if (this.pendingClientMessageId !== e)
@@ -3744,7 +3963,7 @@ class Ne {
3744
3963
  ...this.state.isThinking ? {} : { turnPhase: null },
3745
3964
  isRetrying: !1,
3746
3965
  ...this.state.isThinking ? {} : { taskStatus: "failed" },
3747
- lastError: si,
3966
+ lastError: hi,
3748
3967
  lastErrorCode: "message_delivery_failed"
3749
3968
  });
3750
3969
  }
@@ -3756,7 +3975,7 @@ class Ne {
3756
3975
  if (this.state.isThinking && t) {
3757
3976
  const r = this.state.assistantDraftRespondsToUserMessageId !== null && this.state.assistantDraftRespondsToUserMessageId !== t;
3758
3977
  this.setState({
3759
- messages: os(
3978
+ messages: cs(
3760
3979
  this.state.messages,
3761
3980
  t,
3762
3981
  n,
@@ -3782,13 +4001,13 @@ class Ne {
3782
4001
  scheduleRunAckWatchdog(e) {
3783
4002
  this.runAckWatchdogTimer !== null && window.clearTimeout(this.runAckWatchdogTimer), this.runAckWatchdogTimer = window.setTimeout(() => {
3784
4003
  this.runAckWatchdogTimer = null, this.recoverMissedRunAck(e);
3785
- }, $t);
4004
+ }, Kt);
3786
4005
  }
3787
4006
  recoverMissedRunAck(e) {
3788
4007
  !this.state.isThinking || this.state.status === "closed" || this.activeClientMessageId !== e || (b("web-sdk.agent", "Pluno run ack missed; resyncing session", {
3789
4008
  sessionId: this.state.sessionId,
3790
4009
  clientMessageId: e
3791
- }), 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));
3792
4011
  }
3793
4012
  clearRunAckResyncRetryTimer() {
3794
4013
  this.runAckResyncRetryTimer !== null && (window.clearTimeout(this.runAckResyncRetryTimer), this.runAckResyncRetryTimer = null);
@@ -3811,7 +4030,7 @@ class Ne {
3811
4030
  ),
3812
4031
  isThinking: !1,
3813
4032
  taskStatus: "failed",
3814
- lastError: ti,
4033
+ lastError: di,
3815
4034
  lastErrorCode: "run_recovery_exhausted"
3816
4035
  }), this.clearThinkingWatchdog();
3817
4036
  return;
@@ -3821,7 +4040,7 @@ class Ne {
3821
4040
  sessionId: this.state.sessionId,
3822
4041
  clientMessageId: e,
3823
4042
  resyncAttempts: t + 1
3824
- }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(Wt);
4043
+ }), this.resyncThinkingSession(), this.scheduleThinkingWatchdog(zt);
3825
4044
  }
3826
4045
  resyncThinkingSession() {
3827
4046
  this.state.sessionId ? this.send({
@@ -3838,7 +4057,7 @@ class Ne {
3838
4057
  if (!t || !n || !i)
3839
4058
  return;
3840
4059
  const a = i === "execute_code", l = i === "execute_code_in_browser_tab" && o !== null && typeof o == "object" && o.tabId === "local:current";
3841
- if (!a && !l || !so(o)) {
4060
+ if (!a && !l || !po(o)) {
3842
4061
  this.setToolMessageLoading(n, !1), this.send({
3843
4062
  type: "tool.result",
3844
4063
  sessionId: t,
@@ -3885,9 +4104,9 @@ class Ne {
3885
4104
  startedAtOrigin: location.origin
3886
4105
  }), this.installSessionBrowserApis();
3887
4106
  let c = null, u;
3888
- c = await this.executeRuntimeHelper(), u = await Gt(
4107
+ c = await this.executeRuntimeHelper(), u = await Jt(
3889
4108
  o,
3890
- xi(e.runtimeContext, this.options.backendUrl)
4109
+ Ki(e.runtimeContext, this.options.backendUrl)
3891
4110
  ).catch((d) => ({
3892
4111
  ok: !1,
3893
4112
  exception: {
@@ -3900,11 +4119,11 @@ class Ne {
3900
4119
  toolName: i,
3901
4120
  summary: o.summary,
3902
4121
  rawInput: L(o),
3903
- rawOutput: L(sr(u, c))
3904
- }), ls(this.options.clientId, this.activeBrowserToolCalls.values()));
4122
+ rawOutput: L(hr(u, c))
4123
+ }), ds(this.options.clientId, this.activeBrowserToolCalls.values()));
3905
4124
  }
3906
4125
  setToolMessageLoading(e, t) {
3907
- const n = es(
4126
+ const n = ns(
3908
4127
  this.state.messages,
3909
4128
  e,
3910
4129
  t
@@ -3915,33 +4134,33 @@ class Ne {
3915
4134
  if (this.pageLifecycleCleanup)
3916
4135
  return;
3917
4136
  const e = () => {
3918
- Ds(this.options.clientId, this.activeBrowserToolCalls.values());
4137
+ xs(this.options.clientId, this.activeBrowserToolCalls.values());
3919
4138
  };
3920
4139
  window.addEventListener("pagehide", e), window.addEventListener("beforeunload", e), this.pageLifecycleCleanup = () => {
3921
4140
  window.removeEventListener("pagehide", e), window.removeEventListener("beforeunload", e);
3922
4141
  };
3923
4142
  }
3924
4143
  installSessionBrowserApis() {
3925
- this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = Ei();
4144
+ this.cleanupSessionBrowserApis(), this.sessionBrowserApisCleanup = xi();
3926
4145
  }
3927
4146
  cleanupSessionBrowserApis() {
3928
- this.sessionBrowserApisCleanup && (qi(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
4147
+ this.sessionBrowserApisCleanup && (ji(this.sessionBrowserApisCleanup), this.sessionBrowserApisCleanup = null);
3929
4148
  }
3930
4149
  async executeRuntimeHelper() {
3931
4150
  if (!this.runtimeHelperJavascript?.trim())
3932
4151
  return null;
3933
- const e = await Gt({
4152
+ const e = await Jt({
3934
4153
  javascript: this.runtimeHelperJavascript
3935
4154
  });
3936
- return e.ok === !1 ? nr(e) : null;
4155
+ return e.ok === !1 ? pr(e) : null;
3937
4156
  }
3938
4157
  enableNetworkCapture() {
3939
- this.networkCaptureCleanup || (this.networkCaptureCleanup = Si((e) => {
3940
- lo(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);
3941
4160
  }));
3942
4161
  }
3943
4162
  enqueueNetworkEvent(e) {
3944
- this.queuedNetworkEvents.length >= oi || (this.queuedNetworkEvents.push(ao(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(() => {
3945
4164
  this.networkBatchTimer = null;
3946
4165
  const t = this.queuedNetworkEvents.splice(0, this.queuedNetworkEvents.length);
3947
4166
  t.length === 0 || this.socket?.readyState !== WebSocket.OPEN || this.sendNow({
@@ -3950,14 +4169,14 @@ class Ne {
3950
4169
  page: _(),
3951
4170
  events: t
3952
4171
  });
3953
- }, ri)));
4172
+ }, fi)));
3954
4173
  }
3955
4174
  scheduleReconnect(e = 0) {
3956
4175
  if (this.reconnectTimer !== null || this.state.status === "closed")
3957
4176
  return;
3958
4177
  const t = Math.min(
3959
- ot,
3960
- Math.max(fi(this.reconnectAttempts), e)
4178
+ at,
4179
+ Math.max(Ri(this.reconnectAttempts), e)
3961
4180
  );
3962
4181
  this.reconnectAttempts += 1, this.reconnectTimer = window.setTimeout(() => {
3963
4182
  this.reconnectTimer = null, this.connect().catch((n) => {
@@ -3974,8 +4193,8 @@ class Ne {
3974
4193
  const e = this.socket;
3975
4194
  !e || !this.sendNow({ type: "runtime.ping" }) || (this.clearHeartbeatAckTimer(), this.heartbeatAckTimer = window.setTimeout(() => {
3976
4195
  this.socket === e && (b("web-sdk.agent", "Pluno heartbeat acknowledgement timed out; reconnecting"), this.replaceTimedOutSocket(e));
3977
- }, jn));
3978
- }, $n);
4196
+ }, ei));
4197
+ }, Zn);
3979
4198
  }
3980
4199
  stopHeartbeat() {
3981
4200
  this.heartbeatTimer !== null && (window.clearInterval(this.heartbeatTimer), this.heartbeatTimer = null), this.clearHeartbeatAckTimer();
@@ -4013,12 +4232,12 @@ class Ne {
4013
4232
  ...e.lastError === null && e.lastErrorCode === void 0 ? { lastErrorCode: null } : {},
4014
4233
  ...e.lastError !== void 0 && e.lastErrorSecuritySettingsUrl === void 0 ? { lastErrorSecuritySettingsUrl: null } : {}
4015
4234
  }, a = this.state.sessionId, l = this.state.isThinking || this.state.pendingMessageStatus !== null, c = o.isThinking || o.pendingMessageStatus !== null, u = this.activeClientMessageId ?? this.pendingClientMessageId;
4016
- u && u === this.lastProjectedTurnClientMessageId && c && Mi(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", {
4017
4236
  clientMessageId: u,
4018
4237
  reason: "active_turn_phase_moved_backward",
4019
4238
  previousPhase: this.lastProjectedTurnPhase,
4020
4239
  nextPhase: o.turnPhase
4021
- }), 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), jr(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, {
4022
4241
  status: this.state.status,
4023
4242
  sessionId: this.state.sessionId,
4024
4243
  messageCount: this.state.messages.length,
@@ -4046,7 +4265,7 @@ class Ne {
4046
4265
  this.transportIdentity.transportId
4047
4266
  ].join(":"), n = `${e}:${t}`;
4048
4267
  if (this.sessionRecoveryScope !== n) {
4049
- 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:"));
4050
4269
  this.sessionActivityRecovery.reset(i?.id ?? null), this.sessionRecoveryScope = n;
4051
4270
  }
4052
4271
  this.sessionRecoveryPoller.start(e, t), this.sessionActivityRecoveryPoller.start(e, t);
@@ -4077,13 +4296,13 @@ class Ne {
4077
4296
  }
4078
4297
  }
4079
4298
  const Ze = /* @__PURE__ */ new WeakMap();
4080
- function Si(s) {
4081
- const e = window.__plunoProductAgentNetworkCapture ?? Ti();
4299
+ function _i(s) {
4300
+ const e = window.__plunoProductAgentNetworkCapture ?? Pi();
4082
4301
  return e.subscribers.add(s), () => {
4083
4302
  e.subscribers.delete(s), !(e.subscribers.size > 0) && (e.destroy(), window.__plunoProductAgentNetworkCapture === e && delete window.__plunoProductAgentNetworkCapture);
4084
4303
  };
4085
4304
  }
4086
- function Ti() {
4305
+ function Pi() {
4087
4306
  const s = /* @__PURE__ */ new Set(), e = (g) => {
4088
4307
  s.forEach((f) => {
4089
4308
  try {
@@ -4100,20 +4319,20 @@ function Ti() {
4100
4319
  throw m;
4101
4320
  }
4102
4321
  try {
4103
- const m = f instanceof Request ? f : null, M = no(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);
4104
4323
  if (!te(M, w, h?.body)) {
4105
4324
  const H = {
4106
4325
  requestId: nt("fetch"),
4107
4326
  url: F(M, Ye),
4108
4327
  method: (h?.method ?? m?.method ?? "GET").toUpperCase(),
4109
4328
  requestHeaders: w,
4110
- requestBody: us(h?.body),
4329
+ requestBody: ps(h?.body),
4111
4330
  resourceType: "fetch",
4112
4331
  startedAt: new Date(p).toISOString()
4113
4332
  };
4114
4333
  y.then(
4115
4334
  (S) => {
4116
- io(S, H, p, e).catch(() => {
4335
+ fo(S, H, p, e).catch(() => {
4117
4336
  e({
4118
4337
  ...H,
4119
4338
  responseStatus: S.status,
@@ -4146,16 +4365,16 @@ function Ti() {
4146
4365
  }), M;
4147
4366
  }, l = function(f, h) {
4148
4367
  const p = i.call(this, f, h), y = Ze.get(this);
4149
- 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;
4150
4369
  }, c = function(f) {
4151
4370
  try {
4152
4371
  const h = Ze.get(this);
4153
- 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(
4154
4373
  "loadend",
4155
4374
  () => {
4156
4375
  queueMicrotask(() => {
4157
4376
  try {
4158
- const p = uo(this.getAllResponseHeaders());
4377
+ const p = wo(this.getAllResponseHeaders());
4159
4378
  e({
4160
4379
  requestId: h.requestId,
4161
4380
  url: h.url,
@@ -4165,7 +4384,7 @@ function Ti() {
4165
4384
  resourceType: "xhr",
4166
4385
  responseStatus: this.status,
4167
4386
  responseHeaders: p,
4168
- responseBody: oo(this, p),
4387
+ responseBody: yo(this, p),
4169
4388
  errorText: this.status === 0 ? "XHR request failed or was aborted" : void 0,
4170
4389
  startedAt: h.startedAt,
4171
4390
  durationMs: Date.now() - h.startedAtMs
@@ -4257,14 +4476,14 @@ function b(s, e, t) {
4257
4476
  }, r = n.__plunoProductAgentDiagnostics__ ?? [];
4258
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 }));
4259
4478
  }
4260
- function Kt(s) {
4479
+ function Qt(s) {
4261
4480
  const e = typeof s == "function" ? s() : s;
4262
4481
  return e && Object.keys(e).length > 0 ? e : void 0;
4263
4482
  }
4264
- function wi(s) {
4483
+ function vi(s) {
4265
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";
4266
4485
  }
4267
- function Ai(s) {
4486
+ function Ui(s) {
4268
4487
  if (s.type === "chat.assistant_delta")
4269
4488
  return typeof s.delta == "string" && s.delta.trim().length > 0;
4270
4489
  if (s.type === "tool.call")
@@ -4274,7 +4493,7 @@ function Ai(s) {
4274
4493
  const e = C(s.item);
4275
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;
4276
4495
  }
4277
- function Mi(s, e) {
4496
+ function Di(s, e) {
4278
4497
  if (!s || !e)
4279
4498
  return !1;
4280
4499
  const t = {
@@ -4302,31 +4521,31 @@ function K(s) {
4302
4521
  }
4303
4522
  return null;
4304
4523
  }
4305
- const bi = 5e3, Ri = 12e4;
4306
- function Ei() {
4524
+ const qi = 5e3, Oi = 12e4;
4525
+ function xi() {
4307
4526
  const s = [
4308
- Ci(),
4309
- ki()
4527
+ Ni(),
4528
+ Li()
4310
4529
  ].filter((e) => typeof e == "function");
4311
4530
  return () => {
4312
4531
  for (const e of s.reverse())
4313
4532
  e();
4314
4533
  };
4315
4534
  }
4316
- function ki() {
4317
- return ps(globalThis, "getPageSnapshot", async () => At());
4535
+ function Li() {
4536
+ return ms(globalThis, "getPageSnapshot", async () => Mt());
4318
4537
  }
4319
- function Ci() {
4320
- return ps(globalThis, "pageImages", {
4321
- inspectImage: async (e, t) => await _i(e, t)
4538
+ function Ni() {
4539
+ return ms(globalThis, "pageImages", {
4540
+ inspectImage: async (e, t) => await Hi(e, t)
4322
4541
  });
4323
4542
  }
4324
- async function _i(s, e = {}) {
4325
- const t = Di(e.name), n = await Pi(s);
4543
+ async function Hi(s, e = {}) {
4544
+ const t = $i(e.name), n = await Bi(s);
4326
4545
  return n.ok ? n.sizeBytes > 8 * 1024 * 1024 ? {
4327
4546
  type: "pluno.pageImages.inspectImage",
4328
4547
  imageAttached: !1,
4329
- imageAttachmentError: As
4548
+ imageAttachmentError: Rs
4330
4549
  } : {
4331
4550
  type: "pluno.pageImages.inspectImage",
4332
4551
  imageAttached: !0,
@@ -4340,15 +4559,15 @@ async function _i(s, e = {}) {
4340
4559
  imageAttachmentError: n.error
4341
4560
  };
4342
4561
  }
4343
- async function Pi(s) {
4344
- 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 } : {
4345
4564
  ok: !0,
4346
4565
  mimeType: s.type,
4347
4566
  sizeBytes: s.size,
4348
- dataUrl: await Oi(s)
4349
- } : { 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." } : vi(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);
4350
4569
  }
4351
- function vi(s) {
4570
+ function Fi(s) {
4352
4571
  if (!s.startsWith("data:") || !s.includes(","))
4353
4572
  return { ok: !1, error: "Page image must be a complete data:image/* URL, not bare base64." };
4354
4573
  const [e, t] = s.slice(5).split(",", 2), n = e.split(";").map((a) => a.trim()).filter(Boolean), i = n[0] ?? "";
@@ -4359,7 +4578,7 @@ function vi(s) {
4359
4578
  const r = t.replace(/[ \t\r\n\f]+/g, "");
4360
4579
  if (!/^[A-Za-z0-9+/]*={0,2}$/.test(r))
4361
4580
  return { ok: !1, error: "Page image data URL has invalid base64." };
4362
- const o = Ui(r);
4581
+ const o = Wi(r);
4363
4582
  return o === null ? { ok: !1, error: "Page image data URL has invalid base64." } : o === 0 ? { ok: !1, error: "Page image is empty." } : {
4364
4583
  ok: !0,
4365
4584
  mimeType: i,
@@ -4367,22 +4586,22 @@ function vi(s) {
4367
4586
  dataUrl: `data:${i};base64,${r}`
4368
4587
  };
4369
4588
  }
4370
- function Ui(s) {
4589
+ function Wi(s) {
4371
4590
  if (s.length === 0 || s.length % 4 !== 0)
4372
4591
  return null;
4373
4592
  const e = s.length - s.replace(/=+$/, "").length;
4374
4593
  return e > 2 ? null : s.length / 4 * 3 - e;
4375
4594
  }
4376
- function Di(s) {
4595
+ function $i(s) {
4377
4596
  return (typeof s == "string" ? s.trim() : "") || "Page image";
4378
4597
  }
4379
- function qi(s) {
4598
+ function ji(s) {
4380
4599
  try {
4381
4600
  s();
4382
4601
  } catch {
4383
4602
  }
4384
4603
  }
4385
- function Oi(s) {
4604
+ function zi(s) {
4386
4605
  return new Promise((e, t) => {
4387
4606
  const n = new FileReader();
4388
4607
  n.onload = () => {
@@ -4394,9 +4613,9 @@ function Oi(s) {
4394
4613
  }, n.onerror = () => t(n.error ?? new Error("Failed to read page image")), n.readAsDataURL(s);
4395
4614
  });
4396
4615
  }
4397
- async function Gt(s, e) {
4616
+ async function Jt(s, e) {
4398
4617
  const t = Object.getPrototypeOf(async function() {
4399
- }).constructor, n = s.timeoutMs ?? bi, i = Date.now(), r = [];
4618
+ }).constructor, n = s.timeoutMs ?? qi, i = Date.now(), r = [];
4400
4619
  let o;
4401
4620
  const a = {
4402
4621
  log: console.log,
@@ -4414,7 +4633,7 @@ async function Gt(s, e) {
4414
4633
  o = window.setTimeout(() => d(c), n);
4415
4634
  })
4416
4635
  ]);
4417
- return u === c ? Li(n) : {
4636
+ return u === c ? Gi(n) : {
4418
4637
  ok: !0,
4419
4638
  result: u,
4420
4639
  console: r,
@@ -4443,7 +4662,7 @@ async function Gt(s, e) {
4443
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;
4444
4663
  }
4445
4664
  }
4446
- function xi(s, e) {
4665
+ function Ki(s, e) {
4447
4666
  if (!s || typeof s != "object")
4448
4667
  return;
4449
4668
  const t = s.sandboxFilesToken;
@@ -4453,7 +4672,7 @@ function xi(s, e) {
4453
4672
  const i = () => {
4454
4673
  if (!n)
4455
4674
  throw new Error("sandboxFiles is only available during browser-code execution");
4456
- }, r = async (a, l) => await qn(`${e.replace(/\/$/, "")}${a}`, l);
4675
+ }, r = async (a, l) => await jn(`${e.replace(/\/$/, "")}${a}`, l);
4457
4676
  return {
4458
4677
  value: Object.freeze({
4459
4678
  upload: async (a) => {
@@ -4487,7 +4706,7 @@ function xi(s, e) {
4487
4706
  }
4488
4707
  };
4489
4708
  }
4490
- function Li(s) {
4709
+ function Gi(s) {
4491
4710
  return {
4492
4711
  ok: !1,
4493
4712
  exception: {
@@ -4501,10 +4720,10 @@ function Li(s) {
4501
4720
  }
4502
4721
  };
4503
4722
  }
4504
- function Ni(s) {
4723
+ function Vi(s) {
4505
4724
  return s.replace(/\/+$/, "");
4506
4725
  }
4507
- function Hi(s) {
4726
+ function Qi(s) {
4508
4727
  const e = {
4509
4728
  sidepanel: "extension_sidepanel",
4510
4729
  browser_extension_page_ui: "extension_widget",
@@ -4516,18 +4735,18 @@ function Hi(s) {
4516
4735
  };
4517
4736
  return s && s in e ? e[s] : s ?? "embedded_custom_ui";
4518
4737
  }
4519
- function Bi(s) {
4738
+ function Ji(s) {
4520
4739
  return s === "pluno" ? "scheduled_continuation" : s ?? "user";
4521
4740
  }
4522
- function Fi(s, e = location.origin) {
4741
+ function Xi(s, e = location.origin) {
4523
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;
4524
4743
  }
4525
- function Wi(s) {
4744
+ function Yi(s) {
4526
4745
  const e = new URL("/api/product-agent/embed/ws", s);
4527
4746
  return e.protocol = e.protocol === "https:" ? "wss:" : "ws:", e.toString();
4528
4747
  }
4529
4748
  function _() {
4530
- const s = ks();
4749
+ const s = Ps();
4531
4750
  return {
4532
4751
  url: location.href,
4533
4752
  title: document.title,
@@ -4535,19 +4754,19 @@ function _() {
4535
4754
  ...s ? { plunoProductAgentUi: s } : {}
4536
4755
  };
4537
4756
  }
4538
- function $i() {
4757
+ function Zi() {
4539
4758
  return {
4540
4759
  pageUrl: location.href,
4541
4760
  pageTitle: document.title,
4542
- htmlContent: At()
4761
+ htmlContent: Mt()
4543
4762
  };
4544
4763
  }
4545
- function ji(s) {
4546
- return Ce.add(s), we || (we = zi()), () => {
4764
+ function er(s) {
4765
+ return Ce.add(s), we || (we = tr()), () => {
4547
4766
  Ce.delete(s), Ce.size === 0 && (we?.(), we = null);
4548
4767
  };
4549
4768
  }
4550
- function zi() {
4769
+ function tr() {
4551
4770
  const s = () => {
4552
4771
  for (const r of Array.from(Ce))
4553
4772
  r();
@@ -4563,9 +4782,9 @@ function zi() {
4563
4782
  };
4564
4783
  }
4565
4784
  function et() {
4566
- return ks()?.surface === "browser_extension_sdk_preview";
4785
+ return Ps()?.surface === "browser_extension_sdk_preview";
4567
4786
  }
4568
- function At() {
4787
+ function Mt() {
4569
4788
  if (!document.body)
4570
4789
  return "";
4571
4790
  const s = [], e = [], t = (p, y) => {
@@ -4574,16 +4793,16 @@ function At() {
4574
4793
  };
4575
4794
  t("Selected text", window.getSelection()?.toString() ?? "");
4576
4795
  const n = "[role='dialog'], [role='alertdialog'], dialog[open], [aria-modal='true']", i = Array.from(document.querySelectorAll(n)).filter(
4577
- (p) => bs(p) && !p.parentElement?.closest(n)
4796
+ (p) => ks(p) && !p.parentElement?.closest(n)
4578
4797
  );
4579
4798
  for (const p of i.slice(0, 3))
4580
4799
  t("Active overlay", tt(he(p), e));
4581
- const r = Ki(), o = r ? tt(he(r), e) : "";
4800
+ const r = sr(), o = r ? tt(he(r), e) : "";
4582
4801
  t("Main page content", o), t("Additional visible page text", tt(he(document.body), e));
4583
4802
  const a = s.map(([p, y]) => `${p}:
4584
4803
  ${y}`).join(`
4585
4804
 
4586
- `).trim().slice(0, 12e3), l = Gi(i, r).trim(), c = `Simplified DOM outline:
4805
+ `).trim().slice(0, 12e3), l = nr(i, r).trim(), c = `Simplified DOM outline:
4587
4806
  `, u = `
4588
4807
 
4589
4808
  Visible page text:
@@ -4607,14 +4826,14 @@ function tt(s, e) {
4607
4826
  t = t.replace(n, "");
4608
4827
  return ne(t);
4609
4828
  }
4610
- function bs(s) {
4829
+ function ks(s) {
4611
4830
  const e = window.getComputedStyle(s);
4612
4831
  return e.display !== "none" && e.visibility !== "hidden" && s.getClientRects().length > 0;
4613
4832
  }
4614
- function Ki() {
4615
- 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;
4616
4835
  }
4617
- function Gi(s, e) {
4836
+ function nr(s, e) {
4618
4837
  const t = /* @__PURE__ */ new Set([
4619
4838
  "main",
4620
4839
  "nav",
@@ -4694,7 +4913,7 @@ function Gi(s, e) {
4694
4913
  "data-test",
4695
4914
  "data-qa",
4696
4915
  "data-cy"
4697
- ], c = ["aria-label", "placeholder", "data-testid", "data-test", "data-qa", "data-cy"], { priorityElements: u, priorityTargets: d } = Qi(), 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);
4698
4917
  e && g.add(e);
4699
4918
  let f = 0;
4700
4919
  const h = (w) => {
@@ -4709,36 +4928,36 @@ function Gi(s, e) {
4709
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")
4710
4929
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
4711
4930
  f += 1;
4712
- 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();
4713
4932
  for (const I of B) {
4714
4933
  const R = p(I);
4715
- Q.set(R, (Q.get(R) ?? 0) + 1);
4934
+ V.set(R, (V.get(R) ?? 0) + 1);
4716
4935
  }
4717
4936
  const me = /* @__PURE__ */ new Map(), oe = /* @__PURE__ */ new Map();
4718
4937
  for (const I of B) {
4719
4938
  const R = p(I), z = oe.get(R) ?? 0;
4720
- 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);
4721
4940
  }
4722
- const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], Et = [];
4941
+ const j = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Set(), q = [], kt = [];
4723
4942
  for (const I of B) {
4724
- const R = p(I), z = Q.get(R) ?? 0, _t = j.get(R) ?? 0;
4725
- 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)) {
4726
4945
  U.has(R) || (q.push([`… ${me.get(R) ?? 0} similar siblings omitted`]), U.add(R));
4727
4946
  continue;
4728
4947
  }
4729
- const Pt = S(I, N);
4730
- Et.push(Pt), q.push(Pt.lines);
4948
+ const vt = S(I, N);
4949
+ kt.push(vt), q.push(vt.lines);
4731
4950
  }
4732
4951
  const Fe = [];
4733
4952
  if (T.shadowRoot)
4734
4953
  for (const I of Array.from(T.shadowRoot.children))
4735
4954
  I instanceof HTMLElement && Fe.push(S(I, N + 1));
4736
- 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(
4737
4956
  [ee, ...ye.map((I) => I.textPreview)].filter(Boolean).join(" ")
4738
- ).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 = [];
4739
4958
  if ($e) {
4740
- const I = ye.some((z) => z.containsTextElement), R = n.has(v) && !I ? kt : ee;
4741
- 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)));
4742
4961
  }
4743
4962
  for (const I of q)
4744
4963
  ae.push(...Ae(I, je));
@@ -4756,7 +4975,7 @@ function Gi(s, e) {
4756
4975
  return {
4757
4976
  lines: ae,
4758
4977
  hasUsefulContent: We,
4759
- textPreview: kt,
4978
+ textPreview: Ct,
4760
4979
  containsTextElement: n.has(v) || ye.some((I) => I.containsTextElement)
4761
4980
  };
4762
4981
  };
@@ -4764,7 +4983,7 @@ function Gi(s, e) {
4764
4983
  `);
4765
4984
  }, m = [], M = ne(window.getSelection()?.toString() ?? "");
4766
4985
  M && m.push(`--- selected text ---
4767
- ${JSON.stringify(M)}`), d.length > 0 && m.push(Vi(d, t, l, o));
4986
+ ${JSON.stringify(M)}`), d.length > 0 && m.push(rr(d, t, l, o));
4768
4987
  for (const w of s.slice(0, 3))
4769
4988
  m.push(y(w, "active overlay DOM", /* @__PURE__ */ new Set()));
4770
4989
  if (e && m.push(y(e, "main DOM", /* @__PURE__ */ new Set())), document.body) {
@@ -4775,11 +4994,11 @@ ${JSON.stringify(M)}`), d.length > 0 && m.push(Vi(d, t, l, o));
4775
4994
 
4776
4995
  `);
4777
4996
  }
4778
- function Rs(s, e, t, n) {
4997
+ function Cs(s, e, t, n) {
4779
4998
  const i = s.tagName.toLowerCase();
4780
4999
  let r = i;
4781
5000
  const o = s.getAttribute("id");
4782
- o && Xi(o) && (r += `#${o}`);
5001
+ o && or(o) && (r += `#${o}`);
4783
5002
  for (const a of e) {
4784
5003
  const l = s.getAttribute(a);
4785
5004
  l && l.length <= 160 && (a !== "role" || !t.has(l)) && (r += `[${a}=${JSON.stringify(l)}]`);
@@ -4792,7 +5011,7 @@ function Rs(s, e, t, n) {
4792
5011
  s.hasAttribute(a) && (r += `[${a}]`);
4793
5012
  return `${r}${n ? ` ${JSON.stringify(n)}` : ""}`;
4794
5013
  }
4795
- function Qi() {
5014
+ function ir() {
4796
5015
  const s = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Map(), t = (a, l) => {
4797
5016
  if (!a)
4798
5017
  return;
@@ -4813,7 +5032,7 @@ function Qi() {
4813
5032
  n = n.shadowRoot.activeElement;
4814
5033
  n !== document.body && n !== document.documentElement && t(n, "focused");
4815
5034
  const i = window.getSelection();
4816
- 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"));
4817
5036
  const r = [
4818
5037
  ["[aria-selected='true']", "selected"],
4819
5038
  ["[aria-current]:not([aria-current='false'])", "current"],
@@ -4835,7 +5054,7 @@ function Qi() {
4835
5054
  priorityTargets: Array.from(e, ([a, l]) => ({ element: a, labels: Array.from(l) }))
4836
5055
  };
4837
5056
  }
4838
- function Vi(s, e, t, n) {
5057
+ function rr(s, e, t, n) {
4839
5058
  const i = ["--- active/current elements ---"];
4840
5059
  for (const r of s) {
4841
5060
  const o = [];
@@ -4846,18 +5065,18 @@ function Vi(s, e, t, n) {
4846
5065
  const d = a.getRootNode();
4847
5066
  a = a.parentElement ?? (d instanceof ShadowRoot && d.host instanceof HTMLElement ? d.host : null);
4848
5067
  }
4849
- 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(
4850
5069
  u,
4851
5070
  t,
4852
5071
  n,
4853
- d === l.length - 1 ? Es(u).slice(0, 180) : ""
5072
+ d === l.length - 1 ? _s(u).slice(0, 180) : ""
4854
5073
  ));
4855
5074
  o.length > l.length && c.splice(1, 0, "…"), i.push(`${r.labels.join(", ")}: ${c.join(" > ")}`);
4856
5075
  }
4857
5076
  return i.join(`
4858
5077
  `);
4859
5078
  }
4860
- function Qt(s) {
5079
+ function Xt(s) {
4861
5080
  return s instanceof HTMLElement ? s : s?.parentElement instanceof HTMLElement ? s.parentElement : null;
4862
5081
  }
4863
5082
  function Ae(s, e) {
@@ -4866,17 +5085,17 @@ function Ae(s, e) {
4866
5085
  const t = " ".repeat(e);
4867
5086
  return s.map((n) => `${t}${n}`);
4868
5087
  }
4869
- function Es(s) {
5088
+ function _s(s) {
4870
5089
  return ne(
4871
5090
  Array.from(s.childNodes).filter((e) => e.nodeType === Node.TEXT_NODE).map((e) => e.textContent ?? "").join(" ")
4872
5091
  );
4873
5092
  }
4874
- function Xi(s) {
5093
+ function or(s) {
4875
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);
4876
5095
  }
4877
- function ks() {
4878
- const s = Array.from(document.querySelectorAll(Ht)), e = s.find(
4879
- (r) => typeof r[Nn] == "string"
5096
+ function Ps() {
5097
+ const s = Array.from(document.querySelectorAll(Wt)), e = s.find(
5098
+ (r) => typeof r[Vn] == "string"
4880
5099
  );
4881
5100
  if (!(e ?? s[0]))
4882
5101
  return;
@@ -4887,28 +5106,28 @@ function ks() {
4887
5106
  selectors: [
4888
5107
  {
4889
5108
  name: "widget_host",
4890
- selector: Ht,
5109
+ selector: Wt,
4891
5110
  description: "Finds Pluno's shadow-host element in the host page DOM."
4892
5111
  },
4893
5112
  {
4894
5113
  name: "widget_root",
4895
- selector: On,
5114
+ selector: zn,
4896
5115
  description: "Finds Pluno's widget root inside the widget host shadow root."
4897
5116
  },
4898
5117
  {
4899
5118
  name: "widget_panel",
4900
- selector: xn,
5119
+ selector: Kn,
4901
5120
  description: "Finds Pluno's open chat panel inside the widget host shadow root."
4902
5121
  },
4903
5122
  {
4904
5123
  name: "widget_timeline",
4905
- selector: Ln,
5124
+ selector: Gn,
4906
5125
  description: "Finds Pluno's chat timeline inside the widget host shadow root."
4907
5126
  }
4908
5127
  ]
4909
5128
  };
4910
5129
  }
4911
- function Ji(s) {
5130
+ function ar(s) {
4912
5131
  try {
4913
5132
  const e = JSON.parse(s);
4914
5133
  return e && typeof e == "object" ? e : { type: "error", message: "Invalid server event" };
@@ -4916,7 +5135,7 @@ function Ji(s) {
4916
5135
  return { type: "error", message: "Invalid server event" };
4917
5136
  }
4918
5137
  }
4919
- function Yi(s) {
5138
+ function lr(s) {
4920
5139
  if (typeof s != "string")
4921
5140
  return null;
4922
5141
  try {
@@ -4926,13 +5145,13 @@ function Yi(s) {
4926
5145
  return null;
4927
5146
  }
4928
5147
  }
4929
- function Vt(s, e) {
5148
+ function Yt(s, e) {
4930
5149
  if (!s || typeof s != "object")
4931
5150
  return [];
4932
5151
  const t = s[e];
4933
5152
  return Array.isArray(t) ? t.filter((n) => typeof n == "string" && n.trim().length > 0) : [];
4934
5153
  }
4935
- function Xt(s) {
5154
+ function Zt(s) {
4936
5155
  return Array.isArray(s) ? s.flatMap((e) => {
4937
5156
  if (!e || typeof e != "object")
4938
5157
  return [];
@@ -4940,10 +5159,10 @@ function Xt(s) {
4940
5159
  return typeof t.taskId != "string" || !t.taskId || typeof t.dueAt != "string" || Number.isNaN(Date.parse(t.dueAt)) ? [] : [{ taskId: t.taskId, dueAt: t.dueAt }];
4941
5160
  }) : [];
4942
5161
  }
4943
- function Zi(s) {
5162
+ function cr(s) {
4944
5163
  return Array.isArray(s) ? s.filter((e) => typeof e == "string" && e.trim().length > 0) : [];
4945
5164
  }
4946
- function er(s) {
5165
+ function ur(s) {
4947
5166
  if (!s || typeof s != "object")
4948
5167
  return null;
4949
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;
@@ -4954,13 +5173,13 @@ function er(s) {
4954
5173
  ...a !== null ? { scribbleStyle: a } : {}
4955
5174
  };
4956
5175
  }
4957
- function tr(s) {
5176
+ function dr(s) {
4958
5177
  if (!s || typeof s != "object")
4959
5178
  return null;
4960
5179
  const e = s.javascript;
4961
5180
  return typeof e != "string" || !e.trim() ? null : { javascript: e };
4962
5181
  }
4963
- function sr(s, e) {
5182
+ function hr(s, e) {
4964
5183
  return e ? s && typeof s == "object" ? {
4965
5184
  ...s,
4966
5185
  helperError: e
@@ -4970,13 +5189,13 @@ function sr(s, e) {
4970
5189
  helperError: e
4971
5190
  } : s;
4972
5191
  }
4973
- function nr(s) {
5192
+ function pr(s) {
4974
5193
  if (!s || typeof s != "object")
4975
5194
  return s;
4976
5195
  const e = s;
4977
5196
  return typeof e.exception?.message == "string" ? e.exception.message : typeof e.error == "string" ? e.error : s;
4978
5197
  }
4979
- function ir() {
5198
+ function gr() {
4980
5199
  const s = "pluno.productAgent.clientId", e = window.localStorage.getItem(s);
4981
5200
  if (e)
4982
5201
  return e;
@@ -4986,7 +5205,7 @@ function ir() {
4986
5205
  function x() {
4987
5206
  return crypto.randomUUID();
4988
5207
  }
4989
- function rr(s) {
5208
+ function fr(s) {
4990
5209
  if (!s || typeof s != "object")
4991
5210
  return null;
4992
5211
  const e = s, t = typeof e.id == "string" ? e.id : null;
@@ -4998,11 +5217,11 @@ function rr(s) {
4998
5217
  } : null;
4999
5218
  }
5000
5219
  function st(s, e) {
5001
- return Array.isArray(s) ? ht(
5220
+ return Array.isArray(s) ? pt(
5002
5221
  s.map((t) => Ue(t, e)).filter((t) => t !== null)
5003
5222
  ) : [];
5004
5223
  }
5005
- function or(s) {
5224
+ function mr(s) {
5006
5225
  return Array.isArray(s) ? s.flatMap((e) => {
5007
5226
  if (!e || typeof e != "object")
5008
5227
  return [];
@@ -5030,15 +5249,15 @@ function Ue(s, e) {
5030
5249
  if (!n || typeof n != "object")
5031
5250
  return null;
5032
5251
  const i = n;
5033
- 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")
5034
5253
  return null;
5035
5254
  if (i.type === "assistant_draft")
5036
5255
  return {
5037
5256
  id: typeof i.id == "string" ? i.id : String(t.id ?? crypto.randomUUID()),
5038
5257
  role: "assistant",
5039
5258
  ...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
5040
- content: vt(
5041
- Jt(i.content),
5259
+ content: qt(
5260
+ es(i.content),
5042
5261
  e
5043
5262
  ),
5044
5263
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
@@ -5054,8 +5273,8 @@ function Ue(s, e) {
5054
5273
  id: String(t.id ?? crypto.randomUUID()),
5055
5274
  role: r,
5056
5275
  ...i.phase === "commentary" || i.phase === "final_answer" ? { phase: i.phase } : {},
5057
- content: vt(
5058
- Jt(i.content),
5276
+ content: qt(
5277
+ es(i.content),
5059
5278
  e
5060
5279
  ),
5061
5280
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
@@ -5063,7 +5282,7 @@ function Ue(s, e) {
5063
5282
  ...P(i) !== null ? { causalSequence: P(i) } : {},
5064
5283
  respondsToUserMessageId: O(i) ?? void 0,
5065
5284
  ...E(i) ? { runId: E(i) } : {},
5066
- attachments: qs(i.attachments, e),
5285
+ attachments: Ls(i.attachments, e),
5067
5286
  ...i.steered === !0 ? { steered: !0 } : {}
5068
5287
  };
5069
5288
  return r === "assistant" && typeof i.id == "string" && Object.defineProperty(o, "assistantDraftItemId", {
@@ -5078,7 +5297,7 @@ function Ue(s, e) {
5078
5297
  }), o;
5079
5298
  }
5080
5299
  if (i.type === "function_call_output") {
5081
- const r = sn(i.output);
5300
+ const r = dn(i.output);
5082
5301
  if (r !== null)
5083
5302
  return {
5084
5303
  id: String(t.id ?? crypto.randomUUID()),
@@ -5089,11 +5308,11 @@ function Ue(s, e) {
5089
5308
  respondsToUserMessageId: O(i) ?? void 0,
5090
5309
  ...E(i) ? { runId: E(i) } : {},
5091
5310
  dataType: "function_call_output",
5092
- toolName: St,
5311
+ toolName: Tt,
5093
5312
  callId: ue(i) ?? void 0,
5094
5313
  sharePromptAllowed: r
5095
5314
  };
5096
- const o = In(i.output);
5315
+ const o = En(i.output);
5097
5316
  if (o)
5098
5317
  return {
5099
5318
  id: String(t.id ?? crypto.randomUUID()),
@@ -5104,12 +5323,12 @@ function Ue(s, e) {
5104
5323
  respondsToUserMessageId: O(i) ?? void 0,
5105
5324
  ...E(i) ? { runId: E(i) } : {},
5106
5325
  dataType: "scheduled_check_in",
5107
- toolName: fs,
5326
+ toolName: Is,
5108
5327
  callId: ue(i) ?? void 0,
5109
5328
  scheduledCheckInId: o.id ?? void 0,
5110
5329
  scheduledCheckInAt: o.dueAt
5111
5330
  };
5112
- const a = lr(i.output), l = cr(i.output);
5331
+ const a = Ir(i.output), l = Sr(i.output);
5113
5332
  return a ? {
5114
5333
  id: String(t.id ?? crypto.randomUUID()),
5115
5334
  role: "tool",
@@ -5141,7 +5360,7 @@ function Ue(s, e) {
5141
5360
  return i.type === "function_call" || i.type === "tool_call" || i.type === "web_search_call" || i.type === "mcp_call" || i.type === "tab_lifecycle_decision" ? {
5142
5361
  id: String(t.id ?? crypto.randomUUID()),
5143
5362
  role: "tool",
5144
- content: i.type === "mcp_call" ? ar(i) : dr(i),
5363
+ content: i.type === "mcp_call" ? yr(i) : wr(i),
5145
5364
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5146
5365
  ...k(i) !== null ? { displaySequence: k(i) } : {},
5147
5366
  ...P(i) !== null ? { causalSequence: P(i) } : {},
@@ -5155,7 +5374,7 @@ function Ue(s, e) {
5155
5374
  } : i.type === "run_status" || i.type === "run_error" ? i.type === "run_error" && i.stage === "tool_execution" ? null : {
5156
5375
  id: String(t.id ?? crypto.randomUUID()),
5157
5376
  role: "system",
5158
- content: ur(i),
5377
+ content: Tr(i),
5159
5378
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
5160
5379
  ...k(i) !== null ? { displaySequence: k(i) } : {},
5161
5380
  ...P(i) !== null ? { causalSequence: P(i) } : {},
@@ -5168,11 +5387,11 @@ function Ue(s, e) {
5168
5387
  ...typeof i.securitySettingsUrl == "string" ? { securitySettingsUrl: i.securitySettingsUrl } : {}
5169
5388
  } : null;
5170
5389
  }
5171
- function ar(s) {
5390
+ function yr(s) {
5172
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(" ");
5173
5392
  return t ? `🔌 Using ${t}` : "🔌 Using connected integration";
5174
5393
  }
5175
- function lr(s) {
5394
+ function Ir(s) {
5176
5395
  if (typeof s != "string")
5177
5396
  return null;
5178
5397
  try {
@@ -5189,7 +5408,7 @@ function lr(s) {
5189
5408
  return null;
5190
5409
  }
5191
5410
  }
5192
- function cr(s) {
5411
+ function Sr(s) {
5193
5412
  if (typeof s != "string")
5194
5413
  return null;
5195
5414
  try {
@@ -5204,10 +5423,10 @@ function cr(s) {
5204
5423
  return null;
5205
5424
  }
5206
5425
  }
5207
- function ur(s) {
5426
+ function Tr(s) {
5208
5427
  return s.type === "run_status" && s.status === "steered" ? "Steered" : typeof s.message == "string" && s.message.trim().length > 0 ? s.message : "";
5209
5428
  }
5210
- function dr(s) {
5429
+ function wr(s) {
5211
5430
  if (s.type === "web_search_call") {
5212
5431
  const e = s.action;
5213
5432
  if (e && typeof e == "object") {
@@ -5219,9 +5438,9 @@ function dr(s) {
5219
5438
  }
5220
5439
  return "🔎 Searching the web";
5221
5440
  }
5222
- return hr(s);
5441
+ return Ar(s);
5223
5442
  }
5224
- function hr(s) {
5443
+ function Ar(s) {
5225
5444
  if (typeof s.summary == "string" && s.summary.trim().length > 0)
5226
5445
  return se(s.summary);
5227
5446
  if (typeof s.arguments == "string")
@@ -5238,7 +5457,7 @@ function se(s) {
5238
5457
  const e = s.trim() || "Run tool", t = e.codePointAt(0) ?? 0;
5239
5458
  return t >= 126976 && t <= 129791 || t >= 9728 && t <= 10175 || t >= 127462 && t <= 127487 ? e : `🛠️ ${e}`;
5240
5459
  }
5241
- function pr(s) {
5460
+ function Mr(s) {
5242
5461
  if (s == null)
5243
5462
  return s;
5244
5463
  if (typeof s != "object")
@@ -5263,7 +5482,7 @@ function P(s) {
5263
5482
  function k(s) {
5264
5483
  return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
5265
5484
  }
5266
- function Jt(s) {
5485
+ function es(s) {
5267
5486
  return typeof s == "string" ? s : Array.isArray(s) ? s.map((e) => {
5268
5487
  if (!e || typeof e != "object")
5269
5488
  return "";
@@ -5272,13 +5491,13 @@ function Jt(s) {
5272
5491
  }).filter(Boolean).join("") : "";
5273
5492
  }
5274
5493
  function de(s, e) {
5275
- const t = Cs(
5494
+ const t = vs(
5276
5495
  s,
5277
- Mt(s, e)
5278
- ), n = mr(
5279
- fr(
5280
- Tr(
5281
- gr(s, e),
5496
+ bt(s, e)
5497
+ ), n = Er(
5498
+ Rr(
5499
+ Pr(
5500
+ br(s, e),
5282
5501
  e
5283
5502
  ),
5284
5503
  t
@@ -5286,13 +5505,13 @@ function de(s, e) {
5286
5505
  t
5287
5506
  ), i = n.findIndex((o) => o.id === t.id);
5288
5507
  if (i === -1)
5289
- return ht(
5508
+ return pt(
5290
5509
  [...n, t]
5291
5510
  );
5292
5511
  const r = [...n];
5293
- return r[i] = t, ht(r);
5512
+ return r[i] = t, pt(r);
5294
5513
  }
5295
- function Mt(s, e, t = !0) {
5514
+ function bt(s, e, t = !0) {
5296
5515
  const n = s.find(
5297
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)
5298
5517
  );
@@ -5303,7 +5522,7 @@ function Mt(s, e, t = !0) {
5303
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] : []);
5304
5523
  return e.displaySequence = (i.length > 0 ? Math.max(...i) : 0) + 1, e;
5305
5524
  }
5306
- function gr(s, e) {
5525
+ function br(s, e) {
5307
5526
  const t = e.proactiveSuggestionClientMessageId;
5308
5527
  if (!t)
5309
5528
  return s;
@@ -5313,7 +5532,7 @@ function gr(s, e) {
5313
5532
  const r = [...s];
5314
5533
  return r[i] = e, r;
5315
5534
  }
5316
- function fr(s, e) {
5535
+ function Rr(s, e) {
5317
5536
  const t = e.assistantDraftItemId;
5318
5537
  return t ? s.map(
5319
5538
  (n) => n.dataType === "assistant_draft" && n.id === t ? e : n
@@ -5322,7 +5541,7 @@ function fr(s, e) {
5322
5541
  function Me(s, e, t) {
5323
5542
  return e !== null ? s.respondsToUserMessageId === e : t !== null && s.runId === t;
5324
5543
  }
5325
- function Yt(s, e, t, n) {
5544
+ function ts(s, e, t, n) {
5326
5545
  if (t === null) return s;
5327
5546
  let i = -1;
5328
5547
  for (let o = s.length - 1; o >= 0; o -= 1) {
@@ -5339,7 +5558,7 @@ function Yt(s, e, t, n) {
5339
5558
  respondsToUserMessageId: t
5340
5559
  }, r;
5341
5560
  }
5342
- function Zt(s, e) {
5561
+ function ss(s, e) {
5343
5562
  const t = s.findIndex(
5344
5563
  (i) => !i.id.startsWith("transient-activity:") && i.callId === e.callId
5345
5564
  );
@@ -5356,12 +5575,12 @@ function Zt(s, e) {
5356
5575
  ...n[t].runId ? {} : { runId: e.runId }
5357
5576
  }, n;
5358
5577
  }
5359
- function es(s, e, t) {
5578
+ function ns(s, e, t) {
5360
5579
  let n = !1;
5361
5580
  const i = s.map((r) => r.callId !== e || r.loading === t ? r : (n = !0, { ...r, loading: t }));
5362
5581
  return n ? i : s;
5363
5582
  }
5364
- function ts(s) {
5583
+ function is(s) {
5365
5584
  if (s.hiddenFromTranscript === !0)
5366
5585
  return null;
5367
5586
  const e = typeof s.callId == "string" ? s.callId : null, t = typeof s.toolName == "string" ? s.toolName : null;
@@ -5381,7 +5600,7 @@ function ts(s) {
5381
5600
  loading: !0
5382
5601
  };
5383
5602
  }
5384
- function mr(s, e) {
5603
+ function Er(s, e) {
5385
5604
  if (e.id.startsWith("transient-activity:"))
5386
5605
  return s;
5387
5606
  const t = e.toolName === "tab_lifecycle";
@@ -5390,30 +5609,30 @@ function mr(s, e) {
5390
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);
5391
5610
  return i === -1 ? s : s.flatMap((r, o) => n(r) ? o === i ? [e] : [] : r.id === e.id ? [] : [r]);
5392
5611
  }
5393
- function lt(s, e) {
5612
+ function ct(s, e) {
5394
5613
  const t = [];
5395
5614
  for (const n of e) {
5396
5615
  const i = [...s, ...t];
5397
5616
  t.push(
5398
- Cs(
5617
+ vs(
5399
5618
  i,
5400
- Mt(i, n, !1)
5619
+ bt(i, n, !1)
5401
5620
  )
5402
5621
  );
5403
5622
  }
5404
- return ln(
5623
+ return mn(
5405
5624
  s,
5406
5625
  t,
5407
- ct
5626
+ ut
5408
5627
  );
5409
5628
  }
5410
- function yr(s, e) {
5629
+ function kr(s, e) {
5411
5630
  const t = new Map(s.map((r) => [r.id, r])), n = e.map(
5412
- (r) => Mt(s, r, !1)
5631
+ (r) => bt(s, r, !1)
5413
5632
  );
5414
5633
  for (const r of n)
5415
5634
  t.set(r.id, r);
5416
- const i = lt(
5635
+ const i = ct(
5417
5636
  s,
5418
5637
  [...t.values()]
5419
5638
  );
@@ -5428,8 +5647,8 @@ function yr(s, e) {
5428
5647
  }
5429
5648
  return i;
5430
5649
  }
5431
- function ct(s) {
5432
- 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 = [
5433
5652
  // Output-backed cards and their visible calls are separate durable rows. A distinct key keeps activity hydration
5434
5653
  // from substituting the call for its output and then appending a duplicate output at the end of the timeline.
5435
5654
  ...s.callId ? [`${n ? "call-output" : "call"}:${s.callId}`] : [],
@@ -5448,49 +5667,49 @@ function ct(s) {
5448
5667
  isTransient: s.id.startsWith("transient-activity:") || s.dataType === "assistant_draft"
5449
5668
  };
5450
5669
  }
5451
- function Cs(s, e) {
5670
+ function vs(s, e) {
5452
5671
  if (e.role !== "user" || !e.attachments?.length)
5453
5672
  return e;
5454
5673
  const t = s.find(
5455
- (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))
5456
5675
  );
5457
5676
  if (!t?.attachments?.length)
5458
5677
  return e;
5459
5678
  const n = e.attachments.map((o) => {
5460
- const a = Ir(t.attachments ?? [], o);
5461
- return a ? Sr(o, a) : o;
5462
- }), 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);
5463
5682
  return r && Object.defineProperty(i, "clientMessageId", {
5464
5683
  value: r,
5465
5684
  enumerable: !1
5466
5685
  }), i;
5467
5686
  }
5468
- function Ir(s, e) {
5687
+ function Cr(s, e) {
5469
5688
  return e.id ? s.find((t) => t.id === e.id) ?? null : null;
5470
5689
  }
5471
- function Sr(s, e) {
5690
+ function _r(s, e) {
5472
5691
  const { previewUrl: t } = e;
5473
5692
  return t ? { ...s, previewUrl: t } : s;
5474
5693
  }
5475
- function Tr(s, e) {
5694
+ function Pr(s, e) {
5476
5695
  if (e.role !== "user")
5477
5696
  return s;
5478
5697
  const t = s.findIndex(
5479
- (i) => He(i) && _s(i, e)
5698
+ (i) => He(i) && Us(i, e)
5480
5699
  );
5481
5700
  if (t === -1)
5482
5701
  return s;
5483
5702
  const n = [...s];
5484
5703
  return n.splice(t, 1), n;
5485
5704
  }
5486
- function _s(s, e) {
5487
- const t = J(s), n = J(e);
5705
+ function Us(s, e) {
5706
+ const t = X(s), n = X(e);
5488
5707
  return t && n ? t === n : s.content === e.content;
5489
5708
  }
5490
5709
  function He(s) {
5491
5710
  return s.role === "user" && (s.id.startsWith("local-") || s.id.startsWith("optimistic-user-message:"));
5492
5711
  }
5493
- function J(s) {
5712
+ function X(s) {
5494
5713
  const e = s.clientMessageId;
5495
5714
  if (e)
5496
5715
  return e;
@@ -5499,8 +5718,8 @@ function J(s) {
5499
5718
  );
5500
5719
  return n ? s.id.slice(n.length) : null;
5501
5720
  }
5502
- function ss(s) {
5503
- const e = Ps(s);
5721
+ function rs(s) {
5722
+ const e = Ds(s);
5504
5723
  if (e === null)
5505
5724
  return !1;
5506
5725
  const t = s[e].id;
@@ -5523,10 +5742,10 @@ function ss(s) {
5523
5742
  }
5524
5743
  return !1;
5525
5744
  }
5526
- function wr(s, e, t) {
5745
+ function vr(s, e, t) {
5527
5746
  const n = new Set(
5528
5747
  s.filter(
5529
- (i) => i.role === "user" && e !== null && J(i) === e
5748
+ (i) => i.role === "user" && e !== null && X(i) === e
5530
5749
  ).map((i) => i.id)
5531
5750
  );
5532
5751
  return s.some((i, r) => {
@@ -5537,14 +5756,14 @@ function wr(s, e, t) {
5537
5756
  if (t && i.runId === t) {
5538
5757
  if (n.size === 0)
5539
5758
  return !0;
5540
- const o = vs(s, r);
5759
+ const o = qs(s, r);
5541
5760
  return !i.respondsToUserMessageId && o !== null && n.has(o);
5542
5761
  }
5543
5762
  return !1;
5544
5763
  });
5545
5764
  }
5546
- function Ar(s) {
5547
- const e = Ps(s);
5765
+ function Ur(s) {
5766
+ const e = Ds(s);
5548
5767
  if (e === null)
5549
5768
  return s.some(W);
5550
5769
  const t = s[e].id;
@@ -5552,7 +5771,7 @@ function Ar(s) {
5552
5771
  (n) => n.respondsToUserMessageId === t && W(n)
5553
5772
  ) : s.slice(e + 1).some(W);
5554
5773
  }
5555
- function Ps(s) {
5774
+ function Ds(s) {
5556
5775
  for (let e = s.length - 1; e >= 0; e -= 1)
5557
5776
  if (s[e].role === "user" && !He(s[e]))
5558
5777
  return e;
@@ -5575,7 +5794,7 @@ function ie(s) {
5575
5794
  }
5576
5795
  return null;
5577
5796
  }
5578
- function Mr(s) {
5797
+ function Dr(s) {
5579
5798
  const e = ie(s);
5580
5799
  if (e === null)
5581
5800
  return null;
@@ -5594,10 +5813,10 @@ function C(s) {
5594
5813
  function pe(s) {
5595
5814
  return s?.retryable !== !0 ? !1 : s.type === "run_error" ? !0 : s.type === "run_status" && s.status === "interrupted";
5596
5815
  }
5597
- function br(s) {
5816
+ function qr(s) {
5598
5817
  return s?.type === "run_status" && s.status === "interrupted" && s.reason === "backend_restart";
5599
5818
  }
5600
- function Rr(s, e) {
5819
+ function Or(s, e) {
5601
5820
  const t = ie(e);
5602
5821
  if (t === null)
5603
5822
  return !1;
@@ -5609,7 +5828,7 @@ function Rr(s, e) {
5609
5828
  (o) => o.respondsToUserMessageId === i && De(o)
5610
5829
  ) : s.slice(r + 1).some(De);
5611
5830
  }
5612
- function ut(s) {
5831
+ function dt(s) {
5613
5832
  const e = ie(s);
5614
5833
  if (e === null)
5615
5834
  return null;
@@ -5622,7 +5841,7 @@ function ut(s) {
5622
5841
  const i = n.clientMessageId;
5623
5842
  return typeof i == "string" ? i : null;
5624
5843
  }
5625
- function Er(s) {
5844
+ function xr(s) {
5626
5845
  const e = ie(s);
5627
5846
  if (e === null)
5628
5847
  return null;
@@ -5637,13 +5856,13 @@ function Er(s) {
5637
5856
  if (r.type === "message" && r.role === "assistant")
5638
5857
  return null;
5639
5858
  if (r.type === "run_error")
5640
- return r.retryable !== !0 ? null : dt(s, r) ?? ut(s);
5859
+ return r.retryable !== !0 ? null : ht(s, r) ?? dt(s);
5641
5860
  if (r.type === "run_status")
5642
- 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;
5643
5862
  }
5644
5863
  return null;
5645
5864
  }
5646
- function dt(s, e) {
5865
+ function ht(s, e) {
5647
5866
  if (typeof e.clientMessageId == "string")
5648
5867
  return e.clientMessageId;
5649
5868
  const t = O(e);
@@ -5652,8 +5871,8 @@ function dt(s, e) {
5652
5871
  const n = s.find((r) => A(r, "id") === t), i = C(n);
5653
5872
  return i?.type === "message" && i.role === "user" && typeof i.clientMessageId == "string" ? i.clientMessageId : null;
5654
5873
  }
5655
- function ns(s, e, t, n, i, r) {
5656
- if (!e || !Cr(s))
5874
+ function os(s, e, t, n, i, r) {
5875
+ if (!e || !Nr(s))
5657
5876
  return !1;
5658
5877
  const o = s;
5659
5878
  if (pe(o) || t !== null && typeof o.id == "string" && o.id !== t)
@@ -5661,7 +5880,7 @@ function ns(s, e, t, n, i, r) {
5661
5880
  const a = O(o);
5662
5881
  return n !== null ? a !== null ? a === n : i !== null && E(o) === i && r === n : i === null || E(o) === i;
5663
5882
  }
5664
- function kr(s, e) {
5883
+ function Lr(s, e) {
5665
5884
  for (let t = e - 1; t >= 0; t -= 1) {
5666
5885
  const n = C(s[t]);
5667
5886
  if (n?.type === "message" && n.role === "user")
@@ -5669,13 +5888,13 @@ function kr(s, e) {
5669
5888
  }
5670
5889
  return null;
5671
5890
  }
5672
- function vs(s, e) {
5891
+ function qs(s, e) {
5673
5892
  for (let t = e - 1; t >= 0; t -= 1)
5674
5893
  if (s[t].role === "user")
5675
5894
  return s[t].id;
5676
5895
  return null;
5677
5896
  }
5678
- function Cr(s) {
5897
+ function Nr(s) {
5679
5898
  if (!s || typeof s != "object")
5680
5899
  return !1;
5681
5900
  const e = s;
@@ -5684,42 +5903,42 @@ function Cr(s) {
5684
5903
  function W(s) {
5685
5904
  return s.role === "assistant" && s.phase !== "commentary";
5686
5905
  }
5687
- function _r(s) {
5906
+ function Hr(s) {
5688
5907
  if (!s || typeof s != "object")
5689
5908
  return !1;
5690
5909
  const e = s;
5691
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";
5692
5911
  }
5693
- function ht(s) {
5694
- return s.filter((e, t) => G(e) ? !Wr(s, t) && !Us(s, t) && !Br(s, t) && !Fr(s, t) : Pr(e) ? e.retryable === !0 && Hr(s, t) ? !1 : !Nr(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);
5695
5914
  }
5696
- function Pr(s) {
5915
+ function Br(s) {
5697
5916
  return s.role === "system" && (s.dataType === "run_error" || s.dataType === "run_status" && s.steered !== !0);
5698
5917
  }
5699
5918
  function G(s) {
5700
5919
  return s.role === "system" && s.dataType === "run_status" && s.loading === !0;
5701
5920
  }
5702
- function pt(s) {
5921
+ function gt(s) {
5703
5922
  return s.steered !== !0 && (s.dataType === "assistant_draft" || s.loading === !0);
5704
5923
  }
5705
- function vr(s) {
5706
- return s.some(pt);
5924
+ function Fr(s) {
5925
+ return s.some(gt);
5707
5926
  }
5708
- function is(s, e) {
5927
+ function as(s, e) {
5709
5928
  return (s.retryable === !0 || s.code === "transient_model_error") && s.code !== "run_recovery_exhausted" && e !== null && typeof s.clientMessageId == "string";
5710
5929
  }
5711
- function Ur(s, e) {
5712
- 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;
5713
- 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]);
5714
5933
  }
5715
- function Dr(s, e, t, n) {
5934
+ function $r(s, e, t, n) {
5716
5935
  const i = s.findIndex(
5717
- (l, c) => G(l) && !Us(s, c)
5936
+ (l, c) => G(l) && !Os(s, c)
5718
5937
  ), r = i === -1 ? null : s[i], o = e ?? r?.respondsToUserMessageId ?? null, a = o ? s.find(
5719
5938
  (l) => l.role === "user" && l.id === o
5720
5939
  ) : null;
5721
5940
  return {
5722
- clientMessageId: a ? J(a) : o ? null : n,
5941
+ clientMessageId: a ? X(a) : o ? null : n,
5723
5942
  respondsToUserMessageId: o,
5724
5943
  runId: t ?? r?.runId ?? null
5725
5944
  };
@@ -5727,29 +5946,29 @@ function Dr(s, e, t, n) {
5727
5946
  function _e(s) {
5728
5947
  return s?.type === "run_status" && s.status === "stopped";
5729
5948
  }
5730
- function qr(s, e) {
5949
+ function jr(s, e) {
5731
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;
5732
5951
  }
5733
- function rs(s, e, t) {
5952
+ function ls(s, e, t) {
5734
5953
  const n = new Set(
5735
5954
  s.filter(
5736
- (i) => i.role === "user" && e !== null && J(i) === e
5955
+ (i) => i.role === "user" && e !== null && X(i) === e
5737
5956
  ).map((i) => i.id)
5738
5957
  );
5739
5958
  return s.filter(
5740
5959
  (i) => !G(i) || (n.size > 0 ? !i.respondsToUserMessageId || !n.has(i.respondsToUserMessageId) : !t || i.runId !== t)
5741
5960
  );
5742
5961
  }
5743
- function Us(s, e) {
5962
+ function Os(s, e) {
5744
5963
  return s.some(
5745
- (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && Or(
5964
+ (t, n) => n !== e && t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0 && t.steered !== !0) && zr(
5746
5965
  s,
5747
5966
  e,
5748
5967
  n
5749
5968
  )
5750
5969
  );
5751
5970
  }
5752
- function Or(s, e, t) {
5971
+ function zr(s, e, t) {
5753
5972
  const n = s[e], i = s[t];
5754
5973
  if (ge(n, i))
5755
5974
  return !0;
@@ -5760,20 +5979,20 @@ function Or(s, e, t) {
5760
5979
  return s[r].id === n.respondsToUserMessageId;
5761
5980
  return !1;
5762
5981
  }
5763
- function os(s, e, t, n) {
5982
+ function cs(s, e, t, n) {
5764
5983
  const i = (t && t !== e ? t : null) ?? [...s].reverse().find(
5765
- (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && as(l) && !Lr(
5984
+ (l) => l.respondsToUserMessageId !== void 0 && l.respondsToUserMessageId !== e && us(l) && !Gr(
5766
5985
  s,
5767
5986
  l.respondsToUserMessageId
5768
5987
  )
5769
- )?.respondsToUserMessageId ?? xr(
5988
+ )?.respondsToUserMessageId ?? Kr(
5770
5989
  s,
5771
5990
  e
5772
5991
  );
5773
5992
  if (!i)
5774
5993
  return s;
5775
5994
  let r = !1;
5776
- 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 }));
5777
5996
  if (r)
5778
5997
  return o;
5779
5998
  const a = s.find(
@@ -5795,7 +6014,7 @@ function os(s, e, t, n) {
5795
6014
  }
5796
6015
  ];
5797
6016
  }
5798
- function xr(s, e) {
6017
+ function Kr(s, e) {
5799
6018
  const t = s.findIndex(
5800
6019
  (n) => n.role === "user" && n.id === e
5801
6020
  );
@@ -5806,15 +6025,15 @@ function xr(s, e) {
5806
6025
  return s[n].id;
5807
6026
  return null;
5808
6027
  }
5809
- function as(s) {
6028
+ function us(s) {
5810
6029
  return s.role === "tool" || G(s) ? !0 : s.role === "assistant" && s.phase === "commentary";
5811
6030
  }
5812
- function Lr(s, e) {
6031
+ function Gr(s, e) {
5813
6032
  return s.some(
5814
6033
  (t) => t.respondsToUserMessageId === e && (W(t) || t.role === "system" && (t.dataType === "run_error" || t.dataType === "run_status" && t.loading !== !0))
5815
6034
  );
5816
6035
  }
5817
- function Nr(s, e) {
6036
+ function Vr(s, e) {
5818
6037
  const t = s[e];
5819
6038
  for (let n = e + 1; n < s.length; n += 1) {
5820
6039
  const i = s[n];
@@ -5823,7 +6042,7 @@ function Nr(s, e) {
5823
6042
  }
5824
6043
  return !1;
5825
6044
  }
5826
- function Hr(s, e) {
6045
+ function Qr(s, e) {
5827
6046
  const t = s[e];
5828
6047
  if (!t.respondsToUserMessageId)
5829
6048
  return !1;
@@ -5836,19 +6055,19 @@ function Hr(s, e) {
5836
6055
  }
5837
6056
  return !1;
5838
6057
  }
5839
- function Br(s, e) {
6058
+ function Jr(s, e) {
5840
6059
  const t = s[e];
5841
6060
  return s.some(
5842
6061
  (n, i) => i !== e && n.role === "assistant" && ge(t, n)
5843
6062
  );
5844
6063
  }
5845
- function Fr(s, e) {
6064
+ function Xr(s, e) {
5846
6065
  const t = s[e];
5847
6066
  return s.some(
5848
6067
  (n, i) => i !== e && n.role === "tool" && ge(t, n)
5849
6068
  );
5850
6069
  }
5851
- function Wr(s, e) {
6070
+ function Yr(s, e) {
5852
6071
  const t = s[e];
5853
6072
  for (let n = e + 1; n < s.length; n += 1)
5854
6073
  if (G(s[n]) && ge(t, s[n]))
@@ -5861,15 +6080,15 @@ function ge(s, e) {
5861
6080
  function A(s, e) {
5862
6081
  return s && typeof s == "object" && typeof s[e] == "string" ? s[e] : null;
5863
6082
  }
5864
- function $r(s, e) {
6083
+ function Zr(s, e) {
5865
6084
  try {
5866
- const t = window.localStorage.getItem(`${Ms}${s}`);
6085
+ const t = window.localStorage.getItem(`${Es}${s}`);
5867
6086
  if (!t)
5868
6087
  return null;
5869
6088
  const n = JSON.parse(t), i = typeof n.sessionId == "string" ? n.sessionId : null;
5870
6089
  if (e !== void 0 && i !== e)
5871
6090
  return null;
5872
- const r = Array.isArray(n.messages) ? n.messages.map(eo).filter((o) => !!o) : [];
6091
+ const r = Array.isArray(n.messages) ? n.messages.map(uo).filter((o) => !!o) : [];
5873
6092
  return {
5874
6093
  sessionId: i,
5875
6094
  messages: r
@@ -5878,51 +6097,51 @@ function $r(s, e) {
5878
6097
  return null;
5879
6098
  }
5880
6099
  }
5881
- function gt(s) {
6100
+ function ft(s) {
5882
6101
  return s.role === "user" || s.role === "assistant" || // Live activity is part of the readable conversation cache. Keeping it across host navigation prevents a
5883
6102
  // running tool or commentary history from disappearing while authoritative hydration is still in flight.
5884
6103
  s.role === "tool" || s.dataType === "run_status" || s.dataType === "run_error";
5885
6104
  }
5886
- function jr(s, e) {
6105
+ function eo(s, e) {
5887
6106
  try {
5888
6107
  window.localStorage.setItem(
5889
- `${Ms}${s}`,
6108
+ `${Es}${s}`,
5890
6109
  JSON.stringify({
5891
6110
  sessionId: e.sessionId,
5892
- messages: e.messages.filter(gt).slice(-di).map(to)
6111
+ messages: e.messages.filter(ft).slice(-wi).map(ho)
5893
6112
  })
5894
6113
  );
5895
6114
  } catch {
5896
6115
  return;
5897
6116
  }
5898
6117
  }
5899
- function zr(s) {
6118
+ function to(s) {
5900
6119
  try {
5901
- const e = window.localStorage.getItem(`${at}${s}`);
6120
+ const e = window.localStorage.getItem(`${lt}${s}`);
5902
6121
  if (!e)
5903
6122
  return [];
5904
6123
  const t = JSON.parse(e);
5905
- return Array.isArray(t) ? t.filter(bt) : [];
6124
+ return Array.isArray(t) ? t.filter(Rt) : [];
5906
6125
  } catch {
5907
6126
  return [];
5908
6127
  }
5909
6128
  }
5910
- function V(s, e) {
6129
+ function Q(s, e) {
5911
6130
  try {
5912
- const t = e.filter(bt);
6131
+ const t = e.filter(Rt);
5913
6132
  if (t.length === 0) {
5914
- window.localStorage.removeItem(`${at}${s}`);
6133
+ window.localStorage.removeItem(`${lt}${s}`);
5915
6134
  return;
5916
6135
  }
5917
6136
  window.localStorage.setItem(
5918
- `${at}${s}`,
6137
+ `${lt}${s}`,
5919
6138
  JSON.stringify(t.slice(-25))
5920
6139
  );
5921
6140
  } catch {
5922
6141
  return;
5923
6142
  }
5924
6143
  }
5925
- function Ds(s, e) {
6144
+ function xs(s, e) {
5926
6145
  try {
5927
6146
  const t = `${Le}${s}`, n = location.href, i = location.origin, r = Array.from(e, (o) => ({
5928
6147
  ...o,
@@ -5938,28 +6157,28 @@ function Ds(s, e) {
5938
6157
  } catch {
5939
6158
  }
5940
6159
  }
5941
- function ls(s, e) {
6160
+ function ds(s, e) {
5942
6161
  try {
5943
6162
  if (window.sessionStorage.getItem(`${Le}${s}`) === null)
5944
6163
  return;
5945
6164
  } catch {
5946
6165
  return;
5947
6166
  }
5948
- Ds(s, e);
6167
+ xs(s, e);
5949
6168
  }
5950
- function Kr(s) {
6169
+ function so(s) {
5951
6170
  try {
5952
6171
  const e = `${Le}${s}`, t = window.sessionStorage.getItem(e);
5953
6172
  if (window.sessionStorage.removeItem(e), !t)
5954
6173
  return [];
5955
6174
  const n = JSON.parse(t);
5956
- return Array.isArray(n) ? n.flatMap((i) => Qr(i) ? [{
6175
+ return Array.isArray(n) ? n.flatMap((i) => io(i) ? [{
5957
6176
  ...i.event,
5958
6177
  page: _(),
5959
6178
  rawOutput: {
5960
6179
  pageContextRestarted: !0,
5961
6180
  outcome: "unknown",
5962
- message: Gr(location.href),
6181
+ message: no(location.href),
5963
6182
  currentUrl: location.href,
5964
6183
  console: [],
5965
6184
  metadata: {
@@ -5976,17 +6195,17 @@ function Kr(s) {
5976
6195
  return [];
5977
6196
  }
5978
6197
  }
5979
- function Gr(s) {
6198
+ function no(s) {
5980
6199
  return `The page context restarted. This is expected when the action included page navigation. Otherwise, it's unknown whether the action completed.
5981
6200
  Current URL: ${s}`;
5982
6201
  }
5983
- function Qr(s) {
6202
+ function io(s) {
5984
6203
  if (!s || typeof s != "object")
5985
6204
  return !1;
5986
6205
  const e = s, t = e.event;
5987
- 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";
5988
6207
  }
5989
- function Vr(s, e) {
6208
+ function ro(s, e) {
5990
6209
  const t = new Set(
5991
6210
  s.flatMap((n) => n.type === "tool.result" ? [n.callId] : [])
5992
6211
  );
@@ -5995,26 +6214,26 @@ function Vr(s, e) {
5995
6214
  ...e.filter((n) => !t.has(n.callId))
5996
6215
  ];
5997
6216
  }
5998
- function Xr(s) {
6217
+ function oo(s) {
5999
6218
  try {
6000
6219
  window.sessionStorage.removeItem(`${Le}${s}`);
6001
6220
  } catch {
6002
6221
  return;
6003
6222
  }
6004
6223
  }
6005
- function bt(s) {
6224
+ function Rt(s) {
6006
6225
  if (!s || typeof s != "object")
6007
6226
  return !1;
6008
6227
  const e = s;
6009
- 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;
6010
6229
  }
6011
- function cs(s) {
6230
+ function hs(s) {
6012
6231
  if (!s || typeof s != "object")
6013
6232
  return !1;
6014
6233
  const e = s;
6015
6234
  return typeof e.url == "string" && typeof e.title == "string" && typeof e.origin == "string";
6016
6235
  }
6017
- function qs(s, e) {
6236
+ function Ls(s, e) {
6018
6237
  if (!Array.isArray(s))
6019
6238
  return;
6020
6239
  const t = s.filter((i) => {
@@ -6022,41 +6241,41 @@ function qs(s, e) {
6022
6241
  return !1;
6023
6242
  const r = i;
6024
6243
  return typeof r.name == "string" && typeof r.mimeType == "string" && typeof r.sizeBytes == "number";
6025
- }), n = e ? t.map((i) => Os(i, e)) : t;
6244
+ }), n = e ? t.map((i) => Ns(i, e)) : t;
6026
6245
  return n.length > 0 ? n : void 0;
6027
6246
  }
6028
- function Os(s, e) {
6247
+ function Ns(s, e) {
6029
6248
  return s.fileUrl?.startsWith("/") ? {
6030
6249
  ...s,
6031
6250
  fileUrl: new URL(s.fileUrl, e).toString()
6032
6251
  } : s;
6033
6252
  }
6034
- function ft(s) {
6035
- return s.type || Zr(s.name) || "application/octet-stream";
6253
+ function mt(s) {
6254
+ return s.type || co(s.name) || "application/octet-stream";
6036
6255
  }
6037
- function Jr(s) {
6038
- xs({
6256
+ function ao(s) {
6257
+ Hs({
6039
6258
  name: s.name,
6040
- mimeType: ft(s),
6259
+ mimeType: mt(s),
6041
6260
  sizeBytes: s.size
6042
6261
  });
6043
6262
  }
6044
- function xs(s) {
6045
- const e = Yr(s.name), t = s.mimeType.trim().toLowerCase();
6046
- if (!li.has(`${e}:${t}`))
6263
+ function Hs(s) {
6264
+ const e = lo(s.name), t = s.mimeType.trim().toLowerCase();
6265
+ if (!Ii.has(`${e}:${t}`))
6047
6266
  throw new Error("This attachment type is not supported by the embedded model provider");
6048
- if (s.sizeBytes <= 0 || s.sizeBytes >= ws)
6267
+ if (s.sizeBytes <= 0 || s.sizeBytes >= bs)
6049
6268
  throw new Error("Embedded attachments must be between 1 byte and less than 50 MB");
6050
6269
  }
6051
- function Yr(s) {
6270
+ function lo(s) {
6052
6271
  const e = s.trim().toLowerCase(), t = e.lastIndexOf(".");
6053
6272
  return t >= 0 ? e.slice(t) : "";
6054
6273
  }
6055
- function Zr(s) {
6274
+ function co(s) {
6056
6275
  const e = s.toLowerCase();
6057
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;
6058
6277
  }
6059
- function eo(s) {
6278
+ function uo(s) {
6060
6279
  if (!s || typeof s != "object")
6061
6280
  return null;
6062
6281
  const e = s;
@@ -6074,11 +6293,11 @@ function eo(s) {
6074
6293
  scheduledCheckInId: typeof e.scheduledCheckInId == "string" ? e.scheduledCheckInId : void 0,
6075
6294
  scheduledCheckInAt: typeof e.scheduledCheckInAt == "string" ? e.scheduledCheckInAt : void 0,
6076
6295
  securitySettingsUrl: typeof e.securitySettingsUrl == "string" ? e.securitySettingsUrl : void 0,
6077
- attachments: qs(e.attachments)?.map(qe),
6296
+ attachments: Ls(e.attachments)?.map(qe),
6078
6297
  loading: typeof e.loading == "boolean" ? e.loading : void 0
6079
6298
  };
6080
6299
  }
6081
- function to(s) {
6300
+ function ho(s) {
6082
6301
  return s.attachments?.length ? {
6083
6302
  ...s,
6084
6303
  attachments: s.attachments.map(qe)
@@ -6102,39 +6321,39 @@ function E(s) {
6102
6321
  const e = s.runId;
6103
6322
  return typeof e == "string" && e ? e : null;
6104
6323
  }
6105
- function so(s) {
6324
+ function po(s) {
6106
6325
  const e = s?.timeoutMs;
6107
- 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 <= Ri);
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);
6108
6327
  }
6109
- function Ls(s) {
6328
+ function Bs(s) {
6110
6329
  const e = {};
6111
6330
  try {
6112
6331
  new Headers(s).forEach((t, n) => {
6113
- Object.keys(e).length < wt && (e[n] = Rt(n, t));
6332
+ Object.keys(e).length < At && (e[n] = Et(n, t));
6114
6333
  });
6115
6334
  } catch {
6116
6335
  return {};
6117
6336
  }
6118
6337
  return e;
6119
6338
  }
6120
- function Rt(s, e) {
6121
- return $s(s) ? Be : F(xe(e), ci);
6339
+ function Et(s, e) {
6340
+ return Ks(s) ? Be : F(xe(e), Si);
6122
6341
  }
6123
- function no(s, e) {
6342
+ function go(s, e) {
6124
6343
  return typeof s == "string" ? s : s instanceof URL ? s.toString() : e?.url ?? "";
6125
6344
  }
6126
- async function io(s, e, t, n) {
6127
- const i = Ls(s.headers);
6345
+ async function fo(s, e, t, n) {
6346
+ const i = Bs(s.headers);
6128
6347
  n({
6129
6348
  ...e,
6130
6349
  responseStatus: s.status,
6131
6350
  responseHeaders: i,
6132
- responseBody: await ro(s),
6351
+ responseBody: await mo(s),
6133
6352
  durationMs: Date.now() - t
6134
6353
  });
6135
6354
  }
6136
- async function ro(s) {
6137
- if (!Ns(s.headers))
6355
+ async function mo(s) {
6356
+ if (!Fs(s.headers))
6138
6357
  return;
6139
6358
  let e = null, t = null;
6140
6359
  try {
@@ -6143,7 +6362,7 @@ async function ro(s) {
6143
6362
  const n = new Promise((a) => {
6144
6363
  t = window.setTimeout(() => {
6145
6364
  e?.cancel(), a("timeout");
6146
- }, ui);
6365
+ }, Ti);
6147
6366
  }), i = new TextDecoder();
6148
6367
  let r = "", o = 0;
6149
6368
  for (; ; ) {
@@ -6153,7 +6372,7 @@ async function ro(s) {
6153
6372
  const { done: l, value: c } = a;
6154
6373
  if (l)
6155
6374
  return F(r + i.decode());
6156
- const u = Tt - o;
6375
+ const u = wt - o;
6157
6376
  if (c.byteLength > u)
6158
6377
  return r += i.decode(c.subarray(0, Math.max(u, 0)), { stream: !0 }), e.cancel(), `${F(r)}... [truncated]`;
6159
6378
  o += c.byteLength, r += i.decode(c, { stream: !0 });
@@ -6165,26 +6384,26 @@ async function ro(s) {
6165
6384
  t !== null && window.clearTimeout(t);
6166
6385
  }
6167
6386
  }
6168
- function oo(s, e) {
6169
- if (Ns(new Headers(e)))
6387
+ function yo(s, e) {
6388
+ if (Fs(new Headers(e)))
6170
6389
  try {
6171
6390
  return s.responseType === "" || s.responseType === "text" ? F(s.responseText ?? "") : void 0;
6172
6391
  } catch {
6173
6392
  return;
6174
6393
  }
6175
6394
  }
6176
- function us(s) {
6395
+ function ps(s) {
6177
6396
  if (typeof s == "string")
6178
6397
  return F(s);
6179
6398
  }
6180
- function ao(s) {
6399
+ function Io(s) {
6181
6400
  return L({
6182
6401
  ...s,
6183
- requestBody: ds(s.requestBody),
6184
- responseBody: ds(s.responseBody)
6402
+ requestBody: gs(s.requestBody),
6403
+ responseBody: gs(s.responseBody)
6185
6404
  });
6186
6405
  }
6187
- function ds(s) {
6406
+ function gs(s) {
6188
6407
  if (typeof s != "string")
6189
6408
  return s;
6190
6409
  const e = s.trim();
@@ -6196,14 +6415,14 @@ function ds(s) {
6196
6415
  return xe(s);
6197
6416
  }
6198
6417
  }
6199
- function Ns(s) {
6418
+ function Fs(s) {
6200
6419
  if (!s)
6201
6420
  return !1;
6202
6421
  const e = s.get("content-type")?.toLowerCase() ?? "", t = s.get("content-length"), n = Number(t);
6203
- 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"));
6204
6423
  }
6205
6424
  function te(s, e = {}, t) {
6206
- if (co(t))
6425
+ if (To(t))
6207
6426
  return !0;
6208
6427
  const n = Object.entries(e).find(([i]) => i.toLowerCase() === "content-type")?.[1]?.toLowerCase();
6209
6428
  if (n?.includes("multipart/form-data") || n?.includes("application/octet-stream"))
@@ -6218,7 +6437,7 @@ function te(s, e = {}, t) {
6218
6437
  return !0;
6219
6438
  }
6220
6439
  }
6221
- function lo(s, e) {
6440
+ function So(s, e) {
6222
6441
  if (te(s))
6223
6442
  return !0;
6224
6443
  try {
@@ -6228,23 +6447,23 @@ function lo(s, e) {
6228
6447
  return !0;
6229
6448
  }
6230
6449
  }
6231
- function co(s) {
6450
+ function To(s) {
6232
6451
  return s instanceof FormData || s instanceof Blob || s instanceof ArrayBuffer || ArrayBuffer.isView(s) || typeof ReadableStream < "u" && s instanceof ReadableStream;
6233
6452
  }
6234
- function uo(s) {
6453
+ function wo(s) {
6235
6454
  const e = {};
6236
6455
  for (const t of s.trim().split(/[\r\n]+/)) {
6237
6456
  const n = t.indexOf(":");
6238
6457
  if (n <= 0)
6239
6458
  continue;
6240
- if (Object.keys(e).length >= wt)
6459
+ if (Object.keys(e).length >= At)
6241
6460
  break;
6242
6461
  const i = t.slice(0, n).trim();
6243
- e[i] = Rt(i, t.slice(n + 1).trim());
6462
+ e[i] = Et(i, t.slice(n + 1).trim());
6244
6463
  }
6245
6464
  return e;
6246
6465
  }
6247
- function F(s, e = Tt) {
6466
+ function F(s, e = wt) {
6248
6467
  return s.length <= e ? s : `${s.slice(0, e)}... [truncated ${s.length - e} chars]`;
6249
6468
  }
6250
6469
  function nt(s) {
@@ -6258,31 +6477,31 @@ class Pe extends Error {
6258
6477
  }
6259
6478
  async function be(s, e) {
6260
6479
  let t = null;
6261
- for (let n = 0; n < zt; n += 1)
6480
+ for (let n = 0; n < Vt; n += 1)
6262
6481
  try {
6263
6482
  return await s();
6264
6483
  } catch (i) {
6265
- if (t = i, n >= zt - 1 || !po(i))
6484
+ if (t = i, n >= Vt - 1 || !Mo(i))
6266
6485
  throw i;
6267
- await ho(n);
6486
+ await Ao(n);
6268
6487
  }
6269
6488
  throw t instanceof Error ? t : new Error(e);
6270
6489
  }
6271
- function ho(s) {
6490
+ function Ao(s) {
6272
6491
  return new Promise((e) => {
6273
- window.setTimeout(e, ai[s] ?? 0);
6492
+ window.setTimeout(e, yi[s] ?? 0);
6274
6493
  });
6275
6494
  }
6276
- function po(s) {
6277
- return s instanceof Pe ? go(s.status) : s instanceof TypeError;
6495
+ function Mo(s) {
6496
+ return s instanceof Pe ? bo(s.status) : s instanceof TypeError;
6278
6497
  }
6279
- function go(s) {
6498
+ function bo(s) {
6280
6499
  return s === 408 || s === 409 || s === 429 || s >= 500;
6281
6500
  }
6282
- function fo(s) {
6501
+ function Ro(s) {
6283
6502
  return s === 401 || s === 403;
6284
6503
  }
6285
- const Be = "[REDACTED_SECRET]", $ = "[REDACTED_TOKEN]", mo = "[REDACTED_SIGNED_URL]", yo = 20, Io = /^(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, So = /\bhttps?:\/\/[^\s"'<>]+(?:X-Amz-Signature|X-Goog-Signature|Signature|sig=)[^\s"'<>]*/gi, To = /\bhttps?:\/\/[^\s"'<>]+/gi, wo = /[),.;\]]+$/;
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 = /[),.;\]]+$/;
6286
6505
  function L(s) {
6287
6506
  return Oe(s, 0, /* @__PURE__ */ new WeakSet());
6288
6507
  }
@@ -6291,7 +6510,7 @@ function Oe(s, e, t) {
6291
6510
  return s.startsWith("data:image/") || s.startsWith("data:application/pdf;") ? s : xe(s);
6292
6511
  if (s === null || typeof s != "object")
6293
6512
  return s;
6294
- if (e >= yo)
6513
+ if (e >= ko)
6295
6514
  return "[REDACTED_MAX_DEPTH]";
6296
6515
  if (t.has(s))
6297
6516
  return "[REDACTED_CIRCULAR]";
@@ -6299,71 +6518,71 @@ function Oe(s, e, t) {
6299
6518
  return s.map((i) => Oe(i, e + 1, t));
6300
6519
  const n = {};
6301
6520
  for (const [i, r] of Object.entries(s))
6302
- i === "pageContent" ? n[i] = r : $s(i) ? n[i] = Be : n[i] = i.toLowerCase() === "url" ? Ao(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);
6303
6522
  return n;
6304
6523
  }
6305
- function $s(s) {
6524
+ function Ks(s) {
6306
6525
  const e = s.replace(/[^a-z0-9]/gi, "").toLowerCase();
6307
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");
6308
6527
  }
6309
- function Ao(s) {
6310
- 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());
6311
6530
  }
6312
- function js(s) {
6531
+ function Gs(s) {
6313
6532
  try {
6314
6533
  const e = new URL(s, location.href);
6315
6534
  for (const t of Array.from(e.searchParams.keys()))
6316
- Io.test(t) && e.searchParams.set(t, $);
6535
+ Co.test(t) && e.searchParams.set(t, $);
6317
6536
  return e.username && (e.username = $), e.password && (e.password = $), e.toString();
6318
6537
  } catch {
6319
- return Mo(s);
6538
+ return Do(s);
6320
6539
  }
6321
6540
  }
6322
6541
  function xe(s) {
6323
- return s.replace(So, mo).replace(To, bo).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}`);
6324
6543
  }
6325
- function Mo(s) {
6326
- 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}`);
6327
6546
  }
6328
- function bo(s) {
6329
- const e = s.match(wo)?.[0] ?? "", t = e ? s.slice(0, -e.length) : s;
6330
- 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}`;
6331
6550
  }
6332
- const Do = Object.freeze({
6551
+ const $o = Object.freeze({
6333
6552
  init: (s) => Ne.init(s)
6334
6553
  });
6335
- function qo(s) {
6554
+ function jo(s) {
6336
6555
  return Ne.init(s);
6337
6556
  }
6338
6557
  export {
6339
- Ht as PLUNO_PRODUCT_AGENT_WIDGET_HOST_SELECTOR,
6340
- xn as PLUNO_PRODUCT_AGENT_WIDGET_PANEL_SELECTOR,
6341
- On as PLUNO_PRODUCT_AGENT_WIDGET_ROOT_SELECTOR,
6342
- Ln as PLUNO_PRODUCT_AGENT_WIDGET_TIMELINE_SELECTOR,
6343
- Uo as PRODUCT_AGENT_PROVIDER_INPUT_ATTACHMENT_ACCEPT,
6344
- Do as PlunoProductAgent,
6345
- _n as ProductAgentInteractionManager,
6346
- xt as ProductAgentQueryController,
6347
- vo 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,
6348
6567
  Ne as ProductAgentSessionEngine,
6349
- En as ProductAgentSessionHistoryManager,
6350
- Co as ProductAgentTaskPageTitleController,
6351
- X as ProductAgentTokenProviderError,
6352
- fi as calculateReconnectDelay,
6353
- ko as createLocalStorageInteractionDecisionStorage,
6568
+ qn as ProductAgentSessionHistoryManager,
6569
+ No as ProductAgentTaskPageTitleController,
6570
+ J as ProductAgentTokenProviderError,
6571
+ Ri as calculateReconnectDelay,
6572
+ Lo as createLocalStorageInteractionDecisionStorage,
6354
6573
  Ee as createProductAgentQueryState,
6355
- qo as createProductAgentRuntime,
6356
- _o as createProductAgentTaskPageTitleDocument,
6357
- Do as default,
6358
- Dn as formatProductAgentTaskPageTitle,
6359
- Fi as getProductAgentOriginAccessErrorMessage,
6360
- Po as isProductAgentRuntimeCommand,
6361
- 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,
6362
6581
  ke as normalizeProductAgentEntityPage,
6363
6582
  st as normalizeProductAgentSessionItems,
6364
- Pn as readLocalStorageInteractionDecisions,
6365
- Eo as resolveProductAgentComposerAction,
6366
- Ro as resolveProductAgentWidgetPresentation,
6367
- Ss as selectProductAgentQueryEntities,
6368
- Jr as validateProductAgentProviderInputFile
6583
+ Nn as readLocalStorageInteractionDecisions,
6584
+ xo as resolveProductAgentComposerAction,
6585
+ Oo as resolveProductAgentWidgetPresentation,
6586
+ As as selectProductAgentQueryEntities,
6587
+ ao as validateProductAgentProviderInputFile
6369
6588
  };