@salesforce/metadata-plugins 1.9.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 (51) 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/AgentParser.d.ts.map +1 -1
  5. package/dist/plugins/agent/AgentParser.js +70 -27
  6. package/dist/plugins/agent/ui/assets/index-BpnirPMA.js +71 -0
  7. package/dist/plugins/agent/ui/index.html +1 -1
  8. package/dist/plugins/flexipage/ui/assets/index-DJj6fJsw.js +48 -0
  9. package/dist/plugins/flexipage/ui/index.html +1 -1
  10. package/dist/plugins/flow/ui/assets/index-B-Cn56iR.js +48 -0
  11. package/dist/plugins/flow/ui/index.html +1 -1
  12. package/dist/plugins/flowintent/FlowIntentParser.d.ts +56 -0
  13. package/dist/plugins/flowintent/FlowIntentParser.d.ts.map +1 -0
  14. package/dist/plugins/flowintent/FlowIntentParser.js +144 -0
  15. package/dist/plugins/flowintent/FlowIntentVisualizer.d.ts +41 -0
  16. package/dist/plugins/flowintent/FlowIntentVisualizer.d.ts.map +1 -0
  17. package/dist/plugins/flowintent/FlowIntentVisualizer.js +43 -0
  18. package/dist/plugins/flowintent/types/IntentFlow.d.ts +139 -0
  19. package/dist/plugins/flowintent/types/IntentFlow.d.ts.map +1 -0
  20. package/dist/plugins/flowintent/types/IntentFlow.js +89 -0
  21. package/dist/plugins/flowintent/types/analyzeFlowBuilderGraph.d.ts +42 -0
  22. package/dist/plugins/flowintent/types/analyzeFlowBuilderGraph.d.ts.map +1 -0
  23. package/dist/plugins/flowintent/types/analyzeFlowBuilderGraph.js +226 -0
  24. package/dist/plugins/flowintent/types/analyzeIntentFlowGraph.d.ts +27 -0
  25. package/dist/plugins/flowintent/types/analyzeIntentFlowGraph.d.ts.map +1 -0
  26. package/dist/plugins/flowintent/types/analyzeIntentFlowGraph.js +80 -0
  27. package/dist/plugins/flowintent/types/index.d.ts +17 -0
  28. package/dist/plugins/flowintent/types/index.d.ts.map +1 -0
  29. package/dist/plugins/flowintent/types/index.js +16 -0
  30. package/dist/plugins/flowintent/types/validateIntentFlow.d.ts +32 -0
  31. package/dist/plugins/flowintent/types/validateIntentFlow.d.ts.map +1 -0
  32. package/dist/plugins/flowintent/types/validateIntentFlow.js +438 -0
  33. package/dist/plugins/flowintent/ui/assets/index-BkuUZejF.js +48 -0
  34. package/dist/plugins/flowintent/ui/assets/index-Di3MtBl5.css +1 -0
  35. package/dist/plugins/flowintent/ui/index.html +18 -0
  36. package/dist/plugins/permissionset/ui/assets/index-BCcTde0G.js +48 -0
  37. package/dist/plugins/permissionset/ui/index.html +1 -1
  38. package/dist/plugins/schema/ui/assets/index-BBcLTTbn.js +70 -0
  39. package/dist/plugins/schema/ui/index.html +1 -1
  40. package/dist/shared/bootstrap/createPluginApp.d.ts +14 -10
  41. package/dist/shared/bootstrap/createPluginApp.d.ts.map +1 -1
  42. package/dist/shared/bootstrap/createPluginApp.js +78 -17
  43. package/dist/shared/components/FlowIcons.d.ts +107 -0
  44. package/dist/shared/components/FlowIcons.d.ts.map +1 -0
  45. package/dist/shared/components/FlowIcons.js +243 -0
  46. package/package.json +4 -4
  47. package/dist/plugins/agent/ui/assets/index-C_Q6Mc2L.js +0 -71
  48. package/dist/plugins/flexipage/ui/assets/index-CuJYcAx_.js +0 -48
  49. package/dist/plugins/flow/ui/assets/index-OhJU6yxp.js +0 -48
  50. package/dist/plugins/permissionset/ui/assets/index-CMInRbR2.js +0 -48
  51. package/dist/plugins/schema/ui/assets/index-CWvLR0Fz.js +0 -70
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Salesforce Flow Visualizer</title>
7
- <script type="module" crossorigin src="./assets/index-OhJU6yxp.js"></script>
7
+ <script type="module" crossorigin src="./assets/index-B-Cn56iR.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="./assets/index-H7g-xvR-.css">
9
9
  <link rel="stylesheet" href="@dist/design-system/platform.css" data-platform-styles="true">
10
10
  </head>
@@ -0,0 +1,56 @@
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
+ * Parser for Flow Jam intent payloads.
9
+ *
10
+ * The FlowIntent plugin is payload-only: it is selected by `pluginId` through
11
+ * the framework's `getVisualizerPluginById` and rendered via `visualizeData`,
12
+ * which routes the typed payload to `parseContent`. The payload is validated
13
+ * with `assertIntentFlow` from `./types` (the single source of truth for the
14
+ * IntentFlow contract). Callers that reach this parser through a file-path
15
+ * entry point hit the throwing `parse` stub — the plugin does not participate
16
+ * in filename-based selection.
17
+ */
18
+ import { IMetadataParser, IPlatformContext, ValidationResult } from '@salesforce/metadata-core-sdk';
19
+ import { type FlowIntentViewData } from './types/index.js';
20
+ export declare class FlowIntentParser implements IMetadataParser<FlowIntentViewData> {
21
+ private logger?;
22
+ private telemetry;
23
+ /**
24
+ * Store platform services for later use. Called by the visualizer during
25
+ * `initialize()`. The FlowIntent parse path is pure (payload in, typed data
26
+ * out) so the context is only used for logging, mirroring `FlowParser`.
27
+ */
28
+ setPlatformContext(context: IPlatformContext): void;
29
+ /**
30
+ * Assert a raw payload against the IntentFlow contract and return the typed
31
+ * value. Sole parse entry point for the plugin — the framework's
32
+ * `visualizeData(raw, 'flowintent')` hands the typed payload here. The
33
+ * contract validator (`assertIntentFlow`) enforces structural shape,
34
+ * referential integrity of edge/group refs, and id uniqueness, throwing with
35
+ * every problem enumerated.
36
+ */
37
+ parseContent(raw: unknown): Promise<FlowIntentViewData>;
38
+ /**
39
+ * File-path entry point required by {@link IMetadataParser}. The FlowIntent
40
+ * plugin is payload-only and never participates in filename-based selection,
41
+ * so this always throws — call `visualizeData` with the typed payload
42
+ * instead. Kept so the class satisfies the framework's registration
43
+ * signature; a clear error beats a silent misroute if some future caller
44
+ * hits `visualize()` on this plugin.
45
+ */
46
+ parse(_filePath: string): Promise<FlowIntentViewData>;
47
+ /**
48
+ * Optional framework validation hook. The engine calls this after parsing
49
+ * and throws if `valid` is false. `parseContent` already asserts, so by the
50
+ * time the engine has a value this passes; it is here to map the vendored
51
+ * validator's rich error objects onto the framework's `string[]`
52
+ * {@link ValidationResult} shape.
53
+ */
54
+ validate(data: FlowIntentViewData): ValidationResult;
55
+ }
56
+ //# sourceMappingURL=FlowIntentParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowIntentParser.d.ts","sourceRoot":"","sources":["../../../src/plugins/flowintent/FlowIntentParser.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;GAUG;AAEH,OAAO,EACL,eAAe,EACf,gBAAgB,EAIhB,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AA4C1B,qBAAa,gBAAiB,YAAW,eAAe,CAAC,kBAAkB,CAAC;IAC1E,OAAO,CAAC,MAAM,CAAC,CAAU;IACzB,OAAO,CAAC,SAAS,CAAmC;IAEpD;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAKnD;;;;;;;OAOG;IACG,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoD7D;;;;;;;OAOG;IACG,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI3D;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,gBAAgB;CAWrD"}
@@ -0,0 +1,144 @@
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
+ * Parser for Flow Jam intent payloads.
9
+ *
10
+ * The FlowIntent plugin is payload-only: it is selected by `pluginId` through
11
+ * the framework's `getVisualizerPluginById` and rendered via `visualizeData`,
12
+ * which routes the typed payload to `parseContent`. The payload is validated
13
+ * with `assertIntentFlow` from `./types` (the single source of truth for the
14
+ * IntentFlow contract). Callers that reach this parser through a file-path
15
+ * entry point hit the throwing `parse` stub — the plugin does not participate
16
+ * in filename-based selection.
17
+ */
18
+ import { NoOpTelemetry, } from '@salesforce/metadata-core-sdk';
19
+ import { assertIntentFlow, IntentFlowValidationFailure, isFlowIntentEmptyStateData, validateIntentFlow, } from './types/index.js';
20
+ const PLUGIN_ID = 'flowintent';
21
+ const UNEXPECTED_ERROR_CODE = 'UNEXPECTED_ERROR';
22
+ function formatIssue(issue) {
23
+ return `${issue.path || '(root)'}: ${issue.message}`;
24
+ }
25
+ /**
26
+ * Project validated input into the exact supported contract. The command host
27
+ * already detached the caller-owned object; this second boundary strips unknown
28
+ * fields and ensures the active render retains only canonical plugin data.
29
+ */
30
+ function canonicalizeIntentFlow(flow) {
31
+ return {
32
+ flowLabel: flow.flowLabel,
33
+ ...(flow.flowDescription === undefined ? {} : { flowDescription: flow.flowDescription }),
34
+ ...(flow.flowType === undefined ? {} : { flowType: flow.flowType }),
35
+ ...(flow.intentSummary === undefined ? {} : { intentSummary: [...flow.intentSummary] }),
36
+ nodes: flow.nodes.map((node) => ({
37
+ id: node.id,
38
+ label: node.label,
39
+ type: node.type,
40
+ ...(node.intent === undefined ? {} : { intent: node.intent }),
41
+ })),
42
+ edges: flow.edges.map((edge) => ({
43
+ from: edge.from,
44
+ to: edge.to,
45
+ ...(edge.label === undefined ? {} : { label: edge.label }),
46
+ ...(edge.kind === undefined ? {} : { kind: edge.kind }),
47
+ })),
48
+ ...(flow.groups === undefined
49
+ ? {}
50
+ : {
51
+ groups: flow.groups.map((group) => ({
52
+ id: group.id,
53
+ description: group.description,
54
+ memberNodeIds: [...group.memberNodeIds],
55
+ })),
56
+ }),
57
+ };
58
+ }
59
+ export class FlowIntentParser {
60
+ constructor() {
61
+ this.telemetry = new NoOpTelemetry();
62
+ }
63
+ /**
64
+ * Store platform services for later use. Called by the visualizer during
65
+ * `initialize()`. The FlowIntent parse path is pure (payload in, typed data
66
+ * out) so the context is only used for logging, mirroring `FlowParser`.
67
+ */
68
+ setPlatformContext(context) {
69
+ this.logger = context.logger.createChild('FlowIntentParser');
70
+ this.telemetry = context.telemetry.createChild({ component: 'FlowIntentParser' });
71
+ }
72
+ /**
73
+ * Assert a raw payload against the IntentFlow contract and return the typed
74
+ * value. Sole parse entry point for the plugin — the framework's
75
+ * `visualizeData(raw, 'flowintent')` hands the typed payload here. The
76
+ * contract validator (`assertIntentFlow`) enforces structural shape,
77
+ * referential integrity of edge/group refs, and id uniqueness, throwing with
78
+ * every problem enumerated.
79
+ */
80
+ async parseContent(raw) {
81
+ const telemetry = this.telemetry;
82
+ return telemetry.withSpan('flowintent.parse', async (span) => {
83
+ try {
84
+ if (isFlowIntentEmptyStateData(raw)) {
85
+ span.setAttribute('viewState', 'empty');
86
+ telemetry.sendEvent('flowintent.parse_complete', {
87
+ pluginId: PLUGIN_ID,
88
+ viewState: 'empty',
89
+ });
90
+ this.logger?.info('Parsed empty FlowIntent view state.');
91
+ return { viewState: 'empty' };
92
+ }
93
+ const flow = canonicalizeIntentFlow(assertIntentFlow(raw));
94
+ span.setAttribute('nodeCount', flow.nodes.length);
95
+ span.setAttribute('edgeCount', flow.edges.length);
96
+ telemetry.sendEvent('flowintent.parse_complete', { pluginId: PLUGIN_ID }, { nodeCount: flow.nodes.length, edgeCount: flow.edges.length });
97
+ this.logger?.info(`Parsed intent payload (${flow.nodes.length} nodes, ${flow.edges.length} edges).`);
98
+ return flow;
99
+ }
100
+ catch (error) {
101
+ const validationCodes = error instanceof IntentFlowValidationFailure
102
+ ? error.codes.join(',')
103
+ : UNEXPECTED_ERROR_CODE;
104
+ const validationErrorCount = error instanceof IntentFlowValidationFailure ? error.errorCount : 1;
105
+ // Attach content-free diagnostics before rethrowing. `withSpan` sees
106
+ // and records only the generic error below, never payload-derived
107
+ // paths, messages, labels, or identifiers.
108
+ span.setAttribute('validationCodes', validationCodes);
109
+ span.setAttribute('validationErrorCount', validationErrorCount);
110
+ telemetry.sendEvent('flowintent.parse_error', { pluginId: PLUGIN_ID, validationCodes }, { validationErrorCount });
111
+ throw new Error('Invalid IntentFlow payload.');
112
+ }
113
+ }, { pluginId: PLUGIN_ID });
114
+ }
115
+ /**
116
+ * File-path entry point required by {@link IMetadataParser}. The FlowIntent
117
+ * plugin is payload-only and never participates in filename-based selection,
118
+ * so this always throws — call `visualizeData` with the typed payload
119
+ * instead. Kept so the class satisfies the framework's registration
120
+ * signature; a clear error beats a silent misroute if some future caller
121
+ * hits `visualize()` on this plugin.
122
+ */
123
+ async parse(_filePath) {
124
+ throw new Error('FlowIntent is payload-only; invoke via the by-id in-memory path');
125
+ }
126
+ /**
127
+ * Optional framework validation hook. The engine calls this after parsing
128
+ * and throws if `valid` is false. `parseContent` already asserts, so by the
129
+ * time the engine has a value this passes; it is here to map the vendored
130
+ * validator's rich error objects onto the framework's `string[]`
131
+ * {@link ValidationResult} shape.
132
+ */
133
+ validate(data) {
134
+ if (isFlowIntentEmptyStateData(data)) {
135
+ return { valid: true, errors: [], warnings: [] };
136
+ }
137
+ const result = validateIntentFlow(data);
138
+ return {
139
+ valid: result.valid,
140
+ errors: result.errors.map(formatIssue),
141
+ warnings: result.warnings.map(formatIssue),
142
+ };
143
+ }
144
+ }
@@ -0,0 +1,41 @@
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 Intent Visualizer Plugin
9
+ *
10
+ * Renders a typed Flow Jam `IntentFlow` payload as an intent-flow diagram
11
+ * (start → decisions/branches/loops → end, with grouped follow-up actions).
12
+ *
13
+ * Unlike the other plugins, FlowIntent is **payload-only**: it is never selected
14
+ * by file path. The Flow Jam host already holds the structured payload and pushes
15
+ * it in-memory via `sf.metadata.viz.showVisualizerData`, which the framework routes
16
+ * through `getVisualizerPluginById('flowintent')` → `visualizeData(raw, pluginId)` →
17
+ * the parser's `parseContent`. Accordingly the metadata declares honest
18
+ * `filePatterns: []` + `payloadOnly: true` (which exempts it from the framework's
19
+ * non-empty-`filePatterns` requirement), and `canHandle()` always returns `false`.
20
+ * The UI is a Vite-built React app under `ui/` (auto-detected by the framework); there
21
+ * is no `renderer` property.
22
+ */
23
+ import { IVisualizationPlugin, MetadataPluginInfo, IPlatformContext } from '@salesforce/metadata-core-sdk';
24
+ import { FlowIntentViewData } from './types/index.js';
25
+ import { FlowIntentParser } from './FlowIntentParser.js';
26
+ export declare class FlowIntentVisualizer implements IVisualizationPlugin<FlowIntentViewData> {
27
+ private readonly pluginMetadata;
28
+ readonly parser: FlowIntentParser;
29
+ private logger?;
30
+ constructor();
31
+ getMetadataPluginInfo(): MetadataPluginInfo;
32
+ /**
33
+ * FlowIntent is payload-only — reached only by id via `visualizeData`, never by
34
+ * file path — so this always returns `false` (belt-and-suspenders with
35
+ * `payloadOnly: true`, which already opts the plugin out of file selection).
36
+ */
37
+ canHandle(_filePath: string): boolean;
38
+ initialize(context: IPlatformContext): Promise<void>;
39
+ dispose?(): void;
40
+ }
41
+ //# sourceMappingURL=FlowIntentVisualizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FlowIntentVisualizer.d.ts","sourceRoot":"","sources":["../../../src/plugins/flowintent/FlowIntentVisualizer.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAyB,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,qBAAa,oBAAqB,YAAW,oBAAoB,CAAC,kBAAkB,CAAC;IACnF,OAAO,CAAC,QAAQ,CAAC,cAAc,CAW7B;IAEF,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC,OAAO,CAAC,MAAM,CAAC,CAAU;;IAMzB,qBAAqB,IAAI,kBAAkB;IAI3C;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI/B,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1D,OAAO,CAAC,IAAI,IAAI;CAGjB"}
@@ -0,0 +1,43 @@
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_INTENT_PLUGIN_ID } from './types/index.js';
8
+ import { FlowIntentParser } from './FlowIntentParser.js';
9
+ export class FlowIntentVisualizer {
10
+ constructor() {
11
+ this.pluginMetadata = {
12
+ id: FLOW_INTENT_PLUGIN_ID,
13
+ name: 'Flow Intent Visualizer',
14
+ displayName: 'Flow Intent (Pilot)',
15
+ description: 'Interactive diagram of a Flow Jam intent payload (pushed in-memory, not read from disk)',
16
+ author: 'Agentic Flow Authoring Team',
17
+ filePatterns: [],
18
+ defaultEnabled: false,
19
+ payloadOnly: true,
20
+ priority: 10,
21
+ };
22
+ this.parser = new FlowIntentParser();
23
+ }
24
+ getMetadataPluginInfo() {
25
+ return this.pluginMetadata;
26
+ }
27
+ /**
28
+ * FlowIntent is payload-only — reached only by id via `visualizeData`, never by
29
+ * file path — so this always returns `false` (belt-and-suspenders with
30
+ * `payloadOnly: true`, which already opts the plugin out of file selection).
31
+ */
32
+ canHandle(_filePath) {
33
+ return false;
34
+ }
35
+ async initialize(context) {
36
+ this.logger = context.logger.createChild(this.getMetadataPluginInfo().id);
37
+ this.logger.info('Flow Intent visualizer initialized');
38
+ this.parser.setPlatformContext(context);
39
+ }
40
+ dispose() {
41
+ this.logger?.info(`Disposing ${this.getMetadataPluginInfo().name}`);
42
+ }
43
+ }
@@ -0,0 +1,139 @@
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
+ * IntentFlow — the typed contract for FlowJam intent charts.
9
+ *
10
+ * Authoritative structured data emitted at the source (the agent's
11
+ * `sfdc_flow__preview_intent` tool call) and **never** parsed back out of
12
+ * Mermaid.
13
+ *
14
+ * The producer and consumer currently carry separate pilot-era shapes:
15
+ * - the Flow Jam host (`salesforcedx-vscode-flow-jam`) receives it as
16
+ * `PreviewIntentArgs` from the tool call and hands it to the visualizer
17
+ * in-memory via `sf.metadata.viz.showVisualizerData`;
18
+ * - the "Flow Intent" visualizer plugin (this package) validates that typed
19
+ * payload and renders a read-only diagram.
20
+ *
21
+ * The producer intentionally emits a narrower subset (for example, it does not
22
+ * currently author groups), while this consumer enforces additional runtime
23
+ * constraints such as non-empty strings and reference uniqueness. The gated
24
+ * pilot accepts that boundary; a publishable shared contract is a mandatory GA
25
+ * exit criterion. The `./index` barrel is the single future migration point.
26
+ *
27
+ * Tracking: @W-23729683@
28
+ */
29
+ /**
30
+ * Plugin id for the `salesforce-metadata-plugins` FlowIntent visualizer plugin.
31
+ * Consumed by `FlowIntentVisualizer`'s metadata `id` and by the flow-jam host
32
+ * when invoking `sf.metadata.viz.showVisualizerData`. The host currently keeps
33
+ * its own literal and each repository pins the expected value in a local test;
34
+ * those tests protect this identifier only, not the full payload contract.
35
+ */
36
+ export declare const FLOW_INTENT_PLUGIN_ID = "flowintent";
37
+ /** Salesforce Flow type — categorises how a Flow is triggered / executed. */
38
+ export type FlowType = 'Screen' | 'AutoLaunched' | 'RecordTriggered' | 'Scheduled';
39
+ /** Runtime list of valid {@link FlowType} values (single source of truth for the validator + schema). */
40
+ export declare const FLOW_TYPES: readonly ["Screen", "AutoLaunched", "RecordTriggered", "Scheduled"];
41
+ /** Visual node type — drives the diagram shape (stadium, rectangle, diamond, hexagon). */
42
+ export type IntentNodeType = 'start' | 'process' | 'decision' | 'loop' | 'end';
43
+ /**
44
+ * Runtime list of valid `IntentNodeType` values. Shares one source of truth
45
+ * with the type union above.
46
+ */
47
+ export declare const INTENT_NODE_TYPES: readonly ["start", "process", "decision", "loop", "end"];
48
+ /**
49
+ * How one node connects to the next. Absent `kind` is treated as `"sequence"`.
50
+ * - `sequence` — plain next-step flow.
51
+ * - `branch` — a decision outcome; usually carries a `label` (e.g. "Yes"/"No").
52
+ * - `loop-back` — return from a collection body to its earlier ancestor `loop` node.
53
+ * - `fault` — a downstream error/fault path.
54
+ *
55
+ * Sequence, branch, and fault edges form an acyclic forward graph. Collection
56
+ * loop-backs are the only edges permitted to travel to an earlier depth.
57
+ */
58
+ export type EdgeKind = 'sequence' | 'branch' | 'loop-back' | 'fault';
59
+ /** Runtime list of valid {@link EdgeKind} values (single source of truth for the validator + schema). */
60
+ export declare const EDGE_KINDS: readonly ["sequence", "branch", "loop-back", "fault"];
61
+ /** A single node in the flow. */
62
+ export interface IntentFlowNode {
63
+ /** Stable identifier, unique within the flow. Referenced by edges and groups. */
64
+ id: string;
65
+ /** Human-readable node label. */
66
+ label: string;
67
+ /** Visual node type — drives the diagram shape. */
68
+ type: IntentNodeType;
69
+ /** Optional natural-language description of what this node intends to accomplish. */
70
+ intent?: string;
71
+ }
72
+ /** A directed connection between two nodes. */
73
+ export interface IntentFlowEdge {
74
+ /** Source node `id`. Must reference an existing node. */
75
+ from: string;
76
+ /** Target node `id`. Must reference an existing node. */
77
+ to: string;
78
+ /** Optional edge label (e.g. a branch condition like "Yes"/"No"). */
79
+ label?: string;
80
+ /** Optional edge classification; defaults to `"sequence"` when omitted. */
81
+ kind?: EdgeKind;
82
+ }
83
+ /**
84
+ * An explicit grouping of nodes. Makes the grouping rule machine-enforceable
85
+ * instead of implied by layout.
86
+ */
87
+ export interface IntentFlowGroup {
88
+ /** Stable identifier, unique within the flow. */
89
+ id: string;
90
+ /** Human-readable description of what the group represents. */
91
+ description: string;
92
+ /** `id`s of member nodes. Each must reference an existing node. */
93
+ memberNodeIds: string[];
94
+ }
95
+ /**
96
+ * The FlowJam intent chart contract.
97
+ *
98
+ * Nodes **and** edges are typed data. The shape matches what the flow-jam host
99
+ * emits as `PreviewIntentArgs` from the `sfdc_flow__preview_intent` tool call,
100
+ * so the in-memory payload handed to the visualizer is a direct serialization
101
+ * of that tool call.
102
+ */
103
+ export interface IntentFlow {
104
+ /** Human-readable diagram title (the Flow's label). */
105
+ flowLabel: string;
106
+ /** Brief description of the entire flow, suitable as alt text. */
107
+ flowDescription?: string;
108
+ /** Which kind of Salesforce Flow this represents. */
109
+ flowType?: FlowType;
110
+ /**
111
+ * Bulleted, plain-English summary of the flow's overall intent (2–6 short
112
+ * bullets). Independent of any per-node metadata; the visualizer can render
113
+ * this alongside the diagram for users who prefer text over the graph.
114
+ */
115
+ intentSummary?: string[];
116
+ /** Flow nodes, in flow order. */
117
+ nodes: IntentFlowNode[];
118
+ /** Directed connections between nodes. */
119
+ edges: IntentFlowEdge[];
120
+ /** Optional node groupings. */
121
+ groups?: IntentFlowGroup[];
122
+ }
123
+ /**
124
+ * Plugin-owned view state shown before a chat has produced an intent graph.
125
+ * This is deliberately separate from {@link IntentFlow}: an actual flow must
126
+ * still contain a valid, non-empty graph.
127
+ */
128
+ export interface FlowIntentEmptyStateData {
129
+ viewState: 'empty';
130
+ }
131
+ /** Data the FlowIntent plugin can render without changing the IntentFlow contract. */
132
+ export type FlowIntentViewData = IntentFlow | FlowIntentEmptyStateData;
133
+ /**
134
+ * Recognizes only the exact, inert empty-state sentinel. Avoid reading through
135
+ * accessors/proxies and reject arrays, unusual prototypes, symbols, and extra
136
+ * keys so the sentinel cannot become a second loosely-validated payload shape.
137
+ */
138
+ export declare function isFlowIntentEmptyStateData(value: unknown): value is FlowIntentEmptyStateData;
139
+ //# sourceMappingURL=IntentFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntentFlow.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flowintent/types/IntentFlow.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,6EAA6E;AAC7E,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAEnF,yGAAyG;AACzG,eAAO,MAAM,UAAU,qEAKiB,CAAC;AAEzC,0FAA0F;AAC1F,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,iBAAiB,0DAMgB,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,CAAC;AAErE,yGAAyG;AACzG,eAAO,MAAM,UAAU,uDAKiB,CAAC;AAEzC,iCAAiC;AACjC,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,EAAE,cAAc,CAAC;IACrB,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iCAAiC;IACjC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,0CAA0C;IAC1C,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,sFAAsF;AACtF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,wBAAwB,CAAC;AAEvE;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,wBAAwB,CAuB5F"}
@@ -0,0 +1,89 @@
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
+ * IntentFlow — the typed contract for FlowJam intent charts.
9
+ *
10
+ * Authoritative structured data emitted at the source (the agent's
11
+ * `sfdc_flow__preview_intent` tool call) and **never** parsed back out of
12
+ * Mermaid.
13
+ *
14
+ * The producer and consumer currently carry separate pilot-era shapes:
15
+ * - the Flow Jam host (`salesforcedx-vscode-flow-jam`) receives it as
16
+ * `PreviewIntentArgs` from the tool call and hands it to the visualizer
17
+ * in-memory via `sf.metadata.viz.showVisualizerData`;
18
+ * - the "Flow Intent" visualizer plugin (this package) validates that typed
19
+ * payload and renders a read-only diagram.
20
+ *
21
+ * The producer intentionally emits a narrower subset (for example, it does not
22
+ * currently author groups), while this consumer enforces additional runtime
23
+ * constraints such as non-empty strings and reference uniqueness. The gated
24
+ * pilot accepts that boundary; a publishable shared contract is a mandatory GA
25
+ * exit criterion. The `./index` barrel is the single future migration point.
26
+ *
27
+ * Tracking: @W-23729683@
28
+ */
29
+ /**
30
+ * Plugin id for the `salesforce-metadata-plugins` FlowIntent visualizer plugin.
31
+ * Consumed by `FlowIntentVisualizer`'s metadata `id` and by the flow-jam host
32
+ * when invoking `sf.metadata.viz.showVisualizerData`. The host currently keeps
33
+ * its own literal and each repository pins the expected value in a local test;
34
+ * those tests protect this identifier only, not the full payload contract.
35
+ */
36
+ export const FLOW_INTENT_PLUGIN_ID = 'flowintent';
37
+ /** Runtime list of valid {@link FlowType} values (single source of truth for the validator + schema). */
38
+ export const FLOW_TYPES = [
39
+ 'Screen',
40
+ 'AutoLaunched',
41
+ 'RecordTriggered',
42
+ 'Scheduled',
43
+ ];
44
+ /**
45
+ * Runtime list of valid `IntentNodeType` values. Shares one source of truth
46
+ * with the type union above.
47
+ */
48
+ export const INTENT_NODE_TYPES = [
49
+ 'start',
50
+ 'process',
51
+ 'decision',
52
+ 'loop',
53
+ 'end',
54
+ ];
55
+ /** Runtime list of valid {@link EdgeKind} values (single source of truth for the validator + schema). */
56
+ export const EDGE_KINDS = [
57
+ 'sequence',
58
+ 'branch',
59
+ 'loop-back',
60
+ 'fault',
61
+ ];
62
+ /**
63
+ * Recognizes only the exact, inert empty-state sentinel. Avoid reading through
64
+ * accessors/proxies and reject arrays, unusual prototypes, symbols, and extra
65
+ * keys so the sentinel cannot become a second loosely-validated payload shape.
66
+ */
67
+ export function isFlowIntentEmptyStateData(value) {
68
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
69
+ return false;
70
+ }
71
+ try {
72
+ const prototype = Reflect.getPrototypeOf(value);
73
+ if (prototype !== Object.prototype && prototype !== null) {
74
+ return false;
75
+ }
76
+ const keys = Reflect.ownKeys(value);
77
+ if (keys.length !== 1 || keys[0] !== 'viewState') {
78
+ return false;
79
+ }
80
+ const descriptor = Object.getOwnPropertyDescriptor(value, 'viewState');
81
+ return (descriptor !== undefined &&
82
+ descriptor.enumerable === true &&
83
+ 'value' in descriptor &&
84
+ descriptor.value === 'empty');
85
+ }
86
+ catch {
87
+ return false;
88
+ }
89
+ }
@@ -0,0 +1,42 @@
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 type { EdgeKind, IntentFlow, IntentFlowEdge, IntentFlowNode } from './IntentFlow.js';
8
+ export type FlowBuilderPathRole = 'next' | 'start-path' | 'decision-outcome' | 'loop-for-each' | 'loop-after-last' | 'fault' | 'go-to' | 'loop-back';
9
+ export interface IndexedIntentFlowEdge extends IntentFlowEdge {
10
+ index: number;
11
+ kind: EdgeKind;
12
+ }
13
+ export interface FlowBuilderGraphModel {
14
+ nodesById: Map<string, IntentFlowNode>;
15
+ outgoingByNode: Map<string, IndexedIntentFlowEdge[]>;
16
+ incomingByNode: Map<string, IndexedIntentFlowEdge[]>;
17
+ topologicalOrder: string[];
18
+ mergeByBranchingNode: Map<string, string>;
19
+ mergeOwnerByNode: Map<string, string>;
20
+ roleByEdgeIndex: Map<number, FlowBuilderPathRole>;
21
+ /**
22
+ * Edges that terminate one outcome at an enclosing Decision/Start merge.
23
+ * Kept separate from the primary path role because a Loop After Last edge
24
+ * can also be the tail of its enclosing Decision outcome.
25
+ */
26
+ mergeTailEdgeIndexes: Set<number>;
27
+ /** Execution context used internally to recover nested loop and fault regions. */
28
+ contextByNode: Map<string, string>;
29
+ /** Connectors that leave their source's structural execution context. */
30
+ crossContextEdgeIndexes: Set<number>;
31
+ /**
32
+ * Edges painted as part of a fault path, including GoTo connectors that
33
+ * leave the fault's structural context.
34
+ */
35
+ faultPathEdgeIndexes: Set<number>;
36
+ }
37
+ /**
38
+ * Translate flat IntentFlow edges into the path roles used by Flow Builder's
39
+ * structural renderer. This internal model does not alter the payload shape.
40
+ */
41
+ export declare function analyzeFlowBuilderGraph(flow: IntentFlow): FlowBuilderGraphModel;
42
+ //# sourceMappingURL=analyzeFlowBuilderGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyzeFlowBuilderGraph.d.ts","sourceRoot":"","sources":["../../../../src/plugins/flowintent/types/analyzeFlowBuilderGraph.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG5F,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,YAAY,GACZ,kBAAkB,GAClB,eAAe,GACf,iBAAiB,GACjB,OAAO,GACP,OAAO,GACP,WAAW,CAAC;AAEhB,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACrD,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,EAAE,CAAC,CAAC;IACrD,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAClD;;;;OAIG;IACH,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,kFAAkF;IAClF,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,yEAAyE;IACzE,uBAAuB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrC;;;OAGG;IACH,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACnC;AAyDD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,UAAU,GAAG,qBAAqB,CAyN/E"}