@agents24/chat-react 0.5.36 → 0.5.37

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 (40) hide show
  1. package/dist/{chunk-INO5DSSJ.js → chunk-DWDHK4FZ.js} +3 -4
  2. package/dist/chunk-DWDHK4FZ.js.map +1 -0
  3. package/dist/generated/delegation-types.d.ts +3 -2
  4. package/dist/generated/run-usage.d.ts +11 -0
  5. package/dist/registry/agents24-chat.json +13 -13
  6. package/dist/runtime/index.cjs +25 -9
  7. package/dist/runtime/index.cjs.map +1 -1
  8. package/dist/runtime/index.js +24 -7
  9. package/dist/runtime/index.js.map +1 -1
  10. package/dist/runtime/input-contract.d.ts +1 -1
  11. package/dist/runtime/use-agent-chat-hitl.d.ts +2 -2
  12. package/dist/runtime/use-agent-chat-runtime.d.ts +4 -6
  13. package/dist/scaffold/app.d.ts +2 -2
  14. package/dist/scaffold/components/chat/chat-composer.d.ts +2 -1
  15. package/dist/scaffold/components/chat/chat-message.d.ts +2 -2
  16. package/dist/scaffold/components/chat/message-parts.d.ts +2 -2
  17. package/dist/scaffold/index.cjs +17 -13
  18. package/dist/scaffold/index.cjs.map +1 -1
  19. package/dist/scaffold/index.js +11 -7
  20. package/dist/scaffold/index.js.map +1 -1
  21. package/dist/styles.css +7 -0
  22. package/dist/ui/agent-chat-composer.d.ts +2 -1
  23. package/dist/ui/agent-chat-message.d.ts +6 -2
  24. package/dist/ui/agent-response-timeline.d.ts +11 -3
  25. package/dist/ui/ask-user-interaction.d.ts +5 -1
  26. package/dist/ui/hitl-submission-status.d.ts +22 -0
  27. package/dist/ui/index.cjs +514 -337
  28. package/dist/ui/index.cjs.map +1 -1
  29. package/dist/ui/index.d.ts +1 -0
  30. package/dist/ui/index.js +510 -335
  31. package/dist/ui/index.js.map +1 -1
  32. package/dist/ui/use-agent-chat-composer.d.ts +17 -2
  33. package/dist/ui/use-audio-recorder.d.ts +15 -2
  34. package/package.json +3 -3
  35. package/scaffold/src/app.tsx +2 -1
  36. package/scaffold/src/components/chat/chat-composer.tsx +5 -3
  37. package/scaffold/src/components/chat/chat-message.tsx +3 -3
  38. package/scaffold/src/components/chat/chat-shell.tsx +2 -1
  39. package/scaffold/src/components/chat/message-parts.tsx +6 -6
  40. package/dist/chunk-INO5DSSJ.js.map +0 -1
package/dist/ui/index.cjs CHANGED
@@ -79,6 +79,7 @@ __export(ui_exports, {
79
79
  CodeBlockLine: () => CodeBlockLine,
80
80
  CodeBlockTitle: () => CodeBlockTitle,
81
81
  CodeBlockWrapButton: () => CodeBlockWrapButton,
82
+ HitlSubmissionStatus: () => HitlSubmissionStatus,
82
83
  Marker: () => Marker,
83
84
  MarkerContent: () => MarkerContent,
84
85
  MarkerIcon: () => MarkerIcon,
@@ -105,10 +106,12 @@ __export(ui_exports, {
105
106
  cn: () => cn,
106
107
  contextStatusMetrics: () => contextStatusMetrics,
107
108
  createAgentChatComposerFile: () => createAgentChatComposerFile,
109
+ defaultHitlSubmissionLabels: () => defaultHitlSubmissionLabels,
108
110
  hitlActionLabel: () => hitlActionLabel,
109
111
  hitlTitle: () => hitlTitle,
110
112
  isAgentChatSubagent: () => isAgentChatSubagent,
111
113
  isAgentChatToolRunning: () => isAgentChatToolRunning,
114
+ isHitlSubmissionCompact: () => isHitlSubmissionCompact,
112
115
  latestRunningAgentChatToolId: () => latestRunningAgentChatToolId,
113
116
  markerVariants: () => markerVariants,
114
117
  partitionAgentChatToolTimeline: () => partitionAgentChatToolTimeline,
@@ -861,13 +864,12 @@ function uploadByteSize(data) {
861
864
  function inputMimeTypes(contract) {
862
865
  if (!contract) return [];
863
866
  return [
864
- ...contract.modalities.files.allowed_mime_types,
865
- ...contract.modalities.images.allowed_mime_types,
866
- ...contract.modalities.audio.allowed_mime_types
867
+ ...["files", "images", "audio"].flatMap((key) => contract.modalities[key].enabled ? contract.modalities[key].allowed_mime_types : [])
867
868
  ];
868
869
  }
869
870
  function validateAgentChatSubmission(contract, text, files) {
870
871
  const { modalities, limits } = contract;
872
+ if (files.length && contract.validation_issues?.length) return contract.validation_issues[0].message;
871
873
  const normalizedText = text.trim();
872
874
  if (normalizedText && !modalities.text.enabled) return "This agent does not accept text input.";
873
875
  if (modalities.text.required && !normalizedText) return "Text input is required.";
@@ -958,47 +960,69 @@ function useChatComposerFocus({ textareaRef, disabled, focusKey, restoredDraft,
958
960
 
959
961
  // src/ui/use-audio-recorder.ts
960
962
  var React3 = __toESM(require("react"), 1);
963
+ var import_client4 = require("@agents24/client");
961
964
  var RECORDING_CANDIDATES = ["audio/webm;codecs=opus", "audio/webm", "audio/mp4"];
962
965
  function useAudioRecorder(onRecorded, options = {}) {
963
966
  const recorderRef = React3.useRef(null);
964
967
  const streamRef = React3.useRef(null);
968
+ const operationRef = React3.useRef(null);
965
969
  const pendingRef = React3.useRef(false);
966
- const generationRef = React3.useRef(0);
967
- const onRecordedRef = React3.useRef(onRecorded);
968
- const onStreamChangeRef = React3.useRef(options.onStreamChange);
969
- React3.useEffect(() => {
970
- onRecordedRef.current = onRecorded;
971
- onStreamChangeRef.current = options.onStreamChange;
970
+ const callbacksRef = React3.useRef({ onRecorded, onStreamChange: options.onStreamChange, acceptedMimeTypes: options.acceptedMimeTypes });
971
+ React3.useLayoutEffect(() => {
972
+ callbacksRef.current = { onRecorded, onStreamChange: options.onStreamChange, acceptedMimeTypes: options.acceptedMimeTypes };
972
973
  });
973
974
  const [isRecording, setIsRecording] = React3.useState(false);
975
+ const [isStarting, setIsStarting] = React3.useState(false);
976
+ const [isProcessing, setIsProcessing] = React3.useState(false);
974
977
  const [error, setError] = React3.useState(null);
975
978
  const release = React3.useCallback(() => {
976
979
  streamRef.current?.getTracks().forEach((track) => track.stop());
977
980
  streamRef.current = null;
978
981
  recorderRef.current = null;
979
- onStreamChangeRef.current?.(null);
982
+ callbacksRef.current.onStreamChange?.(null);
980
983
  }, []);
984
+ const discard = React3.useCallback(() => {
985
+ operationRef.current?.controller.abort();
986
+ operationRef.current = null;
987
+ pendingRef.current = false;
988
+ const recorder = recorderRef.current;
989
+ if (recorder) {
990
+ recorder.onstop = null;
991
+ recorder.onerror = null;
992
+ recorder.ondataavailable = null;
993
+ if (recorder.state !== "inactive") recorder.stop();
994
+ }
995
+ release();
996
+ }, [release]);
997
+ const cancel = React3.useCallback(() => {
998
+ discard();
999
+ setIsStarting(false);
1000
+ setIsRecording(false);
1001
+ setIsProcessing(false);
1002
+ setError(null);
1003
+ }, [discard]);
981
1004
  const stop = React3.useCallback(() => {
982
1005
  const recorder = recorderRef.current;
983
1006
  if (recorder && recorder.state !== "inactive") recorder.stop();
984
1007
  }, []);
985
- const start = React3.useCallback(async () => {
986
- if (pendingRef.current || recorderRef.current) return;
1008
+ const isCapturing = React3.useCallback(() => pendingRef.current || recorderRef.current !== null, []);
1009
+ const start = React3.useCallback(async (startOptions = {}) => {
1010
+ if (operationRef.current) return;
987
1011
  setError(null);
988
1012
  if (!navigator.mediaDevices?.getUserMedia || typeof MediaRecorder === "undefined") {
989
1013
  setError("Audio recording is not supported in this browser.");
990
1014
  return;
991
1015
  }
1016
+ const controller = new AbortController();
1017
+ const operation = { operationId: startOptions.operationId ?? crypto.randomUUID(), signal: controller.signal, controller };
1018
+ operationRef.current = operation;
992
1019
  pendingRef.current = true;
993
- const generation = generationRef.current;
1020
+ setIsStarting(true);
994
1021
  try {
995
- const mimeType = RECORDING_CANDIDATES.find((candidate) => MediaRecorder.isTypeSupported(candidate));
996
- if (!mimeType) {
997
- setError("Audio recording is not supported in this browser.");
998
- return;
999
- }
1022
+ const mimeType = RECORDING_CANDIDATES.find((candidate) => MediaRecorder.isTypeSupported(candidate) && (callbacksRef.current.acceptedMimeTypes === void 0 || callbacksRef.current.acceptedMimeTypes.includes((0, import_client4.normalizeAttachmentMimeType)(candidate))));
1023
+ if (!mimeType) throw new Error("unsupported");
1000
1024
  const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
1001
- if (generation !== generationRef.current) {
1025
+ if (operation.signal.aborted) {
1002
1026
  stream.getTracks().forEach((track) => track.stop());
1003
1027
  return;
1004
1028
  }
@@ -1010,48 +1034,54 @@ function useAudioRecorder(onRecorded, options = {}) {
1010
1034
  if (event.data.size) chunks.push(event.data);
1011
1035
  };
1012
1036
  recorder.onstop = () => {
1013
- if (generation !== generationRef.current) return;
1037
+ if (operation.signal.aborted) return;
1014
1038
  const actualType = recorder.mimeType || mimeType;
1015
- const extension = actualType.startsWith("audio/mp4") ? "m4a" : "webm";
1016
- try {
1017
- onRecordedRef.current(new File([new Blob(chunks, { type: actualType })], `recording-${Date.now()}.${extension}`, { type: actualType }));
1018
- } finally {
1019
- release();
1020
- setIsRecording(false);
1039
+ const accepted = callbacksRef.current.acceptedMimeTypes;
1040
+ if (accepted !== void 0 && !accepted.includes((0, import_client4.normalizeAttachmentMimeType)(actualType))) {
1041
+ cancel();
1042
+ setError("This Agent does not accept the recorded audio format.");
1043
+ return;
1021
1044
  }
1022
- };
1023
- recorder.onerror = () => {
1024
- recorder.onstop = null;
1025
- if (recorder.state !== "inactive") recorder.stop();
1045
+ const extension = actualType.startsWith("audio/mp4") ? "m4a" : "webm";
1046
+ const file = new File(chunks, `recording-${Date.now()}.${extension}`, { type: actualType });
1026
1047
  release();
1027
1048
  setIsRecording(false);
1049
+ setIsProcessing(true);
1050
+ void Promise.resolve().then(() => {
1051
+ if (!operation.signal.aborted) return callbacksRef.current.onRecorded(file, operation);
1052
+ }).catch(() => {
1053
+ if (!operation.signal.aborted) setError("Recording processing failed.");
1054
+ }).finally(() => {
1055
+ if (operationRef.current === operation) {
1056
+ operationRef.current = null;
1057
+ setIsProcessing(false);
1058
+ }
1059
+ });
1060
+ };
1061
+ recorder.onerror = () => {
1062
+ cancel();
1028
1063
  setError("Audio recording failed. Try again.");
1029
1064
  };
1030
1065
  recorder.start();
1031
1066
  setIsRecording(true);
1032
- onStreamChangeRef.current?.(stream);
1067
+ callbacksRef.current.onStreamChange?.(stream);
1033
1068
  } catch {
1034
- if (generation === generationRef.current) {
1035
- release();
1036
- setIsRecording(false);
1037
- setError("Microphone access is unavailable.");
1069
+ if (!operation.signal.aborted) {
1070
+ cancel();
1071
+ setError("Microphone access or audio recording is unavailable.");
1038
1072
  }
1039
1073
  } finally {
1040
- if (generation === generationRef.current) pendingRef.current = false;
1041
- }
1042
- }, [release]);
1043
- React3.useEffect(() => () => {
1044
- generationRef.current += 1;
1045
- pendingRef.current = false;
1046
- const recorder = recorderRef.current;
1047
- if (recorder) {
1048
- recorder.onstop = null;
1049
- recorder.onerror = null;
1050
- if (recorder.state !== "inactive") recorder.stop();
1074
+ if (!operation.signal.aborted) {
1075
+ pendingRef.current = false;
1076
+ setIsStarting(false);
1077
+ }
1051
1078
  }
1052
- release();
1053
- }, [release]);
1054
- return { error, isRecording, start, stop };
1079
+ }, [cancel, discard, release]);
1080
+ React3.useLayoutEffect(() => {
1081
+ cancel();
1082
+ return discard;
1083
+ }, [options.scopeKey, cancel, discard]);
1084
+ return { error, isRecording, isStarting, isProcessing, isCapturing, start, stop, cancel };
1055
1085
  }
1056
1086
 
1057
1087
  // src/ui/use-agent-chat-composer.ts
@@ -1063,16 +1093,29 @@ function useAgentChatComposer(options) {
1063
1093
  const localTextareaRef = React4.useRef(null);
1064
1094
  const textareaRef = options.textareaRef ?? localTextareaRef;
1065
1095
  const filesRef = React4.useRef(files);
1066
- const inFlightFilesRef = React4.useRef([]);
1096
+ const inFlightFilesRef = React4.useRef(/* @__PURE__ */ new Map());
1067
1097
  const revisionRef = React4.useRef(0);
1068
1098
  const submittingRef = React4.useRef(false);
1069
- React4.useEffect(() => {
1070
- filesRef.current = files;
1071
- }, [files]);
1099
+ const generationRef = React4.useRef(0);
1100
+ const mountedRef = React4.useRef(true);
1101
+ const textRef = React4.useRef(text);
1102
+ React4.useLayoutEffect(() => {
1103
+ mountedRef.current = true;
1104
+ submittingRef.current = false;
1105
+ setIsSubmitting(false);
1106
+ return () => {
1107
+ mountedRef.current = false;
1108
+ generationRef.current += 1;
1109
+ };
1110
+ }, [options.scopeKey]);
1072
1111
  React4.useEffect(() => () => {
1073
1112
  revokeAgentChatComposerFiles(filesRef.current);
1074
- revokeAgentChatComposerFiles(inFlightFilesRef.current);
1113
+ revokeAgentChatComposerFiles([...inFlightFilesRef.current.values()].flat());
1075
1114
  }, []);
1115
+ const revokeUnownedFiles = (candidates) => {
1116
+ const retained = new Set([...filesRef.current, ...[...inFlightFilesRef.current.values()].flat()].map((file) => file.url));
1117
+ revokeAgentChatComposerFiles(candidates.filter((file) => !retained.has(file.url)));
1118
+ };
1076
1119
  const focusComposer = useChatComposerFocus({
1077
1120
  textareaRef,
1078
1121
  disabled: Boolean(options.disabled),
@@ -1080,7 +1123,10 @@ function useAgentChatComposer(options) {
1080
1123
  restoredDraft: options.restoredDraft,
1081
1124
  onRestore: (draft) => {
1082
1125
  revisionRef.current += 1;
1083
- revokeAgentChatComposerFiles(filesRef.current);
1126
+ const previousFiles = filesRef.current;
1127
+ textRef.current = draft.text;
1128
+ filesRef.current = draft.files;
1129
+ revokeUnownedFiles(previousFiles);
1084
1130
  setTextState(draft.text);
1085
1131
  setFiles(draft.files);
1086
1132
  }
@@ -1088,52 +1134,80 @@ function useAgentChatComposer(options) {
1088
1134
  const attachmentMimeTypes = inputMimeTypes(options.inputContract);
1089
1135
  const setText = (value) => {
1090
1136
  revisionRef.current += 1;
1137
+ textRef.current = value;
1091
1138
  setTextState(value);
1092
1139
  };
1093
1140
  const addFiles = (selected) => {
1094
1141
  const accepted = selected.filter((file) => attachmentMimeTypes.includes(canonicalInputMimeType(file.type, file.name)));
1095
1142
  revisionRef.current += 1;
1096
- const additions = accepted.map(createAgentChatComposerFile);
1097
- setFiles((current) => [...current, ...additions]);
1143
+ const additions = selected.map(createAgentChatComposerFile);
1144
+ filesRef.current = [...filesRef.current, ...additions];
1145
+ setFiles(filesRef.current);
1098
1146
  setAttachmentError(accepted.length === selected.length ? null : "One or more selected file types are not supported by this Agent.");
1099
1147
  };
1100
1148
  const removeFile = (id) => {
1101
1149
  revisionRef.current += 1;
1102
1150
  const removed = filesRef.current.find((file) => file.id === id);
1103
- if (removed) revokeAgentChatComposerFiles([removed]);
1104
- setFiles((current) => current.filter((file) => file.id !== id));
1151
+ filesRef.current = filesRef.current.filter((file) => file.id !== id);
1152
+ if (removed) revokeUnownedFiles([removed]);
1153
+ setFiles(filesRef.current);
1105
1154
  };
1106
- const recorder = useAudioRecorder((file) => addFiles([file]), { onStreamChange: options.onRecordingStreamChange });
1155
+ const recorder = useAudioRecorder(
1156
+ (file, context) => options.onRecordingComplete ? options.onRecordingComplete(file, context) : addFiles([file]),
1157
+ {
1158
+ onStreamChange: options.onRecordingStreamChange,
1159
+ scopeKey: options.scopeKey,
1160
+ acceptedMimeTypes: options.onRecordingComplete ? void 0 : options.inputContract?.modalities.audio.allowed_mime_types ?? []
1161
+ }
1162
+ );
1107
1163
  const validationError = options.inputContract ? validateAgentChatSubmission(
1108
1164
  options.inputContract,
1109
1165
  text,
1110
1166
  files.map((file) => ({ data: file.source || new Uint8Array(), mediaType: file.mediaType, name: file.filename, byteSize: file.byteSize }))
1111
1167
  ) : null;
1112
- const canSubmit = Boolean(text.trim() || files.length) && !options.disabled && !options.isCancelling && !isSubmitting && !recorder.isRecording && !validationError;
1113
- const submit = async () => {
1114
- if (!canSubmit || submittingRef.current) return;
1115
- const value = text;
1116
- const selectedFiles = files;
1168
+ const canSubmit = Boolean(text.trim() || files.length) && !options.disabled && !options.isCancelling && !isSubmitting && !recorder.isRecording && !recorder.isStarting && !recorder.isProcessing && !validationError;
1169
+ const submit = async (submission) => {
1170
+ const value = submission?.text ?? textRef.current;
1171
+ const selectedFiles = submission?.files ?? filesRef.current;
1172
+ const suppliedError = options.inputContract ? validateAgentChatSubmission(
1173
+ options.inputContract,
1174
+ value,
1175
+ selectedFiles.map((file) => ({ data: file.source || new Uint8Array(), mediaType: file.mediaType, name: file.filename, byteSize: file.byteSize }))
1176
+ ) : null;
1177
+ if (!mountedRef.current || !value.trim() && !selectedFiles.length || options.disabled || options.isCancelling || submittingRef.current || recorder.isCapturing() || !submission && recorder.isProcessing || suppliedError) return false;
1178
+ const generation = generationRef.current;
1117
1179
  const clearedRevision = ++revisionRef.current;
1118
1180
  submittingRef.current = true;
1119
1181
  setIsSubmitting(true);
1120
- inFlightFilesRef.current = selectedFiles;
1182
+ const selectedUrls = new Set(selectedFiles.map((file) => file.url));
1183
+ const replacedFiles = filesRef.current.filter((file) => !selectedUrls.has(file.url));
1184
+ const submissionId = /* @__PURE__ */ Symbol();
1185
+ inFlightFilesRef.current.set(submissionId, selectedFiles);
1186
+ textRef.current = "";
1187
+ filesRef.current = [];
1188
+ revokeUnownedFiles(replacedFiles);
1121
1189
  setTextState("");
1122
1190
  setFiles([]);
1123
1191
  focusComposer();
1124
1192
  try {
1125
1193
  await options.onSubmit(value, selectedFiles);
1126
- revokeAgentChatComposerFiles(selectedFiles);
1194
+ return true;
1127
1195
  } catch {
1128
- if (revisionRef.current === clearedRevision) {
1196
+ if (mountedRef.current && generationRef.current === generation && revisionRef.current === clearedRevision) {
1129
1197
  revisionRef.current += 1;
1198
+ textRef.current = value;
1199
+ filesRef.current = selectedFiles;
1130
1200
  setTextState(value);
1131
1201
  setFiles(selectedFiles);
1132
- } else revokeAgentChatComposerFiles(selectedFiles);
1202
+ }
1203
+ return false;
1133
1204
  } finally {
1134
- inFlightFilesRef.current = [];
1135
- submittingRef.current = false;
1136
- setIsSubmitting(false);
1205
+ inFlightFilesRef.current.delete(submissionId);
1206
+ revokeUnownedFiles(selectedFiles);
1207
+ if (mountedRef.current && generationRef.current === generation) {
1208
+ submittingRef.current = false;
1209
+ setIsSubmitting(false);
1210
+ }
1137
1211
  }
1138
1212
  };
1139
1213
  return {
@@ -1150,6 +1224,7 @@ function useAgentChatComposer(options) {
1150
1224
  attachmentMimeTypes,
1151
1225
  validationError,
1152
1226
  recorder,
1227
+ isProcessing: recorder.isProcessing,
1153
1228
  recordingAllowed: options.recordingEnabled ?? options.inputContract?.modalities.audio.recording_enabled ?? false,
1154
1229
  fileAccept: (0, import_client2.attachmentFileAccept)(attachmentMimeTypes),
1155
1230
  onKeyDown: (event) => {
@@ -1283,6 +1358,7 @@ function AgentChatComposer({
1283
1358
  disabled = false,
1284
1359
  forceExpanded = false,
1285
1360
  focusKey,
1361
+ scopeKey,
1286
1362
  inputToolbarContent,
1287
1363
  isRunning = false,
1288
1364
  isCancelling = false,
@@ -1301,6 +1377,7 @@ function AgentChatComposer({
1301
1377
  disabled,
1302
1378
  isRunning,
1303
1379
  isCancelling,
1380
+ scopeKey,
1304
1381
  focusKey,
1305
1382
  restoredDraft,
1306
1383
  textareaRef: localTextareaRef,
@@ -1782,11 +1859,68 @@ function AgentChatDefaultActions({
1782
1859
  }
1783
1860
 
1784
1861
  // src/ui/agent-chat-message.tsx
1785
- var React16 = __toESM(require("react"), 1);
1862
+ var React17 = __toESM(require("react"), 1);
1786
1863
  var import_lucide_react9 = require("lucide-react");
1787
1864
 
1865
+ // src/ui/hitl-submission-status.tsx
1866
+ var React9 = __toESM(require("react"), 1);
1867
+ var import_jsx_runtime7 = require("react/jsx-runtime");
1868
+ var defaultHitlSubmissionLabels = {
1869
+ submitting: "Submitting\u2026",
1870
+ checking: "Checking submission\u2026",
1871
+ uncertain: "Submission could not be confirmed.",
1872
+ retry: "Retry submission",
1873
+ accepted: "Accepted; agent continuing",
1874
+ approved: "Approved; agent continuing",
1875
+ rejected: "Rejected"
1876
+ };
1877
+ function isHitlSubmissionCompact(state) {
1878
+ return ["submitting", "resuming", "checking", "uncertain", "accepted"].includes(state?.status || "");
1879
+ }
1880
+ function HitlSubmissionStatus({ state, labels: overrides, onPaint }) {
1881
+ const labels = { ...defaultHitlSubmissionLabels, ...overrides };
1882
+ const started = React9.useRef(performance.now());
1883
+ const ref = React9.useRef(null);
1884
+ const paintCallback = React9.useRef(onPaint);
1885
+ paintCallback.current = onPaint;
1886
+ React9.useEffect(() => {
1887
+ const frame = requestAnimationFrame(() => paintCallback.current?.(performance.now() - started.current));
1888
+ return () => cancelAnimationFrame(frame);
1889
+ }, []);
1890
+ React9.useEffect(() => {
1891
+ ref.current?.focus({ preventScroll: true });
1892
+ }, []);
1893
+ const text = state.status === "checking" ? labels.checking : state.status === "uncertain" ? labels.uncertain : state.status === "accepted" ? state.action === "approve" ? labels.approved : state.action === "reject" ? labels.rejected : labels.accepted : labels.submitting;
1894
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1895
+ "div",
1896
+ {
1897
+ ref,
1898
+ tabIndex: -1,
1899
+ role: "status",
1900
+ "aria-live": "polite",
1901
+ "aria-atomic": "true",
1902
+ "data-hitl-submission": state.status,
1903
+ className: "a24-hitl-submission flex items-center gap-2 py-1 text-start text-sm text-muted-foreground outline-none",
1904
+ children: [
1905
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: text }),
1906
+ state.status === "uncertain" && state.retry && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1907
+ "button",
1908
+ {
1909
+ type: "button",
1910
+ className: "rounded px-2 py-1 text-foreground underline underline-offset-2",
1911
+ onClick: () => {
1912
+ void state.retry?.().catch(() => void 0);
1913
+ },
1914
+ children: labels.retry
1915
+ }
1916
+ )
1917
+ ]
1918
+ }
1919
+ );
1920
+ }
1921
+
1788
1922
  // src/ui/agent-response-timeline.tsx
1789
- var React15 = __toESM(require("react"), 1);
1923
+ var React16 = __toESM(require("react"), 1);
1790
1924
 
1791
1925
  // src/streaming-text.ts
1792
1926
  var import_react = require("react");
@@ -1971,7 +2105,7 @@ function useStreamingText({
1971
2105
  }
1972
2106
 
1973
2107
  // src/ui/ask-user-interaction.tsx
1974
- var React9 = __toESM(require("react"), 1);
2108
+ var React10 = __toESM(require("react"), 1);
1975
2109
  var import_lucide_react5 = require("lucide-react");
1976
2110
 
1977
2111
  // src/ui/ask-user-interaction-state.ts
@@ -2028,7 +2162,7 @@ function askUserAnswersFromDrafts(questions, drafts) {
2028
2162
  }
2029
2163
 
2030
2164
  // src/ui/ask-user-interaction.tsx
2031
- var import_jsx_runtime7 = require("react/jsx-runtime");
2165
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2032
2166
  function resolvedAnswerText(question, answer) {
2033
2167
  if (!answer) return ["No response recorded"];
2034
2168
  const labels = answer.selectedOptionIds.flatMap((optionId) => {
@@ -2042,7 +2176,7 @@ function ResolvedQuestions({
2042
2176
  buttonRef,
2043
2177
  part
2044
2178
  }) {
2045
- const [open, setOpen] = React9.useState(false);
2179
+ const [open, setOpen] = React10.useState(false);
2046
2180
  const count = part.questions.length;
2047
2181
  const answers = new Map(
2048
2182
  (part.resolution?.answers || []).map((answer) => [
@@ -2050,8 +2184,8 @@ function ResolvedQuestions({
2050
2184
  answer
2051
2185
  ])
2052
2186
  );
2053
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "a24-ask-user a24-ask-user--resolved w-full", children: [
2054
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2187
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "a24-ask-user a24-ask-user--resolved w-full", children: [
2188
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2055
2189
  "button",
2056
2190
  {
2057
2191
  "aria-expanded": open,
@@ -2060,13 +2194,13 @@ function ResolvedQuestions({
2060
2194
  ref: buttonRef,
2061
2195
  type: "button",
2062
2196
  children: [
2063
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
2197
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
2064
2198
  "Asked ",
2065
2199
  count,
2066
2200
  " question",
2067
2201
  count === 1 ? "" : "s"
2068
2202
  ] }),
2069
- open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": "true", className: "size-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2203
+ open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.ChevronDown, { "aria-hidden": "true", className: "size-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2070
2204
  import_lucide_react5.ChevronRight,
2071
2205
  {
2072
2206
  "aria-hidden": "true",
@@ -2076,12 +2210,12 @@ function ResolvedQuestions({
2076
2210
  ]
2077
2211
  }
2078
2212
  ),
2079
- open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-2 space-y-3 ps-4", children: part.questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "min-w-0", children: [
2080
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-sm font-medium text-foreground", children: question.question }),
2081
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-1 space-y-1 text-sm text-muted-foreground", children: resolvedAnswerText(
2213
+ open ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mt-2 space-y-3 ps-4", children: part.questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "min-w-0", children: [
2214
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-sm font-medium text-foreground", children: question.question }),
2215
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mt-1 space-y-1 text-sm text-muted-foreground", children: resolvedAnswerText(
2082
2216
  question,
2083
2217
  answers.get(question.id)
2084
- ).map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2218
+ ).map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2085
2219
  "div",
2086
2220
  {
2087
2221
  className: "whitespace-pre-wrap break-words",
@@ -2094,40 +2228,50 @@ function ResolvedQuestions({
2094
2228
  }
2095
2229
  function AskUserInteraction({
2096
2230
  error,
2231
+ submission,
2232
+ submissionLabels,
2233
+ onSubmissionPaint,
2097
2234
  isBusy = false,
2098
2235
  onSubmit,
2099
2236
  part
2100
2237
  }) {
2101
2238
  const questions = part.questions;
2102
- const [step, setStep] = React9.useState(0);
2103
- const [drafts, setDrafts] = React9.useState(
2239
+ const [step, setStep] = React10.useState(0);
2240
+ const [drafts, setDrafts] = React10.useState(
2104
2241
  () => emptyAskUserDrafts(questions)
2105
2242
  );
2106
- const headingRef = React9.useRef(null);
2107
- const questionsRef = React9.useRef(questions);
2108
- const resolvedButtonRef = React9.useRef(null);
2109
- const wasResolvedRef = React9.useRef(part.status !== "pending");
2243
+ const otherRef = React10.useRef(null);
2244
+ const headingRef = React10.useRef(null);
2245
+ const questionsRef = React10.useRef(questions);
2246
+ const resolvedButtonRef = React10.useRef(null);
2247
+ const wasResolvedRef = React10.useRef(part.status !== "pending");
2110
2248
  questionsRef.current = questions;
2111
- React9.useEffect(() => {
2249
+ React10.useEffect(() => {
2112
2250
  setStep(0);
2113
2251
  setDrafts(emptyAskUserDrafts(questionsRef.current));
2114
2252
  }, [part.interruptId]);
2115
- React9.useEffect(() => {
2253
+ React10.useEffect(() => {
2116
2254
  headingRef.current?.focus();
2117
2255
  }, [step]);
2118
- React9.useEffect(() => {
2256
+ React10.useEffect(() => {
2119
2257
  const isResolved = part.status !== "pending";
2120
2258
  if (isResolved && !wasResolvedRef.current) {
2121
2259
  resolvedButtonRef.current?.focus();
2122
2260
  }
2123
2261
  wasResolvedRef.current = isResolved;
2124
2262
  }, [part.status]);
2263
+ React10.useEffect(() => {
2264
+ if (submission?.status === "error") (otherRef.current?.value ? otherRef.current : headingRef.current)?.focus();
2265
+ }, [submission?.status]);
2266
+ if (part.status === "pending" && isHitlSubmissionCompact(submission)) {
2267
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(HitlSubmissionStatus, { state: submission, labels: submissionLabels, onPaint: onSubmissionPaint });
2268
+ }
2125
2269
  if (part.status !== "pending") {
2126
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ResolvedQuestions, { buttonRef: resolvedButtonRef, part });
2270
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ResolvedQuestions, { buttonRef: resolvedButtonRef, part });
2127
2271
  }
2128
2272
  const question = questions[step];
2129
2273
  if (!question) {
2130
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-sm text-destructive", role: "alert", children: "This question request is unavailable." });
2274
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-sm text-destructive", role: "alert", children: "This question request is unavailable." });
2131
2275
  }
2132
2276
  const draft = drafts[question.id] || {
2133
2277
  customText: "",
@@ -2161,9 +2305,9 @@ function AskUserInteraction({
2161
2305
  })
2162
2306
  );
2163
2307
  };
2164
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "a24-ask-user space-y-3 rounded-xl border border-border/50 bg-background p-4 shadow-sm", children: [
2165
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex min-w-0 items-start justify-between gap-4", children: [
2166
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2308
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "a24-ask-user space-y-3 rounded-xl border border-border/50 bg-background p-4 shadow-sm", children: [
2309
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex min-w-0 items-start justify-between gap-4", children: [
2310
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2167
2311
  "h3",
2168
2312
  {
2169
2313
  className: "min-w-0 flex-1 text-base font-medium leading-6 text-foreground outline-none",
@@ -2172,8 +2316,8 @@ function AskUserInteraction({
2172
2316
  children: question.question
2173
2317
  }
2174
2318
  ),
2175
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex shrink-0 items-center gap-1 text-muted-foreground", children: [
2176
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2319
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex shrink-0 items-center gap-1 text-muted-foreground", children: [
2320
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2177
2321
  "button",
2178
2322
  {
2179
2323
  "aria-label": "Previous question",
@@ -2181,7 +2325,7 @@ function AskUserInteraction({
2181
2325
  disabled: isBusy || step === 0,
2182
2326
  onClick: () => setStep((current) => Math.max(0, current - 1)),
2183
2327
  type: "button",
2184
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2328
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2185
2329
  import_lucide_react5.ChevronLeft,
2186
2330
  {
2187
2331
  "aria-hidden": "true",
@@ -2190,7 +2334,7 @@ function AskUserInteraction({
2190
2334
  )
2191
2335
  }
2192
2336
  ),
2193
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2337
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2194
2338
  "span",
2195
2339
  {
2196
2340
  "aria-label": `Question ${step + 1} of ${questions.length}`,
@@ -2202,7 +2346,7 @@ function AskUserInteraction({
2202
2346
  ]
2203
2347
  }
2204
2348
  ),
2205
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2349
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2206
2350
  "button",
2207
2351
  {
2208
2352
  "aria-label": isLastQuestion ? "Submit answers" : "Next question",
@@ -2210,7 +2354,7 @@ function AskUserInteraction({
2210
2354
  disabled: isBusy || !onSubmit || !canMoveForward,
2211
2355
  onClick: () => completeStep(drafts),
2212
2356
  type: "button",
2213
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2357
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2214
2358
  import_lucide_react5.ChevronRight,
2215
2359
  {
2216
2360
  "aria-hidden": "true",
@@ -2221,10 +2365,10 @@ function AskUserInteraction({
2221
2365
  )
2222
2366
  ] })
2223
2367
  ] }),
2224
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1", children: [
2368
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-1", children: [
2225
2369
  question.options.map((option, index) => {
2226
2370
  const selected = draft.selectedOptionIds.includes(option.id);
2227
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
2371
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
2228
2372
  "button",
2229
2373
  {
2230
2374
  "aria-pressed": selected,
@@ -2236,7 +2380,7 @@ function AskUserInteraction({
2236
2380
  onClick: () => selectOption(option.id),
2237
2381
  type: "button",
2238
2382
  children: [
2239
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2383
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2240
2384
  "span",
2241
2385
  {
2242
2386
  className: cn(
@@ -2246,8 +2390,8 @@ function AskUserInteraction({
2246
2390
  children: index + 1
2247
2391
  }
2248
2392
  ),
2249
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "min-w-0 flex-1 font-medium text-foreground", children: option.label }),
2250
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2393
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "min-w-0 flex-1 font-medium text-foreground", children: option.label }),
2394
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2251
2395
  import_lucide_react5.ChevronRight,
2252
2396
  {
2253
2397
  "aria-hidden": "true",
@@ -2259,11 +2403,12 @@ function AskUserInteraction({
2259
2403
  option.id
2260
2404
  );
2261
2405
  }),
2262
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex min-h-11 items-center gap-2 rounded-xl bg-muted px-2.5 py-1.5 focus-within:ring-1 focus-within:ring-ring", children: [
2263
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react5.Pencil, { "aria-hidden": "true", className: "size-4" }) }),
2264
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2406
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex min-h-11 items-center gap-2 rounded-xl bg-muted px-2.5 py-1.5 focus-within:ring-1 focus-within:ring-ring", children: [
2407
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.Pencil, { "aria-hidden": "true", className: "size-4" }) }),
2408
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2265
2409
  "input",
2266
2410
  {
2411
+ ref: otherRef,
2267
2412
  "aria-label": "Other response",
2268
2413
  autoComplete: "off",
2269
2414
  className: "h-8 min-w-0 flex-1 bg-transparent px-1 text-sm text-foreground outline-none placeholder:text-muted-foreground",
@@ -2280,7 +2425,7 @@ function AskUserInteraction({
2280
2425
  value: draft.customText
2281
2426
  }
2282
2427
  ),
2283
- draft.customText.trim() ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2428
+ draft.customText.trim() ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2284
2429
  "button",
2285
2430
  {
2286
2431
  className: "h-8 shrink-0 rounded-full bg-foreground px-4 text-sm font-medium text-background transition-colors hover:opacity-85 disabled:opacity-50",
@@ -2292,12 +2437,12 @@ function AskUserInteraction({
2292
2437
  ) : null
2293
2438
  ] })
2294
2439
  ] }),
2295
- error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-sm text-destructive", role: "alert", children: error }) : null
2440
+ error ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "text-sm text-destructive", role: "alert", children: error }) : null
2296
2441
  ] });
2297
2442
  }
2298
2443
 
2299
2444
  // src/ui/agent-chat-context-compression-row.tsx
2300
- var import_jsx_runtime8 = require("react/jsx-runtime");
2445
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2301
2446
  function compressionPresentation(part) {
2302
2447
  if (part.status === "failed") {
2303
2448
  return { label: "Could not compact message history", status: "failed" };
@@ -2312,7 +2457,7 @@ function AgentChatContextCompressionRow({
2312
2457
  part
2313
2458
  }) {
2314
2459
  const presentation = compressionPresentation(part);
2315
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2460
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2316
2461
  "div",
2317
2462
  {
2318
2463
  "aria-live": "polite",
@@ -2320,11 +2465,11 @@ function AgentChatContextCompressionRow({
2320
2465
  "data-agents24-context-compression": "",
2321
2466
  "data-status": part.status,
2322
2467
  role: "status",
2323
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn(
2468
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: cn(
2324
2469
  "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--without-orb",
2325
2470
  presentation.status === "failed" && "a24-tool-trigger--error",
2326
2471
  presentation.status === "running" && "a24-tool-trigger--active"
2327
- ), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cn(
2472
+ ), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: cn(
2328
2473
  "a24-tool-trigger__label",
2329
2474
  presentation.status === "running" && "a24-tool-shimmer"
2330
2475
  ), children: presentation.label }) }) })
@@ -2333,7 +2478,7 @@ function AgentChatContextCompressionRow({
2333
2478
  }
2334
2479
 
2335
2480
  // src/ui/message-response.tsx
2336
- var React13 = __toESM(require("react"), 1);
2481
+ var React14 = __toESM(require("react"), 1);
2337
2482
  var import_streamdown = require("streamdown");
2338
2483
 
2339
2484
  // src/active-content.ts
@@ -2358,14 +2503,14 @@ function safeChatMarkdownHref(value) {
2358
2503
  }
2359
2504
 
2360
2505
  // src/ui/message-code.tsx
2361
- var React12 = __toESM(require("react"), 1);
2506
+ var React13 = __toESM(require("react"), 1);
2362
2507
  var import_lucide_react7 = require("lucide-react");
2363
2508
 
2364
2509
  // src/ui/code-block.tsx
2365
- var React10 = __toESM(require("react"), 1);
2510
+ var React11 = __toESM(require("react"), 1);
2366
2511
  var import_class_variance_authority2 = require("class-variance-authority");
2367
2512
  var import_lucide_react6 = require("lucide-react");
2368
- var import_jsx_runtime9 = require("react/jsx-runtime");
2513
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2369
2514
  var codeBlockVariants = (0, import_class_variance_authority2.cva)(
2370
2515
  "a24-code-block",
2371
2516
  {
@@ -2386,7 +2531,7 @@ function CodeBlock({
2386
2531
  size = "default",
2387
2532
  ...props
2388
2533
  }) {
2389
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2534
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2390
2535
  "div",
2391
2536
  {
2392
2537
  "data-slot": "code-block",
@@ -2398,7 +2543,7 @@ function CodeBlock({
2398
2543
  );
2399
2544
  }
2400
2545
  function CodeBlockHeader({ className, ...props }) {
2401
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2546
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2402
2547
  "div",
2403
2548
  {
2404
2549
  "data-slot": "code-block-header",
@@ -2411,7 +2556,7 @@ function CodeBlockHeader({ className, ...props }) {
2411
2556
  );
2412
2557
  }
2413
2558
  function CodeBlockTitle({ className, ...props }) {
2414
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2559
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2415
2560
  "div",
2416
2561
  {
2417
2562
  "data-slot": "code-block-title",
@@ -2427,7 +2572,7 @@ function CodeBlockActions({
2427
2572
  className,
2428
2573
  ...props
2429
2574
  }) {
2430
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2575
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2431
2576
  "div",
2432
2577
  {
2433
2578
  "data-slot": "code-block-actions",
@@ -2445,16 +2590,16 @@ function CodeBlockCopyButton({
2445
2590
  onClick,
2446
2591
  ...props
2447
2592
  }) {
2448
- const [copied, setCopied] = React10.useState(false);
2449
- React10.useEffect(() => {
2593
+ const [copied, setCopied] = React11.useState(false);
2594
+ React11.useEffect(() => {
2450
2595
  if (!copied) {
2451
2596
  return;
2452
2597
  }
2453
2598
  const timeout = setTimeout(() => setCopied(false), 2e3);
2454
2599
  return () => clearTimeout(timeout);
2455
2600
  }, [copied]);
2456
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
2457
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2601
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
2602
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2458
2603
  "button",
2459
2604
  {
2460
2605
  type: "button",
@@ -2470,10 +2615,10 @@ function CodeBlockCopyButton({
2470
2615
  });
2471
2616
  },
2472
2617
  ...props,
2473
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.CheckIcon, { size: 12, strokeWidth: 1.5 }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.CopyIcon, { size: 12, strokeWidth: 1.5 })
2618
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.CheckIcon, { size: 12, strokeWidth: 1.5 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.CopyIcon, { size: 12, strokeWidth: 1.5 })
2474
2619
  }
2475
2620
  ),
2476
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-live": "polite", className: "a24-code-block__announcement", children: copied ? "Copied" : "" })
2621
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-live": "polite", className: "a24-code-block__announcement", children: copied ? "Copied" : "" })
2477
2622
  ] });
2478
2623
  }
2479
2624
  function CodeBlockWrapButton({
@@ -2483,7 +2628,7 @@ function CodeBlockWrapButton({
2483
2628
  onClick,
2484
2629
  ...props
2485
2630
  }) {
2486
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2631
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2487
2632
  "button",
2488
2633
  {
2489
2634
  type: "button",
@@ -2497,7 +2642,7 @@ function CodeBlockWrapButton({
2497
2642
  if (!event.defaultPrevented) onWrapChange(!wrap);
2498
2643
  },
2499
2644
  ...props,
2500
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.WrapTextIcon, { size: 12, strokeWidth: 1.5 })
2645
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.WrapTextIcon, { size: 12, strokeWidth: 1.5 })
2501
2646
  }
2502
2647
  );
2503
2648
  }
@@ -2508,7 +2653,7 @@ function CodeBlockDownloadButton({
2508
2653
  onClick,
2509
2654
  ...props
2510
2655
  }) {
2511
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2656
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2512
2657
  "button",
2513
2658
  {
2514
2659
  type: "button",
@@ -2529,7 +2674,7 @@ function CodeBlockDownloadButton({
2529
2674
  setTimeout(() => URL.revokeObjectURL(url), 1e3);
2530
2675
  },
2531
2676
  ...props,
2532
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.DownloadIcon, { size: 12, strokeWidth: 1.5 })
2677
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.DownloadIcon, { size: 12, strokeWidth: 1.5 })
2533
2678
  }
2534
2679
  );
2535
2680
  }
@@ -2542,7 +2687,7 @@ function CodeBlockContent({
2542
2687
  startLine = 1,
2543
2688
  ...props
2544
2689
  }) {
2545
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2690
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2546
2691
  "pre",
2547
2692
  {
2548
2693
  "data-slot": "code-block-content",
@@ -2556,12 +2701,12 @@ function CodeBlockContent({
2556
2701
  className
2557
2702
  ),
2558
2703
  ...props,
2559
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2704
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2560
2705
  "code",
2561
2706
  {
2562
2707
  "data-slot": "code-block-code",
2563
2708
  className: "a24-code-block__code",
2564
- children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CodeBlockLine, { children: line }, index)) : children
2709
+ children: lineNumbers && typeof children === "string" ? children.replace(/\n$/, "").split("\n").map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CodeBlockLine, { children: line }, index)) : children
2565
2710
  }
2566
2711
  )
2567
2712
  }
@@ -2590,19 +2735,19 @@ function CodeBlockLine({
2590
2735
  ...props
2591
2736
  }) {
2592
2737
  const empty = children === void 0 || children === null || children === "" || Array.isArray(children) && children.length === 0;
2593
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2738
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2594
2739
  "span",
2595
2740
  {
2596
2741
  "data-slot": "code-block-line",
2597
2742
  "data-variant": variant,
2598
2743
  className: cn(codeBlockLineVariants({ variant }), className),
2599
2744
  ...props,
2600
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "data-slot": "code-block-line-content", className: "a24-code-block__line-content", children: empty ? "\n" : children })
2745
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "data-slot": "code-block-line-content", className: "a24-code-block__line-content", children: empty ? "\n" : children })
2601
2746
  }
2602
2747
  );
2603
2748
  }
2604
2749
  function CodeBlockFooter({ className, ...props }) {
2605
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2750
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2606
2751
  "div",
2607
2752
  {
2608
2753
  "data-slot": "code-block-footer",
@@ -2616,13 +2761,13 @@ function CodeBlockFooter({ className, ...props }) {
2616
2761
  }
2617
2762
 
2618
2763
  // src/ui/use-highlighted-code.ts
2619
- var React11 = __toESM(require("react"), 1);
2764
+ var React12 = __toESM(require("react"), 1);
2620
2765
 
2621
2766
  // src/ui/code-highlighter.tsx
2622
2767
  var import_core = require("shiki/core");
2623
2768
  var import_javascript = require("shiki/engine/javascript");
2624
2769
  var import_langs = require("shiki/langs");
2625
- var import_jsx_runtime10 = require("react/jsx-runtime");
2770
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2626
2771
  var languageLoaders = {
2627
2772
  ...import_langs.bundledLanguages,
2628
2773
  ...import_langs.bundledLanguagesAlias
@@ -2667,7 +2812,7 @@ async function loadHighlighter(language) {
2667
2812
  const tokens = lang === "ansi" ? code.split("\n").flatMap((line) => tokenize(line)) : tokenize(code);
2668
2813
  return {
2669
2814
  lines: tokens.map(
2670
- (line) => line.map((token, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2815
+ (line) => line.map((token, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2671
2816
  "span",
2672
2817
  {
2673
2818
  style: token.htmlStyle,
@@ -2686,9 +2831,9 @@ async function loadHighlighter(language) {
2686
2831
  // src/ui/use-highlighted-code.ts
2687
2832
  function useHighlightedCode(value, language) {
2688
2833
  const code = value.endsWith("\n") ? value.slice(0, -1) : value;
2689
- const [loaded, setLoaded] = React11.useState(null);
2834
+ const [loaded, setLoaded] = React12.useState(null);
2690
2835
  const highlighter2 = loaded?.language === language ? loaded.highlighter : null;
2691
- React11.useEffect(() => {
2836
+ React12.useEffect(() => {
2692
2837
  let cancelled = false;
2693
2838
  loadHighlighter(language).then((next2) => {
2694
2839
  if (!cancelled) {
@@ -2700,7 +2845,7 @@ function useHighlightedCode(value, language) {
2700
2845
  cancelled = true;
2701
2846
  };
2702
2847
  }, [language]);
2703
- const [done, setDone] = React11.useState({ highlighter: null, text: "", lines: [] });
2848
+ const [done, setDone] = React12.useState({ highlighter: null, text: "", lines: [] });
2704
2849
  let next = done;
2705
2850
  if (next.highlighter !== highlighter2 || !code.startsWith(next.text)) {
2706
2851
  next = { highlighter: highlighter2, text: "", lines: [] };
@@ -2722,7 +2867,7 @@ function useHighlightedCode(value, language) {
2722
2867
  setDone(next);
2723
2868
  }
2724
2869
  const tail = code.slice(end);
2725
- return React11.useMemo(() => {
2870
+ return React12.useMemo(() => {
2726
2871
  if (!highlighter2) {
2727
2872
  return code.split("\n");
2728
2873
  }
@@ -2731,7 +2876,7 @@ function useHighlightedCode(value, language) {
2731
2876
  }
2732
2877
 
2733
2878
  // src/ui/message-code.tsx
2734
- var import_jsx_runtime11 = require("react/jsx-runtime");
2879
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2735
2880
  var CODE_EXTENSIONS = {
2736
2881
  bash: "sh",
2737
2882
  shell: "sh",
@@ -2773,32 +2918,32 @@ var CODE_EXTENSIONS = {
2773
2918
  plaintext: "txt"
2774
2919
  };
2775
2920
  function MessageCodeBlock({ code, language = "text" }) {
2776
- const [wrap, setWrap] = React12.useState(false);
2921
+ const [wrap, setWrap] = React13.useState(false);
2777
2922
  const lines = useHighlightedCode(code, language);
2778
2923
  const extension = Object.prototype.hasOwnProperty.call(CODE_EXTENSIONS, language.toLowerCase()) ? CODE_EXTENSIONS[language.toLowerCase()] : "txt";
2779
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlock, { children: [
2780
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlockHeader, { children: [
2781
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlockTitle, { children: [
2782
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.FileCode2Icon, { size: 14, strokeWidth: 1.5, "aria-hidden": "true" }),
2783
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: language })
2924
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CodeBlock, { children: [
2925
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CodeBlockHeader, { children: [
2926
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CodeBlockTitle, { children: [
2927
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react7.FileCode2Icon, { size: 14, strokeWidth: 1.5, "aria-hidden": "true" }),
2928
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: language })
2784
2929
  ] }),
2785
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CodeBlockActions, { children: [
2786
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockWrapButton, { wrap, onWrapChange: setWrap }),
2787
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockDownloadButton, { value: code, filename: `code.${extension}` }),
2788
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockCopyButton, { value: code })
2930
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(CodeBlockActions, { children: [
2931
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CodeBlockWrapButton, { wrap, onWrapChange: setWrap }),
2932
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CodeBlockDownloadButton, { value: code, filename: `code.${extension}` }),
2933
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CodeBlockCopyButton, { value: code })
2789
2934
  ] })
2790
2935
  ] }),
2791
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockContent, { "aria-label": `${language} code`, lineNumbers: true, wrap, children: lines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CodeBlockLine, { children: line }, index)) })
2936
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CodeBlockContent, { "aria-label": `${language} code`, lineNumbers: true, wrap, children: lines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CodeBlockLine, { children: line }, index)) })
2792
2937
  ] });
2793
2938
  }
2794
2939
  function MessageMarkdownCode({ children, className, node, ...props }) {
2795
2940
  const language = className?.match(/(?:^|\s)language-([^\s]+)/)?.[1];
2796
2941
  const multiline = node?.position?.start?.line !== node?.position?.end?.line;
2797
2942
  if (props["data-block"] === void 0 && !language && !multiline) {
2798
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("code", { ...props, className: cn("a24-inline-code", className), "data-streamdown": "inline-code", children });
2943
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { ...props, className: cn("a24-inline-code", className), "data-streamdown": "inline-code", children });
2799
2944
  }
2800
2945
  const code = typeof children === "string" ? children.replace(/\n$/, "") : "";
2801
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MessageCodeBlock, { code, language });
2946
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MessageCodeBlock, { code, language });
2802
2947
  }
2803
2948
  function formatMessageJson(text) {
2804
2949
  const trimmed = text.trim();
@@ -2832,17 +2977,17 @@ ${" ".repeat(depth)}`;
2832
2977
  }
2833
2978
 
2834
2979
  // src/ui/message-response.tsx
2835
- var import_jsx_runtime12 = require("react/jsx-runtime");
2980
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2836
2981
  function SafeMarkdownLink({ children, href, ...props }) {
2837
2982
  const domProps = { ...props };
2838
2983
  delete domProps.node;
2839
2984
  const safeHref = safeChatMarkdownHref(href);
2840
- if (!safeHref) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children });
2841
- if (safeHref.startsWith("#")) return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { ...domProps, href: safeHref, children });
2842
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { ...domProps, href: safeHref, rel: "noopener noreferrer", target: "_blank", children });
2985
+ if (!safeHref) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children });
2986
+ if (safeHref.startsWith("#")) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { ...domProps, href: safeHref, children });
2987
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { ...domProps, href: safeHref, rel: "noopener noreferrer", target: "_blank", children });
2843
2988
  }
2844
2989
  function BlockedMarkdownImage({ alt }) {
2845
- return alt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-label": `Image blocked: ${alt}`, role: "img", children: alt }) : null;
2990
+ return alt ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-label": `Image blocked: ${alt}`, role: "img", children: alt }) : null;
2846
2991
  }
2847
2992
  var BLOCK_MARKDOWN_TAGS = /* @__PURE__ */ new Set([
2848
2993
  "blockquote",
@@ -2863,7 +3008,7 @@ function isMultilineCodeNode(node) {
2863
3008
  return node?.tagName === "code" && node.position?.start?.line !== void 0 && node.position?.end?.line !== void 0 && node.position.start.line !== node.position.end.line;
2864
3009
  }
2865
3010
  function hasBlockMarkdownChild(child) {
2866
- if (!React13.isValidElement(child)) {
3011
+ if (!React14.isValidElement(child)) {
2867
3012
  return false;
2868
3013
  }
2869
3014
  if (typeof child.type === "string" && BLOCK_MARKDOWN_TAGS.has(child.type)) {
@@ -2873,7 +3018,7 @@ function hasBlockMarkdownChild(child) {
2873
3018
  if (BLOCK_MARKDOWN_TAGS.has(props.node?.tagName || "") || isMultilineCodeNode(props.node)) {
2874
3019
  return true;
2875
3020
  }
2876
- return React13.Children.toArray(props.children).some(hasBlockMarkdownChild);
3021
+ return React14.Children.toArray(props.children).some(hasBlockMarkdownChild);
2877
3022
  }
2878
3023
  function MessageMarkdownParagraph({
2879
3024
  children,
@@ -2881,17 +3026,17 @@ function MessageMarkdownParagraph({
2881
3026
  }) {
2882
3027
  const domProps = { ...props };
2883
3028
  delete domProps.node;
2884
- const childArray = React13.Children.toArray(children).filter(
3029
+ const childArray = React14.Children.toArray(children).filter(
2885
3030
  (child) => child !== null && child !== ""
2886
3031
  );
2887
- const isImageOnly = childArray.length === 1 && React13.isValidElement(childArray[0]) && childArray[0].props.node?.tagName === "img";
3032
+ const isImageOnly = childArray.length === 1 && React14.isValidElement(childArray[0]) && childArray[0].props.node?.tagName === "img";
2888
3033
  if (isImageOnly) {
2889
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children });
3034
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children });
2890
3035
  }
2891
3036
  if (childArray.some(hasBlockMarkdownChild)) {
2892
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { ...domProps, children });
3037
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ...domProps, children });
2893
3038
  }
2894
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { ...domProps, children });
3039
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { ...domProps, children });
2895
3040
  }
2896
3041
  var MESSAGE_RESPONSE_COMPONENTS = {
2897
3042
  a: SafeMarkdownLink,
@@ -2912,7 +3057,7 @@ var MESSAGE_RESPONSE_REHYPE_PLUGINS = [
2912
3057
  ]
2913
3058
  ] : []
2914
3059
  ];
2915
- var MessageResponse = React13.memo(
3060
+ var MessageResponse = React14.memo(
2916
3061
  ({
2917
3062
  children,
2918
3063
  className,
@@ -2930,13 +3075,13 @@ var MessageResponse = React13.memo(
2930
3075
  maxCatchupChars: 32,
2931
3076
  text
2932
3077
  });
2933
- const streamdownComponents = React13.useMemo(
3078
+ const streamdownComponents = React14.useMemo(
2934
3079
  () => ({ ...MESSAGE_RESPONSE_COMPONENTS, ...components }),
2935
3080
  [components]
2936
3081
  );
2937
- const json = React13.useMemo(() => formatMessageJson(text), [text]);
3082
+ const json = React14.useMemo(() => formatMessageJson(text), [text]);
2938
3083
  if (json !== null && !components?.code) {
2939
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("a24-message-response", className), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3084
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("a24-message-response", className), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2940
3085
  MessageCodeBlock,
2941
3086
  {
2942
3087
  code: streaming || streamingText.isAnimating ? streamingText.displayedText : json,
@@ -2944,7 +3089,7 @@ var MessageResponse = React13.memo(
2944
3089
  }
2945
3090
  ) });
2946
3091
  }
2947
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
3092
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2948
3093
  import_streamdown.Streamdown,
2949
3094
  {
2950
3095
  className: cn("a24-message-response", className),
@@ -2996,10 +3141,10 @@ function resolvedHitlLabel(part) {
2996
3141
  }
2997
3142
 
2998
3143
  // src/ui/tool-sessions.tsx
2999
- var React14 = __toESM(require("react"), 1);
3144
+ var React15 = __toESM(require("react"), 1);
3000
3145
  var import_lucide_react8 = require("lucide-react");
3001
3146
  var import_thinking_orbs = require("thinking-orbs");
3002
- var import_jsx_runtime13 = require("react/jsx-runtime");
3147
+ var import_jsx_runtime14 = require("react/jsx-runtime");
3003
3148
  function toolSlotContext(isActive2, label, part, slots) {
3004
3149
  return {
3005
3150
  isActive: isActive2,
@@ -3017,7 +3162,7 @@ function ToolResourceAction({ context }) {
3017
3162
  const target = context.resourceTargets[0];
3018
3163
  if (!target) return null;
3019
3164
  const name = resourceTargetName(target);
3020
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3165
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3021
3166
  "button",
3022
3167
  {
3023
3168
  "aria-label": `Open ${target.kind} ${target.path}`,
@@ -3031,8 +3176,8 @@ function ToolResourceAction({ context }) {
3031
3176
  );
3032
3177
  }
3033
3178
  function toolAccessory(context, slots) {
3034
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3035
- slots?.onResourceAction ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolResourceAction, { context }) : null,
3179
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3180
+ slots?.onResourceAction ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolResourceAction, { context }) : null,
3036
3181
  slots?.renderToolAccessory?.(context)
3037
3182
  ] });
3038
3183
  }
@@ -3109,12 +3254,12 @@ function ToolActivityReel({
3109
3254
  }) {
3110
3255
  const initial = initialLabel && initialLabel !== label ? initialLabel : label;
3111
3256
  const parsedInitialShownAt = initialShownAt ? Date.parse(initialShownAt) : Number.NaN;
3112
- const [displayed, setDisplayed] = React14.useState(initial);
3113
- const [previous, setPrevious] = React14.useState(null);
3114
- const displayedRef = React14.useRef(initial);
3115
- const latestRef = React14.useRef(label);
3116
- const shownAtRef = React14.useRef(Number.isFinite(parsedInitialShownAt) ? parsedInitialShownAt : Date.now());
3117
- React14.useEffect(() => {
3257
+ const [displayed, setDisplayed] = React15.useState(initial);
3258
+ const [previous, setPrevious] = React15.useState(null);
3259
+ const displayedRef = React15.useRef(initial);
3260
+ const latestRef = React15.useRef(label);
3261
+ const shownAtRef = React15.useRef(Number.isFinite(parsedInitialShownAt) ? parsedInitialShownAt : Date.now());
3262
+ React15.useEffect(() => {
3118
3263
  latestRef.current = label;
3119
3264
  if (displayedRef.current === label) return;
3120
3265
  const showLatest = () => {
@@ -3134,18 +3279,18 @@ function ToolActivityReel({
3134
3279
  const timer = window.setTimeout(showLatest, remaining);
3135
3280
  return () => window.clearTimeout(timer);
3136
3281
  }, [label]);
3137
- React14.useEffect(() => {
3282
+ React15.useEffect(() => {
3138
3283
  if (!previous) return;
3139
3284
  const timer = window.setTimeout(() => setPrevious(null), 200);
3140
3285
  return () => window.clearTimeout(timer);
3141
3286
  }, [previous]);
3142
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "a24-tool-reel", "aria-live": announce ? "polite" : "off", children: [
3143
- previous ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { "aria-hidden": "true", className: "a24-tool-reel__previous", children: previous }) : null,
3144
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: previous ? "a24-tool-reel__current" : void 0, children: displayed })
3287
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "a24-tool-reel", "aria-live": announce ? "polite" : "off", children: [
3288
+ previous ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": "true", className: "a24-tool-reel__previous", children: previous }) : null,
3289
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: previous ? "a24-tool-reel__current" : void 0, children: displayed })
3145
3290
  ] });
3146
3291
  }
3147
3292
  function ToolActivityOrb({ label = "Working", kind = "tool", part, renderActivityIcon }) {
3148
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-orb", children: renderActivityIcon ? renderActivityIcon({ label, kind, part }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_thinking_orbs.ThinkingOrb, { "aria-label": label, size: 20, speed: 0.8, state: "searching" }) });
3293
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-orb", children: renderActivityIcon ? renderActivityIcon({ label, kind, part }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_thinking_orbs.ThinkingOrb, { "aria-label": label, size: 20, speed: 0.8, state: "searching" }) });
3149
3294
  }
3150
3295
  function AgentChatActivityRow({
3151
3296
  label,
@@ -3153,22 +3298,22 @@ function AgentChatActivityRow({
3153
3298
  renderActivityIcon,
3154
3299
  onSelect
3155
3300
  }) {
3156
- const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3157
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
3158
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { label }) })
3301
+ const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3302
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label, kind: "planning", renderActivityIcon }),
3303
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityReel, { label }) })
3159
3304
  ] });
3160
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
3305
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-trigger-row a24-tool-trigger-row--root", "data-agents24-model-turn": modelTurnId, role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", onClick: onSelect, type: "button", children: content }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-trigger a24-tool-trigger--root a24-tool-trigger--active", children: content }) });
3161
3306
  }
3162
3307
  function AgentChatModelTurnRow({ part }) {
3163
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AgentChatActivityRow, { label: "Planning next moves", modelTurnId: part.modelTurnId });
3308
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { label: "Planning next moves", modelTurnId: part.modelTurnId });
3164
3309
  }
3165
3310
  function AgentChatNodeActivityRow({
3166
3311
  renderActivityIcon,
3167
3312
  onSelect,
3168
3313
  part
3169
3314
  }) {
3170
- const [open, setOpen] = React14.useState(false);
3171
- const contentId = React14.useId();
3315
+ const [open, setOpen] = React15.useState(false);
3316
+ const contentId = React15.useId();
3172
3317
  const running = part.status === "running";
3173
3318
  const failed = part.status === "failed";
3174
3319
  const failureMessage = part.failure?.message || "The node could not complete the request.";
@@ -3179,18 +3324,18 @@ function AgentChatNodeActivityRow({
3179
3324
  running && "a24-tool-trigger--active",
3180
3325
  failed && "a24-tool-trigger--error"
3181
3326
  );
3182
- const label = running ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { label: part.label }) }) : part.label;
3327
+ const label = running ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-shimmer", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityReel, { label: part.label }) }) : part.label;
3183
3328
  if (!failed) {
3184
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger-row", role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
3185
- running ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
3186
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3187
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: triggerClassName, children: [
3188
- running ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
3189
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3329
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-trigger-row", role: "status", children: onSelect ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
3330
+ running ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
3331
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3332
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: triggerClassName, children: [
3333
+ running ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label: part.label, kind: "node", part, renderActivityIcon }) : null,
3334
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3190
3335
  ] }) });
3191
3336
  }
3192
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "a24-tool-disclosure", children: [
3193
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3337
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-tool-disclosure", children: [
3338
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-trigger-row", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3194
3339
  "button",
3195
3340
  {
3196
3341
  "aria-controls": contentId,
@@ -3202,12 +3347,12 @@ function AgentChatNodeActivityRow({
3202
3347
  },
3203
3348
  type: "button",
3204
3349
  children: [
3205
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
3206
- open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
3350
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
3351
+ open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
3207
3352
  ]
3208
3353
  }
3209
3354
  ) }),
3210
- open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", id: contentId, children: failureMessage }) : null
3355
+ open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", id: contentId, children: failureMessage }) : null
3211
3356
  ] });
3212
3357
  }
3213
3358
  function toolRowLabel(part, separateResource = false) {
@@ -3234,25 +3379,25 @@ function ToolDisclosure({
3234
3379
  renderActivityIcon,
3235
3380
  accessory
3236
3381
  }) {
3237
- const [open, setOpen] = React14.useState(false);
3238
- const contentId = React14.useId();
3239
- const expandable = React14.Children.toArray(children).length > 0;
3382
+ const [open, setOpen] = React15.useState(false);
3383
+ const contentId = React15.useId();
3384
+ const expandable = React15.Children.toArray(children).length > 0;
3240
3385
  if (!expandable) {
3241
3386
  const triggerClassName = cn("a24-tool-trigger", root && "a24-tool-trigger--root", root && !showOrb && "a24-tool-trigger--without-orb", error && "a24-tool-trigger--error", loading && "a24-tool-trigger--active");
3242
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
3243
- onSelect && part ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
3244
- showOrb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3245
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3246
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: triggerClassName, children: [
3247
- showOrb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3248
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3387
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
3388
+ onSelect && part ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("button", { className: triggerClassName, onClick: () => onSelect(part), type: "button", children: [
3389
+ showOrb ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3390
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3391
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: triggerClassName, children: [
3392
+ showOrb ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3393
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label", children: label })
3249
3394
  ] }),
3250
3395
  accessory
3251
3396
  ] });
3252
3397
  }
3253
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "a24-tool-disclosure", children: [
3254
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
3255
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3398
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-tool-disclosure", children: [
3399
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: cn("a24-tool-trigger-row", root && "a24-tool-trigger-row--root"), children: [
3400
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3256
3401
  "button",
3257
3402
  {
3258
3403
  "aria-controls": contentId,
@@ -3266,25 +3411,25 @@ function ToolDisclosure({
3266
3411
  },
3267
3412
  type: "button",
3268
3413
  children: [
3269
- showOrb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3270
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
3271
- open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
3414
+ showOrb ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityOrb, { label: statusLabel || "Working", kind: grouped ? "group" : "tool", part, renderActivityIcon }) : null,
3415
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-trigger__label", children: label }),
3416
+ open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.ChevronDown, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react8.ChevronRight, { "aria-hidden": "true", className: "a24-tool-trigger__chevron" })
3272
3417
  ]
3273
3418
  }
3274
3419
  ),
3275
3420
  accessory
3276
3421
  ] }),
3277
- open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-disclosure__content", id: contentId, children }) : null
3422
+ open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-disclosure__content", id: contentId, children }) : null
3278
3423
  ] });
3279
3424
  }
3280
3425
  function ToolLabel({ active, label, part, slots }) {
3281
3426
  const rendered = slots?.renderToolLabel?.(toolSlotContext(active, label, part, slots)) ?? label;
3282
- return active ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-tool-shimmer", children: rendered }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: rendered });
3427
+ return active ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-tool-shimmer", children: rendered }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: rendered });
3283
3428
  }
3284
3429
  function ToolList({ children }) {
3285
- const listRef = React14.useRef(null);
3286
- const [fades, setFades] = React14.useState({ bottom: false, top: false });
3287
- const updateFades = React14.useCallback(() => {
3430
+ const listRef = React15.useRef(null);
3431
+ const [fades, setFades] = React15.useState({ bottom: false, top: false });
3432
+ const updateFades = React15.useCallback(() => {
3288
3433
  const list = listRef.current;
3289
3434
  if (!list) return;
3290
3435
  const next = {
@@ -3293,7 +3438,7 @@ function ToolList({ children }) {
3293
3438
  };
3294
3439
  setFades((current) => current.bottom === next.bottom && current.top === next.top ? current : next);
3295
3440
  }, []);
3296
- React14.useEffect(() => {
3441
+ React15.useEffect(() => {
3297
3442
  updateFades();
3298
3443
  const list = listRef.current;
3299
3444
  if (!list || typeof ResizeObserver === "undefined") return;
@@ -3301,13 +3446,13 @@ function ToolList({ children }) {
3301
3446
  observer.observe(list);
3302
3447
  return () => observer.disconnect();
3303
3448
  }, [children, updateFades]);
3304
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3449
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3305
3450
  "div",
3306
3451
  {
3307
3452
  className: "a24-tool-list-frame",
3308
3453
  "data-scroll-fade-bottom": fades.bottom ? "" : void 0,
3309
3454
  "data-scroll-fade-top": fades.top ? "" : void 0,
3310
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-list", onScroll: updateFades, ref: listRef, role: "list", children })
3455
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-list", onScroll: updateFades, ref: listRef, role: "list", children })
3311
3456
  }
3312
3457
  );
3313
3458
  }
@@ -3324,13 +3469,13 @@ function AgentChatToolRow({
3324
3469
  const detail = failed ? failureMessage : optionalText(part.presentation.detail);
3325
3470
  const hostDetails = failed ? null : slots?.renderToolDetails?.(part);
3326
3471
  const context = toolSlotContext(active, toolRowLabel(part, Boolean(slots?.onResourceAction)), part, slots);
3327
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { "data-agents24-tool-part": part.type, "data-state": part.state, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
3472
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-agents24-tool-part": part.type, "data-state": part.state, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
3328
3473
  ToolDisclosure,
3329
3474
  {
3330
3475
  renderActivityIcon: slots?.renderActivityIcon,
3331
3476
  error: failed,
3332
3477
  accessory: toolAccessory(context, slots),
3333
- label: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolLabel, { active, label: context.label, part, slots }),
3478
+ label: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolLabel, { active, label: context.label, part, slots }),
3334
3479
  loading: active,
3335
3480
  onExpandedChange: slots?.onExpandedChange,
3336
3481
  onSelect: slots?.onToolSelect,
@@ -3339,7 +3484,7 @@ function AgentChatToolRow({
3339
3484
  showOrb: showOrb ?? active,
3340
3485
  statusLabel: active ? context.label : void 0,
3341
3486
  children: [
3342
- detail ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("a24-tool-detail", failed && "a24-tool-detail--error"), children: detail }) : null,
3487
+ detail ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("a24-tool-detail", failed && "a24-tool-detail--error"), children: detail }) : null,
3343
3488
  hostDetails
3344
3489
  ]
3345
3490
  }
@@ -3359,19 +3504,19 @@ function AgentChatToolSession({
3359
3504
  parts,
3360
3505
  slots
3361
3506
  }) {
3362
- const presentedLiveRef = React14.useRef(false);
3507
+ const presentedLiveRef = React15.useRef(false);
3363
3508
  if (isLive && isLatestActivity) presentedLiveRef.current = true;
3364
3509
  const activeIndex = parts.findLastIndex((part) => isActive(part, activeToolId));
3365
3510
  const running = activeIndex >= 0;
3366
- if (parts.length === 1 && !modelTurn && !leadingModelTurn) return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AgentChatToolRow, { activeToolId, part: parts[0], slots });
3511
+ if (parts.length === 1 && !modelTurn && !leadingModelTurn) return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part: parts[0], slots });
3367
3512
  const visibleIndex = running ? activeIndex : parts.length - 1;
3368
3513
  const visiblePart = parts[visibleIndex];
3369
3514
  const planning = Boolean(modelTurn);
3370
3515
  const presentingActivity = isLatestActivity && (planning || running || isLive);
3371
3516
  const failed = isLatestActivity && (visiblePart.state === "output-error" || visiblePart.state === "cancelled");
3372
3517
  const label = planning ? "Planning next moves" : isLive && isLatestActivity ? toolRowLabel(visiblePart, true) : sessionLabel(parts, visiblePart, running);
3373
- const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { initialLabel: leadingModelTurn ? "Planning next moves" : void 0, initialShownAt: leadingModelTurn?.timestamp, label }) }) : label;
3374
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3518
+ const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityReel, { initialLabel: leadingModelTurn ? "Planning next moves" : void 0, initialShownAt: leadingModelTurn?.timestamp, label }) }) : label;
3519
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3375
3520
  ToolDisclosure,
3376
3521
  {
3377
3522
  renderActivityIcon: slots?.renderActivityIcon,
@@ -3384,7 +3529,7 @@ function AgentChatToolSession({
3384
3529
  root: true,
3385
3530
  showOrb: isLive && isLatestActivity,
3386
3531
  statusLabel: planning ? "Planning next moves" : label,
3387
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolList, { children: parts.map((part) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { role: "listitem", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AgentChatToolRow, { activeToolId, part, root: false, showOrb: false, slots }) }, part.id)) })
3532
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolList, { children: parts.map((part) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "listitem", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part, root: false, showOrb: false, slots }) }, part.id)) })
3388
3533
  }
3389
3534
  );
3390
3535
  }
@@ -3405,7 +3550,7 @@ function subagentLabel(part) {
3405
3550
  return { label: `Agent ${name}, ran ${children.length} ${children.length === 1 ? "tool" : "tools"}`, running: false };
3406
3551
  }
3407
3552
  function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part, slots }) {
3408
- const presentedLiveRef = React14.useRef(false);
3553
+ const presentedLiveRef = React15.useRef(false);
3409
3554
  if (isLive && isLatestActivity) presentedLiveRef.current = true;
3410
3555
  const children = part.presentation.childTools || [];
3411
3556
  const state = subagentLabel(part);
@@ -3414,9 +3559,9 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
3414
3559
  const hostDetails = failed ? null : slots?.renderToolDetails?.(part);
3415
3560
  const failureMessage = part.failure?.message || null;
3416
3561
  const presentingActivity = isLatestActivity && state.running;
3417
- const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolActivityReel, { label: state.label }) }) : state.label;
3562
+ const labelContent = presentedLiveRef.current ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: presentingActivity ? "a24-tool-shimmer" : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ToolActivityReel, { label: state.label }) }) : state.label;
3418
3563
  const context = toolSlotContext(presentingActivity, state.label, part, slots);
3419
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3564
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3420
3565
  ToolDisclosure,
3421
3566
  {
3422
3567
  renderActivityIcon: slots?.renderActivityIcon,
@@ -3430,12 +3575,12 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
3430
3575
  root: true,
3431
3576
  showOrb: isLive && isLatestActivity,
3432
3577
  statusLabel: state.label,
3433
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(ToolList, { children: [
3434
- children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: cn("a24-child-tool", child.status === "failed" && "a24-child-tool--error"), role: "listitem", children: slots?.renderChildTool?.(child, part) ?? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
3435
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: cn(isLive && isLatestActivity && child.status === "running" && "a24-tool-shimmer"), children: childLabel(child) }),
3436
- child.detail ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "a24-child-tool__detail", children: child.detail }) : null
3578
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(ToolList, { children: [
3579
+ children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("a24-child-tool", child.status === "failed" && "a24-child-tool--error"), role: "listitem", children: slots?.renderChildTool?.(child, part) ?? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
3580
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn(isLive && isLatestActivity && child.status === "running" && "a24-tool-shimmer"), children: childLabel(child) }),
3581
+ child.detail ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-child-tool__detail", children: child.detail }) : null
3437
3582
  ] }) }, child.id)),
3438
- failureMessage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", children: failureMessage }) : null,
3583
+ failureMessage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-tool-detail a24-tool-detail--error", children: failureMessage }) : null,
3439
3584
  hostDetails
3440
3585
  ] })
3441
3586
  }
@@ -3443,41 +3588,51 @@ function AgentChatSubagentGroup({ isLatestActivity = true, isLive = false, part,
3443
3588
  }
3444
3589
 
3445
3590
  // src/ui/agent-response-timeline.tsx
3446
- var import_jsx_runtime14 = require("react/jsx-runtime");
3591
+ var import_jsx_runtime15 = require("react/jsx-runtime");
3447
3592
  function isInternalAskUserTool(part) {
3448
3593
  return [part.toolName, part.toolKey, part.action].some((value) => value?.trim().toLowerCase() === "runtime__ask_user");
3449
3594
  }
3450
3595
  function Shimmer({ children, className }) {
3451
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: cn("inline-block animate-pulse", className), children });
3596
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("inline-block animate-pulse", className), children });
3452
3597
  }
3453
3598
  function AgentChatToolPart({
3454
3599
  activeToolId,
3455
3600
  part
3456
3601
  }) {
3457
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part });
3602
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatToolRow, { activeToolId, part });
3458
3603
  }
3459
3604
  function AgentChatToolGroup({
3460
3605
  activeToolId,
3461
3606
  parts
3462
3607
  }) {
3463
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolSession, { activeToolId, parts });
3608
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatToolSession, { activeToolId, parts });
3464
3609
  }
3465
3610
  function HitlPartRow({
3466
3611
  getHitlActionState,
3612
+ hitlLabels,
3613
+ onHitlPaint,
3467
3614
  isLoading,
3468
3615
  onHitlAction,
3469
3616
  part
3470
3617
  }) {
3471
3618
  const state = getHitlActionState?.(part);
3472
- const [comment, setComment] = React15.useState("");
3619
+ const [comment, setComment] = React16.useState("");
3620
+ const commentRef = React16.useRef(null);
3621
+ const retryActionRef = React16.useRef(null);
3622
+ React16.useEffect(() => {
3623
+ if (state?.status === "error") (commentRef.current || retryActionRef.current)?.focus();
3624
+ }, [state?.status]);
3473
3625
  const presentation = part.presentation || {};
3474
3626
  const requireComment = presentation.require_comment === true;
3475
3627
  const isTerminal = part.status !== "pending";
3476
3628
  if (part.hitlKind === "user_input") {
3477
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3629
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3478
3630
  AskUserInteraction,
3479
3631
  {
3480
3632
  error: state?.error,
3633
+ submission: state,
3634
+ submissionLabels: hitlLabels,
3635
+ onSubmissionPaint: onHitlPaint,
3481
3636
  isBusy: isLoading || state?.status === "resuming",
3482
3637
  onSubmit: onHitlAction ? (answers) => onHitlAction(part, {
3483
3638
  action: "respond",
@@ -3491,12 +3646,14 @@ function HitlPartRow({
3491
3646
  }
3492
3647
  );
3493
3648
  }
3649
+ if (isHitlSubmissionCompact(state)) return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HitlSubmissionStatus, { state, labels: hitlLabels, onPaint: onHitlPaint });
3494
3650
  if (isTerminal) return null;
3495
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-hitl space-y-2.5 px-1 py-2", children: [
3496
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-hitl__title text-sm font-medium text-foreground text-pretty", children: hitlTitle(part) }),
3497
- requireComment ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3651
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "a24-hitl space-y-2.5 px-1 py-2", children: [
3652
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-hitl__title text-sm font-medium text-foreground text-pretty", children: hitlTitle(part) }),
3653
+ requireComment ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3498
3654
  "textarea",
3499
3655
  {
3656
+ ref: commentRef,
3500
3657
  "aria-label": "Approval comment",
3501
3658
  autoComplete: "off",
3502
3659
  className: "a24-hitl__comment min-h-20 w-full resize-y rounded-md border border-border/60 bg-background px-3 py-2 text-sm outline-none focus-visible:border-neutral-300 focus-visible:ring-0 dark:focus-visible:border-neutral-600",
@@ -3506,10 +3663,11 @@ function HitlPartRow({
3506
3663
  value: comment
3507
3664
  }
3508
3665
  ) : null,
3509
- state?.error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-hitl__error text-sm text-destructive", children: state.error }) : null,
3510
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-hitl__actions flex flex-wrap items-center gap-1.5", children: part.allowedActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3666
+ state?.error ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-hitl__error text-sm text-destructive", children: state.error }) : null,
3667
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-hitl__actions flex flex-wrap items-center gap-1.5", children: part.allowedActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3511
3668
  "button",
3512
3669
  {
3670
+ ref: state?.action === action || !state?.action && action === part.allowedActions[0] ? retryActionRef : void 0,
3513
3671
  "aria-label": hitlActionLabel(part, action),
3514
3672
  className: cn(
3515
3673
  "a24-hitl__action min-h-10 rounded-md px-3 text-sm font-medium transition-[background-color,color,opacity,transform] duration-150 ease-out active:scale-[0.96] disabled:pointer-events-none disabled:opacity-60",
@@ -3531,6 +3689,8 @@ function HitlPartRow({
3531
3689
  function AgentChatPart({
3532
3690
  activeToolId,
3533
3691
  getHitlActionState,
3692
+ hitlLabels,
3693
+ onHitlPaint,
3534
3694
  isLoading,
3535
3695
  isTextStreaming,
3536
3696
  message,
@@ -3540,7 +3700,7 @@ function AgentChatPart({
3540
3700
  toolSlots
3541
3701
  }) {
3542
3702
  if (part.kind === "text") {
3543
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3703
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3544
3704
  MessageResponse,
3545
3705
  {
3546
3706
  ...responseProps,
@@ -3550,44 +3710,46 @@ function AgentChatPart({
3550
3710
  }
3551
3711
  );
3552
3712
  }
3553
- if (part.kind === "tool") return isAgentChatSubagent(part) ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatSubagentGroup, { part, slots: toolSlots }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part, slots: toolSlots });
3554
- if (part.kind === "model-turn") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatModelTurnRow, { part });
3713
+ if (part.kind === "tool") return isAgentChatSubagent(part) ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatSubagentGroup, { part, slots: toolSlots }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatToolRow, { activeToolId, part, slots: toolSlots });
3714
+ if (part.kind === "model-turn") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatModelTurnRow, { part });
3555
3715
  if (part.kind === "reasoning") {
3556
3716
  const label = part.text || part.label || "Thinking";
3557
- return part.status === "running" || part.status === "streaming" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Shimmer, { className: "text-sm text-muted-foreground", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-sm text-muted-foreground", children: label });
3717
+ return part.status === "running" || part.status === "streaming" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Shimmer, { className: "text-sm text-muted-foreground", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-sm text-muted-foreground", children: label });
3558
3718
  }
3559
3719
  if (part.kind === "context-compression") {
3560
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatContextCompressionRow, { part });
3720
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatContextCompressionRow, { part });
3561
3721
  }
3562
3722
  if (part.kind === "ui-blocks") {
3563
3723
  if (part.state === "output-error") {
3564
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
3724
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", children: part.errorText || "Failed to render UI content." });
3565
3725
  }
3566
- return part.bundle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
3726
+ return part.bundle ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SafeUiBlocks, { bundle: part.bundle }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "text-sm text-muted-foreground", children: part.state === "input-streaming" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Shimmer, { children: "Rendering UI block" }) : "Rendered UI block" });
3567
3727
  }
3568
3728
  if (part.kind === "hitl") {
3569
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3729
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3570
3730
  HitlPartRow,
3571
3731
  {
3572
3732
  getHitlActionState,
3733
+ hitlLabels,
3734
+ onHitlPaint,
3573
3735
  isLoading,
3574
3736
  onHitlAction,
3575
3737
  part
3576
3738
  }
3577
3739
  );
3578
3740
  }
3579
- if (part.kind === "error") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", role: "alert", children: part.errorText });
3741
+ if (part.kind === "error") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-timeline-error text-sm text-destructive", role: "alert", children: part.errorText });
3580
3742
  if (part.kind === "source") {
3581
3743
  const href = safeExternalUrl(part.url);
3582
- return href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: "a24-source-link", href, rel: "noopener noreferrer", target: "_blank", children: part.title }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-source-link", children: part.title });
3744
+ return href ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { className: "a24-source-link", href, rel: "noopener noreferrer", target: "_blank", children: part.title }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "a24-source-link", children: part.title });
3583
3745
  }
3584
3746
  if (part.kind === "citation") {
3585
3747
  const href = safeExternalUrl(part.url);
3586
3748
  const label = part.label || "Citation";
3587
- return href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: "a24-citation", href, rel: "noopener noreferrer", target: "_blank", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "a24-citation", children: label });
3749
+ return href ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { className: "a24-citation", href, rel: "noopener noreferrer", target: "_blank", children: label }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "a24-citation", children: label });
3588
3750
  }
3589
- if (part.kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-output-attachment", children: part.attachment.filename || "Attachment" });
3590
- if (part.kind === "data") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { "data-agents24-data-part": part.name, className: "hidden", children: message.id });
3751
+ if (part.kind === "attachment") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-output-attachment", children: part.attachment.filename || "Attachment" });
3752
+ if (part.kind === "data") return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { "data-agents24-data-part": part.name, className: "hidden", children: message.id });
3591
3753
  return null;
3592
3754
  }
3593
3755
  function safeExternalUrl(value) {
@@ -3601,28 +3763,28 @@ function safeExternalUrl(value) {
3601
3763
  }
3602
3764
  function SafeUiBlocks({ bundle }) {
3603
3765
  const rows = Array.isArray(bundle.rows) ? bundle.rows : [];
3604
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
3605
- typeof bundle.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { children: bundle.title }) : null,
3766
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("section", { "aria-label": typeof bundle.title === "string" ? bundle.title : "Agent result", className: "a24-ui-blocks", children: [
3767
+ typeof bundle.title === "string" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { children: bundle.title }) : null,
3606
3768
  rows.map((rawRow, rowIndex) => {
3607
3769
  const row = rawRow && typeof rawRow === "object" && !Array.isArray(rawRow) ? rawRow : {};
3608
3770
  const blocks = Array.isArray(row.blocks) ? row.blocks : [];
3609
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
3771
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-ui-blocks__row", children: blocks.map((rawBlock, blockIndex) => {
3610
3772
  const block = rawBlock && typeof rawBlock === "object" && !Array.isArray(rawBlock) ? rawBlock : {};
3611
3773
  const title = typeof block.title === "string" ? block.title : "Result";
3612
3774
  const kind = String(block.kind || "note");
3613
3775
  if (kind === "table" && Array.isArray(block.columns) && Array.isArray(block.rows)) {
3614
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-ui-block", children: [
3615
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { children: title }),
3616
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { children: [
3617
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("th", { children: String(column) }, index)) }) }),
3618
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { children: String(cell) }, cellIndex)) }, index)) })
3776
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "a24-ui-block", children: [
3777
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { children: title }),
3778
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "a24-ui-table-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("table", { children: [
3779
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { children: block.columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { children: String(column) }, index)) }) }),
3780
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tbody", { children: block.rows.map((rawCells, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("tr", { children: (Array.isArray(rawCells) ? rawCells : []).map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("td", { children: String(cell) }, cellIndex)) }, index)) })
3619
3781
  ] }) })
3620
3782
  ] }, String(block.id || blockIndex));
3621
3783
  }
3622
3784
  const value = block.value ?? block.text ?? "";
3623
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "a24-ui-block", children: [
3624
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h4", { children: title }),
3625
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: String(value) })
3785
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "a24-ui-block", children: [
3786
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { children: title }),
3787
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: String(value) })
3626
3788
  ] }, String(block.id || blockIndex));
3627
3789
  }) }, `row-${rowIndex}`);
3628
3790
  })
@@ -3630,6 +3792,8 @@ function SafeUiBlocks({ bundle }) {
3630
3792
  }
3631
3793
  function AgentResponseTimeline({
3632
3794
  getHitlActionState,
3795
+ hitlLabels,
3796
+ onHitlPaint,
3633
3797
  isLoading = false,
3634
3798
  message,
3635
3799
  nodeActivityMode = "default",
@@ -3642,7 +3806,7 @@ function AgentResponseTimeline({
3642
3806
  toolViewMode = "closed"
3643
3807
  }) {
3644
3808
  isLoading = isLoading && !message.responseCompletion;
3645
- const parts = (displayParts || message.parts || []).filter((part) => (part.kind !== "tool" || !isInternalAskUserTool(part)) && (part.kind !== "hitl" || part.hitlKind === "user_input" || part.status === "pending") && (part.kind !== "model-turn" || part.turnKind === "agent") && (part.kind !== "node-activity" || nodeActivityMode === "all" || nodeActivityMode === "default" && part.defaultChatVisible));
3809
+ const parts = (displayParts || message.parts || []).filter((part) => (part.kind !== "tool" || !isInternalAskUserTool(part)) && (part.kind !== "hitl" || part.hitlKind === "user_input" || part.status === "pending" || getHitlActionState?.(part)?.status === "accepted") && (part.kind !== "model-turn" || part.turnKind === "agent") && (part.kind !== "node-activity" || nodeActivityMode === "all" || nodeActivityMode === "default" && part.defaultChatVisible));
3646
3810
  const toolParts = parts.filter((part) => part.kind === "tool");
3647
3811
  const activeToolId = latestRunningAgentChatToolId(toolParts);
3648
3812
  const activeTextPartId = getActiveStreamingTextPartId(
@@ -3656,42 +3820,44 @@ function AgentResponseTimeline({
3656
3820
  if (segment.kind === "tool") {
3657
3821
  const isLatestActivity = segmentIndex === segments.length - 1;
3658
3822
  const showOrb = toolViewMode === "closed" ? isLoading && isLatestActivity : Boolean(activeToolId && (segment.part.id === activeToolId || segment.part.toolCallId === activeToolId));
3659
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolRow, { activeToolId, part: segment.part, showOrb, slots: toolSlots }, segment.part.id));
3823
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatToolRow, { activeToolId, part: segment.part, showOrb, slots: toolSlots }, segment.part.id));
3660
3824
  continue;
3661
3825
  }
3662
3826
  if (segment.kind === "tool-session") {
3663
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatToolSession, { activeToolId, isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, leadingModelTurn: segment.leadingModelTurn, modelTurn: segment.modelTurn, parts: segment.parts, slots: toolSlots }, `tool-session-${segment.parts[0].id}`));
3827
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatToolSession, { activeToolId, isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, leadingModelTurn: segment.leadingModelTurn, modelTurn: segment.modelTurn, parts: segment.parts, slots: toolSlots }, `tool-session-${segment.parts[0].id}`));
3664
3828
  continue;
3665
3829
  }
3666
3830
  if (segment.kind === "subagent") {
3667
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatSubagentGroup, { isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, part: segment.part, slots: toolSlots }, segment.part.id));
3831
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatSubagentGroup, { isLatestActivity: segmentIndex === segments.length - 1, isLive: isLoading, part: segment.part, slots: toolSlots }, segment.part.id));
3668
3832
  continue;
3669
3833
  }
3670
3834
  const part = segment.part;
3671
3835
  if (part.kind === "model-turn") {
3672
3836
  const key = activeActivityClaimed ? part.id : `${message.id}-active-activity`;
3673
3837
  activeActivityClaimed = true;
3674
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Planning next moves", modelTurnId: part.modelTurnId }, key));
3838
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Planning next moves", modelTurnId: part.modelTurnId }, key));
3675
3839
  continue;
3676
3840
  }
3677
3841
  if (part.kind === "node-activity") {
3678
3842
  const key = activeActivityClaimed ? part.id : `${message.id}-active-activity`;
3679
3843
  if (part.status === "running") activeActivityClaimed = true;
3680
3844
  rendered.push(
3681
- part.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: part.label, onSelect: onNodeSelect ? () => onNodeSelect(part) : void 0 }, key) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatNodeActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, onSelect: onNodeSelect, part }, part.id)
3845
+ part.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: part.label, onSelect: onNodeSelect ? () => onNodeSelect(part) : void 0 }, key) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatNodeActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, onSelect: onNodeSelect, part }, part.id)
3682
3846
  );
3683
3847
  continue;
3684
3848
  }
3685
3849
  if (part.kind === "ui-blocks" && renderUiBlocks) {
3686
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(React15.Fragment, { children: renderUiBlocks(part) }, part.id));
3850
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(React16.Fragment, { children: renderUiBlocks(part) }, part.id));
3687
3851
  continue;
3688
3852
  }
3689
3853
  rendered.push(
3690
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(React15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
3854
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(React16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3691
3855
  AgentChatPart,
3692
3856
  {
3693
3857
  activeToolId,
3694
3858
  getHitlActionState,
3859
+ hitlLabels,
3860
+ onHitlPaint,
3695
3861
  isLoading,
3696
3862
  isTextStreaming: part.kind === "text" && part.id === activeTextPartId,
3697
3863
  message,
@@ -3704,16 +3870,16 @@ function AgentResponseTimeline({
3704
3870
  );
3705
3871
  }
3706
3872
  if (rendered.length === 0 && message.content) {
3707
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MessageResponse, { children: message.content }, `${message.id}-fallback`));
3873
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MessageResponse, { children: message.content }, `${message.id}-fallback`));
3708
3874
  }
3709
3875
  if (rendered.length === 0 && isLoading) {
3710
- rendered.push(/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
3876
+ rendered.push(/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatActivityRow, { renderActivityIcon: toolSlots?.renderActivityIcon, label: "Thinking" }, `${message.id}-active-activity`));
3711
3877
  }
3712
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "space-y-3", children: rendered });
3878
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "space-y-3", children: rendered });
3713
3879
  }
3714
3880
 
3715
3881
  // src/ui/agent-chat-message.tsx
3716
- var import_jsx_runtime15 = require("react/jsx-runtime");
3882
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3717
3883
  var DEFAULT_USER_MESSAGE_COLLAPSE_THRESHOLD = 360;
3718
3884
  var DEFAULT_USER_MESSAGE_COLLAPSED_LINES = 4;
3719
3885
  function shouldCollapseUserMessage(content, threshold = DEFAULT_USER_MESSAGE_COLLAPSE_THRESHOLD) {
@@ -3726,8 +3892,8 @@ function AgentChatUserMessageContent({
3726
3892
  showLessLabel = "Show less",
3727
3893
  showMoreLabel = "Show more"
3728
3894
  }) {
3729
- const [isExpanded, setIsExpanded] = React16.useState(false);
3730
- const contentId = React16.useId();
3895
+ const [isExpanded, setIsExpanded] = React17.useState(false);
3896
+ const contentId = React17.useId();
3731
3897
  const shouldCollapse = shouldCollapseUserMessage(content, collapseThreshold);
3732
3898
  const Icon = isExpanded ? import_lucide_react9.ChevronUp : import_lucide_react9.ChevronDown;
3733
3899
  const clampedStyle = shouldCollapse && !isExpanded ? {
@@ -3736,9 +3902,9 @@ function AgentChatUserMessageContent({
3736
3902
  display: "-webkit-box",
3737
3903
  overflow: "hidden"
3738
3904
  } : void 0;
3739
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3740
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { id: contentId, className: "min-w-0", style: clampedStyle, children: content }),
3741
- shouldCollapse ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3905
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex min-w-0 flex-col gap-3", children: [
3906
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { id: contentId, className: "min-w-0", style: clampedStyle, children: content }),
3907
+ shouldCollapse ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3742
3908
  "button",
3743
3909
  {
3744
3910
  "aria-controls": contentId,
@@ -3751,7 +3917,7 @@ function AgentChatUserMessageContent({
3751
3917
  type: "button",
3752
3918
  children: [
3753
3919
  isExpanded ? showLessLabel : showMoreLabel,
3754
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 })
3920
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 })
3755
3921
  ]
3756
3922
  }
3757
3923
  ) : null
@@ -3761,9 +3927,9 @@ function AgentChatUserMessageActionRow({
3761
3927
  children,
3762
3928
  className
3763
3929
  }) {
3764
- const rowRef = React16.useRef(null);
3765
- const [visible, setVisible] = React16.useState(false);
3766
- React16.useEffect(() => {
3930
+ const rowRef = React17.useRef(null);
3931
+ const [visible, setVisible] = React17.useState(false);
3932
+ React17.useEffect(() => {
3767
3933
  const message = rowRef.current?.closest('[data-slot="message"]');
3768
3934
  if (!message) return;
3769
3935
  const show = () => setVisible(true);
@@ -3782,7 +3948,7 @@ function AgentChatUserMessageActionRow({
3782
3948
  message.removeEventListener("focusout", hideWhenFocusLeaves);
3783
3949
  };
3784
3950
  }, []);
3785
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3951
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3786
3952
  "div",
3787
3953
  {
3788
3954
  ref: rowRef,
@@ -3802,6 +3968,8 @@ function AgentChatMessage({
3802
3968
  contentClassName,
3803
3969
  dir,
3804
3970
  getHitlActionState,
3971
+ hitlLabels,
3972
+ onHitlPaint,
3805
3973
  message,
3806
3974
  nodeActivityMode,
3807
3975
  onHitlAction,
@@ -3821,7 +3989,7 @@ function AgentChatMessage({
3821
3989
  const resolvedUserContent = userMessageContent ?? message.content;
3822
3990
  const shouldRenderContent = isAssistant || Boolean(renderUserContent || resolvedUserContent);
3823
3991
  const showAttachments = Boolean(message.attachments?.length) && (message.role === "user" || showAssistantAttachments);
3824
- const renderedActions = actions ?? (actionHandlers ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3992
+ const renderedActions = actions ?? (actionHandlers ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3825
3993
  AgentChatDefaultActions,
3826
3994
  {
3827
3995
  additionalActions,
@@ -3831,14 +3999,14 @@ function AgentChatMessage({
3831
3999
  }
3832
4000
  ) : null);
3833
4001
  const defaultUserActions = !actions && Boolean(actionHandlers) && !isAssistant;
3834
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4002
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3835
4003
  ChatMessage,
3836
4004
  {
3837
4005
  className,
3838
4006
  dir,
3839
4007
  from: message.role,
3840
4008
  children: [
3841
- showAttachments ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4009
+ showAttachments ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3842
4010
  ChatAttachmentRows,
3843
4011
  {
3844
4012
  attachments: message.attachments || [],
@@ -3847,17 +4015,19 @@ function AgentChatMessage({
3847
4015
  resolveContent: attachmentContentResolver
3848
4016
  }
3849
4017
  ) : null,
3850
- shouldRenderContent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4018
+ shouldRenderContent ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
3851
4019
  ChatMessageContent,
3852
4020
  {
3853
4021
  className: cn(isAssistant ? "bg-transparent p-0" : void 0, contentClassName),
3854
4022
  dir,
3855
4023
  from: message.role,
3856
4024
  children: [
3857
- isAssistant ? renderAssistantContent ? renderAssistantContent({ isStreaming, message }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4025
+ isAssistant ? renderAssistantContent ? renderAssistantContent({ isStreaming, message }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3858
4026
  Timeline,
3859
4027
  {
3860
4028
  getHitlActionState,
4029
+ hitlLabels,
4030
+ onHitlPaint,
3861
4031
  isLoading: isStreaming,
3862
4032
  message,
3863
4033
  nodeActivityMode,
@@ -3865,7 +4035,7 @@ function AgentChatMessage({
3865
4035
  parts: message.parts
3866
4036
  }
3867
4037
  ) : null,
3868
- !isAssistant ? renderUserContent ? renderUserContent({ message }) : resolvedUserContent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4038
+ !isAssistant ? renderUserContent ? renderUserContent({ message }) : resolvedUserContent ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3869
4039
  AgentChatUserMessageContent,
3870
4040
  {
3871
4041
  collapsedLines: userMessageCollapsedLines,
@@ -3878,7 +4048,11 @@ function AgentChatMessage({
3878
4048
  ]
3879
4049
  }
3880
4050
  ) : null,
3881
- renderedActions ? defaultUserActions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AgentChatUserMessageActionRow, { className: actionsClassName, children: renderedActions }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn(dir === "rtl" ? "mt-1 h-9 w-full" : "mt-1 h-9 w-full -translate-x-2", actionsClassName), children: renderedActions }) : null
4051
+ renderedActions ? defaultUserActions ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AgentChatUserMessageActionRow, { className: actionsClassName, children: renderedActions }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: cn(
4052
+ dir === "rtl" ? "mt-1 h-9 w-full" : "mt-1 h-9 w-full -translate-x-2",
4053
+ isAssistant && "a24-chat-message-action-row--assistant",
4054
+ actionsClassName
4055
+ ), children: renderedActions }) : null
3882
4056
  ]
3883
4057
  }
3884
4058
  );
@@ -3887,9 +4061,9 @@ function AgentChatMessage({
3887
4061
  // src/ui/bubble.tsx
3888
4062
  var import_class_variance_authority3 = require("class-variance-authority");
3889
4063
  var import_react_slot2 = require("@radix-ui/react-slot");
3890
- var import_jsx_runtime16 = require("react/jsx-runtime");
4064
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3891
4065
  function BubbleGroup({ className, ...props }) {
3892
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4066
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3893
4067
  "div",
3894
4068
  {
3895
4069
  "data-slot": "bubble-group",
@@ -3923,7 +4097,7 @@ function Bubble({
3923
4097
  className,
3924
4098
  ...props
3925
4099
  }) {
3926
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4100
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3927
4101
  "div",
3928
4102
  {
3929
4103
  "data-slot": "bubble",
@@ -3940,7 +4114,7 @@ function BubbleContent({
3940
4114
  ...props
3941
4115
  }) {
3942
4116
  const Comp = asChild ? import_react_slot2.Slot : "div";
3943
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4117
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3944
4118
  Comp,
3945
4119
  {
3946
4120
  "data-slot": "bubble-content",
@@ -3977,7 +4151,7 @@ function BubbleReactions({
3977
4151
  className,
3978
4152
  ...props
3979
4153
  }) {
3980
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4154
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3981
4155
  "div",
3982
4156
  {
3983
4157
  "data-slot": "bubble-reactions",
@@ -3992,7 +4166,7 @@ function BubbleReactions({
3992
4166
  // src/ui/marker.tsx
3993
4167
  var import_class_variance_authority4 = require("class-variance-authority");
3994
4168
  var import_react_slot3 = require("@radix-ui/react-slot");
3995
- var import_jsx_runtime17 = require("react/jsx-runtime");
4169
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3996
4170
  var markerVariants = (0, import_class_variance_authority4.cva)(
3997
4171
  "group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",
3998
4172
  {
@@ -4012,7 +4186,7 @@ function Marker({
4012
4186
  ...props
4013
4187
  }) {
4014
4188
  const Comp = asChild ? import_react_slot3.Slot : "div";
4015
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4189
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4016
4190
  Comp,
4017
4191
  {
4018
4192
  "data-slot": "marker",
@@ -4023,7 +4197,7 @@ function Marker({
4023
4197
  );
4024
4198
  }
4025
4199
  function MarkerIcon({ className, ...props }) {
4026
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4200
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4027
4201
  "span",
4028
4202
  {
4029
4203
  "data-slot": "marker-icon",
@@ -4037,7 +4211,7 @@ function MarkerIcon({ className, ...props }) {
4037
4211
  );
4038
4212
  }
4039
4213
  function MarkerContent({ className, ...props }) {
4040
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4214
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4041
4215
  "span",
4042
4216
  {
4043
4217
  "data-slot": "marker-content",
@@ -4051,7 +4225,7 @@ function MarkerContent({ className, ...props }) {
4051
4225
  }
4052
4226
 
4053
4227
  // src/ui/mcp-connect-required-card.tsx
4054
- var import_jsx_runtime18 = require("react/jsx-runtime");
4228
+ var import_jsx_runtime19 = require("react/jsx-runtime");
4055
4229
  var STATUS_LABELS = {
4056
4230
  pending: "Connect",
4057
4231
  connecting: "Connecting",
@@ -4075,7 +4249,7 @@ function McpConnectRequiredCard({
4075
4249
  const isBusy = loading || status === "connecting" || status === "resuming";
4076
4250
  const isConnected = status === "connected";
4077
4251
  const buttonDisabled = disabled || isBusy || isConnected || !onConnect;
4078
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4252
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4079
4253
  "div",
4080
4254
  {
4081
4255
  "data-agents24-mcp-connect-card": true,
@@ -4085,13 +4259,13 @@ function McpConnectRequiredCard({
4085
4259
  className
4086
4260
  ),
4087
4261
  ...props,
4088
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [
4089
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "min-w-0", children: [
4090
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "truncate text-sm font-medium", children: label }),
4091
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mt-1 text-sm text-muted-foreground", children: message || "Connect your account to continue." }),
4092
- status === "error" && error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mt-2 text-sm text-destructive", children: error }) : null
4262
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [
4263
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "min-w-0", children: [
4264
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "truncate text-sm font-medium", children: label }),
4265
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mt-1 text-sm text-muted-foreground", children: message || "Connect your account to continue." }),
4266
+ status === "error" && error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "mt-2 text-sm text-destructive", children: error }) : null
4093
4267
  ] }),
4094
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
4268
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
4095
4269
  "button",
4096
4270
  {
4097
4271
  type: "button",
@@ -4159,6 +4333,7 @@ function McpConnectRequiredCard({
4159
4333
  CodeBlockLine,
4160
4334
  CodeBlockTitle,
4161
4335
  CodeBlockWrapButton,
4336
+ HitlSubmissionStatus,
4162
4337
  Marker,
4163
4338
  MarkerContent,
4164
4339
  MarkerIcon,
@@ -4185,10 +4360,12 @@ function McpConnectRequiredCard({
4185
4360
  cn,
4186
4361
  contextStatusMetrics,
4187
4362
  createAgentChatComposerFile,
4363
+ defaultHitlSubmissionLabels,
4188
4364
  hitlActionLabel,
4189
4365
  hitlTitle,
4190
4366
  isAgentChatSubagent,
4191
4367
  isAgentChatToolRunning,
4368
+ isHitlSubmissionCompact,
4192
4369
  latestRunningAgentChatToolId,
4193
4370
  markerVariants,
4194
4371
  partitionAgentChatToolTimeline,