@pipelex/sdk 0.64.0 → 0.66.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.
- package/README.md +17 -1
- package/dist/cli/script.d.ts +1 -1
- package/dist/client.d.ts +233 -9
- package/dist/client.js +325 -24
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js.map +1 -1
- package/dist/method-layouts.d.ts +51 -20
- package/dist/method-layouts.js +23 -17
- package/dist/method-layouts.js.map +1 -1
- package/dist/method-showcases.d.ts +169 -0
- package/dist/method-showcases.js +139 -0
- package/dist/method-showcases.js.map +1 -0
- package/dist/product-models.d.ts +37 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +4 -2
- package/docs/errors.md +1 -1
- package/docs/method-copy.md +1 -1
- package/docs/method-examples.md +1 -0
- package/docs/method-layouts.md +52 -9
- package/docs/method-showcases.md +100 -0
- package/docs/public-methods.md +1 -0
- package/package.json +1 -1
package/docs/architecture.md
CHANGED
|
@@ -117,7 +117,8 @@ Flat `src/` (mirrors `mthds-js`'s `runners/api` flatness — the SDK has one cli
|
|
|
117
117
|
- `client.ts` — `PipelexApiClient`: the `request()` pipeline (auth, base URL, timeouts/abort, problem-details parsing) and every route. It implements the standard's `MTHDSProtocol<DictPipeOutput>` for every route but `validate`, so the protocol-execution methods stay shaped like the standard: `validate` answers Pipelex's own verdict, `PipelexValidationResult`, because the hosted plane still sends the verdict that predates the protocol's problem items, where the standard's `ValidationResult` lists them.
|
|
118
118
|
- `models.ts` — Dict-serialized concretes (`DictStuff` / `DictWorkingMemory` / `DictPipeOutput` / `DictRunResultExecute`), the `/v1/validate` surface (`PipelexValidationResult`, whose two arms are declared whole rather than as narrowings of the standard's `ValidationResult`, listing their faults and warnings as the standard's `ProblemItem`, with its `SuggestedFix` and `FixOp`, see [errors.md](./errors.md#a-verdicts-problem-items)), the tools surface (`Diagnostic` / `LintResponse` / `FormatResponse`), and the crate-route request/response models — the shared `CrateRequestBase` / `CrateInvalidReport` vocabulary plus the `/v1/resolve`, `/v1/codegen` and `/v1/pipe-io` shapes built on it, `GeneratedArtifact` among them.
|
|
119
119
|
- `product-models.ts` — the snake_case wire shapes for the hosted-product management routes (profile, methods catalog, organizations, billing, API keys, onboarding, storage, an organization's files, runs list/detail/update). Each interface models only the fields the product actually consumes — no speculative mirrors.
|
|
120
|
-
- `method-layouts.ts` — a method's stored layouts: `MethodLayoutInput` and `LayoutProvenanceInput`, the write `storeMethodLayout` sends, `MethodLayout` and `LayoutProvenance`, what the platform stores, answers and carries on a validate's `layouts`, and the reader
|
|
120
|
+
- `method-layouts.ts` — a method's stored layouts: `MethodLayoutInput` and `LayoutProvenanceInput`, the write `storeMethodLayout` sends, `MethodLayout` and `LayoutProvenance`, what the platform stores, answers and carries on a validate's `layouts`, `MethodLayoutList`, what `listMethodLayouts` answers, and the reader they all go through, `readMethodLayout` (with `methodLayoutFault`, which names the member an unreadable layout breaks, and `readMethodLayouts`, which reads a list of layouts entry by entry). It imports the plain-object guard of `records.ts` and nothing else. The Python twin is `pipelex_sdk/method_layout_models.py`. See [method-layouts.md](./method-layouts.md).
|
|
121
|
+
- `method-showcases.ts` — a method's showcases: `MethodShowcaseInput`, the freeze `freezeMethodShowcase` sends, `MethodShowcaseSummary`, `MethodShowcaseDetail`, its document and its files, what the holder's and a version's reads answer, `MethodShowcaseFreezeResult`, the freeze's verdict, and the readers they go through: `readMethodShowcaseSummaries`, which reads a list of showcases entry by entry, and `methodShowcaseDetailFault` and `methodShowcaseFreezeFault`, which hold a detail and a verdict whole. It imports the plain-object guard of `records.ts` and the standard's form types. The Python twin is `pipelex_sdk/method_showcase_models.py`. See [method-showcases.md](./method-showcases.md).
|
|
121
122
|
- `answer-reading.ts` — `readHostedAnswer`, the reading of an answer that is not the route's result as its problem: a problem document as received, and an answer whose body is none, the hosted edge's, a gateway's or a proxy's, by its status, `client.outcome_unknown` for a start or an execute that may have created a run; and `outcomeUnknownProblem`. `ApiResponseError` reads every answer through it. The Python twin is `pipelex_sdk/answer_reading.py`. See [errors.md](./errors.md#an-answer-that-is-no-problem-document).
|
|
122
123
|
- `transport-reading.ts` — `requestMayHaveLeft`, the **pure** reading of whether a request that got no answer may have left this machine, every failure counting unless it proves nothing was sent (a failure of the connection's set-up). `ApiUnreachableError` applies it on a start or an execute, which the client marks with `mayStartRun`, to read the failure as `client.unreachable` or `client.outcome_unknown`. The Python twin is `pipelex_sdk/transport_reading.py`. See [errors.md](./errors.md#a-run-that-may-have-started--outcome_unknown).
|
|
123
124
|
- `problem-items.ts` — `readProblemItems`, the reading of a verdict's `errors` and `warnings` as the standard's problem items, member by member, so one malformed member never costs the caller its fault. The Python twin is `pipelex_sdk/problem_items.py`. See [errors.md](./errors.md#a-verdicts-problem-items).
|
|
@@ -162,7 +163,8 @@ The hosted catalog/account routes the webapp drives. All ride the same `{base}/v
|
|
|
162
163
|
- **Method examples:** `createMethodExample`, `listMethodExamples`, `iterateMethodExamples`, `getMethodExample`, `updateMethodExample`, `recordMethodExampleLatestRun`, `saveAssistantMethodExample`, `deleteMethodExample`, on `/v1/methods/{id}/examples`. An example is a named set of inputs saved on a method, shared across the organization, with an `input_revision` that rises each time its inputs change and the `latest_run_id` of those inputs, which an inputs edit clears. `recordMethodExampleLatestRun` records a run against the revision whose inputs it used and answers a `MethodExampleLatestRunResult` discriminated on `outcome`, `recorded` or `stale`, each arm carrying the `example`: a run that outlasted an edit is a verdict, never thrown, and an answer off the union is one the SDK cannot read; `saveAssistantMethodExample` is the build assistant's save, which writes into the example it names only while that example is still the assistant's (`kept_by_assistant`) at the revision it read, and otherwise creates one, answering a `MethodExampleAssistantSaveResult` discriminated on `outcome`, `kept` or `created`; one helper, `readVerdict`, reads these verdicts and `publishMethod`'s, the example checked once, by the reader every example goes through. Every answer carrying an example is read with `parseExactJson` and every request body written with `stringifyExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the inputs reads as a `bigint` and goes back digit for digit, to an edit or as a run's inputs; `3.0` still reads as `3`, and inputs holding one sent back unchanged are an edit for the platform, which compares inputs as canonical JSON. Every example the client hands back, the page rows and the verdict's `example` included, is checked by `readMethodExample` against the fields the Python SDK's model requires, with the strict types it holds them to, an example breaking one being an answer the SDK cannot read. The list is paged oldest first by an opaque cursor, and a page may be short while `nextCursor` is set; `iterateMethodExamples` follows it through the loop `iterateMethods` and `iterateRuns` share, and refuses a method id at the call rather than at the first pull. Every method takes a bare catalog id, and the client refuses an example id that is empty, `.` or `..` or holds a lone surrogate, a create without its name or inputs or whose `run_id` is given but empty, an edit naming neither `name` nor `inputs`, and a latest-run write without a run id or a positive integer revision before sending. See [method-examples.md](./method-examples.md).
|
|
163
164
|
- **Template catalog:** `listMethodTemplates`, `iterateMethodTemplates`, on `GET /v1/method-templates`, and `listMethodCategories`, on `GET /v1/method-categories`. The public methods of the deployment's templates organization, in the order the platform serves for the `ordering` asked for, filtered by `category`, with the page's `categories` and each card's thumbnails behind short-lived links. `listMethodTemplates` reads the page with its own reader rather than `requestPage`, since its `ordering` and `categories` sit beside `items` and `nextCursor`, and redacts the links of an answer it cannot read; `iterateMethodTemplates` follows the cursor with the same ordering and category. `listMethodCategories` reads the catalog's whole list of categories, which an admin of the platform keeps, in its order. Both check each category with one reader, `methodCategoriesFault`: a string `slug` and `label`, and `labels`, an object of strings by language tag ([public-methods.md](./public-methods.md)).
|
|
164
165
|
- **Method copies:** `copyMethod`, on `/v1/methods/{id}/copy`. `copyMethod` makes a new, unpublished method in an organization the caller may change methods in, the method's own for a duplicate, holding the original's draft tree, its form inputs and its examples, the stored files they name copied into the destination, and answers a `MethodCopyResult` discriminated on `outcome`: `copied` with the copy as `method` and what was copied, or `refused` with the `references` of a bundle naming storage the destination cannot read or, in a duplicate, a file under the original's run files, which erasing the original would remove. The two arms carry different members, so the verdict is read by the copy itself rather than by `readVerdict`, which reads verdicts whose arms share one: an `outcome` off the union, a `copied` answer whose `method` is not an object and a `refused` one whose `references` is not an array are each an answer the SDK cannot read. Its body is closed, `destination_org_id` with `name` and `expected_draft_updated_at` when given, and its last argument takes an `idempotencyKey`, sent as the `Idempotency-Key` header through the same `requestRaw` option and the same `idempotencyKeyOf` check a start uses. Every method read carries `copied_from`, the original a copy names, `null` on a method created afresh. `MethodErrorCode` names the copy's own codes, `pipelex.org.not_found` and `pipelex.catalog.copy_too_large`, whose `limit` member is typed `MethodCopyLimit`. It takes a bare catalog id. See [method-copy.md](./method-copy.md).
|
|
165
|
-
- **Method
|
|
166
|
+
- **Method showcases:** `freezeMethodShowcase` and `listMethodShowcases`, on `/v1/methods/{id}/showcases`, `getMethodShowcase` and `withdrawMethodShowcase`, on `/v1/methods/{id}/showcases/{showcase_id}`, and `listMethodVersionShowcases` and `getMethodVersionShowcase`, on `/v1/methods/{id}/versions/{n}/showcases[/{showcase_id}]`. A showcase is a completed run frozen with a private copy of its files; the freeze answers a verdict discriminated on `outcome`, read open on `reason`, the lists are read entry by entry as a layout list is, and a detail is read whole with `parseExactJson` and any error's signed links redacted. The freeze's and the withdrawal's `idempotencyKey` goes through the same `idempotencyKeyOf` check. See [method-showcases.md](./method-showcases.md).
|
|
167
|
+
- **Method layouts:** `storeMethodLayout` and `listMethodLayouts`, on `/v1/methods/{id}/versions/{n}/layouts`, `listMethodDraftLayouts`, on `/v1/methods/{id}/draft/layouts`, `setMethodLayoutsOff`, on `/v1/methods/{id}/layouts-off`, and the `layouts` view of `validate`. A layout is a data file a producer designed for one pipe of a published version, which the platform stores keyed by the content it was designed for, `tree_digest`, `pipe_ref`, `catalog` and `prompt_hash`, a write of the same identity replacing it, and carries on every validate by `method_id` that names `layouts` and resolves the same tree. The write takes a bare catalog id and a positive integer version, refuses a layout or a provenance that is not an object before sending, and sends the closed body alone, its members listed once in `method-layouts.ts` (`LAYOUT_INPUT_MEMBERS`, `PROVENANCE_INPUT_MEMBERS`) and held to the input interfaces by `satisfies`, `sample_json` and each optional provenance member that is `null` or omitted left out; its last argument takes an `idempotencyKey` (`MethodLayoutWriteOptions`), sent as the `Idempotency-Key` header through the same `idempotencyKeyOf` check a start and a copy use, since a write sent again without one runs again, restamping the layout and applying the bound again; the platform's refusals (`422` `request.invalid` naming the member, `tree_digest` among them for a tree that is not the version's, `403` `auth.forbidden` for a runner, `404` `pipelex.catalog.not_found` naming the method or the version, `409` `pipelex.catalog.being_deleted`) are `ApiResponseError`s. One reader in `method-layouts.ts`, `readMethodLayout`, holds the write's answer and each entry of a report's `layouts` to the same rule, the six identity and payload members strings and the provenance an object with a string `producer` and `model`, its `seed` and `style` read as `null` and its `repair_rounds` as `0` when they do not fit; an answer breaking it is one the SDK cannot read, and an entry breaking it is left out of the report, a list left with none removed, so `layouts` is absent or holds at least one layout. `listMethodLayouts` reads the same list with no dry run, its `items` read entry by entry by that rule, and `setMethodLayoutsOff` writes the whole list of switched-off catalogs, an array or a `RequestArgumentError` before sending, its idempotency key sent as the write's is. See [method-layouts.md](./method-layouts.md).
|
|
166
168
|
- **Organizations:** `listMemberships`, `createOrganization`, `renameOrganization` (`PATCH`). Each membership carries the caller's `role_in_org`, an `OrgRole` (`admin`, `member` or `runner`) read open: a role a later platform adds arrives as its raw string, so a `switch` over it says what an unknown role does. The role is for display; what it may do is the platform's to decide, and a call refused to the caller's role is an `ApiResponseError`. The org "switch" is a WorkOS-session op (`/api/active-org`), not a `/v1` route — out of SDK scope.
|
|
167
169
|
- **Organization branding:** `getBranding` (`GET /v1/branding`, any role, web session or API key) and `updateOrganizationBranding` (`PATCH /v1/organizations/{org_id}/branding`, a write by the `admin` or the `member` role, never a `runner`) answer the same `OrganizationBranding`: the organization's name, its light and dark colour sets (`BrandingColors`), its square and wide logos (`LogoDescriptor`), its app `style` and `typeface`, and its read-only `white_label` entitlement, the last three read as `null`, `null` and `false` from a platform that predates them. The write's `OrganizationBrandingUpdate` sets a key given a value, clears a key given `null` and keeps a key left out; a refused field is named by its `location.field`, a colour by its dotted key, a logo by its slot in `ApiResponseError.errors` with a `LogoRefusalCode` when the platform measured it. See [organization-branding.md](./organization-branding.md).
|
|
168
170
|
- **Caller webhooks:** `listRunWebhookDeliveries`, `getRunWebhookDelivery` and `replayRunWebhookDelivery`, on `/v1/runs/{id}/webhook-deliveries`, `/v1/runs/{id}/webhook-deliveries/{delivery_id}` and its `/replay`, read a run's delivery log and send a settled delivery again, any member by web session or API key, the replay taking an `idempotencyKey` under which the platform stores its answer; `getWebhookSecret`, on `GET /v1/organizations/{org_id}/webhook-secret`, and `rotateWebhookSecret`, on `POST /v1/organizations/{org_id}/webhook-secret/rotate`, read and rotate the organization's signing secret, an admin's routes from a web session only, the rotation taking an `idempotencyKey` the platform never replays. See [webhooks.md](./webhooks.md).
|
package/docs/errors.md
CHANGED
|
@@ -96,7 +96,7 @@ What the hosted API answers a start sent under a key:
|
|
|
96
96
|
|
|
97
97
|
**A copy takes a key too.** `copyMethod` sends an `idempotencyKey` the same way, held to the same rule, and the hosted API keeps it for the same 24 hours, scoped to the caller and the method's organization. A copy binds no run, so its answers under a key differ from a start's: [method-copy.md](./method-copy.md#retrying-a-copy--idempotencykey) gives them.
|
|
98
98
|
|
|
99
|
-
**And a layout write.** `storeMethodLayout` sends an `idempotencyKey` the same way, held to the same rule. A write sent again without one runs again, restamping the layout and applying the bound of layouts a content keeps again, so a write whose answer was lost is sent again under the key it was first sent with, which answers it as the first write was answered: [method-layouts.md](./method-layouts.md#storing-a-layout) gives the answers.
|
|
99
|
+
**And a layout write.** `storeMethodLayout` sends an `idempotencyKey` the same way, held to the same rule. A write sent again without one runs again, restamping the layout and applying the bound of layouts a content keeps again, so a write whose answer was lost is sent again under the key it was first sent with, which answers it as the first write was answered: [method-layouts.md](./method-layouts.md#storing-a-layout) gives the answers. `setMethodLayoutsOff` takes a key by the same rule, since a write of the whole list sent again undoes a switch that landed in between. `freezeMethodShowcase` and `withdrawMethodShowcase` take one as well, by the same rule, which matters most to a withdrawal, since one sent again without a key answers a `404` ([method-showcases.md](./method-showcases.md#withdrawing-a-showcase)).
|
|
100
100
|
|
|
101
101
|
**So do a secret rotation and a delivery replay.** `rotateWebhookSecret` and `replayRunWebhookDelivery` send an `idempotencyKey` the same way, held to the same rule. A rotation's answer carries a secret, so the platform never replays it, while a replay's stored answer is given again: [webhooks.md](./webhooks.md) gives both.
|
|
102
102
|
|
package/docs/method-copy.md
CHANGED
|
@@ -59,7 +59,7 @@ The answer is a `200` discriminated on `outcome`, as `publishMethod`'s is, becau
|
|
|
59
59
|
|
|
60
60
|
| `outcome` | Members | When |
|
|
61
61
|
|---|---|---|
|
|
62
|
-
| `copied` | `method`, the copy, a `MethodData` with its `copied_from`; `examples_copied`; `stored_files_copied` | The copy exists in the destination. |
|
|
62
|
+
| `copied` | `method`, the copy, a `MethodData` with its `copied_from`; `examples_copied`; `stored_files_copied`; `showcases_copied` and `layouts_copied`, reserved and `0` for now, absent from a platform that predates them, which means none ([method-showcases.md](./method-showcases.md#fields-reserved-for-later)) | The copy exists in the destination. |
|
|
63
63
|
| `refused` | `reason`, `bundle_names_other_storage`; `message`, a sentence for a person; `references`, every `{ path, uri }` the destination cannot read and, in a duplicate, every one under the original's run files, ordered by path and then by reference | A `.mthds` file of the draft names a stored file outside the destination, which every run there would refuse, or, in a duplicate, a file under the original method's own run files, which erasing the original would remove. Nothing was written. |
|
|
64
64
|
|
|
65
65
|
**A duplicate is held to one more rule.** Every reference to the original's organization is one the destination can read, the original's storage being the destination's, but a reference under the original method's own run files, `pipelex-storage://<org_id>/<method_id>/…`, names a file one of the original's runs stored, and erasing the original sweeps those away: every run of the duplicate would then fail to fetch it. So such a reference is refused too, with the same verdict and the same reason, beside any the destination cannot read. It is the rule the copy's inputs follow: an input naming such a file is re-homed, while a bundle naming one is refused, since the platform rewrites a copy's inputs but never its bundles. Every other reference of the organization, an upload under its `assets/` or another method's run file, passes in a duplicate as it does for the original. A copy into another organization needs no such rule, since it already refuses every reference to the original's organization. The `message` says why for each kind of reference.
|
package/docs/method-examples.md
CHANGED
|
@@ -12,6 +12,7 @@ An **example** is a named set of inputs saved on a stored method, so the method
|
|
|
12
12
|
| `inputs` | A JSON object: the inputs as a run of the method takes them. The platform answers them exactly as they were saved; the client reads an integer past `Number.MAX_SAFE_INTEGER` as a `bigint` holding its exact digits and every other number as a double, so `3.0` reads as `3` ([below](#numbers-in-an-examples-inputs)). |
|
|
13
13
|
| `input_revision` | Starts at 1 and rises by one each time the inputs change. |
|
|
14
14
|
| `latest_run_id` | The latest run of the current inputs, or `null`. It may name a run deleted since, whose read then answers `404`. |
|
|
15
|
+
| `showcase_id` | The showcase frozen from the example's latest run, or `null`. Reserved: the platform answers `null` for now, and clears it with `latest_run_id` when the inputs change. A platform that predates it leaves it out, which means none ([method-showcases.md](./method-showcases.md#fields-reserved-for-later)). |
|
|
15
16
|
| `created_by_user_id`, `created_at`, `updated_at` | Who saved it, when, and when it last changed. |
|
|
16
17
|
| `kept_by_assistant` | Whether the build assistant keeps this example's inputs current with its test inputs: `true` on an example the assistant's save created, `false` on every other, and `false` from the first inputs change a person makes. A rename leaves it as it is ([below](#the-build-assistants-example)). |
|
|
17
18
|
|
package/docs/method-layouts.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# A method's stored layouts
|
|
2
2
|
|
|
3
|
-
A **layout** is a data file a producer designed for one pipe of a method: a tree of elements written in the vocabulary of a catalog of components, every value bound to a path in the host's form state, carrying no field descriptions and no data of its own. A host renders it over the input-form descriptor the same method's validate projects, and renders the plain form instead whenever it cannot. The hosted platform stores layouts beside a method's published versions and hands them back on the
|
|
3
|
+
A **layout** is a data file a producer designed for one pipe of a method: a tree of elements written in the vocabulary of a catalog of components, every value bound to a path in the host's form state, carrying no field descriptions and no data of its own. A host renders it over the input-form descriptor the same method's validate projects, and renders the plain form instead whenever it cannot. The hosted platform stores layouts beside a method's published versions and hands them back, on a direct read by the version or on a validate of the method by id, so a method laid out once opens with its layout for everyone who opens it. It never produces a layout, never parses one and never judges one against a catalog or a descriptor: that is the producer's work before the write and the host's before it renders.
|
|
4
4
|
|
|
5
|
-
The client reaches the write on the hosted API's `POST /v1/methods/{method_id}/versions/{version}/layouts`
|
|
5
|
+
The client reaches the write on the hosted API's `POST /v1/methods/{method_id}/versions/{version}/layouts`, the direct read on `GET` of the same route, the read of the draft's layouts on `GET /v1/methods/{method_id}/draft/layouts`, the read through `POST /v1/validate` under the `layouts` view, and the off switch on `PUT /v1/methods/{method_id}/layouts-off`. The types are in `src/method-layouts.ts`, exported from the package's root: `MethodLayoutInput` and `LayoutProvenanceInput` for the write, `MethodLayout` and `LayoutProvenance` for what is stored, and `MethodLayoutList` for the direct read. The storage and the `layouts` token are a Pipelex hosted feature; the shapes are stated brand-neutrally, snake_case with no `pipelex_` prefix, as the input-form descriptor they are rendered over is. The conformance spec `pipelex-hosted-method-layouts.md`, in the workspace's `conformance` repository, states the contract.
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
import { PipelexApiClient } from "@pipelex/sdk";
|
|
@@ -54,6 +54,7 @@ if (report.is_valid) {
|
|
|
54
54
|
| `jsonl` | The layout itself, as the producer's model emitted it: JSON patch lines, one per line, carried as one string exactly as written. |
|
|
55
55
|
| `provenance` | How it was made: `producer`, `model`, `seed`, `style` and `repair_rounds` (below). |
|
|
56
56
|
| `stored_at` | The moment the write landed, ISO 8601 in UTC. The one member the platform sets, absent from the write. |
|
|
57
|
+
| `sample_json` | A written sample of the result the layout was designed over, one JSON text, or `null` when none was stored (see [The written sample](#the-written-sample)). |
|
|
57
58
|
|
|
58
59
|
| `provenance` member | Meaning |
|
|
59
60
|
|---|---|
|
|
@@ -63,7 +64,7 @@ if (report.is_valid) {
|
|
|
63
64
|
| `style` | The id of the app style the layout was designed under, such as `editorial`, or `null` when it was designed under none. The platform holds it to the shape `^[a-z0-9-]{1,32}$` and never to a list of styles, so a host reads an id it does not know as no style. |
|
|
64
65
|
| `repair_rounds` | How many repair rounds the producer ran before the layout validated against its catalog. |
|
|
65
66
|
|
|
66
|
-
**A layout belongs to the content it was designed for, never to a version number.** Its identity is `tree_digest`, `pipe_ref`, `catalog` and `prompt_hash` within one method, and it names no method and no version. It is written against a published version, and served for whatever selector of that method resolves the same tree: the version it was written against, a later version that holds the same tree, or the draft while it holds it. The same tree saved as another method carries none of it, and a copy of a method takes no layout.
|
|
67
|
+
**A layout belongs to the content it was designed for, never to a version number.** Its identity is `tree_digest`, `pipe_ref`, `catalog` and `prompt_hash` within one method, and it names no method and no version. It is written against a published version, and served for whatever selector of that method resolves the same tree: the version it was written against, a later version that holds the same tree, or the draft while it holds it. A publish that writes a new version also carries the previous version's layouts forward, each copied under the new tree as it stood, so a design follows the method; a host's checks decide whether one still fits. The same tree saved as another method carries none of it, and a copy of a method takes no layout.
|
|
67
68
|
|
|
68
69
|
## Storing a layout
|
|
69
70
|
|
|
@@ -73,11 +74,11 @@ if (report.is_valid) {
|
|
|
73
74
|
|
|
74
75
|
It takes a bare catalog id, as every method route does, and refuses a suffixed one (`mt_…@3`) with a `RequestArgumentError` before anything is sent; `version` is the number of the published version the layout was designed for, and a value that is not a positive integer is refused the same way.
|
|
75
76
|
|
|
76
|
-
**The body is closed at both levels.** The client sends `tree_digest`, `pipe_ref`, `catalog`, `prompt_hash`, `jsonl` and `provenance` with its `producer` and `model`, and `seed`, `style` and `repair_rounds` when each is given and not `null`, and nothing else. A layout read back can be passed as it is: its `stored_at` is left out. A layout or a provenance that is not an object is refused with a `RequestArgumentError` before any request; every other member is sent as given, and the platform holds it to its shape.
|
|
77
|
+
**The body is closed at both levels.** The client sends `tree_digest`, `pipe_ref`, `catalog`, `prompt_hash`, `jsonl` and `provenance` with its `producer` and `model`, and `sample_json` and the provenance's `seed`, `style` and `repair_rounds` when each is given and not `null`, and nothing else. A layout read back can be passed as it is: its `stored_at` is left out. A layout or a provenance that is not an object is refused with a `RequestArgumentError` before any request; every other member is sent as given, and the platform holds it to its shape.
|
|
77
78
|
|
|
78
79
|
**`tree_digest` must be the tree the version holds**, its `MethodVersionSummary.tree_digest`, which `getMethodVersion` and `listMethodVersions` read: a producer designs over the descriptor of the version it was handed, so a layout stating another tree describes content the version does not hold, and is refused.
|
|
79
80
|
|
|
80
|
-
**A write of the same identity replaces the layout
|
|
81
|
+
**A write of the same identity replaces the layout**, its sample included, so a write that sends no `sample_json` stores none. The answer is the same `200` whether the write stored a new layout or replaced one, and the replaced layout is carried no more.
|
|
81
82
|
|
|
82
83
|
**A write is sent again under its idempotency key.** `options.idempotencyKey` (`MethodLayoutWriteOptions`) is sent as the `Idempotency-Key` header, and nothing is sent when it is absent or `null`. Under the same key the hosted API answers a retry with the first write's stored answer and runs nothing, so a write whose answer was lost, on a client timeout for instance, is sent again unchanged under the key it was first sent with. Without a key the write runs again: it stamps the layout with a new `stored_at`, which moves it ahead of every layout stored since in the newest-first order, and applies the bound below again, so when another producer stored a newer prompt of the same pipe and catalog meanwhile, the resent layout can come back ahead of it and, at the bound, that newer layout can be the one removed. Generate one key per layout to store, a `crypto.randomUUID()` for instance. The write's `200` and its `4xx` refusals are stored under the key alike; a `5xx` and a refusal for its timing (a `408`, `425` or `429`) are not, so the same key sends the write afresh, and neither are the key's own `409` answers below, so a retry after `request.idempotency_key_in_use` runs as the key's first request would. A key is 1 to 255 visible ASCII characters, and anything else is a `RequestArgumentError` before any request.
|
|
83
84
|
|
|
@@ -85,13 +86,17 @@ It takes a bare catalog id, as every method route does, and refuses a suffixed o
|
|
|
85
86
|
|
|
86
87
|
**Who may write.** The write changes the method, so it takes the roles that change methods: an `admin` or a `member` of the method's organization. A `runner` is refused.
|
|
87
88
|
|
|
89
|
+
## The written sample
|
|
90
|
+
|
|
91
|
+
A designed result page needs something to draw before anyone has run the method, so a layout may carry a sample of its result: `sample_json`, one JSON text of at most 64 KiB of UTF-8, which the platform stores and never reads, refusing it on write when it does not parse. **Only a written sample belongs here, invented from the description of the result and holding no customer's data, never a run's output.** A layout's readers include the method's runners and, for a public method, other organizations, and since the platform never reads the sample, keeping that rule is the producer's. The client reads a `sample_json` that is missing or not a string as `null`, and hands the text back as it is: a host parses it and checks it itself.
|
|
92
|
+
|
|
88
93
|
## The refusals
|
|
89
94
|
|
|
90
95
|
Each is an `ApiResponseError` carrying the platform's problem, and none stores anything. Branch on its `code`, never on the status.
|
|
91
96
|
|
|
92
97
|
| Status | `code` | When |
|
|
93
98
|
|---|---|---|
|
|
94
|
-
| `422` | `request.invalid` | A member breaking its shape or bound, named in the problem's `params.field` and `location.field`, `provenance.<member>` for one of the provenance's: a missing member, a `tree_digest` that is not `sha256:` and 64 lowercase hexadecimal characters, a `pipe_ref` that is not a dotted reference or is over 256 characters, a `catalog` or `producer` that is not a slug, a `prompt_hash` that is not 12 to 64 lowercase hexadecimal digits, an empty `jsonl`, one over 128 KiB of UTF-8 or one holding a raw control character other than the tab, the line feed and the carriage return, a `model` that is empty, over 128 characters or holds a control character, a `seed` over 4,000 characters, a `style` off its shape, a `repair_rounds` outside 0 to 100, and a lone UTF-16 surrogate in `jsonl`, `model` or `
|
|
99
|
+
| `422` | `request.invalid` | A member breaking its shape or bound, named in the problem's `params.field` and `location.field`, `provenance.<member>` for one of the provenance's: a missing member, a `tree_digest` that is not `sha256:` and 64 lowercase hexadecimal characters, a `pipe_ref` that is not a dotted reference or is over 256 characters, a `catalog` or `producer` that is not a slug, a `prompt_hash` that is not 12 to 64 lowercase hexadecimal digits, an empty `jsonl`, one over 128 KiB of UTF-8 or one holding a raw control character other than the tab, the line feed and the carriage return, a `model` that is empty, over 128 characters or holds a control character, a `seed` over 4,000 characters, a `style` off its shape, a `repair_rounds` outside 0 to 100, a `sample_json` over 64 KiB of UTF-8 or that is no JSON text, and a lone UTF-16 surrogate in `jsonl`, `model`, `seed` or `sample_json`. |
|
|
95
100
|
| `422` | `request.invalid` naming `tree_digest` | `tree_digest` is not the digest of the tree the version holds. |
|
|
96
101
|
| `403` | `auth.forbidden` | A `runner`, or a caller with no recognised role; its `params.requirement` is `member`. |
|
|
97
102
|
| `404` | `pipelex.catalog.not_found` | No such method in the caller's organization, another organization's included, its `params.resource` `method`; or a version the method never published, its `params.resource` `version`. |
|
|
@@ -102,9 +107,47 @@ Each is an `ApiResponseError` carrying the platform's problem, and none stores a
|
|
|
102
107
|
|
|
103
108
|
An answer that does not read as a layout, one whose `tree_digest`, `pipe_ref`, `catalog`, `prompt_hash`, `jsonl` or `stored_at` is not a string, or whose `provenance` is not an object with a string `producer` and `model`, is an answer the SDK cannot read, thrown as an `ApiResponseError` coded `client.response_unreadable` whose message names the member.
|
|
104
109
|
|
|
110
|
+
## Reading a version's layouts
|
|
111
|
+
|
|
112
|
+
| Method | Route | Answer |
|
|
113
|
+
|---|---|---|
|
|
114
|
+
| `listMethodLayouts(methodId, version, options?)` | `GET /v1/methods/{id}/versions/{n}/layouts` | A `MethodLayoutList`, whose `items` are the layouts stored for the version's content, newest first, at most 16, empty when none is. |
|
|
115
|
+
|
|
116
|
+
This is what a host calls when it opens a method's page. It touches only the platform's database and calls no runner, where the `layouts` view below dry-runs every pipe of the method to return the same list. It takes a bare catalog id and a positive integer version, each refused with a `RequestArgumentError` before anything is sent, and `options.signal` cancels the read, for a page that can do without its layouts. A `runner` reads what it is shown, another organization's public method answers the layouts its builders stored, and the answer ignores `layouts_off`, which is the host's to honour.
|
|
117
|
+
|
|
118
|
+
Its refusals are `ApiResponseError`s: `404` `pipelex.catalog.not_found` for an unknown method, another organization's internal one (`params.resource` `method`) and a version never published (`params.resource` `version`); `409` `pipelex.catalog.being_deleted` during the erasure of the caller's own method; `500` `runtime.unexpected` for a version stored before methods were trees. `items` is read entry by entry, by the rule below, so an entry that does not read as a layout is left out; an answer whose `items` is not an array is one the SDK cannot read.
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
const { items } = await client.listMethodLayouts("mt_abc123", 3, {
|
|
122
|
+
signal: AbortSignal.timeout(5000),
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Reading the draft's layouts
|
|
127
|
+
|
|
128
|
+
| Method | Route | Returns |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| `listMethodDraftLayouts(methodId, options?)` | `GET /v1/methods/{id}/draft/layouts` | A `MethodLayoutList` of the layouts stored for the draft's content, newest first, `items` empty for an empty draft or a draft none was designed for. |
|
|
131
|
+
|
|
132
|
+
A layout is keyed by its content, so a draft holding a published tree finds that tree's layouts here, and a builder sees the designs of what it is editing. It reads for the organization that holds the method alone, since a draft is its holder's. It takes a bare catalog id, and `options.signal` cancels the read. The platform answers `404` `pipelex.catalog.not_found` for a method the organization does not hold, another organization's public one included, and `409` `pipelex.catalog.being_deleted` during its erasure.
|
|
133
|
+
|
|
134
|
+
## Switching a page's design off
|
|
135
|
+
|
|
136
|
+
A builder can turn a page's design off and on, per catalog, without losing it. The state is `layouts_off`, the catalog slugs whose layouts no host draws, read on `MethodData`, `MethodDetail` and `PublicMethodDetail` and absent from a platform that predates it, which means none.
|
|
137
|
+
|
|
138
|
+
| Method | Route | Answer |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| `setMethodLayoutsOff(methodId, catalogs, options?)` | `PUT /v1/methods/{id}/layouts-off` | The method, its `layouts_off` the list as held. |
|
|
141
|
+
|
|
142
|
+
`catalogs` is the whole list and replaces the one held, so changing one catalog means reading `layouts_off` and writing the new list; an empty list switches every design on. The switch acts at once with no publish and holds across every publish, and a layout switched off is kept: `listMethodLayouts` and the `layouts` view still answer it, and the host draws the plain page. Like a rename, the write never moves the draft token, so the `updated_at` a caller holds stays valid.
|
|
143
|
+
|
|
144
|
+
**The last write to land is the one held.** A write sent again without a key writes its list again, and so undoes a switch that landed in between. `options.idempotencyKey` (`MethodLayoutsOffOptions`) is sent as the `Idempotency-Key` header, so a write whose answer was lost is sent again under its key and answered as the first was, by the rule [a layout write](#storing-a-layout) follows.
|
|
145
|
+
|
|
146
|
+
A `catalogs` that is not an array is a `RequestArgumentError` before any request, and its entries are sent as given. The route's body is closed, and the platform answers: `422` `request.invalid` for more than 8 catalogs, a catalog named twice or one that is not a slug; `403` `auth.forbidden` for a `runner`; `404` `pipelex.catalog.not_found` for an unknown method or another organization's, a public one included; `409` `pipelex.catalog.being_deleted` during the erasure; and `413` `request.too_large` for a list that would leave the method too large to publish, which a list that does not grow never is, so switching a design back on is always reachable.
|
|
147
|
+
|
|
105
148
|
## Reading the layouts: the `layouts` view
|
|
106
149
|
|
|
107
|
-
A host
|
|
150
|
+
A host that is already validating the method can read its layouts on the same call, at the cost of the validate's dry run. A `validate` naming a stored method by `method_id` (`mt_…`, `mt_…@<n>` or `mt_…@draft`) and naming `layouts` among its `views` is answered, on the valid report, with `layouts`: every layout stored for the tree the selector resolved, newest first by `stored_at`, at most 16. Ask for `views: ["input_form", "layouts"]` to receive the descriptor and the layouts over it in one answer. `ValidateView` types the tokens this SDK knows, `input_form`, `output_form` and `layouts`, and `ValidateOptions.views` still takes any other token as its raw string.
|
|
108
151
|
|
|
109
152
|
The token rides the `views` list with that list's mechanics: the client sends it verbatim and only when asked, a runner that does not know it ignores it, and it never causes a `422`. The platform forwards `views` as sent and adds the member to the runner's answer.
|
|
110
153
|
|
|
@@ -116,9 +159,9 @@ The token rides the `views` list with that list's mechanics: the client sends it
|
|
|
116
159
|
- no layout is stored for the resolved tree;
|
|
117
160
|
- the platform could not read the stored layouts, which costs the validate nothing else.
|
|
118
161
|
|
|
119
|
-
A host therefore never reads an empty array. Publishing a version with another tree leaves the layouts of the old tree where they were
|
|
162
|
+
A host therefore never reads an empty array here. Publishing a version with another tree leaves the layouts of the old tree where they were, and the old version named by its number still carries them all; the new tree carries the copies the publish made of them. Another organization's public method carries the layouts its holder's builders stored.
|
|
120
163
|
|
|
121
|
-
**The client reads `layouts` entry by entry**, as it reads a verdict's problem items, so one layout it cannot read never costs the caller the verdict or the other layouts: an entry that does not read as a layout, by the rule the write's answer is held to, is left out, and a list left with none is removed. In each entry, a provenance `seed` or `style` that is missing or not a string reads as `null`, and a `repair_rounds` that is missing or not a non-negative integer reads as `0`, the platform's own defaults; the write's answer
|
|
164
|
+
**The client reads `layouts` entry by entry**, as it reads a verdict's problem items, so one layout it cannot read never costs the caller the verdict or the other layouts: an entry that does not read as a layout, by the rule the write's answer is held to, is left out, and a list left with none is removed. In each entry, a `sample_json` or a provenance `seed` or `style` that is missing or not a string reads as `null`, and a `repair_rounds` that is missing or not a non-negative integer reads as `0`, the platform's own defaults; the write's answer and the direct read's entries are read the same way.
|
|
122
165
|
|
|
123
166
|
**Discovery.** `GET /v1/version` lists `method_layouts` among its `extensions` once the platform stores layouts and carries the view. Without it, a validate answering no `layouts` cannot tell a method nobody laid out from a platform that ignores the token, so a host that does not find it offers no layout to produce, since the write would be refused, and renders the plain form. The SDK types no member for it: read it off `version()`, whose answer keeps every extension member as the server sent it.
|
|
124
167
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# A method's showcases
|
|
2
|
+
|
|
3
|
+
A **showcase** is a completed run of a method, frozen: its inputs, its main output, the forms and contracts that describe them, and a private copy of every stored file they name. It exists so that people can see what a method really produces without spending credit. It differs from what sits beside it: an **example** is the builder's private test bench, whose output is whatever its latest run left, and a **layout's written sample** is invented, while a showcase is real output that stays exactly as it was frozen.
|
|
4
|
+
|
|
5
|
+
The client reaches the hosted API's `POST` and `GET /v1/methods/{method_id}/showcases`, `GET` and `DELETE /v1/methods/{method_id}/showcases/{showcase_id}`, and `GET /v1/methods/{method_id}/versions/{version}/showcases[/{showcase_id}]`. The types are in `src/method-showcases.ts`, exported from the package's root. The platform's own account of the contract is `platform/docs/method-showcases.md` in `pipelex-server`. This page is the twin of `pipelex-sdk`'s `docs/method-showcases.md`.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { PipelexApiClient } from "@pipelex/sdk";
|
|
9
|
+
|
|
10
|
+
const client = new PipelexApiClient();
|
|
11
|
+
|
|
12
|
+
// A builder freezes a completed run of the draft, then publishes.
|
|
13
|
+
const verdict = await client.freezeMethodShowcase("mt_abc123", {
|
|
14
|
+
run_id: "run_1",
|
|
15
|
+
name: "March receipt",
|
|
16
|
+
});
|
|
17
|
+
switch (verdict.outcome) {
|
|
18
|
+
case "frozen":
|
|
19
|
+
case "unchanged":
|
|
20
|
+
console.log(verdict.showcase.showcase_id);
|
|
21
|
+
break;
|
|
22
|
+
case "refused":
|
|
23
|
+
console.log(verdict.reason, verdict.message);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Any reader of a published version, another organization's on a public method included.
|
|
28
|
+
const { items } = await client.listMethodVersionShowcases("mt_abc123", 3);
|
|
29
|
+
const detail = await client.getMethodVersionShowcase("mt_abc123", 3, items[0]!.showcase_id);
|
|
30
|
+
console.log(detail.document.main_stuff, detail.files.map((file) => file.file_name));
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Freezing a run
|
|
34
|
+
|
|
35
|
+
| Method | Route | Answer |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `freezeMethodShowcase(methodId, { run_id, name }, options?)` | `POST /v1/methods/{id}/showcases` | A `MethodShowcaseFreezeResult`, a `200` discriminated on `outcome` |
|
|
38
|
+
|
|
39
|
+
`run_id` is a run's `pipeline_run_id`. The body is closed, and the client sends these members and nothing else. Freezing precedes publishing: a builder freezes a run of the draft, so a showcase can exist before the version that shows it, and another organization reads one only through a published version holding its tree.
|
|
40
|
+
|
|
41
|
+
A run that cannot be frozen is a verdict about the run, not a failure of the request, so branch on `outcome`, never on the status:
|
|
42
|
+
|
|
43
|
+
| `outcome` | Members | When |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `frozen` | `showcase`, a new summary | The run was frozen. |
|
|
46
|
+
| `unchanged` | `showcase`, the one that stands | This run is already a showcase, whatever has happened to its tree since. Nothing is written, and the name in the request is ignored. |
|
|
47
|
+
| `refused` | `reason`, `message` | The run cannot be frozen, and nothing was written. |
|
|
48
|
+
|
|
49
|
+
| `reason` | When |
|
|
50
|
+
|---|---|
|
|
51
|
+
| `run_not_usable` | The run is not this method's in this organization, did not complete, kept no results (a blocking `execute` stores none), stored no output or forms, does not say which pipe it ran, or kept no record of inputs its pipe declares. |
|
|
52
|
+
| `tree_not_current` | The run's tree is neither the draft's nor the latest published version's, or the run records none. |
|
|
53
|
+
| `file_not_readable` | The document names a file that is gone or outside the organization, or holds a signed link the freeze could not rewrite. |
|
|
54
|
+
| `too_large` | A stored artifact of the run, the document, the number of files or their total size is past what one showcase holds. |
|
|
55
|
+
| `too_many` | The tree already holds as many showcases as one tree keeps. |
|
|
56
|
+
|
|
57
|
+
`reason` is read open, typed `MethodShowcaseRefusalReason | (string & {})`: a reason a later platform adds arrives as its raw string, still a verdict, so show its `message` when you do not handle it. An `outcome` that is none of these, a `showcase` that does not read as a summary, and a refusal whose `reason` or `message` is not a string are each an answer the SDK cannot read, thrown as an `ApiResponseError` coded `client.response_unreadable`.
|
|
58
|
+
|
|
59
|
+
**Who may freeze.** The write changes the method, so it takes an `admin` or a `member` of the method's organization; a `runner` is refused with `403` `auth.forbidden`. Other refusals are thrown as `ApiResponseError`: `404` `pipelex.catalog.not_found` for a method the organization does not hold, `409` `pipelex.catalog.being_deleted` during its erasure, `422` `request.invalid` for a body that does not validate, and `503` `runtime.unavailable`, with `retry` `yes`, past the freeze's deadline.
|
|
60
|
+
|
|
61
|
+
A `run_id` or a `name` that is not a non-empty string is a `RequestArgumentError` before any request. `options.idempotencyKey` is sent as the `Idempotency-Key` header. A freeze sent again without a key is safe in itself, since freezing a run already frozen answers `unchanged`.
|
|
62
|
+
|
|
63
|
+
## Withdrawing a showcase
|
|
64
|
+
|
|
65
|
+
| Method | Route | Answer |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `withdrawMethodShowcase(methodId, showcaseId, options?)` | `DELETE /v1/methods/{id}/showcases/{showcase_id}` | Nothing, on a `204` |
|
|
68
|
+
|
|
69
|
+
The row goes first, which closes every read at once, and then its stored document and files. It runs no check, even on a public method's last showcase, because taking down something published by mistake must never be refused; the method then stays public, and its next publish needs a showcase. What another organization already copied stays theirs.
|
|
70
|
+
|
|
71
|
+
A second withdrawal is a `404` `pipelex.catalog.not_found` with `params.resource` `example`, so a withdrawal whose answer was lost reads as a failure when sent again without a key. Send it under the same `options.idempotencyKey` and it is answered as the first was. A `runner` is refused with `403` `auth.forbidden`.
|
|
72
|
+
|
|
73
|
+
## Reading showcases
|
|
74
|
+
|
|
75
|
+
| Method | Route | Who | Answer |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| `listMethodVersionShowcases(methodId, version, options?)` | `GET /v1/methods/{id}/versions/{n}/showcases` | Every reader of the version | The showcases of the tree it holds, oldest first |
|
|
78
|
+
| `getMethodVersionShowcase(methodId, version, showcaseId, options?)` | `GET …/versions/{n}/showcases/{showcase_id}` | The same | One showcase in full |
|
|
79
|
+
| `listMethodShowcases(methodId, options?)` | `GET /v1/methods/{id}/showcases` | The holding organization's members alone | Every showcase across every tree, each naming its digest, oldest first |
|
|
80
|
+
| `getMethodShowcase(methodId, showcaseId, options?)` | `GET /v1/methods/{id}/showcases/{showcase_id}` | The same | One showcase in full |
|
|
81
|
+
|
|
82
|
+
**Another organization never reads a showcase of a tree no published version holds**: a version's read looks the showcase up under the digest that version names, and the holder's routes answer another organization a `404`, public method or not.
|
|
83
|
+
|
|
84
|
+
**A summary** (`MethodShowcaseSummary`) is `showcase_id`, `name`, `pipe_ref`, `tree_digest` and `frozen_at`. A list's `items` are read entry by entry, so an entry that does not read as a summary is left out, and an answer whose `items` is not an array is one the SDK cannot read.
|
|
85
|
+
|
|
86
|
+
**A detail** (`MethodShowcaseDetail`) adds `document` and `files`. `document` holds `inputs`, `main_stuff`, `input_form`, `output_form` and `pipe_io_contracts`, relayed as they were stored, and is read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` is a `bigint`. `files` lists `address`, `file_name`, `media_type`, `size_bytes` and `url` for every stored file the document names. A detail is held whole, unlike a list: one that breaks its shape, a `document` member left out or a `files` entry included, is an answer the SDK cannot read, thrown with its signed links redacted.
|
|
87
|
+
|
|
88
|
+
**A document never holds a signed link.** After a freeze, an image that was a stored link is an `src="pipelex-storage://…"` address, and a renderer replaces each address with the `url` of the matching entry of `files`. `url` is a short-lived presigned `GET` of the file's bytes: a bearer credential, which belongs on a server and never in a browser.
|
|
89
|
+
|
|
90
|
+
The refusals are thrown as `ApiResponseError`: `404` `pipelex.catalog.not_found` for an unknown method or another organization's internal one (`params.resource` `method`), a version never published (`params.resource` `version`), and a showcase the route does not hold (`params.resource` `example`, since the values of that parameter are the published registry's); `409` `pipelex.catalog.being_deleted` during the erasure of the caller's own method. A `version` that is not a positive integer and a showcase id that is empty, `.` or `..`, or holds a lone surrogate are refused with `RequestArgumentError` before any request. `options.signal` cancels a read.
|
|
91
|
+
|
|
92
|
+
## Fields reserved for later
|
|
93
|
+
|
|
94
|
+
The platform answers these, and nothing fills them yet, so that the SDKs are released once:
|
|
95
|
+
|
|
96
|
+
- `showcase_id` on an example (`MethodExample.showcase_id`), `null` for now, and cleared with `latest_run_id` when the inputs change. A platform that predates it leaves it out, which means none.
|
|
97
|
+
- `showcase_missing` on a publish's refusal (`MethodPublishRefused.reason`), which the platform states and does not raise yet.
|
|
98
|
+
- `showcases_copied` and `layouts_copied` on a copy's verdict (`MethodCopied`), which stay `0`. A platform that predates them leaves them out, which means none.
|
|
99
|
+
|
|
100
|
+
`GET /v1/version` lists `method_showcases` in its `extensions` when the platform serves these routes. The SDK types no field for it: read it off `version()`, as the [layouts' discovery](./method-layouts.md) does.
|
package/docs/public-methods.md
CHANGED
|
@@ -106,5 +106,6 @@ A public method's publish is held to more than any draft's, so that a template's
|
|
|
106
106
|
| `storage_reference` | A `.mthds` file of the draft names a `pipelex-storage://` file, which other organizations cannot read. |
|
|
107
107
|
| `thumbnail_missing` | The draft's tree holds no file directly under `thumbnails/`, or none was read within the publish's time; a retry may read them in time. |
|
|
108
108
|
| `thumbnail_invalid` | No file directly under `thumbnails/` is a valid thumbnail. |
|
|
109
|
+
| `showcase_missing` | The draft's tree holds no showcase for other organizations to look at. Reserved: the platform states it and does not raise it yet ([method-showcases.md](./method-showcases.md#fields-reserved-for-later)). |
|
|
109
110
|
|
|
110
111
|
Each is a verdict, a `200` with a `message` for a person and the runner's valid `validation`, never a thrown error. `MethodPublishRefused.reason` is read open, typed `MethodPublishRefusalReason | (string & {})`: a reason a later platform adds arrives as its raw string, still a verdict, so a client shows its `message` when it does not handle the reason. An internal method's publish never meets the reasons of this table. A method made public while its publish ran is a `503` with nothing written, safe to retry.
|