@tutti-os/agent-gui 0.0.15 → 0.0.16

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.
Files changed (50) hide show
  1. package/dist/AgentMentionSearchController-DqssJ2-b.d.ts +218 -0
  2. package/dist/agent-conversation/index.d.ts +3 -1
  3. package/dist/agent-conversation/index.js +5 -4
  4. package/dist/agent-conversation/index.js.map +1 -1
  5. package/dist/agent-message-center/index.d.ts +2 -1
  6. package/dist/agent-message-center/index.js +547 -287
  7. package/dist/agent-message-center/index.js.map +1 -1
  8. package/dist/app/renderer/agentactivity.css +144 -8
  9. package/dist/{chunk-H4HT3FE6.js → chunk-267VY3EJ.js} +40 -30
  10. package/dist/chunk-267VY3EJ.js.map +1 -0
  11. package/dist/{chunk-XHQGCP7A.js → chunk-CABHBFYH.js} +2 -2
  12. package/dist/{chunk-OFGXNXYT.js → chunk-EKATXC3W.js} +2 -2
  13. package/dist/{chunk-YKDFQADM.js → chunk-FJYH2ZPX.js} +177 -332
  14. package/dist/chunk-FJYH2ZPX.js.map +1 -0
  15. package/dist/{chunk-EK5RDKG7.js → chunk-GWR6WGZY.js} +21 -11
  16. package/dist/chunk-GWR6WGZY.js.map +1 -0
  17. package/dist/{chunk-7CBJJNX6.js → chunk-JNGYJ7GM.js} +2 -2
  18. package/dist/{chunk-7CBJJNX6.js.map → chunk-JNGYJ7GM.js.map} +1 -1
  19. package/dist/{chunk-U4F3COKL.js → chunk-KWPL3JYS.js} +83 -115
  20. package/dist/chunk-KWPL3JYS.js.map +1 -0
  21. package/dist/{chunk-2CA4NPP3.js → chunk-LW2S255I.js} +10 -7
  22. package/dist/{chunk-2CA4NPP3.js.map → chunk-LW2S255I.js.map} +1 -1
  23. package/dist/{chunk-SVOGXWFJ.js → chunk-LWRYYGPZ.js} +562 -468
  24. package/dist/chunk-LWRYYGPZ.js.map +1 -0
  25. package/dist/chunk-O5TUTXHT.js +196 -0
  26. package/dist/chunk-O5TUTXHT.js.map +1 -0
  27. package/dist/{chunk-KJPMZ7G5.js → chunk-SIDWRR5I.js} +39 -17
  28. package/dist/chunk-SIDWRR5I.js.map +1 -0
  29. package/dist/context-mention-palette/index.d.ts +5 -104
  30. package/dist/context-mention-palette/index.js +6 -5
  31. package/dist/i18n/index.d.ts +38 -16
  32. package/dist/i18n/index.js +1 -1
  33. package/dist/index.d.ts +22 -2
  34. package/dist/index.js +1825 -1303
  35. package/dist/index.js.map +1 -1
  36. package/dist/workbench/contribution.js +2 -2
  37. package/dist/workbench/index.d.ts +2 -1
  38. package/dist/workbench/index.js +2 -2
  39. package/dist/workbench/launch.js +1 -1
  40. package/dist/workspace-agent-generated-files.js +2 -2
  41. package/package.json +12 -12
  42. package/dist/agentFileMentionExtension-CM1c9bqk.d.ts +0 -86
  43. package/dist/chunk-EK5RDKG7.js.map +0 -1
  44. package/dist/chunk-H4HT3FE6.js.map +0 -1
  45. package/dist/chunk-KJPMZ7G5.js.map +0 -1
  46. package/dist/chunk-SVOGXWFJ.js.map +0 -1
  47. package/dist/chunk-U4F3COKL.js.map +0 -1
  48. package/dist/chunk-YKDFQADM.js.map +0 -1
  49. /package/dist/{chunk-XHQGCP7A.js.map → chunk-CABHBFYH.js.map} +0 -0
  50. /package/dist/{chunk-OFGXNXYT.js.map → chunk-EKATXC3W.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  approvalOptionDisplayLabel,
4
4
  getPromptToolDetails,
5
5
  isPromptRequestIdTitle
6
- } from "../chunk-2CA4NPP3.js";
6
+ } from "../chunk-LW2S255I.js";
7
7
  import {
8
8
  PLAN_IMPLEMENTATION_ACTION_IMPLEMENT,
9
9
  PLAN_IMPLEMENTATION_PROMPT,
@@ -16,16 +16,17 @@ import {
16
16
  cn,
17
17
  extractAgentMcpToolTarget,
18
18
  normalizeAskUserQuestions
19
- } from "../chunk-YKDFQADM.js";
19
+ } from "../chunk-FJYH2ZPX.js";
20
20
  import {
21
21
  managedAgentRoundedIconUrl,
22
22
  userAvatarPlaceholderUrl,
23
23
  workspaceAgentActivityStatusLabel
24
- } from "../chunk-OFGXNXYT.js";
24
+ } from "../chunk-EKATXC3W.js";
25
25
  import "../chunk-MTFSQWZ6.js";
26
26
  import {
27
27
  resolveWorkspaceAgentSessionSortTimeUnixMs
28
28
  } from "../chunk-IBIMGLCD.js";
29
+ import "../chunk-O5TUTXHT.js";
29
30
  import {
30
31
  workspaceAgentProviderLabel
31
32
  } from "../chunk-TYGL25EL.js";
@@ -35,12 +36,12 @@ import {
35
36
  import {
36
37
  AgentGuiI18nProvider,
37
38
  useTranslation
38
- } from "../chunk-KJPMZ7G5.js";
39
+ } from "../chunk-SIDWRR5I.js";
39
40
  import "../chunk-PJP5BUU6.js";
40
41
 
41
42
  // agent-message-center/WorkspaceAgentMessageCenterPanel.tsx
42
43
  import {
43
- memo,
44
+ memo as memo2,
44
45
  useCallback as useCallback2,
45
46
  useEffect as useEffect3,
46
47
  useLayoutEffect as useLayoutEffect2,
@@ -928,6 +929,8 @@ import { cn as cn3 } from "@tutti-os/ui-system";
928
929
 
929
930
  // agent-message-center/WorkspaceAgentMessageCenterCard.tsx
930
931
  import {
932
+ cloneElement,
933
+ memo,
931
934
  useCallback,
932
935
  useEffect,
933
936
  useLayoutEffect,
@@ -947,122 +950,129 @@ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
947
950
  function stopMessageCenterTextPointerPropagation(event) {
948
951
  event.stopPropagation();
949
952
  }
950
- function WorkspaceAgentMessageCenterCard({
951
- cardRef,
952
- highlighted = false,
953
- interactive = true,
954
- item,
955
- isSubmitting,
956
- onLinkAction,
957
- onOpenChat,
958
- onSubmitPrompt
959
- }) {
960
- "use memo";
961
- const { t } = useTranslation();
962
- const prompt = item.pendingPrompt;
963
- const displayTitle = normalizeAgentTitleText(item.title);
964
- const summary = messageCenterVisibleSummary(item);
965
- const displayStatus = statusClass(item);
966
- const statusLabel = workspaceAgentActivityStatusLabel(displayStatus, t);
967
- return /* @__PURE__ */ jsxs(
968
- "article",
969
- {
970
- ref: cardRef,
971
- className: cn2(
972
- "workspace-agent-message-center__card group/message-card flex min-w-0 flex-col gap-2.5 rounded-lg border border-[var(--line-2)] bg-[var(--background-fronted)] p-3.5 outline outline-0 outline-offset-2 outline-transparent transition-[background-color,border-color,outline-color]",
973
- isWaitingMessageCenterItem(item) && "agent-gui-edge-glow border-[var(--tutti-purple-border)] bg-[var(--tutti-purple-bg)]",
974
- highlighted && "outline-2 outline-[var(--accent)]"
975
- ),
976
- "data-highlighted": highlighted ? "true" : void 0,
977
- "data-message-center-digest-kind": item.digest.primary.kind,
978
- "data-message-center-item-id": item.id,
979
- "data-waiting": isWaitingMessageCenterItem(item) ? "true" : void 0,
980
- "data-status": displayStatus,
981
- tabIndex: highlighted ? -1 : void 0,
982
- children: [
983
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2.5", children: [
984
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
985
- /* @__PURE__ */ jsxs(Tooltip, { children: [
986
- /* @__PURE__ */ jsx2(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx2(
987
- "h3",
988
- {
989
- className: "workspace-agent-message-center__copy-text min-w-0 truncate text-[13px] font-bold leading-5 text-[var(--text-secondary)]",
990
- onPointerDown: stopMessageCenterTextPointerPropagation,
991
- children: displayTitle
992
- }
993
- ) }),
953
+ var WorkspaceAgentMessageCenterCard = memo(
954
+ function WorkspaceAgentMessageCenterCard2({
955
+ cardRef,
956
+ highlighted = false,
957
+ interactive = true,
958
+ item,
959
+ isSubmitting,
960
+ lazySummary = false,
961
+ onLinkAction,
962
+ onOpenChat,
963
+ onSubmitPrompt
964
+ }) {
965
+ "use memo";
966
+ const { t } = useTranslation();
967
+ const prompt = item.pendingPrompt;
968
+ const displayTitle = normalizeAgentTitleText(item.title);
969
+ const summary = messageCenterVisibleSummary(item);
970
+ const displayStatus = statusClass(item);
971
+ const statusLabel = workspaceAgentActivityStatusLabel(displayStatus, t);
972
+ return /* @__PURE__ */ jsxs(
973
+ "article",
974
+ {
975
+ ref: cardRef,
976
+ className: cn2(
977
+ "workspace-agent-message-center__card group/message-card flex min-w-0 flex-col gap-2.5 rounded-lg border border-[var(--line-2)] bg-[var(--background-fronted)] p-3.5 outline outline-0 outline-offset-2 outline-transparent transition-[background-color,border-color,outline-color]",
978
+ isWaitingMessageCenterItem(item) && "agent-gui-edge-glow border-[var(--tutti-purple-border)] bg-[var(--tutti-purple-bg)]",
979
+ highlighted && "outline-2 outline-[var(--accent)]"
980
+ ),
981
+ "data-highlighted": highlighted ? "true" : void 0,
982
+ "data-message-center-digest-kind": item.digest.primary.kind,
983
+ "data-message-center-item-id": item.id,
984
+ "data-waiting": isWaitingMessageCenterItem(item) ? "true" : void 0,
985
+ "data-status": displayStatus,
986
+ tabIndex: highlighted ? -1 : void 0,
987
+ children: [
988
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2.5", children: [
989
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
994
990
  /* @__PURE__ */ jsx2(
995
- TooltipContent,
991
+ LazyMessageCenterTooltip,
996
992
  {
993
+ content: displayTitle,
997
994
  side: "top",
998
995
  align: "start",
999
996
  className: "max-w-[min(360px,calc(100vw-32px))] whitespace-normal text-left [overflow-wrap:anywhere]",
1000
- children: displayTitle
997
+ children: /* @__PURE__ */ jsx2(
998
+ "h3",
999
+ {
1000
+ className: "workspace-agent-message-center__copy-text min-w-0 truncate text-[13px] font-bold leading-5 text-[var(--text-secondary)]",
1001
+ onPointerDown: stopMessageCenterTextPointerPropagation,
1002
+ children: displayTitle
1003
+ }
1004
+ )
1001
1005
  }
1002
- )
1006
+ ),
1007
+ item.cwd ? /* @__PURE__ */ jsx2(ProjectPathInfo, { path: item.cwd }) : null
1003
1008
  ] }),
1004
- item.cwd ? /* @__PURE__ */ jsx2(ProjectPathInfo, { path: item.cwd }) : null
1009
+ /* @__PURE__ */ jsxs(
1010
+ "span",
1011
+ {
1012
+ className: "workspace-agent-message-center__status inline-flex shrink-0 items-center gap-1.5 text-[11px] font-semibold leading-4 text-[var(--text-secondary)]",
1013
+ "data-status": displayStatus,
1014
+ title: statusLabel,
1015
+ children: [
1016
+ /* @__PURE__ */ jsx2(
1017
+ StatusDot,
1018
+ {
1019
+ tone: messageCenterStatusTone(item),
1020
+ pulse: isWaitingMessageCenterItem(item) || item.status === "working",
1021
+ size: "sm",
1022
+ title: statusLabel
1023
+ }
1024
+ ),
1025
+ /* @__PURE__ */ jsx2("span", { children: statusLabel })
1026
+ ]
1027
+ }
1028
+ )
1005
1029
  ] }),
1006
- /* @__PURE__ */ jsxs(
1007
- "span",
1030
+ summary ? /* @__PURE__ */ jsx2(
1031
+ MessageCenterSummary,
1008
1032
  {
1009
- className: "workspace-agent-message-center__status inline-flex shrink-0 items-center gap-1.5 text-[11px] font-semibold leading-4 text-[var(--text-secondary)]",
1010
- "data-status": displayStatus,
1011
- title: statusLabel,
1012
- children: [
1013
- /* @__PURE__ */ jsx2(
1014
- StatusDot,
1015
- {
1016
- tone: messageCenterStatusTone(item),
1017
- pulse: isWaitingMessageCenterItem(item) || item.status === "working",
1018
- size: "sm",
1019
- title: statusLabel
1020
- }
1021
- ),
1022
- /* @__PURE__ */ jsx2("span", { children: statusLabel })
1023
- ]
1033
+ item,
1034
+ lazy: lazySummary,
1035
+ onLinkAction,
1036
+ summary,
1037
+ emptyLabel: t("agentHost.workspaceAgentMessageCenterNoSummary")
1038
+ }
1039
+ ) : null,
1040
+ prompt && interactive ? /* @__PURE__ */ jsx2("div", { className: "min-w-0", children: /* @__PURE__ */ jsx2(
1041
+ AgentInteractivePromptSurface,
1042
+ {
1043
+ embedded: true,
1044
+ variant: "compact",
1045
+ keyboardShortcuts: false,
1046
+ prompt,
1047
+ isSubmitting,
1048
+ onSubmit: onSubmitPrompt,
1049
+ labels: buildWorkspaceAgentInteractivePromptLabels(
1050
+ t,
1051
+ item.provider
1052
+ )
1053
+ }
1054
+ ) }) : null,
1055
+ /* @__PURE__ */ jsx2(
1056
+ MessageCenterOpenChatButton,
1057
+ {
1058
+ provider: item.provider,
1059
+ item,
1060
+ label: t("agentHost.workspaceAgentMessageCenterOpenChat"),
1061
+ onOpenChat,
1062
+ alwaysVisible: interactive && prompt !== null
1024
1063
  }
1025
1064
  )
1026
- ] }),
1027
- summary ? /* @__PURE__ */ jsx2(
1028
- MessageCenterSummary,
1029
- {
1030
- item,
1031
- onLinkAction,
1032
- summary,
1033
- emptyLabel: t("agentHost.workspaceAgentMessageCenterNoSummary")
1034
- }
1035
- ) : null,
1036
- prompt && interactive ? /* @__PURE__ */ jsx2("div", { className: "min-w-0", children: /* @__PURE__ */ jsx2(
1037
- AgentInteractivePromptSurface,
1038
- {
1039
- embedded: true,
1040
- variant: "compact",
1041
- keyboardShortcuts: false,
1042
- prompt,
1043
- isSubmitting,
1044
- onSubmit: onSubmitPrompt,
1045
- labels: buildWorkspaceAgentInteractivePromptLabels(
1046
- t,
1047
- item.provider
1048
- )
1049
- }
1050
- ) }) : null,
1051
- /* @__PURE__ */ jsx2(
1052
- MessageCenterOpenChatButton,
1053
- {
1054
- provider: item.provider,
1055
- item,
1056
- label: t("agentHost.workspaceAgentMessageCenterOpenChat"),
1057
- onOpenChat,
1058
- alwaysVisible: interactive && prompt !== null
1059
- }
1060
- )
1061
- ]
1062
- }
1063
- );
1064
- }
1065
+ ]
1066
+ }
1067
+ );
1068
+ }
1069
+ );
1065
1070
  var STACK_PRESENCE_FALLBACK_MS = 380;
1071
+ var MESSAGE_CENTER_STACK_INITIAL_RENDER_COUNT = 24;
1072
+ var MESSAGE_CENTER_STACK_RENDER_BATCH_SIZE = 24;
1073
+ var MESSAGE_CENTER_STACK_RENDER_BATCH_DELAY_MS = 40;
1074
+ var MESSAGE_CENTER_SUMMARY_LAZY_ROOT_MARGIN = "480px 0px";
1075
+ var MESSAGE_CENTER_SUMMARY_OVERFLOW_MEASURE_DELAY_MS = 80;
1066
1076
  function useStackRegionPresence(visible) {
1067
1077
  const [mounted, setMounted] = useState(visible);
1068
1078
  const closing = mounted && !visible;
@@ -1092,117 +1102,171 @@ function useStackRegionPresence(visible) {
1092
1102
  );
1093
1103
  return { closing, mounted, onAnimationEnd };
1094
1104
  }
1095
- function WorkspaceAgentMessageCenterStack({
1096
- className,
1097
- expanded,
1098
- groupId,
1099
- items,
1100
- renderCard,
1101
- onCollapse,
1102
- onExpand
1103
- }) {
1104
- "use memo";
1105
- const { t } = useTranslation();
1106
- const summaryRegion = useStackRegionPresence(!expanded);
1107
- const cardsRegion = useStackRegionPresence(expanded);
1108
- if (items.length < 2) {
1109
- return null;
1110
- }
1111
- const collapseLabel = t(
1112
- "agentHost.workspaceAgentMessageCenterCollapseStackAria"
1113
- );
1114
- return /* @__PURE__ */ jsxs(
1115
- "div",
1116
- {
1117
- className: cn2("relative flex min-w-0 flex-col", className),
1118
- "data-stack-count": items.length,
1119
- "data-stack-motion": "smooth",
1120
- "data-stack-state": expanded ? "expanded" : "collapsed",
1121
- "data-stack-top-item-id": items[0]?.id,
1122
- "data-testid": `workspace-agent-message-stack-${groupId}`,
1123
- children: [
1124
- summaryRegion.mounted ? /* @__PURE__ */ jsx2(
1125
- "div",
1126
- {
1127
- className: cn2(
1128
- "workspace-agent-message-center__stack-rest min-w-0",
1129
- summaryRegion.closing ? "workspace-agent-message-center__stack-rest--closing" : "workspace-agent-message-center__stack-rest--opening"
1130
- ),
1131
- onAnimationEnd: summaryRegion.onAnimationEnd,
1132
- children: /* @__PURE__ */ jsx2(
1133
- "div",
1134
- {
1135
- className: "min-h-0 min-w-0 overflow-hidden",
1136
- "aria-hidden": summaryRegion.closing ? true : void 0,
1137
- inert: summaryRegion.closing ? true : void 0,
1138
- children: /* @__PURE__ */ jsx2(
1139
- MessageCenterStackSummary,
1140
- {
1141
- groupId,
1142
- items,
1143
- onExpand
1144
- }
1145
- )
1146
- }
1147
- )
1148
- }
1149
- ) : null,
1150
- cardsRegion.mounted ? /* @__PURE__ */ jsx2(
1151
- "div",
1152
- {
1153
- className: cn2(
1154
- "workspace-agent-message-center__stack-rest min-w-0",
1155
- cardsRegion.closing ? "workspace-agent-message-center__stack-rest--closing" : "workspace-agent-message-center__stack-rest--opening"
1156
- ),
1157
- onAnimationEnd: cardsRegion.onAnimationEnd,
1158
- children: /* @__PURE__ */ jsxs(
1159
- "div",
1160
- {
1161
- className: "min-h-0 min-w-0 overflow-hidden",
1162
- "aria-hidden": cardsRegion.closing ? true : void 0,
1163
- inert: cardsRegion.closing ? true : void 0,
1164
- children: [
1165
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2 px-0.5 pb-1.5", children: [
1166
- /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5 text-[13px] font-semibold leading-4 text-[var(--text-tertiary)]", children: [
1105
+ var WorkspaceAgentMessageCenterStack = memo(
1106
+ function WorkspaceAgentMessageCenterStack2({
1107
+ className,
1108
+ expanded,
1109
+ groupId,
1110
+ highlightedItemId,
1111
+ items,
1112
+ renderCard,
1113
+ onCollapse,
1114
+ onExpand
1115
+ }) {
1116
+ "use memo";
1117
+ const { t } = useTranslation();
1118
+ const summaryRegion = useStackRegionPresence(!expanded);
1119
+ const cardsRegion = useStackRegionPresence(expanded);
1120
+ const visibleItems = useBatchedMessageCenterStackItems({
1121
+ expanded,
1122
+ highlightedItemId,
1123
+ items,
1124
+ mounted: cardsRegion.mounted
1125
+ });
1126
+ if (items.length < 2) {
1127
+ return null;
1128
+ }
1129
+ const collapseLabel = t(
1130
+ "agentHost.workspaceAgentMessageCenterCollapseStackAria"
1131
+ );
1132
+ return /* @__PURE__ */ jsxs(
1133
+ "div",
1134
+ {
1135
+ className: cn2("relative flex min-w-0 flex-col", className),
1136
+ "data-stack-count": items.length,
1137
+ "data-stack-motion": "smooth",
1138
+ "data-stack-state": expanded ? "expanded" : "collapsed",
1139
+ "data-stack-top-item-id": items[0]?.id,
1140
+ "data-testid": `workspace-agent-message-stack-${groupId}`,
1141
+ children: [
1142
+ summaryRegion.mounted ? /* @__PURE__ */ jsx2(
1143
+ "div",
1144
+ {
1145
+ className: cn2(
1146
+ "workspace-agent-message-center__stack-rest min-w-0",
1147
+ summaryRegion.closing ? "workspace-agent-message-center__stack-rest--closing" : "workspace-agent-message-center__stack-rest--opening"
1148
+ ),
1149
+ onAnimationEnd: summaryRegion.onAnimationEnd,
1150
+ children: /* @__PURE__ */ jsx2(
1151
+ "div",
1152
+ {
1153
+ className: "min-h-0 min-w-0 overflow-hidden",
1154
+ "aria-hidden": summaryRegion.closing ? true : void 0,
1155
+ inert: summaryRegion.closing ? true : void 0,
1156
+ children: /* @__PURE__ */ jsx2(
1157
+ MessageCenterStackSummary,
1158
+ {
1159
+ groupId,
1160
+ items,
1161
+ onExpand
1162
+ }
1163
+ )
1164
+ }
1165
+ )
1166
+ }
1167
+ ) : null,
1168
+ cardsRegion.mounted ? /* @__PURE__ */ jsx2(
1169
+ "div",
1170
+ {
1171
+ className: cn2(
1172
+ "workspace-agent-message-center__stack-rest min-w-0",
1173
+ cardsRegion.closing ? "workspace-agent-message-center__stack-rest--closing" : "workspace-agent-message-center__stack-rest--opening"
1174
+ ),
1175
+ onAnimationEnd: cardsRegion.onAnimationEnd,
1176
+ children: /* @__PURE__ */ jsxs(
1177
+ "div",
1178
+ {
1179
+ className: "min-h-0 min-w-0 overflow-hidden",
1180
+ "aria-hidden": cardsRegion.closing ? true : void 0,
1181
+ inert: cardsRegion.closing ? true : void 0,
1182
+ children: [
1183
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-between gap-2 px-0.5 pb-1.5", children: [
1184
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5 text-[13px] font-semibold leading-4 text-[var(--text-tertiary)]", children: [
1185
+ /* @__PURE__ */ jsx2(
1186
+ MessageCenterIdentityAvatarMark,
1187
+ {
1188
+ identity: items[0]?.identity ?? null,
1189
+ provider: items[0]?.provider ?? "",
1190
+ userId: items[0]?.userId ?? null
1191
+ }
1192
+ ),
1193
+ /* @__PURE__ */ jsx2("span", { className: "min-w-0 truncate", children: t(
1194
+ "agentHost.workspaceAgentMessageCenterStackSummaryCount",
1195
+ {
1196
+ count: items.length
1197
+ }
1198
+ ) })
1199
+ ] }),
1167
1200
  /* @__PURE__ */ jsx2(
1168
- MessageCenterIdentityAvatarMark,
1201
+ LazyMessageCenterTooltip,
1169
1202
  {
1170
- identity: items[0]?.identity ?? null,
1171
- provider: items[0]?.provider ?? "",
1172
- userId: items[0]?.userId ?? null
1203
+ content: collapseLabel,
1204
+ side: "top",
1205
+ align: "center",
1206
+ children: /* @__PURE__ */ jsx2(
1207
+ Button,
1208
+ {
1209
+ type: "button",
1210
+ variant: "ghost",
1211
+ size: "icon-sm",
1212
+ "aria-label": collapseLabel,
1213
+ className: "size-6 text-[var(--text-tertiary)] hover:text-[var(--text-primary)]",
1214
+ onClick: () => onCollapse(groupId),
1215
+ children: /* @__PURE__ */ jsx2(ChevronUp, { className: "size-3.5", "aria-hidden": "true" })
1216
+ }
1217
+ )
1173
1218
  }
1174
- ),
1175
- /* @__PURE__ */ jsx2("span", { className: "min-w-0 truncate", children: t("agentHost.workspaceAgentMessageCenterStackSummaryCount", {
1176
- count: items.length
1177
- }) })
1219
+ )
1178
1220
  ] }),
1179
- /* @__PURE__ */ jsxs(Tooltip, { children: [
1180
- /* @__PURE__ */ jsx2(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx2(
1181
- Button,
1182
- {
1183
- type: "button",
1184
- variant: "ghost",
1185
- size: "icon-sm",
1186
- "aria-label": collapseLabel,
1187
- className: "size-6 text-[var(--text-tertiary)] hover:text-[var(--text-primary)]",
1188
- onClick: onCollapse,
1189
- children: /* @__PURE__ */ jsx2(ChevronUp, { className: "size-3.5", "aria-hidden": "true" })
1190
- }
1191
- ) }),
1192
- /* @__PURE__ */ jsx2(TooltipContent, { side: "top", align: "center", children: collapseLabel })
1193
- ] })
1194
- ] }),
1195
- /* @__PURE__ */ jsx2("div", { className: "flex min-w-0 flex-col gap-2.5", children: items.map(
1196
- (item, stackedIndex) => renderCard(item, { stackedIndex })
1197
- ) })
1198
- ]
1199
- }
1200
- )
1201
- }
1202
- ) : null
1203
- ]
1204
- }
1221
+ /* @__PURE__ */ jsx2("div", { className: "flex min-w-0 flex-col gap-2.5", children: visibleItems.map(
1222
+ (item, stackedIndex) => renderCard(item, { stackedIndex })
1223
+ ) })
1224
+ ]
1225
+ }
1226
+ )
1227
+ }
1228
+ ) : null
1229
+ ]
1230
+ }
1231
+ );
1232
+ }
1233
+ );
1234
+ function useBatchedMessageCenterStackItems({
1235
+ expanded,
1236
+ highlightedItemId,
1237
+ items,
1238
+ mounted
1239
+ }) {
1240
+ const limit = items.length;
1241
+ const highlightedIndex = highlightedItemId === null || highlightedItemId === void 0 ? -1 : items.findIndex((item) => item.id === highlightedItemId);
1242
+ const initialCount = Math.min(
1243
+ limit,
1244
+ Math.max(MESSAGE_CENTER_STACK_INITIAL_RENDER_COUNT, highlightedIndex + 1)
1205
1245
  );
1246
+ const [renderCount, setRenderCount] = useState(initialCount);
1247
+ useEffect(() => {
1248
+ if (!mounted) {
1249
+ setRenderCount(initialCount);
1250
+ return;
1251
+ }
1252
+ setRenderCount(
1253
+ (current) => Math.min(Math.max(current, initialCount), limit)
1254
+ );
1255
+ }, [initialCount, limit, mounted]);
1256
+ useEffect(() => {
1257
+ if (!expanded || !mounted || renderCount >= limit) {
1258
+ return void 0;
1259
+ }
1260
+ const timeoutId = window.setTimeout(() => {
1261
+ setRenderCount(
1262
+ (current) => Math.min(current + MESSAGE_CENTER_STACK_RENDER_BATCH_SIZE, limit)
1263
+ );
1264
+ }, MESSAGE_CENTER_STACK_RENDER_BATCH_DELAY_MS);
1265
+ return () => {
1266
+ window.clearTimeout(timeoutId);
1267
+ };
1268
+ }, [expanded, limit, mounted, renderCount]);
1269
+ return items.slice(0, Math.min(renderCount, limit));
1206
1270
  }
1207
1271
  function MessageCenterStackSummary({
1208
1272
  groupId,
@@ -1231,7 +1295,7 @@ function MessageCenterStackSummary({
1231
1295
  "data-stack-provider": firstItem.provider,
1232
1296
  "data-stack-user-id": firstItem.userId ?? "",
1233
1297
  "data-testid": `workspace-agent-message-stack-summary-${groupId}`,
1234
- onClick: onExpand,
1298
+ onClick: () => onExpand(groupId),
1235
1299
  children: /* @__PURE__ */ jsxs(
1236
1300
  "span",
1237
1301
  {
@@ -1357,12 +1421,21 @@ function isGenericApprovalSummary(summary) {
1357
1421
  function MessageCenterSummary({
1358
1422
  emptyLabel,
1359
1423
  item,
1424
+ lazy,
1360
1425
  onLinkAction,
1361
1426
  summary
1362
1427
  }) {
1363
1428
  "use memo";
1364
1429
  const summaryRef = useRef(null);
1365
1430
  const [isOverflowing, setIsOverflowing] = useState(false);
1431
+ const shouldRenderRichSummary = useLazyMessageCenterSummaryReady(
1432
+ summaryRef,
1433
+ lazy
1434
+ );
1435
+ const shouldMeasureOverflow = useDeferredMessageCenterSummaryMeasureReady(
1436
+ summaryRef,
1437
+ shouldRenderRichSummary
1438
+ );
1366
1439
  const handleLinkAction = useCallback(
1367
1440
  (action) => {
1368
1441
  onLinkAction?.(
@@ -1371,21 +1444,29 @@ function MessageCenterSummary({
1371
1444
  },
1372
1445
  [item.provider, onLinkAction]
1373
1446
  );
1374
- useLayoutEffect(() => {
1447
+ useEffect(() => {
1448
+ if (!shouldMeasureOverflow) {
1449
+ setIsOverflowing(false);
1450
+ return void 0;
1451
+ }
1375
1452
  const element = summaryRef.current;
1376
1453
  if (!element) {
1377
- return;
1454
+ return void 0;
1378
1455
  }
1379
1456
  const updateOverflowState = () => {
1380
1457
  setIsOverflowing(element.scrollHeight > element.clientHeight + 1);
1381
1458
  };
1382
- updateOverflowState();
1383
- const resizeObserver = new ResizeObserver(updateOverflowState);
1384
- resizeObserver.observe(element);
1459
+ let resizeObserver = null;
1460
+ const timeoutId = window.setTimeout(() => {
1461
+ updateOverflowState();
1462
+ resizeObserver = new ResizeObserver(updateOverflowState);
1463
+ resizeObserver.observe(element);
1464
+ }, MESSAGE_CENTER_SUMMARY_OVERFLOW_MEASURE_DELAY_MS);
1385
1465
  return () => {
1386
- resizeObserver.disconnect();
1466
+ window.clearTimeout(timeoutId);
1467
+ resizeObserver?.disconnect();
1387
1468
  };
1388
- }, [summary]);
1469
+ }, [shouldMeasureOverflow, summary]);
1389
1470
  return /* @__PURE__ */ jsx2(
1390
1471
  AgentVerticalScrollArea,
1391
1472
  {
@@ -1398,7 +1479,7 @@ function MessageCenterSummary({
1398
1479
  onPointerDown: stopMessageCenterTextPointerPropagation,
1399
1480
  scrollbarClassName: "top-2 bottom-2 right-1.5",
1400
1481
  syncKey: summary,
1401
- children: summary ? /* @__PURE__ */ jsx2(
1482
+ children: summary && shouldRenderRichSummary ? /* @__PURE__ */ jsx2(
1402
1483
  AgentMessageMarkdown,
1403
1484
  {
1404
1485
  content: summary,
@@ -1411,10 +1492,85 @@ function MessageCenterSummary({
1411
1492
  },
1412
1493
  enableImageZoom: true
1413
1494
  }
1414
- ) : emptyLabel
1495
+ ) : summary ? /* @__PURE__ */ jsx2("div", { className: "whitespace-pre-wrap [overflow-wrap:anywhere]", children: summary }) : emptyLabel
1415
1496
  }
1416
1497
  );
1417
1498
  }
1499
+ function useLazyMessageCenterSummaryReady(ref, lazy) {
1500
+ const [ready, setReady] = useState(!lazy);
1501
+ useEffect(() => {
1502
+ setReady(!lazy);
1503
+ }, [lazy]);
1504
+ useEffect(() => {
1505
+ if (!lazy) {
1506
+ return void 0;
1507
+ }
1508
+ if (ready) {
1509
+ return void 0;
1510
+ }
1511
+ const element = ref.current;
1512
+ if (!element || typeof IntersectionObserver === "undefined") {
1513
+ setReady(true);
1514
+ return void 0;
1515
+ }
1516
+ const observer = new IntersectionObserver(
1517
+ (entries) => {
1518
+ if (entries.some((entry) => entry.isIntersecting)) {
1519
+ setReady(true);
1520
+ observer.disconnect();
1521
+ }
1522
+ },
1523
+ { rootMargin: MESSAGE_CENTER_SUMMARY_LAZY_ROOT_MARGIN }
1524
+ );
1525
+ observer.observe(element);
1526
+ return () => observer.disconnect();
1527
+ }, [lazy, ready, ref]);
1528
+ return ready;
1529
+ }
1530
+ function useDeferredMessageCenterSummaryMeasureReady(ref, enabled) {
1531
+ const [ready, setReady] = useState(false);
1532
+ useEffect(() => {
1533
+ if (!enabled) {
1534
+ setReady(false);
1535
+ return void 0;
1536
+ }
1537
+ if (ready) {
1538
+ return void 0;
1539
+ }
1540
+ const element = ref.current;
1541
+ if (!element || typeof IntersectionObserver === "undefined") {
1542
+ const timeoutId2 = window.setTimeout(
1543
+ () => setReady(true),
1544
+ MESSAGE_CENTER_SUMMARY_OVERFLOW_MEASURE_DELAY_MS
1545
+ );
1546
+ return () => {
1547
+ window.clearTimeout(timeoutId2);
1548
+ };
1549
+ }
1550
+ let timeoutId = null;
1551
+ const observer = new IntersectionObserver(
1552
+ (entries) => {
1553
+ if (!entries.some((entry) => entry.isIntersecting)) {
1554
+ return;
1555
+ }
1556
+ observer.disconnect();
1557
+ timeoutId = window.setTimeout(
1558
+ () => setReady(true),
1559
+ MESSAGE_CENTER_SUMMARY_OVERFLOW_MEASURE_DELAY_MS
1560
+ );
1561
+ },
1562
+ { rootMargin: MESSAGE_CENTER_SUMMARY_LAZY_ROOT_MARGIN }
1563
+ );
1564
+ observer.observe(element);
1565
+ return () => {
1566
+ observer.disconnect();
1567
+ if (timeoutId !== null) {
1568
+ window.clearTimeout(timeoutId);
1569
+ }
1570
+ };
1571
+ }, [enabled, ready, ref]);
1572
+ return ready;
1573
+ }
1418
1574
  function MessageCenterOpenChatButton({
1419
1575
  alwaysVisible = false,
1420
1576
  item,
@@ -1573,25 +1729,66 @@ function MessageCenterIdentityAvatarStack({
1573
1729
  }
1574
1730
  function ProjectPathInfo({ path }) {
1575
1731
  "use memo";
1576
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
1577
- /* @__PURE__ */ jsx2(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx2(
1578
- "button",
1579
- {
1580
- type: "button",
1581
- className: "workspace-agent-message-center__project-info-button invisible inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-[var(--text-secondary)] opacity-0 transition-[background-color,color,opacity,visibility] group-hover/message-card:visible group-hover/message-card:opacity-100 group-focus-within/message-card:visible group-focus-within/message-card:opacity-100 hover:bg-[var(--transparency-hover)] hover:text-[var(--text-primary)] focus-visible:bg-[var(--transparency-hover)] focus-visible:text-[var(--text-primary)] focus-visible:outline-none",
1582
- "aria-label": path,
1583
- children: /* @__PURE__ */ jsx2(Info, { className: "size-3.5", strokeWidth: 2, "aria-hidden": "true" })
1584
- }
1585
- ) }),
1586
- /* @__PURE__ */ jsx2(
1587
- TooltipContent,
1588
- {
1589
- side: "top",
1590
- align: "start",
1591
- className: "max-w-[320px] text-[11px] [overflow-wrap:anywhere]",
1592
- children: path
1593
- }
1594
- )
1732
+ return /* @__PURE__ */ jsx2(
1733
+ LazyMessageCenterTooltip,
1734
+ {
1735
+ content: path,
1736
+ side: "top",
1737
+ align: "start",
1738
+ className: "max-w-[320px] text-[11px] [overflow-wrap:anywhere]",
1739
+ children: /* @__PURE__ */ jsx2(
1740
+ "button",
1741
+ {
1742
+ type: "button",
1743
+ className: "workspace-agent-message-center__project-info-button invisible inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-[var(--text-secondary)] opacity-0 transition-[background-color,color,opacity,visibility] group-hover/message-card:visible group-hover/message-card:opacity-100 group-focus-within/message-card:visible group-focus-within/message-card:opacity-100 hover:bg-[var(--transparency-hover)] hover:text-[var(--text-primary)] focus-visible:bg-[var(--transparency-hover)] focus-visible:text-[var(--text-primary)] focus-visible:outline-none",
1744
+ "aria-label": path,
1745
+ children: /* @__PURE__ */ jsx2(Info, { className: "size-3.5", strokeWidth: 2, "aria-hidden": "true" })
1746
+ }
1747
+ )
1748
+ }
1749
+ );
1750
+ }
1751
+ function LazyMessageCenterTooltip({
1752
+ align,
1753
+ children,
1754
+ className,
1755
+ content,
1756
+ side
1757
+ }) {
1758
+ "use memo";
1759
+ const [hydrated, setHydrated] = useState(false);
1760
+ const [open, setOpen] = useState(false);
1761
+ const showTooltip = useCallback(() => {
1762
+ setHydrated(true);
1763
+ setOpen(true);
1764
+ }, []);
1765
+ const hideTooltip = useCallback(() => {
1766
+ setOpen(false);
1767
+ }, []);
1768
+ const trigger = cloneElement(children, {
1769
+ onBlur: (event) => {
1770
+ children.props.onBlur?.(event);
1771
+ hideTooltip();
1772
+ },
1773
+ onFocus: (event) => {
1774
+ children.props.onFocus?.(event);
1775
+ showTooltip();
1776
+ },
1777
+ onPointerEnter: (event) => {
1778
+ children.props.onPointerEnter?.(event);
1779
+ showTooltip();
1780
+ },
1781
+ onPointerLeave: (event) => {
1782
+ children.props.onPointerLeave?.(event);
1783
+ hideTooltip();
1784
+ }
1785
+ });
1786
+ if (!hydrated) {
1787
+ return trigger;
1788
+ }
1789
+ return /* @__PURE__ */ jsxs(Tooltip, { open, onOpenChange: setOpen, children: [
1790
+ /* @__PURE__ */ jsx2(TooltipTrigger, { asChild: true, children: trigger }),
1791
+ /* @__PURE__ */ jsx2(TooltipContent, { side, align, className, children: content })
1595
1792
  ] });
1596
1793
  }
1597
1794
  function AgentProviderLabel({ provider }) {
@@ -1971,7 +2168,12 @@ function groupMessageCenterItems(items, groupBy, t) {
1971
2168
  {
1972
2169
  id: "needs-attention",
1973
2170
  label: t("agentHost.workspaceAgentMessageCenterGroupNeedsAttention"),
1974
- match: (item) => messageCenterStatusFilterValue(item) === "waiting" || messageCenterStatusFilterValue(item) === "failed"
2171
+ match: (item) => messageCenterStatusFilterValue(item) === "waiting"
2172
+ },
2173
+ {
2174
+ id: "failed",
2175
+ label: t("agentHost.workspaceAgentMessageCenterFilterFailed"),
2176
+ match: (item) => messageCenterStatusFilterValue(item) === "failed"
1975
2177
  },
1976
2178
  {
1977
2179
  id: "working",
@@ -2193,7 +2395,8 @@ function MessageCenterOptionWithCount({
2193
2395
  // agent-message-center/WorkspaceAgentMessageCenterPanel.tsx
2194
2396
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
2195
2397
  var MESSAGE_CENTER_TOOLTIP_DELAY_MS = 300;
2196
- var WorkspaceAgentMessageCenterPanel = memo(
2398
+ var MESSAGE_CENTER_STACK_EAGER_SUMMARY_COUNT = 8;
2399
+ var WorkspaceAgentMessageCenterPanel = memo2(
2197
2400
  function WorkspaceAgentMessageCenterPanel2({
2198
2401
  open,
2199
2402
  i18n,
@@ -2209,6 +2412,9 @@ var WorkspaceAgentMessageCenterPanel = memo(
2209
2412
  onSubmitPrompt
2210
2413
  }) {
2211
2414
  "use memo";
2415
+ if (!open) {
2416
+ return null;
2417
+ }
2212
2418
  return /* @__PURE__ */ jsx5(AgentGuiI18nProvider, { runtime: i18n, locale, children: /* @__PURE__ */ jsx5(
2213
2419
  WorkspaceAgentMessageCenterPanelContent,
2214
2420
  {
@@ -2284,6 +2490,13 @@ function WorkspaceAgentMessageCenterPanelContent({
2284
2490
  () => groupMessageCenterItems(listItems, groupBy, t),
2285
2491
  [groupBy, t, listItems]
2286
2492
  );
2493
+ const itemGroupStacks = useMemo2(
2494
+ () => itemGroups.map((group) => ({
2495
+ ...group,
2496
+ stacks: partitionMessageCenterItemsByAgentUser(group.items)
2497
+ })),
2498
+ [itemGroups]
2499
+ );
2287
2500
  const highlightedItem = useMemo2(
2288
2501
  () => highlightedItemId ? model.items.find((item) => item.id === highlightedItemId) ?? null : null,
2289
2502
  [highlightedItemId, model.items]
@@ -2436,15 +2649,15 @@ function WorkspaceAgentMessageCenterPanelContent({
2436
2649
  if (!open || !highlightedItemId) {
2437
2650
  return;
2438
2651
  }
2439
- for (const group of itemGroups) {
2440
- for (const stack of partitionMessageCenterItemsByAgentUser(group.items)) {
2652
+ for (const group of itemGroupStacks) {
2653
+ for (const stack of group.stacks) {
2441
2654
  if (stack.items.length > 1 && stack.items.some((item) => item.id === highlightedItemId)) {
2442
2655
  expandStack(`${group.id}:${stack.id}`);
2443
2656
  return;
2444
2657
  }
2445
2658
  }
2446
2659
  }
2447
- }, [expandStack, highlightedItemId, itemGroups, open]);
2660
+ }, [expandStack, highlightedItemId, itemGroupStacks, open]);
2448
2661
  useLayoutEffect2(() => {
2449
2662
  if (!open || !highlightedItemId) {
2450
2663
  lastScrolledHighlightedItemIdRef.current = null;
@@ -2487,6 +2700,48 @@ function WorkspaceAgentMessageCenterPanelContent({
2487
2700
  window.clearTimeout(timeoutId);
2488
2701
  };
2489
2702
  }, [highlightedItemId, onHighlightedItemSettled, open]);
2703
+ const renderMessageCenterCard = useCallback2(
2704
+ (item, options = {}) => {
2705
+ const highlighted = item.id === highlightedItemId;
2706
+ const stackedIndex = options.stackedIndex;
2707
+ const card = /* @__PURE__ */ jsx5(
2708
+ MessageCenterRenderedCard,
2709
+ {
2710
+ highlighted,
2711
+ item,
2712
+ isSubmitting: submittingPromptKey === `${item.agentSessionId}:${item.pendingPrompt?.requestId}`,
2713
+ lazySummary: stackedIndex !== void 0 && stackedIndex >= MESSAGE_CENTER_STACK_EAGER_SUMMARY_COUNT,
2714
+ registerNode: setItemNode,
2715
+ onLinkAction,
2716
+ onOpenChat,
2717
+ onSubmitPrompt: submitPrompt
2718
+ },
2719
+ item.agentSessionId
2720
+ );
2721
+ if (stackedIndex === void 0) {
2722
+ return card;
2723
+ }
2724
+ return /* @__PURE__ */ jsx5(
2725
+ "div",
2726
+ {
2727
+ className: "min-w-0 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:animate-none",
2728
+ style: {
2729
+ animationDelay: `${Math.min(stackedIndex * 24, 96)}ms`
2730
+ },
2731
+ children: card
2732
+ },
2733
+ item.agentSessionId
2734
+ );
2735
+ },
2736
+ [
2737
+ highlightedItemId,
2738
+ onLinkAction,
2739
+ onOpenChat,
2740
+ setItemNode,
2741
+ submitPrompt,
2742
+ submittingPromptKey
2743
+ ]
2744
+ );
2490
2745
  return /* @__PURE__ */ jsx5(
2491
2746
  Drawer,
2492
2747
  {
@@ -2551,7 +2806,7 @@ function WorkspaceAgentMessageCenterPanelContent({
2551
2806
  onSubmitPrompt: (item, input) => void submitPrompt(item, input)
2552
2807
  }
2553
2808
  ) : null,
2554
- itemGroups.map((group) => /* @__PURE__ */ jsxs4(
2809
+ itemGroupStacks.map((group) => /* @__PURE__ */ jsxs4(
2555
2810
  "section",
2556
2811
  {
2557
2812
  className: "flex min-w-0 flex-col gap-2.5",
@@ -2559,45 +2814,13 @@ function WorkspaceAgentMessageCenterPanelContent({
2559
2814
  children: [
2560
2815
  /* @__PURE__ */ jsx5("div", { className: "flex min-w-0 items-center justify-between gap-3 px-0.5", children: /* @__PURE__ */ jsx5(MessageCenterGroupHeading, { group }) }),
2561
2816
  (() => {
2562
- const renderCard = (item, options = {}) => {
2563
- const highlighted = item.id === highlightedItemId;
2564
- const card = /* @__PURE__ */ jsx5(
2565
- MessageCenterCard,
2566
- {
2567
- cardRef: (node) => setItemNode(item.id, node),
2568
- highlighted,
2569
- item,
2570
- isSubmitting: submittingPromptKey === `${item.agentSessionId}:${item.pendingPrompt?.requestId}`,
2571
- onLinkAction,
2572
- onOpenChat,
2573
- onSubmitPrompt: (input) => void submitPrompt(item, input)
2574
- },
2575
- item.agentSessionId
2576
- );
2577
- if (options.stackedIndex === void 0) {
2578
- return card;
2579
- }
2580
- return /* @__PURE__ */ jsx5(
2581
- "div",
2582
- {
2583
- className: "min-w-0 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-200 motion-safe:ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:animate-none",
2584
- style: {
2585
- animationDelay: `${Math.min(options.stackedIndex * 24, 96)}ms`
2586
- },
2587
- children: card
2588
- },
2589
- item.agentSessionId
2590
- );
2591
- };
2592
- return partitionMessageCenterItemsByAgentUser(
2593
- group.items
2594
- ).map((stack) => {
2817
+ return group.stacks.map((stack) => {
2595
2818
  const firstItem = stack.items[0];
2596
2819
  if (!firstItem) {
2597
2820
  return null;
2598
2821
  }
2599
2822
  if (stack.items.length === 1) {
2600
- return renderCard(firstItem);
2823
+ return renderMessageCenterCard(firstItem);
2601
2824
  }
2602
2825
  const stackId = group.id === stack.id ? stack.id : `${group.id}:${stack.id}`;
2603
2826
  return /* @__PURE__ */ jsx5(
@@ -2605,10 +2828,11 @@ function WorkspaceAgentMessageCenterPanelContent({
2605
2828
  {
2606
2829
  expanded: expandedStackIds.has(stackId),
2607
2830
  groupId: stackId,
2831
+ highlightedItemId,
2608
2832
  items: stack.items,
2609
- renderCard,
2610
- onCollapse: () => collapseStack(stackId),
2611
- onExpand: () => expandStack(stackId)
2833
+ renderCard: renderMessageCenterCard,
2834
+ onCollapse: collapseStack,
2835
+ onExpand: expandStack
2612
2836
  },
2613
2837
  stackId
2614
2838
  );
@@ -2642,6 +2866,42 @@ function WorkspaceAgentMessageCenterPanelContent({
2642
2866
  }
2643
2867
  var MessageCenterCard = WorkspaceAgentMessageCenterCard;
2644
2868
  var MessageCenterStack = WorkspaceAgentMessageCenterStack;
2869
+ var MessageCenterRenderedCard = memo2(function MessageCenterRenderedCard2({
2870
+ highlighted,
2871
+ isSubmitting,
2872
+ item,
2873
+ lazySummary,
2874
+ onLinkAction,
2875
+ onOpenChat,
2876
+ onSubmitPrompt,
2877
+ registerNode
2878
+ }) {
2879
+ const cardRef = useCallback2(
2880
+ (node) => {
2881
+ registerNode(item.id, node);
2882
+ },
2883
+ [item.id, registerNode]
2884
+ );
2885
+ const handleSubmitPrompt = useCallback2(
2886
+ (input) => {
2887
+ onSubmitPrompt(item, input);
2888
+ },
2889
+ [item, onSubmitPrompt]
2890
+ );
2891
+ return /* @__PURE__ */ jsx5(
2892
+ MessageCenterCard,
2893
+ {
2894
+ cardRef,
2895
+ highlighted,
2896
+ item,
2897
+ isSubmitting,
2898
+ lazySummary,
2899
+ onLinkAction,
2900
+ onOpenChat,
2901
+ onSubmitPrompt: handleSubmitPrompt
2902
+ }
2903
+ );
2904
+ });
2645
2905
  function MessageCenterGroupHeading({
2646
2906
  group
2647
2907
  }) {