@uipath/maestro-builder-sdk 6.118.1 → 6.119.1
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/api-index.md +2 -2
- package/dist/compile-cli.js +12 -1
- package/dist/core/refusals.d.ts +8 -0
- package/dist/core/refusals.js +8 -0
- package/dist/flow-node-type.d.ts +7 -0
- package/dist/merge-baseline-connections.d.ts +25 -0
- package/dist/merge-baseline-connections.js +113 -0
- package/dist/merge-cli.js +4 -0
- package/dist/merge.js +19 -0
- package/dist/nodes/document/flow/factories.d.ts +8 -9
- package/dist/nodes/document/flow/factories.js +8 -9
- package/dist/nodes/document/flow/node-type.js +84 -5
- package/dist/nodes/document/flow/taxonomy-check.d.ts +36 -0
- package/dist/nodes/document/flow/taxonomy-check.js +207 -0
- package/dist/nodes/document/flow/taxonomy.d.ts +92 -0
- package/dist/nodes/document/flow/taxonomy.js +301 -0
- package/dist/registry/prepare/messages.d.ts +5 -3
- package/dist/registry/prepare/messages.js +20 -6
- package/dist/registry/prepare/resolve.d.ts +11 -0
- package/dist/registry/prepare/resolve.js +25 -1
- package/dist/registry/prepare/retry.js +14 -4
- package/dist/serialize.d.ts +17 -0
- package/dist/serialize.js +17 -0
- package/package.json +2 -2
package/dist/api-index.md
CHANGED
|
@@ -135,7 +135,7 @@ could hand you spans for a version you do not have.
|
|
|
135
135
|
| `DocumentClassifyInputs` | interface | `dist/nodes/document/flow/spec.d.ts:10-39` | Option shapes | What `documentClassify()` takes: the document, and how to split and classify it. |
|
|
136
136
|
| `DocValidationInputs` | interface | `dist/nodes/hitl/flow/spec.d.ts:76-99` | Option shapes | The Document Validation task's subject — `variant: 'document-validation'` only. |
|
|
137
137
|
| `DoWhileOptions` | interface | `dist/flow-sdk.d.ts:451-460` | Option shapes | Do-while options. |
|
|
138
|
-
| `dynamicExtract` | function | `dist/nodes/document/flow/factories.d.ts:20-
|
|
138
|
+
| `dynamicExtract` | function | `dist/nodes/document/flow/factories.d.ts:20-89` | Actions | Extract fields from a document with an INLINE schema — Dynamic Extract (`uipath.ixp.extract-document-builder`), the… |
|
|
139
139
|
| `DynamicExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:56-131` | Option shapes | What `dynamicExtract()` takes: the document and the fields to extract from it. |
|
|
140
140
|
| `EdgeRoute` | interface | `dist/flow-sdk.d.ts:651-665` | Supporting types | One edge's route: user-dragged bends and/or the auto-router's waypoints. |
|
|
141
141
|
| `endCall` | function | `dist/nodes/agent/flow/factories.d.ts:32-39` | Actions | Hang up (`uipath.conversational.voice.end-call`). |
|
|
@@ -197,7 +197,7 @@ could hand you spans for a version you do not have.
|
|
|
197
197
|
| `InOutField` | interface | `dist/core/actions.d.ts:278-295` | Supporting types | A value the reviewer READS **and can correct**: pre-filled from the flow, editable on the form, and the (possibly… |
|
|
198
198
|
| `input` | function | `dist/core/expr.d.ts:44-61` | Expressions and types | Reference a flow input by name → `$vars.<triggerId>.output.<name>`. |
|
|
199
199
|
| `isLookupToken` | function | `dist/core/lookups.d.ts:53-54` | Generated descriptors | True when `v` is an unresolved LookupToken. |
|
|
200
|
-
| `ixpExtract` | function | `dist/nodes/document/flow/factories.d.ts:
|
|
200
|
+
| `ixpExtract` | function | `dist/nodes/document/flow/factories.d.ts:90-144` | Actions | Extract fields from a document with a published IxP project — the platform's **Extract** node (`uipath.ixp.*`, service… |
|
|
201
201
|
| `IxpExtractInputs` | interface | `dist/nodes/document/flow/spec.d.ts:149-224` | Option shapes | What `ixpExtract()` takes: the IxP project's extractor, its identity on the tenant, and the document. |
|
|
202
202
|
| `IxpToolRef` | interface | `dist/core/actions.d.ts:789-827` | Supporting types | A published IxP (Intelligent eXtraction Platform) project as a tool — the agent decides when to extract a document and… |
|
|
203
203
|
| `js` | function | `dist/core/expr.d.ts:247-282` | Expressions and types | Build a raw JS *expression* (a condition or computation). |
|
package/dist/compile-cli.js
CHANGED
|
@@ -168,14 +168,20 @@ export async function run(argv) {
|
|
|
168
168
|
// The node registry cache `uip maestro flow registry pull` writes: a `rawNode`
|
|
169
169
|
// without `manifest` resolves its definition there (#1981). Read on first use.
|
|
170
170
|
const nodeCatalog = readNodeCatalog();
|
|
171
|
+
// The `.flow` this compile overwrites: a step reads the node it had there
|
|
172
|
+
// (Extract document keeps its taxonomy ids, #1985).
|
|
173
|
+
const overwrites = readJsonOrUndefined(resolve(out));
|
|
174
|
+
const notes = [];
|
|
171
175
|
const warnings = [];
|
|
172
176
|
let emitted;
|
|
173
177
|
try {
|
|
174
178
|
emitted = await withFetchedDefinitions(argv, (library) => {
|
|
175
179
|
// One pass's warnings: a pass that missed a definition runs again.
|
|
176
180
|
warnings.length = 0;
|
|
181
|
+
notes.length = 0;
|
|
177
182
|
return serializeWithSidecars(built, {
|
|
178
183
|
library, bindings, warn: (w) => warnings.push(w), resources, agentSource, nodeCatalog,
|
|
184
|
+
overwrites, note: (n) => notes.push(n),
|
|
179
185
|
...(solution !== undefined ? { solution } : {}),
|
|
180
186
|
carriedDrafts: (d) => warnings.push(draftWarning(d)),
|
|
181
187
|
});
|
|
@@ -247,6 +253,8 @@ export async function run(argv) {
|
|
|
247
253
|
console.log(`compile: wrote ${sidecar.path}`);
|
|
248
254
|
written.push(target);
|
|
249
255
|
}
|
|
256
|
+
for (const n of notes)
|
|
257
|
+
console.log(`compile: ${JSON.stringify(n.step)} ${n.message}`);
|
|
250
258
|
for (const path of processors?.written ?? [])
|
|
251
259
|
console.log(`compile: wrote ${path} (IDP processor)`);
|
|
252
260
|
for (const why of processors?.skipped ?? [])
|
|
@@ -267,7 +275,10 @@ export async function run(argv) {
|
|
|
267
275
|
+ `. To make this explicit, set source: "${to}" on "${step}" in the .flow.ts.`);
|
|
268
276
|
}
|
|
269
277
|
}
|
|
270
|
-
reportResult({
|
|
278
|
+
reportResult({
|
|
279
|
+
path: resolve(out), nodes: flowJson.nodes.length, edges: flowJson.edges.length, sidecars: written,
|
|
280
|
+
...(notes.length > 0 ? { notes } : {}),
|
|
281
|
+
});
|
|
271
282
|
// PRUNE the agent resources this compile owns but did not write this time.
|
|
272
283
|
// Compile otherwise only ever ADDS files, and an agent resource is keyed by a
|
|
273
284
|
// uuid derived from the step name and the resource's identity — so dropping a
|
package/dist/core/refusals.d.ts
CHANGED
|
@@ -367,6 +367,14 @@ export declare const REFUSALS: {
|
|
|
367
367
|
readonly EXTRACT_READ_NOT_OUTPUT: "lint";
|
|
368
368
|
readonly EXTRACT_READ_UNKNOWN_FIELD: "lint";
|
|
369
369
|
readonly EXTRACT_SCHEMA_SHAPE: "lint";
|
|
370
|
+
readonly EXTRACT_TAXONOMY_BARE: "lint";
|
|
371
|
+
readonly EXTRACT_TAXONOMY_DUPLICATE_ID: "lint";
|
|
372
|
+
readonly EXTRACT_TAXONOMY_FIELD_TYPE: "lint";
|
|
373
|
+
readonly EXTRACT_TAXONOMY_LEGACY: "lint";
|
|
374
|
+
readonly EXTRACT_TAXONOMY_LIMIT: "lint";
|
|
375
|
+
readonly EXTRACT_TAXONOMY_NESTING: "lint";
|
|
376
|
+
readonly EXTRACT_TAXONOMY_REF: "lint";
|
|
377
|
+
readonly EXTRACT_TAXONOMY_STRUCTURE: "lint";
|
|
370
378
|
readonly FAKE_JOIN: "lint";
|
|
371
379
|
readonly FILE_NOT_FOUND: "lowering";
|
|
372
380
|
readonly FIRE_AND_FORGET_READ: "lint";
|
package/dist/core/refusals.js
CHANGED
|
@@ -441,6 +441,14 @@ export const REFUSALS = {
|
|
|
441
441
|
EXTRACT_READ_NOT_OUTPUT: 'lint',
|
|
442
442
|
EXTRACT_READ_UNKNOWN_FIELD: 'lint',
|
|
443
443
|
EXTRACT_SCHEMA_SHAPE: 'lint',
|
|
444
|
+
EXTRACT_TAXONOMY_BARE: 'lint',
|
|
445
|
+
EXTRACT_TAXONOMY_DUPLICATE_ID: 'lint',
|
|
446
|
+
EXTRACT_TAXONOMY_FIELD_TYPE: 'lint',
|
|
447
|
+
EXTRACT_TAXONOMY_LEGACY: 'lint',
|
|
448
|
+
EXTRACT_TAXONOMY_LIMIT: 'lint',
|
|
449
|
+
EXTRACT_TAXONOMY_NESTING: 'lint',
|
|
450
|
+
EXTRACT_TAXONOMY_REF: 'lint',
|
|
451
|
+
EXTRACT_TAXONOMY_STRUCTURE: 'lint',
|
|
444
452
|
FAKE_JOIN: 'lint',
|
|
445
453
|
FILE_NOT_FOUND: 'lowering',
|
|
446
454
|
FIRE_AND_FORGET_READ: 'lint',
|
package/dist/flow-node-type.d.ts
CHANGED
|
@@ -179,6 +179,13 @@ export interface FlowSerializeContext {
|
|
|
179
179
|
* pair) or must pick an id that is not taken; add entries through `bind`.
|
|
180
180
|
*/
|
|
181
181
|
readonly bindings: ReadonlyMap<string, Readonly<Record<string, unknown>>>;
|
|
182
|
+
/**
|
|
183
|
+
* The node this step had in the `.flow` the compile overwrites
|
|
184
|
+
* (`SerializeOpts.overwrites`): same id, same type; undefined when there is none.
|
|
185
|
+
*/
|
|
186
|
+
overwrittenNode(): unknown;
|
|
187
|
+
/** Report an informational line about what was written (`SerializeOpts.note`). */
|
|
188
|
+
note(message: string, data?: unknown): void;
|
|
182
189
|
/**
|
|
183
190
|
* A symbolic `connection` or `folder` label resolved through the flow's
|
|
184
191
|
* bindings.json, as a connector step's is: a self-referential label throws the
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AnyFlow } from './edit-scope.js';
|
|
2
|
+
/** The `inputs.detail` fields a bindings.json entry resolves a label into. */
|
|
3
|
+
declare const CONNECTION_FIELDS: readonly ["connectionId", "connectionResourceId", "connectionFolderKey"];
|
|
4
|
+
/** One field the baseline resolved that the original carries as written. */
|
|
5
|
+
export interface ResolvedConnectionField {
|
|
6
|
+
/** The subflow key, or `undefined` at the root. */
|
|
7
|
+
subflow?: string;
|
|
8
|
+
nodeId: string;
|
|
9
|
+
field: (typeof CONNECTION_FIELDS)[number];
|
|
10
|
+
/** The original's value: the label. */
|
|
11
|
+
original: string;
|
|
12
|
+
/** The baseline's value: what the label resolved to. */
|
|
13
|
+
baseline: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The baseline with the original's connection labels restored, and each field
|
|
17
|
+
* restored. Returns the baseline itself (not a copy) when nothing differs.
|
|
18
|
+
*/
|
|
19
|
+
export declare function withOriginalConnectionLabels(original: AnyFlow, baseline: AnyFlow): {
|
|
20
|
+
baseline: AnyFlow;
|
|
21
|
+
restored: ResolvedConnectionField[];
|
|
22
|
+
};
|
|
23
|
+
/** The warning merge prints for each node whose baseline it restored. */
|
|
24
|
+
export declare function restoredConnectionMessage(fields: readonly ResolvedConnectionField[]): string[];
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* merge-baseline-connections — give a precompiled baseline the original's
|
|
3
|
+
* connection labels back (UV-17831 item 4).
|
|
4
|
+
*
|
|
5
|
+
* The baseline is compile(decompile(original)) before the edit, so merge reads
|
|
6
|
+
* "edited equals baseline" as "untouched". That holds only while the baseline
|
|
7
|
+
* reproduces the original. A connection the original carries as a label
|
|
8
|
+
* (`"slack"`, compiled before bindings.json named it) does not survive a compile
|
|
9
|
+
* that resolves labels through bindings.json: the baseline gets the real id. A
|
|
10
|
+
* later edit that swaps the label for that id then equals the baseline, merge
|
|
11
|
+
* keeps the original node, and the edit is dropped without an error.
|
|
12
|
+
*
|
|
13
|
+
* `flow merge --baseline-from` and the stamped source form compile the baseline
|
|
14
|
+
* themselves with no bindings, so their baseline keeps the label (#1929). A
|
|
15
|
+
* baseline file compiled elsewhere (the decompile pipeline's
|
|
16
|
+
* `<Name>.baseline/<Name>.flow`, a supplied source's baseline, any
|
|
17
|
+
* `flow compile` run with `.flow-sdk/bindings.json` present) is fixed up here,
|
|
18
|
+
* so every merge with a baseline compares the edit against the same thing.
|
|
19
|
+
*
|
|
20
|
+
* Example. Original node `notify`: `connectionId: "slack"`; baseline file:
|
|
21
|
+
* `connectionId: "0f0e…"` (resolved). After this, the baseline says `"slack"`,
|
|
22
|
+
* the edit's `"0f0e…"` differs from it, and merge writes the id.
|
|
23
|
+
*
|
|
24
|
+
* Only a label (not a GUID) the baseline resolved to a GUID is restored, and only
|
|
25
|
+
* in the fields a connection binding resolves
|
|
26
|
+
* (`inputs.detail.connectionId`, `connectionResourceId`, `connectionFolderKey`),
|
|
27
|
+
* plus the binding rows that carry the resolved values under the original row's
|
|
28
|
+
* id. Every other round-trip difference is left for merge-roundtrip.ts to report.
|
|
29
|
+
*/
|
|
30
|
+
import { GUID_RE } from './core/binding-messages.js';
|
|
31
|
+
import { jsonClone } from './core/json-clone.js';
|
|
32
|
+
import { isRecord } from './core/node-envelope.js';
|
|
33
|
+
/** The `inputs.detail` fields a bindings.json entry resolves a label into. */
|
|
34
|
+
const CONNECTION_FIELDS = ['connectionId', 'connectionResourceId', 'connectionFolderKey'];
|
|
35
|
+
function detailOf(node) {
|
|
36
|
+
const detail = node?.inputs?.detail;
|
|
37
|
+
return isRecord(detail) ? detail : undefined;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The baseline with the original's connection labels restored, and each field
|
|
41
|
+
* restored. Returns the baseline itself (not a copy) when nothing differs.
|
|
42
|
+
*/
|
|
43
|
+
export function withOriginalConnectionLabels(original, baseline) {
|
|
44
|
+
const restored = [];
|
|
45
|
+
const scopes = [
|
|
46
|
+
[undefined, original, baseline],
|
|
47
|
+
...Object.keys(baseline.subflows ?? {}).map((key) => [
|
|
48
|
+
key,
|
|
49
|
+
original.subflows?.[key],
|
|
50
|
+
baseline.subflows?.[key],
|
|
51
|
+
]),
|
|
52
|
+
];
|
|
53
|
+
for (const [subflow, o, b] of scopes) {
|
|
54
|
+
const origById = new Map((o?.nodes ?? []).map((n) => [n.id, n]));
|
|
55
|
+
for (const node of b?.nodes ?? []) {
|
|
56
|
+
const od = detailOf(origById.get(node.id));
|
|
57
|
+
const bd = detailOf(node);
|
|
58
|
+
if (!od || !bd)
|
|
59
|
+
continue;
|
|
60
|
+
for (const field of CONNECTION_FIELDS) {
|
|
61
|
+
const ov = od[field];
|
|
62
|
+
const bv = bd[field];
|
|
63
|
+
// Only a label the baseline resolved to an id: never a differing id or
|
|
64
|
+
// a differing label, which are real round-trip changes merge reports.
|
|
65
|
+
if (typeof ov === 'string' && ov !== '' && !GUID_RE.test(ov) && typeof bv === 'string' && GUID_RE.test(bv)) {
|
|
66
|
+
restored.push({ ...(subflow !== undefined ? { subflow } : {}), nodeId: node.id, field, original: ov, baseline: bv });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (restored.length === 0)
|
|
72
|
+
return { baseline, restored };
|
|
73
|
+
const fixed = jsonClone(baseline);
|
|
74
|
+
const fixedScope = (subflow) => subflow === undefined ? fixed : fixed.subflows?.[subflow];
|
|
75
|
+
for (const r of restored) {
|
|
76
|
+
const detail = detailOf(fixedScope(r.subflow)?.nodes?.find((n) => n.id === r.nodeId));
|
|
77
|
+
if (detail)
|
|
78
|
+
detail[r.field] = r.original;
|
|
79
|
+
}
|
|
80
|
+
// A row is the original's row with the resolved values in it: same id, and
|
|
81
|
+
// equal to the original's once each resolved value is mapped back to its label.
|
|
82
|
+
const labelOf = new Map(restored.map((r) => [r.baseline, r.original]));
|
|
83
|
+
const origRows = new Map((original.bindings ?? []).filter((r) => typeof r.id === 'string').map((r) => [r.id, r]));
|
|
84
|
+
if (fixed.bindings) {
|
|
85
|
+
fixed.bindings = fixed.bindings.map((row) => {
|
|
86
|
+
const orig = typeof row.id === 'string' ? origRows.get(row.id) : undefined;
|
|
87
|
+
if (!orig || row.resource !== 'connection')
|
|
88
|
+
return row;
|
|
89
|
+
const unresolved = Object.fromEntries(Object.entries(row).map(([k, v]) => [k, typeof v === 'string' ? labelOf.get(v) ?? v : v]));
|
|
90
|
+
return JSON.stringify(sorted(unresolved)) === JSON.stringify(sorted(orig)) ? jsonClone(orig) : row;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return { baseline: fixed, restored };
|
|
94
|
+
}
|
|
95
|
+
function sorted(o) {
|
|
96
|
+
return Object.fromEntries(Object.entries(o).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));
|
|
97
|
+
}
|
|
98
|
+
/** The warning merge prints for each node whose baseline it restored. */
|
|
99
|
+
export function restoredConnectionMessage(fields) {
|
|
100
|
+
const byNode = new Map();
|
|
101
|
+
for (const f of fields) {
|
|
102
|
+
const key = `${f.subflow ?? ''}\n${f.nodeId}`;
|
|
103
|
+
byNode.set(key, [...(byNode.get(key) ?? []), f]);
|
|
104
|
+
}
|
|
105
|
+
return [...byNode.values()].map((fs) => {
|
|
106
|
+
const where = fs[0].subflow !== undefined ? ` in subflow "${fs[0].subflow}"` : '';
|
|
107
|
+
const pairs = [...new Map(fs.map((f) => [`${f.original}\n${f.baseline}`, f])).values()]
|
|
108
|
+
.map((f) => `"${f.original}" -> "${f.baseline}"`).join(', ');
|
|
109
|
+
return `the baseline resolves the connection of node "${fs[0].nodeId}"${where} (${pairs}), which the original carries as a label: `
|
|
110
|
+
+ 'the baseline was compiled with a bindings.json and the original was not. Merge compares the edit against the original\'s label, '
|
|
111
|
+
+ 'so the connection the edited flow names is written.';
|
|
112
|
+
});
|
|
113
|
+
}
|
package/dist/merge-cli.js
CHANGED
|
@@ -424,8 +424,12 @@ export async function run(argv) {
|
|
|
424
424
|
if (editedIsSource) {
|
|
425
425
|
// The edited source gets what `compile` gives it: check() with the same
|
|
426
426
|
// options, and the serializer's warnings (CONNECTION_STUB, ...) printed.
|
|
427
|
+
// It compiles over the original, as `compile` over the same file does: a
|
|
428
|
+
// step reads the node it had there (`SerializeOpts.overwrites`), so an
|
|
429
|
+
// idless Extract taxonomy keeps the ids the saved .flow has (#1985).
|
|
427
430
|
const compiled = await compileSourceDraftTolerant(resolve(editedPath), {
|
|
428
431
|
...compileOpts,
|
|
432
|
+
overwrites: original,
|
|
429
433
|
warn: (w) => console.error(` ⚠ [${w.code}] ${w.message}`),
|
|
430
434
|
});
|
|
431
435
|
edited = compiled.flow;
|
package/dist/merge.js
CHANGED
|
@@ -105,6 +105,7 @@ import { mergeAgentSidecars } from './merge-sidecars.js';
|
|
|
105
105
|
import { embeddedAgentFindings, isEmbeddedAgent, mergeEmbeddedAgentNode } from './merge-embedded-agent.js';
|
|
106
106
|
import { mergeObject, mergeVariables, stableJson } from './merge-variables.js';
|
|
107
107
|
import { replaceSupersededOutputs } from './merge-superseded-outputs.js';
|
|
108
|
+
import { restoredConnectionMessage, withOriginalConnectionLabels } from './merge-baseline-connections.js';
|
|
108
109
|
import { byId, isKept, nodeUnchanged, subflowsTakenFromEdited } from './edit-scope.js';
|
|
109
110
|
export { MergeRefusedError } from './merge-roundtrip.js';
|
|
110
111
|
/**
|
|
@@ -392,6 +393,7 @@ function positionStoreOf(f) {
|
|
|
392
393
|
return nodes && Object.keys(nodes).length > 0 ? nodes : undefined;
|
|
393
394
|
}
|
|
394
395
|
export function mergeFlow(original, edited, options = {}) {
|
|
396
|
+
options = withFaithfulBaseline(original, options);
|
|
395
397
|
const { result, findings, agentFindings } = mergeFlowFindings(original, edited, options);
|
|
396
398
|
reportOrRefuse([...findings, ...agentFindings()], options);
|
|
397
399
|
return result;
|
|
@@ -407,6 +409,7 @@ export function mergeFlow(original, edited, options = {}) {
|
|
|
407
409
|
* project's `agent.json` is refused in every mode. See merge-sidecars.ts.
|
|
408
410
|
*/
|
|
409
411
|
export function mergeFlowWithSidecars(original, edited, sidecars, options = {}) {
|
|
412
|
+
options = withFaithfulBaseline(original, options);
|
|
410
413
|
const { result, findings, agentFindings } = mergeFlowFindings(original, edited, options);
|
|
411
414
|
const carried = mergeAgentSidecars(result, sidecars, { original, baseline: options.baseline, edited });
|
|
412
415
|
// After the carry: what it wrote onto an embedded node is the author's.
|
|
@@ -419,6 +422,22 @@ export function mergeFlowWithSidecars(original, edited, sidecars, options = {})
|
|
|
419
422
|
onNodes: carried.onNodes.map((c) => ({ nodeId: c.node.id, inputs: c.inputs })),
|
|
420
423
|
};
|
|
421
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* `options` with a baseline that reproduces the original's connection labels
|
|
427
|
+
* (merge-baseline-connections.ts, UV-17831): a baseline compiled with a
|
|
428
|
+
* bindings.json the original was not would make a label-to-id edit equal the
|
|
429
|
+
* baseline, and merge would drop it. Each node it restores is warned.
|
|
430
|
+
*/
|
|
431
|
+
function withFaithfulBaseline(original, options) {
|
|
432
|
+
if (!options.baseline)
|
|
433
|
+
return options;
|
|
434
|
+
const { baseline, restored } = withOriginalConnectionLabels(original, options.baseline);
|
|
435
|
+
if (restored.length === 0)
|
|
436
|
+
return options;
|
|
437
|
+
for (const message of restoredConnectionMessage(restored))
|
|
438
|
+
options.warn?.(message);
|
|
439
|
+
return { ...options, baseline };
|
|
440
|
+
}
|
|
422
441
|
/** Refused with or without `strict`: merging would replace the project's `agent.json`. */
|
|
423
442
|
class SidecarOverwriteError extends MergeRefusedError {
|
|
424
443
|
constructor(findings) {
|
|
@@ -26,9 +26,14 @@ export declare function documentClassify(inputs: DocumentClassifyInputs): Action
|
|
|
26
26
|
* @remarks
|
|
27
27
|
* `schema` is the extraction taxonomy: `prompt` (the instructions) and
|
|
28
28
|
* `outputSchema`, whose `properties` are the field groups and whose `$defs`
|
|
29
|
-
* are the field types the fields `$ref`.
|
|
30
|
-
*
|
|
31
|
-
* `x-uipath-field-id`)
|
|
29
|
+
* are the field types the fields `$ref`. Write it without ids or closing
|
|
30
|
+
* keys: compile gives every field group its `x-uipath-field-group-id`, every
|
|
31
|
+
* field its `x-uipath-field-id` and every nested group (`Invoice > Lines`)
|
|
32
|
+
* its parent's id, and closes the objects (`required` lists every property,
|
|
33
|
+
* `additionalProperties: false`), as `uip maestro flow nodes schema set` does.
|
|
34
|
+
* An id the source carries is kept. A missing one is the one the `.flow` being
|
|
35
|
+
* overwritten has for the same entry, or else one minted from the entry's
|
|
36
|
+
* place, so a recompile gives the same id.
|
|
32
37
|
*
|
|
33
38
|
* The output is a processed document: `version`, `type` (`'Extraction'`),
|
|
34
39
|
* `result`, `taxonomy` and `metadata` (run ids and the model configuration).
|
|
@@ -56,20 +61,14 @@ export declare function documentClassify(inputs: DocumentClassifyInputs): Action
|
|
|
56
61
|
* prompt: 'Extract the invoice header. Values are on the page; do not compute them.',
|
|
57
62
|
* outputSchema: {
|
|
58
63
|
* type: 'object',
|
|
59
|
-
* additionalProperties: false,
|
|
60
|
-
* required: ['Invoice'],
|
|
61
64
|
* properties: {
|
|
62
65
|
* Invoice: {
|
|
63
66
|
* type: ['object', 'null'],
|
|
64
67
|
* description: 'The invoice header, which appears once per document.',
|
|
65
|
-
* additionalProperties: false,
|
|
66
|
-
* required: ['Total'],
|
|
67
|
-
* 'x-uipath-field-group-id': '3f9a1c2e-5b7d-4e8a-9c1f-2d6b8e0a4c13',
|
|
68
68
|
* properties: {
|
|
69
69
|
* Total: {
|
|
70
70
|
* $ref: '#/$defs/ft-monetary-quantity',
|
|
71
71
|
* description: 'The amount payable including tax.',
|
|
72
|
-
* 'x-uipath-field-id': '7c2e4a91-0d3b-4f6e-a8c5-1b9d3f7e2a64',
|
|
73
72
|
* },
|
|
74
73
|
* },
|
|
75
74
|
* },
|
|
@@ -27,9 +27,14 @@ export function documentClassify(inputs) {
|
|
|
27
27
|
* @remarks
|
|
28
28
|
* `schema` is the extraction taxonomy: `prompt` (the instructions) and
|
|
29
29
|
* `outputSchema`, whose `properties` are the field groups and whose `$defs`
|
|
30
|
-
* are the field types the fields `$ref`.
|
|
31
|
-
*
|
|
32
|
-
* `x-uipath-field-id`)
|
|
30
|
+
* are the field types the fields `$ref`. Write it without ids or closing
|
|
31
|
+
* keys: compile gives every field group its `x-uipath-field-group-id`, every
|
|
32
|
+
* field its `x-uipath-field-id` and every nested group (`Invoice > Lines`)
|
|
33
|
+
* its parent's id, and closes the objects (`required` lists every property,
|
|
34
|
+
* `additionalProperties: false`), as `uip maestro flow nodes schema set` does.
|
|
35
|
+
* An id the source carries is kept. A missing one is the one the `.flow` being
|
|
36
|
+
* overwritten has for the same entry, or else one minted from the entry's
|
|
37
|
+
* place, so a recompile gives the same id.
|
|
33
38
|
*
|
|
34
39
|
* The output is a processed document: `version`, `type` (`'Extraction'`),
|
|
35
40
|
* `result`, `taxonomy` and `metadata` (run ids and the model configuration).
|
|
@@ -57,20 +62,14 @@ export function documentClassify(inputs) {
|
|
|
57
62
|
* prompt: 'Extract the invoice header. Values are on the page; do not compute them.',
|
|
58
63
|
* outputSchema: {
|
|
59
64
|
* type: 'object',
|
|
60
|
-
* additionalProperties: false,
|
|
61
|
-
* required: ['Invoice'],
|
|
62
65
|
* properties: {
|
|
63
66
|
* Invoice: {
|
|
64
67
|
* type: ['object', 'null'],
|
|
65
68
|
* description: 'The invoice header, which appears once per document.',
|
|
66
|
-
* additionalProperties: false,
|
|
67
|
-
* required: ['Total'],
|
|
68
|
-
* 'x-uipath-field-group-id': '3f9a1c2e-5b7d-4e8a-9c1f-2d6b8e0a4c13',
|
|
69
69
|
* properties: {
|
|
70
70
|
* Total: {
|
|
71
71
|
* $ref: '#/$defs/ft-monetary-quantity',
|
|
72
72
|
* description: 'The amount payable including tax.',
|
|
73
|
-
* 'x-uipath-field-id': '7c2e4a91-0d3b-4f6e-a8c5-1b9d3f7e2a64',
|
|
74
73
|
* },
|
|
75
74
|
* },
|
|
76
75
|
* },
|
|
@@ -13,11 +13,22 @@ import { declareKeys } from '../../../core/option-keys.js';
|
|
|
13
13
|
import { stableId } from '../../../core/stable-id.js';
|
|
14
14
|
import { buildDefaultSchemaDocument, buildScaffoldConfig } from './idp-processor.js';
|
|
15
15
|
import { checkExtractRead, isLegacyExtractOutputs } from './extract-output.js';
|
|
16
|
+
import { closeObjectSchemas, derivedTaxonomyMint, settleTaxonomyIds } from './taxonomy.js';
|
|
17
|
+
import { checkTaxonomy, isBareJsonSchema, isLegacyTaxonomy, isReadableTaxonomy } from './taxonomy-check.js';
|
|
16
18
|
export const DOCUMENT_DIAGNOSTICS = {
|
|
17
19
|
DOC_NO_FILEREF: { severity: 'error', summary: 'no fileRef, so nothing to classify or extract from' },
|
|
18
|
-
EXTRACT_SCHEMA_SHAPE: { severity: 'error', summary: 'a Dynamic Extract schema that is not
|
|
20
|
+
EXTRACT_SCHEMA_SHAPE: { severity: 'error', summary: 'a Dynamic Extract schema that is not a { prompt, outputSchema } document' },
|
|
19
21
|
EXTRACT_READ_NOT_OUTPUT: { severity: 'error', summary: 'an Extract document step read outside output' },
|
|
20
22
|
EXTRACT_READ_UNKNOWN_FIELD: { severity: 'error', summary: 'an Extract document step read of a field the processed document does not have' },
|
|
23
|
+
// The taxonomy rules `nodes schema set` refuses and `flow validate` reports (#1986).
|
|
24
|
+
EXTRACT_TAXONOMY_LEGACY: { severity: 'warning', summary: 'a taxonomy in the superseded { taxonomy, fieldTypes } shape' },
|
|
25
|
+
EXTRACT_TAXONOMY_BARE: { severity: 'warning', summary: 'a bare JSON Schema where the { prompt, outputSchema } taxonomy goes' },
|
|
26
|
+
EXTRACT_TAXONOMY_STRUCTURE: { severity: 'error', summary: 'a taxonomy container that is not the shape the Schema Editor reads' },
|
|
27
|
+
EXTRACT_TAXONOMY_REF: { severity: 'error', summary: 'a field with no $ref, or a $ref that names no field type in $defs' },
|
|
28
|
+
EXTRACT_TAXONOMY_NESTING: { severity: 'error', summary: 'a nested group (A > B) with no group A, or a top-level group naming a parent' },
|
|
29
|
+
EXTRACT_TAXONOMY_DUPLICATE_ID: { severity: 'error', summary: 'two field groups or two fields with one id' },
|
|
30
|
+
EXTRACT_TAXONOMY_FIELD_TYPE: { severity: 'error', summary: 'a $defs key a $ref cannot name unescaped, or a field type with no title' },
|
|
31
|
+
EXTRACT_TAXONOMY_LIMIT: { severity: 'error', summary: 'a name over 128 characters (a nested group\'s whole A > B key) or instructions over 4096' },
|
|
21
32
|
};
|
|
22
33
|
function checkFileRef(inputs, verb, ctx) {
|
|
23
34
|
const fr = inputs.fileRef;
|
|
@@ -128,6 +139,31 @@ function withConfig(schema, modelConfig) {
|
|
|
128
139
|
return schema;
|
|
129
140
|
return { config: buildScaffoldConfig(modelConfig), ...schema };
|
|
130
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* The schema as `nodes schema set` writes it: its taxonomy ids settled, then
|
|
144
|
+
* its objects closed so the Schema Editor opens it. A value with no
|
|
145
|
+
* `outputSchema` object is written as given.
|
|
146
|
+
*/
|
|
147
|
+
function withTaxonomyIds(schema, flowId, nodeId, previous) {
|
|
148
|
+
if (!isObject(schema) || !isObject(schema.outputSchema))
|
|
149
|
+
return { document: schema };
|
|
150
|
+
const { document, counts } = settleTaxonomyIds(schema, isObject(previous) ? previous : undefined, derivedTaxonomyMint(flowId, nodeId));
|
|
151
|
+
closeObjectSchemas(document.outputSchema);
|
|
152
|
+
return { document, counts };
|
|
153
|
+
}
|
|
154
|
+
/** The schema document the overwritten `.flow` has for this step, if any. */
|
|
155
|
+
function overwrittenSchema(ctx) {
|
|
156
|
+
const node = ctx.overwrittenNode();
|
|
157
|
+
return node?.inputs?.schemaDocument;
|
|
158
|
+
}
|
|
159
|
+
/** Say what happened to the ids, as `nodes schema set` reports it; nothing for a taxonomy with no entries. */
|
|
160
|
+
function noteTaxonomyIds(ctx, c) {
|
|
161
|
+
if (c === undefined || c.groupIdsPreserved + c.groupIdsMinted + c.fieldIdsPreserved + c.fieldIdsMinted === 0)
|
|
162
|
+
return;
|
|
163
|
+
ctx.note(`taxonomy ids: ${c.groupIdsPreserved} group and ${c.fieldIdsPreserved} field id(s) kept, `
|
|
164
|
+
+ `${c.groupIdsMinted} group and ${c.fieldIdsMinted} field id(s) minted`
|
|
165
|
+
+ (c.businessChecksDropped > 0 ? `; ${c.businessChecksDropped} business check(s) dropped (they named a field or group that is gone)` : ''), c);
|
|
166
|
+
}
|
|
131
167
|
/** The lifted schema without a `config` that is only the scaffold {@link withConfig} adds back. */
|
|
132
168
|
function withoutScaffoldConfig(schema, modelConfig) {
|
|
133
169
|
if (!isObject(schema) || JSON.stringify(schema.config) !== JSON.stringify(buildScaffoldConfig(modelConfig)))
|
|
@@ -135,6 +171,39 @@ function withoutScaffoldConfig(schema, modelConfig) {
|
|
|
135
171
|
const { config: _scaffold, ...rest } = schema;
|
|
136
172
|
return rest;
|
|
137
173
|
}
|
|
174
|
+
const SET_HINT = 'The document is { prompt, outputSchema }, the one `uip maestro flow nodes schema set` takes; '
|
|
175
|
+
+ 'see website/reference/document-pipeline.md.';
|
|
176
|
+
/**
|
|
177
|
+
* The taxonomy rules (#1986): what `nodes schema set` refuses, run on the
|
|
178
|
+
* document as compile writes it (config scaffolded, ids settled, objects
|
|
179
|
+
* closed), so nothing compile fills in is reported.
|
|
180
|
+
*/
|
|
181
|
+
function checkSchema(inputs, ctx) {
|
|
182
|
+
const schema = inputs.schema;
|
|
183
|
+
if (schema === undefined)
|
|
184
|
+
return;
|
|
185
|
+
const at = `"${ctx.step}"'s schema`;
|
|
186
|
+
if (!isObject(schema)) {
|
|
187
|
+
ctx.report('EXTRACT_SCHEMA_SHAPE', `${at} must be an object (the inline extraction schema document).`, SET_HINT);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (isLegacyTaxonomy(schema)) {
|
|
191
|
+
ctx.report('EXTRACT_TAXONOMY_LEGACY', `${at} uses the superseded { taxonomy, fieldTypes } shape, which \`nodes schema set\` refuses.`, SET_HINT);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (!isReadableTaxonomy(schema)) {
|
|
195
|
+
if (isBareJsonSchema(schema)) {
|
|
196
|
+
ctx.report('EXTRACT_TAXONOMY_BARE', `${at} is a bare JSON Schema: no "prompt", no field types in "$defs", no field groups. \`nodes schema set\` refuses it, `
|
|
197
|
+
+ 'and the processor built from it holds no fields.', 'Wrap the groups as { prompt: \'…\', outputSchema: { type: \'object\', properties: { <Group>: … }, $defs: { … } } }. ' + SET_HINT);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
ctx.report('EXTRACT_SCHEMA_SHAPE', `${at} must have "prompt" (the overall instructions, a string) and "outputSchema" (an object).`, SET_HINT);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const { document } = withTaxonomyIds(withConfig(schema, undefined), 'check', ctx.step);
|
|
204
|
+
for (const finding of checkTaxonomy(document))
|
|
205
|
+
ctx.report(finding.code, `${at}: ${finding.path}: ${finding.message}`);
|
|
206
|
+
}
|
|
138
207
|
/** A non-empty string input of the node, as the lift keeps it. */
|
|
139
208
|
function liftText(inputs, key, ctx) {
|
|
140
209
|
const v = ctx.plainValue(inputs[key]);
|
|
@@ -235,6 +304,13 @@ export const dynamicExtractNodeType = {
|
|
|
235
304
|
const processorKey = inputs.processorKey !== undefined && inputs.processorKey !== ''
|
|
236
305
|
? inputs.processorKey
|
|
237
306
|
: readOnly || folderPath !== undefined ? undefined : mintedProcessorKey(ctx.flowId, ctx.nodeId);
|
|
307
|
+
// One pass, as `nodes schema set` does it: the source's ids are claimed, a
|
|
308
|
+
// missing one is adopted from the overwritten `.flow` by name, else minted;
|
|
309
|
+
// business checks are pruned only after that.
|
|
310
|
+
const taxonomy = inputs.schema !== undefined
|
|
311
|
+
? withTaxonomyIds(withConfig(inputs.schema, modelConfig ?? d.modelConfig), ctx.flowId, ctx.nodeId, overwrittenSchema(ctx))
|
|
312
|
+
: undefined;
|
|
313
|
+
noteTaxonomyIds(ctx, taxonomy?.counts);
|
|
238
314
|
return {
|
|
239
315
|
inputs: {
|
|
240
316
|
...d,
|
|
@@ -258,8 +334,11 @@ export const dynamicExtractNodeType = {
|
|
|
258
334
|
...(modelConfig !== undefined ? { modelConfig } : {}),
|
|
259
335
|
// No schema: the empty taxonomy `nodes create` seeds, so the node opens in
|
|
260
336
|
// the Schema Editor and its processor has a document to hold.
|
|
337
|
+
// Every field group and field gets its stable id (#1985), as
|
|
338
|
+
// `nodes schema set` gives them: kept when the source carries one,
|
|
339
|
+
// else minted from the flow, the node and the entry's place.
|
|
261
340
|
schemaDocument: inputs.schema !== undefined
|
|
262
|
-
?
|
|
341
|
+
? taxonomy.document
|
|
263
342
|
: buildDefaultSchemaDocument(modelConfig ?? d.modelConfig),
|
|
264
343
|
// The definition's model declares `source: true`: the platform mints a
|
|
265
344
|
// stable storage slot per instance; omit it and the node validates then
|
|
@@ -286,6 +365,8 @@ export const dynamicExtractNodeType = {
|
|
|
286
365
|
// not printed; anything else is the author's.
|
|
287
366
|
const rawSchema = ctx.plainValue(inputs.schemaDocument);
|
|
288
367
|
const seeded = buildDefaultSchemaDocument(inputs.modelConfig);
|
|
368
|
+
// Taxonomy ids are printed as the node has them (#1985): a recompile keeps
|
|
369
|
+
// an id the source carries, in place, so the file comes back byte for byte.
|
|
289
370
|
const schema = rawSchema !== undefined && JSON.stringify(rawSchema) !== JSON.stringify(seeded)
|
|
290
371
|
? withoutScaffoldConfig(rawSchema, inputs.modelConfig) : undefined;
|
|
291
372
|
// The processor a node already names is printed, so a recompile keeps it;
|
|
@@ -325,9 +406,7 @@ export const dynamicExtractNodeType = {
|
|
|
325
406
|
}),
|
|
326
407
|
check: ({ inputs }, ctx) => {
|
|
327
408
|
checkFileRef(inputs, 'extract from', ctx);
|
|
328
|
-
|
|
329
|
-
ctx.report('EXTRACT_SCHEMA_SHAPE', `"${ctx.step}"'s schema must be an object (the inline extraction schema document).`);
|
|
330
|
-
}
|
|
409
|
+
checkSchema(inputs, ctx);
|
|
331
410
|
},
|
|
332
411
|
// check collected no expressions for this kind before the port; unchanged by it.
|
|
333
412
|
expressions: () => [],
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type Json = Record<string, unknown>;
|
|
2
|
+
/** The check codes, by the rule each one stands for. */
|
|
3
|
+
export type TaxonomyCode = 'EXTRACT_TAXONOMY_STRUCTURE' | 'EXTRACT_TAXONOMY_REF' | 'EXTRACT_TAXONOMY_NESTING' | 'EXTRACT_TAXONOMY_DUPLICATE_ID' | 'EXTRACT_TAXONOMY_FIELD_TYPE' | 'EXTRACT_TAXONOMY_LIMIT';
|
|
4
|
+
export interface TaxonomyFinding {
|
|
5
|
+
code: TaxonomyCode;
|
|
6
|
+
/** Dot/bracket path into the schema document, e.g. `outputSchema.properties["Invoice"]`. */
|
|
7
|
+
path: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The extraction API's limits, flow-schema's `IXP_MAX_*` (`ixp-schema/constants.ts`).
|
|
12
|
+
* The names are 128 since flow-workbench #5603 (flow-schema 0.138.0-develop,
|
|
13
|
+
* 2026-11-06), which matches IXP; the 0.135.x line still says 64. The
|
|
14
|
+
* newest line is copied, so `check` refuses nothing the platform accepts.
|
|
15
|
+
* tests/taxonomy-limits-drift.test.ts holds each one to the flow-schema the
|
|
16
|
+
* repo pins for it.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TAXONOMY_LIMITS: {
|
|
19
|
+
readonly fieldGroupName: 128;
|
|
20
|
+
readonly fieldName: 128;
|
|
21
|
+
readonly fieldTypeName: 128;
|
|
22
|
+
readonly instructions: 4096;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Every rule a `{ prompt, outputSchema }` document breaks, in the CLI
|
|
26
|
+
* validator's order, then the limits. Empty when `nodes schema set` would
|
|
27
|
+
* write it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkTaxonomy(document: Json): TaxonomyFinding[];
|
|
30
|
+
/** The superseded private `{ taxonomy, fieldTypes }` document. */
|
|
31
|
+
export declare function isLegacyTaxonomy(value: unknown): boolean;
|
|
32
|
+
/** A `{ prompt, outputSchema }` document — the shape `schema set` takes. */
|
|
33
|
+
export declare function isReadableTaxonomy(value: unknown): value is Json;
|
|
34
|
+
/** A bare JSON Schema — `{ type: 'object', properties }` with no `prompt` around it (flow-schema `readExtractionOutputSchema`). */
|
|
35
|
+
export declare function isBareJsonSchema(value: unknown): boolean;
|
|
36
|
+
export {};
|