@datatechsolutions/ui 2.11.6 → 2.11.8

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.
@@ -210,47 +210,84 @@ var useWorkflowStore = zustand.create((set, get) => ({
210
210
  });
211
211
  }
212
212
  }));
213
- var useModalStore = zustand.create((set) => ({
213
+ var EMPTY_STATE = {
214
214
  activeModal: null,
215
215
  agentData: null,
216
- subworkflowData: null,
217
216
  logicNodeData: null,
218
- pipelineSettingsData: null,
219
- openAgentModal: (agent, models, isCreateMode = false) => set({
220
- activeModal: "agent",
221
- agentData: { agent, models, isCreateMode },
222
- subworkflowData: null,
223
- logicNodeData: null,
224
- pipelineSettingsData: null
225
- }),
226
- openSubworkflowModal: (tool) => set({
227
- activeModal: "subworkflow",
228
- subworkflowData: { tool },
229
- agentData: null,
230
- logicNodeData: null,
231
- pipelineSettingsData: null
232
- }),
233
- openLogicNodeModal: (nodeId, nodeLabel, config) => set({
234
- activeModal: "logic-node",
235
- logicNodeData: { nodeId, nodeLabel, config },
236
- agentData: null,
237
- subworkflowData: null,
238
- pipelineSettingsData: null
239
- }),
240
- openPipelineSettingsModal: (name, description) => set({
241
- activeModal: "pipeline-settings",
242
- pipelineSettingsData: { name, description },
243
- agentData: null,
244
- subworkflowData: null,
245
- logicNodeData: null
246
- }),
247
- closeModal: () => set({
248
- activeModal: null,
249
- agentData: null,
250
- subworkflowData: null,
251
- logicNodeData: null,
252
- pipelineSettingsData: null
253
- })
217
+ pipelineSettingsData: null
218
+ };
219
+ var useModalStore = zustand.create((set, get) => ({
220
+ ...EMPTY_STATE,
221
+ stack: [],
222
+ openAgentModal: (agent, models, isCreateMode = false) => {
223
+ const current = get();
224
+ const entry = {
225
+ type: current.activeModal,
226
+ agentData: current.agentData,
227
+ logicNodeData: current.logicNodeData,
228
+ pipelineSettingsData: current.pipelineSettingsData
229
+ };
230
+ const newStack = current.activeModal ? [...current.stack, entry] : current.stack;
231
+ set({
232
+ activeModal: "agent",
233
+ agentData: { agent, models, isCreateMode },
234
+ logicNodeData: null,
235
+ pipelineSettingsData: null,
236
+ stack: newStack
237
+ });
238
+ },
239
+ openLogicNodeModal: (nodeId, nodeLabel, config) => {
240
+ const current = get();
241
+ const entry = {
242
+ type: current.activeModal,
243
+ agentData: current.agentData,
244
+ logicNodeData: current.logicNodeData,
245
+ pipelineSettingsData: current.pipelineSettingsData
246
+ };
247
+ const newStack = current.activeModal ? [...current.stack, entry] : current.stack;
248
+ set({
249
+ activeModal: "logic-node",
250
+ logicNodeData: { nodeId, nodeLabel, config },
251
+ agentData: null,
252
+ pipelineSettingsData: null,
253
+ stack: newStack
254
+ });
255
+ },
256
+ openPipelineSettingsModal: (name, description) => {
257
+ const current = get();
258
+ const entry = {
259
+ type: current.activeModal,
260
+ agentData: current.agentData,
261
+ logicNodeData: current.logicNodeData,
262
+ pipelineSettingsData: current.pipelineSettingsData
263
+ };
264
+ const newStack = current.activeModal ? [...current.stack, entry] : current.stack;
265
+ set({
266
+ activeModal: "pipeline-settings",
267
+ pipelineSettingsData: { name, description },
268
+ agentData: null,
269
+ logicNodeData: null,
270
+ stack: newStack
271
+ });
272
+ },
273
+ closeModal: () => {
274
+ const { stack } = get();
275
+ if (stack.length > 0) {
276
+ const previous = stack[stack.length - 1];
277
+ set({
278
+ activeModal: previous.type,
279
+ agentData: previous.agentData,
280
+ logicNodeData: previous.logicNodeData,
281
+ pipelineSettingsData: previous.pipelineSettingsData,
282
+ stack: stack.slice(0, -1)
283
+ });
284
+ } else {
285
+ set({ ...EMPTY_STATE, stack: [] });
286
+ }
287
+ },
288
+ closeAllModals: () => {
289
+ set({ ...EMPTY_STATE, stack: [] });
290
+ }
254
291
  }));
255
292
  var GRAPH_ACTIVE_EDGE_COLOR = "#14b8a6";
256
293
  var GRAPH_TRUE_EDGE_COLOR = "#22c55e";
@@ -2890,203 +2927,214 @@ var GroupFlowNode = react.memo(function GroupFlowNode2({ id, data, selected }) {
2890
2927
  /* @__PURE__ */ jsxRuntime.jsx(WorkflowHandle, { type: "source", position: react$1.Position.Right, id: "right-out", colorClass: "!bg-slate-500" })
2891
2928
  ] });
2892
2929
  });
2893
- function StartNodeConfigForm({ config, onSave, onCancel }) {
2894
- const t = chunkYXN2K77G_js.useTranslations("agents.workflow.startNodeConfig");
2895
- const [inputVariables, setInputVariables] = react.useState([...config.inputVariables]);
2930
+ function ConfigFormActions({
2931
+ cancelLabel,
2932
+ saveLabel,
2933
+ onCancel,
2934
+ onSave,
2935
+ saveDisabled = false
2936
+ }) {
2937
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2 border-t border-gray-200 pt-4 dark:border-gray-700", children: [
2938
+ /* @__PURE__ */ jsxRuntime.jsx(chunk4XID6LOC_js.Button, { type: "button", outline: true, onClick: onCancel, children: cancelLabel }),
2939
+ /* @__PURE__ */ jsxRuntime.jsx(chunk4XID6LOC_js.Button, { type: "button", onClick: onSave, disabled: saveDisabled, children: saveLabel })
2940
+ ] });
2941
+ }
2942
+ var COLOR_CLASSES = {
2943
+ green: {
2944
+ badge: "bg-green-100 text-green-700 dark:bg-green-500/20 dark:text-green-300",
2945
+ input: "focus:border-green-400 focus:ring-green-400/20",
2946
+ row: "border-green-200/30 dark:border-green-500/15",
2947
+ add: "text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",
2948
+ dot: "bg-green-500"
2949
+ },
2950
+ blue: {
2951
+ badge: "bg-blue-100 text-blue-700 dark:bg-blue-500/20 dark:text-blue-300",
2952
+ input: "focus:border-blue-400 focus:ring-blue-400/20",
2953
+ row: "border-blue-200/30 dark:border-blue-500/15",
2954
+ add: "text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",
2955
+ dot: "bg-blue-500"
2956
+ },
2957
+ purple: {
2958
+ badge: "bg-purple-100 text-purple-700 dark:bg-purple-500/20 dark:text-purple-300",
2959
+ input: "focus:border-purple-400 focus:ring-purple-400/20",
2960
+ row: "border-purple-200/30 dark:border-purple-500/15",
2961
+ add: "text-purple-600 hover:text-purple-700 dark:text-purple-400 dark:hover:text-purple-300",
2962
+ dot: "bg-purple-500"
2963
+ },
2964
+ red: {
2965
+ badge: "bg-red-100 text-red-700 dark:bg-red-500/20 dark:text-red-300",
2966
+ input: "focus:border-red-400 focus:ring-red-400/20",
2967
+ row: "border-red-200/30 dark:border-red-500/15",
2968
+ add: "text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",
2969
+ dot: "bg-red-500"
2970
+ },
2971
+ teal: {
2972
+ badge: "bg-teal-100 text-teal-700 dark:bg-teal-500/20 dark:text-teal-300",
2973
+ input: "focus:border-teal-400 focus:ring-teal-400/20",
2974
+ row: "border-teal-200/30 dark:border-teal-500/15",
2975
+ add: "text-teal-600 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300",
2976
+ dot: "bg-teal-500"
2977
+ }
2978
+ };
2979
+ function VariableListEditor({
2980
+ variables,
2981
+ onChange,
2982
+ placeholder = "Variable name",
2983
+ label,
2984
+ addLabel = "Add",
2985
+ color = "green",
2986
+ numbered = false,
2987
+ editable = false,
2988
+ max = 0
2989
+ }) {
2896
2990
  const [newVariable, setNewVariable] = react.useState("");
2897
- const handleAddVariable = () => {
2991
+ const inputRef = react.useRef(null);
2992
+ const colors = COLOR_CLASSES[color];
2993
+ const canAdd = max === 0 || variables.length < max;
2994
+ const handleAdd = react.useCallback(() => {
2898
2995
  const trimmed = newVariable.trim();
2899
- if (trimmed && !inputVariables.includes(trimmed)) {
2900
- setInputVariables([...inputVariables, trimmed]);
2901
- setNewVariable("");
2902
- }
2903
- };
2904
- const handleRemoveVariable = (variable) => {
2905
- setInputVariables(inputVariables.filter((existingVariable) => existingVariable !== variable));
2906
- };
2907
- const handleKeyDown = (event) => {
2996
+ if (!trimmed || variables.includes(trimmed)) return;
2997
+ onChange([...variables, trimmed]);
2998
+ setNewVariable("");
2999
+ inputRef.current?.focus();
3000
+ }, [newVariable, variables, onChange]);
3001
+ const handleRemove = react.useCallback((index) => {
3002
+ onChange(variables.filter((_, i) => i !== index));
3003
+ }, [variables, onChange]);
3004
+ const handleEdit = react.useCallback((index, value) => {
3005
+ const updated = [...variables];
3006
+ updated[index] = value;
3007
+ onChange(updated);
3008
+ }, [variables, onChange]);
3009
+ const handleKeyDown = react.useCallback((event) => {
2908
3010
  if (event.key === "Enter") {
2909
3011
  event.preventDefault();
2910
- handleAddVariable();
3012
+ handleAdd();
2911
3013
  }
2912
- };
3014
+ }, [handleAdd]);
3015
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3016
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "mb-2 block text-xs font-medium text-gray-500 dark:text-gray-400", children: label }),
3017
+ variables.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2 space-y-1", children: variables.map((variable, index) => /* @__PURE__ */ jsxRuntime.jsxs(
3018
+ "div",
3019
+ {
3020
+ className: `group flex items-center gap-2 rounded-lg border px-2.5 py-1.5 transition-colors ${colors.row} hover:bg-white/5`,
3021
+ children: [
3022
+ numbered ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex h-5 min-w-5 items-center justify-center rounded-full text-[10px] font-bold ${colors.badge}`, children: index + 1 }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${colors.dot}` }),
3023
+ editable ? /* @__PURE__ */ jsxRuntime.jsx(
3024
+ "input",
3025
+ {
3026
+ type: "text",
3027
+ value: variable,
3028
+ onChange: (event) => handleEdit(index, event.target.value),
3029
+ className: `flex-1 rounded-md border-0 bg-transparent px-1 py-0.5 text-sm font-medium text-gray-900 outline-none ${colors.input} focus:ring-1 dark:text-white`
3030
+ }
3031
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-sm font-medium text-gray-900 dark:text-white", children: variable }),
3032
+ /* @__PURE__ */ jsxRuntime.jsx(
3033
+ "button",
3034
+ {
3035
+ type: "button",
3036
+ onClick: () => handleRemove(index),
3037
+ className: "shrink-0 rounded p-0.5 text-gray-400 opacity-0 transition-all hover:bg-red-100 hover:text-red-500 group-hover:opacity-100 dark:hover:bg-red-500/10 dark:hover:text-red-400",
3038
+ "aria-label": `Remove ${variable}`,
3039
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "h-3.5 w-3.5" })
3040
+ }
3041
+ )
3042
+ ]
3043
+ },
3044
+ `${index}-${variable}`
3045
+ )) }),
3046
+ canAdd && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
3047
+ /* @__PURE__ */ jsxRuntime.jsx(
3048
+ "input",
3049
+ {
3050
+ ref: inputRef,
3051
+ type: "text",
3052
+ value: newVariable,
3053
+ onChange: (event) => setNewVariable(event.target.value),
3054
+ onKeyDown: handleKeyDown,
3055
+ placeholder,
3056
+ className: "flex-1 rounded-lg border border-gray-200/50 bg-gray-50/50 px-3 py-1.5 text-sm text-gray-700 outline-none transition-colors placeholder:text-gray-400 focus:border-gray-300 focus:ring-1 focus:ring-gray-300/30 dark:border-white/10 dark:bg-white/5 dark:text-gray-300 dark:placeholder:text-gray-600"
3057
+ }
3058
+ ),
3059
+ /* @__PURE__ */ jsxRuntime.jsxs(
3060
+ "button",
3061
+ {
3062
+ type: "button",
3063
+ onClick: handleAdd,
3064
+ disabled: !newVariable.trim(),
3065
+ className: `flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs font-semibold transition-all disabled:cursor-not-allowed disabled:opacity-40 ${colors.add} hover:bg-white/10`,
3066
+ children: [
3067
+ /* @__PURE__ */ jsxRuntime.jsx(outline.PlusIcon, { className: "h-3.5 w-3.5" }),
3068
+ addLabel
3069
+ ]
3070
+ }
3071
+ )
3072
+ ] }),
3073
+ variables.length === 0 && !canAdd && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-400 dark:text-gray-500", children: "No variables defined" })
3074
+ ] });
3075
+ }
3076
+ function StartNodeConfigForm({ config, onSave, onCancel }) {
3077
+ const t = chunkYXN2K77G_js.useTranslations("agents.workflow.startNodeConfig");
3078
+ const [inputVariables, setInputVariables] = react.useState([...config.inputVariables]);
2913
3079
  const handleSave = () => {
2914
3080
  onSave({ ...config, inputVariables });
2915
3081
  };
2916
3082
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2917
3083
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2918
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("inputVariablesLabel") }),
2919
3084
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("inputVariablesHelp") }),
2920
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
2921
- /* @__PURE__ */ jsxRuntime.jsx(
2922
- chunk4XID6LOC_js.Input,
2923
- {
2924
- value: newVariable,
2925
- onChange: (event) => setNewVariable(event.target.value),
2926
- onKeyDown: handleKeyDown,
2927
- placeholder: t("variablePlaceholder"),
2928
- className: "flex-1"
2929
- }
2930
- ),
2931
- /* @__PURE__ */ jsxRuntime.jsx(
2932
- chunk4XID6LOC_js.Button,
2933
- {
2934
- type: "button",
2935
- onClick: handleAddVariable,
2936
- outline: true,
2937
- size: "sm",
2938
- children: t("addVariable")
2939
- }
2940
- )
2941
- ] }),
2942
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: inputVariables.map((variable) => /* @__PURE__ */ jsxRuntime.jsxs(
2943
- "span",
2944
- {
2945
- className: "inline-flex items-center gap-1 rounded-full bg-green-100 px-2.5 py-1 text-xs font-medium text-green-700 dark:bg-green-500/20 dark:text-green-300",
2946
- children: [
2947
- variable,
2948
- /* @__PURE__ */ jsxRuntime.jsx(
2949
- chunk4XID6LOC_js.IconButton,
2950
- {
2951
- icon: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "h-3 w-3" }),
2952
- label: `Remove ${variable}`,
2953
- onClick: () => handleRemoveVariable(variable),
2954
- variant: "ghost",
2955
- size: "sm",
2956
- className: "!p-0"
2957
- }
2958
- )
2959
- ]
2960
- },
2961
- variable
2962
- )) })
2963
- ] }),
2964
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2 border-t border-gray-200 pt-4 dark:border-gray-700", children: [
2965
3085
  /* @__PURE__ */ jsxRuntime.jsx(
2966
- chunk4XID6LOC_js.Button,
3086
+ VariableListEditor,
2967
3087
  {
2968
- type: "button",
2969
- onClick: onCancel,
2970
- outline: true,
2971
- size: "sm",
2972
- children: t("cancel")
2973
- }
2974
- ),
2975
- /* @__PURE__ */ jsxRuntime.jsx(
2976
- chunk4XID6LOC_js.Button,
2977
- {
2978
- type: "button",
2979
- onClick: handleSave,
2980
- color: "ios-glass-blue",
2981
- size: "sm",
2982
- children: t("save")
3088
+ variables: inputVariables,
3089
+ onChange: setInputVariables,
3090
+ label: t("inputVariablesLabel"),
3091
+ placeholder: t("variablePlaceholder"),
3092
+ addLabel: t("addVariable"),
3093
+ color: "green"
2983
3094
  }
2984
3095
  )
2985
- ] })
3096
+ ] }),
3097
+ /* @__PURE__ */ jsxRuntime.jsx(
3098
+ ConfigFormActions,
3099
+ {
3100
+ cancelLabel: t("cancel"),
3101
+ saveLabel: t("save"),
3102
+ onCancel,
3103
+ onSave: handleSave
3104
+ }
3105
+ )
2986
3106
  ] });
2987
3107
  }
2988
3108
  function EndNodeConfigForm({ config, onSave, onCancel }) {
2989
3109
  const t = chunkYXN2K77G_js.useTranslations("agents.workflow.endNodeConfig");
2990
3110
  const [outputVariables, setOutputVariables] = react.useState([...config.outputVariables]);
2991
- const [newVariable, setNewVariable] = react.useState("");
2992
- const handleAddVariable = () => {
2993
- const trimmed = newVariable.trim();
2994
- if (trimmed && !outputVariables.includes(trimmed)) {
2995
- setOutputVariables([...outputVariables, trimmed]);
2996
- setNewVariable("");
2997
- }
2998
- };
2999
- const handleRemoveVariable = (variable) => {
3000
- setOutputVariables(outputVariables.filter((existingVariable) => existingVariable !== variable));
3001
- };
3002
- const handleKeyDown = (event) => {
3003
- if (event.key === "Enter") {
3004
- event.preventDefault();
3005
- handleAddVariable();
3006
- }
3007
- };
3008
3111
  const handleSave = () => {
3009
3112
  onSave({ ...config, outputVariables });
3010
3113
  };
3011
3114
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
3012
3115
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3013
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("outputVariablesLabel") }),
3014
3116
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-2 text-xs text-gray-500 dark:text-gray-400", children: t("outputVariablesHelp") }),
3015
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
3016
- /* @__PURE__ */ jsxRuntime.jsx(
3017
- "input",
3018
- {
3019
- type: "text",
3020
- value: newVariable,
3021
- onChange: (event) => setNewVariable(event.target.value),
3022
- onKeyDown: handleKeyDown,
3023
- placeholder: t("variablePlaceholder"),
3024
- className: "w-full flex-1 rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 placeholder-gray-400 outline-none focus:border-indigo-400 focus:ring-2 focus:ring-indigo-400/20 dark:border-gray-600 dark:bg-gray-800 dark:text-white dark:placeholder-gray-500"
3025
- }
3026
- ),
3027
- /* @__PURE__ */ jsxRuntime.jsx(
3028
- "button",
3029
- {
3030
- type: "button",
3031
- onClick: handleAddVariable,
3032
- className: "text-sm text-indigo-600 hover:text-indigo-700 dark:text-indigo-400",
3033
- children: t("addVariable")
3034
- }
3035
- )
3036
- ] }),
3037
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: outputVariables.map((variable) => /* @__PURE__ */ jsxRuntime.jsxs(
3038
- "span",
3039
- {
3040
- className: "inline-flex items-center gap-1 rounded-full bg-red-100 px-2.5 py-1 text-xs font-medium text-red-700 dark:bg-red-500/20 dark:text-red-300",
3041
- children: [
3042
- variable,
3043
- /* @__PURE__ */ jsxRuntime.jsx(
3044
- "button",
3045
- {
3046
- type: "button",
3047
- onClick: () => handleRemoveVariable(variable),
3048
- className: "text-sm text-red-500 hover:text-red-600",
3049
- "aria-label": `Remove ${variable}`,
3050
- children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "h-3 w-3" })
3051
- }
3052
- )
3053
- ]
3054
- },
3055
- variable
3056
- )) })
3057
- ] }),
3058
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700", children: [
3059
- /* @__PURE__ */ jsxRuntime.jsx(
3060
- "button",
3061
- {
3062
- type: "button",
3063
- onClick: onCancel,
3064
- className: "rounded-lg border border-gray-300 px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",
3065
- children: t("cancel")
3066
- }
3067
- ),
3068
3117
  /* @__PURE__ */ jsxRuntime.jsx(
3069
- "button",
3118
+ VariableListEditor,
3070
3119
  {
3071
- type: "button",
3072
- onClick: handleSave,
3073
- className: "rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 dark:bg-indigo-500 dark:hover:bg-indigo-600",
3074
- children: t("save")
3120
+ variables: outputVariables,
3121
+ onChange: setOutputVariables,
3122
+ label: t("outputVariablesLabel"),
3123
+ placeholder: t("variablePlaceholder"),
3124
+ addLabel: t("addVariable"),
3125
+ color: "red"
3075
3126
  }
3076
3127
  )
3077
- ] })
3078
- ] });
3079
- }
3080
- function ConfigFormActions({
3081
- cancelLabel,
3082
- saveLabel,
3083
- onCancel,
3084
- onSave,
3085
- saveDisabled = false
3086
- }) {
3087
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2 border-t border-gray-200 pt-4 dark:border-gray-700", children: [
3088
- /* @__PURE__ */ jsxRuntime.jsx(chunk4XID6LOC_js.Button, { type: "button", outline: true, onClick: onCancel, children: cancelLabel }),
3089
- /* @__PURE__ */ jsxRuntime.jsx(chunk4XID6LOC_js.Button, { type: "button", onClick: onSave, disabled: saveDisabled, children: saveLabel })
3128
+ ] }),
3129
+ /* @__PURE__ */ jsxRuntime.jsx(
3130
+ ConfigFormActions,
3131
+ {
3132
+ cancelLabel: t("cancel"),
3133
+ saveLabel: t("save"),
3134
+ onCancel,
3135
+ onSave: handleSave
3136
+ }
3137
+ )
3090
3138
  ] });
3091
3139
  }
3092
3140
  var OPERATOR_OPTIONS = [
@@ -3568,23 +3616,6 @@ function AnswerNodeConfigForm({ config, onSave, onCancel }) {
3568
3616
  const t = chunkYXN2K77G_js.useTranslations("agents.workflow.answerNodeConfig");
3569
3617
  const [outputTemplate, setOutputTemplate] = react.useState(config.outputTemplate);
3570
3618
  const [outputVariables, setOutputVariables] = react.useState([...config.outputVariables]);
3571
- const [newVariable, setNewVariable] = react.useState("");
3572
- const handleAddVariable = () => {
3573
- const trimmed = newVariable.trim();
3574
- if (trimmed && !outputVariables.includes(trimmed)) {
3575
- setOutputVariables([...outputVariables, trimmed]);
3576
- setNewVariable("");
3577
- }
3578
- };
3579
- const handleRemoveVariable = (variable) => {
3580
- setOutputVariables(outputVariables.filter((existingVariable) => existingVariable !== variable));
3581
- };
3582
- const handleKeyDown = (event) => {
3583
- if (event.key === "Enter") {
3584
- event.preventDefault();
3585
- handleAddVariable();
3586
- }
3587
- };
3588
3619
  const handleSave = () => {
3589
3620
  onSave({ ...config, outputTemplate, outputVariables });
3590
3621
  };
@@ -3601,50 +3632,17 @@ function AnswerNodeConfigForm({ config, onSave, onCancel }) {
3601
3632
  className: "font-mono text-xs"
3602
3633
  }
3603
3634
  ),
3604
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3605
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("outputVariablesLabel") }),
3606
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
3607
- /* @__PURE__ */ jsxRuntime.jsx(
3608
- chunk4XID6LOC_js.FormInput,
3609
- {
3610
- type: "text",
3611
- value: newVariable,
3612
- onValueChange: setNewVariable,
3613
- onKeyDown: handleKeyDown,
3614
- placeholder: t("variablePlaceholder"),
3615
- className: "flex-1"
3616
- }
3617
- ),
3618
- /* @__PURE__ */ jsxRuntime.jsx(
3619
- chunk4XID6LOC_js.Button,
3620
- {
3621
- type: "button",
3622
- onClick: handleAddVariable,
3623
- children: t("addVariable")
3624
- }
3625
- )
3626
- ] }),
3627
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: outputVariables.map((variable) => /* @__PURE__ */ jsxRuntime.jsxs(
3628
- "span",
3629
- {
3630
- className: "inline-flex items-center gap-1 rounded-full bg-blue-100 px-2.5 py-1 text-xs font-medium text-blue-700 dark:bg-blue-500/20 dark:text-blue-300",
3631
- children: [
3632
- variable,
3633
- /* @__PURE__ */ jsxRuntime.jsx(
3634
- chunk4XID6LOC_js.IconButton,
3635
- {
3636
- onClick: () => handleRemoveVariable(variable),
3637
- icon: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "h-3 w-3" }),
3638
- label: `Remove ${variable}`,
3639
- size: "sm",
3640
- color: "ios-red"
3641
- }
3642
- )
3643
- ]
3644
- },
3645
- variable
3646
- )) })
3647
- ] }),
3635
+ /* @__PURE__ */ jsxRuntime.jsx(
3636
+ VariableListEditor,
3637
+ {
3638
+ variables: outputVariables,
3639
+ onChange: setOutputVariables,
3640
+ label: t("outputVariablesLabel"),
3641
+ placeholder: t("variablePlaceholder"),
3642
+ addLabel: t("addVariable"),
3643
+ color: "blue"
3644
+ }
3645
+ ),
3648
3646
  /* @__PURE__ */ jsxRuntime.jsx(
3649
3647
  ConfigFormActions,
3650
3648
  {
@@ -4039,77 +4037,23 @@ function VariableAggregatorNodeConfigForm({ config, onSave, onCancel }) {
4039
4037
  const [inputVariables, setInputVariables] = react.useState([...config.inputVariables]);
4040
4038
  const [outputVariable, setOutputVariable] = react.useState(config.outputVariable);
4041
4039
  const [aggregationMode, setAggregationMode] = react.useState(config.aggregationMode);
4042
- const [newVariable, setNewVariable] = react.useState("");
4043
- const handleAddVariable = () => {
4044
- const trimmed = newVariable.trim();
4045
- if (trimmed && !inputVariables.includes(trimmed)) {
4046
- setInputVariables([...inputVariables, trimmed]);
4047
- setNewVariable("");
4048
- }
4049
- };
4050
- const handleRemoveVariable = (index) => {
4051
- setInputVariables(inputVariables.filter((_, variableIndex) => variableIndex !== index));
4052
- };
4053
- const handleVariableChange = (index, value) => {
4054
- setInputVariables(inputVariables.map((variable, variableIndex) => variableIndex === index ? value : variable));
4055
- };
4056
- const handleKeyDown = (event) => {
4057
- if (event.key === "Enter") {
4058
- event.preventDefault();
4059
- handleAddVariable();
4060
- }
4061
- };
4062
4040
  const handleSave = () => {
4063
4041
  onSave({ ...config, inputVariables, outputVariable, aggregationMode });
4064
4042
  };
4065
4043
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
4066
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
4067
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 block text-sm font-medium text-gray-700 dark:text-gray-300", children: t("inputVariablesLabel") }),
4068
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
4069
- /* @__PURE__ */ jsxRuntime.jsx(
4070
- chunk4XID6LOC_js.FormInput,
4071
- {
4072
- type: "text",
4073
- value: newVariable,
4074
- onValueChange: setNewVariable,
4075
- onKeyDown: handleKeyDown,
4076
- placeholder: t("variablePlaceholder"),
4077
- className: "flex-1"
4078
- }
4079
- ),
4080
- /* @__PURE__ */ jsxRuntime.jsx(
4081
- chunk4XID6LOC_js.Button,
4082
- {
4083
- type: "button",
4084
- onClick: handleAddVariable,
4085
- children: t("addInputVariable")
4086
- }
4087
- )
4088
- ] }),
4089
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 space-y-2", children: inputVariables.map((variable, index) => /* @__PURE__ */ jsxRuntime.jsx(chunk4XID6LOC_js.Card, { className: "border-purple-200/70 dark:border-purple-500/30", children: /* @__PURE__ */ jsxRuntime.jsx(chunk4XID6LOC_js.CardContent, { className: "p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
4090
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex min-w-6 items-center justify-center rounded-full bg-purple-100 px-1.5 py-0.5 text-[10px] font-semibold text-purple-700 dark:bg-purple-500/20 dark:text-purple-300", children: index + 1 }),
4091
- /* @__PURE__ */ jsxRuntime.jsx(
4092
- chunk4XID6LOC_js.FormInput,
4093
- {
4094
- type: "text",
4095
- value: variable,
4096
- onValueChange: (value) => handleVariableChange(index, value),
4097
- placeholder: t("variablePlaceholder"),
4098
- className: "flex-1"
4099
- }
4100
- ),
4101
- /* @__PURE__ */ jsxRuntime.jsx(
4102
- chunk4XID6LOC_js.IconButton,
4103
- {
4104
- icon: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "h-3 w-3" }),
4105
- label: `Remove ${variable || index + 1}`,
4106
- onClick: () => handleRemoveVariable(index),
4107
- size: "sm",
4108
- color: "ios-red"
4109
- }
4110
- )
4111
- ] }) }) }, `${index}-${variable}`)) })
4112
- ] }),
4044
+ /* @__PURE__ */ jsxRuntime.jsx(
4045
+ VariableListEditor,
4046
+ {
4047
+ variables: inputVariables,
4048
+ onChange: setInputVariables,
4049
+ label: t("inputVariablesLabel"),
4050
+ placeholder: t("variablePlaceholder"),
4051
+ addLabel: t("addInputVariable"),
4052
+ color: "purple",
4053
+ numbered: true,
4054
+ editable: true
4055
+ }
4056
+ ),
4113
4057
  /* @__PURE__ */ jsxRuntime.jsx(
4114
4058
  chunk4XID6LOC_js.FormInput,
4115
4059
  {
@@ -7199,5 +7143,5 @@ exports.useModalStore = useModalStore;
7199
7143
  exports.useWorkflowBuilderClient = useWorkflowBuilderClient;
7200
7144
  exports.useWorkflowBuilderClientOptional = useWorkflowBuilderClientOptional;
7201
7145
  exports.useWorkflowStore = useWorkflowStore;
7202
- //# sourceMappingURL=chunk-E7GVGD4Z.js.map
7203
- //# sourceMappingURL=chunk-E7GVGD4Z.js.map
7146
+ //# sourceMappingURL=chunk-LFWRE3A3.js.map
7147
+ //# sourceMappingURL=chunk-LFWRE3A3.js.map