@distri/react 0.3.5 → 0.3.6

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.
package/dist/index.js CHANGED
@@ -491,7 +491,8 @@ var useChatStateStore = create((set, get2) => ({
491
491
  const shouldUpdateTaskId = !get2().currentTaskId;
492
492
  set({
493
493
  currentRunId: runId,
494
- currentTaskId: shouldUpdateTaskId ? taskId : get2().currentTaskId
494
+ currentTaskId: shouldUpdateTaskId ? taskId : get2().currentTaskId,
495
+ currentAgentId: runStartedEvent.data.agentId || get2().currentAgentId
495
496
  });
496
497
  get2().setStreamingIndicator("typing");
497
498
  set({ isStreaming: true });
@@ -659,8 +660,21 @@ var useChatStateStore = create((set, get2) => ({
659
660
  });
660
661
  }
661
662
  break;
662
- case "agent_handover":
663
+ case "agent_handover": {
664
+ const handoverEvent = event;
665
+ set({ currentAgentId: handoverEvent.data.to_agent });
666
+ const handoverMsg = {
667
+ id: `handover-${Date.now()}`,
668
+ role: "system",
669
+ parts: [{
670
+ part_type: "text",
671
+ data: `Transferring to **${handoverEvent.data.to_agent}**${handoverEvent.data.reason ? ` \u2014 ${handoverEvent.data.reason}` : ""}`
672
+ }],
673
+ created_at: timestamp
674
+ };
675
+ set((state) => ({ messages: [...state.messages, handoverMsg] }));
663
676
  break;
677
+ }
664
678
  case "todos_updated": {
665
679
  const todosEvent = event;
666
680
  if (todosEvent.data.todos) {
@@ -757,14 +771,6 @@ var useChatStateStore = create((set, get2) => ({
757
771
  } catch (error) {
758
772
  console.error(`\u274C Error completing tool ${toolCall.tool_name}:`, error);
759
773
  const errorMessage = error instanceof Error ? error.message : "Tool completion failed";
760
- try {
761
- console.log(`\u{1F504} Retrying completeTool for ${toolCall.tool_name}`);
762
- await agent2.completeTool(result);
763
- console.log(`\u2705 Retry successful for ${toolCall.tool_name}`);
764
- return;
765
- } catch (retryError) {
766
- console.error(`\u274C Retry also failed for ${toolCall.tool_name}:`, retryError);
767
- }
768
774
  get2().updateToolCallStatus(toolCall.tool_call_id, {
769
775
  status: "error",
770
776
  error: errorMessage,
@@ -1277,7 +1283,11 @@ function useChat({
1277
1283
  if (abortControllerRef.current) {
1278
1284
  abortControllerRef.current.abort();
1279
1285
  }
1280
- }, []);
1286
+ failAllPendingToolCalls("User cancelled the operation");
1287
+ setStreamingIndicator(void 0);
1288
+ setStreaming(false);
1289
+ setLoading(false);
1290
+ }, [failAllPendingToolCalls, setStreamingIndicator, setStreaming, setLoading]);
1281
1291
  return {
1282
1292
  isStreaming,
1283
1293
  messages,
@@ -1792,11 +1802,56 @@ function useAgentsByUsage(options) {
1792
1802
  };
1793
1803
  }
1794
1804
 
1805
+ // src/useModels.ts
1806
+ import { useState as useState7, useEffect as useEffect6, useCallback as useCallback8 } from "react";
1807
+ function useModels() {
1808
+ const { client, error: clientError, isLoading: clientLoading } = useDistri();
1809
+ const [providers, setProviders] = useState7([]);
1810
+ const [loading, setLoading] = useState7(true);
1811
+ const [error, setError] = useState7(null);
1812
+ const fetchModels = useCallback8(async () => {
1813
+ if (!client) return;
1814
+ try {
1815
+ setLoading(true);
1816
+ setError(null);
1817
+ const result = await client.fetchAvailableModels();
1818
+ setProviders(result);
1819
+ } catch (err) {
1820
+ console.error("[useModels] Failed to fetch models:", err);
1821
+ setError(err instanceof Error ? err : new Error("Failed to fetch models"));
1822
+ } finally {
1823
+ setLoading(false);
1824
+ }
1825
+ }, [client]);
1826
+ useEffect6(() => {
1827
+ if (clientLoading) {
1828
+ setLoading(true);
1829
+ return;
1830
+ }
1831
+ if (clientError) {
1832
+ setError(clientError);
1833
+ setLoading(false);
1834
+ return;
1835
+ }
1836
+ if (client) {
1837
+ fetchModels();
1838
+ } else {
1839
+ setLoading(false);
1840
+ }
1841
+ }, [clientLoading, clientError, client, fetchModels]);
1842
+ return {
1843
+ providers,
1844
+ loading: loading || clientLoading,
1845
+ error: error || clientError,
1846
+ refetch: fetchModels
1847
+ };
1848
+ }
1849
+
1795
1850
  // src/components/Chat.tsx
1796
- import { useState as useState18, useCallback as useCallback17, useRef as useRef13, useEffect as useEffect15, useImperativeHandle, forwardRef as forwardRef5, useMemo as useMemo6 } from "react";
1851
+ import { useState as useState19, useCallback as useCallback18, useRef as useRef13, useEffect as useEffect16, useImperativeHandle, forwardRef as forwardRef5, useMemo as useMemo6 } from "react";
1797
1852
 
1798
1853
  // src/components/ChatInput.tsx
1799
- import { useRef as useRef7, useEffect as useEffect8, useCallback as useCallback10, useState as useState10, useMemo as useMemo3 } from "react";
1854
+ import { useRef as useRef7, useEffect as useEffect9, useCallback as useCallback11, useState as useState11, useMemo as useMemo3 } from "react";
1800
1855
 
1801
1856
  // ../../node_modules/.pnpm/orderedmap@2.1.1/node_modules/orderedmap/dist/index.js
1802
1857
  function OrderedMap(content) {
@@ -17973,7 +18028,7 @@ function canInsertNode(state, nodeType) {
17973
18028
  }
17974
18029
 
17975
18030
  // ../../node_modules/.pnpm/@tiptap+react@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2__@tiptap+pm@2.27.2_react-dom_4dad981b9d8ee28eba93d4c829cfb5ca/node_modules/@tiptap/react/dist/index.js
17976
- import React6, { forwardRef as forwardRef3, useState as useState7, useDebugValue, useLayoutEffect, useEffect as useEffect6, useRef as useRef5, createContext as createContext3, useContext as useContext3, version, createRef, memo, createElement } from "react";
18031
+ import React6, { forwardRef as forwardRef3, useState as useState8, useDebugValue, useLayoutEffect, useEffect as useEffect7, useRef as useRef5, createContext as createContext3, useContext as useContext3, version, createRef, memo, createElement } from "react";
17977
18032
  import ReactDOM, { flushSync } from "react-dom";
17978
18033
  function getDefaultExportFromCjs(x) {
17979
18034
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -18063,7 +18118,7 @@ function requireUseSyncExternalStoreShim_development() {
18063
18118
  return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
18064
18119
  }
18065
18120
  var objectIs = typeof Object.is === "function" ? Object.is : is;
18066
- var useState24 = React$1.useState, useEffect21 = React$1.useEffect, useLayoutEffect2 = React$1.useLayoutEffect, useDebugValue2 = React$1.useDebugValue;
18121
+ var useState28 = React$1.useState, useEffect22 = React$1.useEffect, useLayoutEffect2 = React$1.useLayoutEffect, useDebugValue2 = React$1.useDebugValue;
18067
18122
  var didWarnOld18Alpha = false;
18068
18123
  var didWarnUncachedGetSnapshot = false;
18069
18124
  function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
@@ -18085,7 +18140,7 @@ function requireUseSyncExternalStoreShim_development() {
18085
18140
  }
18086
18141
  }
18087
18142
  }
18088
- var _useState = useState24({
18143
+ var _useState = useState28({
18089
18144
  inst: {
18090
18145
  value,
18091
18146
  getSnapshot
@@ -18100,7 +18155,7 @@ function requireUseSyncExternalStoreShim_development() {
18100
18155
  });
18101
18156
  }
18102
18157
  }, [subscribe, value, getSnapshot]);
18103
- useEffect21(function() {
18158
+ useEffect22(function() {
18104
18159
  if (checkIfSnapshotChanged(inst)) {
18105
18160
  forceUpdate({
18106
18161
  inst
@@ -18419,9 +18474,9 @@ function requireWithSelector_development() {
18419
18474
  }
18420
18475
  var objectIs = typeof Object.is === "function" ? Object.is : is;
18421
18476
  var useSyncExternalStore = shim2.useSyncExternalStore;
18422
- var useRef14 = React$1.useRef, useEffect21 = React$1.useEffect, useMemo10 = React$1.useMemo, useDebugValue2 = React$1.useDebugValue;
18477
+ var useRef16 = React$1.useRef, useEffect22 = React$1.useEffect, useMemo11 = React$1.useMemo, useDebugValue2 = React$1.useDebugValue;
18423
18478
  function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
18424
- var instRef = useRef14(null);
18479
+ var instRef = useRef16(null);
18425
18480
  var inst;
18426
18481
  if (instRef.current === null) {
18427
18482
  inst = {
@@ -18432,7 +18487,7 @@ function requireWithSelector_development() {
18432
18487
  } else {
18433
18488
  inst = instRef.current;
18434
18489
  }
18435
- var _useMemo = useMemo10(function() {
18490
+ var _useMemo = useMemo11(function() {
18436
18491
  var hasMemo = false;
18437
18492
  var memoizedSnapshot;
18438
18493
  var memoizedSelection;
@@ -18476,7 +18531,7 @@ function requireWithSelector_development() {
18476
18531
  return [getSnapshotWithSelector, getServerSnapshotWithSelector];
18477
18532
  }, [getSnapshot, getServerSnapshot, selector, isEqual]), getSelection2 = _useMemo[0], getServerSelection = _useMemo[1];
18478
18533
  var value = useSyncExternalStore(subscribe, getSelection2, getServerSelection);
18479
- useEffect21(function() {
18534
+ useEffect22(function() {
18480
18535
  inst.hasValue = true;
18481
18536
  inst.value = value;
18482
18537
  }, [value]);
@@ -18497,7 +18552,7 @@ if (process.env.NODE_ENV === "production") {
18497
18552
  withSelector.exports = requireWithSelector_development();
18498
18553
  }
18499
18554
  var withSelectorExports = withSelector.exports;
18500
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect6;
18555
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect7;
18501
18556
  var EditorStateManager = class {
18502
18557
  constructor(initialEditor) {
18503
18558
  this.transactionNumber = 0;
@@ -18557,7 +18612,7 @@ var EditorStateManager = class {
18557
18612
  };
18558
18613
  function useEditorState(options) {
18559
18614
  var _a;
18560
- const [editorStateManager] = useState7(() => new EditorStateManager(options.editor));
18615
+ const [editorStateManager] = useState8(() => new EditorStateManager(options.editor));
18561
18616
  const selectedState = withSelectorExports.useSyncExternalStoreWithSelector(editorStateManager.subscribe, editorStateManager.getSnapshot, editorStateManager.getServerSnapshot, options.selector, (_a = options.equalityFn) !== null && _a !== void 0 ? _a : deepEqual);
18562
18617
  useIsomorphicLayoutEffect(() => {
18563
18618
  return editorStateManager.watch(options.editor);
@@ -18781,10 +18836,10 @@ var EditorInstanceManager = class _EditorInstanceManager {
18781
18836
  function useEditor(options = {}, deps = []) {
18782
18837
  const mostRecentOptions = useRef5(options);
18783
18838
  mostRecentOptions.current = options;
18784
- const [instanceManager] = useState7(() => new EditorInstanceManager(mostRecentOptions));
18839
+ const [instanceManager] = useState8(() => new EditorInstanceManager(mostRecentOptions));
18785
18840
  const editor = shimExports.useSyncExternalStore(instanceManager.subscribe, instanceManager.getEditor, instanceManager.getServerSnapshot);
18786
18841
  useDebugValue(editor);
18787
- useEffect6(instanceManager.onRender(deps));
18842
+ useEffect7(instanceManager.onRender(deps));
18788
18843
  useEditorState({
18789
18844
  editor,
18790
18845
  selector: ({ transactionNumber }) => {
@@ -20840,18 +20895,18 @@ var Placeholder = Extension.create({
20840
20895
  import { Send, Square, X, Mic as Mic2, MicOff as MicOff2, Radio, Globe, Plus } from "lucide-react";
20841
20896
 
20842
20897
  // src/components/VoiceInput.tsx
20843
- import { useState as useState9, useCallback as useCallback9, useEffect as useEffect7 } from "react";
20898
+ import { useState as useState10, useCallback as useCallback10, useEffect as useEffect8 } from "react";
20844
20899
  import { Mic, MicOff, Loader2 } from "lucide-react";
20845
20900
  import SpeechRecognition, { useSpeechRecognition } from "react-speech-recognition";
20846
20901
 
20847
20902
  // src/hooks/useSpeechToText.ts
20848
- import { useCallback as useCallback8, useRef as useRef6, useState as useState8 } from "react";
20903
+ import { useCallback as useCallback9, useRef as useRef6, useState as useState9 } from "react";
20849
20904
  var useSpeechToText = () => {
20850
20905
  const { client } = useDistri();
20851
- const [isTranscribing, setIsTranscribing] = useState8(false);
20852
- const [isStreaming, setIsStreaming] = useState8(false);
20906
+ const [isTranscribing, setIsTranscribing] = useState9(false);
20907
+ const [isStreaming, setIsStreaming] = useState9(false);
20853
20908
  const streamingConnectionRef = useRef6(null);
20854
- const transcribe = useCallback8(async (audioBlob, config = {}) => {
20909
+ const transcribe = useCallback9(async (audioBlob, config = {}) => {
20855
20910
  if (!client) {
20856
20911
  throw new Error("DistriClient not initialized");
20857
20912
  }
@@ -20866,7 +20921,7 @@ var useSpeechToText = () => {
20866
20921
  setIsTranscribing(false);
20867
20922
  }
20868
20923
  }, [client, isTranscribing]);
20869
- const startStreamingTranscription = useCallback8(async (options = {}) => {
20924
+ const startStreamingTranscription = useCallback9(async (options = {}) => {
20870
20925
  if (!client) {
20871
20926
  throw new Error("DistriClient not initialized");
20872
20927
  }
@@ -20907,7 +20962,7 @@ var useSpeechToText = () => {
20907
20962
  throw error;
20908
20963
  }
20909
20964
  }, [client, isStreaming]);
20910
- const stopStreamingTranscription = useCallback8(() => {
20965
+ const stopStreamingTranscription = useCallback9(() => {
20911
20966
  if (streamingConnectionRef.current) {
20912
20967
  console.log("\u{1F3A4} Stopping streaming transcription");
20913
20968
  streamingConnectionRef.current.stop();
@@ -20916,14 +20971,14 @@ var useSpeechToText = () => {
20916
20971
  }
20917
20972
  setIsStreaming(false);
20918
20973
  }, []);
20919
- const sendAudio = useCallback8((audioData) => {
20974
+ const sendAudio = useCallback9((audioData) => {
20920
20975
  if (streamingConnectionRef.current) {
20921
20976
  streamingConnectionRef.current.sendAudio(audioData);
20922
20977
  } else {
20923
20978
  console.warn("\u{1F3A4} No active streaming connection to send audio to");
20924
20979
  }
20925
20980
  }, []);
20926
- const sendText = useCallback8((text) => {
20981
+ const sendText = useCallback9((text) => {
20927
20982
  if (streamingConnectionRef.current) {
20928
20983
  streamingConnectionRef.current.sendText(text);
20929
20984
  } else {
@@ -20954,10 +21009,10 @@ var VoiceInput = ({
20954
21009
  interimResults = true,
20955
21010
  useBrowserSpeechRecognition = true
20956
21011
  }) => {
20957
- const [isListening, setIsListening] = useState9(false);
20958
- const [showModal, setShowModal] = useState9(false);
20959
- const [interimTranscript, setInterimTranscript] = useState9("");
20960
- const [mediaRecorder, setMediaRecorder] = useState9(null);
21012
+ const [isListening, setIsListening] = useState10(false);
21013
+ const [showModal, setShowModal] = useState10(false);
21014
+ const [interimTranscript, setInterimTranscript] = useState10("");
21015
+ const [mediaRecorder, setMediaRecorder] = useState10(null);
20961
21016
  const {
20962
21017
  transcript,
20963
21018
  interimTranscript: browserInterimTranscript,
@@ -20969,7 +21024,7 @@ var VoiceInput = ({
20969
21024
  const speechToText = useSpeechToText();
20970
21025
  const useBrowser = useBrowserSpeechRecognition && browserSupportsSpeechRecognition;
20971
21026
  const canUseBackend = !useBrowser && speechToText;
20972
- useEffect7(() => {
21027
+ useEffect8(() => {
20973
21028
  if (finalTranscript && finalTranscript.trim()) {
20974
21029
  onTranscript(finalTranscript.trim());
20975
21030
  resetTranscript();
@@ -20977,12 +21032,12 @@ var VoiceInput = ({
20977
21032
  setIsListening(false);
20978
21033
  }
20979
21034
  }, [finalTranscript, onTranscript, resetTranscript]);
20980
- useEffect7(() => {
21035
+ useEffect8(() => {
20981
21036
  if (useBrowser) {
20982
21037
  setInterimTranscript(browserInterimTranscript || transcript);
20983
21038
  }
20984
21039
  }, [browserInterimTranscript, transcript, useBrowser]);
20985
- const startListening = useCallback9(async () => {
21040
+ const startListening = useCallback10(async () => {
20986
21041
  if (disabled) return;
20987
21042
  setShowModal(true);
20988
21043
  setIsListening(true);
@@ -21055,7 +21110,7 @@ var VoiceInput = ({
21055
21110
  setIsListening(false);
21056
21111
  }
21057
21112
  }, [canUseBackend, disabled, interimResults, language, onError, onTranscript, speechToText, useBrowser]);
21058
- const stopListening = useCallback9(() => {
21113
+ const stopListening = useCallback10(() => {
21059
21114
  if (useBrowser) {
21060
21115
  SpeechRecognition.stopListening();
21061
21116
  } else if (mediaRecorder && mediaRecorder.state === "recording") {
@@ -21072,7 +21127,7 @@ var VoiceInput = ({
21072
21127
  setInterimTranscript("");
21073
21128
  resetTranscript();
21074
21129
  }, [useBrowser, mediaRecorder, interimTranscript, onTranscript, resetTranscript]);
21075
- const handleCancel = useCallback9(() => {
21130
+ const handleCancel = useCallback10(() => {
21076
21131
  if (useBrowser) {
21077
21132
  SpeechRecognition.stopListening();
21078
21133
  } else if (mediaRecorder && mediaRecorder.state === "recording") {
@@ -21086,7 +21141,7 @@ var VoiceInput = ({
21086
21141
  setInterimTranscript("");
21087
21142
  resetTranscript();
21088
21143
  }, [useBrowser, mediaRecorder, resetTranscript]);
21089
- useEffect7(() => {
21144
+ useEffect8(() => {
21090
21145
  let timeoutId;
21091
21146
  if (isListening && !listening && interimTranscript.trim()) {
21092
21147
  timeoutId = setTimeout(() => {
@@ -21187,8 +21242,8 @@ var ChatInput = ({
21187
21242
  }) => {
21188
21243
  const fileInputRef = useRef7(null);
21189
21244
  const mediaRecorderRef = useRef7(null);
21190
- const [isRecording, setIsRecording] = useState10(false);
21191
- const [recordingTime, setRecordingTime] = useState10(0);
21245
+ const [isRecording, setIsRecording] = useState11(false);
21246
+ const [recordingTime, setRecordingTime] = useState11(0);
21192
21247
  const imageAttachments = useMemo3(() => attachedImages ?? [], [attachedImages]);
21193
21248
  const onChangeRef = useRef7(onChange);
21194
21249
  const handleSendRef = useRef7(() => {
@@ -21229,20 +21284,20 @@ var ChatInput = ({
21229
21284
  }
21230
21285
  }
21231
21286
  });
21232
- useEffect8(() => {
21287
+ useEffect9(() => {
21233
21288
  if (editor) {
21234
21289
  editor.setEditable(!disabled);
21235
21290
  }
21236
21291
  }, [editor, disabled]);
21237
- useEffect8(() => {
21292
+ useEffect9(() => {
21238
21293
  if (editor && editor.getText() !== value) {
21239
21294
  editor.commands.setContent(value || "");
21240
21295
  }
21241
21296
  }, [value, editor]);
21242
- useEffect8(() => {
21297
+ useEffect9(() => {
21243
21298
  onChangeRef.current = onChange;
21244
21299
  }, [onChange]);
21245
- const convertFileToBase64 = useCallback10((file) => {
21300
+ const convertFileToBase64 = useCallback11((file) => {
21246
21301
  return new Promise((resolve, reject) => {
21247
21302
  const reader = new FileReader();
21248
21303
  reader.onload = () => {
@@ -21257,14 +21312,14 @@ var ChatInput = ({
21257
21312
  reader.readAsDataURL(file);
21258
21313
  });
21259
21314
  }, []);
21260
- const handleFileSelect = useCallback10((e) => {
21315
+ const handleFileSelect = useCallback11((e) => {
21261
21316
  const files = e.target.files;
21262
21317
  if (files && files.length > 0 && onAddImages) {
21263
21318
  onAddImages(files);
21264
21319
  }
21265
21320
  e.target.value = "";
21266
21321
  }, [onAddImages]);
21267
- const startRecording = useCallback10(async () => {
21322
+ const startRecording = useCallback11(async () => {
21268
21323
  try {
21269
21324
  const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
21270
21325
  const mediaRecorder = new MediaRecorder(stream, { mimeType: "audio/webm" });
@@ -21293,7 +21348,7 @@ var ChatInput = ({
21293
21348
  console.error("Error starting recording:", error);
21294
21349
  }
21295
21350
  }, [onVoiceRecord]);
21296
- const stopRecording = useCallback10(() => {
21351
+ const stopRecording = useCallback11(() => {
21297
21352
  if (mediaRecorderRef.current && isRecording) {
21298
21353
  if (mediaRecorderRef.current._timer) {
21299
21354
  clearInterval(mediaRecorderRef.current._timer);
@@ -21303,23 +21358,23 @@ var ChatInput = ({
21303
21358
  setRecordingTime(0);
21304
21359
  }
21305
21360
  }, [isRecording]);
21306
- const handleVoiceToggle = useCallback10(() => {
21361
+ const handleVoiceToggle = useCallback11(() => {
21307
21362
  if (isRecording) {
21308
21363
  stopRecording();
21309
21364
  } else {
21310
21365
  startRecording();
21311
21366
  }
21312
21367
  }, [isRecording, startRecording, stopRecording]);
21313
- const handleBrowserToggle = useCallback10(() => {
21368
+ const handleBrowserToggle = useCallback11(() => {
21314
21369
  if (onToggleBrowser) {
21315
21370
  onToggleBrowser(!browserEnabled);
21316
21371
  }
21317
21372
  }, [onToggleBrowser, browserEnabled]);
21318
- const handleSpeechTranscript = useCallback10((transcript) => {
21373
+ const handleSpeechTranscript = useCallback11((transcript) => {
21319
21374
  onChangeRef.current(transcript);
21320
21375
  onSpeechTranscript?.(transcript);
21321
21376
  }, [onSpeechTranscript]);
21322
- const handleSend = useCallback10(async () => {
21377
+ const handleSend = useCallback11(async () => {
21323
21378
  if (!value.trim() && imageAttachments.length === 0 || disabled || isStreaming) {
21324
21379
  return;
21325
21380
  }
@@ -21356,7 +21411,7 @@ var ChatInput = ({
21356
21411
  onStop();
21357
21412
  }
21358
21413
  };
21359
- useEffect8(() => {
21414
+ useEffect9(() => {
21360
21415
  handleSendRef.current = handleSend;
21361
21416
  }, [handleSend]);
21362
21417
  const hasContent = value.trim().length > 0 || imageAttachments.length > 0;
@@ -21593,12 +21648,12 @@ ${JSON.stringify(part, null, 2)}
21593
21648
  }
21594
21649
 
21595
21650
  // src/components/renderers/ImageRenderer.tsx
21596
- import { useState as useState11, useCallback as useCallback11, useEffect as useEffect9 } from "react";
21651
+ import { useState as useState12, useCallback as useCallback12, useEffect as useEffect10 } from "react";
21597
21652
  import { createPortal } from "react-dom";
21598
21653
  import { X as X2 } from "lucide-react";
21599
21654
  import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
21600
21655
  var ImageDialog = ({ src, alt, onClose }) => {
21601
- useEffect9(() => {
21656
+ useEffect10(() => {
21602
21657
  const handleKeyDown2 = (e) => {
21603
21658
  if (e.key === "Escape") {
21604
21659
  onClose();
@@ -21607,7 +21662,7 @@ var ImageDialog = ({ src, alt, onClose }) => {
21607
21662
  document.addEventListener("keydown", handleKeyDown2);
21608
21663
  return () => document.removeEventListener("keydown", handleKeyDown2);
21609
21664
  }, [onClose]);
21610
- useEffect9(() => {
21665
+ useEffect10(() => {
21611
21666
  document.body.style.overflow = "hidden";
21612
21667
  return () => {
21613
21668
  document.body.style.overflow = "";
@@ -21654,8 +21709,8 @@ var ImageRenderer = ({
21654
21709
  imageParts,
21655
21710
  className = ""
21656
21711
  }) => {
21657
- const [viewingImage, setViewingImage] = useState11(null);
21658
- const handleClose = useCallback11(() => {
21712
+ const [viewingImage, setViewingImage] = useState12(null);
21713
+ const handleClose = useCallback12(() => {
21659
21714
  setViewingImage(null);
21660
21715
  }, []);
21661
21716
  if (!imageParts || imageParts.length === 0) {
@@ -21968,12 +22023,82 @@ var AssistantMessageRenderer = ({
21968
22023
  ] });
21969
22024
  };
21970
22025
 
21971
- // src/components/renderers/ThinkingRenderer.tsx
22026
+ // src/components/renderers/thinkingPhrases.json
22027
+ var thinkingPhrases_default = { planning: [{ text: "Brewing something good", emoji: "\u2615", icon: "coffee" }, { text: "Pulling the right strings", emoji: "\u{1F3AD}", icon: "wand" }, { text: "Assembling the crew", emoji: "\u{1F91D}", icon: "users" }, { text: "Plotting world domination", emoji: "\u{1F5FA}\uFE0F", icon: "map" }, { text: "Sharpening the strategy", emoji: "\u265F\uFE0F", icon: "swords" }, { text: "Loading the master plan", emoji: "\u{1F3AF}", icon: "target" }, { text: "Cooking with gas now", emoji: "\u{1F525}", icon: "flame" }, { text: "Spinning up the agents", emoji: "\u26A1", icon: "zap" }], replanning: [{ text: "Plot twist incoming", emoji: "\u{1F504}", icon: "refresh-cw" }, { text: "Pivoting gracefully", emoji: "\u{1FA70}", icon: "sparkles" }, { text: "Taking a different angle", emoji: "\u{1F9ED}", icon: "compass" }, { text: "Recalibrating the vibe", emoji: "\u{1F39B}\uFE0F", icon: "sliders" }, { text: "New plan, better plan", emoji: "\u2728", icon: "sparkles" }], thinking: [{ text: "Hold my coffee", emoji: "\u2615", icon: "coffee" }, { text: "Crunching the numbers", emoji: "\u{1F9EE}", icon: "calculator" }, { text: "Working some magic", emoji: "\u{1FA84}", icon: "wand" }, { text: "Almost got it", emoji: "\u{1F3C1}", icon: "flag" }, { text: "Neurons firing", emoji: "\u{1F9E0}", icon: "brain" }, { text: "On it like a bonnet", emoji: "\u{1F3A9}", icon: "zap" }, { text: "Deep in the zone", emoji: "\u{1F3A7}", icon: "headphones" }, { text: "Wrangling the bits", emoji: "\u{1F920}", icon: "cog" }] };
22028
+
22029
+ // src/components/renderers/DistriLoadingIcon.tsx
21972
22030
  import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
21973
- var LoadingShimmer = ({ text, className }) => {
21974
- return /* @__PURE__ */ jsxs8("div", { className: `w-full ${className || ""}`, children: [
21975
- /* @__PURE__ */ jsx13("span", { className: "font-medium text-shimmer", children: text }),
22031
+ var DistriLoadingIcon = ({
22032
+ className = "",
22033
+ size = 16
22034
+ }) => {
22035
+ return /* @__PURE__ */ jsxs8("span", { className: `inline-flex items-center ${className}`, children: [
22036
+ /* @__PURE__ */ jsxs8(
22037
+ "svg",
22038
+ {
22039
+ width: size,
22040
+ height: size,
22041
+ viewBox: "0 0 361 437",
22042
+ fill: "none",
22043
+ xmlns: "http://www.w3.org/2000/svg",
22044
+ className: "distri-loading-icon",
22045
+ children: [
22046
+ /* @__PURE__ */ jsx13(
22047
+ "path",
22048
+ {
22049
+ d: "M207 148C276.036 148 332 203.964 332 273C332 342.036 276.036 398 207 398H82V148H207Z",
22050
+ stroke: "currentColor",
22051
+ strokeWidth: "50"
22052
+ }
22053
+ ),
22054
+ /* @__PURE__ */ jsx13("path", { d: "M147 63H187V123H147V63Z", fill: "currentColor" }),
22055
+ /* @__PURE__ */ jsx13(
22056
+ "path",
22057
+ {
22058
+ d: "M220 258C220 246.954 228.954 238 240 238C251.046 238 260 246.954 260 258V288C260 299.046 251.046 308 240 308C228.954 308 220 299.046 220 288V258Z",
22059
+ fill: "currentColor",
22060
+ className: "distri-eye"
22061
+ }
22062
+ ),
22063
+ /* @__PURE__ */ jsx13(
22064
+ "path",
22065
+ {
22066
+ d: "M136 258C136 246.954 144.954 238 156 238C167.046 238 176 246.954 176 258V288C176 299.046 167.046 308 156 308C144.954 308 136 299.046 136 288V258Z",
22067
+ fill: "currentColor",
22068
+ className: "distri-eye"
22069
+ }
22070
+ ),
22071
+ /* @__PURE__ */ jsx13("path", { d: "M2 215H42V315H2V215Z", fill: "currentColor" }),
22072
+ /* @__PURE__ */ jsx13("circle", { cx: "167", cy: "40", r: "40", fill: "currentColor" })
22073
+ ]
22074
+ }
22075
+ ),
21976
22076
  /* @__PURE__ */ jsx13("style", { children: `
22077
+ @keyframes distri-slide {
22078
+ 0%, 100% { transform: translateX(0); }
22079
+ 50% { transform: translateX(4px); }
22080
+ }
22081
+ @keyframes distri-blink {
22082
+ 0%, 90%, 100% { opacity: 1; }
22083
+ 95% { opacity: 0.1; }
22084
+ }
22085
+ .distri-loading-icon {
22086
+ animation: distri-slide 1.5s ease-in-out infinite;
22087
+ }
22088
+ .distri-eye {
22089
+ animation: distri-blink 3s ease-in-out infinite;
22090
+ }
22091
+ ` })
22092
+ ] });
22093
+ };
22094
+
22095
+ // src/components/renderers/ThinkingRenderer.tsx
22096
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
22097
+ var LoadingShimmer = ({ text, className, showIcon = false }) => {
22098
+ return /* @__PURE__ */ jsxs9("div", { className: `flex items-center gap-2 ${className || ""}`, children: [
22099
+ showIcon && /* @__PURE__ */ jsx14(DistriLoadingIcon, { size: 14, className: "text-primary/70" }),
22100
+ /* @__PURE__ */ jsx14("span", { className: "font-medium text-shimmer", children: text }),
22101
+ /* @__PURE__ */ jsx14("style", { children: `
21977
22102
  @keyframes shimmer {
21978
22103
  0% { background-position: -150% 0; }
21979
22104
  100% { background-position: 150% 0; }
@@ -21992,23 +22117,25 @@ var LoadingShimmer = ({ text, className }) => {
21992
22117
  var ThinkingRenderer = ({
21993
22118
  className = ""
21994
22119
  }) => {
21995
- const component = LoadingShimmer({ text: "Thinking..." });
21996
- return /* @__PURE__ */ jsx13("div", { className: `flex items-start gap-3 py-3 ${className}`, children: /* @__PURE__ */ jsx13("div", { className: "w-full", children: /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: component }) }) });
22120
+ const pool = thinkingPhrases_default.thinking;
22121
+ const pick = pool[Math.floor(Math.random() * pool.length)];
22122
+ const component = LoadingShimmer({ text: `${pick.text}\u2026`, showIcon: true });
22123
+ return /* @__PURE__ */ jsx14("div", { className: `flex items-start gap-3 py-3 ${className}`, children: /* @__PURE__ */ jsx14("div", { className: "w-full", children: /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: component }) }) });
21997
22124
  };
21998
22125
 
21999
22126
  // src/components/renderers/MessageFeedback.tsx
22000
- import { useState as useState13, useEffect as useEffect10, useCallback as useCallback13 } from "react";
22127
+ import { useState as useState14, useEffect as useEffect11, useCallback as useCallback14 } from "react";
22001
22128
  import { ThumbsUp, ThumbsDown, Loader2 as Loader22, MessageSquare } from "lucide-react";
22002
22129
 
22003
22130
  // src/hooks/useMessageFeedback.ts
22004
- import { useState as useState12, useCallback as useCallback12 } from "react";
22131
+ import { useState as useState13, useCallback as useCallback13 } from "react";
22005
22132
  function useMessageReadStatus(options) {
22006
22133
  const { threadId, messageId, autoFetch = false } = options;
22007
22134
  const { client } = useDistri();
22008
- const [readStatus, setReadStatus] = useState12(null);
22009
- const [loading, setLoading] = useState12(autoFetch);
22010
- const [error, setError] = useState12(null);
22011
- const refetch = useCallback12(async () => {
22135
+ const [readStatus, setReadStatus] = useState13(null);
22136
+ const [loading, setLoading] = useState13(autoFetch);
22137
+ const [error, setError] = useState13(null);
22138
+ const refetch = useCallback13(async () => {
22012
22139
  if (!client) {
22013
22140
  setError(new Error("Client not available"));
22014
22141
  return;
@@ -22025,7 +22152,7 @@ function useMessageReadStatus(options) {
22025
22152
  setLoading(false);
22026
22153
  }
22027
22154
  }, [client, threadId, messageId]);
22028
- const markAsRead = useCallback12(async () => {
22155
+ const markAsRead = useCallback13(async () => {
22029
22156
  if (!client) {
22030
22157
  setError(new Error("Client not available"));
22031
22158
  return null;
@@ -22055,10 +22182,10 @@ function useMessageReadStatus(options) {
22055
22182
  function useThreadReadStatus(options) {
22056
22183
  const { threadId, enabled = true } = options;
22057
22184
  const { client } = useDistri();
22058
- const [readStatuses, setReadStatuses] = useState12([]);
22059
- const [loading, setLoading] = useState12(enabled);
22060
- const [error, setError] = useState12(null);
22061
- const refetch = useCallback12(async () => {
22185
+ const [readStatuses, setReadStatuses] = useState13([]);
22186
+ const [loading, setLoading] = useState13(enabled);
22187
+ const [error, setError] = useState13(null);
22188
+ const refetch = useCallback13(async () => {
22062
22189
  if (!client) {
22063
22190
  setError(new Error("Client not available"));
22064
22191
  return;
@@ -22075,13 +22202,13 @@ function useThreadReadStatus(options) {
22075
22202
  setLoading(false);
22076
22203
  }
22077
22204
  }, [client, threadId]);
22078
- const isRead = useCallback12(
22205
+ const isRead = useCallback13(
22079
22206
  (messageId) => {
22080
22207
  return readStatuses.some((status) => status.message_id === messageId);
22081
22208
  },
22082
22209
  [readStatuses]
22083
22210
  );
22084
- const markAsRead = useCallback12(
22211
+ const markAsRead = useCallback13(
22085
22212
  async (messageId) => {
22086
22213
  if (!client) {
22087
22214
  setError(new Error("Client not available"));
@@ -22117,10 +22244,10 @@ function useThreadReadStatus(options) {
22117
22244
  function useMessageVote(options) {
22118
22245
  const { threadId, messageId, autoFetch = false } = options;
22119
22246
  const { client } = useDistri();
22120
- const [summary, setSummary] = useState12(null);
22121
- const [loading, setLoading] = useState12(autoFetch);
22122
- const [error, setError] = useState12(null);
22123
- const refetch = useCallback12(async () => {
22247
+ const [summary, setSummary] = useState13(null);
22248
+ const [loading, setLoading] = useState13(autoFetch);
22249
+ const [error, setError] = useState13(null);
22250
+ const refetch = useCallback13(async () => {
22124
22251
  if (!client) {
22125
22252
  setError(new Error("Client not available"));
22126
22253
  return;
@@ -22137,7 +22264,7 @@ function useMessageVote(options) {
22137
22264
  setLoading(false);
22138
22265
  }
22139
22266
  }, [client, threadId, messageId]);
22140
- const vote = useCallback12(
22267
+ const vote = useCallback13(
22141
22268
  async (voteType, comment) => {
22142
22269
  if (!client) {
22143
22270
  setError(new Error("Client not available"));
@@ -22178,8 +22305,8 @@ function useMessageVote(options) {
22178
22305
  },
22179
22306
  [client, threadId, messageId]
22180
22307
  );
22181
- const upvote = useCallback12(() => vote("upvote"), [vote]);
22182
- const downvote = useCallback12(
22308
+ const upvote = useCallback13(() => vote("upvote"), [vote]);
22309
+ const downvote = useCallback13(
22183
22310
  (comment) => {
22184
22311
  if (!comment || comment.trim() === "") {
22185
22312
  setError(new Error("Downvotes require a comment"));
@@ -22189,7 +22316,7 @@ function useMessageVote(options) {
22189
22316
  },
22190
22317
  [vote]
22191
22318
  );
22192
- const removeVote = useCallback12(async () => {
22319
+ const removeVote = useCallback13(async () => {
22193
22320
  if (!client) {
22194
22321
  setError(new Error("Client not available"));
22195
22322
  return;
@@ -22229,10 +22356,10 @@ function useMessageVote(options) {
22229
22356
  function useMessageVotes(options) {
22230
22357
  const { threadId, messageId, enabled = false } = options;
22231
22358
  const { client } = useDistri();
22232
- const [votes, setVotes] = useState12([]);
22233
- const [loading, setLoading] = useState12(enabled);
22234
- const [error, setError] = useState12(null);
22235
- const refetch = useCallback12(async () => {
22359
+ const [votes, setVotes] = useState13([]);
22360
+ const [loading, setLoading] = useState13(enabled);
22361
+ const [error, setError] = useState13(null);
22362
+ const refetch = useCallback13(async () => {
22236
22363
  if (!client) {
22237
22364
  setError(new Error("Client not available"));
22238
22365
  return;
@@ -22258,7 +22385,7 @@ function useMessageVotes(options) {
22258
22385
  }
22259
22386
 
22260
22387
  // src/components/renderers/MessageFeedback.tsx
22261
- import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
22388
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
22262
22389
  var MessageFeedback = ({
22263
22390
  threadId,
22264
22391
  messageId,
@@ -22266,9 +22393,9 @@ var MessageFeedback = ({
22266
22393
  className,
22267
22394
  onVote
22268
22395
  }) => {
22269
- const [showCommentInput, setShowCommentInput] = useState13(false);
22270
- const [comment, setComment] = useState13("");
22271
- const [pendingDownvote, setPendingDownvote] = useState13(false);
22396
+ const [showCommentInput, setShowCommentInput] = useState14(false);
22397
+ const [comment, setComment] = useState14("");
22398
+ const [pendingDownvote, setPendingDownvote] = useState14(false);
22272
22399
  const {
22273
22400
  summary,
22274
22401
  loading,
@@ -22278,10 +22405,10 @@ var MessageFeedback = ({
22278
22405
  removeVote,
22279
22406
  refetch
22280
22407
  } = useMessageVote({ threadId, messageId, autoFetch: false });
22281
- useEffect10(() => {
22408
+ useEffect11(() => {
22282
22409
  refetch();
22283
22410
  }, [refetch]);
22284
- const handleUpvote = useCallback13(async () => {
22411
+ const handleUpvote = useCallback14(async () => {
22285
22412
  if (loading) return;
22286
22413
  if (summary?.user_vote === "upvote") {
22287
22414
  await removeVote();
@@ -22292,7 +22419,7 @@ var MessageFeedback = ({
22292
22419
  }
22293
22420
  }
22294
22421
  }, [loading, summary, upvote, removeVote, onVote]);
22295
- const handleDownvoteClick = useCallback13(() => {
22422
+ const handleDownvoteClick = useCallback14(() => {
22296
22423
  if (loading) return;
22297
22424
  if (summary?.user_vote === "downvote") {
22298
22425
  removeVote();
@@ -22301,7 +22428,7 @@ var MessageFeedback = ({
22301
22428
  setPendingDownvote(true);
22302
22429
  setShowCommentInput(true);
22303
22430
  }, [loading, summary, removeVote]);
22304
- const handleDownvoteSubmit = useCallback13(async () => {
22431
+ const handleDownvoteSubmit = useCallback14(async () => {
22305
22432
  if (!comment.trim()) return;
22306
22433
  const result = await downvote(comment.trim());
22307
22434
  if (result) {
@@ -22313,16 +22440,16 @@ var MessageFeedback = ({
22313
22440
  }
22314
22441
  }
22315
22442
  }, [comment, downvote, onVote]);
22316
- const handleCancelDownvote = useCallback13(() => {
22443
+ const handleCancelDownvote = useCallback14(() => {
22317
22444
  setShowCommentInput(false);
22318
22445
  setComment("");
22319
22446
  setPendingDownvote(false);
22320
22447
  }, []);
22321
22448
  const isUpvoted = summary?.user_vote === "upvote";
22322
22449
  const isDownvoted = summary?.user_vote === "downvote";
22323
- return /* @__PURE__ */ jsxs9("div", { className: cn("flex flex-col gap-2", className), children: [
22324
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1", children: [
22325
- /* @__PURE__ */ jsxs9(
22450
+ return /* @__PURE__ */ jsxs10("div", { className: cn("flex flex-col gap-2", className), children: [
22451
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
22452
+ /* @__PURE__ */ jsxs10(
22326
22453
  "button",
22327
22454
  {
22328
22455
  onClick: handleUpvote,
@@ -22337,12 +22464,12 @@ var MessageFeedback = ({
22337
22464
  "aria-label": isUpvoted ? "Remove upvote" : "Upvote",
22338
22465
  "aria-pressed": isUpvoted,
22339
22466
  children: [
22340
- loading ? /* @__PURE__ */ jsx14(Loader22, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx14(ThumbsUp, { className: cn("h-3.5 w-3.5", isUpvoted && "fill-current") }),
22341
- !compact && summary && summary.upvotes > 0 && /* @__PURE__ */ jsx14("span", { children: summary.upvotes })
22467
+ loading ? /* @__PURE__ */ jsx15(Loader22, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx15(ThumbsUp, { className: cn("h-3.5 w-3.5", isUpvoted && "fill-current") }),
22468
+ !compact && summary && summary.upvotes > 0 && /* @__PURE__ */ jsx15("span", { children: summary.upvotes })
22342
22469
  ]
22343
22470
  }
22344
22471
  ),
22345
- /* @__PURE__ */ jsxs9(
22472
+ /* @__PURE__ */ jsxs10(
22346
22473
  "button",
22347
22474
  {
22348
22475
  onClick: handleDownvoteClick,
@@ -22357,18 +22484,18 @@ var MessageFeedback = ({
22357
22484
  "aria-label": isDownvoted ? "Remove downvote" : "Downvote",
22358
22485
  "aria-pressed": isDownvoted,
22359
22486
  children: [
22360
- loading ? /* @__PURE__ */ jsx14(Loader22, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx14(ThumbsDown, { className: cn("h-3.5 w-3.5", isDownvoted && "fill-current") }),
22361
- !compact && summary && summary.downvotes > 0 && /* @__PURE__ */ jsx14("span", { children: summary.downvotes })
22487
+ loading ? /* @__PURE__ */ jsx15(Loader22, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx15(ThumbsDown, { className: cn("h-3.5 w-3.5", isDownvoted && "fill-current") }),
22488
+ !compact && summary && summary.downvotes > 0 && /* @__PURE__ */ jsx15("span", { children: summary.downvotes })
22362
22489
  ]
22363
22490
  }
22364
22491
  )
22365
22492
  ] }),
22366
- showCommentInput && /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-2 p-3 bg-muted/50 rounded-lg border border-border/50", children: [
22367
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
22368
- /* @__PURE__ */ jsx14(MessageSquare, { className: "h-3.5 w-3.5" }),
22369
- /* @__PURE__ */ jsx14("span", { children: "Please tell us what was wrong with this response" })
22493
+ showCommentInput && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2 p-3 bg-muted/50 rounded-lg border border-border/50", children: [
22494
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
22495
+ /* @__PURE__ */ jsx15(MessageSquare, { className: "h-3.5 w-3.5" }),
22496
+ /* @__PURE__ */ jsx15("span", { children: "Please tell us what was wrong with this response" })
22370
22497
  ] }),
22371
- /* @__PURE__ */ jsx14(
22498
+ /* @__PURE__ */ jsx15(
22372
22499
  "textarea",
22373
22500
  {
22374
22501
  value: comment,
@@ -22383,8 +22510,8 @@ var MessageFeedback = ({
22383
22510
  autoFocus: true
22384
22511
  }
22385
22512
  ),
22386
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2 justify-end", children: [
22387
- /* @__PURE__ */ jsx14(
22513
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 justify-end", children: [
22514
+ /* @__PURE__ */ jsx15(
22388
22515
  "button",
22389
22516
  {
22390
22517
  onClick: handleCancelDownvote,
@@ -22396,7 +22523,7 @@ var MessageFeedback = ({
22396
22523
  children: "Cancel"
22397
22524
  }
22398
22525
  ),
22399
- /* @__PURE__ */ jsx14(
22526
+ /* @__PURE__ */ jsx15(
22400
22527
  "button",
22401
22528
  {
22402
22529
  onClick: handleDownvoteSubmit,
@@ -22407,29 +22534,29 @@ var MessageFeedback = ({
22407
22534
  "hover:bg-primary/90 transition-colors",
22408
22535
  "disabled:opacity-50 disabled:cursor-not-allowed"
22409
22536
  ),
22410
- children: loading ? /* @__PURE__ */ jsx14(Loader22, { className: "h-3 w-3 animate-spin" }) : "Submit Feedback"
22537
+ children: loading ? /* @__PURE__ */ jsx15(Loader22, { className: "h-3 w-3 animate-spin" }) : "Submit Feedback"
22411
22538
  }
22412
22539
  )
22413
22540
  ] })
22414
22541
  ] }),
22415
- error && /* @__PURE__ */ jsx14("div", { className: "text-xs text-destructive", children: error.message })
22542
+ error && /* @__PURE__ */ jsx15("div", { className: "text-xs text-destructive", children: error.message })
22416
22543
  ] });
22417
22544
  };
22418
22545
 
22419
22546
  // src/components/renderers/StepBasedRenderer.tsx
22420
22547
  import { Clock, CheckCircle as CheckCircle2, AlertCircle } from "lucide-react";
22421
- import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
22548
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
22422
22549
  var StepIndicator = ({ step }) => {
22423
22550
  const getStatusIcon2 = () => {
22424
22551
  switch (step.status) {
22425
22552
  case "running":
22426
- return /* @__PURE__ */ jsx15("div", { className: "animate-spin rounded-full h-3 w-3 border-b-2 border-primary" });
22553
+ return /* @__PURE__ */ jsx16("div", { className: "animate-spin rounded-full h-3 w-3 border-b-2 border-primary" });
22427
22554
  case "completed":
22428
- return /* @__PURE__ */ jsx15(CheckCircle2, { className: "h-3 w-3 text-green-500" });
22555
+ return /* @__PURE__ */ jsx16(CheckCircle2, { className: "h-3 w-3 text-green-500" });
22429
22556
  case "failed":
22430
- return /* @__PURE__ */ jsx15(AlertCircle, { className: "h-3 w-3 text-red-500" });
22557
+ return /* @__PURE__ */ jsx16(AlertCircle, { className: "h-3 w-3 text-red-500" });
22431
22558
  default:
22432
- return /* @__PURE__ */ jsx15(Clock, { className: "h-3 w-3 text-muted-foreground" });
22559
+ return /* @__PURE__ */ jsx16(Clock, { className: "h-3 w-3 text-muted-foreground" });
22433
22560
  }
22434
22561
  };
22435
22562
  const getStatusText = () => {
@@ -22448,7 +22575,7 @@ var StepIndicator = ({ step }) => {
22448
22575
  const renderShimmerForRunning = () => {
22449
22576
  if (step.status !== "running") return null;
22450
22577
  const text = step.title || "AI is writing...";
22451
- return /* @__PURE__ */ jsx15(LoadingShimmer, { text, className: "text-sm" });
22578
+ return /* @__PURE__ */ jsx16(LoadingShimmer, { text, className: "text-sm" });
22452
22579
  };
22453
22580
  const getDuration = () => {
22454
22581
  if (step.startTime) {
@@ -22459,19 +22586,19 @@ var StepIndicator = ({ step }) => {
22459
22586
  return "";
22460
22587
  };
22461
22588
  if (step.status === "completed") {
22462
- return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-xs text-muted-foreground mb-1 opacity-60", children: [
22589
+ return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-xs text-muted-foreground mb-1 opacity-60", children: [
22463
22590
  getStatusIcon2(),
22464
- /* @__PURE__ */ jsx15("span", { className: "font-medium", children: step.title }),
22465
- /* @__PURE__ */ jsxs10("span", { children: [
22591
+ /* @__PURE__ */ jsx16("span", { className: "font-medium", children: step.title }),
22592
+ /* @__PURE__ */ jsxs11("span", { children: [
22466
22593
  "(",
22467
22594
  getDuration(),
22468
22595
  ")"
22469
22596
  ] })
22470
22597
  ] });
22471
22598
  }
22472
- return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 text-sm text-muted-foreground mb-3", children: [
22599
+ return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground mb-3", children: [
22473
22600
  getStatusIcon2(),
22474
- step.status === "running" ? renderShimmerForRunning() : /* @__PURE__ */ jsx15("span", { className: "font-medium", children: getStatusText() })
22601
+ step.status === "running" ? renderShimmerForRunning() : /* @__PURE__ */ jsx16("span", { className: "font-medium", children: getStatusText() })
22475
22602
  ] });
22476
22603
  };
22477
22604
  var StepBasedRenderer = ({
@@ -22487,15 +22614,15 @@ var StepBasedRenderer = ({
22487
22614
  const stepId = distriMessage.step_id;
22488
22615
  const step = stepId ? steps.get(stepId) : null;
22489
22616
  if (distriMessage.role === "user") {
22490
- return /* @__PURE__ */ jsx15(UserMessageRenderer, { message: distriMessage });
22617
+ return /* @__PURE__ */ jsx16(UserMessageRenderer, { message: distriMessage });
22491
22618
  }
22492
22619
  if (distriMessage.role === "assistant") {
22493
22620
  const showFeedback = enableFeedback && threadId && distriMessage.id && step?.status !== "running";
22494
- return /* @__PURE__ */ jsx15("div", { className: "flex items-start gap-4", children: /* @__PURE__ */ jsxs10("div", { className: "w-full", children: [
22495
- (distriMessage.agent_id || distriMessage.agent_name) && /* @__PURE__ */ jsx15("div", { className: "mb-2", children: /* @__PURE__ */ jsx15("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-primary/10 text-primary border border-primary/20", children: distriMessage.agent_name || distriMessage.agent_id }) }),
22496
- step && /* @__PURE__ */ jsx15(StepIndicator, { step }),
22497
- /* @__PURE__ */ jsx15("div", { className: "transition-all duration-200 ease-in-out", children: /* @__PURE__ */ jsx15(AssistantMessageRenderer, { message: distriMessage }) }),
22498
- showFeedback && /* @__PURE__ */ jsx15("div", { className: "mt-3 pt-2 border-t border-border/30", children: /* @__PURE__ */ jsx15(
22621
+ return /* @__PURE__ */ jsx16("div", { className: "flex items-start gap-4", children: /* @__PURE__ */ jsxs11("div", { className: "w-full", children: [
22622
+ (distriMessage.agent_id || distriMessage.agent_name) && /* @__PURE__ */ jsx16("div", { className: "mb-2", children: /* @__PURE__ */ jsx16("span", { className: "inline-flex items-center px-2 py-0.5 rounded-md text-xs font-medium bg-primary/10 text-primary border border-primary/20", children: distriMessage.agent_name || distriMessage.agent_id }) }),
22623
+ step && /* @__PURE__ */ jsx16(StepIndicator, { step }),
22624
+ /* @__PURE__ */ jsx16("div", { className: "transition-all duration-200 ease-in-out", children: /* @__PURE__ */ jsx16(AssistantMessageRenderer, { message: distriMessage }) }),
22625
+ showFeedback && /* @__PURE__ */ jsx16("div", { className: "mt-3 pt-2 border-t border-border/30", children: /* @__PURE__ */ jsx16(
22499
22626
  MessageFeedback,
22500
22627
  {
22501
22628
  threadId,
@@ -22509,13 +22636,13 @@ var StepBasedRenderer = ({
22509
22636
  };
22510
22637
 
22511
22638
  // src/components/renderers/ToolExecutionRenderer.tsx
22512
- import { useState as useState14 } from "react";
22639
+ import { useState as useState15 } from "react";
22513
22640
  import { ChevronDown, ChevronRight, CheckCircle as CheckCircle3, XCircle as XCircle2, Clock as Clock2 } from "lucide-react";
22514
- import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
22641
+ import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
22515
22642
  var renderPart = (part, index) => {
22516
22643
  switch (part.part_type) {
22517
22644
  case "text":
22518
- return /* @__PURE__ */ jsx16("div", { className: "whitespace-pre-wrap break-words", children: part.data }, index);
22645
+ return /* @__PURE__ */ jsx17("div", { className: "whitespace-pre-wrap break-words", children: part.data }, index);
22519
22646
  case "image": {
22520
22647
  const imageData = part.data;
22521
22648
  let src;
@@ -22524,9 +22651,9 @@ var renderPart = (part, index) => {
22524
22651
  } else if (imageData.type === "url" && imageData.url) {
22525
22652
  src = imageData.url;
22526
22653
  } else {
22527
- return /* @__PURE__ */ jsx16("div", { className: "text-muted-foreground italic", children: "Invalid image data" }, index);
22654
+ return /* @__PURE__ */ jsx17("div", { className: "text-muted-foreground italic", children: "Invalid image data" }, index);
22528
22655
  }
22529
- return /* @__PURE__ */ jsx16("div", { className: "my-2", children: /* @__PURE__ */ jsx16(
22656
+ return /* @__PURE__ */ jsx17("div", { className: "my-2", children: /* @__PURE__ */ jsx17(
22530
22657
  "img",
22531
22658
  {
22532
22659
  src,
@@ -22540,130 +22667,172 @@ var renderPart = (part, index) => {
22540
22667
  if (typeof data === "object" && data !== null && "success" in data) {
22541
22668
  const result = data;
22542
22669
  if (result.error) {
22543
- return /* @__PURE__ */ jsxs11("div", { className: "text-destructive", children: [
22670
+ return /* @__PURE__ */ jsxs12("div", { className: "text-destructive", children: [
22544
22671
  "Error: ",
22545
22672
  result.error
22546
22673
  ] }, index);
22547
22674
  }
22548
22675
  if (result.result !== void 0) {
22549
- return /* @__PURE__ */ jsx16("pre", { className: "whitespace-pre-wrap break-words", children: typeof result.result === "string" ? result.result : JSON.stringify(result.result, null, 2) }, index);
22676
+ return /* @__PURE__ */ jsx17("pre", { className: "whitespace-pre-wrap break-words", children: typeof result.result === "string" ? result.result : JSON.stringify(result.result, null, 2) }, index);
22550
22677
  }
22551
- return /* @__PURE__ */ jsx16("div", { className: "text-green-600", children: "Success" }, index);
22678
+ return /* @__PURE__ */ jsx17("div", { className: "text-green-600", children: "Success" }, index);
22552
22679
  }
22553
- return /* @__PURE__ */ jsx16("pre", { className: "whitespace-pre-wrap break-words", children: JSON.stringify(data, null, 2) }, index);
22680
+ return /* @__PURE__ */ jsx17("pre", { className: "whitespace-pre-wrap break-words", children: JSON.stringify(data, null, 2) }, index);
22554
22681
  }
22555
22682
  default:
22556
- return /* @__PURE__ */ jsx16("pre", { className: "whitespace-pre-wrap break-words", children: JSON.stringify(part, null, 2) }, index);
22683
+ return /* @__PURE__ */ jsx17("pre", { className: "whitespace-pre-wrap break-words", children: JSON.stringify(part, null, 2) }, index);
22557
22684
  }
22558
22685
  };
22559
22686
  var renderToolResultParts = (result) => {
22560
22687
  if (!result.parts || result.parts.length === 0) {
22561
22688
  return "No result available";
22562
22689
  }
22563
- return /* @__PURE__ */ jsx16("div", { className: "space-y-2", children: result.parts.map((part, index) => renderPart(part, index)) });
22690
+ return /* @__PURE__ */ jsx17("div", { className: "space-y-2", children: result.parts.map((part, index) => renderPart(part, index)) });
22564
22691
  };
22565
- var getFriendlyToolMessage = (toolName, input) => {
22692
+ var formatToolCall = (toolName, input) => {
22693
+ const str = (key) => input?.[key] || "?";
22694
+ const truncate = (s, max) => s.length > max ? `${s.slice(0, max)}\u2026` : s;
22566
22695
  switch (toolName) {
22696
+ case "load_skill":
22697
+ return `load_skill("${str("skill_name")}")`;
22698
+ case "run_skill_script": {
22699
+ const step = input?.step_index;
22700
+ return step != null ? `run_skill_script("${str("skill_name")}", step=${step})` : `run_skill_script("${str("skill_name")}")`;
22701
+ }
22702
+ case "create_skill":
22703
+ case "delete_skill":
22704
+ return `${toolName}("${input?.name || input?.skill_name || "?"}")`;
22567
22705
  case "search":
22568
- return `Searching "${input?.query || "unknown query"}"`;
22569
- case "call_search_agent":
22570
- return `Searching`;
22571
- case "read_values":
22572
- return `Reading values`;
22573
- case "get_sheet_info":
22574
- return `Getting sheet info`;
22575
- case "get_context_pack":
22576
- return `Understanding the spreadsheet`;
22577
- case "write_values":
22578
- return `Updating values`;
22579
- case "clear_values":
22580
- return `Clearing values`;
22581
- case "merge_cells":
22582
- return `Merging cells`;
22583
- case "call_blink_ops_agent":
22584
- return `Planning sheet updates`;
22585
- case "apply_blink_ops":
22586
- return `Applying sheet updates`;
22587
- default:
22588
- return `Executing ${toolName}`;
22706
+ return `search("${truncate(str("query"), 60)}")`;
22707
+ case "tool_search":
22708
+ return `tool_search("${truncate(str("query"), 60)}")`;
22709
+ case "execute_shell":
22710
+ return `execute_shell("${truncate(str("command"), 60)}")`;
22711
+ case "start_shell":
22712
+ case "stop_shell":
22713
+ return `${toolName}()`;
22714
+ case "browsr_scrape":
22715
+ case "browsr_crawl":
22716
+ return `${toolName}("${truncate(str("url"), 60)}")`;
22717
+ case "transfer_to_agent":
22718
+ return `transfer_to_agent("${str("agent_name")}")`;
22719
+ case "api_request": {
22720
+ const method = input?.method || "GET";
22721
+ const path = input?.path;
22722
+ const url = input?.url;
22723
+ if (url) return `api_request(${method} ${truncate(url, 50)})`;
22724
+ if (path) return `api_request(${method} ${path})`;
22725
+ return `api_request(${method})`;
22726
+ }
22727
+ case "final":
22728
+ case "reflect":
22729
+ return `${toolName}()`;
22730
+ default: {
22731
+ const compact = JSON.stringify(input || {});
22732
+ return `${toolName}(${truncate(compact, 80)})`;
22733
+ }
22589
22734
  }
22590
22735
  };
22591
- var ToolCallCard = ({ toolCall, state, renderResultData }) => {
22592
- const [isExpanded, setIsExpanded] = useState14(false);
22593
- const [activeTab, setActiveTab] = useState14("output");
22594
- const friendlyMessage = getFriendlyToolMessage(toolCall.tool_name, toolCall.input);
22736
+ var summarizeResult = (state) => {
22737
+ if (!state.result?.parts?.length) return null;
22738
+ for (const part of state.result.parts) {
22739
+ const p = part;
22740
+ if (p.part_type === "text" && typeof p.data === "string") {
22741
+ const text = p.data.trim();
22742
+ return text.length > 120 ? `${text.slice(0, 120)}\u2026` : text;
22743
+ }
22744
+ if (p.part_type === "data" && typeof p.data === "object" && p.data !== null) {
22745
+ const obj = p.data;
22746
+ if (obj.error) return `Error: ${obj.error}`;
22747
+ if (obj.data && typeof obj.data === "object") {
22748
+ const inner = obj.data;
22749
+ if (Array.isArray(inner)) return `${inner.length} items`;
22750
+ const label = inner.name || inner.id || inner.title || inner.status;
22751
+ if (label) return String(label);
22752
+ }
22753
+ if (obj.status && obj.data !== void 0) {
22754
+ const compact = JSON.stringify(obj.data);
22755
+ return compact.length > 100 ? `${compact.slice(0, 100)}\u2026` : compact;
22756
+ }
22757
+ }
22758
+ }
22759
+ return null;
22760
+ };
22761
+ var ToolCallCard = ({ toolCall, state, renderResultData, debug = false }) => {
22762
+ const [isExpanded, setIsExpanded] = useState15(false);
22763
+ const [activeTab, setActiveTab] = useState15("output");
22764
+ const formatted = formatToolCall(toolCall.tool_name, toolCall.input);
22595
22765
  const executionTime = state?.endTime && state?.startTime ? state.endTime - state.startTime : void 0;
22596
- const renderTabs = () => /* @__PURE__ */ jsxs11("div", { className: "mt-2", children: [
22597
- /* @__PURE__ */ jsx16("div", { className: "mb-2 flex items-center gap-2", children: ["output", "input"].map((tab) => /* @__PURE__ */ jsx16(
22766
+ const renderDebugTabs = () => /* @__PURE__ */ jsxs12("div", { className: "mt-1.5 ml-5", children: [
22767
+ /* @__PURE__ */ jsx17("div", { className: "mb-1.5 flex items-center gap-1.5", children: ["output", "input"].map((tab) => /* @__PURE__ */ jsx17(
22598
22768
  "button",
22599
22769
  {
22600
22770
  onClick: () => setActiveTab(tab),
22601
- className: `text-xs px-2 py-1 rounded border transition-colors ${activeTab === tab ? "bg-primary text-primary-foreground border-primary" : "bg-muted text-muted-foreground hover:text-foreground"}`,
22771
+ className: `text-[11px] px-1.5 py-0.5 rounded transition-colors ${activeTab === tab ? "bg-muted-foreground/20 text-foreground" : "text-muted-foreground hover:text-foreground"}`,
22602
22772
  children: tab === "output" ? "Output" : "Input"
22603
22773
  },
22604
22774
  tab
22605
22775
  )) }),
22606
- activeTab === "input" ? /* @__PURE__ */ jsx16("pre", { className: "text-xs text-muted-foreground whitespace-pre-wrap overflow-auto break-words border border-muted rounded-md p-3", children: JSON.stringify(toolCall.input, null, 2) }) : /* @__PURE__ */ jsx16("div", { className: "text-xs text-muted-foreground overflow-auto border border-muted rounded-md p-3", children: renderResultData(state) }),
22607
- state?.error && activeTab === "output" && /* @__PURE__ */ jsxs11("div", { className: "mt-2 text-xs text-destructive", children: [
22608
- "Error: ",
22609
- state.error
22610
- ] })
22776
+ activeTab === "input" ? /* @__PURE__ */ jsx17("pre", { className: "text-[11px] text-muted-foreground whitespace-pre-wrap overflow-auto break-words bg-muted/50 rounded p-2 max-h-[200px]", children: JSON.stringify(toolCall.input, null, 2) }) : /* @__PURE__ */ jsx17("div", { className: "text-[11px] text-muted-foreground overflow-auto bg-muted/50 rounded p-2 max-h-[200px]", children: renderResultData(state) })
22611
22777
  ] });
22612
22778
  if (state?.status === "pending" || state?.status === "running") {
22613
- return /* @__PURE__ */ jsx16("div", { className: "mb-2", children: /* @__PURE__ */ jsx16(LoadingShimmer, { text: friendlyMessage }) });
22779
+ return /* @__PURE__ */ jsx17("div", { className: "mb-1", children: /* @__PURE__ */ jsx17(LoadingShimmer, { text: formatted, className: "text-xs", showIcon: true }) });
22614
22780
  }
22615
22781
  if (state?.status === "completed") {
22616
22782
  const time = executionTime || 0;
22617
- return /* @__PURE__ */ jsxs11("div", { className: "mb-2", children: [
22618
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between text-sm text-muted-foreground", children: [
22619
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
22620
- /* @__PURE__ */ jsx16(CheckCircle3, { className: "w-4 h-4 text-green-600" }),
22621
- /* @__PURE__ */ jsxs11("span", { children: [
22622
- friendlyMessage,
22623
- " completed",
22624
- time > 100 && /* @__PURE__ */ jsxs11("span", { className: "ml-1 text-xs", children: [
22625
- "(",
22626
- (time / 1e3).toFixed(1),
22627
- "s)"
22628
- ] })
22629
- ] })
22630
- ] }),
22631
- /* @__PURE__ */ jsxs11(
22632
- "button",
22633
- {
22634
- onClick: () => setIsExpanded(!isExpanded),
22635
- className: "flex items-center gap-1 text-xs transition-colors hover:text-foreground",
22636
- children: [
22637
- isExpanded ? /* @__PURE__ */ jsx16(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx16(ChevronRight, { className: "h-3 w-3" }),
22638
- "View details"
22639
- ]
22640
- }
22641
- )
22783
+ const summary = summarizeResult(state);
22784
+ return /* @__PURE__ */ jsxs12("div", { className: "mb-1 group", children: [
22785
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-1.5 text-xs text-muted-foreground", children: [
22786
+ /* @__PURE__ */ jsx17(CheckCircle3, { className: "w-3 h-3 text-green-600 mt-0.5 shrink-0" }),
22787
+ /* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
22788
+ /* @__PURE__ */ jsxs12(
22789
+ "span",
22790
+ {
22791
+ className: debug ? "cursor-pointer hover:text-foreground transition-colors" : "",
22792
+ onClick: debug ? () => setIsExpanded(!isExpanded) : void 0,
22793
+ children: [
22794
+ formatted,
22795
+ time > 100 && /* @__PURE__ */ jsxs12("span", { className: "ml-1 text-muted-foreground/60", children: [
22796
+ (time / 1e3).toFixed(1),
22797
+ "s"
22798
+ ] }),
22799
+ debug && (isExpanded ? /* @__PURE__ */ jsx17(ChevronDown, { className: "inline h-3 w-3 ml-0.5" }) : /* @__PURE__ */ jsx17(ChevronRight, { className: "inline h-3 w-3 ml-0.5 opacity-0 group-hover:opacity-100 transition-opacity" }))
22800
+ ]
22801
+ }
22802
+ ),
22803
+ summary && !isExpanded && /* @__PURE__ */ jsx17("div", { className: "text-muted-foreground/60 truncate", children: `\u23BF ${summary}` })
22804
+ ] })
22642
22805
  ] }),
22643
- isExpanded && renderTabs()
22806
+ debug && isExpanded && renderDebugTabs()
22644
22807
  ] });
22645
22808
  }
22646
22809
  if (state?.status === "error") {
22647
- return /* @__PURE__ */ jsxs11("div", { className: "mb-3", children: [
22648
- /* @__PURE__ */ jsxs11("div", { className: "mb-2 flex items-center gap-2 text-sm text-destructive", children: [
22649
- /* @__PURE__ */ jsx16(XCircle2, { className: "h-4 w-4" }),
22650
- /* @__PURE__ */ jsxs11("span", { children: [
22651
- friendlyMessage,
22652
- " failed",
22653
- state.error && /* @__PURE__ */ jsxs11("span", { className: "ml-1 text-xs text-muted-foreground", children: [
22654
- "- ",
22655
- state.error
22656
- ] })
22810
+ return /* @__PURE__ */ jsxs12("div", { className: "mb-1", children: [
22811
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-1.5 text-xs", children: [
22812
+ /* @__PURE__ */ jsx17(XCircle2, { className: "h-3 w-3 text-destructive mt-0.5 shrink-0" }),
22813
+ /* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
22814
+ /* @__PURE__ */ jsxs12(
22815
+ "span",
22816
+ {
22817
+ className: `text-destructive ${debug ? "cursor-pointer hover:text-destructive/80" : ""}`,
22818
+ onClick: debug ? () => setIsExpanded(!isExpanded) : void 0,
22819
+ children: [
22820
+ formatted,
22821
+ " failed"
22822
+ ]
22823
+ }
22824
+ ),
22825
+ state.error && /* @__PURE__ */ jsx17("div", { className: "text-muted-foreground/60 text-[11px] truncate", children: `\u23BF ${state.error}` })
22657
22826
  ] })
22658
22827
  ] }),
22659
- renderTabs()
22828
+ debug && isExpanded && renderDebugTabs()
22660
22829
  ] });
22661
22830
  }
22662
22831
  if (state) {
22663
- return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
22664
- /* @__PURE__ */ jsx16(Clock2, { className: "h-4 w-4" }),
22665
- /* @__PURE__ */ jsxs11("span", { children: [
22666
- friendlyMessage,
22832
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 text-xs text-muted-foreground mb-1", children: [
22833
+ /* @__PURE__ */ jsx17(Clock2, { className: "h-3 w-3" }),
22834
+ /* @__PURE__ */ jsxs12("span", { children: [
22835
+ formatted,
22667
22836
  " (",
22668
22837
  state.status,
22669
22838
  ")"
@@ -22675,7 +22844,8 @@ var ToolCallCard = ({ toolCall, state, renderResultData }) => {
22675
22844
  var ToolExecutionRenderer = ({
22676
22845
  event,
22677
22846
  toolCallStates,
22678
- toolRenderers
22847
+ toolRenderers,
22848
+ debug = false
22679
22849
  }) => {
22680
22850
  const toolCalls = event.data?.tool_calls || [];
22681
22851
  if (toolCalls.length === 0) {
@@ -22687,7 +22857,7 @@ var ToolExecutionRenderer = ({
22687
22857
  }
22688
22858
  return renderToolResultParts(toolCallState.result);
22689
22859
  };
22690
- return /* @__PURE__ */ jsx16(Fragment4, { children: toolCalls.filter((toolCall) => toolCall.tool_name !== "final").map((toolCall) => {
22860
+ return /* @__PURE__ */ jsx17(Fragment4, { children: toolCalls.filter((toolCall) => toolCall.tool_name !== "final").map((toolCall) => {
22691
22861
  const state = toolCallStates.get(toolCall.tool_call_id);
22692
22862
  const renderer = toolRenderers?.[toolCall.tool_name];
22693
22863
  if (renderer) {
@@ -22696,14 +22866,15 @@ var ToolExecutionRenderer = ({
22696
22866
  tool_name: toolCall.tool_name,
22697
22867
  input: toolCall.input
22698
22868
  };
22699
- return /* @__PURE__ */ jsx16("div", { children: renderer({ toolCall: toolCallPayload, state }) }, toolCall.tool_call_id);
22869
+ return /* @__PURE__ */ jsx17("div", { children: renderer({ toolCall: toolCallPayload, state }) }, toolCall.tool_call_id);
22700
22870
  }
22701
- return /* @__PURE__ */ jsx16(
22871
+ return /* @__PURE__ */ jsx17(
22702
22872
  ToolCallCard,
22703
22873
  {
22704
22874
  toolCall,
22705
22875
  state,
22706
- renderResultData
22876
+ renderResultData,
22877
+ debug
22707
22878
  },
22708
22879
  toolCall.tool_call_id
22709
22880
  );
@@ -22711,11 +22882,11 @@ var ToolExecutionRenderer = ({
22711
22882
  };
22712
22883
 
22713
22884
  // src/components/renderers/MessageReadTracker.tsx
22714
- import { useEffect as useEffect12, useRef as useRef9 } from "react";
22885
+ import { useEffect as useEffect13, useRef as useRef9 } from "react";
22715
22886
 
22716
22887
  // src/components/renderers/MessageReadContext.tsx
22717
- import { createContext as createContext4, useContext as useContext4, useState as useState15, useCallback as useCallback14, useEffect as useEffect11, useRef as useRef8 } from "react";
22718
- import { jsx as jsx17 } from "react/jsx-runtime";
22888
+ import { createContext as createContext4, useContext as useContext4, useState as useState16, useCallback as useCallback15, useEffect as useEffect12, useRef as useRef8 } from "react";
22889
+ import { jsx as jsx18 } from "react/jsx-runtime";
22719
22890
  var MessageReadContext = createContext4(null);
22720
22891
  var MessageReadProvider = ({
22721
22892
  threadId,
@@ -22723,11 +22894,11 @@ var MessageReadProvider = ({
22723
22894
  children
22724
22895
  }) => {
22725
22896
  const { client } = useDistri();
22726
- const [readMessageIds, setReadMessageIds] = useState15(/* @__PURE__ */ new Set());
22727
- const [isLoading, setIsLoading] = useState15(true);
22897
+ const [readMessageIds, setReadMessageIds] = useState16(/* @__PURE__ */ new Set());
22898
+ const [isLoading, setIsLoading] = useState16(true);
22728
22899
  const pendingMarks = useRef8(/* @__PURE__ */ new Set());
22729
22900
  const fetchedThreadId = useRef8(null);
22730
- useEffect11(() => {
22901
+ useEffect12(() => {
22731
22902
  if (!enabled || !client || !threadId) {
22732
22903
  setIsLoading(false);
22733
22904
  return;
@@ -22750,16 +22921,16 @@ var MessageReadProvider = ({
22750
22921
  };
22751
22922
  fetchReadStatuses();
22752
22923
  }, [client, threadId, enabled]);
22753
- useEffect11(() => {
22924
+ useEffect12(() => {
22754
22925
  if (fetchedThreadId.current !== threadId) {
22755
22926
  setReadMessageIds(/* @__PURE__ */ new Set());
22756
22927
  pendingMarks.current = /* @__PURE__ */ new Set();
22757
22928
  }
22758
22929
  }, [threadId]);
22759
- const isRead = useCallback14((messageId) => {
22930
+ const isRead = useCallback15((messageId) => {
22760
22931
  return readMessageIds.has(messageId);
22761
22932
  }, [readMessageIds]);
22762
- const markAsRead = useCallback14(async (messageId) => {
22933
+ const markAsRead = useCallback15(async (messageId) => {
22763
22934
  if (!client || !threadId || !enabled) {
22764
22935
  return;
22765
22936
  }
@@ -22786,14 +22957,14 @@ var MessageReadProvider = ({
22786
22957
  readMessageIds,
22787
22958
  isLoading
22788
22959
  };
22789
- return /* @__PURE__ */ jsx17(MessageReadContext.Provider, { value, children });
22960
+ return /* @__PURE__ */ jsx18(MessageReadContext.Provider, { value, children });
22790
22961
  };
22791
22962
  var useMessageReadContext = () => {
22792
22963
  return useContext4(MessageReadContext);
22793
22964
  };
22794
22965
 
22795
22966
  // src/components/renderers/MessageReadTracker.tsx
22796
- import { jsx as jsx18 } from "react/jsx-runtime";
22967
+ import { jsx as jsx19 } from "react/jsx-runtime";
22797
22968
  var MessageReadTracker = ({
22798
22969
  messageId,
22799
22970
  enabled = true,
@@ -22805,7 +22976,7 @@ var MessageReadTracker = ({
22805
22976
  const ref = useRef9(null);
22806
22977
  const timeoutRef = useRef9(null);
22807
22978
  const hasTriggered = useRef9(false);
22808
- useEffect12(() => {
22979
+ useEffect13(() => {
22809
22980
  if (!enabled || !readContext || !ref.current || !messageId) {
22810
22981
  return;
22811
22982
  }
@@ -22847,19 +23018,19 @@ var MessageReadTracker = ({
22847
23018
  }
22848
23019
  };
22849
23020
  }, [enabled, threshold, delay, messageId, readContext]);
22850
- useEffect12(() => {
23021
+ useEffect13(() => {
22851
23022
  hasTriggered.current = false;
22852
23023
  }, [messageId]);
22853
- return /* @__PURE__ */ jsx18("div", { ref, "data-message-id": messageId, children });
23024
+ return /* @__PURE__ */ jsx19("div", { ref, "data-message-id": messageId, children });
22854
23025
  };
22855
23026
 
22856
23027
  // src/components/renderers/MessageRenderer.tsx
22857
- import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
23028
+ import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
22858
23029
  var RendererWrapper = ({
22859
23030
  children,
22860
23031
  className = "",
22861
23032
  isUserMessage = false
22862
- }) => /* @__PURE__ */ jsx19("div", { className: `w-full px-4 overflow-hidden ${className}`, style: { maxWidth: "100%", wordBreak: "break-word" }, children: /* @__PURE__ */ jsx19(
23033
+ }) => /* @__PURE__ */ jsx20("div", { className: `w-full px-4 overflow-hidden ${className}`, style: { maxWidth: "100%", wordBreak: "break-word" }, children: /* @__PURE__ */ jsx20(
22863
23034
  "div",
22864
23035
  {
22865
23036
  className: `w-full overflow-hidden ${isUserMessage ? "ml-auto" : "max-w-4xl mx-auto"}`,
@@ -22888,7 +23059,7 @@ function MessageRenderer({
22888
23059
  const distriMessage = message;
22889
23060
  switch (distriMessage.role) {
22890
23061
  case "user":
22891
- return /* @__PURE__ */ jsx19(RendererWrapper, { className: "distri-user-message", isUserMessage: true, children: /* @__PURE__ */ jsx19(
23062
+ return /* @__PURE__ */ jsx20(RendererWrapper, { className: "distri-user-message", isUserMessage: true, children: /* @__PURE__ */ jsx20(
22892
23063
  UserMessageRenderer,
22893
23064
  {
22894
23065
  message: distriMessage
@@ -22896,7 +23067,7 @@ function MessageRenderer({
22896
23067
  ) }, `user-${index}`);
22897
23068
  case "assistant": {
22898
23069
  const shouldTrackRead = enableFeedback && distriMessage.id;
22899
- const content = /* @__PURE__ */ jsx19(
23070
+ const content = /* @__PURE__ */ jsx20(
22900
23071
  StepBasedRenderer,
22901
23072
  {
22902
23073
  message: distriMessage,
@@ -22904,7 +23075,7 @@ function MessageRenderer({
22904
23075
  enableFeedback
22905
23076
  }
22906
23077
  );
22907
- return /* @__PURE__ */ jsx19(RendererWrapper, { className: "distri-assistant-message", children: shouldTrackRead ? /* @__PURE__ */ jsx19(
23078
+ return /* @__PURE__ */ jsx20(RendererWrapper, { className: "distri-assistant-message", children: shouldTrackRead ? /* @__PURE__ */ jsx20(
22908
23079
  MessageReadTracker,
22909
23080
  {
22910
23081
  messageId: distriMessage.id,
@@ -22917,9 +23088,9 @@ function MessageRenderer({
22917
23088
  if (!debug) {
22918
23089
  return null;
22919
23090
  }
22920
- return /* @__PURE__ */ jsx19(RendererWrapper, { className: "distri-developer-message", children: /* @__PURE__ */ jsxs12("div", { className: "p-3 bg-muted/50 border border-dashed border-muted-foreground/30 rounded text-sm", children: [
22921
- /* @__PURE__ */ jsx19("div", { className: "text-xs text-muted-foreground font-medium mb-1", children: "Developer Context" }),
22922
- /* @__PURE__ */ jsx19(
23091
+ return /* @__PURE__ */ jsx20(RendererWrapper, { className: "distri-developer-message", children: /* @__PURE__ */ jsxs13("div", { className: "p-3 bg-muted/50 border border-dashed border-muted-foreground/30 rounded text-sm", children: [
23092
+ /* @__PURE__ */ jsx20("div", { className: "text-xs text-muted-foreground font-medium mb-1", children: "Developer Context" }),
23093
+ /* @__PURE__ */ jsx20(
22923
23094
  UserMessageRenderer,
22924
23095
  {
22925
23096
  message: distriMessage
@@ -22954,32 +23125,33 @@ function MessageRenderer({
22954
23125
  if (toolCallsState.size === 0) {
22955
23126
  return null;
22956
23127
  }
22957
- return /* @__PURE__ */ jsx19(RendererWrapper, { className: "distri-tool-execution-start", children: /* @__PURE__ */ jsx19(
23128
+ return /* @__PURE__ */ jsx20(RendererWrapper, { className: "distri-tool-execution-start", children: /* @__PURE__ */ jsx20(
22958
23129
  ToolExecutionRenderer,
22959
23130
  {
22960
23131
  event,
22961
23132
  toolCallStates: toolCallsState,
22962
- toolRenderers
23133
+ toolRenderers,
23134
+ debug
22963
23135
  }
22964
23136
  ) }, `tool-execution-start-${index}`);
22965
23137
  case "tool_results":
22966
23138
  return null;
22967
23139
  case "agent_handover":
22968
- return /* @__PURE__ */ jsx19(RendererWrapper, { className: "distri-handover", children: /* @__PURE__ */ jsx19("div", { className: "p-3 bg-muted rounded border", children: /* @__PURE__ */ jsxs12("div", { className: "text-sm text-muted-foreground", children: [
22969
- /* @__PURE__ */ jsx19("strong", { children: "Handover to:" }),
23140
+ return /* @__PURE__ */ jsx20(RendererWrapper, { className: "distri-handover", children: /* @__PURE__ */ jsx20("div", { className: "p-3 bg-muted rounded border", children: /* @__PURE__ */ jsxs13("div", { className: "text-sm text-muted-foreground", children: [
23141
+ /* @__PURE__ */ jsx20("strong", { children: "Handover to:" }),
22970
23142
  " ",
22971
23143
  event.data?.to_agent || "unknown agent"
22972
23144
  ] }) }) }, `handover-${index}`);
22973
23145
  case "run_finished":
22974
23146
  return null;
22975
23147
  case "run_error":
22976
- return /* @__PURE__ */ jsx19(RendererWrapper, { className: "distri-run-error", children: /* @__PURE__ */ jsxs12("div", { className: "p-3 bg-destructive/10 border border-destructive/20 rounded", children: [
22977
- /* @__PURE__ */ jsxs12("div", { className: "text-sm text-destructive", children: [
22978
- /* @__PURE__ */ jsx19("strong", { children: "Error:" }),
23148
+ return /* @__PURE__ */ jsx20(RendererWrapper, { className: "distri-run-error", children: /* @__PURE__ */ jsxs13("div", { className: "p-3 bg-destructive/10 border border-destructive/20 rounded", children: [
23149
+ /* @__PURE__ */ jsxs13("div", { className: "text-sm text-destructive", children: [
23150
+ /* @__PURE__ */ jsx20("strong", { children: "Error:" }),
22979
23151
  " ",
22980
23152
  event.data?.message || "Unknown error occurred"
22981
23153
  ] }),
22982
- /* @__PURE__ */ jsx19("button", { className: "mt-2 text-xs text-destructive underline", children: "Retry" })
23154
+ /* @__PURE__ */ jsx20("button", { className: "mt-2 text-xs text-destructive underline", children: "Retry" })
22983
23155
  ] }) }, `run-error-${index}`);
22984
23156
  default:
22985
23157
  return null;
@@ -22990,16 +23162,16 @@ function MessageRenderer({
22990
23162
 
22991
23163
  // src/components/renderers/TodosDisplay.tsx
22992
23164
  import { CheckCircle2 as CheckCircle22, Circle, Loader2 as Loader23 } from "lucide-react";
22993
- import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
23165
+ import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
22994
23166
  var getStatusIcon = (status) => {
22995
23167
  switch (status) {
22996
23168
  case "done":
22997
- return /* @__PURE__ */ jsx20(CheckCircle22, { className: "h-4 w-4 text-green-500 flex-shrink-0" });
23169
+ return /* @__PURE__ */ jsx21(CheckCircle22, { className: "h-4 w-4 text-green-500 flex-shrink-0" });
22998
23170
  case "in_progress":
22999
- return /* @__PURE__ */ jsx20(Loader23, { className: "h-4 w-4 text-blue-500 animate-spin flex-shrink-0" });
23171
+ return /* @__PURE__ */ jsx21(Loader23, { className: "h-4 w-4 text-blue-500 animate-spin flex-shrink-0" });
23000
23172
  case "open":
23001
23173
  default:
23002
- return /* @__PURE__ */ jsx20(Circle, { className: "h-4 w-4 text-muted-foreground flex-shrink-0" });
23174
+ return /* @__PURE__ */ jsx21(Circle, { className: "h-4 w-4 text-muted-foreground flex-shrink-0" });
23003
23175
  }
23004
23176
  };
23005
23177
  var getStatusStyles = (status) => {
@@ -23024,10 +23196,10 @@ var TodosDisplay = ({
23024
23196
  const completedCount = todos.filter((t) => t.status === "done").length;
23025
23197
  const inProgressCount = todos.filter((t) => t.status === "in_progress").length;
23026
23198
  const totalCount = todos.length;
23027
- return /* @__PURE__ */ jsxs13("div", { className: `rounded-lg border bg-card p-3 ${className}`, children: [
23028
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between mb-2", children: [
23029
- /* @__PURE__ */ jsx20("h4", { className: "text-sm font-medium text-foreground", children: title }),
23030
- /* @__PURE__ */ jsxs13("span", { className: "text-xs text-muted-foreground", children: [
23199
+ return /* @__PURE__ */ jsxs14("div", { className: `rounded-lg border bg-card p-3 ${className}`, children: [
23200
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between mb-2", children: [
23201
+ /* @__PURE__ */ jsx21("h4", { className: "text-sm font-medium text-foreground", children: title }),
23202
+ /* @__PURE__ */ jsxs14("span", { className: "text-xs text-muted-foreground", children: [
23031
23203
  completedCount,
23032
23204
  "/",
23033
23205
  totalCount,
@@ -23035,20 +23207,20 @@ var TodosDisplay = ({
23035
23207
  inProgressCount > 0 && ` (${inProgressCount} in progress)`
23036
23208
  ] })
23037
23209
  ] }),
23038
- /* @__PURE__ */ jsx20("div", { className: "h-1.5 bg-muted rounded-full mb-3 overflow-hidden", children: /* @__PURE__ */ jsx20(
23210
+ /* @__PURE__ */ jsx21("div", { className: "h-1.5 bg-muted rounded-full mb-3 overflow-hidden", children: /* @__PURE__ */ jsx21(
23039
23211
  "div",
23040
23212
  {
23041
23213
  className: "h-full bg-green-500 transition-all duration-300",
23042
23214
  style: { width: `${completedCount / totalCount * 100}%` }
23043
23215
  }
23044
23216
  ) }),
23045
- /* @__PURE__ */ jsx20("ul", { className: "space-y-1.5", children: todos.map((todo) => /* @__PURE__ */ jsxs13(
23217
+ /* @__PURE__ */ jsx21("ul", { className: "space-y-1.5", children: todos.map((todo) => /* @__PURE__ */ jsxs14(
23046
23218
  "li",
23047
23219
  {
23048
23220
  className: "flex items-start gap-2 text-sm",
23049
23221
  children: [
23050
23222
  getStatusIcon(todo.status),
23051
- /* @__PURE__ */ jsx20("span", { className: getStatusStyles(todo.status), children: todo.content })
23223
+ /* @__PURE__ */ jsx21("span", { className: getStatusStyles(todo.status), children: todo.content })
23052
23224
  ]
23053
23225
  },
23054
23226
  todo.id
@@ -23057,24 +23229,24 @@ var TodosDisplay = ({
23057
23229
  };
23058
23230
 
23059
23231
  // src/components/renderers/TypingIndicator.tsx
23060
- import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
23232
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
23061
23233
  var TypingIndicator = () => {
23062
- return /* @__PURE__ */ jsx21("div", { className: "flex items-center gap-4 py-3", children: /* @__PURE__ */ jsx21("div", { className: "w-full", children: /* @__PURE__ */ jsx21("div", { className: "flex items-center space-x-1 p-3 bg-muted/30 rounded-lg w-fit", children: /* @__PURE__ */ jsxs14("div", { className: "flex space-x-1", children: [
23063
- /* @__PURE__ */ jsx21(
23234
+ return /* @__PURE__ */ jsx22("div", { className: "flex items-center gap-4 py-3", children: /* @__PURE__ */ jsx22("div", { className: "w-full", children: /* @__PURE__ */ jsx22("div", { className: "flex items-center space-x-1 p-3 bg-muted/30 rounded-lg w-fit", children: /* @__PURE__ */ jsxs15("div", { className: "flex space-x-1", children: [
23235
+ /* @__PURE__ */ jsx22(
23064
23236
  "div",
23065
23237
  {
23066
23238
  className: "h-2 w-2 bg-muted-foreground rounded-full animate-bounce",
23067
23239
  style: { animationDelay: "0ms" }
23068
23240
  }
23069
23241
  ),
23070
- /* @__PURE__ */ jsx21(
23242
+ /* @__PURE__ */ jsx22(
23071
23243
  "div",
23072
23244
  {
23073
23245
  className: "h-2 w-2 bg-muted-foreground rounded-full animate-bounce",
23074
23246
  style: { animationDelay: "150ms" }
23075
23247
  }
23076
23248
  ),
23077
- /* @__PURE__ */ jsx21(
23249
+ /* @__PURE__ */ jsx22(
23078
23250
  "div",
23079
23251
  {
23080
23252
  className: "h-2 w-2 bg-muted-foreground rounded-full animate-bounce",
@@ -23085,7 +23257,7 @@ var TypingIndicator = () => {
23085
23257
  };
23086
23258
 
23087
23259
  // src/components/renderers/LoadingAnimation.tsx
23088
- import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
23260
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
23089
23261
  var sizeClasses = {
23090
23262
  sm: { dot: "h-1.5 w-1.5", container: "p-2", avatar: "w-8 h-8 text-base" },
23091
23263
  md: { dot: "h-2 w-2", container: "p-3", avatar: "w-10 h-10 text-lg" },
@@ -23095,8 +23267,8 @@ var TypingDotsAnimation = ({ config }) => {
23095
23267
  const size = config.size || "md";
23096
23268
  const classes = sizeClasses[size];
23097
23269
  const dotColor = config.primaryColor || "currentColor";
23098
- return /* @__PURE__ */ jsx22("div", { className: `flex items-center gap-4 py-3 ${config.className || ""}`, children: /* @__PURE__ */ jsx22("div", { className: "w-full", children: /* @__PURE__ */ jsxs15("div", { className: `flex items-center space-x-1 ${classes.container} bg-muted/30 rounded-lg w-fit`, children: [
23099
- /* @__PURE__ */ jsx22("div", { className: "flex space-x-1", children: [0, 150, 300].map((delay, i) => /* @__PURE__ */ jsx22(
23270
+ return /* @__PURE__ */ jsx23("div", { className: `flex items-center gap-4 py-3 ${config.className || ""}`, children: /* @__PURE__ */ jsx23("div", { className: "w-full", children: /* @__PURE__ */ jsxs16("div", { className: `flex items-center space-x-1 ${classes.container} bg-muted/30 rounded-lg w-fit`, children: [
23271
+ /* @__PURE__ */ jsx23("div", { className: "flex space-x-1", children: [0, 150, 300].map((delay, i) => /* @__PURE__ */ jsx23(
23100
23272
  "div",
23101
23273
  {
23102
23274
  className: `${classes.dot} rounded-full animate-bounce`,
@@ -23107,7 +23279,7 @@ var TypingDotsAnimation = ({ config }) => {
23107
23279
  },
23108
23280
  i
23109
23281
  )) }),
23110
- config.label && /* @__PURE__ */ jsx22("span", { className: "ml-2 text-sm text-muted-foreground", children: config.label })
23282
+ config.label && /* @__PURE__ */ jsx23("span", { className: "ml-2 text-sm text-muted-foreground", children: config.label })
23111
23283
  ] }) }) });
23112
23284
  };
23113
23285
  var PulseRingAnimation = ({ config }) => {
@@ -23115,16 +23287,16 @@ var PulseRingAnimation = ({ config }) => {
23115
23287
  const sizeMap = { sm: "w-8 h-8", md: "w-12 h-12", lg: "w-16 h-16" };
23116
23288
  const primaryColor = config.primaryColor || "#10B981";
23117
23289
  const secondaryColor = config.secondaryColor || "#34D399";
23118
- return /* @__PURE__ */ jsxs15("div", { className: `flex items-center gap-3 py-3 ${config.className || ""}`, children: [
23119
- /* @__PURE__ */ jsxs15("div", { className: `${sizeMap[size]} relative flex items-center justify-center`, children: [
23120
- /* @__PURE__ */ jsx22(
23290
+ return /* @__PURE__ */ jsxs16("div", { className: `flex items-center gap-3 py-3 ${config.className || ""}`, children: [
23291
+ /* @__PURE__ */ jsxs16("div", { className: `${sizeMap[size]} relative flex items-center justify-center`, children: [
23292
+ /* @__PURE__ */ jsx23(
23121
23293
  "div",
23122
23294
  {
23123
23295
  className: "absolute inset-1 rounded-full animate-pulse",
23124
23296
  style: { background: `linear-gradient(135deg, ${primaryColor}, ${secondaryColor})` }
23125
23297
  }
23126
23298
  ),
23127
- /* @__PURE__ */ jsx22(
23299
+ /* @__PURE__ */ jsx23(
23128
23300
  "div",
23129
23301
  {
23130
23302
  className: "absolute inset-0 rounded-full animate-ping opacity-75",
@@ -23132,7 +23304,7 @@ var PulseRingAnimation = ({ config }) => {
23132
23304
  }
23133
23305
  )
23134
23306
  ] }),
23135
- config.label && /* @__PURE__ */ jsx22("span", { className: "text-sm text-muted-foreground", children: config.label })
23307
+ config.label && /* @__PURE__ */ jsx23("span", { className: "text-sm text-muted-foreground", children: config.label })
23136
23308
  ] });
23137
23309
  };
23138
23310
  var TeacherTypingAnimation = ({ config }) => {
@@ -23141,8 +23313,8 @@ var TeacherTypingAnimation = ({ config }) => {
23141
23313
  const primaryColor = config.primaryColor || "#10B981";
23142
23314
  const secondaryColor = config.secondaryColor || "#34D399";
23143
23315
  const avatar = config.avatar || "\u{1F393}";
23144
- return /* @__PURE__ */ jsxs15("div", { className: `flex items-start gap-3 py-3 ${config.className || ""}`, children: [
23145
- /* @__PURE__ */ jsx22(
23316
+ return /* @__PURE__ */ jsxs16("div", { className: `flex items-start gap-3 py-3 ${config.className || ""}`, children: [
23317
+ /* @__PURE__ */ jsx23(
23146
23318
  "div",
23147
23319
  {
23148
23320
  className: `${classes.avatar} rounded-full flex items-center justify-center shrink-0`,
@@ -23150,9 +23322,9 @@ var TeacherTypingAnimation = ({ config }) => {
23150
23322
  children: avatar
23151
23323
  }
23152
23324
  ),
23153
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
23154
- config.label && /* @__PURE__ */ jsx22("span", { className: "text-xs font-medium text-muted-foreground", children: config.label }),
23155
- /* @__PURE__ */ jsx22("div", { className: `flex items-center space-x-1 ${classes.container} bg-muted/50 rounded-2xl w-fit`, children: /* @__PURE__ */ jsx22("div", { className: "flex space-x-1", children: [0, 200, 400].map((delay, i) => /* @__PURE__ */ jsx22(
23325
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
23326
+ config.label && /* @__PURE__ */ jsx23("span", { className: "text-xs font-medium text-muted-foreground", children: config.label }),
23327
+ /* @__PURE__ */ jsx23("div", { className: `flex items-center space-x-1 ${classes.container} bg-muted/50 rounded-2xl w-fit`, children: /* @__PURE__ */ jsx23("div", { className: "flex space-x-1", children: [0, 200, 400].map((delay, i) => /* @__PURE__ */ jsx23(
23156
23328
  "div",
23157
23329
  {
23158
23330
  className: `${classes.dot} bg-muted-foreground/50 rounded-full`,
@@ -23164,7 +23336,7 @@ var TeacherTypingAnimation = ({ config }) => {
23164
23336
  i
23165
23337
  )) }) })
23166
23338
  ] }),
23167
- /* @__PURE__ */ jsx22("style", { children: `
23339
+ /* @__PURE__ */ jsx23("style", { children: `
23168
23340
  @keyframes typingBounce {
23169
23341
  0%, 60%, 100% { transform: translateY(0); }
23170
23342
  30% { transform: translateY(-6px); }
@@ -23176,15 +23348,15 @@ var SpinnerAnimation = ({ config }) => {
23176
23348
  const size = config.size || "md";
23177
23349
  const sizeMap = { sm: "w-5 h-5", md: "w-8 h-8", lg: "w-10 h-10" };
23178
23350
  const primaryColor = config.primaryColor || "currentColor";
23179
- return /* @__PURE__ */ jsxs15("div", { className: `flex items-center gap-3 py-3 ${config.className || ""}`, children: [
23180
- /* @__PURE__ */ jsx22(
23351
+ return /* @__PURE__ */ jsxs16("div", { className: `flex items-center gap-3 py-3 ${config.className || ""}`, children: [
23352
+ /* @__PURE__ */ jsx23(
23181
23353
  "div",
23182
23354
  {
23183
23355
  className: `${sizeMap[size]} animate-spin rounded-full border-2 border-muted border-t-current`,
23184
23356
  style: primaryColor !== "currentColor" ? { borderTopColor: primaryColor } : void 0
23185
23357
  }
23186
23358
  ),
23187
- config.label && /* @__PURE__ */ jsx22("span", { className: "text-sm text-muted-foreground", children: config.label })
23359
+ config.label && /* @__PURE__ */ jsx23("span", { className: "text-sm text-muted-foreground", children: config.label })
23188
23360
  ] });
23189
23361
  };
23190
23362
  var WaveAnimation = ({ config }) => {
@@ -23192,8 +23364,8 @@ var WaveAnimation = ({ config }) => {
23192
23364
  const barHeights = { sm: "h-4", md: "h-6", lg: "h-8" };
23193
23365
  const barWidths = { sm: "w-1", md: "w-1.5", lg: "w-2" };
23194
23366
  const primaryColor = config.primaryColor || "#6366F1";
23195
- return /* @__PURE__ */ jsxs15("div", { className: `flex items-center gap-3 py-3 ${config.className || ""}`, children: [
23196
- /* @__PURE__ */ jsx22("div", { className: "flex items-end gap-1", children: [0, 100, 200, 300, 400].map((delay, i) => /* @__PURE__ */ jsx22(
23367
+ return /* @__PURE__ */ jsxs16("div", { className: `flex items-center gap-3 py-3 ${config.className || ""}`, children: [
23368
+ /* @__PURE__ */ jsx23("div", { className: "flex items-end gap-1", children: [0, 100, 200, 300, 400].map((delay, i) => /* @__PURE__ */ jsx23(
23197
23369
  "div",
23198
23370
  {
23199
23371
  className: `${barWidths[size]} ${barHeights[size]} rounded-full`,
@@ -23205,8 +23377,8 @@ var WaveAnimation = ({ config }) => {
23205
23377
  },
23206
23378
  i
23207
23379
  )) }),
23208
- config.label && /* @__PURE__ */ jsx22("span", { className: "text-sm text-muted-foreground", children: config.label }),
23209
- /* @__PURE__ */ jsx22("style", { children: `
23380
+ config.label && /* @__PURE__ */ jsx23("span", { className: "text-sm text-muted-foreground", children: config.label }),
23381
+ /* @__PURE__ */ jsx23("style", { children: `
23210
23382
  @keyframes wave {
23211
23383
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
23212
23384
  50% { transform: scaleY(1); opacity: 1; }
@@ -23218,17 +23390,17 @@ var LoadingAnimation = ({ config = {} }) => {
23218
23390
  const preset = config.preset || "typing-dots";
23219
23391
  switch (preset) {
23220
23392
  case "typing-dots":
23221
- return /* @__PURE__ */ jsx22(TypingDotsAnimation, { config });
23393
+ return /* @__PURE__ */ jsx23(TypingDotsAnimation, { config });
23222
23394
  case "pulse-ring":
23223
- return /* @__PURE__ */ jsx22(PulseRingAnimation, { config });
23395
+ return /* @__PURE__ */ jsx23(PulseRingAnimation, { config });
23224
23396
  case "teacher-typing":
23225
- return /* @__PURE__ */ jsx22(TeacherTypingAnimation, { config });
23397
+ return /* @__PURE__ */ jsx23(TeacherTypingAnimation, { config });
23226
23398
  case "spinner":
23227
- return /* @__PURE__ */ jsx22(SpinnerAnimation, { config });
23399
+ return /* @__PURE__ */ jsx23(SpinnerAnimation, { config });
23228
23400
  case "wave":
23229
- return /* @__PURE__ */ jsx22(WaveAnimation, { config });
23401
+ return /* @__PURE__ */ jsx23(WaveAnimation, { config });
23230
23402
  default:
23231
- return /* @__PURE__ */ jsx22(TypingDotsAnimation, { config });
23403
+ return /* @__PURE__ */ jsx23(TypingDotsAnimation, { config });
23232
23404
  }
23233
23405
  };
23234
23406
 
@@ -23236,11 +23408,11 @@ var LoadingAnimation = ({ config = {} }) => {
23236
23408
  import * as React15 from "react";
23237
23409
  import * as SelectPrimitive from "@radix-ui/react-select";
23238
23410
  import { Check as Check2, ChevronDown as ChevronDown2, ChevronUp } from "lucide-react";
23239
- import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
23411
+ import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
23240
23412
  var Select = SelectPrimitive.Root;
23241
23413
  var SelectGroup = SelectPrimitive.Group;
23242
23414
  var SelectValue = SelectPrimitive.Value;
23243
- var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs16(
23415
+ var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs17(
23244
23416
  SelectPrimitive.Trigger,
23245
23417
  {
23246
23418
  ref,
@@ -23251,12 +23423,12 @@ var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref)
23251
23423
  ...props,
23252
23424
  children: [
23253
23425
  children,
23254
- /* @__PURE__ */ jsx23(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx23(ChevronDown2, { className: "h-4 w-4 opacity-50" }) })
23426
+ /* @__PURE__ */ jsx24(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx24(ChevronDown2, { className: "h-4 w-4 opacity-50" }) })
23255
23427
  ]
23256
23428
  }
23257
23429
  ));
23258
23430
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
23259
- var SelectScrollUpButton = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
23431
+ var SelectScrollUpButton = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
23260
23432
  SelectPrimitive.ScrollUpButton,
23261
23433
  {
23262
23434
  ref,
@@ -23265,11 +23437,11 @@ var SelectScrollUpButton = React15.forwardRef(({ className, ...props }, ref) =>
23265
23437
  className
23266
23438
  ),
23267
23439
  ...props,
23268
- children: /* @__PURE__ */ jsx23(ChevronUp, { className: "h-4 w-4" })
23440
+ children: /* @__PURE__ */ jsx24(ChevronUp, { className: "h-4 w-4" })
23269
23441
  }
23270
23442
  ));
23271
23443
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
23272
- var SelectScrollDownButton = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
23444
+ var SelectScrollDownButton = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
23273
23445
  SelectPrimitive.ScrollDownButton,
23274
23446
  {
23275
23447
  ref,
@@ -23278,11 +23450,11 @@ var SelectScrollDownButton = React15.forwardRef(({ className, ...props }, ref) =
23278
23450
  className
23279
23451
  ),
23280
23452
  ...props,
23281
- children: /* @__PURE__ */ jsx23(ChevronDown2, { className: "h-4 w-4" })
23453
+ children: /* @__PURE__ */ jsx24(ChevronDown2, { className: "h-4 w-4" })
23282
23454
  }
23283
23455
  ));
23284
23456
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
23285
- var SelectContent = React15.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx23(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs16(
23457
+ var SelectContent = React15.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx24(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs17(
23286
23458
  SelectPrimitive.Content,
23287
23459
  {
23288
23460
  ref,
@@ -23294,8 +23466,8 @@ var SelectContent = React15.forwardRef(({ className, children, position = "poppe
23294
23466
  position,
23295
23467
  ...props,
23296
23468
  children: [
23297
- /* @__PURE__ */ jsx23(SelectScrollUpButton, {}),
23298
- /* @__PURE__ */ jsx23(
23469
+ /* @__PURE__ */ jsx24(SelectScrollUpButton, {}),
23470
+ /* @__PURE__ */ jsx24(
23299
23471
  SelectPrimitive.Viewport,
23300
23472
  {
23301
23473
  className: cn(
@@ -23305,12 +23477,12 @@ var SelectContent = React15.forwardRef(({ className, children, position = "poppe
23305
23477
  children
23306
23478
  }
23307
23479
  ),
23308
- /* @__PURE__ */ jsx23(SelectScrollDownButton, {})
23480
+ /* @__PURE__ */ jsx24(SelectScrollDownButton, {})
23309
23481
  ]
23310
23482
  }
23311
23483
  ) }));
23312
23484
  SelectContent.displayName = SelectPrimitive.Content.displayName;
23313
- var SelectLabel = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
23485
+ var SelectLabel = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
23314
23486
  SelectPrimitive.Label,
23315
23487
  {
23316
23488
  ref,
@@ -23319,7 +23491,7 @@ var SelectLabel = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
23319
23491
  }
23320
23492
  ));
23321
23493
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
23322
- var SelectItem = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs16(
23494
+ var SelectItem = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs17(
23323
23495
  SelectPrimitive.Item,
23324
23496
  {
23325
23497
  ref,
@@ -23329,13 +23501,13 @@ var SelectItem = React15.forwardRef(({ className, children, ...props }, ref) =>
23329
23501
  ),
23330
23502
  ...props,
23331
23503
  children: [
23332
- /* @__PURE__ */ jsx23("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx23(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx23(Check2, { className: "h-4 w-4" }) }) }),
23333
- /* @__PURE__ */ jsx23(SelectPrimitive.ItemText, { children })
23504
+ /* @__PURE__ */ jsx24("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx24(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx24(Check2, { className: "h-4 w-4" }) }) }),
23505
+ /* @__PURE__ */ jsx24(SelectPrimitive.ItemText, { children })
23334
23506
  ]
23335
23507
  }
23336
23508
  ));
23337
23509
  SelectItem.displayName = SelectPrimitive.Item.displayName;
23338
- var SelectSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx23(
23510
+ var SelectSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
23339
23511
  SelectPrimitive.Separator,
23340
23512
  {
23341
23513
  ref,
@@ -23346,13 +23518,13 @@ var SelectSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @_
23346
23518
  SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
23347
23519
 
23348
23520
  // src/hooks/useTts.ts
23349
- import { useCallback as useCallback15, useRef as useRef10, useState as useState16 } from "react";
23521
+ import { useCallback as useCallback16, useRef as useRef10, useState as useState17 } from "react";
23350
23522
  var useTts = (config = {}) => {
23351
23523
  const baseUrl = config.baseUrl || "http://localhost:8080/v1";
23352
- const [isSynthesizing, setIsSynthesizing] = useState16(false);
23524
+ const [isSynthesizing, setIsSynthesizing] = useState17(false);
23353
23525
  const wsRef = useRef10(null);
23354
23526
  const audioContextRef = useRef10(null);
23355
- const synthesize = useCallback15(async (request) => {
23527
+ const synthesize = useCallback16(async (request) => {
23356
23528
  const authHeader = config.accessToken ? `Bearer ${config.accessToken}` : void 0;
23357
23529
  const response = await fetch(`${baseUrl}/tts/synthesize`, {
23358
23530
  method: "POST",
@@ -23368,7 +23540,7 @@ var useTts = (config = {}) => {
23368
23540
  }
23369
23541
  return response.blob();
23370
23542
  }, [baseUrl, config.accessToken]);
23371
- const getAvailableVoices = useCallback15(async () => {
23543
+ const getAvailableVoices = useCallback16(async () => {
23372
23544
  const authHeader = config.accessToken ? `Bearer ${config.accessToken}` : void 0;
23373
23545
  const response = await fetch(`${baseUrl}/tts/voices`, {
23374
23546
  headers: {
@@ -23380,7 +23552,7 @@ var useTts = (config = {}) => {
23380
23552
  }
23381
23553
  return response.json();
23382
23554
  }, [baseUrl, config.accessToken]);
23383
- const playAudio = useCallback15((audioBlob) => {
23555
+ const playAudio = useCallback16((audioBlob) => {
23384
23556
  const audioUrl = URL.createObjectURL(audioBlob);
23385
23557
  const audio = new Audio(audioUrl);
23386
23558
  return new Promise((resolve, reject) => {
@@ -23395,7 +23567,7 @@ var useTts = (config = {}) => {
23395
23567
  audio.play().catch(reject);
23396
23568
  });
23397
23569
  }, []);
23398
- const streamingPlayAudio = useCallback15((audioChunks) => {
23570
+ const streamingPlayAudio = useCallback16((audioChunks) => {
23399
23571
  if (!audioContextRef.current) {
23400
23572
  audioContextRef.current = new AudioContext();
23401
23573
  }
@@ -23422,7 +23594,7 @@ var useTts = (config = {}) => {
23422
23594
  })();
23423
23595
  });
23424
23596
  }, []);
23425
- const startStreamingTts = useCallback15((options = {}) => {
23597
+ const startStreamingTts = useCallback16((options = {}) => {
23426
23598
  if (isSynthesizing) {
23427
23599
  throw new Error("Streaming TTS already in progress");
23428
23600
  }
@@ -23490,7 +23662,7 @@ var useTts = (config = {}) => {
23490
23662
  }
23491
23663
  };
23492
23664
  }, [isSynthesizing, baseUrl]);
23493
- const stopStreamingTts = useCallback15(() => {
23665
+ const stopStreamingTts = useCallback16(() => {
23494
23666
  if (wsRef.current) {
23495
23667
  wsRef.current.close();
23496
23668
  wsRef.current = null;
@@ -23509,7 +23681,7 @@ var useTts = (config = {}) => {
23509
23681
  };
23510
23682
 
23511
23683
  // src/components/ChatEmptyState.tsx
23512
- import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
23684
+ import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
23513
23685
  var DefaultChatEmptyState = ({ controller, options, maxWidth }) => {
23514
23686
  const disabled = controller.isLoading || controller.isStreaming;
23515
23687
  const categories = options?.categories ?? [];
@@ -23531,7 +23703,7 @@ var DefaultChatEmptyState = ({ controller, options, maxWidth }) => {
23531
23703
  const renderStarter = (starter, layout) => {
23532
23704
  const variant = starter.variant ?? "outline";
23533
23705
  const isGrid = layout === "grid";
23534
- return /* @__PURE__ */ jsxs17(
23706
+ return /* @__PURE__ */ jsxs18(
23535
23707
  Button,
23536
23708
  {
23537
23709
  type: "button",
@@ -23545,44 +23717,44 @@ var DefaultChatEmptyState = ({ controller, options, maxWidth }) => {
23545
23717
  },
23546
23718
  disabled,
23547
23719
  children: [
23548
- starter.icon && /* @__PURE__ */ jsx24("span", { className: `text-lg ${isGrid ? "" : "mr-2"}`, children: starter.icon }),
23549
- /* @__PURE__ */ jsxs17("span", { className: `flex flex-col ${isGrid ? "items-center text-center" : "items-start"} gap-1`, children: [
23550
- /* @__PURE__ */ jsx24("span", { className: "font-medium text-foreground", children: starter.label }),
23551
- starter.description ? /* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: starter.description }) : null
23720
+ starter.icon && /* @__PURE__ */ jsx25("span", { className: `text-lg ${isGrid ? "" : "mr-2"}`, children: starter.icon }),
23721
+ /* @__PURE__ */ jsxs18("span", { className: `flex flex-col ${isGrid ? "items-center text-center" : "items-start"} gap-1`, children: [
23722
+ /* @__PURE__ */ jsx25("span", { className: "font-medium text-foreground", children: starter.label }),
23723
+ starter.description ? /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: starter.description }) : null
23552
23724
  ] })
23553
23725
  ]
23554
23726
  },
23555
23727
  starter.id ?? starter.label
23556
23728
  );
23557
23729
  };
23558
- return /* @__PURE__ */ jsx24("div", { className: "py-4 sm:py-8", children: /* @__PURE__ */ jsx24(
23730
+ return /* @__PURE__ */ jsx25("div", { className: "py-4 sm:py-8", children: /* @__PURE__ */ jsx25(
23559
23731
  "div",
23560
23732
  {
23561
23733
  className: "mx-auto w-full px-2",
23562
23734
  style: maxWidth ? { maxWidth } : void 0,
23563
- children: /* @__PURE__ */ jsx24("div", { className: "", children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-6", children: [
23564
- controller.composer ? /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
23735
+ children: /* @__PURE__ */ jsx25("div", { className: "", children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-6", children: [
23736
+ controller.composer ? /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2", children: [
23565
23737
  controller.composer,
23566
- options?.promptHelperText ? /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground text-center sm:text-left", children: options.promptHelperText }) : null
23738
+ options?.promptHelperText ? /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground text-center sm:text-left", children: options.promptHelperText }) : null
23567
23739
  ] }) : null,
23568
- categories.length > 0 ? /* @__PURE__ */ jsxs17("div", { className: "space-y-1 p-1", children: [
23569
- options?.categoriesLabel ? /* @__PURE__ */ jsx24("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: options.categoriesLabel }) : null,
23570
- options?.startersLabel ? /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium text-muted-foreground", children: options.startersLabel }) : null,
23571
- /* @__PURE__ */ jsx24("div", { className: "flex flex-col gap-3", children: categories.map((category) => {
23740
+ categories.length > 0 ? /* @__PURE__ */ jsxs18("div", { className: "space-y-1 p-1", children: [
23741
+ options?.categoriesLabel ? /* @__PURE__ */ jsx25("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: options.categoriesLabel }) : null,
23742
+ options?.startersLabel ? /* @__PURE__ */ jsx25("p", { className: "text-sm font-medium text-muted-foreground", children: options.startersLabel }) : null,
23743
+ /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-3", children: categories.map((category) => {
23572
23744
  const categoryLayout = category.layout ?? defaultLayout;
23573
- return /* @__PURE__ */ jsxs17(
23745
+ return /* @__PURE__ */ jsxs18(
23574
23746
  "div",
23575
23747
  {
23576
23748
  className: "bg-background/70 p-1 sm:p-4",
23577
23749
  children: [
23578
- category.title || category.description || category.icon ? /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-2 mb-3", children: [
23579
- category.icon && /* @__PURE__ */ jsx24("span", { className: "text-xl", children: category.icon }),
23580
- /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
23581
- category.title ? /* @__PURE__ */ jsx24("h3", { className: "text-xs font-semibold text-foreground", children: category.title }) : null,
23582
- category.description ? /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: category.description }) : null
23750
+ category.title || category.description || category.icon ? /* @__PURE__ */ jsxs18("div", { className: "flex items-start gap-2 mb-3", children: [
23751
+ category.icon && /* @__PURE__ */ jsx25("span", { className: "text-xl", children: category.icon }),
23752
+ /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1", children: [
23753
+ category.title ? /* @__PURE__ */ jsx25("h3", { className: "text-xs font-semibold text-foreground", children: category.title }) : null,
23754
+ category.description ? /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: category.description }) : null
23583
23755
  ] })
23584
23756
  ] }) : null,
23585
- category.starters && category.starters.length > 0 ? /* @__PURE__ */ jsx24("div", { className: categoryLayout === "grid" ? "grid grid-cols-2 sm:grid-cols-3 gap-2" : "flex flex-col gap-2", children: category.starters.map((starter) => renderStarter(starter, categoryLayout)) }) : null
23757
+ category.starters && category.starters.length > 0 ? /* @__PURE__ */ jsx25("div", { className: categoryLayout === "grid" ? "grid grid-cols-2 sm:grid-cols-3 gap-2" : "flex flex-col gap-2", children: category.starters.map((starter) => renderStarter(starter, categoryLayout)) }) : null
23586
23758
  ]
23587
23759
  },
23588
23760
  category.id
@@ -23595,7 +23767,7 @@ var DefaultChatEmptyState = ({ controller, options, maxWidth }) => {
23595
23767
  };
23596
23768
 
23597
23769
  // src/hooks/useChatMessages.ts
23598
- import { useCallback as useCallback16, useEffect as useEffect13, useState as useState17, useRef as useRef11 } from "react";
23770
+ import { useCallback as useCallback17, useEffect as useEffect14, useState as useState18, useRef as useRef11 } from "react";
23599
23771
 
23600
23772
  // ../core/src/encoder.ts
23601
23773
  function convertA2AMessageToDistri(a2aMessage) {
@@ -23905,27 +24077,27 @@ function useChatMessages({
23905
24077
  } = {}) {
23906
24078
  const onErrorRef = useRef11(onError);
23907
24079
  const { client } = useDistri();
23908
- useEffect13(() => {
24080
+ useEffect14(() => {
23909
24081
  onErrorRef.current = onError;
23910
24082
  }, [onError]);
23911
- const [messages, setMessages] = useState17(initialMessages);
23912
- const [isLoading, setIsLoading] = useState17(false);
23913
- const [error, setError] = useState17(null);
24083
+ const [messages, setMessages] = useState18(initialMessages);
24084
+ const [isLoading, setIsLoading] = useState18(false);
24085
+ const [error, setError] = useState18(null);
23914
24086
  const initialMessagesLength = initialMessages.length;
23915
- useEffect13(() => {
24087
+ useEffect14(() => {
23916
24088
  if (initialMessages.length > 0) {
23917
24089
  setMessages(initialMessages);
23918
24090
  }
23919
24091
  }, [initialMessages]);
23920
- const addMessage = useCallback16((message) => {
24092
+ const addMessage = useCallback17((message) => {
23921
24093
  setMessages((prev) => {
23922
24094
  return [...prev, message];
23923
24095
  });
23924
24096
  }, []);
23925
- const clearMessages = useCallback16(() => {
24097
+ const clearMessages = useCallback17(() => {
23926
24098
  setMessages([]);
23927
24099
  }, []);
23928
- const fetchMessages = useCallback16(async () => {
24100
+ const fetchMessages = useCallback17(async () => {
23929
24101
  if (!client || !threadId) return;
23930
24102
  try {
23931
24103
  setIsLoading(true);
@@ -23941,7 +24113,7 @@ function useChatMessages({
23941
24113
  setIsLoading(false);
23942
24114
  }
23943
24115
  }, [client, threadId]);
23944
- useEffect13(() => {
24116
+ useEffect14(() => {
23945
24117
  if (threadId && client && !initialMessagesLength && enabled) {
23946
24118
  fetchMessages();
23947
24119
  }
@@ -23957,9 +24129,9 @@ function useChatMessages({
23957
24129
  }
23958
24130
 
23959
24131
  // src/components/AuthLoading.tsx
23960
- import { useEffect as useEffect14, useRef as useRef12, useMemo as useMemo5 } from "react";
24132
+ import { useEffect as useEffect15, useRef as useRef12, useMemo as useMemo5 } from "react";
23961
24133
  import { Loader2 as Loader24, AlertCircle as AlertCircle2 } from "lucide-react";
23962
- import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
24134
+ import { Fragment as Fragment5, jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
23963
24135
  var AuthLoading = ({
23964
24136
  children,
23965
24137
  className = ""
@@ -23977,7 +24149,7 @@ var AuthLoading = ({
23977
24149
  } = useDistriAuth();
23978
24150
  const iframeRef = useRef12(null);
23979
24151
  const timeoutRef = useRef12(null);
23980
- useEffect14(() => {
24152
+ useEffect15(() => {
23981
24153
  if (status !== "loading") return;
23982
24154
  if (config.debug) console.log("[AuthWorker] Starting authentication phase");
23983
24155
  iframeRef.current?.contentWindow?.postMessage({ type: "distri:refresh_token" }, "*");
@@ -24030,10 +24202,10 @@ var AuthLoading = ({
24030
24202
  }, [config]);
24031
24203
  const containerClass = `relative flex flex-col items-center justify-center p-8 text-center min-h-[400px] w-full bg-background animate-in fade-in duration-300 ${className}`;
24032
24204
  if (status === "loading") {
24033
- return /* @__PURE__ */ jsxs18("div", { className: containerClass, children: [
24034
- /* @__PURE__ */ jsx25(Loader24, { className: "h-8 w-8 animate-spin text-primary mb-4" }),
24035
- /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground font-sans text-sm animate-pulse font-medium", children: "Initializing Security\u2026" }),
24036
- /* @__PURE__ */ jsx25(
24205
+ return /* @__PURE__ */ jsxs19("div", { className: containerClass, children: [
24206
+ /* @__PURE__ */ jsx26(Loader24, { className: "h-8 w-8 animate-spin text-primary mb-4" }),
24207
+ /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground font-sans text-sm animate-pulse font-medium", children: "Initializing Security\u2026" }),
24208
+ /* @__PURE__ */ jsx26(
24037
24209
  "iframe",
24038
24210
  {
24039
24211
  ref: iframeRef,
@@ -24053,11 +24225,11 @@ var AuthLoading = ({
24053
24225
  ] });
24054
24226
  }
24055
24227
  if (status === "error") {
24056
- return /* @__PURE__ */ jsxs18("div", { className: containerClass, children: [
24057
- /* @__PURE__ */ jsx25(AlertCircle2, { className: "h-12 w-12 text-destructive mb-4" }),
24058
- /* @__PURE__ */ jsx25("h2", { className: "text-lg font-semibold text-foreground mb-2", children: "Authentication Failed" }),
24059
- /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground font-sans text-sm mb-6 max-w-xs", children: error || "Could not establish a secure connection." }),
24060
- /* @__PURE__ */ jsx25(
24228
+ return /* @__PURE__ */ jsxs19("div", { className: containerClass, children: [
24229
+ /* @__PURE__ */ jsx26(AlertCircle2, { className: "h-12 w-12 text-destructive mb-4" }),
24230
+ /* @__PURE__ */ jsx26("h2", { className: "text-lg font-semibold text-foreground mb-2", children: "Authentication Failed" }),
24231
+ /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground font-sans text-sm mb-6 max-w-xs", children: error || "Could not establish a secure connection." }),
24232
+ /* @__PURE__ */ jsx26(
24061
24233
  "button",
24062
24234
  {
24063
24235
  onClick: () => requestAuth(),
@@ -24067,21 +24239,51 @@ var AuthLoading = ({
24067
24239
  )
24068
24240
  ] });
24069
24241
  }
24070
- return /* @__PURE__ */ jsx25(Fragment5, { children });
24242
+ return /* @__PURE__ */ jsx26(Fragment5, { children });
24071
24243
  };
24072
24244
 
24073
24245
  // src/components/Chat.tsx
24074
24246
  import { AlertCircle as AlertCircle3, Loader2 as Loader25 } from "lucide-react";
24075
- import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
24247
+ import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
24076
24248
  var RendererWrapper2 = ({
24077
24249
  children,
24078
24250
  className = ""
24079
- }) => /* @__PURE__ */ jsx26("div", { className: `max-w-3xl mx-auto w-full ${className}`, children });
24251
+ }) => /* @__PURE__ */ jsx27("div", { className: `max-w-3xl mx-auto w-full ${className}`, children });
24080
24252
  var getThemeClasses = (theme) => {
24081
24253
  if (theme === "dark") return "dark";
24082
24254
  if (theme === "light") return "light";
24083
24255
  return "";
24084
24256
  };
24257
+ function formatTokenCount(tokens) {
24258
+ if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1)}M`;
24259
+ if (tokens >= 1e3) return `${(tokens / 1e3).toFixed(1)}k`;
24260
+ return String(tokens);
24261
+ }
24262
+ var ThreadTokensBanner = ({ thread }) => {
24263
+ if (!thread || !(thread.total_tokens ?? 0)) return null;
24264
+ return /* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-center gap-3 py-1.5 text-[11px] text-muted-foreground/70", children: [
24265
+ /* @__PURE__ */ jsxs20("span", { children: [
24266
+ /* @__PURE__ */ jsx27("span", { className: "opacity-60", children: "In:" }),
24267
+ " ",
24268
+ /* @__PURE__ */ jsx27("span", { className: "font-medium text-muted-foreground", children: formatTokenCount(thread.input_tokens ?? 0) })
24269
+ ] }),
24270
+ /* @__PURE__ */ jsx27("span", { className: "opacity-30", children: "\xB7" }),
24271
+ /* @__PURE__ */ jsxs20("span", { children: [
24272
+ /* @__PURE__ */ jsx27("span", { className: "opacity-60", children: "Out:" }),
24273
+ " ",
24274
+ /* @__PURE__ */ jsx27("span", { className: "font-medium text-muted-foreground", children: formatTokenCount(thread.output_tokens ?? 0) })
24275
+ ] }),
24276
+ /* @__PURE__ */ jsx27("span", { className: "opacity-30", children: "\xB7" }),
24277
+ /* @__PURE__ */ jsxs20("span", { children: [
24278
+ /* @__PURE__ */ jsx27("span", { className: "opacity-60", children: "Total:" }),
24279
+ " ",
24280
+ /* @__PURE__ */ jsxs20("span", { className: "font-medium text-foreground/70", children: [
24281
+ formatTokenCount(thread.total_tokens ?? 0),
24282
+ " tokens"
24283
+ ] })
24284
+ ] })
24285
+ ] });
24286
+ };
24085
24287
  var ChatInner = forwardRef5(function ChatInner2({
24086
24288
  threadId,
24087
24289
  agent: agent2,
@@ -24115,24 +24317,24 @@ var ChatInner = forwardRef5(function ChatInner2({
24115
24317
  debug = false,
24116
24318
  enableFeedback = false
24117
24319
  }, ref) {
24118
- const [input, setInput] = useState18(initialInput ?? "");
24320
+ const [input, setInput] = useState19(initialInput ?? "");
24119
24321
  const initialInputRef = useRef13(initialInput ?? "");
24120
- const [expandedTools, setExpandedTools] = useState18(/* @__PURE__ */ new Set());
24322
+ const [expandedTools, setExpandedTools] = useState19(/* @__PURE__ */ new Set());
24121
24323
  const messagesEndRef = useRef13(null);
24122
- const [pendingMessage, setPendingMessage] = useState18(null);
24123
- const [attachedImages, setAttachedImages] = useState18([]);
24124
- const [isDragOver, setIsDragOver] = useState18(false);
24324
+ const [pendingMessage, setPendingMessage] = useState19(null);
24325
+ const [attachedImages, setAttachedImages] = useState19([]);
24326
+ const [isDragOver, setIsDragOver] = useState19(false);
24125
24327
  const speechToText = useSpeechToText();
24126
24328
  const tts = useTts();
24127
- const [isStreamingVoice, setIsStreamingVoice] = useState18(false);
24128
- const [streamingTranscript, setStreamingTranscript] = useState18("");
24129
- const [audioChunks, setAudioChunks] = useState18([]);
24130
- const [browserEnabled, setBrowserEnabled] = useState18(false);
24329
+ const [isStreamingVoice, setIsStreamingVoice] = useState19(false);
24330
+ const [streamingTranscript, setStreamingTranscript] = useState19("");
24331
+ const [audioChunks, setAudioChunks] = useState19([]);
24332
+ const [browserEnabled, setBrowserEnabled] = useState19(false);
24131
24333
  const browserViewerUrl = useChatStateStore((state) => state.browserViewerUrl);
24132
24334
  const agentDefinition = useMemo6(() => agent2?.getDefinition(), [agent2]);
24133
24335
  const supportsBrowserStreaming = allowBrowserPreview && Boolean(agentDefinition?.browser_config);
24134
24336
  const browserAgentIdRef = useRef13(void 0);
24135
- useEffect15(() => {
24337
+ useEffect16(() => {
24136
24338
  const agentId = agentDefinition?.id;
24137
24339
  if (!agentDefinition || !supportsBrowserStreaming) {
24138
24340
  setBrowserEnabled(false);
@@ -24145,14 +24347,14 @@ var ChatInner = forwardRef5(function ChatInner2({
24145
24347
  setBrowserEnabled(defaultEnabled);
24146
24348
  }
24147
24349
  }, [agentDefinition, supportsBrowserStreaming]);
24148
- useEffect15(() => {
24350
+ useEffect16(() => {
24149
24351
  if (typeof initialInput === "string" && initialInput !== initialInputRef.current) {
24150
24352
  setInput(initialInput);
24151
24353
  initialInputRef.current = initialInput;
24152
24354
  }
24153
24355
  }, [initialInput]);
24154
24356
  const browserSessionId = useChatStateStore((state) => state.browserSessionId);
24155
- const mergedMetadataProvider = useCallback17(async () => {
24357
+ const mergedMetadataProvider = useCallback18(async () => {
24156
24358
  const baseMetadata = await getMetadataProp?.() ?? {};
24157
24359
  const existingOverrides = baseMetadata.definition_overrides ?? {};
24158
24360
  const overrides = supportsBrowserStreaming ? { ...existingOverrides, use_browser: browserEnabled } : existingOverrides;
@@ -24202,13 +24404,32 @@ var ChatInner = forwardRef5(function ChatInner2({
24202
24404
  const currentThought = useChatStateStore((state) => state.currentThought);
24203
24405
  const currentState = useChatStateStore((state) => state);
24204
24406
  const todos = useChatStateStore((state) => state.todos);
24205
- useEffect15(() => {
24407
+ useEffect16(() => {
24206
24408
  if (onChatStateChange) {
24207
24409
  onChatStateChange(currentState);
24208
24410
  }
24209
24411
  }, [currentState, onChatStateChange]);
24210
24412
  const { client: distriClient } = useDistri();
24211
- const handleToggleBrowser = useCallback17(async (enabled) => {
24413
+ const [threadDetails, setThreadDetails] = useState19(null);
24414
+ const wasStreamingRef = useRef13(false);
24415
+ const refreshThreadDetails = useCallback18(() => {
24416
+ if (distriClient && threadId) {
24417
+ distriClient.getThread(threadId).then(setThreadDetails).catch(() => {
24418
+ });
24419
+ }
24420
+ }, [distriClient, threadId]);
24421
+ useEffect16(() => {
24422
+ if (wasStreamingRef.current && !isStreaming) {
24423
+ refreshThreadDetails();
24424
+ }
24425
+ wasStreamingRef.current = isStreaming;
24426
+ }, [isStreaming, refreshThreadDetails]);
24427
+ useEffect16(() => {
24428
+ if (distriClient && threadId && initialMessages && initialMessages.length > 0) {
24429
+ refreshThreadDetails();
24430
+ }
24431
+ }, [distriClient, threadId]);
24432
+ const handleToggleBrowser = useCallback18(async (enabled) => {
24212
24433
  if (!supportsBrowserStreaming) return;
24213
24434
  setBrowserEnabled(enabled);
24214
24435
  if (enabled && !browserSessionId && distriClient) {
@@ -24220,7 +24441,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24220
24441
  }
24221
24442
  }
24222
24443
  }, [supportsBrowserStreaming, browserSessionId, distriClient]);
24223
- const addImages = useCallback17(async (files) => {
24444
+ const addImages = useCallback18(async (files) => {
24224
24445
  const imageFiles = Array.from(files).filter((file) => file.type.startsWith("image/"));
24225
24446
  for (const file of imageFiles) {
24226
24447
  const id = Date.now().toString() + Math.random().toString(36).substring(2, 11);
@@ -24234,7 +24455,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24234
24455
  setAttachedImages((prev) => [...prev, newImage]);
24235
24456
  }
24236
24457
  }, []);
24237
- const removeImage = useCallback17((id) => {
24458
+ const removeImage = useCallback18((id) => {
24238
24459
  setAttachedImages((prev) => {
24239
24460
  const image = prev.find((img) => img.id === id);
24240
24461
  if (image) {
@@ -24243,19 +24464,19 @@ var ChatInner = forwardRef5(function ChatInner2({
24243
24464
  return prev.filter((img) => img.id !== id);
24244
24465
  });
24245
24466
  }, []);
24246
- const handleDragOver = useCallback17((e) => {
24467
+ const handleDragOver = useCallback18((e) => {
24247
24468
  e.preventDefault();
24248
24469
  e.stopPropagation();
24249
24470
  setIsDragOver(true);
24250
24471
  }, []);
24251
- const handleDragLeave = useCallback17((e) => {
24472
+ const handleDragLeave = useCallback18((e) => {
24252
24473
  e.preventDefault();
24253
24474
  e.stopPropagation();
24254
24475
  if (!e.currentTarget.contains(e.relatedTarget)) {
24255
24476
  setIsDragOver(false);
24256
24477
  }
24257
24478
  }, []);
24258
- const handleDrop2 = useCallback17((e) => {
24479
+ const handleDrop2 = useCallback18((e) => {
24259
24480
  e.preventDefault();
24260
24481
  e.stopPropagation();
24261
24482
  setIsDragOver(false);
@@ -24264,13 +24485,13 @@ var ChatInner = forwardRef5(function ChatInner2({
24264
24485
  addImages(files);
24265
24486
  }
24266
24487
  }, [addImages]);
24267
- const contentToParts = useCallback17((content) => {
24488
+ const contentToParts = useCallback18((content) => {
24268
24489
  if (typeof content === "string") {
24269
24490
  return [{ part_type: "text", data: content }];
24270
24491
  }
24271
24492
  return content;
24272
24493
  }, []);
24273
- const handleSendMessage = useCallback17(async (content) => {
24494
+ const handleSendMessage = useCallback18(async (content) => {
24274
24495
  if (typeof content === "string" && !content.trim()) return;
24275
24496
  if (Array.isArray(content) && content.length === 0) return;
24276
24497
  setInput("");
@@ -24285,12 +24506,12 @@ var ChatInner = forwardRef5(function ChatInner2({
24285
24506
  await sendMessage(content);
24286
24507
  }
24287
24508
  }, [sendMessage, isStreaming, contentToParts]);
24288
- const handleStopStreaming = useCallback17(() => {
24509
+ const handleStopStreaming = useCallback18(() => {
24289
24510
  console.log("handleStopStreaming called, about to call stopStreaming()");
24290
24511
  stopStreaming();
24291
24512
  useChatStateStore.getState().resetStreamingStates();
24292
24513
  }, [stopStreaming]);
24293
- const handleTriggerTool = useCallback17(async (toolName, input2) => {
24514
+ const handleTriggerTool = useCallback18(async (toolName, input2) => {
24294
24515
  const toolCallId = `manual_${Date.now()}_${Math.random().toString(36).substring(2, 11)} `;
24295
24516
  const toolCall = {
24296
24517
  tool_call_id: toolCallId,
@@ -24305,7 +24526,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24305
24526
  console.error("Tool not found:", toolName);
24306
24527
  }
24307
24528
  }, []);
24308
- const handleVoiceRecord = useCallback17(async (audioBlob) => {
24529
+ const handleVoiceRecord = useCallback18(async (audioBlob) => {
24309
24530
  try {
24310
24531
  if (!voiceEnabled || !speechToText) {
24311
24532
  console.error("Voice recording not properly configured - missing speechToText");
@@ -24323,7 +24544,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24323
24544
  }
24324
24545
  }
24325
24546
  }, [voiceEnabled, speechToText, handleSendMessage, onError]);
24326
- const startStreamingVoice = useCallback17(async () => {
24547
+ const startStreamingVoice = useCallback18(async () => {
24327
24548
  if (!voiceEnabled || isStreamingVoice || !speechToText) {
24328
24549
  console.error("Cannot start streaming voice - missing requirements");
24329
24550
  return;
@@ -24375,7 +24596,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24375
24596
  setIsStreamingVoice(false);
24376
24597
  }
24377
24598
  }, [voiceEnabled, isStreamingVoice, speechToText, tts, ttsConfig, handleSendMessage, onError, audioChunks]);
24378
- const stopStreamingVoice = useCallback17(() => {
24599
+ const stopStreamingVoice = useCallback18(() => {
24379
24600
  if (!isStreamingVoice) return;
24380
24601
  if (speechToText) {
24381
24602
  speechToText.stopStreamingTranscription();
@@ -24385,12 +24606,12 @@ var ChatInner = forwardRef5(function ChatInner2({
24385
24606
  setStreamingTranscript("");
24386
24607
  setAudioChunks([]);
24387
24608
  }, [isStreamingVoice, speechToText, tts]);
24388
- const handleSpeechTranscript = useCallback17(async (transcript) => {
24609
+ const handleSpeechTranscript = useCallback18(async (transcript) => {
24389
24610
  if (transcript.trim()) {
24390
24611
  await handleSendMessage(transcript);
24391
24612
  }
24392
24613
  }, [handleSendMessage]);
24393
- useEffect15(() => {
24614
+ useEffect16(() => {
24394
24615
  const sendPendingMessage = async () => {
24395
24616
  if (!isStreaming && pendingMessage && pendingMessage.length > 0) {
24396
24617
  console.log("Streaming ended, sending pending message parts:", pendingMessage);
@@ -24405,7 +24626,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24405
24626
  };
24406
24627
  sendPendingMessage();
24407
24628
  }, [isStreaming, pendingMessage, sendMessage]);
24408
- useEffect15(() => {
24629
+ useEffect16(() => {
24409
24630
  if (!voiceEnabled || !ttsConfig || isStreamingVoice) return;
24410
24631
  const lastMessage = messages[messages.length - 1];
24411
24632
  if (lastMessage && "role" in lastMessage && lastMessage.role === "assistant" && "content" in lastMessage && typeof lastMessage.content === "string") {
@@ -24430,13 +24651,13 @@ var ChatInner = forwardRef5(function ChatInner2({
24430
24651
  streamingTranscript: voiceEnabled && speechToText ? streamingTranscript : void 0
24431
24652
  }), [handleSendMessage, handleStopStreaming, handleTriggerTool, isStreaming, isLoading, voiceEnabled, speechToText, startStreamingVoice, stopStreamingVoice, isStreamingVoice, streamingTranscript]);
24432
24653
  useImperativeHandle(ref, () => chatInstance, [chatInstance]);
24433
- useEffect15(() => {
24654
+ useEffect16(() => {
24434
24655
  if (onChatInstanceReady) {
24435
24656
  onChatInstanceReady(chatInstance);
24436
24657
  }
24437
24658
  }, [onChatInstanceReady, chatInstance]);
24438
24659
  const completedTaskIdsRef = useRef13(/* @__PURE__ */ new Set());
24439
- useEffect15(() => {
24660
+ useEffect16(() => {
24440
24661
  if (!onTaskFinish) return;
24441
24662
  const unsub = useChatStateStore.subscribe((state) => state.tasks);
24442
24663
  const tasks = useChatStateStore.getState().tasks;
@@ -24448,7 +24669,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24448
24669
  });
24449
24670
  return () => unsub();
24450
24671
  }, [onTaskFinish]);
24451
- const toggleToolExpansion = useCallback17((toolId) => {
24672
+ const toggleToolExpansion = useCallback18((toolId) => {
24452
24673
  setExpandedTools((prev) => {
24453
24674
  const newSet = new Set(prev);
24454
24675
  if (newSet.has(toolId)) {
@@ -24459,10 +24680,10 @@ var ChatInner = forwardRef5(function ChatInner2({
24459
24680
  return newSet;
24460
24681
  });
24461
24682
  }, []);
24462
- useEffect15(() => {
24683
+ useEffect16(() => {
24463
24684
  messagesEndRef.current?.scrollIntoView({ behavior: "smooth" });
24464
24685
  }, [messages]);
24465
- useEffect15(() => {
24686
+ useEffect16(() => {
24466
24687
  const newExpanded = new Set(expandedTools);
24467
24688
  let hasChanges = false;
24468
24689
  toolCalls.forEach((toolCall) => {
@@ -24480,7 +24701,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24480
24701
  const renderMessages = () => {
24481
24702
  const elements = [];
24482
24703
  messages.forEach((message, index) => {
24483
- const renderedMessage = /* @__PURE__ */ jsx26(
24704
+ const renderedMessage = /* @__PURE__ */ jsx27(
24484
24705
  MessageRenderer,
24485
24706
  {
24486
24707
  message,
@@ -24510,13 +24731,13 @@ var ChatInner = forwardRef5(function ChatInner2({
24510
24731
  );
24511
24732
  externalToolCalls.forEach((toolCall) => {
24512
24733
  elements.push(
24513
- /* @__PURE__ */ jsx26(RendererWrapper2, { children: toolCall.component }, `external-tool-${toolCall.tool_call_id}`)
24734
+ /* @__PURE__ */ jsx27(RendererWrapper2, { children: toolCall.component }, `external-tool-${toolCall.tool_call_id}`)
24514
24735
  );
24515
24736
  });
24516
24737
  return elements;
24517
24738
  };
24518
24739
  const showEmptyState = messages.length === 0 && !isLoading && !error;
24519
- const submitFromEmptyState = useCallback17(async (value) => {
24740
+ const submitFromEmptyState = useCallback18(async (value) => {
24520
24741
  console.log("[Chat] submitFromEmptyState called with:", value);
24521
24742
  if (typeof value === "string" || Array.isArray(value)) {
24522
24743
  console.log("[Chat] Sending message:", value);
@@ -24526,7 +24747,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24526
24747
  console.log("[Chat] Sending input:", input);
24527
24748
  await handleSendMessage(input);
24528
24749
  }, [handleSendMessage, input]);
24529
- const setComposerInput = useCallback17((value) => {
24750
+ const setComposerInput = useCallback18((value) => {
24530
24751
  setInput(value);
24531
24752
  }, [setInput]);
24532
24753
  const emptyStateController = useMemo6(() => ({
@@ -24536,9 +24757,9 @@ var ChatInner = forwardRef5(function ChatInner2({
24536
24757
  isLoading,
24537
24758
  isStreaming
24538
24759
  }), [input, setComposerInput, submitFromEmptyState, isLoading, isStreaming]);
24539
- const renderComposer = useCallback17((variant, className2) => {
24760
+ const renderComposer = useCallback18((variant, className2) => {
24540
24761
  const basePlaceholder = showEmptyState && emptyState?.promptPlaceholder ? emptyState.promptPlaceholder : "Type your message\u2026";
24541
- return /* @__PURE__ */ jsx26(
24762
+ return /* @__PURE__ */ jsx27(
24542
24763
  ChatInput,
24543
24764
  {
24544
24765
  value: input,
@@ -24596,7 +24817,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24596
24817
  const className2 = maxWidth ? baseClass : `${baseClass} max-w-2xl`;
24597
24818
  const composer = renderComposer("hero", className2);
24598
24819
  if (maxWidth) {
24599
- return /* @__PURE__ */ jsx26("div", { style: { maxWidth }, children: composer });
24820
+ return /* @__PURE__ */ jsx27("div", { style: { maxWidth }, children: composer });
24600
24821
  }
24601
24822
  return composer;
24602
24823
  }, [renderComposer, maxWidth]);
@@ -24612,7 +24833,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24612
24833
  if (renderEmptyState) {
24613
24834
  return renderEmptyState(controllerWithComposer);
24614
24835
  }
24615
- return /* @__PURE__ */ jsx26(DefaultChatEmptyState, { controller: controllerWithComposer, options: emptyState, maxWidth });
24836
+ return /* @__PURE__ */ jsx27(DefaultChatEmptyState, { controller: controllerWithComposer, options: emptyState, maxWidth });
24616
24837
  }, [showEmptyState, renderEmptyState, controllerWithComposer, emptyState, maxWidth]);
24617
24838
  const shouldRenderFooterComposer = !showEmptyState || Boolean(renderEmptyState);
24618
24839
  const footerHasContent = shouldRenderFooterComposer || models && models.length > 0 || voiceEnabled && speechToText && (isStreamingVoice || streamingTranscript);
@@ -24620,14 +24841,14 @@ var ChatInner = forwardRef5(function ChatInner2({
24620
24841
  const renderThinkingIndicator = () => {
24621
24842
  if (streamingIndicator === "typing") {
24622
24843
  if (renderLoadingAnimation) {
24623
- return /* @__PURE__ */ jsx26(RendererWrapper2, { className: "distri-typing-indicator", children: renderLoadingAnimation() }, `typing-indicator`);
24844
+ return /* @__PURE__ */ jsx27(RendererWrapper2, { className: "distri-typing-indicator", children: renderLoadingAnimation() }, `typing-indicator`);
24624
24845
  }
24625
24846
  if (loadingAnimation) {
24626
- return /* @__PURE__ */ jsx26(RendererWrapper2, { className: "distri-typing-indicator", children: /* @__PURE__ */ jsx26(LoadingAnimation, { config: loadingAnimation }) }, `typing-indicator`);
24847
+ return /* @__PURE__ */ jsx27(RendererWrapper2, { className: "distri-typing-indicator", children: /* @__PURE__ */ jsx27(LoadingAnimation, { config: loadingAnimation }) }, `typing-indicator`);
24627
24848
  }
24628
- return /* @__PURE__ */ jsx26(RendererWrapper2, { className: "distri-typing-indicator", children: /* @__PURE__ */ jsx26(TypingIndicator, {}) }, `typing-indicator`);
24849
+ return /* @__PURE__ */ jsx27(RendererWrapper2, { className: "distri-typing-indicator", children: /* @__PURE__ */ jsx27(TypingIndicator, {}) }, `typing-indicator`);
24629
24850
  } else if (streamingIndicator) {
24630
- return /* @__PURE__ */ jsx26(RendererWrapper2, { className: "distri-thinking-indicator", children: /* @__PURE__ */ jsx26(
24851
+ return /* @__PURE__ */ jsx27(RendererWrapper2, { className: "distri-thinking-indicator", children: /* @__PURE__ */ jsx27(
24631
24852
  ThinkingRenderer,
24632
24853
  {
24633
24854
  indicator: streamingIndicator,
@@ -24640,38 +24861,38 @@ var ChatInner = forwardRef5(function ChatInner2({
24640
24861
  const renderPendingMessage = () => {
24641
24862
  if (!pendingMessage || pendingMessage.length === 0) return null;
24642
24863
  const partCount = pendingMessage.length;
24643
- return /* @__PURE__ */ jsx26(RendererWrapper2, { children: /* @__PURE__ */ jsx26("div", { className: "border-l-4 border-yellow-400 bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-r-lg", children: /* @__PURE__ */ jsxs19("div", { className: "flex items-start", children: [
24644
- /* @__PURE__ */ jsx26("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx26("div", { className: "w-2 h-2 bg-yellow-400 rounded-full animate-pulse mt-2" }) }),
24645
- /* @__PURE__ */ jsxs19("div", { className: "ml-3 flex-1", children: [
24646
- /* @__PURE__ */ jsxs19("h3", { className: "text-sm font-medium text-yellow-800 dark:text-yellow-200", children: [
24864
+ return /* @__PURE__ */ jsx27(RendererWrapper2, { children: /* @__PURE__ */ jsx27("div", { className: "border-l-4 border-yellow-400 bg-yellow-50 dark:bg-yellow-900/20 p-4 rounded-r-lg", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-start", children: [
24865
+ /* @__PURE__ */ jsx27("div", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx27("div", { className: "w-2 h-2 bg-yellow-400 rounded-full animate-pulse mt-2" }) }),
24866
+ /* @__PURE__ */ jsxs20("div", { className: "ml-3 flex-1", children: [
24867
+ /* @__PURE__ */ jsxs20("h3", { className: "text-sm font-medium text-yellow-800 dark:text-yellow-200", children: [
24647
24868
  "Message queued (",
24648
24869
  partCount,
24649
24870
  " part",
24650
24871
  partCount > 1 ? "s" : "",
24651
24872
  ")"
24652
24873
  ] }),
24653
- /* @__PURE__ */ jsx26("div", { className: "mt-2", children: /* @__PURE__ */ jsx26("div", { className: "text-sm text-yellow-700 dark:text-yellow-300 bg-white dark:bg-gray-800 p-2 rounded border", children: pendingMessage.map((part, partIndex) => {
24874
+ /* @__PURE__ */ jsx27("div", { className: "mt-2", children: /* @__PURE__ */ jsx27("div", { className: "text-sm text-yellow-700 dark:text-yellow-300 bg-white dark:bg-gray-800 p-2 rounded border", children: pendingMessage.map((part, partIndex) => {
24654
24875
  if (part.part_type === "text") {
24655
- return /* @__PURE__ */ jsx26("span", { className: "block mb-1", children: part.data }, partIndex);
24876
+ return /* @__PURE__ */ jsx27("span", { className: "block mb-1", children: part.data }, partIndex);
24656
24877
  } else if (part.part_type === "image" && typeof part.data === "object" && part.data !== null && "name" in part.data) {
24657
- return /* @__PURE__ */ jsxs19("span", { className: "inline-block text-xs text-muted-foreground bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded mr-2 mb-1", children: [
24878
+ return /* @__PURE__ */ jsxs20("span", { className: "inline-block text-xs text-muted-foreground bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded mr-2 mb-1", children: [
24658
24879
  "\u{1F4F7} ",
24659
24880
  part.data.name
24660
24881
  ] }, partIndex);
24661
24882
  }
24662
- return /* @__PURE__ */ jsxs19("span", { className: "inline-block text-xs text-muted-foreground bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded mr-2 mb-1", children: [
24883
+ return /* @__PURE__ */ jsxs20("span", { className: "inline-block text-xs text-muted-foreground bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded mr-2 mb-1", children: [
24663
24884
  "[",
24664
24885
  part.part_type,
24665
24886
  "]"
24666
24887
  ] }, partIndex);
24667
24888
  }) }) }),
24668
- /* @__PURE__ */ jsx26("p", { className: "mt-2 text-xs text-yellow-600 dark:text-yellow-400", children: "Will be sent automatically when AI response is complete" })
24889
+ /* @__PURE__ */ jsx27("p", { className: "mt-2 text-xs text-yellow-600 dark:text-yellow-400", children: "Will be sent automatically when AI response is complete" })
24669
24890
  ] })
24670
24891
  ] }) }) }, "pending-message");
24671
24892
  };
24672
24893
  if (!agent2)
24673
- return /* @__PURE__ */ jsx26("div", { children: " Agent not available" });
24674
- return /* @__PURE__ */ jsxs19(
24894
+ return /* @__PURE__ */ jsx27("div", { children: " Agent not available" });
24895
+ return /* @__PURE__ */ jsxs20(
24675
24896
  "div",
24676
24897
  {
24677
24898
  className: `flex flex-col h-full bg-background font-sans overflow-hidden relative ${getThemeClasses(theme)} ${className}`,
@@ -24680,34 +24901,35 @@ var ChatInner = forwardRef5(function ChatInner2({
24680
24901
  onDragLeave: handleDragLeave,
24681
24902
  onDrop: handleDrop2,
24682
24903
  children: [
24683
- isDragOver && /* @__PURE__ */ jsx26("div", { className: "absolute inset-0 z-50 flex items-center justify-center bg-primary/10 border-2 border-primary border-dashed", children: /* @__PURE__ */ jsx26("div", { className: "text-primary font-medium text-lg", children: "Drop images anywhere to upload" }) }),
24684
- /* @__PURE__ */ jsx26("div", { className: "flex-1 overflow-y-auto bg-background text-foreground selection:bg-primary/20 selection:text-primary-foreground dark:selection:bg-primary/40", children: /* @__PURE__ */ jsxs19(
24904
+ isDragOver && /* @__PURE__ */ jsx27("div", { className: "absolute inset-0 z-50 flex items-center justify-center bg-primary/10 border-2 border-primary border-dashed", children: /* @__PURE__ */ jsx27("div", { className: "text-primary font-medium text-lg", children: "Drop images anywhere to upload" }) }),
24905
+ /* @__PURE__ */ jsx27("div", { className: "flex-1 overflow-y-auto bg-background text-foreground selection:bg-primary/20 selection:text-primary-foreground dark:selection:bg-primary/40", children: /* @__PURE__ */ jsxs20(
24685
24906
  "div",
24686
24907
  {
24687
24908
  className: "mx-auto w-full px-2 py-4 text-sm space-y-4",
24688
24909
  style: { maxWidth: maxWidth || "768px", width: "100%", boxSizing: "border-box" },
24689
24910
  children: [
24690
- error && /* @__PURE__ */ jsx26("div", { className: "p-4 bg-destructive/10 border-l-4 border-destructive", children: /* @__PURE__ */ jsxs19("div", { className: "text-destructive text-xs", children: [
24691
- /* @__PURE__ */ jsx26("strong", { children: "Error:" }),
24911
+ error && /* @__PURE__ */ jsx27("div", { className: "p-4 bg-destructive/10 border-l-4 border-destructive", children: /* @__PURE__ */ jsxs20("div", { className: "text-destructive text-xs", children: [
24912
+ /* @__PURE__ */ jsx27("strong", { children: "Error:" }),
24692
24913
  " ",
24693
24914
  error.message
24694
24915
  ] }) }),
24695
- todos && todos.length > 0 && /* @__PURE__ */ jsx26(TodosDisplay, { todos, className: "mb-4" }),
24696
- /* @__PURE__ */ jsxs19(
24916
+ /* @__PURE__ */ jsx27(ThreadTokensBanner, { thread: threadDetails }),
24917
+ todos && todos.length > 0 && /* @__PURE__ */ jsx27(TodosDisplay, { todos, className: "mb-4" }),
24918
+ /* @__PURE__ */ jsxs20(
24697
24919
  "div",
24698
24920
  {
24699
24921
  className: "flex flex-col gap-4 lg:flex-row lg:items-start",
24700
24922
  style: maxWidth ? { maxWidth: "100%" } : void 0,
24701
24923
  children: [
24702
- /* @__PURE__ */ jsx26(MessageReadProvider, { threadId, enabled: enableFeedback, children: /* @__PURE__ */ jsxs19("div", { className: "flex-1 min-w-0 space-y-4 w-full", children: [
24924
+ /* @__PURE__ */ jsx27(MessageReadProvider, { threadId, enabled: enableFeedback, children: /* @__PURE__ */ jsxs20("div", { className: "flex-1 min-w-0 space-y-4 w-full", children: [
24703
24925
  emptyStateContent,
24704
24926
  renderMessages(),
24705
24927
  renderExternalToolCalls(),
24706
24928
  renderThinkingIndicator(),
24707
24929
  renderPendingMessage(),
24708
- /* @__PURE__ */ jsx26("div", { ref: messagesEndRef })
24930
+ /* @__PURE__ */ jsx27("div", { ref: messagesEndRef })
24709
24931
  ] }) }),
24710
- showBrowserPreview && browserViewerUrl && /* @__PURE__ */ jsx26("div", { className: "w-full lg:w-[320px] xl:w-[360px] shrink-0", children: /* @__PURE__ */ jsx26("div", { className: "lg:sticky lg:top-4 space-y-3", children: /* @__PURE__ */ jsx26("div", { className: "overflow-hidden rounded-xl border border-border/40 bg-background", children: /* @__PURE__ */ jsx26(
24932
+ showBrowserPreview && browserViewerUrl && /* @__PURE__ */ jsx27("div", { className: "w-full lg:w-[320px] xl:w-[360px] shrink-0", children: /* @__PURE__ */ jsx27("div", { className: "lg:sticky lg:top-4 space-y-3", children: /* @__PURE__ */ jsx27("div", { className: "overflow-hidden rounded-xl border border-border/40 bg-background", children: /* @__PURE__ */ jsx27(
24711
24933
  "iframe",
24712
24934
  {
24713
24935
  src: browserViewerUrl,
@@ -24722,24 +24944,24 @@ var ChatInner = forwardRef5(function ChatInner2({
24722
24944
  ]
24723
24945
  }
24724
24946
  ) }),
24725
- footerHasContent ? /* @__PURE__ */ jsx26("footer", { className: "\n sticky bottom-0 inset-x-0 z-30\n border-t border-border\n bg-background/80 backdrop-blur supports-[backdrop-filter]:bg-background/60\n pb-[env(safe-area-inset-bottom)]\n", children: /* @__PURE__ */ jsxs19(
24947
+ footerHasContent ? /* @__PURE__ */ jsx27("footer", { className: "\n sticky bottom-0 inset-x-0 z-30\n border-t border-border\n bg-background/80 backdrop-blur supports-[backdrop-filter]:bg-background/60\n pb-[env(safe-area-inset-bottom)]\n", children: /* @__PURE__ */ jsxs20(
24726
24948
  "div",
24727
24949
  {
24728
24950
  className: "mx-auto w-full px-4 py-3 sm:py-4 space-y-3",
24729
24951
  style: { maxWidth: maxWidth || "768px" },
24730
24952
  children: [
24731
- models && models.length > 0 && /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2", children: [
24732
- /* @__PURE__ */ jsx26("span", { className: "text-sm text-muted-foreground shrink-0", children: "Model:" }),
24733
- /* @__PURE__ */ jsxs19(Select, { value: selectedModelId, onValueChange: onModelChange, children: [
24734
- /* @__PURE__ */ jsx26(SelectTrigger, { className: "w-64 max-w-full", children: /* @__PURE__ */ jsx26(SelectValue, { placeholder: "Select a model" }) }),
24735
- /* @__PURE__ */ jsx26(SelectContent, { children: models.map((model) => /* @__PURE__ */ jsx26(SelectItem, { value: model.id, children: model.name }, model.id)) })
24953
+ models && models.length > 0 && /* @__PURE__ */ jsxs20("div", { className: "flex flex-wrap items-center gap-2", children: [
24954
+ /* @__PURE__ */ jsx27("span", { className: "text-sm text-muted-foreground shrink-0", children: "Model:" }),
24955
+ /* @__PURE__ */ jsxs20(Select, { value: selectedModelId, onValueChange: onModelChange, children: [
24956
+ /* @__PURE__ */ jsx27(SelectTrigger, { className: "w-64 max-w-full", children: /* @__PURE__ */ jsx27(SelectValue, { placeholder: "Select a model" }) }),
24957
+ /* @__PURE__ */ jsx27(SelectContent, { children: models.map((model) => /* @__PURE__ */ jsx27(SelectItem, { value: model.id, children: model.name }, model.id)) })
24736
24958
  ] })
24737
24959
  ] }),
24738
- voiceEnabled && speechToText && (isStreamingVoice || streamingTranscript) && /* @__PURE__ */ jsxs19("div", { className: "p-3 bg-muted/50 border border-muted rounded-lg", children: [
24739
- /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
24740
- /* @__PURE__ */ jsx26("span", { className: "w-2 h-2 rounded-full bg-red-500 animate-pulse" }),
24741
- /* @__PURE__ */ jsx26("span", { className: "text-sm font-medium text-muted-foreground", children: isStreamingVoice ? "Listening\u2026" : "Processing\u2026" }),
24742
- isStreamingVoice && /* @__PURE__ */ jsx26(
24960
+ voiceEnabled && speechToText && (isStreamingVoice || streamingTranscript) && /* @__PURE__ */ jsxs20("div", { className: "p-3 bg-muted/50 border border-muted rounded-lg", children: [
24961
+ /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
24962
+ /* @__PURE__ */ jsx27("span", { className: "w-2 h-2 rounded-full bg-red-500 animate-pulse" }),
24963
+ /* @__PURE__ */ jsx27("span", { className: "text-sm font-medium text-muted-foreground", children: isStreamingVoice ? "Listening\u2026" : "Processing\u2026" }),
24964
+ isStreamingVoice && /* @__PURE__ */ jsx27(
24743
24965
  "button",
24744
24966
  {
24745
24967
  onClick: stopStreamingVoice,
@@ -24748,7 +24970,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24748
24970
  }
24749
24971
  )
24750
24972
  ] }),
24751
- streamingTranscript && /* @__PURE__ */ jsxs19("p", { className: "mt-2 text-sm text-foreground font-mono break-words", children: [
24973
+ streamingTranscript && /* @__PURE__ */ jsxs20("p", { className: "mt-2 text-sm text-foreground font-mono break-words", children: [
24752
24974
  "\u201C",
24753
24975
  streamingTranscript,
24754
24976
  "\u201D"
@@ -24763,7 +24985,7 @@ var ChatInner = forwardRef5(function ChatInner2({
24763
24985
  );
24764
24986
  });
24765
24987
  var Chat = forwardRef5((props, ref) => {
24766
- return /* @__PURE__ */ jsx26(AuthLoading, { children: /* @__PURE__ */ jsx26(ChatContainer, { ref, ...props }) });
24988
+ return /* @__PURE__ */ jsx27(AuthLoading, { children: /* @__PURE__ */ jsx27(ChatContainer, { ref, ...props }) });
24767
24989
  });
24768
24990
  var ChatContainer = forwardRef5(function ChatContainer2({ agent: agentProp, agentId, enableHistory, threadId, initialMessages: initialMessagesProp, theme, enableFeedback, ...props }, ref) {
24769
24991
  const { isLoading: clientLoading } = useDistri();
@@ -24778,30 +25000,30 @@ var ChatContainer = forwardRef5(function ChatContainer2({ agent: agentProp, agen
24778
25000
  });
24779
25001
  const initialMessages = initialMessagesProp || fetchedMessages;
24780
25002
  if (clientLoading || agentLoading || enableHistory && historyLoading) {
24781
- return /* @__PURE__ */ jsxs19("div", { className: `flex flex-col items-center justify-center p-8 text-center h-full bg-background ${getThemeClasses(theme || "auto")}`, children: [
24782
- /* @__PURE__ */ jsx26(Loader25, { className: "h-8 w-8 animate-spin text-primary mb-4" }),
24783
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground font-sans text-sm", children: "Initializing..." })
25003
+ return /* @__PURE__ */ jsxs20("div", { className: `flex flex-col items-center justify-center p-8 text-center h-full bg-background ${getThemeClasses(theme || "auto")}`, children: [
25004
+ /* @__PURE__ */ jsx27(Loader25, { className: "h-8 w-8 animate-spin text-primary mb-4" }),
25005
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground font-sans text-sm", children: "Initializing..." })
24784
25006
  ] });
24785
25007
  }
24786
25008
  if (!agent2) {
24787
- return /* @__PURE__ */ jsxs19("div", { className: `flex flex-col items-center justify-center p-8 text-center h-full bg-background ${getThemeClasses(theme || "auto")}`, children: [
24788
- /* @__PURE__ */ jsx26(AlertCircle3, { className: "h-12 w-12 text-amber-500 mb-4" }),
24789
- /* @__PURE__ */ jsx26("h2", { className: "text-lg font-semibold text-foreground mb-2", children: "Agent Not Available" }),
24790
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground font-sans text-sm mb-4", children: "No agent has been configured or the backend is not responding." }),
24791
- /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground font-sans text-xs", children: "Make sure your Distri backend is running and accessible." })
25009
+ return /* @__PURE__ */ jsxs20("div", { className: `flex flex-col items-center justify-center p-8 text-center h-full bg-background ${getThemeClasses(theme || "auto")}`, children: [
25010
+ /* @__PURE__ */ jsx27(AlertCircle3, { className: "h-12 w-12 text-amber-500 mb-4" }),
25011
+ /* @__PURE__ */ jsx27("h2", { className: "text-lg font-semibold text-foreground mb-2", children: "Agent Not Available" }),
25012
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground font-sans text-sm mb-4", children: "No agent has been configured or the backend is not responding." }),
25013
+ /* @__PURE__ */ jsx27("p", { className: "text-muted-foreground font-sans text-xs", children: "Make sure your Distri backend is running and accessible." })
24792
25014
  ] });
24793
25015
  }
24794
- return /* @__PURE__ */ jsx26(ChatInner, { ref, agent: agent2, threadId, initialMessages, theme, enableFeedback, ...props });
25016
+ return /* @__PURE__ */ jsx27(ChatInner, { ref, agent: agent2, threadId, initialMessages, theme, enableFeedback, ...props });
24795
25017
  });
24796
25018
 
24797
25019
  // src/components/AgentList.tsx
24798
25020
  import React18 from "react";
24799
25021
  import { RefreshCw, Play, Bot } from "lucide-react";
24800
- import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
25022
+ import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
24801
25023
 
24802
25024
  // src/components/AgentSelect.tsx
24803
25025
  import { Bot as Bot2 } from "lucide-react";
24804
- import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
25026
+ import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
24805
25027
  var AgentSelect = ({
24806
25028
  agents,
24807
25029
  selectedAgentId,
@@ -24811,29 +25033,29 @@ var AgentSelect = ({
24811
25033
  disabled = false
24812
25034
  }) => {
24813
25035
  const selectedAgent = agents.find((agent2) => agent2.id === selectedAgentId);
24814
- return /* @__PURE__ */ jsxs21(Select, { value: selectedAgentId, onValueChange: onAgentSelect, disabled, children: [
24815
- /* @__PURE__ */ jsx28(SelectTrigger, { className: `w-full ${className} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`, children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center space-x-2", children: [
24816
- /* @__PURE__ */ jsx28(Bot2, { className: "h-4 w-4" }),
24817
- /* @__PURE__ */ jsx28(SelectValue, { placeholder, children: selectedAgent?.name || placeholder })
25036
+ return /* @__PURE__ */ jsxs22(Select, { value: selectedAgentId, onValueChange: onAgentSelect, disabled, children: [
25037
+ /* @__PURE__ */ jsx29(SelectTrigger, { className: `w-full ${className} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`, children: /* @__PURE__ */ jsxs22("div", { className: "flex items-center space-x-2", children: [
25038
+ /* @__PURE__ */ jsx29(Bot2, { className: "h-4 w-4" }),
25039
+ /* @__PURE__ */ jsx29(SelectValue, { placeholder, children: selectedAgent?.name || placeholder })
24818
25040
  ] }) }),
24819
- /* @__PURE__ */ jsx28(SelectContent, { children: agents.map((agent2) => /* @__PURE__ */ jsx28(SelectItem, { value: agent2.id, children: /* @__PURE__ */ jsxs21("div", { className: "flex items-center space-x-2", children: [
24820
- /* @__PURE__ */ jsx28(Bot2, { className: "h-4 w-4" }),
24821
- /* @__PURE__ */ jsxs21("div", { className: "flex flex-col", children: [
24822
- /* @__PURE__ */ jsx28("span", { className: "font-medium", children: agent2.name }),
24823
- agent2.description && /* @__PURE__ */ jsx28("span", { className: "text-xs text-muted-foreground", children: agent2.description })
25041
+ /* @__PURE__ */ jsx29(SelectContent, { children: agents.map((agent2) => /* @__PURE__ */ jsx29(SelectItem, { value: agent2.id, children: /* @__PURE__ */ jsxs22("div", { className: "flex items-center space-x-2", children: [
25042
+ /* @__PURE__ */ jsx29(Bot2, { className: "h-4 w-4" }),
25043
+ /* @__PURE__ */ jsxs22("div", { className: "flex flex-col", children: [
25044
+ /* @__PURE__ */ jsx29("span", { className: "font-medium", children: agent2.name }),
25045
+ agent2.description && /* @__PURE__ */ jsx29("span", { className: "text-xs text-muted-foreground", children: agent2.description })
24824
25046
  ] })
24825
25047
  ] }) }, agent2.id)) })
24826
25048
  ] });
24827
25049
  };
24828
25050
 
24829
25051
  // src/components/BrowserPreviewPanel.tsx
24830
- import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
25052
+ import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
24831
25053
  var BrowserPreviewPanel = ({
24832
25054
  frameSrc,
24833
25055
  timestampLabel,
24834
25056
  className
24835
25057
  }) => {
24836
- return /* @__PURE__ */ jsxs22(
25058
+ return /* @__PURE__ */ jsxs23(
24837
25059
  "div",
24838
25060
  {
24839
25061
  className: cn(
@@ -24841,14 +25063,14 @@ var BrowserPreviewPanel = ({
24841
25063
  className
24842
25064
  ),
24843
25065
  children: [
24844
- /* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between px-3 py-2 border-b bg-background/70 backdrop-blur text-xs text-muted-foreground", children: [
24845
- /* @__PURE__ */ jsx29("span", { className: "text-xs sm:text-sm font-medium text-foreground", children: "Live browser preview" }),
24846
- timestampLabel && /* @__PURE__ */ jsxs22("span", { className: "text-[11px] text-muted-foreground/80", children: [
25066
+ /* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between px-3 py-2 border-b bg-background/70 backdrop-blur text-xs text-muted-foreground", children: [
25067
+ /* @__PURE__ */ jsx30("span", { className: "text-xs sm:text-sm font-medium text-foreground", children: "Live browser preview" }),
25068
+ timestampLabel && /* @__PURE__ */ jsxs23("span", { className: "text-[11px] text-muted-foreground/80", children: [
24847
25069
  "Updated ",
24848
25070
  timestampLabel
24849
25071
  ] })
24850
25072
  ] }),
24851
- /* @__PURE__ */ jsx29("div", { className: "bg-background", children: /* @__PURE__ */ jsx29(
25073
+ /* @__PURE__ */ jsx30("div", { className: "bg-background", children: /* @__PURE__ */ jsx30(
24852
25074
  "img",
24853
25075
  {
24854
25076
  src: frameSrc,
@@ -24862,10 +25084,10 @@ var BrowserPreviewPanel = ({
24862
25084
  };
24863
25085
 
24864
25086
  // src/components/BrowserViewport.tsx
24865
- import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
24866
- var DefaultEmptyState = () => /* @__PURE__ */ jsxs23("div", { className: "flex h-full flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground", children: [
24867
- /* @__PURE__ */ jsx30("p", { children: "No browser session." }),
24868
- /* @__PURE__ */ jsx30("p", { className: "text-xs text-muted-foreground/70", children: "Browser will appear here when an agent uses it." })
25087
+ import { jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
25088
+ var DefaultEmptyState = () => /* @__PURE__ */ jsxs24("div", { className: "flex h-full flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground", children: [
25089
+ /* @__PURE__ */ jsx31("p", { children: "No browser session." }),
25090
+ /* @__PURE__ */ jsx31("p", { className: "text-xs text-muted-foreground/70", children: "Browser will appear here when an agent uses it." })
24869
25091
  ] });
24870
25092
  var BrowserViewport = ({
24871
25093
  className,
@@ -24876,7 +25098,7 @@ var BrowserViewport = ({
24876
25098
  const browserSessionId = useChatStateStore((state) => state.browserSessionId);
24877
25099
  const effectiveViewerUrl = viewerUrlOverride || browserViewerUrl;
24878
25100
  if (effectiveViewerUrl) {
24879
- return /* @__PURE__ */ jsxs23(
25101
+ return /* @__PURE__ */ jsxs24(
24880
25102
  "div",
24881
25103
  {
24882
25104
  className: cn(
@@ -24884,11 +25106,11 @@ var BrowserViewport = ({
24884
25106
  className
24885
25107
  ),
24886
25108
  children: [
24887
- browserSessionId && /* @__PURE__ */ jsxs23("div", { className: "absolute left-2 top-2 z-10 rounded-md bg-background/90 px-2 py-1 text-xs text-muted-foreground backdrop-blur-sm", children: [
25109
+ browserSessionId && /* @__PURE__ */ jsxs24("div", { className: "absolute left-2 top-2 z-10 rounded-md bg-background/90 px-2 py-1 text-xs text-muted-foreground backdrop-blur-sm", children: [
24888
25110
  "Session: ",
24889
25111
  browserSessionId
24890
25112
  ] }),
24891
- /* @__PURE__ */ jsx30(
25113
+ /* @__PURE__ */ jsx31(
24892
25114
  "iframe",
24893
25115
  {
24894
25116
  src: effectiveViewerUrl,
@@ -24901,30 +25123,30 @@ var BrowserViewport = ({
24901
25123
  }
24902
25124
  );
24903
25125
  }
24904
- return /* @__PURE__ */ jsx30(
25126
+ return /* @__PURE__ */ jsx31(
24905
25127
  "div",
24906
25128
  {
24907
25129
  className: cn(
24908
25130
  "h-full min-h-[220px] rounded-xl border border-dashed border-border/40 bg-muted/10 p-4",
24909
25131
  className
24910
25132
  ),
24911
- children: emptyState ?? /* @__PURE__ */ jsx30(DefaultEmptyState, {})
25133
+ children: emptyState ?? /* @__PURE__ */ jsx31(DefaultEmptyState, {})
24912
25134
  }
24913
25135
  );
24914
25136
  };
24915
25137
 
24916
25138
  // src/components/ConfigurationPanel.tsx
24917
- import { useEffect as useEffect17, useMemo as useMemo7, useState as useState20 } from "react";
25139
+ import { useEffect as useEffect18, useMemo as useMemo7, useState as useState21 } from "react";
24918
25140
 
24919
25141
  // src/hooks/useConfiguration.ts
24920
- import { useCallback as useCallback18, useEffect as useEffect16, useState as useState19 } from "react";
25142
+ import { useCallback as useCallback19, useEffect as useEffect17, useState as useState20 } from "react";
24921
25143
  function useConfiguration() {
24922
25144
  const { client, isLoading } = useDistri();
24923
- const [configuration, setConfiguration] = useState19(null);
24924
- const [meta, setMeta2] = useState19(null);
24925
- const [loading, setLoading] = useState19(true);
24926
- const [error, setError] = useState19(null);
24927
- const refresh = useCallback18(async () => {
25145
+ const [configuration, setConfiguration] = useState20(null);
25146
+ const [meta, setMeta2] = useState20(null);
25147
+ const [loading, setLoading] = useState20(true);
25148
+ const [error, setError] = useState20(null);
25149
+ const refresh = useCallback19(async () => {
24928
25150
  setLoading(true);
24929
25151
  try {
24930
25152
  if (isLoading || !client) return;
@@ -24939,7 +25161,7 @@ function useConfiguration() {
24939
25161
  setLoading(false);
24940
25162
  }
24941
25163
  }, [client, isLoading]);
24942
- const saveConfiguration = useCallback18(
25164
+ const saveConfiguration = useCallback19(
24943
25165
  async (config) => {
24944
25166
  setLoading(true);
24945
25167
  try {
@@ -24958,7 +25180,7 @@ function useConfiguration() {
24958
25180
  },
24959
25181
  [client]
24960
25182
  );
24961
- useEffect16(() => {
25183
+ useEffect17(() => {
24962
25184
  void refresh();
24963
25185
  }, [refresh]);
24964
25186
  return {
@@ -24974,8 +25196,8 @@ function useConfiguration() {
24974
25196
 
24975
25197
  // src/components/ui/card.tsx
24976
25198
  import * as React19 from "react";
24977
- import { jsx as jsx31 } from "react/jsx-runtime";
24978
- var Card = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx31(
25199
+ import { jsx as jsx32 } from "react/jsx-runtime";
25200
+ var Card = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
24979
25201
  "div",
24980
25202
  {
24981
25203
  ref,
@@ -24987,7 +25209,7 @@ var Card = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
24987
25209
  }
24988
25210
  ));
24989
25211
  Card.displayName = "Card";
24990
- var CardHeader = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx31(
25212
+ var CardHeader = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
24991
25213
  "div",
24992
25214
  {
24993
25215
  ref,
@@ -24996,7 +25218,7 @@ var CardHeader = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE
24996
25218
  }
24997
25219
  ));
24998
25220
  CardHeader.displayName = "CardHeader";
24999
- var CardTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx31(
25221
+ var CardTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
25000
25222
  "h3",
25001
25223
  {
25002
25224
  ref,
@@ -25008,7 +25230,7 @@ var CardTitle = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE_
25008
25230
  }
25009
25231
  ));
25010
25232
  CardTitle.displayName = "CardTitle";
25011
- var CardDescription = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx31(
25233
+ var CardDescription = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
25012
25234
  "p",
25013
25235
  {
25014
25236
  ref,
@@ -25017,9 +25239,9 @@ var CardDescription = React19.forwardRef(({ className, ...props }, ref) => /* @_
25017
25239
  }
25018
25240
  ));
25019
25241
  CardDescription.displayName = "CardDescription";
25020
- var CardContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx31("div", { ref, className: cn("p-6 pt-0", className), ...props }));
25242
+ var CardContent = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32("div", { ref, className: cn("p-6 pt-0", className), ...props }));
25021
25243
  CardContent.displayName = "CardContent";
25022
- var CardFooter = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx31(
25244
+ var CardFooter = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
25023
25245
  "div",
25024
25246
  {
25025
25247
  ref,
@@ -25031,10 +25253,10 @@ CardFooter.displayName = "CardFooter";
25031
25253
 
25032
25254
  // src/components/ui/input.tsx
25033
25255
  import * as React20 from "react";
25034
- import { jsx as jsx32 } from "react/jsx-runtime";
25256
+ import { jsx as jsx33 } from "react/jsx-runtime";
25035
25257
  var Input = React20.forwardRef(
25036
25258
  ({ className, type, ...props }, ref) => {
25037
- return /* @__PURE__ */ jsx32(
25259
+ return /* @__PURE__ */ jsx33(
25038
25260
  "input",
25039
25261
  {
25040
25262
  type,
@@ -25051,12 +25273,12 @@ var Input = React20.forwardRef(
25051
25273
  Input.displayName = "Input";
25052
25274
 
25053
25275
  // src/components/ui/skeleton.tsx
25054
- import { jsx as jsx33 } from "react/jsx-runtime";
25276
+ import { jsx as jsx34 } from "react/jsx-runtime";
25055
25277
  function Skeleton({
25056
25278
  className,
25057
25279
  ...props
25058
25280
  }) {
25059
- return /* @__PURE__ */ jsx33(
25281
+ return /* @__PURE__ */ jsx34(
25060
25282
  "div",
25061
25283
  {
25062
25284
  className: cn("animate-pulse rounded-md bg-muted", className),
@@ -25067,7 +25289,7 @@ function Skeleton({
25067
25289
 
25068
25290
  // src/components/ui/badge.tsx
25069
25291
  import { cva } from "class-variance-authority";
25070
- import { jsx as jsx34 } from "react/jsx-runtime";
25292
+ import { jsx as jsx35 } from "react/jsx-runtime";
25071
25293
  var badgeVariants = cva(
25072
25294
  "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
25073
25295
  {
@@ -25085,13 +25307,15 @@ var badgeVariants = cva(
25085
25307
  }
25086
25308
  );
25087
25309
  function Badge({ className, variant, ...props }) {
25088
- return /* @__PURE__ */ jsx34("div", { className: cn(badgeVariants({ variant }), className), ...props });
25310
+ return /* @__PURE__ */ jsx35("div", { className: cn(badgeVariants({ variant }), className), ...props });
25089
25311
  }
25090
25312
 
25091
25313
  // src/components/ConfigurationPanel.tsx
25092
- import { Fragment as Fragment6, jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
25314
+ import { Fragment as Fragment6, jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
25093
25315
  var providerOptions = [
25094
25316
  { value: "openai", label: "OpenAI", hint: "Hosted" },
25317
+ { value: "anthropic", label: "Anthropic", hint: "Claude" },
25318
+ { value: "azure_openai", label: "Azure OpenAI", hint: "Azure" },
25095
25319
  { value: "openai_compat", label: "OpenAI Compatible", hint: "Custom base URL" },
25096
25320
  { value: "vllora", label: "VLLora", hint: "Local" }
25097
25321
  ];
@@ -25100,7 +25324,7 @@ var defaultModelSettings = (settings) => {
25100
25324
  return {
25101
25325
  model: settings?.model || "gpt-4.1-mini",
25102
25326
  temperature: settings?.temperature ?? 0.7,
25103
- max_tokens: settings?.max_tokens ?? 1e3,
25327
+ max_tokens: settings?.max_tokens,
25104
25328
  context_size: settings?.context_size ?? 2e4,
25105
25329
  top_p: settings?.top_p ?? 1,
25106
25330
  frequency_penalty: settings?.frequency_penalty ?? 0,
@@ -25124,32 +25348,38 @@ var providerDefaults = (name) => {
25124
25348
  switch (name) {
25125
25349
  case "openai_compat":
25126
25350
  return { name, base_url: "http://localhost:8080/v1" };
25351
+ case "azure_openai":
25352
+ return { name, base_url: "", deployment: "", api_version: "2024-02-01" };
25127
25353
  case "vllora":
25128
25354
  return { name, base_url: "http://localhost:9090/v1" };
25129
25355
  default:
25130
25356
  return { name };
25131
25357
  }
25132
25358
  };
25133
- var FieldLabel = ({ children }) => /* @__PURE__ */ jsx35("span", { className: "text-xs font-medium text-muted-foreground", children });
25359
+ var FieldLabel = ({ children }) => /* @__PURE__ */ jsx36("span", { className: "text-xs font-medium text-muted-foreground", children });
25134
25360
  var MetaRow = ({ meta }) => {
25135
25361
  if (!meta) return null;
25136
- return /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
25137
- /* @__PURE__ */ jsx35(Badge, { variant: meta.overrides_active ? "secondary" : "outline", children: meta.overrides_active ? "Overrides active" : "Using base configuration" }),
25138
- /* @__PURE__ */ jsxs24("span", { className: "truncate", children: [
25362
+ return /* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
25363
+ /* @__PURE__ */ jsx36(Badge, { variant: meta.overrides_active ? "secondary" : "outline", children: meta.overrides_active ? "Overrides active" : "Using base configuration" }),
25364
+ /* @__PURE__ */ jsxs25("span", { className: "truncate", children: [
25139
25365
  "Base: ",
25140
25366
  meta.base_path
25141
25367
  ] }),
25142
- /* @__PURE__ */ jsxs24("span", { className: "truncate", children: [
25368
+ /* @__PURE__ */ jsxs25("span", { className: "truncate", children: [
25143
25369
  "Overrides: ",
25144
25370
  meta.overrides_path
25145
25371
  ] })
25146
25372
  ] });
25147
25373
  };
25148
25374
  function ConfigurationPanel({ className, title = "Agent Settings" }) {
25149
- const { configuration, meta, loading, error } = useConfiguration();
25150
- const [draft, setDraft] = useState20(null);
25151
- const [useCustomAnalysis, setUseCustomAnalysis] = useState20(false);
25152
- useEffect17(() => {
25375
+ const { configuration, meta, loading, error, saveConfiguration } = useConfiguration();
25376
+ const { providers } = useModels();
25377
+ const [draft, setDraft] = useState21(null);
25378
+ const [useCustomAnalysis, setUseCustomAnalysis] = useState21(false);
25379
+ const [saving, setSaving] = useState21(false);
25380
+ const [saveError, setSaveError] = useState21(null);
25381
+ const [saveSuccess, setSaveSuccess] = useState21(false);
25382
+ useEffect18(() => {
25153
25383
  if (configuration) {
25154
25384
  setDraft({
25155
25385
  ...configuration,
@@ -25192,110 +25422,181 @@ function ConfigurationPanel({ className, title = "Agent Settings" }) {
25192
25422
  const renderProviderExtras = (settings, fallbackName) => {
25193
25423
  const provider = parseProvider(settings?.provider);
25194
25424
  const activeName = provider.name || fallbackName;
25195
- if (!activeName || activeName !== "openai_compat" && activeName !== "vllora") {
25196
- return null;
25197
- }
25198
- return /* @__PURE__ */ jsxs24("div", { className: "space-y-2 rounded-md border border-dashed border-border/60 p-3", children: [
25199
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between", children: [
25200
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Provider details" }),
25201
- /* @__PURE__ */ jsx35(Badge, { variant: "outline", className: "uppercase", children: activeName })
25425
+ const target = settings === draft?.analysis_model_settings ? "analysis_model_settings" : "model_settings";
25426
+ const needsExtras = activeName === "openai_compat" || activeName === "vllora" || activeName === "azure_openai";
25427
+ if (!activeName || !needsExtras) return null;
25428
+ return /* @__PURE__ */ jsxs25("div", { className: "md:col-span-2 space-y-3 rounded-md border border-dashed border-border/60 p-3", children: [
25429
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between", children: [
25430
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Provider details" }),
25431
+ /* @__PURE__ */ jsx36(Badge, { variant: "outline", className: "uppercase", children: activeName })
25202
25432
  ] }),
25203
- /* @__PURE__ */ jsx35(
25204
- Input,
25205
- {
25206
- value: provider.base_url || "",
25207
- onChange: (e) => updateModelSetting(
25208
- settings === draft?.analysis_model_settings ? "analysis_model_settings" : "model_settings",
25209
- "provider",
25210
- { ...provider, base_url: e.target.value }
25211
- ),
25212
- placeholder: "https://your-provider/v1"
25213
- }
25214
- ),
25215
- activeName === "openai_compat" && /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: "Base URL for your compatible gateway. Credentials are pulled from the backend environment when available." })
25433
+ (activeName === "openai_compat" || activeName === "vllora" || activeName === "azure_openai") && /* @__PURE__ */ jsxs25("div", { className: "space-y-1", children: [
25434
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Base URL" }),
25435
+ /* @__PURE__ */ jsx36(
25436
+ Input,
25437
+ {
25438
+ value: provider.base_url || "",
25439
+ onChange: (e) => updateModelSetting(target, "provider", { ...provider, base_url: e.target.value }),
25440
+ placeholder: activeName === "azure_openai" ? "https://your-resource.openai.azure.com" : "https://your-provider/v1"
25441
+ }
25442
+ )
25443
+ ] }),
25444
+ activeName === "azure_openai" && /* @__PURE__ */ jsxs25(Fragment6, { children: [
25445
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-1", children: [
25446
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Deployment name" }),
25447
+ /* @__PURE__ */ jsx36(
25448
+ Input,
25449
+ {
25450
+ value: provider.deployment || "",
25451
+ onChange: (e) => updateModelSetting(target, "provider", { ...provider, deployment: e.target.value }),
25452
+ placeholder: "gpt-4o"
25453
+ }
25454
+ )
25455
+ ] }),
25456
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-1", children: [
25457
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "API version" }),
25458
+ /* @__PURE__ */ jsx36(
25459
+ Input,
25460
+ {
25461
+ value: provider.api_version || "2024-02-01",
25462
+ onChange: (e) => updateModelSetting(target, "provider", { ...provider, api_version: e.target.value }),
25463
+ placeholder: "2024-02-01"
25464
+ }
25465
+ )
25466
+ ] })
25467
+ ] }),
25468
+ activeName === "openai_compat" && /* @__PURE__ */ jsx36("p", { className: "text-xs text-muted-foreground", children: "Base URL for your compatible gateway. Credentials are pulled from the backend environment when available." })
25216
25469
  ] });
25217
25470
  };
25218
- const disabled = true;
25219
- return /* @__PURE__ */ jsxs24("div", { className: cn("space-y-4", className), children: [
25220
- /* @__PURE__ */ jsxs24("div", { className: "flex items-start justify-between gap-3", children: [
25221
- /* @__PURE__ */ jsxs24("div", { children: [
25222
- /* @__PURE__ */ jsx35("p", { className: "text-xs uppercase tracking-[0.3em] text-muted-foreground", children: "Distri" }),
25223
- /* @__PURE__ */ jsx35("h2", { className: "text-xl font-semibold", children: title })
25471
+ const handleSave = async () => {
25472
+ if (!draft) return;
25473
+ setSaving(true);
25474
+ setSaveError(null);
25475
+ setSaveSuccess(false);
25476
+ try {
25477
+ await saveConfiguration(draft);
25478
+ setSaveSuccess(true);
25479
+ setTimeout(() => setSaveSuccess(false), 3e3);
25480
+ } catch (err) {
25481
+ setSaveError(err instanceof Error ? err.message : "Failed to save");
25482
+ } finally {
25483
+ setSaving(false);
25484
+ }
25485
+ };
25486
+ const renderModelSelect = (target, currentModel) => {
25487
+ const modelLabel = (() => {
25488
+ if (!currentModel) return void 0;
25489
+ for (const p of providers) {
25490
+ const m = p.models.find((m2) => m2.id === currentModel);
25491
+ if (m) return m.name;
25492
+ }
25493
+ return currentModel;
25494
+ })();
25495
+ return /* @__PURE__ */ jsxs25(
25496
+ Select,
25497
+ {
25498
+ value: currentModel || "",
25499
+ onValueChange: (value) => updateModelSetting(target, "model", value),
25500
+ children: [
25501
+ /* @__PURE__ */ jsx36(SelectTrigger, { children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Select a model", children: modelLabel }) }),
25502
+ /* @__PURE__ */ jsx36(SelectContent, { children: providers.map((provider, idx) => /* @__PURE__ */ jsxs25(SelectGroup, { children: [
25503
+ idx > 0 && /* @__PURE__ */ jsx36(SelectSeparator, {}),
25504
+ /* @__PURE__ */ jsxs25(SelectLabel, { className: "flex items-center gap-2 text-xs", children: [
25505
+ /* @__PURE__ */ jsx36(
25506
+ "span",
25507
+ {
25508
+ className: cn(
25509
+ "inline-block h-2 w-2 rounded-full",
25510
+ provider.configured ? "bg-emerald-500" : "bg-muted-foreground/40"
25511
+ )
25512
+ }
25513
+ ),
25514
+ provider.provider_label,
25515
+ !provider.configured && /* @__PURE__ */ jsx36("span", { className: "text-[10px] text-muted-foreground/60 font-normal", children: "(not configured)" })
25516
+ ] }),
25517
+ provider.models.map((model) => /* @__PURE__ */ jsx36(
25518
+ SelectItem,
25519
+ {
25520
+ value: model.id,
25521
+ disabled: !provider.configured,
25522
+ children: model.name
25523
+ },
25524
+ model.id
25525
+ ))
25526
+ ] }, provider.provider_id)) })
25527
+ ]
25528
+ }
25529
+ );
25530
+ };
25531
+ return /* @__PURE__ */ jsxs25("div", { className: cn("space-y-4", className), children: [
25532
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-start justify-between gap-3", children: [
25533
+ /* @__PURE__ */ jsxs25("div", { children: [
25534
+ /* @__PURE__ */ jsx36("p", { className: "text-xs uppercase tracking-[0.3em] text-muted-foreground", children: "Distri" }),
25535
+ /* @__PURE__ */ jsx36("h2", { className: "text-xl font-semibold", children: title })
25224
25536
  ] }),
25225
- /* @__PURE__ */ jsx35("div", { className: "flex items-center gap-2", children: meta && /* @__PURE__ */ jsx35(MetaRow, { meta }) })
25537
+ /* @__PURE__ */ jsx36("div", { className: "flex items-center gap-2", children: meta && /* @__PURE__ */ jsx36(MetaRow, { meta }) })
25226
25538
  ] }),
25227
- error && /* @__PURE__ */ jsx35("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: error }),
25228
- !draft && loading && /* @__PURE__ */ jsx35(Card, { children: /* @__PURE__ */ jsxs24(CardContent, { className: "space-y-3 p-4", children: [
25229
- /* @__PURE__ */ jsx35(Skeleton, { className: "h-6 w-1/3" }),
25230
- /* @__PURE__ */ jsx35(Skeleton, { className: "h-4 w-full" }),
25231
- /* @__PURE__ */ jsx35(Skeleton, { className: "h-4 w-2/3" })
25539
+ error && /* @__PURE__ */ jsx36("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: error }),
25540
+ !draft && loading && /* @__PURE__ */ jsx36(Card, { children: /* @__PURE__ */ jsxs25(CardContent, { className: "space-y-3 p-4", children: [
25541
+ /* @__PURE__ */ jsx36(Skeleton, { className: "h-6 w-1/3" }),
25542
+ /* @__PURE__ */ jsx36(Skeleton, { className: "h-4 w-full" }),
25543
+ /* @__PURE__ */ jsx36(Skeleton, { className: "h-4 w-2/3" })
25232
25544
  ] }) }),
25233
- draft && /* @__PURE__ */ jsxs24(Fragment6, { children: [
25234
- /* @__PURE__ */ jsx35(Card, { children: /* @__PURE__ */ jsxs24(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
25235
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25236
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Name" }),
25237
- /* @__PURE__ */ jsx35(
25545
+ draft && /* @__PURE__ */ jsxs25(Fragment6, { children: [
25546
+ /* @__PURE__ */ jsx36(Card, { children: /* @__PURE__ */ jsxs25(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
25547
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25548
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Name" }),
25549
+ /* @__PURE__ */ jsx36(
25238
25550
  Input,
25239
25551
  {
25240
25552
  value: draft.name,
25241
25553
  onChange: (e) => setDraft((curr) => curr ? { ...curr, name: e.target.value } : curr),
25242
- placeholder: "browsr",
25243
- disabled
25554
+ placeholder: "browsr"
25244
25555
  }
25245
25556
  )
25246
25557
  ] }),
25247
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25248
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Version" }),
25249
- /* @__PURE__ */ jsx35(
25558
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25559
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Version" }),
25560
+ /* @__PURE__ */ jsx36(
25250
25561
  Input,
25251
25562
  {
25252
25563
  value: draft.version,
25253
25564
  onChange: (e) => setDraft((curr) => curr ? { ...curr, version: e.target.value } : curr),
25254
- placeholder: "0.1.0",
25255
- disabled
25565
+ placeholder: "0.1.0"
25256
25566
  }
25257
25567
  )
25258
25568
  ] })
25259
25569
  ] }) }),
25260
- /* @__PURE__ */ jsxs24(Card, { children: [
25261
- /* @__PURE__ */ jsxs24(CardHeader, { children: [
25262
- /* @__PURE__ */ jsx35(CardTitle, { children: "Default model" }),
25263
- /* @__PURE__ */ jsx35(CardDescription, { children: "Used for most agent calls unless a definition overrides it." })
25570
+ /* @__PURE__ */ jsxs25(Card, { children: [
25571
+ /* @__PURE__ */ jsxs25(CardHeader, { children: [
25572
+ /* @__PURE__ */ jsx36(CardTitle, { children: "Default model" }),
25573
+ /* @__PURE__ */ jsx36(CardDescription, { children: "Used for most agent calls unless a definition overrides it." })
25264
25574
  ] }),
25265
- /* @__PURE__ */ jsxs24(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
25266
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25267
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Provider" }),
25268
- /* @__PURE__ */ jsxs24(
25575
+ /* @__PURE__ */ jsxs25(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
25576
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25577
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Provider" }),
25578
+ /* @__PURE__ */ jsxs25(
25269
25579
  Select,
25270
25580
  {
25271
25581
  value: providerName,
25272
25582
  onValueChange: (value) => updateProvider("model_settings", value),
25273
- disabled,
25274
25583
  children: [
25275
- /* @__PURE__ */ jsx35(SelectTrigger, { children: /* @__PURE__ */ jsx35(SelectValue, { placeholder: "Choose provider" }) }),
25276
- /* @__PURE__ */ jsx35(SelectContent, { children: providerOptions.map((option) => /* @__PURE__ */ jsx35(SelectItem, { value: option.value, children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-2", children: [
25277
- /* @__PURE__ */ jsx35("span", { children: option.label }),
25278
- option.hint && /* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: option.hint })
25584
+ /* @__PURE__ */ jsx36(SelectTrigger, { children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Choose provider" }) }),
25585
+ /* @__PURE__ */ jsx36(SelectContent, { children: providerOptions.map((option) => /* @__PURE__ */ jsx36(SelectItem, { value: option.value, children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between gap-2", children: [
25586
+ /* @__PURE__ */ jsx36("span", { children: option.label }),
25587
+ option.hint && /* @__PURE__ */ jsx36("span", { className: "text-xs text-muted-foreground", children: option.hint })
25279
25588
  ] }) }, option.value)) })
25280
25589
  ]
25281
25590
  }
25282
25591
  )
25283
25592
  ] }),
25284
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25285
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Model ID" }),
25286
- /* @__PURE__ */ jsx35(
25287
- Input,
25288
- {
25289
- value: draft.model_settings?.model || "",
25290
- onChange: (e) => updateModelSetting("model_settings", "model", e.target.value),
25291
- placeholder: "gpt-4.1-mini",
25292
- disabled
25293
- }
25294
- )
25593
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25594
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Model" }),
25595
+ renderModelSelect("model_settings", draft.model_settings?.model)
25295
25596
  ] }),
25296
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25297
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Temperature" }),
25298
- /* @__PURE__ */ jsx35(
25597
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25598
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Temperature" }),
25599
+ /* @__PURE__ */ jsx36(
25299
25600
  Input,
25300
25601
  {
25301
25602
  type: "number",
@@ -25303,41 +25604,38 @@ function ConfigurationPanel({ className, title = "Agent Settings" }) {
25303
25604
  min: "0",
25304
25605
  max: "2",
25305
25606
  value: draft.model_settings?.temperature ?? 0,
25306
- onChange: (e) => updateModelSetting("model_settings", "temperature", Number.parseFloat(e.target.value)),
25307
- disabled
25607
+ onChange: (e) => updateModelSetting("model_settings", "temperature", Number.parseFloat(e.target.value))
25308
25608
  }
25309
25609
  )
25310
25610
  ] }),
25311
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25312
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Max tokens" }),
25313
- /* @__PURE__ */ jsx35(
25611
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25612
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Max tokens" }),
25613
+ /* @__PURE__ */ jsx36(
25314
25614
  Input,
25315
25615
  {
25316
25616
  type: "number",
25317
25617
  min: "1",
25318
25618
  value: draft.model_settings?.max_tokens ?? 0,
25319
- onChange: (e) => updateModelSetting("model_settings", "max_tokens", Number(e.target.value)),
25320
- disabled
25619
+ onChange: (e) => updateModelSetting("model_settings", "max_tokens", Number(e.target.value))
25321
25620
  }
25322
25621
  )
25323
25622
  ] }),
25324
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25325
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Context size" }),
25326
- /* @__PURE__ */ jsx35(
25623
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25624
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Context size" }),
25625
+ /* @__PURE__ */ jsx36(
25327
25626
  Input,
25328
25627
  {
25329
25628
  type: "number",
25330
25629
  min: "1024",
25331
25630
  step: "512",
25332
25631
  value: draft.model_settings?.context_size ?? 0,
25333
- onChange: (e) => updateModelSetting("model_settings", "context_size", Number(e.target.value)),
25334
- disabled
25632
+ onChange: (e) => updateModelSetting("model_settings", "context_size", Number(e.target.value))
25335
25633
  }
25336
25634
  )
25337
25635
  ] }),
25338
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25339
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Top P" }),
25340
- /* @__PURE__ */ jsx35(
25636
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25637
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Top P" }),
25638
+ /* @__PURE__ */ jsx36(
25341
25639
  Input,
25342
25640
  {
25343
25641
  type: "number",
@@ -25345,22 +25643,21 @@ function ConfigurationPanel({ className, title = "Agent Settings" }) {
25345
25643
  max: "1",
25346
25644
  step: "0.05",
25347
25645
  value: draft.model_settings?.top_p ?? 1,
25348
- onChange: (e) => updateModelSetting("model_settings", "top_p", Number.parseFloat(e.target.value)),
25349
- disabled
25646
+ onChange: (e) => updateModelSetting("model_settings", "top_p", Number.parseFloat(e.target.value))
25350
25647
  }
25351
25648
  )
25352
25649
  ] }),
25353
25650
  renderProviderExtras(draft.model_settings)
25354
25651
  ] })
25355
25652
  ] }),
25356
- /* @__PURE__ */ jsxs24(Card, { children: [
25357
- /* @__PURE__ */ jsxs24(CardHeader, { className: "flex flex-row items-center justify-between gap-3", children: [
25358
- /* @__PURE__ */ jsxs24("div", { children: [
25359
- /* @__PURE__ */ jsx35(CardTitle, { children: "Analysis model" }),
25360
- /* @__PURE__ */ jsx35(CardDescription, { children: "Optional lighter model for planning and summaries." })
25653
+ /* @__PURE__ */ jsxs25(Card, { children: [
25654
+ /* @__PURE__ */ jsxs25(CardHeader, { className: "flex flex-row items-center justify-between gap-3", children: [
25655
+ /* @__PURE__ */ jsxs25("div", { children: [
25656
+ /* @__PURE__ */ jsx36(CardTitle, { children: "Analysis model" }),
25657
+ /* @__PURE__ */ jsx36(CardDescription, { children: "Optional lighter model for planning and summaries." })
25361
25658
  ] }),
25362
- /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2", children: [
25363
- /* @__PURE__ */ jsx35(
25659
+ /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2", children: [
25660
+ /* @__PURE__ */ jsx36(
25364
25661
  Checkbox,
25365
25662
  {
25366
25663
  id: "analysis-toggle",
@@ -25384,43 +25681,34 @@ function ConfigurationPanel({ className, title = "Agent Settings" }) {
25384
25681
  disabled: loading
25385
25682
  }
25386
25683
  ),
25387
- /* @__PURE__ */ jsx35("label", { htmlFor: "analysis-toggle", className: "text-sm text-muted-foreground", children: "Use dedicated analysis settings" })
25684
+ /* @__PURE__ */ jsx36("label", { htmlFor: "analysis-toggle", className: "text-sm text-muted-foreground", children: "Use dedicated analysis settings" })
25388
25685
  ] })
25389
25686
  ] }),
25390
- useCustomAnalysis && /* @__PURE__ */ jsxs24(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
25391
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25392
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Provider" }),
25393
- /* @__PURE__ */ jsxs24(
25687
+ useCustomAnalysis && /* @__PURE__ */ jsxs25(CardContent, { className: "grid gap-4 md:grid-cols-2", children: [
25688
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25689
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Provider" }),
25690
+ /* @__PURE__ */ jsxs25(
25394
25691
  Select,
25395
25692
  {
25396
25693
  value: analysisProviderName,
25397
25694
  onValueChange: (value) => updateProvider("analysis_model_settings", value),
25398
- disabled,
25399
25695
  children: [
25400
- /* @__PURE__ */ jsx35(SelectTrigger, { children: /* @__PURE__ */ jsx35(SelectValue, { placeholder: "Choose provider" }) }),
25401
- /* @__PURE__ */ jsx35(SelectContent, { children: providerOptions.map((option) => /* @__PURE__ */ jsx35(SelectItem, { value: option.value, children: /* @__PURE__ */ jsxs24("div", { className: "flex items-center justify-between gap-2", children: [
25402
- /* @__PURE__ */ jsx35("span", { children: option.label }),
25403
- option.hint && /* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: option.hint })
25696
+ /* @__PURE__ */ jsx36(SelectTrigger, { children: /* @__PURE__ */ jsx36(SelectValue, { placeholder: "Choose provider" }) }),
25697
+ /* @__PURE__ */ jsx36(SelectContent, { children: providerOptions.map((option) => /* @__PURE__ */ jsx36(SelectItem, { value: option.value, children: /* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between gap-2", children: [
25698
+ /* @__PURE__ */ jsx36("span", { children: option.label }),
25699
+ option.hint && /* @__PURE__ */ jsx36("span", { className: "text-xs text-muted-foreground", children: option.hint })
25404
25700
  ] }) }, option.value)) })
25405
25701
  ]
25406
25702
  }
25407
25703
  )
25408
25704
  ] }),
25409
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25410
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Model ID" }),
25411
- /* @__PURE__ */ jsx35(
25412
- Input,
25413
- {
25414
- value: draft.analysis_model_settings?.model || "",
25415
- onChange: (e) => updateModelSetting("analysis_model_settings", "model", e.target.value),
25416
- placeholder: "gpt-4.1-mini",
25417
- disabled
25418
- }
25419
- )
25705
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25706
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Model" }),
25707
+ renderModelSelect("analysis_model_settings", draft.analysis_model_settings?.model)
25420
25708
  ] }),
25421
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25422
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Temperature" }),
25423
- /* @__PURE__ */ jsx35(
25709
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25710
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Temperature" }),
25711
+ /* @__PURE__ */ jsx36(
25424
25712
  Input,
25425
25713
  {
25426
25714
  type: "number",
@@ -25428,41 +25716,38 @@ function ConfigurationPanel({ className, title = "Agent Settings" }) {
25428
25716
  min: "0",
25429
25717
  max: "2",
25430
25718
  value: draft.analysis_model_settings?.temperature ?? 0,
25431
- onChange: (e) => updateModelSetting("analysis_model_settings", "temperature", Number.parseFloat(e.target.value)),
25432
- disabled
25719
+ onChange: (e) => updateModelSetting("analysis_model_settings", "temperature", Number.parseFloat(e.target.value))
25433
25720
  }
25434
25721
  )
25435
25722
  ] }),
25436
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25437
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Max tokens" }),
25438
- /* @__PURE__ */ jsx35(
25723
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25724
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Max tokens" }),
25725
+ /* @__PURE__ */ jsx36(
25439
25726
  Input,
25440
25727
  {
25441
25728
  type: "number",
25442
25729
  min: "1",
25443
25730
  value: draft.analysis_model_settings?.max_tokens ?? 0,
25444
- onChange: (e) => updateModelSetting("analysis_model_settings", "max_tokens", Number(e.target.value)),
25445
- disabled
25731
+ onChange: (e) => updateModelSetting("analysis_model_settings", "max_tokens", Number(e.target.value))
25446
25732
  }
25447
25733
  )
25448
25734
  ] }),
25449
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25450
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Context size" }),
25451
- /* @__PURE__ */ jsx35(
25735
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25736
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Context size" }),
25737
+ /* @__PURE__ */ jsx36(
25452
25738
  Input,
25453
25739
  {
25454
25740
  type: "number",
25455
25741
  min: "1024",
25456
25742
  step: "512",
25457
25743
  value: draft.analysis_model_settings?.context_size ?? 0,
25458
- onChange: (e) => updateModelSetting("analysis_model_settings", "context_size", Number(e.target.value)),
25459
- disabled
25744
+ onChange: (e) => updateModelSetting("analysis_model_settings", "context_size", Number(e.target.value))
25460
25745
  }
25461
25746
  )
25462
25747
  ] }),
25463
- /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
25464
- /* @__PURE__ */ jsx35(FieldLabel, { children: "Top P" }),
25465
- /* @__PURE__ */ jsx35(
25748
+ /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
25749
+ /* @__PURE__ */ jsx36(FieldLabel, { children: "Top P" }),
25750
+ /* @__PURE__ */ jsx36(
25466
25751
  Input,
25467
25752
  {
25468
25753
  type: "number",
@@ -25470,21 +25755,23 @@ function ConfigurationPanel({ className, title = "Agent Settings" }) {
25470
25755
  max: "1",
25471
25756
  step: "0.05",
25472
25757
  value: draft.analysis_model_settings?.top_p ?? 1,
25473
- onChange: (e) => updateModelSetting("analysis_model_settings", "top_p", Number.parseFloat(e.target.value)),
25474
- disabled
25758
+ onChange: (e) => updateModelSetting("analysis_model_settings", "top_p", Number.parseFloat(e.target.value))
25475
25759
  }
25476
25760
  )
25477
25761
  ] }),
25478
25762
  renderProviderExtras(draft.analysis_model_settings, analysisProviderName)
25479
25763
  ] })
25480
- ] })
25764
+ ] }),
25765
+ saveError && /* @__PURE__ */ jsx36("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: saveError }),
25766
+ saveSuccess && /* @__PURE__ */ jsx36("div", { className: "rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-600", children: "Settings saved successfully." }),
25767
+ /* @__PURE__ */ jsx36("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx36(Button, { onClick: handleSave, disabled: saving || loading, children: saving ? "Saving..." : "Save Settings" }) })
25481
25768
  ] })
25482
25769
  ] });
25483
25770
  }
25484
25771
 
25485
25772
  // src/components/ThemeProvider.tsx
25486
- import { createContext as createContext5, useContext as useContext5, useState as useState21 } from "react";
25487
- import { jsx as jsx36 } from "react/jsx-runtime";
25773
+ import { createContext as createContext5, useContext as useContext5, useState as useState22 } from "react";
25774
+ import { jsx as jsx37 } from "react/jsx-runtime";
25488
25775
  var initialState = {
25489
25776
  theme: "system",
25490
25777
  setTheme: () => null
@@ -25496,7 +25783,7 @@ function ThemeProvider({
25496
25783
  storageKey = "distri-theme",
25497
25784
  ...props
25498
25785
  }) {
25499
- const [theme, setTheme] = useState21(() => {
25786
+ const [theme, setTheme] = useState22(() => {
25500
25787
  if (typeof window === "undefined") {
25501
25788
  return defaultTheme === "system" ? "dark" : defaultTheme;
25502
25789
  }
@@ -25513,7 +25800,7 @@ function ThemeProvider({
25513
25800
  setTheme(theme2);
25514
25801
  }
25515
25802
  };
25516
- return /* @__PURE__ */ jsx36(ThemeProviderContext.Provider, { ...props, value, children });
25803
+ return /* @__PURE__ */ jsx37(ThemeProviderContext.Provider, { ...props, value, children });
25517
25804
  }
25518
25805
  var useTheme = () => {
25519
25806
  const context = useContext5(ThemeProviderContext);
@@ -25525,31 +25812,31 @@ var useTheme = () => {
25525
25812
  // src/components/ThemeToggle.tsx
25526
25813
  import React23 from "react";
25527
25814
  import { Moon, Sun } from "lucide-react";
25528
- import { jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
25815
+ import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
25529
25816
  function ThemeToggle({ theme, onThemeChange }) {
25530
25817
  const dropdownRef = React23.useRef(null);
25531
- return /* @__PURE__ */ jsx37("div", { className: "relative", ref: dropdownRef, children: /* @__PURE__ */ jsxs25(
25818
+ return /* @__PURE__ */ jsx38("div", { className: "relative", ref: dropdownRef, children: /* @__PURE__ */ jsxs26(
25532
25819
  "button",
25533
25820
  {
25534
25821
  onClick: () => onThemeChange?.(theme === "light" ? "dark" : "light"),
25535
25822
  className: "flex items-center justify-center w-9 h-9 rounded-md border bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground transition-colors",
25536
25823
  children: [
25537
- /* @__PURE__ */ jsx37(Sun, { className: "h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
25538
- /* @__PURE__ */ jsx37(Moon, { className: "absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
25539
- /* @__PURE__ */ jsx37("span", { className: "sr-only", children: "Toggle theme" })
25824
+ /* @__PURE__ */ jsx38(Sun, { className: "h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }),
25825
+ /* @__PURE__ */ jsx38(Moon, { className: "absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" }),
25826
+ /* @__PURE__ */ jsx38("span", { className: "sr-only", children: "Toggle theme" })
25540
25827
  ]
25541
25828
  }
25542
25829
  ) });
25543
25830
  }
25544
25831
 
25545
25832
  // src/components/Toast.tsx
25546
- import { useEffect as useEffect18 } from "react";
25833
+ import { useEffect as useEffect19 } from "react";
25547
25834
  import { X as X3, CheckCircle as CheckCircle4, AlertCircle as AlertCircle4, AlertTriangle, Info } from "lucide-react";
25548
- import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
25835
+ import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
25549
25836
 
25550
25837
  // src/components/AskFollowUp.tsx
25551
- import { useState as useState22, useCallback as useCallback19, useMemo as useMemo8, useEffect as useEffect19 } from "react";
25552
- import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
25838
+ import { useState as useState23, useCallback as useCallback20, useMemo as useMemo8, useEffect as useEffect20 } from "react";
25839
+ import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
25553
25840
  var ASK_FOLLOW_UP_TOOL_NAME = "ask_follow_up";
25554
25841
  function createAskFollowUpTool() {
25555
25842
  return {
@@ -25621,8 +25908,8 @@ function AskFollowUpComponent({
25621
25908
  const input = toolCall.input;
25622
25909
  const questions = useMemo8(() => input?.questions || [], [input?.questions]);
25623
25910
  const hasQuestions = questions.length > 0;
25624
- const [currentStep, setCurrentStep] = useState22(0);
25625
- const [answers, setAnswers] = useState22(() => {
25911
+ const [currentStep, setCurrentStep] = useState23(0);
25912
+ const [answers, setAnswers] = useState23(() => {
25626
25913
  const defaults = {};
25627
25914
  questions.forEach((q) => {
25628
25915
  if (q.default !== void 0) {
@@ -25640,7 +25927,7 @@ function AskFollowUpComponent({
25640
25927
  const currentQuestion = hasQuestions ? questions[currentStep] : null;
25641
25928
  const isLastStep = currentStep === questions.length - 1;
25642
25929
  const isCompleted = toolCallState?.status === "completed";
25643
- useEffect19(() => {
25930
+ useEffect20(() => {
25644
25931
  if (!hasQuestions && !isCompleted) {
25645
25932
  const output = { answers: {}, completed: true };
25646
25933
  completeTool({
@@ -25653,14 +25940,14 @@ function AskFollowUpComponent({
25653
25940
  });
25654
25941
  }
25655
25942
  }, [hasQuestions, isCompleted, completeTool, toolCall.tool_call_id, toolCall.tool_name]);
25656
- const handleAnswer = useCallback19((value) => {
25943
+ const handleAnswer = useCallback20((value) => {
25657
25944
  if (!currentQuestion) return;
25658
25945
  setAnswers((prev) => ({
25659
25946
  ...prev,
25660
25947
  [currentQuestion.id]: value
25661
25948
  }));
25662
25949
  }, [currentQuestion]);
25663
- const handleNext = useCallback19(() => {
25950
+ const handleNext = useCallback20(() => {
25664
25951
  if (!currentQuestion) return;
25665
25952
  if (currentQuestion.required && !answers[currentQuestion.id]) {
25666
25953
  return;
@@ -25682,12 +25969,12 @@ function AskFollowUpComponent({
25682
25969
  setCurrentStep((prev) => prev + 1);
25683
25970
  }
25684
25971
  }, [currentQuestion, answers, isLastStep, completeTool, toolCall]);
25685
- const handleBack = useCallback19(() => {
25972
+ const handleBack = useCallback20(() => {
25686
25973
  if (currentStep > 0) {
25687
25974
  setCurrentStep((prev) => prev - 1);
25688
25975
  }
25689
25976
  }, [currentStep]);
25690
- const handleKeyDown2 = useCallback19((e) => {
25977
+ const handleKeyDown2 = useCallback20((e) => {
25691
25978
  if (e.key === "Enter" && !e.shiftKey) {
25692
25979
  e.preventDefault();
25693
25980
  handleNext();
@@ -25697,27 +25984,27 @@ function AskFollowUpComponent({
25697
25984
  return null;
25698
25985
  }
25699
25986
  if (isCompleted) {
25700
- return /* @__PURE__ */ jsxs27("div", { className: "border rounded-lg p-4 bg-muted/30", children: [
25701
- /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
25702
- /* @__PURE__ */ jsx39(CheckIcon, { className: "w-4 h-4 text-green-500" }),
25703
- /* @__PURE__ */ jsx39("span", { children: "Follow-up questions answered" })
25987
+ return /* @__PURE__ */ jsxs28("div", { className: "border rounded-lg p-4 bg-muted/30", children: [
25988
+ /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
25989
+ /* @__PURE__ */ jsx40(CheckIcon, { className: "w-4 h-4 text-green-500" }),
25990
+ /* @__PURE__ */ jsx40("span", { children: "Follow-up questions answered" })
25704
25991
  ] }),
25705
- /* @__PURE__ */ jsx39("div", { className: "mt-2 space-y-1", children: questions.map((q) => /* @__PURE__ */ jsxs27("div", { className: "text-xs", children: [
25706
- /* @__PURE__ */ jsx39("span", { className: "text-muted-foreground", children: q.question }),
25707
- /* @__PURE__ */ jsx39("span", { className: "ml-2 font-medium", children: Array.isArray(answers[q.id]) ? answers[q.id].join(", ") : String(answers[q.id]) })
25992
+ /* @__PURE__ */ jsx40("div", { className: "mt-2 space-y-1", children: questions.map((q) => /* @__PURE__ */ jsxs28("div", { className: "text-xs", children: [
25993
+ /* @__PURE__ */ jsx40("span", { className: "text-muted-foreground", children: q.question }),
25994
+ /* @__PURE__ */ jsx40("span", { className: "ml-2 font-medium", children: Array.isArray(answers[q.id]) ? answers[q.id].join(", ") : String(answers[q.id]) })
25708
25995
  ] }, q.id)) })
25709
25996
  ] });
25710
25997
  }
25711
25998
  if (!currentQuestion) {
25712
25999
  return null;
25713
26000
  }
25714
- return /* @__PURE__ */ jsxs27("div", { className: "border rounded-lg overflow-hidden bg-background shadow-sm", children: [
25715
- (input.title || input.description) && /* @__PURE__ */ jsxs27("div", { className: "px-4 py-3 border-b bg-muted/30", children: [
25716
- input.title && /* @__PURE__ */ jsx39("h3", { className: "font-medium text-sm", children: input.title }),
25717
- input.description && /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground mt-1", children: input.description })
26001
+ return /* @__PURE__ */ jsxs28("div", { className: "border rounded-lg overflow-hidden bg-background shadow-sm", children: [
26002
+ (input.title || input.description) && /* @__PURE__ */ jsxs28("div", { className: "px-4 py-3 border-b bg-muted/30", children: [
26003
+ input.title && /* @__PURE__ */ jsx40("h3", { className: "font-medium text-sm", children: input.title }),
26004
+ input.description && /* @__PURE__ */ jsx40("p", { className: "text-xs text-muted-foreground mt-1", children: input.description })
25718
26005
  ] }),
25719
- /* @__PURE__ */ jsxs27("div", { className: "px-4 pt-3", children: [
25720
- /* @__PURE__ */ jsx39("div", { className: "flex items-center gap-1", children: questions.map((_, idx) => /* @__PURE__ */ jsx39(
26006
+ /* @__PURE__ */ jsxs28("div", { className: "px-4 pt-3", children: [
26007
+ /* @__PURE__ */ jsx40("div", { className: "flex items-center gap-1", children: questions.map((_, idx) => /* @__PURE__ */ jsx40(
25721
26008
  "div",
25722
26009
  {
25723
26010
  className: cn(
@@ -25727,19 +26014,19 @@ function AskFollowUpComponent({
25727
26014
  },
25728
26015
  idx
25729
26016
  )) }),
25730
- /* @__PURE__ */ jsxs27("p", { className: "text-xs text-muted-foreground mt-2", children: [
26017
+ /* @__PURE__ */ jsxs28("p", { className: "text-xs text-muted-foreground mt-2", children: [
25731
26018
  "Question ",
25732
26019
  currentStep + 1,
25733
26020
  " of ",
25734
26021
  questions.length
25735
26022
  ] })
25736
26023
  ] }),
25737
- /* @__PURE__ */ jsxs27("div", { className: "p-4", children: [
25738
- /* @__PURE__ */ jsxs27("label", { className: "block text-sm font-medium mb-3", children: [
26024
+ /* @__PURE__ */ jsxs28("div", { className: "p-4", children: [
26025
+ /* @__PURE__ */ jsxs28("label", { className: "block text-sm font-medium mb-3", children: [
25739
26026
  currentQuestion.question,
25740
- currentQuestion.required && /* @__PURE__ */ jsx39("span", { className: "text-destructive ml-1", children: "*" })
26027
+ currentQuestion.required && /* @__PURE__ */ jsx40("span", { className: "text-destructive ml-1", children: "*" })
25741
26028
  ] }),
25742
- currentQuestion.type === "text" && /* @__PURE__ */ jsx39(
26029
+ currentQuestion.type === "text" && /* @__PURE__ */ jsx40(
25743
26030
  "input",
25744
26031
  {
25745
26032
  type: "text",
@@ -25751,7 +26038,7 @@ function AskFollowUpComponent({
25751
26038
  autoFocus: true
25752
26039
  }
25753
26040
  ),
25754
- currentQuestion.type === "select" && currentQuestion.options && /* @__PURE__ */ jsx39("div", { className: "space-y-2", children: currentQuestion.options.map((option) => /* @__PURE__ */ jsx39(
26041
+ currentQuestion.type === "select" && currentQuestion.options && /* @__PURE__ */ jsx40("div", { className: "space-y-2", children: currentQuestion.options.map((option) => /* @__PURE__ */ jsx40(
25755
26042
  "button",
25756
26043
  {
25757
26044
  onClick: () => handleAnswer(option),
@@ -25763,9 +26050,9 @@ function AskFollowUpComponent({
25763
26050
  },
25764
26051
  option
25765
26052
  )) }),
25766
- currentQuestion.type === "multiselect" && currentQuestion.options && /* @__PURE__ */ jsx39("div", { className: "space-y-2", children: currentQuestion.options.map((option) => {
26053
+ currentQuestion.type === "multiselect" && currentQuestion.options && /* @__PURE__ */ jsx40("div", { className: "space-y-2", children: currentQuestion.options.map((option) => {
25767
26054
  const selected = (answers[currentQuestion.id] || []).includes(option);
25768
- return /* @__PURE__ */ jsxs27(
26055
+ return /* @__PURE__ */ jsxs28(
25769
26056
  "button",
25770
26057
  {
25771
26058
  onClick: () => {
@@ -25778,18 +26065,18 @@ function AskFollowUpComponent({
25778
26065
  selected ? "border-primary bg-primary/10" : "hover:bg-muted"
25779
26066
  ),
25780
26067
  children: [
25781
- /* @__PURE__ */ jsx39("div", { className: cn(
26068
+ /* @__PURE__ */ jsx40("div", { className: cn(
25782
26069
  "w-4 h-4 border rounded flex items-center justify-center",
25783
26070
  selected ? "bg-primary border-primary" : "border-muted-foreground"
25784
- ), children: selected && /* @__PURE__ */ jsx39(CheckIcon, { className: "w-3 h-3 text-primary-foreground" }) }),
26071
+ ), children: selected && /* @__PURE__ */ jsx40(CheckIcon, { className: "w-3 h-3 text-primary-foreground" }) }),
25785
26072
  option
25786
26073
  ]
25787
26074
  },
25788
26075
  option
25789
26076
  );
25790
26077
  }) }),
25791
- currentQuestion.type === "boolean" && /* @__PURE__ */ jsxs27("div", { className: "flex gap-3", children: [
25792
- /* @__PURE__ */ jsx39(
26078
+ currentQuestion.type === "boolean" && /* @__PURE__ */ jsxs28("div", { className: "flex gap-3", children: [
26079
+ /* @__PURE__ */ jsx40(
25793
26080
  "button",
25794
26081
  {
25795
26082
  onClick: () => handleAnswer(true),
@@ -25800,7 +26087,7 @@ function AskFollowUpComponent({
25800
26087
  children: "Yes"
25801
26088
  }
25802
26089
  ),
25803
- /* @__PURE__ */ jsx39(
26090
+ /* @__PURE__ */ jsx40(
25804
26091
  "button",
25805
26092
  {
25806
26093
  onClick: () => handleAnswer(false),
@@ -25813,8 +26100,8 @@ function AskFollowUpComponent({
25813
26100
  )
25814
26101
  ] })
25815
26102
  ] }),
25816
- /* @__PURE__ */ jsxs27("div", { className: "px-4 pb-4 flex items-center justify-between", children: [
25817
- /* @__PURE__ */ jsx39(
26103
+ /* @__PURE__ */ jsxs28("div", { className: "px-4 pb-4 flex items-center justify-between", children: [
26104
+ /* @__PURE__ */ jsx40(
25818
26105
  "button",
25819
26106
  {
25820
26107
  onClick: handleBack,
@@ -25826,7 +26113,7 @@ function AskFollowUpComponent({
25826
26113
  children: "Back"
25827
26114
  }
25828
26115
  ),
25829
- /* @__PURE__ */ jsx39(
26116
+ /* @__PURE__ */ jsx40(
25830
26117
  "button",
25831
26118
  {
25832
26119
  onClick: handleNext,
@@ -25842,14 +26129,14 @@ function AskFollowUpComponent({
25842
26129
  ] });
25843
26130
  }
25844
26131
  function CheckIcon({ className }) {
25845
- return /* @__PURE__ */ jsx39(
26132
+ return /* @__PURE__ */ jsx40(
25846
26133
  "svg",
25847
26134
  {
25848
26135
  className,
25849
26136
  fill: "none",
25850
26137
  stroke: "currentColor",
25851
26138
  viewBox: "0 0 24 24",
25852
- children: /* @__PURE__ */ jsx39(
26139
+ children: /* @__PURE__ */ jsx40(
25853
26140
  "path",
25854
26141
  {
25855
26142
  strokeLinecap: "round",
@@ -25862,6 +26149,85 @@ function CheckIcon({ className }) {
25862
26149
  );
25863
26150
  }
25864
26151
 
26152
+ // src/components/ContextIndicator.tsx
26153
+ import { jsx as jsx41, jsxs as jsxs29 } from "react/jsx-runtime";
26154
+ function ContextIndicator({
26155
+ contextHealth,
26156
+ isCompacting = false,
26157
+ className = ""
26158
+ }) {
26159
+ if (!contextHealth) return null;
26160
+ const percentage = Math.round(contextHealth.usage_ratio * 100);
26161
+ const color = getColor(contextHealth.usage_ratio);
26162
+ const tierLabel = contextHealth.last_compaction?.tier;
26163
+ return /* @__PURE__ */ jsxs29("div", { className: `distri-context-indicator ${className}`, title: `Context: ${percentage}% used`, children: [
26164
+ /* @__PURE__ */ jsx41("div", { className: "distri-context-bar-bg", style: { width: "100%", height: 4, background: "#e5e7eb", borderRadius: 2, overflow: "hidden" }, children: /* @__PURE__ */ jsx41(
26165
+ "div",
26166
+ {
26167
+ className: "distri-context-bar-fill",
26168
+ style: {
26169
+ width: `${Math.min(percentage, 100)}%`,
26170
+ height: "100%",
26171
+ background: color,
26172
+ borderRadius: 2,
26173
+ transition: "width 0.5s ease, background 0.3s ease"
26174
+ }
26175
+ }
26176
+ ) }),
26177
+ /* @__PURE__ */ jsxs29("div", { className: "distri-context-label", style: { fontSize: 11, color: "#6b7280", marginTop: 2, display: "flex", justifyContent: "space-between" }, children: [
26178
+ /* @__PURE__ */ jsx41("span", { children: isCompacting ? "Compacting..." : `${percentage}% context used` }),
26179
+ tierLabel && /* @__PURE__ */ jsxs29("span", { style: { opacity: 0.7 }, children: [
26180
+ "Last: ",
26181
+ tierLabel
26182
+ ] })
26183
+ ] })
26184
+ ] });
26185
+ }
26186
+ function getColor(ratio) {
26187
+ if (ratio < 0.5) return "#22c55e";
26188
+ if (ratio < 0.7) return "#eab308";
26189
+ if (ratio < 0.85) return "#f97316";
26190
+ return "#ef4444";
26191
+ }
26192
+
26193
+ // src/hooks/useContextHealth.ts
26194
+ import { useCallback as useCallback21, useRef as useRef14, useState as useState24 } from "react";
26195
+ function useContextHealth() {
26196
+ const [contextHealth, setContextHealth] = useState24(null);
26197
+ const [isCompacting, setIsCompacting] = useState24(false);
26198
+ const lastCompactionRef = useRef14(null);
26199
+ const handleEvent = useCallback21((event) => {
26200
+ if (event?.type !== "context_compaction") return;
26201
+ const compactionEvent = event;
26202
+ lastCompactionRef.current = compactionEvent;
26203
+ setContextHealth({
26204
+ usage_ratio: compactionEvent.tokens_after / compactionEvent.context_limit,
26205
+ tokens_used: compactionEvent.tokens_after,
26206
+ tokens_limit: compactionEvent.context_limit,
26207
+ last_compaction: compactionEvent
26208
+ });
26209
+ setIsCompacting(true);
26210
+ setTimeout(() => setIsCompacting(false), 1500);
26211
+ }, []);
26212
+ const reset = useCallback21(() => {
26213
+ setContextHealth(null);
26214
+ lastCompactionRef.current = null;
26215
+ setIsCompacting(false);
26216
+ }, []);
26217
+ return {
26218
+ /** Current context health snapshot, or null if no compaction has occurred yet */
26219
+ contextHealth,
26220
+ /** The most recent compaction event */
26221
+ lastCompaction: lastCompactionRef.current,
26222
+ /** Whether a compaction just occurred (true for ~1.5s after event) */
26223
+ isCompacting,
26224
+ /** Call with raw event objects from the stream to update health */
26225
+ handleEvent,
26226
+ /** Reset state (e.g., when switching threads) */
26227
+ reset
26228
+ };
26229
+ }
26230
+
25865
26231
  // src/utils/toolWrapper.ts
25866
26232
  import React26 from "react";
25867
26233
  function wrapFnToolAsUiTool(fnTool, options = {}) {
@@ -25888,16 +26254,237 @@ function wrapTools(tools, options = {}) {
25888
26254
  });
25889
26255
  }
25890
26256
 
26257
+ // src/useWorkflow.ts
26258
+ import { useState as useState25, useCallback as useCallback22, useMemo as useMemo9 } from "react";
26259
+ import { countSteps, workflowProgress } from "@distri/core";
26260
+ function useWorkflow({ workflow: initial, onExecuteStep, onStateChange }) {
26261
+ const [workflow, setWorkflow] = useState25(initial);
26262
+ const [isRunning, setIsRunning] = useState25(false);
26263
+ const progress = useMemo9(() => workflowProgress(workflow), [workflow]);
26264
+ const counts = useMemo9(() => countSteps(workflow), [workflow]);
26265
+ const updateAndNotify = useCallback22((w) => {
26266
+ setWorkflow(w);
26267
+ onStateChange?.(w);
26268
+ }, [onStateChange]);
26269
+ const findNextRunnable = useCallback22(() => {
26270
+ for (let i = 0; i < workflow.steps.length; i++) {
26271
+ const step = workflow.steps[i];
26272
+ if (step.status !== "pending") continue;
26273
+ const depsMet = (step.depends_on ?? []).every(
26274
+ (depId) => workflow.steps.some((s) => s.id === depId && s.status === "done")
26275
+ );
26276
+ if (depsMet) return i;
26277
+ }
26278
+ return null;
26279
+ }, [workflow]);
26280
+ const runNextStep = useCallback22(async () => {
26281
+ const idx = findNextRunnable();
26282
+ if (idx === null) return;
26283
+ const step = workflow.steps[idx];
26284
+ const updated = { ...workflow };
26285
+ updated.steps = [...workflow.steps];
26286
+ updated.steps[idx] = { ...step, status: "running", started_at: (/* @__PURE__ */ new Date()).toISOString() };
26287
+ updated.status = "running";
26288
+ updateAndNotify(updated);
26289
+ setIsRunning(true);
26290
+ try {
26291
+ const result = await onExecuteStep(step.id, step, workflow.context ?? {});
26292
+ const final_ = { ...updated };
26293
+ final_.steps = [...updated.steps];
26294
+ final_.steps[idx] = {
26295
+ ...final_.steps[idx],
26296
+ status: result.status,
26297
+ result: result.result,
26298
+ error: result.error,
26299
+ completed_at: (/* @__PURE__ */ new Date()).toISOString()
26300
+ };
26301
+ if (result.context_updates) {
26302
+ final_.context = { ...final_.context, ...result.context_updates };
26303
+ }
26304
+ const allDone = final_.steps.every((s) => s.status === "done" || s.status === "skipped");
26305
+ const hasFailed = final_.steps.some((s) => s.status === "failed");
26306
+ if (allDone) final_.status = "completed";
26307
+ else if (hasFailed) final_.status = "failed";
26308
+ final_.updated_at = (/* @__PURE__ */ new Date()).toISOString();
26309
+ updateAndNotify(final_);
26310
+ } catch (err) {
26311
+ const errMsg = err instanceof Error ? err.message : String(err);
26312
+ const final_ = { ...updated };
26313
+ final_.steps = [...updated.steps];
26314
+ final_.steps[idx] = { ...final_.steps[idx], status: "failed", error: errMsg, completed_at: (/* @__PURE__ */ new Date()).toISOString() };
26315
+ final_.status = "failed";
26316
+ updateAndNotify(final_);
26317
+ } finally {
26318
+ setIsRunning(false);
26319
+ }
26320
+ }, [workflow, findNextRunnable, onExecuteStep, updateAndNotify]);
26321
+ const runAll = useCallback22(async () => {
26322
+ let current = workflow;
26323
+ setIsRunning(true);
26324
+ try {
26325
+ while (true) {
26326
+ const idx = (() => {
26327
+ for (let i = 0; i < current.steps.length; i++) {
26328
+ const step2 = current.steps[i];
26329
+ if (step2.status !== "pending") continue;
26330
+ const depsMet = (step2.depends_on ?? []).every(
26331
+ (depId) => current.steps.some((s) => s.id === depId && s.status === "done")
26332
+ );
26333
+ if (depsMet) return i;
26334
+ }
26335
+ return null;
26336
+ })();
26337
+ if (idx === null) break;
26338
+ const step = current.steps[idx];
26339
+ current = { ...current, steps: [...current.steps] };
26340
+ current.steps[idx] = { ...step, status: "running", started_at: (/* @__PURE__ */ new Date()).toISOString() };
26341
+ current.status = "running";
26342
+ updateAndNotify(current);
26343
+ const result = await onExecuteStep(step.id, step, current.context ?? {});
26344
+ current = { ...current, steps: [...current.steps] };
26345
+ current.steps[idx] = {
26346
+ ...current.steps[idx],
26347
+ status: result.status,
26348
+ result: result.result,
26349
+ error: result.error,
26350
+ completed_at: (/* @__PURE__ */ new Date()).toISOString()
26351
+ };
26352
+ if (result.context_updates) {
26353
+ current.context = { ...current.context, ...result.context_updates };
26354
+ }
26355
+ if (result.status === "failed") {
26356
+ current.status = "failed";
26357
+ updateAndNotify(current);
26358
+ break;
26359
+ }
26360
+ const allDone = current.steps.every((s) => s.status === "done" || s.status === "skipped");
26361
+ if (allDone) current.status = "completed";
26362
+ current.updated_at = (/* @__PURE__ */ new Date()).toISOString();
26363
+ updateAndNotify(current);
26364
+ }
26365
+ } finally {
26366
+ setIsRunning(false);
26367
+ }
26368
+ }, [workflow, onExecuteStep, updateAndNotify]);
26369
+ const updateWorkflow = useCallback22((w) => {
26370
+ setWorkflow(w);
26371
+ }, []);
26372
+ return { workflow, isRunning, progress, counts, runNextStep, runAll, updateWorkflow };
26373
+ }
26374
+
26375
+ // src/useWorkflowRunner.ts
26376
+ import { useState as useState26, useCallback as useCallback23, useRef as useRef15 } from "react";
26377
+ import {
26378
+ WorkflowRunner
26379
+ } from "@distri/core";
26380
+ function useWorkflowRunner(options = {}) {
26381
+ const { client } = useDistri();
26382
+ const [isRunning, setIsRunning] = useState26(false);
26383
+ const [status, setStatus] = useState26(null);
26384
+ const [events, setEvents] = useState26([]);
26385
+ const stoppedRef = useRef15(false);
26386
+ const run2 = useCallback23(async (workflow, input = {}) => {
26387
+ if (!client) throw new Error("DistriClient not initialized");
26388
+ const runner = new WorkflowRunner(client, {
26389
+ buildRequest: options.buildRequest,
26390
+ env: options.env,
26391
+ executeStep: options.executeStep
26392
+ });
26393
+ setIsRunning(true);
26394
+ setStatus("running");
26395
+ setEvents([]);
26396
+ stoppedRef.current = false;
26397
+ let finalStatus = "failed";
26398
+ try {
26399
+ for await (const event of runner.run(workflow, input)) {
26400
+ if (stoppedRef.current) break;
26401
+ setEvents((prev) => [...prev, event]);
26402
+ options.onEvent?.(event);
26403
+ if (event.event === "workflow_completed") {
26404
+ finalStatus = event.status;
26405
+ setStatus(event.status);
26406
+ }
26407
+ }
26408
+ } catch (err) {
26409
+ finalStatus = "failed";
26410
+ setStatus("failed");
26411
+ } finally {
26412
+ setIsRunning(false);
26413
+ }
26414
+ return finalStatus;
26415
+ }, [client, options.buildRequest, options.env, options.executeStep, options.onEvent]);
26416
+ const stop = useCallback23(() => {
26417
+ stoppedRef.current = true;
26418
+ }, []);
26419
+ return { run: run2, isRunning, status, events, stop };
26420
+ }
26421
+
26422
+ // src/components/WorkflowProgress.tsx
26423
+ import { stepIcon, workflowProgress as workflowProgress2 } from "@distri/core";
26424
+ import { jsx as jsx42, jsxs as jsxs30 } from "react/jsx-runtime";
26425
+ function WorkflowProgress({ workflow, className, detailed }) {
26426
+ const progress = workflowProgress2(workflow);
26427
+ const done = workflow.steps.filter((s) => s.status === "done" || s.status === "skipped").length;
26428
+ const total = workflow.steps.length;
26429
+ return /* @__PURE__ */ jsxs30("div", { className, children: [
26430
+ /* @__PURE__ */ jsxs30("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
26431
+ /* @__PURE__ */ jsx42("div", { style: {
26432
+ flex: 1,
26433
+ height: 6,
26434
+ borderRadius: 3,
26435
+ backgroundColor: "var(--muted, #e5e7eb)",
26436
+ overflow: "hidden"
26437
+ }, children: /* @__PURE__ */ jsx42("div", { style: {
26438
+ width: `${progress}%`,
26439
+ height: "100%",
26440
+ borderRadius: 3,
26441
+ backgroundColor: workflow.status === "failed" ? "var(--destructive, #ef4444)" : "var(--primary, #6366f1)",
26442
+ transition: "width 0.3s ease"
26443
+ } }) }),
26444
+ /* @__PURE__ */ jsxs30("span", { style: { fontSize: 12, color: "var(--muted-foreground, #6b7280)", whiteSpace: "nowrap" }, children: [
26445
+ done,
26446
+ "/",
26447
+ total
26448
+ ] })
26449
+ ] }),
26450
+ /* @__PURE__ */ jsx42("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: workflow.steps.map((step) => /* @__PURE__ */ jsxs30(
26451
+ "div",
26452
+ {
26453
+ style: {
26454
+ display: "flex",
26455
+ alignItems: "flex-start",
26456
+ gap: 8,
26457
+ padding: "6px 0",
26458
+ opacity: step.status === "skipped" ? 0.5 : 1
26459
+ },
26460
+ children: [
26461
+ /* @__PURE__ */ jsx42("span", { style: { fontSize: 14, lineHeight: "20px" }, children: stepIcon(step.status ?? "pending") }),
26462
+ /* @__PURE__ */ jsxs30("div", { style: { flex: 1, minWidth: 0 }, children: [
26463
+ /* @__PURE__ */ jsx42("div", { style: {
26464
+ fontSize: 13,
26465
+ fontWeight: step.status === "running" ? 600 : 400,
26466
+ color: step.status === "failed" ? "var(--destructive, #ef4444)" : "inherit"
26467
+ }, children: step.label }),
26468
+ step.error && /* @__PURE__ */ jsx42("div", { style: { fontSize: 11, color: "var(--destructive, #ef4444)", marginTop: 2 }, children: step.error }),
26469
+ detailed && step.result != null && step.status === "done" && /* @__PURE__ */ jsx42("div", { style: { fontSize: 11, color: "var(--muted-foreground, #6b7280)", marginTop: 2 }, children: String(typeof step.result === "string" ? step.result : JSON.stringify(step.result)).slice(0, 100) })
26470
+ ] })
26471
+ ]
26472
+ },
26473
+ step.id
26474
+ )) })
26475
+ ] });
26476
+ }
26477
+
25891
26478
  // src/components/ui/dialog.tsx
25892
26479
  import * as React27 from "react";
25893
- import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
26480
+ import { jsx as jsx43, jsxs as jsxs31 } from "react/jsx-runtime";
25894
26481
  var Dialog = React27.createContext({});
25895
26482
  var DialogRoot = ({ open, onOpenChange, children }) => {
25896
- return /* @__PURE__ */ jsx40(Dialog.Provider, { value: { open, onOpenChange }, children });
26483
+ return /* @__PURE__ */ jsx43(Dialog.Provider, { value: { open, onOpenChange }, children });
25897
26484
  };
25898
26485
  var DialogTrigger = React27.forwardRef(({ className, children, ...props }, ref) => {
25899
26486
  const context = React27.useContext(Dialog);
25900
- return /* @__PURE__ */ jsx40(
26487
+ return /* @__PURE__ */ jsx43(
25901
26488
  "button",
25902
26489
  {
25903
26490
  ref,
@@ -25912,7 +26499,7 @@ DialogTrigger.displayName = "DialogTrigger";
25912
26499
  var DialogContent = React27.forwardRef(({ className, children, ...props }, ref) => {
25913
26500
  const context = React27.useContext(Dialog);
25914
26501
  if (!context.open) return null;
25915
- return /* @__PURE__ */ jsx40("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm", children: /* @__PURE__ */ jsxs28(
26502
+ return /* @__PURE__ */ jsx43("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm", children: /* @__PURE__ */ jsxs31(
25916
26503
  "div",
25917
26504
  {
25918
26505
  ref,
@@ -25923,12 +26510,12 @@ var DialogContent = React27.forwardRef(({ className, children, ...props }, ref)
25923
26510
  ...props,
25924
26511
  children: [
25925
26512
  children,
25926
- /* @__PURE__ */ jsx40(
26513
+ /* @__PURE__ */ jsx43(
25927
26514
  "button",
25928
26515
  {
25929
26516
  className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
25930
26517
  onClick: () => context.onOpenChange?.(false),
25931
- children: /* @__PURE__ */ jsxs28(
26518
+ children: /* @__PURE__ */ jsxs31(
25932
26519
  "svg",
25933
26520
  {
25934
26521
  width: "24",
@@ -25941,8 +26528,8 @@ var DialogContent = React27.forwardRef(({ className, children, ...props }, ref)
25941
26528
  strokeLinejoin: "round",
25942
26529
  className: "h-4 w-4",
25943
26530
  children: [
25944
- /* @__PURE__ */ jsx40("path", { d: "m18 6-12 12" }),
25945
- /* @__PURE__ */ jsx40("path", { d: "m6 6 12 12" })
26531
+ /* @__PURE__ */ jsx43("path", { d: "m18 6-12 12" }),
26532
+ /* @__PURE__ */ jsx43("path", { d: "m6 6 12 12" })
25946
26533
  ]
25947
26534
  }
25948
26535
  )
@@ -25953,7 +26540,7 @@ var DialogContent = React27.forwardRef(({ className, children, ...props }, ref)
25953
26540
  ) });
25954
26541
  });
25955
26542
  DialogContent.displayName = "DialogContent";
25956
- var DialogHeader = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx40(
26543
+ var DialogHeader = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx43(
25957
26544
  "div",
25958
26545
  {
25959
26546
  ref,
@@ -25965,7 +26552,7 @@ var DialogHeader = React27.forwardRef(({ className, ...props }, ref) => /* @__PU
25965
26552
  }
25966
26553
  ));
25967
26554
  DialogHeader.displayName = "DialogHeader";
25968
- var DialogTitle = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx40(
26555
+ var DialogTitle = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx43(
25969
26556
  "h3",
25970
26557
  {
25971
26558
  ref,
@@ -25980,10 +26567,10 @@ DialogTitle.displayName = "DialogTitle";
25980
26567
 
25981
26568
  // src/components/ui/textarea.tsx
25982
26569
  import * as React28 from "react";
25983
- import { jsx as jsx41 } from "react/jsx-runtime";
26570
+ import { jsx as jsx44 } from "react/jsx-runtime";
25984
26571
  var Textarea = React28.forwardRef(
25985
26572
  ({ className, ...props }, ref) => {
25986
- return /* @__PURE__ */ jsx41(
26573
+ return /* @__PURE__ */ jsx44(
25987
26574
  "textarea",
25988
26575
  {
25989
26576
  className: cn(
@@ -26007,9 +26594,9 @@ import { PanelLeft } from "lucide-react";
26007
26594
  // src/components/ui/separator.tsx
26008
26595
  import * as React29 from "react";
26009
26596
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
26010
- import { jsx as jsx42 } from "react/jsx-runtime";
26597
+ import { jsx as jsx45 } from "react/jsx-runtime";
26011
26598
  var Separator2 = React29.forwardRef(
26012
- ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx42(
26599
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx45(
26013
26600
  SeparatorPrimitive.Root,
26014
26601
  {
26015
26602
  ref,
@@ -26031,10 +26618,10 @@ import * as React30 from "react";
26031
26618
  import * as SheetPrimitive from "@radix-ui/react-dialog";
26032
26619
  import { cva as cva2 } from "class-variance-authority";
26033
26620
  import { X as X4 } from "lucide-react";
26034
- import { jsx as jsx43, jsxs as jsxs29 } from "react/jsx-runtime";
26621
+ import { jsx as jsx46, jsxs as jsxs32 } from "react/jsx-runtime";
26035
26622
  var Sheet = SheetPrimitive.Root;
26036
26623
  var SheetPortal = SheetPrimitive.Portal;
26037
- var SheetOverlay = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx43(
26624
+ var SheetOverlay = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx46(
26038
26625
  SheetPrimitive.Overlay,
26039
26626
  {
26040
26627
  className: cn(
@@ -26062,9 +26649,9 @@ var sheetVariants = cva2(
26062
26649
  }
26063
26650
  }
26064
26651
  );
26065
- var SheetContent = React30.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs29(SheetPortal, { children: [
26066
- /* @__PURE__ */ jsx43(SheetOverlay, {}),
26067
- /* @__PURE__ */ jsxs29(
26652
+ var SheetContent = React30.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs32(SheetPortal, { children: [
26653
+ /* @__PURE__ */ jsx46(SheetOverlay, {}),
26654
+ /* @__PURE__ */ jsxs32(
26068
26655
  SheetPrimitive.Content,
26069
26656
  {
26070
26657
  ref,
@@ -26072,9 +26659,9 @@ var SheetContent = React30.forwardRef(({ side = "right", className, children, ..
26072
26659
  ...props,
26073
26660
  children: [
26074
26661
  children,
26075
- /* @__PURE__ */ jsxs29(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
26076
- /* @__PURE__ */ jsx43(X4, { className: "h-4 w-4" }),
26077
- /* @__PURE__ */ jsx43("span", { className: "sr-only", children: "Close" })
26662
+ /* @__PURE__ */ jsxs32(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
26663
+ /* @__PURE__ */ jsx46(X4, { className: "h-4 w-4" }),
26664
+ /* @__PURE__ */ jsx46("span", { className: "sr-only", children: "Close" })
26078
26665
  ] })
26079
26666
  ]
26080
26667
  }
@@ -26084,7 +26671,7 @@ SheetContent.displayName = SheetPrimitive.Content.displayName;
26084
26671
  var SheetHeader = ({
26085
26672
  className,
26086
26673
  ...props
26087
- }) => /* @__PURE__ */ jsx43(
26674
+ }) => /* @__PURE__ */ jsx46(
26088
26675
  "div",
26089
26676
  {
26090
26677
  className: cn(
@@ -26098,7 +26685,7 @@ SheetHeader.displayName = "SheetHeader";
26098
26685
  var SheetFooter = ({
26099
26686
  className,
26100
26687
  ...props
26101
- }) => /* @__PURE__ */ jsx43(
26688
+ }) => /* @__PURE__ */ jsx46(
26102
26689
  "div",
26103
26690
  {
26104
26691
  className: cn(
@@ -26109,7 +26696,7 @@ var SheetFooter = ({
26109
26696
  }
26110
26697
  );
26111
26698
  SheetFooter.displayName = "SheetFooter";
26112
- var SheetTitle = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx43(
26699
+ var SheetTitle = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx46(
26113
26700
  SheetPrimitive.Title,
26114
26701
  {
26115
26702
  ref,
@@ -26118,7 +26705,7 @@ var SheetTitle = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE
26118
26705
  }
26119
26706
  ));
26120
26707
  SheetTitle.displayName = SheetPrimitive.Title.displayName;
26121
- var SheetDescription = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx43(
26708
+ var SheetDescription = React30.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx46(
26122
26709
  SheetPrimitive.Description,
26123
26710
  {
26124
26711
  ref,
@@ -26131,11 +26718,11 @@ SheetDescription.displayName = SheetPrimitive.Description.displayName;
26131
26718
  // src/components/ui/tooltip.tsx
26132
26719
  import * as React31 from "react";
26133
26720
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
26134
- import { jsx as jsx44 } from "react/jsx-runtime";
26721
+ import { jsx as jsx47 } from "react/jsx-runtime";
26135
26722
  var TooltipProvider = TooltipPrimitive.Provider;
26136
26723
  var Tooltip = TooltipPrimitive.Root;
26137
26724
  var TooltipTrigger = TooltipPrimitive.Trigger;
26138
- var TooltipContent = React31.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx44(
26725
+ var TooltipContent = React31.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx47(
26139
26726
  TooltipPrimitive.Content,
26140
26727
  {
26141
26728
  ref,
@@ -26150,7 +26737,7 @@ var TooltipContent = React31.forwardRef(({ className, sideOffset = 4, ...props }
26150
26737
  TooltipContent.displayName = TooltipPrimitive.Content.displayName;
26151
26738
 
26152
26739
  // src/components/ui/sidebar.tsx
26153
- import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
26740
+ import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
26154
26741
  var SIDEBAR_COOKIE_NAME = "sidebar:state";
26155
26742
  var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
26156
26743
  var SIDEBAR_WIDTH = "16rem";
@@ -26233,7 +26820,7 @@ var SidebarProvider = React32.forwardRef(({ defaultOpen = true, open: openProp,
26233
26820
  };
26234
26821
  return vars;
26235
26822
  }, [style2]);
26236
- return /* @__PURE__ */ jsx45(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx45(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx45(
26823
+ return /* @__PURE__ */ jsx48(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx48(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx48(
26237
26824
  "div",
26238
26825
  {
26239
26826
  style: providerStyle,
@@ -26251,7 +26838,7 @@ SidebarProvider.displayName = "SidebarProvider";
26251
26838
  var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }, ref) => {
26252
26839
  const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
26253
26840
  if (collapsible === "none") {
26254
- return /* @__PURE__ */ jsx45(
26841
+ return /* @__PURE__ */ jsx48(
26255
26842
  "div",
26256
26843
  {
26257
26844
  className: cn(
@@ -26268,7 +26855,7 @@ var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsi
26268
26855
  "--sidebar-width": SIDEBAR_WIDTH_MOBILE
26269
26856
  };
26270
26857
  if (isMobile) {
26271
- return /* @__PURE__ */ jsx45(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsx45(
26858
+ return /* @__PURE__ */ jsx48(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsx48(
26272
26859
  SheetContent,
26273
26860
  {
26274
26861
  "data-sidebar": "sidebar",
@@ -26276,11 +26863,11 @@ var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsi
26276
26863
  className: "w-[--sidebar-width-mobile] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",
26277
26864
  style: sheetStyles,
26278
26865
  side,
26279
- children: /* @__PURE__ */ jsx45("div", { className: "flex h-full w-full flex-col", children })
26866
+ children: /* @__PURE__ */ jsx48("div", { className: "flex h-full w-full flex-col", children })
26280
26867
  }
26281
26868
  ) });
26282
26869
  }
26283
- return /* @__PURE__ */ jsxs30(
26870
+ return /* @__PURE__ */ jsxs33(
26284
26871
  "div",
26285
26872
  {
26286
26873
  ref,
@@ -26290,7 +26877,7 @@ var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsi
26290
26877
  "data-variant": variant,
26291
26878
  "data-side": side,
26292
26879
  children: [
26293
- /* @__PURE__ */ jsx45(
26880
+ /* @__PURE__ */ jsx48(
26294
26881
  "div",
26295
26882
  {
26296
26883
  className: cn(
@@ -26301,7 +26888,7 @@ var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsi
26301
26888
  )
26302
26889
  }
26303
26890
  ),
26304
- /* @__PURE__ */ jsx45(
26891
+ /* @__PURE__ */ jsx48(
26305
26892
  "div",
26306
26893
  {
26307
26894
  className: cn(
@@ -26312,7 +26899,7 @@ var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsi
26312
26899
  className
26313
26900
  ),
26314
26901
  ...props,
26315
- children: /* @__PURE__ */ jsx45(
26902
+ children: /* @__PURE__ */ jsx48(
26316
26903
  "div",
26317
26904
  {
26318
26905
  "data-sidebar": "sidebar",
@@ -26329,7 +26916,7 @@ var Sidebar = React32.forwardRef(({ side = "left", variant = "sidebar", collapsi
26329
26916
  Sidebar.displayName = "Sidebar";
26330
26917
  var SidebarTrigger = React32.forwardRef(({ className, onClick, ...props }, ref) => {
26331
26918
  const { toggleSidebar } = useSidebar();
26332
- return /* @__PURE__ */ jsxs30(
26919
+ return /* @__PURE__ */ jsxs33(
26333
26920
  Button,
26334
26921
  {
26335
26922
  ref,
@@ -26343,8 +26930,8 @@ var SidebarTrigger = React32.forwardRef(({ className, onClick, ...props }, ref)
26343
26930
  },
26344
26931
  ...props,
26345
26932
  children: [
26346
- /* @__PURE__ */ jsx45(PanelLeft, {}),
26347
- /* @__PURE__ */ jsx45("span", { className: "sr-only", children: "Toggle Sidebar" })
26933
+ /* @__PURE__ */ jsx48(PanelLeft, {}),
26934
+ /* @__PURE__ */ jsx48("span", { className: "sr-only", children: "Toggle Sidebar" })
26348
26935
  ]
26349
26936
  }
26350
26937
  );
@@ -26352,7 +26939,7 @@ var SidebarTrigger = React32.forwardRef(({ className, onClick, ...props }, ref)
26352
26939
  SidebarTrigger.displayName = "SidebarTrigger";
26353
26940
  var SidebarRail = React32.forwardRef(({ className, ...props }, ref) => {
26354
26941
  const { toggleSidebar } = useSidebar();
26355
- return /* @__PURE__ */ jsx45(
26942
+ return /* @__PURE__ */ jsx48(
26356
26943
  "button",
26357
26944
  {
26358
26945
  ref,
@@ -26376,7 +26963,7 @@ var SidebarRail = React32.forwardRef(({ className, ...props }, ref) => {
26376
26963
  });
26377
26964
  SidebarRail.displayName = "SidebarRail";
26378
26965
  var SidebarInset = React32.forwardRef(({ className, ...props }, ref) => {
26379
- return /* @__PURE__ */ jsx45(
26966
+ return /* @__PURE__ */ jsx48(
26380
26967
  "main",
26381
26968
  {
26382
26969
  ref,
@@ -26391,7 +26978,7 @@ var SidebarInset = React32.forwardRef(({ className, ...props }, ref) => {
26391
26978
  });
26392
26979
  SidebarInset.displayName = "SidebarInset";
26393
26980
  var SidebarHeader = React32.forwardRef(({ className, ...props }, ref) => {
26394
- return /* @__PURE__ */ jsx45(
26981
+ return /* @__PURE__ */ jsx48(
26395
26982
  "div",
26396
26983
  {
26397
26984
  ref,
@@ -26403,7 +26990,7 @@ var SidebarHeader = React32.forwardRef(({ className, ...props }, ref) => {
26403
26990
  });
26404
26991
  SidebarHeader.displayName = "SidebarHeader";
26405
26992
  var SidebarFooter = React32.forwardRef(({ className, ...props }, ref) => {
26406
- return /* @__PURE__ */ jsx45(
26993
+ return /* @__PURE__ */ jsx48(
26407
26994
  "div",
26408
26995
  {
26409
26996
  ref,
@@ -26415,7 +27002,7 @@ var SidebarFooter = React32.forwardRef(({ className, ...props }, ref) => {
26415
27002
  });
26416
27003
  SidebarFooter.displayName = "SidebarFooter";
26417
27004
  var SidebarSeparator = React32.forwardRef(({ className, ...props }, ref) => {
26418
- return /* @__PURE__ */ jsx45(
27005
+ return /* @__PURE__ */ jsx48(
26419
27006
  Separator2,
26420
27007
  {
26421
27008
  ref,
@@ -26427,7 +27014,7 @@ var SidebarSeparator = React32.forwardRef(({ className, ...props }, ref) => {
26427
27014
  });
26428
27015
  SidebarSeparator.displayName = "SidebarSeparator";
26429
27016
  var SidebarContent = React32.forwardRef(({ className, ...props }, ref) => {
26430
- return /* @__PURE__ */ jsx45(
27017
+ return /* @__PURE__ */ jsx48(
26431
27018
  "div",
26432
27019
  {
26433
27020
  ref,
@@ -26442,7 +27029,7 @@ var SidebarContent = React32.forwardRef(({ className, ...props }, ref) => {
26442
27029
  });
26443
27030
  SidebarContent.displayName = "SidebarContent";
26444
27031
  var SidebarGroup = React32.forwardRef(({ className, ...props }, ref) => {
26445
- return /* @__PURE__ */ jsx45(
27032
+ return /* @__PURE__ */ jsx48(
26446
27033
  "div",
26447
27034
  {
26448
27035
  ref,
@@ -26455,7 +27042,7 @@ var SidebarGroup = React32.forwardRef(({ className, ...props }, ref) => {
26455
27042
  SidebarGroup.displayName = "SidebarGroup";
26456
27043
  var SidebarGroupLabel = React32.forwardRef(({ className, asChild = false, ...props }, ref) => {
26457
27044
  const Comp = asChild ? Slot : "div";
26458
- return /* @__PURE__ */ jsx45(
27045
+ return /* @__PURE__ */ jsx48(
26459
27046
  Comp,
26460
27047
  {
26461
27048
  ref,
@@ -26472,7 +27059,7 @@ var SidebarGroupLabel = React32.forwardRef(({ className, asChild = false, ...pro
26472
27059
  SidebarGroupLabel.displayName = "SidebarGroupLabel";
26473
27060
  var SidebarGroupAction = React32.forwardRef(({ className, asChild = false, ...props }, ref) => {
26474
27061
  const Comp = asChild ? Slot : "button";
26475
- return /* @__PURE__ */ jsx45(
27062
+ return /* @__PURE__ */ jsx48(
26476
27063
  Comp,
26477
27064
  {
26478
27065
  ref,
@@ -26490,7 +27077,7 @@ var SidebarGroupAction = React32.forwardRef(({ className, asChild = false, ...pr
26490
27077
  });
26491
27078
  SidebarGroupAction.displayName = "SidebarGroupAction";
26492
27079
  var SidebarGroupContent = React32.forwardRef(({ className, ...props }, ref) => {
26493
- return /* @__PURE__ */ jsx45(
27080
+ return /* @__PURE__ */ jsx48(
26494
27081
  "div",
26495
27082
  {
26496
27083
  ref,
@@ -26502,7 +27089,7 @@ var SidebarGroupContent = React32.forwardRef(({ className, ...props }, ref) => {
26502
27089
  });
26503
27090
  SidebarGroupContent.displayName = "SidebarGroupContent";
26504
27091
  var SidebarMenu = React32.forwardRef(({ className, ...props }, ref) => {
26505
- return /* @__PURE__ */ jsx45(
27092
+ return /* @__PURE__ */ jsx48(
26506
27093
  "ul",
26507
27094
  {
26508
27095
  ref,
@@ -26514,7 +27101,7 @@ var SidebarMenu = React32.forwardRef(({ className, ...props }, ref) => {
26514
27101
  });
26515
27102
  SidebarMenu.displayName = "SidebarMenu";
26516
27103
  var SidebarMenuItem = React32.forwardRef(({ className, ...props }, ref) => {
26517
- return /* @__PURE__ */ jsx45(
27104
+ return /* @__PURE__ */ jsx48(
26518
27105
  "li",
26519
27106
  {
26520
27107
  ref,
@@ -26548,7 +27135,7 @@ var sidebarMenuButtonVariants = cva3(
26548
27135
  var SidebarMenuButton = React32.forwardRef(({ asChild = false, isActive: isActive2 = false, variant = "default", size = "default", tooltip, className, ...props }, ref) => {
26549
27136
  const Comp = asChild ? Slot : "button";
26550
27137
  const { isMobile, state } = useSidebar();
26551
- const button = /* @__PURE__ */ jsx45(
27138
+ const button = /* @__PURE__ */ jsx48(
26552
27139
  Comp,
26553
27140
  {
26554
27141
  ref,
@@ -26567,9 +27154,9 @@ var SidebarMenuButton = React32.forwardRef(({ asChild = false, isActive: isActiv
26567
27154
  children: tooltip
26568
27155
  };
26569
27156
  }
26570
- return /* @__PURE__ */ jsxs30(Tooltip, { children: [
26571
- /* @__PURE__ */ jsx45(TooltipTrigger, { asChild: true, children: button }),
26572
- /* @__PURE__ */ jsx45(
27157
+ return /* @__PURE__ */ jsxs33(Tooltip, { children: [
27158
+ /* @__PURE__ */ jsx48(TooltipTrigger, { asChild: true, children: button }),
27159
+ /* @__PURE__ */ jsx48(
26573
27160
  TooltipContent,
26574
27161
  {
26575
27162
  side: "right",
@@ -26583,7 +27170,7 @@ var SidebarMenuButton = React32.forwardRef(({ asChild = false, isActive: isActiv
26583
27170
  SidebarMenuButton.displayName = "SidebarMenuButton";
26584
27171
  var SidebarMenuAction = React32.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
26585
27172
  const Comp = asChild ? Slot : "button";
26586
- return /* @__PURE__ */ jsx45(
27173
+ return /* @__PURE__ */ jsx48(
26587
27174
  Comp,
26588
27175
  {
26589
27176
  ref,
@@ -26605,7 +27192,7 @@ var SidebarMenuAction = React32.forwardRef(({ className, asChild = false, showOn
26605
27192
  });
26606
27193
  SidebarMenuAction.displayName = "SidebarMenuAction";
26607
27194
  var SidebarMenuBadge = React32.forwardRef(({ className, ...props }, ref) => {
26608
- return /* @__PURE__ */ jsx45(
27195
+ return /* @__PURE__ */ jsx48(
26609
27196
  "div",
26610
27197
  {
26611
27198
  ref,
@@ -26629,7 +27216,7 @@ var SidebarMenuSkeleton = React32.forwardRef(({ className, showIcon = false, ...
26629
27216
  return `${Math.floor(Math.random() * 40) + 50}%`;
26630
27217
  }, []);
26631
27218
  const skeletonStyle = { "--skeleton-width": width };
26632
- return /* @__PURE__ */ jsxs30(
27219
+ return /* @__PURE__ */ jsxs33(
26633
27220
  "div",
26634
27221
  {
26635
27222
  ref,
@@ -26637,8 +27224,8 @@ var SidebarMenuSkeleton = React32.forwardRef(({ className, showIcon = false, ...
26637
27224
  className: cn("rounded-md h-8 flex gap-2 px-2 items-center", className),
26638
27225
  ...props,
26639
27226
  children: [
26640
- showIcon && /* @__PURE__ */ jsx45(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }),
26641
- /* @__PURE__ */ jsx45(
27227
+ showIcon && /* @__PURE__ */ jsx48(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }),
27228
+ /* @__PURE__ */ jsx48(
26642
27229
  Skeleton,
26643
27230
  {
26644
27231
  className: "h-4 flex-1 max-w-[--skeleton-width]",
@@ -26652,7 +27239,7 @@ var SidebarMenuSkeleton = React32.forwardRef(({ className, showIcon = false, ...
26652
27239
  });
26653
27240
  SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
26654
27241
  var SidebarMenuSub = React32.forwardRef(({ className, ...props }, ref) => {
26655
- return /* @__PURE__ */ jsx45(
27242
+ return /* @__PURE__ */ jsx48(
26656
27243
  "ul",
26657
27244
  {
26658
27245
  ref,
@@ -26668,12 +27255,12 @@ var SidebarMenuSub = React32.forwardRef(({ className, ...props }, ref) => {
26668
27255
  });
26669
27256
  SidebarMenuSub.displayName = "SidebarMenuSub";
26670
27257
  var SidebarMenuSubItem = React32.forwardRef(({ ...props }, ref) => {
26671
- return /* @__PURE__ */ jsx45("li", { ref, ...props });
27258
+ return /* @__PURE__ */ jsx48("li", { ref, ...props });
26672
27259
  });
26673
27260
  SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
26674
27261
  var SidebarMenuSubButton = React32.forwardRef(({ asChild = false, size = "md", isActive: isActive2, className, ...props }, ref) => {
26675
27262
  const Comp = asChild ? Slot : "a";
26676
- return /* @__PURE__ */ jsx45(
27263
+ return /* @__PURE__ */ jsx48(
26677
27264
  Comp,
26678
27265
  {
26679
27266
  ref,
@@ -26698,14 +27285,14 @@ SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
26698
27285
  import * as React33 from "react";
26699
27286
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
26700
27287
  import { Check as Check3, ChevronRight as ChevronRight2, Circle as Circle2 } from "lucide-react";
26701
- import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
27288
+ import { jsx as jsx49, jsxs as jsxs34 } from "react/jsx-runtime";
26702
27289
  var DropdownMenu = DropdownMenuPrimitive.Root;
26703
27290
  var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
26704
27291
  var DropdownMenuGroup = DropdownMenuPrimitive.Group;
26705
27292
  var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
26706
27293
  var DropdownMenuSub = DropdownMenuPrimitive.Sub;
26707
27294
  var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
26708
- var DropdownMenuSubTrigger = React33.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs31(
27295
+ var DropdownMenuSubTrigger = React33.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs34(
26709
27296
  DropdownMenuPrimitive.SubTrigger,
26710
27297
  {
26711
27298
  ref,
@@ -26717,12 +27304,12 @@ var DropdownMenuSubTrigger = React33.forwardRef(({ className, inset, children, .
26717
27304
  ...props,
26718
27305
  children: [
26719
27306
  children,
26720
- /* @__PURE__ */ jsx46(ChevronRight2, { className: "ml-auto" })
27307
+ /* @__PURE__ */ jsx49(ChevronRight2, { className: "ml-auto" })
26721
27308
  ]
26722
27309
  }
26723
27310
  ));
26724
27311
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
26725
- var DropdownMenuSubContent = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx46(
27312
+ var DropdownMenuSubContent = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx49(
26726
27313
  DropdownMenuPrimitive.SubContent,
26727
27314
  {
26728
27315
  ref,
@@ -26734,7 +27321,7 @@ var DropdownMenuSubContent = React33.forwardRef(({ className, ...props }, ref) =
26734
27321
  }
26735
27322
  ));
26736
27323
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
26737
- var DropdownMenuContent = React33.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx46(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx46(
27324
+ var DropdownMenuContent = React33.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx49(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx49(
26738
27325
  DropdownMenuPrimitive.Content,
26739
27326
  {
26740
27327
  ref,
@@ -26748,7 +27335,7 @@ var DropdownMenuContent = React33.forwardRef(({ className, sideOffset = 4, ...pr
26748
27335
  }
26749
27336
  ) }));
26750
27337
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
26751
- var DropdownMenuItem = React33.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx46(
27338
+ var DropdownMenuItem = React33.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx49(
26752
27339
  DropdownMenuPrimitive.Item,
26753
27340
  {
26754
27341
  ref,
@@ -26761,7 +27348,7 @@ var DropdownMenuItem = React33.forwardRef(({ className, inset, ...props }, ref)
26761
27348
  }
26762
27349
  ));
26763
27350
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
26764
- var DropdownMenuCheckboxItem = React33.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs31(
27351
+ var DropdownMenuCheckboxItem = React33.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs34(
26765
27352
  DropdownMenuPrimitive.CheckboxItem,
26766
27353
  {
26767
27354
  ref,
@@ -26772,13 +27359,13 @@ var DropdownMenuCheckboxItem = React33.forwardRef(({ className, children, checke
26772
27359
  checked,
26773
27360
  ...props,
26774
27361
  children: [
26775
- /* @__PURE__ */ jsx46("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx46(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx46(Check3, { className: "h-4 w-4" }) }) }),
27362
+ /* @__PURE__ */ jsx49("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx49(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx49(Check3, { className: "h-4 w-4" }) }) }),
26776
27363
  children
26777
27364
  ]
26778
27365
  }
26779
27366
  ));
26780
27367
  DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
26781
- var DropdownMenuRadioItem = React33.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs31(
27368
+ var DropdownMenuRadioItem = React33.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs34(
26782
27369
  DropdownMenuPrimitive.RadioItem,
26783
27370
  {
26784
27371
  ref,
@@ -26788,13 +27375,13 @@ var DropdownMenuRadioItem = React33.forwardRef(({ className, children, ...props
26788
27375
  ),
26789
27376
  ...props,
26790
27377
  children: [
26791
- /* @__PURE__ */ jsx46("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx46(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx46(Circle2, { className: "h-2 w-2 fill-current" }) }) }),
27378
+ /* @__PURE__ */ jsx49("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx49(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx49(Circle2, { className: "h-2 w-2 fill-current" }) }) }),
26792
27379
  children
26793
27380
  ]
26794
27381
  }
26795
27382
  ));
26796
27383
  DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
26797
- var DropdownMenuLabel = React33.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx46(
27384
+ var DropdownMenuLabel = React33.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx49(
26798
27385
  DropdownMenuPrimitive.Label,
26799
27386
  {
26800
27387
  ref,
@@ -26807,7 +27394,7 @@ var DropdownMenuLabel = React33.forwardRef(({ className, inset, ...props }, ref)
26807
27394
  }
26808
27395
  ));
26809
27396
  DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
26810
- var DropdownMenuSeparator = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx46(
27397
+ var DropdownMenuSeparator = React33.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx49(
26811
27398
  DropdownMenuPrimitive.Separator,
26812
27399
  {
26813
27400
  ref,
@@ -26820,7 +27407,7 @@ var DropdownMenuShortcut = ({
26820
27407
  className,
26821
27408
  ...props
26822
27409
  }) => {
26823
- return /* @__PURE__ */ jsx46(
27410
+ return /* @__PURE__ */ jsx49(
26824
27411
  "span",
26825
27412
  {
26826
27413
  className: cn("ml-auto text-xs tracking-widest opacity-60", className),
@@ -26848,6 +27435,7 @@ export {
26848
27435
  ChatInner,
26849
27436
  ChatInput,
26850
27437
  ConfigurationPanel,
27438
+ ContextIndicator,
26851
27439
  DialogRoot as Dialog,
26852
27440
  DialogContent,
26853
27441
  DialogHeader,
@@ -26933,6 +27521,7 @@ export {
26933
27521
  TypingIndicator,
26934
27522
  UserMessageRenderer,
26935
27523
  VoiceInput,
27524
+ WorkflowProgress,
26936
27525
  createAskFollowUpTool,
26937
27526
  extractContent,
26938
27527
  useAgent,
@@ -26942,6 +27531,7 @@ export {
26942
27531
  useChatMessages,
26943
27532
  useChatStateStore,
26944
27533
  useConfiguration,
27534
+ useContextHealth,
26945
27535
  useDistri,
26946
27536
  useDistriAuth,
26947
27537
  useDistriToken,
@@ -26949,12 +27539,15 @@ export {
26949
27539
  useMessageReadStatus,
26950
27540
  useMessageVote,
26951
27541
  useMessageVotes,
27542
+ useModels,
26952
27543
  useSidebar,
26953
27544
  useSpeechToText,
26954
27545
  useTheme,
26955
27546
  useThreadReadStatus,
26956
27547
  useThreads,
26957
27548
  useTts,
27549
+ useWorkflow,
27550
+ useWorkflowRunner,
26958
27551
  useWorkspace,
26959
27552
  wrapFnToolAsUiTool,
26960
27553
  wrapTools