@burdenoff/fluidgrids-fe-sdk 2026.1105.1 → 2026.1105.3

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 (60) hide show
  1. package/README.md +30 -0
  2. package/dist/ExecutionDetailPage-JXGPSLS3.js +30 -0
  3. package/dist/{WorkflowsList-EV725VG5.js → ExecutionsListPage-U3TC5JUI.js} +11 -8
  4. package/dist/{WorkflowBuilder-CRR5WP4V.js → WorkflowBuilder-6DOD6WWH.js} +16 -13
  5. package/dist/{ExecutionsListPage-NQIQXMTY.js → WorkflowsList-XOWRQNST.js} +10 -8
  6. package/dist/{agentTools-PN4W7QZH.js → agentTools-YQBN33WG.js} +7 -5
  7. package/dist/{chunk-VFVN7D3A.js → chunk-22U3TUKZ.js} +3 -93
  8. package/dist/{chunk-XLI75E3D.js → chunk-2WUVF4EQ.js} +2 -2
  9. package/dist/{chunk-GVIYGJQG.js → chunk-3MZOYJ5I.js} +1 -1
  10. package/dist/{chunk-L44BRLW5.js → chunk-3ZYRLGDF.js} +612 -22
  11. package/dist/{chunk-FCT6POFX.js → chunk-4NNF7DIB.js} +1 -1
  12. package/dist/chunk-5DVP2UYH.js +1924 -0
  13. package/dist/{chunk-JDQYGH4Q.js → chunk-EKDUYCTS.js} +4 -4
  14. package/dist/{chunk-6P7DOBVN.js → chunk-EYQ7GJRW.js} +2 -2
  15. package/dist/{chunk-HLAUK5GM.js → chunk-FVWRGL7S.js} +1 -1
  16. package/dist/{chunk-AZKVI4YN.js → chunk-G33OMSW6.js} +8 -6
  17. package/dist/{chunk-D7G5VWSH.js → chunk-G774FI2E.js} +2 -2
  18. package/dist/{chunk-DANOMJ5I.js → chunk-IJ7UIDCW.js} +7 -6
  19. package/dist/{chunk-EC2AN74G.js → chunk-IL343FKX.js} +1 -1
  20. package/dist/chunk-JYYN3CLL.js +32 -0
  21. package/dist/{chunk-O2EB7UT2.js → chunk-KAWRHIJZ.js} +2 -2
  22. package/dist/{chunk-JC4D7RQ6.js → chunk-KN37RIFC.js} +5 -4
  23. package/dist/{chunk-AASHQI77.js → chunk-KZCNJAMK.js} +2 -1
  24. package/dist/{chunk-BHAKNT5M.js → chunk-LDWBMCX4.js} +4 -3
  25. package/dist/{chunk-MSQAULLG.js → chunk-MA6I4KY5.js} +186 -7
  26. package/dist/{chunk-R3Z7W4EX.js → chunk-MP44TAOO.js} +276 -196
  27. package/dist/{chunk-FJSXXO5W.js → chunk-MY7SEUXM.js} +1 -1
  28. package/dist/{chunk-I3QPAEL6.js → chunk-NMQENSPW.js} +15 -14
  29. package/dist/chunk-NZAYYUQ4.js +172 -0
  30. package/dist/{chunk-6EZJ5J3B.js → chunk-NZFPCTIS.js} +4 -4
  31. package/dist/{chunk-MZFJL4X3.js → chunk-OXXXUAWM.js} +1 -1
  32. package/dist/chunk-SDZEAIIE.js +9 -0
  33. package/dist/{chunk-CGR3AEZU.js → chunk-TCIBTMJI.js} +68 -2
  34. package/dist/{chunk-4QB6S7YW.js → chunk-TJAG2DQT.js} +9 -38
  35. package/dist/{chunk-MQN6YDX4.js → chunk-TLHX4DK4.js} +7 -6
  36. package/dist/{chunk-AG3VC7Y2.js → chunk-VESQH55Q.js} +2 -2
  37. package/dist/chunk-WZ3EJVS6.js +93 -0
  38. package/dist/{chunk-OCJTTHTS.js → chunk-Y7FKJJMF.js} +1 -9
  39. package/dist/{chunk-HOTVUVZG.js → chunk-YGOGJDN4.js} +2 -2
  40. package/dist/{chunk-AVHBWJRY.js → chunk-Z3ABLERJ.js} +3 -1
  41. package/dist/{chunk-C26QAWCT.js → chunk-ZBPRNWKY.js} +235 -2146
  42. package/dist/{chunk-2QOAJF7V.js → chunk-ZLBTUCC2.js} +4 -3
  43. package/dist/code-editor-field-WWPDMF4O.js +3 -0
  44. package/dist/executions.js +16 -12
  45. package/dist/history.js +9 -6
  46. package/dist/index.d.ts +77 -1
  47. package/dist/index.js +46 -41
  48. package/dist/{node-detail-view-3VG7XFIZ.js → node-detail-view-U5HOP2WX.js} +35 -9
  49. package/dist/nodes.js +2 -2
  50. package/dist/observability.js +9 -6
  51. package/dist/{quick-config-panel-GB7SDWHD.js → quick-config-panel-XAISBW6Y.js} +10 -7
  52. package/dist/settings.js +9 -6
  53. package/dist/templates.js +15 -12
  54. package/dist/workflow-builder.js +17 -14
  55. package/dist/workflow-preview.d.ts +158 -0
  56. package/dist/workflow-preview.js +721 -0
  57. package/dist/workflows-list.js +10 -8
  58. package/package.json +5 -1
  59. package/dist/ExecutionDetailPage-YBAMVPMB.js +0 -26
  60. package/dist/code-editor-field-XWUVOKTA.js +0 -2
@@ -0,0 +1,172 @@
1
+ // src/modules/observability/optimisation.ts
2
+ var DEFAULT_WINDOW_DAYS = 30;
3
+ var DISMISS_REASONS = [
4
+ "NOT_APPLICABLE" /* NotApplicable */,
5
+ "ACCEPTED_COST" /* AcceptedCost */,
6
+ "WILL_FIX_LATER" /* WillFixLater */,
7
+ "OTHER" /* Other */
8
+ ];
9
+ var MAX_DISMISS_NOTE_LENGTH = 500;
10
+ function isRecord(value) {
11
+ return typeof value === "object" && value !== null && !Array.isArray(value);
12
+ }
13
+ function evidenceRecord(evidence) {
14
+ if (typeof evidence === "string") {
15
+ try {
16
+ const parsed = JSON.parse(evidence);
17
+ return isRecord(parsed) ? parsed : {};
18
+ } catch {
19
+ return {};
20
+ }
21
+ }
22
+ return isRecord(evidence) ? evidence : {};
23
+ }
24
+ function numberAt(evidence, key) {
25
+ const value = evidence[key];
26
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
27
+ }
28
+ function formatShare(value) {
29
+ return `${Math.round(value * 100)}%`;
30
+ }
31
+ function formatSeconds(ms) {
32
+ const seconds = ms / 1e3;
33
+ return `${Number.isInteger(seconds) ? seconds : seconds.toFixed(1)} s`;
34
+ }
35
+ function formatCount(value) {
36
+ return Math.round(value).toLocaleString("en-US");
37
+ }
38
+ function formatMicroUsd(value) {
39
+ const dollars = value / 1e6;
40
+ if (dollars > 0 && dollars < 0.01) return "< $0.01";
41
+ return `$${dollars.toLocaleString("en-US", {
42
+ minimumFractionDigits: 2,
43
+ maximumFractionDigits: 2
44
+ })}`;
45
+ }
46
+ function monthlySavingLabel(microUsd) {
47
+ if (microUsd === null || microUsd === void 0) return null;
48
+ if (!Number.isFinite(microUsd) || microUsd <= 0) return null;
49
+ return formatMicroUsd(microUsd);
50
+ }
51
+ function evidenceWindowDays(evidence) {
52
+ const days = numberAt(evidenceRecord(evidence), "windowDays");
53
+ return days !== null && days > 0 ? days : DEFAULT_WINDOW_DAYS;
54
+ }
55
+ var FACTS = {
56
+ ["RAISE_TIMEOUT" /* RaiseTimeout */]: [
57
+ { id: "executions", format: formatCount },
58
+ { id: "timeoutRate", format: formatShare },
59
+ { id: "currentTimeoutMs", format: formatSeconds },
60
+ {
61
+ id: "p95CompletedMs",
62
+ format: formatSeconds
63
+ },
64
+ {
65
+ id: "suggestedTimeoutMs",
66
+ format: formatSeconds
67
+ }
68
+ ],
69
+ ["ADD_RETRY" /* AddRetry */]: [
70
+ { id: "executions", format: formatCount },
71
+ {
72
+ id: "transientFailures",
73
+ format: formatCount
74
+ },
75
+ {
76
+ id: "transientFailureRate",
77
+ format: formatShare
78
+ }
79
+ ],
80
+ ["UNUSED_NODE" /* UnusedNode */]: [{ id: "completedRuns", format: formatCount }],
81
+ ["ENABLE_CACHE" /* EnableCache */]: [
82
+ { id: "calls", format: formatCount },
83
+ { id: "repeatedCalls", format: formatCount },
84
+ { id: "repeatShare", format: formatShare },
85
+ { id: "costMicroUsd", format: formatMicroUsd }
86
+ ],
87
+ ["CHEAPER_MODEL" /* CheaperModel */]: [],
88
+ ["MISSING_GUARDRAIL" /* MissingGuardrail */]: []
89
+ };
90
+ function evidenceFacts(kind, evidence) {
91
+ const record = evidenceRecord(evidence);
92
+ const facts = [];
93
+ for (const spec of FACTS[kind] ?? []) {
94
+ const value = numberAt(record, spec.id);
95
+ if (value === null) continue;
96
+ facts.push({ id: spec.id, value: spec.format(value) });
97
+ }
98
+ if (kind === "UNUSED_NODE" /* UnusedNode */) {
99
+ const removed = record.removedNodeIds;
100
+ if (Array.isArray(removed) && removed.length > 0) {
101
+ facts.push({
102
+ id: "removedNodeIds",
103
+ value: removed.map(String).join(", ")
104
+ });
105
+ }
106
+ }
107
+ if (kind === "ADD_RETRY" /* AddRetry */) {
108
+ const byType = record.failuresByType;
109
+ if (isRecord(byType)) {
110
+ const parts = Object.entries(byType).filter(
111
+ (entry) => typeof entry[1] === "number" && entry[1] > 0
112
+ ).map(([type, count]) => `${type} ${formatCount(count)}`);
113
+ if (parts.length > 0) {
114
+ facts.push({
115
+ id: "failuresByType",
116
+ value: parts.join(", ")
117
+ });
118
+ }
119
+ }
120
+ }
121
+ return facts;
122
+ }
123
+ function shortRunId(runId) {
124
+ return runId.length > 8 ? runId.slice(0, 8) : runId;
125
+ }
126
+
127
+ // src/modules/executions/utils/ai-usage.ts
128
+ function aiCost(usage) {
129
+ if (!usage || usage.calls <= 0) return { kind: "none" };
130
+ const cost = usage.costMicroUsd;
131
+ if (cost === null || cost === void 0 || !Number.isFinite(cost)) {
132
+ return { kind: "unpriced" };
133
+ }
134
+ const unpricedCalls = Math.max(0, usage.calls - usage.pricedCalls);
135
+ return {
136
+ kind: "priced",
137
+ text: formatMicroUsd(cost),
138
+ partial: unpricedCalls > 0 || usage.pendingCalls > 0,
139
+ unpricedCalls: Math.max(unpricedCalls, usage.pendingCalls)
140
+ };
141
+ }
142
+ function formatTokens(value) {
143
+ if (value === null || value === void 0 || !Number.isFinite(value)) {
144
+ return "0";
145
+ }
146
+ return Math.max(0, Math.round(value)).toLocaleString("en-US");
147
+ }
148
+ function modelLabel(providerKey, modelKey) {
149
+ const parts = [providerKey, modelKey].filter(
150
+ (part) => typeof part === "string" && part.length > 0
151
+ );
152
+ return parts.length ? parts.join(" \xB7 ") : null;
153
+ }
154
+ var AI_SPEND_RANGE_DAYS = [7, 30, 90];
155
+ var DAY_MS = 864e5;
156
+ function aiSpendPeriod(days, now = /* @__PURE__ */ new Date()) {
157
+ const toMs = Math.ceil(now.getTime() / 6e4) * 6e4;
158
+ return {
159
+ from: new Date(toMs - days * DAY_MS).toISOString(),
160
+ to: new Date(toMs).toISOString()
161
+ };
162
+ }
163
+ function runsOfWorkflowPath(workflowKey) {
164
+ return `../runs?workflowKey=${encodeURIComponent(workflowKey)}`;
165
+ }
166
+ function agentTracePath(runId, nodeId) {
167
+ const params = new URLSearchParams({ tab: "agent" });
168
+ if (nodeId) params.set("node", nodeId);
169
+ return `../runs/${encodeURIComponent(runId)}?${params.toString()}`;
170
+ }
171
+
172
+ export { AI_SPEND_RANGE_DAYS, DISMISS_REASONS, MAX_DISMISS_NOTE_LENGTH, agentTracePath, aiCost, aiSpendPeriod, evidenceFacts, evidenceWindowDays, formatTokens, modelLabel, monthlySavingLabel, runsOfWorkflowPath, shortRunId };
@@ -1,8 +1,8 @@
1
- import { useRunStatusCounts, ExecutionStats, ExecutionFilters, ExecutionTable, ExecutionCards, ExecutionTimeline, Pagination, runStatusLabels } from './chunk-MSQAULLG.js';
2
- import { useExecutionsWithStore, useExecutionStats, useExecutionActions, useAutoRefresh, WORKFLOW_ID_MAX_LENGTH } from './chunk-AG3VC7Y2.js';
3
- import { useWorkflowDefinitions } from './chunk-HOTVUVZG.js';
1
+ import { useRunStatusCounts, ExecutionStats, ExecutionFilters, ExecutionTable, ExecutionCards, ExecutionTimeline, Pagination, runStatusLabels } from './chunk-MA6I4KY5.js';
2
+ import { useExecutionsWithStore, useExecutionStats, useExecutionActions, useAutoRefresh, WORKFLOW_ID_MAX_LENGTH } from './chunk-VESQH55Q.js';
3
+ import { useWorkflowDefinitions } from './chunk-YGOGJDN4.js';
4
4
  import { FluidGridsDocsLink } from './chunk-4VJ3MDOV.js';
5
- import { useDurableParityEnabled } from './chunk-C26QAWCT.js';
5
+ import { useDurableParityEnabled } from './chunk-ZBPRNWKY.js';
6
6
  import { useTr } from './chunk-UULVIT25.js';
7
7
  import { useExecutionsStore } from './chunk-UEG2WC3G.js';
8
8
  import { useRef, useCallback, useMemo, useState, useEffect } from 'react';
@@ -1,4 +1,4 @@
1
- import { NodeEndpointConfigsDocument, NodeEndpointConfigDocument, NodeManifestDocument, fetchAllNodeEndpointConfigs } from './chunk-AVHBWJRY.js';
1
+ import { NodeEndpointConfigsDocument, NodeEndpointConfigDocument, NodeManifestDocument, fetchAllNodeEndpointConfigs } from './chunk-Z3ABLERJ.js';
2
2
  import { useTr } from './chunk-UULVIT25.js';
3
3
  import { getFluidGridsClient } from './chunk-3IXU7WUC.js';
4
4
  import { useMemo, useState, useCallback, useEffect } from 'react';
@@ -0,0 +1,9 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ var BuilderReadOnlyContext = createContext(false);
4
+ var BuilderReadOnlyProvider = BuilderReadOnlyContext.Provider;
5
+ function useBuilderReadOnly() {
6
+ return useContext(BuilderReadOnlyContext);
7
+ }
8
+
9
+ export { BuilderReadOnlyProvider, useBuilderReadOnly };
@@ -1,4 +1,4 @@
1
- import { RunFailureClustersDocument, DismissRunFailureClusterDocument, RunFailureTriageSettingsDocument, SetRunFailureTriageEnabledDocument, FgTriageFailedRunsDocument } from './chunk-AVHBWJRY.js';
1
+ import { RunFailureClustersDocument, DismissRunFailureClusterDocument, RunFailureTriageSettingsDocument, SetRunFailureTriageEnabledDocument, FgTriageFailedRunsDocument } from './chunk-Z3ABLERJ.js';
2
2
  import { useTr } from './chunk-UULVIT25.js';
3
3
  import { getFluidGridsClient } from './chunk-3IXU7WUC.js';
4
4
  import { throwIfResultError } from './chunk-US5QSLPV.js';
@@ -325,4 +325,70 @@ function FailureTriagePanel({
325
325
  );
326
326
  }
327
327
 
328
- export { BUCKET_LABELS, FailureTriagePanel, OPEN_STATUSES, dismissRunFailureCluster, fetchRunFailureClusters };
328
+ // src/modules/observability/utils.ts
329
+ function percentage(value, total) {
330
+ if (total <= 0) return 0;
331
+ return Math.round(value / total * 1e3) / 10;
332
+ }
333
+ function getFailureBreakdown(runs) {
334
+ const counts = /* @__PURE__ */ new Map();
335
+ for (const run of runs) {
336
+ const key = run.errorType || "UNKNOWN";
337
+ counts.set(key, (counts.get(key) ?? 0) + 1);
338
+ }
339
+ return [...counts.entries()].map(([key, count]) => ({ key, count })).sort((a, b) => b.count - a.count || a.key.localeCompare(b.key));
340
+ }
341
+ function getTopFailingWorkflows(runs) {
342
+ const counts = /* @__PURE__ */ new Map();
343
+ for (const run of runs) {
344
+ const current = counts.get(run.workflowKey);
345
+ if (current) {
346
+ current.count += 1;
347
+ } else {
348
+ counts.set(run.workflowKey, {
349
+ workflowKey: run.workflowKey,
350
+ label: run.workflow?.name || run.workflowKey,
351
+ count: 1
352
+ });
353
+ }
354
+ }
355
+ return [...counts.values()].sort(
356
+ (a, b) => b.count - a.count || a.label.localeCompare(b.label)
357
+ );
358
+ }
359
+ function getTopFailingNodes(nodeUsageStats) {
360
+ return [...nodeUsageStats].filter((stat) => stat.failureCount > 0).sort(
361
+ (a, b) => b.failureCount - a.failureCount || a.nodeType.localeCompare(b.nodeType)
362
+ );
363
+ }
364
+ function formatDuration(seconds) {
365
+ if (seconds === null || seconds === void 0 || !Number.isFinite(seconds)) {
366
+ return "\u2014";
367
+ }
368
+ if (seconds < 1) return `${Math.round(seconds * 1e3)}ms`;
369
+ if (seconds < 60) return `${seconds.toFixed(1)}s`;
370
+ const minutes = Math.floor(seconds / 60);
371
+ const remainingSeconds = Math.round(seconds % 60);
372
+ return `${minutes}m ${remainingSeconds}s`;
373
+ }
374
+ function formatBytes(bytes) {
375
+ if (!Number.isFinite(bytes) || bytes < 0) return "\u2014";
376
+ if (bytes < 1024) return `${bytes} B`;
377
+ const units = ["KB", "MB", "GB", "TB"];
378
+ let value = bytes / 1024;
379
+ let unit = units[0];
380
+ for (let i = 1; i < units.length && value >= 1024; i += 1) {
381
+ value /= 1024;
382
+ unit = units[i];
383
+ }
384
+ return `${value.toFixed(value >= 10 ? 0 : 1)} ${unit}`;
385
+ }
386
+ function prettyJson(value) {
387
+ try {
388
+ return JSON.stringify(value, null, 2) ?? "null";
389
+ } catch {
390
+ return String(value);
391
+ }
392
+ }
393
+
394
+ export { BUCKET_LABELS, FailureTriagePanel, OPEN_STATUSES, dismissRunFailureCluster, fetchRunFailureClusters, formatBytes, formatDuration, getFailureBreakdown, getTopFailingNodes, getTopFailingWorkflows, percentage, prettyJson };
@@ -1,5 +1,5 @@
1
- import { mergeStickyNotes } from './chunk-C26QAWCT.js';
2
- import { WorkflowDefinitionDocument, WorkflowVersionDiffDocument } from './chunk-AVHBWJRY.js';
1
+ import { canvasFromDefinition } from './chunk-JYYN3CLL.js';
2
+ import { WorkflowDefinitionDocument, WorkflowVersionDiffDocument } from './chunk-Z3ABLERJ.js';
3
3
  import { useTr } from './chunk-UULVIT25.js';
4
4
  import { getFluidGridsClient } from './chunk-3IXU7WUC.js';
5
5
  import { describeOperationError, throwIfResultError } from './chunk-US5QSLPV.js';
@@ -50,35 +50,6 @@ function versionsOfWorkflow(rows, workflowKey) {
50
50
  return rows.filter((row) => row.workflowKey === workflowKey).sort((a, b) => time(b.createdAt) - time(a.createdAt));
51
51
  }
52
52
 
53
- // src/builder/live/definition-canvas.ts
54
- function isRecord(value) {
55
- return typeof value === "object" && value !== null && !Array.isArray(value);
56
- }
57
- function hasId(item) {
58
- return isRecord(item) && typeof item.id === "string" && item.id.length > 0;
59
- }
60
- function canvasFromDefinition(definitionJson) {
61
- let definition = definitionJson;
62
- if (typeof definition === "string") {
63
- try {
64
- definition = JSON.parse(definition);
65
- } catch {
66
- return null;
67
- }
68
- }
69
- if (!isRecord(definition)) return null;
70
- const data = isRecord(definition.data) ? definition.data : definition;
71
- if (!Array.isArray(data.nodes)) return null;
72
- const nodes = mergeStickyNotes({
73
- nodes: data.nodes,
74
- stickyNotes: Array.isArray(data.stickyNotes) ? data.stickyNotes : []
75
- }).filter(hasId);
76
- const edges = (Array.isArray(data.edges) ? data.edges : []).filter(
77
- hasId
78
- );
79
- return { nodes, edges };
80
- }
81
-
82
53
  // src/modules/history/utils/version-graph-diff.ts
83
54
  var LAYOUT_NODE_KEYS = /* @__PURE__ */ new Set([
84
55
  "position",
@@ -106,7 +77,7 @@ var LAYOUT_EDGE_KEYS = /* @__PURE__ */ new Set([
106
77
  ]);
107
78
  var DIFF_CARD_FOOTPRINT = { width: 220, height: 90 };
108
79
  var MAX_CHANGED_FIELDS = 20;
109
- function isRecord2(value) {
80
+ function isRecord(value) {
110
81
  return typeof value === "object" && value !== null && !Array.isArray(value);
111
82
  }
112
83
  function equalJson(left, right) {
@@ -114,7 +85,7 @@ function equalJson(left, right) {
114
85
  if (Array.isArray(left) && Array.isArray(right)) {
115
86
  return left.length === right.length && left.every((value, index) => equalJson(value, right[index]));
116
87
  }
117
- if (isRecord2(left) && isRecord2(right)) {
88
+ if (isRecord(left) && isRecord(right)) {
118
89
  const leftKeys = Object.keys(left).filter((k) => left[k] !== void 0);
119
90
  const rightKeys = Object.keys(right).filter((k) => right[k] !== void 0);
120
91
  if (leftKeys.length !== rightKeys.length) return false;
@@ -128,7 +99,7 @@ function changedPaths(before, after, prefix = "", limit = MAX_CHANGED_FIELDS) {
128
99
  const paths = [];
129
100
  const visit = (left, right, path) => {
130
101
  if (paths.length >= limit || equalJson(left, right)) return;
131
- if (isRecord2(left) && isRecord2(right)) {
102
+ if (isRecord(left) && isRecord(right)) {
132
103
  const keys = [
133
104
  .../* @__PURE__ */ new Set([...Object.keys(left), ...Object.keys(right)])
134
105
  ].sort((a, b) => a.localeCompare(b));
@@ -154,11 +125,11 @@ function text(value) {
154
125
  return typeof value === "string" && value.trim() ? value.trim() : null;
155
126
  }
156
127
  function nodeLabel(node) {
157
- const data = isRecord2(node.data) ? node.data : {};
128
+ const data = isRecord(node.data) ? node.data : {};
158
129
  return text(data.label) ?? text(data.name) ?? text(data.title) ?? String(node.id);
159
130
  }
160
131
  function nodeTypeOf(node) {
161
- const data = isRecord2(node.data) ? node.data : {};
132
+ const data = isRecord(node.data) ? node.data : {};
162
133
  return text(data.nodeType) ?? text(data.type) ?? text(node.type) ?? "node";
163
134
  }
164
135
  function positionOf(node) {
@@ -197,7 +168,7 @@ function edgeSignature(edge) {
197
168
  function edgeLabel(edge) {
198
169
  if (typeof edge.label === "string" && edge.label.trim())
199
170
  return edge.label.trim();
200
- const data = isRecord2(edge.data) ? edge.data : {};
171
+ const data = isRecord(edge.data) ? edge.data : {};
201
172
  return text(data.label);
202
173
  }
203
174
  function emptyCounts() {
@@ -1478,4 +1449,4 @@ function VersionDiffDialog({
1478
1449
  ] });
1479
1450
  }
1480
1451
 
1481
- export { VersionDiffDialog, VersionLifecycleBar, canvasFromDefinition, countLifecycle, versionsOfWorkflow };
1452
+ export { VersionDiffDialog, VersionLifecycleBar, countLifecycle, versionsOfWorkflow };
@@ -1,10 +1,11 @@
1
- import { isGuidedTourIntent, pickGuidedTour, withoutGuidedTourIntent, isCreateIntent, CreateWorkflowRefusalDialog, decideMissingWorkflow } from './chunk-HLAUK5GM.js';
1
+ import { isGuidedTourIntent, pickGuidedTour, withoutGuidedTourIntent, isCreateIntent, CreateWorkflowRefusalDialog, decideMissingWorkflow } from './chunk-FVWRGL7S.js';
2
2
  import { registerLiveCanvasHandler } from './chunk-PIKYQE7P.js';
3
- import { useWorkflowReloadStore, releaseLeaseKeptForReload, useInstalledNodes, buildNodeCheck, FlowBuilderPage, buildRequiredNodeTypes } from './chunk-I3QPAEL6.js';
4
- import { canvasFromDefinition } from './chunk-4QB6S7YW.js';
5
- import { useLazyWorkflowDefinition, useCreateWorkflow } from './chunk-HOTVUVZG.js';
6
- import { useFlowStore, refetchStoreNodes, BILLING_PLANS_PATH, codeBuildIdOf, mergeStickyNotes, rememberRevision, blankWorkflowCreateInput, classifyCreateRefusal, useSaveStatusStore, workflowFingerprint, registerWorkflowNodeTypes } from './chunk-C26QAWCT.js';
7
- import { WorkflowDefinitionDocument } from './chunk-AVHBWJRY.js';
3
+ import { useWorkflowReloadStore, releaseLeaseKeptForReload, useInstalledNodes, buildNodeCheck, FlowBuilderPage, buildRequiredNodeTypes } from './chunk-NMQENSPW.js';
4
+ import { canvasFromDefinition } from './chunk-JYYN3CLL.js';
5
+ import { useLazyWorkflowDefinition, useCreateWorkflow } from './chunk-YGOGJDN4.js';
6
+ import { refetchStoreNodes, BILLING_PLANS_PATH, codeBuildIdOf, rememberRevision, blankWorkflowCreateInput, classifyCreateRefusal, useSaveStatusStore, workflowFingerprint, registerWorkflowNodeTypes } from './chunk-ZBPRNWKY.js';
7
+ import { useFlowStore, mergeStickyNotes } from './chunk-5DVP2UYH.js';
8
+ import { WorkflowDefinitionDocument } from './chunk-Z3ABLERJ.js';
8
9
  import { useTr } from './chunk-UULVIT25.js';
9
10
  import { getFluidGridsClient } from './chunk-3IXU7WUC.js';
10
11
  import { throwIfResultError } from './chunk-US5QSLPV.js';
@@ -1,6 +1,6 @@
1
1
  import { REPLAY_WORKFLOW_RUN, RETRY_WORKFLOW_RUNS } from './chunk-5ERAJC2I.js';
2
- import { useFluidGridsAnalytics, emitRunStarted, openRunQuotaUpgradePrompt } from './chunk-C26QAWCT.js';
3
- import { ExecutionsListDocument, ExecutionDetailDocument, ExecutionStatsDocument, PauseExecutionDocument, ResumeExecutionDocument, CancelExecutionDocument, RetryNodeDocument, TriggerWorkflowDocument, TerminateExecutionDocument } from './chunk-AVHBWJRY.js';
2
+ import { useFluidGridsAnalytics, emitRunStarted, openRunQuotaUpgradePrompt } from './chunk-ZBPRNWKY.js';
3
+ import { ExecutionsListDocument, ExecutionDetailDocument, ExecutionStatsDocument, PauseExecutionDocument, ResumeExecutionDocument, CancelExecutionDocument, RetryNodeDocument, TriggerWorkflowDocument, TerminateExecutionDocument } from './chunk-Z3ABLERJ.js';
4
4
  import { useTr } from './chunk-UULVIT25.js';
5
5
  import { getFluidGridsClient } from './chunk-3IXU7WUC.js';
6
6
  import { throwIfResultError, emitFluidGridsEvent, emitOperationErrorEvent } from './chunk-US5QSLPV.js';
@@ -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,11 +1,3 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- var BuilderReadOnlyContext = createContext(false);
4
- var BuilderReadOnlyProvider = BuilderReadOnlyContext.Provider;
5
- function useBuilderReadOnly() {
6
- return useContext(BuilderReadOnlyContext);
7
- }
8
-
9
1
  // src/builder/components/ndv/code-editor-diagnostics.ts
10
2
  function editorSeverity(value) {
11
3
  const lower = value.toLowerCase();
@@ -43,4 +35,4 @@ function toCodeMirrorDiagnostics(text, diagnostics) {
43
35
  });
44
36
  }
45
37
 
46
- export { BuilderReadOnlyProvider, editorSeverity, toCodeMirrorDiagnostics, useBuilderReadOnly };
38
+ export { editorSeverity, toCodeMirrorDiagnostics };
@@ -1,5 +1,5 @@
1
- import { useFluidGridsAnalytics, emitWorkflowCreated, emitRunStarted, runTriggerFromMode, openRunQuotaUpgradePrompt, emitWorkflowPublished } from './chunk-C26QAWCT.js';
2
- import { WorkflowDefinitionsDocument, WorkflowDefinitionDocument, WorkflowVersionsDocument, CreateWorkflowDefinitionDocument, ImportWorkflowDocument, PreviewN8nImportDocument, UpdateWorkflowDefinitionDocument, CreateWorkflowVersionDocument, DeleteWorkflowDefinitionDocument, DuplicateWorkflowDocument, RestoreWorkflowVersionDocument, TriggerWorkflowDocument, WorkflowRunsDocument, WorkflowRunDocument, DashboardSummaryDocument, ActivateWorkflowDefinitionDocument, DeactivateWorkflowDefinitionDocument } from './chunk-AVHBWJRY.js';
1
+ import { useFluidGridsAnalytics, emitWorkflowCreated, emitRunStarted, runTriggerFromMode, openRunQuotaUpgradePrompt, emitWorkflowPublished } from './chunk-ZBPRNWKY.js';
2
+ import { WorkflowDefinitionsDocument, WorkflowDefinitionDocument, WorkflowVersionsDocument, CreateWorkflowDefinitionDocument, ImportWorkflowDocument, PreviewN8nImportDocument, UpdateWorkflowDefinitionDocument, CreateWorkflowVersionDocument, DeleteWorkflowDefinitionDocument, DuplicateWorkflowDocument, RestoreWorkflowVersionDocument, TriggerWorkflowDocument, WorkflowRunsDocument, WorkflowRunDocument, DashboardSummaryDocument, ActivateWorkflowDefinitionDocument, DeactivateWorkflowDefinitionDocument } from './chunk-Z3ABLERJ.js';
3
3
  import { useTr } from './chunk-UULVIT25.js';
4
4
  import { getFluidGridsClient } from './chunk-3IXU7WUC.js';
5
5
  import { throwIfResultError, emitFluidGridsEvent, emitOperationErrorEvent } from './chunk-US5QSLPV.js';