@pluno/product-agent-web 0.1.251 → 0.1.253

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.
@@ -185,7 +185,7 @@ function Fi(s) {
185
185
  e ^= s.charCodeAt(t), e = Math.imul(e, 16777619);
186
186
  return `fnv1a-${(e >>> 0).toString(16).padStart(8, "0")}`;
187
187
  }
188
- const Es = "0.1.251", zi = {
188
+ const Es = "0.1.253", zi = {
189
189
  version: Es
190
190
  };
191
191
  function ze(s) {
@@ -404,15 +404,15 @@ function Ki(s, e) {
404
404
  updatedAt: t ? s.updatedAt : null
405
405
  };
406
406
  }
407
- function se(s) {
408
- return s !== null && typeof s == "object" && !Object.isFrozen(s) && (Object.values(s).forEach(se), Object.freeze(s)), s;
407
+ function ie(s) {
408
+ return s !== null && typeof s == "object" && !Object.isFrozen(s) && (Object.values(s).forEach(ie), Object.freeze(s)), s;
409
409
  }
410
410
  function J(s) {
411
411
  if (!je(s)) throw new Error("Conversation inputs must be JSON-safe values.");
412
412
  return JSON.parse(JSON.stringify(s));
413
413
  }
414
414
  function Wi(s = "", e = 0) {
415
- return se({ authorityId: s, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, checkpointEffectId: null, checkpointError: null });
415
+ return ie({ authorityId: s, generation: e, pendingRestoration: {}, proactiveQuestions: {}, sessions: {}, submissions: {}, submissionOrder: [], stops: {}, requests: {}, requestSequence: 0, deliveries: {}, operations: {}, effectsEnabled: !1, checkpointEffectId: null, checkpointError: null });
416
416
  }
417
417
  function es(s) {
418
418
  return {
@@ -543,7 +543,7 @@ function rs(s, e) {
543
543
  queries: { ...a.queries, [r.lane]: { ...c, requestId: null, status: c.data === null ? "not_requested" : "ready" } }
544
544
  } } };
545
545
  }
546
- return se(i);
546
+ return ie(i);
547
547
  }
548
548
  function Ge(s) {
549
549
  return JSON.stringify(s, (e, t) => t && typeof t == "object" && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([i], [n]) => i.localeCompare(n))) : t);
@@ -648,8 +648,8 @@ function hr(s, e, t, i) {
648
648
  if (t.clients[e.clientScopeId] !== e.conversationScopeId) throw new Error("Submission selection has changed.");
649
649
  const { type: a, authorityId: c, generation: d, prepareContext: l, ...u } = e, h = s.submissions[e.userMessageId];
650
650
  if (h) {
651
- const { contextPreparation: w, requestedModel: I, sessionId: _, delivery: A, cancelled: C, cancellationReason: M, error: ie, executionVersion: B, ...S } = h;
652
- if (Ge(S) !== Ge(u)) throw new Error("User-message identity cannot be reused with different input.");
651
+ const { contextPreparation: w, requestedModel: I, sessionId: _, delivery: E, cancelled: C, cancellationReason: M, error: te, executionVersion: B, ...W } = h;
652
+ if (Ge(W) !== Ge(u)) throw new Error("User-message identity cannot be reused with different input.");
653
653
  return { state: s, effects: r };
654
654
  }
655
655
  const p = t.selections[e.conversationScopeId], f = Object.values(s.submissions).find((w) => w.conversationScopeId === e.conversationScopeId && !w.cancelled && w.sessionId !== null), m = i.scopes[e.clientScopeId], g = {
@@ -750,7 +750,7 @@ function hr(s, e, t, i) {
750
750
  const c = a.sessionId ? n.sessions[a.sessionId]?.execution : null;
751
751
  c?.user_message_ids.includes(a.userMessageId) && a.executionVersion !== c.version && (n = { ...n, submissions: { ...n.submissions, [a.userMessageId]: { ...a, executionVersion: c.version } } });
752
752
  }
753
- return o && (n = { ...n, requestSequence: n.requestSequence + 1 }, r.push({ id: `conversation:${n.generation}:${n.requestSequence}`, kind: "conversation.interactions", input: o })), { state: se(n), effects: r };
753
+ return o && (n = { ...n, requestSequence: n.requestSequence + 1 }, r.push({ id: `conversation:${n.generation}:${n.requestSequence}`, kind: "conversation.interactions", input: o })), { state: ie(n), effects: r };
754
754
  }
755
755
  const Zs = (s, e) => ({
756
756
  acceptance: "unissued",
@@ -789,7 +789,7 @@ function Qi(s, e) {
789
789
  const u = l.command.payload.source;
790
790
  return !Object.values(s.submissions).some((h) => h.conversationScopeId === l.conversationScopeId && h.delivery === "accepted" && h.attachments.some((p) => p.sourceId === u.sourceId));
791
791
  }));
792
- return se({
792
+ return ie({
793
793
  schema: 1,
794
794
  authorityId: s.authorityId,
795
795
  submissions: r,
@@ -809,7 +809,7 @@ function he(s, e) {
809
809
  }
810
810
  function os(s, e, t, i = !1) {
811
811
  if (!e.effectsEnabled || !i && s.submissions === e.submissions && s.deliveries === e.deliveries && s.operations === e.operations && s.stops === e.stops && s.sessions === e.sessions) return { state: e, effects: [] };
812
- const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, o = se({ ...e, requestSequence: n, checkpointEffectId: r });
812
+ const n = e.requestSequence + 1, r = `conversation:${e.generation}:${n}`, o = ie({ ...e, requestSequence: n, checkpointEffectId: r });
813
813
  return { state: o, effects: [{ id: r, kind: "conversation.checkpoint", input: {
814
814
  authorityId: o.authorityId,
815
815
  generation: o.generation,
@@ -928,7 +928,7 @@ function cs(s) {
928
928
  }
929
929
  } }) : t.push({ id: h, kind: "conversation.command", input: { ...i, command: c.command } });
930
930
  }
931
- return { state: se(e), effects: t };
931
+ return { state: ie(e), effects: t };
932
932
  }
933
933
  function fr(s, e, t, i) {
934
934
  let n = s, r = e;
@@ -1038,18 +1038,18 @@ function fr(s, e, t, i) {
1038
1038
  error: v.contextPreparation === null && !v.cancelled ? { code: "context_preparation_interrupted", message: "Page context preparation was interrupted. Please send this message again.", retryable: !1 } : !l.deliveries[g] && v.delivery !== "accepted" && !v.cancelled ? { code: "submission_interrupted", message: "Message preparation was interrupted. Retry this message.", retryable: !0 } : v.error
1039
1039
  }])),
1040
1040
  deliveries: Object.fromEntries(Object.entries(l.submissions).map(([g, v], w) => {
1041
- const I = l.deliveries[g], _ = v.contextPreparation === null, A = v.delivery === "accepted" ? "accepted" : I?.acceptance ?? (I && (I.step === "send" || I.step === "receipt") ? "uncertain" : "unissued");
1041
+ const I = l.deliveries[g], _ = v.contextPreparation === null, E = v.delivery === "accepted" ? "accepted" : I?.acceptance ?? (I && (I.step === "send" || I.step === "receipt") ? "uncertain" : "unissued");
1042
1042
  return [g, {
1043
1043
  ...Zs(v, w),
1044
1044
  ...I,
1045
- acceptance: A,
1045
+ acceptance: E,
1046
1046
  allocation: v.sessionId !== null ? "resolved" : I?.allocation ?? (I?.step === "upload" ? "uncertain" : "unissued"),
1047
1047
  effectId: null,
1048
1048
  // Readiness is authority-local and must be re-established after restart. Captured input stays immutable.
1049
- step: A === "uncertain" && I?.step === "send" && I.phase !== "done" ? "receipt" : I?.step ?? null,
1050
- prepared: A === "accepted",
1049
+ step: E === "uncertain" && I?.step === "send" && I.phase !== "done" ? "receipt" : I?.step ?? null,
1050
+ prepared: E === "accepted",
1051
1051
  queuePosition: I?.queuePosition ?? w,
1052
- phase: A === "accepted" ? "done" : _ || !I ? "failed" : ["running", "waiting"].includes(I.phase) ? "uncertain" : I.phase
1052
+ phase: E === "accepted" ? "done" : _ || !I ? "failed" : ["running", "waiting"].includes(I.phase) ? "uncertain" : I.phase
1053
1053
  }];
1054
1054
  })),
1055
1055
  operations: Object.fromEntries(Object.entries(l.operations).map(([g, v]) => [g, {
@@ -1227,7 +1227,7 @@ function Q(s) {
1227
1227
  const e = s.runtime(), t = e.engine.getState().slices.directory;
1228
1228
  return !e.isDisposed && (s.isCurrent?.() ?? !0) && t.authorityId === s.authority.authorityId && t.generation === s.authority.generation;
1229
1229
  }
1230
- function K(s, e) {
1230
+ function H(s, e) {
1231
1231
  if (!Q(s) || e.authorityId !== s.authority.authorityId || e.generation !== s.authority.generation)
1232
1232
  throw Object.assign(new Error("Conversation authority was retired."), { code: "authority_retired", retryable: !0 });
1233
1233
  }
@@ -1252,7 +1252,7 @@ function fe(s, e) {
1252
1252
  function mr(s) {
1253
1253
  let e = Promise.resolve();
1254
1254
  const t = (o = Qi(s.runtime().engine.getState().slices.conversation, s.runtime().engine.getState().slices.directory)) => {
1255
- const a = () => (K(s, s.authority), s.saveDelivery(o));
1255
+ const a = () => (H(s, s.authority), s.saveDelivery(o));
1256
1256
  return e = e.then(a, a), e;
1257
1257
  }, i = (o, a) => {
1258
1258
  throw Q(s) && !(o instanceof Error && "code" in o && ["executor_not_ready", "request_timed_out"].includes(String(o.code))) && s.onError?.(o, a), fe(o, a);
@@ -1260,7 +1260,7 @@ function mr(s) {
1260
1260
  const { token: o, protocol: a, ...c } = s.http.auth;
1261
1261
  return { ...c, ...s.connectionId() ? { connection_id: s.connectionId() } : {} };
1262
1262
  }, r = (o) => {
1263
- if (K(s, s.authority), s.runtime().engine.getState().slices.conversation.submissions[o]?.cancelled)
1263
+ if (H(s, s.authority), s.runtime().engine.getState().slices.conversation.submissions[o]?.cancelled)
1264
1264
  throw Object.assign(new Error("Submission was cancelled."), { code: "submission_cancelled", retryable: !1 });
1265
1265
  };
1266
1266
  return {
@@ -1282,7 +1282,7 @@ function mr(s) {
1282
1282
  clearTimeout(a), d();
1283
1283
  });
1284
1284
  },
1285
- "conversation.checkpoint": async (o) => (K(s, o), await t(o.checkpoint).catch((a) => i(a, { operation: "conversation.checkpoint" })), K(s, o), null),
1285
+ "conversation.checkpoint": async (o) => (H(s, o), await t(o.checkpoint).catch((a) => i(a, { operation: "conversation.checkpoint" })), H(s, o), null),
1286
1286
  "conversation.receipt": (o) => ee(s.onTiming, {
1287
1287
  operation: "send",
1288
1288
  layer: "http",
@@ -1290,13 +1290,13 @@ function mr(s) {
1290
1290
  clientMessageId: o.userMessageId,
1291
1291
  sessionId: o.sessionId
1292
1292
  }).measure("receipt_http", () => Promise.resolve().then(async () => {
1293
- K(s, o);
1293
+ H(s, o);
1294
1294
  const a = await s.http.request("/receipt", {}, {
1295
1295
  context: n(),
1296
1296
  session_id: o.sessionId,
1297
1297
  client_message_id: o.userMessageId
1298
1298
  }, "POST", "conversations", { readOnly: !0 });
1299
- if (K(s, o), a !== null && (typeof a.sessionId != "string" || !a.sessionId || a.clientMessageId !== o.userMessageId || o.sessionId !== null && a.sessionId !== o.sessionId)) throw Object.assign(new Error("Conversation receipt identity mismatch."), { code: "acceptance_identity_mismatch" });
1299
+ if (H(s, o), a !== null && (typeof a.sessionId != "string" || !a.sessionId || a.clientMessageId !== o.userMessageId || o.sessionId !== null && a.sessionId !== o.sessionId)) throw Object.assign(new Error("Conversation receipt identity mismatch."), { code: "acceptance_identity_mismatch" });
1300
1300
  return a !== null && ee(s.onTiming, {
1301
1301
  operation: "send",
1302
1302
  layer: "http",
@@ -1308,7 +1308,7 @@ function mr(s) {
1308
1308
  "conversation.command": (o) => {
1309
1309
  let a = !1;
1310
1310
  return Promise.resolve().then(async () => {
1311
- K(s, o), (o.command.type === "chat.user_message" || o.command.type === "attachment.upload_completed") && r(String(o.command.payload.clientMessageId));
1311
+ H(s, o), (o.command.type === "chat.user_message" || o.command.type === "attachment.upload_completed") && r(String(o.command.payload.clientMessageId));
1312
1312
  const c = o.command.payload, d = ee(["chat.user_message", "chat.retry_last_user_message", "run.stop", "attachment.upload_completed"].includes(o.command.type) ? s.onTiming : void 0, {
1313
1313
  operation: o.command.type === "run.stop" ? "stop" : "send",
1314
1314
  layer: "http",
@@ -1316,7 +1316,7 @@ function mr(s) {
1316
1316
  clientMessageId: String(c.clientMessageId ?? c.expectedUserMessageId ?? o.command.request_id),
1317
1317
  sessionId: typeof c.sessionId == "string" ? c.sessionId : null
1318
1318
  });
1319
- return await d.measure("checkpoint", () => t()), K(s, o), (o.command.type === "chat.user_message" || o.command.type === "attachment.upload_completed") && r(String(o.command.payload.clientMessageId)), s.onCommand?.(o.command), a = !0, await d.measure("command_http", async () => {
1319
+ return await d.measure("checkpoint", () => t()), H(s, o), (o.command.type === "chat.user_message" || o.command.type === "attachment.upload_completed") && r(String(o.command.payload.clientMessageId)), s.onCommand?.(o.command), a = !0, await d.measure("command_http", async () => {
1320
1320
  const l = await s.http.request(
1321
1321
  "/commands",
1322
1322
  {},
@@ -1325,7 +1325,7 @@ function mr(s) {
1325
1325
  "conversations",
1326
1326
  { timing: d }
1327
1327
  );
1328
- if (K(s, o), l.request_id !== o.command.request_id || !je(l.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
1328
+ if (H(s, o), l.request_id !== o.command.request_id || !je(l.result)) throw Object.assign(new Error("Conversation response identity mismatch."), { code: "acceptance_identity_mismatch" });
1329
1329
  if (o.command.type.startsWith("chat.")) {
1330
1330
  const u = l.result;
1331
1331
  if (typeof u?.sessionId != "string" || !u.sessionId || u.clientMessageId !== o.command.payload.clientMessageId || o.command.payload.sessionId && u.sessionId !== o.command.payload.sessionId) throw Object.assign(new Error("Conversation acceptance identity mismatch."), { code: "acceptance_identity_mismatch" });
@@ -1362,7 +1362,7 @@ function mr(s) {
1362
1362
  sessionId: o.submission.sessionId
1363
1363
  }).measure("attachment_upload", () => Promise.resolve().then(async () => {
1364
1364
  const c = () => {
1365
- if (K(s, o), !o.preparationId) return r(o.submission.userMessageId);
1365
+ if (H(s, o), !o.preparationId) return r(o.submission.userMessageId);
1366
1366
  const f = s.runtime().engine.getState().slices.directory;
1367
1367
  if (!Object.values(f.clients).includes(o.submission.conversationScopeId))
1368
1368
  throw Object.assign(new Error("Attachment preparation was cancelled."), { code: "submission_cancelled", retryable: !1 });
@@ -1412,7 +1412,7 @@ function mr(s) {
1412
1412
  }));
1413
1413
  },
1414
1414
  "conversation.snapshot": (o) => Promise.resolve().then(async () => {
1415
- K(s, o);
1415
+ H(s, o);
1416
1416
  const a = s.runtime(), c = new AbortController(), d = () => {
1417
1417
  const h = a.engine.getState().slices;
1418
1418
  Q(s) ? h.directory.memberships[o.sessionId]?.members.length ? h.conversation.sessions[o.sessionId]?.queries[o.lane].requestId !== o.requestId && c.abort("request_replaced") : c.abort("observation_released") : c.abort("authority_retired");
@@ -1421,7 +1421,7 @@ function mr(s) {
1421
1421
  try {
1422
1422
  const h = [];
1423
1423
  for (let g = 0; g < Math.max(1, o.refreshItemIds.length); g += 200) {
1424
- if (K(s, o), !s.runtime().engine.getState().slices.directory.memberships[o.sessionId]?.members.length) throw new Error("Conversation observation was retired.");
1424
+ if (H(s, o), !s.runtime().engine.getState().slices.directory.memberships[o.sessionId]?.members.length) throw new Error("Conversation observation was retired.");
1425
1425
  const v = await s.http.request(
1426
1426
  `/${encodeURIComponent(o.sessionId)}/snapshot`,
1427
1427
  {},
@@ -1439,7 +1439,7 @@ function mr(s) {
1439
1439
  const I = fe(w);
1440
1440
  throw Object.assign(I, { details: { ...I.details, successfulRequests: h.length } });
1441
1441
  });
1442
- if (K(s, o), v.conversation_id !== o.sessionId) throw new Error("Snapshot conversation identity mismatch.");
1442
+ if (H(s, o), v.conversation_id !== o.sessionId) throw new Error("Snapshot conversation identity mismatch.");
1443
1443
  if (h.push(v), !v.projection_ready) break;
1444
1444
  }
1445
1445
  const p = h[0];
@@ -1587,15 +1587,15 @@ class gr {
1587
1587
  }
1588
1588
  }
1589
1589
  function Re(s, e, t) {
1590
- const i = s.submissionOrder.map((y) => s.submissions[y]).filter((y) => y.conversationScopeId === t), n = e.selections[t]?.sessionId ?? i.find((y) => !y.cancelled && y.sessionId !== null)?.sessionId ?? null, r = n ? s.sessions[n] : void 0, o = s.submissionOrder.map((y) => s.submissions[y]).filter((y) => n ? y.sessionId === n || y.sessionId === null && y.conversationScopeId === t : y.conversationScopeId === t), a = Object.values(r?.items ?? {}).sort((y, q) => {
1591
- const O = re(y.created_at), L = re(q.created_at);
1592
- return O < L ? -1 : O > L ? 1 : y.id < q.id ? -1 : y.id > q.id ? 1 : 0;
1590
+ const i = s.submissionOrder.map((y) => s.submissions[y]).filter((y) => y.conversationScopeId === t), n = e.selections[t]?.sessionId ?? i.find((y) => !y.cancelled && y.sessionId !== null)?.sessionId ?? null, r = n ? s.sessions[n] : void 0, o = s.submissionOrder.map((y) => s.submissions[y]).filter((y) => n ? y.sessionId === n || y.sessionId === null && y.conversationScopeId === t : y.conversationScopeId === t), a = Object.values(r?.items ?? {}).sort((y, T) => {
1591
+ const O = re(y.created_at), L = re(T.created_at);
1592
+ return O < L ? -1 : O > L ? 1 : y.id < T.id ? -1 : y.id > T.id ? 1 : 0;
1593
1593
  }), c = o.filter((y) => (!y.cancelled || y.conversationScopeId === t && (y.sessionId === null || y.sessionId === n || n === null && y === o[o.length - 1])) && !r?.items[y.userMessageId] && !r?.removedItems[y.userMessageId]), d = {};
1594
1594
  for (const y of a) {
1595
- const q = pt(y);
1596
- if (q === null) continue;
1595
+ const T = pt(y);
1596
+ if (T === null) continue;
1597
1597
  const O = r?.streams[y.id];
1598
- d[y.id] = O ? O.state === "open" ? "open" : q < O.revision ? "awaiting_content" : O.state : "open";
1598
+ d[y.id] = O ? O.state === "open" ? "open" : T < O.revision ? "awaiting_content" : O.state : "open";
1599
1599
  }
1600
1600
  const l = [];
1601
1601
  for (const y of a)
@@ -1603,15 +1603,15 @@ function Re(s, e, t) {
1603
1603
  l.push({ id: y.id, userMessageId: y.id, activityIds: [], outcomeIds: [], collapsed: !1 });
1604
1604
  else {
1605
1605
  l.length || l.push({ id: `leading:${y.id}`, userMessageId: null, activityIds: [], outcomeIds: [], collapsed: !1 });
1606
- const q = l.length - 1, O = l[q], L = y.type === "commentary" || y.type === "tool_summary" ? "activityIds" : "outcomeIds";
1607
- l[q] = { ...O, [L]: [...O[L], y.id] };
1606
+ const T = l.length - 1, O = l[T], L = y.type === "commentary" || y.type === "tool_summary" ? "activityIds" : "outcomeIds";
1607
+ l[T] = { ...O, [L]: [...O[L], y.id] };
1608
1608
  }
1609
1609
  for (const y of c) {
1610
- const q = l.findIndex((O) => {
1610
+ const T = l.findIndex((O) => {
1611
1611
  const L = o.find((Ke) => Ke.userMessageId === O.userMessageId), ke = r?.items[O.userMessageId ?? O.activityIds[0] ?? O.outcomeIds[0]];
1612
1612
  return (L?.submittedAt ?? (ke ? Date.parse(ke.created_at) : 1 / 0)) > y.submittedAt;
1613
1613
  });
1614
- l.splice(q < 0 ? l.length : q, 0, {
1614
+ l.splice(T < 0 ? l.length : T, 0, {
1615
1615
  id: y.userMessageId,
1616
1616
  userMessageId: y.userMessageId,
1617
1617
  activityIds: [],
@@ -1621,17 +1621,17 @@ function Re(s, e, t) {
1621
1621
  }
1622
1622
  const u = r?.execution, h = o.filter((y) => !y.cancelled && y.delivery !== "failed"), p = h.filter((y) => y.delivery !== "accepted" && y.executionVersion === null), f = h.filter((y) => y.delivery === "accepted" && y.executionVersion === null), m = h[h.length - 1], g = p.length > 0, v = m !== void 0 && f.includes(m);
1623
1623
  let w = g ? "submitting" : v ? "awaiting_execution" : u?.phase ?? "idle";
1624
- const I = Object.entries(s.stops).filter(([y]) => y === t || n !== null && e.selections[y]?.sessionId === n).map(([, y]) => y).find((y) => (!o.length || y.userMessageIds.includes(o[o.length - 1].userMessageId) || !g && !v && oe(u).some((q) => y.userMessageIds.includes(q))) && (!u || u.version <= y.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(u.phase) || o.some((q) => q.cancelled && q.executionVersion === null && y.userMessageIds.includes(q.userMessageId)))), _ = u && ["thinking", "steering", "queued", "stopping"].includes(u.phase) || o.some((y) => y.delivery === "accepted" && y.executionVersion === null && I?.userMessageIds.includes(y.userMessageId));
1624
+ const I = Object.entries(s.stops).filter(([y]) => y === t || n !== null && e.selections[y]?.sessionId === n).map(([, y]) => y).find((y) => (!o.length || y.userMessageIds.includes(o[o.length - 1].userMessageId) || !g && !v && oe(u).some((T) => y.userMessageIds.includes(T))) && (!u || u.version <= y.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(u.phase) || o.some((T) => T.cancelled && T.executionVersion === null && y.userMessageIds.includes(T.userMessageId)))), _ = u && ["thinking", "steering", "queued", "stopping"].includes(u.phase) || o.some((y) => y.delivery === "accepted" && y.executionVersion === null && I?.userMessageIds.includes(y.userMessageId));
1625
1625
  I && _ && !g && (!u || !["thinking", "steering", "queued", "stopping"].includes(u.phase) || oe(u).every((y) => I.userMessageIds.includes(y))) && (w = "stopping"), I && !_ && !g && o.some((y) => y.cancelled && y.executionVersion === null && I.userMessageIds.includes(y.userMessageId)) && (w = o.some((y) => I.userMessageIds.includes(y.userMessageId) && ["sending", "uncertain"].includes(y.delivery)) ? "stopping" : "stopped");
1626
- const A = ["thinking", "steering", "queued"].includes(w), C = s.stops[t] ?? I, M = C?.userMessageIds.filter((y) => !["completed", "failed"].includes(r?.executionByUserMessage[y]?.phase ?? "")) ?? [], ie = M.some((y) => {
1627
- const q = o.find((L) => L.userMessageId === y);
1628
- return !Object.values(s.operations).some((L) => L.command.type === "run.stop" && L.command.payload.expectedUserMessageId === y && L.phase === "done") && (q?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(q.delivery) || !!(u && oe(u).includes(y) && ["thinking", "steering", "queued", "stopping"].includes(u.phase)));
1629
- }), B = u?.user_message_ids ?? [], S = g || v ? m?.userMessageId ?? null : B[B.length - 1] ?? null, k = l.find((y) => y.userMessageId === S), T = A ? [...k?.activityIds ?? []].reverse().find((y) => d[y] === "open") ?? null : null, F = n !== null && !!e.selections[t]?.provisionalId && a.length === 0 && o.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1626
+ const E = ["thinking", "steering", "queued"].includes(w), C = s.stops[t] ?? I, M = C?.userMessageIds.filter((y) => !["completed", "failed"].includes(r?.executionByUserMessage[y]?.phase ?? "")) ?? [], te = M.some((y) => {
1627
+ const T = o.find((L) => L.userMessageId === y);
1628
+ return !Object.values(s.operations).some((L) => L.command.type === "run.stop" && L.command.payload.expectedUserMessageId === y && L.phase === "done") && (T?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(T.delivery) || !!(u && oe(u).includes(y) && ["thinking", "steering", "queued", "stopping"].includes(u.phase)));
1629
+ }), B = u?.user_message_ids ?? [], W = g || v ? m?.userMessageId ?? null : B[B.length - 1] ?? null, S = l.find((y) => y.userMessageId === W), q = E ? [...S?.activityIds ?? []].reverse().find((y) => d[y] === "open") ?? null : null, A = n !== null && !!e.selections[t]?.provisionalId && a.length === 0 && o.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
1630
1630
  (!r?.execution || r.execution.phase === "idle" && r.execution.user_message_ids.length === 0) && Object.values(s.operations).some((y) => y.conversationScopeId === t && y.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(y.command.type) && !y.command.payload.sessionId && y.result?.sessionId === n);
1631
- return se({
1631
+ return ie({
1632
1632
  historyRefreshFailure: r?.historyRefreshFailure ?? null,
1633
1633
  selectionKey: t ? JSON.stringify([s.authorityId, s.generation, t]) : void 0,
1634
- isDraftSession: F,
1634
+ isDraftSession: A,
1635
1635
  proactiveQuestion: s.proactiveQuestions[t] ?? null,
1636
1636
  sessionId: n,
1637
1637
  items: a,
@@ -1643,9 +1643,9 @@ function Re(s, e, t) {
1643
1643
  removedItems: r?.removedItems ?? {},
1644
1644
  streamStates: d,
1645
1645
  preparation: r?.preparation ?? null,
1646
- stop: C ? { ...C, userMessageIds: M, pending: ie } : null,
1647
- segments: l.map((y, q) => ({ ...y, collapsed: A ? y.userMessageId !== S : q < l.length - 1 || y.activityIds.length > 0 })),
1648
- activity: { phase: w, activeItemId: T, userMessageId: S, executionKey: JSON.stringify([...oe(u)].sort()) },
1646
+ stop: C ? { ...C, userMessageIds: M, pending: te } : null,
1647
+ segments: l.map((y, T) => ({ ...y, collapsed: E ? y.userMessageId !== W : T < l.length - 1 || y.activityIds.length > 0 })),
1648
+ activity: { phase: w, activeItemId: q, userMessageId: W, executionKey: JSON.stringify([...oe(u)].sort()) },
1649
1649
  // Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
1650
1650
  // the same submitted text in the optimistic transcript and composer during delivery.
1651
1651
  receipts: i.filter((y) => !y.cancelled && e.clients[y.clientScopeId] === t).map((y) => ({ viewId: y.viewId, userMessageId: y.userMessageId, acceptedRendererRevision: y.rendererRevision }))
@@ -1665,7 +1665,7 @@ function Xi(s, e) {
1665
1665
  return s.sessionId && o ? { type: "execution", userMessageId: o, sessionId: s.sessionId } : null;
1666
1666
  }
1667
1667
  function yr(s, e) {
1668
- return se({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, Re(s, e, t)])) });
1668
+ return ie({ scopes: Object.fromEntries([...new Set(Object.values(e.clients))].map((t) => [t, Re(s, e, t)])) });
1669
1669
  }
1670
1670
  function vr(s, e) {
1671
1671
  if (!e) return !1;
@@ -2042,19 +2042,19 @@ const Tr = "Pluno is reconnecting. Try again in a moment.";
2042
2042
  function kr(s) {
2043
2043
  return (s instanceof Error ? s.message : s) === Tr;
2044
2044
  }
2045
- const te = /* @__PURE__ */ Object.create(null);
2046
- te.open = "0";
2047
- te.close = "1";
2048
- te.ping = "2";
2049
- te.pong = "3";
2050
- te.message = "4";
2051
- te.upgrade = "5";
2052
- te.noop = "6";
2045
+ const se = /* @__PURE__ */ Object.create(null);
2046
+ se.open = "0";
2047
+ se.close = "1";
2048
+ se.ping = "2";
2049
+ se.pong = "3";
2050
+ se.message = "4";
2051
+ se.upgrade = "5";
2052
+ se.noop = "6";
2053
2053
  const rt = /* @__PURE__ */ Object.create(null);
2054
- Object.keys(te).forEach((s) => {
2055
- rt[te[s]] = s;
2054
+ Object.keys(se).forEach((s) => {
2055
+ rt[se[s]] = s;
2056
2056
  });
2057
- const ls = { type: "error", data: "parser error" }, Yi = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Zi = typeof ArrayBuffer == "function", en = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, ks = ({ type: s, data: e }, t, i) => Yi && e instanceof Blob ? t ? i(e) : ni(e, i) : Zi && (e instanceof ArrayBuffer || en(e)) ? t ? i(e) : ni(new Blob([e]), i) : i(te[s] + (e || "")), ni = (s, e) => {
2057
+ const ls = { type: "error", data: "parser error" }, Yi = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Zi = typeof ArrayBuffer == "function", en = (s) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(s) : s && s.buffer instanceof ArrayBuffer, ks = ({ type: s, data: e }, t, i) => Yi && e instanceof Blob ? t ? i(e) : ni(e, i) : Zi && (e instanceof ArrayBuffer || en(e)) ? t ? i(e) : ni(new Blob([e]), i) : i(se[s] + (e || "")), ni = (s, e) => {
2058
2058
  const t = new FileReader();
2059
2059
  return t.onload = function() {
2060
2060
  const i = t.result.split(",")[1];
@@ -4732,15 +4732,15 @@ class hn {
4732
4732
  }
4733
4733
  async requestOnce(e, t, i, n, r, o, a, c = 1) {
4734
4734
  const d = this.auth.client_kind === "embed", l = new URL(`/api/product-agent/${r ?? (d ? "embed" : "runtime")}${e}`, this.options.backendUrl), u = r === "conversations" ? {} : d ? { client_id: this.auth.client_id, transport_id: this.auth.transport_id } : { community_id: this.auth.community_id, automation_run_id: this.auth.automation_run_id };
4735
- for (const [S, k] of Object.entries({ ...u, ...t }))
4736
- k != null && l.searchParams.set(S, String(k));
4735
+ for (const [S, q] of Object.entries({ ...u, ...t }))
4736
+ q != null && l.searchParams.set(S, String(q));
4737
4737
  this.requests.signal.throwIfAborted(), o?.throwIfAborted();
4738
4738
  const h = new AbortController(), p = { trigger: null }, f = (S) => {
4739
4739
  h.signal.aborted || (p.trigger = S, h.abort());
4740
4740
  }, m = () => f("transport_disposed"), g = () => f(["owner_disposed", "authority_retired", "observation_released", "request_replaced"].includes(o?.reason) ? o.reason : "caller_cancelled");
4741
4741
  this.requests.signal.addEventListener("abort", m, { once: !0 }), o?.addEventListener("abort", g, { once: !0 });
4742
- const v = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", w = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", I = setTimeout(() => f("deadline"), w ? 6e4 : v ? 3e4 : 15e3), _ = Eo(), A = Date.now();
4743
- let C = null, M = null, ie = null, B = null;
4742
+ const v = r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) && n === "POST", w = /^\/conversations(?:\/[^/]+)?$/.test(e) && (n ?? (i === void 0 ? "GET" : "POST")) === "GET", I = setTimeout(() => f("deadline"), w ? 6e4 : v ? 3e4 : 15e3), _ = Eo(), E = Date.now();
4743
+ let C = null, M = !1, te = null, B = null, W = null;
4744
4744
  try {
4745
4745
  const S = await Promise.resolve(fetch(l, {
4746
4746
  method: n ?? (i === void 0 ? "GET" : "POST"),
@@ -4748,62 +4748,64 @@ class hn {
4748
4748
  signal: h.signal,
4749
4749
  headers: { "x-product-agent-auth-request-id": _, authorization: d || r === "conversations" ? `Bearer ${this.auth.token}` : this.auth.token, "content-type": "application/json", ...v ? { "x-request-id": _ } : {} },
4750
4750
  ...i === void 0 ? {} : { body: JSON.stringify(i) }
4751
- })).catch((k) => {
4752
- throw v && k instanceof TypeError ? new b("The connection was interrupted. Please try again.", "connection_interrupted", !0) : k;
4751
+ })).catch((q) => {
4752
+ throw M = !0, q;
4753
4753
  });
4754
- if (C = Date.now(), M = S.status, ie = li(S.headers.get("x-request-id")), B = li(S.headers.get("x-cloud-trace-context")), !S.ok) {
4755
- const k = S.status === 401 ? "unauthorized" : S.status === 426 ? "update_required" : String(S.status), T = (await S.json().catch(() => null))?.detail;
4756
- if (r === "conversations" && e.endsWith("/snapshot") && S.status === 409 && T === "Display projection is not enabled")
4754
+ if (C = Date.now(), te = S.status, B = li(S.headers.get("x-request-id")), W = li(S.headers.get("x-cloud-trace-context")), !S.ok) {
4755
+ const q = S.status === 401 ? "unauthorized" : S.status === 426 ? "update_required" : String(S.status), A = (await S.json().catch(() => null))?.detail;
4756
+ if (d && S.status === 403 && (r === "conversations" && /^\/[^/]+\/snapshot$/.test(e) || (!r || r === "embed") && /^\/conversations\/[^/]+$/.test(e)) && ["Conversation unavailable", "Integration mismatch", "Embedded origin mismatch"].includes(A))
4757
+ throw new b("Conversation unavailable", "conversation_access_denied");
4758
+ if (r === "conversations" && e.endsWith("/snapshot") && S.status === 409 && A === "Display projection is not enabled")
4757
4759
  throw new b("Conversation history is unavailable. Try loading this chat again after the service is ready.", "display_projection_disabled");
4758
- if (r === "conversations" && e === "/commands" && (S.status === 409 && T?.code === "executor_not_ready" && T.retryable === !0 || S.status === 403 && T === "Register the executor before commands"))
4760
+ if (r === "conversations" && e === "/commands" && (S.status === 409 && A?.code === "executor_not_ready" && A.retryable === !0 || S.status === 403 && A === "Register the executor before commands"))
4759
4761
  throw new b("Reconnecting the browser before continuing.", "executor_not_ready");
4760
- if (S.status !== 401 && T && typeof T == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(T.code) || !nt(void 0, T.code).allowed) && typeof T.message == "string")
4761
- throw new b(T.message, T.code, !1, {
4762
- ...typeof T.blockedOrigin == "string" ? { blockedOrigin: T.blockedOrigin } : {},
4763
- ...typeof T.securitySettingsUrl == "string" ? { securitySettingsUrl: T.securitySettingsUrl } : {}
4762
+ if (S.status !== 401 && A && typeof A == "object" && (["service_origin_not_allowed", "security_control_enforcement_unavailable"].includes(A.code) || !nt(void 0, A.code).allowed) && typeof A.message == "string")
4763
+ throw new b(A.message, A.code, !1, {
4764
+ ...typeof A.blockedOrigin == "string" ? { blockedOrigin: A.blockedOrigin } : {},
4765
+ ...typeof A.securitySettingsUrl == "string" ? { securitySettingsUrl: A.securitySettingsUrl } : {}
4764
4766
  }, r === "conversations" && e === "/commands");
4765
- const F = T === "Token expired" ? "token_expired" : T === "Invalid token" ? "invalid_token" : T?.reason, y = S.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(F) ? { requestId: _, authTransport: "http", authEndpoint: `${r ?? (d ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: F, retryable: F === "token_expired" && (T === "Token expired" || T.retryable === !0) } : void 0;
4766
- throw new b(S.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : S.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${S.status})`, k, !1, y);
4767
+ const y = A === "Token expired" ? "token_expired" : A === "Invalid token" ? "invalid_token" : A?.reason, T = S.status === 401 && ["missing_token", "token_expired", "invalid_token", "user_not_found"].includes(y) ? { requestId: _, authTransport: "http", authEndpoint: `${r ?? (d ? "embed" : "runtime")}:${["snapshot", "me", "bootstrap", "commands", "activity", "session-history"].includes(e.split("/").pop()) ? e.split("/").pop() : "other"}`, reason: y, retryable: y === "token_expired" && (A === "Token expired" || A.retryable === !0) } : void 0;
4768
+ throw new b(S.status === 401 ? "Your session expired or is invalid. Reconnect to continue." : S.status === 403 ? "You don't have access to this conversation. Check your access and reconnect." : `Product Agent request failed (${S.status})`, q, !1, T);
4767
4769
  }
4768
4770
  return await S.json();
4769
4771
  } catch (S) {
4770
- const k = p.trigger ?? ((S instanceof Error || S instanceof DOMException) && S.name === "AbortError" ? "unexpected_abort" : null), T = {
4772
+ const q = p.trigger ?? ((S instanceof Error || S instanceof DOMException) && S.name === "AbortError" ? "unexpected_abort" : null), A = {
4771
4773
  requestId: _,
4772
4774
  method: n ?? (i === void 0 ? "GET" : "POST"),
4773
4775
  route: v ? "/api/product-agent/conversations/:sessionId/snapshot" : e === "/commands" ? "/api/product-agent/:namespace/commands" : "/api/product-agent/:namespace/:operation",
4774
- status: M,
4775
- abortTrigger: k,
4776
- category: k === "deadline" ? "request_timed_out" : k === "unexpected_abort" ? "connection_interrupted" : k ? "request_cancelled" : S instanceof b ? S.code : "invalid_response",
4777
- responseHeadersMs: C === null ? null : Math.max(0, C - A),
4776
+ status: te,
4777
+ abortTrigger: q,
4778
+ category: q === "deadline" ? "request_timed_out" : q === "unexpected_abort" ? "connection_interrupted" : q ? "request_cancelled" : S instanceof b ? S.code : M ? "connection_interrupted" : "invalid_response",
4779
+ responseHeadersMs: C === null ? null : Math.max(0, C - E),
4778
4780
  responseBodyMs: C === null ? null : Math.max(0, Date.now() - C),
4779
- owner: k === "deadline" ? "http_deadline" : k === "transport_disposed" ? "http_transport" : k && k !== "unexpected_abort" ? "conversation_query" : M === null ? "browser" : "http_response",
4780
- elapsedMs: Math.max(0, Date.now() - A),
4781
+ owner: q === "deadline" ? "http_deadline" : q === "transport_disposed" ? "http_transport" : q && q !== "unexpected_abort" ? "conversation_query" : te === null ? "browser" : "http_response",
4782
+ elapsedMs: Math.max(0, Date.now() - E),
4781
4783
  attempt: c,
4782
4784
  queryRequestId: P(a?.queryRequestId),
4783
4785
  ownerId: P(a?.ownerId),
4784
4786
  authorityGeneration: a?.authorityGeneration ?? null,
4785
4787
  sessionId: P(a?.sessionId),
4786
4788
  release: this.auth.extension_version ? `extension-${this.auth.extension_version}` : `sdk-${zi.version}`,
4787
- upstreamRequestId: ie,
4788
- upstreamTraceId: B
4789
+ upstreamRequestId: B,
4790
+ upstreamTraceId: W
4789
4791
  };
4790
- de(T) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(T) : console.warn("Product Agent HTTP request failed", T)).catch(() => {
4792
+ de(A) && Promise.resolve().then(() => this.options.onRequestFailure ? this.options.onRequestFailure(A) : console.warn("Product Agent HTTP request failed", A)).catch(() => {
4791
4793
  });
4792
- const F = de(T) ? { httpRequest: T } : void 0;
4793
- if (k !== null) {
4794
- const y = k !== "deadline" && k !== "unexpected_abort";
4794
+ const y = de(A) ? { httpRequest: A } : void 0;
4795
+ if (q !== null) {
4796
+ const T = q !== "deadline" && q !== "unexpected_abort";
4795
4797
  throw new b(
4796
- y ? "The request was cancelled." : k === "deadline" ? "The request timed out. Please try again." : "The connection was interrupted. Please try again.",
4797
- y ? "request_cancelled" : k === "deadline" ? "request_timed_out" : "connection_interrupted",
4798
+ T ? "The request was cancelled." : q === "deadline" ? "The request timed out. Please try again." : "The connection was interrupted. Please try again.",
4799
+ T ? "request_cancelled" : q === "deadline" ? "request_timed_out" : "connection_interrupted",
4798
4800
  !0,
4799
- F
4801
+ y
4800
4802
  );
4801
4803
  }
4802
- throw S instanceof b && F ? new b(S.message, S.code, S.outcomeUnknown, { ...S.detail, ...F }, S.backendRefusal) : v && F ? new b(
4803
- "The conversation response could not be read. Please try again.",
4804
+ throw S instanceof b && y ? new b(S.message, S.code, S.outcomeUnknown, { ...S.detail, ...y }, S.backendRefusal) : y ? new b(
4805
+ M ? "The connection was interrupted. Please try again." : v ? "The conversation response could not be read. Please try again." : "The response could not be read. Please try again.",
4804
4806
  "connection_interrupted",
4805
4807
  !0,
4806
- F
4808
+ y
4807
4809
  ) : S;
4808
4810
  } finally {
4809
4811
  clearTimeout(I), this.requests.signal.removeEventListener("abort", m), o?.removeEventListener("abort", g);
@@ -4854,12 +4856,12 @@ function Ue(s) {
4854
4856
  return s.status === "error" && s.consecutiveFailures < 10 && e !== null && !["unauthorized", "401", "403", "authority_retired"].includes(e.code) && (e.retryable || /^5\d\d$/.test(e.code) || ["runtime_error", "connection_interrupted", "request_timed_out", "408", "429"].includes(e.code));
4855
4857
  }
4856
4858
  const xt = { activeIntervalMs: 3e3, idleIntervalMs: 15e3, maxFailureIntervalMs: 3e4 };
4857
- function W(s) {
4859
+ function K(s) {
4858
4860
  const e = s.currentAuthority();
4859
4861
  return e.authorityId === s.authority.authorityId && e.generation === s.authority.generation;
4860
4862
  }
4861
4863
  function Me(s, e) {
4862
- if (!W(s) || e.authorityId !== s.authority.authorityId || e.generation !== s.authority.generation)
4864
+ if (!K(s) || e.authorityId !== s.authority.authorityId || e.generation !== s.authority.generation)
4863
4865
  throw new Error("Directory authority is no longer current.");
4864
4866
  }
4865
4867
  function ge(s) {
@@ -4906,7 +4908,7 @@ function qo(s) {
4906
4908
  o = await s.http.request("/conversations", r, void 0, "GET", e);
4907
4909
  return Me(s, i), { ...o, updatedAt: s.now() };
4908
4910
  } catch (n) {
4909
- throw W({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(n), n;
4911
+ throw K({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(n), n;
4910
4912
  }
4911
4913
  },
4912
4914
  "directory.mutate": (i) => {
@@ -4917,7 +4919,7 @@ function qo(s) {
4917
4919
  const a = await s.http.request(`/conversations/${encodeURIComponent(i.sessionId)}`, {}, i.patch, "PATCH", e);
4918
4920
  return Me(s, i), a;
4919
4921
  } catch (a) {
4920
- throw W({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(a), a;
4922
+ throw K({ authority: i, currentAuthority: s.currentAuthority }) && s.onError?.(a), a;
4921
4923
  }
4922
4924
  });
4923
4925
  t.set(i.sessionId, r);
@@ -4943,7 +4945,7 @@ class Co {
4943
4945
  disposed = !1;
4944
4946
  boundary;
4945
4947
  reconcile() {
4946
- const e = this.options.runtime.engine.getProjection().directory.intents, t = !this.disposed && W(this.boundary) && (this.options.enabled?.() ?? !0);
4948
+ const e = this.options.runtime.engine.getProjection().directory.intents, t = !this.disposed && K(this.boundary) && (this.options.enabled?.() ?? !0);
4947
4949
  for (const [n, r] of this.observations)
4948
4950
  t && e[n]?.observe || (r.metadata.stop(), r.recovery?.transcript.stop(), r.recovery?.activity.stop(), this.observations.delete(n), this.options.socket?.release(n, this.owner).catch((o) => this.report(o)));
4949
4951
  if (t) for (const [n, r] of Object.entries(e)) {
@@ -4995,14 +4997,14 @@ class Co {
4995
4997
  this.observations.size ? this.options.wakeup.start() : this.options.wakeup.stop();
4996
4998
  }
4997
4999
  metadata(e) {
4998
- if (this.disposed || !W(this.boundary) || !this.observations.has(e.conversation_id)) return;
5000
+ if (this.disposed || !K(this.boundary) || !this.observations.has(e.conversation_id)) return;
4999
5001
  const t = this.options.runtime.engine.getState().slices.directory.metadataRevision;
5000
5002
  if (this.options.runtime.engine.accept({ ...this.options.authority, type: "directory.metadata_received", metadata: e }), this.options.runtime.engine.getState().slices.directory.metadataRevision !== t)
5001
5003
  for (const n of this.observedQueryStates())
5002
5004
  n.invalidated && this.refreshObservedQuery(n.query).catch((r) => this.report(r));
5003
5005
  }
5004
5006
  open(e, t = "replace", i) {
5005
- if (this.disposed || !W(this.boundary)) return Promise.resolve();
5007
+ if (this.disposed || !K(this.boundary)) return Promise.resolve();
5006
5008
  e = ge(e);
5007
5009
  const n = x(e);
5008
5010
  return t === "replace" && this.options.runtime.engine.getState().slices.directory.queries[n]?.requestId ? (this.refreshAfterRequest.add(n), Promise.resolve()) : (this.requestPage(e, t, i).catch((r) => this.report(r)), Promise.resolve());
@@ -5023,9 +5025,9 @@ class Co {
5023
5025
  }), r;
5024
5026
  }
5025
5027
  async readPage(e, t, i, n = !1) {
5026
- for (; !this.disposed && W(this.boundary) && this.options.runtime.engine.getState().slices.directory.queries[x(e)]?.requestId; )
5028
+ for (; !this.disposed && K(this.boundary) && this.options.runtime.engine.getState().slices.directory.queries[x(e)]?.requestId; )
5027
5029
  await this.waitForQuery(e, !1);
5028
- if (this.disposed || !W(this.boundary)) throw new Error("Directory authority is no longer current.");
5030
+ if (this.disposed || !K(this.boundary)) throw new Error("Directory authority is no longer current.");
5029
5031
  return await this.options.runtime.engine.dispatch({
5030
5032
  ...this.options.authority,
5031
5033
  type: "directory.query",
@@ -5066,26 +5068,26 @@ class Co {
5066
5068
  o?.(), o = null, this.queryWaiters.delete(c);
5067
5069
  }, c = () => {
5068
5070
  const d = this.options.runtime.engine.getState().slices.directory.queries[i];
5069
- return this.disposed || !W(this.boundary) || !d ? (a(), t ? r(new Error("Directory authority is no longer current.")) : n(), !0) : d.requestId !== null ? !1 : (a(), t && d.status === "error" ? r(new Error(d.error?.message ?? "Conversation directory failed")) : n(), !0);
5071
+ return this.disposed || !K(this.boundary) || !d ? (a(), t ? r(new Error("Directory authority is no longer current.")) : n(), !0) : d.requestId !== null ? !1 : (a(), t && d.status === "error" ? r(new Error(d.error?.message ?? "Conversation directory failed")) : n(), !0);
5070
5072
  };
5071
5073
  c() || (this.queryWaiters.add(c), o = this.options.runtime.engine.subscribe(c));
5072
5074
  });
5073
5075
  }
5074
5076
  async focus() {
5075
- this.disposed || !W(this.boundary) || !(this.options.enabled?.() ?? !0) || this.refreshObservedQueries().catch((e) => this.report(e));
5077
+ this.disposed || !K(this.boundary) || !(this.options.enabled?.() ?? !0) || this.refreshObservedQueries().catch((e) => this.report(e));
5076
5078
  }
5077
5079
  observedQueryStates() {
5078
5080
  const e = this.options.runtime.engine.getState().slices.directory.queries;
5079
5081
  return this.options.observedQueries().flatMap((t) => e[x(ge(t))] ?? []);
5080
5082
  }
5081
5083
  isObserved(e) {
5082
- return !this.disposed && W(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((t) => x(t.query) === x(e));
5084
+ return !this.disposed && K(this.boundary) && (this.options.enabled?.() ?? !0) && this.observedQueryStates().some((t) => x(t.query) === x(e));
5083
5085
  }
5084
5086
  async refreshObservedQueries() {
5085
5087
  await Promise.all(this.observedQueryStates().map((e) => this.refreshObservedQuery(e.query)));
5086
5088
  }
5087
5089
  async reconnect() {
5088
- if (!(this.disposed || !W(this.boundary) || !(this.options.enabled?.() ?? !0))) {
5090
+ if (!(this.disposed || !K(this.boundary) || !(this.options.enabled?.() ?? !0))) {
5089
5091
  this.reconcile();
5090
5092
  for (const [e, t] of this.observations)
5091
5093
  this.options.socket?.retain(e, this.owner).catch((i) => this.report(i)), t.metadata.refresh(), t.recovery?.transcript.refresh(), t.recovery?.activity.refresh();
@@ -5093,7 +5095,7 @@ class Co {
5093
5095
  }
5094
5096
  }
5095
5097
  report(e) {
5096
- !this.disposed && W(this.boundary) && this.options.onError(e);
5098
+ !this.disposed && K(this.boundary) && this.options.onError(e);
5097
5099
  }
5098
5100
  dispose() {
5099
5101
  this.disposed = !0;
@@ -6388,7 +6390,7 @@ class Zo {
6388
6390
  })
6389
6391
  },
6390
6392
  errorAdapter: (n) => {
6391
- const r = Se(n), o = n !== null && typeof n == "object" && "details" in n ? n.details : void 0, a = o && typeof o == "object" && "httpRequest" in o ? o.httpRequest : void 0;
6393
+ const r = Se(n), o = n !== null && typeof n == "object" ? "details" in n ? n.details : "detail" in n ? n.detail : void 0 : void 0, a = o && typeof o == "object" && "httpRequest" in o ? o.httpRequest : void 0;
6392
6394
  return { ...r, ...de(a) ? { details: { ...r.details, httpRequest: a } } : {} };
6393
6395
  }
6394
6396
  });
@@ -6811,7 +6813,7 @@ class ka {
6811
6813
  if (n && n.version >= t.version) continue;
6812
6814
  if (n && n.payload.kind !== t.payload.kind) throw new Error("Interaction kind changed.");
6813
6815
  const r = n?.payload.kind === "personal_channel" && n.lifecycle === "completed" ? "completed" : t.lifecycle, o = n?.payload.kind === "sharing" && t.payload.kind === "sharing" ? { ...t.payload, variant: n.payload.variant } : t.payload;
6814
- this.sources.set(i, se(J({ ...t, lifecycle: r, payload: o }))), t.payload.kind === "integration_auth" && this.invalidateAuth(t.payload.request_id);
6816
+ this.sources.set(i, ie(J({ ...t, lifecycle: r, payload: o }))), t.payload.kind === "integration_auth" && this.invalidateAuth(t.payload.request_id);
6815
6817
  }
6816
6818
  }
6817
6819
  /** @internal */
@@ -8135,6 +8137,10 @@ class _t {
8135
8137
  },
8136
8138
  onCommand: (u) => be("client_event", u.type, Ht({ ...u.payload, type: u.type })),
8137
8139
  onError: (u, h) => {
8140
+ if (this.options.productVariant === "customer_embedded" && h.operation === "conversation.snapshot" && u instanceof b && u.code === "conversation_access_denied") {
8141
+ h.sessionId === this.getState().sessionId && this.startNewSession({ notifyTransport: !1 });
8142
+ return;
8143
+ }
8138
8144
  $("web-sdk.conversation", "Conversation operation failed", { ...h, ...ir(u) }), this.handleDirectoryTransportError(u);
8139
8145
  }
8140
8146
  }),
@@ -8606,12 +8612,12 @@ class _t {
8606
8612
  return this.clientRuntime.isDisposed ? null : new Promise((g, v) => {
8607
8613
  let w = null, I = null;
8608
8614
  const _ = () => {
8609
- const A = this.clientRuntime.engine.getState().slices.conversation.submissions[r];
8610
- if (!(A && !A.cancelled && A.delivery !== "accepted" && A.delivery !== "failed"))
8611
- if (w?.(), I?.(), A?.delivery === "failed" && !A.cancelled) v(new Error(A.error?.message ?? "Message delivery failed."));
8615
+ const E = this.clientRuntime.engine.getState().slices.conversation.submissions[r];
8616
+ if (!(E && !E.cancelled && E.delivery !== "accepted" && E.delivery !== "failed"))
8617
+ if (w?.(), I?.(), E?.delivery === "failed" && !E.cancelled) v(new Error(E.error?.message ?? "Message delivery failed."));
8612
8618
  else {
8613
- const C = A?.invocation === "user" && A.contextPreparation?.pageContent ? A.context.page?.url : null;
8614
- A?.delivery === "accepted" && !A.cancelled && typeof C == "string" && c === this.submissionIntentRevision && m === this.directoryAuthority && this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId] === f && (this.lastUserMessagePageUrl = C), g(A?.delivery === "accepted" && !A.cancelled ? r : null);
8619
+ const C = E?.invocation === "user" && E.contextPreparation?.pageContent ? E.context.page?.url : null;
8620
+ E?.delivery === "accepted" && !E.cancelled && typeof C == "string" && c === this.submissionIntentRevision && m === this.directoryAuthority && this.clientRuntime.engine.getState().slices.directory.clients[this.modelClientScopeId] === f && (this.lastUserMessagePageUrl = C), g(E?.delivery === "accepted" && !E.cancelled ? r : null);
8615
8621
  }
8616
8622
  };
8617
8623
  w = this.clientRuntime.engine.subscribe(_), I = this.clientRuntime.onDispose(() => {
@@ -9165,7 +9171,7 @@ class _t {
9165
9171
  }
9166
9172
  reportHealthSignal(e, t = {}) {
9167
9173
  const i = this.getState();
9168
- if (t.httpRequest && (!de(t.httpRequest) || t.httpRequest.sessionId !== i.sessionId) || t.historyRefreshFailure && (t.historyRefreshFailure.consecutiveFailures < 3 || t.historyRefreshFailure.sessionId !== i.sessionId) || t.renderedError && t.renderedError.sessionId !== i.sessionId || t.uiInvariant && t.uiInvariant.current.sessionId !== i.sessionId) return;
9174
+ if (t.httpRequest && (!de(t.httpRequest) || t.httpRequest.sessionId !== null && t.httpRequest.sessionId !== i.sessionId) || t.historyRefreshFailure && (t.historyRefreshFailure.consecutiveFailures < 3 || t.historyRefreshFailure.sessionId !== i.sessionId) || t.renderedError && t.renderedError.sessionId !== i.sessionId || t.uiInvariant && t.uiInvariant.current.sessionId !== i.sessionId) return;
9169
9175
  const n = t.historyRefreshFailure?.episodeId ?? (t.renderedError ? `${t.errorFingerprint}:${t.renderedError.itemId}` : void 0) ?? t.errorFingerprint ?? t.clientMessageId ?? (t.previousPhase && t.nextPhase ? `${t.previousPhase}:${t.nextPhase}:${t.reason ?? "unknown"}` : null);
9170
9176
  if (n) {
9171
9177
  const f = `${e}:${n}:${e === "invalid_state_transition" ? t.reason ?? "unknown" : ""}`;
@@ -9934,7 +9940,7 @@ function dc() {
9934
9940
  try {
9935
9941
  const v = p instanceof Request ? p : null, w = yd(p, v), I = Dn(f?.headers ?? v?.headers);
9936
9942
  if (!we(w, I, f?.body)) {
9937
- const A = {
9943
+ const E = {
9938
9944
  requestId: Zt("fetch"),
9939
9945
  url: ae(w, Vt),
9940
9946
  method: (f?.method ?? v?.method ?? "GET").toUpperCase(),
@@ -9945,9 +9951,9 @@ function dc() {
9945
9951
  };
9946
9952
  g.then(
9947
9953
  (C) => {
9948
- vd(C, A, m, e).catch(() => {
9954
+ vd(C, E, m, e).catch(() => {
9949
9955
  e({
9950
- ...A,
9956
+ ...E,
9951
9957
  responseStatus: C.status,
9952
9958
  durationMs: Date.now() - m
9953
9959
  });
@@ -9955,7 +9961,7 @@ function dc() {
9955
9961
  },
9956
9962
  (C) => {
9957
9963
  e({
9958
- ...A,
9964
+ ...E,
9959
9965
  errorText: ae(C instanceof Error ? C.message : String(C)),
9960
9966
  durationMs: Date.now() - m
9961
9967
  });
@@ -10482,61 +10488,61 @@ function Pc(s, e) {
10482
10488
  }, m = (I) => {
10483
10489
  const _ = I.getAttribute("data-testid") || I.getAttribute("data-test") || I.getAttribute("data-qa") || I.getAttribute("data-cy") || "";
10484
10490
  return `${I.tagName.toLowerCase()}|${f(I)}|${_}`;
10485
- }, g = (I, _, A) => {
10486
- const C = (M, ie) => {
10487
- const B = M.tagName.toLowerCase(), S = window.getComputedStyle(M), k = l.has(M);
10488
- if (p >= 1e3 && !k || A.has(M) || r.has(B) || M.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || S.display === "none" || S.visibility === "hidden")
10491
+ }, g = (I, _, E) => {
10492
+ const C = (M, te) => {
10493
+ const B = M.tagName.toLowerCase(), W = window.getComputedStyle(M), S = l.has(M);
10494
+ if (p >= 1e3 && !S || E.has(M) || r.has(B) || M.matches(".pluno-pa-widget-host, [data-pluno-product-agent-widget]") || W.display === "none" || W.visibility === "hidden")
10489
10495
  return { lines: [], hasUsefulContent: !1, textPreview: "", containsTextElement: !1 };
10490
10496
  p += 1;
10491
- const T = f(M), F = Tn(M), y = a.has(T) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(B) || B === "a" && M.hasAttribute("href"), q = Array.from(M.children).filter((E) => E instanceof HTMLElement), O = /* @__PURE__ */ new Map();
10492
- for (const E of q) {
10493
- const U = m(E);
10497
+ const q = f(M), A = Tn(M), y = a.has(q) || ["button", "input", "textarea", "select", "iframe", "canvas"].includes(B) || B === "a" && M.hasAttribute("href"), T = Array.from(M.children).filter((k) => k instanceof HTMLElement), O = /* @__PURE__ */ new Map();
10498
+ for (const k of T) {
10499
+ const U = m(k);
10494
10500
  O.set(U, (O.get(U) ?? 0) + 1);
10495
10501
  }
10496
10502
  const L = /* @__PURE__ */ new Map(), ke = /* @__PURE__ */ new Map();
10497
- for (const E of q) {
10498
- const U = m(E), le = ke.get(U) ?? 0;
10499
- ke.set(U, le + 1), (O.get(U) ?? 0) > 8 && le >= 6 && !l.has(E) && L.set(U, (L.get(U) ?? 0) + 1);
10503
+ for (const k of T) {
10504
+ const U = m(k), le = ke.get(U) ?? 0;
10505
+ ke.set(U, le + 1), (O.get(U) ?? 0) > 8 && le >= 6 && !l.has(k) && L.set(U, (L.get(U) ?? 0) + 1);
10500
10506
  }
10501
10507
  const Ke = /* @__PURE__ */ new Map(), zs = /* @__PURE__ */ new Set(), Rt = [], Hs = [];
10502
- for (const E of q) {
10503
- const U = m(E), le = O.get(U) ?? 0, Vs = Ke.get(U) ?? 0;
10504
- if (Ke.set(U, Vs + 1), le > 8 && Vs >= 6 && !l.has(E)) {
10508
+ for (const k of T) {
10509
+ const U = m(k), le = O.get(U) ?? 0, Vs = Ke.get(U) ?? 0;
10510
+ if (Ke.set(U, Vs + 1), le > 8 && Vs >= 6 && !l.has(k)) {
10505
10511
  zs.has(U) || (Rt.push([`… ${L.get(U) ?? 0} similar siblings omitted`]), zs.add(U));
10506
10512
  continue;
10507
10513
  }
10508
- const Gs = C(E, ie);
10514
+ const Gs = C(k, te);
10509
10515
  Hs.push(Gs), Rt.push(Gs.lines);
10510
10516
  }
10511
10517
  const At = [];
10512
10518
  if (M.shadowRoot)
10513
- for (const E of Array.from(M.shadowRoot.children))
10514
- E instanceof HTMLElement && At.push(C(E, ie + 1));
10515
- const We = [...Hs, ...At], Et = F.length > 0 || y || We.some((E) => E.hasUsefulContent), Ks = Ee(
10516
- [F, ...We.map((E) => E.textPreview)].filter(Boolean).join(" ")
10517
- ).slice(0, 180), Hn = M.hasAttribute("contenteditable") && (F.length > 0 || !M.querySelector("[contenteditable]")), Ws = d.some((E) => M.hasAttribute(E)) || !!T || Hn, Tt = (M.getClientRects().length > 0 || S.display === "contents") && (t.has(B) || Ws || k) && (Et || k) && (!n.has(B) || Et || Ws || k), kt = Tt ? 1 : 0, qe = [];
10519
+ for (const k of Array.from(M.shadowRoot.children))
10520
+ k instanceof HTMLElement && At.push(C(k, te + 1));
10521
+ const We = [...Hs, ...At], Et = A.length > 0 || y || We.some((k) => k.hasUsefulContent), Ks = Ee(
10522
+ [A, ...We.map((k) => k.textPreview)].filter(Boolean).join(" ")
10523
+ ).slice(0, 180), Hn = M.hasAttribute("contenteditable") && (A.length > 0 || !M.querySelector("[contenteditable]")), Ws = d.some((k) => M.hasAttribute(k)) || !!q || Hn, Tt = (M.getClientRects().length > 0 || W.display === "contents") && (t.has(B) || Ws || S) && (Et || S) && (!n.has(B) || Et || Ws || S), kt = Tt ? 1 : 0, qe = [];
10518
10524
  if (Tt) {
10519
- const E = We.some((le) => le.containsTextElement), U = i.has(B) && !E ? Ks : F;
10525
+ const k = We.some((le) => le.containsTextElement), U = i.has(B) && !k ? Ks : A;
10520
10526
  qe.push(En(M, c, o, U.slice(0, 180)));
10521
10527
  }
10522
- for (const E of Rt)
10523
- qe.push(...Ze(E, kt));
10524
- const qt = At.flatMap((E) => E.lines);
10528
+ for (const k of Rt)
10529
+ qe.push(...Ze(k, kt));
10530
+ const qt = At.flatMap((k) => k.lines);
10525
10531
  if (qt.length > 0) {
10526
- const E = qt.slice(0, 20);
10527
- qt.length > E.length && E.push("… shadow DOM omitted");
10532
+ const k = qt.slice(0, 20);
10533
+ qt.length > k.length && k.push("… shadow DOM omitted");
10528
10534
  const U = B.includes("tooltip") || B.includes("popper") || B.includes("loader");
10529
- if (ie < 2 && !U) {
10535
+ if (te < 2 && !U) {
10530
10536
  const le = Tt ? "#shadow-root" : `${B} #shadow-root`;
10531
- qe.push(...Ze([le, ...Ze(E, 1)], kt));
10537
+ qe.push(...Ze([le, ...Ze(k, 1)], kt));
10532
10538
  } else
10533
- qe.push(...Ze(E, kt));
10539
+ qe.push(...Ze(k, kt));
10534
10540
  }
10535
10541
  return {
10536
10542
  lines: qe,
10537
10543
  hasUsefulContent: Et,
10538
10544
  textPreview: Ks,
10539
- containsTextElement: i.has(B) || We.some((E) => E.containsTextElement)
10545
+ containsTextElement: i.has(B) || We.some((k) => k.containsTextElement)
10540
10546
  };
10541
10547
  };
10542
10548
  return [`--- ${_} ---`, ...C(I, 0).lines].join(`
@@ -10796,10 +10802,10 @@ function qn(s, e) {
10796
10802
  e
10797
10803
  ),
10798
10804
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10799
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10805
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10800
10806
  ...V(n) !== null ? { causalSequence: V(n) } : {},
10801
10807
  respondsToUserMessageId: ue(n) ?? void 0,
10802
- ...H(n) ? { runId: H(n) } : {},
10808
+ ...z(n) ? { runId: z(n) } : {},
10803
10809
  dataType: "assistant_draft",
10804
10810
  ...n.steered === !0 ? { steered: !0 } : {}
10805
10811
  };
@@ -10813,10 +10819,10 @@ function qn(s, e) {
10813
10819
  e
10814
10820
  ),
10815
10821
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10816
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10822
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10817
10823
  ...V(n) !== null ? { causalSequence: V(n) } : {},
10818
10824
  respondsToUserMessageId: ue(n) ?? void 0,
10819
- ...H(n) ? { runId: H(n) } : {},
10825
+ ...z(n) ? { runId: z(n) } : {},
10820
10826
  attachments: Mn(n.attachments, e),
10821
10827
  ...n.steered === !0 ? { steered: !0 } : {}
10822
10828
  };
@@ -10839,9 +10845,9 @@ function qn(s, e) {
10839
10845
  role: "tool",
10840
10846
  content: "",
10841
10847
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10842
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10848
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10843
10849
  respondsToUserMessageId: ue(n) ?? void 0,
10844
- ...H(n) ? { runId: H(n) } : {},
10850
+ ...z(n) ? { runId: z(n) } : {},
10845
10851
  dataType: "function_call_output",
10846
10852
  toolName: Ds,
10847
10853
  callId: xe(n) ?? void 0,
@@ -10854,9 +10860,9 @@ function qn(s, e) {
10854
10860
  role: "tool",
10855
10861
  content: "",
10856
10862
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10857
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10863
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10858
10864
  respondsToUserMessageId: ue(n) ?? void 0,
10859
- ...H(n) ? { runId: H(n) } : {},
10865
+ ...z(n) ? { runId: z(n) } : {},
10860
10866
  dataType: "scheduled_check_in",
10861
10867
  toolName: wn,
10862
10868
  callId: xe(n) ?? void 0,
@@ -10869,10 +10875,10 @@ function qn(s, e) {
10869
10875
  role: "tool",
10870
10876
  content: `Connect ${a.appName} to continue`,
10871
10877
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10872
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10878
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10873
10879
  ...V(n) !== null ? { causalSequence: V(n) } : {},
10874
10880
  respondsToUserMessageId: ue(n) ?? void 0,
10875
- ...H(n) ? { runId: H(n) } : {},
10881
+ ...z(n) ? { runId: z(n) } : {},
10876
10882
  dataType: "function_call_output",
10877
10883
  toolName: "authenticate_pipedream_app",
10878
10884
  callId: xe(n) ?? void 0,
@@ -10882,10 +10888,10 @@ function qn(s, e) {
10882
10888
  role: "tool",
10883
10889
  content: "Connect WhatsApp to continue",
10884
10890
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10885
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10891
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10886
10892
  ...V(n) !== null ? { causalSequence: V(n) } : {},
10887
10893
  respondsToUserMessageId: ue(n) ?? void 0,
10888
- ...H(n) ? { runId: H(n) } : {},
10894
+ ...z(n) ? { runId: z(n) } : {},
10889
10895
  dataType: "function_call_output",
10890
10896
  toolName: "request_personal_channel_connection",
10891
10897
  callId: xe(n) ?? void 0,
@@ -10897,10 +10903,10 @@ function qn(s, e) {
10897
10903
  role: "tool",
10898
10904
  content: n.type === "mcp_call" ? zc(n) : Vc(n),
10899
10905
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10900
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10906
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10901
10907
  ...V(n) !== null ? { causalSequence: V(n) } : {},
10902
10908
  respondsToUserMessageId: ue(n) ?? void 0,
10903
- ...H(n) ? { runId: H(n) } : {},
10909
+ ...z(n) ? { runId: z(n) } : {},
10904
10910
  dataType: String(n.type),
10905
10911
  toolName: n.type === "tab_lifecycle_decision" ? "tab_lifecycle_decision" : typeof n.name == "string" ? n.name : void 0,
10906
10912
  callId: xe(n) ?? void 0,
@@ -10911,10 +10917,10 @@ function qn(s, e) {
10911
10917
  role: "system",
10912
10918
  content: Wc(n),
10913
10919
  createdAt: typeof t.createdAt == "string" ? t.createdAt : (/* @__PURE__ */ new Date()).toISOString(),
10914
- ...z(n) !== null ? { displaySequence: z(n) } : {},
10920
+ ...F(n) !== null ? { displaySequence: F(n) } : {},
10915
10921
  ...V(n) !== null ? { causalSequence: V(n) } : {},
10916
10922
  respondsToUserMessageId: ue(n) ?? void 0,
10917
- ...H(n) ? { runId: H(n) } : {},
10923
+ ...z(n) ? { runId: z(n) } : {},
10918
10924
  dataType: String(n.type),
10919
10925
  loading: n.steered !== !0 && n.type === "run_status" && (n.status === "running" || n.status === "retrying"),
10920
10926
  ...n.steered === !0 || n.type === "run_status" && n.status === "steered" ? { steered: !0 } : {},
@@ -10999,7 +11005,7 @@ function xe(s) {
10999
11005
  function V(s) {
11000
11006
  return typeof s.causalSequence == "number" && Number.isSafeInteger(s.causalSequence) ? s.causalSequence : null;
11001
11007
  }
11002
- function z(s) {
11008
+ function F(s) {
11003
11009
  return typeof s.displaySequence == "number" && Number.isSafeInteger(s.displaySequence) ? s.displaySequence : null;
11004
11010
  }
11005
11011
  function Di(s) {
@@ -11299,7 +11305,7 @@ function ue(s) {
11299
11305
  const e = s.respondsToUserMessageId;
11300
11306
  return typeof e == "string" && e ? e : null;
11301
11307
  }
11302
- function H(s) {
11308
+ function z(s) {
11303
11309
  const e = s.runId;
11304
11310
  return typeof e == "string" && e ? e : null;
11305
11311
  }