@contentgrowth/llm-service 0.9.2 → 0.9.3

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.
@@ -693,18 +693,139 @@ var ChatInputArea = forwardRef(({
693
693
  });
694
694
  ChatInputArea.displayName = "ChatInputArea";
695
695
 
696
+ // src/ui/react/components/TapToTalk.tsx
697
+ import { useState as useState4, useCallback as useCallback4 } from "react";
698
+ import { MicrophoneIcon as MicrophoneIcon2 } from "@heroicons/react/24/outline";
699
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
700
+ var TapToTalk = ({
701
+ onResult,
702
+ voiceConfig: propVoiceConfig,
703
+ className = "",
704
+ disabled = false,
705
+ tooltip = "Tap to speak",
706
+ onFocusTarget,
707
+ accentColor = "bg-emerald-600"
708
+ }) => {
709
+ var _a;
710
+ const globalConfig = useChatConfig();
711
+ const voiceConfig = propVoiceConfig || ((_a = globalConfig.voice) == null ? void 0 : _a.config);
712
+ const [isTranscribing, setIsTranscribing] = useState4(false);
713
+ const [voiceTrigger, setVoiceTrigger] = useState4(null);
714
+ const [errorMsg, setErrorMsg] = useState4(null);
715
+ const handleVoiceResult = useCallback4((text, isFinal) => {
716
+ if (isFinal) {
717
+ onResult(text);
718
+ setErrorMsg(null);
719
+ setVoiceTrigger(null);
720
+ }
721
+ }, [onResult]);
722
+ const handleVoiceEnd = useCallback4(() => {
723
+ setVoiceTrigger(null);
724
+ }, []);
725
+ const nativeSpeech = useSpeechRecognition(handleVoiceResult, handleVoiceEnd, voiceConfig == null ? void 0 : voiceConfig.language);
726
+ const customRecorder = useAudioRecorder(async (blob) => {
727
+ setVoiceTrigger(null);
728
+ setIsTranscribing(true);
729
+ setErrorMsg(null);
730
+ if (blob.type === "audio/simulated") {
731
+ console.log("[TapToTalk] Handling simulated audio capture");
732
+ await new Promise((resolve) => setTimeout(resolve, 1500));
733
+ onResult("This is a simulated transcription for development testing.");
734
+ setIsTranscribing(false);
735
+ return;
736
+ }
737
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "custom" && voiceConfig.onAudioCapture) {
738
+ try {
739
+ const text = await voiceConfig.onAudioCapture(blob);
740
+ if (text) onResult(text);
741
+ } catch (error) {
742
+ console.error("[TapToTalk] Custom transcription failed:", error);
743
+ setErrorMsg(error.message || "Transcription failed");
744
+ } finally {
745
+ setIsTranscribing(false);
746
+ }
747
+ } else {
748
+ setIsTranscribing(false);
749
+ }
750
+ });
751
+ const isListening = !!voiceTrigger || nativeSpeech.isListening || customRecorder.isRecording;
752
+ const isActive = isListening || isTranscribing;
753
+ const toggleVoice = async () => {
754
+ if (isActive) {
755
+ if (isTranscribing && !isListening) return;
756
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "native") {
757
+ nativeSpeech.stop();
758
+ } else {
759
+ customRecorder.stop();
760
+ }
761
+ setVoiceTrigger(null);
762
+ } else {
763
+ setErrorMsg(null);
764
+ onFocusTarget == null ? void 0 : onFocusTarget();
765
+ setVoiceTrigger("click");
766
+ if ((voiceConfig == null ? void 0 : voiceConfig.mode) === "custom") {
767
+ try {
768
+ await customRecorder.start();
769
+ } catch (e) {
770
+ setErrorMsg("Mic access denied");
771
+ setVoiceTrigger(null);
772
+ }
773
+ } else {
774
+ if (!nativeSpeech.isSupported) {
775
+ setErrorMsg("Speech not supported");
776
+ setVoiceTrigger(null);
777
+ return;
778
+ }
779
+ nativeSpeech.start();
780
+ }
781
+ }
782
+ };
783
+ let bgColor = accentColor;
784
+ let label = "Tap to Talk";
785
+ let Icon = /* @__PURE__ */ jsx6(MicrophoneIcon2, { className: "h-5 w-5" });
786
+ if (isListening) {
787
+ bgColor = "bg-orange-500";
788
+ label = "Listening ... Tap to stop";
789
+ Icon = /* @__PURE__ */ jsx6(MicrophoneIcon2, { className: "h-5 w-5 animate-pulse" });
790
+ } else if (isTranscribing) {
791
+ bgColor = "bg-orange-500";
792
+ label = "Transcribing ...";
793
+ Icon = /* @__PURE__ */ jsxs4("svg", { className: "animate-spin h-5 w-5 text-white", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
794
+ /* @__PURE__ */ jsx6("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
795
+ /* @__PURE__ */ jsx6("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
796
+ ] });
797
+ }
798
+ return /* @__PURE__ */ jsxs4(
799
+ "button",
800
+ {
801
+ onClick: toggleVoice,
802
+ disabled: disabled || isTranscribing && !isListening,
803
+ className: `flex items-center justify-center gap-3 px-6 py-3 rounded-xl transition-all duration-300 w-full font-medium shadow-md active:scale-[0.98]
804
+ ${bgColor} text-white
805
+ ${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
806
+ ${className}`,
807
+ title: label,
808
+ children: [
809
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center justify-center shrink-0", children: Icon }),
810
+ /* @__PURE__ */ jsx6("span", { className: "truncate", children: label }),
811
+ errorMsg && /* @__PURE__ */ jsx6("span", { className: "text-[10px] bg-white/20 px-1.5 py-0.5 rounded text-red-100 animate-in fade-in slide-in-from-right-1", children: errorMsg })
812
+ ]
813
+ }
814
+ );
815
+ };
816
+
696
817
  // src/ui/react/components/ChatMessageList.tsx
697
- import { useEffect as useEffect6, useRef as useRef5 } from "react";
818
+ import { useEffect as useEffect6, useRef as useRef6 } from "react";
698
819
 
699
820
  // src/ui/react/components/interactive/ConfirmInteraction.tsx
700
- import { useState as useState4 } from "react";
701
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
821
+ import { useState as useState5 } from "react";
822
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
702
823
  var ConfirmInteraction = ({
703
824
  parameters,
704
825
  onResponse,
705
826
  isResponseSubmitted
706
827
  }) => {
707
- const [selectedOption, setSelectedOption] = useState4(null);
828
+ const [selectedOption, setSelectedOption] = useState5(null);
708
829
  const params = parameters;
709
830
  const { yesPrompt, noPrompt } = params;
710
831
  console.log("[ConfirmInteraction] Parameters:", params);
@@ -713,8 +834,8 @@ var ConfirmInteraction = ({
713
834
  setSelectedOption(buttonText);
714
835
  onResponse(value);
715
836
  };
716
- return /* @__PURE__ */ jsx6("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ jsxs4("div", { className: "flex space-x-2", children: [
717
- /* @__PURE__ */ jsx6(
837
+ return /* @__PURE__ */ jsx7("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ jsxs5("div", { className: "flex space-x-2", children: [
838
+ /* @__PURE__ */ jsx7(
718
839
  "button",
719
840
  {
720
841
  onClick: () => handleOptionClick(true, yesPrompt),
@@ -723,7 +844,7 @@ var ConfirmInteraction = ({
723
844
  children: yesPrompt
724
845
  }
725
846
  ),
726
- /* @__PURE__ */ jsx6(
847
+ /* @__PURE__ */ jsx7(
727
848
  "button",
728
849
  {
729
850
  onClick: () => handleOptionClick(false, noPrompt),
@@ -737,16 +858,16 @@ var ConfirmInteraction = ({
737
858
  var ConfirmInteraction_default = ConfirmInteraction;
738
859
 
739
860
  // src/ui/react/components/interactive/SelectInteraction.tsx
740
- import { useState as useState5, useEffect as useEffect4 } from "react";
741
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
861
+ import { useState as useState6, useEffect as useEffect4 } from "react";
862
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
742
863
  var SelectInteraction = ({
743
864
  parameters,
744
865
  onResponse,
745
866
  isResponseSubmitted,
746
867
  message
747
868
  }) => {
748
- const [selectedOption, setSelectedOption] = useState5(null);
749
- const [customOption, setCustomOption] = useState5(null);
869
+ const [selectedOption, setSelectedOption] = useState6(null);
870
+ const [customOption, setCustomOption] = useState6(null);
750
871
  const params = parameters;
751
872
  const { question, options, placeholder } = params;
752
873
  useEffect4(() => {
@@ -764,8 +885,8 @@ var SelectInteraction = ({
764
885
  setCustomOption(null);
765
886
  onResponse(option);
766
887
  };
767
- return /* @__PURE__ */ jsxs5("div", { className: "mt-2 mb-4", children: [
768
- /* @__PURE__ */ jsx7("div", { className: "flex flex-wrap gap-2", children: options.map((option, index) => /* @__PURE__ */ jsx7(
888
+ return /* @__PURE__ */ jsxs6("div", { className: "mt-2 mb-4", children: [
889
+ /* @__PURE__ */ jsx8("div", { className: "flex flex-wrap gap-2", children: options.map((option, index) => /* @__PURE__ */ jsx8(
769
890
  "button",
770
891
  {
771
892
  onClick: () => handleOptionClick(option),
@@ -775,9 +896,9 @@ var SelectInteraction = ({
775
896
  },
776
897
  index
777
898
  )) }),
778
- customOption && isResponseSubmitted && /* @__PURE__ */ jsxs5("div", { className: "mt-2 text-sm text-amber-600 bg-amber-50 p-2 rounded", children: [
899
+ customOption && isResponseSubmitted && /* @__PURE__ */ jsxs6("div", { className: "mt-2 text-sm text-amber-600 bg-amber-50 p-2 rounded", children: [
779
900
  "User provided custom option: ",
780
- /* @__PURE__ */ jsxs5("span", { className: "font-semibold", children: [
901
+ /* @__PURE__ */ jsxs6("span", { className: "font-semibold", children: [
781
902
  '"',
782
903
  customOption,
783
904
  '"'
@@ -788,20 +909,20 @@ var SelectInteraction = ({
788
909
  var SelectInteraction_default = SelectInteraction;
789
910
 
790
911
  // src/ui/react/components/interactive/FormInteraction.tsx
791
- import { useState as useState6, useEffect as useEffect5, useRef as useRef4 } from "react";
912
+ import { useState as useState7, useEffect as useEffect5, useRef as useRef5 } from "react";
792
913
  import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
793
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
914
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
794
915
  var FormInteraction = ({
795
916
  parameters,
796
917
  onResponse,
797
918
  isResponseSubmitted,
798
919
  submittedValues
799
920
  }) => {
800
- const [isModalOpen, setIsModalOpen] = useState6(false);
801
- const [formValues, setFormValues] = useState6({});
802
- const [isExpanded, setIsExpanded] = useState6(false);
803
- const [parsedFields, setParsedFields] = useState6([]);
804
- const formButtonsRef = useRef4(null);
921
+ const [isModalOpen, setIsModalOpen] = useState7(false);
922
+ const [formValues, setFormValues] = useState7({});
923
+ const [isExpanded, setIsExpanded] = useState7(false);
924
+ const [parsedFields, setParsedFields] = useState7([]);
925
+ const formButtonsRef = useRef5(null);
805
926
  const parseParameters = () => {
806
927
  const { prompt, description, submitText = "Submit", cancelText = "Cancel" } = parameters;
807
928
  let fieldsArray = [];
@@ -910,12 +1031,12 @@ var FormInteraction = ({
910
1031
  case "email":
911
1032
  case "number":
912
1033
  case "password":
913
- return /* @__PURE__ */ jsxs6("div", { className: "mb-4 flex items-center space-x-4", children: [
914
- /* @__PURE__ */ jsxs6("label", { htmlFor: name, className: "text-sm font-medium text-gray-700 min-w-[120px]", children: [
1034
+ return /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex items-center space-x-4", children: [
1035
+ /* @__PURE__ */ jsxs7("label", { htmlFor: name, className: "text-sm font-medium text-gray-700 min-w-[120px]", children: [
915
1036
  label,
916
- required && /* @__PURE__ */ jsx8("span", { className: "text-red-500", children: "*" })
1037
+ required && /* @__PURE__ */ jsx9("span", { className: "text-red-500", children: "*" })
917
1038
  ] }),
918
- /* @__PURE__ */ jsx8(
1039
+ /* @__PURE__ */ jsx9(
919
1040
  "input",
920
1041
  {
921
1042
  type: type === "string" ? "text" : type,
@@ -931,12 +1052,12 @@ var FormInteraction = ({
931
1052
  )
932
1053
  ] }, name);
933
1054
  case "textarea":
934
- return /* @__PURE__ */ jsxs6("div", { className: "mb-4 flex items-start space-x-4", children: [
935
- /* @__PURE__ */ jsxs6("label", { htmlFor: name, className: "text-sm font-medium text-gray-700 min-w-[120px] pt-2", children: [
1055
+ return /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex items-start space-x-4", children: [
1056
+ /* @__PURE__ */ jsxs7("label", { htmlFor: name, className: "text-sm font-medium text-gray-700 min-w-[120px] pt-2", children: [
936
1057
  label,
937
- required && /* @__PURE__ */ jsx8("span", { className: "text-red-500", children: "*" })
1058
+ required && /* @__PURE__ */ jsx9("span", { className: "text-red-500", children: "*" })
938
1059
  ] }),
939
- /* @__PURE__ */ jsx8(
1060
+ /* @__PURE__ */ jsx9(
940
1061
  "textarea",
941
1062
  {
942
1063
  id: name,
@@ -952,12 +1073,12 @@ var FormInteraction = ({
952
1073
  )
953
1074
  ] }, name);
954
1075
  case "select":
955
- return /* @__PURE__ */ jsxs6("div", { className: "mb-4 flex items-center space-x-4", children: [
956
- /* @__PURE__ */ jsxs6("label", { htmlFor: name, className: "text-sm font-medium text-gray-700 min-w-[120px]", children: [
1076
+ return /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex items-center space-x-4", children: [
1077
+ /* @__PURE__ */ jsxs7("label", { htmlFor: name, className: "text-sm font-medium text-gray-700 min-w-[120px]", children: [
957
1078
  label,
958
- required && /* @__PURE__ */ jsx8("span", { className: "text-red-500", children: "*" })
1079
+ required && /* @__PURE__ */ jsx9("span", { className: "text-red-500", children: "*" })
959
1080
  ] }),
960
- /* @__PURE__ */ jsxs6(
1081
+ /* @__PURE__ */ jsxs7(
961
1082
  "select",
962
1083
  {
963
1084
  id: name,
@@ -968,17 +1089,17 @@ var FormInteraction = ({
968
1089
  disabled: isResponseSubmitted,
969
1090
  className: "flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",
970
1091
  children: [
971
- /* @__PURE__ */ jsx8("option", { value: "", disabled: true, children: placeholder || "Select an option" }),
972
- options == null ? void 0 : options.map((option, index) => /* @__PURE__ */ jsx8("option", { value: option, children: option }, index))
1092
+ /* @__PURE__ */ jsx9("option", { value: "", disabled: true, children: placeholder || "Select an option" }),
1093
+ options == null ? void 0 : options.map((option, index) => /* @__PURE__ */ jsx9("option", { value: option, children: option }, index))
973
1094
  ]
974
1095
  }
975
1096
  )
976
1097
  ] }, name);
977
1098
  case "checkbox":
978
- return /* @__PURE__ */ jsxs6("div", { className: "mb-4 flex items-center space-x-4", children: [
979
- /* @__PURE__ */ jsx8("div", { className: "min-w-[120px]" }),
980
- /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
981
- /* @__PURE__ */ jsx8(
1099
+ return /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex items-center space-x-4", children: [
1100
+ /* @__PURE__ */ jsx9("div", { className: "min-w-[120px]" }),
1101
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1102
+ /* @__PURE__ */ jsx9(
982
1103
  "input",
983
1104
  {
984
1105
  type: "checkbox",
@@ -991,20 +1112,20 @@ var FormInteraction = ({
991
1112
  className: "h-4 w-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500"
992
1113
  }
993
1114
  ),
994
- /* @__PURE__ */ jsxs6("label", { htmlFor: name, className: "ml-2 text-sm text-gray-700", children: [
1115
+ /* @__PURE__ */ jsxs7("label", { htmlFor: name, className: "ml-2 text-sm text-gray-700", children: [
995
1116
  label,
996
- required && /* @__PURE__ */ jsx8("span", { className: "text-red-500", children: "*" })
1117
+ required && /* @__PURE__ */ jsx9("span", { className: "text-red-500", children: "*" })
997
1118
  ] })
998
1119
  ] })
999
1120
  ] }, name);
1000
1121
  case "radio":
1001
- return /* @__PURE__ */ jsxs6("div", { className: "mb-4 flex space-x-4", children: [
1002
- /* @__PURE__ */ jsxs6("div", { className: "text-sm font-medium text-gray-700 min-w-[120px] pt-2", children: [
1122
+ return /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex space-x-4", children: [
1123
+ /* @__PURE__ */ jsxs7("div", { className: "text-sm font-medium text-gray-700 min-w-[120px] pt-2", children: [
1003
1124
  label,
1004
- required && /* @__PURE__ */ jsx8("span", { className: "text-red-500", children: "*" })
1125
+ required && /* @__PURE__ */ jsx9("span", { className: "text-red-500", children: "*" })
1005
1126
  ] }),
1006
- /* @__PURE__ */ jsx8("div", { className: "flex-1 space-y-2", children: options == null ? void 0 : options.map((option, index) => /* @__PURE__ */ jsxs6("div", { className: "flex items-center", children: [
1007
- /* @__PURE__ */ jsx8(
1127
+ /* @__PURE__ */ jsx9("div", { className: "flex-1 space-y-2", children: options == null ? void 0 : options.map((option, index) => /* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
1128
+ /* @__PURE__ */ jsx9(
1008
1129
  "input",
1009
1130
  {
1010
1131
  id: `${name}-${index}`,
@@ -1018,7 +1139,7 @@ var FormInteraction = ({
1018
1139
  className: "h-4 w-4 text-blue-600 border-gray-300 focus:ring-blue-500"
1019
1140
  }
1020
1141
  ),
1021
- /* @__PURE__ */ jsx8("label", { htmlFor: `${name}-${index}`, className: "ml-2 text-sm text-gray-700", children: option })
1142
+ /* @__PURE__ */ jsx9("label", { htmlFor: `${name}-${index}`, className: "ml-2 text-sm text-gray-700", children: option })
1022
1143
  ] }, index)) })
1023
1144
  ] }, name);
1024
1145
  default:
@@ -1026,27 +1147,27 @@ var FormInteraction = ({
1026
1147
  }
1027
1148
  };
1028
1149
  if (isResponseSubmitted) {
1029
- return /* @__PURE__ */ jsxs6("div", { className: "mt-2 bg-gray-50 p-3 rounded-md border border-gray-200", children: [
1030
- /* @__PURE__ */ jsxs6("div", { className: "flex justify-between items-center cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
1031
- /* @__PURE__ */ jsxs6("span", { className: "font-medium text-gray-700", children: [
1150
+ return /* @__PURE__ */ jsxs7("div", { className: "mt-2 bg-gray-50 p-3 rounded-md border border-gray-200", children: [
1151
+ /* @__PURE__ */ jsxs7("div", { className: "flex justify-between items-center cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
1152
+ /* @__PURE__ */ jsxs7("span", { className: "font-medium text-gray-700", children: [
1032
1153
  isExpanded ? "Hide" : "Show",
1033
1154
  " Form Responses"
1034
1155
  ] }),
1035
- isExpanded ? /* @__PURE__ */ jsx8(ChevronUpIcon, { className: "h-5 w-5 text-gray-500" }) : /* @__PURE__ */ jsx8(ChevronDownIcon, { className: "h-5 w-5 text-gray-500" })
1156
+ isExpanded ? /* @__PURE__ */ jsx9(ChevronUpIcon, { className: "h-5 w-5 text-gray-500" }) : /* @__PURE__ */ jsx9(ChevronDownIcon, { className: "h-5 w-5 text-gray-500" })
1036
1157
  ] }),
1037
- isExpanded && /* @__PURE__ */ jsx8("div", { className: "mt-2 space-y-2", children: parsedFields.map((field) => /* @__PURE__ */ jsxs6("div", { className: "flex", children: [
1038
- /* @__PURE__ */ jsxs6("span", { className: "text-sm font-medium text-gray-600 mr-2", children: [
1158
+ isExpanded && /* @__PURE__ */ jsx9("div", { className: "mt-2 space-y-2", children: parsedFields.map((field) => /* @__PURE__ */ jsxs7("div", { className: "flex", children: [
1159
+ /* @__PURE__ */ jsxs7("span", { className: "text-sm font-medium text-gray-600 mr-2", children: [
1039
1160
  field.label,
1040
1161
  ":"
1041
1162
  ] }),
1042
- /* @__PURE__ */ jsx8("span", { className: "text-sm text-gray-800", children: typeof (submittedValues == null ? void 0 : submittedValues[field.name]) === "boolean" ? submittedValues[field.name] ? "Yes" : "No" : (submittedValues == null ? void 0 : submittedValues[field.name]) || "Not provided" })
1163
+ /* @__PURE__ */ jsx9("span", { className: "text-sm text-gray-800", children: typeof (submittedValues == null ? void 0 : submittedValues[field.name]) === "boolean" ? submittedValues[field.name] ? "Yes" : "No" : (submittedValues == null ? void 0 : submittedValues[field.name]) || "Not provided" })
1043
1164
  ] }, field.name)) })
1044
1165
  ] });
1045
1166
  }
1046
- return /* @__PURE__ */ jsx8("div", { className: "mt-2", children: isModalOpen && /* @__PURE__ */ jsx8("div", { className: "p-4", children: /* @__PURE__ */ jsxs6("form", { onSubmit: handleSubmit, className: "mt-4", children: [
1167
+ return /* @__PURE__ */ jsx9("div", { className: "mt-2", children: isModalOpen && /* @__PURE__ */ jsx9("div", { className: "p-4", children: /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className: "mt-4", children: [
1047
1168
  parsedFields.map((field) => renderField(field)),
1048
- /* @__PURE__ */ jsxs6("div", { ref: formButtonsRef, className: "flex justify-end mt-4 space-x-2", children: [
1049
- /* @__PURE__ */ jsx8(
1169
+ /* @__PURE__ */ jsxs7("div", { ref: formButtonsRef, className: "flex justify-end mt-4 space-x-2", children: [
1170
+ /* @__PURE__ */ jsx9(
1050
1171
  "button",
1051
1172
  {
1052
1173
  type: "button",
@@ -1056,7 +1177,7 @@ var FormInteraction = ({
1056
1177
  children: params.cancelText
1057
1178
  }
1058
1179
  ),
1059
- /* @__PURE__ */ jsx8(
1180
+ /* @__PURE__ */ jsx9(
1060
1181
  "button",
1061
1182
  {
1062
1183
  type: "submit",
@@ -1071,12 +1192,12 @@ var FormInteraction = ({
1071
1192
  var FormInteraction_default = FormInteraction;
1072
1193
 
1073
1194
  // src/ui/react/components/interactive/PresentInteraction.tsx
1074
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1195
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1075
1196
  var ReactMarkdown2;
1076
1197
  try {
1077
1198
  ReactMarkdown2 = __require("react-markdown");
1078
1199
  } catch (error) {
1079
- ReactMarkdown2 = ({ children }) => /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap", children });
1200
+ ReactMarkdown2 = ({ children }) => /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap", children });
1080
1201
  }
1081
1202
  var PresentInteraction = ({
1082
1203
  parameters
@@ -1114,15 +1235,15 @@ var PresentInteraction = ({
1114
1235
  }
1115
1236
  };
1116
1237
  const styles = getLevelStyles();
1117
- return /* @__PURE__ */ jsxs7("div", { className: `mt-2 mb-4 p-4 ${styles.container} border rounded-md`, children: [
1118
- title && /* @__PURE__ */ jsx9("div", { className: `font-medium ${styles.title} mb-2`, children: title }),
1119
- /* @__PURE__ */ jsx9("div", { className: `text-sm ${styles.content}`, children: format === "markdown" ? /* @__PURE__ */ jsx9(ReactMarkdown2, { className: "prose prose-sm max-w-none", children: content }) : format === "html" ? /* @__PURE__ */ jsx9("div", { dangerouslySetInnerHTML: { __html: content } }) : /* @__PURE__ */ jsx9("div", { className: "whitespace-pre-wrap", children: content }) })
1238
+ return /* @__PURE__ */ jsxs8("div", { className: `mt-2 mb-4 p-4 ${styles.container} border rounded-md`, children: [
1239
+ title && /* @__PURE__ */ jsx10("div", { className: `font-medium ${styles.title} mb-2`, children: title }),
1240
+ /* @__PURE__ */ jsx10("div", { className: `text-sm ${styles.content}`, children: format === "markdown" ? /* @__PURE__ */ jsx10(ReactMarkdown2, { className: "prose prose-sm max-w-none", children: content }) : format === "html" ? /* @__PURE__ */ jsx10("div", { dangerouslySetInnerHTML: { __html: content } }) : /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap", children: content }) })
1120
1241
  ] });
1121
1242
  };
1122
1243
  var PresentInteraction_default = PresentInteraction;
1123
1244
 
1124
1245
  // src/ui/react/components/interactive/InteractiveMessageHandler.tsx
1125
- import { jsx as jsx10 } from "react/jsx-runtime";
1246
+ import { jsx as jsx11 } from "react/jsx-runtime";
1126
1247
  var InteractiveMessageHandler = ({
1127
1248
  message,
1128
1249
  onResponse,
@@ -1133,7 +1254,7 @@ var InteractiveMessageHandler = ({
1133
1254
  const submittedResponse = parentMessage == null ? void 0 : parentMessage.responseValue;
1134
1255
  switch (functionType) {
1135
1256
  case "confirm":
1136
- return /* @__PURE__ */ jsx10(
1257
+ return /* @__PURE__ */ jsx11(
1137
1258
  ConfirmInteraction_default,
1138
1259
  {
1139
1260
  parameters,
@@ -1142,7 +1263,7 @@ var InteractiveMessageHandler = ({
1142
1263
  }
1143
1264
  );
1144
1265
  case "select":
1145
- return /* @__PURE__ */ jsx10(
1266
+ return /* @__PURE__ */ jsx11(
1146
1267
  SelectInteraction_default,
1147
1268
  {
1148
1269
  parameters,
@@ -1152,7 +1273,7 @@ var InteractiveMessageHandler = ({
1152
1273
  }
1153
1274
  );
1154
1275
  case "form":
1155
- return /* @__PURE__ */ jsx10(
1276
+ return /* @__PURE__ */ jsx11(
1156
1277
  FormInteraction_default,
1157
1278
  {
1158
1279
  parameters,
@@ -1162,7 +1283,7 @@ var InteractiveMessageHandler = ({
1162
1283
  }
1163
1284
  );
1164
1285
  case "present":
1165
- return /* @__PURE__ */ jsx10(
1286
+ return /* @__PURE__ */ jsx11(
1166
1287
  PresentInteraction_default,
1167
1288
  {
1168
1289
  parameters
@@ -1179,7 +1300,7 @@ var InteractiveMessageHandler_default = InteractiveMessageHandler;
1179
1300
 
1180
1301
  // src/ui/react/components/ChatMessageList.tsx
1181
1302
  import { InformationCircleIcon } from "@heroicons/react/24/outline";
1182
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1303
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
1183
1304
  var ChatMessageList = ({
1184
1305
  chatHistory,
1185
1306
  isProcessing,
@@ -1188,9 +1309,9 @@ var ChatMessageList = ({
1188
1309
  getContextExample,
1189
1310
  onInteractiveResponse
1190
1311
  }) => {
1191
- const chatContainerRef = useRef5(null);
1192
- const lastMessageRef = useRef5(null);
1193
- const processingIndicatorRef = useRef5(null);
1312
+ const chatContainerRef = useRef6(null);
1313
+ const lastMessageRef = useRef6(null);
1314
+ const processingIndicatorRef = useRef6(null);
1194
1315
  useEffect6(() => {
1195
1316
  if (isProcessing && processingIndicatorRef.current) {
1196
1317
  processingIndicatorRef.current.scrollIntoView({ behavior: "smooth" });
@@ -1207,15 +1328,15 @@ var ChatMessageList = ({
1207
1328
  onInteractiveResponse(messageId, response);
1208
1329
  }
1209
1330
  };
1210
- return /* @__PURE__ */ jsxs8(
1331
+ return /* @__PURE__ */ jsxs9(
1211
1332
  "div",
1212
1333
  {
1213
1334
  ref: chatContainerRef,
1214
1335
  className: "flex-1 overflow-y-auto p-4 space-y-8 bg-gray-50",
1215
1336
  children: [
1216
- chatHistory.length === 0 && !isProcessing && /* @__PURE__ */ jsxs8("div", { className: "text-center py-8", children: [
1217
- /* @__PURE__ */ jsx11("h3", { className: "text-lg font-medium text-gray-700 mb-2", children: "How can I help you today?" }),
1218
- /* @__PURE__ */ jsxs8("p", { className: "text-sm text-gray-500 mb-4", children: [
1337
+ chatHistory.length === 0 && !isProcessing && /* @__PURE__ */ jsxs9("div", { className: "text-center py-8", children: [
1338
+ /* @__PURE__ */ jsx12("h3", { className: "text-lg font-medium text-gray-700 mb-2", children: "How can I help you today?" }),
1339
+ /* @__PURE__ */ jsxs9("p", { className: "text-sm text-gray-500 mb-4", children: [
1219
1340
  "Try asking me something like ",
1220
1341
  getContextExample()
1221
1342
  ] })
@@ -1224,14 +1345,14 @@ var ChatMessageList = ({
1224
1345
  const isLastMessage = index === chatHistory.length - 1;
1225
1346
  const isUser = message.role === "user";
1226
1347
  const isError = message.role === "error";
1227
- return /* @__PURE__ */ jsxs8(
1348
+ return /* @__PURE__ */ jsxs9(
1228
1349
  "div",
1229
1350
  {
1230
1351
  ref: isLastMessage ? lastMessageRef : void 0,
1231
1352
  className: `flex flex-col w-full ${isUser ? "items-end" : "items-start"}`,
1232
1353
  children: [
1233
- /* @__PURE__ */ jsx11("div", { className: "text-xs text-gray-400 mb-1 px-1", children: message.timestamp ? `${isUser ? "Sent" : "Received"} at ${new Date(message.timestamp).toLocaleString()}` : "" }),
1234
- /* @__PURE__ */ jsx11("div", { className: "w-full", children: message.interactive && message.interactiveData ? /* @__PURE__ */ jsx11("div", { className: `max-w-[85%] ${isUser ? "ml-auto" : "mr-auto"}`, children: /* @__PURE__ */ jsx11(
1354
+ /* @__PURE__ */ jsx12("div", { className: "text-xs text-gray-400 mb-1 px-1", children: message.timestamp ? `${isUser ? "Sent" : "Received"} at ${new Date(message.timestamp).toLocaleString()}` : "" }),
1355
+ /* @__PURE__ */ jsx12("div", { className: "w-full", children: message.interactive && message.interactiveData ? /* @__PURE__ */ jsx12("div", { className: `max-w-[85%] ${isUser ? "ml-auto" : "mr-auto"}`, children: /* @__PURE__ */ jsx12(
1235
1356
  InteractiveMessageHandler_default,
1236
1357
  {
1237
1358
  message: message.interactiveData,
@@ -1243,16 +1364,16 @@ var ChatMessageList = ({
1243
1364
  isResponseSubmitted: !!message.isResponseSubmitted,
1244
1365
  parentMessage: message
1245
1366
  }
1246
- ) }) : /* @__PURE__ */ jsx11(
1367
+ ) }) : /* @__PURE__ */ jsx12(
1247
1368
  MessageBubble,
1248
1369
  {
1249
1370
  message,
1250
1371
  isUser
1251
1372
  }
1252
1373
  ) }),
1253
- isUser && message.interactive && /* @__PURE__ */ jsxs8("div", { className: "flex items-center mt-1 space-x-1 text-xs text-gray-500 italic", children: [
1254
- /* @__PURE__ */ jsx11(InformationCircleIcon, { className: "h-3 w-3 text-blue-400" }),
1255
- /* @__PURE__ */ jsxs8("span", { children: [
1374
+ isUser && message.interactive && /* @__PURE__ */ jsxs9("div", { className: "flex items-center mt-1 space-x-1 text-xs text-gray-500 italic", children: [
1375
+ /* @__PURE__ */ jsx12(InformationCircleIcon, { className: "h-3 w-3 text-blue-400" }),
1376
+ /* @__PURE__ */ jsxs9("span", { children: [
1256
1377
  message.request === "form" && "Response to form submission",
1257
1378
  message.request === "select" && "Response to selection prompt",
1258
1379
  message.request === "confirm" && "Response to confirmation prompt"
@@ -1263,29 +1384,29 @@ var ChatMessageList = ({
1263
1384
  message.id || `message-${index}`
1264
1385
  );
1265
1386
  }),
1266
- isProcessing && /* @__PURE__ */ jsx11(
1387
+ isProcessing && /* @__PURE__ */ jsx12(
1267
1388
  "div",
1268
1389
  {
1269
1390
  ref: processingIndicatorRef,
1270
1391
  className: "flex justify-start my-4",
1271
- children: /* @__PURE__ */ jsx11("div", { className: "bg-white text-gray-800 border border-gray-200 rounded-lg px-4 py-2 max-w-[85%]", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center", children: [
1272
- /* @__PURE__ */ jsx11("span", { className: "text-sm", children: processingHint }),
1273
- /* @__PURE__ */ jsxs8("span", { className: "ml-2 flex space-x-1", children: [
1274
- /* @__PURE__ */ jsx11("span", { className: "h-2 w-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
1275
- /* @__PURE__ */ jsx11("span", { className: "h-2 w-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
1276
- /* @__PURE__ */ jsx11("span", { className: "h-2 w-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
1392
+ children: /* @__PURE__ */ jsx12("div", { className: "bg-white text-gray-800 border border-gray-200 rounded-lg px-4 py-2 max-w-[85%]", children: /* @__PURE__ */ jsxs9("div", { className: "flex items-center", children: [
1393
+ /* @__PURE__ */ jsx12("span", { className: "text-sm", children: processingHint }),
1394
+ /* @__PURE__ */ jsxs9("span", { className: "ml-2 flex space-x-1", children: [
1395
+ /* @__PURE__ */ jsx12("span", { className: "h-2 w-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
1396
+ /* @__PURE__ */ jsx12("span", { className: "h-2 w-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
1397
+ /* @__PURE__ */ jsx12("span", { className: "h-2 w-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
1277
1398
  ] })
1278
1399
  ] }) })
1279
1400
  }
1280
1401
  ),
1281
- currentTask && !currentTask.complete && /* @__PURE__ */ jsxs8("div", { className: "mt-4 bg-blue-50 border border-blue-100 rounded-lg p-3", children: [
1282
- /* @__PURE__ */ jsxs8("div", { className: "text-sm text-blue-800 mb-1", children: [
1402
+ currentTask && !currentTask.complete && /* @__PURE__ */ jsxs9("div", { className: "mt-4 bg-blue-50 border border-blue-100 rounded-lg p-3", children: [
1403
+ /* @__PURE__ */ jsxs9("div", { className: "text-sm text-blue-800 mb-1", children: [
1283
1404
  "Task in progress: Step ",
1284
1405
  currentTask.currentStep,
1285
1406
  " of ",
1286
1407
  currentTask.steps
1287
1408
  ] }),
1288
- /* @__PURE__ */ jsx11("div", { className: "w-full bg-blue-200 rounded-full h-2", children: /* @__PURE__ */ jsx11(
1409
+ /* @__PURE__ */ jsx12("div", { className: "w-full bg-blue-200 rounded-full h-2", children: /* @__PURE__ */ jsx12(
1289
1410
  "div",
1290
1411
  {
1291
1412
  className: "bg-blue-500 h-2 rounded-full",
@@ -1300,34 +1421,34 @@ var ChatMessageList = ({
1300
1421
 
1301
1422
  // src/ui/react/components/ConnectionStatus.tsx
1302
1423
  import { Wifi, WifiOff, RefreshCw } from "lucide-react";
1303
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
1424
+ import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
1304
1425
  var ConnectionStatus = ({
1305
1426
  connectionStatus,
1306
1427
  onReconnect
1307
1428
  }) => {
1308
- return /* @__PURE__ */ jsxs9("div", { className: "bg-amber-100 connection-status flex items-center justify-between px-4 py-1 text-xs", children: [
1309
- /* @__PURE__ */ jsx12("div", { className: "text-gray-700 font-medium", children: "You are talking with your personal Content Strategist" }),
1310
- connectionStatus === "connected" && /* @__PURE__ */ jsxs9("div", { className: "flex items-center text-green-600", children: [
1311
- /* @__PURE__ */ jsx12(Wifi, { className: "w-3 h-3 mr-1" }),
1312
- /* @__PURE__ */ jsx12("span", { children: "Connected" })
1429
+ return /* @__PURE__ */ jsxs10("div", { className: "bg-amber-100 connection-status flex items-center justify-between px-4 py-1 text-xs", children: [
1430
+ /* @__PURE__ */ jsx13("div", { className: "text-gray-700 font-medium", children: "You are talking with your personal Content Strategist" }),
1431
+ connectionStatus === "connected" && /* @__PURE__ */ jsxs10("div", { className: "flex items-center text-green-600", children: [
1432
+ /* @__PURE__ */ jsx13(Wifi, { className: "w-3 h-3 mr-1" }),
1433
+ /* @__PURE__ */ jsx13("span", { children: "Connected" })
1313
1434
  ] }),
1314
- connectionStatus === "reconnecting" && /* @__PURE__ */ jsxs9("div", { className: "flex items-center text-amber-600", children: [
1315
- /* @__PURE__ */ jsx12(RefreshCw, { className: "w-3 h-3 mr-1 animate-spin" }),
1316
- /* @__PURE__ */ jsx12("span", { children: "Reconnecting..." })
1435
+ connectionStatus === "reconnecting" && /* @__PURE__ */ jsxs10("div", { className: "flex items-center text-amber-600", children: [
1436
+ /* @__PURE__ */ jsx13(RefreshCw, { className: "w-3 h-3 mr-1 animate-spin" }),
1437
+ /* @__PURE__ */ jsx13("span", { children: "Reconnecting..." })
1317
1438
  ] }),
1318
- connectionStatus === "disconnected" && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
1319
- /* @__PURE__ */ jsxs9("div", { className: "text-red-600 flex items-center", children: [
1320
- /* @__PURE__ */ jsx12(WifiOff, { className: "w-3 h-3 mr-1" }),
1321
- /* @__PURE__ */ jsx12("span", { children: "Disconnected" })
1439
+ connectionStatus === "disconnected" && /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1440
+ /* @__PURE__ */ jsxs10("div", { className: "text-red-600 flex items-center", children: [
1441
+ /* @__PURE__ */ jsx13(WifiOff, { className: "w-3 h-3 mr-1" }),
1442
+ /* @__PURE__ */ jsx13("span", { children: "Disconnected" })
1322
1443
  ] }),
1323
- /* @__PURE__ */ jsxs9(
1444
+ /* @__PURE__ */ jsxs10(
1324
1445
  "button",
1325
1446
  {
1326
1447
  onClick: onReconnect,
1327
1448
  className: "text-blue-600 hover:text-blue-800 flex items-center",
1328
1449
  children: [
1329
- /* @__PURE__ */ jsx12(RefreshCw, { className: "w-3 h-3 mr-1" }),
1330
- /* @__PURE__ */ jsx12("span", { children: "Reconnect" })
1450
+ /* @__PURE__ */ jsx13(RefreshCw, { className: "w-3 h-3 mr-1" }),
1451
+ /* @__PURE__ */ jsx13("span", { children: "Reconnect" })
1331
1452
  ]
1332
1453
  }
1333
1454
  )
@@ -1336,7 +1457,7 @@ var ConnectionStatus = ({
1336
1457
  };
1337
1458
 
1338
1459
  // src/ui/react/components/Spinner.tsx
1339
- import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
1460
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
1340
1461
  var Spinner = ({
1341
1462
  size = "md",
1342
1463
  className = "",
@@ -1348,7 +1469,7 @@ var Spinner = ({
1348
1469
  lg: "h-8 w-8",
1349
1470
  xl: "h-12 w-12"
1350
1471
  };
1351
- return /* @__PURE__ */ jsxs10(
1472
+ return /* @__PURE__ */ jsxs11(
1352
1473
  "svg",
1353
1474
  {
1354
1475
  className: `animate-spin ${sizeClasses[size]} ${color} ${className}`,
@@ -1356,7 +1477,7 @@ var Spinner = ({
1356
1477
  fill: "none",
1357
1478
  viewBox: "0 0 24 24",
1358
1479
  children: [
1359
- /* @__PURE__ */ jsx13(
1480
+ /* @__PURE__ */ jsx14(
1360
1481
  "circle",
1361
1482
  {
1362
1483
  className: "opacity-25",
@@ -1367,7 +1488,7 @@ var Spinner = ({
1367
1488
  strokeWidth: "4"
1368
1489
  }
1369
1490
  ),
1370
- /* @__PURE__ */ jsx13(
1491
+ /* @__PURE__ */ jsx14(
1371
1492
  "path",
1372
1493
  {
1373
1494
  className: "opacity-75",
@@ -1430,6 +1551,7 @@ export {
1430
1551
  ConnectionStatus,
1431
1552
  MessageBubble,
1432
1553
  Spinner,
1554
+ TapToTalk,
1433
1555
  createWhisperVoiceConfig,
1434
1556
  transcribeAudio,
1435
1557
  useAudioRecorder,