@uipath/flow-tool 1.0.1 → 1.1.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.
- package/README.md +43 -46
- package/dist/index.js +1 -1
- package/dist/packager-tool.js +69474 -50247
- package/dist/services/connector-binding-validator.d.ts +95 -0
- package/dist/services/flow-validate-service.d.ts +149 -0
- package/dist/services/node-service.d.ts +94 -0
- package/dist/services/node-validators/expression-prefix-validator.d.ts +45 -0
- package/dist/services/node-validators/index.d.ts +3 -0
- package/dist/services/node-validators/ixp-node-validator.d.ts +2 -0
- package/dist/services/node-validators/model-source-validator.d.ts +25 -0
- package/dist/services/node-validators/types.d.ts +1 -1
- package/dist/services/packaging-utils.d.ts +107 -0
- package/dist/tool.js +254129 -217036
- package/dist/utils/flow-io.d.ts +11 -0
- package/dist/utils/handle-expansion.d.ts +50 -0
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +99154 -100096
- package/package.json +19 -27
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connector-binding shape validator (MST-9810, upstream UiPath/cli#2027).
|
|
3
|
+
*
|
|
4
|
+
* `uip maestro flow validate` historically only checked that `node.type`
|
|
5
|
+
* existed in the definitions[] list. A flow whose nodes are generic Managed
|
|
6
|
+
* HTTP placeholders (`core.action.http.v2`) labelled like connector activities
|
|
7
|
+
* — e.g. `name: "Send Slack Message"`, `display.label: "Create Jira Issue"` —
|
|
8
|
+
* with no `inputs.detail` binding therefore passed validation cleanly, then
|
|
9
|
+
* 404'd at runtime against the unconfigured HTTP endpoint.
|
|
10
|
+
*
|
|
11
|
+
* This module looks at every Managed-HTTP node, derives whether the label is
|
|
12
|
+
* "connector-shaped" (mentions a connector keyword from the cached IS catalog
|
|
13
|
+
* or a static fallback list), and verifies that the node carries either a
|
|
14
|
+
* connector-mode or manual-mode binding. Misses surface as a `warning` by
|
|
15
|
+
* default and as `error` under `--strict-bindings`.
|
|
16
|
+
*
|
|
17
|
+
* Catalog lookup is best-effort: when the registry cache is missing
|
|
18
|
+
* (offline / first-run), a small static keyword list keeps the check active
|
|
19
|
+
* for the most common connectors (Slack, Gmail, Jira, Salesforce, …) rather
|
|
20
|
+
* than going silent — these are the same connectors most likely to be
|
|
21
|
+
* referenced by hallucinating agents.
|
|
22
|
+
*/
|
|
23
|
+
import type { ValidationIssue } from "./node-validators/types.js";
|
|
24
|
+
/** Generic Managed HTTP node type — the type that historically slipped through. */
|
|
25
|
+
export declare const MANAGED_HTTP_NODE_TYPE = "core.action.http.v2";
|
|
26
|
+
/**
|
|
27
|
+
* Structural shape of a flow node the binding validator needs. Kept loose so
|
|
28
|
+
* `ParsedWorkflow` nodes satisfy it without a cast — fields beyond this set
|
|
29
|
+
* are ignored.
|
|
30
|
+
*/
|
|
31
|
+
export interface ConnectorBindingNode {
|
|
32
|
+
id: string;
|
|
33
|
+
type: string;
|
|
34
|
+
name?: unknown;
|
|
35
|
+
display?: {
|
|
36
|
+
label?: unknown;
|
|
37
|
+
} & Record<string, unknown>;
|
|
38
|
+
inputs?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/** Structural shape of the workflow envelope the validator walks. */
|
|
41
|
+
export interface ConnectorBindingWorkflow {
|
|
42
|
+
nodes: ConnectorBindingNode[];
|
|
43
|
+
subflows?: Record<string, {
|
|
44
|
+
nodes?: ConnectorBindingNode[];
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
export interface ConnectorBindingValidationOptions {
|
|
48
|
+
/**
|
|
49
|
+
* Promote each emitted issue from `warning` to `error`. Wired to the
|
|
50
|
+
* `--strict-bindings` CLI flag. Useful for CI gates that want a
|
|
51
|
+
* mislabeled HTTP node to fail the build rather than passively warn.
|
|
52
|
+
*/
|
|
53
|
+
strict?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Test-time injection. When provided, this overrides whatever
|
|
56
|
+
* `loadRegistry()` would return. Lets specs assert behavior against a
|
|
57
|
+
* known catalog without touching the user's real cache.
|
|
58
|
+
*/
|
|
59
|
+
catalogOverride?: ConnectorCatalog;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compact view of the IS catalog the validator actually needs — connector
|
|
63
|
+
* keywords (`key`, `name`) and a flat list of activity display tokens.
|
|
64
|
+
* Built once per `validateFile` from the cached `MaestroRegistry`.
|
|
65
|
+
*/
|
|
66
|
+
export interface ConnectorCatalog {
|
|
67
|
+
/**
|
|
68
|
+
* Connector keyword tokens (e.g. "slack" derived from `uipath-uipath-slack`
|
|
69
|
+
* → strip "uipath-" prefix → split by "-"). Lower-cased.
|
|
70
|
+
*/
|
|
71
|
+
keywords: Set<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Activity displayName token bags — each entry is the set of lowercase
|
|
74
|
+
* tokens from one activity's displayName. A label whose tokens match
|
|
75
|
+
* any entry (subset or superset) is considered connector-shaped.
|
|
76
|
+
*/
|
|
77
|
+
activityTokenBags: Array<{
|
|
78
|
+
connectorKey: string;
|
|
79
|
+
connectorName: string;
|
|
80
|
+
tokens: Set<string>;
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Build a `ConnectorCatalog` from the cached registry. Returns a catalog with
|
|
85
|
+
* empty `activityTokenBags` (but populated with static keywords) when no
|
|
86
|
+
* cache exists — so the check still fires for offline users.
|
|
87
|
+
*/
|
|
88
|
+
export declare function loadConnectorCatalog(): Promise<ConnectorCatalog>;
|
|
89
|
+
/**
|
|
90
|
+
* Walk every node in the flow + every subflow and emit one issue per
|
|
91
|
+
* unbound, connector-shaped Managed HTTP node. Scope mirrors
|
|
92
|
+
* `validateResourceBindings` so the new check stays consistent with the
|
|
93
|
+
* §A4 binding-integrity pass already in `FlowValidateService`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function validateConnectorBindings(workflow: ConnectorBindingWorkflow, catalog: ConnectorCatalog, options?: Pick<ConnectorBindingValidationOptions, "strict">): ValidationIssue[];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { NodeManifest } from "@uipath/flow-core";
|
|
2
|
+
import { type ConnectorCatalog } from "./connector-binding-validator.js";
|
|
1
3
|
import { type FlowNodeValidator, type ValidationIssue } from "./node-validators/index.js";
|
|
2
4
|
import type { WorkflowGovernanceEnforcements, WorkflowValidationRule } from "./node-validators/workflow-rule-types.js";
|
|
3
5
|
interface FlowValidateResult {
|
|
@@ -5,6 +7,7 @@ interface FlowValidateResult {
|
|
|
5
7
|
filePath: string;
|
|
6
8
|
issues: ValidationIssue[];
|
|
7
9
|
}
|
|
10
|
+
type ManifestForCurrentValidation = Pick<NodeManifest, "nodeType" | "version" | "handleConfiguration" | "supportsErrorHandling">;
|
|
8
11
|
/**
|
|
9
12
|
* Optional hooks callers can use to extend validation without editing this
|
|
10
13
|
* service. See `packages/flow-tool/src/services/node-validators/types.ts`
|
|
@@ -37,6 +40,30 @@ export interface FlowValidateOptions {
|
|
|
37
40
|
* in this allow-list.
|
|
38
41
|
*/
|
|
39
42
|
availableModelNames?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* Compare edge handles against the current bundled OOTB manifests in
|
|
45
|
+
* addition to the definitions embedded in the .flow file. This catches
|
|
46
|
+
* flows generated with stale OOTB definitions that are internally
|
|
47
|
+
* consistent but render incorrectly in Studio Web.
|
|
48
|
+
*/
|
|
49
|
+
validateCurrentManifests?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Test/host override for the current manifest set. Supplying this also
|
|
52
|
+
* enables current-manifest validation.
|
|
53
|
+
*/
|
|
54
|
+
currentManifests?: ManifestForCurrentValidation[];
|
|
55
|
+
/**
|
|
56
|
+
* Promote connector-binding shape warnings (MST-9810) to errors. By
|
|
57
|
+
* default, an unbound Managed HTTP node carrying a connector-shaped label
|
|
58
|
+
* emits a warning so existing flows keep validating green; CI gates
|
|
59
|
+
* opt in via `--strict-bindings` to fail the build instead.
|
|
60
|
+
*/
|
|
61
|
+
strictBindings?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Test/host override for the connector catalog used by the binding-shape
|
|
64
|
+
* validator. Supplying this skips the `loadRegistry()` cache lookup.
|
|
65
|
+
*/
|
|
66
|
+
connectorCatalog?: ConnectorCatalog;
|
|
40
67
|
}
|
|
41
68
|
export declare class FlowValidateService {
|
|
42
69
|
private readonly fs;
|
|
@@ -44,15 +71,137 @@ export declare class FlowValidateService {
|
|
|
44
71
|
private readonly nodeValidators;
|
|
45
72
|
private readonly governanceEnforcements?;
|
|
46
73
|
private readonly availableModelNames?;
|
|
74
|
+
private readonly validateCurrentManifests;
|
|
75
|
+
private readonly currentManifestOverrides?;
|
|
76
|
+
private readonly strictBindings;
|
|
77
|
+
private readonly connectorCatalogOverride?;
|
|
78
|
+
private currentManifestCache?;
|
|
79
|
+
private connectorCatalogCache?;
|
|
47
80
|
constructor(options?: FlowValidateOptions);
|
|
48
81
|
execute(flowFilePath: string): Promise<number>;
|
|
82
|
+
private loadCurrentManifestMap;
|
|
83
|
+
private loadCurrentManifestMapUncached;
|
|
49
84
|
validateFile(flowFilePath: string): Promise<FlowValidateResult>;
|
|
85
|
+
/**
|
|
86
|
+
* For agent nodes that reference an external agent definition via a
|
|
87
|
+
* `projectId` UUID, read the sibling `<uuid>/agent.json` file and
|
|
88
|
+
* populate `systemPrompt` / `userPrompt` (and governance-relevant
|
|
89
|
+
* settings) from the agent's `messages` array so that schema
|
|
90
|
+
* validation sees them.
|
|
91
|
+
*
|
|
92
|
+
* The UUID may be at `inputs.source` (canonical post-flow-core-0.2.50)
|
|
93
|
+
* or `model.source` (legacy). The autonomous-agent manifest's
|
|
94
|
+
* `model.source: true` declaration is a historical artifact from
|
|
95
|
+
* before the migration; current canvas writes go to `inputs.source`.
|
|
96
|
+
* `node.model.source` is read for backwards compatibility with older
|
|
97
|
+
* `.flow` files. MST-9263.
|
|
98
|
+
*
|
|
99
|
+
* Returns a map of `nodeId → AgentHydrationDiagnosis` so callers can
|
|
100
|
+
* decorate downstream `REQUIRED_FIELD` validator errors with a
|
|
101
|
+
* specific reason hydration could not fill the prompt fields.
|
|
102
|
+
*/
|
|
103
|
+
private resolveAgentPrompts;
|
|
104
|
+
/**
|
|
105
|
+
* Decorate `[REQUIRED_FIELD] systemPrompt|userPrompt` validator errors
|
|
106
|
+
* on inline-agent nodes with a diagnostic hint pinpointing why the
|
|
107
|
+
* resolver couldn't fill the field — so users see "agent.json not
|
|
108
|
+
* found at <path>" instead of just "systemPrompt is required". The
|
|
109
|
+
* raw AJV error stays in the message; the hint is appended on a
|
|
110
|
+
* second line. MST-9263.
|
|
111
|
+
*/
|
|
112
|
+
private enrichInlineAgentPromptIssues;
|
|
50
113
|
private validateGraph;
|
|
51
114
|
private validateEdgeReferences;
|
|
52
115
|
private validateNodeTypeDefinitions;
|
|
53
116
|
private validateUniqueIds;
|
|
54
117
|
/** Uniqueness check for `variables.globals` IDs; called once per scope (root + each subflow). */
|
|
55
118
|
private validateGlobalVariableUniqueness;
|
|
119
|
+
/**
|
|
120
|
+
* Resource-node bindings integrity (residual roadmap §A4, [MST-9712]).
|
|
121
|
+
*
|
|
122
|
+
* Every process-typed node (RPA workflow, agent, API workflow, agent-tool
|
|
123
|
+
* process — see PROCESS_NODE_PREFIXES) referenced anywhere in the flow
|
|
124
|
+
* — top-level `nodes[]` AND every subflow's `nodes[]` — must have a
|
|
125
|
+
* corresponding `workflow.bindings` entry whose `resourceKey` covers the
|
|
126
|
+
* node's needs. Without it, the workflow passes `flow validate` today but
|
|
127
|
+
* fails opaquely at runtime as "Failure in the Orchestrator Job".
|
|
128
|
+
*
|
|
129
|
+
* Uses `collectNodeBindingResourceKeys` from `node-service.ts` (the same
|
|
130
|
+
* helper `ensureProcessBindings` uses on the write path) to compute each
|
|
131
|
+
* process node's needed resource keys, then checks each against the
|
|
132
|
+
* declared `bindings[].resourceKey` set.
|
|
133
|
+
*/
|
|
134
|
+
private validateResourceBindings;
|
|
135
|
+
/**
|
|
136
|
+
* Cross-node connection ID reuse (residual roadmap §A6, [MST-9714]).
|
|
137
|
+
*
|
|
138
|
+
* Two distinct nodes referencing the same `inputs.detail.connectionResourceId`
|
|
139
|
+
* share runtime connection state. Often that's a bug (a node was duplicated
|
|
140
|
+
* without re-pointing the connection); sometimes it's intentional (two
|
|
141
|
+
* connectors on the same SaaS account, sharing rate-limit headroom).
|
|
142
|
+
*
|
|
143
|
+
* Severity: `warning` — legitimate sharing exists, so don't block validate.
|
|
144
|
+
* Users can investigate or ignore as appropriate.
|
|
145
|
+
*
|
|
146
|
+
* Scope: top-level `workflow.nodes` + every `workflow.subflows[].nodes`
|
|
147
|
+
* (matches A4's iteration shape for consistency).
|
|
148
|
+
*/
|
|
149
|
+
private validateConnectionIdReuse;
|
|
150
|
+
/**
|
|
151
|
+
* Connector-binding shape check (MST-9810, upstream UiPath/cli#2027).
|
|
152
|
+
*
|
|
153
|
+
* Lazy-loads the IS connector catalog (cached registry from
|
|
154
|
+
* `~/.uipath/maestro/registry.json`, falling back to a static keyword
|
|
155
|
+
* list when no cache exists) and delegates to
|
|
156
|
+
* `validateConnectorBindings`. Promotes warnings to errors when
|
|
157
|
+
* constructed with `strictBindings: true` (wired to `--strict-bindings`).
|
|
158
|
+
*
|
|
159
|
+
* Catalog loading is best-effort and never throws: when the cache is
|
|
160
|
+
* missing or unreadable, the validator still runs against the static
|
|
161
|
+
* fallback keyword list. That keeps the check active for offline users
|
|
162
|
+
* who would otherwise be the most likely to hit this bug, while
|
|
163
|
+
* letting tests inject deterministic catalogs via
|
|
164
|
+
* `FlowValidateOptions.connectorCatalog`.
|
|
165
|
+
*/
|
|
166
|
+
private validateConnectorBindingShapes;
|
|
167
|
+
private loadConnectorCatalogCached;
|
|
168
|
+
/**
|
|
169
|
+
* Project↔solution registration + canonical-path layout (residual roadmap
|
|
170
|
+
* §A3, [MST-9711]). Walks up from the .flow's parent looking for a
|
|
171
|
+
* `.uipx` solution file. When one is found, asserts both:
|
|
172
|
+
*
|
|
173
|
+
* (a) the .flow's project directory is registered in the solution's
|
|
174
|
+
* projects[] list (matched by ProjectRelativePath's directory name),
|
|
175
|
+
* and
|
|
176
|
+
* (b) the canonical layout: <solution>/<projectName>/<projectName>.flow
|
|
177
|
+
* — i.e. the .flow file basename equals its parent directory name.
|
|
178
|
+
*
|
|
179
|
+
* Standalone authoring (no .uipx in any parent) is allowed — the rule
|
|
180
|
+
* stays silent in that case so single-flow workflows aren't penalised.
|
|
181
|
+
*
|
|
182
|
+
* Severity: warning. Both issues are recoverable (`uip solution project add`
|
|
183
|
+
* fixes registration; renaming the file or directory fixes the layout).
|
|
184
|
+
*/
|
|
185
|
+
private validateSolutionRegistrationAndLayout;
|
|
186
|
+
/**
|
|
187
|
+
* Best-effort path canonicalization for the registration-comparison
|
|
188
|
+
* call site. Returns `fs.realpath(p)` when the call succeeds, and
|
|
189
|
+
* the original `p` when it fails (e.g., the path doesn't exist).
|
|
190
|
+
* Falling back to the literal path is deliberate: a missing path is
|
|
191
|
+
* exactly the failure mode that the surrounding validator already
|
|
192
|
+
* surfaces via other issues, and canonicalization is an optimization
|
|
193
|
+
* for symlink/case-folding correctness, not a precondition.
|
|
194
|
+
*/
|
|
195
|
+
private canonicalizePath;
|
|
196
|
+
/**
|
|
197
|
+
* Catch stale embedded OOTB definitions. Studio Web renders against the
|
|
198
|
+
* current node manifest, while .flow files carry a serialized copy of the
|
|
199
|
+
* manifest that may have been produced by an older CLI. A flow can
|
|
200
|
+
* therefore be internally consistent, pass embedded-definition validation,
|
|
201
|
+
* and still render with missing edges because the edge handle no longer
|
|
202
|
+
* exists in the current manifest.
|
|
203
|
+
*/
|
|
204
|
+
private validateEdgeHandlesAgainstCurrentManifests;
|
|
56
205
|
/**
|
|
57
206
|
* Check that every edge references handles declared in the source/target
|
|
58
207
|
* node manifests, and that no handle exceeds its maxConnections constraint.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { NodeInstance, Workflow } from "@uipath/flow-core";
|
|
2
|
+
import { type ConnectorInfo } from "@uipath/maestro-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a node type is genuinely absent from the SDK bundle and the
|
|
5
|
+
* tenant manifest — i.e. a typo or a removed node.
|
|
6
|
+
*/
|
|
7
|
+
export declare class NodeTypeNotFoundError extends Error {
|
|
8
|
+
readonly code = "NodeTypeNotFound";
|
|
9
|
+
readonly instructions: string;
|
|
10
|
+
constructor(message: string, instructions: string);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Thrown when a node type IS in the SDK bundle (so it exists as a feature on
|
|
14
|
+
* the platform) but is missing from the loaded tenant manifest — almost always
|
|
15
|
+
* a feature-flag / entitlement gate.
|
|
16
|
+
*/
|
|
17
|
+
export declare class NodeTypeNotEnabledError extends Error {
|
|
18
|
+
readonly code = "NodeTypeNotEnabled";
|
|
19
|
+
readonly instructions: string;
|
|
20
|
+
constructor(message: string, instructions: string);
|
|
21
|
+
}
|
|
22
|
+
export interface NodeSummary {
|
|
23
|
+
id: string;
|
|
24
|
+
type: string;
|
|
25
|
+
label: string;
|
|
26
|
+
position: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ListNodesResult {
|
|
32
|
+
nodes: NodeSummary[];
|
|
33
|
+
count: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const listNodesInFlow: (filePath: string) => Promise<ListNodesResult>;
|
|
36
|
+
export interface AddNodeOptions {
|
|
37
|
+
position?: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
};
|
|
41
|
+
label?: string;
|
|
42
|
+
inputs?: Record<string, unknown>;
|
|
43
|
+
source?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface AddNodeResult {
|
|
46
|
+
node: NodeInstance;
|
|
47
|
+
definitionAdded: boolean;
|
|
48
|
+
bindingsCreated: number;
|
|
49
|
+
variableCount: number;
|
|
50
|
+
connectorInfo?: ConnectorInfo;
|
|
51
|
+
}
|
|
52
|
+
export interface DeleteNodeResult {
|
|
53
|
+
deletedNode: NodeSummary;
|
|
54
|
+
edgesRemoved: number;
|
|
55
|
+
bindingsRemoved: number;
|
|
56
|
+
definitionsRemoved: number;
|
|
57
|
+
variablesRemoved: number;
|
|
58
|
+
variableUpdatesRemoved: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Node type prefixes that use process-style bindings (GUID as resourceKey).
|
|
62
|
+
* Covers RPA workflows, agent process tools, and agent nodes.
|
|
63
|
+
*/
|
|
64
|
+
export declare const PROCESS_NODE_PREFIXES: string[];
|
|
65
|
+
export declare function isProcessNode(manifest: {
|
|
66
|
+
nodeType: string;
|
|
67
|
+
}): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Safety net: ensure every process/agent node in the workflow has corresponding
|
|
70
|
+
* entries in the workflow `bindings` array and that `<bindings.*>` placeholders
|
|
71
|
+
* in node model.context are resolved to `=bindings.<id>` references.
|
|
72
|
+
*
|
|
73
|
+
* This handles flows authored outside the CLI (e.g. direct file edits or
|
|
74
|
+
* skill-generated files) where `addNodeToFlow` was never called, so the
|
|
75
|
+
* binding creation / resolution step was skipped.
|
|
76
|
+
*
|
|
77
|
+
* Mutates the workflow in place. Safe to call multiple times — already-resolved
|
|
78
|
+
* nodes are skipped.
|
|
79
|
+
*/
|
|
80
|
+
export declare function ensureProcessBindings(workflow: Workflow): number;
|
|
81
|
+
/**
|
|
82
|
+
* Collect all binding resourceKeys associated with a node.
|
|
83
|
+
* Handles three binding ownership patterns:
|
|
84
|
+
* 1. Process nodes — resourceKey from the definition's model.bindings.resourceKey,
|
|
85
|
+
* falling back to the process GUID extracted from the node type
|
|
86
|
+
* 2. Connector nodes — resourceKey is the connectionId stored in inputs.detail
|
|
87
|
+
* 3. Input refs — "=bindings.<id>" patterns resolved to resourceKeys
|
|
88
|
+
*/
|
|
89
|
+
export declare function collectNodeBindingResourceKeys(node: NodeInstance, bindings: Array<{
|
|
90
|
+
id: string;
|
|
91
|
+
resourceKey: string;
|
|
92
|
+
}>, definitions?: Array<Record<string, unknown>>): Set<string>;
|
|
93
|
+
export declare const addNodeToFlow: (filePath: string, nodeType: string, options?: AddNodeOptions) => Promise<AddNodeResult>;
|
|
94
|
+
export declare const deleteNodeFromFlow: (filePath: string, nodeId: string) => Promise<DeleteNodeResult>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FlowNodeValidator } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Lints two related authoring failure modes around `=js:` expression-mode:
|
|
4
|
+
*
|
|
5
|
+
* 1. **Connector / HTTP parameters missing the `=js:` prefix (MST-9107).**
|
|
6
|
+
* The flow-workbench BPMN serializer rewrites `$vars` → `vars` regardless
|
|
7
|
+
* of whether the value carries the `=js:` prefix, so a string like
|
|
8
|
+
* `"$vars.X.output.Id"` ships to the runtime as the literal string
|
|
9
|
+
* `"vars.X.output.Id"` instead of being evaluated as an expression. The
|
|
10
|
+
* failure is silent: `flow validate` (without this rule) and `flow format`
|
|
11
|
+
* both pass; the activity input ends up bound to the literal string at
|
|
12
|
+
* runtime.
|
|
13
|
+
*
|
|
14
|
+
* Also catches the agent-invented `nodes.<id>.output.Y` syntax — there
|
|
15
|
+
* is no such reference dialect; the agent should write
|
|
16
|
+
* `=js:$vars.<id>.output.<f>`.
|
|
17
|
+
*
|
|
18
|
+
* 2. **Script-node `inputs.source` written as an expression-mode string
|
|
19
|
+
* (MST-9265 / MST-9260).** A Script node's `source` field is the
|
|
20
|
+
* JavaScript function body, not an expression-mode value. Authoring
|
|
21
|
+
* `inputs.source = "=js:vars.start.output.text"` makes the runtime
|
|
22
|
+
* treat the literal string as the JS source — i.e., the script reverses
|
|
23
|
+
* its own source code instead of the input. Flag values that begin with
|
|
24
|
+
* `=js:` so the agent gets an actionable error before `flow debug`.
|
|
25
|
+
*
|
|
26
|
+
* Scope:
|
|
27
|
+
* - Connector activity nodes (`uipath.connector.*`, excluding triggers) —
|
|
28
|
+
* missing-prefix scan against `inputs.detail.{body,query,path}Parameters`.
|
|
29
|
+
* - Managed HTTP nodes (`core.action.http.v2`) — same scan.
|
|
30
|
+
* - Custom HTTP nodes (`core.action.http`) — same scan.
|
|
31
|
+
* - Script nodes (`core.action.script`) — `inputs.source` literal-vs-
|
|
32
|
+
* expression check (MST-9260).
|
|
33
|
+
*
|
|
34
|
+
* Out of scope:
|
|
35
|
+
* - Decision / Switch / HTTP branch condition expressions — those are always
|
|
36
|
+
* parsed as JS, so `=js:` is forbidden, not required. Covered by the
|
|
37
|
+
* `condition-expression` rule in `@uipath/flow-schema`.
|
|
38
|
+
* - Variable updates — `bpmn-moddle.ensureJsPrefix` already auto-prefixes and
|
|
39
|
+
* warns; covered by `variable-update-service`.
|
|
40
|
+
* - End node output `source` and subflow input `source` — those ARE
|
|
41
|
+
* expression-mode fields where `=js:` is valid. A future check can lint
|
|
42
|
+
* their *contents* (resolvability) but the leading-`=js:` rule does not
|
|
43
|
+
* apply.
|
|
44
|
+
*/
|
|
45
|
+
export declare const expressionPrefixValidator: FlowNodeValidator;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { FlowNodeValidator } from "./types.js";
|
|
2
2
|
export { connectorNodeValidator } from "./connector-validator.js";
|
|
3
|
+
export { expressionPrefixValidator } from "./expression-prefix-validator.js";
|
|
4
|
+
export { ixpNodeValidator } from "./ixp-node-validator.js";
|
|
5
|
+
export { modelSourceValidator } from "./model-source-validator.js";
|
|
3
6
|
export type { FlowNodeValidator, FlowValidatorContext, FlowValidatorNode, ValidationIssue, ValidationIssueSeverity, } from "./types.js";
|
|
4
7
|
/**
|
|
5
8
|
* Validators applied by default in `FlowValidateService`. Downstream tools
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FlowNodeValidator } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Enforces the source-UUID contract for nodes whose plugin manifest declares
|
|
4
|
+
* `model: { source: true, ... }` at the top level.
|
|
5
|
+
*
|
|
6
|
+
* flow-core 0.2.50 moved the per-instance source UUID from `node.model.source`
|
|
7
|
+
* to `node.inputs.source`. Older `.flow` files may still carry the legacy
|
|
8
|
+
* `model.source` shape, so validation accepts both locations while reporting
|
|
9
|
+
* missing values against the canonical `inputs.source` path.
|
|
10
|
+
*
|
|
11
|
+
* Scope:
|
|
12
|
+
* - Any node whose plugin manifest declares `model.source === true`.
|
|
13
|
+
* - Currently observed plugins: `uipath.agent.autonomous`,
|
|
14
|
+
* `uipath.agent.conversational`. Plugin-list discovered dynamically
|
|
15
|
+
* from the registry — adding new agent-style plugins in the future
|
|
16
|
+
* doesn't require updating this validator.
|
|
17
|
+
*
|
|
18
|
+
* Out of scope:
|
|
19
|
+
* - Plugins that don't declare `model.source: true` (most node types).
|
|
20
|
+
* - Validating the UUID format of the source value — handled by the
|
|
21
|
+
* schema-validation rule in `@uipath/flow-schema`.
|
|
22
|
+
* - The `model.type`, `model.serviceType`, `model.version` fields —
|
|
23
|
+
* those are written by the canvas, not by the agent.
|
|
24
|
+
*/
|
|
25
|
+
export declare const modelSourceValidator: FlowNodeValidator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Contribution surface for node-type-scoped validators in `uip flow validate`.
|
|
2
|
+
* Contribution surface for node-type-scoped validators in `uip maestro flow validate`.
|
|
3
3
|
*
|
|
4
4
|
* A `FlowNodeValidator` runs once per node during the validate pass and emits
|
|
5
5
|
* zero or more `ValidationIssue`s. This is the second pluggability layer of
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { IFileSystem } from "@uipath/filesystem";
|
|
2
|
+
import { type EntryPoint, type PackagingBinding, type PackagingNode, type PackagingNodeManifest, type PackagingWorkflowVariables } from "@uipath/flow-schema";
|
|
3
|
+
interface FlowFileNode {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
typeVersion?: string;
|
|
7
|
+
display?: Record<string, unknown>;
|
|
8
|
+
inputs?: Record<string, unknown>;
|
|
9
|
+
outputs?: Record<string, unknown>;
|
|
10
|
+
model?: Record<string, unknown>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the inline-agent's projectId UUID from a flow node.
|
|
15
|
+
*
|
|
16
|
+
* flow-core 0.2.50 moved the per-instance source UUID from
|
|
17
|
+
* `node.model.source` to `node.inputs.source`. Older `.flow` files (and
|
|
18
|
+
* any saved before the migration ran) still carry the legacy
|
|
19
|
+
* `model.source` shape — `model-source-validator.ts` accepts both, so
|
|
20
|
+
* the packagers must too. Falls back through the same key set
|
|
21
|
+
* flow-workbench's `extractInlineAgents` uses.
|
|
22
|
+
*
|
|
23
|
+
* Note: `packager/packager-tool-flow/src/flow-tool.ts` keeps an inline
|
|
24
|
+
* copy of this rule (`readSource` in `generateFlowPackagingArtifacts`).
|
|
25
|
+
* `flow-tool` already imports `@uipath/packager-tool-flow`, so the
|
|
26
|
+
* reverse import would create a cycle. If the priority list ever
|
|
27
|
+
* changes, update both copies — or lift the helper into
|
|
28
|
+
* `@uipath/flow-schema` (currently an external dep) and delete both.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readInlineAgentSource(node: {
|
|
31
|
+
inputs?: Record<string, unknown>;
|
|
32
|
+
model?: Record<string, unknown>;
|
|
33
|
+
}): string | undefined;
|
|
34
|
+
/** Returns true when the node's type is a known inline-agent node type. */
|
|
35
|
+
export declare function isInlineAgentNodeType(type: string | undefined): boolean;
|
|
36
|
+
/** Returns true when the node's type is the conversational agent type. */
|
|
37
|
+
export declare function isConversationalAgentNodeType(type: string | undefined): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Convert file-format nodes (flat `inputs`/`display`/`outputs`) to the
|
|
40
|
+
* `PackagingNode` shape expected by flow-schema packaging helpers — also
|
|
41
|
+
* flat: `display`, `inputs`, `outputs`, and `model` sit at the top of the
|
|
42
|
+
* node, matching `inputsMatchBinding` and `getConnectionMetadata` in
|
|
43
|
+
* `getBindingResources`. We default `typeVersion` here for legacy file-format
|
|
44
|
+
* nodes that omit it; `toPackagingNodes` from flow-schema is an identity cast
|
|
45
|
+
* and does NOT remap fields, so we do that here.
|
|
46
|
+
*/
|
|
47
|
+
export declare function fileNodesToPackagingNodes(nodes: FlowFileNode[]): PackagingNode[];
|
|
48
|
+
/** Packaged inline agent with entry point and file metadata. */
|
|
49
|
+
export interface InlineAgentPackage {
|
|
50
|
+
/** The agent's projectId UUID (directory name). */
|
|
51
|
+
source: string;
|
|
52
|
+
/** Entry point for entry-points.json. */
|
|
53
|
+
entryPoint: EntryPoint;
|
|
54
|
+
/** The raw agent.json content (for .agent-builder/agent.json). */
|
|
55
|
+
agentJson: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Scan workflow nodes for inline agents, read their agent.json,
|
|
59
|
+
* and build entry points + metadata for packaging.
|
|
60
|
+
*
|
|
61
|
+
* The source UUID may live at `inputs.source` (canonical) or `model.source`
|
|
62
|
+
* (legacy, pre-flow-core 0.2.50). We honour both — see
|
|
63
|
+
* {@link readInlineAgentSource}.
|
|
64
|
+
*/
|
|
65
|
+
export declare function packageInlineAgents(fs: IFileSystem, projectDir: string, nodes: Array<{
|
|
66
|
+
type: string;
|
|
67
|
+
inputs?: Record<string, unknown>;
|
|
68
|
+
model?: Record<string, unknown>;
|
|
69
|
+
}>): Promise<InlineAgentPackage[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Build inline-agent descriptors for a debug session's FpsProperties
|
|
72
|
+
* injection. Mirrors flow-workbench's `extractInlineAgents` shape:
|
|
73
|
+
* one entry per agent node with a resolvable source UUID.
|
|
74
|
+
*
|
|
75
|
+
* The runtime resolves each entry by `executorInfo.projectId`, so this
|
|
76
|
+
* walks every agent node — even the ones whose `agent.json` may not be
|
|
77
|
+
* on disk yet — and returns the descriptor list.
|
|
78
|
+
*
|
|
79
|
+
* `entryPointPath` is `<projectId>/agent.json` (no `content/` prefix —
|
|
80
|
+
* runtime resolves against the deployed package root).
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildInlineAgentDescriptors(nodes: Array<{
|
|
83
|
+
type: string;
|
|
84
|
+
display?: Record<string, unknown>;
|
|
85
|
+
inputs?: Record<string, unknown>;
|
|
86
|
+
model?: Record<string, unknown>;
|
|
87
|
+
}>): Array<{
|
|
88
|
+
name: string;
|
|
89
|
+
agentProjectId: string;
|
|
90
|
+
isConversational: boolean;
|
|
91
|
+
entryPointPath: string;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Write all packaging artifacts (operate.json, entry-points.json, bindings_v2.json,
|
|
95
|
+
* package-descriptor.json) into a directory using @uipath/flow-schema.
|
|
96
|
+
*
|
|
97
|
+
* Returns the computed entry points so callers can derive PIMS entry point paths
|
|
98
|
+
* without calling getEntryPoints again.
|
|
99
|
+
*/
|
|
100
|
+
export declare function writePackagingArtifacts(fs: IFileSystem, projectDir: string, projectId: string, packagingNodes: PackagingNode[], bindings: PackagingBinding[], variables: PackagingWorkflowVariables, bpmnFileName: string, startEventId: string, flowFileName?: string, definitions?: PackagingNodeManifest[]): Promise<EntryPoint[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Re-read a .flow file and regenerate bindings_v2.json in the same project directory.
|
|
103
|
+
* Called after `node add` (process nodes), `node delete`, and `node configure` to
|
|
104
|
+
* keep bindings in sync with the .flow file.
|
|
105
|
+
*/
|
|
106
|
+
export declare function regenerateBindingsFile(fs: IFileSystem, flowFilePath: string): Promise<void>;
|
|
107
|
+
export {};
|