@pipelex/sdk 0.15.0 → 0.17.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.
@@ -1,50 +1,71 @@
1
1
  /**
2
2
  * `prepareInputs` — signature-driven input preparation. Resolves the target
3
- * pipe's declared inputs via the explicit inputs template, interprets the
4
- * caller's inputs top-down against it, uploads the file-bearing values, and
5
- * returns rewritten inputs (canonical content carrying `pipelex-storage://` in
6
- * `url`) plus one upload record per prepared asset.
3
+ * pipe's declared inputs from the **input-form descriptor** on the validate
4
+ * report, interprets the caller's inputs top-down against it, uploads the
5
+ * file-bearing values, and returns rewritten inputs (canonical content carrying
6
+ * `pipelex-storage://` in `url`) plus one upload record per prepared asset.
7
+ *
8
+ * The method is named the same three ways every other method-taking operation
9
+ * takes it — inline `files`, a `method_ref` address, or a stored `method_id` —
10
+ * exactly one per call. All three are pass-throughs to `POST /v1/validate`,
11
+ * which resolves an address on the runner and an id on the platform, so nothing
12
+ * is expanded client-side.
7
13
  *
8
14
  * Per input, the caller may submit EITHER the **compact** value (a bare source /
9
- * canonical `{url}` content) OR the explicit `{ concept, content }` envelope that
10
- * `buildInputs({ explicit: true })` hands back — its `content` is interpreted
11
- * exactly as the compact value would be, and the envelope is preserved on output
12
- * (the `concept` annotation rides through; the runtime accepts it — see
13
- * `pipelex`'s `input_shaper.py` `_is_explicit` / `input_normalizer.py`).
15
+ * canonical `{url}` content) OR the explicit `{ concept, content }` envelope —
16
+ * its `content` is interpreted exactly as the compact value would be, and the
17
+ * envelope is preserved on output (the `concept` annotation rides through; the
18
+ * runtime accepts it — see `pipelex`'s `input_shaper.py` `_is_explicit` /
19
+ * `input_normalizer.py`).
14
20
  *
15
- * The classification mirrors the runtime: `pipelex`'s `input_normalizer` walks
16
- * Image/Document contents (recognized by their `url`-bearing shape, incl. nested
17
- * in structured content) and `resolve_uri` decides upload vs pass-through. The
18
- * declared signature comes from the explicit template (`buildInputs`,
19
- * `explicit: true`), whose canonical content shape is the classifier — the file
20
- * signal is a value that is a dict containing a `url` key. See the shared
21
- * behavior matrix (`wip/upload/behavior-matrix.md`) and `docs/input-preparation.md`.
21
+ * **The descriptor is the classifier, never the value's shape.** `input_form`
22
+ * (the MTHDS standard's artifact, opted into with `views: ["input_form"]`)
23
+ * states the kind at every depth — `document` / `image` mark a file position,
24
+ * `object` recurses through `fields`, `list` through `item`, everything else
25
+ * passes through. That is what makes an OPTIONAL nested file field prepare like
26
+ * a required one, and a `text` field merely *named* `url` stay untouched: both
27
+ * were misread while the signature came from the rendered inputs template, whose
28
+ * file signal was a `url`-bearing dict. See `docs/input-preparation.md` and the
29
+ * shared behavior matrix (`wip/upload/behavior-matrix.md`).
22
30
  */
23
- import type { BuildInputsResponse, MthdsFileItem } from "./models.js";
31
+ import type { MthdsFileItem, PipelexValidationResult, ValidateMethodSelector } from "./models.js";
24
32
  import type { UploadCapableClient, UploadRecord } from "./upload.js";
25
- /** The pipe selector + caller inputs shared by both closure-source shapes. */
26
- interface PrepareInputsBase {
27
- /** The pipe to prepare inputs for, as a qualified `domain.pipe_code`; omit to default to the closure's `main_pipe`. */
33
+ /** The shared half of the request: the target pipe and the caller's inputs. */
34
+ export interface PrepareInputsBase {
35
+ /**
36
+ * The pipe to prepare inputs for, as a QUALIFIED `domain.pipe_code` ref. Omit
37
+ * it to default — see "Pipe selection" in `docs/input-preparation.md`. A bare
38
+ * `pipe_code` is refused: the descriptor is keyed by qualified refs, and search
39
+ * is a run-route affordance this helper deliberately does not grow. So is an
40
+ * `alias->domain.pipe_code` ref: the alias names a dependency package's pipe,
41
+ * which the descriptor does not describe (it covers the method's own pipes).
42
+ */
28
43
  pipe_ref?: string;
29
- /** The caller's compact inputs (variable name → value). */
44
+ /** The caller's inputs (variable name → value), compact or explicit-envelope per input. */
30
45
  inputs: Record<string, unknown>;
31
46
  }
32
47
  /**
33
- * What `prepareInputs` takes: the method closure, the target pipe, and the
34
- * caller's compact inputs. Supply the closure EITHER as inline `files` OR as a
35
- * stored `method_id` — never both. `method_id` is a client-side convenience:
36
- * it is resolved to `files` via `getMethodClosure` before anything hits the
37
- * wire (it never travels as a wire field), and requires an API key.
48
+ * How the method is named — exactly one of the three selectors, each pinning the
49
+ * other two to `never` so a second one is a compile error (the same XOR
50
+ * `ValidateMethodSelector` states for the tooling routes). All three reach the
51
+ * server as-is: `files` inline, `method_ref` resolved by the runner, `method_id`
52
+ * resolved by the platform.
38
53
  */
39
- export type PrepareInputsRequest = (PrepareInputsBase & {
40
- /** The method closure — inline MTHDS files. This is the signature source. */
54
+ export type PrepareInputsClosure = {
41
55
  files: MthdsFileItem[];
56
+ method_ref?: never;
57
+ method_id?: never;
58
+ } | {
59
+ method_ref: string;
60
+ files?: never;
42
61
  method_id?: never;
43
- }) | (PrepareInputsBase & {
44
- /** A stored method's id — resolved client-side to its closure before the build call. */
62
+ } | {
45
63
  method_id: string;
46
64
  files?: never;
47
- });
65
+ method_ref?: never;
66
+ };
67
+ /** What `prepareInputs` takes: one method selector, the target pipe, the caller's inputs. */
68
+ export type PrepareInputsRequest = PrepareInputsBase & PrepareInputsClosure;
48
69
  /** The result of `prepareInputs`: rewritten inputs (copy-on-write) plus upload records. */
49
70
  export interface PreparedInputs {
50
71
  /** A copy of `inputs` with each file-bearing value rewritten to canonical content carrying `pipelex-storage://` in `url`. */
@@ -53,44 +74,28 @@ export interface PreparedInputs {
53
74
  uploads: UploadRecord[];
54
75
  }
55
76
  /**
56
- * The client surface `prepareInputs` needs: raw `upload`, the `buildInputs`
57
- * signature source, and `getMethodClosure` to resolve a by-id request's closure.
77
+ * The client surface `prepareInputs` needs: raw `upload`, and `validate` as the
78
+ * signature source. Typed as the client's own `validate` signature so
79
+ * `PipelexApiClient` satisfies it structurally.
58
80
  */
59
81
  export interface PrepareCapableClient extends UploadCapableClient {
60
- buildInputs(request: {
61
- files: MthdsFileItem[];
62
- pipe_ref?: string;
63
- format?: "json";
64
- explicit?: boolean;
65
- }): Promise<BuildInputsResponse>;
66
- /** Resolve a stored method's id into its runnable closure — the by-id signature source. */
67
- getMethodClosure(methodId: string): Promise<MthdsFileItem[]>;
82
+ validate(source: string[] | ValidateMethodSelector, allowSignatures?: boolean, mthdsSources?: string[], render?: string[], views?: string[], options?: {
83
+ timeoutMs?: number;
84
+ signal?: AbortSignal;
85
+ }): Promise<PipelexValidationResult>;
68
86
  }
69
- /**
70
- * Resolve a `files` / `method_id` closure pair to inline files: reject an
71
- * over-specified `{ files, method_id }` (both given) before any resolution
72
- * runs, then either return the inline `files` unchanged or fetch-and-parse the
73
- * stored method behind `method_id` via `getMethodClosure`. Returns `undefined`
74
- * when NEITHER is given — the caller decides what that means for its own
75
- * request shape, since `buildInputs` (client.ts) also accepts a third source,
76
- * the reserved `method_ref`, that `prepareInputs` does not.
77
- *
78
- * Shared between `PipelexApiClient.buildInputs` and `resolveClosureFiles`
79
- * (below) so the files/method_id invariant is defined in exactly one place —
80
- * a duplicated copy of this exact check is what let a `buildInputs`-only
81
- * revision briefly reject a legitimate `method_ref`-only request.
82
- */
83
- export declare function resolveFilesOrMethodId(files: MthdsFileItem[] | undefined, methodId: string | undefined, getMethodClosure: (methodId: string) => Promise<MthdsFileItem[]>, makeError: (message: string) => Error): Promise<MthdsFileItem[] | undefined>;
84
87
  /**
85
88
  * Prepare a pipe's inputs: upload local/byte/data-URL assets at the signature's
86
89
  * file-bearing positions and return copy-on-write rewritten inputs plus upload
87
90
  * records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
88
91
  * unchanged. All failures are raised before any run is created.
89
92
  *
90
- * The declared signature is resolved from the closure; a closure that does not
91
- * resolve throws {@link InputPreparationError}. No-verdict conditions from the
92
- * signature route (unknown `pipe_ref`, auth, server fault) surface as the build
93
- * route's `ApiResponseError`.
93
+ * The signature comes from one `POST /v1/validate` with `views: ["input_form"]`,
94
+ * whatever the selector — inline `files`, a `method_ref` the runner resolves, or
95
+ * a `method_id` the platform resolves. A closure that does not load, an unknown
96
+ * `pipe_ref`, no default pipe, or a report with no descriptor throw
97
+ * {@link InputPreparationError}; a no-verdict condition from the route (a
98
+ * malformed selector, an unknown or foreign-org id, no package at the address,
99
+ * auth, a server fault) surfaces as `ApiResponseError`, unchanged.
94
100
  */
95
101
  export declare function prepareInputs(client: PrepareCapableClient, request: PrepareInputsRequest): Promise<PreparedInputs>;
96
- export {};
@@ -1,24 +1,32 @@
1
1
  /**
2
2
  * `prepareInputs` — signature-driven input preparation. Resolves the target
3
- * pipe's declared inputs via the explicit inputs template, interprets the
4
- * caller's inputs top-down against it, uploads the file-bearing values, and
5
- * returns rewritten inputs (canonical content carrying `pipelex-storage://` in
6
- * `url`) plus one upload record per prepared asset.
3
+ * pipe's declared inputs from the **input-form descriptor** on the validate
4
+ * report, interprets the caller's inputs top-down against it, uploads the
5
+ * file-bearing values, and returns rewritten inputs (canonical content carrying
6
+ * `pipelex-storage://` in `url`) plus one upload record per prepared asset.
7
+ *
8
+ * The method is named the same three ways every other method-taking operation
9
+ * takes it — inline `files`, a `method_ref` address, or a stored `method_id` —
10
+ * exactly one per call. All three are pass-throughs to `POST /v1/validate`,
11
+ * which resolves an address on the runner and an id on the platform, so nothing
12
+ * is expanded client-side.
7
13
  *
8
14
  * Per input, the caller may submit EITHER the **compact** value (a bare source /
9
- * canonical `{url}` content) OR the explicit `{ concept, content }` envelope that
10
- * `buildInputs({ explicit: true })` hands back — its `content` is interpreted
11
- * exactly as the compact value would be, and the envelope is preserved on output
12
- * (the `concept` annotation rides through; the runtime accepts it — see
13
- * `pipelex`'s `input_shaper.py` `_is_explicit` / `input_normalizer.py`).
15
+ * canonical `{url}` content) OR the explicit `{ concept, content }` envelope —
16
+ * its `content` is interpreted exactly as the compact value would be, and the
17
+ * envelope is preserved on output (the `concept` annotation rides through; the
18
+ * runtime accepts it — see `pipelex`'s `input_shaper.py` `_is_explicit` /
19
+ * `input_normalizer.py`).
14
20
  *
15
- * The classification mirrors the runtime: `pipelex`'s `input_normalizer` walks
16
- * Image/Document contents (recognized by their `url`-bearing shape, incl. nested
17
- * in structured content) and `resolve_uri` decides upload vs pass-through. The
18
- * declared signature comes from the explicit template (`buildInputs`,
19
- * `explicit: true`), whose canonical content shape is the classifier — the file
20
- * signal is a value that is a dict containing a `url` key. See the shared
21
- * behavior matrix (`wip/upload/behavior-matrix.md`) and `docs/input-preparation.md`.
21
+ * **The descriptor is the classifier, never the value's shape.** `input_form`
22
+ * (the MTHDS standard's artifact, opted into with `views: ["input_form"]`)
23
+ * states the kind at every depth — `document` / `image` mark a file position,
24
+ * `object` recurses through `fields`, `list` through `item`, everything else
25
+ * passes through. That is what makes an OPTIONAL nested file field prepare like
26
+ * a required one, and a `text` field merely *named* `url` stay untouched: both
27
+ * were misread while the signature came from the rendered inputs template, whose
28
+ * file signal was a `url`-bearing dict. See `docs/input-preparation.md` and the
29
+ * shared behavior matrix (`wip/upload/behavior-matrix.md`).
22
30
  */
23
31
  import { InputPreparationError } from "./errors.js";
24
32
  import { uploadFile } from "./upload.js";
@@ -28,16 +36,26 @@ const HTTP_URL_RE = /^https?:\/\//i;
28
36
  function isPlainObject(value) {
29
37
  return Object.prototype.toString.call(value) === "[object Object]";
30
38
  }
31
- /** A canonical Image/Document content is a plain object carrying a `url` key. */
39
+ /** A trimmed non-empty string, or `undefined` — the "empty is absent" rule. */
40
+ function nonEmptyString(value) {
41
+ if (typeof value !== "string")
42
+ return undefined;
43
+ const trimmed = value.trim();
44
+ return trimmed.length > 0 ? trimmed : undefined;
45
+ }
46
+ /**
47
+ * A canonical Image/Document content is a plain object carrying a `url` key.
48
+ * A VALUE-shape helper only: it is consulted at a position the descriptor has
49
+ * already declared a file, never as the signal that one is there.
50
+ */
32
51
  function isFileContent(node) {
33
52
  return isPlainObject(node) && "url" in node;
34
53
  }
35
54
  /**
36
- * The explicit-template envelope: a plain object whose keys are EXACTLY `concept`
37
- * and `content` — the shape `buildInputs({ explicit: true })` returns per input.
38
- * Matches the runtime's `_is_explicit` (`pipelex`'s `input_shaper.py`): exact
39
- * keys, not a superset, so a structured-content input that merely happens to carry
40
- * both fields is not misread as an envelope.
55
+ * The explicit envelope: a plain object whose keys are EXACTLY `concept` and
56
+ * `content`. Matches the runtime's `_is_explicit` (`pipelex`'s
57
+ * `input_shaper.py`): exact keys, not a superset, so a structured-content input
58
+ * that merely happens to carry both fields is not misread as an envelope.
41
59
  */
42
60
  function isExplicitEnvelope(value) {
43
61
  if (!isPlainObject(value))
@@ -133,66 +151,166 @@ async function resolveFilePosition(ctx, callerValue) {
133
151
  const resolved = await resolveSource(ctx, callerValue);
134
152
  return { url: resolved };
135
153
  }
136
- /** Template-guided walk: a template node that is canonical file content marks a file position. */
137
- async function resolveNode(ctx, templateNode, callerValue) {
138
- if (isFileContent(templateNode)) {
139
- return resolveFilePosition(ctx, callerValue);
140
- }
141
- if (Array.isArray(templateNode) && templateNode.length > 0) {
142
- const elementTemplate = templateNode[0];
143
- if (Array.isArray(callerValue)) {
144
- return Promise.all(callerValue.map((item) => resolveNode(ctx, elementTemplate, item)));
145
- }
146
- return callerValue; // shape mismatch — leave it for the run to reject
147
- }
148
- if (isPlainObject(templateNode) && isPlainObject(callerValue)) {
149
- const result = { ...callerValue };
150
- for (const key of Object.keys(templateNode)) {
151
- if (key in callerValue) {
152
- result[key] = await resolveNode(ctx, templateNode[key], callerValue[key]);
154
+ /**
155
+ * Descriptor-guided walk, discriminated on the node's `kind`:
156
+ *
157
+ * - `document` / `image` — a file position, whatever the value's shape;
158
+ * - `object` — walk the declared `fields` by name; keys the descriptor does not
159
+ * name are copied through untouched;
160
+ * - `list` — walk `item` against each element;
161
+ * - every other kind (`text`, `prose`, `date`, `number`, `boolean`, `enum`,
162
+ * `unknown`) — pass through at any depth. `unknown` is the standard's escape
163
+ * hatch for a `Dynamic` / `Composite` input, and it is NOT interpreted: the
164
+ * signature declares no file there, and uploading by value shape is the defect
165
+ * this walk removes. A caller with such an input uploads with `uploadFile`
166
+ * first and passes the storage URI.
167
+ *
168
+ * A caller value whose shape disagrees with the node (a scalar at an `object`, a
169
+ * non-array at a `list`) passes through for the run to reject — preparation never
170
+ * second-guesses the signature.
171
+ */
172
+ async function resolveNode(ctx, node, callerValue) {
173
+ switch (node.kind) {
174
+ case "document":
175
+ case "image":
176
+ return resolveFilePosition(ctx, callerValue);
177
+ case "object": {
178
+ if (!isPlainObject(callerValue))
179
+ return callerValue;
180
+ const result = { ...callerValue };
181
+ for (const field of node.fields) {
182
+ if (Object.hasOwn(callerValue, field.name)) {
183
+ result[field.name] = await resolveNode(ctx, field, callerValue[field.name]);
184
+ }
153
185
  }
186
+ return result;
187
+ }
188
+ case "list": {
189
+ if (!Array.isArray(callerValue))
190
+ return callerValue;
191
+ return Promise.all(callerValue.map((element) => resolveNode(ctx, node.item, element)));
154
192
  }
155
- return result;
193
+ default:
194
+ return callerValue;
195
+ }
196
+ }
197
+ /**
198
+ * Normalize and check the three selectors. Empty is absent (`files: []`,
199
+ * `method_ref: ""`, `method_id: " "`), mirroring the run options' rule and the
200
+ * Python `CrateRequestBase` normalisers, and exactly one must remain — the check
201
+ * lives here because this helper is the one that composes the `validate` call.
202
+ * The illegal shapes are compile errors for typed callers; this backs them up for
203
+ * untyped (JS) ones with a typed `InputPreparationError`.
204
+ */
205
+ function resolveSelector(request) {
206
+ const raw = request;
207
+ const files = Array.isArray(raw["files"]) && raw["files"].length > 0
208
+ ? raw["files"]
209
+ : undefined;
210
+ const methodRef = nonEmptyString(raw["method_ref"]);
211
+ const methodId = nonEmptyString(raw["method_id"]);
212
+ const given = [];
213
+ if (files !== undefined)
214
+ given.push("`files`");
215
+ if (methodRef !== undefined)
216
+ given.push("`method_ref`");
217
+ if (methodId !== undefined)
218
+ given.push("`method_id`");
219
+ if (given.length === 0) {
220
+ throw new InputPreparationError("Cannot prepare inputs: no method selector. Supply exactly one of `files` (an inline MTHDS " +
221
+ "closure), `method_ref` (a published method's address) or `method_id` (a stored method's " +
222
+ "catalog id).");
223
+ }
224
+ if (given.length > 1) {
225
+ throw new InputPreparationError(`Cannot prepare inputs: ${given.join(" and ")} were both given. Supply exactly one method ` +
226
+ "selector — `files`, `method_ref` or `method_id`.");
156
227
  }
157
- return callerValue; // scalar (text/number/…) or shape mismatch — pass through
228
+ if (files !== undefined)
229
+ return { files };
230
+ if (methodRef !== undefined)
231
+ return { method_ref: methodRef };
232
+ return { method_id: methodId };
158
233
  }
159
234
  /**
160
- * Resolve a `files` / `method_id` closure pair to inline files: reject an
161
- * over-specified `{ files, method_id }` (both given) before any resolution
162
- * runs, then either return the inline `files` unchanged or fetch-and-parse the
163
- * stored method behind `method_id` via `getMethodClosure`. Returns `undefined`
164
- * when NEITHER is given — the caller decides what that means for its own
165
- * request shape, since `buildInputs` (client.ts) also accepts a third source,
166
- * the reserved `method_ref`, that `prepareInputs` does not.
235
+ * Ask `validate` for the signature, whatever the selector, and hand back the
236
+ * valid report.
167
237
  *
168
- * Shared between `PipelexApiClient.buildInputs` and `resolveClosureFiles`
169
- * (below) so the files/method_id invariant is defined in exactly one place —
170
- * a duplicated copy of this exact check is what let a `buildInputs`-only
171
- * revision briefly reject a legitimate `method_ref`-only request.
238
+ * `allowSignatures: true` on purpose: preparation needs a pipe's DECLARED inputs,
239
+ * and a bundle mid-authoring with an unresolved signature elsewhere must not be
240
+ * refused inputs for a pipe whose inputs are declared. Whether the bundle runs is
241
+ * the run's verdict, not preparation's. The `is_valid: false` arm still means the
242
+ * closure does not load, which is a preparation failure.
172
243
  */
173
- export async function resolveFilesOrMethodId(files, methodId, getMethodClosure, makeError) {
174
- if (methodId !== undefined && files !== undefined) {
175
- throw makeError("supply the closure as either `files` or `method_id`, never both.");
244
+ async function fetchSignature(client, selector) {
245
+ let result;
246
+ if ("files" in selector) {
247
+ const contents = selector.files.map((file) => file.content);
248
+ // `validateFiles`' rule: label every content once any file names a source, so
249
+ // the server never sees a length-mismatched `mthds_sources` array.
250
+ const hasAnySource = selector.files.some((file) => file.source !== undefined);
251
+ const sources = hasAnySource
252
+ ? selector.files.map((file, index) => file.source ?? `inline://file-${index + 1}.mthds`)
253
+ : undefined;
254
+ result = await client.validate(contents, true, sources, undefined, ["input_form"]);
176
255
  }
177
- if (methodId !== undefined) {
178
- return getMethodClosure(methodId);
256
+ else {
257
+ result = await client.validate(selector, true, undefined, undefined, ["input_form"]);
179
258
  }
180
- return files;
259
+ if (!result.is_valid) {
260
+ const first = result.validation_errors[0]?.message ?? result.message;
261
+ throw new InputPreparationError(`Cannot prepare inputs: the method signature did not resolve — ${first}`);
262
+ }
263
+ return result;
181
264
  }
182
265
  /**
183
- * Resolve the request's closure to inline `files`: fetch and parse a stored
184
- * method when `method_id` is given, else use the inline `files`. The either/or
185
- * is a type invariant (the discriminated union); {@link resolveFilesOrMethodId}
186
- * backs the over-specified "both given" case at runtime for non-typed callers,
187
- * and the "neither given" case is rejected here (prepareInputs has no third
188
- * closure source, unlike `buildInputs`).
266
+ * Pick the pipe whose descriptor guides the walk, in the order `docs/input-preparation.md`
267
+ * documents: an explicit qualified `pipe_ref`, then the report's typed resolved
268
+ * default, then the bundle's declared `main_pipe`, then the single pipe — else an
269
+ * error naming the candidates.
189
270
  */
190
- async function resolveClosureFiles(client, request) {
191
- const files = await resolveFilesOrMethodId(request.files, request.method_id, (methodId) => client.getMethodClosure(methodId), (message) => new InputPreparationError(`Cannot prepare inputs: ${message}`));
192
- if (files === undefined) {
193
- throw new InputPreparationError("Cannot prepare inputs: supply either `files` (an inline MTHDS closure) or `method_id` (a stored method).");
271
+ function selectPipeRef(report, inputForm, requested) {
272
+ const refs = Object.keys(inputForm);
273
+ const candidates = refs.length > 0 ? refs.join(", ") : "(none — the closure declares no pipes)";
274
+ if (requested !== undefined) {
275
+ if (!requested.includes(".")) {
276
+ throw new InputPreparationError(`Cannot prepare inputs: \`pipe_ref\` must be qualified (\`domain.pipe_code\`), got the bare ` +
277
+ `"${requested}". The method declares: ${candidates}.`);
278
+ }
279
+ if (!(requested in inputForm)) {
280
+ throw new InputPreparationError(`Cannot prepare inputs: the method declares no pipe "${requested}". It declares: ${candidates}.`);
281
+ }
282
+ return requested;
194
283
  }
195
- return files;
284
+ // The typed resolved default, when the runner serves it (manifest-aware for a
285
+ // `method_ref` package, which is why it outranks the blueprint read below).
286
+ const typedDefault = nonEmptyString(report.default_pipe_ref);
287
+ if (typedDefault !== undefined && typedDefault in inputForm)
288
+ return typedDefault;
289
+ // `bundle_blueprint` is opaque transport in this SDK on purpose, so read it
290
+ // defensively and fall through rather than trust it.
291
+ const blueprintDefault = readBlueprintMainPipeRef(report.bundle_blueprint);
292
+ if (blueprintDefault !== undefined && blueprintDefault in inputForm)
293
+ return blueprintDefault;
294
+ if (refs.length === 1)
295
+ return refs[0];
296
+ throw new InputPreparationError(`Cannot prepare inputs: the method declares no single default pipe, so \`pipe_ref\` is required. ` +
297
+ `It declares: ${candidates}.`);
298
+ }
299
+ /**
300
+ * The bundle blueprint's declared `main_pipe`, qualified by its `domain` when it
301
+ * is authored bare. Every read is defensive: the blueprint is typed
302
+ * `Record<string, unknown>` because its schema is the runtime's, not this SDK's.
303
+ */
304
+ function readBlueprintMainPipeRef(blueprint) {
305
+ if (!isPlainObject(blueprint))
306
+ return undefined;
307
+ const mainPipe = nonEmptyString(blueprint["main_pipe"]);
308
+ if (mainPipe === undefined)
309
+ return undefined;
310
+ if (mainPipe.includes("."))
311
+ return mainPipe;
312
+ const domain = nonEmptyString(blueprint["domain"]);
313
+ return domain === undefined ? undefined : `${domain}.${mainPipe}`;
196
314
  }
197
315
  /**
198
316
  * Prepare a pipe's inputs: upload local/byte/data-URL assets at the signature's
@@ -200,45 +318,44 @@ async function resolveClosureFiles(client, request) {
200
318
  * records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
201
319
  * unchanged. All failures are raised before any run is created.
202
320
  *
203
- * The declared signature is resolved from the closure; a closure that does not
204
- * resolve throws {@link InputPreparationError}. No-verdict conditions from the
205
- * signature route (unknown `pipe_ref`, auth, server fault) surface as the build
206
- * route's `ApiResponseError`.
321
+ * The signature comes from one `POST /v1/validate` with `views: ["input_form"]`,
322
+ * whatever the selector — inline `files`, a `method_ref` the runner resolves, or
323
+ * a `method_id` the platform resolves. A closure that does not load, an unknown
324
+ * `pipe_ref`, no default pipe, or a report with no descriptor throw
325
+ * {@link InputPreparationError}; a no-verdict condition from the route (a
326
+ * malformed selector, an unknown or foreign-org id, no package at the address,
327
+ * auth, a server fault) surfaces as `ApiResponseError`, unchanged.
207
328
  */
208
329
  export async function prepareInputs(client, request) {
209
- const files = await resolveClosureFiles(client, request);
210
- const report = await client.buildInputs({
211
- files,
212
- ...(request.pipe_ref === undefined ? {} : { pipe_ref: request.pipe_ref }),
213
- format: "json",
214
- explicit: true,
215
- });
216
- if (!report.is_valid) {
217
- const first = report.validation_errors[0]?.message ?? report.message;
218
- throw new InputPreparationError(`Cannot prepare inputs: the method signature did not resolve — ${first}`);
219
- }
220
- // We requested `format: "json"`, so the valid arm carries the envelope in `inputs`.
221
- if (report.format !== "json") {
222
- throw new InputPreparationError(`Cannot prepare inputs: expected a JSON inputs template, got "${report.format}".`);
330
+ const selector = resolveSelector(request);
331
+ const report = await fetchSignature(client, selector);
332
+ const inputForm = report.input_form;
333
+ if (inputForm === undefined) {
334
+ // Never a silent degrade to "no uploads": without the descriptor there is no
335
+ // signature to prepare against.
336
+ throw new InputPreparationError("Cannot prepare inputs: the validate report carries no `input_form` descriptor — the signature " +
337
+ 'preparation reads. The descriptor rides `views: ["input_form"]` on pipelex-api >= 0.18.0; ' +
338
+ "point the client at a runner that serves it.");
223
339
  }
224
- const template = report.inputs;
340
+ const pipeRef = selectPipeRef(report, inputForm, nonEmptyString(request.pipe_ref));
341
+ const descriptor = inputForm[pipeRef];
342
+ const declared = new Map(descriptor.fields.map((field) => [field.name, field]));
225
343
  const ctx = { client, uploads: [], dedup: new Map() };
226
344
  const rewritten = { ...request.inputs };
227
345
  for (const [name, callerValue] of Object.entries(request.inputs)) {
228
- const entry = template[name];
229
- if (!isPlainObject(entry) || !("content" in entry)) {
230
- // Not a declared input (or an unexpected envelope) — pass through untouched.
231
- continue;
346
+ const field = declared.get(name);
347
+ if (field === undefined) {
348
+ continue; // Not a declared input — pass through untouched, as today.
232
349
  }
233
350
  if (isExplicitEnvelope(callerValue)) {
234
- // The caller filled the explicit `{ concept, content }` template: walk the
235
- // inner content against the compact signature, then re-wrap so the concept
351
+ // The caller filled the explicit `{ concept, content }` envelope: walk the
352
+ // inner content against the same node, then re-wrap so the concept
236
353
  // annotation rides through to the run (the runtime accepts the envelope).
237
- const walked = await resolveNode(ctx, entry.content, callerValue.content);
354
+ const walked = await resolveNode(ctx, field, callerValue.content);
238
355
  rewritten[name] = { ...callerValue, content: walked };
239
356
  }
240
357
  else {
241
- rewritten[name] = await resolveNode(ctx, entry.content, callerValue);
358
+ rewritten[name] = await resolveNode(ctx, field, callerValue);
242
359
  }
243
360
  }
244
361
  return { inputs: rewritten, uploads: ctx.uploads };
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-inputs.js","sourceRoot":"","sources":["../src/prepare-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AACpD,MAAM,WAAW,GAAG,eAAe,CAAC;AA4DpC,2FAA2F;AAC3F,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC;AACrE,CAAC;AAED,iFAAiF;AACjF,SAAS,aAAa,CAAC,IAAa;IAClC,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,KAAc;IACxC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,C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",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "TypeScript SDK for the Pipelex hosted API — execute methods, manage runs, and call the product surface.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -59,7 +59,7 @@
59
59
  "vitest": "^4.0.18"
60
60
  },
61
61
  "dependencies": {
62
- "mthds": "^0.24.0",
62
+ "mthds": "^0.25.0",
63
63
  "smol-toml": "^1.6.0"
64
64
  }
65
65
  }