@datatechsolutions/ui 2.11.83 → 2.11.84

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 (101) hide show
  1. package/dist/astrlabe/index.d.mts +3 -52
  2. package/dist/astrlabe/index.d.ts +3 -52
  3. package/dist/astrlabe/index.js +107 -107
  4. package/dist/astrlabe/index.mjs +4 -4
  5. package/dist/astrlabe/workflow-canvas.js +4 -4
  6. package/dist/astrlabe/workflow-canvas.mjs +3 -3
  7. package/dist/chunk-3T2WGL47.js +44 -0
  8. package/dist/chunk-3T2WGL47.js.map +1 -0
  9. package/dist/{chunk-UVGMKHWH.mjs → chunk-63AL2RN5.mjs} +4 -4
  10. package/dist/{chunk-UVGMKHWH.mjs.map → chunk-63AL2RN5.mjs.map} +1 -1
  11. package/dist/chunk-64G2HBRQ.mjs +481 -0
  12. package/dist/chunk-64G2HBRQ.mjs.map +1 -0
  13. package/dist/{chunk-J3OYJ44D.mjs → chunk-BH2AU3LG.mjs} +3 -3
  14. package/dist/{chunk-J3OYJ44D.mjs.map → chunk-BH2AU3LG.mjs.map} +1 -1
  15. package/dist/chunk-CCRBT7TA.mjs +941 -0
  16. package/dist/chunk-CCRBT7TA.mjs.map +1 -0
  17. package/dist/chunk-CHLJUSXX.mjs +128 -0
  18. package/dist/chunk-CHLJUSXX.mjs.map +1 -0
  19. package/dist/chunk-CXIQWPBH.js +214 -0
  20. package/dist/chunk-CXIQWPBH.js.map +1 -0
  21. package/dist/chunk-EDE36MKE.mjs +412 -0
  22. package/dist/chunk-EDE36MKE.mjs.map +1 -0
  23. package/dist/{chunk-M7P2TQ6X.js → chunk-EFREXNZB.js} +64 -64
  24. package/dist/{chunk-M7P2TQ6X.js.map → chunk-EFREXNZB.js.map} +1 -1
  25. package/dist/chunk-FAGDZEKM.js +23 -0
  26. package/dist/chunk-FAGDZEKM.js.map +1 -0
  27. package/dist/{chunk-TUEYBNWL.js → chunk-GV6WJCEB.js} +3 -3
  28. package/dist/{chunk-TUEYBNWL.js.map → chunk-GV6WJCEB.js.map} +1 -1
  29. package/dist/chunk-HU3EAHFO.mjs +20 -0
  30. package/dist/chunk-HU3EAHFO.mjs.map +1 -0
  31. package/dist/{chunk-LLFU42KC.mjs → chunk-I6WYV2AN.mjs} +3 -3
  32. package/dist/{chunk-LLFU42KC.mjs.map → chunk-I6WYV2AN.mjs.map} +1 -1
  33. package/dist/chunk-JJWFMKZY.js +132 -0
  34. package/dist/chunk-JJWFMKZY.js.map +1 -0
  35. package/dist/{chunk-JFWZHROG.js → chunk-L6FVIWAJ.js} +128 -128
  36. package/dist/{chunk-JFWZHROG.js.map → chunk-L6FVIWAJ.js.map} +1 -1
  37. package/dist/chunk-MNQEZL7B.mjs +210 -0
  38. package/dist/chunk-MNQEZL7B.mjs.map +1 -0
  39. package/dist/chunk-SGJ24J2Q.js +943 -0
  40. package/dist/chunk-SGJ24J2Q.js.map +1 -0
  41. package/dist/chunk-SW6TVAIJ.js +418 -0
  42. package/dist/chunk-SW6TVAIJ.js.map +1 -0
  43. package/dist/chunk-SYNVNTLJ.mjs +20 -0
  44. package/dist/chunk-SYNVNTLJ.mjs.map +1 -0
  45. package/dist/chunk-UQXVCVAN.mjs +41 -0
  46. package/dist/chunk-UQXVCVAN.mjs.map +1 -0
  47. package/dist/chunk-WGELLCOZ.js +22 -0
  48. package/dist/chunk-WGELLCOZ.js.map +1 -0
  49. package/dist/chunk-YXPHJ2BQ.js +541 -0
  50. package/dist/chunk-YXPHJ2BQ.js.map +1 -0
  51. package/dist/index.d.mts +3 -47
  52. package/dist/index.d.ts +3 -47
  53. package/dist/index.js +765 -765
  54. package/dist/index.mjs +2 -2
  55. package/dist/navigation-BiWVffAN.d.mts +49 -0
  56. package/dist/navigation-BiWVffAN.d.ts +49 -0
  57. package/dist/platform/agents-workspace.d.mts +19 -0
  58. package/dist/platform/agents-workspace.d.ts +19 -0
  59. package/dist/platform/agents-workspace.js +26 -0
  60. package/dist/platform/agents-workspace.js.map +1 -0
  61. package/dist/platform/agents-workspace.mjs +17 -0
  62. package/dist/platform/agents-workspace.mjs.map +1 -0
  63. package/dist/platform/app-shell.d.mts +58 -0
  64. package/dist/platform/app-shell.d.ts +58 -0
  65. package/dist/platform/app-shell.js +17 -0
  66. package/dist/platform/app-shell.js.map +1 -0
  67. package/dist/platform/app-shell.mjs +8 -0
  68. package/dist/platform/app-shell.mjs.map +1 -0
  69. package/dist/platform/index.d.mts +100 -3
  70. package/dist/platform/index.d.ts +100 -3
  71. package/dist/platform/index.js +499 -28
  72. package/dist/platform/index.js.map +1 -1
  73. package/dist/platform/index.mjs +472 -27
  74. package/dist/platform/index.mjs.map +1 -1
  75. package/dist/platform/pages/index.d.mts +243 -82
  76. package/dist/platform/pages/index.d.ts +243 -82
  77. package/dist/platform/pages/index.js +886 -614
  78. package/dist/platform/pages/index.js.map +1 -1
  79. package/dist/platform/pages/index.mjs +756 -511
  80. package/dist/platform/pages/index.mjs.map +1 -1
  81. package/dist/platform/utils/index.js +18 -56
  82. package/dist/platform/utils/index.js.map +1 -1
  83. package/dist/platform/utils/index.mjs +3 -53
  84. package/dist/platform/utils/index.mjs.map +1 -1
  85. package/dist/platform/workflow-api-client.d.mts +6 -0
  86. package/dist/platform/workflow-api-client.d.ts +6 -0
  87. package/dist/platform/workflow-api-client.js +246 -0
  88. package/dist/platform/workflow-api-client.js.map +1 -0
  89. package/dist/platform/workflow-api-client.mjs +5 -0
  90. package/dist/platform/workflow-api-client.mjs.map +1 -0
  91. package/dist/platform/workflow-canvas-shell.d.mts +18 -0
  92. package/dist/platform/workflow-canvas-shell.d.ts +18 -0
  93. package/dist/platform/workflow-canvas-shell.js +20 -0
  94. package/dist/platform/workflow-canvas-shell.js.map +1 -0
  95. package/dist/platform/workflow-canvas-shell.mjs +11 -0
  96. package/dist/platform/workflow-canvas-shell.mjs.map +1 -0
  97. package/dist/{rule-form-F5jBOeqk.d.mts → rule-form-BYJzyork.d.mts} +50 -1
  98. package/dist/{rule-form-F5jBOeqk.d.ts → rule-form-BYJzyork.d.ts} +50 -1
  99. package/dist/workflow-api-client-C8gPn_D1.d.mts +386 -0
  100. package/dist/workflow-api-client-Dy1Ph8W-.d.ts +386 -0
  101. package/package.json +21 -1
@@ -0,0 +1,943 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var chunkSW6TVAIJ_js = require('./chunk-SW6TVAIJ.js');
5
+ var chunkYXPHJ2BQ_js = require('./chunk-YXPHJ2BQ.js');
6
+ var chunkL6FVIWAJ_js = require('./chunk-L6FVIWAJ.js');
7
+ var chunk5UU3RQRB_js = require('./chunk-5UU3RQRB.js');
8
+ var chunkEFREXNZB_js = require('./chunk-EFREXNZB.js');
9
+ var chunkGV6WJCEB_js = require('./chunk-GV6WJCEB.js');
10
+ var chunkYXN2K77G_js = require('./chunk-YXN2K77G.js');
11
+ var react = require('react');
12
+ var reactRouter = require('react-router');
13
+ var outline = require('@heroicons/react/24/outline');
14
+ var jsxRuntime = require('react/jsx-runtime');
15
+
16
+ var WS_ENDPOINT = undefined.VITE_WS_ENDPOINT ?? "";
17
+ var useWebSocket = WS_ENDPOINT.length > 0;
18
+ function connectSSE(workflowId, runId, callbacks) {
19
+ let eventSource = null;
20
+ let cancelled = false;
21
+ chunkYXPHJ2BQ_js.buildAuthenticatedApiUrl(
22
+ `/workflows/${encodeURIComponent(workflowId)}/runs/${encodeURIComponent(runId)}/events`,
23
+ { includeAccessToken: true }
24
+ ).then((url) => {
25
+ if (cancelled) return;
26
+ eventSource = new EventSource(url);
27
+ eventSource.addEventListener("connected", () => callbacks.onConnected());
28
+ eventSource.addEventListener("execution", (messageEvent) => {
29
+ try {
30
+ callbacks.onEvent(JSON.parse(messageEvent.data));
31
+ } catch {
32
+ }
33
+ });
34
+ eventSource.addEventListener("done", (messageEvent) => {
35
+ try {
36
+ const data = JSON.parse(messageEvent.data);
37
+ callbacks.onDone(data.status === "run_completed" ? "completed" : "failed");
38
+ } catch {
39
+ callbacks.onDone("completed");
40
+ }
41
+ eventSource?.close();
42
+ });
43
+ eventSource.addEventListener("error", () => {
44
+ eventSource?.close();
45
+ callbacks.onError();
46
+ });
47
+ }).catch(() => callbacks.onError());
48
+ return () => {
49
+ cancelled = true;
50
+ eventSource?.close();
51
+ };
52
+ }
53
+ function connectWebSocket(_workflowId, runId, callbacks) {
54
+ const ws = new WebSocket(WS_ENDPOINT);
55
+ ws.addEventListener("open", () => {
56
+ ws.send(JSON.stringify({ action: "subscribe", runId }));
57
+ callbacks.onConnected();
58
+ });
59
+ ws.addEventListener("message", (messageEvent) => {
60
+ try {
61
+ const data = JSON.parse(messageEvent.data);
62
+ if (data.type === "run_completed" || data.type === "run_failed") {
63
+ callbacks.onDone(data.type === "run_completed" ? "completed" : "failed");
64
+ ws.send(JSON.stringify({ action: "unsubscribe", runId }));
65
+ ws.close();
66
+ return;
67
+ }
68
+ callbacks.onEvent(data);
69
+ } catch {
70
+ }
71
+ });
72
+ ws.addEventListener("error", () => {
73
+ callbacks.onError();
74
+ });
75
+ ws.addEventListener("close", () => {
76
+ });
77
+ return () => {
78
+ if (ws.readyState === WebSocket.OPEN) {
79
+ ws.send(JSON.stringify({ action: "unsubscribe", runId }));
80
+ }
81
+ ws.close();
82
+ };
83
+ }
84
+ function useRunEvents(workflowId, runId) {
85
+ const [events, setEvents] = react.useState([]);
86
+ const [status, setStatus] = react.useState("idle");
87
+ const [error, setError] = react.useState(null);
88
+ const cleanupRef = react.useRef(null);
89
+ const retriesRef = react.useRef(0);
90
+ const connect = react.useCallback(() => {
91
+ if (!workflowId || !runId) return;
92
+ const connectFn = useWebSocket ? connectWebSocket : connectSSE;
93
+ const callbacks = {
94
+ onConnected: () => {
95
+ setStatus("streaming");
96
+ setError(null);
97
+ retriesRef.current = 0;
98
+ },
99
+ onEvent: (event) => {
100
+ setEvents((prev) => [...prev, event]);
101
+ },
102
+ onDone: (terminalStatus) => {
103
+ setStatus(terminalStatus);
104
+ cleanupRef.current = null;
105
+ },
106
+ onError: () => {
107
+ cleanupRef.current = null;
108
+ if (retriesRef.current < 3) {
109
+ retriesRef.current++;
110
+ const delay = Math.min(1e3 * Math.pow(2, retriesRef.current - 1), 5e3);
111
+ setTimeout(connect, delay);
112
+ } else {
113
+ setStatus("error");
114
+ setError("Connection lost after 3 retries");
115
+ }
116
+ }
117
+ };
118
+ cleanupRef.current = connectFn(workflowId, runId, callbacks);
119
+ }, [workflowId, runId]);
120
+ react.useEffect(() => {
121
+ if (!workflowId || !runId) return;
122
+ setEvents([]);
123
+ setStatus("streaming");
124
+ setError(null);
125
+ retriesRef.current = 0;
126
+ connect();
127
+ return () => {
128
+ if (cleanupRef.current) {
129
+ cleanupRef.current();
130
+ cleanupRef.current = null;
131
+ }
132
+ };
133
+ }, [workflowId, runId, connect]);
134
+ return {
135
+ events,
136
+ isStreaming: status === "streaming",
137
+ status,
138
+ error
139
+ };
140
+ }
141
+ function resetWorkflowRunPresentation(actions) {
142
+ actions.clearNodeResults();
143
+ actions.setIsRunning(false);
144
+ }
145
+ function applyWorkflowExecutionEventToStore(actions, event) {
146
+ switch (event.type) {
147
+ case "run_started":
148
+ actions.clearNodeResults();
149
+ actions.setIsRunning(true);
150
+ return;
151
+ case "node_started":
152
+ if (!event.nodeId) return;
153
+ actions.setNodeResult(event.nodeId, {
154
+ status: "running",
155
+ durationMs: event.durationMs
156
+ });
157
+ return;
158
+ case "node_completed":
159
+ if (!event.nodeId) return;
160
+ actions.setNodeResult(event.nodeId, {
161
+ status: "success",
162
+ data: event.outputs,
163
+ durationMs: event.durationMs
164
+ });
165
+ return;
166
+ case "node_error":
167
+ if (!event.nodeId) return;
168
+ actions.setNodeResult(event.nodeId, {
169
+ status: "error",
170
+ error: event.error,
171
+ durationMs: event.durationMs
172
+ });
173
+ return;
174
+ case "run_completed":
175
+ case "run_failed":
176
+ actions.setIsRunning(false);
177
+ return;
178
+ default:
179
+ return;
180
+ }
181
+ }
182
+ function useWorkflowRunPresentation(events, status) {
183
+ const clearNodeResults = chunkEFREXNZB_js.useWorkflowStore((state) => state.clearNodeResults);
184
+ const setIsRunning = chunkEFREXNZB_js.useWorkflowStore((state) => state.setIsRunning);
185
+ const setNodeResult = chunkEFREXNZB_js.useWorkflowStore((state) => state.setNodeResult);
186
+ react.useEffect(() => {
187
+ if (status === "idle") {
188
+ resetWorkflowRunPresentation({ clearNodeResults, setIsRunning, setNodeResult });
189
+ return;
190
+ }
191
+ clearNodeResults();
192
+ for (const event of events) {
193
+ applyWorkflowExecutionEventToStore({ clearNodeResults, setIsRunning, setNodeResult }, event);
194
+ }
195
+ if (status === "completed" || status === "failed" || status === "error") {
196
+ setIsRunning(false);
197
+ } else if (status === "streaming") {
198
+ setIsRunning(true);
199
+ }
200
+ }, [clearNodeResults, events, setIsRunning, setNodeResult, status]);
201
+ }
202
+
203
+ // src/hooks/use-workflow-execution.ts
204
+ function useWorkflowExecution(workflowId) {
205
+ const [activeRunId, setActiveRunId] = react.useState(null);
206
+ const [isLaunching, setIsLaunching] = react.useState(false);
207
+ const stream = useRunEvents(workflowId || null, activeRunId);
208
+ const clearNodeResults = chunkEFREXNZB_js.useWorkflowStore((state) => state.clearNodeResults);
209
+ const setIsRunning = chunkEFREXNZB_js.useWorkflowStore((state) => state.setIsRunning);
210
+ const setNodeResult = chunkEFREXNZB_js.useWorkflowStore((state) => state.setNodeResult);
211
+ useWorkflowRunPresentation(stream.events, activeRunId ? stream.status : "idle");
212
+ react.useEffect(() => {
213
+ if (stream.status === "completed" || stream.status === "failed" || stream.status === "error") {
214
+ setIsLaunching(false);
215
+ }
216
+ }, [stream.status]);
217
+ const run = react.useCallback(async (inputVariables) => {
218
+ if (!workflowId) return;
219
+ setIsLaunching(true);
220
+ try {
221
+ const runRecord = await chunkYXPHJ2BQ_js.executeWorkflow(workflowId, inputVariables);
222
+ setActiveRunId(runRecord.id);
223
+ } finally {
224
+ setIsLaunching(false);
225
+ }
226
+ }, [workflowId]);
227
+ const stop = react.useCallback(() => {
228
+ setActiveRunId(null);
229
+ setIsLaunching(false);
230
+ resetWorkflowRunPresentation({ clearNodeResults, setIsRunning, setNodeResult });
231
+ }, [clearNodeResults, setIsRunning, setNodeResult]);
232
+ react.useEffect(() => {
233
+ setActiveRunId(null);
234
+ setIsLaunching(false);
235
+ resetWorkflowRunPresentation({ clearNodeResults, setIsRunning, setNodeResult });
236
+ }, [clearNodeResults, setIsRunning, setNodeResult, workflowId]);
237
+ return {
238
+ isRunning: isLaunching || stream.status === "streaming",
239
+ execute: run,
240
+ stop,
241
+ runId: activeRunId,
242
+ runStatus: activeRunId ? stream.status : "idle"
243
+ };
244
+ }
245
+ function getPublishableKey() {
246
+ return undefined.VITE_WORKFLOW_BUILDER_PUBLISHABLE_KEY ?? "";
247
+ }
248
+ function useDatasourceLabels() {
249
+ const t = chunkYXN2K77G_js.useTranslations("platform.datasources");
250
+ return react.useMemo(() => {
251
+ const keys = [
252
+ "title",
253
+ "subtitle",
254
+ "addDatasource",
255
+ "createTitle",
256
+ "emptyTitle",
257
+ "emptyDescription",
258
+ "stepSelectType",
259
+ "stepConfigure",
260
+ "categoryRelational",
261
+ "categoryNoSql",
262
+ "categoryWarehouse",
263
+ "categoryTimeSeries",
264
+ "categoryGraph",
265
+ "categoryKeyValue",
266
+ "categorySearch",
267
+ "fieldName",
268
+ "fieldNamePlaceholder",
269
+ "fieldHost",
270
+ "fieldHostPlaceholder",
271
+ "fieldPort",
272
+ "fieldDatabase",
273
+ "fieldDatabasePlaceholder",
274
+ "fieldUsername",
275
+ "fieldUsernamePlaceholder",
276
+ "fieldPassword",
277
+ "fieldPasswordPlaceholder",
278
+ "fieldSchema",
279
+ "fieldSchemaPlaceholder",
280
+ "fieldSsl",
281
+ "fieldReadOnly",
282
+ "fieldReadOnlyHelp",
283
+ "fieldConnectionString",
284
+ "fieldConnectionStringPlaceholder",
285
+ "fieldProjectId",
286
+ "fieldProjectIdPlaceholder",
287
+ "fieldDataset",
288
+ "fieldDatasetPlaceholder",
289
+ "fieldKeyFile",
290
+ "fieldKeyFilePlaceholder",
291
+ "fieldAccount",
292
+ "fieldAccountPlaceholder",
293
+ "fieldWarehouse",
294
+ "fieldWarehousePlaceholder",
295
+ "fieldRegion",
296
+ "fieldRegionPlaceholder",
297
+ "fieldBucket",
298
+ "fieldBucketPlaceholder",
299
+ "fieldToken",
300
+ "fieldTokenPlaceholder",
301
+ "fieldApiKey",
302
+ "fieldApiKeyPlaceholder",
303
+ "fieldEnvironment",
304
+ "fieldEnvironmentPlaceholder",
305
+ "fieldIndex",
306
+ "fieldIndexPlaceholder",
307
+ "fieldUrl",
308
+ "fieldUrlPlaceholder",
309
+ "testConnection",
310
+ "testing",
311
+ "connectionSuccess",
312
+ "connectionFailed",
313
+ "save",
314
+ "saving",
315
+ "cancel",
316
+ "back",
317
+ "enabled",
318
+ "disabled",
319
+ "dialect",
320
+ "created",
321
+ "deleted",
322
+ "deleteConfirm"
323
+ ];
324
+ const labels = {};
325
+ for (const key of keys) labels[key] = t(key);
326
+ return labels;
327
+ }, [t]);
328
+ }
329
+ function AgentsWorkspace({ workflowId, messages }) {
330
+ const navigate = reactRouter.useNavigate();
331
+ const locale = chunkYXN2K77G_js.useLocale();
332
+ const tWorkflow = chunkYXN2K77G_js.useTranslations("agents.workflow");
333
+ const tCommon = chunkYXN2K77G_js.useTranslations("common");
334
+ const datasourceLabels = useDatasourceLabels();
335
+ const { error: notifyError, success: notifySuccess } = chunkGV6WJCEB_js.useNotifications();
336
+ const showSuccess = react.useCallback((title, message) => {
337
+ notifySuccess(title, message);
338
+ }, [notifySuccess]);
339
+ const showError = react.useCallback((title, message) => {
340
+ notifyError(title, message);
341
+ if (message) {
342
+ console.error("[AgentsWorkspace]", message);
343
+ }
344
+ }, []);
345
+ const [isLoading, setIsLoading] = react.useState(true);
346
+ const [loadError, setLoadError] = react.useState(null);
347
+ const [isLoadingWorkflows, setIsLoadingWorkflows] = react.useState(true);
348
+ const [isPublishing, setIsPublishing] = react.useState(false);
349
+ const [workflows, setWorkflows] = react.useState([]);
350
+ const [workflow, setWorkflow] = react.useState(null);
351
+ const [agents, setAgents] = react.useState([]);
352
+ const [models, setModels] = react.useState([]);
353
+ const [tools, setTools] = react.useState([]);
354
+ const [agentToolDefs, setAgentToolDefs] = react.useState([]);
355
+ const [rules, setRules] = react.useState([]);
356
+ const [datasources, setDatasources] = react.useState([]);
357
+ const [modelConnections, setModelConnections] = react.useState([]);
358
+ const [showDatasourceModal, setShowDatasourceModal] = react.useState(false);
359
+ const openPipelineSettingsModal = chunkEFREXNZB_js.useModalStore((s) => s.openPipelineSettingsModal);
360
+ const [showRunInputDialog, setShowRunInputDialog] = react.useState(false);
361
+ const [showPreviewPanel, setShowPreviewPanel] = react.useState(false);
362
+ const [isCreatingAgent, setIsCreatingAgent] = react.useState(false);
363
+ const openSubworkflowModal = chunkL6FVIWAJ_js.useSubworkflowStore((s) => s.openModal);
364
+ const closeSubworkflowModal = chunkL6FVIWAJ_js.useSubworkflowStore((s) => s.closeModal);
365
+ const [deleteTarget, setDeleteTarget] = react.useState(null);
366
+ const [saveStatus, setSaveStatus] = react.useState("idle");
367
+ const latestGraphRef = react.useRef(null);
368
+ const saveTimerRef = react.useRef(null);
369
+ const skipInitialAutoSaveRef = react.useRef(true);
370
+ const showRunPanel = chunkEFREXNZB_js.useWorkflowStore((state) => state.showRunPanel);
371
+ const toggleRunPanel = chunkEFREXNZB_js.useWorkflowStore((state) => state.toggleRunPanel);
372
+ const workflowNodes = chunkEFREXNZB_js.useWorkflowStore((state) => state.nodes);
373
+ const { execute: executeWorkflowRun, stop: stopWorkflowRun, isRunning } = useWorkflowExecution(workflowId);
374
+ const loadWorkspaceData = react.useCallback(async () => {
375
+ setIsLoading(true);
376
+ setLoadError(null);
377
+ try {
378
+ const [workflowData, agentList, modelList, agentToolDefList, ruleList, datasourceList, connectionList] = await Promise.all([
379
+ chunkYXPHJ2BQ_js.getWorkflowById(workflowId),
380
+ chunkYXPHJ2BQ_js.getAgentConfigsWithPrompts(),
381
+ chunkYXPHJ2BQ_js.getAgentModels(),
382
+ chunkYXPHJ2BQ_js.getAgentToolDefinitions().catch(() => []),
383
+ chunkYXPHJ2BQ_js.getAgentRules(),
384
+ chunkYXPHJ2BQ_js.getDatasources().catch(() => []),
385
+ chunkYXPHJ2BQ_js.listModelProviderConnections().catch(() => [])
386
+ ]);
387
+ const toolResults = await Promise.all(
388
+ agentList.map((agent) => chunkYXPHJ2BQ_js.getAgentTools(agent.agentId).catch(() => []))
389
+ );
390
+ const toolList = toolResults.flat();
391
+ setWorkflow(workflowData);
392
+ latestGraphRef.current = workflowData.graph;
393
+ setAgents(agentList);
394
+ setModels(modelList);
395
+ setTools(toolList);
396
+ setAgentToolDefs(agentToolDefList);
397
+ setRules(ruleList);
398
+ setDatasources(datasourceList);
399
+ setModelConnections(connectionList);
400
+ } catch (error) {
401
+ const message = error instanceof Error ? error.message : tCommon("loadWorkspaceFailed");
402
+ setWorkflow(null);
403
+ setAgents([]);
404
+ setModels([]);
405
+ setTools([]);
406
+ setAgentToolDefs([]);
407
+ setRules([]);
408
+ setDatasources([]);
409
+ setModelConnections([]);
410
+ setLoadError(message);
411
+ notifyError(tCommon("serverError"), message);
412
+ } finally {
413
+ setIsLoading(false);
414
+ }
415
+ }, [workflowId]);
416
+ const loadWorkflowList = react.useCallback(async () => {
417
+ setIsLoadingWorkflows(true);
418
+ try {
419
+ const list = await chunkYXPHJ2BQ_js.getWorkflows();
420
+ setWorkflows(list);
421
+ } catch {
422
+ setWorkflows([]);
423
+ } finally {
424
+ setIsLoadingWorkflows(false);
425
+ }
426
+ }, []);
427
+ react.useEffect(() => {
428
+ void loadWorkspaceData();
429
+ }, [loadWorkspaceData]);
430
+ react.useEffect(() => {
431
+ void loadWorkflowList();
432
+ }, [loadWorkflowList]);
433
+ react.useEffect(() => {
434
+ skipInitialAutoSaveRef.current = true;
435
+ }, [workflowId]);
436
+ react.useEffect(() => {
437
+ return () => {
438
+ if (saveTimerRef.current) {
439
+ clearTimeout(saveTimerRef.current);
440
+ }
441
+ };
442
+ }, []);
443
+ const handleAutoSaveGraph = react.useCallback((graph) => {
444
+ latestGraphRef.current = graph;
445
+ if (isLoading || skipInitialAutoSaveRef.current) {
446
+ skipInitialAutoSaveRef.current = false;
447
+ return;
448
+ }
449
+ if (saveTimerRef.current) {
450
+ clearTimeout(saveTimerRef.current);
451
+ }
452
+ setSaveStatus("saving");
453
+ saveTimerRef.current = setTimeout(() => {
454
+ void chunkYXPHJ2BQ_js.saveWorkflowDraft(workflowId, graph).then((updatedWorkflow) => {
455
+ setWorkflow(updatedWorkflow);
456
+ setWorkflows((current) => current.map((item) => item.id === updatedWorkflow.id ? updatedWorkflow : item));
457
+ setSaveStatus("saved");
458
+ setTimeout(() => setSaveStatus("idle"), 900);
459
+ }).catch(() => {
460
+ setSaveStatus("idle");
461
+ });
462
+ }, 800);
463
+ }, [workflowId]);
464
+ const handlePublish = react.useCallback(async () => {
465
+ if (!latestGraphRef.current) return;
466
+ const validation = chunk5UU3RQRB_js.validateWorkflowGraph(latestGraphRef.current, { locale });
467
+ if (!validation.valid) {
468
+ showError(tWorkflow("validationError"), validation.errors[0] ?? tWorkflow("validation"));
469
+ return;
470
+ }
471
+ setIsPublishing(true);
472
+ try {
473
+ const published = await chunkYXPHJ2BQ_js.publishWorkflow(workflowId);
474
+ setWorkflow(published);
475
+ setWorkflows((current) => current.map((item) => item.id === published.id ? published : item));
476
+ } finally {
477
+ setIsPublishing(false);
478
+ }
479
+ }, [locale, showError, tWorkflow, workflowId]);
480
+ const handleSelectWorkflow = react.useCallback((selected) => {
481
+ if (selected.id === workflowId) return;
482
+ navigate(`/workflows/edit?workflowId=${encodeURIComponent(selected.id)}`);
483
+ }, [navigate, workflowId]);
484
+ const handleCreateWorkflow = react.useCallback(async () => {
485
+ const created = await chunkYXPHJ2BQ_js.createWorkflow({
486
+ name: tWorkflow("defaultWorkflowName")
487
+ });
488
+ navigate(`/workflows/edit?workflowId=${encodeURIComponent(created.id)}`);
489
+ }, [navigate, tWorkflow]);
490
+ const handleDeleteWorkflow = react.useCallback((id, name) => {
491
+ setDeleteTarget({ id, name });
492
+ }, []);
493
+ const confirmDelete = react.useCallback(async () => {
494
+ if (!deleteTarget) return;
495
+ await chunkYXPHJ2BQ_js.deleteWorkflow(deleteTarget.id);
496
+ const remaining = workflows.filter((item) => item.id !== deleteTarget.id);
497
+ if (remaining.length > 0) {
498
+ navigate(`/workflows/edit?workflowId=${encodeURIComponent(remaining[0].id)}`);
499
+ } else {
500
+ navigate("/workflows");
501
+ }
502
+ setDeleteTarget(null);
503
+ }, [deleteTarget, workflows, navigate]);
504
+ const handleOpenRunDialog = react.useCallback(() => {
505
+ const startNode = workflowNodes.find((node) => node.type === "start");
506
+ const hasEndNode = workflowNodes.some((node) => node.type === "end");
507
+ const hasValidStartConfig = Boolean(
508
+ startNode && typeof startNode.data === "object" && startNode.data !== null && "config" in startNode.data && startNode.data.config && startNode.data.config.type === "start"
509
+ );
510
+ if (!hasValidStartConfig) {
511
+ showError(tWorkflow("validationError"), tWorkflow("startNodeRequired"));
512
+ return;
513
+ }
514
+ if (!hasEndNode) {
515
+ showError(tWorkflow("validationError"), tWorkflow("endNodeRequired"));
516
+ return;
517
+ }
518
+ setShowRunInputDialog(true);
519
+ }, [workflowNodes, showError, tWorkflow]);
520
+ const handleCreateAgent = react.useCallback(() => {
521
+ setIsCreatingAgent(true);
522
+ }, []);
523
+ const handleCancelCreateAgent = react.useCallback(() => {
524
+ setIsCreatingAgent(false);
525
+ }, []);
526
+ const handleAgentSaved = react.useCallback(async () => {
527
+ const nextAgents = await chunkYXPHJ2BQ_js.getAgentConfigsWithPrompts();
528
+ setAgents(nextAgents);
529
+ setIsCreatingAgent(false);
530
+ }, []);
531
+ const handleToggleTool = react.useCallback(async (tool) => {
532
+ try {
533
+ const updated = await chunkYXPHJ2BQ_js.updateAgentTool(tool.toolId, { enabled: !tool.enabled });
534
+ setTools((current) => current.map((item) => item.toolId === tool.toolId ? updated : item));
535
+ showSuccess(
536
+ tWorkflow("toolsSection"),
537
+ updated.enabled ? tWorkflow("published") : tWorkflow("draftBadge")
538
+ );
539
+ } catch (error) {
540
+ showError(
541
+ tWorkflow("validationError"),
542
+ error instanceof Error ? error.message : tWorkflow("publishError")
543
+ );
544
+ }
545
+ }, [showError, showSuccess, tWorkflow]);
546
+ const handleToggleRule = react.useCallback(async (rule) => {
547
+ try {
548
+ const updated = await chunkYXPHJ2BQ_js.updateAgentRule(rule.ruleId, { ...rule, enabled: !rule.enabled });
549
+ setRules((current) => current.map((item) => item.ruleId === rule.ruleId ? updated : item));
550
+ showSuccess(
551
+ tWorkflow("rulesSection"),
552
+ updated.enabled ? tWorkflow("published") : tWorkflow("draftBadge")
553
+ );
554
+ } catch (error) {
555
+ showError(
556
+ tWorkflow("validationError"),
557
+ error instanceof Error ? error.message : tWorkflow("publishError")
558
+ );
559
+ }
560
+ }, [showError, showSuccess, tWorkflow]);
561
+ const handleCreateTool = react.useCallback(() => {
562
+ openSubworkflowModal({ toolId: "", name: "", category: "external", enabled: true });
563
+ }, [openSubworkflowModal]);
564
+ const handleCreateRule = react.useCallback(() => {
565
+ }, []);
566
+ const handleCreateAgentTool = react.useCallback(() => {
567
+ }, []);
568
+ const handleConvertToSubworkflow = react.useCallback((workflow2) => {
569
+ openSubworkflowModal({
570
+ toolId: "",
571
+ name: workflow2.name,
572
+ description: workflow2.description ?? "",
573
+ category: "external",
574
+ enabled: true,
575
+ config: { type: "workflow", graph: workflow2.graph }
576
+ });
577
+ }, [openSubworkflowModal]);
578
+ const handleEditTool = react.useCallback((tool) => {
579
+ openSubworkflowModal(tool);
580
+ }, [openSubworkflowModal]);
581
+ const handleCreateDatasource = react.useCallback(() => {
582
+ setShowDatasourceModal(true);
583
+ }, []);
584
+ const handleSaveDatasource = react.useCallback(async (data) => {
585
+ try {
586
+ const created = await chunkYXPHJ2BQ_js.createDatasource(data);
587
+ setDatasources((current) => [...current, created]);
588
+ showSuccess(tWorkflow("dataSourcesSection"), tCommon("created") ?? "Created");
589
+ } catch (error) {
590
+ showError(
591
+ tWorkflow("dataSourcesSection"),
592
+ error instanceof Error ? error.message : tCommon("createDatasourceFailed")
593
+ );
594
+ }
595
+ }, [showSuccess, showError, tWorkflow, tCommon]);
596
+ const datasourceEntities = react.useMemo(
597
+ () => datasources.map((ds) => ({
598
+ id: ds.id,
599
+ label: ds.name ?? ds.id,
600
+ description: ds.dialect ?? "",
601
+ defaultLimit: 100,
602
+ fields: []
603
+ })),
604
+ [datasources]
605
+ );
606
+ const datasourceDefinitions = react.useMemo(
607
+ () => datasources.map((ds) => ({
608
+ id: ds.id,
609
+ name: ds.name ?? ds.id,
610
+ dialect: ds.dialect ?? "postgres"
611
+ })),
612
+ [datasources]
613
+ );
614
+ const paletteModelProviders = react.useMemo(() => {
615
+ const toPaletteKey = (slug) => {
616
+ switch (slug) {
617
+ case "anthropic_api":
618
+ return "anthropic";
619
+ case "openai_api":
620
+ return "openai";
621
+ case "aws_bedrock":
622
+ return "amazon";
623
+ case "google_vertex":
624
+ return "google";
625
+ default:
626
+ return slug ?? "custom";
627
+ }
628
+ };
629
+ return modelConnections.map((connection) => ({
630
+ id: connection.id,
631
+ name: connection.name,
632
+ provider: toPaletteKey(connection.providerSlug),
633
+ modelCount: connection.modelFilter?.length ?? 1,
634
+ configured: connection.enabled
635
+ }));
636
+ }, [modelConnections]);
637
+ if (isLoading) {
638
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-[calc(100vh-120px)] flex-col", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liquid-surface flex h-full flex-col overflow-hidden rounded-2xl", children: [
639
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-shrink-0 items-center justify-between px-5 py-3", children: [
640
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shimmer h-6 w-40 rounded-lg" }),
641
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shimmer h-8 w-24 rounded-lg" })
642
+ ] }),
643
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liquid-divider border-t" }),
644
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
645
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-56 border-r border-white/20 p-4 dark:border-white/10", children: [
646
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shimmer mb-3 h-5 w-24 rounded" }),
647
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: [1, 2, 3].map((index) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shimmer h-10 w-full rounded-lg" }, index)) })
648
+ ] }),
649
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shimmer h-8 w-48 rounded-lg" }) })
650
+ ] })
651
+ ] }) });
652
+ }
653
+ if (!workflow) {
654
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-[calc(100vh-120px)] items-center justify-center", children: loadError ? /* @__PURE__ */ jsxRuntime.jsx(
655
+ chunkGV6WJCEB_js.PageErrorState,
656
+ {
657
+ statusCode: 500,
658
+ title: tCommon("serverError"),
659
+ message: loadError,
660
+ onRetry: () => {
661
+ void loadWorkspaceData();
662
+ },
663
+ retryLabel: tCommon("retry")
664
+ }
665
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
666
+ chunkGV6WJCEB_js.PageEmptyState,
667
+ {
668
+ title: tWorkflow("emptyTitle"),
669
+ message: tWorkflow("emptyDescription"),
670
+ iconName: "cpu-chip"
671
+ }
672
+ ) });
673
+ }
674
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkEFREXNZB_js.WorkflowBuilderProvider, { publishableKey: getPublishableKey(), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-[calc(100vh-120px)] flex-col", "data-testid": "agents-workspace", children: [
675
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liquid-surface flex h-full flex-col overflow-hidden rounded-2xl", children: [
676
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-shrink-0 items-center justify-between px-5 py-3", children: [
677
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
678
+ /* @__PURE__ */ jsxRuntime.jsx(
679
+ "button",
680
+ {
681
+ type: "button",
682
+ onClick: () => openPipelineSettingsModal(
683
+ workflow.name,
684
+ workflow.description ?? "",
685
+ {
686
+ slug: workflow.slug ?? null,
687
+ isDraft: workflow.isDraft,
688
+ isActive: workflow.isActive
689
+ }
690
+ ),
691
+ className: "rounded-lg px-2.5 py-1 text-sm font-semibold text-gray-900 transition-colors hover:bg-gray-100/80 dark:text-white dark:hover:bg-white/10",
692
+ title: tWorkflow("editName"),
693
+ children: workflow.name || tWorkflow("title")
694
+ }
695
+ ),
696
+ /* @__PURE__ */ jsxRuntime.jsx(chunkGV6WJCEB_js.CopyableId, { id: workflowId, className: "text-[10px]" }),
697
+ workflow.isDraft ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center rounded-full bg-amber-100 px-2.5 py-0.5 text-[10px] font-semibold text-amber-800 dark:bg-amber-900/30 dark:text-amber-300", children: tWorkflow("draftBadge") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center rounded-full bg-green-100 px-2.5 py-0.5 text-[10px] font-semibold text-green-800 dark:bg-green-900/30 dark:text-green-300", children: tWorkflow("published") }),
698
+ /* @__PURE__ */ jsxRuntime.jsx(chunkL6FVIWAJ_js.SaveStatusBadge, { status: saveStatus })
699
+ ] }),
700
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
701
+ /* @__PURE__ */ jsxRuntime.jsx(
702
+ chunkGV6WJCEB_js.Button,
703
+ {
704
+ size: "xs",
705
+ plain: true,
706
+ onClick: () => setShowPreviewPanel((previous) => !previous),
707
+ title: tWorkflow("previewPanel.title"),
708
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChartBarIcon, { className: "h-3.5 w-3.5", "data-slot": "icon" })
709
+ }
710
+ ),
711
+ isRunning ? /* @__PURE__ */ jsxRuntime.jsxs(chunkGV6WJCEB_js.Button, { size: "xs", outline: true, onClick: stopWorkflowRun, children: [
712
+ /* @__PURE__ */ jsxRuntime.jsx(outline.StopIcon, { className: "h-3.5 w-3.5", "data-slot": "icon" }),
713
+ tWorkflow("runPanel.stop")
714
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
715
+ chunkGV6WJCEB_js.Button,
716
+ {
717
+ size: "xs",
718
+ outline: true,
719
+ onClick: handleOpenRunDialog,
720
+ disabled: !workflow.publishedGraph && !latestGraphRef.current,
721
+ title: !workflow.publishedGraph && !latestGraphRef.current ? tWorkflow("noPublishedWorkflow") : void 0,
722
+ children: [
723
+ /* @__PURE__ */ jsxRuntime.jsx(outline.PlayIcon, { className: "h-3.5 w-3.5", "data-slot": "icon" }),
724
+ tWorkflow("runPanel.run")
725
+ ]
726
+ }
727
+ ),
728
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkGV6WJCEB_js.Button, { gradient: true, size: "xs", onClick: () => {
729
+ void handlePublish();
730
+ }, disabled: isPublishing, children: [
731
+ /* @__PURE__ */ jsxRuntime.jsx(outline.DocumentCheckIcon, { className: "h-3.5 w-3.5", "data-slot": "icon" }),
732
+ tWorkflow("publish")
733
+ ] })
734
+ ] })
735
+ ] }),
736
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liquid-divider border-t" }),
737
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
738
+ chunkL6FVIWAJ_js.WorkflowListBar,
739
+ {
740
+ workflows,
741
+ activeWorkflowId: workflowId,
742
+ isLoading: isLoadingWorkflows,
743
+ onSelect: handleSelectWorkflow,
744
+ onCreate: () => {
745
+ void handleCreateWorkflow();
746
+ },
747
+ onDelete: handleDeleteWorkflow,
748
+ onConvertToSubworkflow: handleConvertToSubworkflow
749
+ }
750
+ ) }),
751
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "liquid-divider border-t" }),
752
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [
753
+ /* @__PURE__ */ jsxRuntime.jsx(
754
+ chunkL6FVIWAJ_js.NodePalette,
755
+ {
756
+ agents,
757
+ tools,
758
+ agentTools: agentToolDefs,
759
+ rules,
760
+ entities: datasourceEntities,
761
+ modelProviders: paletteModelProviders,
762
+ onCreateAgent: handleCreateAgent,
763
+ onCreateTool: () => {
764
+ void handleCreateTool();
765
+ },
766
+ onCreateAgentTool: () => {
767
+ void handleCreateAgentTool();
768
+ },
769
+ onCreateRule: () => {
770
+ void handleCreateRule();
771
+ },
772
+ onCreateDatasource: handleCreateDatasource
773
+ }
774
+ ),
775
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
776
+ chunkL6FVIWAJ_js.AutoSaveWorkspace,
777
+ {
778
+ workflowId,
779
+ className: "h-full w-full",
780
+ locale,
781
+ ...messages ? { messages } : {},
782
+ initialGraph: workflow.graph,
783
+ agents,
784
+ models,
785
+ tools,
786
+ agentTools: agentToolDefs,
787
+ rules,
788
+ datasources: datasourceDefinitions,
789
+ onLoadTables: chunkYXPHJ2BQ_js.getDatasourceTables,
790
+ onLoadSchema: chunkYXPHJ2BQ_js.getDatasourceSchema,
791
+ onEditTool: handleEditTool,
792
+ onToggleTool: handleToggleTool,
793
+ onToggleRule: handleToggleRule,
794
+ onAgentSaved: () => {
795
+ void handleAgentSaved();
796
+ },
797
+ isCreatingAgent,
798
+ onCancelCreateAgent: handleCancelCreateAgent,
799
+ onAutoSaveGraph: handleAutoSaveGraph,
800
+ onGraphSnapshot: (graph) => {
801
+ latestGraphRef.current = graph;
802
+ },
803
+ renderAgentModal: (props) => /* @__PURE__ */ jsxRuntime.jsx(
804
+ chunkL6FVIWAJ_js.AgentModal,
805
+ {
806
+ ...props,
807
+ onSaved: () => {
808
+ props.onSaved();
809
+ void handleAgentSaved();
810
+ },
811
+ onPersist: async (payload) => {
812
+ const body = {
813
+ name: payload.name,
814
+ displayName: payload.displayName,
815
+ description: payload.description,
816
+ avatar: payload.avatar,
817
+ modelId: payload.modelId,
818
+ modelProviderId: payload.connectionId,
819
+ framework: payload.framework,
820
+ systemPrompt: payload.systemPrompt,
821
+ instruction: payload.systemPrompt,
822
+ temperature: payload.temperature,
823
+ maxOutputTokens: payload.maxOutputTokens,
824
+ maxTokens: payload.maxOutputTokens,
825
+ topP: payload.topP,
826
+ topK: payload.topK,
827
+ elo: payload.elo,
828
+ status: payload.status,
829
+ tags: payload.tags,
830
+ agentToolIds: payload.enabledToolIds
831
+ };
832
+ if (payload.agentId) {
833
+ await chunkYXPHJ2BQ_js.updateAgentConfig(payload.agentId, body);
834
+ } else {
835
+ await chunkYXPHJ2BQ_js.createAgentConfig(body);
836
+ }
837
+ }
838
+ }
839
+ )
840
+ }
841
+ ) })
842
+ ] })
843
+ ] }),
844
+ /* @__PURE__ */ jsxRuntime.jsx(
845
+ chunkL6FVIWAJ_js.PipelineSettingsModal,
846
+ {
847
+ onSave: async (changes) => {
848
+ const metadata = {
849
+ name: changes.name,
850
+ description: changes.description
851
+ };
852
+ if (changes.slug !== void 0) metadata.slug = changes.slug;
853
+ if (changes.isDraft !== void 0) metadata.isDraft = changes.isDraft;
854
+ if (changes.isActive !== void 0) metadata.isActive = changes.isActive;
855
+ const updated = latestGraphRef.current ? await chunkYXPHJ2BQ_js.saveWorkflowDraft(workflowId, latestGraphRef.current, metadata) : await chunkYXPHJ2BQ_js.updateWorkflowSettings(workflowId, metadata);
856
+ setWorkflow(updated);
857
+ setWorkflows((current) => current.map((item) => item.id === updated.id ? updated : item));
858
+ }
859
+ }
860
+ ),
861
+ /* @__PURE__ */ jsxRuntime.jsx(
862
+ chunkL6FVIWAJ_js.SubworkflowModal,
863
+ {
864
+ onMaximize: (subworkflowId) => {
865
+ closeSubworkflowModal();
866
+ navigate(`/workflows/edit?workflowId=${encodeURIComponent(subworkflowId)}`);
867
+ },
868
+ onSaved: async (saved) => {
869
+ const isNew = !saved.toolId;
870
+ if (isNew) {
871
+ const created = await chunkYXPHJ2BQ_js.createWorkflow({
872
+ name: saved.name,
873
+ description: saved.description
874
+ });
875
+ closeSubworkflowModal();
876
+ navigate(`/workflows/edit?workflowId=${encodeURIComponent(created.id)}`);
877
+ } else {
878
+ const updated = await chunkYXPHJ2BQ_js.updateAgentTool(saved.toolId, saved);
879
+ setTools((current) => current.map((item) => item.toolId === saved.toolId ? updated : item));
880
+ closeSubworkflowModal();
881
+ }
882
+ }
883
+ }
884
+ ),
885
+ /* @__PURE__ */ jsxRuntime.jsx(
886
+ chunkL6FVIWAJ_js.RunPanel,
887
+ {
888
+ open: showRunPanel,
889
+ onClose: toggleRunPanel,
890
+ onRun: handleOpenRunDialog,
891
+ onStop: stopWorkflowRun
892
+ }
893
+ ),
894
+ /* @__PURE__ */ jsxRuntime.jsx(
895
+ chunkL6FVIWAJ_js.RunInputDialog,
896
+ {
897
+ open: showRunInputDialog,
898
+ onClose: () => setShowRunInputDialog(false),
899
+ onRun: (inputVariables) => {
900
+ void executeWorkflowRun(inputVariables);
901
+ if (!showRunPanel) {
902
+ toggleRunPanel();
903
+ }
904
+ }
905
+ }
906
+ ),
907
+ /* @__PURE__ */ jsxRuntime.jsx(
908
+ chunkL6FVIWAJ_js.PreviewPanel,
909
+ {
910
+ open: showPreviewPanel,
911
+ onClose: () => setShowPreviewPanel(false),
912
+ workflowId,
913
+ loadRuns: chunkYXPHJ2BQ_js.getWorkflowRuns
914
+ }
915
+ ),
916
+ /* @__PURE__ */ jsxRuntime.jsx(
917
+ chunkSW6TVAIJ_js.DatasourceFormModal,
918
+ {
919
+ open: showDatasourceModal,
920
+ onClose: () => setShowDatasourceModal(false),
921
+ labels: datasourceLabels,
922
+ onSave: (data) => {
923
+ void handleSaveDatasource(data);
924
+ }
925
+ }
926
+ ),
927
+ /* @__PURE__ */ jsxRuntime.jsx(
928
+ chunkGV6WJCEB_js.DynamicIslandConfirm,
929
+ {
930
+ open: deleteTarget !== null,
931
+ onClose: () => setDeleteTarget(null),
932
+ onConfirm: () => {
933
+ void confirmDelete();
934
+ },
935
+ title: `${tWorkflow("deleteWorkflowConfirm")} ${deleteTarget?.name ?? ""}?`
936
+ }
937
+ )
938
+ ] }) });
939
+ }
940
+
941
+ exports.AgentsWorkspace = AgentsWorkspace;
942
+ //# sourceMappingURL=chunk-SGJ24J2Q.js.map
943
+ //# sourceMappingURL=chunk-SGJ24J2Q.js.map