@agents24/chat-react 0.5.30 → 0.5.31

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 (45) hide show
  1. package/README.md +9 -4
  2. package/dist/generated/delegation-types.d.ts +129 -0
  3. package/dist/registry/agents24-chat.json +37 -19
  4. package/dist/runtime/index.cjs +52 -0
  5. package/dist/runtime/index.cjs.map +1 -1
  6. package/dist/runtime/index.d.ts +2 -0
  7. package/dist/runtime/index.js +51 -0
  8. package/dist/runtime/index.js.map +1 -1
  9. package/dist/runtime/use-delegation-tasks.d.ts +20 -0
  10. package/dist/scaffold/app.d.ts +2 -1
  11. package/dist/scaffold/components/chat/chat-composer.d.ts +4 -1
  12. package/dist/scaffold/components/chat/subagent-tasks.d.ts +3 -0
  13. package/dist/scaffold/components/theme-provider.d.ts +4 -3
  14. package/dist/scaffold/index.cjs +425 -280
  15. package/dist/scaffold/index.cjs.map +1 -1
  16. package/dist/scaffold/index.d.ts +3 -2
  17. package/dist/scaffold/index.js +416 -271
  18. package/dist/scaffold/index.js.map +1 -1
  19. package/dist/styles.css +14 -0
  20. package/dist/ui/adapters.d.ts +5 -2
  21. package/dist/ui/agent-chat-composer.d.ts +2 -1
  22. package/dist/ui/agent-chat-queue.d.ts +0 -2
  23. package/dist/ui/index.cjs +306 -260
  24. package/dist/ui/index.cjs.map +1 -1
  25. package/dist/ui/index.js +308 -263
  26. package/dist/ui/index.js.map +1 -1
  27. package/dist/ui/tool-sessions.d.ts +10 -2
  28. package/dist/ui/use-agent-chat-composer.d.ts +25 -26
  29. package/dist/ui/use-audio-recorder.d.ts +4 -2
  30. package/package.json +4 -3
  31. package/scaffold/host-styles.css +3 -0
  32. package/scaffold/manifest.json +2 -2
  33. package/scaffold/src/app.tsx +4 -1
  34. package/scaffold/src/chat.css +11 -1
  35. package/scaffold/src/components/chat/chat-composer.tsx +36 -19
  36. package/scaffold/src/components/chat/chat-shell.tsx +5 -4
  37. package/scaffold/src/components/chat/external-link-dialog.tsx +6 -5
  38. package/scaffold/src/components/chat/identity-control.tsx +0 -1
  39. package/scaffold/src/components/chat/subagent-tasks.tsx +109 -0
  40. package/scaffold/src/components/theme-provider.tsx +30 -27
  41. package/scaffold/src/components/ui/tooltip.tsx +3 -0
  42. package/scaffold/src/host.css +11 -0
  43. package/scaffold/src/index.css +1 -213
  44. package/scaffold/src/index.tsx +4 -2
  45. package/scaffold/src/theme.css +215 -0
@@ -41,14 +41,14 @@ module.exports = __toCommonJS(src_exports);
41
41
 
42
42
  // scaffold/src/app.tsx
43
43
  var import_browser = require("@agents24/client/browser");
44
- var import_runtime2 = require("@agents24/chat-react/runtime");
45
- var import_react2 = require("@agents24/react");
44
+ var import_runtime3 = require("@agents24/chat-react/runtime");
45
+ var import_react3 = require("@agents24/react");
46
46
 
47
47
  // scaffold/src/components/chat/chat-shell.tsx
48
- var import_runtime = require("@agents24/chat-react/runtime");
49
- var import_ui4 = require("@agents24/chat-react/ui");
48
+ var import_runtime2 = require("@agents24/chat-react/runtime");
49
+ var import_ui5 = require("@agents24/chat-react/ui");
50
50
  var import_lucide_react11 = require("lucide-react");
51
- var React8 = __toESM(require("react"), 1);
51
+ var React9 = __toESM(require("react"), 1);
52
52
 
53
53
  // scaffold/src/components/chat/chat-composer.tsx
54
54
  var import_lucide_react3 = require("lucide-react");
@@ -125,6 +125,21 @@ var import_lucide_react = require("lucide-react");
125
125
  var React = __toESM(require("react"), 1);
126
126
  var import_jsx_runtime2 = require("react/jsx-runtime");
127
127
  var ThemeContext = React.createContext(null);
128
+ var appearanceEvent = "agents24-chat-appearance-change";
129
+ var subscribeAppearance = (notify) => {
130
+ window.addEventListener("storage", notify);
131
+ window.addEventListener(appearanceEvent, notify);
132
+ return () => {
133
+ window.removeEventListener("storage", notify);
134
+ window.removeEventListener(appearanceEvent, notify);
135
+ };
136
+ };
137
+ var subscribeDarkMode = (notify) => {
138
+ const media = window.matchMedia?.("(prefers-color-scheme: dark)");
139
+ media?.addEventListener("change", notify);
140
+ return () => media?.removeEventListener("change", notify);
141
+ };
142
+ var getDarkMode = () => window.matchMedia?.("(prefers-color-scheme: dark)").matches ?? false;
128
143
  var storageKey = "agents24-chat-appearance";
129
144
  function storedAppearance() {
130
145
  try {
@@ -137,44 +152,33 @@ function storedAppearance() {
137
152
  function ThemeProvider({
138
153
  children,
139
154
  controller,
140
- theme = "soft"
155
+ theme = "soft",
156
+ mode = "isolated"
141
157
  }) {
142
- const [internalAppearance, setInternalAppearance] = React.useState("system");
143
- const [resolvedAppearance, setResolvedAppearance] = React.useState("light");
144
- const [mounted, setMounted] = React.useState(false);
158
+ const [sessionAppearance, setSessionAppearance] = React.useState(null);
159
+ const stored = React.useSyncExternalStore(subscribeAppearance, storedAppearance, () => "system");
160
+ const systemDark = React.useSyncExternalStore(subscribeDarkMode, getDarkMode, () => false);
145
161
  const [portalContainer, setPortalContainer] = React.useState(null);
146
- const appearance = controller?.appearance ?? internalAppearance;
147
- React.useEffect(() => {
148
- if (theme !== "inherit" && !controller) setInternalAppearance(storedAppearance());
149
- setMounted(true);
150
- }, [controller, theme]);
151
- React.useEffect(() => {
152
- if (theme === "inherit" || !mounted || typeof window === "undefined" || typeof window.matchMedia !== "function") return;
153
- const media = window.matchMedia("(prefers-color-scheme: dark)");
154
- const apply = () => setResolvedAppearance(
155
- appearance === "system" ? media.matches ? "dark" : "light" : appearance
156
- );
157
- apply();
158
- media.addEventListener("change", apply);
159
- return () => media.removeEventListener("change", apply);
160
- }, [appearance, mounted, theme]);
162
+ const appearance = controller?.appearance ?? sessionAppearance ?? stored;
163
+ const resolvedAppearance = appearance === "system" ? systemDark ? "dark" : "light" : appearance;
161
164
  const change = React.useCallback((next) => {
162
- if (theme === "inherit") return;
163
165
  if (controller) {
164
166
  controller.setAppearance(next);
165
167
  return;
166
168
  }
169
+ setSessionAppearance(next);
167
170
  try {
168
171
  window.localStorage.setItem(storageKey, next);
169
172
  } catch {
170
173
  }
171
- setInternalAppearance(next);
172
- }, [controller, theme]);
173
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ThemeContext.Provider, { value: { appearance, inherited: theme === "inherit", portalContainer, setAppearance: change }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
174
+ window.dispatchEvent(new Event(appearanceEvent));
175
+ }, [controller]);
176
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ThemeContext.Provider, { value: { appearance, portalContainer, setAppearance: change, inherited: mode === "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
174
177
  "div",
175
178
  {
176
179
  ref: setPortalContainer,
177
- className: theme === "inherit" ? "size-full" : `${resolvedAppearance} size-full`,
180
+ className: mode === "inherit" ? "size-full" : `${resolvedAppearance} size-full`,
181
+ "data-agents24-theme-mode": mode,
178
182
  "data-agents24-theme": theme,
179
183
  "data-agents24-theme-root": "",
180
184
  children
@@ -476,6 +480,7 @@ function TooltipTrigger({
476
480
  asChild: _asChild,
477
481
  ...props
478
482
  }) {
483
+ void _asChild;
479
484
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui4.Slot.Root, { "data-slot": "tooltip-trigger", ...props });
480
485
  }
481
486
  function TooltipContent({
@@ -485,6 +490,8 @@ function TooltipContent({
485
490
  sideOffset: _sideOffset,
486
491
  ...props
487
492
  }) {
493
+ void _align;
494
+ void _sideOffset;
488
495
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
489
496
  "span",
490
497
  {
@@ -508,6 +515,8 @@ function TooltipContent({
508
515
  var import_jsx_runtime7 = require("react/jsx-runtime");
509
516
  function ChatComposer({
510
517
  inputContract,
518
+ queue,
519
+ onRecordingStreamChange,
511
520
  disabled,
512
521
  contextWindow,
513
522
  focusKey,
@@ -526,30 +535,34 @@ function ChatComposer({
526
535
  utilityRow = "inline"
527
536
  }) {
528
537
  const inputRef = React2.useRef(null);
529
- const textareaRef = React2.useRef(null);
530
- const composer = (0, import_ui.useAgentChatComposer)({
531
- inputContract,
532
- disabled,
533
- isRunning,
534
- isCancelling,
535
- focusKey,
536
- restoredDraft,
537
- textareaRef,
538
- onSubmit: ({ text: text2, files: files2 }) => onSubmit(text2, files2)
539
- });
540
538
  const {
541
539
  text,
542
- files,
543
540
  setText,
544
- validationError,
541
+ files,
542
+ removeFile,
543
+ addFiles,
544
+ textareaRef,
545
+ submit,
545
546
  attachmentError,
546
- recorder,
547
- recordingAllowed,
547
+ attachmentMimeTypes,
548
548
  allowAttachments,
549
+ recordingAllowed,
550
+ recorder,
551
+ isExpanded,
552
+ validationError,
549
553
  action,
550
- submit
551
- } = composer;
552
- const isExpanded = forceExpanded || text.includes("\n") || text.length > 62;
554
+ canSubmit
555
+ } = (0, import_ui.useAgentChatComposer)({
556
+ inputContract,
557
+ disabled,
558
+ focusKey,
559
+ forceExpanded,
560
+ isCancelling,
561
+ isRunning,
562
+ onSubmit,
563
+ restoredDraft,
564
+ onRecordingStreamChange
565
+ });
553
566
  const selectedAgent = agents.find((item) => item.id === agentId);
554
567
  const selectedModel = models.find((item) => item.id === modelId);
555
568
  const modelSelector = models.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-fit max-w-40", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Select, { disabled: disabled || isRunning, onValueChange: onModelChange, value: modelId || void 0, children: [
@@ -595,25 +608,29 @@ function ChatComposer({
595
608
  className: "relative z-10 w-full pb-[max(1rem,env(safe-area-inset-bottom))]",
596
609
  "data-agents24-chat-composer": "",
597
610
  children: [
598
- allowAttachments && files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-2 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
599
- import_ui.ChatAttachmentRows,
600
- {
601
- attachments: files,
602
- onRemove: (attachment) => {
603
- if (attachment.id) composer.removeFile(attachment.id);
604
- }
605
- }
606
- ) }),
611
+ queue,
607
612
  attachmentError || recorder.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mb-2 text-xs text-destructive", role: "alert", children: attachmentError || recorder.error }) : null,
608
613
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
609
614
  "div",
610
615
  {
611
616
  "data-expanded": isExpanded || void 0,
617
+ "data-attachments": files.length > 0 || void 0,
612
618
  className: cn(
613
619
  "agents24-composer-grid grid min-w-0 items-center gap-2 rounded-xl border bg-background shadow-sm",
614
620
  isExpanded ? "p-2" : "p-1.5"
615
621
  ),
616
622
  children: [
623
+ allowAttachments && files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "agents24-composer-attachments min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
624
+ import_ui.ChatAttachmentRows,
625
+ {
626
+ layout: "composer",
627
+ attachments: files,
628
+ onRemove: (attachment) => {
629
+ if (!attachment.id) return;
630
+ removeFile(attachment.id);
631
+ }
632
+ }
633
+ ) }),
617
634
  allowAttachments ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
618
635
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
619
636
  "input",
@@ -622,9 +639,9 @@ function ChatComposer({
622
639
  className: "sr-only",
623
640
  type: "file",
624
641
  multiple: true,
625
- accept: composer.fileAccept,
642
+ accept: attachmentMimeTypes.join(","),
626
643
  onChange: (event) => {
627
- composer.addFiles(Array.from(event.target.files ?? []));
644
+ addFiles(Array.from(event.target.files ?? []));
628
645
  event.currentTarget.value = "";
629
646
  }
630
647
  }
@@ -644,8 +661,15 @@ function ChatComposer({
644
661
  "agents24-composer-textarea max-h-56 min-h-9 field-sizing-content resize-none overflow-y-auto border-0 bg-transparent px-2 shadow-none focus-visible:ring-0 dark:bg-transparent",
645
662
  isExpanded ? "py-2" : "h-9 py-2"
646
663
  ),
647
- onChange: (event) => setText(event.target.value),
648
- onKeyDown: composer.onKeyDown
664
+ onChange: (event) => {
665
+ setText(event.target.value);
666
+ },
667
+ onKeyDown: (event) => {
668
+ if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
669
+ event.preventDefault();
670
+ void submit();
671
+ }
672
+ }
649
673
  }
650
674
  ),
651
675
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "agents24-composer-actions flex items-center gap-1", children: [
@@ -677,7 +701,7 @@ function ChatComposer({
677
701
  ) : validationError ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Tooltip, { children: [
678
702
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { tabIndex: 0, "aria-label": validationError, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": isRunning ? "Queue message" : "Send message", disabled: true, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) }) }) }),
679
703
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipContent, { children: validationError })
680
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": isRunning ? "Queue message" : "Send message", disabled: disabled || !composer.canSubmit, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) })
704
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { size: "icon", "aria-label": isRunning ? "Queue message" : "Send message", disabled: !canSubmit, onClick: () => void submit(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ArrowUp, {}) })
681
705
  ] })
682
706
  ]
683
707
  }
@@ -886,19 +910,20 @@ function DialogDescription({
886
910
  var import_jsx_runtime10 = require("react/jsx-runtime");
887
911
  function ExternalLinkDialog({ isOpen, onClose, onConfirm, url }) {
888
912
  const [copied, setCopied] = React4.useState(false);
889
- React4.useEffect(() => {
890
- if (!isOpen) setCopied(false);
891
- }, [isOpen]);
913
+ const close = () => {
914
+ setCopied(false);
915
+ onClose();
916
+ };
892
917
  const copyUrl = async () => {
893
918
  await navigator.clipboard.writeText(url);
894
919
  setCopied(true);
895
920
  };
896
921
  const openUrl = () => {
897
922
  onConfirm();
898
- onClose();
923
+ close();
899
924
  };
900
925
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Dialog, { open: isOpen, onOpenChange: (open) => {
901
- if (!open) onClose();
926
+ if (!open) close();
902
927
  }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogContent, { className: "max-h-[calc(100dvh-2rem)] min-w-0 overflow-hidden sm:max-w-md", children: [
903
928
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogHeader, { children: [
904
929
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogTitle, { children: "Open external link?" }),
@@ -1160,10 +1185,134 @@ function ChatMessage({
1160
1185
  ] }) });
1161
1186
  }
1162
1187
 
1163
- // scaffold/src/components/chat/theme-menu.tsx
1164
- var import_lucide_react6 = require("lucide-react");
1188
+ // scaffold/src/components/chat/subagent-tasks.tsx
1165
1189
  var React5 = __toESM(require("react"), 1);
1190
+ var import_react = require("@agents24/react");
1191
+ var import_ui4 = require("@agents24/chat-react/ui");
1192
+ var import_runtime = require("@agents24/chat-react/runtime");
1166
1193
  var import_jsx_runtime15 = require("react/jsx-runtime");
1194
+ function SubagentTasks({ threadId }) {
1195
+ const client = (0, import_react.useAgentClient)();
1196
+ const source = React5.useMemo(() => ({ events: (input) => client.threads.delegations.events(input) }), [client]);
1197
+ const { tasks, error, refresh } = (0, import_runtime.useDelegationTasks)({ threadId, source });
1198
+ const [selection, setSelection] = React5.useState({ threadId: null, handle: null });
1199
+ const selected = selection.threadId === threadId ? selection.handle : null;
1200
+ if (!threadId || !tasks.length && !error) return null;
1201
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("section", { "aria-label": "Subagent tasks", className: "mx-auto w-full max-w-3xl px-4 py-2 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { children: [
1202
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("summary", { className: "cursor-pointer font-medium", children: [
1203
+ "Tasks (",
1204
+ tasks.length,
1205
+ ")"
1206
+ ] }),
1207
+ error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", children: "Task updates are unavailable. Retrying\u2026" }) : null,
1208
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "max-h-56 overflow-y-auto", children: tasks.map((task) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { style: { paddingInlineStart: Math.max(0, task.depth - 1) * 12 }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1209
+ "button",
1210
+ {
1211
+ type: "button",
1212
+ className: "flex w-full items-center justify-between gap-3 rounded-md px-2 py-2 text-start hover:bg-muted",
1213
+ onClick: () => setSelection({ threadId, handle: selected === task.handle ? null : task.handle }),
1214
+ "aria-expanded": selected === task.handle,
1215
+ children: [
1216
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "min-w-0 truncate", children: [
1217
+ task.name,
1218
+ task.background ? " \xB7 Background" : ""
1219
+ ] }),
1220
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "shrink-0 text-xs text-muted-foreground", children: task.status.replaceAll("_", " ") })
1221
+ ]
1222
+ }
1223
+ ) }, task.handle)) }),
1224
+ tasks.filter((task) => task.handle === selected).map((task) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TaskConversation, { threadId, task, onChanged: refresh }, `${threadId}:${task.handle}`))
1225
+ ] }) });
1226
+ }
1227
+ function TaskConversation({ threadId, task, onChanged }) {
1228
+ const client = (0, import_react.useAgentClient)();
1229
+ const [history, setHistory] = React5.useState(null);
1230
+ const [earlier, setEarlier] = React5.useState([]);
1231
+ const historyInitialized = React5.useRef(false);
1232
+ const [before, setBefore] = React5.useState(null);
1233
+ const [error, setError] = React5.useState(null);
1234
+ const [busy, setBusy] = React5.useState(false);
1235
+ const operation = React5.useRef(null);
1236
+ React5.useEffect(() => {
1237
+ const controller = new AbortController();
1238
+ let timer;
1239
+ const refresh = async () => {
1240
+ try {
1241
+ const page = await client.threads.delegations.history({ threadId, handle: task.handle, signal: controller.signal });
1242
+ if (controller.signal.aborted) return;
1243
+ setHistory(page);
1244
+ if (!historyInitialized.current) {
1245
+ historyInitialized.current = true;
1246
+ setBefore(page.paging.next_before_turn_index);
1247
+ }
1248
+ } catch {
1249
+ if (!controller.signal.aborted) setError("Task history could not be loaded.");
1250
+ } finally {
1251
+ if (!controller.signal.aborted) timer = setTimeout(refresh, 2e3);
1252
+ }
1253
+ };
1254
+ void refresh();
1255
+ return () => {
1256
+ controller.abort();
1257
+ clearTimeout(timer);
1258
+ };
1259
+ }, [client, threadId, task.handle]);
1260
+ const loadEarlier = async () => {
1261
+ if (before === null) return;
1262
+ setBusy(true);
1263
+ try {
1264
+ const page = await client.threads.delegations.history({ threadId, handle: task.handle, before });
1265
+ setEarlier((current) => [...page.turns, ...current]);
1266
+ setBefore(page.paging.next_before_turn_index);
1267
+ } catch {
1268
+ setError("Earlier task history could not be loaded.");
1269
+ } finally {
1270
+ setBusy(false);
1271
+ }
1272
+ };
1273
+ const act = async (action) => {
1274
+ setBusy(true);
1275
+ setError(null);
1276
+ if (operation.current?.action !== action) operation.current = { action, id: crypto.randomUUID() };
1277
+ try {
1278
+ await client.threads.delegations.act({
1279
+ threadId,
1280
+ handle: task.handle,
1281
+ action: { action, operation_id: operation.current.id }
1282
+ });
1283
+ operation.current = null;
1284
+ onChanged();
1285
+ } catch {
1286
+ setError("The task action could not be completed. Try again.");
1287
+ } finally {
1288
+ setBusy(false);
1289
+ }
1290
+ };
1291
+ const turns = Array.from(new Map([...earlier, ...history?.turns || []].map((turn) => [turn.id, turn])).values()).sort((a, b) => a.turn_index - b.turn_index);
1292
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "space-y-3 rounded-md bg-muted/30 p-3", children: [
1293
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "font-medium", children: task.name }),
1294
+ error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { role: "alert", children: error }) : null,
1295
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
1296
+ task.capabilities.interrupt ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "secondary", size: "sm", disabled: busy, onClick: () => void act("interrupt"), children: "Interrupt" }) : null,
1297
+ task.capabilities.cancel ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "secondary", size: "sm", disabled: busy, onClick: () => void act("cancel"), children: "Cancel task" }) : null,
1298
+ before !== null ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => void loadEarlier(), children: "Earlier exchanges" }) : null
1299
+ ] }),
1300
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "max-h-[55dvh] space-y-4 overflow-y-auto break-words", children: turns.map((turn) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("article", { className: "space-y-2", children: [
1301
+ turn.assignment_instruction ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "whitespace-pre-wrap text-muted-foreground", children: turn.assignment_instruction }) : null,
1302
+ turn.user_input_text ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "whitespace-pre-wrap", children: turn.user_input_text }) : null,
1303
+ turn.exchanges?.map((exchange) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "whitespace-pre-wrap break-words text-sm", children: [
1304
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-xs font-medium", children: exchange.sender === "parent" ? "Parent Agent" : "Subagent update" }),
1305
+ exchange.text
1306
+ ] }, exchange.id)),
1307
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_ui4.AgentResponseTimeline, { message: { id: turn.id, role: "assistant", createdAt: turn.created_at, content: turn.assistant_output_text || "", parts: (0, import_react.partsFromResponseBlocks)(turn.response_blocks) } })
1308
+ ] }, turn.id)) })
1309
+ ] });
1310
+ }
1311
+
1312
+ // scaffold/src/components/chat/theme-menu.tsx
1313
+ var import_lucide_react6 = require("lucide-react");
1314
+ var React6 = __toESM(require("react"), 1);
1315
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1167
1316
  var options = [
1168
1317
  { value: "system", label: "System", icon: import_lucide_react6.Laptop },
1169
1318
  { value: "light", label: "Light", icon: import_lucide_react6.Sun },
@@ -1171,12 +1320,12 @@ var options = [
1171
1320
  ];
1172
1321
  function ThemeMenu() {
1173
1322
  const { appearance, setAppearance, inherited } = useTheme();
1174
- const [open, setOpen] = React5.useState(false);
1175
- const rootRef = React5.useRef(null);
1176
- const firstItemRef = React5.useRef(null);
1177
- const menuId = React5.useId();
1323
+ const [open, setOpen] = React6.useState(false);
1324
+ const rootRef = React6.useRef(null);
1325
+ const firstItemRef = React6.useRef(null);
1326
+ const menuId = React6.useId();
1178
1327
  const ActiveIcon = options.find((item) => item.value === appearance)?.icon ?? import_lucide_react6.Laptop;
1179
- React5.useEffect(() => {
1328
+ React6.useEffect(() => {
1180
1329
  if (!open) return;
1181
1330
  firstItemRef.current?.focus();
1182
1331
  const closeOnOutsidePointer = (event) => {
@@ -1194,8 +1343,8 @@ function ThemeMenu() {
1194
1343
  }, [open]);
1195
1344
  if (inherited) return null;
1196
1345
  const label = appearance === "system" ? "System" : appearance === "light" ? "Light" : "Dark";
1197
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: rootRef, className: "relative", children: [
1198
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1346
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { ref: rootRef, className: "relative", children: [
1347
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1199
1348
  Button,
1200
1349
  {
1201
1350
  "aria-controls": menuId,
@@ -1205,16 +1354,16 @@ function ThemeMenu() {
1205
1354
  onClick: () => setOpen((value) => !value),
1206
1355
  size: "icon-sm",
1207
1356
  variant: "ghost",
1208
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ActiveIcon, {})
1357
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ActiveIcon, {})
1209
1358
  }
1210
1359
  ),
1211
- open ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1360
+ open ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1212
1361
  "div",
1213
1362
  {
1214
1363
  id: menuId,
1215
1364
  className: "absolute end-0 top-full z-50 mt-1 flex min-w-44 flex-col rounded-xl border bg-popover p-1 text-popover-foreground shadow-md",
1216
1365
  role: "menu",
1217
- children: options.map(({ value, label: optionLabel, icon: Icon }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
1366
+ children: options.map(({ value, label: optionLabel, icon: Icon }, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
1218
1367
  Button,
1219
1368
  {
1220
1369
  ref: index === 0 ? firstItemRef : void 0,
@@ -1228,7 +1377,7 @@ function ThemeMenu() {
1228
1377
  size: "sm",
1229
1378
  variant: "ghost",
1230
1379
  children: [
1231
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, {}),
1380
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, {}),
1232
1381
  " ",
1233
1382
  optionLabel
1234
1383
  ]
@@ -1241,23 +1390,23 @@ function ThemeMenu() {
1241
1390
  }
1242
1391
 
1243
1392
  // scaffold/src/components/chat/thread-sidebar.tsx
1244
- var import_react = require("@agents24/react");
1393
+ var import_react2 = require("@agents24/react");
1245
1394
  var import_lucide_react10 = require("lucide-react");
1246
1395
 
1247
1396
  // scaffold/src/components/chat/identity-control.tsx
1248
1397
  var import_lucide_react9 = require("lucide-react");
1249
1398
 
1250
1399
  // scaffold/src/components/ui/sidebar.tsx
1251
- var React7 = __toESM(require("react"), 1);
1400
+ var React8 = __toESM(require("react"), 1);
1252
1401
  var import_class_variance_authority3 = require("class-variance-authority");
1253
1402
  var import_radix_ui9 = require("radix-ui");
1254
1403
 
1255
1404
  // scaffold/src/hooks/use-mobile.ts
1256
- var React6 = __toESM(require("react"), 1);
1405
+ var React7 = __toESM(require("react"), 1);
1257
1406
  var MOBILE_BREAKPOINT = 768;
1258
1407
  function useIsMobile() {
1259
- const [isMobile, setIsMobile] = React6.useState(void 0);
1260
- React6.useEffect(() => {
1408
+ const [isMobile, setIsMobile] = React7.useState(void 0);
1409
+ React7.useEffect(() => {
1261
1410
  const onChange = () => {
1262
1411
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
1263
1412
  };
@@ -1275,31 +1424,31 @@ function useIsMobile() {
1275
1424
  }
1276
1425
 
1277
1426
  // scaffold/src/components/ui/input.tsx
1278
- var import_jsx_runtime16 = require("react/jsx-runtime");
1427
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1279
1428
 
1280
1429
  // scaffold/src/components/ui/separator.tsx
1281
1430
  var import_radix_ui7 = require("radix-ui");
1282
- var import_jsx_runtime17 = require("react/jsx-runtime");
1431
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1283
1432
 
1284
1433
  // scaffold/src/components/ui/sheet.tsx
1285
1434
  var import_radix_ui8 = require("radix-ui");
1286
1435
  var import_lucide_react7 = require("lucide-react");
1287
- var import_jsx_runtime18 = require("react/jsx-runtime");
1436
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1288
1437
  function Sheet({ ...props }) {
1289
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_radix_ui8.Dialog.Root, { "data-slot": "sheet", ...props });
1438
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_radix_ui8.Dialog.Root, { "data-slot": "sheet", ...props });
1290
1439
  }
1291
1440
  function SheetPortal({
1292
1441
  container,
1293
1442
  ...props
1294
1443
  }) {
1295
1444
  const themeContainer = useThemePortalContainer();
1296
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_radix_ui8.Dialog.Portal, { container: container || themeContainer || void 0, "data-slot": "sheet-portal", ...props });
1445
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_radix_ui8.Dialog.Portal, { container: container || themeContainer || void 0, "data-slot": "sheet-portal", ...props });
1297
1446
  }
1298
1447
  function SheetOverlay({
1299
1448
  className,
1300
1449
  ...props
1301
1450
  }) {
1302
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1451
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1303
1452
  import_radix_ui8.Dialog.Overlay,
1304
1453
  {
1305
1454
  "data-slot": "sheet-overlay",
@@ -1318,9 +1467,9 @@ function SheetContent({
1318
1467
  showCloseButton = true,
1319
1468
  ...props
1320
1469
  }) {
1321
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SheetPortal, { children: [
1322
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SheetOverlay, {}),
1323
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1470
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(SheetPortal, { children: [
1471
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SheetOverlay, {}),
1472
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1324
1473
  import_radix_ui8.Dialog.Content,
1325
1474
  {
1326
1475
  "data-slot": "sheet-content",
@@ -1332,18 +1481,18 @@ function SheetContent({
1332
1481
  ...props,
1333
1482
  children: [
1334
1483
  children,
1335
- showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_radix_ui8.Dialog.Close, { "data-slot": "sheet-close", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
1484
+ showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_radix_ui8.Dialog.Close, { "data-slot": "sheet-close", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
1336
1485
  Button,
1337
1486
  {
1338
1487
  variant: "ghost",
1339
1488
  className: "absolute top-4 right-4 bg-secondary",
1340
1489
  size: "icon-sm",
1341
1490
  children: [
1342
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1491
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1343
1492
  import_lucide_react7.XIcon,
1344
1493
  {}
1345
1494
  ),
1346
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "sr-only", children: "Close" })
1495
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "sr-only", children: "Close" })
1347
1496
  ]
1348
1497
  }
1349
1498
  ) })
@@ -1353,7 +1502,7 @@ function SheetContent({
1353
1502
  ] });
1354
1503
  }
1355
1504
  function SheetHeader({ className, ...props }) {
1356
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1505
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1357
1506
  "div",
1358
1507
  {
1359
1508
  "data-slot": "sheet-header",
@@ -1366,7 +1515,7 @@ function SheetTitle({
1366
1515
  className,
1367
1516
  ...props
1368
1517
  }) {
1369
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1518
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1370
1519
  import_radix_ui8.Dialog.Title,
1371
1520
  {
1372
1521
  "data-slot": "sheet-title",
@@ -1382,7 +1531,7 @@ function SheetDescription({
1382
1531
  className,
1383
1532
  ...props
1384
1533
  }) {
1385
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1534
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1386
1535
  import_radix_ui8.Dialog.Description,
1387
1536
  {
1388
1537
  "data-slot": "sheet-description",
@@ -1393,17 +1542,17 @@ function SheetDescription({
1393
1542
  }
1394
1543
 
1395
1544
  // scaffold/src/components/ui/skeleton.tsx
1396
- var import_jsx_runtime19 = require("react/jsx-runtime");
1545
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1397
1546
 
1398
1547
  // scaffold/src/components/ui/sidebar.tsx
1399
1548
  var import_lucide_react8 = require("lucide-react");
1400
- var import_jsx_runtime20 = require("react/jsx-runtime");
1549
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1401
1550
  var SIDEBAR_COOKIE_NAME = "sidebar_state";
1402
1551
  var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
1403
1552
  var SIDEBAR_KEYBOARD_SHORTCUT = "b";
1404
- var SidebarContext = React7.createContext(null);
1553
+ var SidebarContext = React8.createContext(null);
1405
1554
  function useSidebar() {
1406
- const context = React7.useContext(SidebarContext);
1555
+ const context = React8.useContext(SidebarContext);
1407
1556
  if (!context) {
1408
1557
  throw new Error("useSidebar must be used within a SidebarProvider.");
1409
1558
  }
@@ -1418,10 +1567,10 @@ function SidebarProvider({
1418
1567
  ...props
1419
1568
  }) {
1420
1569
  const isMobile = useIsMobile();
1421
- const [openMobile, setOpenMobile] = React7.useState(false);
1422
- const [_open, _setOpen] = React7.useState(defaultOpen);
1570
+ const [openMobile, setOpenMobile] = React8.useState(false);
1571
+ const [_open, _setOpen] = React8.useState(defaultOpen);
1423
1572
  const open = openProp ?? _open;
1424
- const setOpen = React7.useCallback(
1573
+ const setOpen = React8.useCallback(
1425
1574
  (value) => {
1426
1575
  const openState = typeof value === "function" ? value(open) : value;
1427
1576
  if (setOpenProp) {
@@ -1433,10 +1582,10 @@ function SidebarProvider({
1433
1582
  },
1434
1583
  [setOpenProp, open]
1435
1584
  );
1436
- const toggleSidebar = React7.useCallback(() => {
1585
+ const toggleSidebar = React8.useCallback(() => {
1437
1586
  return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
1438
1587
  }, [isMobile, setOpen, setOpenMobile]);
1439
- React7.useEffect(() => {
1588
+ React8.useEffect(() => {
1440
1589
  const handleKeyDown = (event) => {
1441
1590
  if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1442
1591
  event.preventDefault();
@@ -1447,7 +1596,7 @@ function SidebarProvider({
1447
1596
  return () => window.removeEventListener("keydown", handleKeyDown);
1448
1597
  }, [toggleSidebar]);
1449
1598
  const state = open ? "expanded" : "collapsed";
1450
- const contextValue = React7.useMemo(
1599
+ const contextValue = React8.useMemo(
1451
1600
  () => ({
1452
1601
  state,
1453
1602
  open,
@@ -1459,7 +1608,7 @@ function SidebarProvider({
1459
1608
  }),
1460
1609
  [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
1461
1610
  );
1462
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1611
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1463
1612
  "div",
1464
1613
  {
1465
1614
  "data-slot": "sidebar-wrapper",
@@ -1483,7 +1632,7 @@ function Sidebar({
1483
1632
  }) {
1484
1633
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
1485
1634
  if (collapsible === "none") {
1486
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1635
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1487
1636
  "div",
1488
1637
  {
1489
1638
  "data-slot": "sidebar",
@@ -1497,7 +1646,7 @@ function Sidebar({
1497
1646
  );
1498
1647
  }
1499
1648
  if (isMobile) {
1500
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1649
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1501
1650
  SheetContent,
1502
1651
  {
1503
1652
  dir,
@@ -1507,16 +1656,16 @@ function Sidebar({
1507
1656
  className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [--sidebar-width:18rem] [&>button]:hidden",
1508
1657
  side,
1509
1658
  children: [
1510
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(SheetHeader, { className: "sr-only", children: [
1511
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetTitle, { children: "Sidebar" }),
1512
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })
1659
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(SheetHeader, { className: "sr-only", children: [
1660
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SheetTitle, { children: "Sidebar" }),
1661
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })
1513
1662
  ] }),
1514
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex h-full w-full flex-col", children })
1663
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex h-full w-full flex-col", children })
1515
1664
  ]
1516
1665
  }
1517
1666
  ) });
1518
1667
  }
1519
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1668
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1520
1669
  "div",
1521
1670
  {
1522
1671
  className: "group peer hidden text-sidebar-foreground md:block",
@@ -1526,7 +1675,7 @@ function Sidebar({
1526
1675
  "data-side": side,
1527
1676
  "data-slot": "sidebar",
1528
1677
  children: [
1529
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1678
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1530
1679
  "div",
1531
1680
  {
1532
1681
  "data-slot": "sidebar-gap",
@@ -1538,7 +1687,7 @@ function Sidebar({
1538
1687
  )
1539
1688
  }
1540
1689
  ),
1541
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1690
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1542
1691
  "div",
1543
1692
  {
1544
1693
  "data-slot": "sidebar-container",
@@ -1550,7 +1699,7 @@ function Sidebar({
1550
1699
  className
1551
1700
  ),
1552
1701
  ...props,
1553
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1702
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1554
1703
  "div",
1555
1704
  {
1556
1705
  "data-sidebar": "sidebar",
@@ -1571,7 +1720,7 @@ function SidebarTrigger({
1571
1720
  ...props
1572
1721
  }) {
1573
1722
  const { toggleSidebar } = useSidebar();
1574
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
1723
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1575
1724
  Button,
1576
1725
  {
1577
1726
  "data-sidebar": "trigger",
@@ -1585,15 +1734,15 @@ function SidebarTrigger({
1585
1734
  },
1586
1735
  ...props,
1587
1736
  children: [
1588
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.PanelLeftIcon, {}),
1589
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
1737
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.PanelLeftIcon, {}),
1738
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
1590
1739
  ]
1591
1740
  }
1592
1741
  );
1593
1742
  }
1594
1743
  function SidebarRail({ className, ...props }) {
1595
1744
  const { toggleSidebar } = useSidebar();
1596
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1745
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1597
1746
  "button",
1598
1747
  {
1599
1748
  "data-sidebar": "rail",
@@ -1616,7 +1765,7 @@ function SidebarRail({ className, ...props }) {
1616
1765
  );
1617
1766
  }
1618
1767
  function SidebarInset({ className, ...props }) {
1619
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1768
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1620
1769
  "main",
1621
1770
  {
1622
1771
  "data-slot": "sidebar-inset",
@@ -1629,7 +1778,7 @@ function SidebarInset({ className, ...props }) {
1629
1778
  );
1630
1779
  }
1631
1780
  function SidebarHeader({ className, ...props }) {
1632
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1781
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1633
1782
  "div",
1634
1783
  {
1635
1784
  "data-slot": "sidebar-header",
@@ -1643,7 +1792,7 @@ function SidebarHeader({ className, ...props }) {
1643
1792
  );
1644
1793
  }
1645
1794
  function SidebarFooter({ className, ...props }) {
1646
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1795
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1647
1796
  "div",
1648
1797
  {
1649
1798
  "data-slot": "sidebar-footer",
@@ -1654,7 +1803,7 @@ function SidebarFooter({ className, ...props }) {
1654
1803
  );
1655
1804
  }
1656
1805
  function SidebarContent({ className, ...props }) {
1657
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1806
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1658
1807
  "div",
1659
1808
  {
1660
1809
  "data-slot": "sidebar-content",
@@ -1668,7 +1817,7 @@ function SidebarContent({ className, ...props }) {
1668
1817
  );
1669
1818
  }
1670
1819
  function SidebarGroup({ className, ...props }) {
1671
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1820
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1672
1821
  "div",
1673
1822
  {
1674
1823
  "data-slot": "sidebar-group",
@@ -1682,7 +1831,7 @@ function SidebarGroupContent({
1682
1831
  className,
1683
1832
  ...props
1684
1833
  }) {
1685
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1834
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1686
1835
  "div",
1687
1836
  {
1688
1837
  "data-slot": "sidebar-group-content",
@@ -1693,7 +1842,7 @@ function SidebarGroupContent({
1693
1842
  );
1694
1843
  }
1695
1844
  function SidebarMenu({ className, ...props }) {
1696
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1845
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1697
1846
  "ul",
1698
1847
  {
1699
1848
  "data-slot": "sidebar-menu",
@@ -1704,7 +1853,7 @@ function SidebarMenu({ className, ...props }) {
1704
1853
  );
1705
1854
  }
1706
1855
  function SidebarMenuItem({ className, ...props }) {
1707
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1856
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1708
1857
  "li",
1709
1858
  {
1710
1859
  "data-slot": "sidebar-menu-item",
@@ -1745,7 +1894,7 @@ function SidebarMenuButton({
1745
1894
  }) {
1746
1895
  const Comp = asChild ? import_radix_ui9.Slot.Root : "button";
1747
1896
  const { isMobile, state } = useSidebar();
1748
- const button = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1897
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1749
1898
  Comp,
1750
1899
  {
1751
1900
  "data-slot": "sidebar-menu-button",
@@ -1764,9 +1913,9 @@ function SidebarMenuButton({
1764
1913
  children: tooltip
1765
1914
  };
1766
1915
  }
1767
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Tooltip, { children: [
1768
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipTrigger, { asChild: true, children: button }),
1769
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1916
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
1917
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: button }),
1918
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1770
1919
  TooltipContent,
1771
1920
  {
1772
1921
  side: "right",
@@ -1784,7 +1933,7 @@ function SidebarMenuAction({
1784
1933
  ...props
1785
1934
  }) {
1786
1935
  const Comp = asChild ? import_radix_ui9.Slot.Root : "button";
1787
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1936
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1788
1937
  Comp,
1789
1938
  {
1790
1939
  "data-slot": "sidebar-menu-action",
@@ -1800,7 +1949,7 @@ function SidebarMenuAction({
1800
1949
  }
1801
1950
 
1802
1951
  // scaffold/src/components/chat/identity-control.tsx
1803
- var import_jsx_runtime21 = require("react/jsx-runtime");
1952
+ var import_jsx_runtime22 = require("react/jsx-runtime");
1804
1953
  function identityLabel(identity) {
1805
1954
  if (identity.displayName) return identity.displayName;
1806
1955
  if (identity.state === "authenticated") return "Signed in";
@@ -1810,44 +1959,43 @@ function identityLabel(identity) {
1810
1959
  return "Guest";
1811
1960
  }
1812
1961
  function IdentityAvatar({ identity }) {
1813
- const label = identityLabel(identity);
1814
1962
  if (identity.avatarUrl) {
1815
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { alt: "", className: "size-6 rounded-full object-cover", src: identity.avatarUrl });
1963
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { alt: "", className: "size-6 rounded-full object-cover", src: identity.avatarUrl });
1816
1964
  }
1817
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex size-6 items-center justify-center rounded-full bg-sidebar-accent text-[10px] font-semibold", "aria-hidden": "true", children: identity.displayName ? identity.displayName.slice(0, 1).toUpperCase() : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.UserRound, { className: "size-3.5" }) });
1965
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex size-6 items-center justify-center rounded-full bg-sidebar-accent text-[10px] font-semibold", "aria-hidden": "true", children: identity.displayName ? identity.displayName.slice(0, 1).toUpperCase() : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.UserRound, { className: "size-3.5" }) });
1818
1966
  }
1819
1967
  function IdentityControl({ identity }) {
1820
1968
  const label = identityLabel(identity);
1821
1969
  const canSignOut = identity.state === "authenticated" && Boolean(identity.onSignOut);
1822
1970
  const canSignIn = (identity.state === "guest" || identity.state === "signed_out" || identity.state === "error") && Boolean(identity.onSignIn);
1823
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SidebarMenu, { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SidebarMenuItem, { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { children: [
1824
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
1971
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarMenu, { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarMenuItem, { className: "w-full min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { children: [
1972
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
1825
1973
  SidebarMenuButton,
1826
1974
  {
1827
1975
  size: "lg",
1828
1976
  "aria-label": `Account: ${label}`,
1829
1977
  className: "w-full min-w-0 justify-start",
1830
1978
  children: [
1831
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IdentityAvatar, { identity }),
1832
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-0 flex-1 overflow-hidden text-start", children: [
1833
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "block truncate text-sm font-medium", children: label }),
1834
- identity.secondaryText ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "block truncate text-xs text-muted-foreground", children: identity.secondaryText }) : null
1979
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IdentityAvatar, { identity }),
1980
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "min-w-0 flex-1 overflow-hidden text-start", children: [
1981
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "block truncate text-sm font-medium", children: label }),
1982
+ identity.secondaryText ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "block truncate text-xs text-muted-foreground", children: identity.secondaryText }) : null
1835
1983
  ] })
1836
1984
  ]
1837
1985
  }
1838
1986
  ) }),
1839
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenuContent, { align: "start", side: "top", sideOffset: 8, children: [
1840
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenuLabel, { children: [
1841
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "block truncate", children: label }),
1842
- identity.secondaryText ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "mt-0.5 block truncate text-xs font-normal text-muted-foreground", children: identity.secondaryText }) : null
1987
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuContent, { align: "start", side: "top", sideOffset: 8, children: [
1988
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuLabel, { children: [
1989
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "block truncate", children: label }),
1990
+ identity.secondaryText ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "mt-0.5 block truncate text-xs font-normal text-muted-foreground", children: identity.secondaryText }) : null
1843
1991
  ] }),
1844
- canSignIn || canSignOut ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuSeparator, {}) : null,
1845
- canSignIn ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenuItem, { onSelect: () => identity.onSignIn?.(), children: [
1846
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.LogIn, {}),
1992
+ canSignIn || canSignOut ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}) : null,
1993
+ canSignIn ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onSelect: () => identity.onSignIn?.(), children: [
1994
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.LogIn, {}),
1847
1995
  "Sign in"
1848
1996
  ] }) : null,
1849
- canSignOut ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenuItem, { onSelect: () => identity.onSignOut?.(), children: [
1850
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.LogOut, {}),
1997
+ canSignOut ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onSelect: () => identity.onSignOut?.(), children: [
1998
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.LogOut, {}),
1851
1999
  "Sign out"
1852
2000
  ] }) : null
1853
2001
  ] })
@@ -1855,25 +2003,25 @@ function IdentityControl({ identity }) {
1855
2003
  }
1856
2004
 
1857
2005
  // scaffold/src/components/chat/thread-sidebar.tsx
1858
- var import_jsx_runtime22 = require("react/jsx-runtime");
2006
+ var import_jsx_runtime23 = require("react/jsx-runtime");
1859
2007
  function ThreadStatus({ thread }) {
1860
- const activity = (0, import_react.getThreadActivity)(thread);
2008
+ const activity = (0, import_react2.getThreadActivity)(thread);
1861
2009
  if (!activity.isSpinning) return null;
1862
2010
  const label = activity.status === "cancelling" ? "Cancelling" : activity.status === "queued" ? "Queued" : "Running";
1863
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2011
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1864
2012
  "span",
1865
2013
  {
1866
2014
  className: "pointer-events-none absolute end-1 top-1/2 hidden size-5 -translate-y-1/2 items-center justify-center text-muted-foreground transition-opacity group-hover/menu-item:opacity-0 md:flex",
1867
2015
  role: "status",
1868
2016
  "aria-label": label,
1869
2017
  title: label,
1870
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.LoaderCircle, { className: "size-3.5 animate-spin" })
2018
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.LoaderCircle, { className: "size-3.5 animate-spin" })
1871
2019
  }
1872
2020
  );
1873
2021
  }
1874
2022
  function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoadingMore, onDelete, onLoadMore, onNew, onOpen, threads }) {
1875
2023
  const { setOpenMobile } = useSidebar();
1876
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2024
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1877
2025
  Sidebar,
1878
2026
  {
1879
2027
  "aria-label": "Conversations",
@@ -1881,19 +2029,19 @@ function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoading
1881
2029
  "data-agents24-chat-sidebar": "",
1882
2030
  role: "navigation",
1883
2031
  children: [
1884
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarHeader, { className: "gap-1 p-2", children: [
1885
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-8 shrink-0", "aria-hidden": "true" }),
1886
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { className: "w-full justify-start", variant: "ghost", onClick: () => {
2032
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SidebarHeader, { className: "gap-1 p-2", children: [
2033
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-8 shrink-0", "aria-hidden": "true" }),
2034
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Button, { className: "w-full justify-start", variant: "ghost", onClick: () => {
1887
2035
  onNew();
1888
2036
  setOpenMobile(false);
1889
2037
  }, children: [
1890
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.SquarePen, {}),
2038
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.SquarePen, {}),
1891
2039
  " New chat"
1892
2040
  ] })
1893
2041
  ] }),
1894
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarContent, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarGroupContent, { children: [
1895
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarMenu, { children: threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarMenuItem, { children: [
1896
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2042
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SidebarContent, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SidebarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SidebarGroupContent, { children: [
2043
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SidebarMenu, { children: threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SidebarMenuItem, { children: [
2044
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1897
2045
  SidebarMenuButton,
1898
2046
  {
1899
2047
  className: "pr-8 pl-3",
@@ -1903,11 +2051,11 @@ function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoading
1903
2051
  void onOpen(thread.id).catch(() => void 0);
1904
2052
  setOpenMobile(false);
1905
2053
  },
1906
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "min-w-0 truncate", children: String(thread.title || "New conversation") })
2054
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "min-w-0 truncate", children: String(thread.title || "New conversation") })
1907
2055
  }
1908
2056
  ),
1909
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ThreadStatus, { thread }),
1910
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2057
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ThreadStatus, { thread }),
2058
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1911
2059
  SidebarMenuAction,
1912
2060
  {
1913
2061
  showOnHover: true,
@@ -1917,12 +2065,12 @@ function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoading
1917
2065
  event.stopPropagation();
1918
2066
  if (window.confirm("Delete this conversation?")) void onDelete(thread.id).catch(() => void 0);
1919
2067
  },
1920
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Trash2, {})
2068
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Trash2, {})
1921
2069
  }
1922
2070
  )
1923
2071
  ] }, thread.id)) }),
1924
- !isLoading && threads.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "px-2 py-8 text-center text-xs text-muted-foreground", children: "No conversations" }),
1925
- hasMore && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
2072
+ !isLoading && threads.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "px-2 py-8 text-center text-xs text-muted-foreground", children: "No conversations" }),
2073
+ hasMore && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
1926
2074
  Button,
1927
2075
  {
1928
2076
  className: "mt-2 w-full",
@@ -1931,14 +2079,14 @@ function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoading
1931
2079
  variant: "ghost",
1932
2080
  onClick: () => void onLoadMore().catch(() => void 0),
1933
2081
  children: [
1934
- isLoadingMore && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.LoaderCircle, { className: "animate-spin" }),
2082
+ isLoadingMore && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.LoaderCircle, { className: "animate-spin" }),
1935
2083
  "Load more"
1936
2084
  ]
1937
2085
  }
1938
2086
  )
1939
2087
  ] }) }) }),
1940
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarFooter, { className: "w-full min-w-0 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(IdentityControl, { identity }) }),
1941
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarRail, {})
2088
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SidebarFooter, { className: "w-full min-w-0 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IdentityControl, { identity }) }),
2089
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SidebarRail, {})
1942
2090
  ]
1943
2091
  }
1944
2092
  );
@@ -1946,7 +2094,7 @@ function ThreadSidebar({ activeThreadId, hasMore, identity, isLoading, isLoading
1946
2094
 
1947
2095
  // scaffold/src/components/chat/turn-outline.tsx
1948
2096
  var import_chat_react = require("@agents24/chat-react");
1949
- var import_jsx_runtime23 = require("react/jsx-runtime");
2097
+ var import_jsx_runtime24 = require("react/jsx-runtime");
1950
2098
  function turnsFromMessages(messages) {
1951
2099
  return messages.reduce((turns, message) => {
1952
2100
  if (message.role === "user") {
@@ -1965,7 +2113,7 @@ function turnsFromMessages(messages) {
1965
2113
  }, []);
1966
2114
  }
1967
2115
  function TurnOutline({ messages }) {
1968
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2116
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1969
2117
  import_chat_react.LatestThreadScroller.Outline,
1970
2118
  {
1971
2119
  items: turnsFromMessages(messages),
@@ -1989,7 +2137,7 @@ function isScaffoldTimelineLoading({
1989
2137
 
1990
2138
  // scaffold/src/components/chat/chat-shell.tsx
1991
2139
  var import_chat_react2 = require("@agents24/chat-react");
1992
- var import_jsx_runtime24 = require("react/jsx-runtime");
2140
+ var import_jsx_runtime25 = require("react/jsx-runtime");
1993
2141
  var LOADING_INPUT_CONTRACT = {
1994
2142
  version: "agents24.runtime-inputs.v2",
1995
2143
  modalities: {
@@ -2002,31 +2150,31 @@ var LOADING_INPUT_CONTRACT = {
2002
2150
  retention: { mode: "thread_lifetime" }
2003
2151
  };
2004
2152
  function PersistentSidebarTrigger() {
2005
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-none fixed start-3 top-0 z-[60] flex h-12 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SidebarTrigger, { className: "pointer-events-auto [&_svg]:size-[18px]" }) });
2153
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-none fixed start-3 top-0 z-[60] flex h-12 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SidebarTrigger, { className: "pointer-events-auto [&_svg]:size-[18px]" }) });
2006
2154
  }
2007
2155
  function CollapsedHeaderActions({ onNew }) {
2008
2156
  const { isMobile, openMobile, state } = useSidebar();
2009
2157
  const sidebarVisible = isMobile ? openMobile : state === "expanded";
2010
2158
  if (sidebarVisible) return null;
2011
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
2012
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-8 w-17 shrink-0", "aria-hidden": "true" }),
2013
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-none fixed start-12 top-0 z-[60] flex h-12 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { className: "pointer-events-auto", variant: "ghost", size: "icon-sm", "aria-label": "New chat", onClick: onNew, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.SquarePen, {}) }) })
2159
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
2160
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-8 w-17 shrink-0", "aria-hidden": "true" }),
2161
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-none fixed start-12 top-0 z-[60] flex h-12 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { className: "pointer-events-auto", variant: "ghost", size: "icon-sm", "aria-label": "New chat", onClick: onNew, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.SquarePen, {}) }) })
2014
2162
  ] });
2015
2163
  }
2016
2164
  function OperationErrorNotice({ runtime }) {
2017
2165
  const error = runtime.operationError || runtime.backgroundError;
2018
2166
  if (!error) return null;
2019
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-3 z-40 flex justify-center px-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "pointer-events-auto flex max-w-lg items-start gap-2 rounded-lg border border-destructive/20 bg-background px-3 py-2 text-sm shadow-md", role: "alert", children: [
2020
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CircleAlert, { className: "mt-0.5 size-4 shrink-0 text-destructive" }),
2021
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "min-w-0 flex-1 wrap-break-word", children: (0, import_runtime.agentChatRuntimeErrorMessage)(error) || "The chat could not complete that action." }),
2022
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2167
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-none absolute inset-x-0 top-3 z-40 flex justify-center px-4", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "pointer-events-auto flex max-w-lg items-start gap-2 rounded-lg border border-destructive/20 bg-background px-3 py-2 text-sm shadow-md", role: "alert", children: [
2168
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.CircleAlert, { className: "mt-0.5 size-4 shrink-0 text-destructive" }),
2169
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "min-w-0 flex-1 wrap-break-word", children: (0, import_runtime2.agentChatRuntimeErrorMessage)(error) || "The chat could not complete that action." }),
2170
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2023
2171
  Button,
2024
2172
  {
2025
2173
  "aria-label": "Dismiss error",
2026
2174
  onClick: runtime.operationError ? runtime.clearOperationError : runtime.controller.clearBackgroundError,
2027
2175
  size: "icon-xs",
2028
2176
  variant: "ghost",
2029
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.X, {})
2177
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.X, {})
2030
2178
  }
2031
2179
  )
2032
2180
  ] }) });
@@ -2042,24 +2190,24 @@ function ChatShell({
2042
2190
  const isUploading = controller.runState === "uploading";
2043
2191
  const isRunning = controller.runState === "streaming" || controller.runState === "reconnecting" || controller.runState === "paused" || controller.runState === "cancelling";
2044
2192
  const isCancelling = controller.runState === "cancelling";
2045
- const wasLiveRun = (0, import_ui4.useLiveCompletionRuns)(controller.activeRunId, isRunning);
2193
+ const wasLiveRun = (0, import_ui5.useLiveCompletionRuns)(controller.activeRunId, isRunning);
2046
2194
  const activeTitle = controller.threads.find((thread) => thread.id === controller.activeThreadId)?.title;
2047
2195
  const hasBlockingError = Boolean(runtime.fatalError && controller.messages.length === 0);
2048
2196
  const isEmptyState = controller.activeThreadId === null && controller.messages.length === 0 && !hasBlockingError;
2049
2197
  const latestAnchorId = (0, import_chat_react2.latestThreadAnchorId)(controller.messages);
2050
- const composerOverlayRef = React8.useRef(null);
2051
- const [composerOverlayHeight, setComposerOverlayHeight] = React8.useState(192);
2052
- const [restoredDraft, setRestoredDraft] = React8.useState(null);
2053
- const draftRevisionRef = React8.useRef(0);
2054
- const retractForEdit = React8.useCallback(async (message) => {
2198
+ const composerOverlayRef = React9.useRef(null);
2199
+ const [composerOverlayHeight, setComposerOverlayHeight] = React9.useState(192);
2200
+ const [restoredDraft, setRestoredDraft] = React9.useState(null);
2201
+ const draftRevisionRef = React9.useRef(0);
2202
+ const retractForEdit = React9.useCallback(async (message) => {
2055
2203
  const draft = await controller.retractPendingMessage(message);
2056
2204
  setRestoredDraft({
2057
2205
  revision: ++draftRevisionRef.current,
2058
2206
  text: draft.text,
2059
- files: (0, import_ui4.queuedMessageComposerFiles)(draft)
2207
+ files: (0, import_ui5.queuedMessageComposerFiles)(draft)
2060
2208
  });
2061
2209
  }, [controller]);
2062
- React8.useLayoutEffect(() => {
2210
+ React9.useLayoutEffect(() => {
2063
2211
  const overlay = composerOverlayRef.current;
2064
2212
  if (!overlay || isEmptyState) return;
2065
2213
  const updateHeight = () => {
@@ -2070,15 +2218,15 @@ function ChatShell({
2070
2218
  resizeObserver.observe(overlay);
2071
2219
  return () => resizeObserver.disconnect();
2072
2220
  }, [isEmptyState]);
2073
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2221
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2074
2222
  SidebarProvider,
2075
2223
  {
2076
2224
  className: "h-svh min-h-0 overflow-hidden",
2077
2225
  "data-agents24-chat": "",
2078
2226
  "data-agents24-chat-layout": "",
2079
2227
  children: [
2080
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(PersistentSidebarTrigger, {}),
2081
- sidebar || /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2228
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PersistentSidebarTrigger, {}),
2229
+ sidebar || /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2082
2230
  ThreadSidebar,
2083
2231
  {
2084
2232
  activeThreadId: controller.activeThreadId,
@@ -2093,57 +2241,58 @@ function ChatShell({
2093
2241
  onOpen: runtime.openThread
2094
2242
  }
2095
2243
  ),
2096
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(SidebarInset, { className: "h-svh min-h-0 overflow-hidden bg-background", children: [
2097
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2244
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(SidebarInset, { className: "h-svh min-h-0 overflow-hidden bg-background", children: [
2245
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2098
2246
  "header",
2099
2247
  {
2100
2248
  className: "flex h-12 shrink-0 items-center gap-2 border-b border-border/50 px-3 sm:px-4",
2101
2249
  "data-agents24-chat-header": "",
2102
2250
  children: [
2103
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CollapsedHeaderActions, { onNew: runtime.newThread }),
2104
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h1", { className: "truncate text-sm font-medium", children: String(activeTitle || "New chat") }) }),
2105
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ThemeMenu, {})
2251
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CollapsedHeaderActions, { onNew: runtime.newThread }),
2252
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h1", { className: "truncate text-sm font-medium", children: String(activeTitle || "New chat") }) }),
2253
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ThemeMenu, {})
2106
2254
  ]
2107
2255
  }
2108
2256
  ),
2109
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2257
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2110
2258
  "section",
2111
2259
  {
2112
2260
  "aria-label": "Conversation",
2113
2261
  className: "relative flex min-h-0 flex-1 flex-col overflow-hidden",
2114
2262
  "data-agents24-chat-transcript": "",
2115
2263
  children: [
2116
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OperationErrorNotice, { runtime }),
2117
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_chat_react2.LatestThreadScroller.Provider, { autoScroll: true, defaultScrollPosition: "last-anchor", scrollPreviousItemPeek: 64, children: [
2118
- !isEmptyState && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_chat_react2.LatestThreadScroller.Root, { className: "relative min-h-0 flex-1", children: [
2119
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_chat_react2.LatestThreadScroller.Viewport, { preserveScrollOnPrepend: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2264
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(OperationErrorNotice, { runtime }),
2265
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SubagentTasks, { threadId: controller.activeThreadId }),
2266
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_chat_react2.LatestThreadScroller.Provider, { autoScroll: true, defaultScrollPosition: "last-anchor", scrollPreviousItemPeek: 64, children: [
2267
+ !isEmptyState && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_chat_react2.LatestThreadScroller.Root, { className: "relative min-h-0 flex-1", children: [
2268
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_chat_react2.LatestThreadScroller.Viewport, { preserveScrollOnPrepend: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2120
2269
  import_chat_react2.LatestThreadScroller.Content,
2121
2270
  {
2122
2271
  className: "mx-auto w-full max-w-3xl gap-3 px-4 pt-8 pb-0 sm:px-6 sm:pt-12",
2123
2272
  style: { paddingBottom: composerOverlayHeight + 72 },
2124
2273
  children: [
2125
- controller.hasOlderTurns && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Button, { className: "self-center", variant: "ghost", size: "sm", disabled: controller.isLoadingOlder, onClick: () => {
2274
+ controller.hasOlderTurns && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Button, { className: "self-center", variant: "ghost", size: "sm", disabled: controller.isLoadingOlder, onClick: () => {
2126
2275
  void controller.loadOlder().catch(() => void 0);
2127
2276
  }, children: [
2128
- controller.isLoadingOlder && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.LoaderCircle, { className: "animate-spin" }),
2277
+ controller.isLoadingOlder && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.LoaderCircle, { className: "animate-spin" }),
2129
2278
  " Load earlier messages"
2130
2279
  ] }),
2131
- runtime.isBootstrapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { "aria-label": "Loading conversation", className: "flex flex-1 items-center justify-center py-24 text-muted-foreground", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.LoaderCircle, { className: "size-4 animate-spin" }) }),
2132
- hasBlockingError && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 py-24 text-center", children: [
2133
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.CircleAlert, { className: "size-5 text-destructive" }),
2134
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { children: [
2135
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "font-medium", children: "Couldn\u2019t connect" }),
2136
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "mt-1 max-w-md text-sm text-muted-foreground", children: runtime.errorMessage })
2280
+ runtime.isBootstrapping && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { "aria-label": "Loading conversation", className: "flex flex-1 items-center justify-center py-24 text-muted-foreground", role: "status", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.LoaderCircle, { className: "size-4 animate-spin" }) }),
2281
+ hasBlockingError && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 py-24 text-center", children: [
2282
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react11.CircleAlert, { className: "size-5 text-destructive" }),
2283
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
2284
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "font-medium", children: "Couldn\u2019t connect" }),
2285
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mt-1 max-w-md text-sm text-muted-foreground", children: runtime.errorMessage })
2137
2286
  ] }),
2138
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "outline", onClick: () => void runtime.retryBootstrap(), children: "Try again" })
2287
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "outline", onClick: () => void runtime.retryBootstrap(), children: "Try again" })
2139
2288
  ] }),
2140
- controller.messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2289
+ controller.messages.map((message) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2141
2290
  import_chat_react2.LatestThreadScroller.Item,
2142
2291
  {
2143
2292
  messageId: message.id,
2144
2293
  scrollAnchor: isRunning && message.id === latestAnchorId,
2145
2294
  className: "overflow-visible [content-visibility:visible]",
2146
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2295
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2147
2296
  ChatMessage,
2148
2297
  {
2149
2298
  animateCompletion: wasLiveRun(message.runId),
@@ -2169,9 +2318,9 @@ function ChatShell({
2169
2318
  ]
2170
2319
  }
2171
2320
  ) }),
2172
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TurnOutline, { messages: controller.messages })
2321
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TurnOutline, { messages: controller.messages })
2173
2322
  ] }),
2174
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
2323
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
2175
2324
  "div",
2176
2325
  {
2177
2326
  ref: composerOverlayRef,
@@ -2180,56 +2329,52 @@ function ChatShell({
2180
2329
  background: "linear-gradient(to bottom, transparent 0%, color-mix(in oklch, var(--background) 85%, transparent) 45%, var(--background) 65%, var(--background) 100%)"
2181
2330
  },
2182
2331
  children: [
2183
- isEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mx-auto mb-8 w-full max-w-3xl px-4 text-center sm:px-6", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "text-3xl font-semibold tracking-tight sm:text-4xl", children: "Ready when you are." }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pointer-events-auto absolute inset-x-0 top-0 flex -translate-y-full justify-center pb-3", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_chat_react2.LatestThreadScroller.Button, { className: "!relative !inset-auto !translate-x-0 rtl:!translate-x-0" }) }),
2184
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "pointer-events-auto mx-auto w-full max-w-3xl px-4 sm:px-6", children: [
2185
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2186
- import_ui4.AgentChatQueue,
2187
- {
2188
- pending: controller.pendingMessages,
2189
- queue: controller.messageQueue,
2190
- canSteer: controller.runState === "streaming",
2191
- onSteer: controller.steerPendingMessage,
2192
- onRemove: controller.removePendingMessage,
2193
- onEdit: retractForEdit,
2194
- onResume: controller.resumeQueue
2195
- }
2196
- ),
2197
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2198
- Composer,
2199
- {
2200
- restoredDraft,
2201
- inputContract: runtime.inputContract || LOADING_INPUT_CONTRACT,
2202
- contextWindow: runtime.contextWindow,
2203
- disabled: runtime.isBootstrapping || runtime.isChangingAgent || isUploading || hasBlockingError,
2204
- focusKey: controller.activeThreadId,
2205
- forceExpanded: isEmptyState,
2206
- isCancelling,
2207
- isRunning,
2208
- agentId: runtime.agentId,
2209
- agents: runtime.agents,
2210
- onAgentChange: (agentId) => {
2211
- void runtime.changeAgent(agentId);
2212
- },
2213
- onStop: () => {
2214
- void controller.cancelRun().catch(() => void 0);
2215
- },
2216
- modelId: runtime.modelId,
2217
- models: runtime.models,
2218
- onModelChange: runtime.changeModel,
2219
- onSubmit: (text, files) => runtime.submit({
2220
- text,
2221
- files: files.filter((file) => file.source).map((file) => ({
2222
- data: file.source,
2223
- mediaType: file.mediaType,
2224
- name: file.filename
2225
- })),
2226
- attachmentIds: files.flatMap((file) => file.persistedAttachmentId ? [file.persistedAttachmentId] : []),
2227
- attachments: files
2228
- }),
2229
- utilityRow: isEmptyState ? "inline" : "below"
2230
- }
2231
- )
2232
- ] })
2332
+ isEmptyState ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mx-auto mb-8 w-full max-w-3xl px-4 text-center sm:px-6", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "text-3xl font-semibold tracking-tight sm:text-4xl", children: "Ready when you are." }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-auto absolute inset-x-0 top-0 flex -translate-y-full justify-center pb-3", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_chat_react2.LatestThreadScroller.Button, { className: "!relative !inset-auto !translate-x-0 rtl:!translate-x-0" }) }),
2333
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "pointer-events-auto mx-auto w-full max-w-3xl px-4 sm:px-6", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2334
+ Composer,
2335
+ {
2336
+ queue: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2337
+ import_ui5.AgentChatQueue,
2338
+ {
2339
+ pending: controller.pendingMessages,
2340
+ queue: controller.messageQueue,
2341
+ onRemove: controller.removePendingMessage,
2342
+ onEdit: retractForEdit,
2343
+ onResume: controller.resumeQueue
2344
+ }
2345
+ ),
2346
+ restoredDraft,
2347
+ inputContract: runtime.inputContract || LOADING_INPUT_CONTRACT,
2348
+ contextWindow: runtime.contextWindow,
2349
+ disabled: runtime.isBootstrapping || runtime.isChangingAgent || isUploading || hasBlockingError,
2350
+ focusKey: controller.activeThreadId,
2351
+ forceExpanded: isEmptyState,
2352
+ isCancelling,
2353
+ isRunning,
2354
+ agentId: runtime.agentId,
2355
+ agents: runtime.agents,
2356
+ onAgentChange: (agentId) => {
2357
+ void runtime.changeAgent(agentId);
2358
+ },
2359
+ onStop: () => {
2360
+ void controller.cancelRun().catch(() => void 0);
2361
+ },
2362
+ modelId: runtime.modelId,
2363
+ models: runtime.models,
2364
+ onModelChange: runtime.changeModel,
2365
+ onSubmit: (text, files) => runtime.submit({
2366
+ text,
2367
+ files: files.filter((file) => file.source).map((file) => ({
2368
+ data: file.source,
2369
+ mediaType: file.mediaType,
2370
+ name: file.filename
2371
+ })),
2372
+ attachmentIds: files.flatMap((file) => file.persistedAttachmentId ? [file.persistedAttachmentId] : []),
2373
+ attachments: files
2374
+ }),
2375
+ utilityRow: isEmptyState ? "inline" : "below"
2376
+ }
2377
+ ) })
2233
2378
  ]
2234
2379
  }
2235
2380
  )
@@ -2247,7 +2392,7 @@ function ChatShell({
2247
2392
  var GUEST_CHAT_IDENTITY = { state: "guest" };
2248
2393
 
2249
2394
  // scaffold/src/app.tsx
2250
- var import_jsx_runtime25 = require("react/jsx-runtime");
2395
+ var import_jsx_runtime26 = require("react/jsx-runtime");
2251
2396
  var createBrowserAbortController = () => new AbortController();
2252
2397
  var browserVisibility = (0, import_browser.createBrowserVisibility)();
2253
2398
  function RuntimeChat({
@@ -2255,21 +2400,21 @@ function RuntimeChat({
2255
2400
  identity = GUEST_CHAT_IDENTITY,
2256
2401
  ...props
2257
2402
  }) {
2258
- const runtime = (0, import_runtime2.useAgentChatRuntime)({
2403
+ const runtime = (0, import_runtime3.useAgentChatRuntime)({
2259
2404
  ...props,
2260
2405
  mcpRedirectUri: props.mcpRedirectUri || (typeof window === "undefined" ? void 0 : window.location.href)
2261
2406
  });
2262
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatShell, { components, identity, runtime, sidebar: props.sidebar });
2407
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChatShell, { components, identity, runtime, sidebar: props.sidebar });
2263
2408
  }
2264
2409
  function App(props) {
2265
2410
  const identity = props.identity || GUEST_CHAT_IDENTITY;
2266
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react2.Agents24Provider, { client: props.client, createAbortController: createBrowserAbortController, visibility: browserVisibility, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RuntimeChat, { ...props }, identity.state) });
2411
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react3.Agents24Provider, { client: props.client, createAbortController: createBrowserAbortController, visibility: browserVisibility, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RuntimeChat, { ...props }, identity.state) });
2267
2412
  }
2268
2413
 
2269
2414
  // scaffold/src/index.tsx
2270
- var import_jsx_runtime26 = require("react/jsx-runtime");
2271
- function Agents24ChatScaffold({ appearanceController, theme, ...props }) {
2272
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ThemeProvider, { controller: appearanceController, theme, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(App, { ...props }) }) });
2415
+ var import_jsx_runtime27 = require("react/jsx-runtime");
2416
+ function Agents24ChatScaffold({ appearanceController, theme, themeMode, ...props }) {
2417
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ThemeProvider, { controller: appearanceController, theme, mode: themeMode, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(App, { ...props }) }) });
2273
2418
  }
2274
2419
  // Annotate the CommonJS export names for ESM import in node:
2275
2420
  0 && (module.exports = {