@uipath/maestro-builder-sdk 6.89.0 → 6.90.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,21 +4,11 @@
4
4
  *
5
5
  * Usage: node --experimental-strip-types check-cli.js <case.ts | BaseName> \
6
6
  * [--library <library-json dir>] [--connectors-local <overlay dir>] [--bindings <bindings.json>] \
7
- * [-o <the plan compile writes>] [--resources <resources.json>] \
8
- * [--registry-resolved <tasks/registry-resolved.json> | --no-registry-resolved]
7
+ * [-o <the plan compile writes>] [--resources <resources.json>]
9
8
  * Exits 0 when clean (warnings allowed), 1 on any error.
10
9
  *
11
10
  * The library is opened exactly as `compile-cli` opens it (`openCliLibrary`), so
12
11
  * a connector task `compile` cannot resolve fails here first (#1014).
13
- *
14
- * `--registry-resolved <file>` holds each resource task to the resource the
15
- * SDD resolved it to (RESOURCE_NOT_AS_RESOLVED). With no file named, check
16
- * looks where `uip maestro case sdd resolve` writes it (`registryCandidates`).
17
- * A file found there that gives no entries is reported and passed over; a
18
- * named one is an error. The file read, how many resource tasks it judged, the
19
- * tasks it had no entry for, and the entries it could not use are printed, so
20
- * the check is never silent. `--no-registry-resolved` turns it off for an
21
- * author who chose another resource on purpose, and check says so.
22
12
  */
23
13
  import { reportDiagnostics } from '../cli-result.js';
24
14
  import { resolveCaseFile, loadBuiltCase } from './load.js';
@@ -30,71 +20,9 @@ import { runWhenInvokedDirectly } from '../cli-run.js';
30
20
  import { ensureTypeScriptRuntime } from '../node-runtime.js';
31
21
  import { defaultResourcesFile } from '../workdir.js';
32
22
  import { readCliResources } from '../registry/prepare/resources.js';
33
- import { DEFAULT_REGISTRY_RESOLVED, RESOLVE_COMMAND, readRegistryResolved, registryResolvedCoverage } from './registry-resolved.js';
34
- import { existsSync, readFileSync } from 'node:fs';
35
- import { dirname, join, relative, resolve } from 'node:path';
36
23
  /** Flags that take a value: their argument is never the source positional. */
37
- const VALUE_FLAGS = new Set(['--library', '--connectors-local', '--bindings', '--resources', '--registry-resolved', '-o']);
38
- const USAGE = 'usage: check <case.ts | BaseName> [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>] [--registry-resolved <file> | --no-registry-resolved] [-o <plan>]';
39
- /**
40
- * Where to look for the SDD's resolutions when no file is named: the working
41
- * directory's `tasks/`, then beside the case file and up to two directories
42
- * above it, under `tasks/` or at the root (cli `findRegistryLedger`). The
43
- * authoring layout puts the case at `<workspace>/<solution>/<project>/` and the
44
- * file at `<workspace>/tasks/`, so check run from either place finds it.
45
- */
46
- function registryCandidates(caseFile) {
47
- const dir = dirname(resolve(caseFile));
48
- const all = [resolve(DEFAULT_REGISTRY_RESOLVED)];
49
- for (const up of ['', '..', join('..', '..')])
50
- for (const leaf of ['tasks', '.'])
51
- all.push(resolve(dir, up, leaf, 'registry-resolved.json'));
52
- return [...new Set(all)];
53
- }
54
- const shown = (file) => relative(process.cwd(), file) || file;
55
- /** Read one registry-resolved file: its resolutions, or why it gives none. */
56
- function readRegistryFile(file) {
57
- let json;
58
- try {
59
- json = JSON.parse(readFileSync(file, 'utf8'));
60
- }
61
- catch (e) {
62
- return { why: `not JSON (${e.message})` };
63
- }
64
- const registry = readRegistryResolved(json);
65
- return registry ? { registry: { ...registry, file: shown(file) } } : { why: 'no resolved entries (no object with a "task" and a "selected")' };
66
- }
67
- /**
68
- * The SDD's resolutions. A file named with `--registry-resolved` must give
69
- * some: if not, that is an error. Otherwise the first candidate that gives
70
- * some is used, and each candidate passed over is reported in `notes`.
71
- * `--no-registry-resolved` reads none, and says so when a candidate exists.
72
- */
73
- function cliRegistryResolved(argv, caseFile) {
74
- const i = argv.indexOf('--registry-resolved');
75
- const named = i >= 0 ? argv[i + 1] : undefined;
76
- const found = () => registryCandidates(caseFile).filter((f) => existsSync(f));
77
- if (argv.includes('--no-registry-resolved')) {
78
- if (i >= 0)
79
- return { error: '--registry-resolved and --no-registry-resolved are both given. Remove one of them.', notes: [] };
80
- const first = found()[0];
81
- return { notes: first ? [`check: ${shown(first)} not read (--no-registry-resolved): resource tasks are not held to the SDD's resolutions.`] : [] };
82
- }
83
- if (named !== undefined) {
84
- if (!existsSync(resolve(named)))
85
- return { error: `cannot read ${named}: no such file. Name the file \`${RESOLVE_COMMAND}\` wrote, or drop --registry-resolved.`, notes: [] };
86
- const { registry, why } = readRegistryFile(resolve(named));
87
- return registry ? { registry, notes: [] } : { error: `cannot read ${named}: ${why}. Fix the file, or drop --registry-resolved.`, notes: [] };
88
- }
89
- const notes = [];
90
- for (const file of found()) {
91
- const { registry, why } = readRegistryFile(file);
92
- if (registry)
93
- return { registry, notes };
94
- notes.push(`check: ${shown(file)} not read: ${why}. Resource tasks are not held to it.`);
95
- }
96
- return { notes };
97
- }
24
+ const VALUE_FLAGS = new Set(['--library', '--connectors-local', '--bindings', '--resources', '-o']);
25
+ const USAGE = 'usage: check <case.ts | BaseName> [--library <dir>] [--connectors-local <dir>] [--bindings <file>] [--resources <file>] [-o <plan>]';
98
26
  export async function run(argv) {
99
27
  if (argv.length === 0 || argv[0] === '-h' || argv[0] === '--help') {
100
28
  console.error(USAGE);
@@ -112,45 +40,7 @@ export async function run(argv) {
112
40
  // binding-label rules (#1034): `-o` names the plan as it does for compile.
113
41
  const { bindings } = caseCompileTarget(argv);
114
42
  const resources = readCliResources(argv, defaultResourcesFile());
115
- const resolved = cliRegistryResolved(argv, file);
116
- if (resolved.error) {
117
- console.error(`check: ${resolved.error}`);
118
- return 1;
119
- }
120
- for (const note of resolved.notes)
121
- console.error(note);
122
- if (resolved.registry) {
123
- const cover = registryResolvedCoverage(built, resolved.registry);
124
- const quoted = (names) => names.map((n) => JSON.stringify(n)).join(', ');
125
- const { resolved: list, unusable } = resolved.registry;
126
- const inSolution = list.filter((e) => e.selected.inSolution).length;
127
- const open = unusable.filter((e) => e.why === 'unresolved').length;
128
- const noName = unusable.length - open;
129
- console.error(`check: resource tasks held to ${resolved.registry.file}: ${cover.held} of ${cover.held + cover.noEntry.length + cover.ambiguous.length + cover.unusable.length} judged`
130
- + ` (${list.length} resolution(s)${open ? `, ${open} unresolved` : ''}`
131
- + `${noName ? `, ${noName} with no selected name` : ''}`
132
- + `${inSolution ? `, ${inSolution} with no folder, read as solution_folder (a project in this solution)` : ''}).`);
133
- if (cover.noEntry.length)
134
- console.error(`check: not judged, no entry with this task name: ${quoted(cover.noEntry)}. `
135
- + 'Use the SDD\'s task name, or resolve the task again.');
136
- if (cover.ambiguous.length)
137
- console.error(`check: not judged, more than one entry has this task name and none is in the task's stage: ${quoted(cover.ambiguous)}. `
138
- + 'Use the SDD\'s stage name, or resolve the task again.');
139
- const unjudged = (why) => cover.unusable.filter((u) => u.why === why).map((u) => u.task);
140
- if (unjudged('unresolved').length)
141
- console.error(`check: not judged, the SDD left the task unresolved (selected: null): ${quoted(unjudged('unresolved'))}. `
142
- + 'A resource created for it is not checked against the SDD.');
143
- if (unjudged('no-name').length)
144
- console.error(`check: not judged, the entry's selection has no string name: ${quoted(unjudged('no-name'))}. `
145
- + `Fix the entry, or resolve the task again (\`${RESOLVE_COMMAND}\`).`);
146
- if (cover.unused.length)
147
- console.error(`check: no resource task matched these resolutions: ${quoted(cover.unused)}.`);
148
- }
149
- const diags = check(built, {
150
- ...caseCheckOpts(openCliLibrary(argv), bindings),
151
- ...(resources ? { resources } : {}),
152
- ...(resolved.registry ? { registryResolved: resolved.registry } : {}),
153
- });
43
+ const diags = check(built, { ...caseCheckOpts(openCliLibrary(argv), bindings), ...(resources ? { resources } : {}) });
154
44
  reportDiagnostics(diags);
155
45
  for (const d of diags)
156
46
  console.error(` ${d.level === 'error' ? '✗' : '⚠'} [${d.code}] ${d.message}`);
@@ -13,7 +13,6 @@
13
13
  */
14
14
  import type { BuiltCase } from './case-sdk.js';
15
15
  import { type ConnectorCheckOpts } from '../core/connector-checks.js';
16
- import { type RegistryResolved } from './registry-resolved.js';
17
16
  import type { Library } from '../core/library.js';
18
17
  export interface Diagnostic {
19
18
  level: 'error' | 'warning';
@@ -44,12 +43,6 @@ export interface Diagnostic {
44
43
  export type CaseCheckOpts = Pick<ConnectorCheckOpts, 'lookups' | 'resolutions' | 'resources' | 'schemaReadiness' | 'bindings'> & {
45
44
  /** The library `compile` serializes against, for the serializer `check` runs. */
46
45
  library?: Library;
47
- /**
48
- * The resources the SDD resolved each task to (`tasks/registry-resolved.json`,
49
- * read with `readRegistryResolved`). A resource task whose name or folder
50
- * differs is RESOURCE_NOT_AS_RESOLVED. Omit it and no task is judged.
51
- */
52
- registryResolved?: RegistryResolved;
53
46
  };
54
47
  /**
55
48
  * Validate a built case.
@@ -9,7 +9,6 @@ import { caseJsonPreservation } from './preserve.js';
9
9
  import { scriptLint } from './script.js';
10
10
  import { httpRequestLint } from './http-request.js';
11
11
  import { checkRuleSemantics } from './check-rule-semantics.js';
12
- import { registryResolvedLint } from './registry-resolved.js';
13
12
  import { serialize } from './serialize.js';
14
13
  import { lintPlanFindings, planReport } from './plan-check/index.js';
15
14
  import { caseExprLints } from './case-expr-check.js';
@@ -247,10 +246,6 @@ export function check(built, opts = {}) {
247
246
  for (const f of httpRequestLint(`HTTP request task "${t.name}"`, t.http))
248
247
  diags.push({ level: 'error', code: f.code, message: f.message, ...(f.suggestion ? { suggestion: f.suggestion } : {}), where: t.name });
249
248
  checkRuleSemantics(built, diags);
250
- // A resource task bound to another resource than the SDD resolved (lint).
251
- if (opts.registryResolved)
252
- for (const f of registryResolvedLint(built, opts.registryResolved))
253
- diags.push({ level: 'error', code: f.code, message: f.message, suggestion: f.suggestion, where: f.where });
254
249
  checkLibraryConnectors(built, opts, diags);
255
250
  diags.push(...serializerRefusals(built, opts, diags, reportedReads));
256
251
  return diags;
@@ -30,9 +30,6 @@ export function registerCaseCommands(program) {
30
30
  .option('--connectors-local <dir>', 'connection-resolved connector overlay')
31
31
  .option('--bindings <file>', 'bindings.json, for the connection/folder label rules')
32
32
  .option('--resources <file>', 'resource ledger that registry prepare writes (default .flow-sdk/resources.json)')
33
- .option('--registry-resolved <file>', 'the resources `uip maestro case sdd resolve` resolved each task to (default tasks/registry-resolved.json)')
34
- // Commander keeps the default undefined when --no-X follows --X: the value is a file, false, or unset.
35
- .option('--no-registry-resolved', 'do not hold resource tasks to tasks/registry-resolved.json')
36
33
  .addOption(retiredCompiledOption())
37
34
  .action(async (input, options) => {
38
35
  let mode;
@@ -52,10 +49,6 @@ export function registerCaseCommands(program) {
52
49
  addValue(argv, '--connectors-local', options.connectorsLocal);
53
50
  addValue(argv, '--bindings', options.bindings);
54
51
  addValue(argv, '--resources', options.resources);
55
- if (options.registryResolved === false)
56
- argv.push('--no-registry-resolved');
57
- else
58
- addValue(argv, '--registry-resolved', options.registryResolved);
59
52
  await invoke('case check', () => import('../../case/check-cli.js'), argv);
60
53
  });
61
54
  family.command('decompile')
@@ -649,6 +649,35 @@ export interface ConnectorToolRef {
649
649
  * | `'maestro'` | `tool.processorchestration.<key>` | an agentic process (`StartAgenticProcess`) |
650
650
  */
651
651
  export type ProcessToolKind = 'process' | 'agent' | 'api' | 'flow' | 'maestro' | 'function';
652
+ /**
653
+ * Where one argument of a {@link ProcessToolRef} gets its value: the canvas's
654
+ * three sources (Prompt, Fixed value, Variable) for a tool argument. A bare type
655
+ * leaves the argument to the model, as before sources existed.
656
+ *
657
+ * @remarks
658
+ * | form | source | the model | pinned |
659
+ * |---|---|---|---|
660
+ * | `'string'` (a bare type) | the model | fills it, from its name and type alone | nothing |
661
+ * | `{ type, prompt }` | Prompt | fills it, reading `prompt` as the argument's description | nothing |
662
+ * | `{ type, value }` | Fixed value | does not choose it | `value`, as authored (`42`, `true`, an object) |
663
+ * | `{ type, variable }` | Variable | does not choose it | the flow value `variable` references, read at run time |
664
+ *
665
+ * Every argument stays in the tool's `inputSchema`, and in its `required`,
666
+ * whichever its source, as the canvas leaves it. `variable` takes what an agent's
667
+ * `inputs` takes (`input('topic')`, a step output, a `$vars` reference), and
668
+ * must be a single reference: the platform binds each one to an agent input
669
+ * of its own. See docs/INLINE_AGENT_TOOL_ARGUMENTS_DESIGN.md.
670
+ */
671
+ export type ToolArgument = InlineAgentFieldType | {
672
+ type: InlineAgentFieldType;
673
+ prompt: string;
674
+ } | {
675
+ type: InlineAgentFieldType;
676
+ value: unknown;
677
+ } | {
678
+ type: InlineAgentFieldType;
679
+ variable: unknown;
680
+ };
652
681
  /**
653
682
  * A deployed tenant resource the agent may invoke. Like `rpaWorkflow()` and
654
683
  * its siblings, the definition cannot be bundled — the node type carries the
@@ -674,8 +703,12 @@ export interface ProcessToolRef {
674
703
  * only a name is one the model has to guess at.
675
704
  */
676
705
  description?: string;
677
- /** The resource's input arguments, by name and type — becomes its `inputSchema`. */
678
- inputs?: Record<string, InlineAgentFieldType>;
706
+ /**
707
+ * The resource's input arguments, by name: each a bare type, which the model
708
+ * fills, or a {@link ToolArgument} object naming its source — a `prompt`, a
709
+ * fixed `value` or a flow `variable`. Their types become its `inputSchema`.
710
+ */
711
+ inputs?: Record<string, ToolArgument>;
679
712
  /** What it returns, by name and type — becomes its `outputSchema`. */
680
713
  returns?: Record<string, InlineAgentFieldType>;
681
714
  }
@@ -32,6 +32,25 @@ export type AgentInputBinding = {
32
32
  kind: 'expression';
33
33
  binding: string;
34
34
  };
35
+ /**
36
+ * Classify a RENDERED input value (as serialize renders it).
37
+ *
38
+ * A rendered value is an expression exactly when it starts with `=js:` — the
39
+ * same test the rest of the serializer applies, so a literal string that
40
+ * happens to begin with `=js:` is treated as one everywhere. Compile refuses a
41
+ * tool argument's `variable` that is not a reference with it too
42
+ * (`toolArgumentRefusal`).
43
+ */
44
+ export declare function classifyAgentInput(rendered: unknown): AgentInputBinding;
45
+ /**
46
+ * The agent input a RENDERED value binds, when it is a single reference: its
47
+ * flat name and binding, as {@link agentInputPlan} names it. A literal or a
48
+ * composite expression binds none.
49
+ */
50
+ export declare function agentInputRef(rendered: unknown): {
51
+ flatName: string;
52
+ binding: string;
53
+ } | undefined;
35
54
  /**
36
55
  * The platform-facing plan for one inline agent's declared inputs.
37
56
  *
@@ -39,12 +58,19 @@ export type AgentInputBinding = {
39
58
  * `agentInputVariables`, the sidecar's `inputSchema`, and both prompts), so they
40
59
  * cannot drift apart.
41
60
  *
61
+ * `toolRefs` are the references the agent's tools bind their Variable
62
+ * arguments to (see {@link agentInputRef}). Each is an agent input too, after
63
+ * the declared ones, but has no logical name, so no prompt placeholder.
64
+ *
42
65
  * `refs` is DEDUPED BY FLAT NAME and keeps author order. Two logical names bound
43
66
  * to the same reference are one JobArgument on the platform (v1 dedupes on a
44
67
  * seen-set, `:490-522`), so emitting two descriptors would claim an argument that
45
- * will not exist.
68
+ * will not exist. The same holds for a tool reference an input already binds.
46
69
  */
47
- export declare function agentInputPlan(inputs: Record<string, unknown>, render: (value: unknown) => unknown): AgentInputPlan;
70
+ export declare function agentInputPlan(inputs: Record<string, unknown>, render: (value: unknown) => unknown, toolRefs?: ReadonlyArray<{
71
+ flatName: string;
72
+ binding: string;
73
+ }>): AgentInputPlan;
48
74
  /**
49
75
  * The `agent.json` sidecar for a text CONVERSATIONAL agent.
50
76
  *
@@ -12,9 +12,11 @@ import { flatNameOf } from './expr.js';
12
12
  *
13
13
  * A rendered value is an expression exactly when it starts with `=js:` — the
14
14
  * same test the rest of the serializer applies, so a literal string that
15
- * happens to begin with `=js:` is treated as one everywhere.
15
+ * happens to begin with `=js:` is treated as one everywhere. Compile refuses a
16
+ * tool argument's `variable` that is not a reference with it too
17
+ * (`toolArgumentRefusal`).
16
18
  */
17
- function classifyAgentInput(rendered) {
19
+ export function classifyAgentInput(rendered) {
18
20
  if (typeof rendered !== 'string' || !rendered.startsWith('=js:')) {
19
21
  return { kind: 'literal', text: String(rendered) };
20
22
  }
@@ -23,6 +25,15 @@ function classifyAgentInput(rendered) {
23
25
  ? { kind: 'expression', binding: rendered }
24
26
  : { kind: 'ref', flatName, binding: rendered };
25
27
  }
28
+ /**
29
+ * The agent input a RENDERED value binds, when it is a single reference: its
30
+ * flat name and binding, as {@link agentInputPlan} names it. A literal or a
31
+ * composite expression binds none.
32
+ */
33
+ export function agentInputRef(rendered) {
34
+ const b = classifyAgentInput(rendered);
35
+ return b.kind === 'ref' ? { flatName: b.flatName, binding: b.binding } : undefined;
36
+ }
26
37
  /**
27
38
  * The platform-facing plan for one inline agent's declared inputs.
28
39
  *
@@ -30,23 +41,33 @@ function classifyAgentInput(rendered) {
30
41
  * `agentInputVariables`, the sidecar's `inputSchema`, and both prompts), so they
31
42
  * cannot drift apart.
32
43
  *
44
+ * `toolRefs` are the references the agent's tools bind their Variable
45
+ * arguments to (see {@link agentInputRef}). Each is an agent input too, after
46
+ * the declared ones, but has no logical name, so no prompt placeholder.
47
+ *
33
48
  * `refs` is DEDUPED BY FLAT NAME and keeps author order. Two logical names bound
34
49
  * to the same reference are one JobArgument on the platform (v1 dedupes on a
35
50
  * seen-set, `:490-522`), so emitting two descriptors would claim an argument that
36
- * will not exist.
51
+ * will not exist. The same holds for a tool reference an input already binds.
37
52
  */
38
- export function agentInputPlan(inputs, render) {
53
+ export function agentInputPlan(inputs, render, toolRefs = []) {
39
54
  const byName = new Map();
40
55
  const refs = [];
41
56
  const seen = new Set();
57
+ const claim = (r) => {
58
+ if (seen.has(r.flatName))
59
+ return;
60
+ seen.add(r.flatName);
61
+ refs.push({ flatName: r.flatName, binding: r.binding });
62
+ };
42
63
  for (const [name, val] of Object.entries(inputs)) {
43
64
  const b = classifyAgentInput(render(val));
44
65
  byName.set(name, b);
45
- if (b.kind === 'ref' && !seen.has(b.flatName)) {
46
- seen.add(b.flatName);
47
- refs.push({ flatName: b.flatName, binding: b.binding });
48
- }
66
+ if (b.kind === 'ref')
67
+ claim(b);
49
68
  }
69
+ for (const r of toolRefs)
70
+ claim(r);
50
71
  return { byName, refs };
51
72
  }
52
73
  /**
@@ -366,6 +366,25 @@ export declare function flatNameOf(expression: string): string | undefined;
366
366
  * @internal Public for compatibility; not an authoring factory.
367
367
  */
368
368
  export declare function flatNameSegmentsOf(expression: string): string[] | undefined;
369
+ /**
370
+ * The reference a flat name encodes, the inverse of {@link flatNameOf}: a
371
+ * `__`-split name back to `$vars.<path>` (`$metadata.<path>` when it starts
372
+ * with `metadata`), a numeric segment as an index.
373
+ *
374
+ * ```
375
+ * flatNameReference('normalizeData__output__invoiceNumber') // '$vars.normalizeData.output.invoiceNumber'
376
+ * flatNameReference('a__output__items__0__id') // '$vars.a.output.items[0].id'
377
+ * flatNameReference('metadata__jobId') // '$metadata.jobId'
378
+ * ```
379
+ *
380
+ * The decode is a guess when an id contains `__` (see {@link flatNameSegmentsOf}):
381
+ * `erp__lookup__output__value` decodes to `$vars.erp.lookup.output.value`, which
382
+ * encodes back to the same name. So the caller has to check the reference's root
383
+ * names something that exists. `undefined` for a name no reference encodes to.
384
+ *
385
+ * @internal Public for compatibility; not an authoring factory.
386
+ */
387
+ export declare function flatNameReference(flatName: string): string | undefined;
369
388
  /** Variable type descriptors (map to Flow variable `type` values). */
370
389
  export declare const types: {
371
390
  readonly string: "string";
package/dist/core/expr.js CHANGED
@@ -539,6 +539,31 @@ export function flatNameSegmentsOf(expression) {
539
539
  const segments = Array.from(m[2].matchAll(PATH_SEGMENT), (s) => s[1] ?? s[0]);
540
540
  return m[1] === 'vars' ? segments : ['metadata', ...segments];
541
541
  }
542
+ /**
543
+ * The reference a flat name encodes, the inverse of {@link flatNameOf}: a
544
+ * `__`-split name back to `$vars.<path>` (`$metadata.<path>` when it starts
545
+ * with `metadata`), a numeric segment as an index.
546
+ *
547
+ * ```
548
+ * flatNameReference('normalizeData__output__invoiceNumber') // '$vars.normalizeData.output.invoiceNumber'
549
+ * flatNameReference('a__output__items__0__id') // '$vars.a.output.items[0].id'
550
+ * flatNameReference('metadata__jobId') // '$metadata.jobId'
551
+ * ```
552
+ *
553
+ * The decode is a guess when an id contains `__` (see {@link flatNameSegmentsOf}):
554
+ * `erp__lookup__output__value` decodes to `$vars.erp.lookup.output.value`, which
555
+ * encodes back to the same name. So the caller has to check the reference's root
556
+ * names something that exists. `undefined` for a name no reference encodes to.
557
+ *
558
+ * @internal Public for compatibility; not an authoring factory.
559
+ */
560
+ export function flatNameReference(flatName) {
561
+ const segments = flatName.split(FLAT_SEP);
562
+ const [root, ...rest] = segments[0] === 'metadata' && segments.length > 1 ? ['$metadata', ...segments.slice(1)] : ['$vars', ...segments];
563
+ const path = rest.map((s, k) => (/^\d+$/.test(s) && k > 0 ? `[${s}]` : `.${s}`)).join('');
564
+ const reference = `${root}${path}`;
565
+ return flatNameOf(reference) === flatName ? reference : undefined;
566
+ }
542
567
  // ─── Types ──────────────────────────────────────────────────────────────────
543
568
  /** Variable type descriptors (map to Flow variable `type` values). */
544
569
  export const types = {
@@ -481,6 +481,12 @@ export declare const REFUSALS: {
481
481
  readonly INLINE_AGENT_SCAFFOLD_MODEL: "lint";
482
482
  readonly INLINE_AGENT_SOURCE_NOT_GUID: "lint";
483
483
  readonly FLOW_AGENT_TOOL_A2A_INCOMPLETE: "lint";
484
+ readonly FLOW_AGENT_TOOL_ARGUMENT_COMPOSITE: "lowering";
485
+ readonly FLOW_AGENT_TOOL_ARGUMENT_EMPTY_PROMPT: "lint";
486
+ readonly FLOW_AGENT_TOOL_ARGUMENT_EXPRESSION: "lowering";
487
+ readonly FLOW_AGENT_TOOL_ARGUMENT_SOURCE: "lowering";
488
+ readonly FLOW_AGENT_TOOL_ARGUMENT_TYPE: "lint";
489
+ readonly FLOW_AGENT_TOOL_ARGUMENT_VARIABLE: "lowering";
484
490
  readonly FLOW_AGENT_TOOL_CLIENTSIDE_NO_NAME: "lint";
485
491
  readonly FLOW_AGENT_TOOL_CLIENTSIDE_SCHEMA_TWICE: "lowering";
486
492
  readonly FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION: "lint";
@@ -624,7 +630,6 @@ export declare const REFUSALS: {
624
630
  readonly RESOURCE_REF_IS_BINDING: "lowering";
625
631
  readonly RESOURCE_ROW_INCOMPLETE: "lowering";
626
632
  readonly RESOURCE_UNRESOLVED: "lowering";
627
- readonly RESOURCE_NOT_AS_RESOLVED: "lint";
628
633
  readonly RETRY_BASE_WITHOUT_EXPONENTIAL: "lint";
629
634
  readonly RETRY_INVALID_COUNT: "lint";
630
635
  readonly RETRY_INVALID_DURATION: "lint";
@@ -555,6 +555,12 @@ export const REFUSALS = {
555
555
  INLINE_AGENT_SCAFFOLD_MODEL: 'lint',
556
556
  INLINE_AGENT_SOURCE_NOT_GUID: 'lint',
557
557
  FLOW_AGENT_TOOL_A2A_INCOMPLETE: 'lint',
558
+ FLOW_AGENT_TOOL_ARGUMENT_COMPOSITE: 'lowering',
559
+ FLOW_AGENT_TOOL_ARGUMENT_EMPTY_PROMPT: 'lint',
560
+ FLOW_AGENT_TOOL_ARGUMENT_EXPRESSION: 'lowering',
561
+ FLOW_AGENT_TOOL_ARGUMENT_SOURCE: 'lowering',
562
+ FLOW_AGENT_TOOL_ARGUMENT_TYPE: 'lint',
563
+ FLOW_AGENT_TOOL_ARGUMENT_VARIABLE: 'lowering',
558
564
  FLOW_AGENT_TOOL_CLIENTSIDE_NO_NAME: 'lint',
559
565
  FLOW_AGENT_TOOL_CLIENTSIDE_SCHEMA_TWICE: 'lowering',
560
566
  FLOW_AGENT_TOOL_CONNECTOR_NO_CONNECTION: 'lint',
@@ -698,9 +704,6 @@ export const REFUSALS = {
698
704
  RESOURCE_REF_IS_BINDING: 'lowering',
699
705
  RESOURCE_ROW_INCOMPLETE: 'lowering',
700
706
  RESOURCE_UNRESOLVED: 'lowering',
701
- // Case check (case/registry-resolved.ts): a resource task's name or folder is
702
- // not the one tasks/registry-resolved.json resolved; compile writes it as authored.
703
- RESOURCE_NOT_AS_RESOLVED: 'lint',
704
707
  RETRY_BASE_WITHOUT_EXPONENTIAL: 'lint',
705
708
  RETRY_INVALID_COUNT: 'lint',
706
709
  RETRY_INVALID_DURATION: 'lint',
@@ -0,0 +1,105 @@
1
+ /**
2
+ * A process tool's arguments ({@link ToolArgument}) as compile writes them: the
3
+ * type alone, for the tool's `resource.json` `inputSchema` and its definition,
4
+ * and the Prompt, Fixed value and Variable sources, for that `resource.json`
5
+ * alone (docs/INLINE_AGENT_TOOL_ARGUMENTS_DESIGN.md, "What compile writes"),
6
+ * and the refusals of an argument it cannot write as authored
7
+ * ({@link toolArgumentRefusal}).
8
+ */
9
+ import type { InlineAgentFieldType, ToolArgument } from './actions.js';
10
+ import { CompileRefusal } from './compile-refusal.js';
11
+ import { Expr } from './expr.js';
12
+ /**
13
+ * Every {@link InlineAgentFieldType}, in declaration order: what a tool
14
+ * argument's `type`, and a tool's `returns`, can name. Listed as the keys of
15
+ * a record over the type, so a new member does not compile until it is here.
16
+ */
17
+ export declare const INLINE_AGENT_FIELD_TYPES: readonly InlineAgentFieldType[];
18
+ /** Whether `type` is an {@link InlineAgentFieldType}. */
19
+ export declare function isInlineAgentFieldType(type: unknown): type is InlineAgentFieldType;
20
+ /**
21
+ * An argument's type: a bare type is its own, an argument object's is its
22
+ * `type`. Anything else is passed through as it is, as the flat map's value
23
+ * always was, for `check` to report.
24
+ */
25
+ export declare function typeOf(arg: ToolArgument): InlineAgentFieldType;
26
+ /**
27
+ * A tool's `inputs` as the flat `{ name: type }` map, or `undefined` when it has
28
+ * none. `null` (from a `.flow.ts` run as JavaScript) counts as none, as it did
29
+ * when the writers read the flat map with `?? {}`.
30
+ */
31
+ export declare function argumentTypes(inputs: Record<string, ToolArgument> | null | undefined): Record<string, InlineAgentFieldType> | undefined;
32
+ /**
33
+ * An `argumentProperties` key: the JSONPath of an argument by name. Each
34
+ * `.`-separated segment is one bracketed key, with backslash and single quote
35
+ * escaped (`accountId` → `$['accountId']`, `order.total` →
36
+ * `$['order']['total']`), as the canvas's `toJsonPathKey` writes it
37
+ * (flow-workbench `agent-storage/tool-field-maps.ts`).
38
+ */
39
+ export declare function jsonPathKey(name: string): string;
40
+ /**
41
+ * The keys of a JSONPath of bracketed, single-quoted keys, the inverse of
42
+ * {@link jsonPathKey} (`$['order']['total']` → `['order', 'total']`):
43
+ * an `argumentProperties` key, or an `argument` entry's `argumentPath`.
44
+ * `undefined` for any other spelling.
45
+ */
46
+ export declare function jsonPathSegments(path: string): string[] | undefined;
47
+ /**
48
+ * An argument's Prompt: the text the canvas writes as the argument's
49
+ * `inputSchema` description, or `undefined` for one with no prompt or an empty
50
+ * or whitespace-only one, which the canvas does not save (`check` warns,
51
+ * `FLOW_AGENT_TOOL_ARGUMENT_EMPTY_PROMPT`).
52
+ */
53
+ export declare function promptOf(arg: ToolArgument): string | undefined;
54
+ /**
55
+ * The agent input each Variable argument binds, by argument name: its flat name
56
+ * and binding, from the `variable` rendered as an agent's `inputs` value is.
57
+ * Only a single reference binds one; a literal or a composite expression is
58
+ * left out, which compile never writes: {@link toolArgumentRefusal} refuses it
59
+ * (`FLOW_AGENT_TOOL_ARGUMENT_COMPOSITE`).
60
+ */
61
+ export declare function toolVariableRefs(inputs: Record<string, ToolArgument> | undefined, render: (value: unknown) => unknown): Record<string, {
62
+ flatName: string;
63
+ binding: string;
64
+ }>;
65
+ /**
66
+ * A tool's `argumentProperties`: a `static` entry for each argument with a Fixed
67
+ * `value`, written with the JSON type it was authored with, objects and arrays
68
+ * included, and an `argument` entry for each Variable in `variables` (from
69
+ * {@link toolVariableRefs}), whose path is the agent input's flat name
70
+ * (`$['topic']`, `$['node1__output__y']`), as the canvas writes it under its
71
+ * default flat encoding. A Prompt has no entry (its text is the schema
72
+ * description), nor does a bare type, which the model fills.
73
+ */
74
+ export declare function toolArgumentProperties(inputs: Record<string, ToolArgument> | undefined, variables?: Record<string, {
75
+ flatName: string;
76
+ }>): Record<string, unknown>;
77
+ /** The keys an argument object names its one source by. */
78
+ export declare const TOOL_ARGUMENT_SOURCES: readonly ["prompt", "value", "variable"];
79
+ /**
80
+ * The first SDK expression anywhere in a fixed value: the value itself, or
81
+ * inside an array or object in it (`FLOW_AGENT_TOOL_ARGUMENT_EXPRESSION`).
82
+ */
83
+ export declare function exprIn(value: unknown): Expr | undefined;
84
+ /**
85
+ * Refuse a process tool argument that compile cannot write as authored
86
+ * (docs/INLINE_AGENT_TOOL_ARGUMENTS_DESIGN.md, "What `check` reports"). The
87
+ * storage schema takes each of these (except a type outside the six, which it
88
+ * refuses), so the platform would load a tool other than the one authored:
89
+ *
90
+ * * `FLOW_AGENT_TOOL_ARGUMENT_SOURCE`: an argument object with no valid
91
+ * `type`, or with other than exactly one of `prompt`, `value` and `variable`.
92
+ * `{ type }` alone counts: a bare type is how to name none.
93
+ * * `FLOW_AGENT_TOOL_ARGUMENT_COMPOSITE`: a `variable` that is not a single
94
+ * reference, so has no agent input to bind; the model would fill it.
95
+ * * `FLOW_AGENT_TOOL_ARGUMENT_EXPRESSION`: an SDK expression anywhere in a
96
+ * fixed `value`, `lit()` included, which would be written as the SDK's own
97
+ * object rather than evaluated.
98
+ *
99
+ * Returned, not thrown, for the caller to hold: the agent's serialize judges
100
+ * the rest of the agent first, and keeps a refused argument out of the agent's
101
+ * input plan. `render` renders a value as the agent's `inputs` are rendered;
102
+ * `who` and `tool` name the agent kind and the tool in the message
103
+ * (`'Inline agent'`, `'process' tool "Create Account"`).
104
+ */
105
+ export declare function toolArgumentRefusal(who: string, step: string, tool: string, name: string, arg: ToolArgument, render: (value: unknown) => unknown): CompileRefusal | undefined;