@salesforce/metadata-plugins 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -0
  4. package/dist/plugins/agent/ui/assets/index-BpnirPMA.js +71 -0
  5. package/dist/plugins/agent/ui/index.html +1 -1
  6. package/dist/plugins/flexipage/ui/assets/index-DJj6fJsw.js +48 -0
  7. package/dist/plugins/flexipage/ui/index.html +1 -1
  8. package/dist/plugins/flow/ui/assets/index-B-Cn56iR.js +48 -0
  9. package/dist/plugins/flow/ui/index.html +1 -1
  10. package/dist/plugins/flowintent/FlowIntentParser.d.ts +56 -0
  11. package/dist/plugins/flowintent/FlowIntentParser.d.ts.map +1 -0
  12. package/dist/plugins/flowintent/FlowIntentParser.js +144 -0
  13. package/dist/plugins/flowintent/FlowIntentVisualizer.d.ts +41 -0
  14. package/dist/plugins/flowintent/FlowIntentVisualizer.d.ts.map +1 -0
  15. package/dist/plugins/flowintent/FlowIntentVisualizer.js +43 -0
  16. package/dist/plugins/flowintent/types/IntentFlow.d.ts +139 -0
  17. package/dist/plugins/flowintent/types/IntentFlow.d.ts.map +1 -0
  18. package/dist/plugins/flowintent/types/IntentFlow.js +89 -0
  19. package/dist/plugins/flowintent/types/analyzeFlowBuilderGraph.d.ts +42 -0
  20. package/dist/plugins/flowintent/types/analyzeFlowBuilderGraph.d.ts.map +1 -0
  21. package/dist/plugins/flowintent/types/analyzeFlowBuilderGraph.js +226 -0
  22. package/dist/plugins/flowintent/types/analyzeIntentFlowGraph.d.ts +27 -0
  23. package/dist/plugins/flowintent/types/analyzeIntentFlowGraph.d.ts.map +1 -0
  24. package/dist/plugins/flowintent/types/analyzeIntentFlowGraph.js +80 -0
  25. package/dist/plugins/flowintent/types/index.d.ts +17 -0
  26. package/dist/plugins/flowintent/types/index.d.ts.map +1 -0
  27. package/dist/plugins/flowintent/types/index.js +16 -0
  28. package/dist/plugins/flowintent/types/validateIntentFlow.d.ts +32 -0
  29. package/dist/plugins/flowintent/types/validateIntentFlow.d.ts.map +1 -0
  30. package/dist/plugins/flowintent/types/validateIntentFlow.js +438 -0
  31. package/dist/plugins/flowintent/ui/assets/index-BkuUZejF.js +48 -0
  32. package/dist/plugins/flowintent/ui/assets/index-Di3MtBl5.css +1 -0
  33. package/dist/plugins/flowintent/ui/index.html +18 -0
  34. package/dist/plugins/permissionset/ui/assets/index-BCcTde0G.js +48 -0
  35. package/dist/plugins/permissionset/ui/index.html +1 -1
  36. package/dist/plugins/schema/ui/assets/index-BBcLTTbn.js +70 -0
  37. package/dist/plugins/schema/ui/index.html +1 -1
  38. package/dist/shared/bootstrap/createPluginApp.d.ts +14 -10
  39. package/dist/shared/bootstrap/createPluginApp.d.ts.map +1 -1
  40. package/dist/shared/bootstrap/createPluginApp.js +78 -17
  41. package/dist/shared/components/FlowIcons.d.ts +107 -0
  42. package/dist/shared/components/FlowIcons.d.ts.map +1 -0
  43. package/dist/shared/components/FlowIcons.js +243 -0
  44. package/package.json +3 -3
  45. package/dist/plugins/agent/ui/assets/index-C_Q6Mc2L.js +0 -71
  46. package/dist/plugins/flexipage/ui/assets/index-CuJYcAx_.js +0 -48
  47. package/dist/plugins/flow/ui/assets/index-OhJU6yxp.js +0 -48
  48. package/dist/plugins/permissionset/ui/assets/index-CMInRbR2.js +0 -48
  49. package/dist/plugins/schema/ui/assets/index-CWvLR0Fz.js +0 -70
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { FLOW_TYPES, INTENT_NODE_TYPES, EDGE_KINDS, } from './IntentFlow.js';
8
+ import { analyzeIntentFlowGraph, hasDirectedPath } from './analyzeIntentFlowGraph.js';
9
+ /**
10
+ * Content-free failure raised by {@link assertIntentFlow}. The full validation
11
+ * result remains local to the validator; callers receive only the fixed code
12
+ * vocabulary and the total number of errors, which are safe for telemetry.
13
+ */
14
+ export class IntentFlowValidationFailure extends Error {
15
+ constructor(errors) {
16
+ const codes = Object.freeze([...new Set(errors.map((error) => error.code))].sort());
17
+ super(`Invalid IntentFlow (${codes.join(', ')}).`);
18
+ this.name = 'IntentFlowValidationFailure';
19
+ this.codes = codes;
20
+ this.errorCount = errors.length;
21
+ }
22
+ }
23
+ const NODE_TYPES = new Set(INTENT_NODE_TYPES);
24
+ const EDGE_KIND_SET = new Set(EDGE_KINDS);
25
+ const FLOW_TYPE_SET = new Set(FLOW_TYPES);
26
+ const FORBIDDEN_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
27
+ function isObject(v) {
28
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
29
+ }
30
+ function isNonEmptyString(v) {
31
+ return typeof v === 'string' && v.length > 0;
32
+ }
33
+ /** Reject hostile object graphs without evaluating accessors. */
34
+ function inspectObjectGraph(root) {
35
+ const errors = [];
36
+ const seen = new WeakSet();
37
+ const stack = [{ value: root, path: '' }];
38
+ while (stack.length > 0) {
39
+ const entry = stack.pop();
40
+ if (!entry) {
41
+ break;
42
+ }
43
+ const { value, path } = entry;
44
+ if (typeof value !== 'object' || value === null) {
45
+ continue;
46
+ }
47
+ if (seen.has(value)) {
48
+ errors.push({
49
+ path,
50
+ code: 'REPEATED_REFERENCE',
51
+ message: 'repeated object references are not allowed.',
52
+ });
53
+ continue;
54
+ }
55
+ seen.add(value);
56
+ const isArray = Array.isArray(value);
57
+ const prototype = Reflect.getPrototypeOf(value);
58
+ if ((!isArray && prototype !== Object.prototype && prototype !== null) ||
59
+ (isArray && prototype !== Array.prototype)) {
60
+ errors.push({ path, code: 'UNEXPECTED_PROTOTYPE', message: 'unexpected object prototype.' });
61
+ continue;
62
+ }
63
+ for (const key of Reflect.ownKeys(value)) {
64
+ if (isArray && key === 'length') {
65
+ continue;
66
+ }
67
+ // Object member names are user-controlled. Keep them out of paths even
68
+ // when reporting an accessor, while array indexes remain structural.
69
+ const childPath = isArray && typeof key === 'string' ? `${path}[${key}]` : '<property>';
70
+ if (typeof key !== 'string') {
71
+ errors.push({ path, code: 'SYMBOL_KEY', message: 'symbol keys are not allowed.' });
72
+ continue;
73
+ }
74
+ if (FORBIDDEN_KEYS.has(key)) {
75
+ errors.push({ path: '<property>', code: 'FORBIDDEN_KEY', message: 'forbidden own key.' });
76
+ continue;
77
+ }
78
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
79
+ if (!descriptor || !('value' in descriptor) || descriptor.get || descriptor.set) {
80
+ errors.push({
81
+ path: childPath,
82
+ code: 'ACCESSOR_PROPERTY',
83
+ message: 'accessor properties are not allowed.',
84
+ });
85
+ continue;
86
+ }
87
+ stack.push({ value: descriptor.value, path: childPath });
88
+ }
89
+ }
90
+ return errors;
91
+ }
92
+ export function validateIntentFlow(value) {
93
+ const errors = inspectObjectGraph(value);
94
+ const warnings = [];
95
+ const err = (path, code, message) => errors.push({ path, code, message });
96
+ const warn = (path, code, message) => warnings.push({ path, code, message });
97
+ if (errors.length > 0) {
98
+ return { valid: false, errors, warnings };
99
+ }
100
+ if (!isObject(value)) {
101
+ return {
102
+ valid: false,
103
+ errors: [{ path: '', code: 'ROOT_TYPE', message: 'IntentFlow must be a JSON object.' }],
104
+ warnings,
105
+ };
106
+ }
107
+ if (!isNonEmptyString(value.flowLabel)) {
108
+ err('flowLabel', 'FLOW_LABEL', 'must be a non-empty string.');
109
+ }
110
+ if (value.flowDescription !== undefined && typeof value.flowDescription !== 'string') {
111
+ err('flowDescription', 'FLOW_DESCRIPTION', 'must be a string when present.');
112
+ }
113
+ if (value.flowType !== undefined &&
114
+ (typeof value.flowType !== 'string' || !FLOW_TYPE_SET.has(value.flowType))) {
115
+ err('flowType', 'FLOW_TYPE', 'must be a supported flow type when present.');
116
+ }
117
+ if (value.intentSummary !== undefined) {
118
+ if (!Array.isArray(value.intentSummary)) {
119
+ err('intentSummary', 'INTENT_SUMMARY_TYPE', 'must be an array of strings when present.');
120
+ }
121
+ else {
122
+ value.intentSummary.forEach((entry, i) => {
123
+ if (typeof entry !== 'string') {
124
+ err(`intentSummary[${i}]`, 'INTENT_SUMMARY_ENTRY', 'must be a string.');
125
+ }
126
+ });
127
+ }
128
+ }
129
+ const nodeIds = new Set();
130
+ const nodeTypes = new Map();
131
+ let graphStructureValid = true;
132
+ if (!Array.isArray(value.nodes)) {
133
+ err('nodes', 'NODES_TYPE', 'must be an array.');
134
+ graphStructureValid = false;
135
+ }
136
+ else {
137
+ if (value.nodes.length === 0) {
138
+ err('nodes', 'NODES_EMPTY', 'must contain at least one node.');
139
+ }
140
+ value.nodes.forEach((node, i) => {
141
+ const p = `nodes[${i}]`;
142
+ if (!isObject(node)) {
143
+ graphStructureValid = false;
144
+ return err(p, 'NODE_TYPE', 'must be an object.');
145
+ }
146
+ if (!isNonEmptyString(node.id)) {
147
+ graphStructureValid = false;
148
+ err(`${p}.id`, 'NODE_ID', 'must be a non-empty string.');
149
+ }
150
+ else if (nodeIds.has(node.id)) {
151
+ graphStructureValid = false;
152
+ err(`${p}.id`, 'DUPLICATE_NODE_ID', 'duplicate node id.');
153
+ }
154
+ else {
155
+ nodeIds.add(node.id);
156
+ if (typeof node.type === 'string') {
157
+ nodeTypes.set(node.id, node.type);
158
+ }
159
+ }
160
+ if (!isNonEmptyString(node.label)) {
161
+ err(`${p}.label`, 'NODE_LABEL', 'must be a non-empty string.');
162
+ }
163
+ if (!isNonEmptyString(node.type) || !NODE_TYPES.has(node.type)) {
164
+ graphStructureValid = false;
165
+ err(`${p}.type`, 'NODE_KIND', 'must be a supported node type.');
166
+ }
167
+ if (node.intent !== undefined && typeof node.intent !== 'string') {
168
+ err(`${p}.intent`, 'NODE_INTENT', 'must be a string when present.');
169
+ }
170
+ });
171
+ }
172
+ const weakAdjacency = new Map();
173
+ for (const id of nodeIds) {
174
+ weakAdjacency.set(id, new Set());
175
+ }
176
+ const validGraphEdges = [];
177
+ const edgeSignatures = new Set();
178
+ const incidentNodeIds = new Set();
179
+ if (!Array.isArray(value.edges)) {
180
+ err('edges', 'EDGES_TYPE', 'must be an array.');
181
+ graphStructureValid = false;
182
+ }
183
+ else {
184
+ value.edges.forEach((edge, i) => {
185
+ const p = `edges[${i}]`;
186
+ if (!isObject(edge)) {
187
+ graphStructureValid = false;
188
+ return err(p, 'EDGE_TYPE', 'must be an object.');
189
+ }
190
+ const fromValid = isNonEmptyString(edge.from);
191
+ const toValid = isNonEmptyString(edge.to);
192
+ if (!fromValid) {
193
+ graphStructureValid = false;
194
+ err(`${p}.from`, 'EDGE_FROM', 'must be a non-empty string.');
195
+ }
196
+ else if (nodeIds.size > 0 && !nodeIds.has(edge.from)) {
197
+ graphStructureValid = false;
198
+ err(`${p}.from`, 'UNKNOWN_EDGE_ENDPOINT', 'references an unknown node id.');
199
+ }
200
+ if (!toValid) {
201
+ graphStructureValid = false;
202
+ err(`${p}.to`, 'EDGE_TO', 'must be a non-empty string.');
203
+ }
204
+ else if (nodeIds.size > 0 && !nodeIds.has(edge.to)) {
205
+ graphStructureValid = false;
206
+ err(`${p}.to`, 'UNKNOWN_EDGE_ENDPOINT', 'references an unknown node id.');
207
+ }
208
+ if (edge.label !== undefined && typeof edge.label !== 'string') {
209
+ err(`${p}.label`, 'EDGE_LABEL', 'must be a string when present.');
210
+ }
211
+ const kindValid = edge.kind === undefined || (typeof edge.kind === 'string' && EDGE_KIND_SET.has(edge.kind));
212
+ if (edge.kind !== undefined &&
213
+ (typeof edge.kind !== 'string' || !EDGE_KIND_SET.has(edge.kind))) {
214
+ graphStructureValid = false;
215
+ err(`${p}.kind`, 'EDGE_KIND', 'must be a supported edge kind when present.');
216
+ }
217
+ if (fromValid &&
218
+ toValid &&
219
+ nodeIds.has(edge.from) &&
220
+ nodeIds.has(edge.to)) {
221
+ const from = edge.from;
222
+ const to = edge.to;
223
+ const signature = JSON.stringify([from, to, edge.kind ?? 'sequence', edge.label ?? '']);
224
+ if (edgeSignatures.has(signature)) {
225
+ graphStructureValid = false;
226
+ err(p, 'DUPLICATE_EDGE', 'duplicate edge.');
227
+ }
228
+ else {
229
+ edgeSignatures.add(signature);
230
+ if (kindValid) {
231
+ validGraphEdges.push({
232
+ from,
233
+ to,
234
+ ...(edge.kind === undefined ? {} : { kind: edge.kind }),
235
+ index: i,
236
+ });
237
+ }
238
+ }
239
+ weakAdjacency.get(from).add(to);
240
+ weakAdjacency.get(to).add(from);
241
+ incidentNodeIds.add(from);
242
+ incidentNodeIds.add(to);
243
+ }
244
+ });
245
+ }
246
+ const graphAnalysis = graphStructureValid
247
+ ? analyzeIntentFlowGraph([...nodeIds], validGraphEdges)
248
+ : undefined;
249
+ if (graphAnalysis) {
250
+ for (const edge of validGraphEdges.filter((candidate) => candidate.kind === 'loop-back')) {
251
+ if (nodeTypes.get(edge.to) !== 'loop') {
252
+ err(`edges[${edge.index}].to`, 'LOOP_BACK_TARGET_TYPE', 'loop-back targets must be collection loop nodes.');
253
+ }
254
+ }
255
+ if (graphAnalysis.hasNonLoopCycle) {
256
+ err('edges', 'NON_LOOP_CYCLE', 'sequence, branch, and fault edges must be acyclic.');
257
+ }
258
+ else {
259
+ for (const edge of validGraphEdges.filter((candidate) => candidate.kind === 'loop-back')) {
260
+ const sourceDepth = graphAnalysis.depthByNode.get(edge.from);
261
+ const targetDepth = graphAnalysis.depthByNode.get(edge.to);
262
+ if (sourceDepth === undefined || targetDepth === undefined || targetDepth >= sourceDepth) {
263
+ err(`edges[${edge.index}]`, 'INVALID_LOOP_BACK_DIRECTION', 'loop-back targets must be at a strictly earlier forward depth.');
264
+ }
265
+ if (!hasDirectedPath(graphAnalysis.nonLoopAdjacency, edge.to, edge.from)) {
266
+ err(`edges[${edge.index}]`, 'LOOP_BACK_NOT_ANCESTOR', 'loop-back targets must be forward ancestors of their source.');
267
+ }
268
+ }
269
+ }
270
+ const outgoingByNode = new Map();
271
+ const incomingByNode = new Map();
272
+ for (const id of nodeIds) {
273
+ outgoingByNode.set(id, []);
274
+ incomingByNode.set(id, []);
275
+ }
276
+ for (const edge of validGraphEdges) {
277
+ outgoingByNode.get(edge.from)?.push(edge);
278
+ incomingByNode.get(edge.to)?.push(edge);
279
+ }
280
+ for (const [nodeId, nodeType] of nodeTypes) {
281
+ const outgoing = outgoingByNode.get(nodeId) ?? [];
282
+ const incoming = incomingByNode.get(nodeId) ?? [];
283
+ const sequence = outgoing.filter((edge) => (edge.kind ?? 'sequence') === 'sequence');
284
+ const branches = outgoing.filter((edge) => edge.kind === 'branch');
285
+ const faults = outgoing.filter((edge) => edge.kind === 'fault');
286
+ const loopBacks = outgoing.filter((edge) => edge.kind === 'loop-back');
287
+ if (nodeType === 'start') {
288
+ if (incoming.length > 0) {
289
+ err('edges', 'START_HAS_INCOMING', 'the start node cannot have incoming paths.');
290
+ }
291
+ if (sequence.length !== 1 || faults.length > 0 || loopBacks.length > 0) {
292
+ err('edges', 'START_PATH_SHAPE', 'the start node must have exactly one next path.');
293
+ }
294
+ }
295
+ else if (nodeType === 'end') {
296
+ if (outgoing.length > 0) {
297
+ err('edges', 'END_HAS_OUTGOING', 'end nodes cannot have outgoing paths.');
298
+ }
299
+ }
300
+ else if (nodeType === 'decision') {
301
+ if (branches.length < 2 || sequence.length > 0 || faults.length > 0) {
302
+ err('edges', 'DECISION_PATH_SHAPE', 'decision nodes must have at least two outcome paths and no next or fault path.');
303
+ }
304
+ }
305
+ else if (nodeType === 'loop') {
306
+ const incomingLoopBacks = incoming.filter((edge) => edge.kind === 'loop-back');
307
+ const forwardPaths = [...sequence, ...branches];
308
+ if (forwardPaths.length !== 2 || faults.length > 0 || loopBacks.length > 0) {
309
+ err('edges', 'LOOP_PATH_SHAPE', 'loop nodes must have one For Each outcome and one After Last next path.');
310
+ }
311
+ if (incomingLoopBacks.length === 0) {
312
+ err('edges', 'LOOP_RETURN_MISSING', 'loop nodes must have a loop-back path.');
313
+ }
314
+ else if (forwardPaths.length === 2) {
315
+ const pathsReachingReturn = forwardPaths.filter((path) => incomingLoopBacks.some((loopBack) => loopBack.from === path.to ||
316
+ hasDirectedPath(graphAnalysis.nonLoopAdjacency, path.to, loopBack.from)));
317
+ if (pathsReachingReturn.length !== 1) {
318
+ err('edges', 'LOOP_BODY_WITHOUT_RETURN', 'exactly one loop path must reach a loop-back to its loop node.');
319
+ }
320
+ }
321
+ }
322
+ else if (branches.length > 0 || sequence.length > 1 || faults.length > 1) {
323
+ err('edges', 'PROCESS_PATH_SHAPE', 'process nodes may have at most one next path and one fault path.');
324
+ }
325
+ for (const edge of faults) {
326
+ if (nodeType !== 'process') {
327
+ err(`edges[${edge.index}]`, 'FAULT_SOURCE_TYPE', 'fault paths must start at process nodes.');
328
+ }
329
+ }
330
+ for (const edge of branches) {
331
+ if (nodeType !== 'start' && nodeType !== 'decision' && nodeType !== 'loop') {
332
+ err(`edges[${edge.index}]`, 'BRANCH_SOURCE_TYPE', 'outcome paths must start at start, decision, or loop nodes.');
333
+ }
334
+ }
335
+ }
336
+ }
337
+ const groupedNodeIds = new Set();
338
+ if (value.groups !== undefined) {
339
+ if (!Array.isArray(value.groups)) {
340
+ err('groups', 'GROUPS_TYPE', 'must be an array when present.');
341
+ }
342
+ else {
343
+ const groupIds = new Set();
344
+ value.groups.forEach((group, i) => {
345
+ const p = `groups[${i}]`;
346
+ if (!isObject(group)) {
347
+ return err(p, 'GROUP_TYPE', 'must be an object.');
348
+ }
349
+ if (!isNonEmptyString(group.id)) {
350
+ err(`${p}.id`, 'GROUP_ID', 'must be a non-empty string.');
351
+ }
352
+ else if (groupIds.has(group.id)) {
353
+ err(`${p}.id`, 'DUPLICATE_GROUP_ID', 'duplicate group id.');
354
+ }
355
+ else {
356
+ groupIds.add(group.id);
357
+ }
358
+ if (!isNonEmptyString(group.description)) {
359
+ err(`${p}.description`, 'GROUP_DESCRIPTION', 'must be a non-empty string.');
360
+ }
361
+ if (!Array.isArray(group.memberNodeIds)) {
362
+ err(`${p}.memberNodeIds`, 'GROUP_MEMBERS_TYPE', 'must be an array.');
363
+ return;
364
+ }
365
+ const members = new Set();
366
+ group.memberNodeIds.forEach((ref, j) => {
367
+ if (!isNonEmptyString(ref)) {
368
+ err(`${p}.memberNodeIds[${j}]`, 'GROUP_MEMBER', 'must be a non-empty string.');
369
+ }
370
+ else if (!nodeIds.has(ref)) {
371
+ err(`${p}.memberNodeIds[${j}]`, 'UNKNOWN_GROUP_MEMBER', 'references an unknown node id.');
372
+ }
373
+ else {
374
+ members.add(ref);
375
+ groupedNodeIds.add(ref);
376
+ }
377
+ });
378
+ if (members.size === 0) {
379
+ err(`${p}.memberNodeIds`, 'EMPTY_GROUP', 'must contain at least one node.');
380
+ }
381
+ else if (members.size > 1) {
382
+ const first = members.values().next().value;
383
+ const reached = new Set([first]);
384
+ const queue = [first];
385
+ for (let cursor = 0; cursor < queue.length; cursor += 1) {
386
+ for (const next of weakAdjacency.get(queue[cursor]) ?? []) {
387
+ if (members.has(next) && !reached.has(next)) {
388
+ reached.add(next);
389
+ queue.push(next);
390
+ }
391
+ }
392
+ }
393
+ if (reached.size !== members.size) {
394
+ err(`${p}.memberNodeIds`, 'DISCONNECTED_GROUP', 'members must form a connected induced subgraph.');
395
+ }
396
+ }
397
+ });
398
+ }
399
+ }
400
+ const starts = [...nodeTypes].filter(([, type]) => type === 'start').map(([id]) => id);
401
+ const hasIsolatedNode = [...nodeIds].some((id) => !incidentNodeIds.has(id) && !groupedNodeIds.has(id));
402
+ if (starts.length !== 1) {
403
+ err('nodes', 'START_NODE_COUNT', 'must contain exactly one start node.');
404
+ }
405
+ if (starts.length === 1 && graphAnalysis && !graphAnalysis.hasNonLoopCycle) {
406
+ const reached = new Set([starts[0]]);
407
+ const queue = [starts[0]];
408
+ for (let cursor = 0; cursor < queue.length; cursor += 1) {
409
+ for (const next of graphAnalysis.nonLoopAdjacency.get(queue[cursor]) ?? []) {
410
+ if (!reached.has(next)) {
411
+ reached.add(next);
412
+ queue.push(next);
413
+ }
414
+ }
415
+ }
416
+ if (reached.size !== nodeIds.size) {
417
+ err('nodes', 'UNREACHABLE_NODE', 'all nodes must be reachable from the start node.');
418
+ }
419
+ }
420
+ else if (hasIsolatedNode) {
421
+ // When start-based reachability cannot run (invalid graph, no start, or
422
+ // multiple starts), retain a content-free diagnostic for truly isolated
423
+ // nodes. A valid one-start graph uses UNREACHABLE_NODE instead so callers
424
+ // do not receive duplicate diagnostics for the same structural problem.
425
+ warn('nodes', 'ORPHAN_NODE', 'one or more nodes have no edge connection or group membership.');
426
+ }
427
+ return { valid: errors.length === 0, errors, warnings };
428
+ }
429
+ export function isIntentFlow(value) {
430
+ return validateIntentFlow(value).valid;
431
+ }
432
+ export function assertIntentFlow(value) {
433
+ const { valid, errors } = validateIntentFlow(value);
434
+ if (!valid) {
435
+ throw new IntentFlowValidationFailure(errors);
436
+ }
437
+ return value;
438
+ }