@uipath/maestro-builder-sdk 6.8.5 → 6.8.6

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.
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Internal: what `check` and `compile` say about a `rawNode` for a node type
3
+ * the SDK has a typed factory for, and the Data Fabric input keys it may carry.
4
+ * Not re-exported from the package entry point.
5
+ */
6
+ /** The factory to use for one node type, and the versions of it the SDK bundles. */
7
+ export interface TypedFactory {
8
+ /** The typed spelling, as the refusal names it. */
9
+ factory: string;
10
+ /**
11
+ * Every `<version>` with a `<nodeType>@<version>` entry in `core-definitions.json`.
12
+ * Listed here rather than read from the file because this module sits under
13
+ * `node-classes.ts`, which must not import `node:*`; `raw-node-typed-family.test.ts`
14
+ * pins the two equal.
15
+ */
16
+ bundled: readonly string[];
17
+ }
18
+ /**
19
+ * Every node type the SDK authors as a STEP through a typed factory, with the
20
+ * factory to use. `raw-node-typed-family.test.ts` pins the key set to the
21
+ * `flow-coverage.json` rows with `support: 'typed'` and a `bundledKey`, so a
22
+ * family that gains a factory gains its row here too.
23
+ *
24
+ * Two groups of typed rows are left out, because neither is ever a step:
25
+ * triggers (`core.trigger.*`, placed by `.trigger()`) and agent resources
26
+ * (`uipath.agent.resource.*`, attached to an agent). `decompile` keeps an
27
+ * orphaned one as a `rawNode`, and a warning on that round trip would be noise.
28
+ *
29
+ * The Data Fabric verbs name their options, because the query and write keys
30
+ * an author reaches for by hand (`_filters`, `_sort`, `fieldValues`, …) each
31
+ * have a typed spelling.
32
+ */
33
+ export declare const TYPED_FACTORIES: Readonly<Record<string, TypedFactory>>;
34
+ /**
35
+ * Every `entityConfig` key the product reads or persists on a Data Fabric node,
36
+ * across the four verbs. flow-workbench develop `eed682f19`:
37
+ *
38
+ * - services `serialization/entity-vdo.ts` `interface EntityConfig` (:229-272):
39
+ * `entityName`, `resultMode`, `_recordLimit`, `_skip`, `_sort`,
40
+ * `_selectedFieldNames`, `_filters`, `_entityFields`, `_relatedFields`,
41
+ * `_folderKey`, `_entityKey`, `_resourceKey`, `_outputSchema`;
42
+ * `CreateEntityConfig` (:719) adds `fieldValues`; `UpdateEntityConfig` (:744)
43
+ * adds `recordSource`, `readEntityNodeId`, `recordId`, `fieldUpdates`.
44
+ * - canvas `properties-panel/EntityConfigField.tsx` `EntityConfigInputs`
45
+ * (:85-110) and `entity/useEntityPanelState.ts` `EntitySelectionPatch`
46
+ * (:248-270), which the panels persist on an entity pick:
47
+ * `_entityDisplayName`, `_choiceSets`, `_folderPath`, `_entitySubType`.
48
+ * - Create/Update/DeleteEntityConfigField.tsx declare nothing beyond these.
49
+ *
50
+ * One union rather than one set per verb: a key another verb reads is at worst
51
+ * ignored, and a per-verb split would refuse a canvas-written key on a verb
52
+ * whose panel happens not to declare it. The test pins every key the typed
53
+ * factories write to this set.
54
+ */
55
+ export declare const DATAFABRIC_ENTITY_CONFIG_KEYS: ReadonlySet<string>;
56
+ /**
57
+ * A reminder, as a `warning`, that a `rawNode` stands in for a typed factory,
58
+ * or `undefined` for a type with no factory.
59
+ *
60
+ * A warning and never an error: a factory does not always write every input its
61
+ * node reads (the Data Fabric verbs do not write `_entityFields`, which a
62
+ * related-path filter needs), and nothing checks factory coverage family by
63
+ * family. So the raw node keeps compiling at every version. The one failure
64
+ * the eval archive measured, an invented key the node never reads, is refused
65
+ * by {@link dataFabricUnknownInputs} instead.
66
+ *
67
+ * @param nodeType - The definition's `nodeType`, as passed to `rawNode`.
68
+ * @returns The warning, or `undefined` for a type with no typed factory.
69
+ */
70
+ export declare function typedFamilyRawNodeWarning(nodeType: string): string | undefined;
71
+ /**
72
+ * Why a `core.datafabric.*` node's inputs carry a key the product never reads,
73
+ * or `undefined` when they do not.
74
+ *
75
+ * This is where the eval failure became possible. A raw node renders its inputs
76
+ * verbatim, and `core.datafabric.read@1.4`'s registry definition declares only
77
+ * `entityName` and `resultMode`, so `validate` cannot see any other key. Measured
78
+ * on the eval archive (2026-09-23, skill-flow-datafabric-native-contract-intake-pipeline):
79
+ * the agent wrote `_sortOptions: [{ fieldName, isDescending }]` in place of
80
+ * `_sort`, `check` printed "no issues", `validate` said Valid, and the query
81
+ * would have run unsorted. The allowed set is what the product reads
82
+ * ({@link DATAFABRIC_ENTITY_CONFIG_KEYS}), so `_entityFields` and the other
83
+ * canvas snapshots stay legal.
84
+ *
85
+ * Severity follows the version: at a bundled `<nodeType>@<version>` the key set
86
+ * is known, so the key is refused (`error`); at a version this SDK has not
87
+ * synced, a newer node could read a new key, so it is reported (`warning`).
88
+ *
89
+ * @param nodeType - The node's type.
90
+ * @param version - The version the node is emitted at.
91
+ * @param inputs - The node's inputs, before rendering.
92
+ * @returns The diagnostic, or `undefined` for a clean node or a non-Data-Fabric type.
93
+ */
94
+ export declare function dataFabricUnknownInputs(nodeType: string, version: string, inputs: unknown): {
95
+ severity: 'error' | 'warning';
96
+ message: string;
97
+ } | undefined;
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Internal: what `check` and `compile` say about a `rawNode` for a node type
3
+ * the SDK has a typed factory for, and the Data Fabric input keys it may carry.
4
+ * Not re-exported from the package entry point.
5
+ */
6
+ /**
7
+ * Every node type the SDK authors as a STEP through a typed factory, with the
8
+ * factory to use. `raw-node-typed-family.test.ts` pins the key set to the
9
+ * `flow-coverage.json` rows with `support: 'typed'` and a `bundledKey`, so a
10
+ * family that gains a factory gains its row here too.
11
+ *
12
+ * Two groups of typed rows are left out, because neither is ever a step:
13
+ * triggers (`core.trigger.*`, placed by `.trigger()`) and agent resources
14
+ * (`uipath.agent.resource.*`, attached to an agent). `decompile` keeps an
15
+ * orphaned one as a `rawNode`, and a warning on that round trip would be noise.
16
+ *
17
+ * The Data Fabric verbs name their options, because the query and write keys
18
+ * an author reaches for by hand (`_filters`, `_sort`, `fieldValues`, …) each
19
+ * have a typed spelling.
20
+ */
21
+ export const TYPED_FACTORIES = {
22
+ 'core.action.http': { factory: 'http({ managed: false })', bundled: ['1.0.0'] },
23
+ 'core.action.http.v2': { factory: 'http({ managed: true })', bundled: ['2.3'] },
24
+ 'core.action.queue.create': { factory: 'queueItem()', bundled: ['1.2'] },
25
+ 'core.action.queue.create-and-wait': { factory: 'queueItem({ wait: true })', bundled: ['1.2'] },
26
+ 'core.action.script': { factory: 'script()', bundled: ['1.0.0', '1.1'] },
27
+ 'core.action.transform': { factory: 'transform()', bundled: ['1.0.0', '1.1'] },
28
+ 'core.action.transform.filter': { factory: "transform({ variant: 'filter' })", bundled: ['1.0.0', '1.1'] },
29
+ 'core.action.transform.group-by': { factory: "transform({ variant: 'group-by' })", bundled: ['1.0.0', '1.1'] },
30
+ 'core.action.transform.map': { factory: "transform({ variant: 'map' })", bundled: ['1.0.0', '1.1'] },
31
+ 'core.control.end': { factory: '.return()', bundled: ['1.0.0', '1.0'] },
32
+ 'core.datafabric.read': {
33
+ factory: "dataFabricRead({ entity, resultMode: 'single' | 'multiple', filters: [{ field, operator, value, or }], "
34
+ + 'sort: { field, direction }, limit, skip, fields, folderKey })',
35
+ bundled: ['1.0', '1.4'],
36
+ },
37
+ 'core.datafabric.create': {
38
+ factory: 'dataFabricCreate({ entity, values: { <field>: <value> }, folderKey })',
39
+ bundled: ['1.3'],
40
+ },
41
+ 'core.datafabric.update': {
42
+ factory: 'dataFabricUpdate({ entity, record: { byId } | { fromRead }, set: { <field>: <value> }, folderKey })',
43
+ bundled: ['1.0', '1.3'],
44
+ },
45
+ 'core.datafabric.delete': {
46
+ factory: 'dataFabricDelete({ entity, record: { byId } | { fromRead }, folderKey })',
47
+ bundled: ['1.3'],
48
+ },
49
+ 'core.logic.decision': { factory: '.branch()', bundled: ['1.0.0', '1.3'] },
50
+ 'core.logic.delay': { factory: 'delay({ duration })', bundled: ['1.0.0', '1.0'] },
51
+ 'core.logic.dowhile': { factory: '.doWhile(name, condition, body, { limit, breakEnabled })', bundled: ['1.0'] },
52
+ 'core.logic.loop': { factory: '.loop()', bundled: ['1.0.0', '2.4'] },
53
+ 'core.logic.merge': { factory: '.parallel() rejoin', bundled: ['1.0.0', '1.0'] },
54
+ 'core.logic.mock': { factory: 'mock()', bundled: ['1.0.0', '1.0'] },
55
+ 'core.logic.switch': { factory: '.switch()', bundled: ['1.0.0', '1.1'] },
56
+ 'core.logic.terminate': { factory: '.terminate()', bundled: ['1.0.0', '1.0'] },
57
+ 'core.subflow': { factory: 'subflow(child, inputs)', bundled: ['1.0.0', '1.0'] },
58
+ 'uipath.agent.conversational': { factory: 'conversationalAgent()', bundled: ['1.6', '1.7'] },
59
+ 'uipath.agent.voice': { factory: 'voiceAgent()', bundled: ['1.0', '1.1'] },
60
+ 'uipath.conversational.get-conversation-context': { factory: 'conversationContext()', bundled: ['1.0'] },
61
+ 'uipath.conversational.send-message': { factory: 'sendMessage()', bundled: ['1.0', '1.1'] },
62
+ 'uipath.conversational.voice.create-outgoing-call': { factory: 'createOutgoingCall()', bundled: ['1.0'] },
63
+ 'uipath.conversational.voice.end-call': { factory: 'endCall()', bundled: ['1.0'] },
64
+ 'uipath.conversational.wait-for-message': { factory: 'waitForMessage()', bundled: ['1.0', '1.1'] },
65
+ 'uipath.document.classify': { factory: 'documentClassify()', bundled: ['1.0'] },
66
+ 'uipath.human-in-the-loop': { factory: 'hitl()', bundled: ['1.0', '1.1', '1.2'] },
67
+ 'uipath.human-in-the-loop.coded-action-app': {
68
+ factory: "hitl({ variant: 'action-app' })",
69
+ bundled: ['1.0', '1.1'],
70
+ },
71
+ 'uipath.human-in-the-loop.document-validation': {
72
+ factory: "hitl({ variant: 'document-validation' })",
73
+ bundled: ['1.0'],
74
+ },
75
+ 'uipath.human-in-the-loop.quick-form': { factory: "hitl({ variant: 'quick-form' })", bundled: ['1.0', '1.1'] },
76
+ 'uipath.pattern.batch-transform': { factory: 'batchTransform()', bundled: ['1.0'] },
77
+ 'uipath.pattern.deep-rag': { factory: 'summarize()', bundled: ['1.0'] },
78
+ 'uipath.ixp.extract-document-builder': { factory: 'dynamicExtract()', bundled: ['1.0.0'] },
79
+ };
80
+ /**
81
+ * Every `entityConfig` key the product reads or persists on a Data Fabric node,
82
+ * across the four verbs. flow-workbench develop `eed682f19`:
83
+ *
84
+ * - services `serialization/entity-vdo.ts` `interface EntityConfig` (:229-272):
85
+ * `entityName`, `resultMode`, `_recordLimit`, `_skip`, `_sort`,
86
+ * `_selectedFieldNames`, `_filters`, `_entityFields`, `_relatedFields`,
87
+ * `_folderKey`, `_entityKey`, `_resourceKey`, `_outputSchema`;
88
+ * `CreateEntityConfig` (:719) adds `fieldValues`; `UpdateEntityConfig` (:744)
89
+ * adds `recordSource`, `readEntityNodeId`, `recordId`, `fieldUpdates`.
90
+ * - canvas `properties-panel/EntityConfigField.tsx` `EntityConfigInputs`
91
+ * (:85-110) and `entity/useEntityPanelState.ts` `EntitySelectionPatch`
92
+ * (:248-270), which the panels persist on an entity pick:
93
+ * `_entityDisplayName`, `_choiceSets`, `_folderPath`, `_entitySubType`.
94
+ * - Create/Update/DeleteEntityConfigField.tsx declare nothing beyond these.
95
+ *
96
+ * One union rather than one set per verb: a key another verb reads is at worst
97
+ * ignored, and a per-verb split would refuse a canvas-written key on a verb
98
+ * whose panel happens not to declare it. The test pins every key the typed
99
+ * factories write to this set.
100
+ */
101
+ export const DATAFABRIC_ENTITY_CONFIG_KEYS = new Set([
102
+ 'entityName', 'resultMode',
103
+ '_recordLimit', '_skip', '_sort', '_selectedFieldNames', '_filters',
104
+ '_entityFields', '_relatedFields', '_choiceSets', '_outputSchema',
105
+ '_folderKey', '_folderPath', '_entityKey', '_resourceKey', '_entityDisplayName', '_entitySubType',
106
+ 'fieldValues', 'fieldUpdates', 'recordSource', 'readEntityNodeId', 'recordId',
107
+ ]);
108
+ /**
109
+ * What the Data Fabric factories write, and what they do not, as the typed-family
110
+ * warning states it. The factories do not author the canvas's column snapshots,
111
+ * so a related-path filter (`customer.Name`) still needs a raw node carrying
112
+ * `_entityFields` (core/actions.ts `DataFabricFilter.field`).
113
+ */
114
+ const DATAFABRIC_HINT = ' The factory writes the query and write keys: `filters` becomes `_filters` (flat rows; `or: true` '
115
+ + 'starts each OR alternative), `sort` is `_sort`, `limit`/`skip`/`fields` are '
116
+ + '`_recordLimit`/`_skip`/`_selectedFieldNames`, `values`/`set` are `fieldValues`/`fieldUpdates`, '
117
+ + 'and `record` is `recordSource`. It does not write the column snapshots `_entityFields`, '
118
+ + '`_relatedFields`, `_choiceSets` or `_outputSchema`; a related-path filter such as '
119
+ + '`customer.Name` needs `_entityFields`, so for that a raw node is still the way.';
120
+ /**
121
+ * A reminder, as a `warning`, that a `rawNode` stands in for a typed factory,
122
+ * or `undefined` for a type with no factory.
123
+ *
124
+ * A warning and never an error: a factory does not always write every input its
125
+ * node reads (the Data Fabric verbs do not write `_entityFields`, which a
126
+ * related-path filter needs), and nothing checks factory coverage family by
127
+ * family. So the raw node keeps compiling at every version. The one failure
128
+ * the eval archive measured, an invented key the node never reads, is refused
129
+ * by {@link dataFabricUnknownInputs} instead.
130
+ *
131
+ * @param nodeType - The definition's `nodeType`, as passed to `rawNode`.
132
+ * @returns The warning, or `undefined` for a type with no typed factory.
133
+ */
134
+ export function typedFamilyRawNodeWarning(nodeType) {
135
+ if (typeof nodeType !== 'string')
136
+ return undefined;
137
+ const entry = TYPED_FACTORIES[nodeType];
138
+ if (entry === undefined)
139
+ return undefined;
140
+ const hint = nodeType.startsWith('core.datafabric.') ? DATAFABRIC_HINT : '';
141
+ return `rawNode("${nodeType}"): this SDK has a typed factory, ${entry.factory}. A raw node keeps its `
142
+ + `inputs verbatim, and \`validate\` cannot see a key the registry definition does not declare, so a `
143
+ + `misspelled input compiles and is ignored at run time. Prefer the factory unless you need an input it `
144
+ + `does not write.${hint}`;
145
+ }
146
+ const isPlainObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v) && Object.getPrototypeOf(v) === Object.prototype;
147
+ /**
148
+ * Why a `core.datafabric.*` node's inputs carry a key the product never reads,
149
+ * or `undefined` when they do not.
150
+ *
151
+ * This is where the eval failure became possible. A raw node renders its inputs
152
+ * verbatim, and `core.datafabric.read@1.4`'s registry definition declares only
153
+ * `entityName` and `resultMode`, so `validate` cannot see any other key. Measured
154
+ * on the eval archive (2026-09-23, skill-flow-datafabric-native-contract-intake-pipeline):
155
+ * the agent wrote `_sortOptions: [{ fieldName, isDescending }]` in place of
156
+ * `_sort`, `check` printed "no issues", `validate` said Valid, and the query
157
+ * would have run unsorted. The allowed set is what the product reads
158
+ * ({@link DATAFABRIC_ENTITY_CONFIG_KEYS}), so `_entityFields` and the other
159
+ * canvas snapshots stay legal.
160
+ *
161
+ * Severity follows the version: at a bundled `<nodeType>@<version>` the key set
162
+ * is known, so the key is refused (`error`); at a version this SDK has not
163
+ * synced, a newer node could read a new key, so it is reported (`warning`).
164
+ *
165
+ * @param nodeType - The node's type.
166
+ * @param version - The version the node is emitted at.
167
+ * @param inputs - The node's inputs, before rendering.
168
+ * @returns The diagnostic, or `undefined` for a clean node or a non-Data-Fabric type.
169
+ */
170
+ export function dataFabricUnknownInputs(nodeType, version, inputs) {
171
+ if (typeof nodeType !== 'string' || !nodeType.startsWith('core.datafabric.'))
172
+ return undefined;
173
+ if (!isPlainObject(inputs))
174
+ return undefined;
175
+ const unknown = Object.keys(inputs).filter((k) => k !== 'entityConfig');
176
+ const cfg = inputs.entityConfig;
177
+ if (isPlainObject(cfg)) {
178
+ for (const k of Object.keys(cfg))
179
+ if (!DATAFABRIC_ENTITY_CONFIG_KEYS.has(k))
180
+ unknown.push(`entityConfig.${k}`);
181
+ }
182
+ if (unknown.length === 0)
183
+ return undefined;
184
+ const bundled = TYPED_FACTORIES[nodeType]?.bundled.includes(version) ?? false;
185
+ const named = unknown.map((k) => `\`${k}\``).join(', ');
186
+ const factory = TYPED_FACTORIES[nodeType]?.factory;
187
+ const base = `${nodeType}@${version} carries ${named}, which the platform never reads: Data Fabric `
188
+ + `nodes read only \`inputs.entityConfig\`, with the keys ${[...DATAFABRIC_ENTITY_CONFIG_KEYS].join(', ')} `
189
+ + `(flow-workbench entity-vdo.ts \`EntityConfig\` and the entity panels). \`validate\` cannot see `
190
+ + `the key, so it compiles and is ignored at run time; for example a sort is \`_sort: { field, direction }\`, `
191
+ + `not \`_sortOptions\`.${factory ? ` The typed factory, ${factory}, writes only keys the node reads.` : ''}`;
192
+ if (bundled)
193
+ return { severity: 'error', message: base };
194
+ return {
195
+ severity: 'warning',
196
+ message: `${base} This SDK does not bundle ${nodeType}@${version}, so a newer node may read the key; `
197
+ + 'it compiles as written.',
198
+ };
199
+ }
@@ -15,6 +15,7 @@ import { pyStr } from "../compat/pystr.js";
15
15
  import { mapConcurrent } from "../concurrency.js";
16
16
  import { Refusal, messageOf } from "../errors.js";
17
17
  import { registrySearchConnectors } from "../uip/commands.js";
18
+ import { failureReason } from "../uip/envelope.js";
18
19
  import { applyCuratedOverrides, extractCanonical, filterNodeTypesByTier, mergeConnectorRecord, nodeOf, scopedConnectorKey, selectPublishedConnectors, } from "./canonical.js";
19
20
  import { SEARCH_RESULTS_NAME, createBuildContext, isConnectorGet, registryCacheName, registryGet, } from "./context.js";
20
21
  import { enrichAll } from "./enrich.js";
@@ -53,7 +54,7 @@ export async function registrySearch(ctx) {
53
54
  ctx.reporter.info("Running registry search...");
54
55
  const result = await ctx.client.run(registrySearchConnectors(), ctx.timeoutMs === undefined ? undefined : { timeoutMs: ctx.timeoutMs });
55
56
  if (result.code !== 0)
56
- throw new Refusal(`Registry search failed: ${result.stderr}`, "REGISTRY_SEARCH_FAILED");
57
+ throw new Refusal(`Registry search failed: ${failureReason(result)}`, "REGISTRY_SEARCH_FAILED");
57
58
  ctx.caches.registry.write(SEARCH_RESULTS_NAME, undefined, result.stdout);
58
59
  }
59
60
  const data = ctx.caches.registry.read(SEARCH_RESULTS_NAME);
@@ -60,6 +60,32 @@ export declare function registryCacheName(nodeType: string): string;
60
60
  export declare const SEARCH_RESULTS_NAME = "_search_results.json";
61
61
  /** `json.dump(payload, f)`: cache bytes shaped as Python wrote them. */
62
62
  export declare function writeCache(cache: ResponseCache, name: string, payload: unknown): void;
63
+ /** A `registry get` that did not answer with the node, and why. */
64
+ export interface RegistryMiss {
65
+ nodeType: string;
66
+ /** The CLI's own reason ({@link failureReason}); never empty. */
67
+ reason: string;
68
+ /**
69
+ * True only for the CLI's "Node not found" answer — the node is absent. False
70
+ * for every failure of the LOOKUP (an error, a refusal, a timeout), which says
71
+ * nothing about whether the node exists.
72
+ */
73
+ notFound: boolean;
74
+ }
75
+ /** {@link registryProbe}'s answer: the cache name of the reply, or the miss. */
76
+ export type RegistryProbe = {
77
+ name: string;
78
+ } | {
79
+ miss: RegistryMiss;
80
+ };
81
+ /**
82
+ * Cached `uip maestro flow registry get <nodeType>`, reporting nothing.
83
+ *
84
+ * The caller gets the miss with its reason and decides what to say — a caller
85
+ * probing which namespace an operation lives in puts every probe's reason into
86
+ * one refusal instead of a WARN per probe.
87
+ */
88
+ export declare function registryProbe(ctx: BuildContext, nodeType: string): Promise<RegistryProbe>;
63
89
  /**
64
90
  * `registry_get`: cached `uip maestro flow registry get <nodeType>`.
65
91
  *
@@ -18,7 +18,7 @@ import { pyJsonStringify } from "../codecs/pyjson.js";
18
18
  import { sortedByKeys } from "../compat/compare.js";
19
19
  import { isConnectorsMetadata, isResourcesDescribeObject, isResourcesDescribeOperation, isResourcesList as isResourcesListArgv, registryGet as registryGetArgv, } from "../uip/commands.js";
20
20
  import { CACHED_FAILURE, isCachedFailure, safeCacheName } from "../uip/response-cache.js";
21
- import { pyStrip } from "../compat/pystr.js";
21
+ import { failureReason, isNodeNotFound } from "../uip/envelope.js";
22
22
  import { get, isRecord, pyOr, truthy } from "./py.js";
23
23
  export function createBuildContext(ports, scope = {}) {
24
24
  const parentFields = scope.parentFields instanceof Map
@@ -116,25 +116,38 @@ function envelope(payload) {
116
116
  return payload;
117
117
  }
118
118
  /**
119
- * `registry_get`: cached `uip maestro flow registry get <nodeType>`.
119
+ * Cached `uip maestro flow registry get <nodeType>`, reporting nothing.
120
120
  *
121
- * Returns the cache name the raw stdout lives under, or `undefined` when the
122
- * call failed. `quiet` suppresses the failure WARN — for a caller probing which
123
- * of several node-type namespaces an action lives in, where a miss is an
124
- * expected answer rather than a problem to report.
121
+ * The caller gets the miss with its reason and decides what to say — a caller
122
+ * probing which namespace an operation lives in puts every probe's reason into
123
+ * one refusal instead of a WARN per probe.
125
124
  */
126
- export async function registryGet(ctx, nodeType, quiet = false) {
125
+ export async function registryProbe(ctx, nodeType) {
127
126
  const name = registryCacheName(nodeType);
128
127
  if (ctx.caches.registry.has(name))
129
- return name;
128
+ return { name };
130
129
  const result = await runUip(ctx, registryGetArgv(nodeType, ctx.connectionId));
131
130
  if (result.code !== 0) {
132
- if (!quiet)
133
- ctx.reporter.warn(` WARN: registry get failed for ${nodeType}: ${pyStrip(result.stderr)}`);
134
- return undefined;
131
+ return { miss: { nodeType, reason: failureReason(result), notFound: isNodeNotFound(result) } };
135
132
  }
136
133
  ctx.caches.registry.write(name, undefined, result.stdout);
137
- return name;
134
+ return { name };
135
+ }
136
+ /**
137
+ * `registry_get`: cached `uip maestro flow registry get <nodeType>`.
138
+ *
139
+ * Returns the cache name the raw stdout lives under, or `undefined` when the
140
+ * call failed. `quiet` suppresses the failure WARN — for a caller probing which
141
+ * of several node-type namespaces an action lives in, where a miss is an
142
+ * expected answer rather than a problem to report.
143
+ */
144
+ export async function registryGet(ctx, nodeType, quiet = false) {
145
+ const probe = await registryProbe(ctx, nodeType);
146
+ if ("name" in probe)
147
+ return probe.name;
148
+ if (!quiet)
149
+ ctx.reporter.warn(` WARN: registry get failed for ${nodeType}: ${probe.miss.reason}`);
150
+ return undefined;
138
151
  }
139
152
  function noteFailedFieldDescribe(ctx, connectorKey, objectName, operation, message) {
140
153
  if (ctx.parentFields.size > 0) {
@@ -18,6 +18,7 @@ import { lowerFirst, pyStr, pyStrip, startsWithUpper } from "../compat/pystr.js"
18
18
  import { mapConcurrent } from "../concurrency.js";
19
19
  import { Refusal } from "../errors.js";
20
20
  import { isTriggersDescribe, isTriggersObjects } from "../uip/commands.js";
21
+ import { failureReason } from "../uip/envelope.js";
21
22
  import { safeCacheName } from "../uip/response-cache.js";
22
23
  import { schemaCacheScope, writeCache } from "./context.js";
23
24
  import { objectsComeFromTheConnection } from "./generic-expand.js";
@@ -66,8 +67,8 @@ async function runJson(client, argv, timeoutMs) {
66
67
  payload = JSON.parse(result.stdout);
67
68
  }
68
69
  catch {
69
- const text = codePointSlice(pyStrip(result.stderr || result.stdout), 0, 300);
70
- throw new EventDiscoveryError(`${head} did not answer JSON: ${text || "no output"}`, result.refused === true);
70
+ const text = codePointSlice(failureReason(result), 0, 300);
71
+ throw new EventDiscoveryError(`${head} did not answer JSON: ${text}`, result.refused === true);
71
72
  }
72
73
  if (get(payload, "Result") !== "Success") {
73
74
  // `refused` is carried here too, although the refusing client in this tree
@@ -5,7 +5,8 @@ import type { UipClient } from "../uip/client.js";
5
5
  * Exact prefix only: the same search returns
6
6
  * `uipath.agent.resource.tool.connector.<key>.<action>` and
7
7
  * `uipath.connector.trigger.<key>.<event>`, which are not actions of this node
8
- * and would read as alternatives an author could pass.
8
+ * and would read as alternatives an author could pass as an action. The events
9
+ * are listed separately, by {@link registryEventIds}.
9
10
  */
10
11
  export declare function registryActionIds(payload: unknown, connectorKey: string): string[];
11
12
  /**
@@ -19,8 +20,44 @@ export declare function registryActionIds(payload: unknown, connectorKey: string
19
20
  */
20
21
  export declare function closestActions(action: string, candidates: readonly string[]): string[];
21
22
  /**
22
- * `_registry_actions`: the action ids the registry serves for `connectorKey`,
23
- * or `[]` when the search fails or does not answer JSON. This runs only on the
24
- * failure path, where an empty answer is itself the message ("returned nothing").
23
+ * {@link closestActions}, kept only where the candidate is plausibly what was
24
+ * meant: it shares MOST of the wanted id's words (`list-all-records` →
25
+ * `list-records`), or it is a near spelling (`record-creatd` → `record-created`,
26
+ * `send-mail` → `send-email`). One shared word is not enough: `record-created`
27
+ * shares "record" with every Data Fabric action, and offering
28
+ * `update-entity-record` as the closest match to an EVENT name points the
29
+ * author at the wrong namespace.
25
30
  */
26
- export declare function registryActions(client: UipClient, connectorKey: string, timeoutMs?: number): Promise<string[]>;
31
+ export declare function plausibleMatches(wanted: string, candidates: readonly string[]): string[];
32
+ /** The two node-type forms a connector event is served in. */
33
+ export type EventForm = "trigger" | "event";
34
+ /** One event id in a `registry search` reply, with the forms it was served in. */
35
+ export interface RegistryEvent {
36
+ id: string;
37
+ /** `trigger` = `uipath.connector.trigger.<key>.<id>` (starts a flow), `event` = `…event…` (waits mid-flow). */
38
+ forms: EventForm[];
39
+ }
40
+ /**
41
+ * The event ids in a `registry search <key>` reply, sorted, each with its forms.
42
+ *
43
+ * The form is kept because the two can come and go separately: on 2026-09-16
44
+ * the Data Fabric `.event.` pair was still served after its `.trigger.` pair
45
+ * was gone, and `prepare` probes the `.trigger.` form.
46
+ */
47
+ export declare function registryEventIds(payload: unknown, connectorKey: string): RegistryEvent[];
48
+ /** What `registry search <key>` served, or why it could not say. */
49
+ export interface RegistryCatalog {
50
+ actions: string[];
51
+ events: RegistryEvent[];
52
+ /**
53
+ * Set when the search itself failed or did not answer JSON. The lists are
54
+ * then empty because nothing was read, NOT because the catalog is empty, and
55
+ * a message must not say "returned nothing".
56
+ */
57
+ failure?: string;
58
+ }
59
+ /**
60
+ * `registry search <key>`, read for both catalogs. This runs only on the
61
+ * failure path, to tell the author what the catalog does serve.
62
+ */
63
+ export declare function registryCatalog(client: UipClient, connectorKey: string, timeoutMs?: number): Promise<RegistryCatalog>;
@@ -3,9 +3,14 @@
3
3
  *
4
4
  * When `registry get uipath.connector.<key>.<action>` finds nothing — and the
5
5
  * event namespaces do not have it either — the one question left is what the
6
- * tenant actually serves for that connector, so the refusal can list it. That
7
- * is a `registry search <key>` against the live catalog rather than a cached
8
- * index, because a stale index is one of the ways this failure happens.
6
+ * catalog actually serves for that connector, so the refusal can list it: its
7
+ * actions AND its events, because the author's name may have meant either.
8
+ * That is one `registry search <key>`.
9
+ *
10
+ * `registry get` and `registry search` both answer from the CLI's local node
11
+ * index and pull the tenant catalog only when that index is missing (uipath-cli
12
+ * `packages/maestro-sdk/src/registry/node-sync-service.ts:307-323`, `:570-597`),
13
+ * so what they list can be stale; the refusal says how to refresh it.
9
14
  *
10
15
  * Ported from `_registry_actions` / `_closest_actions` in
11
16
  * `prepare_connector.py`. The fetch goes through the injected {@link UipClient};
@@ -13,6 +18,7 @@
13
18
  */
14
19
  import { compareCodePoints, sortedStrings } from "../compat/compare.js";
15
20
  import { registrySearch } from "../uip/commands.js";
21
+ import { failureReason, findJsonDocument, tail } from "../uip/envelope.js";
16
22
  import { isPlainObject, pyOr } from "./support.js";
17
23
  /**
18
24
  * The action ids in a `registry search <key>` reply, sorted.
@@ -20,7 +26,8 @@ import { isPlainObject, pyOr } from "./support.js";
20
26
  * Exact prefix only: the same search returns
21
27
  * `uipath.agent.resource.tool.connector.<key>.<action>` and
22
28
  * `uipath.connector.trigger.<key>.<event>`, which are not actions of this node
23
- * and would read as alternatives an author could pass.
29
+ * and would read as alternatives an author could pass as an action. The events
30
+ * are listed separately, by {@link registryEventIds}.
24
31
  */
25
32
  export function registryActionIds(payload, connectorKey) {
26
33
  // `json.loads(stdout).get("Data") or []`: a reply that is not an object has
@@ -74,21 +81,88 @@ export function closestActions(action, candidates) {
74
81
  });
75
82
  return scored.map(({ candidate }) => candidate);
76
83
  }
84
+ /** Levenshtein distance, two rows. Short strings only (operation ids). */
85
+ function editDistance(a, b) {
86
+ let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
87
+ for (let i = 1; i <= a.length; i++) {
88
+ const cur = [i];
89
+ for (let j = 1; j <= b.length; j++) {
90
+ cur[j] = Math.min(prev[j] + 1, cur[j - 1] + 1, prev[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
91
+ }
92
+ prev = cur;
93
+ }
94
+ return prev[b.length];
95
+ }
77
96
  /**
78
- * `_registry_actions`: the action ids the registry serves for `connectorKey`,
79
- * or `[]` when the search fails or does not answer JSON. This runs only on the
80
- * failure path, where an empty answer is itself the message ("returned nothing").
97
+ * {@link closestActions}, kept only where the candidate is plausibly what was
98
+ * meant: it shares MOST of the wanted id's words (`list-all-records` →
99
+ * `list-records`), or it is a near spelling (`record-creatd` → `record-created`,
100
+ * `send-mail` → `send-email`). One shared word is not enough: `record-created`
101
+ * shares "record" with every Data Fabric action, and offering
102
+ * `update-entity-record` as the closest match to an EVENT name points the
103
+ * author at the wrong namespace.
81
104
  */
82
- export async function registryActions(client, connectorKey, timeoutMs) {
83
- const result = await client.run(registrySearch(connectorKey), timeoutMs === undefined ? undefined : { timeoutMs });
84
- if (result.code !== 0)
105
+ export function plausibleMatches(wanted, candidates) {
106
+ const words = new Set(wanted.split("-"));
107
+ const limit = Math.max(2, Math.floor(wanted.length / 3));
108
+ const kept = closestActions(wanted, candidates)
109
+ .map((candidate, rank) => ({ candidate, rank, distance: editDistance(wanted, candidate) }))
110
+ .filter(({ candidate, distance }) => {
111
+ const shared = [...words].filter((word) => candidate.split("-").includes(word)).length;
112
+ return shared * 2 > words.size || distance <= limit;
113
+ });
114
+ // Nearest spelling first; the word-overlap rank breaks ties.
115
+ kept.sort((a, b) => a.distance - b.distance || a.rank - b.rank);
116
+ return kept.map(({ candidate }) => candidate);
117
+ }
118
+ /**
119
+ * The event ids in a `registry search <key>` reply, sorted, each with its forms.
120
+ *
121
+ * The form is kept because the two can come and go separately: on 2026-09-16
122
+ * the Data Fabric `.event.` pair was still served after its `.trigger.` pair
123
+ * was gone, and `prepare` probes the `.trigger.` form.
124
+ */
125
+ export function registryEventIds(payload, connectorKey) {
126
+ if (!isPlainObject(payload))
85
127
  return [];
86
- let payload;
87
- try {
88
- payload = JSON.parse(result.stdout);
89
- }
90
- catch {
128
+ const data = pyOr(payload.Data, []);
129
+ if (!Array.isArray(data))
91
130
  return [];
131
+ const forms = new Map();
132
+ for (const entry of data) {
133
+ if (!isPlainObject(entry))
134
+ continue;
135
+ const nodeType = pyOr(entry.NodeType, "");
136
+ if (typeof nodeType !== "string")
137
+ continue;
138
+ for (const form of ["trigger", "event"]) {
139
+ const prefix = `uipath.connector.${form}.${connectorKey}.`;
140
+ if (!nodeType.startsWith(prefix))
141
+ continue;
142
+ const rest = nodeType.slice(prefix.length);
143
+ if (rest.includes("."))
144
+ continue;
145
+ if (!forms.has(rest))
146
+ forms.set(rest, new Set());
147
+ forms.get(rest).add(form);
148
+ }
149
+ }
150
+ return sortedStrings(forms.keys()).map((id) => ({
151
+ id,
152
+ forms: ["trigger", "event"].filter((form) => forms.get(id).has(form)),
153
+ }));
154
+ }
155
+ /**
156
+ * `registry search <key>`, read for both catalogs. This runs only on the
157
+ * failure path, to tell the author what the catalog does serve.
158
+ */
159
+ export async function registryCatalog(client, connectorKey, timeoutMs) {
160
+ const result = await client.run(registrySearch(connectorKey), timeoutMs === undefined ? undefined : { timeoutMs });
161
+ if (result.code !== 0)
162
+ return { actions: [], events: [], failure: failureReason(result) };
163
+ const payload = findJsonDocument(result.stdout);
164
+ if (payload === undefined) {
165
+ return { actions: [], events: [], failure: `it did not answer JSON: ${tail(result.stdout.trim()) || "no output"}` };
92
166
  }
93
- return registryActionIds(payload, connectorKey);
167
+ return { actions: registryActionIds(payload, connectorKey), events: registryEventIds(payload, connectorKey) };
94
168
  }
@@ -23,10 +23,9 @@
23
23
  */
24
24
  import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
25
25
  import { pyJsonStringify } from "../codecs/pyjson.js";
26
- import { pyStrip } from "../compat/pystr.js";
27
26
  import { Refusal, messageOf } from "../errors.js";
28
27
  import { isConnectionsList } from "../uip/commands.js";
29
- import { dataItems, parseEnvelope } from "../uip/envelope.js";
28
+ import { dataItems, failureReason, parseEnvelope } from "../uip/envelope.js";
30
29
  import { isPlainObject, notJsonReason, pyGet, pyOr, pyRepr, pyStrAny, pyTruthy } from "./support.js";
31
30
  /** No usable connection, with the reason and the way forward (`_connections.ConnectionError_`). */
32
31
  export class ConnectionRefusal extends Refusal {
@@ -44,7 +43,7 @@ export class ConnectionRefusal extends Refusal {
44
43
  export async function listConnections(client, options) {
45
44
  const result = await client.run(isConnectionsList({ allFolders: options.allFolders, byoa: options.byoa }));
46
45
  if (result.code !== 0) {
47
- throw new ConnectionRefusal(`listing connections failed: ${pyStrip(result.stderr) || "no output"}`, "CONNECTION_LISTING_FAILED");
46
+ throw new ConnectionRefusal(`listing connections failed: ${failureReason(result)}`, "CONNECTION_LISTING_FAILED");
48
47
  }
49
48
  const envelope = parseEnvelope(result.stdout);
50
49
  if (envelope === undefined) {