@pluno/product-agent-web 0.1.264 → 0.1.266

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.
@@ -37,7 +37,7 @@ function Fp(t, e, n, i) {
37
37
  function $p(t) {
38
38
  return Lr(t) > 0.5 ? [24, 24, 27] : [250, 250, 249];
39
39
  }
40
- const Hp = "0.1.264", ri = {
40
+ const Hp = "0.1.266", ri = {
41
41
  version: Hp
42
42
  }, ye = (t) => typeof t == "string" && /^[a-zA-Z0-9:_.-]{1,160}$/.test(t) ? t : null;
43
43
  function Ad(t) {
@@ -532,7 +532,7 @@ function Dd(t, e, n = null, i = !0) {
532
532
  }
533
533
  return s("allowed", "none");
534
534
  }
535
- function Tt(t) {
535
+ function qt(t) {
536
536
  return t?.execution_message_ids ?? t?.user_message_ids ?? [];
537
537
  }
538
538
  function Jt(t) {
@@ -646,11 +646,11 @@ function fn(t, e, n) {
646
646
  }
647
647
  const l = o?.execution, h = a.filter((E) => !E.cancelled && E.delivery !== "failed"), g = h.filter((E) => E.delivery !== "accepted" && E.executionVersion === null), y = h.filter((E) => E.delivery === "accepted" && E.executionVersion === null), f = h[h.length - 1], b = g.length > 0, w = f !== void 0 && y.includes(f);
648
648
  let v = b ? "submitting" : w ? "awaiting_execution" : l?.phase ?? "idle";
649
- const k = Object.entries(t.stops).filter(([E]) => E === n || s !== null && e.selections[E]?.sessionId === s).map(([, E]) => E).find((E) => (!a.length || E.userMessageIds.includes(a[a.length - 1].userMessageId) || !b && !w && Tt(l).some((N) => E.userMessageIds.includes(N))) && (!l || l.version <= E.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((N) => N.cancelled && N.executionVersion === null && E.userMessageIds.includes(N.userMessageId)))), m = l && ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((E) => E.delivery === "accepted" && E.executionVersion === null && k?.userMessageIds.includes(E.userMessageId));
650
- k && m && !b && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) || Tt(l).every((E) => k.userMessageIds.includes(E))) && (v = "stopping"), k && !m && !b && a.some((E) => E.cancelled && E.executionVersion === null && k.userMessageIds.includes(E.userMessageId)) && (v = a.some((E) => k.userMessageIds.includes(E.userMessageId) && ["sending", "uncertain"].includes(E.delivery)) ? "stopping" : "stopped");
649
+ const k = Object.entries(t.stops).filter(([E]) => E === n || s !== null && e.selections[E]?.sessionId === s).map(([, E]) => E).find((E) => (!a.length || E.userMessageIds.includes(a[a.length - 1].userMessageId) || !b && !w && qt(l).some((N) => E.userMessageIds.includes(N))) && (!l || l.version <= E.executionVersion || ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((N) => N.cancelled && N.executionVersion === null && E.userMessageIds.includes(N.userMessageId)))), m = l && ["thinking", "steering", "queued", "stopping"].includes(l.phase) || a.some((E) => E.delivery === "accepted" && E.executionVersion === null && k?.userMessageIds.includes(E.userMessageId));
650
+ k && m && !b && (!l || !["thinking", "steering", "queued", "stopping"].includes(l.phase) || qt(l).every((E) => k.userMessageIds.includes(E))) && (v = "stopping"), k && !m && !b && a.some((E) => E.cancelled && E.executionVersion === null && k.userMessageIds.includes(E.userMessageId)) && (v = a.some((E) => k.userMessageIds.includes(E.userMessageId) && ["sending", "uncertain"].includes(E.delivery)) ? "stopping" : "stopped");
651
651
  const S = ["thinking", "steering", "queued"].includes(v), _ = t.stops[n] ?? k, x = _?.userMessageIds.filter((E) => !["completed", "failed"].includes(o?.executionByUserMessage[E]?.phase ?? "")) ?? [], R = x.some((E) => {
652
652
  const N = a.find((ue) => ue.userMessageId === E);
653
- return !Object.values(t.operations).some((ue) => ue.command.type === "run.stop" && ue.command.payload.expectedUserMessageId === E && ue.phase === "done") && (N?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(N.delivery) || !!(l && Tt(l).includes(E) && ["thinking", "steering", "queued", "stopping"].includes(l.phase)));
653
+ return !Object.values(t.operations).some((ue) => ue.command.type === "run.stop" && ue.command.payload.expectedUserMessageId === E && ue.phase === "done") && (N?.executionVersion === null && ["sending", "uncertain", "accepted"].includes(N.delivery) || !!(l && qt(l).includes(E) && ["thinking", "steering", "queued", "stopping"].includes(l.phase)));
654
654
  }), q = l?.user_message_ids ?? [], U = b || w ? f?.userMessageId ?? null : q[q.length - 1] ?? null, P = u.find((E) => E.userMessageId === U), z = S ? [...P?.activityIds ?? []].reverse().find((E) => d[E] === "open") ?? null : null, B = s !== null && !!e.selections[n]?.provisionalId && r.length === 0 && a.length === 0 && // The first persisted idle snapshot already has a positive synchronization version.
655
655
  (!o?.execution || o.execution.phase === "idle" && o.execution.user_message_ids.length === 0) && Object.values(t.operations).some((E) => E.conversationScopeId === n && E.phase === "done" && ["runtime.warmup", "attachment.prepare"].includes(E.command.type) && !E.command.payload.sessionId && E.result?.sessionId === s);
656
656
  return Ke({
@@ -670,7 +670,7 @@ function fn(t, e, n) {
670
670
  preparation: o?.preparation ?? null,
671
671
  stop: _ ? { ..._, userMessageIds: x, pending: R } : null,
672
672
  segments: u.map((E, N) => ({ ...E, collapsed: S ? E.userMessageId !== U : N < u.length - 1 || E.activityIds.length > 0 })),
673
- activity: { phase: v, activeItemId: z, userMessageId: U, executionKey: JSON.stringify([...Tt(l)].sort()) },
673
+ activity: { phase: v, activeItemId: z, userMessageId: U, executionKey: JSON.stringify([...qt(l)].sort()) },
674
674
  // Staging transfers the immutable input to the core. Waiting for backend acceptance leaves
675
675
  // the same submitted text in the optimistic transcript and composer during delivery.
676
676
  receipts: i.filter((E) => !E.cancelled && e.clients[E.clientScopeId] === n).map((E) => ({ viewId: E.viewId, userMessageId: E.userMessageId, acceptedRendererRevision: E.rendererRevision }))
@@ -1092,9 +1092,9 @@ function Wr() {
1092
1092
  };
1093
1093
  }
1094
1094
  function Vr(t = 0) {
1095
- return { localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
1095
+ return { suggestionReadFailures: 0, localScribbleStyle: null, originContextQueries: {}, contextObservers: {}, contextReads: {}, contextRunOrigins: {}, appearanceEpochs: {}, appearanceQueries: {}, polls: {}, queries: {}, pending: {}, queuedPreferences: {}, desiredPreferences: {}, refreshBatch: null, refreshQueuedRequestId: null, refreshAt: null, failures: 0, now: t, timerId: null, timerDeadline: null, timerRevision: 0, refreshRequired: !1, schedulerError: null, deepFlows: {} };
1096
1096
  }
1097
- function Nt(t, e) {
1097
+ function At(t, e) {
1098
1098
  return e.kind === "originContext" ? JSON.stringify([t.authorityId, t.generation, t.communityId, e.kind, e.origin]) : JSON.stringify([
1099
1099
  t.authorityId,
1100
1100
  t.generation,
@@ -1176,7 +1176,7 @@ function Gr(t, e, n) {
1176
1176
  "now" in e && o({ now: e.now });
1177
1177
  const c = (m, S) => {
1178
1178
  const _ = { ...i.features.contextObservers }, x = _[m];
1179
- if (S === null ? delete _[m] : _[m] = Nt(r, { kind: "originContext", clientScopeId: m, origin: S, pageUrl: "" }), o({ contextObservers: _ }), !x || Object.values(_).includes(x)) return;
1179
+ if (S === null ? delete _[m] : _[m] = At(r, { kind: "originContext", clientScopeId: m, origin: S, pageUrl: "" }), o({ contextObservers: _ }), !x || Object.values(_).includes(x)) return;
1180
1180
  const R = { ...i.features.queries }, q = { ...i.features.polls }, U = { ...i.features.contextReads }, P = { ...i.features.originContextQueries }, z = { ...i.features.pending }, B = P[x]?.origin, E = { ...i.features.contextRunOrigins };
1181
1181
  for (const [N, Y] of Object.entries(E)) Y === B && delete E[N];
1182
1182
  delete R[x], delete q[x], delete U[x], delete P[x];
@@ -1190,7 +1190,7 @@ function Gr(t, e, n) {
1190
1190
  const d = e.type === "stage7.query" ? e.query : e.type === "stage7.mutate" ? e.mutation : e.type === "effect.completed" || e.type === "effect.failed" ? i.features.pending[e.effectId]?.operation : null;
1191
1191
  if (d && Fd(d)) {
1192
1192
  ji(r, d);
1193
- const m = ph(i.features, r, e, (S) => Nt(r, S));
1193
+ const m = ph(i.features, r, e, (S) => At(r, S));
1194
1194
  return { state: { ...i, features: m.state }, effects: m.effects };
1195
1195
  }
1196
1196
  if (e.type === "stage7.act" || e.type === "stage7.retry_action" || (e.type === "effect.completed" || e.type === "effect.failed") && e.effectKind === "stage7.platform") {
@@ -1233,7 +1233,7 @@ function Gr(t, e, n) {
1233
1233
  S.revision <= _.revision || (Di(i, m) === !0 && (S.permission === "granted" && _.permission !== "granted" || S.snoozedUntil && S.snoozedUntil !== _.snoozedUntil) && l(m, null), a({ deviceFacts: { ...i.interactions.deviceFacts, [m]: S } }));
1234
1234
  }, y = (m, S, _ = !1) => {
1235
1235
  ji(r, m);
1236
- const x = Nt(r, m), R = Pn(r, "query", S);
1236
+ const x = At(r, m), R = Pn(r, "query", S);
1237
1237
  if (m.kind === "originContext") {
1238
1238
  const z = i.features.queries[x], B = i.features.contextReads[x];
1239
1239
  if (o({ originContextQueries: { ...i.features.originContextQueries, [x]: m } }), !_ && (z?.status === "ready" || z?.status === "error") && B && (i.features.now - B.settledAt < 3e4 || z.error && !z.error.retryable && z.error.code !== "runtime_error")) return;
@@ -1284,7 +1284,7 @@ function Gr(t, e, n) {
1284
1284
  return;
1285
1285
  }
1286
1286
  if (m.kind === "generatePrompts") {
1287
- const U = { kind: "starterPrompts", ...m.page, includeUserSuggestions: m.includeUserSuggestions ?? !1 }, P = Nt(r, U), z = i.features.queries[P] ?? Zt(P);
1287
+ const U = { kind: "starterPrompts", ...m.page, includeUserSuggestions: m.includeUserSuggestions ?? !1 }, P = At(r, U), z = i.features.queries[P] ?? Zt(P);
1288
1288
  o({ queries: { ...i.features.queries, [P]: ei(z, { key: P, requestId: Et(S), mode: "replace" }) } });
1289
1289
  }
1290
1290
  o({ pending: { ...i.features.pending, [x]: { requestId: S, effectId: x, fingerprint: R, key: sl(m), generation: r.generation, operation: m, mode: "mutation", status: "pending", error: null, result: null } } }), s.push({ kind: "stage7.mutate", id: x, input: { authority: r, requestId: S, mutation: m } });
@@ -1333,8 +1333,13 @@ function Gr(t, e, n) {
1333
1333
  c(e.clientScopeId, e.origin);
1334
1334
  break;
1335
1335
  case "stage7.query":
1336
+ if (e.query.kind === "userSuggestedTasks") {
1337
+ const m = At(r, e.query);
1338
+ if (!e.force && (i.features.polls[m] || i.features.queries[m]?.status === "error")) break;
1339
+ e.force && o({ suggestionReadFailures: 0 });
1340
+ }
1336
1341
  if (e.query.kind === "originContext" && (c(e.query.clientScopeId, e.query.origin), e.force)) {
1337
- const m = Nt(r, e.query), S = { ...i.features.contextReads };
1342
+ const m = At(r, e.query), S = { ...i.features.contextReads };
1338
1343
  delete S[m], o({ contextReads: S });
1339
1344
  }
1340
1345
  y(e.query, e.requestId, e.force);
@@ -1540,7 +1545,7 @@ function Gr(t, e, n) {
1540
1545
  }, `${m.requestId}:ack`);
1541
1546
  }
1542
1547
  if (w(e.effectId, S), m.operation.kind === "generatePrompts") {
1543
- const _ = { kind: "starterPrompts", ...m.operation.page, includeUserSuggestions: m.operation.includeUserSuggestions ?? !1 }, x = Nt(r, _), R = i.features.queries[x];
1548
+ const _ = { kind: "starterPrompts", ...m.operation.page, includeUserSuggestions: m.operation.includeUserSuggestions ?? !1 }, x = At(r, _), R = i.features.queries[x];
1544
1549
  R?.requestId === m.requestId && o({ queries: { ...i.features.queries, [x]: S ? gs(R, { key: x, requestId: Et(m.requestId), error: e.error }) : Jo(R, { key: x, requestId: Et(m.requestId), data: e.output.data, cursor: null, updatedAt: e.output.completedAt }) } });
1545
1550
  }
1546
1551
  if (!S && e.output.data.kind === "originContext") {
@@ -1583,7 +1588,7 @@ function Gr(t, e, n) {
1583
1588
  if (_.kind === "originContext" || _.kind === "userContext" || _.kind === "contextRun") {
1584
1589
  const x = _.kind === "originContext" ? m.mode === "query" && m.operation.kind === "originContext" && Object.values(i.features.contextObservers).includes(m.key) ? m.operation : null : _.kind === "userContext" ? { kind: "userContext" } : _.value.runId ? { kind: "contextRun", runId: _.value.runId } : null;
1585
1590
  if (x && ["queued", "pending", "running", "in_progress", "stopping", "cancel_requested"].includes(_.value.status)) {
1586
- const R = Nt(r, x);
1591
+ const R = At(r, x);
1587
1592
  o({ polls: { ...i.features.polls, [R]: { query: x, deadline: i.features.now + 5e3 } } });
1588
1593
  }
1589
1594
  }
@@ -1598,9 +1603,13 @@ function Gr(t, e, n) {
1598
1603
  }
1599
1604
  }
1600
1605
  if (S && m.mode === "query" && ["originContext", "userContext", "contextRun"].includes(m.operation.kind) && e.error.retryable && (i.features.contextReads[m.key]?.failures ?? 0) <= 3) {
1601
- const _ = m.operation, x = Nt(r, _);
1606
+ const _ = m.operation, x = At(r, _);
1602
1607
  o({ polls: { ...i.features.polls, [x]: { query: _, deadline: i.features.now + 5e3 * (i.features.contextReads[m.key]?.failures ?? 1) } } });
1603
1608
  }
1609
+ if (m.mode === "query" && m.operation.kind === "userSuggestedTasks") {
1610
+ const _ = S ? i.features.suggestionReadFailures + 1 : 0, x = { ...i.features.polls };
1611
+ delete x[m.key], S && _ <= 3 && (e.error.retryable || ["connection_interrupted", "request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.error.code)) && (x[m.key] = { query: m.operation, deadline: i.features.now + 1e3 * 2 ** (_ - 1) }), o({ suggestionReadFailures: _, polls: x });
1612
+ }
1604
1613
  if (m.operation.kind === "preference") {
1605
1614
  const _ = m.operation.feature, x = i.features.queuedPreferences[_];
1606
1615
  if (x) {
@@ -1633,7 +1642,7 @@ function Gr(t, e, n) {
1633
1642
  return { state: i, effects: s };
1634
1643
  }
1635
1644
  function Jr(t, e) {
1636
- return t.account.authority ? t.features.queries[Nt(t.account.authority, e)] ?? null : null;
1645
+ return t.account.authority ? t.features.queries[At(t.account.authority, e)] ?? null : null;
1637
1646
  }
1638
1647
  function we(t) {
1639
1648
  if (!t || typeof t != "object" || Array.isArray(t)) throw new Error("Invalid feature response object.");
@@ -1643,7 +1652,7 @@ function ne(t) {
1643
1652
  if (typeof t != "string") throw new Error("Invalid feature response string.");
1644
1653
  return t;
1645
1654
  }
1646
- function Rt(t) {
1655
+ function Tt(t) {
1647
1656
  return t == null ? null : ne(t);
1648
1657
  }
1649
1658
  function $n(t) {
@@ -1662,7 +1671,7 @@ function Cs(t) {
1662
1671
  return t.map(ne);
1663
1672
  }
1664
1673
  function Fs(t) {
1665
- const e = Rt(t);
1674
+ const e = Tt(t);
1666
1675
  if (e !== null && !Number.isFinite(Date.parse(e))) throw new Error("Invalid feature deadline.");
1667
1676
  return e;
1668
1677
  }
@@ -1674,13 +1683,13 @@ function Ci(t) {
1674
1683
  preferencesVersion: $n(e.preferencesVersion),
1675
1684
  scribbleStyleEnabled: Yo(e.scribbleStyleEnabled),
1676
1685
  blockedOrigins: Cs(e.blockedServiceOrigins),
1677
- personalInstructions: Rt(e.personalInstructions),
1686
+ personalInstructions: Tt(e.personalInstructions),
1678
1687
  securityPolicyVersion: $n(e.securityPolicyVersion)
1679
1688
  };
1680
1689
  }
1681
1690
  function $s(t) {
1682
1691
  const e = we(t);
1683
- return { eligibleSince: Fs(e.eligibleSince), revision: $n(e.revision), requestId: Rt(e.requestId), snoozedUntil: Fs(e.snoozedUntil) };
1692
+ return { eligibleSince: Fs(e.eligibleSince), revision: $n(e.revision), requestId: Tt(e.requestId), snoozedUntil: Fs(e.snoozedUntil) };
1684
1693
  }
1685
1694
  function fh(t) {
1686
1695
  const e = we(t);
@@ -1735,14 +1744,14 @@ function mh(t) {
1735
1744
  }
1736
1745
  function Ai(t, e) {
1737
1746
  const n = we(e);
1738
- if (t === "contextRun") return { kind: t, value: { status: ne(n.status), runId: ne(n.id), updatedAt: Rt(n.completedAt ?? n.createdAt), hasContext: null } };
1739
- const i = n.latestRun === null || n.latestRun === void 0 ? null : we(n.latestRun), s = Rt(n.activeRefreshRunId);
1747
+ if (t === "contextRun") return { kind: t, value: { status: ne(n.status), runId: ne(n.id), updatedAt: Tt(n.completedAt ?? n.createdAt), hasContext: null } };
1748
+ const i = n.latestRun === null || n.latestRun === void 0 ? null : we(n.latestRun), s = Tt(n.activeRefreshRunId);
1740
1749
  return { kind: t, value: {
1741
1750
  ...n.origin === void 0 ? {} : { origin: ne(n.origin) },
1742
- ...i?.createdAt === void 0 ? {} : { latestRun: { id: ne(i.id), status: ne(i.status), createdAt: ne(i.createdAt), completedAt: Rt(i.completedAt), error: Rt(i.error) } },
1751
+ ...i?.createdAt === void 0 ? {} : { latestRun: { id: ne(i.id), status: ne(i.status), createdAt: ne(i.createdAt), completedAt: Tt(i.completedAt), error: Tt(i.error) } },
1743
1752
  status: s ? "running" : i ? ne(i.status) : "idle",
1744
1753
  runId: s ?? (i ? ne(i.id) : null),
1745
- updatedAt: Rt(n.latestSnapshotUpdatedAt),
1754
+ updatedAt: Tt(n.latestSnapshotUpdatedAt),
1746
1755
  hasContext: ii(n.hasContext)
1747
1756
  } };
1748
1757
  }
@@ -1757,7 +1766,7 @@ function fs(t, e) {
1757
1766
  }
1758
1767
  function ms(t) {
1759
1768
  const e = we(t);
1760
- if (!ii(e.success)) throw new Error(Rt(e.message) ?? "Failed to submit feedback");
1769
+ if (!ii(e.success)) throw new Error(Tt(e.message) ?? "Failed to submit feedback");
1761
1770
  return { kind: "ack", success: !0 };
1762
1771
  }
1763
1772
  function Zo(t) {
@@ -1811,16 +1820,16 @@ function yh(t) {
1811
1820
  }
1812
1821
  case "starterPrompts": {
1813
1822
  const c = we(await a("/starter-prompts", o ? { page_url: i.pageUrl } : { origin: i.origin, page_url: i.pageUrl, include_user_suggestions: i.includeUserSuggestions }));
1814
- r = { kind: "starterPrompts", origin: i.origin, prompts: Cs(c.starterPrompts), ...c.runtimeHelpers === void 0 ? {} : { runtimeHelpersJavascript: c.runtimeHelpers === null ? null : Rt(we(c.runtimeHelpers).javascript) } };
1823
+ r = { kind: "starterPrompts", origin: i.origin, prompts: Cs(c.starterPrompts), ...c.runtimeHelpers === void 0 ? {} : { runtimeHelpersJavascript: c.runtimeHelpers === null ? null : Tt(we(c.runtimeHelpers).javascript) } };
1815
1824
  break;
1816
1825
  }
1817
1826
  case "userSuggestedTasks": {
1818
- const c = we(await a("/user-suggested-tasks"));
1827
+ const c = we(await t.http.request("/user-suggested-tasks", {}, void 0, "GET", "runtime", { skipAuthentication: !0 }));
1819
1828
  if (!Array.isArray(c.proactiveSuggestions)) throw new Error("Invalid proactive suggestions.");
1820
1829
  r = {
1821
1830
  kind: "userSuggestedTasks",
1822
1831
  prompts: Cs(c.starterPrompts),
1823
- morningReportOpening: Rt(c.morningReportOpening),
1832
+ morningReportOpening: Tt(c.morningReportOpening),
1824
1833
  signupAt: ne(c.signupAt),
1825
1834
  proactiveSuggestions: c.proactiveSuggestions.map(mh)
1826
1835
  };
@@ -1991,7 +2000,7 @@ function $d(t, e, n) {
1991
2000
  h(new Error("Feature authority retired."));
1992
2001
  return;
1993
2002
  }
1994
- if (e.type === "stage7.query" && e.query.kind === "originContext" && y.features.contextObservers[e.query.clientScopeId] !== Nt(i, e.query)) {
2003
+ if (e.type === "stage7.query" && e.query.kind === "originContext" && y.features.contextObservers[e.query.clientScopeId] !== At(i, e.query)) {
1995
2004
  h(Object.assign(new Error("Context observation retired."), { code: "observation_released", retryable: !1 }));
1996
2005
  return;
1997
2006
  }
@@ -2138,7 +2147,7 @@ function Yr(t, e) {
2138
2147
  if (e.conversation_id !== t.sessionId) throw new Error("Execution belongs to another conversation.");
2139
2148
  if (to(e.version), t.execution && e.version <= t.execution.version) return t;
2140
2149
  const n = { ...t.executionByUserMessage };
2141
- for (const i of Tt(e)) n[i] = {
2150
+ for (const i of qt(e)) n[i] = {
2142
2151
  version: e.version,
2143
2152
  phase: e.phase,
2144
2153
  responseMessageIds: e.response_message_groups?.find((s) => s.includes(i)) ?? [i]
@@ -2359,9 +2368,9 @@ function Ah(t, e, n, i) {
2359
2368
  }
2360
2369
  case "conversation.stop": {
2361
2370
  if (n.clients[e.clientScopeId] !== e.conversationScopeId) return { state: t, effects: o };
2362
- const r = n.selections[e.conversationScopeId].sessionId, c = r ? t.sessions[r]?.execution : null, d = Object.values(t.submissions).filter((f) => (r ? f.sessionId === r : f.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(f.userMessageId))), u = d.filter((f) => !f.cancelled && (f.delivery !== "failed" || t.deliveries[f.userMessageId]?.phase === "paused" || e.userMessageIds?.includes(f.userMessageId) && t.deliveries[f.userMessageId]?.acceptance === "unissued") && (f.delivery !== "accepted" || f.executionVersion === null)), l = u.length > 0, h = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || Tt(c).some((f) => e.userMessageIds.includes(f)));
2371
+ const r = n.selections[e.conversationScopeId].sessionId, c = r ? t.sessions[r]?.execution : null, d = Object.values(t.submissions).filter((f) => (r ? f.sessionId === r : f.conversationScopeId === e.conversationScopeId) && (!e.userMessageIds || e.userMessageIds.includes(f.userMessageId))), u = d.filter((f) => !f.cancelled && (f.delivery !== "failed" || t.deliveries[f.userMessageId]?.phase === "paused" || e.userMessageIds?.includes(f.userMessageId) && t.deliveries[f.userMessageId]?.acceptance === "unissued") && (f.delivery !== "accepted" || f.executionVersion === null)), l = u.length > 0, h = c && ["queued", "thinking", "steering", "stopping"].includes(c.phase) && (!e.userMessageIds || qt(c).some((f) => e.userMessageIds.includes(f)));
2363
2372
  if (!l && !h && (c || !e.userMessageIds?.length)) return { state: t, effects: o };
2364
- const g = Array.from(new Set(e.userMessageIds ?? [...u.map((f) => f.userMessageId), ...h ? Tt(c) : []])), y = { ...t.submissions };
2373
+ const g = Array.from(new Set(e.userMessageIds ?? [...u.map((f) => f.userMessageId), ...h ? qt(c) : []])), y = { ...t.submissions };
2365
2374
  for (const f of d)
2366
2375
  g.includes(f.userMessageId) && f.delivery !== "accepted" && (y[f.userMessageId] = { ...f, cancelled: !0, cancellationReason: e.reason ?? "user_requested" });
2367
2376
  s = { ...t, submissions: y, stops: { ...t.stops, [e.conversationScopeId]: {
@@ -2574,7 +2583,7 @@ function ia(t) {
2574
2583
  };
2575
2584
  for (const [r, c] of Object.entries(e.stops))
2576
2585
  for (const d of c.userMessageIds) {
2577
- const u = e.submissions[d], l = u?.sessionId ?? Object.values(e.sessions).find((g) => Tt(g.execution).includes(d))?.sessionId, h = u?.delivery === "accepted" || l && Tt(e.sessions[l]?.execution).includes(d);
2586
+ const u = e.submissions[d], l = u?.sessionId ?? Object.values(e.sessions).find((g) => qt(g.execution).includes(d))?.sessionId, h = u?.delivery === "accepted" || l && qt(e.sessions[l]?.execution).includes(d);
2578
2587
  l && h && a(`stop:${r}:${c.requestId}:${d}`, l, d, c.reason);
2579
2588
  }
2580
2589
  for (const r of Object.values(e.submissions))
@@ -5412,7 +5421,7 @@ const Yg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5412
5421
  return te;
5413
5422
  }
5414
5423
  }, Symbol.toStringTag, { value: "Module" }));
5415
- function At(t, e, n) {
5424
+ function Rt(t, e, n) {
5416
5425
  return t.on(e, n), function() {
5417
5426
  t.off(e, n);
5418
5427
  };
@@ -5460,10 +5469,10 @@ class au extends Re {
5460
5469
  return;
5461
5470
  const e = this.io;
5462
5471
  this.subs = [
5463
- At(e, "open", this.onopen.bind(this)),
5464
- At(e, "packet", this.onpacket.bind(this)),
5465
- At(e, "error", this.onerror.bind(this)),
5466
- At(e, "close", this.onclose.bind(this))
5472
+ Rt(e, "open", this.onopen.bind(this)),
5473
+ Rt(e, "packet", this.onpacket.bind(this)),
5474
+ Rt(e, "error", this.onerror.bind(this)),
5475
+ Rt(e, "close", this.onclose.bind(this))
5467
5476
  ];
5468
5477
  }
5469
5478
  /**
@@ -6095,11 +6104,11 @@ class ca extends Re {
6095
6104
  this.engine = new zg(this.uri, this.opts);
6096
6105
  const n = this.engine, i = this;
6097
6106
  this._readyState = "opening", this.skipReconnect = !1;
6098
- const s = At(n, "open", function() {
6107
+ const s = Rt(n, "open", function() {
6099
6108
  i.onopen(), e && e();
6100
6109
  }), o = (r) => {
6101
6110
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", r), e ? e(r) : this.maybeReconnectOnOpen();
6102
- }, a = At(n, "error", o);
6111
+ }, a = Rt(n, "error", o);
6103
6112
  if (this._timeout !== !1) {
6104
6113
  const r = this._timeout, c = this.setTimeoutFn(() => {
6105
6114
  s(), o(new Error("timeout")), n.close();
@@ -6128,12 +6137,12 @@ class ca extends Re {
6128
6137
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
6129
6138
  const e = this.engine;
6130
6139
  this.subs.push(
6131
- At(e, "ping", this.onping.bind(this)),
6132
- At(e, "data", this.ondata.bind(this)),
6133
- At(e, "error", this.onerror.bind(this)),
6134
- At(e, "close", this.onclose.bind(this)),
6140
+ Rt(e, "ping", this.onping.bind(this)),
6141
+ Rt(e, "data", this.ondata.bind(this)),
6142
+ Rt(e, "error", this.onerror.bind(this)),
6143
+ Rt(e, "close", this.onclose.bind(this)),
6135
6144
  // @ts-ignore
6136
- At(this.decoder, "decoded", this.ondecoded.bind(this))
6145
+ Rt(this.decoder, "decoded", this.ondecoded.bind(this))
6137
6146
  );
6138
6147
  }
6139
6148
  /**
@@ -7269,7 +7278,6 @@ class Ae extends EventTarget {
7269
7278
  hydration = null;
7270
7279
  hydrations = Promise.resolve();
7271
7280
  bootstrapRequests = new AbortController();
7272
- suggestionTimer = null;
7273
7281
  diagnostics = [];
7274
7282
  diagnosticTimer = null;
7275
7283
  diagnosticFlush = !1;
@@ -7298,7 +7306,7 @@ class Ae extends EventTarget {
7298
7306
  }, 12e4));
7299
7307
  }
7300
7308
  resetBootstrap() {
7301
- this.bootstrapRequests.abort(), this.bootstrapRequests = new AbortController(), this.suggestionTimer !== null && clearTimeout(this.suggestionTimer), this.suggestionTimer = null;
7309
+ this.bootstrapRequests.abort(), this.bootstrapRequests = new AbortController();
7302
7310
  for (const [e, n] of this.contextRevisions) this.contextRevisions.set(e, n + 1);
7303
7311
  }
7304
7312
  queueDiagnostic(e, n = {}) {
@@ -7452,23 +7460,6 @@ class Ae extends EventTarget {
7452
7460
  isRetryableRead(e) {
7453
7461
  return e instanceof TypeError || e instanceof DOMException && e.name === "AbortError" || e instanceof L && ["request_timed_out", "408", "425", "429", "500", "502", "503", "504"].includes(e.code);
7454
7462
  }
7455
- async loadUserSuggestions(e, n = 0) {
7456
- const i = this.promptRevision, s = this.options.pageUrl();
7457
- this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !0 });
7458
- try {
7459
- const o = await this.httpTransport.request("/user-suggested-tasks", {}, void 0, void 0, void 0, { signal: e });
7460
- !e.aborted && i === this.promptRevision && s === this.options.pageUrl() && this.receive({ ...o, type: "starterPrompts.updated" });
7461
- } catch (o) {
7462
- if (e.aborted) return;
7463
- if (!this.isRetryableRead(o)) {
7464
- i === this.promptRevision && s === this.options.pageUrl() && this.receive({ type: "starterPrompts.updated", starterPromptsLoading: !1 }), o instanceof L && ["unauthorized", "update_required"].includes(o.code) ? this.fail(o) : console.error("Product Agent optional suggestions could not be loaded", o);
7465
- return;
7466
- }
7467
- this.suggestionTimer = setTimeout(() => {
7468
- this.suggestionTimer = null, this.loadUserSuggestions(e, n + 1);
7469
- }, Math.min(3e4, 1e3 * 2 ** Math.min(n, 5)));
7470
- }
7471
- }
7472
7463
  async dispatch(e, n) {
7473
7464
  const { type: i, ...s } = e, o = this.options.auth.client_kind === "embed", a = e.pageUrl ?? e.page?.url ?? this.options.pageUrl(), r = { page_url: a, origin: new URL(a).origin };
7474
7465
  if (i === "auth.session") {
@@ -7485,7 +7476,7 @@ class Ae extends EventTarget {
7485
7476
  if (h.aborted || !this.isCurrent(n) || (this.credentialBootstrap = null, !this.options.auth.community_id && g.user?.runtimeCommunityId && (this.options.auth.community_id = g.user.runtimeCommunityId), this.receive({ type: "auth.ok", ...g }), h.aborted)) return;
7486
7477
  this.options.auth.client_kind === "extension" && this.receive({ type: "executor.registered", userId: g.user.id }), this.bootstrapped = !0;
7487
7478
  for (const y of this.beforeBootstrap.splice(0)) this.receive(y);
7488
- this.synchronizeReferences(), this.options.auth.client_kind === "web" && this.loadUserSuggestions(h);
7479
+ this.synchronizeReferences();
7489
7480
  return;
7490
7481
  }
7491
7482
  if (i === "runtime.auth_ack") {
@@ -9489,8 +9480,8 @@ class $a {
9489
9480
  if (!k.startsWith(`background:${this.modelClientScopeId}:`)) continue;
9490
9481
  const S = fn(f.conversation, f.directory, m), _ = S.sessionId ? f.conversation.sessions[S.sessionId] : void 0;
9491
9482
  if (this.firstResponseTimersByClientMessageId.size && (u(ir(S, _?.queries.current, this.options.backendUrl).messages, S.sessionId), ["failed", "stopped"].includes(S.activity.phase)))
9492
- for (const R of Tt(_?.execution)) this.clearFirstResponseTimer(R);
9493
- const x = S.activity.phase === "completed" && Tt(_?.execution).some((R) => this.firstResponseTimersByClientMessageId.has(R));
9483
+ for (const R of qt(_?.execution)) this.clearFirstResponseTimer(R);
9484
+ const x = S.activity.phase === "completed" && qt(_?.execution).some((R) => this.firstResponseTimersByClientMessageId.has(R));
9494
9485
  (w && S.sessionId === this.getState().sessionId || !x && ["completed", "failed", "stopped"].includes(S.activity.phase)) && this.directoryScope.detach(k);
9495
9486
  }
9496
9487
  const v = this.getState();
@@ -9559,7 +9550,7 @@ class $a {
9559
9550
  i.sessionId ? e.conversation.sessions[i.sessionId]?.queries.current : void 0,
9560
9551
  this.options.backendUrl,
9561
9552
  this.clientRuntime.engine.getDiagnostics({ clientScopeId: this.modelClientScopeId, scopeId: n, sessionId: i.sessionId })
9562
- ), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = Jr(e, { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }), r = Jr(e, { kind: "appearance", ...o }), c = r?.data?.kind === "appearance" ? r.data.value : null;
9553
+ ), o = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href }, a = Jr(e, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...o, includeUserSuggestions: !1 }), r = Jr(e, { kind: "appearance", ...o }), c = r?.data?.kind === "appearance" ? r.data.value : null;
9563
9554
  return {
9564
9555
  ...this.platformState,
9565
9556
  ...s,
@@ -9571,7 +9562,7 @@ class $a {
9571
9562
  lastError: s.lastError ?? this.platformState.lastError,
9572
9563
  lastErrorCode: s.lastErrorCode ?? this.platformState.lastErrorCode,
9573
9564
  lastErrorSecuritySettingsUrl: !s.lastErrorCode || s.lastErrorCode === this.platformState.lastErrorCode ? this.platformState.lastErrorSecuritySettingsUrl : null,
9574
- starterPrompts: a?.data?.kind === "starterPrompts" ? [...a.data.prompts] : yy(this.options.initialStarterPrompts),
9565
+ starterPrompts: a?.data && (a.data.kind === "starterPrompts" || a.data.kind === "userSuggestedTasks") ? [...a.data.prompts] : yy(this.options.initialStarterPrompts),
9575
9566
  starterPromptsLoading: a?.status === "loading" || a?.status === "refreshing",
9576
9567
  appearance: c ? { accentColor: c.accent, colorScheme: c.colorScheme, fontFamily: c.fontFamily, scribbleStyle: c.scribbleStyle } : null
9577
9568
  };
@@ -10699,7 +10690,7 @@ class $a {
10699
10690
  const e = { clientScopeId: this.modelClientScopeId, origin: location.origin, pageUrl: location.href };
10700
10691
  return Promise.all([
10701
10692
  er(this.clientRuntime, { kind: "appearance", ...e }),
10702
- er(this.clientRuntime, { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (n) => {
10693
+ er(this.clientRuntime, this.options.productVariant === "personal" ? { kind: "userSuggestedTasks" } : { kind: "starterPrompts", ...e, includeUserSuggestions: !1 }).then(async (n) => {
10703
10694
  n.kind === "starterPrompts" && n.prompts.length === 0 && location.href === e.pageUrl && await this.requestTransientStarterPrompts();
10704
10695
  })
10705
10696
  ]).then(() => {
@@ -12822,16 +12813,16 @@ function fb(t) {
12822
12813
  inner: "#4b4b4b",
12823
12814
  shadow: "#000000"
12824
12815
  } : {
12825
- top: Lt(e, 0.28, -0.03),
12826
- middle: Lt(e, 0.08, 0.04),
12827
- bottom: Lt(e, -0.1, 0.02),
12828
- edgeStart: Lt(e, 0.08, 0.08),
12829
- edgeMiddle: Lt(e, -0.08, 0.08),
12830
- edgeEnd: Lt(e, -0.18, 0.05),
12831
- glow: Lt(e, 0.32, -0.12),
12832
- highlight: Lt(e, 0.38, -0.18),
12833
- inner: Lt(e, 0.24, -0.1),
12834
- shadow: Lt(e, -0.25, -0.08)
12816
+ top: Nt(e, 0.28, -0.03),
12817
+ middle: Nt(e, 0.08, 0.04),
12818
+ bottom: Nt(e, -0.1, 0.02),
12819
+ edgeStart: Nt(e, 0.08, 0.08),
12820
+ edgeMiddle: Nt(e, -0.08, 0.08),
12821
+ edgeEnd: Nt(e, -0.18, 0.05),
12822
+ glow: Nt(e, 0.32, -0.12),
12823
+ highlight: Nt(e, 0.38, -0.18),
12824
+ inner: Nt(e, 0.24, -0.1),
12825
+ shadow: Nt(e, -0.25, -0.08)
12835
12826
  };
12836
12827
  }
12837
12828
  function zu(t) {
@@ -12868,7 +12859,7 @@ function mb(t, e, n) {
12868
12859
  t[2] + (e[2] - t[2]) * i
12869
12860
  ];
12870
12861
  }
12871
- function Lt(t, e, n) {
12862
+ function Nt(t, e, n) {
12872
12863
  const [i, s, o] = yb($i(t));
12873
12864
  return fa(bb(i, ya(s + n), ya(o + e)));
12874
12865
  }
@@ -13341,7 +13332,7 @@ async function lw(t = {}) {
13341
13332
  }
13342
13333
  );
13343
13334
  const o = document.createElement("div");
13344
- o.className = "pluno-pa-widget-host", o.style.setProperty("display", "block", "important"), o.setAttribute("data-pluno-product-agent-ui", "widget"), o.setAttribute("data-pluno-product-agent-layout", e.layout), e.extensionRuntime && (e.extensionRuntime.markHostOwner?.(o), Object.defineProperty(o, aw, {
13335
+ o.className = "pluno-pa-widget-host", o.style.setProperty("display", "block", "important"), e.layout === "floating" && o.style.setProperty("position", "absolute", "important"), o.setAttribute("data-pluno-product-agent-ui", "widget"), o.setAttribute("data-pluno-product-agent-layout", e.layout), e.extensionRuntime && (e.extensionRuntime.markHostOwner?.(o), Object.defineProperty(o, aw, {
13345
13336
  configurable: !0,
13346
13337
  value: e.extensionRuntime.ownerId
13347
13338
  }));
@@ -13551,7 +13542,7 @@ async function lw(t = {}) {
13551
13542
  ci.clear();
13552
13543
  };
13553
13544
  let vt = 0, en = 0, sc = 0;
13554
- const qt = /* @__PURE__ */ new Map();
13545
+ const Pt = /* @__PURE__ */ new Map();
13555
13546
  let tn = null, jt = null;
13556
13547
  const ho = (p) => p === $ ? "widget_composer" : p === m ? "widget_launcher" : p && a.contains(p) ? "widget_control" : p === w.body ? "body" : p === w.documentElement ? "document" : p ? "host_page" : "none", _n = (p, I, C = {}) => {
13557
13548
  const A = xs(w), j = C.skipIfAlreadyFocused === !0 && A === p;
@@ -13645,7 +13636,7 @@ async function lw(t = {}) {
13645
13636
  ...A ? { proactiveSuggestionQuestion: C.text } : {}
13646
13637
  })) throw Object.assign(new Error("The task was not submitted."), { code: "interaction_not_started" });
13647
13638
  } else if (C.kind === "edit")
13648
- rt = e.proactiveSuggestion, _e = !0, M.stageProactiveSuggestionQuestion(C.text), Mt("Yes, but ", !0, !0, !0, "proactive_suggestion");
13639
+ rt = e.proactiveSuggestion, _e = !0, M.stageProactiveSuggestionQuestion(C.text), Ot("Yes, but ", !0, !0, !0, "proactive_suggestion");
13649
13640
  else throw new Error("The requested platform action is unavailable.");
13650
13641
  } },
13651
13642
  activeUsersLoader: e.activeUsersLoader,
@@ -13662,20 +13653,20 @@ async function lw(t = {}) {
13662
13653
  } catch (p) {
13663
13654
  throw go?.release(), o.remove(), p;
13664
13655
  }
13665
- let di = M.getState().sessionId, ui = M.getState().selectionKey, pi = M.getState().user?.id ?? null, Pt = Ns.find(
13656
+ let di = M.getState().sessionId, ui = M.getState().selectionKey, pi = M.getState().user?.id ?? null, Mt = Ns.find(
13666
13657
  (p) => p.value === e.model
13667
13658
  )?.value ?? Vs[0].value, hi = !1;
13668
13659
  const ac = e.productVariant === "personal" && e.onModelChange !== void 0;
13669
13660
  de.hidden = !ac;
13670
13661
  const Wn = () => {
13671
- const p = Ns.find((C) => C.value === Pt), I = hi;
13672
- Me.textContent = p?.label ?? Pt, de.dataset.loading = String(I), de.setAttribute("aria-disabled", String(I));
13662
+ const p = Ns.find((C) => C.value === Mt), I = hi;
13663
+ Me.textContent = p?.label ?? Mt, de.dataset.loading = String(I), de.setAttribute("aria-disabled", String(I));
13673
13664
  for (const C of ce) {
13674
- const A = C.dataset.model === Pt;
13665
+ const A = C.dataset.model === Mt;
13675
13666
  C.classList.toggle("is-selected", A), C.setAttribute("aria-selected", String(A)), C.disabled = I;
13676
13667
  }
13677
13668
  }, gp = (p) => {
13678
- Pt = p, M.setModel(p), Wn();
13669
+ Mt = p, M.setModel(p), Wn();
13679
13670
  };
13680
13671
  Wn(), de.addEventListener("toggle", () => {
13681
13672
  de.open && hi && (de.open = !1), de.open || de.querySelector(".pluno-pa-widget__model-more")?.removeAttribute("open");
@@ -13687,13 +13678,13 @@ async function lw(t = {}) {
13687
13678
  for (const p of ce)
13688
13679
  p.addEventListener("click", () => {
13689
13680
  const I = Ns.find((A) => A.value === p.dataset.model);
13690
- if (!I || I.value === Pt && M.getModel() === I.value || hi) {
13681
+ if (!I || I.value === Mt && M.getModel() === I.value || hi) {
13691
13682
  de.open = !1;
13692
13683
  return;
13693
13684
  }
13694
- const C = Pt;
13695
- Pt = I.value, hi = !0, de.open = !1, de.title = "", Wn(), Promise.resolve(e.onModelChange?.(I.value)).then(() => gp(I.value)).catch(() => {
13696
- Pt = C, de.title = "Could not change model";
13685
+ const C = Mt;
13686
+ Mt = I.value, hi = !0, de.open = !1, de.title = "", Wn(), Promise.resolve(e.onModelChange?.(I.value)).then(() => gp(I.value)).catch(() => {
13687
+ Mt = C, de.title = "Could not change model";
13697
13688
  }).finally(() => {
13698
13689
  hi = !1, Wn();
13699
13690
  });
@@ -14026,7 +14017,7 @@ async function lw(t = {}) {
14026
14017
  let So = !1, En = !1;
14027
14018
  const xo = () => {
14028
14019
  const p = M.getState().status === "error" && ["unauthorized", "invalid_token", "update_required"].includes(M.getState().lastErrorCode ?? ""), I = !!e.billingStatus && e.billingStatus?.submissionGate?.reason !== "connection_required";
14029
- xn.hidden = p || M.getState().status !== "connected" || !So || I || e.productVariant !== "personal" || Dt(), xn.hidden ? bi.remove() : bi.parentElement !== xn && xn.append(bi), kn.disabled = En, kn.setAttribute("aria-busy", String(En)), vc.hidden = !En, Ic.data = En ? "Trying" : "Try again";
14020
+ xn.hidden = p || M.getState().status !== "connected" || !So || I || e.productVariant !== "personal" || Lt(), xn.hidden ? bi.remove() : bi.parentElement !== xn && xn.append(bi), kn.disabled = En, kn.setAttribute("aria-busy", String(En)), vc.hidden = !En, Ic.data = En ? "Trying" : "Try again";
14030
14021
  }, ko = async () => {
14031
14022
  if (!(En || Ue)) {
14032
14023
  En = !0, xo();
@@ -14048,7 +14039,7 @@ async function lw(t = {}) {
14048
14039
  });
14049
14040
  let wi = null;
14050
14041
  const Sc = (p) => {
14051
- if (Dt())
14042
+ if (Lt())
14052
14043
  return;
14053
14044
  const I = Date.now(), C = window.location.href;
14054
14045
  p === "composer_input" && wi?.scope === C && I - wi.requestedAt < qb || (p === "composer_input" && (wi = { scope: C, requestedAt: I }), Promise.resolve(M.warmup(p)).catch((A) => {
@@ -14058,7 +14049,7 @@ async function lw(t = {}) {
14058
14049
  Dn(A)
14059
14050
  );
14060
14051
  }));
14061
- }, Mt = (p = "", I = !0, C = !0, A = !0, j = "external_request") => {
14052
+ }, Ot = (p = "", I = !0, C = !0, A = !0, j = "external_request") => {
14062
14053
  const X = r.classList.contains("pluno-pa-widget--open") || !x.hidden && !r.classList.contains("pluno-pa-widget--closing");
14063
14054
  !X && A && Sc("panel_open"), ko(), Ii && (Ii = !1, qo()), r.classList.contains("pluno-pa-widget--open") || (y = null), It !== null && (window.clearTimeout(It), It = null), mi("shown", !1), x.hidden = !1, P.hidden = !1, Pr(
14064
14055
  q,
@@ -14092,22 +14083,22 @@ async function lw(t = {}) {
14092
14083
  }, 220);
14093
14084
  };
14094
14085
  v.addEventListener("submit", (p) => {
14095
- p.preventDefault(), Mt(m.value, !0, !0, !0, "launcher_input"), m.value = "";
14086
+ p.preventDefault(), Ot(m.value, !0, !0, !0, "launcher_input"), m.value = "";
14096
14087
  }), k?.addEventListener("click", (p) => {
14097
14088
  p.preventDefault(), p.stopPropagation();
14098
14089
  }), v.addEventListener("click", (p) => {
14099
- p.target === m && !k || (Mt(m.value, !0, !0, !0, "launcher_click"), m.value = "");
14090
+ p.target === m && !k || (Ot(m.value, !0, !0, !0, "launcher_click"), m.value = "");
14100
14091
  });
14101
14092
  const xc = () => {
14102
- Mt(m.value, !0, !0, !0, "launcher_focus"), m.value = "";
14093
+ Ot(m.value, !0, !0, !0, "launcher_focus"), m.value = "";
14103
14094
  };
14104
14095
  m.addEventListener("focus", xc), m.addEventListener("input", () => {
14105
14096
  if (!m.value)
14106
14097
  return;
14107
14098
  const p = m.value;
14108
- Mt(p, !0, !0, !0, "launcher_input"), m.value = "";
14099
+ Ot(p, !0, !0, !0, "launcher_input"), m.value = "";
14109
14100
  });
14110
- let _i = null, an = null, ns = null, Cn = null, Ot = null, ze = null;
14101
+ let _i = null, an = null, ns = null, Cn = null, Dt = null, ze = null;
14111
14102
  const is = (p) => p === m || p === $, kc = (p) => p.composedPath().find(is) ?? null, Sp = (p) => {
14112
14103
  let I = p;
14113
14104
  for (; I; ) {
@@ -14147,10 +14138,10 @@ async function lw(t = {}) {
14147
14138
  }, Ro = (p, I) => {
14148
14139
  if (!I)
14149
14140
  return;
14150
- Ot !== null && window.clearTimeout(Ot);
14141
+ Dt !== null && window.clearTimeout(Dt);
14151
14142
  const C = Date.now();
14152
- Ot = window.setTimeout(() => {
14153
- Ot = null, Ht === p && I.isConnected && _n(I, "host_modal_recovery", {
14143
+ Dt = window.setTimeout(() => {
14144
+ Dt = null, Ht === p && I.isConnected && _n(I, "host_modal_recovery", {
14154
14145
  preventScroll: !0,
14155
14146
  scheduledAt: C
14156
14147
  });
@@ -14167,9 +14158,9 @@ async function lw(t = {}) {
14167
14158
  return;
14168
14159
  }
14169
14160
  Ro(C, null);
14170
- }, Kb)) : (Cn !== null && (window.clearInterval(Cn), Cn = null), Ot !== null && (window.clearTimeout(Ot), Ot = null), ns = null);
14161
+ }, Kb)) : (Cn !== null && (window.clearInterval(Cn), Cn = null), Dt !== null && (window.clearTimeout(Dt), Dt = null), ns = null);
14171
14162
  }, kp = () => {
14172
- Cn !== null && (window.clearInterval(Cn), Cn = null), Ot !== null && (window.clearTimeout(Ot), Ot = null), ze !== null && (window.clearTimeout(ze), ze = null);
14163
+ Cn !== null && (window.clearInterval(Cn), Cn = null), Dt !== null && (window.clearTimeout(Dt), Dt = null), ze !== null && (window.clearTimeout(ze), ze = null);
14173
14164
  }, Ec = (p) => {
14174
14165
  const I = kc(p);
14175
14166
  if (!I)
@@ -14229,7 +14220,7 @@ async function lw(t = {}) {
14229
14220
  Ht === null && C.isConnected && j(Ao());
14230
14221
  }, 0);
14231
14222
  }), v.addEventListener("keydown", (p) => {
14232
- !r.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(), Mt("", !0, !0, !0, "minimized_launcher"));
14223
+ !r.classList.contains("pluno-pa-widget--minimized") || p.key !== "Enter" && p.key !== " " || (p.preventDefault(), Ot("", !0, !0, !0, "minimized_launcher"));
14233
14224
  }), _?.addEventListener("pointerdown", (p) => {
14234
14225
  p.stopPropagation();
14235
14226
  }), _?.addEventListener("click", (p) => {
@@ -14268,7 +14259,7 @@ async function lw(t = {}) {
14268
14259
  F.style.paddingBottom = `${p > 0 ? p + 24 : 12}px`, Ft.enabled && Xn(F, () => Ft.enabled);
14269
14260
  });
14270
14261
  Rc?.observe(Ac);
14271
- const Dt = () => e.loginRequired || e.signupRequired;
14262
+ const Lt = () => e.loginRequired || e.signupRequired;
14272
14263
  let Ht = null, Ii = !1, os = M.getState().status === "connected";
14273
14264
  const Si = () => {
14274
14265
  const p = M.getState().status;
@@ -14276,14 +14267,14 @@ async function lw(t = {}) {
14276
14267
  }, Tc = () => M.getState().status !== "connected", An = () => {
14277
14268
  if (e.productVariant !== "personal") return Tc();
14278
14269
  const p = e.billingStatus?.auth;
14279
- return !p?.user || !p.workspace || Dt();
14270
+ return !p?.user || !p.workspace || Lt();
14280
14271
  }, To = () => {
14281
14272
  const p = M.getState().status;
14282
14273
  return Si() ? !1 : p !== "connected" && !(os && p === "reconnecting");
14283
14274
  }, Vn = () => {
14284
- const p = Dt(), I = M.getState(), C = !I.isThinking && !I.pendingMessageStatus && !!I.lastError;
14275
+ const p = Lt(), I = M.getState(), C = !I.isThinking && !I.pendingMessageStatus && !!I.lastError;
14285
14276
  m.readOnly = !1, $.readOnly = !1, m.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : C ? "Needs attention" : Ii ? "New update" : e.launcherLabel, $.placeholder = p ? e.signupRequired ? e.signupButtonLabel : e.loginButtonLabel : Vt.launcherLabel, z.hidden = p;
14286
- }, rs = () => [...qt.values()].some((p) => p.revision === en && p.generation === vt), qc = () => {
14277
+ }, rs = () => [...Pt.values()].some((p) => p.revision === en && p.generation === vt), qc = () => {
14287
14278
  const p = M.getState(), I = e.billingStatus;
14288
14279
  return {
14289
14280
  submissionAllowed: I?.submissionGate?.allowed === !0,
@@ -14296,8 +14287,8 @@ async function lw(t = {}) {
14296
14287
  // Delivery belongs to an earlier immutable input; only the current composer handoff blocks Send.
14297
14288
  hasPendingMessage: !1
14298
14289
  };
14299
- }, Rn = () => e.productVariant === "personal" ? Si() && !Dt() && !rs() && e.billingStatus?.submissionGate?.allowed === !0 || Xc(qc()) : !To() && !Qn(e.billingStatus) && !rs(), Pc = () => {
14300
- const p = M.getState(), I = !Si() && [...qt.values()].some((C) => C.revision === en && C.generation === vt);
14290
+ }, Rn = () => e.productVariant === "personal" ? Si() && !Lt() && !rs() && e.billingStatus?.submissionGate?.allowed === !0 || Xc(qc()) : !To() && !Qn(e.billingStatus) && !rs(), Pc = () => {
14291
+ const p = M.getState(), I = !Si() && [...Pt.values()].some((C) => C.revision === en && C.generation === vt);
14301
14292
  return th({
14302
14293
  hasRunningAssistantTurn: I || p.isThinking || p.turnPhase !== null || p.pendingMessageStatus !== null,
14303
14294
  // Retained text already submitted by this revision must not hide Stop behind a disabled Send.
@@ -14309,7 +14300,7 @@ async function lw(t = {}) {
14309
14300
  const p = Pc();
14310
14301
  ec(Te, p.action === "stop"), Te.disabled = p.disabled, e.productVariant === "personal" && (T && (T.disabled = !Rn()), r.querySelectorAll(".pluno-pa-widget__starter-prompt").forEach((I) => {
14311
14302
  I.disabled = !Rn();
14312
- })), be.disabled = Dt() || An() || e.productVariant !== "personal" && Qn(e.billingStatus);
14303
+ })), be.disabled = Lt() || An() || e.productVariant !== "personal" && Qn(e.billingStatus);
14313
14304
  };
14314
14305
  Vn();
14315
14306
  const qo = () => {
@@ -14321,7 +14312,7 @@ async function lw(t = {}) {
14321
14312
  };
14322
14313
  qo();
14323
14314
  const Po = () => {
14324
- if (!(Dt() || Ue))
14315
+ if (!(Lt() || Ue))
14325
14316
  return Vn(), Le(), M.connect().then(
14326
14317
  () => {
14327
14318
  Ue || (Vn(), Le());
@@ -14341,8 +14332,8 @@ async function lw(t = {}) {
14341
14332
  B.textContent = "", B.hidden = !0, jt = null;
14342
14333
  }, 3e3);
14343
14334
  }, Mo = (p, I) => {
14344
- const C = qt.get(p);
14345
- if (!C || I !== void 0 && C.submittedAt !== I || (qt.delete(p), C.generation !== vt || C.revision !== en)) return;
14335
+ const C = Pt.get(p);
14336
+ if (!C || I !== void 0 && C.submittedAt !== I || (Pt.delete(p), C.generation !== vt || C.revision !== en)) return;
14346
14337
  const A = new Set(C.attachments);
14347
14338
  ct = ct.filter((j) => !A.has(j)), $.value = "", $.dispatchEvent(new Event("input", { bubbles: !0 })), li(), Le();
14348
14339
  }, Mc = (p) => {
@@ -14359,14 +14350,14 @@ async function lw(t = {}) {
14359
14350
  I === vt && (M.getState().receipts === void 0 && Mo(p.clientMessageId), ve?.clientMessageId === p.clientMessageId && (ve.pendingSubmission = !1, A && (ve.clientMessageId = A), fc()), C && (_e = !1, rt = null, e.proactiveSuggestion = null, at()));
14360
14351
  }).catch((A) => {
14361
14352
  if (I !== vt) return;
14362
- ve?.clientMessageId === p.clientMessageId && (ve = null), qt.delete(p.clientMessageId), li();
14353
+ ve?.clientMessageId === p.clientMessageId && (ve = null), Pt.delete(p.clientMessageId), li();
14363
14354
  const j = A instanceof Error ? A.message : "Failed to upload attachment";
14364
14355
  M.getState().lastError !== j && as(j);
14365
14356
  }).finally(() => {
14366
14357
  I === vt && Le();
14367
14358
  });
14368
14359
  }, Oc = () => {
14369
- if (Ue || !tn || e.productVariant === "personal" && !Xc({ ...qc(), isSubmitting: !1 }) || M.getState().status !== "connected" || Dt() || Qn(e.billingStatus))
14360
+ if (Ue || !tn || e.productVariant === "personal" && !Xc({ ...qc(), isSubmitting: !1 }) || M.getState().status !== "connected" || Lt() || Qn(e.billingStatus))
14370
14361
  return;
14371
14362
  const p = tn;
14372
14363
  tn = null, Mc(p);
@@ -14376,7 +14367,7 @@ async function lw(t = {}) {
14376
14367
  return;
14377
14368
  for (const j of C)
14378
14369
  j.id && j.previewUrl && ci.set(j.id, j.previewUrl);
14379
- if ([...qt.values()].some((j) => j.revision === en && j.generation === vt)) return;
14370
+ if ([...Pt.values()].some((j) => j.revision === en && j.generation === vt)) return;
14380
14371
  const A = {
14381
14372
  inputValue: p,
14382
14373
  value: I,
@@ -14384,7 +14375,7 @@ async function lw(t = {}) {
14384
14375
  clientMessageId: crypto.randomUUID(),
14385
14376
  submittedAt: Math.max(Date.now(), sc + 1)
14386
14377
  };
14387
- if (sc = A.submittedAt, qt.set(A.clientMessageId, { ...A, revision: en, generation: vt }), Le(), ve = {
14378
+ if (sc = A.submittedAt, Pt.set(A.clientMessageId, { ...A, revision: en, generation: vt }), Le(), ve = {
14388
14379
  createdAt: Date.now(),
14389
14380
  clientMessageId: A.clientMessageId,
14390
14381
  observedConversation: null,
@@ -14421,7 +14412,7 @@ async function lw(t = {}) {
14421
14412
  e.productVariant === "customer_embedded"
14422
14413
  );
14423
14414
  if (en++, ct = [...ct, ...I], li(), Ep(), Le(), Ce(M.getState()), !r.classList.contains("pluno-pa-widget--open")) {
14424
- Mt("", !0, !0, !0, "attachment_drop");
14415
+ Ot("", !0, !0, !0, "attachment_drop");
14425
14416
  return;
14426
14417
  }
14427
14418
  nn("attachment_added");
@@ -14482,7 +14473,7 @@ async function lw(t = {}) {
14482
14473
  if (p.disabled)
14483
14474
  return;
14484
14475
  if (p.action === "stop") {
14485
- qt.clear(), tn = null, ve = null, M.stop(), Le();
14476
+ Pt.clear(), tn = null, ve = null, M.stop(), Le();
14486
14477
  return;
14487
14478
  }
14488
14479
  const I = $.value.trim().length > 0 || ct.length > 0;
@@ -14557,7 +14548,7 @@ async function lw(t = {}) {
14557
14548
  return;
14558
14549
  }
14559
14550
  p.key !== "Escape" || !$e || ($e = !1, $t(), nn("history_escape"));
14560
- }), d.composerValue && ($.value = d.composerValue, Oi($)), e.layout === "page" ? Mt($.value, !1, !0, !1, "external_request") : u === "minimized" ? mi("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && Mt($.value, !1, !1, !1, "restored_state");
14551
+ }), d.composerValue && ($.value = d.composerValue, Oi($)), e.layout === "page" ? Ot($.value, !1, !0, !1, "external_request") : u === "minimized" ? mi("minimized", !1) : e.initialDisplayState === void 0 && d.isOpen && Ot($.value, !1, !1, !1, "restored_state");
14561
14552
  const cs = () => c;
14562
14553
  let Lo = M.getState().appearance !== null, ls = M.getInteractions();
14563
14554
  const et = (p) => ls.find(
@@ -14623,7 +14614,7 @@ async function lw(t = {}) {
14623
14614
  };
14624
14615
  let Gn = null;
14625
14616
  const jo = (p = {}) => {
14626
- vt++, qt.clear(), ic(), tn = null, ve = null, gi = !1, Yi.clear(), on = !0, dt(!0, "newSession"), St(), $e = !1, $t();
14617
+ vt++, Pt.clear(), ic(), tn = null, ve = null, gi = !1, Yi.clear(), on = !0, dt(!0, "newSession"), St(), $e = !1, $t();
14627
14618
  const I = Promise.resolve(M.startNewSession(p));
14628
14619
  return wi = null, fo.clear(), $.value = "", ct = [], li(), Oi($), Ge(), Le(), _n($, "new_chat"), Ce(M.getState()), I;
14629
14620
  };
@@ -14865,8 +14856,8 @@ async function lw(t = {}) {
14865
14856
  if (!p && !os) return;
14866
14857
  const I = p?.auth;
14867
14858
  (I?.status !== "error" || I.errorCode !== "browser_session_unavailable" && I.errorCode !== "backend_auth_pending") && (hs += 1, ki = null, qn = !1);
14868
- const C = Dt();
14869
- e.billingStatus = p, n(p), Ho(M.getState()), Vn(), Ce(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), po(), Le(), queueMicrotask(Oc), C && !Dt() && Po();
14859
+ const C = Lt();
14860
+ e.billingStatus = p, n(p), Ho(M.getState()), Vn(), Ce(M.getState(), { skipUnchangedTimeline: !0, renderSource: "account" }), po(), Le(), queueMicrotask(Oc), C && !Lt() && Po();
14870
14861
  });
14871
14862
  let Ko = !1, Wo = null;
14872
14863
  const Wc = (p) => {
@@ -14874,13 +14865,13 @@ async function lw(t = {}) {
14874
14865
  };
14875
14866
  M.on("state", (p) => {
14876
14867
  const I = p.user?.id ?? null;
14877
- (di !== null && di !== p.sessionId || pi !== null && pi !== I || ui !== void 0 && ui !== p.selectionKey) && (vt++, qt.clear(), ve = null), ui = p.selectionKey, di = p.sessionId, pi = I;
14868
+ (di !== null && di !== p.sessionId || pi !== null && pi !== I || ui !== void 0 && ui !== p.selectionKey) && (vt++, Pt.clear(), ve = null), ui = p.selectionKey, di = p.sessionId, pi = I;
14878
14869
  for (const pe of p.messages)
14879
14870
  pe.role === "user" && Mo(pe.id);
14880
14871
  for (const pe of p.receipts ?? []) Mo(pe.userMessageId, pe.acceptedRendererRevision);
14881
14872
  if (e.extensionRuntime && ($o += 1, ki = null), Ho(p), ac) {
14882
14873
  const pe = M.getModel(), kt = ub(pe) ? pe : Vs[0].value;
14883
- kt !== Pt && (Pt = kt, Wn());
14874
+ kt !== Mt && (Mt = kt, Wn());
14884
14875
  }
14885
14876
  Wc(p), p.status === "connected" && (os = !0, tn && queueMicrotask(() => {
14886
14877
  Oc();
@@ -14922,7 +14913,7 @@ async function lw(t = {}) {
14922
14913
  },
14923
14914
  openPanel: (p) => {
14924
14915
  const I = typeof p == "string" ? p : $.value, C = typeof p == "object" ? p.focusComposer !== !1 : !0, A = typeof p == "object" ? p.trigger ?? "external_request" : "external_request";
14925
- A === "proactive_suggestion" && e.proactiveSuggestion && (rt = e.proactiveSuggestion, _e = !0, at()), Mt(A === "proactive_suggestion" ? "Yes, but " : I, !1, C, !0, A);
14916
+ A === "proactive_suggestion" && e.proactiveSuggestion && (rt = e.proactiveSuggestion, _e = !0, at()), Ot(A === "proactive_suggestion" ? "Yes, but " : I, !1, C, !0, A);
14926
14917
  },
14927
14918
  closePanel: Eo,
14928
14919
  updateDisplayState: (p) => {