@uipath/maestro-builder-sdk 6.117.0 → 6.117.2
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/dist/check.d.ts +7 -0
- package/dist/check.js +54 -6
- package/dist/cli-library.js +17 -0
- package/dist/core/connector-output-fields.d.ts +15 -0
- package/dist/core/connector-output-fields.js +24 -0
- package/dist/core/nodes/family.d.ts +8 -0
- package/dist/core/nodes/node-type.d.ts +6 -0
- package/dist/core/refusals.d.ts +3 -0
- package/dist/core/refusals.js +3 -0
- package/dist/flow-node-registry.d.ts +7 -0
- package/dist/flow-node-registry.js +9 -0
- package/dist/flow-node-type.d.ts +8 -1
- package/dist/merge-cli.js +23 -2
- package/dist/merge-embedded-agent.d.ts +46 -10
- package/dist/merge-embedded-agent.js +180 -25
- package/dist/merge-sidecars.d.ts +8 -0
- package/dist/merge-sidecars.js +24 -29
- package/dist/merge.d.ts +9 -4
- package/dist/merge.js +27 -19
- package/dist/nodes/connector/flow/family.js +4 -2
- package/dist/nodes/connector/flow/node-type.js +3 -0
- package/dist/nodes/connector/flow/output-read.d.ts +37 -0
- package/dist/nodes/connector/flow/output-read.js +23 -0
- package/dist/nodes/http/flow/check.js +12 -8
- package/dist/nodes/http/flow/factories.js +1 -1
- package/dist/nodes/http/flow/spec.d.ts +3 -3
- package/dist/registry/curated-overlay.d.ts +1 -0
- package/dist/registry/curated-overlay.js +5 -0
- package/package.json +2 -2
package/dist/check.d.ts
CHANGED
|
@@ -83,6 +83,13 @@ export interface CheckOpts extends ConnectorCheckOpts, EventCheckOpts {
|
|
|
83
83
|
* whether it grants an error port is then the same answer in both rungs.
|
|
84
84
|
*/
|
|
85
85
|
connectorDefinition?: (connector: string, operation: string, version?: string, object?: string) => unknown;
|
|
86
|
+
/**
|
|
87
|
+
* The top-level fields one connector operation declares it returns (its
|
|
88
|
+
* library entry's `outputSchema`), for the read rule on `out(step, field)`.
|
|
89
|
+
* Undefined when the library cannot say: no declared fields, a list
|
|
90
|
+
* operation, or a schema that depends on the connection.
|
|
91
|
+
*/
|
|
92
|
+
connectorOutputFields?: (connector: string, operation: string, version?: string, object?: string) => readonly string[] | undefined;
|
|
86
93
|
/**
|
|
87
94
|
* The connector library `compile` serializes with. `check` runs the
|
|
88
95
|
* serializer in collect mode, with this library and `bindings`, to report
|
package/dist/check.js
CHANGED
|
@@ -8,7 +8,7 @@ import { bundledDefinition, resolveContributionDefinition, serialize } from './s
|
|
|
8
8
|
import { checkEventResolution, checkEventSubscription, eventParamsFor, } from './core/event-checks.js';
|
|
9
9
|
import { checkCookedEscapes, checkFlowExpressions, checkVarsOnlyInQuotes, literalExprShape, literalLooksLikeExpr } from './flow-expr-check.js';
|
|
10
10
|
import { FLOW_EXPR_DIALECT, checkBindingLabels, checkConnectorLookups as coreCheckConnectorLookups, checkConnectorResources as coreCheckConnectorResources, checkConnectorSchema as coreCheckConnectorSchema, } from './core/connector-checks.js';
|
|
11
|
-
import { nearestName } from './core/edit-distance.js';
|
|
11
|
+
import { editDistance, nearestName } from './core/edit-distance.js';
|
|
12
12
|
import { escapeRegExp } from './core/escape-regexp.js';
|
|
13
13
|
import { hasExits } from './core/step-ports.js';
|
|
14
14
|
import { actionTails, armReachesJoin } from './flow-parallel-hitl.js';
|
|
@@ -20,7 +20,7 @@ import { childStepLists } from './flow-step-tree.js';
|
|
|
20
20
|
import { VARS_READ_RE } from './core/vars-read.js';
|
|
21
21
|
import { FLOW_METADATA_KEYS, unknownMetadataKeys } from './core/flow-metadata.js';
|
|
22
22
|
import { endContentKey } from './flow-end-content.js';
|
|
23
|
-
import { FLOW_NODE_TYPES, FLOW_TRIGGER_TYPES } from './flow-node-registry.js';
|
|
23
|
+
import { FLOW_NODE_TYPES, FLOW_TRIGGER_TYPES, isNodeTypeFinding } from './flow-node-registry.js';
|
|
24
24
|
import { stepExits, stepRouting } from './flow-step-exits.js';
|
|
25
25
|
import { stepDeclaredVariables } from './flow-step-variables.js';
|
|
26
26
|
import { resolveVersion, resolveVersionCarried } from './core/nodes/versioned.js';
|
|
@@ -103,7 +103,11 @@ export function scopeToEdit(edited, baseline) {
|
|
|
103
103
|
const sorted = classifyDrafts(baseline.flow ?? {}, edited.flow ?? {}, baseline.flow, placed);
|
|
104
104
|
const kept = new Set(sorted.kept.map((f) => f.index));
|
|
105
105
|
const unplaced = new Set(sorted.unplaced.map((f) => f.index));
|
|
106
|
-
|
|
106
|
+
// A finding about the node's type (a retired node, `aboutNodeType`) is not
|
|
107
|
+
// introduced by an edit to the node's content, so it is judged as if the node
|
|
108
|
+
// were unchanged: pre-existing when the baseline reports it on the same node.
|
|
109
|
+
// A node the edit added has no baseline finding, so it stays edited.
|
|
110
|
+
const preExisting = preExistingFindings(placed.map((f) => ({ level: f.level, code: f.code, message: f.message, place: unplaced.has(f.index) ? '' : f.nodeId, unchanged: kept.has(f.index) || isNodeTypeFinding(f.code) })), locate(baseline).map((b) => ({ level: b.level, code: b.code, message: b.message, place: b.nodeId })));
|
|
107
111
|
const out = scopeFindings(edited.diagnostics, preExisting, PRE_EXISTING_LOWERING_NOTE);
|
|
108
112
|
if (edited.stoppedAt) {
|
|
109
113
|
const at = edited.stoppedAt.code !== undefined ? `[${edited.stoppedAt.code}] ` : '';
|
|
@@ -1138,7 +1142,8 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
1138
1142
|
// at the same point as the per-family no-output rules below.
|
|
1139
1143
|
const placed = checkedSteps.get(name);
|
|
1140
1144
|
if (placed) {
|
|
1141
|
-
const contract = placed.impl.
|
|
1145
|
+
const contract = placed.impl.checkOutput?.(placed.spec, opts)
|
|
1146
|
+
?? placed.impl.output(placed.spec, { resources: opts.resources });
|
|
1142
1147
|
if (contract.kind === 'none') {
|
|
1143
1148
|
diags.push(catalogued(placed.entry, step, contract.code, contract.message({ node: name, ref: `$vars.${name}${field ? '.' + field : ''}`, reader: step })));
|
|
1144
1149
|
continue;
|
|
@@ -1213,14 +1218,16 @@ function checkFlow(built, ancestors, opts = {}) {
|
|
|
1213
1218
|
// A registered node type that states its output's fields: the same read
|
|
1214
1219
|
// rule, worded by its contract and reported through its family's catalog.
|
|
1215
1220
|
const fieldsPlaced = checkedSteps.get(name);
|
|
1216
|
-
const fieldsContract = fieldsPlaced
|
|
1221
|
+
const fieldsContract = fieldsPlaced
|
|
1222
|
+
&& (fieldsPlaced.impl.checkOutput?.(fieldsPlaced.spec, opts)
|
|
1223
|
+
?? fieldsPlaced.impl.output(fieldsPlaced.spec, { resources: opts.resources }));
|
|
1217
1224
|
if (fieldsPlaced && fieldsContract?.kind === 'fields') {
|
|
1218
1225
|
const found = [];
|
|
1219
1226
|
checkDeclaredOutputRead({
|
|
1220
1227
|
prefix: fieldsContract.read.codePrefix, what: fieldsContract.read.label, name, field, rest, step,
|
|
1221
1228
|
diags: found, withoutReturns: fieldsContract.read.whenUndeclared,
|
|
1222
1229
|
declared: fieldsContract.fields === undefined ? undefined : Object.keys(fieldsContract.fields),
|
|
1223
|
-
open: fieldsContract.open,
|
|
1230
|
+
open: fieldsContract.open, partial: fieldsContract.partial,
|
|
1224
1231
|
});
|
|
1225
1232
|
for (const d of found)
|
|
1226
1233
|
diags.push(catalogued(fieldsPlaced.entry, step, d.code, d.message, d.suggestion));
|
|
@@ -2151,6 +2158,47 @@ function checkDeclaredOutputRead(o) {
|
|
|
2151
2158
|
if (o.declared.includes(wanted))
|
|
2152
2159
|
return;
|
|
2153
2160
|
const nearest = nearestName(wanted, o.declared);
|
|
2161
|
+
if (o.partial) {
|
|
2162
|
+
// A bracket or other non-identifier head (`output['updated-at']`) is not
|
|
2163
|
+
// judged: the split above cannot tell where its name ends.
|
|
2164
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(wanted))
|
|
2165
|
+
return;
|
|
2166
|
+
if (nearest !== undefined && nearest.toLowerCase() === wanted.toLowerCase()) {
|
|
2167
|
+
diags.push({
|
|
2168
|
+
level: 'error', code: `${prefix}_READ_FIELD_CASE`, step,
|
|
2169
|
+
message: `${what} "${name}" declares the output "${nearest}", but "$vars.${name}.output.${wanted}" (read in `
|
|
2170
|
+
+ `"${step}") spells it "${wanted}". Field names are case-sensitive, so unless the response itself uses `
|
|
2171
|
+
+ `"${wanted}", this read resolves to undefined at run time.`,
|
|
2172
|
+
suggestion: `out('${name}', '${nearest}')`,
|
|
2173
|
+
});
|
|
2174
|
+
return;
|
|
2175
|
+
}
|
|
2176
|
+
// Suggest only a close typo (`convrsationId` -> `conversationId`), at most
|
|
2177
|
+
// one edit per three letters: `ok` is two edits from `id`, and a declared
|
|
2178
|
+
// list of dozens nearly always has a short name (`id`) inside the read, so
|
|
2179
|
+
// `nearestName`'s looser match would point at an unrelated field.
|
|
2180
|
+
let suggested;
|
|
2181
|
+
let best = Math.min(2, Math.floor(wanted.length / 3)) + 1;
|
|
2182
|
+
for (const c of o.declared) {
|
|
2183
|
+
const d = editDistance(wanted.toLowerCase(), c.toLowerCase());
|
|
2184
|
+
if (d < best) {
|
|
2185
|
+
best = d;
|
|
2186
|
+
suggested = c;
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
// A large response (Jira's get-issue) declares dozens of heads; name the first ones.
|
|
2190
|
+
const listed = o.declared.length > 20
|
|
2191
|
+
? `${o.declared.slice(0, 20).join(', ')} and ${o.declared.length - 20} more`
|
|
2192
|
+
: o.declared.join(', ');
|
|
2193
|
+
diags.push({
|
|
2194
|
+
level: 'error', code: `${prefix}_READ_UNKNOWN_FIELD`, step,
|
|
2195
|
+
message: `${what} "${name}" declares no output "${wanted}" (read as "$vars.${name}.output.${wanted}" in `
|
|
2196
|
+
+ `"${step}"). It declares: ${listed}. The declared list can miss a field the response `
|
|
2197
|
+
+ `really carries; keep the read only if you have seen "${wanted}" in a real response.`,
|
|
2198
|
+
...(suggested !== undefined ? { suggestion: `out('${name}', '${suggested}')` } : {}),
|
|
2199
|
+
});
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2154
2202
|
diags.push({
|
|
2155
2203
|
level: 'error', code: `${prefix}_READ_UNKNOWN_FIELD`, step,
|
|
2156
2204
|
message: `${what} "${name}" declares no output "${wanted}" (read as "$vars.${name}.output.${wanted}" in `
|
package/dist/cli-library.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { connectorCheckOpts } from './core/cli-library.js';
|
|
2
|
+
import { connectorOutputFields } from './core/connector-output-fields.js';
|
|
2
3
|
import { synthesizedDefinitionRefusal } from './core/synthesized-definition.js';
|
|
3
4
|
import { connectorInputErrors } from './serialize.js';
|
|
4
5
|
export { openCliLibrary, connectorCheckOpts, eventResolveErrorFor, byoaCheckOpts } from './core/cli-library.js';
|
|
@@ -20,6 +21,8 @@ export function flowCheckOpts(library, bindings) {
|
|
|
20
21
|
};
|
|
21
22
|
if (!library)
|
|
22
23
|
return shared;
|
|
24
|
+
// One resolve per operation per check; the read rule asks on every read.
|
|
25
|
+
const outputFields = new Map();
|
|
23
26
|
return {
|
|
24
27
|
...shared,
|
|
25
28
|
listEnvelope: (connector, operation, version, object) => {
|
|
@@ -38,5 +41,19 @@ export function flowCheckOpts(library, bindings) {
|
|
|
38
41
|
return undefined; // as above
|
|
39
42
|
}
|
|
40
43
|
},
|
|
44
|
+
connectorOutputFields: (connector, operation, version, object) => {
|
|
45
|
+
const id = JSON.stringify([connector, operation, version ?? null, object ?? null]);
|
|
46
|
+
if (outputFields.has(id))
|
|
47
|
+
return outputFields.get(id);
|
|
48
|
+
let fields;
|
|
49
|
+
try {
|
|
50
|
+
fields = connectorOutputFields(library.resolve(connector, operation, version, object), library.schemaReadiness(connector, operation, version, object));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
fields = undefined; // as above
|
|
54
|
+
}
|
|
55
|
+
outputFields.set(id, fields);
|
|
56
|
+
return fields;
|
|
57
|
+
},
|
|
41
58
|
};
|
|
42
59
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The top-level output fields a connector operation declares (the heads of its
|
|
3
|
+
* library entry's `outputSchema.fields`: `fields.issuetype.name` -> `fields`),
|
|
4
|
+
* for the read rule on `out(step, field)`. The list is not exhaustive.
|
|
5
|
+
*
|
|
6
|
+
* `undefined` means "the library cannot say", and the rule stays silent:
|
|
7
|
+
*
|
|
8
|
+
* - no declared fields;
|
|
9
|
+
* - a `List` operation: the output is the collection, the fields an item's;
|
|
10
|
+
* - a file response: an `octet-stream` field names the file, not a property;
|
|
11
|
+
* - an object no entry describes (`objectNameUnverified`);
|
|
12
|
+
* - a connection-resolved schema not yet prepared (`schemaReadiness`).
|
|
13
|
+
*/
|
|
14
|
+
import type { ResolvedConnector, SchemaReadiness } from './library.js';
|
|
15
|
+
export declare function connectorOutputFields(rc: ResolvedConnector, readiness: SchemaReadiness | undefined): readonly string[] | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function connectorOutputFields(rc, readiness) {
|
|
2
|
+
if (rc.objectNameUnverified)
|
|
3
|
+
return undefined;
|
|
4
|
+
if (readiness && !readiness.prepared)
|
|
5
|
+
return undefined;
|
|
6
|
+
const entry = rc.entry;
|
|
7
|
+
if (entry?.operation?.name === 'List')
|
|
8
|
+
return undefined;
|
|
9
|
+
const fields = entry?.outputSchema?.fields;
|
|
10
|
+
if (!Array.isArray(fields))
|
|
11
|
+
return undefined;
|
|
12
|
+
const heads = new Set();
|
|
13
|
+
for (const f of fields) {
|
|
14
|
+
if (f?.type === 'octet-stream')
|
|
15
|
+
return undefined;
|
|
16
|
+
const name = f?.name;
|
|
17
|
+
if (typeof name !== 'string')
|
|
18
|
+
continue;
|
|
19
|
+
const head = name.split(/[.[]/, 1)[0];
|
|
20
|
+
if (head)
|
|
21
|
+
heads.add(head);
|
|
22
|
+
}
|
|
23
|
+
return heads.size > 0 ? [...heads] : undefined;
|
|
24
|
+
}
|
|
@@ -14,6 +14,14 @@ import type { AnyNodeType } from './versioned.js';
|
|
|
14
14
|
export type DiagnosticCatalog = Readonly<Record<string, {
|
|
15
15
|
readonly severity: 'error' | 'warning';
|
|
16
16
|
readonly summary: string;
|
|
17
|
+
/**
|
|
18
|
+
* The finding is about the node's type, not its content (a retired node type).
|
|
19
|
+
* An edit to the node's content does not introduce it, so under a baseline
|
|
20
|
+
* (`check --baseline`, `merge --baseline-from`) it is pre-existing when the
|
|
21
|
+
* baseline reports the same code on the same node, even when the edit changed
|
|
22
|
+
* that node. Unset for a finding about what the node holds.
|
|
23
|
+
*/
|
|
24
|
+
readonly aboutNodeType?: boolean;
|
|
17
25
|
}>>;
|
|
18
26
|
/** One placed node of a family, as the family-level check sees it. */
|
|
19
27
|
export interface Placement<Spec = unknown> {
|
|
@@ -94,6 +94,11 @@ export interface FieldsRead {
|
|
|
94
94
|
* states the fields a read may name — `undefined` when the author declared none,
|
|
95
95
|
* which makes any field read its own mistake — and `read` keeps the wording of
|
|
96
96
|
* the read rule it replaces, for the same reason. `open` admits any field.
|
|
97
|
+
* `partial` says the list may miss fields the value really carries (a
|
|
98
|
+
* connector operation's library schema): a read that differs from a declared
|
|
99
|
+
* field only in letter case is `<PREFIX>_READ_FIELD_CASE`, certain to read
|
|
100
|
+
* undefined, and any other miss is `<PREFIX>_READ_UNKNOWN_FIELD`, worded as a
|
|
101
|
+
* possible gap in the list, at the severity the family's catalog gives it.
|
|
97
102
|
*
|
|
98
103
|
* `reader` is for an output whose shape no field list states: an HTTP response is
|
|
99
104
|
* an envelope (`body`, `statusCode`, `headers`) whose `body` holds the author's
|
|
@@ -108,6 +113,7 @@ export type OutputContract = {
|
|
|
108
113
|
readonly kind: 'fields';
|
|
109
114
|
readonly fields: Readonly<Record<string, TypeDesc>> | undefined;
|
|
110
115
|
readonly open?: boolean;
|
|
116
|
+
readonly partial?: boolean;
|
|
111
117
|
readonly read: FieldsRead;
|
|
112
118
|
} | {
|
|
113
119
|
readonly kind: 'reader';
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -241,6 +241,9 @@ export declare const REFUSALS: {
|
|
|
241
241
|
readonly CONNECTOR_OBJECT_REQUIRED: "draft";
|
|
242
242
|
readonly CONNECTOR_OUTPUT_SOURCE: "lint";
|
|
243
243
|
readonly CONNECTOR_OUTPUT_VAR_CLASH: "lint";
|
|
244
|
+
readonly CONNECTOR_READ_FIELD_CASE: "lint";
|
|
245
|
+
readonly CONNECTOR_READ_NOT_OUTPUT: "lint";
|
|
246
|
+
readonly CONNECTOR_READ_UNKNOWN_FIELD: "lint";
|
|
244
247
|
readonly CONNECTOR_RESOLVE_FAILED: "lowering";
|
|
245
248
|
readonly CONTINUE_OUTSIDE_LOOP: "lowering";
|
|
246
249
|
readonly CONTRIBUTION_BINDING_UNRESOLVED: "draft";
|
package/dist/core/refusals.js
CHANGED
|
@@ -315,6 +315,9 @@ export const REFUSALS = {
|
|
|
315
315
|
CONNECTOR_OBJECT_REQUIRED: 'draft',
|
|
316
316
|
CONNECTOR_OUTPUT_SOURCE: 'lint',
|
|
317
317
|
CONNECTOR_OUTPUT_VAR_CLASH: 'lint',
|
|
318
|
+
CONNECTOR_READ_FIELD_CASE: 'lint',
|
|
319
|
+
CONNECTOR_READ_NOT_OUTPUT: 'lint',
|
|
320
|
+
CONNECTOR_READ_UNKNOWN_FIELD: 'lint',
|
|
318
321
|
CONNECTOR_RESOLVE_FAILED: 'lowering',
|
|
319
322
|
CONTINUE_OUTSIDE_LOOP: 'lowering',
|
|
320
323
|
CONTRIBUTION_BINDING_UNRESOLVED: 'draft',
|
|
@@ -11,6 +11,13 @@ import type { FlowContexts, FlowNodeFamily, FlowTriggerFamily, FlowTriggerType }
|
|
|
11
11
|
/** The families, in no significant order. Adding one is the whole of registering it. */
|
|
12
12
|
export declare const FLOW_NODE_FAMILIES: readonly FlowNodeFamily[];
|
|
13
13
|
export declare const FLOW_NODE_TYPES: NodeTypeRegistry<FlowContexts>;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a family's catalog marks `code` as about the node's type, not its
|
|
16
|
+
* content (`aboutNodeType`): an edit to a node the baseline reports it on too
|
|
17
|
+
* does not introduce it. Read by `check --baseline` (`scopeToEdit`) and by
|
|
18
|
+
* `merge --baseline-from`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isNodeTypeFinding(code: string): boolean;
|
|
14
21
|
/**
|
|
15
22
|
* Register a node-type package's family with the Flow registry
|
|
16
23
|
* (`@uipath/maestro-builder-sdk/extend`'s `defineFlowNodeFamily` calls this).
|
|
@@ -27,6 +27,15 @@ import { triggerFlowFamily } from './nodes/trigger/flow/family.js';
|
|
|
27
27
|
/** The families, in no significant order. Adding one is the whole of registering it. */
|
|
28
28
|
export const FLOW_NODE_FAMILIES = [agentFlowFamily, aiPatternsFlowFamily, connectorFlowFamily, conversationFlowFamily, dataFabricFlowFamily, delayFlowFamily, documentFlowFamily, hitlFlowFamily, httpFlowFamily, mockFlowFamily, processFlowFamily, queueFlowFamily, scriptFlowFamily, transformFlowFamily];
|
|
29
29
|
export const FLOW_NODE_TYPES = new NodeTypeRegistry('flow', FLOW_NODE_FAMILIES, { hasBundledDefinition });
|
|
30
|
+
/**
|
|
31
|
+
* Whether a family's catalog marks `code` as about the node's type, not its
|
|
32
|
+
* content (`aboutNodeType`): an edit to a node the baseline reports it on too
|
|
33
|
+
* does not introduce it. Read by `check --baseline` (`scopeToEdit`) and by
|
|
34
|
+
* `merge --baseline-from`.
|
|
35
|
+
*/
|
|
36
|
+
export function isNodeTypeFinding(code) {
|
|
37
|
+
return FLOW_NODE_TYPES.families.some((f) => Object.hasOwn(f.diagnostics, code) && f.diagnostics[code].aboutNodeType === true);
|
|
38
|
+
}
|
|
30
39
|
// Node-type packages contribute their families through the light `/extend` entry;
|
|
31
40
|
// adopt the ones already contributed and register every later one as it arrives.
|
|
32
41
|
adoptContributedFamilies((family) => FLOW_NODE_TYPES.register(family));
|
package/dist/flow-node-type.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { SolutionProjects } from './core/solution-projects.js';
|
|
13
13
|
import type { ResourceResolutions } from './core/resource-resolution.js';
|
|
14
|
-
import type { ArtifactContexts, FactoryCall, NodeType, OptionKeyLists } from './core/nodes/node-type.js';
|
|
14
|
+
import type { ArtifactContexts, FactoryCall, NodeType, OptionKeyLists, OutputContract } from './core/nodes/node-type.js';
|
|
15
15
|
import type { VersionedNodeType } from './core/nodes/versioned.js';
|
|
16
16
|
import type { DiagnosticCatalog, NodeFamily, Placement } from './core/nodes/family.js';
|
|
17
17
|
import type { DefinitionReference, NodeContribution } from './core/node-classes.js';
|
|
@@ -670,6 +670,13 @@ export interface FlowNodeType<Spec> extends NodeType<Spec, FlowNodeContribution,
|
|
|
670
670
|
* `errorPort`, so the two rungs give one answer; undefined when it cannot.
|
|
671
671
|
*/
|
|
672
672
|
checkDefinition?(spec: Spec, options: CheckOpts): unknown;
|
|
673
|
+
/**
|
|
674
|
+
* What reading this step's output yields, when only check's `options` can say
|
|
675
|
+
* (a connector operation's declared outputs, from the library). Check reads it
|
|
676
|
+
* in place of `output`; undefined falls back to `output`, so a check with no
|
|
677
|
+
* library judges the step as it always did.
|
|
678
|
+
*/
|
|
679
|
+
checkOutput?(spec: Spec, options: CheckOpts): OutputContract | undefined;
|
|
673
680
|
/**
|
|
674
681
|
* The node a spec builds, as far as the spec itself names it, for a per-tenant
|
|
675
682
|
* prefix type: its concrete type name, and the version the spec pins. A refused
|
package/dist/merge-cli.js
CHANGED
|
@@ -109,6 +109,7 @@ import { fetchesDefinitions, openWithFetchedDefinitions, withFetchedDefinitions
|
|
|
109
109
|
import { Bindings } from './bindings.js';
|
|
110
110
|
import { defaultBindingsFile } from './workdir.js';
|
|
111
111
|
import { loadNodePackages } from './node-packages.js';
|
|
112
|
+
import { isNodeTypeFinding } from './flow-node-registry.js';
|
|
112
113
|
import { baselineFromOriginal, checkEdited, compileSourceDraftTolerant, decompileOriginal } from './merge-compile.js';
|
|
113
114
|
import { classifyDrafts, classifyLowering, findingCounts, splitUnplaced } from './edit-scope.js';
|
|
114
115
|
const USAGE = 'usage: flow-merge <original.flow> <edited.flow | Edited.flow.ts> [-o merged.flow, or the original for a stamped .flow.ts] '
|
|
@@ -529,11 +530,24 @@ export async function run(argv) {
|
|
|
529
530
|
// refused when it does not: then the edit introduced it (#1322). With a
|
|
530
531
|
// precompiled --baseline file there is nothing to compare against, so every
|
|
531
532
|
// one is refused, as before.
|
|
533
|
+
const baselineChecks = baselineCompile === undefined ? []
|
|
534
|
+
: checkEdited(baselineCompile.built, baselineCompile.flow, checkOpts).filter((d) => d.level === 'error');
|
|
532
535
|
const baselineFindings = baselineCompile === undefined ? undefined : findingCounts([
|
|
533
536
|
...baselineCompile.drafts,
|
|
534
537
|
...baselineCompile.lowering,
|
|
535
|
-
...
|
|
538
|
+
...baselineChecks,
|
|
536
539
|
]);
|
|
540
|
+
// A finding about the node's type (`aboutNodeType`, a retired node) on a node
|
|
541
|
+
// the edit changed does not stop the write when the original's own round trip
|
|
542
|
+
// reports it on that node too: the node was already of that type, and the edit
|
|
543
|
+
// did not make it so. It is printed; a node the edit added stays
|
|
544
|
+
// refused. Needs --baseline-from: a precompiled --baseline carries no findings.
|
|
545
|
+
const typeFindings = new Set(baselineChecks.filter((d) => isNodeTypeFinding(d.code)).map((d) => `${d.nodeId}\n${d.code}`));
|
|
546
|
+
const keptType = checked.refused.filter((d) => d.reason === 'edited' && typeFindings.has(`${d.nodeId}\n${d.code}`));
|
|
547
|
+
checked.refused = checked.refused.filter((d) => !keptType.includes(d));
|
|
548
|
+
for (const d of keptType) {
|
|
549
|
+
console.error(` ⚠ [${d.code}] "${d.nodeId}" is changed, and the original has this finding on it too, so it does not stop the write: ${d.message}`);
|
|
550
|
+
}
|
|
537
551
|
const unplacedDrafts = splitUnplaced(unplaced, baselineFindings);
|
|
538
552
|
const unplacedChecks = splitUnplaced(checked.unplaced, baselineFindings);
|
|
539
553
|
const unplacedLowering = splitUnplaced(lowered.unplaced, baselineFindings);
|
|
@@ -557,7 +571,11 @@ export async function run(argv) {
|
|
|
557
571
|
: d.reason === 'uncompared'
|
|
558
572
|
? `"${d.nodeId}" is the original's, but the SDK cannot compile it, and ${baseline ? 'a precompiled --baseline has no record of' : 'with no baseline merge cannot tell'} `
|
|
559
573
|
+ 'whether the edit touched it; pass --baseline-from <original.flow> (instead of --baseline) so merge compiles the original itself and can compare the node'
|
|
560
|
-
:
|
|
574
|
+
: baselineCompile === undefined && isNodeTypeFinding(d.code)
|
|
575
|
+
? `"${d.nodeId}" is changed or new in the edited flow, and without a derived baseline merge cannot tell whether `
|
|
576
|
+
+ 'the original already had this finding on it; pass --baseline-from <original.flow> (instead of --baseline) '
|
|
577
|
+
+ 'so a node the original already had is written with a warning'
|
|
578
|
+
: `"${d.nodeId}" is changed or new in the edited flow`;
|
|
561
579
|
console.error(` ✗ [${d.code}] ${where}: ${d.message}`);
|
|
562
580
|
}
|
|
563
581
|
console.error(`flow-merge: ${errors.length} error(s) in nodes merge takes from the edited flow; each line says what to do (finish the node, revert the edit, or pass what merge needs). Nothing written.`);
|
|
@@ -623,6 +641,9 @@ export async function run(argv) {
|
|
|
623
641
|
writeJsonFile(target, sidecar.json);
|
|
624
642
|
console.log(`flow-merge: wrote ${sidecar.path} (carries ${sidecar.carried.join(', ')})`);
|
|
625
643
|
}
|
|
644
|
+
for (const { nodeId, inputs } of merged.onNodes) {
|
|
645
|
+
console.log(`flow-merge: carried the agent.json edit onto embedded agent "${nodeId}" (${inputs.map((k) => `inputs.${k}`).join(', ')})`);
|
|
646
|
+
}
|
|
626
647
|
const originalDir = dirOf(originalPath);
|
|
627
648
|
// A resource another `.flow` in the project still names stays (compile's prune
|
|
628
649
|
// has the same guard): a decompiled canvas agent keeps its `source` directory,
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
* merge), the edited node is taken, and every key the original has that the
|
|
30
30
|
* shell does not (the configuration) is put back.
|
|
31
31
|
*
|
|
32
|
-
* A prompt or model edit in the source
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
32
|
+
* A prompt or model edit in the source lands in the edited `<source>/agent.json`,
|
|
33
|
+
* which the embedded node shadows. For an inline agent, whose `agent.json` the
|
|
34
|
+
* SDK writes from the same options the node carries, merge writes the author's
|
|
35
|
+
* change to that file (baseline compile to edited compile) onto the node
|
|
36
|
+
* instead ({@link carryAgentJsonEdit}). What it cannot carry is reported, and
|
|
37
|
+
* `strict` refuses any merged node that would no longer carry the original's
|
|
38
|
+
* embedded configuration, apart from what the author changed, or whose prompt
|
|
39
|
+
* names an input the node no longer declares ({@link embeddedAgentFindings}).
|
|
38
40
|
*/
|
|
39
41
|
import type { MergeFinding } from './merge-roundtrip.js';
|
|
40
42
|
interface AgentNode {
|
|
@@ -62,29 +64,63 @@ export declare function isEmbeddedAgent(node: {
|
|
|
62
64
|
* @returns The original node with the edit's changed structural inputs and changed top-level keys applied.
|
|
63
65
|
*/
|
|
64
66
|
export declare function mergeEmbeddedAgentNode<N extends AgentNode>(orig: N, edited: N, base: N | undefined): N;
|
|
67
|
+
/**
|
|
68
|
+
* Write the author's `agent.json` edit onto an embedded inline agent node, which
|
|
69
|
+
* is read before its `agent.json` and so would never see it.
|
|
70
|
+
*
|
|
71
|
+
* `changed` are the paths that differ from `baseline` to `edited` (both
|
|
72
|
+
* compiled). A prompt is written as the edited file has it, with each input in
|
|
73
|
+
* the name the node declares it by ({@link inNodeInputNames}). A removed
|
|
74
|
+
* setting is not carried: the original `agent.json`, which merge keeps, still
|
|
75
|
+
* has it, and decompile would read it back from there. The schemas are
|
|
76
|
+
* not carried here: the node's descriptor arrays hold them, and merge applied
|
|
77
|
+
* that node change already. Anything else (a conversational or voice agent's
|
|
78
|
+
* file, a message list compile does not write, a setting the node has no input
|
|
79
|
+
* for) is returned as not carried.
|
|
80
|
+
*
|
|
81
|
+
* For example a baseline system prompt `"Triage"` edited to `"Triage and rank"`
|
|
82
|
+
* sets `inputs.systemPrompt` to `"Triage and rank"` and returns
|
|
83
|
+
* `{ inputs: ['systemPrompt'], notCarried: [] }`.
|
|
84
|
+
*
|
|
85
|
+
* @param node - The merged node, still embedded; its `inputs` are changed in place.
|
|
86
|
+
* @param baseline - The baseline compile's `agent.json`.
|
|
87
|
+
* @param edited - The edited compile's `agent.json`.
|
|
88
|
+
* @param changed - The paths from `baseline` to `edited`, as `mergeJson3` names them.
|
|
89
|
+
*/
|
|
90
|
+
export declare function carryAgentJsonEdit(node: {
|
|
91
|
+
type?: string;
|
|
92
|
+
inputs?: Record<string, unknown>;
|
|
93
|
+
}, baseline: unknown, edited: unknown, changed: readonly string[]): {
|
|
94
|
+
inputs: string[];
|
|
95
|
+
notCarried: string[];
|
|
96
|
+
};
|
|
65
97
|
/**
|
|
66
98
|
* What a merged embedded agent needs said, per original embedded agent (root
|
|
67
99
|
* and subflows, matched by scope and node id):
|
|
68
100
|
*
|
|
69
101
|
* - `agent-storage` (refuses): the merged node no longer carries the original's
|
|
70
102
|
* embedded configuration, so the runtime would read `<source>/agent.json`
|
|
71
|
-
* instead — a model or prompt change the author never wrote.
|
|
103
|
+
* instead — a model or prompt change the author never wrote. The inputs merge
|
|
104
|
+
* carried from the author's `agent.json` edit ({@link carryAgentJsonEdit}) are
|
|
105
|
+
* the author's, not lost.
|
|
72
106
|
* - `agent-prompt-input` (refuses): a kept prompt names `{{input.X}}` but the
|
|
73
107
|
* merged node declares no input `X` (the edit removed or renamed it), so the
|
|
74
108
|
* prompt would render the placeholder empty.
|
|
75
109
|
* - `agent-embedded-edit` (warns): the author edited the node; merge applied the
|
|
76
|
-
* node change and kept the original's prompts, model and settings
|
|
77
|
-
*
|
|
110
|
+
* node change and kept the original's prompts, model and settings apart from
|
|
111
|
+
* what it carried, so any other configuration edit did not reach this agent.
|
|
78
112
|
*
|
|
79
113
|
* @param hasBaseline - Whether the merge had a baseline. Without one, merge
|
|
80
114
|
* cannot tell the author's change from the round trip's, so the
|
|
81
115
|
* `agent-embedded-edit` warning says the node may have been edited.
|
|
82
116
|
* @param scopes - Per scope (`''` = root, otherwise the subflow key): the original, merged and edited-node-ids.
|
|
117
|
+
* @param authored - Per merged node, the inputs {@link carryAgentJsonEdit} wrote onto it. Absent when the
|
|
118
|
+
* merge read no `agent.json` sidecars (`mergeFlow`), so nothing could be carried and the warning says so.
|
|
83
119
|
*/
|
|
84
120
|
export declare function embeddedAgentFindings(hasBaseline: boolean, scopes: Array<{
|
|
85
121
|
scope: string;
|
|
86
122
|
original: AgentNode[];
|
|
87
123
|
merged: AgentNode[];
|
|
88
124
|
edited: ReadonlySet<string>;
|
|
89
|
-
}>): MergeFinding[];
|
|
125
|
+
}>, authored?: ReadonlyMap<object, readonly string[]>): MergeFinding[];
|
|
90
126
|
export {};
|
|
@@ -29,23 +29,44 @@
|
|
|
29
29
|
* merge), the edited node is taken, and every key the original has that the
|
|
30
30
|
* shell does not (the configuration) is put back.
|
|
31
31
|
*
|
|
32
|
-
* A prompt or model edit in the source
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
32
|
+
* A prompt or model edit in the source lands in the edited `<source>/agent.json`,
|
|
33
|
+
* which the embedded node shadows. For an inline agent, whose `agent.json` the
|
|
34
|
+
* SDK writes from the same options the node carries, merge writes the author's
|
|
35
|
+
* change to that file (baseline compile to edited compile) onto the node
|
|
36
|
+
* instead ({@link carryAgentJsonEdit}). What it cannot carry is reported, and
|
|
37
|
+
* `strict` refuses any merged node that would no longer carry the original's
|
|
38
|
+
* embedded configuration, apart from what the author changed, or whose prompt
|
|
39
|
+
* names an input the node no longer declares ({@link embeddedAgentFindings}).
|
|
38
40
|
*/
|
|
41
|
+
import { agentInputRef } from './core/agent-sidecar.js';
|
|
39
42
|
import { jsonClone } from './core/json-clone.js';
|
|
43
|
+
import { wireExprBody } from './core/wire-expr.js';
|
|
40
44
|
/**
|
|
41
45
|
* The agent node types whose configuration can live on the node or in
|
|
42
46
|
* `<source>/agent.json`, and whether a `voice` settings object on the node
|
|
43
47
|
* counts as embedded configuration (flow-schema counts it on the voice node only).
|
|
44
48
|
*/
|
|
45
49
|
const SIDECAR_AGENT_TYPES = new Map([
|
|
46
|
-
['uipath.agent.autonomous', { voiceSettings: false }],
|
|
47
|
-
['uipath.agent.conversational', { voiceSettings: false }],
|
|
48
|
-
['uipath.agent.voice', { voiceSettings: true }],
|
|
50
|
+
['uipath.agent.autonomous', { voiceSettings: false, inlineAgentJson: true }],
|
|
51
|
+
['uipath.agent.conversational', { voiceSettings: false, inlineAgentJson: false }],
|
|
52
|
+
['uipath.agent.voice', { voiceSettings: true, inlineAgentJson: false }],
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* The inline agent's `agent.json` settings an embedded node carries as inputs,
|
|
56
|
+
* by setting: `inlineAgentJson` writes each from the option of the input's
|
|
57
|
+
* name, and decompile lifts the node's input to that option.
|
|
58
|
+
*/
|
|
59
|
+
const SETTINGS_ON_THE_NODE = new Map([
|
|
60
|
+
['model', 'model'],
|
|
61
|
+
['temperature', 'temperature'],
|
|
62
|
+
['maxTokens', 'maxTokenPerResponse'],
|
|
63
|
+
['maxIterations', 'maxIterations'],
|
|
64
|
+
['mode', 'mode'],
|
|
65
|
+
]);
|
|
66
|
+
/** The inline agent's `agent.json` messages an embedded node carries as inputs, by role. */
|
|
67
|
+
const PROMPTS_ON_THE_NODE = new Map([
|
|
68
|
+
['system', 'systemPrompt'],
|
|
69
|
+
['user', 'userPrompt'],
|
|
49
70
|
]);
|
|
50
71
|
/**
|
|
51
72
|
* The agent-node inputs that are flow-level and survive Studio Web's shell
|
|
@@ -177,6 +198,108 @@ export function mergeEmbeddedAgentNode(orig, edited, base) {
|
|
|
177
198
|
out.inputs = inputs;
|
|
178
199
|
return out;
|
|
179
200
|
}
|
|
201
|
+
const isDict = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
202
|
+
/** An inline agent's prompts by role, when its messages are one system and one user message, as compile writes them. */
|
|
203
|
+
function promptsOf(agentJson) {
|
|
204
|
+
const messages = agentJson.messages;
|
|
205
|
+
if (!Array.isArray(messages) || messages.length !== PROMPTS_ON_THE_NODE.size)
|
|
206
|
+
return undefined;
|
|
207
|
+
const out = new Map();
|
|
208
|
+
for (const m of messages) {
|
|
209
|
+
if (!isDict(m) || typeof m.role !== 'string' || !PROMPTS_ON_THE_NODE.has(m.role) || typeof m.content !== 'string')
|
|
210
|
+
return undefined;
|
|
211
|
+
out.set(m.role, m.content);
|
|
212
|
+
}
|
|
213
|
+
return out.size === PROMPTS_ON_THE_NODE.size ? out : undefined;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* A prompt compile wrote, in the input names an embedded node declares. Compile
|
|
217
|
+
* writes each input's FLAT NAME (`{{input.prep1__output__ticket}}`); an
|
|
218
|
+
* embedded node may declare that input under another id (`ticket`), which its
|
|
219
|
+
* prompts use. A flat name the node also declares as an id is left as it is.
|
|
220
|
+
*/
|
|
221
|
+
function inNodeInputNames(prompt, agentInputVariables) {
|
|
222
|
+
const vars = (Array.isArray(agentInputVariables) ? agentInputVariables : []).filter(isDict);
|
|
223
|
+
const ids = new Set(vars.map((v) => v.id));
|
|
224
|
+
let out = prompt;
|
|
225
|
+
for (const v of vars) {
|
|
226
|
+
if (typeof v.id !== 'string' || typeof v.binding !== 'string')
|
|
227
|
+
continue;
|
|
228
|
+
const flatName = agentInputRef(`=js:${wireExprBody(v.binding)}`)?.flatName;
|
|
229
|
+
if (flatName === undefined || ids.has(flatName))
|
|
230
|
+
continue;
|
|
231
|
+
out = out.split(`{{input.${flatName}}}`).join(`{{input.${v.id}}}`);
|
|
232
|
+
}
|
|
233
|
+
return out;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Write the author's `agent.json` edit onto an embedded inline agent node, which
|
|
237
|
+
* is read before its `agent.json` and so would never see it.
|
|
238
|
+
*
|
|
239
|
+
* `changed` are the paths that differ from `baseline` to `edited` (both
|
|
240
|
+
* compiled). A prompt is written as the edited file has it, with each input in
|
|
241
|
+
* the name the node declares it by ({@link inNodeInputNames}). A removed
|
|
242
|
+
* setting is not carried: the original `agent.json`, which merge keeps, still
|
|
243
|
+
* has it, and decompile would read it back from there. The schemas are
|
|
244
|
+
* not carried here: the node's descriptor arrays hold them, and merge applied
|
|
245
|
+
* that node change already. Anything else (a conversational or voice agent's
|
|
246
|
+
* file, a message list compile does not write, a setting the node has no input
|
|
247
|
+
* for) is returned as not carried.
|
|
248
|
+
*
|
|
249
|
+
* For example a baseline system prompt `"Triage"` edited to `"Triage and rank"`
|
|
250
|
+
* sets `inputs.systemPrompt` to `"Triage and rank"` and returns
|
|
251
|
+
* `{ inputs: ['systemPrompt'], notCarried: [] }`.
|
|
252
|
+
*
|
|
253
|
+
* @param node - The merged node, still embedded; its `inputs` are changed in place.
|
|
254
|
+
* @param baseline - The baseline compile's `agent.json`.
|
|
255
|
+
* @param edited - The edited compile's `agent.json`.
|
|
256
|
+
* @param changed - The paths from `baseline` to `edited`, as `mergeJson3` names them.
|
|
257
|
+
*/
|
|
258
|
+
export function carryAgentJsonEdit(node, baseline, edited, changed) {
|
|
259
|
+
const onTheNode = changed.filter((p) => !/^(inputSchema|outputSchema)(\.|\[|$)/.test(p));
|
|
260
|
+
const kind = node.type === undefined ? undefined : SIDECAR_AGENT_TYPES.get(node.type);
|
|
261
|
+
if (!kind?.inlineAgentJson || !isDict(baseline) || !isDict(edited))
|
|
262
|
+
return { inputs: [], notCarried: onTheNode };
|
|
263
|
+
const inputs = { ...(node.inputs ?? {}) };
|
|
264
|
+
const carried = new Set();
|
|
265
|
+
const notCarried = [];
|
|
266
|
+
const set = (key, value, path) => {
|
|
267
|
+
if (value === undefined) {
|
|
268
|
+
notCarried.push(path);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
inputs[key] = jsonClone(value);
|
|
272
|
+
carried.add(key);
|
|
273
|
+
};
|
|
274
|
+
const settings = isDict(edited.settings) ? edited.settings : {};
|
|
275
|
+
let messages = false;
|
|
276
|
+
for (const p of onTheNode) {
|
|
277
|
+
const setting = /^settings\.([A-Za-z]+)$/.exec(p)?.[1];
|
|
278
|
+
const input = setting === undefined ? undefined : SETTINGS_ON_THE_NODE.get(setting);
|
|
279
|
+
if (input !== undefined)
|
|
280
|
+
set(input, settings[setting], p);
|
|
281
|
+
else if (/^guardrails(\.|\[|$)/.test(p))
|
|
282
|
+
set('guardrails', edited.guardrails, p);
|
|
283
|
+
else if (/^messages(\.|\[|$)/.test(p))
|
|
284
|
+
messages = true;
|
|
285
|
+
else
|
|
286
|
+
notCarried.push(p);
|
|
287
|
+
}
|
|
288
|
+
if (messages) {
|
|
289
|
+
const before = promptsOf(baseline);
|
|
290
|
+
const after = promptsOf(edited);
|
|
291
|
+
if (before === undefined || after === undefined)
|
|
292
|
+
notCarried.push('messages');
|
|
293
|
+
else {
|
|
294
|
+
for (const [role, key] of PROMPTS_ON_THE_NODE) {
|
|
295
|
+
if (before.get(role) !== after.get(role))
|
|
296
|
+
set(key, inNodeInputNames(after.get(role), inputs.agentInputVariables), 'messages');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
node.inputs = inputs;
|
|
301
|
+
return { inputs: [...carried], notCarried };
|
|
302
|
+
}
|
|
180
303
|
/** `{{input.<name>}}` placeholders in a prompt string. */
|
|
181
304
|
function promptInputs(prompt) {
|
|
182
305
|
if (typeof prompt !== 'string')
|
|
@@ -189,20 +312,24 @@ function promptInputs(prompt) {
|
|
|
189
312
|
*
|
|
190
313
|
* - `agent-storage` (refuses): the merged node no longer carries the original's
|
|
191
314
|
* embedded configuration, so the runtime would read `<source>/agent.json`
|
|
192
|
-
* instead — a model or prompt change the author never wrote.
|
|
315
|
+
* instead — a model or prompt change the author never wrote. The inputs merge
|
|
316
|
+
* carried from the author's `agent.json` edit ({@link carryAgentJsonEdit}) are
|
|
317
|
+
* the author's, not lost.
|
|
193
318
|
* - `agent-prompt-input` (refuses): a kept prompt names `{{input.X}}` but the
|
|
194
319
|
* merged node declares no input `X` (the edit removed or renamed it), so the
|
|
195
320
|
* prompt would render the placeholder empty.
|
|
196
321
|
* - `agent-embedded-edit` (warns): the author edited the node; merge applied the
|
|
197
|
-
* node change and kept the original's prompts, model and settings
|
|
198
|
-
*
|
|
322
|
+
* node change and kept the original's prompts, model and settings apart from
|
|
323
|
+
* what it carried, so any other configuration edit did not reach this agent.
|
|
199
324
|
*
|
|
200
325
|
* @param hasBaseline - Whether the merge had a baseline. Without one, merge
|
|
201
326
|
* cannot tell the author's change from the round trip's, so the
|
|
202
327
|
* `agent-embedded-edit` warning says the node may have been edited.
|
|
203
328
|
* @param scopes - Per scope (`''` = root, otherwise the subflow key): the original, merged and edited-node-ids.
|
|
329
|
+
* @param authored - Per merged node, the inputs {@link carryAgentJsonEdit} wrote onto it. Absent when the
|
|
330
|
+
* merge read no `agent.json` sidecars (`mergeFlow`), so nothing could be carried and the warning says so.
|
|
204
331
|
*/
|
|
205
|
-
export function embeddedAgentFindings(hasBaseline, scopes) {
|
|
332
|
+
export function embeddedAgentFindings(hasBaseline, scopes, authored) {
|
|
206
333
|
const out = [];
|
|
207
334
|
for (const { scope, original, merged, edited } of scopes) {
|
|
208
335
|
const where = scope === '' ? '' : ` in subflow "${scope}"`;
|
|
@@ -213,8 +340,9 @@ export function embeddedAgentFindings(hasBaseline, scopes) {
|
|
|
213
340
|
const m = mergedById.get(o.id);
|
|
214
341
|
if (m === undefined || m.type !== o.type)
|
|
215
342
|
continue; // deleted or replaced by the author
|
|
343
|
+
const byAuthor = new Set(authored?.get(m) ?? []);
|
|
216
344
|
const lost = Object.entries(configInputs(o))
|
|
217
|
-
.filter(([k, v]) => !same(m.inputs?.[k], v))
|
|
345
|
+
.filter(([k, v]) => !byAuthor.has(k) && !same(m.inputs?.[k], v))
|
|
218
346
|
.map(([k]) => k);
|
|
219
347
|
if (!isEmbeddedAgent(m) || lost.length > 0) {
|
|
220
348
|
out.push({
|
|
@@ -228,17 +356,36 @@ export function embeddedAgentFindings(hasBaseline, scopes) {
|
|
|
228
356
|
const declared = new Set((Array.isArray(m.inputs?.agentInputVariables) ? m.inputs.agentInputVariables : [])
|
|
229
357
|
.map((v) => v?.id)
|
|
230
358
|
.filter((id) => typeof id === 'string'));
|
|
231
|
-
const missing = [...new Set([...promptInputs(m.inputs?.systemPrompt), ...promptInputs(m.inputs?.userPrompt)])]
|
|
232
|
-
.filter((name) => !declared.has(name));
|
|
233
359
|
const origDeclared = new Set((Array.isArray(o.inputs?.agentInputVariables) ? o.inputs.agentInputVariables : []).map((v) => v?.id));
|
|
234
|
-
//
|
|
235
|
-
|
|
236
|
-
|
|
360
|
+
// Prompt by prompt, a placeholder the node does not declare: one the edit
|
|
361
|
+
// removed or renamed, or one the author's carried prompt added. One the
|
|
362
|
+
// original prompt already left undeclared is not the merge's doing.
|
|
363
|
+
const kept = new Set();
|
|
364
|
+
const added = new Set();
|
|
365
|
+
for (const key of ['systemPrompt', 'userPrompt']) {
|
|
366
|
+
const before = new Set(promptInputs(o.inputs?.[key]));
|
|
367
|
+
for (const name of promptInputs(m.inputs?.[key])) {
|
|
368
|
+
if (declared.has(name))
|
|
369
|
+
continue;
|
|
370
|
+
if (byAuthor.has(key) && !before.has(name))
|
|
371
|
+
added.add(name);
|
|
372
|
+
else if (origDeclared.has(name))
|
|
373
|
+
kept.add(name);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const placeholders = (names) => [...names].map((n) => `{{input.${n}}}`).join(', ');
|
|
377
|
+
if (added.size > 0) {
|
|
378
|
+
out.push({
|
|
379
|
+
kind: 'agent-prompt-input', refuses: true,
|
|
380
|
+
message: `agent "${o.id}"${where}: the edited prompt uses ${placeholders(added)}, but the node declares no `
|
|
381
|
+
+ 'such input, so the prompt would render it empty. Declare it in the agent\'s inputs.',
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
if (kept.size > 0) {
|
|
237
385
|
out.push({
|
|
238
386
|
kind: 'agent-prompt-input', refuses: true,
|
|
239
|
-
message: `agent "${o.id}"${where} keeps
|
|
240
|
-
+
|
|
241
|
-
+ 'An embedded agent\'s prompts are not taken from the source; change the prompt on the canvas too.',
|
|
387
|
+
message: `agent "${o.id}"${where} keeps a prompt that uses ${placeholders(kept)}, but the edit removed or `
|
|
388
|
+
+ 'renamed that input. Change the prompt in the source too, so merge carries it onto the node.',
|
|
242
389
|
});
|
|
243
390
|
}
|
|
244
391
|
if (edited.has(o.id)) {
|
|
@@ -249,9 +396,17 @@ export function embeddedAgentFindings(hasBaseline, scopes) {
|
|
|
249
396
|
? 'your change to the node'
|
|
250
397
|
: 'the edited node\'s inputs and outputs (with no baseline it cannot tell your change from the round trip\'s, '
|
|
251
398
|
+ 'so this node may not have been edited)')
|
|
252
|
-
+
|
|
253
|
-
|
|
254
|
-
|
|
399
|
+
+ (byAuthor.size > 0
|
|
400
|
+
? `, wrote your ${[...byAuthor].sort().map((k) => `inputs.${k}`).join(', ')} edit onto the node, and kept the rest `
|
|
401
|
+
+ 'of its configuration as the original has it.'
|
|
402
|
+
: ' and kept those as the original has them.')
|
|
403
|
+
+ (!hasBaseline
|
|
404
|
+
? ' With no baseline, a prompt, model or settings edit in the source is not carried for an embedded agent '
|
|
405
|
+
+ '(it would land in <source>/agent.json, which the node shadows); pass --baseline to carry it.'
|
|
406
|
+
: authored === undefined
|
|
407
|
+
? ' This merge read no agent.json, so a prompt, model or settings edit in the source is not carried for '
|
|
408
|
+
+ 'an embedded agent; merge with the sidecars (flow-merge, or mergeFlowWithSidecars) to carry it.'
|
|
409
|
+
: ''),
|
|
255
410
|
});
|
|
256
411
|
}
|
|
257
412
|
}
|
package/dist/merge-sidecars.d.ts
CHANGED
|
@@ -66,6 +66,13 @@ export declare function agentSources(flow: {
|
|
|
66
66
|
* `{a: 3, b: 2}` and `changed = ["a"]`.
|
|
67
67
|
*/
|
|
68
68
|
export declare function mergeJson3(original: unknown, baseline: unknown, edited: unknown, changed: string[], path?: string): unknown;
|
|
69
|
+
/** One embedded agent node merge wrote the author's `agent.json` edit onto. */
|
|
70
|
+
export interface NodeCarry {
|
|
71
|
+
/** The merged node, changed in place. */
|
|
72
|
+
node: AnyNode;
|
|
73
|
+
/** The `inputs` keys written. */
|
|
74
|
+
inputs: string[];
|
|
75
|
+
}
|
|
69
76
|
/**
|
|
70
77
|
* The sidecar files the merged flow needs written beside it, and what merge could
|
|
71
78
|
* not carry. `merged` is `mergeFlow`'s result. An agent is new when the
|
|
@@ -82,5 +89,6 @@ export declare function mergeAgentSidecars(merged: {
|
|
|
82
89
|
removals: string[];
|
|
83
90
|
findings: MergeFinding[];
|
|
84
91
|
missing: MergeFinding[];
|
|
92
|
+
onNodes: NodeCarry[];
|
|
85
93
|
};
|
|
86
94
|
export {};
|
package/dist/merge-sidecars.js
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
*/
|
|
67
67
|
import { builtinResourceDirectory } from './core/agent-resource-identity.js';
|
|
68
68
|
import { jsonClone } from './core/json-clone.js';
|
|
69
|
-
import { isEmbeddedAgent } from './merge-embedded-agent.js';
|
|
69
|
+
import { carryAgentJsonEdit, isEmbeddedAgent } from './merge-embedded-agent.js';
|
|
70
70
|
/** The `{ path, json }` list `serializeWithSidecars` returns, as a {@link SidecarSet}. */
|
|
71
71
|
export function sidecarSetFromList(list) {
|
|
72
72
|
return (source) => {
|
|
@@ -268,13 +268,6 @@ function carryResources(source, files, flows) {
|
|
|
268
268
|
}
|
|
269
269
|
return { writes, removals, unmatched };
|
|
270
270
|
}
|
|
271
|
-
/**
|
|
272
|
-
* The `agent.json` keys an embedded node carries itself, in its descriptor
|
|
273
|
-
* arrays (`agentInputVariables` / `agentOutputVariables`). An input or output
|
|
274
|
-
* edit changes them in the compiled `agent.json` and on the node; merge applies
|
|
275
|
-
* the node change (#1220), so their delta is not an edit the node shadows.
|
|
276
|
-
*/
|
|
277
|
-
const SCHEMA_ON_THE_NODE = /^(inputSchema|outputSchema)(\.|$)/;
|
|
278
271
|
const finding = (message) => ({ kind: 'agent-sidecar', message, refuses: true });
|
|
279
272
|
/**
|
|
280
273
|
* The sidecar files the merged flow needs written beside it, and what merge could
|
|
@@ -286,6 +279,7 @@ const finding = (message) => ({ kind: 'agent-sidecar', message, refuses: true })
|
|
|
286
279
|
*/
|
|
287
280
|
export function mergeAgentSidecars(merged, sources, flows) {
|
|
288
281
|
const writes = [];
|
|
282
|
+
const onNodes = [];
|
|
289
283
|
const removals = [];
|
|
290
284
|
const findings = [];
|
|
291
285
|
const missing = [];
|
|
@@ -297,6 +291,23 @@ export function mergeAgentSidecars(merged, sources, flows) {
|
|
|
297
291
|
const orig = sources.original(source);
|
|
298
292
|
const agentPath = `${source}/agent.json`;
|
|
299
293
|
const originalNode = originalAgents.get(source);
|
|
294
|
+
const base = sources.baseline?.(source);
|
|
295
|
+
// An embedded node (prompts or voice settings on the node) is read before
|
|
296
|
+
// agent.json, so the author's agent.json edit is written onto the node, and
|
|
297
|
+
// what cannot be is reported. `node` is the merged node: for an embedded
|
|
298
|
+
// original, the original plus the author's node change (#1220), still embedded.
|
|
299
|
+
if (base !== undefined && isEmbeddedAgent(node)) {
|
|
300
|
+
const changed = [];
|
|
301
|
+
mergeJson3(base[agentPath], base[agentPath], edited[agentPath], changed);
|
|
302
|
+
const { inputs, notCarried } = carryAgentJsonEdit(node, base[agentPath], edited[agentPath], changed);
|
|
303
|
+
if (inputs.length > 0)
|
|
304
|
+
onNodes.push({ node, inputs });
|
|
305
|
+
if (notCarried.length > 0) {
|
|
306
|
+
findings.push(finding(`agent "${node.id}": its ${agentPath} was edited (${notCarried.join(', ')}), but the original node carries its `
|
|
307
|
+
+ 'own configuration (embedded), which is read before agent.json, so the edit would not reach the agent. That '
|
|
308
|
+
+ 'change is NOT carried. Make it on the canvas, or save the agent with its prompts in agent.json only.'));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
300
311
|
if (orig === undefined && originalNode !== undefined && !isEmbeddedAgent(originalNode)) {
|
|
301
312
|
missing.push(finding(`agent "${node.id}": the original flow has this agent, but ${agentPath} is not beside --original, or does not `
|
|
302
313
|
+ `parse. Nothing is written. Pass the project's own <Name>.flow as --original, with ${agentPath} beside it `
|
|
@@ -310,7 +321,6 @@ export function mergeAgentSidecars(merged, sources, flows) {
|
|
|
310
321
|
writes.push({ path, json: jsonClone(json), carried: ['new agent'] });
|
|
311
322
|
continue;
|
|
312
323
|
}
|
|
313
|
-
const base = sources.baseline?.(source);
|
|
314
324
|
if (base === undefined) {
|
|
315
325
|
if (stable(orig[agentPath]) !== stable(edited[agentPath])) {
|
|
316
326
|
const why = sources.baselineMissing
|
|
@@ -333,25 +343,10 @@ export function mergeAgentSidecars(merged, sources, flows) {
|
|
|
333
343
|
// agent.json: the author's delta, applied onto the original.
|
|
334
344
|
const changed = [];
|
|
335
345
|
const next = mergeJson3(orig[agentPath], base[agentPath], edited[agentPath], changed);
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
// An embedded node (prompts or voice settings on the node) is read before
|
|
341
|
-
// agent.json, so an agent.json edit does not reach it. Its input and
|
|
342
|
-
// output schemas are the exception: the node's descriptor arrays carry
|
|
343
|
-
// them, and merge applied that node change already.
|
|
344
|
-
if (isEmbeddedAgent(node)) {
|
|
345
|
-
const shadowed = changed.filter((p) => !SCHEMA_ON_THE_NODE.test(p));
|
|
346
|
-
if (shadowed.length > 0) {
|
|
347
|
-
findings.push(finding(`agent "${node.id}": its ${agentPath} was edited (${shadowed.join(', ')}), but the original node carries its `
|
|
348
|
-
+ 'own configuration (embedded), which is read before agent.json, so the edit would not reach the agent. The '
|
|
349
|
-
+ 'change is NOT carried. Make the change on the canvas, or save the agent with its prompts in agent.json only.'));
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
else if (stable(next) !== stable(orig[agentPath])) {
|
|
353
|
-
writes.push({ path: agentPath, json: next, carried: changed });
|
|
354
|
-
}
|
|
346
|
+
// An embedded node's edit went onto the node above; its agent.json, which
|
|
347
|
+
// the node shadows, stays the original's.
|
|
348
|
+
if (changed.length > 0 && !isEmbeddedAgent(node) && stable(next) !== stable(orig[agentPath])) {
|
|
349
|
+
writes.push({ path: agentPath, json: next, carried: changed });
|
|
355
350
|
}
|
|
356
351
|
// Resources: carried by identity (#1221), when the three flows are known.
|
|
357
352
|
if (flows === undefined) {
|
|
@@ -372,5 +367,5 @@ export function mergeAgentSidecars(merged, sources, flows) {
|
|
|
372
367
|
+ 'stay as they are. Make that change on the canvas.'));
|
|
373
368
|
}
|
|
374
369
|
}
|
|
375
|
-
return { writes, removals, findings, missing };
|
|
370
|
+
return { writes, removals, findings, missing, onNodes };
|
|
376
371
|
}
|
package/dist/merge.d.ts
CHANGED
|
@@ -139,13 +139,18 @@ export declare function mergeFlow(original: AnyFlow, edited: AnyFlow, options?:
|
|
|
139
139
|
* `mergeFlow`, plus the agent sidecar files the merged flow needs written beside
|
|
140
140
|
* it (#1207). An inline agent's prompts and settings live only in
|
|
141
141
|
* `<source>/agent.json`, so an edit to them changes no node; this carries the
|
|
142
|
-
* author's change to that file onto the original's copy
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
142
|
+
* author's change to that file onto the original's copy, or, for an embedded
|
|
143
|
+
* agent, which reads its prompts and settings from the node, onto the node
|
|
144
|
+
* (`onNodes`). What it cannot carry becomes a finding: warned, and refused
|
|
145
|
+
* under `strict`, with the flow's own findings. One that would replace the
|
|
146
|
+
* project's `agent.json` is refused in every mode. See merge-sidecars.ts.
|
|
146
147
|
*/
|
|
147
148
|
export declare function mergeFlowWithSidecars(original: AnyFlow, edited: AnyFlow, sidecars: MergeSidecarSources, options?: MergeOptions): {
|
|
148
149
|
flow: AnyFlow;
|
|
149
150
|
sidecars: SidecarWrite[];
|
|
150
151
|
removals: string[];
|
|
152
|
+
onNodes: Array<{
|
|
153
|
+
nodeId: string;
|
|
154
|
+
inputs: string[];
|
|
155
|
+
}>;
|
|
151
156
|
};
|
package/dist/merge.js
CHANGED
|
@@ -384,24 +384,32 @@ function positionStoreOf(f) {
|
|
|
384
384
|
return nodes && Object.keys(nodes).length > 0 ? nodes : undefined;
|
|
385
385
|
}
|
|
386
386
|
export function mergeFlow(original, edited, options = {}) {
|
|
387
|
-
const { result, findings } = mergeFlowFindings(original, edited, options);
|
|
388
|
-
reportOrRefuse(findings, options);
|
|
387
|
+
const { result, findings, agentFindings } = mergeFlowFindings(original, edited, options);
|
|
388
|
+
reportOrRefuse([...findings, ...agentFindings()], options);
|
|
389
389
|
return result;
|
|
390
390
|
}
|
|
391
391
|
/**
|
|
392
392
|
* `mergeFlow`, plus the agent sidecar files the merged flow needs written beside
|
|
393
393
|
* it (#1207). An inline agent's prompts and settings live only in
|
|
394
394
|
* `<source>/agent.json`, so an edit to them changes no node; this carries the
|
|
395
|
-
* author's change to that file onto the original's copy
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
395
|
+
* author's change to that file onto the original's copy, or, for an embedded
|
|
396
|
+
* agent, which reads its prompts and settings from the node, onto the node
|
|
397
|
+
* (`onNodes`). What it cannot carry becomes a finding: warned, and refused
|
|
398
|
+
* under `strict`, with the flow's own findings. One that would replace the
|
|
399
|
+
* project's `agent.json` is refused in every mode. See merge-sidecars.ts.
|
|
399
400
|
*/
|
|
400
401
|
export function mergeFlowWithSidecars(original, edited, sidecars, options = {}) {
|
|
401
|
-
const { result, findings } = mergeFlowFindings(original, edited, options);
|
|
402
|
+
const { result, findings, agentFindings } = mergeFlowFindings(original, edited, options);
|
|
402
403
|
const carried = mergeAgentSidecars(result, sidecars, { original, baseline: options.baseline, edited });
|
|
403
|
-
|
|
404
|
-
|
|
404
|
+
// After the carry: what it wrote onto an embedded node is the author's.
|
|
405
|
+
const authored = new Map(carried.onNodes.map((c) => [c.node, c.inputs]));
|
|
406
|
+
reportOrRefuse([...findings, ...agentFindings(authored), ...carried.findings], options, carried.missing);
|
|
407
|
+
return {
|
|
408
|
+
flow: result,
|
|
409
|
+
sidecars: carried.writes,
|
|
410
|
+
removals: carried.removals,
|
|
411
|
+
onNodes: carried.onNodes.map((c) => ({ nodeId: c.node.id, inputs: c.inputs })),
|
|
412
|
+
};
|
|
405
413
|
}
|
|
406
414
|
/** Refused with or without `strict`: merging would replace the project's `agent.json`. */
|
|
407
415
|
class SidecarOverwriteError extends MergeRefusedError {
|
|
@@ -621,17 +629,17 @@ function mergeFlowFindings(original, edited, options) {
|
|
|
621
629
|
const findings = [
|
|
622
630
|
...(options.baseline ? roundTripFindings(original, options.baseline, result) : []),
|
|
623
631
|
...mergedFileFindings(result, original),
|
|
624
|
-
...embeddedAgentFindings(!!options.baseline, [
|
|
625
|
-
{ scope: '', original: original.nodes ?? [], merged: finalNodes, edited: editedIds },
|
|
626
|
-
...Object.entries(original.subflows ?? {}).map(([key, sf]) => ({
|
|
627
|
-
scope: key,
|
|
628
|
-
original: sf?.nodes ?? [],
|
|
629
|
-
merged: result.subflows?.[key]?.nodes ?? [],
|
|
630
|
-
edited: subflowEdited.get(key) ?? new Set(),
|
|
631
|
-
})),
|
|
632
|
-
]),
|
|
633
632
|
];
|
|
634
|
-
|
|
633
|
+
const agentFindings = (authored) => embeddedAgentFindings(!!options.baseline, [
|
|
634
|
+
{ scope: '', original: original.nodes ?? [], merged: finalNodes, edited: editedIds },
|
|
635
|
+
...Object.entries(original.subflows ?? {}).map(([key, sf]) => ({
|
|
636
|
+
scope: key,
|
|
637
|
+
original: sf?.nodes ?? [],
|
|
638
|
+
merged: result.subflows?.[key]?.nodes ?? [],
|
|
639
|
+
edited: subflowEdited.get(key) ?? new Set(),
|
|
640
|
+
})),
|
|
641
|
+
], authored);
|
|
642
|
+
return { result, findings, agentFindings };
|
|
635
643
|
}
|
|
636
644
|
/**
|
|
637
645
|
* Whether the merged node for `orig` must be built from the original rather than
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { eventTriggerType } from './event-trigger.js';
|
|
2
2
|
import { eventWaitNodeType } from './event-wait.js';
|
|
3
3
|
import { connectorNodeType } from './node-type.js';
|
|
4
|
+
import { CONNECTOR_DIAGNOSTICS } from './output-read.js';
|
|
4
5
|
export const connectorFlowFamily = {
|
|
5
6
|
id: 'connector',
|
|
6
7
|
title: 'Integration Service connector',
|
|
7
8
|
types: [connectorNodeType, eventWaitNodeType],
|
|
8
|
-
//
|
|
9
|
-
|
|
9
|
+
// The output-read codes are the family's own; its other rules' codes are the
|
|
10
|
+
// pipeline's, shared with the triggers (ctx.connector, ctx.eventSubscription).
|
|
11
|
+
diagnostics: CONNECTOR_DIAGNOSTICS,
|
|
10
12
|
};
|
|
11
13
|
export const connectorTriggerFamily = {
|
|
12
14
|
id: 'connector',
|
|
@@ -7,6 +7,7 @@ import { libraryExecution } from '../../../core/external-execution.js';
|
|
|
7
7
|
import { CONNECTOR_INPUT_MISSING, FLOW_EXPR_DIALECT, buildConnectorInputs, replayInputsOf, transportHttpMethod } from '../../../core/connector-inputs.js';
|
|
8
8
|
import { ConnectorResolveError } from '../../../core/connector-resolve-error.js';
|
|
9
9
|
import { definitionHasErrorPort } from '../../../core/error-port.js';
|
|
10
|
+
import { connectorCheckOutput } from './output-read.js';
|
|
10
11
|
import { Expr } from '../../../core/expr.js';
|
|
11
12
|
import { jsonClone } from '../../../core/json-clone.js';
|
|
12
13
|
import { subNodeId } from '../../../core/node-id-placeholder.js';
|
|
@@ -454,6 +455,8 @@ const connector10 = {
|
|
|
454
455
|
// Every Expr in the inputs, nested ones included, resolves against the flow's names.
|
|
455
456
|
expressions: (spec) => [{ value: spec.inputs }],
|
|
456
457
|
output: () => ({ kind: 'opaque' }),
|
|
458
|
+
// Given a library, the operation's declared outputs: a read outside them is reported (#1967).
|
|
459
|
+
checkOutput: (spec, options) => connectorCheckOutput(spec, options.connectorOutputFields),
|
|
457
460
|
listShape: (spec, options) => options.listEnvelope?.(spec.key, spec.action, spec.version, spec.object),
|
|
458
461
|
};
|
|
459
462
|
export const connectorNodeType = {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The read rule on a connector operation's output, and the family's catalog.
|
|
3
|
+
*
|
|
4
|
+
* `out('upload', 'WebUrl')` compiles, and reads undefined at run time when the
|
|
5
|
+
* operation returns `webUrl`: field names are case-sensitive and nothing
|
|
6
|
+
* compared the read with the operation's declared outputs (#1967). Given a
|
|
7
|
+
* library, the operation type's `checkOutput` states those outputs as a
|
|
8
|
+
* `partial` `fields` contract, and check's shared read rule reports:
|
|
9
|
+
*
|
|
10
|
+
* - CONNECTOR_READ_NOT_OUTPUT: `$vars.<step>.<x>` where `x` is not `output`
|
|
11
|
+
* (or `error`); a connector publishes its response only under `output`.
|
|
12
|
+
* - CONNECTOR_READ_FIELD_CASE: the field differs from a declared one only in
|
|
13
|
+
* letter case. It reads undefined unless the response's casing differs
|
|
14
|
+
* from the declared one, which no live response has been checked for; a
|
|
15
|
+
* warning until one is (#2017 review).
|
|
16
|
+
* - CONNECTOR_READ_UNKNOWN_FIELD: no declared field has the name. A warning,
|
|
17
|
+
* because the library's list can miss a field the response really carries
|
|
18
|
+
* (`core/connector-output-fields.ts`).
|
|
19
|
+
*
|
|
20
|
+
* Without a library, or for an operation the library cannot describe (a list,
|
|
21
|
+
* an unprepared connection-resolved schema, no declared fields), the type falls
|
|
22
|
+
* back to its `opaque` output and nothing is reported.
|
|
23
|
+
*/
|
|
24
|
+
import type { DiagnosticCatalog } from '../../../core/nodes/family.js';
|
|
25
|
+
import type { OutputContract } from '../../../core/nodes/node-type.js';
|
|
26
|
+
/** Every code the family reports, with the severity it reports it at. */
|
|
27
|
+
export declare const CONNECTOR_DIAGNOSTICS: DiagnosticCatalog;
|
|
28
|
+
/** The top-level output fields of one operation, from check's library (`CheckOpts.connectorOutputFields`). */
|
|
29
|
+
type OutputFields = (connector: string, operation: string, version?: string, object?: string) => readonly string[] | undefined;
|
|
30
|
+
/** The operation's output as check's library states it, or undefined to fall back to `opaque`. */
|
|
31
|
+
export declare function connectorCheckOutput(spec: {
|
|
32
|
+
key: string;
|
|
33
|
+
action: string;
|
|
34
|
+
version?: string;
|
|
35
|
+
object?: string;
|
|
36
|
+
}, outputFields: OutputFields | undefined): OutputContract | undefined;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Every code the family reports, with the severity it reports it at. */
|
|
2
|
+
export const CONNECTOR_DIAGNOSTICS = {
|
|
3
|
+
CONNECTOR_READ_NOT_OUTPUT: { severity: 'error', summary: 'a read outside the step\'s output' },
|
|
4
|
+
CONNECTOR_READ_FIELD_CASE: { severity: 'warning', summary: 'a read of a declared output field in the wrong letter case' },
|
|
5
|
+
CONNECTOR_READ_UNKNOWN_FIELD: { severity: 'warning', summary: 'a read of a field the operation does not declare' },
|
|
6
|
+
};
|
|
7
|
+
/** The operation's output as check's library states it, or undefined to fall back to `opaque`. */
|
|
8
|
+
export function connectorCheckOutput(spec, outputFields) {
|
|
9
|
+
const fields = outputFields?.(spec.key, spec.action, spec.version, spec.object);
|
|
10
|
+
if (fields === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
return {
|
|
13
|
+
kind: 'fields',
|
|
14
|
+
fields: Object.fromEntries(fields.map((f) => [f, 'any'])),
|
|
15
|
+
partial: true,
|
|
16
|
+
read: {
|
|
17
|
+
codePrefix: 'CONNECTOR',
|
|
18
|
+
label: 'Connector step',
|
|
19
|
+
// Unreachable: a partial contract always carries its fields.
|
|
20
|
+
whenUndeclared: '',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -3,7 +3,12 @@ import { escapeRegExp } from '../../../core/escape-regexp.js';
|
|
|
3
3
|
import { isJsExpressionValue } from '../../../core/wire-expr.js';
|
|
4
4
|
import { Expr } from '../../../core/expr.js';
|
|
5
5
|
export const HTTP_DIAGNOSTICS = {
|
|
6
|
-
HTTP_V1_RETIRED: {
|
|
6
|
+
HTTP_V1_RETIRED: {
|
|
7
|
+
severity: 'error',
|
|
8
|
+
summary: 'the plain node, which the tenant node registry no longer serves',
|
|
9
|
+
// About what the node is, not what it holds.
|
|
10
|
+
aboutNodeType: true,
|
|
11
|
+
},
|
|
7
12
|
HTTP_BINDING_REQUIRES_MANAGED: { severity: 'error', summary: 'connection settings on the standalone node' },
|
|
8
13
|
HTTP_MANAGED_BINDING_INCOMPLETE: { severity: 'error', summary: 'a managed connection without both connection and folder' },
|
|
9
14
|
HTTP_TARGET_CONNECTOR_EMPTY: { severity: 'error', summary: 'an empty targetConnector' },
|
|
@@ -102,10 +107,8 @@ function checkSecretHeaders(inputs, ctx) {
|
|
|
102
107
|
*/
|
|
103
108
|
export function checkHttp(inputs, ctx) {
|
|
104
109
|
const step = ctx.step;
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
// type 'Intsvc.HttpExecution'". A warning, not an error, so `decompile` keeps
|
|
108
|
-
// round-tripping existing flows.
|
|
110
|
+
// A new plain node is an error; a node the baseline already has is a warning
|
|
111
|
+
// (`aboutNodeType`). `compile` does not run `check`.
|
|
109
112
|
//
|
|
110
113
|
// Moving to the managed node is not a rename: a non-2xx fails the step instead
|
|
111
114
|
// of arriving on the success path with `statusCode`, so a status branch becomes
|
|
@@ -119,9 +122,10 @@ export function checkHttp(inputs, ctx) {
|
|
|
119
122
|
const tail = wantsConnection
|
|
120
123
|
? `It also sets Integration Service connection settings, which only the managed node can use.`
|
|
121
124
|
: `Without a connection it sends the request through Integration Service's shared egress, so public APIs can answer 429.`;
|
|
122
|
-
ctx.report('HTTP_V1_RETIRED', `Step "${step}" emits core.action.http,
|
|
123
|
-
+ `core.action.http.v2,
|
|
124
|
-
+ `
|
|
125
|
+
ctx.report('HTTP_V1_RETIRED', `Step "${step}" emits core.action.http, the plain HTTP node, which the tenant node registry no longer serves `
|
|
126
|
+
+ `(it serves only core.action.http.v2), so the designer does not offer it. Write managed: true for a new step. `
|
|
127
|
+
+ `A plain node the flow already has is a warning under check --baseline, even when the edit changes it. `
|
|
128
|
+
+ `Moving to managed: true changes behaviour rather than just the node type: a non-2xx `
|
|
125
129
|
+ `fails the step instead of arriving with statusCode, so a status branch becomes an .onError() handler `
|
|
126
130
|
+ `reading err('${step}', 'status'). ${tail}`, wantsConnection ? `http({ url: …, managed: true, connection, folder })` : `http({ url: …, managed: true })`);
|
|
127
131
|
}
|
|
@@ -15,7 +15,7 @@ export function http(inputs) {
|
|
|
15
15
|
if (typeof inputs.managed !== 'boolean') {
|
|
16
16
|
throw new CompileRefusal('HTTP_MANAGED_REQUIRED', 'http() requires managed: true or managed: false because they emit different platform nodes. '
|
|
17
17
|
+ 'Use true for Managed HTTP Request/core.action.http.v2 or when non-2xx statuses must reach .onError(); '
|
|
18
|
-
+ 'false emits the
|
|
18
|
+
+ 'false emits the plain core.action.http, which the tenant node registry no longer serves.');
|
|
19
19
|
}
|
|
20
20
|
return builtinActionSpec({ kind: 'http', inputs });
|
|
21
21
|
}
|
|
@@ -35,9 +35,9 @@ interface HttpInputsBase {
|
|
|
35
35
|
body?: string | Expr;
|
|
36
36
|
contentType?: string;
|
|
37
37
|
/**
|
|
38
|
-
* Choose the HTTP node explicitly. `false` emits the
|
|
39
|
-
* `core.action.http`, which
|
|
40
|
-
*
|
|
38
|
+
* Choose the HTTP node explicitly. `false` emits the plain
|
|
39
|
+
* `core.action.http`, which the tenant node registry no longer serves, so
|
|
40
|
+
* `check` refuses a new one (HTTP_V1_RETIRED); `true` emits the managed `core.action.http.v2`, routed
|
|
41
41
|
* through Integration Service's HTTP connector.
|
|
42
42
|
*
|
|
43
43
|
* This has no default because these are different platform nodes, not two
|
|
@@ -114,5 +114,6 @@ export declare function checkCuratedOverlay(libraryPath: string, overlayPath?: s
|
|
|
114
114
|
* (`registry/fetch/`), where {@link applyCuratedOverlay} would be wrong: it also
|
|
115
115
|
* adds every definition this directory carries, and those are fixtures, not
|
|
116
116
|
* operations the tenant was asked about. Returns the corrected entry paths.
|
|
117
|
+
* An `overlayPath` that does not exist, as in a bundled SDK, contributes nothing.
|
|
117
118
|
*/
|
|
118
119
|
export declare function applyCorrectionsAndSideTables(libraryPath: string, sideTablesTo: string, overlayPath?: string): Promise<string[]>;
|
|
@@ -453,6 +453,7 @@ export async function checkCuratedOverlay(libraryPath, overlayPath = bundledOver
|
|
|
453
453
|
* (`registry/fetch/`), where {@link applyCuratedOverlay} would be wrong: it also
|
|
454
454
|
* adds every definition this directory carries, and those are fixtures, not
|
|
455
455
|
* operations the tenant was asked about. Returns the corrected entry paths.
|
|
456
|
+
* An `overlayPath` that does not exist, as in a bundled SDK, contributes nothing.
|
|
456
457
|
*/
|
|
457
458
|
export async function applyCorrectionsAndSideTables(libraryPath, sideTablesTo, overlayPath = bundledOverlayPath()) {
|
|
458
459
|
const corrected = [];
|
|
@@ -466,6 +467,10 @@ export async function applyCorrectionsAndSideTables(libraryPath, sideTablesTo, o
|
|
|
466
467
|
const target = join(sideTablesTo, table);
|
|
467
468
|
if (await exists(target))
|
|
468
469
|
continue;
|
|
470
|
+
// A bundled SDK (Studio Web's sandbox) runs without its lib/ directory, so
|
|
471
|
+
// there is no copy to give: a reader takes an absent table as an empty one.
|
|
472
|
+
if (!(await exists(join(overlayPath, table))))
|
|
473
|
+
continue;
|
|
469
474
|
await mkdir(sideTablesTo, { recursive: true });
|
|
470
475
|
await cp(join(overlayPath, table), target);
|
|
471
476
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/maestro-builder-sdk",
|
|
3
|
-
"version": "6.117.
|
|
3
|
+
"version": "6.117.2",
|
|
4
4
|
"description": "Build UiPath Flow, Case, and BPMN artifacts by writing TypeScript.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://docs.uipath.com/maestro",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"@types/node": "^22.7.0",
|
|
125
125
|
"esbuild": "^0.28.1"
|
|
126
126
|
},
|
|
127
|
-
"gitref": "
|
|
127
|
+
"gitref": "f07017fda4361782d6c91a42e2d4c64d945d4442"
|
|
128
128
|
}
|