@burdenoff/fluidgrids-fe-sdk 2026.1104.3 → 2026.1105.2

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 (69) hide show
  1. package/README.md +38 -0
  2. package/dist/ExecutionDetailPage-HQB2SWBP.js +28 -0
  3. package/dist/ExecutionsListPage-RSLL634L.js +22 -0
  4. package/dist/WorkflowBuilder-E3PNZX74.js +32 -0
  5. package/dist/WorkflowsList-473FRRP2.js +21 -0
  6. package/dist/{agentTools-SZZN6TP3.js → agentTools-5N3ZEZDW.js} +8 -7
  7. package/dist/{chunk-NIY6R42C.js → chunk-2KUZBEWW.js} +7 -5
  8. package/dist/{chunk-NTWG3CJX.js → chunk-3IXU7WUC.js} +32 -21
  9. package/dist/{chunk-AAIZ6S6E.js → chunk-3QCRKKTI.js} +70 -88
  10. package/dist/{chunk-WTV6SQYK.js → chunk-3XUWPDKJ.js} +616 -25
  11. package/dist/{chunk-XCSCD3IU.js → chunk-5CFCFA6O.js} +8 -7
  12. package/dist/{chunk-DFIX6YWP.js → chunk-62CCBMDC.js} +40 -21
  13. package/dist/{chunk-KHXRYQYP.js → chunk-64JN2TVX.js} +4 -3
  14. package/dist/{chunk-NYBL5WHP.js → chunk-6IS7EXIY.js} +3 -3
  15. package/dist/{chunk-YYVRBROH.js → chunk-6ZK4MRVA.js} +1 -1
  16. package/dist/{chunk-4YCMMBSK.js → chunk-AJVU5YW6.js} +3 -3
  17. package/dist/{chunk-NGXJHYV5.js → chunk-AMXJLVZN.js} +2 -2
  18. package/dist/{chunk-PXIFUMLA.js → chunk-AU7LACOY.js} +16 -11
  19. package/dist/{chunk-GEY7RXRZ.js → chunk-CH3YUGWR.js} +4 -4
  20. package/dist/{chunk-XNU2PLJ2.js → chunk-CNKTQ5MG.js} +189 -9
  21. package/dist/{chunk-BIB7IH26.js → chunk-EYQ7GJRW.js} +5 -5
  22. package/dist/{chunk-X6PIU7FE.js → chunk-GKFMK7FF.js} +4 -3
  23. package/dist/{chunk-NJRCAE6K.js → chunk-HK76ZUAK.js} +5 -5
  24. package/dist/{chunk-F7LQL43U.js → chunk-IL343FKX.js} +2 -2
  25. package/dist/{chunk-5D4XS3WJ.js → chunk-J3YQCEP3.js} +18 -4
  26. package/dist/{chunk-4EUEKSEQ.js → chunk-L2N6DDOI.js} +2 -2
  27. package/dist/chunk-NZAYYUQ4.js +172 -0
  28. package/dist/{chunk-ON7LK6QH.js → chunk-O7CJJNW6.js} +278 -197
  29. package/dist/{chunk-ZDCJPQ5M.js → chunk-OXXXUAWM.js} +2 -2
  30. package/dist/{chunk-D4WA2M2N.js → chunk-QFC6E3WD.js} +4 -3
  31. package/dist/{chunk-AFX3EKFN.js → chunk-QFGZXWTM.js} +16 -4
  32. package/dist/{chunk-IK7IGG6T.js → chunk-QPLFALVV.js} +9 -8
  33. package/dist/{chunk-MF7JLSJX.js → chunk-SALZ3LQB.js} +11 -2
  34. package/dist/{chunk-SS7Y66P5.js → chunk-TCIBTMJI.js} +70 -4
  35. package/dist/{chunk-OMB3WMDQ.js → chunk-TNFBRXU7.js} +11 -10
  36. package/dist/chunk-UEG2WC3G.js +502 -0
  37. package/dist/chunk-US5QSLPV.js +316 -0
  38. package/dist/{chunk-5UHAB75U.js → chunk-W5WML3OO.js} +1 -1
  39. package/dist/chunk-WZ3EJVS6.js +93 -0
  40. package/dist/{chunk-Q72EOY4T.js → chunk-X25NCWG2.js} +9 -3
  41. package/dist/{chunk-VDJFTZ2H.js → chunk-XFH6SLDK.js} +4 -93
  42. package/dist/{chunk-TBHAZK52.js → chunk-Y6M7K4UG.js} +1 -1
  43. package/dist/{chunk-AVHBWJRY.js → chunk-Z3ABLERJ.js} +3 -1
  44. package/dist/client-YVZMLEQX.js +3 -0
  45. package/dist/config-66FUPSG5.js +1 -0
  46. package/dist/executions.js +18 -15
  47. package/dist/global-client-N5EIFW6T.js +3 -0
  48. package/dist/history.js +9 -8
  49. package/dist/index.d.ts +172 -133
  50. package/dist/index.js +95 -74
  51. package/dist/{node-detail-view-GAGSLHAO.js → node-detail-view-WIWW5N6N.js} +36 -11
  52. package/dist/nodes.js +5 -3
  53. package/dist/observability.js +10 -8
  54. package/dist/{quick-config-panel-44RBX6YR.js → quick-config-panel-O64TXXK3.js} +10 -8
  55. package/dist/settings.js +11 -9
  56. package/dist/templates.js +15 -14
  57. package/dist/{workflow-builder-BMGVSwpy.d.ts → workflow-builder-7vv9dCdp.d.ts} +413 -2
  58. package/dist/workflow-builder.d.ts +2 -1
  59. package/dist/workflow-builder.js +17 -16
  60. package/dist/workflows-list.js +11 -10
  61. package/package.json +1 -1
  62. package/dist/ExecutionDetailPage-ND2VMU45.js +0 -25
  63. package/dist/ExecutionsListPage-EZ65FXER.js +0 -20
  64. package/dist/WorkflowBuilder-4I44FWII.js +0 -31
  65. package/dist/WorkflowsList-YFD2RKKQ.js +0 -20
  66. package/dist/chunk-6AMNEX2Y.js +0 -214
  67. package/dist/client-EYQDMR4O.js +0 -1
  68. package/dist/config-3DBXLCK3.js +0 -1
  69. package/dist/global-client-O2HCG5CJ.js +0 -1
@@ -0,0 +1,316 @@
1
+ import { getFluidGridsTokenRevision, config, setFluidGridsConfig } from './chunk-UEG2WC3G.js';
2
+ import { CombinedGraphQLErrors, ServerError } from '@apollo/client/errors';
3
+ import { ApolloLink, Observable } from '@apollo/client/core';
4
+
5
+ // src/graphql/live-tokens.ts
6
+ function createLiveTokenReader(initial) {
7
+ const createdAt = getFluidGridsTokenRevision();
8
+ return () => {
9
+ if (getFluidGridsTokenRevision() === createdAt) return initial;
10
+ return {
11
+ authToken: config.authToken ?? initial.authToken,
12
+ workspaceToken: config.workspaceToken ?? initial.workspaceToken
13
+ };
14
+ };
15
+ }
16
+ function describeGraphQLError(error) {
17
+ const code = typeof error.extensions?.code === "string" ? error.extensions.code : void 0;
18
+ switch (code) {
19
+ case "QUOTA_EXHAUSTED": {
20
+ const quota = /Quota exhausted for (\S+)/.exec(error.message)?.[1];
21
+ const allowance = quota ? `"${quota}" quota` : "usage quota";
22
+ return `Quota exhausted \u2014 your workspace has used up its ${allowance}. Upgrade your plan or wait for the quota to reset.`;
23
+ }
24
+ case "QUOTA_NOT_PROVISIONED":
25
+ return "This workspace's plan does not include this usage allowance yet. Contact your workspace admin or support to have it provisioned.";
26
+ case "UNAUTHENTICATED":
27
+ return "Your session has expired. Please sign in again.";
28
+ case "FORBIDDEN":
29
+ return error.message || "You don't have permission to perform this action.";
30
+ default:
31
+ return error.message || "Unknown error";
32
+ }
33
+ }
34
+ function firstGraphQLErrorInBody(bodyText) {
35
+ try {
36
+ const parsed = JSON.parse(bodyText);
37
+ if (typeof parsed !== "object" || parsed === null) return null;
38
+ const errors = parsed.errors;
39
+ if (!Array.isArray(errors) || errors.length === 0) return null;
40
+ const first = errors[0];
41
+ if (typeof first !== "object" || first === null) return null;
42
+ const message = first.message;
43
+ if (typeof message !== "string") return null;
44
+ return first;
45
+ } catch {
46
+ return null;
47
+ }
48
+ }
49
+ function describeOperationError(error, fallback = "Unknown error") {
50
+ if (CombinedGraphQLErrors.is(error)) {
51
+ const first = error.errors[0];
52
+ return first ? describeGraphQLError(first) : error.message || fallback;
53
+ }
54
+ if (ServerError.is(error)) {
55
+ const first = firstGraphQLErrorInBody(error.bodyText);
56
+ if (first) return describeGraphQLError(first);
57
+ }
58
+ if (error instanceof Error) {
59
+ return error.message || fallback;
60
+ }
61
+ if (typeof error === "string" && error.length > 0) {
62
+ return error;
63
+ }
64
+ return fallback;
65
+ }
66
+ function throwIfResultError(result) {
67
+ if (result.error) {
68
+ throw new Error(describeOperationError(result.error), {
69
+ cause: result.error
70
+ });
71
+ }
72
+ return result;
73
+ }
74
+ function hasForbiddenCode(errors) {
75
+ return (errors ?? []).some((error) => error.extensions?.code === "FORBIDDEN");
76
+ }
77
+ function isForbiddenError(error) {
78
+ if (CombinedGraphQLErrors.is(error)) {
79
+ return hasForbiddenCode(error.errors);
80
+ }
81
+ if (ServerError.is(error)) {
82
+ if (error.statusCode === 403) return true;
83
+ const first = firstGraphQLErrorInBody(error.bodyText);
84
+ return first ? hasForbiddenCode([first]) : false;
85
+ }
86
+ if (error instanceof Error && error.cause !== void 0) {
87
+ return isForbiddenError(error.cause);
88
+ }
89
+ return false;
90
+ }
91
+ var REFRESHABLE_AUTH_FAILURES = /* @__PURE__ */ new Set([
92
+ "CREDENTIAL_EXPIRED",
93
+ "CREDENTIAL_REVOKED"
94
+ ]);
95
+ var EXPIRED_TOKEN_MESSAGE = /\b(?:jwt|token)\b[^.]{0,40}\bexpired\b|\bexpired\b[^.]{0,20}\b(?:jwt|token)\b/i;
96
+ function isUnauthenticatedGraphQLError(error) {
97
+ const code = error.extensions?.code;
98
+ if (code === "UNAUTHENTICATED") return true;
99
+ const authFailure = error.extensions?.authFailure;
100
+ if (typeof authFailure === "string" && REFRESHABLE_AUTH_FAILURES.has(authFailure)) {
101
+ return true;
102
+ }
103
+ return typeof error.message === "string" && EXPIRED_TOKEN_MESSAGE.test(error.message);
104
+ }
105
+ function hasUnauthenticatedGraphQLError(errors) {
106
+ return (errors ?? []).some(isUnauthenticatedGraphQLError);
107
+ }
108
+ function isUnauthenticatedError(error) {
109
+ if (CombinedGraphQLErrors.is(error)) {
110
+ return hasUnauthenticatedGraphQLError(error.errors);
111
+ }
112
+ if (ServerError.is(error)) {
113
+ if (error.statusCode === 401) return true;
114
+ const first = firstGraphQLErrorInBody(error.bodyText);
115
+ return first ? isUnauthenticatedGraphQLError(first) : false;
116
+ }
117
+ if (error instanceof Error && error.cause !== void 0) {
118
+ return isUnauthenticatedError(error.cause);
119
+ }
120
+ return false;
121
+ }
122
+ function operationErrorCode(error) {
123
+ const codeOf = (graphQLError) => {
124
+ const code = graphQLError?.extensions?.code;
125
+ return typeof code === "string" ? code : void 0;
126
+ };
127
+ if (CombinedGraphQLErrors.is(error)) return codeOf(error.errors[0]);
128
+ if (ServerError.is(error)) {
129
+ return codeOf(firstGraphQLErrorInBody(error.bodyText) ?? void 0);
130
+ }
131
+ if (error instanceof Error && error.cause !== void 0) {
132
+ return operationErrorCode(error.cause);
133
+ }
134
+ return void 0;
135
+ }
136
+
137
+ // src/events/eventBus.ts
138
+ var FLUIDGRIDS_EVENTS_VERSION = "1.0.0";
139
+ var FLUIDGRIDS_EVENT_NAMES = [
140
+ "workflow:saved",
141
+ "workflow:activated",
142
+ "run:started",
143
+ "run:completed",
144
+ "node:selected",
145
+ "error",
146
+ "auth:failed"
147
+ ];
148
+ function withoutUndefined(payload) {
149
+ return Object.fromEntries(
150
+ Object.entries(payload).filter(([, value]) => value !== void 0)
151
+ );
152
+ }
153
+ function emitFluidGridsEvent(name, payload) {
154
+ let handler;
155
+ try {
156
+ handler = config.onEvent;
157
+ } catch {
158
+ return;
159
+ }
160
+ if (typeof handler !== "function") return;
161
+ try {
162
+ const args = [name, withoutUndefined(payload)];
163
+ handler(...args);
164
+ } catch (error) {
165
+ console.warn(`[FluidGrids SDK] onEvent handler failed for ${name}`, error);
166
+ }
167
+ }
168
+ function emitOperationErrorEvent(source, error) {
169
+ emitFluidGridsEvent("error", {
170
+ source,
171
+ message: describeOperationError(error),
172
+ code: operationErrorCode(error)
173
+ });
174
+ }
175
+ var MAX_COMPLETED_RUNS = 500;
176
+ var completedRuns = /* @__PURE__ */ new Set();
177
+ function emitRunCompletedOnce(payload) {
178
+ if (!payload.runId || completedRuns.has(payload.runId)) return;
179
+ completedRuns.add(payload.runId);
180
+ if (completedRuns.size > MAX_COMPLETED_RUNS) {
181
+ const oldest = completedRuns.values().next().value;
182
+ if (oldest !== void 0) completedRuns.delete(oldest);
183
+ }
184
+ emitFluidGridsEvent("run:completed", payload);
185
+ }
186
+ var inFlight = null;
187
+ var refreshGeneration = 0;
188
+ var lastRefreshed = null;
189
+ function normalizeTokens(value) {
190
+ if (typeof value === "string") {
191
+ return value.trim() ? { authToken: value } : null;
192
+ }
193
+ if (!value || typeof value !== "object") return null;
194
+ const tokens = {};
195
+ if (typeof value.authToken === "string" && value.authToken.trim()) {
196
+ tokens.authToken = value.authToken;
197
+ }
198
+ if (typeof value.workspaceToken === "string" && value.workspaceToken.trim()) {
199
+ tokens.workspaceToken = value.workspaceToken;
200
+ }
201
+ return tokens.authToken || tokens.workspaceToken ? tokens : null;
202
+ }
203
+ function storeInConfig(tokens) {
204
+ setFluidGridsConfig(tokens);
205
+ }
206
+ function refreshTokens(callback, store) {
207
+ if (inFlight) return inFlight;
208
+ const run = (async () => {
209
+ try {
210
+ const tokens = normalizeTokens(await callback());
211
+ if (!tokens) {
212
+ emitFluidGridsEvent("auth:failed", {
213
+ message: "onTokenExpired returned no token."
214
+ });
215
+ return null;
216
+ }
217
+ store(tokens);
218
+ refreshGeneration += 1;
219
+ lastRefreshed = tokens;
220
+ return tokens;
221
+ } catch (error) {
222
+ emitFluidGridsEvent("auth:failed", {
223
+ message: describeOperationError(error, "Token refresh failed.")
224
+ });
225
+ return null;
226
+ }
227
+ })();
228
+ inFlight = run;
229
+ void run.finally(() => {
230
+ if (inFlight === run) inFlight = null;
231
+ });
232
+ return run;
233
+ }
234
+ function withTokenHeaders(headers, tokens) {
235
+ return {
236
+ ...headers,
237
+ ...tokens.authToken && { authorization: `Bearer ${tokens.authToken}` },
238
+ ...tokens.workspaceToken && {
239
+ "x-workspace-authorization": `Bearer ${tokens.workspaceToken}`
240
+ }
241
+ };
242
+ }
243
+ function resultIsUnauthenticated(result) {
244
+ return hasUnauthenticatedGraphQLError(result.errors);
245
+ }
246
+ function createFluidGridsTokenRefreshLink(options = {}) {
247
+ return new ApolloLink((operation, forward) => {
248
+ const store = options.onTokenRefreshed ?? storeInConfig;
249
+ return new Observable((observer) => {
250
+ const sentInGeneration = refreshGeneration;
251
+ let retried = false;
252
+ let closed = false;
253
+ let current = null;
254
+ const retryOrFail = (fail) => {
255
+ const callback = options.onTokenExpired ?? config.auth?.onTokenExpired;
256
+ if (!callback) return false;
257
+ retried = true;
258
+ current?.unsubscribe();
259
+ current = null;
260
+ const refreshed = refreshGeneration !== sentInGeneration && lastRefreshed ? Promise.resolve(lastRefreshed) : refreshTokens(callback, store);
261
+ void refreshed.then((tokens) => {
262
+ if (closed) return;
263
+ if (!tokens) {
264
+ fail();
265
+ return;
266
+ }
267
+ const context = operation.getContext();
268
+ const headers = context.headers;
269
+ operation.setContext({
270
+ headers: withTokenHeaders(
271
+ headers && typeof headers === "object" ? (
272
+ // Apollo keeps request headers as a plain string map.
273
+ headers
274
+ ) : void 0,
275
+ tokens
276
+ )
277
+ });
278
+ subscribe();
279
+ });
280
+ return true;
281
+ };
282
+ const subscribe = () => {
283
+ let refreshing = false;
284
+ current = forward(operation).subscribe({
285
+ next: (result) => {
286
+ if (!retried && resultIsUnauthenticated(result) && retryOrFail(() => {
287
+ observer.next(result);
288
+ observer.complete();
289
+ })) {
290
+ refreshing = true;
291
+ return;
292
+ }
293
+ observer.next(result);
294
+ },
295
+ error: (error) => {
296
+ if (!retried && isUnauthenticatedError(error) && retryOrFail(() => observer.error(error))) {
297
+ refreshing = true;
298
+ return;
299
+ }
300
+ observer.error(error);
301
+ },
302
+ complete: () => {
303
+ if (!refreshing) observer.complete();
304
+ }
305
+ });
306
+ };
307
+ subscribe();
308
+ return () => {
309
+ closed = true;
310
+ current?.unsubscribe();
311
+ };
312
+ });
313
+ });
314
+ }
315
+
316
+ export { FLUIDGRIDS_EVENTS_VERSION, FLUIDGRIDS_EVENT_NAMES, createFluidGridsTokenRefreshLink, createLiveTokenReader, describeOperationError, emitFluidGridsEvent, emitOperationErrorEvent, emitRunCompletedOnce, isForbiddenError, isUnauthenticatedError, throwIfResultError };
@@ -1,4 +1,4 @@
1
- import { resolveInputHandles } from './chunk-AAIZ6S6E.js';
1
+ import { resolveInputHandles } from './chunk-3QCRKKTI.js';
2
2
 
3
3
  // src/builder/hooks/attach-node-helpers.ts
4
4
  var ATTACH_GAP_X = 120;
@@ -0,0 +1,93 @@
1
+ // src/modules/agent-definitions/utils/agent-form.ts
2
+ var DEFAULT_GRANT_DAYS = 30;
3
+ var MAX_GRANT_DAYS = 365;
4
+ var MAX_TOOL_RULES = 100;
5
+ var MAX_CONNECTIONS = 100;
6
+ var AgentFormError = class extends Error {
7
+ constructor(message) {
8
+ super(message);
9
+ this.name = "AgentFormError";
10
+ }
11
+ };
12
+ function emptyAgentForm() {
13
+ return {
14
+ name: "",
15
+ description: "",
16
+ tools: [{ nodeType: "", operations: "" }],
17
+ connectionScope: [],
18
+ requireToolApproval: false,
19
+ status: "ACTIVE"
20
+ };
21
+ }
22
+ function agentToForm(agent) {
23
+ return {
24
+ name: agent.name,
25
+ description: agent.description ?? "",
26
+ tools: agent.toolAllowlist.length > 0 ? agent.toolAllowlist.map((rule) => ({
27
+ nodeType: rule.nodeType,
28
+ operations: rule.operations.join(", ")
29
+ })) : [{ nodeType: "", operations: "" }],
30
+ connectionScope: [...agent.connectionScope],
31
+ requireToolApproval: agent.requireToolApproval,
32
+ status: agent.status
33
+ };
34
+ }
35
+ function splitOperations(value) {
36
+ return [
37
+ ...new Set(
38
+ value.split(",").map((operation) => operation.trim()).filter(Boolean)
39
+ )
40
+ ];
41
+ }
42
+ function formToInput(form) {
43
+ const name = form.name.trim();
44
+ if (name.length === 0 || name.length > 200) {
45
+ throw new AgentFormError("Give the agent a name of 1 to 200 characters.");
46
+ }
47
+ const description = form.description.trim();
48
+ if (description.length > 2e3) {
49
+ throw new AgentFormError(
50
+ "The description must be at most 2000 characters."
51
+ );
52
+ }
53
+ const rules = form.tools.map((row) => ({
54
+ nodeType: row.nodeType.trim(),
55
+ operations: splitOperations(row.operations)
56
+ })).filter((rule) => rule.nodeType.length > 0 || rule.operations.length > 0);
57
+ if (rules.some((rule) => rule.nodeType.length === 0)) {
58
+ throw new AgentFormError("Every tool rule needs a node type.");
59
+ }
60
+ if (rules.length > MAX_TOOL_RULES) {
61
+ throw new AgentFormError(`At most ${MAX_TOOL_RULES} tool rules.`);
62
+ }
63
+ const connectionScope = [...new Set(form.connectionScope.filter(Boolean))];
64
+ if (connectionScope.length > MAX_CONNECTIONS) {
65
+ throw new AgentFormError(`At most ${MAX_CONNECTIONS} connections.`);
66
+ }
67
+ return {
68
+ name,
69
+ description: description || null,
70
+ toolAllowlist: rules,
71
+ connectionScope,
72
+ requireToolApproval: form.requireToolApproval,
73
+ status: form.status
74
+ };
75
+ }
76
+ function grantDays(value) {
77
+ const days = Number(value);
78
+ if (!Number.isInteger(days) || days < 1 || days > MAX_GRANT_DAYS) {
79
+ throw new AgentFormError(
80
+ `A grant lasts between 1 and ${MAX_GRANT_DAYS} days.`
81
+ );
82
+ }
83
+ return days;
84
+ }
85
+ function describeRule(rule) {
86
+ return rule.operations.length > 0 ? `${rule.nodeType}: ${rule.operations.join(", ")}` : `${rule.nodeType}: any operation`;
87
+ }
88
+ function isAgentNodeType(nodeType) {
89
+ if (!nodeType) return false;
90
+ return nodeType === "store/ai-agent" || nodeType.includes("store/ai-agent");
91
+ }
92
+
93
+ export { AgentFormError, DEFAULT_GRANT_DAYS, MAX_GRANT_DAYS, agentToForm, describeRule, emptyAgentForm, formToInput, grantDays, isAgentNodeType };
@@ -1,8 +1,8 @@
1
- import { Card, FluidGridsMark } from './chunk-DFIX6YWP.js';
1
+ import { Card, FluidGridsMark } from './chunk-62CCBMDC.js';
2
2
  import { Input } from './chunk-IEVSFCFS.js';
3
3
  import { Button } from './chunk-BQXVT32O.js';
4
- import { useWorkflowDefinition } from './chunk-AFX3EKFN.js';
5
- import { FluidGridsProvider, useFlowStore } from './chunk-AAIZ6S6E.js';
4
+ import { useWorkflowDefinition } from './chunk-QFGZXWTM.js';
5
+ import { FluidGridsProvider, useFlowStore } from './chunk-3QCRKKTI.js';
6
6
  import { cn } from './chunk-JL7CASN5.js';
7
7
  import { useTr } from './chunk-UULVIT25.js';
8
8
  import { useState, useRef, useEffect, useCallback } from 'react';
@@ -494,6 +494,9 @@ function WorkflowBuilder({
494
494
  organizationId,
495
495
  workspaceClient,
496
496
  globalClient,
497
+ theme,
498
+ auth,
499
+ onEvent,
497
500
  ...coreProps
498
501
  }) {
499
502
  const workflow = initialWorkflow || createDefaultWorkflow(workflowId, workflowVersion);
@@ -511,6 +514,9 @@ function WorkflowBuilder({
511
514
  organizationId,
512
515
  workspaceClient,
513
516
  globalClient,
517
+ theme,
518
+ auth,
519
+ onEvent,
514
520
  children: /* @__PURE__ */ jsx(WorkflowBuilderCore, { workflow, ...coreProps })
515
521
  }
516
522
  );
@@ -1,5 +1,7 @@
1
- import { useAgentDefinitions, useAgentDefinitionList, useConnections, describeOperationError } from './chunk-AAIZ6S6E.js';
1
+ import { emptyAgentForm, agentToForm, describeRule, formToInput, AgentFormError, DEFAULT_GRANT_DAYS, MAX_GRANT_DAYS, grantDays } from './chunk-WZ3EJVS6.js';
2
+ import { useAgentDefinitions, useAgentDefinitionList, useConnections } from './chunk-3QCRKKTI.js';
2
3
  import { useTr } from './chunk-UULVIT25.js';
4
+ import { describeOperationError } from './chunk-US5QSLPV.js';
3
5
  import { useState, useCallback, useEffect } from 'react';
4
6
  import { Icon } from '@iconify/react';
5
7
  import { Button } from '@burdenoff/fe-libs/button';
@@ -7,97 +9,6 @@ import { Badge, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, L
7
9
  import { toast } from 'sonner';
8
10
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
9
11
 
10
- // src/modules/agent-definitions/utils/agent-form.ts
11
- var DEFAULT_GRANT_DAYS = 30;
12
- var MAX_GRANT_DAYS = 365;
13
- var MAX_TOOL_RULES = 100;
14
- var MAX_CONNECTIONS = 100;
15
- var AgentFormError = class extends Error {
16
- constructor(message) {
17
- super(message);
18
- this.name = "AgentFormError";
19
- }
20
- };
21
- function emptyAgentForm() {
22
- return {
23
- name: "",
24
- description: "",
25
- tools: [{ nodeType: "", operations: "" }],
26
- connectionScope: [],
27
- requireToolApproval: false,
28
- status: "ACTIVE"
29
- };
30
- }
31
- function agentToForm(agent) {
32
- return {
33
- name: agent.name,
34
- description: agent.description ?? "",
35
- tools: agent.toolAllowlist.length > 0 ? agent.toolAllowlist.map((rule) => ({
36
- nodeType: rule.nodeType,
37
- operations: rule.operations.join(", ")
38
- })) : [{ nodeType: "", operations: "" }],
39
- connectionScope: [...agent.connectionScope],
40
- requireToolApproval: agent.requireToolApproval,
41
- status: agent.status
42
- };
43
- }
44
- function splitOperations(value) {
45
- return [
46
- ...new Set(
47
- value.split(",").map((operation) => operation.trim()).filter(Boolean)
48
- )
49
- ];
50
- }
51
- function formToInput(form) {
52
- const name = form.name.trim();
53
- if (name.length === 0 || name.length > 200) {
54
- throw new AgentFormError("Give the agent a name of 1 to 200 characters.");
55
- }
56
- const description = form.description.trim();
57
- if (description.length > 2e3) {
58
- throw new AgentFormError(
59
- "The description must be at most 2000 characters."
60
- );
61
- }
62
- const rules = form.tools.map((row) => ({
63
- nodeType: row.nodeType.trim(),
64
- operations: splitOperations(row.operations)
65
- })).filter((rule) => rule.nodeType.length > 0 || rule.operations.length > 0);
66
- if (rules.some((rule) => rule.nodeType.length === 0)) {
67
- throw new AgentFormError("Every tool rule needs a node type.");
68
- }
69
- if (rules.length > MAX_TOOL_RULES) {
70
- throw new AgentFormError(`At most ${MAX_TOOL_RULES} tool rules.`);
71
- }
72
- const connectionScope = [...new Set(form.connectionScope.filter(Boolean))];
73
- if (connectionScope.length > MAX_CONNECTIONS) {
74
- throw new AgentFormError(`At most ${MAX_CONNECTIONS} connections.`);
75
- }
76
- return {
77
- name,
78
- description: description || null,
79
- toolAllowlist: rules,
80
- connectionScope,
81
- requireToolApproval: form.requireToolApproval,
82
- status: form.status
83
- };
84
- }
85
- function grantDays(value) {
86
- const days = Number(value);
87
- if (!Number.isInteger(days) || days < 1 || days > MAX_GRANT_DAYS) {
88
- throw new AgentFormError(
89
- `A grant lasts between 1 and ${MAX_GRANT_DAYS} days.`
90
- );
91
- }
92
- return days;
93
- }
94
- function describeRule(rule) {
95
- return rule.operations.length > 0 ? `${rule.nodeType}: ${rule.operations.join(", ")}` : `${rule.nodeType}: any operation`;
96
- }
97
- function isAgentNodeType(nodeType) {
98
- if (!nodeType) return false;
99
- return nodeType === "store/ai-agent" || nodeType.includes("store/ai-agent");
100
- }
101
12
  function errorMessage(err) {
102
13
  if (err instanceof AgentFormError) return err.message;
103
14
  return describeOperationError(err);
@@ -587,4 +498,4 @@ function AgentDefinitionSelectField({
587
498
  );
588
499
  }
589
500
 
590
- export { AgentDefinitionSelectField, AgentsTab, isAgentNodeType };
501
+ export { AgentDefinitionSelectField, AgentsTab };
@@ -1,4 +1,4 @@
1
- import { QuotaExhaustedDialog } from './chunk-X6PIU7FE.js';
1
+ import { QuotaExhaustedDialog } from './chunk-GKFMK7FF.js';
2
2
  import { useTr } from './chunk-UULVIT25.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4