@iblai/iblai-js 2.70.0 → 2.71.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/web-containers/source/chat/index.js +7 -2
  2. package/dist/web-containers/source/chat/index.js.map +1 -1
  3. package/dist/web-containers/source/chat-input-form/use-overflow-fit.js +7 -5
  4. package/dist/web-containers/source/chat-input-form/use-overflow-fit.js.map +1 -1
  5. package/dist/web-containers/source/chat-input-form.js +5 -3
  6. package/dist/web-containers/source/chat-input-form.js.map +1 -1
  7. package/dist/web-containers/source/classifier-panel.js +401 -0
  8. package/dist/web-containers/source/classifier-panel.js.map +1 -0
  9. package/dist/web-containers/source/components/chat/index.js +7 -2
  10. package/dist/web-containers/source/components/chat/index.js.map +1 -1
  11. package/dist/web-containers/source/components/chat-input-form/use-overflow-fit.js +7 -5
  12. package/dist/web-containers/source/components/chat-input-form/use-overflow-fit.js.map +1 -1
  13. package/dist/web-containers/source/components/chat-input-form.js +5 -3
  14. package/dist/web-containers/source/components/chat-input-form.js.map +1 -1
  15. package/dist/web-containers/source/components/mentors/mentor-selection-grid.js +5 -2
  16. package/dist/web-containers/source/components/mentors/mentor-selection-grid.js.map +1 -1
  17. package/dist/web-containers/source/components/modals/user-profile-modal.js +3 -0
  18. package/dist/web-containers/source/components/modals/user-profile-modal.js.map +1 -1
  19. package/dist/web-containers/source/components/workflows/classifier-panel.js +401 -0
  20. package/dist/web-containers/source/components/workflows/classifier-panel.js.map +1 -0
  21. package/dist/web-containers/source/components/workflows/delete-workflow-modal.js +4 -3
  22. package/dist/web-containers/source/components/workflows/delete-workflow-modal.js.map +1 -1
  23. package/dist/web-containers/source/components/workflows/insert-reference.js +81 -0
  24. package/dist/web-containers/source/components/workflows/insert-reference.js.map +1 -0
  25. package/dist/web-containers/source/components/workflows/node-config-panel.js +135 -71
  26. package/dist/web-containers/source/components/workflows/node-config-panel.js.map +1 -1
  27. package/dist/web-containers/source/components/workflows/panel-fields.js +125 -0
  28. package/dist/web-containers/source/components/workflows/panel-fields.js.map +1 -0
  29. package/dist/web-containers/source/components/workflows/shortcuts.js +77 -0
  30. package/dist/web-containers/source/components/workflows/shortcuts.js.map +1 -0
  31. package/dist/web-containers/source/components/workflows/tool-dialogs.js +11 -11
  32. package/dist/web-containers/source/components/workflows/tool-dialogs.js.map +1 -1
  33. package/dist/web-containers/source/components/workflows/workflow-canvas.js +874 -278
  34. package/dist/web-containers/source/components/workflows/workflow-canvas.js.map +1 -1
  35. package/dist/web-containers/source/components/workflows/workflow-definition.js +220 -8
  36. package/dist/web-containers/source/components/workflows/workflow-definition.js.map +1 -1
  37. package/dist/web-containers/source/components/workflows/workflow-editor.js +495 -84
  38. package/dist/web-containers/source/components/workflows/workflow-editor.js.map +1 -1
  39. package/dist/web-containers/source/components/workflows/workflow-preview-chat.js +4 -0
  40. package/dist/web-containers/source/components/workflows/workflow-preview-chat.js.map +1 -1
  41. package/dist/web-containers/source/components/workflows/workflow-sidebar.js +6 -11
  42. package/dist/web-containers/source/components/workflows/workflow-sidebar.js.map +1 -1
  43. package/dist/web-containers/source/components/workflows/workflow-switch.js +13 -0
  44. package/dist/web-containers/source/components/workflows/workflow-switch.js.map +1 -0
  45. package/dist/web-containers/source/components/workflows/workflow-textarea.js +168 -0
  46. package/dist/web-containers/source/components/workflows/workflow-textarea.js.map +1 -0
  47. package/dist/web-containers/source/delete-workflow-modal.js +4 -3
  48. package/dist/web-containers/source/delete-workflow-modal.js.map +1 -1
  49. package/dist/web-containers/source/en.json.js +138 -9
  50. package/dist/web-containers/source/en.json.js.map +1 -1
  51. package/dist/web-containers/source/es.json.js +135 -6
  52. package/dist/web-containers/source/es.json.js.map +1 -1
  53. package/dist/web-containers/source/fr.json.js +135 -6
  54. package/dist/web-containers/source/fr.json.js.map +1 -1
  55. package/dist/web-containers/source/i18n/messages/en.json.js +138 -9
  56. package/dist/web-containers/source/i18n/messages/en.json.js.map +1 -1
  57. package/dist/web-containers/source/i18n/messages/es.json.js +135 -6
  58. package/dist/web-containers/source/i18n/messages/es.json.js.map +1 -1
  59. package/dist/web-containers/source/i18n/messages/fr.json.js +135 -6
  60. package/dist/web-containers/source/i18n/messages/fr.json.js.map +1 -1
  61. package/dist/web-containers/source/i18n/messages/zh.json.js +135 -6
  62. package/dist/web-containers/source/i18n/messages/zh.json.js.map +1 -1
  63. package/dist/web-containers/source/insert-reference.js +81 -0
  64. package/dist/web-containers/source/insert-reference.js.map +1 -0
  65. package/dist/web-containers/source/mentor-selection-grid.js +5 -2
  66. package/dist/web-containers/source/mentor-selection-grid.js.map +1 -1
  67. package/dist/web-containers/source/mentors/mentor-selection-grid.js +5 -2
  68. package/dist/web-containers/source/mentors/mentor-selection-grid.js.map +1 -1
  69. package/dist/web-containers/source/messages/en.json.js +138 -9
  70. package/dist/web-containers/source/messages/en.json.js.map +1 -1
  71. package/dist/web-containers/source/messages/es.json.js +135 -6
  72. package/dist/web-containers/source/messages/es.json.js.map +1 -1
  73. package/dist/web-containers/source/messages/fr.json.js +135 -6
  74. package/dist/web-containers/source/messages/fr.json.js.map +1 -1
  75. package/dist/web-containers/source/messages/zh.json.js +135 -6
  76. package/dist/web-containers/source/messages/zh.json.js.map +1 -1
  77. package/dist/web-containers/source/modals/user-profile-modal.js +3 -0
  78. package/dist/web-containers/source/modals/user-profile-modal.js.map +1 -1
  79. package/dist/web-containers/source/node-config-panel.js +135 -71
  80. package/dist/web-containers/source/node-config-panel.js.map +1 -1
  81. package/dist/web-containers/source/panel-fields.js +125 -0
  82. package/dist/web-containers/source/panel-fields.js.map +1 -0
  83. package/dist/web-containers/source/shortcuts.js +77 -0
  84. package/dist/web-containers/source/shortcuts.js.map +1 -0
  85. package/dist/web-containers/source/tool-dialogs.js +11 -11
  86. package/dist/web-containers/source/tool-dialogs.js.map +1 -1
  87. package/dist/web-containers/source/tsconfig.build.tsbuildinfo +1 -1
  88. package/dist/web-containers/source/use-overflow-fit.js +7 -5
  89. package/dist/web-containers/source/use-overflow-fit.js.map +1 -1
  90. package/dist/web-containers/source/user-profile-modal.js +3 -0
  91. package/dist/web-containers/source/user-profile-modal.js.map +1 -1
  92. package/dist/web-containers/source/web-containers/tsconfig.build.tsbuildinfo +1 -1
  93. package/dist/web-containers/source/workflow-canvas.js +874 -278
  94. package/dist/web-containers/source/workflow-canvas.js.map +1 -1
  95. package/dist/web-containers/source/workflow-definition.js +220 -8
  96. package/dist/web-containers/source/workflow-definition.js.map +1 -1
  97. package/dist/web-containers/source/workflow-editor.js +495 -84
  98. package/dist/web-containers/source/workflow-editor.js.map +1 -1
  99. package/dist/web-containers/source/workflow-preview-chat.js +4 -0
  100. package/dist/web-containers/source/workflow-preview-chat.js.map +1 -1
  101. package/dist/web-containers/source/workflow-sidebar.js +6 -11
  102. package/dist/web-containers/source/workflow-sidebar.js.map +1 -1
  103. package/dist/web-containers/source/workflow-switch.js +13 -0
  104. package/dist/web-containers/source/workflow-switch.js.map +1 -0
  105. package/dist/web-containers/source/workflow-textarea.js +168 -0
  106. package/dist/web-containers/source/workflow-textarea.js.map +1 -0
  107. package/dist/web-containers/source/workflows/classifier-panel.js +401 -0
  108. package/dist/web-containers/source/workflows/classifier-panel.js.map +1 -0
  109. package/dist/web-containers/source/workflows/delete-workflow-modal.js +4 -3
  110. package/dist/web-containers/source/workflows/delete-workflow-modal.js.map +1 -1
  111. package/dist/web-containers/source/workflows/insert-reference.js +81 -0
  112. package/dist/web-containers/source/workflows/insert-reference.js.map +1 -0
  113. package/dist/web-containers/source/workflows/node-config-panel.js +135 -71
  114. package/dist/web-containers/source/workflows/node-config-panel.js.map +1 -1
  115. package/dist/web-containers/source/workflows/panel-fields.js +125 -0
  116. package/dist/web-containers/source/workflows/panel-fields.js.map +1 -0
  117. package/dist/web-containers/source/workflows/shortcuts.js +77 -0
  118. package/dist/web-containers/source/workflows/shortcuts.js.map +1 -0
  119. package/dist/web-containers/source/workflows/tool-dialogs.js +11 -11
  120. package/dist/web-containers/source/workflows/tool-dialogs.js.map +1 -1
  121. package/dist/web-containers/source/workflows/workflow-canvas.js +874 -278
  122. package/dist/web-containers/source/workflows/workflow-canvas.js.map +1 -1
  123. package/dist/web-containers/source/workflows/workflow-definition.js +220 -8
  124. package/dist/web-containers/source/workflows/workflow-definition.js.map +1 -1
  125. package/dist/web-containers/source/workflows/workflow-editor.js +495 -84
  126. package/dist/web-containers/source/workflows/workflow-editor.js.map +1 -1
  127. package/dist/web-containers/source/workflows/workflow-preview-chat.js +4 -0
  128. package/dist/web-containers/source/workflows/workflow-preview-chat.js.map +1 -1
  129. package/dist/web-containers/source/workflows/workflow-sidebar.js +6 -11
  130. package/dist/web-containers/source/workflows/workflow-sidebar.js.map +1 -1
  131. package/dist/web-containers/source/workflows/workflow-switch.js +13 -0
  132. package/dist/web-containers/source/workflows/workflow-switch.js.map +1 -0
  133. package/dist/web-containers/source/workflows/workflow-textarea.js +168 -0
  134. package/dist/web-containers/source/workflows/workflow-textarea.js.map +1 -0
  135. package/dist/web-containers/source/zh.json.js +135 -6
  136. package/dist/web-containers/source/zh.json.js.map +1 -1
  137. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { useState, useRef, useEffect, useCallback } from 'react';
2
+ import { useRef, useState, useEffect, useCallback } from 'react';
3
3
  import { useGetMentorSettingsQuery, useGetToolsQuery } from '@iblai/data-layer';
4
4
  import { WithFormPermissions } from '@iblai/web-utils';
5
5
  import { useT } from '../../i18n/context.js';
@@ -8,10 +8,11 @@ import { Button } from '../ui/button.js';
8
8
  import { Input } from '../ui/input.js';
9
9
  import { Label } from '../ui/label.js';
10
10
  import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '../ui/dialog.js';
11
- import { Textarea } from '../ui/textarea.js';
12
- import { Switch } from '../ui/switch.js';
11
+ import { WorkflowTextarea } from './workflow-textarea.js';
12
+ import { WorkflowSwitch } from './workflow-switch.js';
13
13
  import { TooltipProvider, Tooltip, TooltipTrigger, TooltipContent } from '../ui/tooltip.js';
14
14
  import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../ui/select.js';
15
+ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '../ui/collapsible.js';
15
16
  import { MentorSelectionGrid } from '../mentors/mentor-selection-grid.js';
16
17
  import { AgentSettingsProvider } from '../modals/edit-mentor-modal/agent-settings-context.js';
17
18
  import { AgentDatasetsTab } from '../modals/edit-mentor-modal/tabs/datasets-tab.js';
@@ -19,24 +20,40 @@ import { McpTab } from '../modals/edit-mentor-modal/tabs/mcp-tab/index.js';
19
20
  import { useToggleTools } from '../modals/edit-mentor-modal/tabs/tools-tab/use-toggle-tools.js';
20
21
  import { useCopyToClipboard } from '../chat/markdown/use-copy-to-clipboard.js';
21
22
  import { ActionTooltip } from './action-tooltip.js';
22
- import { parseVariableDefault, EXPRESSION_EXAMPLES, WHILE_DEFAULT_MAX_ITERATIONS, isValidVariableName } from './workflow-definition.js';
23
+ import { ClassifierPanel } from './classifier-panel.js';
24
+ import { stepResultReference, ReferenceTextarea } from './insert-reference.js';
25
+ import { usePanelFieldFocus, FieldLabel, PlaceholderHint, fieldRoot } from './panel-fields.js';
26
+ import { isAuthoredInstructions, parseVariableDefault, WHILE_MAX_ITERATIONS, EXPRESSION_EXAMPLES, WHILE_DEFAULT_MAX_ITERATIONS, isValidVariableName, stepHasResult, stepPlaceholder } from './workflow-definition.js';
23
27
  import Check from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/check.js';
24
28
  import Copy from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/copy.js';
25
29
  import X from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/x.js';
26
30
  import Trash2 from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/trash-2.js';
27
31
  import Plus from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/plus.js';
28
32
  import Info from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/info.js';
33
+ import ChevronUp from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/chevron-up.js';
34
+ import ChevronDown from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
29
35
  import Settings from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/settings.js';
30
36
  import Plug from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/plug.js';
31
37
  import Cable from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/cable.js';
32
38
 
39
+ // Sized to the canvas it floats over, not the window: the editor's header and
40
+ // validation banner take a varying share of the screen, and a window-based cap
41
+ // pushed the bottom of a tall panel out of view. Phones get the canvas's full
42
+ // width: a 320px panel was cut off on the left.
43
+ const PANEL_SHELL = 'bg-card border-border absolute top-4 right-4 flex max-h-[calc(100%-2rem)] w-[320px] flex-col rounded-xl border shadow-xl max-md:inset-x-2 max-md:top-2 max-md:max-h-[calc(100%-1rem)] max-md:w-auto';
44
+ // On a phone the panel covers the canvas and Close is the only way out, so the
45
+ // header's 24px buttons grow to a finger's size there.
46
+ const PANEL_HEADER_BUTTON = 'h-6 w-6 pointer-coarse:size-8';
33
47
  const INPUT_VARIABLES = [{ id: '1', name: 'input', type: 'string' }];
34
48
  const VARIABLE_TYPES = ['String', 'Number', 'Boolean', 'Object', 'List'];
35
49
  // Blank first rows are only shown, never saved, until the user types in them.
36
50
  const blankCondition = () => [{ id: '1', caseName: '', expression: '' }];
37
51
  const blankTransformRow = () => [{ id: '1', target: '', expression: '' }];
38
52
  const blankAssignment = () => [{ id: '1', variable: '', expression: '' }];
39
- const DEFAULT_INSTRUCTIONS = 'You are a helpful assistant.';
53
+ // The backend never sends the old builder's pre-filled default, so it is shown
54
+ // as no instructions rather than as text the step adds.
55
+ const shownInstructions = (text) => (isAuthoredInstructions(text) ? (text !== null && text !== void 0 ? text : '') : '');
56
+ const schemaText = (schema) => schema ? JSON.stringify(schema, null, 2) : '';
40
57
  const DEFAULT_MENTOR_LABELS = new Set([
41
58
  'my agent',
42
59
  'agent',
@@ -50,11 +67,15 @@ const isDefaultMentorLabel = (label) => {
50
67
  return true;
51
68
  return DEFAULT_MENTOR_LABELS.has(label.trim().toLowerCase());
52
69
  };
53
- function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, onDeleteNode, workflowVariables = [], stepReferences = [], variableUsages = {}, org, defaultMentorId, username, agentSettings, }) {
54
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
70
+ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, onDeleteNode, workflowVariables = [], stepReferences = [], variableUsages = {}, placeholderVariables, placeholderSteps, org, defaultMentorId, username, agentSettings, classifierModels, onTryClassifier, focusField, }) {
71
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
55
72
  const t = useT();
73
+ const panelRef = useRef(null);
56
74
  const [nodeName, setNodeName] = useState(nodeData.label);
57
- const [instructions, setInstructions] = useState((_a = nodeData.instructions) !== null && _a !== void 0 ? _a : DEFAULT_INSTRUCTIONS);
75
+ const [instructions, setInstructions] = useState(shownInstructions(nodeData.instructions));
76
+ const [outputVariable, setOutputVariable] = useState((_a = nodeData.output_variable) !== null && _a !== void 0 ? _a : '');
77
+ const [outputSchema, setOutputSchema] = useState(schemaText(nodeData.outputSchema));
78
+ const [isAdvancedOpen, setIsAdvancedOpen] = useState(Boolean(nodeData.outputSchema));
58
79
  const [model, setModel] = useState((_b = nodeData.model) !== null && _b !== void 0 ? _b : '');
59
80
  const [continueOnError, setContinueOnError] = useState((_c = nodeData.continueOnError) !== null && _c !== void 0 ? _c : false);
60
81
  const [stateVariables, setStateVariables] = useState((_d = nodeData.stateVariables) !== null && _d !== void 0 ? _d : []);
@@ -69,7 +90,11 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
69
90
  return;
70
91
  }
71
92
  setNodeName(nodeData.label);
72
- setInstructions((_a = nodeData.instructions) !== null && _a !== void 0 ? _a : DEFAULT_INSTRUCTIONS);
93
+ setInstructions(shownInstructions(nodeData.instructions));
94
+ setOutputVariable((_a = nodeData.output_variable) !== null && _a !== void 0 ? _a : '');
95
+ setOutputSchema(schemaText(nodeData.outputSchema));
96
+ if (nodeData.outputSchema)
97
+ setIsAdvancedOpen(true);
73
98
  setModel((_b = nodeData.model) !== null && _b !== void 0 ? _b : '');
74
99
  setContinueOnError((_c = nodeData.continueOnError) !== null && _c !== void 0 ? _c : false);
75
100
  setStateVariables((_d = nodeData.stateVariables) !== null && _d !== void 0 ? _d : []);
@@ -153,7 +178,6 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
153
178
  if (nodeType !== 'mentor' || !mentorSettings)
154
179
  return;
155
180
  const mentorName = mentorSettings.mentor_name || mentorSettings.display_name || nodeData.label;
156
- const mentorPrompt = mentorSettings.system_prompt;
157
181
  const mentorModel = mentorSettings.llm_name;
158
182
  const forcePrefill = forceMentorPrefill.current;
159
183
  const updates = {};
@@ -163,13 +187,6 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
163
187
  updates.label = mentorName;
164
188
  }
165
189
  }
166
- if (mentorPrompt &&
167
- (forcePrefill || !nodeData.instructions || nodeData.instructions === DEFAULT_INSTRUCTIONS)) {
168
- if (mentorPrompt !== nodeData.instructions) {
169
- setInstructions(mentorPrompt);
170
- updates.instructions = mentorPrompt;
171
- }
172
- }
173
190
  if (mentorModel && mentorModel !== nodeData.model) {
174
191
  setModel(mentorModel);
175
192
  updates.model = mentorModel;
@@ -180,14 +197,20 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
180
197
  if (forcePrefill) {
181
198
  forceMentorPrefill.current = false;
182
199
  }
183
- }, [
184
- mentorSettings,
185
- nodeType,
186
- nodeData.label,
187
- nodeData.instructions,
188
- nodeData.model,
189
- updateNodeConfig,
190
- ]);
200
+ }, [mentorSettings, nodeType, nodeData.label, nodeData.model, updateNodeConfig]);
201
+ const agentPrompt = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.system_prompt;
202
+ const instructionsEdited = useRef(false);
203
+ // The old builder copied the agent's prompt in here. The backend skips such a
204
+ // copy, so the field shows it as empty instead of as extra instructions.
205
+ useEffect(() => {
206
+ if (nodeType !== 'mentor' || typeof agentPrompt !== 'string' || instructionsEdited.current) {
207
+ return;
208
+ }
209
+ const saved = nodeData.instructions;
210
+ if (typeof saved === 'string' && saved.trim() && !isAuthoredInstructions(saved, agentPrompt)) {
211
+ setInstructions('');
212
+ }
213
+ }, [nodeType, agentPrompt, nodeData]);
191
214
  const newVarNameTrimmed = newVarName.trim();
192
215
  const newVarNameInvalid = newVarNameTrimmed !== '' && !isValidVariableName(newVarNameTrimmed);
193
216
  const newVarNameTaken = stateVariables.some((variable) => variable.name === newVarNameTrimmed);
@@ -241,6 +264,9 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
241
264
  const updates = {
242
265
  entry_mentor_id: mentorId,
243
266
  mentor_id: mentorId,
267
+ // A hidden copy of the previous agent's prompt would count as written
268
+ // instructions for the new agent, so what the field shows is kept.
269
+ instructions: instructions.trim() ? instructions : undefined,
244
270
  };
245
271
  if (mentor.name) {
246
272
  setNodeName(mentor.name);
@@ -336,8 +362,25 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
336
362
  updateNodeConfig({ mcpConnectors: newConnectors });
337
363
  };
338
364
  const handleInstructionsChange = (value) => {
365
+ instructionsEdited.current = true;
339
366
  setInstructions(value);
340
- updateNodeConfig({ instructions: value });
367
+ updateNodeConfig({ instructions: value.trim() ? value : undefined });
368
+ };
369
+ const outputVariableName = outputVariable.trim();
370
+ const outputVariableInvalid = outputVariableName !== '' && !isValidVariableName(outputVariableName);
371
+ // Publish refuses a name that breaks the rule, so only a valid one is saved.
372
+ const handleOutputVariableChange = (value) => {
373
+ setOutputVariable(value);
374
+ const name = value.trim();
375
+ updateNodeConfig({ output_variable: isValidVariableName(name) ? name : undefined });
376
+ };
377
+ const outputSchemaInvalid = !parseVariableDefault('object', outputSchema).ok;
378
+ const handleOutputSchemaChange = (value) => {
379
+ setOutputSchema(value);
380
+ const parsed = parseVariableDefault('object', value);
381
+ if (parsed.ok) {
382
+ updateNodeConfig({ outputSchema: parsed.value });
383
+ }
341
384
  };
342
385
  const handleContinueOnErrorChange = (value) => {
343
386
  setContinueOnError(value);
@@ -361,6 +404,9 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
361
404
  const [maxIterationsBadInput, setMaxIterationsBadInput] = useState(false);
362
405
  const maxIterationsInvalid = maxIterationsBadInput ||
363
406
  (maxIterations.trim() !== '' && toMaxIterations(maxIterations) === undefined);
407
+ // Still saved: publish refuses it with its own message, and the step keeps
408
+ // what the user typed.
409
+ const maxIterationsTooHigh = !maxIterationsInvalid && ((_v = toMaxIterations(maxIterations)) !== null && _v !== void 0 ? _v : 0) > WHILE_MAX_ITERATIONS;
364
410
  const handleMaxIterationsChange = (value, badInput = false) => {
365
411
  setMaxIterations(value);
366
412
  setMaxIterationsBadInput(badInput);
@@ -369,35 +415,50 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
369
415
  const [copiedStepId, setCopiedStepId] = useState(null);
370
416
  const { copy: copyToClipboard, status: copyStatus } = useCopyToClipboard(1500);
371
417
  const copyStepReference = async (id) => {
372
- await copyToClipboard(`step_results['${id}']`);
418
+ await copyToClipboard(stepResultReference(id));
373
419
  setCopiedStepId(id);
374
420
  };
421
+ const ownPlaceholder = stepPlaceholder(nodeId);
422
+ const { copy: copyOwnPlaceholder, status: ownPlaceholderStatus } = useCopyToClipboard(1500);
375
423
  const handleUserApprovalMessageChange = (value) => {
376
424
  setUserApprovalMessage(value);
377
425
  updateNodeConfig({ userApprovalMessage: value });
378
426
  };
379
- const panelHeader = (description) => (jsxs("div", { className: "flex items-start justify-between", children: [jsxs("div", { className: "flex-1", children: [jsx("h3", { className: "text-foreground mb-0.5 text-base font-semibold", children: nodeData.label }), jsx("p", { className: "text-muted-foreground text-[11px]", children: description })] }), jsxs("div", { className: "flex items-center gap-0.5", children: [onDeleteNode && (jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.deleteNodeLabel', { label: nodeData.label }), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", "aria-label": t('workflowsNodeConfigPanel.deleteNodeLabel', { label: nodeData.label }), onClick: onDeleteNode, children: jsx(Trash2, { className: "text-muted-foreground h-3 w-3" }) }) })), jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", "aria-label": t('workflowsNodeConfigPanel.closeLabel'), onClick: onClose, children: jsx(X, { className: "text-muted-foreground h-3 w-3" }) })] })] }));
380
- const expressionHint = (jsxs(Fragment, { children: [jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.expressionHint') }), stepReferences.length > 0 && (jsxs("div", { className: "space-y-1", children: [jsx("h4", { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.stepIdsLabel') }), stepReferences.map((step) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between gap-2 rounded-lg border p-1.5", children: [jsxs("div", { className: "min-w-0", children: [jsx("p", { className: "text-foreground truncate text-xs", children: step.label }), jsx("p", { id: `${nodeId}-step-ref-${step.id}`, className: "text-muted-foreground truncate font-mono text-[10px]", children: step.id })] }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.copyStepReference', { label: step.label }), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5 shrink-0", "aria-label": t('workflowsNodeConfigPanel.copyStepReference', {
381
- label: step.label,
427
+ // The classifier focuses its own fields: it keeps its own Advanced section.
428
+ usePanelFieldFocus(panelRef, nodeType === 'classifier' ? undefined : focusField, (field) => {
429
+ if (fieldRoot(field) !== 'outputSchema' || isAdvancedOpen)
430
+ return false;
431
+ setIsAdvancedOpen(true);
432
+ return true;
433
+ });
434
+ const placeholderVariableNames = placeholderVariables !== null && placeholderVariables !== void 0 ? placeholderVariables : workflowVariables;
435
+ const placeholderStepReferences = placeholderSteps !== null && placeholderSteps !== void 0 ? placeholderSteps : stepReferences;
436
+ const panelHeader = (description) => (jsxs("div", { className: "flex items-start justify-between", children: [jsxs("div", { className: "flex-1", children: [jsx("h3", { className: "text-foreground mb-0.5 text-base font-semibold", children: nodeData.label }), jsx("p", { className: "text-muted-foreground text-[11px]", children: description })] }), jsxs("div", { className: "flex items-center gap-0.5", children: [stepHasResult(nodeType) && (jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.copyPlaceholder', { placeholder: ownPlaceholder }), children: jsx(Button, { variant: "ghost", size: "icon", className: PANEL_HEADER_BUTTON, "aria-label": t('workflowsNodeConfigPanel.copyPlaceholder', {
437
+ placeholder: ownPlaceholder,
438
+ }), onClick: () => void copyOwnPlaceholder(ownPlaceholder), children: ownPlaceholderStatus === 'success' ? (jsx(Check, { className: "text-muted-foreground h-3 w-3" })) : (jsx(Copy, { className: "text-muted-foreground h-3 w-3" })) }) })), onDeleteNode && (jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.deleteNodeLabel', { label: nodeData.label }), children: jsx(Button, { variant: "ghost", size: "icon", className: PANEL_HEADER_BUTTON, "aria-label": t('workflowsNodeConfigPanel.deleteNodeLabel', { label: nodeData.label }), onClick: onDeleteNode, children: jsx(Trash2, { className: "text-muted-foreground h-3 w-3" }) }) })), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.closeLabel'), children: jsx(Button, { variant: "ghost", size: "icon", className: PANEL_HEADER_BUTTON, "aria-label": t('workflowsNodeConfigPanel.closeLabel'), onClick: onClose, children: jsx(X, { className: "text-muted-foreground h-3 w-3" }) }) })] })] }));
439
+ const expressionHint = (jsxs(Fragment, { children: [jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.expressionHint') }), stepReferences.length > 0 && (jsxs("div", { className: "space-y-1", children: [jsx("h4", { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.stepIdsLabel') }), stepReferences.map((step) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between gap-2 rounded-lg border p-1.5", children: [jsxs("div", { className: "min-w-0", children: [jsx("p", { className: "text-foreground truncate text-xs", children: step.label }), jsx("p", { id: `${nodeId}-step-ref-${step.id}`, className: "text-muted-foreground truncate font-mono text-[10px]", children: stepResultReference(step.id) })] }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.copyPlaceholder', {
440
+ placeholder: stepResultReference(step.id),
441
+ }), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5 shrink-0", "aria-label": t('workflowsNodeConfigPanel.copyPlaceholder', {
442
+ placeholder: stepResultReference(step.id),
382
443
  }), "aria-describedby": `${nodeId}-step-ref-${step.id}`, onClick: () => void copyStepReference(step.id), children: copyStatus === 'success' && copiedStepId === step.id ? (jsx(Check, { className: "text-muted-foreground h-3 w-3" })) : (jsx(Copy, { className: "text-muted-foreground h-3 w-3" })) }) })] }, step.id)))] }))] }));
383
444
  if (nodeType === 'start') {
384
- return (jsxs(Fragment, { children: [jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-20 flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [jsxs("div", { className: "flex items-start justify-between", children: [jsxs("div", { className: "flex-1", children: [jsx("h3", { className: "text-foreground mb-0.5 text-base font-semibold", children: t('workflowsNodeConfigPanel.startTitle') }), jsx("p", { className: "text-muted-foreground text-xs", children: t('workflowsNodeConfigPanel.startDescription') })] }), jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", "aria-label": t('workflowsNodeConfigPanel.closeLabel'), onClick: onClose, children: jsx(X, { className: "h-3 w-3" }) })] }), jsxs("div", { className: "space-y-1.5", children: [jsx("h4", { className: "text-foreground text-xs font-medium", children: t('workflowsNodeConfigPanel.inputVariables') }), jsx("div", { className: "space-y-1", children: INPUT_VARIABLES.map((variable) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("div", { className: "flex h-3.5 w-3.5 items-center justify-center rounded bg-green-500/20", children: jsx("span", { className: "font-mono text-[10px] text-green-500", children: "=" }) }), jsx("span", { className: "text-foreground font-mono text-xs", children: variable.name })] }), jsx("span", { className: "text-muted-foreground text-xs", children: variable.type })] }, variable.id))) })] }), jsxs("div", { className: "space-y-1.5", children: [jsx("h4", { className: "text-foreground text-xs font-medium", children: t('workflowsNodeConfigPanel.stateVariables') }), jsx("div", { className: "space-y-1", children: stateVariables.map((variable) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("div", { className: "flex h-3.5 w-3.5 items-center justify-center rounded bg-purple-500/20", children: jsx("span", { className: "font-mono text-[10px] text-purple-500", children: "$" }) }), jsx("span", { className: "text-foreground font-mono text-xs", children: variable.name })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx("span", { className: "text-muted-foreground text-xs", children: variable.type }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.removeItemLabel', {
445
+ return (jsxs(Fragment, { children: [jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-20`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [jsxs("div", { className: "flex items-start justify-between", children: [jsxs("div", { className: "flex-1", children: [jsx("h3", { className: "text-foreground mb-0.5 text-base font-semibold", children: t('workflowsNodeConfigPanel.startTitle') }), jsx("p", { className: "text-muted-foreground text-xs", children: t('workflowsNodeConfigPanel.startDescription') })] }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.closeLabel'), children: jsx(Button, { variant: "ghost", size: "icon", className: PANEL_HEADER_BUTTON, "aria-label": t('workflowsNodeConfigPanel.closeLabel'), onClick: onClose, children: jsx(X, { className: "text-muted-foreground h-3 w-3" }) }) })] }), jsxs("div", { className: "space-y-1.5", children: [jsx("h4", { className: "text-foreground text-xs font-medium", children: t('workflowsNodeConfigPanel.inputVariables') }), jsx("div", { className: "space-y-1", children: INPUT_VARIABLES.map((variable) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("div", { className: "flex h-3.5 w-3.5 items-center justify-center rounded bg-green-500/20", children: jsx("span", { className: "font-mono text-[10px] text-green-500", children: "=" }) }), jsx("span", { className: "text-foreground font-mono text-xs", children: variable.name })] }), jsx("span", { className: "text-muted-foreground text-xs", children: variable.type })] }, variable.id))) })] }), jsxs("div", { className: "space-y-1.5", children: [jsx("h4", { className: "text-foreground text-xs font-medium", children: t('workflowsNodeConfigPanel.stateVariables') }), jsx("div", { className: "space-y-1", children: stateVariables.map((variable) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("div", { className: "flex h-3.5 w-3.5 items-center justify-center rounded bg-purple-500/20", children: jsx("span", { className: "font-mono text-[10px] text-purple-500", children: "$" }) }), jsx("span", { className: "text-foreground font-mono text-xs", children: variable.name })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx("span", { className: "text-muted-foreground text-xs", children: variable.type }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.removeItemLabel', {
385
446
  name: variable.name,
386
447
  }), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-4 w-4", "aria-label": t('workflowsNodeConfigPanel.removeItemLabel', {
387
448
  name: variable.name,
388
449
  }), onClick: () => {
389
450
  setVariablePendingDelete(variable);
390
451
  setIsDeleteVariableOpen(true);
391
- }, children: jsx(Trash2, { className: "text-muted-foreground h-2.5 w-2.5" }) }) })] })] }, variable.id))) }), jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", onClick: () => setShowAddModal(true), children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] })] }) }), jsx(Dialog, { open: isDeleteVariableOpen, onOpenChange: setIsDeleteVariableOpen, children: jsx(DialogContent, { onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: pendingDeleteUsages.length > 0 ? (jsxs(Fragment, { children: [jsxs(DialogHeader, { className: "space-y-3", children: [jsx(DialogTitle, { className: "ibl-dialog-title", children: t('workflowsNodeConfigPanel.variableInUseTitle') }), jsx(DialogDescription, { className: "text-gray-600 text-sm pt-2", children: t('workflowsNodeConfigPanel.variableInUseDescription', {
392
- name: (_v = variablePendingDelete === null || variablePendingDelete === void 0 ? void 0 : variablePendingDelete.name) !== null && _v !== void 0 ? _v : '',
393
- }) })] }), jsx("ul", { className: "text-foreground list-disc space-y-1 pl-5 text-sm", children: pendingDeleteUsages.map((step) => (jsx("li", { children: step.label }, step.id))) }), jsx(DialogFooter, { className: "gap-2 sm:gap-0 mt-4", children: jsx(Button, { type: "button", className: "ibl-button-primary", onClick: () => setIsDeleteVariableOpen(false), children: t('workflowsNodeConfigPanel.cancelButton') }) })] })) : (jsxs(Fragment, { children: [jsxs(DialogHeader, { className: "space-y-3", children: [jsx(DialogTitle, { className: "ibl-dialog-title", children: t('workflowsNodeConfigPanel.deleteVariableTitle') }), jsx(DialogDescription, { className: "text-gray-600 text-sm pt-2", children: t('workflowsNodeConfigPanel.deleteVariableDescription', {
452
+ }, children: jsx(Trash2, { className: "text-muted-foreground h-2.5 w-2.5" }) }) })] })] }, variable.id))) }), jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", "data-field": "stateVariables", onClick: () => setShowAddModal(true), children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] })] }) }), jsx(Dialog, { open: isDeleteVariableOpen, onOpenChange: setIsDeleteVariableOpen, children: jsx(DialogContent, { className: "w-[calc(100%-2rem)] rounded-lg", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: pendingDeleteUsages.length > 0 ? (jsxs(Fragment, { children: [jsxs(DialogHeader, { className: "space-y-3", children: [jsx(DialogTitle, { className: "ibl-dialog-title", children: t('workflowsNodeConfigPanel.variableInUseTitle') }), jsx(DialogDescription, { className: "text-gray-600 text-sm pt-2", children: t('workflowsNodeConfigPanel.variableInUseDescription', {
394
453
  name: (_w = variablePendingDelete === null || variablePendingDelete === void 0 ? void 0 : variablePendingDelete.name) !== null && _w !== void 0 ? _w : '',
454
+ }) })] }), jsx("ul", { className: "text-foreground list-disc space-y-1 pl-5 text-sm", children: pendingDeleteUsages.map((step) => (jsx("li", { children: step.label }, step.id))) }), jsx(DialogFooter, { className: "gap-2 sm:gap-0 mt-4", children: jsx(Button, { type: "button", className: "ibl-button-primary", onClick: () => setIsDeleteVariableOpen(false), children: t('workflowsNodeConfigPanel.cancelButton') }) })] })) : (jsxs(Fragment, { children: [jsxs(DialogHeader, { className: "space-y-3", children: [jsx(DialogTitle, { className: "ibl-dialog-title", children: t('workflowsNodeConfigPanel.deleteVariableTitle') }), jsx(DialogDescription, { className: "text-gray-600 text-sm pt-2", children: t('workflowsNodeConfigPanel.deleteVariableDescription', {
455
+ name: (_x = variablePendingDelete === null || variablePendingDelete === void 0 ? void 0 : variablePendingDelete.name) !== null && _x !== void 0 ? _x : '',
395
456
  }) })] }), jsxs(DialogFooter, { className: "gap-2 sm:gap-0 mt-4", children: [jsx(Button, { type: "button", variant: "outline", onClick: () => setIsDeleteVariableOpen(false), children: t('workflowsNodeConfigPanel.cancelButton') }), jsx(Button, { type: "button", className: "ibl-button-primary", onClick: () => {
396
457
  if (variablePendingDelete) {
397
458
  handleRemoveVariable(variablePendingDelete.id);
398
459
  }
399
460
  setIsDeleteVariableOpen(false);
400
- }, children: t('workflowsNodeConfigPanel.deleteButton') })] })] })) }) }), jsx(Dialog, { open: showAddModal, onOpenChange: setShowAddModal, children: jsxs(DialogContent, { className: "bg-card w-[calc(100%-2rem)] rounded-lg sm:max-w-[500px]", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { children: jsx(DialogTitle, { className: "sr-only", children: t('workflowsNodeConfigPanel.addStateVariableDialogTitle') }) }), jsxs("div", { className: "space-y-6 pt-4", children: [jsx("div", { className: "bg-muted flex gap-2 rounded-lg p-1", children: VARIABLE_TYPES.map((type) => (jsx("button", { type: "button", onClick: () => {
461
+ }, children: t('workflowsNodeConfigPanel.deleteButton') })] })] })) }) }), jsx(Dialog, { open: showAddModal, onOpenChange: setShowAddModal, children: jsxs(DialogContent, { className: "bg-card w-[calc(100%-2rem)] rounded-lg sm:max-w-[500px]", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { children: jsx(DialogTitle, { className: "sr-only", children: t('workflowsNodeConfigPanel.addStateVariableDialogTitle') }) }), jsxs("div", { className: "space-y-6 pt-4", children: [jsx("div", { className: "bg-muted flex gap-2 rounded-lg p-1 max-sm:gap-1", children: VARIABLE_TYPES.map((type) => (jsx("button", { type: "button", onClick: () => {
401
462
  setSelectedType(type);
402
463
  // Reset default value when type changes to avoid invalid data
403
464
  if (type === 'Boolean') {
@@ -415,28 +476,28 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
415
476
  else {
416
477
  setNewVarDefault('');
417
478
  }
418
- }, className: `flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors ${selectedType === type
479
+ }, className: `flex-1 rounded-md px-4 py-2 text-sm font-medium transition-colors max-sm:px-2 max-sm:text-xs ${selectedType === type
419
480
  ? 'bg-background text-foreground shadow-sm'
420
481
  : 'text-muted-foreground hover:text-foreground'}`, children: type }, type))) }), jsxs("div", { className: "space-y-2", children: [jsx(Label, { htmlFor: "var-name", className: "text-sm font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { id: "var-name", placeholder: t('workflowsNodeConfigPanel.variableNamePlaceholder'), value: newVarName, onChange: (e) => setNewVarName(e.target.value), "aria-invalid": newVarNameInvalid || newVarNameTaken, className: "bg-muted border-border" }), jsx("p", { className: `text-xs ${newVarNameInvalid || newVarNameTaken ? 'text-destructive' : 'text-muted-foreground'}`, children: newVarNameTaken
421
482
  ? t('workflowsNodeConfigPanel.variableNameTaken')
422
- : t('workflowsNodeConfigPanel.variableNameHint') })] }), jsxs("div", { className: "space-y-2", children: [jsxs(Label, { htmlFor: "var-default", className: "text-sm font-medium", children: [t('workflowsNodeConfigPanel.defaultValueLabel'), ' ', jsx("span", { className: "text-muted-foreground font-normal", children: t('workflowsNodeConfigPanel.defaultValueOptional') })] }), selectedType === 'Boolean' ? (jsxs("div", { className: "bg-muted border-border flex items-center gap-3 rounded-lg border p-3", children: [jsx(Switch, { id: "var-default", checked: newVarDefault === 'true', onCheckedChange: (checked) => setNewVarDefault(checked ? 'true' : 'false') }), jsx("span", { className: "text-muted-foreground text-sm", children: newVarDefault === 'true'
483
+ : t('workflowsNodeConfigPanel.variableNameHint') })] }), jsxs("div", { className: "space-y-2", children: [jsxs(Label, { htmlFor: "var-default", className: "text-sm font-medium", children: [t('workflowsNodeConfigPanel.defaultValueLabel'), ' ', jsx("span", { className: "text-muted-foreground font-normal", children: t('workflowsNodeConfigPanel.defaultValueOptional') })] }), selectedType === 'Boolean' ? (jsxs("div", { className: "bg-muted border-border flex items-center gap-3 rounded-lg border p-3", children: [jsx(WorkflowSwitch, { id: "var-default", checked: newVarDefault === 'true', onCheckedChange: (checked) => setNewVarDefault(checked ? 'true' : 'false') }), jsx("span", { className: "text-muted-foreground text-sm", children: newVarDefault === 'true'
423
484
  ? t('workflowsNodeConfigPanel.booleanTrue')
424
- : t('workflowsNodeConfigPanel.booleanFalse') })] })) : selectedType === 'Number' ? (jsx(Input, { id: "var-default", type: "number", placeholder: "0", value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border" })) : selectedType === 'Object' ? (jsx(Textarea, { id: "var-default", placeholder: '{ "key": "value" }', value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border min-h-[100px] font-mono text-sm" })) : selectedType === 'List' ? (jsx(Textarea, { id: "var-default", placeholder: '["item1", "item2"]', value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border min-h-[100px] font-mono text-sm" })) : (jsx(Input, { id: "var-default", placeholder: t('workflowsNodeConfigPanel.defaultValueStringPlaceholder'), value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border" })), defaultValueError && (jsx("p", { className: "text-destructive text-xs", children: defaultValueError }))] }), jsx("div", { className: "flex justify-end", children: jsx(Button, { onClick: handleSaveVariable, disabled: !canSaveVariable, className: "bg-background hover:bg-muted text-foreground border-border h-9 border", children: t('workflowsNodeConfigPanel.saveButton') }) })] })] }) })] }));
485
+ : t('workflowsNodeConfigPanel.booleanFalse') })] })) : selectedType === 'Number' ? (jsx(Input, { id: "var-default", type: "number", placeholder: "0", value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border" })) : selectedType === 'Object' ? (jsx(WorkflowTextarea, { id: "var-default", placeholder: '{ "key": "value" }', value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border min-h-[100px] font-mono text-sm" })) : selectedType === 'List' ? (jsx(WorkflowTextarea, { id: "var-default", placeholder: '["item1", "item2"]', value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border min-h-[100px] font-mono text-sm" })) : (jsx(Input, { id: "var-default", placeholder: t('workflowsNodeConfigPanel.defaultValueStringPlaceholder'), value: newVarDefault, onChange: (e) => setNewVarDefault(e.target.value), className: "bg-muted border-border" })), defaultValueError && (jsx("p", { className: "text-destructive text-xs", children: defaultValueError }))] }), jsx("div", { className: "flex justify-end", children: jsx(Button, { onClick: handleSaveVariable, disabled: !canSaveVariable, className: "bg-background hover:bg-muted text-foreground border-border h-9 border", children: t('workflowsNodeConfigPanel.saveButton') }) })] })] }) })] }));
425
486
  }
426
487
  if (nodeType === 'mentor') {
427
488
  const modelDisplay = (mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.llm_provider)
428
489
  ? `${mentorSettings.llm_provider}${model ? ` · ${model}` : ''}`
429
490
  : model;
430
491
  const enabledToolSlugs = new Set(mentorToolSlugs);
431
- return (jsxs(Fragment, { children: [jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.mentorDescription')), jsxs("div", { className: "space-y-1", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Button, { variant: "ghost", size: "sm", className: "h-6 px-2 text-[11px]", onClick: () => setShowMentorModal(true), children: selectedMentorId
492
+ return (jsxs(Fragment, { children: [jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.mentorDescription')), jsxs("div", { className: "space-y-1", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Button, { variant: "ghost", size: "sm", className: "h-6 px-2 text-[11px]", "data-field": "mentor_id entry_mentor_id", onClick: () => setShowMentorModal(true), children: selectedMentorId
432
493
  ? t('workflowsNodeConfigPanel.changeButton')
433
- : t('workflowsNodeConfigPanel.selectButton') })] }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), className: "bg-muted border-border h-8 text-sm" }), !selectedMentorId && (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.selectAgentHint') }))] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.instructionsLabel') }), jsx(Textarea, { value: instructions, onChange: (e) => handleInstructionsChange(e.target.value), className: "bg-muted border-border min-h-[80px] resize-none text-xs" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.modelLabel') }), jsx(Input, { value: modelDisplay, readOnly: true, placeholder: selectedMentorId
494
+ : t('workflowsNodeConfigPanel.selectButton') })] }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), "data-field": "label", className: "bg-muted border-border h-8 text-sm" }), !selectedMentorId && (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.selectAgentHint') }))] }), jsxs("div", { className: "space-y-1", children: [jsx(FieldLabel, { label: t('workflowsNodeConfigPanel.instructionsLabel'), htmlFor: `${nodeId}-instructions`, info: t('workflowsNodeConfigPanel.instructionsInfo') }), jsx(ReferenceTextarea, { id: `${nodeId}-instructions`, "data-field": "instructions", value: instructions, onValueChange: handleInstructionsChange, format: "placeholder", variables: placeholderVariableNames, steps: placeholderStepReferences, placeholder: t('workflowsNodeConfigPanel.agentInstructionsPlaceholder'), className: "bg-muted border-border min-h-[80px] text-xs" }), jsx(PlaceholderHint, { idPrefix: nodeId, variables: placeholderVariableNames, stepReferences: placeholderStepReferences })] }), jsxs("div", { className: "space-y-1", children: [jsx(FieldLabel, { label: t('workflowsNodeConfigPanel.outputVariableLabel'), htmlFor: `${nodeId}-output-variable`, info: t('workflowsNodeConfigPanel.agentOutputVariableInfo') }), jsx(Input, { id: `${nodeId}-output-variable`, "data-field": "output_variable", value: outputVariable, onChange: (e) => handleOutputVariableChange(e.target.value), placeholder: t('workflowsNodeConfigPanel.outputVariablePlaceholder'), "aria-invalid": outputVariableInvalid, className: "bg-muted border-border h-8 font-mono text-sm" }), outputVariableInvalid && (jsx("p", { className: "text-destructive text-[10px]", children: t('workflowsNodeConfigPanel.variableNameHint') }))] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.modelLabel') }), jsx(Input, { value: modelDisplay, readOnly: true, "data-field": "model", placeholder: selectedMentorId
434
495
  ? isMentorSettingsLoading
435
496
  ? t('workflowsNodeConfigPanel.loadingModelPlaceholder')
436
497
  : t('workflowsNodeConfigPanel.noModelConfiguredPlaceholder')
437
498
  : t('workflowsNodeConfigPanel.selectAgentModelPlaceholder'), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.toolsLabel') }), !selectedMentorId && (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.selectAgentToolsHint') })), selectedMentorId && (isToolsLoading || isMentorSettingsLoading) && (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.loadingTools') })), selectedMentorId && !isToolsLoading && (tools === null || tools === void 0 ? void 0 : tools.length) === 0 && (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.noToolsAvailable') })), selectedMentorId && !isToolsLoading && (tools === null || tools === void 0 ? void 0 : tools.length) ? (jsx(WithFormPermissions, { name: "mentor_tools",
438
499
  // @ts-ignore
439
- permissions: (_x = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.permissions) === null || _x === void 0 ? void 0 : _x.field, enableRBAC: (_y = agentSettings === null || agentSettings === void 0 ? void 0 : agentSettings.enableRBAC) !== null && _y !== void 0 ? _y : false, children: ({ disabled }) => (jsx("div", { className: "space-y-1", children: tools === null || tools === void 0 ? void 0 : tools.map((tool) => {
500
+ permissions: (_y = mentorSettings === null || mentorSettings === void 0 ? void 0 : mentorSettings.permissions) === null || _y === void 0 ? void 0 : _y.field, enableRBAC: (_z = agentSettings === null || agentSettings === void 0 ? void 0 : agentSettings.enableRBAC) !== null && _z !== void 0 ? _z : false, children: ({ disabled }) => (jsx("div", { className: "space-y-1", children: tools === null || tools === void 0 ? void 0 : tools.map((tool) => {
440
501
  var _a;
441
502
  const slug = (_a = tool === null || tool === void 0 ? void 0 : tool.slug) !== null && _a !== void 0 ? _a : '';
442
503
  const toolLabel = (tool === null || tool === void 0 ? void 0 : tool.display_name) ||
@@ -446,7 +507,7 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
446
507
  const isDisabled = isToolsDisabled || disabled || !slug;
447
508
  return (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("span", { className: "text-foreground text-xs", children: toolLabel }), (tool === null || tool === void 0 ? void 0 : tool.description) ? (jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { "aria-label": t('workflowsNodeConfigPanel.toolInfoAriaLabel', {
448
509
  toolLabel,
449
- }), children: jsx(Info, { className: "text-muted-foreground h-3 w-3" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: tool === null || tool === void 0 ? void 0 : tool.description }) })] }) })) : null] }), jsx(Switch, { checked: isEnabled, onCheckedChange: () => {
510
+ }), children: jsx(Info, { className: "text-muted-foreground h-3 w-3" }) }), jsx(TooltipContent, { className: "ibl-tooltip-content", children: jsx("p", { children: tool === null || tool === void 0 ? void 0 : tool.description }) })] }) })) : null] }), jsx(WorkflowSwitch, { checked: isEnabled, onCheckedChange: () => {
450
511
  if (!slug || isDisabled)
451
512
  return;
452
513
  toggleTools(slug);
@@ -456,15 +517,20 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
456
517
  ? t('workflowsNodeConfigPanel.toolEnabled')
457
518
  : t('workflowsNodeConfigPanel.toolDisabled'),
458
519
  }) })] }, slug || toolLabel));
459
- }) })) })) : null] })] }) }), jsx(Dialog, { open: showMentorModal, onOpenChange: (open) => {
520
+ }) })) })) : null] }), jsxs(Collapsible, { open: isAdvancedOpen, onOpenChange: setIsAdvancedOpen, className: "border-border space-y-2 border-t pt-2", children: [jsx(CollapsibleTrigger, { asChild: true, children: jsxs("button", { type: "button", className: "text-foreground flex w-full items-center justify-between text-[11px] font-medium", children: [t('workflowsNodeConfigPanel.advancedLabel'), isAdvancedOpen ? (jsx(ChevronUp, { className: "text-muted-foreground h-3 w-3" })) : (jsx(ChevronDown, { className: "text-muted-foreground h-3 w-3" }))] }) }), jsxs(CollapsibleContent, { className: "space-y-1", children: [jsx(FieldLabel, { label: t('workflowsNodeConfigPanel.outputSchemaLabel'), htmlFor: `${nodeId}-output-schema`, info: t('workflowsNodeConfigPanel.outputSchemaInfo') }), jsx(WorkflowTextarea, { id: `${nodeId}-output-schema`, "data-field": "outputSchema", value: outputSchema, onChange: (e) => handleOutputSchemaChange(e.target.value), "aria-invalid": outputSchemaInvalid, className: "bg-muted border-border min-h-[100px] font-mono text-xs" }), outputSchemaInvalid && (jsx("p", { className: "text-destructive text-[10px]", children: t('workflowsNodeConfigPanel.outputSchemaInvalid') }))] })] })] }) }), jsx(Dialog, { open: showMentorModal, onOpenChange: (open) => {
460
521
  setShowMentorModal(open);
461
522
  if (!open) {
462
523
  setMentorSearchQuery('');
463
524
  }
464
- }, children: jsxs(DialogContent, { className: "w-[95vw] max-w-7xl gap-0 overflow-hidden rounded-lg p-0", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { className: "border-b border-gray-200 bg-white px-6 py-4", children: jsx(DialogTitle, { className: "text-lg font-semibold text-gray-900", children: t('workflowsNodeConfigPanel.selectAgentDialogTitle') }) }), jsx("div", { className: "px-6 py-4", children: jsx(MentorSelectionGrid, { selectedMentorIds: selectedMentorId ? [selectedMentorId] : [], onMentorSelect: handleMentorSelect, searchQuery: mentorSearchQuery, onSearchChange: setMentorSearchQuery, tenantKey: org !== null && org !== void 0 ? org : '', itemsPerPage: 8, showSearch: true, minHeight: "400px" }) })] }) })] }));
525
+ }, children: jsxs(DialogContent, { className: "w-[95vw] max-w-7xl gap-0 overflow-hidden rounded-lg p-0", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { className: "border-b border-gray-200 bg-white px-6 py-4", children: jsx(DialogTitle, { className: "text-lg font-semibold text-gray-900", children: t('workflowsNodeConfigPanel.selectAgentDialogTitle') }) }), jsx("div", { className: "px-6 py-4", children: jsx(MentorSelectionGrid, { selectedMentorIds: selectedMentorId ? [selectedMentorId] : [],
526
+ // Publish refuses an Agent step on the workflow's own agent.
527
+ excludedMentorIds: defaultMentorId ? [defaultMentorId] : [], onMentorSelect: handleMentorSelect, searchQuery: mentorSearchQuery, onSearchChange: setMentorSearchQuery, tenantKey: org !== null && org !== void 0 ? org : '', itemsPerPage: 8, showSearch: true, minHeight: "400px" }) })] }) })] }));
528
+ }
529
+ if (nodeType === 'classifier') {
530
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsx(ClassifierPanel, { nodeId: nodeId, nodeData: nodeData, header: panelHeader(t('workflowsClassifierPanel.description')), onUpdate: updateNodeConfig, workflowVariables: placeholderVariableNames, stepReferences: placeholderStepReferences, models: classifierModels, onTry: onTryClassifier ? (input) => onTryClassifier(nodeId, input) : undefined, focusField: focusField }) }));
465
531
  }
466
532
  if (nodeType === 'guardrails') {
467
- return (jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.guardrailsDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.inputLabel') }), jsxs("div", { className: "bg-muted border-border flex items-center gap-2 rounded-lg border p-2", children: [jsx("div", { className: "flex h-4 w-4 items-center justify-center rounded bg-green-500/20", children: jsx("span", { className: "font-mono text-[10px] text-green-500", children: "=" }) }), jsx("span", { className: "text-foreground font-mono text-xs", children: "input" }), jsxs(Select, { defaultValue: "STRING", children: [jsx(SelectTrigger, { className: "bg-background border-border ml-auto h-6 w-[90px] text-xs", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "STRING", children: "STRING" }), jsx(SelectItem, { value: "NUMBER", children: "NUMBER" }), jsx(SelectItem, { value: "BOOLEAN", children: "BOOLEAN" })] })] })] })] }), jsxs("div", { className: "space-y-2 pt-2", children: [jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.piiLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(Switch, {})] })] }), jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.moderationLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(Switch, {})] })] }), jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.jailbreakLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(Switch, {})] })] }), jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.hallucinationLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(Switch, {})] })] })] }), jsxs("div", { className: "border-border flex items-center justify-between border-t py-1 pt-2", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.continueOnErrorLabel') }), jsx(Switch, { checked: continueOnError, onCheckedChange: handleContinueOnErrorChange })] })] }) }));
533
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.guardrailsDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), "data-field": "label", className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.inputLabel') }), jsxs("div", { className: "bg-muted border-border flex items-center gap-2 rounded-lg border p-2", children: [jsx("div", { className: "flex h-4 w-4 items-center justify-center rounded bg-green-500/20", children: jsx("span", { className: "font-mono text-[10px] text-green-500", children: "=" }) }), jsx("span", { className: "text-foreground font-mono text-xs", children: "input" }), jsxs(Select, { defaultValue: "STRING", children: [jsx(SelectTrigger, { className: "bg-background border-border ml-auto h-6 w-[90px] text-xs", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { children: [jsx(SelectItem, { value: "STRING", children: "STRING" }), jsx(SelectItem, { value: "NUMBER", children: "NUMBER" }), jsx(SelectItem, { value: "BOOLEAN", children: "BOOLEAN" })] })] })] })] }), jsxs("div", { className: "space-y-2 pt-2", children: [jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.piiLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(WorkflowSwitch, {})] })] }), jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.moderationLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(WorkflowSwitch, {})] })] }), jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.jailbreakLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(WorkflowSwitch, {})] })] }), jsxs("div", { className: "flex items-center justify-between py-1", children: [jsxs("div", { className: "flex items-center gap-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.hallucinationLabel') }), jsx(Info, { className: "text-muted-foreground h-3 w-3" })] }), jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", children: jsx(Settings, { className: "text-muted-foreground h-3 w-3" }) }), jsx(WorkflowSwitch, {})] })] })] }), jsxs("div", { className: "border-border flex items-center justify-between border-t py-1 pt-2", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.continueOnErrorLabel') }), jsx(WorkflowSwitch, { checked: continueOnError, onCheckedChange: handleContinueOnErrorChange, "data-field": "continueOnError" })] })] }) }));
468
534
  }
469
535
  if (nodeType === 'file-search') {
470
536
  const handleDatasetSelect = (dataset) => {
@@ -485,9 +551,9 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
485
551
  updateNodeConfig({ fileSearchQuery: value });
486
552
  };
487
553
  const openDatasetDialog = () => setShowDatasetDialog(true);
488
- return (jsxs(Fragment, { children: [jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.fileSearchDescription')), jsxs("div", { className: "space-y-1", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.datasetLabel') }), jsx(Button, { variant: "ghost", size: "sm", className: "h-6 px-2 text-[11px]", onClick: openDatasetDialog, children: datasetId
554
+ return (jsxs(Fragment, { children: [jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.fileSearchDescription')), jsxs("div", { className: "space-y-1", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.datasetLabel') }), jsx(Button, { variant: "ghost", size: "sm", className: "h-6 px-2 text-[11px]", "data-field": "datasetId", onClick: openDatasetDialog, children: datasetId
489
555
  ? t('workflowsNodeConfigPanel.changeButton')
490
- : t('workflowsNodeConfigPanel.selectButton') })] }), datasetId ? (jsx("p", { className: "text-foreground bg-muted truncate rounded-md px-2 py-1.5 text-xs", children: datasetName })) : (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.selectDatasetHint') }))] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.maxResultsLabel') }), jsx(Input, { type: "number", value: maxResults, onChange: (e) => handleMaxResultsChange(e.target.value), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.queryLabel') }), jsx(Textarea, { value: fileSearchQuery, onChange: (e) => handleFileSearchQueryChange(e.target.value), placeholder: t('workflowsNodeConfigPanel.fileSearchQueryPlaceholder'), className: "bg-muted border-border min-h-[100px] resize-none text-xs" })] })] }) }), jsx(Dialog, { open: showDatasetDialog, onOpenChange: setShowDatasetDialog, children: jsxs(DialogContent, { className: "flex max-h-[80vh] w-[90vw] max-w-3xl flex-col gap-0 overflow-hidden rounded-lg p-0", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { className: "sr-only", children: jsx(DialogTitle, { children: t('workflowsNodeConfigPanel.selectDatasetDialogTitle') }) }), jsx(AgentSettingsProvider, { ...pickerSettings, children: jsx(AgentDatasetsTab, { ...agentSettings === null || agentSettings === void 0 ? void 0 : agentSettings.datasetResourceConfig, onSelect: handleDatasetSelect, selectedDatasetId: datasetId }) })] }) })] }));
556
+ : t('workflowsNodeConfigPanel.selectButton') })] }), datasetId ? (jsx("p", { className: "text-foreground bg-muted truncate rounded-md px-2 py-1.5 text-xs", children: datasetName })) : (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.selectDatasetHint') }))] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.maxResultsLabel') }), jsx(Input, { type: "number", "data-field": "maxResults", value: maxResults, onChange: (e) => handleMaxResultsChange(e.target.value), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.queryLabel') }), jsx(WorkflowTextarea, { "data-field": "fileSearchQuery", value: fileSearchQuery, onChange: (e) => handleFileSearchQueryChange(e.target.value), placeholder: t('workflowsNodeConfigPanel.fileSearchQueryPlaceholder'), className: "bg-muted border-border min-h-[100px] text-xs" })] })] }) }), jsx(Dialog, { open: showDatasetDialog, onOpenChange: setShowDatasetDialog, children: jsxs(DialogContent, { className: "flex max-h-[80vh] w-[90vw] max-w-3xl flex-col gap-0 overflow-hidden rounded-lg p-0", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { className: "sr-only", children: jsx(DialogTitle, { children: t('workflowsNodeConfigPanel.selectDatasetDialogTitle') }) }), jsx(AgentSettingsProvider, { ...pickerSettings, children: jsx(AgentDatasetsTab, { ...agentSettings === null || agentSettings === void 0 ? void 0 : agentSettings.datasetResourceConfig, onSelect: handleDatasetSelect, selectedDatasetId: datasetId }) })] }) })] }));
491
557
  }
492
558
  if (nodeType === 'mcp') {
493
559
  const openMcpDialog = () => setShowConnectorManagement(true);
@@ -508,7 +574,7 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
508
574
  updateNodeConfig({ mcpConnectors: newConnectors });
509
575
  closeMcpDialog();
510
576
  };
511
- return (jsxs(Fragment, { children: [jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.mcpDescription')), mcpConnectors.length === 0 ? (jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 py-8", children: [jsxs("div", { className: "flex items-center gap-3", children: [jsx("div", { className: "border-border flex h-16 w-16 items-center justify-center rounded-2xl border bg-white shadow-sm", children: jsx(Plug, { className: "h-8 w-8 text-[#38A1E5]" }) }), jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-[#38A1E5] shadow-sm", children: jsx(Cable, { className: "h-8 w-8 text-white" }) })] }), jsxs(Button, { variant: "secondary", size: "sm", className: "h-8 gap-1.5 text-xs has-[>svg]:px-2.5", onClick: openMcpDialog, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] })) : (jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.connectedToolsLabel') }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.addButton'), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", "aria-label": t('workflowsNodeConfigPanel.addButton'), onClick: openMcpDialog, children: jsx(Plus, { className: "text-muted-foreground h-3 w-3" }) }) })] }), jsx("div", { className: "space-y-1", children: mcpConnectors.map((connector) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("div", { className: "bg-background flex h-6 w-6 items-center justify-center rounded", children: connector.icon ? (jsx("img", { src: connector.icon, alt: connector.name, className: "h-4 w-4 object-contain" })) : (jsx("span", { className: "text-sm", children: "\uD83D\uDD0C" })) }), jsx("span", { className: "text-foreground text-xs", children: connector.name })] }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.removeItemLabel', {
577
+ return (jsxs(Fragment, { children: [jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.mcpDescription')), mcpConnectors.length === 0 ? (jsxs("div", { className: "flex flex-col items-center justify-center space-y-4 py-8", children: [jsxs("div", { className: "flex items-center gap-3", children: [jsx("div", { className: "border-border flex h-16 w-16 items-center justify-center rounded-2xl border bg-white shadow-sm", children: jsx(Plug, { className: "h-8 w-8 text-[#38A1E5]" }) }), jsx("div", { className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-[#38A1E5] shadow-sm", children: jsx(Cable, { className: "h-8 w-8 text-white" }) })] }), jsxs(Button, { variant: "secondary", size: "sm", className: "h-8 gap-1.5 text-xs has-[>svg]:px-2.5", "data-field": "mcpConnectors", onClick: openMcpDialog, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] })) : (jsxs("div", { className: "space-y-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.connectedToolsLabel') }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.addButton'), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", "aria-label": t('workflowsNodeConfigPanel.addButton'), "data-field": "mcpConnectors", onClick: openMcpDialog, children: jsx(Plus, { className: "text-muted-foreground h-3 w-3" }) }) })] }), jsx("div", { className: "space-y-1", children: mcpConnectors.map((connector) => (jsxs("div", { className: "bg-muted/50 border-border flex items-center justify-between rounded-lg border p-1.5", children: [jsxs("div", { className: "flex items-center gap-1.5", children: [jsx("div", { className: "bg-background flex h-6 w-6 items-center justify-center rounded", children: connector.icon ? (jsx("img", { src: connector.icon, alt: connector.name, className: "h-4 w-4 object-contain" })) : (jsx("span", { className: "text-sm", children: "\uD83D\uDD0C" })) }), jsx("span", { className: "text-foreground text-xs", children: connector.name })] }), jsx(ActionTooltip, { label: t('workflowsNodeConfigPanel.removeItemLabel', {
512
578
  name: connector.name,
513
579
  }), children: jsx(Button, { variant: "ghost", size: "icon", className: "h-4 w-4", "aria-label": t('workflowsNodeConfigPanel.removeItemLabel', {
514
580
  name: connector.name,
@@ -518,34 +584,34 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
518
584
  }, children: jsxs(DialogContent, { className: "flex max-h-[80vh] w-[90vw] max-w-4xl flex-col gap-0 overflow-hidden rounded-lg p-0", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { className: "sr-only", children: jsx(DialogTitle, { children: t('workflowsNodeConfigPanel.selectMcpDialogTitle') }) }), jsx(AgentSettingsProvider, { ...pickerSettings, children: jsx(McpTab, { onSelect: handleMcpSelect }) })] }) })] }));
519
585
  }
520
586
  if (nodeType === 'while') {
521
- return (jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.whileDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { htmlFor: `${nodeId}-while-condition`, className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.conditionLabel') }), jsx(Textarea, { id: `${nodeId}-while-condition`, value: whileCondition, onChange: (e) => handleWhileConditionChange(e.target.value), placeholder: EXPRESSION_EXAMPLES.whileCondition, className: "bg-muted border-border min-h-[100px] resize-none font-mono text-xs" }), expressionHint] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { htmlFor: `${nodeId}-max-iterations`, className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.maxIterationsLabel') }), jsx(Input, { id: `${nodeId}-max-iterations`, type: "number", min: 1, step: 1, value: maxIterations, onChange: (e) => { var _a; return handleMaxIterationsChange(e.target.value, (_a = e.target.validity) === null || _a === void 0 ? void 0 : _a.badInput); },
587
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.whileDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), "data-field": "label", className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { htmlFor: `${nodeId}-while-condition`, className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.conditionLabel') }), jsx(ReferenceTextarea, { id: `${nodeId}-while-condition`, "data-field": "condition", value: whileCondition, onValueChange: handleWhileConditionChange, format: "expression", variables: workflowVariables, steps: stepReferences, placeholder: EXPRESSION_EXAMPLES.whileCondition, className: "bg-muted border-border min-h-[100px] font-mono text-xs" }), expressionHint] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { htmlFor: `${nodeId}-max-iterations`, className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.maxIterationsLabel') }), jsx(Input, { id: `${nodeId}-max-iterations`, "data-field": "maxIterations", type: "number", min: 1, max: WHILE_MAX_ITERATIONS, step: 1, value: maxIterations, onChange: (e) => { var _a; return handleMaxIterationsChange(e.target.value, (_a = e.target.validity) === null || _a === void 0 ? void 0 : _a.badInput); },
522
588
  // React drops input events that leave the value '' unchanged,
523
589
  // which is what letters in a number field look like.
524
- onInput: (e) => { var _a, _b; return setMaxIterationsBadInput((_b = (_a = e.currentTarget.validity) === null || _a === void 0 ? void 0 : _a.badInput) !== null && _b !== void 0 ? _b : false); }, placeholder: String(WHILE_DEFAULT_MAX_ITERATIONS), "aria-invalid": maxIterationsInvalid, className: "bg-muted border-border h-8 text-sm" }), jsx("p", { className: `text-[10px] ${maxIterationsInvalid ? 'text-destructive' : 'text-muted-foreground'}`, children: maxIterationsInvalid
590
+ onInput: (e) => { var _a, _b; return setMaxIterationsBadInput((_b = (_a = e.currentTarget.validity) === null || _a === void 0 ? void 0 : _a.badInput) !== null && _b !== void 0 ? _b : false); }, placeholder: String(WHILE_DEFAULT_MAX_ITERATIONS), "aria-invalid": maxIterationsInvalid || maxIterationsTooHigh, className: "bg-muted border-border h-8 text-sm" }), jsx("p", { className: `text-[10px] ${maxIterationsInvalid || maxIterationsTooHigh ? 'text-destructive' : 'text-muted-foreground'}`, children: maxIterationsInvalid
525
591
  ? t('workflowsNodeConfigPanel.maxIterationsInvalid')
526
- : t('workflowsNodeConfigPanel.maxIterationsHint', {
527
- count: WHILE_DEFAULT_MAX_ITERATIONS,
528
- }) })] }), jsx("p", { className: "text-muted-foreground border-border border-t pt-2 text-[10px]", children: t('workflowsNodeConfigPanel.whileConnectHint') })] }) }));
592
+ : maxIterationsTooHigh
593
+ ? t('workflowsNodeConfigPanel.maxIterationsTooHigh', {
594
+ max: WHILE_MAX_ITERATIONS,
595
+ })
596
+ : t('workflowsNodeConfigPanel.maxIterationsHint', {
597
+ count: WHILE_DEFAULT_MAX_ITERATIONS,
598
+ }) })] }), jsx("p", { className: "text-muted-foreground border-border border-t pt-2 text-[10px]", children: t('workflowsNodeConfigPanel.whileConnectHint') })] }) }));
529
599
  }
530
600
  if (nodeType === 'user-approval') {
531
- return (jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.userApprovalDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.messageLabel') }), jsx(Textarea, { value: userApprovalMessage, onChange: (e) => handleUserApprovalMessageChange(e.target.value), placeholder: t('workflowsNodeConfigPanel.approvalMessagePlaceholder'), className: "bg-muted border-border min-h-[120px] resize-none text-xs" })] })] }) }));
601
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.userApprovalDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), "data-field": "label", className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.messageLabel') }), jsx(WorkflowTextarea, { "data-field": "userApprovalMessage", value: userApprovalMessage, onChange: (e) => handleUserApprovalMessageChange(e.target.value), placeholder: t('workflowsNodeConfigPanel.approvalMessagePlaceholder'), className: "bg-muted border-border min-h-[120px] text-xs" })] })] }) }));
532
602
  }
533
603
  if (nodeType === 'transform') {
534
- return (jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.transformDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-2", children: [transformExpressions.map((expr) => (jsxs("div", { className: "border-border bg-muted/30 space-y-1.5 rounded-lg border p-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { htmlFor: `${nodeId}-${expr.id}-target`, className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.keyLabel') }), transformExpressions.length > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-4 w-4", "aria-label": t('workflowsNodeConfigPanel.removeRowLabel'), onClick: () => handleRemoveTransformExpression(expr.id), children: jsx(Trash2, { className: "text-muted-foreground h-2.5 w-2.5" }) }))] }), jsx(Input, { id: `${nodeId}-${expr.id}-target`, value: expr.target, onChange: (e) => handleUpdateTransformExpression(expr.id, {
604
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.transformDescription')), jsxs("div", { className: "space-y-1", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { value: nodeName, onChange: (e) => handleNameChange(e.target.value), "data-field": "label", className: "bg-muted border-border h-8 text-sm" })] }), jsxs("div", { className: "space-y-2", children: [transformExpressions.map((expr, index) => (jsxs("div", { className: "border-border bg-muted/30 space-y-1.5 rounded-lg border p-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { htmlFor: `${nodeId}-${expr.id}-target`, className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.keyLabel') }), transformExpressions.length > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-4 w-4", "aria-label": t('workflowsNodeConfigPanel.removeRowLabel'), onClick: () => handleRemoveTransformExpression(expr.id), children: jsx(Trash2, { className: "text-muted-foreground h-2.5 w-2.5" }) }))] }), jsx(Input, { id: `${nodeId}-${expr.id}-target`, "data-field": `expressions[${index}].target`, value: expr.target, onChange: (e) => handleUpdateTransformExpression(expr.id, {
535
605
  target: e.target.value,
536
- }), placeholder: EXPRESSION_EXAMPLES.transformTarget, className: "bg-background border-border h-7 text-xs" }), jsx(Label, { htmlFor: `${nodeId}-${expr.id}-expression`, className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.valueLabel') }), jsx(Textarea, { id: `${nodeId}-${expr.id}-expression`, value: expr.expression, onChange: (e) => handleUpdateTransformExpression(expr.id, {
537
- expression: e.target.value,
538
- }), placeholder: EXPRESSION_EXAMPLES.transform, className: "bg-background border-border min-h-[60px] font-mono text-xs" })] }, expr.id))), expressionHint, jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", onClick: handleAddTransformExpression, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] })] }) }));
606
+ }), placeholder: EXPRESSION_EXAMPLES.transformTarget, className: "bg-background border-border h-7 text-xs" }), jsx(Label, { htmlFor: `${nodeId}-${expr.id}-expression`, className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.valueLabel') }), jsx(ReferenceTextarea, { id: `${nodeId}-${expr.id}-expression`, "data-field": `expressions[${index}].expression`, value: expr.expression, onValueChange: (expression) => handleUpdateTransformExpression(expr.id, { expression }), format: "expression", variables: workflowVariables, steps: stepReferences, placeholder: EXPRESSION_EXAMPLES.transform, className: "bg-background border-border min-h-[60px] font-mono text-xs" })] }, expr.id))), jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", "data-field": "expressions", "data-list-add": true, onClick: handleAddTransformExpression, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] }), expressionHint] })] }) }));
539
607
  }
540
608
  if (nodeType === 'set-state') {
541
- return (jsxs("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.setStateDescription')), jsxs("div", { className: "space-y-2", children: [assignments.map((assignment) => {
609
+ return (jsxs("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.setStateDescription')), jsxs("div", { className: "space-y-2", children: [assignments.map((assignment, index) => {
542
610
  const variableOptions = Array.from(new Set([...workflowVariables, assignment.variable].filter(Boolean)));
543
- return (jsxs("div", { className: "border-border bg-muted/30 space-y-1.5 rounded-lg border p-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { htmlFor: `${nodeId}-${assignment.id}-expression`, className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.assignValueLabel') }), assignments.length > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-4 w-4", "aria-label": t('workflowsNodeConfigPanel.removeRowLabel'), onClick: () => handleRemoveAssignment(assignment.id), children: jsx(Trash2, { className: "text-muted-foreground h-2.5 w-2.5" }) }))] }), jsx(Textarea, { id: `${nodeId}-${assignment.id}-expression`, value: assignment.expression, onChange: (e) => handleUpdateAssignment(assignment.id, {
544
- expression: e.target.value,
545
- }), placeholder: EXPRESSION_EXAMPLES.setState, className: "bg-background border-border min-h-[60px] font-mono text-xs" }), jsx(Label, { className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.toVariableLabel') }), jsxs("div", { className: "flex gap-1", children: [jsxs(Select, { value: assignment.variable, onValueChange: (value) => handleUpdateAssignment(assignment.id, {
611
+ return (jsxs("div", { className: "border-border bg-muted/30 space-y-1.5 rounded-lg border p-2", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { htmlFor: `${nodeId}-${assignment.id}-expression`, className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.assignValueLabel') }), assignments.length > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-4 w-4", "aria-label": t('workflowsNodeConfigPanel.removeRowLabel'), onClick: () => handleRemoveAssignment(assignment.id), children: jsx(Trash2, { className: "text-muted-foreground h-2.5 w-2.5" }) }))] }), jsx(ReferenceTextarea, { id: `${nodeId}-${assignment.id}-expression`, "data-field": `assignments[${index}].expression`, value: assignment.expression, onValueChange: (expression) => handleUpdateAssignment(assignment.id, { expression }), format: "expression", variables: workflowVariables, steps: stepReferences, placeholder: EXPRESSION_EXAMPLES.setState, className: "bg-background border-border min-h-[60px] font-mono text-xs" }), jsx(Label, { className: "text-foreground text-[10px] font-medium", children: t('workflowsNodeConfigPanel.toVariableLabel') }), jsxs("div", { className: "flex gap-1", children: [jsxs(Select, { value: assignment.variable, onValueChange: (value) => handleUpdateAssignment(assignment.id, {
546
612
  variable: value,
547
- }), children: [jsx(SelectTrigger, { "aria-label": t('workflowsNodeConfigPanel.toVariableLabel'), className: "bg-background border-border h-7 flex-1 text-xs", children: jsx(SelectValue, { placeholder: t('workflowsNodeConfigPanel.selectPlaceholder') }) }), jsx(SelectContent, { children: variableOptions.length === 0 ? (jsx("p", { className: "text-muted-foreground px-2 py-1.5 text-xs", children: t('workflowsNodeConfigPanel.noVariablesYet') })) : (variableOptions.map((name) => (jsx(SelectItem, { value: name, className: "font-mono text-xs", children: name }, name)))) })] }), jsxs(Button, { variant: "outline", size: "sm", className: "h-7 gap-1.5 bg-transparent px-2 text-xs has-[>svg]:px-2.5", onClick: () => setNewVariableRowId(assignment.id), children: [jsx(Plus, { className: "mr-0.5 h-2.5 w-2.5" }), t('workflowsNodeConfigPanel.newButton')] })] })] }, assignment.id));
548
- }), expressionHint, jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", onClick: handleAddAssignment, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] })] }), jsx(Dialog, { open: newVariableRowId !== null, onOpenChange: (open) => {
613
+ }), children: [jsx(SelectTrigger, { "aria-label": t('workflowsNodeConfigPanel.toVariableLabel'), "data-field": `assignments[${index}].variable`, className: "bg-background border-border h-7 flex-1 text-xs", children: jsx(SelectValue, { placeholder: t('workflowsNodeConfigPanel.selectPlaceholder') }) }), jsx(SelectContent, { children: variableOptions.length === 0 ? (jsx("p", { className: "text-muted-foreground px-2 py-1.5 text-xs", children: t('workflowsNodeConfigPanel.noVariablesYet') })) : (variableOptions.map((name) => (jsx(SelectItem, { value: name, className: "font-mono text-xs", children: name }, name)))) })] }), jsxs(Button, { variant: "outline", size: "sm", className: "h-7 gap-1.5 bg-transparent px-2 text-xs has-[>svg]:px-2.5", onClick: () => setNewVariableRowId(assignment.id), children: [jsx(Plus, { className: "mr-0.5 h-2.5 w-2.5" }), t('workflowsNodeConfigPanel.newButton')] })] })] }, assignment.id));
614
+ }), jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", "data-field": "assignments", "data-list-add": true, onClick: handleAddAssignment, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] }), expressionHint] })] }), jsx(Dialog, { open: newVariableRowId !== null, onOpenChange: (open) => {
549
615
  if (!open)
550
616
  closeNewVariableDialog();
551
617
  }, children: jsxs(DialogContent, { className: "bg-card w-[calc(100%-2rem)] rounded-lg sm:max-w-[420px]", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: t('workflowsNodeConfigPanel.newVariableDialogTitle') }) }), jsxs("form", { className: "space-y-4", onSubmit: (e) => {
@@ -554,18 +620,16 @@ function NodeConfigPanel({ nodeId, nodeType, nodeData, onClose, onUpdateNode, on
554
620
  }, children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { htmlFor: "new-variable-name", className: "text-sm font-medium", children: t('workflowsNodeConfigPanel.nameLabel') }), jsx(Input, { id: "new-variable-name", autoFocus: true, placeholder: t('workflowsNodeConfigPanel.variableNamePlaceholder'), value: newVariableName, onChange: (e) => setNewVariableName(e.target.value), "aria-invalid": newVariableNameTrimmed !== '' && !canAddNewVariable, className: "bg-muted border-border font-mono" }), jsx("p", { className: `text-xs ${newVariableNameTrimmed !== '' && !canAddNewVariable ? 'text-destructive' : 'text-muted-foreground'}`, children: t('workflowsNodeConfigPanel.variableNameHint') })] }), jsx("div", { className: "flex justify-end", children: jsx(Button, { type: "submit", disabled: !canAddNewVariable, className: "h-9", children: t('workflowsNodeConfigPanel.addButton') }) })] })] }) })] }));
555
621
  }
556
622
  if (nodeType === 'if-else' || nodeType === 'conditional') {
557
- return (jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.ifElseDescription')), conditions.map((condition, index) => (jsxs("div", { className: "bg-muted/30 border-border space-y-2 rounded-lg border p-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: index === 0
623
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxs("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: [panelHeader(t('workflowsNodeConfigPanel.ifElseDescription')), conditions.map((condition, index) => (jsxs("div", { className: "bg-muted/30 border-border space-y-2 rounded-lg border p-3", children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Label, { className: "text-foreground text-[11px] font-medium", children: index === 0
558
624
  ? t('workflowsNodeConfigPanel.conditionIf')
559
- : t('workflowsNodeConfigPanel.conditionElseIf', { index }) }), conditions.length > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", "aria-label": t('workflowsNodeConfigPanel.removeRowLabel'), onClick: () => handleRemoveCondition(condition.id), children: jsx(Trash2, { className: "text-muted-foreground h-3 w-3" }) }))] }), jsx(Input, { placeholder: t('workflowsNodeConfigPanel.caseNamePlaceholder'), className: "bg-background border-border h-8 text-sm", value: condition.caseName, onChange: (e) => handleUpdateCondition(condition.id, {
625
+ : t('workflowsNodeConfigPanel.conditionElseIf', { index }) }), conditions.length > 1 && (jsx(Button, { variant: "ghost", size: "icon", className: "h-5 w-5", "aria-label": t('workflowsNodeConfigPanel.removeRowLabel'), onClick: () => handleRemoveCondition(condition.id), children: jsx(Trash2, { className: "text-muted-foreground h-3 w-3" }) }))] }), jsx(Input, { placeholder: t('workflowsNodeConfigPanel.caseNamePlaceholder'), className: "bg-background border-border h-8 text-sm", "data-field": `conditions[${index}].caseName`, value: condition.caseName, onChange: (e) => handleUpdateCondition(condition.id, {
560
626
  caseName: e.target.value,
561
- }) }), jsx(Textarea, { "aria-label": index === 0
627
+ }) }), jsx(ReferenceTextarea, { "aria-label": index === 0
562
628
  ? t('workflowsNodeConfigPanel.conditionIf')
563
- : t('workflowsNodeConfigPanel.conditionElseIf', { index }), placeholder: t('workflowsNodeConfigPanel.conditionPlaceholder'), className: "bg-background border-border min-h-[60px] resize-none font-mono text-xs", value: condition.expression, onChange: (e) => handleUpdateCondition(condition.id, {
564
- expression: e.target.value,
565
- }) })] }, condition.id))), expressionHint, jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", onClick: handleAddCondition, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] })] }) }));
629
+ : t('workflowsNodeConfigPanel.conditionElseIf', { index }), "data-field": `conditions[${index}].expression${index === 0 ? ' condition conditions' : ''}`, placeholder: t('workflowsNodeConfigPanel.conditionPlaceholder'), className: "bg-background border-border min-h-[60px] font-mono text-xs", value: condition.expression, onValueChange: (expression) => handleUpdateCondition(condition.id, { expression }), format: "expression", variables: workflowVariables, steps: stepReferences }), !condition.expression.trim() && (jsx("p", { className: "text-muted-foreground text-[10px]", children: t('workflowsNodeConfigPanel.conditionRequired') }))] }, condition.id))), jsxs(Button, { variant: "secondary", size: "sm", className: "h-7 w-full gap-1.5 text-xs has-[>svg]:px-2.5", "data-field": "conditions", "data-list-add": true, onClick: handleAddCondition, children: [jsx(Plus, { className: "mr-1 h-3 w-3" }), t('workflowsNodeConfigPanel.addButton')] }), expressionHint] }) }));
566
630
  }
567
631
  if (nodeType === 'end') {
568
- return (jsx("div", { "data-testid": "workflow-node-panel", className: "bg-card border-border absolute top-4 right-4 z-[22] flex max-h-[calc(100vh-14rem)] w-[320px] flex-col rounded-xl border shadow-xl", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsx("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: panelHeader(t('workflowsNodeConfigPanel.endDescription')) }) }));
632
+ return (jsx("div", { ref: panelRef, "data-testid": "workflow-node-panel", className: `${PANEL_SHELL} z-[22]`, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsx("div", { className: "flex-1 space-y-2 overflow-y-auto p-3", children: panelHeader(t('workflowsNodeConfigPanel.endDescription')) }) }));
569
633
  }
570
634
  return null;
571
635
  }