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