@salesforce/metadata-plugins 1.5.0 → 1.6.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 (54) hide show
  1. package/dist/plugins/agent/AgentParser.d.ts +7 -1
  2. package/dist/plugins/agent/AgentParser.d.ts.map +1 -1
  3. package/dist/plugins/agent/AgentParser.js +9 -0
  4. package/dist/plugins/agent/agentSelectionGraph.d.ts +101 -0
  5. package/dist/plugins/agent/agentSelectionGraph.d.ts.map +1 -0
  6. package/dist/plugins/agent/agentSelectionGraph.js +407 -0
  7. package/dist/plugins/agent/extract/ast-to-graph.d.ts +2 -0
  8. package/dist/plugins/agent/extract/ast-to-graph.d.ts.map +1 -1
  9. package/dist/plugins/agent/extract/ast-to-graph.js +1 -0
  10. package/dist/plugins/agent/ui/assets/index-C_Q6Mc2L.js +71 -0
  11. package/dist/plugins/agent/ui/assets/index-DX8JtDoL.css +1 -0
  12. package/dist/plugins/agent/ui/index.html +2 -2
  13. package/dist/plugins/flexipage/FlexipageParser.d.ts +12 -1
  14. package/dist/plugins/flexipage/FlexipageParser.d.ts.map +1 -1
  15. package/dist/plugins/flexipage/FlexipageParser.js +14 -0
  16. package/dist/plugins/flexipage/ui/assets/index-CuJYcAx_.js +48 -0
  17. package/dist/plugins/flexipage/ui/assets/index-DBy19jKB.css +1 -0
  18. package/dist/plugins/flexipage/ui/index.html +2 -2
  19. package/dist/plugins/flow/FlowParser.d.ts +8 -1
  20. package/dist/plugins/flow/FlowParser.d.ts.map +1 -1
  21. package/dist/plugins/flow/FlowParser.js +10 -0
  22. package/dist/plugins/flow/flowSelectionGraph.d.ts +71 -0
  23. package/dist/plugins/flow/flowSelectionGraph.d.ts.map +1 -0
  24. package/dist/plugins/flow/flowSelectionGraph.js +196 -0
  25. package/dist/plugins/flow/ui/assets/index-DJP9DbPL.js +48 -0
  26. package/dist/plugins/flow/ui/assets/index-H7g-xvR-.css +1 -0
  27. package/dist/plugins/flow/ui/index.html +2 -2
  28. package/dist/plugins/schema/SchemaParser.d.ts +12 -1
  29. package/dist/plugins/schema/SchemaParser.d.ts.map +1 -1
  30. package/dist/plugins/schema/SchemaParser.js +14 -0
  31. package/dist/plugins/schema/schemaSelectionGraph.d.ts +34 -0
  32. package/dist/plugins/schema/schemaSelectionGraph.d.ts.map +1 -0
  33. package/dist/plugins/schema/schemaSelectionGraph.js +77 -0
  34. package/dist/plugins/schema/ui/assets/index-BHwyhVGF.js +70 -0
  35. package/dist/plugins/schema/ui/assets/index-Cp1nVgsx.css +1 -0
  36. package/dist/plugins/schema/ui/index.html +2 -2
  37. package/dist/shared/bootstrap/createPluginApp.d.ts +14 -0
  38. package/dist/shared/bootstrap/createPluginApp.d.ts.map +1 -1
  39. package/dist/shared/bootstrap/createPluginApp.js +4 -0
  40. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts +9 -1
  41. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.d.ts.map +1 -1
  42. package/dist/shared/uem/ui/components/UEMVisualization/UEMVisualization.js +55 -30
  43. package/dist/shared/utils/uemTreeUtils.d.ts +33 -3
  44. package/dist/shared/utils/uemTreeUtils.d.ts.map +1 -1
  45. package/dist/shared/utils/uemTreeUtils.js +82 -5
  46. package/package.json +3 -3
  47. package/dist/plugins/agent/ui/assets/index-CTzSDPPx.css +0 -1
  48. package/dist/plugins/agent/ui/assets/index-D0wb9GBs.js +0 -71
  49. package/dist/plugins/flexipage/ui/assets/index-DT5lcUwK.js +0 -48
  50. package/dist/plugins/flexipage/ui/assets/index-U3SB2gLS.css +0 -1
  51. package/dist/plugins/flow/ui/assets/index-Cb-x8fUq.css +0 -1
  52. package/dist/plugins/flow/ui/assets/index-DDfQ7eDI.js +0 -48
  53. package/dist/plugins/schema/ui/assets/index-DCLgZby3.css +0 -1
  54. package/dist/plugins/schema/ui/assets/index-jqcasNAD.js +0 -70
@@ -13,7 +13,7 @@
13
13
  * categorized Toolbox resources, Start configuration, and 264 canvas groups.
14
14
  * Layout/collapse are the renderer's concern; this stays a pure XML → model map.
15
15
  */
16
- import { IMetadataParser, IPlatformContext, MetadataFileInfo, VersionInfo } from '@salesforce/metadata-core-sdk';
16
+ import { IMetadataParser, IPlatformContext, MetadataFileInfo, VersionInfo, type SelectableNode } from '@salesforce/metadata-core-sdk';
17
17
  import { FlowModel } from './types/FlowData.js';
18
18
  export declare class FlowParser implements IMetadataParser<FlowModel> {
19
19
  private context?;
@@ -32,5 +32,12 @@ export declare class FlowParser implements IMetadataParser<FlowModel> {
32
32
  * `data.label`, so we can return it without re-reading the file.
33
33
  */
34
34
  extractMetadataInfo(data: FlowModel): MetadataFileInfo | null;
35
+ /**
36
+ * Vibe-edit contribution: project the parsed flow into normalized selectable
37
+ * nodes (elements + Orchestrator stage steps). Delegates entirely to the pure
38
+ * `flowSelectionGraph` module so the ids emitted here stay byte-identical to
39
+ * the `data-mv-id`s the canvas cards render.
40
+ */
41
+ getSelectableNodes(data: FlowModel): SelectableNode[];
35
42
  }
36
43
  //# sourceMappingURL=FlowParser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowParser.d.ts","sourceRoot":"","sources":["../../../src/plugins/flow/FlowParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;GAQG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAGhB,gBAAgB,EAEhB,WAAW,EAGZ,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAIL,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAuB7B,qBAAa,UAAW,YAAW,eAAe,CAAC,SAAS,CAAC;IAC3D,OAAO,CAAC,OAAO,CAAC,CAAmB;IACnC,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,SAAS,CAAC,CAAa;IAE/B,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAM7C,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAuF3E,QAAQ,CAAC,KAAK,EAAE,SAAS;;;;;IAOzB;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,IAAI;CAI9D"}
1
+ {"version":3,"file":"FlowParser.d.ts","sourceRoot":"","sources":["../../../src/plugins/flow/FlowParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;GAQG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAGhB,gBAAgB,EAEhB,WAAW,EAGX,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAIL,SAAS,EAGV,MAAM,qBAAqB,CAAC;AAuB7B,qBAAa,UAAW,YAAW,eAAe,CAAC,SAAS,CAAC;IAC3D,OAAO,CAAC,OAAO,CAAC,CAAmB;IACnC,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,SAAS,CAAC,CAAa;IAE/B,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAM7C,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAuF3E,QAAQ,CAAC,KAAK,EAAE,SAAS;;;;;IAOzB;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,gBAAgB,GAAG,IAAI;IAK7D;;;;;OAKG;IACH,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE;CAGtD"}
@@ -14,6 +14,7 @@
14
14
  * Layout/collapse are the renderer's concern; this stays a pure XML → model map.
15
15
  */
16
16
  import { SalesforceXMLParser, ErrorBuilder, ErrorCategory, } from '@salesforce/metadata-core-sdk';
17
+ import { flowSelectableNodes } from './flowSelectionGraph.js';
17
18
  import { isPluginError } from '../../shared/utils/isPluginError.js';
18
19
  import { FLOW_END, FLOW_START } from './parser/flowLabels.js';
19
20
  import { arr, bool, num, str } from './parser/xmlPrimitives.js';
@@ -115,6 +116,15 @@ export class FlowParser {
115
116
  const label = typeof data.label === 'string' ? data.label.trim() : '';
116
117
  return label ? { label } : null;
117
118
  }
119
+ /**
120
+ * Vibe-edit contribution: project the parsed flow into normalized selectable
121
+ * nodes (elements + Orchestrator stage steps). Delegates entirely to the pure
122
+ * `flowSelectionGraph` module so the ids emitted here stay byte-identical to
123
+ * the `data-mv-id`s the canvas cards render.
124
+ */
125
+ getSelectableNodes(data) {
126
+ return flowSelectableNodes(data);
127
+ }
118
128
  }
119
129
  function buildModel(source, filePath, versionInfo) {
120
130
  const parser = new SalesforceXMLParser();
@@ -0,0 +1,71 @@
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
+ /**
8
+ * Flow SelectionGraph (C1) — the plugin's ENTIRE vibe-edit contribution.
9
+ *
10
+ * One forward projection of the parsed `FlowModel` into the normalized
11
+ * `SelectableNode` contract. Because a Flow element's `id` is already its
12
+ * globally-unique API name (`<name>` in the `.flow-meta.xml`), we reuse it
13
+ * VERBATIM as the SelectableNode id — no `structuralId` needed for elements.
14
+ * The id the parser emits here and the id the canvas cards render as
15
+ * `data-mv-id` are therefore identical BY CONSTRUCTION, so the generic core-sdk
16
+ * engine resolves a selected element by a pure `Map.get(id)` — no per-element
17
+ * buildContext, no inverse resolver, no descriptor.
18
+ *
19
+ * The only derived id is for a Flow Orchestrator **stage step** (`<stageSteps>`),
20
+ * which has no standalone element id: it is keyed deterministically on
21
+ * `(stageId, stepName)` via the shared `structuralId`, so `flowStepId` gives the
22
+ * same byte-identical id at parse-time (host, DOM-less) and render-time (iframe).
23
+ *
24
+ * What is NOT projected (and correspondingly never stamped in the DOM):
25
+ * - the synthetic `start` / `end` bookends the parser injects (graph
26
+ * terminators, not editable elements); and
27
+ * - the renderer-only `group` summary kind (synthesized by the collapse
28
+ * transform in the view model — the parser never emits it).
29
+ */
30
+ import { type SelectableNode } from '@salesforce/metadata-core-sdk';
31
+ import type { FlowModel } from './types/FlowData.js';
32
+ /**
33
+ * Deterministic id for a Flow Orchestrator stage step. Stage steps have no
34
+ * standalone API name at the element level, so their id is derived from the
35
+ * owning stage's (already unique) id plus the step's `<name>`. StageCard renders
36
+ * each step row with this exact id as `data-mv-id`.
37
+ */
38
+ export declare function flowStepId(stageId: string, stepName: string): string;
39
+ /**
40
+ * The synthetic group key used for the leading "Properties" block (Label / API
41
+ * Name / Description) that every element inspector shows. It is NOT one of the
42
+ * parser's `details` groups — it's rendered directly by `PropertiesGroup` — so
43
+ * it gets a fixed key here that both the projection and the sidebar agree on.
44
+ */
45
+ export declare const FLOW_PROPERTIES_GROUP_KEY = "Properties";
46
+ /**
47
+ * Deterministic id for one label/value ROW inside an element's inspector panel
48
+ * (a Properties row or a detail-group row). Sidebar rows have no standalone API
49
+ * name, so — exactly like a stage step — the id is derived from the owning
50
+ * element's id plus the row's coordinates within the panel:
51
+ *
52
+ * - `groupKey` identifies the containing block. For the leading Properties
53
+ * block it is {@link FLOW_PROPERTIES_GROUP_KEY}; for a detail group it is
54
+ * `"<groupIndex>:<groupTitle>"` so duplicate group titles can't collide.
55
+ * - `rowLabel` the row's left-column label ("Object", "API Name", …).
56
+ * - `index` the row's position within its group, disambiguating rows that
57
+ * share a label.
58
+ *
59
+ * The sidebar renders each row with this exact id as `data-mv-id`, so the
60
+ * engine's `Map.get(id)` inversion resolves a clicked row to this projected
61
+ * node. Host (DOM-less) and render (iframe) compute byte-identical ids.
62
+ */
63
+ export declare function flowRowId(elementId: string, groupKey: string, rowLabel: string, index: number): string;
64
+ /**
65
+ * Emit the full Flow SelectionGraph. Used by `FlowParser.getSelectableNodes()`
66
+ * (host-side) and — because element ids are the elements' own API names and
67
+ * step ids are identity-derived — matched exactly by the ids the canvas cards
68
+ * render as `data-mv-id`.
69
+ */
70
+ export declare function flowSelectableNodes(data: FlowModel): SelectableNode[];
71
+ //# sourceMappingURL=flowSelectionGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowSelectionGraph.d.ts","sourceRoot":"","sources":["../../../src/plugins/flow/flowSelectionGraph.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,qBAAqB,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,eAAe,CAAC;AAEtD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAER;AAyID;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,CAKrE"}
@@ -0,0 +1,196 @@
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
+ /**
8
+ * Flow SelectionGraph (C1) — the plugin's ENTIRE vibe-edit contribution.
9
+ *
10
+ * One forward projection of the parsed `FlowModel` into the normalized
11
+ * `SelectableNode` contract. Because a Flow element's `id` is already its
12
+ * globally-unique API name (`<name>` in the `.flow-meta.xml`), we reuse it
13
+ * VERBATIM as the SelectableNode id — no `structuralId` needed for elements.
14
+ * The id the parser emits here and the id the canvas cards render as
15
+ * `data-mv-id` are therefore identical BY CONSTRUCTION, so the generic core-sdk
16
+ * engine resolves a selected element by a pure `Map.get(id)` — no per-element
17
+ * buildContext, no inverse resolver, no descriptor.
18
+ *
19
+ * The only derived id is for a Flow Orchestrator **stage step** (`<stageSteps>`),
20
+ * which has no standalone element id: it is keyed deterministically on
21
+ * `(stageId, stepName)` via the shared `structuralId`, so `flowStepId` gives the
22
+ * same byte-identical id at parse-time (host, DOM-less) and render-time (iframe).
23
+ *
24
+ * What is NOT projected (and correspondingly never stamped in the DOM):
25
+ * - the synthetic `start` / `end` bookends the parser injects (graph
26
+ * terminators, not editable elements); and
27
+ * - the renderer-only `group` summary kind (synthesized by the collapse
28
+ * transform in the view model — the parser never emits it).
29
+ */
30
+ import { structuralId } from '@salesforce/metadata-core-sdk';
31
+ /**
32
+ * Deterministic id for a Flow Orchestrator stage step. Stage steps have no
33
+ * standalone API name at the element level, so their id is derived from the
34
+ * owning stage's (already unique) id plus the step's `<name>`. StageCard renders
35
+ * each step row with this exact id as `data-mv-id`.
36
+ */
37
+ export function flowStepId(stageId, stepName) {
38
+ return structuralId(stageId, 'step', stepName);
39
+ }
40
+ /**
41
+ * The synthetic group key used for the leading "Properties" block (Label / API
42
+ * Name / Description) that every element inspector shows. It is NOT one of the
43
+ * parser's `details` groups — it's rendered directly by `PropertiesGroup` — so
44
+ * it gets a fixed key here that both the projection and the sidebar agree on.
45
+ */
46
+ export const FLOW_PROPERTIES_GROUP_KEY = 'Properties';
47
+ /**
48
+ * Deterministic id for one label/value ROW inside an element's inspector panel
49
+ * (a Properties row or a detail-group row). Sidebar rows have no standalone API
50
+ * name, so — exactly like a stage step — the id is derived from the owning
51
+ * element's id plus the row's coordinates within the panel:
52
+ *
53
+ * - `groupKey` identifies the containing block. For the leading Properties
54
+ * block it is {@link FLOW_PROPERTIES_GROUP_KEY}; for a detail group it is
55
+ * `"<groupIndex>:<groupTitle>"` so duplicate group titles can't collide.
56
+ * - `rowLabel` the row's left-column label ("Object", "API Name", …).
57
+ * - `index` the row's position within its group, disambiguating rows that
58
+ * share a label.
59
+ *
60
+ * The sidebar renders each row with this exact id as `data-mv-id`, so the
61
+ * engine's `Map.get(id)` inversion resolves a clicked row to this projected
62
+ * node. Host (DOM-less) and render (iframe) compute byte-identical ids.
63
+ */
64
+ export function flowRowId(elementId, groupKey, rowLabel, index) {
65
+ return structuralId(elementId, 'detail', `${groupKey}::${rowLabel}`, index);
66
+ }
67
+ /**
68
+ * Element kinds that are graph scaffolding rather than editable elements, so
69
+ * they are excluded from the selection graph (and never stamped in the DOM):
70
+ * - `end` — the synthetic terminal bookend the parser injects (a bare glyph
71
+ * with no editable configuration).
72
+ * - `group` — a renderer-only collapsed-group summary node (view model only).
73
+ *
74
+ * NOTE: `start` is intentionally NOT here. The Start element carries real,
75
+ * editable configuration (trigger / entry criteria — see `startDetails`) and
76
+ * Flow Builder treats it as a first-class selectable element, so it IS
77
+ * projected into the graph and stamped in the DOM (its stable `FLOW_START` id).
78
+ */
79
+ const NON_SELECTABLE_KINDS = new Set(['end', 'group']);
80
+ /** Salient, JSON-safe attributes surfaced to the agent for one element. */
81
+ function elementAttributes(node) {
82
+ const attributes = {
83
+ label: node.label,
84
+ typeLabel: node.typeLabel,
85
+ };
86
+ if (node.metaTypeLabel) {
87
+ attributes.metaTypeLabel = node.metaTypeLabel;
88
+ }
89
+ if (node.detail) {
90
+ attributes.detail = node.detail;
91
+ }
92
+ if (node.description) {
93
+ attributes.description = node.description;
94
+ }
95
+ if (node.groupId) {
96
+ attributes.groupId = node.groupId;
97
+ }
98
+ return attributes;
99
+ }
100
+ /**
101
+ * Project the element's inspector-panel ROWS into child selectable nodes — one
102
+ * per label/value row the sidebar's `SelectedElement` renders, so each row is
103
+ * individually selectable for vibe-edit (parented to the element).
104
+ *
105
+ * This MIRRORS the render side exactly (DetailGroup.tsx's `PropertiesGroup` +
106
+ * `DetailGroup`), because the sidebar stamps each row with `flowRowId(...)` as
107
+ * its `data-mv-id` and the engine resolves the click by a pure id lookup — the
108
+ * projected id and the rendered id MUST be byte-identical:
109
+ *
110
+ * - the leading "Properties" block: Label (always), API Name (every kind
111
+ * except the synthetic Start bookend, which has no real API name), and
112
+ * Description (only when present); then
113
+ * - every row of every element-specific detail group (`node.details`).
114
+ */
115
+ function elementRowNodes(node, filePath) {
116
+ const rows = [];
117
+ const rowNode = (groupKey, groupTitle, rowLabel, index, value) => ({
118
+ id: flowRowId(node.id, groupKey, rowLabel, index),
119
+ type: 'detail',
120
+ apiName: rowLabel,
121
+ parentId: node.id,
122
+ attributes: {
123
+ group: groupTitle,
124
+ label: rowLabel,
125
+ ...(value ? { value } : {}),
126
+ },
127
+ ...(filePath ? { filePath } : {}),
128
+ });
129
+ // Properties block — the fixed leading group rendered by PropertiesGroup.
130
+ // Labels are distinct within it, so index 0 keeps every id unique.
131
+ rows.push(rowNode(FLOW_PROPERTIES_GROUP_KEY, 'Properties', 'Label', 0, node.label));
132
+ // API Name is shown for every genuine element; the synthetic Start bookend
133
+ // carries a prefixed id that isn't a real API name, so it's omitted there
134
+ // (PropertiesGroup skips it for kind 'group' / 'start'; 'group' never reaches
135
+ // this projection).
136
+ if (node.kind !== 'group' && node.kind !== 'start') {
137
+ rows.push(rowNode(FLOW_PROPERTIES_GROUP_KEY, 'Properties', 'API Name', 0, node.id));
138
+ }
139
+ if (node.description) {
140
+ rows.push(rowNode(FLOW_PROPERTIES_GROUP_KEY, 'Properties', 'Description', 0, node.description));
141
+ }
142
+ // Element-specific detail groups. The group key carries the group's INDEX so
143
+ // duplicate group titles (e.g. two "Outcome: …" decision groups) can't
144
+ // collide; the row index disambiguates rows sharing a label within a group.
145
+ (node.details ?? []).forEach((group, gi) => {
146
+ const groupKey = `${gi}:${group.title}`;
147
+ (group.rows ?? []).forEach((row, i) => {
148
+ rows.push(rowNode(groupKey, group.title, row.label, i, row.value));
149
+ });
150
+ });
151
+ return rows;
152
+ }
153
+ /** Project one element (+ its inspector rows and stage steps) into selectable nodes. */
154
+ function elementToNodes(node, filePath) {
155
+ const element = {
156
+ id: node.id,
157
+ type: node.kind,
158
+ apiName: node.id,
159
+ attributes: elementAttributes(node),
160
+ ...(filePath ? { filePath } : {}),
161
+ };
162
+ const rowNodes = elementRowNodes(node, filePath);
163
+ const steps = node.steps ?? [];
164
+ if (steps.length === 0) {
165
+ return [element, ...rowNodes];
166
+ }
167
+ // Flow Orchestrator stage: each `<stageSteps>` row is a child selectable
168
+ // node parented to the stage, mirroring how StageCard renders the rows inside
169
+ // the stage container.
170
+ const stepNodes = steps.map((step) => ({
171
+ id: flowStepId(node.id, step.name),
172
+ type: 'step',
173
+ apiName: step.name,
174
+ parentId: node.id,
175
+ attributes: {
176
+ label: step.label,
177
+ ...(step.actionName ? { actionName: step.actionName } : {}),
178
+ ...(step.actionType ? { actionType: step.actionType } : {}),
179
+ ...(step.stepSubtype ? { stepSubtype: step.stepSubtype } : {}),
180
+ },
181
+ ...(filePath ? { filePath } : {}),
182
+ }));
183
+ return [element, ...rowNodes, ...stepNodes];
184
+ }
185
+ /**
186
+ * Emit the full Flow SelectionGraph. Used by `FlowParser.getSelectableNodes()`
187
+ * (host-side) and — because element ids are the elements' own API names and
188
+ * step ids are identity-derived — matched exactly by the ids the canvas cards
189
+ * render as `data-mv-id`.
190
+ */
191
+ export function flowSelectableNodes(data) {
192
+ const filePath = data.sourcePath || undefined;
193
+ return data.nodes
194
+ .filter((node) => !NON_SELECTABLE_KINDS.has(node.kind))
195
+ .flatMap((node) => elementToNodes(node, filePath));
196
+ }