@pipelex/sdk 0.26.0 → 0.28.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,15 +1,17 @@
1
1
  /**
2
- * `prepareInputs` — signature-driven input preparation. Resolves the target
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
2
+ * `prepareInputs` — signature-driven input preparation. Reads the target pipe's
3
+ * declared inputs from the **input-form descriptor** `POST /v1/pipe-io` returns,
4
+ * interprets the caller's inputs top-down against it, uploads the file-bearing
5
+ * values, and returns rewritten inputs (canonical content carrying
6
6
  * `pipelex-storage://` in `url`) plus one upload record per prepared asset.
7
7
  *
8
8
  * The method is named the same three ways every other method-taking operation
9
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.
10
+ * exactly one per call. All three are pass-throughs to `POST /v1/pipe-io`, which
11
+ * resolves an address on the runner and an id on the platform, so nothing is
12
+ * expanded client-side. The route also SELECTS the pipe: the caller's qualified
13
+ * `pipe_ref`, else the method's own entry pipe, and the ref it answers with is
14
+ * the one prepared. It runs no dry run, so preparing inputs costs one static load.
13
15
  *
14
16
  * Per input, the caller may submit EITHER the **compact** value (a bare source /
15
17
  * canonical `{url}` content) OR the explicit `{ concept, content }` envelope —
@@ -19,19 +21,33 @@
19
21
  * `input_normalizer.py`).
20
22
  *
21
23
  * **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`).
24
+ * (the MTHDS standard's artifact) states the kind at every depth — `document` /
25
+ * `image` mark a file position, `object` recurses through `fields`, `list`
26
+ * through `item`, everything else passes through. That is what makes an
27
+ * OPTIONAL nested file field prepare like a required one, and a `text` field
28
+ * merely *named* `url` stay untouched: both were misread while the signature
29
+ * came from the rendered inputs template, whose file signal was a `url`-bearing
30
+ * dict. See `docs/input-preparation.md`, which `pipelex-sdk-python` mirrors case
31
+ * for case.
30
32
  */
31
- import { InputPreparationError } from "./errors.js";
33
+ import { ApiResponseError, InputPreparationError } from "./errors.js";
32
34
  import { uploadFile } from "./upload.js";
33
35
  const PIPELEX_STORAGE_SCHEME = "pipelex-storage://";
34
36
  const HTTP_URL_RE = /^https?:\/\//i;
37
+ /**
38
+ * The `error_type`s of the route's pipe-selection refusals — the only `422`s
39
+ * `prepareInputs` turns into an `InputPreparationError`. They are the runtime's
40
+ * entry-lookup classes, the vocabulary the run routes speak too: a ref that names
41
+ * no pipe, or no entry pipe at all, is `EntryPipeNotFoundError`; a code that
42
+ * matches pipes in several domains, or several `main_pipe` declarations, is
43
+ * `EntryPipeAmbiguousError`. Every other `422` (a malformed body, an over-limit
44
+ * file, a fetched package with no `.mthds` file, a stored method with no source)
45
+ * shares the generic `ValidationError` type and stays an `ApiResponseError`.
46
+ */
47
+ const PIPE_SELECTION_ERROR_TYPES = new Set([
48
+ "EntryPipeNotFoundError",
49
+ "EntryPipeAmbiguousError",
50
+ ]);
35
51
  /** Strict plain-object test — excludes arrays, `Uint8Array`, `Blob`, and other exotics. */
36
52
  function isPlainObject(value) {
37
53
  return Object.prototype.toString.call(value) === "[object Object]";
@@ -198,7 +214,7 @@ async function resolveNode(ctx, node, callerValue) {
198
214
  * Normalize and check the three selectors. Empty is absent (`files: []`,
199
215
  * `method_ref: ""`, `method_id: " "`), mirroring the run options' rule and the
200
216
  * Python `CrateRequestBase` normalisers, and exactly one must remain — the check
201
- * lives here because this helper is the one that composes the `validate` call.
217
+ * lives here because this helper is the one that composes the `pipeIo` call.
202
218
  * The illegal shapes are compile errors for typed callers; this backs them up for
203
219
  * untyped (JS) ones with a typed `InputPreparationError`.
204
220
  */
@@ -222,7 +238,8 @@ function resolveSelector(request) {
222
238
  "catalog id).");
223
239
  }
224
240
  if (given.length > 1) {
225
- throw new InputPreparationError(`Cannot prepare inputs: ${given.join(" and ")} were both given. Supply exactly one method ` +
241
+ throw new InputPreparationError(`Cannot prepare inputs: ${given.join(" and ")} were ${given.length === 2 ? "both" : "all"} ` +
242
+ "given. Supply exactly one method " +
226
243
  "selector — `files`, `method_ref` or `method_id`.");
227
244
  }
228
245
  if (files !== undefined)
@@ -232,113 +249,84 @@ function resolveSelector(request) {
232
249
  return { method_id: methodId };
233
250
  }
234
251
  /**
235
- * Ask `validate` for the signature, whatever the selector, and hand back the
236
- * valid report.
252
+ * Normalize the caller's `pipe_ref` and refuse, before any request, the two
253
+ * spellings preparation cannot honour. Empty is absent, so the route's selection
254
+ * chain decides.
237
255
  *
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.
256
+ * - A **bare** `pipe_code` is refused because a request names a pipe by its
257
+ * qualified ref. The route will refuse it too once the runner's shared
258
+ * selection enforces that rule; until then it would resolve a bare code across
259
+ * domains, and preparation does not lean on that fallback.
260
+ * - An **`alias->domain.pipe_code`** ref is refused because the alias names a
261
+ * dependency package's pipe, and preparation covers the method's own pipes: the
262
+ * crate routes do not load an address-based dependency at all. The run route
263
+ * takes such a ref; preparation refuses it, and that asymmetry is deliberate.
243
264
  */
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"]);
265
+ function normalizePipeRef(raw) {
266
+ const pipeRef = nonEmptyString(raw);
267
+ if (pipeRef === undefined)
268
+ return undefined;
269
+ if (pipeRef.includes("->")) {
270
+ throw new InputPreparationError(`Cannot prepare inputs: \`pipe_ref\` "${pipeRef}" names a dependency package's pipe. ` +
271
+ "Preparation covers the method's own pipes: name one as `domain.pipe_code`.");
255
272
  }
256
- else {
257
- result = await client.validate(selector, true, undefined, undefined, ["input_form"]);
273
+ if (!pipeRef.includes(".")) {
274
+ throw new InputPreparationError(`Cannot prepare inputs: \`pipe_ref\` must be qualified (\`domain.pipe_code\`), got the bare ` +
275
+ `"${pipeRef}".`);
258
276
  }
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;
277
+ return pipeRef;
264
278
  }
265
279
  /**
266
- * Pick the pipe whose descriptor guides the walk, in the order
267
- * `docs/input-preparation.md` documents: an explicit qualified `pipe_ref`, then
268
- * the report's resolved default — read on the field's PRESENCE, never on its
269
- * truthiness — and, behind an ABSENT field only, the bundle's declared
270
- * `main_pipe` then the single pipe.
280
+ * Ask `POST /v1/pipe-io` for the pipe and its signature, whatever the selector,
281
+ * and hand back the valid report.
271
282
  *
272
- * `default_pipe_ref` answers the very question this function asks: the qualified
273
- * ref of the pipe a selector-less run of THIS request would execute. A stated
274
- * `null` is that answer too — the server determined no entry pipe, and such a run
275
- * is refused by the run route — so reading it as silence and falling through would
276
- * prepare a pipe the run will not execute. Only a field the report does not carry
277
- * at all (a runner predating it) leaves the blueprint and single-pipe arms
278
- * standing. A JSON body cannot carry an own property holding `undefined`, and the
279
- * parsed body is handed through untouched, so strict `=== undefined` is the whole
280
- * absence test.
283
+ * The route runs no dry run and does not refuse a method with pending
284
+ * signatures elsewhere: preparation needs a pipe's DECLARED inputs, and whether
285
+ * the method runs is the run's verdict, not preparation's. The `is_valid: false`
286
+ * arm means the closure does not load, which is a preparation failure. So is a
287
+ * selection the route refuses — an unknown `pipe_ref`, no entry pipe, several —
288
+ * which it answers with a `422` typed by one of {@link PIPE_SELECTION_ERROR_TYPES};
289
+ * every other failure is re-thrown unchanged.
281
290
  */
282
- function selectPipeRef(report, inputForm, requested) {
283
- const refs = Object.keys(inputForm);
284
- const candidates = refs.length > 0 ? refs.join(", ") : "(none — the closure declares no pipes)";
285
- if (requested !== undefined) {
286
- if (!requested.includes(".")) {
287
- throw new InputPreparationError(`Cannot prepare inputs: \`pipe_ref\` must be qualified (\`domain.pipe_code\`), got the bare ` +
288
- `"${requested}". The method declares: ${candidates}.`);
289
- }
290
- if (!(requested in inputForm)) {
291
- throw new InputPreparationError(`Cannot prepare inputs: the method declares no pipe "${requested}". It declares: ${candidates}.`);
292
- }
293
- return requested;
291
+ async function fetchSignature(client, selector, pipeRef) {
292
+ const request = pipeRef === undefined ? { ...selector } : { ...selector, pipe_ref: pipeRef };
293
+ let result;
294
+ try {
295
+ result = await client.pipeIo(request);
294
296
  }
295
- // The resolved default, when the runner serves the field at all (manifest-aware
296
- // for a `method_ref` package, which is why it outranks the blueprint read below).
297
- if (report.default_pipe_ref !== undefined) {
298
- const statedDefault = nonEmptyString(report.default_pipe_ref);
299
- if (statedDefault === undefined) {
300
- // A stated `null` — or anything else that is not a non-empty string — is the
301
- // server's verdict, not a gap: no entry pipe was determined, so a run naming
302
- // no pipe would not resolve one either. Neither fallback stands behind it.
303
- throw new InputPreparationError(`Cannot prepare inputs: the server determined no entry pipe for this method, so a run that ` +
304
- `names no pipe would not resolve one (no \`main_pipe\` is declared, or the package manifest ` +
305
- `names a pipe the closure does not declare or declares in several domains). Pass ` +
306
- `\`pipe_ref\`. It declares: ${candidates}.`);
297
+ catch (error) {
298
+ if (error instanceof ApiResponseError &&
299
+ error.status === 422 &&
300
+ error.errorType !== undefined &&
301
+ PIPE_SELECTION_ERROR_TYPES.has(error.errorType)) {
302
+ const detail = error.serverMessage ?? error.message;
303
+ throw new InputPreparationError(`Cannot prepare inputs: ${detail}`, { cause: error });
307
304
  }
308
- if (!(statedDefault in inputForm)) {
309
- // The default and the descriptor come from one report keyed by one pipe set, so
310
- // a miss is the report contradicting itself — falling through would silently
311
- // prepare a different pipe than the one the run would execute.
312
- throw new InputPreparationError(`Cannot prepare inputs: the validate report names "${statedDefault}" as the default pipe, but ` +
313
- `its \`input_form\` descriptor does not describe it. Pass \`pipe_ref\`. It declares: ${candidates}.`);
314
- }
315
- return statedDefault;
305
+ throw error;
306
+ }
307
+ if (!result.is_valid) {
308
+ const first = result.validation_errors[0]?.message ?? result.message;
309
+ throw new InputPreparationError(`Cannot prepare inputs: the method signature did not resolve — ${first}`);
316
310
  }
317
- // Behind an ABSENT field only. `bundle_blueprint` is opaque transport in this SDK
318
- // on purpose, so read it defensively and fall through rather than trust it.
319
- const blueprintDefault = readBlueprintMainPipeRef(report.bundle_blueprint);
320
- if (blueprintDefault !== undefined && blueprintDefault in inputForm)
321
- return blueprintDefault;
322
- if (refs.length === 1)
323
- return refs[0];
324
- throw new InputPreparationError(`Cannot prepare inputs: the method declares no single default pipe, so \`pipe_ref\` is required. ` +
325
- `It declares: ${candidates}.`);
311
+ return result;
326
312
  }
327
313
  /**
328
- * The bundle blueprint's declared `main_pipe`, qualified by its `domain` when it
329
- * is authored bare. Every read is defensive: the blueprint is typed
330
- * `Record<string, unknown>` because its schema is the runtime's, not this SDK's.
314
+ * The descriptor of the pipe the route selected. The route answers a
315
+ * single-pipe request with `input_form` keyed by exactly the `pipe_ref` it
316
+ * resolved, so a missing ref or a missing key is the answer contradicting itself
317
+ * — preparing any other pipe would silently walk the wrong signature.
331
318
  */
332
- function readBlueprintMainPipeRef(blueprint) {
333
- if (!isPlainObject(blueprint))
334
- return undefined;
335
- const mainPipe = nonEmptyString(blueprint["main_pipe"]);
336
- if (mainPipe === undefined)
337
- return undefined;
338
- if (mainPipe.includes("."))
339
- return mainPipe;
340
- const domain = nonEmptyString(blueprint["domain"]);
341
- return domain === undefined ? undefined : `${domain}.${mainPipe}`;
319
+ function selectedDescriptor(report) {
320
+ const pipeRef = nonEmptyString(report.pipe_ref);
321
+ const inputForm = report.input_form;
322
+ if (pipeRef === undefined || !isPlainObject(inputForm) || !Object.hasOwn(inputForm, pipeRef)) {
323
+ const described = isPlainObject(inputForm)
324
+ ? Object.keys(inputForm).join(", ") || "none"
325
+ : "none";
326
+ throw new InputPreparationError(`Cannot prepare inputs: the pipe I/O answer selected ${pipeRef === undefined ? "no pipe" : `"${pipeRef}"`}, ` +
327
+ `but its \`input_form\` does not describe it (it describes: ${described}).`);
328
+ }
329
+ return inputForm[pipeRef];
342
330
  }
343
331
  /**
344
332
  * Prepare a pipe's inputs: upload local/byte/data-URL assets at the signature's
@@ -346,27 +334,20 @@ function readBlueprintMainPipeRef(blueprint) {
346
334
  * records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
347
335
  * unchanged. All failures are raised before any run is created.
348
336
  *
349
- * The signature comes from one `POST /v1/validate` with `views: ["input_form"]`,
350
- * whatever the selector — inline `files`, a `method_ref` the runner resolves, or
351
- * a `method_id` the platform resolves. A closure that does not load, an unknown
352
- * `pipe_ref`, no default pipe, or a report with no descriptor throw
353
- * {@link InputPreparationError}; a no-verdict condition from the route (a
354
- * malformed selector, an unknown or foreign-org id, no package at the address,
355
- * auth, a server fault) surfaces as `ApiResponseError`, unchanged.
337
+ * The pipe and its signature come from one `POST /v1/pipe-io`, whatever the
338
+ * selector — inline `files`, a `method_ref` the runner resolves, or a
339
+ * `method_id` the platform resolves. A bare or alias-qualified `pipe_ref`, a
340
+ * closure that does not load, and a selection the route refuses (an unknown
341
+ * `pipe_ref`, no entry pipe, several) throw {@link InputPreparationError}; any
342
+ * other failure from the route (a malformed selector, an unknown or foreign-org
343
+ * id, no package at the address, auth, a server fault, a deployment that does not
344
+ * serve the route) surfaces as `ApiResponseError`, unchanged.
356
345
  */
357
346
  export async function prepareInputs(client, request) {
358
347
  const selector = resolveSelector(request);
359
- const report = await fetchSignature(client, selector);
360
- const inputForm = report.input_form;
361
- if (inputForm === undefined) {
362
- // Never a silent degrade to "no uploads": without the descriptor there is no
363
- // signature to prepare against.
364
- throw new InputPreparationError("Cannot prepare inputs: the validate report carries no `input_form` descriptor — the signature " +
365
- 'preparation reads. The descriptor rides `views: ["input_form"]` on pipelex-api >= 0.18.0; ' +
366
- "point the client at a runner that serves it.");
367
- }
368
- const pipeRef = selectPipeRef(report, inputForm, nonEmptyString(request.pipe_ref));
369
- const descriptor = inputForm[pipeRef];
348
+ const pipeRef = normalizePipeRef(request.pipe_ref);
349
+ const report = await fetchSignature(client, selector, pipeRef);
350
+ const descriptor = selectedDescriptor(report);
370
351
  const declared = new Map(descriptor.fields.map((field) => [field.name, field]));
371
352
  const ctx = { client, uploads: [], dedup: new Map() };
372
353
  const rewritten = { ...request.inputs };
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-inputs.js","sourceRoot":"","sources":["../src/prepare-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAQH,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAQpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AACpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAgEpC,2FAA2F;AAC3F,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC;AACrE,CAAC;AAED,+EAA+E;AAC/E,SA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I,GAAG,EAAE,EAAE,CAAC;IACtE,MAAM,SAAS,GAA4B,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IACjE,KAAK,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAS,CAAC,2DAA2D;QACvE,CAAC;QACD,IAAI,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;YACpC,2EAA2E;YAC3E,mEAAmE;YACnE,0EAA0E;YAC1E,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAClE,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;AACrD,CAAC"}
@@ -271,6 +271,10 @@ export interface UploadGrant {
271
271
  }
272
272
  /** Per-pipe progress marker surfaced in a run's `pipe_statuses` map. */
273
273
  export type PipeStatus = "scheduled" | "running" | "succeeded" | "failed" | "skipped";
274
+ /**
275
+ * A run's record — the base of `RunDetail`, which `getRunDetail` returns. The run-history list
276
+ * does not return it: its rows are the slimmer `RunHistoryItem`.
277
+ */
274
278
  export interface PipelineRun {
275
279
  pipeline_run_id: string;
276
280
  /** `null` on an ad-hoc run — one started from an inline bundle belongs to no
@@ -294,6 +298,28 @@ export interface PipelineRun {
294
298
  * WHY a run failed rather than showing a generic message. */
295
299
  error?: RunErrorReport | null;
296
300
  }
301
+ /**
302
+ * One row of a method's run history — an item of `listRuns`' page and of `iterateRuns`.
303
+ *
304
+ * Exactly what a history row shows, and nothing more: the run's id, when it started and
305
+ * finished, whether it succeeded, which pipe it ran and, for a failed run, why. The rest of the
306
+ * run's record — its organization, its creator, its method (the caller just named it), its
307
+ * workflow id — is not sent on the list; read it with `getRunDetail` (or `getRunStatus`) once a
308
+ * run is opened.
309
+ */
310
+ export interface RunHistoryItem {
311
+ pipeline_run_id: string;
312
+ status: RunStatus;
313
+ /** ISO-8601 instant the run was created. */
314
+ created_at: string;
315
+ /** ISO-8601 instant the run reached a terminal status; `null` or absent while it runs. */
316
+ finished_at?: string | null;
317
+ /** `null` when the runner resolved the pipe from the bundle's `main_pipe`. */
318
+ pipe_code?: string | null;
319
+ /** The runner's stored error report — present only on a failed run that recorded one,
320
+ * so opening it from history shows why without another read. */
321
+ error?: RunErrorReport | null;
322
+ }
297
323
  /**
298
324
  * A single run, whole — `GET /v1/runs/{id}`.
299
325
  *
@@ -338,7 +364,7 @@ export interface ListRunsQuery {
338
364
  * avoid.
339
365
  */
340
366
  export interface RunPage {
341
- items: PipelineRun[];
367
+ items: RunHistoryItem[];
342
368
  nextCursor: string | null;
343
369
  }
344
370
  /** The admin/manual run-status patch — `status` is a free string here. */
package/dist/runs.d.ts CHANGED
@@ -17,7 +17,7 @@ import type { DictPipeOutput, DictWorkingMemory } from "./models.js";
17
17
  * Wire contract mirrors the Pipelex Hosted API:
18
18
  * POST /v1/start → RunResultStart (start, 202)
19
19
  * GET /v1/runs/{pipeline_run_id}/status → RunRead (status, self-healing)
20
- * GET /v1/runs/{pipeline_run_id}/results → 202 / 200 / 409 (results)
20
+ * GET /v1/runs/{pipeline_run_id}/results → 202 / 200 / 409 (results; `?artifacts=` narrows it)
21
21
  */
22
22
  /**
23
23
  * Hosted run lifecycle status. Mirrors `pipelex_shared.schemas.run.RunStatus`
@@ -122,16 +122,50 @@ export interface TokensUsageRecord {
122
122
  /** Legacy fields on a pre-contract artifact relayed verbatim (`job_metadata`, `unit_costs`). */
123
123
  [extension: string]: unknown;
124
124
  }
125
+ /**
126
+ * The result artifacts a results read can be narrowed to, in the platform's order. Passing some
127
+ * of them as `artifacts` to `getRunResult` (or `waitForResult` / `startAndWaitForResult`) sends
128
+ * `?artifacts=` and the platform reads, re-signs and returns only those. `tokens_usages` brings
129
+ * `usage_assembly_error` with it.
130
+ */
131
+ export declare const RUN_RESULT_ARTIFACTS: readonly ["graph_spec", "pipe_io_contracts", "input_form", "output_form", "main_stuff", "working_memory", "tokens_usages"];
132
+ /** One result artifact a results read can be narrowed to — see `RUN_RESULT_ARTIFACTS`. */
133
+ export type RunResultArtifact = (typeof RUN_RESULT_ARTIFACTS)[number];
134
+ /**
135
+ * Refuse an artifact selection the platform would answer with a 400: an empty one, or one naming
136
+ * an artifact it does not know. `undefined` is no selection, which reads every artifact.
137
+ */
138
+ export declare function assertArtifactSelection(artifacts: readonly string[] | undefined): void;
139
+ /** Whether a results read with this selection carries `main_stuff` — no selection reads all. */
140
+ export declare function selectionIncludesMainStuff(artifacts: readonly RunResultArtifact[] | undefined): boolean;
141
+ /** `getRunResult` options. */
142
+ export interface GetRunResultOptions {
143
+ /** Abort the read. */
144
+ signal?: AbortSignal;
145
+ /**
146
+ * Read only these artifacts, sent as one comma-separated `?artifacts=` parameter. Omitted, the
147
+ * read returns every artifact. With a selection, an unselected artifact is ABSENT from the
148
+ * result (`undefined`), while a selected one the run never wrote is `null`. An empty selection
149
+ * or an unknown name is a `RangeError` before any request.
150
+ */
151
+ artifacts?: readonly RunResultArtifact[];
152
+ }
125
153
  /**
126
154
  * Result artifacts for a completed run — `GET /v1/runs/{pipeline_run_id}/results`.
127
155
  *
156
+ * **Absent versus null.** A read narrowed with `artifacts` carries only the artifacts it named: an
157
+ * unselected artifact is absent (`undefined`), a selected one the run did not write is `null`.
158
+ * Without a selection every artifact field is present on the hosted path. So `undefined` means
159
+ * "not asked for" and `null` means "asked for, not there".
160
+ *
128
161
  * `main_stuff` is the resolved main output content and is ALWAYS present for a
129
162
  * completed run (the pipelex >= 0.37 main-stuff invariant): on the hosted path it
130
163
  * is the `main_stuff.json` S3 artifact relayed verbatim; on the bare-runner blocking
131
164
  * path the SDK resolves it from the returned working memory via the run's
132
165
  * `main_stuff_name`, so both paths deliver the same content shape. Consumers read
133
166
  * `main_stuff` directly — no shape-guessing. A completed run that cannot deliver a
134
- * main stuff throws `MissingMainStuffError`.
167
+ * main stuff throws `MissingMainStuffError` — when the read asked for it, which a read with no
168
+ * selection does.
135
169
  */
136
170
  export interface RunResults {
137
171
  pipeline_run_id: string;
@@ -140,9 +174,10 @@ export interface RunResults {
140
174
  * because the content is polymorphic: a structured output is an object of the concept's fields,
141
175
  * a multiple output the envelope `{ items: [...] }` the runtime's `ListContent` serialises to,
142
176
  * and a native is wrapped too (`{ text }`, `{ number }`). It may be a valid empty value — an
143
- * empty `items`, an empty `text` — but it is never absent. See `docs/run-results.md`.
177
+ * empty `items`, an empty `text` — but it is never null. It is absent only from a read whose
178
+ * `artifacts` selection left it out. See `docs/run-results.md`.
144
179
  */
145
- main_stuff: unknown;
180
+ main_stuff?: unknown;
146
181
  /**
147
182
  * The run's working memory — every named stuff of the run (`{ root, aliases }`), the inputs it
148
183
  * was given and the intermediates it produced as well as the main output, each stuff carried as
@@ -283,13 +318,18 @@ export interface WaitForResultOptions {
283
318
  attempt: number;
284
319
  elapsedMs: number;
285
320
  }) => void;
321
+ /**
322
+ * Read only these result artifacts on each poll — `getRunResult`'s `artifacts`. The 202 a
323
+ * running run answers carries nothing, so the selection only shapes the completed result.
324
+ * `startAndWaitForResult`'s blocking fallback on a bare runner ignores it and returns every
325
+ * artifact the runner sent.
326
+ */
327
+ artifacts?: readonly RunResultArtifact[];
286
328
  }
287
329
  export declare const DEFAULT_POLL_INTERVAL_MS = 2000;
288
330
  export declare const DEFAULT_WAIT_TIMEOUT_MS = 1200000;
289
331
  /** A single result lookup — the primitive the poll loop drives. */
290
- export type FetchResultOnce = (runId: string, options?: {
291
- signal?: AbortSignal;
292
- }) => Promise<RunResultState>;
332
+ export type FetchResultOnce = (runId: string, options?: GetRunResultOptions) => Promise<RunResultState>;
293
333
  /**
294
334
  * Refuse wait options no poll loop can honour. A NaN would reach the sleep's timer as a
295
335
  * 1 ms delay and poll in a tight loop. `startAndWaitForResult` calls this before it starts
package/dist/runs.js CHANGED
@@ -15,6 +15,44 @@ export function isTerminalRunStatus(status) {
15
15
  export function isSuccessRunStatus(status) {
16
16
  return status === "COMPLETED";
17
17
  }
18
+ // ── Results artifact selection ───────────────────────────────────
19
+ /**
20
+ * The result artifacts a results read can be narrowed to, in the platform's order. Passing some
21
+ * of them as `artifacts` to `getRunResult` (or `waitForResult` / `startAndWaitForResult`) sends
22
+ * `?artifacts=` and the platform reads, re-signs and returns only those. `tokens_usages` brings
23
+ * `usage_assembly_error` with it.
24
+ */
25
+ export const RUN_RESULT_ARTIFACTS = [
26
+ "graph_spec",
27
+ "pipe_io_contracts",
28
+ "input_form",
29
+ "output_form",
30
+ "main_stuff",
31
+ "working_memory",
32
+ "tokens_usages",
33
+ ];
34
+ /**
35
+ * Refuse an artifact selection the platform would answer with a 400: an empty one, or one naming
36
+ * an artifact it does not know. `undefined` is no selection, which reads every artifact.
37
+ */
38
+ export function assertArtifactSelection(artifacts) {
39
+ if (artifacts === undefined)
40
+ return;
41
+ if (!Array.isArray(artifacts) || artifacts.length === 0) {
42
+ throw new RangeError(`"artifacts" must name one or more of ${RUN_RESULT_ARTIFACTS.join(", ")}; omit it to read ` +
43
+ "every artifact.");
44
+ }
45
+ const known = RUN_RESULT_ARTIFACTS;
46
+ const unknown = artifacts.filter((name) => !known.includes(name));
47
+ if (unknown.length > 0) {
48
+ throw new RangeError(`Unknown result artifact(s) ${unknown.join(", ")}; valid artifacts are: ` +
49
+ `${RUN_RESULT_ARTIFACTS.join(", ")}.`);
50
+ }
51
+ }
52
+ /** Whether a results read with this selection carries `main_stuff` — no selection reads all. */
53
+ export function selectionIncludesMainStuff(artifacts) {
54
+ return artifacts === undefined || artifacts.includes("main_stuff");
55
+ }
18
56
  // ── Poll loop ───────────────────────────────────────────────────────
19
57
  export const DEFAULT_POLL_INTERVAL_MS = 2_000;
20
58
  export const DEFAULT_WAIT_TIMEOUT_MS = 1_200_000; // 20 min — matches the runner's blocking execute ceiling.
@@ -29,6 +67,7 @@ export function assertWaitOptions(options = {}) {
29
67
  throw new RangeError(`"intervalMs" and "timeoutMs" must be numbers, got ${String(intervalMs)} and ` +
30
68
  `${String(timeoutMs)}.`);
31
69
  }
70
+ assertArtifactSelection(options.artifacts);
32
71
  }
33
72
  /**
34
73
  * Poll a single-shot result lookup (`fetchOnce`) until the run reaches a
@@ -55,7 +94,9 @@ export async function pollUntilResult(fetchOnce, runId, options = {}) {
55
94
  if (elapsedMs >= timeoutMs) {
56
95
  throw new RunTimeoutError(`Run ${runId} did not reach a terminal state within ${timeoutMs}ms.`, runId, timeoutMs);
57
96
  }
58
- const state = await fetchOnce(runId, { signal: options.signal });
97
+ const state = await fetchOnce(runId, options.artifacts === undefined
98
+ ? { signal: options.signal }
99
+ : { signal: options.signal, artifacts: options.artifacts });
59
100
  if (state.state === "completed") {
60
101
  return state.result;
61
102
  }
package/dist/runs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"runs.js","sourceRoot":"","sources":["../src/runs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAyCjD,MAAM,qBAAqB,GAA2B,IAAI,GAAG,CAAY;IACvE,WAAW;IACX,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,WAAW;CACZ,CAAC,CAAC;AAEH,6EAA6E;AAC7E,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,OAAO,qBAAqB,CAAC,GAA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C,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/version.d.ts CHANGED
@@ -3,4 +3,4 @@
3
3
  * `User-Agent` without importing the public barrel. Kept in sync with
4
4
  * `package.json` — enforced by `tests/index.test.ts`.
5
5
  */
6
- export declare const SDK_VERSION = "0.26.0";
6
+ export declare const SDK_VERSION = "0.28.0";
package/dist/version.js CHANGED
@@ -3,5 +3,5 @@
3
3
  * `User-Agent` without importing the public barrel. Kept in sync with
4
4
  * `package.json` — enforced by `tests/index.test.ts`.
5
5
  */
6
- export const SDK_VERSION = "0.26.0";
6
+ export const SDK_VERSION = "0.28.0";
7
7
  //# sourceMappingURL=version.js.map