@pipelex/sdk 0.47.0 → 0.48.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 +8 -6
- package/dist/cli/script.d.ts +1 -1
- package/dist/cli/source.d.ts +8 -7
- package/dist/cli/source.js +11 -5
- package/dist/cli/source.js.map +1 -1
- package/dist/client.d.ts +321 -210
- package/dist/client.js +819 -514
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +5 -2
- package/dist/errors.js +5 -2
- package/dist/errors.js.map +1 -1
- package/dist/hooks/bundle-gather.d.ts +28 -40
- package/dist/hooks/bundle-gather.js +55 -230
- package/dist/hooks/bundle-gather.js.map +1 -1
- package/dist/hooks/claude-mthds-check.d.ts +7 -5
- package/dist/hooks/claude-mthds-check.js +8 -53
- package/dist/hooks/claude-mthds-check.js.map +1 -1
- package/dist/hooks/validate-stage.d.ts +27 -0
- package/dist/hooks/validate-stage.js +57 -0
- package/dist/hooks/validate-stage.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/method-trees.d.ts +208 -73
- package/dist/method-trees.js +221 -34
- package/dist/method-trees.js.map +1 -1
- package/dist/models.d.ts +162 -59
- package/dist/prepare-inputs.d.ts +46 -27
- package/dist/prepare-inputs.js +123 -42
- package/dist/prepare-inputs.js.map +1 -1
- package/dist/product-models.d.ts +14 -16
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +17 -18
- package/docs/cli.md +1 -1
- package/docs/crate-routes.md +42 -20
- package/docs/errors.md +5 -5
- package/docs/hook-bundle.md +1 -1
- package/docs/input-preparation.md +11 -11
- package/docs/method-trees.md +119 -21
- package/docs/run-results.md +5 -2
- package/package.json +2 -2
- package/dist/bundle-resources.d.ts +0 -62
- package/dist/bundle-resources.js +0 -165
- package/dist/bundle-resources.js.map +0 -1
- package/docs/bundle-resources.md +0 -107
package/dist/client.d.ts
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import type { MTHDSProtocol, ModelCategory, ModelDeck, RunOptions, StartOptions, VersionInfo } from "mthds/protocol";
|
|
2
|
-
import type { CodegenRequest, CodegenResponse, DictPipeOutput, FormatResponse, LintResponse, ModelCheckCategory, ModelReferenceVerdict, PipeIORequest, PipeIOResponse, PipelexRunResultStart, PipelexValidationResult, ResolveRequest, ResolveResponse, ValidateMethodSelector } from "./models.js";
|
|
2
|
+
import type { CodegenRequest, CodegenResponse, CrateRouteOptions, DictPipeOutput, FormatResponse, LintResponse, ModelCheckCategory, ModelReferenceVerdict, PipeIORequest, PipeIOResponse, PipelexRunResultStart, PipelexValidateSource, PipelexValidationResult, ResolveRequest, ResolveResponse, ValidateMethodSelector } from "./models.js";
|
|
3
3
|
import { type GetRunResultOptions, type RunProgress, type RunRead, type RunResults, type RunResultState, type StartAndWaitForResultOptions, type WaitForResultOptions } from "./runs.js";
|
|
4
4
|
import type { BillingPortalResponse, ChangePlanResponse, CheckoutResponse, InvoiceView, Membership, MembershipsResponse, ListMethodExamplesQuery, ListMethodsQuery, ListMethodVersionsQuery, MethodData, MethodDeletionAccepted, MethodDetail, MethodDraftInput, MethodExample, MethodExampleCreateInput, MethodExampleLatestRunInput, MethodExampleLatestRunResult, MethodExamplePage, MethodExampleUpdateInput, MethodPage, MethodPublishInput, MethodPublishResult, MethodRenameInput, MethodSummary, MethodVersion, MethodVersionPage, MethodWriteInput, OnboardingSubmission, PipelexApiKeyCreated, PipelexApiKeyList, ListRunsQuery, RunHistoryItem, RunDetail, RunPage, PlanView, ResolvedStorageUrl, SavedMethodFile, SubscriptionResponse, UpdateRunInput, UploadGrant, UploadGrantInput, UploadInput, UploadedFile, UserProfile } from "./product-models.js";
|
|
5
|
-
import type { MethodTreeLimits } from "./method-trees.js";
|
|
5
|
+
import type { MethodTreeForms, MethodTreeLimits } from "./method-trees.js";
|
|
6
6
|
import type { AppInfo } from "./user-agent.js";
|
|
7
7
|
import type { UploadableAsset, UploadFileOptions, UploadRecord } from "./upload.js";
|
|
8
|
-
import type { BundleResources } from "./bundle-resources.js";
|
|
9
8
|
import type { PrepareInputsRequest, PreparedInputs } from "./prepare-inputs.js";
|
|
10
9
|
import type { BulkResolveStorageUrlsInput, BulkResolvedStorageUrls, DownloadArtifactsRequest, DownloadArtifactsResult, FetchArtifactOptions, ResolvedArtifact } from "./artifacts.js";
|
|
11
10
|
import { PipelexExecuteResult } from "./execute-result.js";
|
|
12
|
-
export interface MthdsFile {
|
|
13
|
-
/** File contents to validate. */
|
|
14
|
-
content: string;
|
|
15
|
-
/** Optional provenance URI threaded into validation diagnostics. */
|
|
16
|
-
uri?: string;
|
|
17
|
-
}
|
|
18
11
|
/**
|
|
19
|
-
* The Pipelex API's own run
|
|
20
|
-
* reads, beside the protocol's
|
|
21
|
-
*
|
|
22
|
-
* deployment, bare or hosted (on `api.pipelex.com`, once the platform deploy
|
|
23
|
-
* carrying it lands), and the `resources` the bundle's steps read.
|
|
12
|
+
* The Pipelex API's own run argument — the layer-2 argument the RUNNER itself
|
|
13
|
+
* reads, beside the protocol's `files` map: the `method_ref` run source, served by
|
|
14
|
+
* any pipelex-api >= 0.21.0 deployment, bare or hosted.
|
|
24
15
|
*
|
|
25
|
-
*
|
|
16
|
+
* A named option rather than an `extra` entry, for the same reason as the hosted
|
|
26
17
|
* extensions below: `extra` remains the escape hatch for an extension this
|
|
27
18
|
* client does not know about, never the way to pass one it does.
|
|
28
19
|
*/
|
|
@@ -34,32 +25,18 @@ export interface PipelexApiRunExtensions {
|
|
|
34
25
|
* default branch at HEAD), the package is located by manifest identity, and
|
|
35
26
|
* the resolved commit SHA comes back as `method_provenance` on the response.
|
|
36
27
|
*
|
|
37
|
-
* A complete run source of its own — the fetched package carries its
|
|
38
|
-
* and its entry pipe — so it pairs with NOTHING: exclusive with
|
|
39
|
-
*
|
|
40
|
-
* the hosted `method_id` (an address run has its own provenance and
|
|
41
|
-
* linkage id). `pipe_code` beside it is fine — it overrides the
|
|
42
|
-
* `main_pipe` to pick which pipe in the fetched package to run. This
|
|
43
|
-
* rejects the illegal pairings before anything hits the wire, mirroring
|
|
44
|
-
* server's own 422s.
|
|
28
|
+
* A complete run source of its own — the fetched package carries its whole
|
|
29
|
+
* tree and its entry pipe — so it pairs with NOTHING: exclusive with the
|
|
30
|
+
* method's tree in any of its forms (`directory`, `contents`, `tree`, `files`)
|
|
31
|
+
* and with the hosted `method_id` (an address run has its own provenance and
|
|
32
|
+
* needs no linkage id). `pipe_code` beside it is fine — it overrides the
|
|
33
|
+
* manifest's `main_pipe` to pick which pipe in the fetched package to run. This
|
|
34
|
+
* client rejects the illegal pairings before anything hits the wire, mirroring
|
|
35
|
+
* the server's own 422s.
|
|
45
36
|
*
|
|
46
37
|
* An empty string is treated as absent and is not sent.
|
|
47
38
|
*/
|
|
48
39
|
method_ref?: string | null;
|
|
49
|
-
/**
|
|
50
|
-
* The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, keyed
|
|
51
|
-
* by the path the step names (`templates/invoice.docx`), each as its bytes (a `Uint8Array`,
|
|
52
|
-
* a Node `Buffer` included, an `ArrayBuffer` or a `Blob`). The client sends them as the
|
|
53
|
-
* wire's `resources`, each file in standard base64; see `docs/bundle-resources.md`.
|
|
54
|
-
*
|
|
55
|
-
* They accompany the bundle whose steps read them: inline `mthds_contents` or a method
|
|
56
|
-
* bundle (`files` / `bundle_b64`), or a hosted `method_id` the platform resolves. Beside a
|
|
57
|
-
* `method_ref` (whose files are its package's own), or with no source at all, they are
|
|
58
|
-
* rejected client-side, mirroring the server's `422`. A key that cannot name a file inside
|
|
59
|
-
* the bundle (absolute, a `..` segment, a backslash, a colon) is rejected client-side too.
|
|
60
|
-
* An absent, `null` or empty map is not sent.
|
|
61
|
-
*/
|
|
62
|
-
resources?: BundleResources | null;
|
|
63
40
|
}
|
|
64
41
|
/**
|
|
65
42
|
* The hosted API's own run arguments — the layer-3 extensions this client adds
|
|
@@ -88,14 +65,14 @@ export interface PipelexHostedRunExtensions {
|
|
|
88
65
|
* for a version never published; `mt_…@draft` runs the draft. The suffix
|
|
89
66
|
* rides the string untouched, any other suffix is a `422`, and the answer's
|
|
90
67
|
* `method_version` says which version runs.
|
|
91
|
-
* - **Alongside
|
|
92
|
-
* — the
|
|
68
|
+
* - **Alongside the method's tree** (`directory`, `contents`, `tree` or `files`)
|
|
69
|
+
* — the tree is what RUNS (precedence), and the id is recorded as
|
|
93
70
|
* **run-history linkage** on the Run row. That linkage is what writes the
|
|
94
71
|
* index key `GET /v1/runs?method_id=` queries, so a run started without it
|
|
95
72
|
* is absent from its method's history permanently. The id must be bare
|
|
96
|
-
* there: the
|
|
97
|
-
*
|
|
98
|
-
*
|
|
73
|
+
* there: the tree is what runs, so a suffix would claim a version that did
|
|
74
|
+
* not, and a suffixed id is rejected client-side (a `422` on the hosted
|
|
75
|
+
* API).
|
|
99
76
|
* - **Alongside `method_ref`** — rejected client-side (and a 422 on the
|
|
100
77
|
* hosted API): an address run carries its own provenance, so it takes no
|
|
101
78
|
* linkage id.
|
|
@@ -104,8 +81,21 @@ export interface PipelexHostedRunExtensions {
|
|
|
104
81
|
*/
|
|
105
82
|
method_id?: string | null;
|
|
106
83
|
}
|
|
107
|
-
/**
|
|
108
|
-
|
|
84
|
+
/**
|
|
85
|
+
* `execute()` options — the protocol's run arguments, the method's tree in any of the four forms
|
|
86
|
+
* of `MethodTreeForms` (the protocol's `files` and `tree`, and this client's `directory` and
|
|
87
|
+
* `contents`), and the Pipelex API and hosted extensions.
|
|
88
|
+
*
|
|
89
|
+
* The tree is given in at most one form. `files` is sent as given; a `directory`, `contents` or
|
|
90
|
+
* `tree` is sent as the `files` map, inline when its inline map weighs 256 KiB or less and no more
|
|
91
|
+
* than the inline limit the API announces, or whatever its weight when the API keeps no blob store,
|
|
92
|
+
* and otherwise every file by hash, after uploading the files the API lacks (see
|
|
93
|
+
* `docs/method-trees.md`). A `directory` is listed by the `mthds` package's lister under the
|
|
94
|
+
* MTHDS standard's membership rule, so a run's inputs file (`inputs.json`, `inputs.toml`) never
|
|
95
|
+
* travels with the method. A `files` map, a `tree` or `contents` holding no file is refused, as
|
|
96
|
+
* the standard refuses a tree holding no file; an empty `directory` is absent.
|
|
97
|
+
*/
|
|
98
|
+
export type PipelexRunOptions = RunOptions & MethodTreeForms & PipelexApiRunExtensions & PipelexHostedRunExtensions;
|
|
109
99
|
/**
|
|
110
100
|
* What a run start sends beside its body: the request's own headers, which no run argument
|
|
111
101
|
* reaches. Each is camelCase, since none of them is a wire field of the run request.
|
|
@@ -136,52 +126,32 @@ export interface PipelexStartRequestOptions {
|
|
|
136
126
|
* `start()` / `startAndWaitForResult()` options — the same, for the durable path, plus the start
|
|
137
127
|
* request's own `idempotencyKey`.
|
|
138
128
|
*/
|
|
139
|
-
export type PipelexStartOptions = StartOptions & PipelexApiRunExtensions & PipelexHostedRunExtensions & PipelexStartRequestOptions;
|
|
129
|
+
export type PipelexStartOptions = StartOptions & MethodTreeForms & PipelexApiRunExtensions & PipelexHostedRunExtensions & PipelexStartRequestOptions;
|
|
140
130
|
/**
|
|
141
|
-
* The method selector `validate()` takes in place of
|
|
142
|
-
* beside the other wire shapes in `./models.js` and re-exported here, the import
|
|
131
|
+
* The method selector `validate()` takes in place of the method's tree, and the whole of what it
|
|
132
|
+
* takes — declared beside the other wire shapes in `./models.js` and re-exported here, the import
|
|
143
133
|
* path consumers have always used.
|
|
144
134
|
*/
|
|
145
|
-
export type { ValidateMethodSelector };
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
allowSignatures?: boolean;
|
|
149
|
-
/** Optional validate presentation hints, e.g. ["markdown"]. */
|
|
150
|
-
render?: string[];
|
|
151
|
-
/** Optional structured-view opt-in tokens, e.g. ["input_form", "output_form"]; sent only when given. */
|
|
152
|
-
views?: string[];
|
|
135
|
+
export type { PipelexValidateSource, ValidateMethodSelector };
|
|
136
|
+
/** `validate()`'s last argument: the presentation it asks for, and the call's own transport. */
|
|
137
|
+
export interface ValidateOptions {
|
|
153
138
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
139
|
+
* Validate presentation hints, a list of view-format tokens. The client always adds
|
|
140
|
+
* `"markdown"`, so both arms carry `rendered_markdown`.
|
|
156
141
|
*/
|
|
157
|
-
|
|
142
|
+
render?: string[];
|
|
143
|
+
/** Structured-view opt-in tokens, e.g. `["input_form", "output_form"]`; sent only when given. */
|
|
144
|
+
views?: string[];
|
|
158
145
|
/**
|
|
159
146
|
* Per-call request ceiling; defaults to the 20-min execute ceiling. A positive number
|
|
160
147
|
* no larger than 2147483647, the longest delay a timer honours, else a `RangeError`.
|
|
161
148
|
*/
|
|
162
149
|
timeoutMs?: number;
|
|
163
|
-
/** Caller-driven cancellation; the abort reason propagates untouched. */
|
|
164
|
-
signal?: AbortSignal;
|
|
165
|
-
}
|
|
166
|
-
/** `validate()`'s last argument: what rides beside the method, and the call's own transport. */
|
|
167
|
-
export interface ValidateOptions {
|
|
168
150
|
/**
|
|
169
|
-
*
|
|
170
|
-
* the
|
|
171
|
-
*
|
|
172
|
-
* file in standard base64; see `docs/bundle-resources.md`. They accompany inline contents, or
|
|
173
|
-
* a hosted `{ method_id }` the platform resolves; beside a `{ method_ref }` they are rejected
|
|
174
|
-
* client-side, mirroring the server's `422`. A step whose template file was not sent makes the
|
|
175
|
-
* verdict invalid, saying so; the dry run checks an office template file it was sent and adds
|
|
176
|
-
* its findings to the valid arm's `warnings` (`template_check_warning`).
|
|
151
|
+
* Caller-driven cancellation; the abort reason propagates untouched. It is also read between
|
|
152
|
+
* the steps a `directory`, `contents` or `tree` costs before the request (the listing, each
|
|
153
|
+
* read, the version handshake, the blob route and each upload).
|
|
177
154
|
*/
|
|
178
|
-
resources?: BundleResources | null;
|
|
179
|
-
/**
|
|
180
|
-
* Per-call request ceiling; defaults to the 20-min execute ceiling. A positive number
|
|
181
|
-
* no larger than 2147483647, the longest delay a timer honours, else a `RangeError`.
|
|
182
|
-
*/
|
|
183
|
-
timeoutMs?: number;
|
|
184
|
-
/** Caller-driven cancellation; the abort reason propagates untouched. */
|
|
185
155
|
signal?: AbortSignal;
|
|
186
156
|
}
|
|
187
157
|
export interface PipelexApiClientOptions {
|
|
@@ -230,11 +200,13 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
230
200
|
/** Cached `/v1/version` handshake outcome — whether the durable lifecycle is served. */
|
|
231
201
|
private lifecycleAvailable;
|
|
232
202
|
/**
|
|
233
|
-
* The
|
|
234
|
-
*
|
|
235
|
-
*
|
|
203
|
+
* The last `/v1/version` handshake that answered and when it was asked, kept for
|
|
204
|
+
* `HANDSHAKE_TTL_MS` as `mthds`'s `MthdsApiClient` keeps it: what sending a tree reads from it
|
|
205
|
+
* (`blob_store`, the tree limits) changes only with a deploy. A handshake that failed is not
|
|
206
|
+
* kept, so the next call asks again, and a refusal showing it stale drops it sooner
|
|
207
|
+
* (`forgetHandshake`).
|
|
236
208
|
*/
|
|
237
|
-
private
|
|
209
|
+
private versionCache;
|
|
238
210
|
/** The client's request ceiling (`PipelexApiClientOptions.requestTimeoutMs`). */
|
|
239
211
|
private readonly requestTimeoutMs;
|
|
240
212
|
/**
|
|
@@ -424,8 +396,21 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
424
396
|
*
|
|
425
397
|
* The answer is read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the
|
|
426
398
|
* working memory, the main output included, is a `bigint` holding its exact digits.
|
|
399
|
+
*
|
|
400
|
+
* The method's tree, given as a `directory`, `contents` or `tree`, is prepared before the
|
|
401
|
+
* request: listed, read, and sent inline or by hash after uploading the files the API lacks (see
|
|
402
|
+
* `PipelexRunOptions`). A tree this client refuses (two forms, no file, a directory it cannot
|
|
403
|
+
* list) is a `RequestArgumentError`, and a file that fails to upload a `MethodFileTransferError`,
|
|
404
|
+
* each before the run is asked.
|
|
427
405
|
*/
|
|
428
406
|
execute(options: PipelexRunOptions): Promise<PipelexExecuteResult>;
|
|
407
|
+
/**
|
|
408
|
+
* `execute`, stopped by `signal` before each step of the tree's preparation and right before the
|
|
409
|
+
* request is sent, never during it, since a request sent may have started a run. `sending` is
|
|
410
|
+
* the tree already prepared, which the blocking fallback of `startAndWaitForResult` sends as the
|
|
411
|
+
* start sent it rather than preparing it again.
|
|
412
|
+
*/
|
|
413
|
+
private executeRun;
|
|
429
414
|
/**
|
|
430
415
|
* Start a method asynchronously — `POST /v1/start` (202, no output yet).
|
|
431
416
|
*
|
|
@@ -445,33 +430,51 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
445
430
|
* `runMayHaveStarted` is true can be retried unchanged (see
|
|
446
431
|
* `PipelexStartRequestOptions`). A malformed key is a `RequestArgumentError`
|
|
447
432
|
* before anything is sent.
|
|
433
|
+
*
|
|
434
|
+
* The method's tree is prepared before the request as `execute` prepares it. The prepared body
|
|
435
|
+
* is the same for the same tree, so a start retried under its idempotency key sends the body the
|
|
436
|
+
* key was bound to. A start whose hash entries name a blob the API does not hold yet is refused
|
|
437
|
+
* with a `422` `missing_blobs`, which releases its key: send it again unchanged, which asks the
|
|
438
|
+
* blob route and uploads what is missing first.
|
|
448
439
|
*/
|
|
449
440
|
start(options: PipelexStartOptions): Promise<PipelexRunResultStart>;
|
|
450
441
|
/**
|
|
451
|
-
*
|
|
442
|
+
* `start`, stopped by `signal` as `executeRun` is, `sending` being the tree already prepared.
|
|
443
|
+
*/
|
|
444
|
+
private startRun;
|
|
445
|
+
/**
|
|
446
|
+
* Parse, validate, and dry-run a method — `POST /v1/validate`.
|
|
452
447
|
*
|
|
453
448
|
* `/validate` is a diagnostic endpoint: every produced verdict rides a **200**,
|
|
454
449
|
* discriminated on `is_valid`. This returns the `PipelexValidationResult` union
|
|
455
450
|
* verbatim — `is_valid: true` ⇒ the typed `PipelexValidationReport` (structural
|
|
456
451
|
* artifacts), `is_valid: false` ⇒ a `PipelexInvalidReport` (`validation_errors[]`).
|
|
457
|
-
* An invalid
|
|
458
|
-
* *no-verdict* condition (a malformed request,
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
* `source`
|
|
462
|
-
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
* - **
|
|
452
|
+
* An invalid method is NOT thrown — the caller pattern-matches `is_valid`. Only a
|
|
453
|
+
* *no-verdict* condition (a malformed request, a tree the route refuses, auth, a
|
|
454
|
+
* server fault) is non-2xx and surfaces as `ApiResponseError`.
|
|
455
|
+
*
|
|
456
|
+
* `source` names WHAT is validated, in exactly one form — the strict tooling XOR
|
|
457
|
+
* (the routes are stateless, so there is no linkage exception; a second selector
|
|
458
|
+
* is a request-shape `422`, refused here first with a `RequestArgumentError`):
|
|
459
|
+
*
|
|
460
|
+
* - **the method's tree**, in one of the four forms of `MethodTreeForms`: a
|
|
461
|
+
* `directory` the `mthds` package's lister lists under the standard's
|
|
462
|
+
* membership rule (Node only), `contents` by tree path, a listed `tree`, or the
|
|
463
|
+
* protocol's `files` map, sent as given. A `directory`, `contents` or `tree` is
|
|
464
|
+
* sent as the `files` map, inline or by hash, exactly as a run sends it (see
|
|
465
|
+
* `PipelexRunOptions`). Every `.mthds` file of the tree is judged, named by its
|
|
466
|
+
* tree path in the diagnostics' `source`, and every other file is one a step may
|
|
467
|
+
* read, such as a `PipeDocGen` step's template file, whose template check's
|
|
468
|
+
* findings ride the valid arm's `warnings`;
|
|
466
469
|
* - **`{ method_ref }`** — a published method's address, resolved by the
|
|
467
470
|
* server (pipelex-api >= 0.21.0) through the same fetch path as a
|
|
468
|
-
* `method_ref` run, the package's real
|
|
471
|
+
* `method_ref` run, the package's real tree paths feeding the diagnostics'
|
|
469
472
|
* source labels;
|
|
470
473
|
* - **`{ method_id }`** — a stored method's catalog id, hosted-only: the
|
|
471
|
-
* platform resolves the version it names and
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
474
|
+
* platform resolves the version it names and sends that version's tree to the
|
|
475
|
+
* runner (a bare runner rejects the request as carrying no source it
|
|
476
|
+
* understands). A bare `mt_…` validates the latest published version,
|
|
477
|
+
* `mt_…@<n>` version `n` and `mt_…@draft` the draft.
|
|
475
478
|
*
|
|
476
479
|
* A selector-resolution failure (fetch failure, no package at the address, an
|
|
477
480
|
* unknown or foreign-org id, a bare id of a method never published, `409`
|
|
@@ -480,40 +483,23 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
480
483
|
* `ApiResponseError` — never an `is_valid: false` verdict, which is reserved
|
|
481
484
|
* for actual MTHDS content.
|
|
482
485
|
*
|
|
483
|
-
* `
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
* `
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
* top-level field to the valid arm — `input_form` and `output_form`. Unlike `render`,
|
|
501
|
-
* this client sends `views` ONLY when the caller asks: the point of an opt-in view
|
|
502
|
-
* is that the default response stays byte-identical, and the highest-frequency
|
|
503
|
-
* consumers (hook pipelines, CI gates, agent loops) never pay for bytes they
|
|
504
|
-
* discard. `pipelex-api` gates `input_form` on this token as of 0.18.0; a 0.17.0
|
|
505
|
-
* runner resolved no token (the key is silently ignored, never a 422) and emitted
|
|
506
|
-
* the field regardless — which is why `PipelexValidationReport.input_form` is typed
|
|
507
|
-
* optional rather than required.
|
|
508
|
-
*
|
|
509
|
-
* `options.resources` sends the files the bundle's steps read, such as a
|
|
510
|
-
* `PipeDocGen` step's `template_file`, keyed by the path the step names, each as
|
|
511
|
-
* its bytes (see {@link ValidateOptions}). A step whose template file was not sent
|
|
512
|
-
* is an `is_valid: false` verdict saying so, and a template check's findings in an
|
|
513
|
-
* office template file ride the valid arm's `warnings`. A key no step names, or
|
|
514
|
-
* files over the server's limits, are no-verdict refusals: a `422`
|
|
515
|
-
* `BundleResourceNotNamedError`, a `413` `PayloadTooLarge` or
|
|
516
|
-
* `BundleResourcesTooLargeError`.
|
|
486
|
+
* `allowSignatures` tolerates unimplemented pipe signatures, as the protocol's
|
|
487
|
+
* `validate(source, allowSignatures)` does: they surface as `pending_signatures`
|
|
488
|
+
* and `is_runnable`, never as an error.
|
|
489
|
+
*
|
|
490
|
+
* `options.render` is the Pipelex-API presentation hint — a list of view-format
|
|
491
|
+
* tokens. This client always asks for Markdown so both valid results and produced
|
|
492
|
+
* validation-error verdicts carry `rendered_markdown`; callers may add more tokens.
|
|
493
|
+
* Unknown tokens are server-side lenient-ignored (never a 422).
|
|
494
|
+
*
|
|
495
|
+
* `options.views` is the sibling opt-in for *structured* views where `render`
|
|
496
|
+
* carries *rendered text*. The two lists are independent, each resolving its own
|
|
497
|
+
* tokens against its own supported set, and each supported token adds a same-named
|
|
498
|
+
* top-level field to the valid arm — `input_form` and `output_form`. Unlike
|
|
499
|
+
* `render`, this client sends `views` ONLY when the caller asks: the point of an
|
|
500
|
+
* opt-in view is that the default response stays byte-identical, and the
|
|
501
|
+
* highest-frequency consumers (hook pipelines, CI gates, agent loops) never pay for
|
|
502
|
+
* bytes they discard.
|
|
517
503
|
*
|
|
518
504
|
* A `{ method_ref }` source makes the server clone a repository before it
|
|
519
505
|
* validates anything, and it needs no special budget here: this route already
|
|
@@ -523,16 +509,7 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
523
509
|
* exists to RAISE routes whose default is the ~30s poll ceiling; applying it here
|
|
524
510
|
* would lower this one.
|
|
525
511
|
*/
|
|
526
|
-
validate(source:
|
|
527
|
-
/**
|
|
528
|
-
* Validate paired MTHDS files while preserving URI attribution for diagnostics.
|
|
529
|
-
*
|
|
530
|
-
* This adapter intentionally keeps the low-level `validate(...)` payload shape
|
|
531
|
-
* intact for existing consumers. When any file has a URI, every content gets a
|
|
532
|
-
* parallel source label; inline labels are deterministic so the server never
|
|
533
|
-
* sees a length-mismatched `mthds_sources` array.
|
|
534
|
-
*/
|
|
535
|
-
validateFiles(files: MthdsFile[], options?: ValidateFilesOptions): Promise<PipelexValidationResult>;
|
|
512
|
+
validate(source: PipelexValidateSource, allowSignatures?: boolean, options?: ValidateOptions): Promise<PipelexValidationResult>;
|
|
536
513
|
/**
|
|
537
514
|
* Lint one `.mthds` file against the embedded MTHDS schema — `POST /v1/lint`.
|
|
538
515
|
*
|
|
@@ -574,11 +551,10 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
574
551
|
* never on a message.
|
|
575
552
|
*
|
|
576
553
|
* All of these are static and inference-free, so they default to the management-call
|
|
577
|
-
* timeout. The internal
|
|
554
|
+
* timeout. The internal raise is `crateRequestTimeoutMs`'s: the fetch-sized budget a
|
|
578
555
|
* crate route gets when its closure is a `method_ref`, because the server may clone a
|
|
579
|
-
* repository before it answers
|
|
580
|
-
*
|
|
581
|
-
* what the request costs, not a caller-facing parameter.
|
|
556
|
+
* repository before it answers. It is matched to what the request costs, not a
|
|
557
|
+
* caller-facing parameter.
|
|
582
558
|
*
|
|
583
559
|
* **These routes deliberately expose no `timeoutMs` / `signal`, and that is not an
|
|
584
560
|
* oversight to be "fixed" per route.** Automated reviewers have proposed adding them
|
|
@@ -589,11 +565,11 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
589
565
|
* ceiling and takes caller transport options; every extension route rides the
|
|
590
566
|
* static core. Giving one static route an override while its siblings lack one is
|
|
591
567
|
* the inconsistency.
|
|
592
|
-
* 2. The input is **bounded server-side** — the
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
568
|
+
* 2. The input is **bounded server-side** — the deployment caps a request's tree by its
|
|
569
|
+
* count of files, a size per file, a total and the bytes it carries inline, all
|
|
570
|
+
* announced by its `/v1/version` handshake — and none of these routes runs inference.
|
|
571
|
+
* The upload those limits allow is what `crateRequestTimeoutMs` budgets for, not the
|
|
572
|
+
* server's work.
|
|
597
573
|
* 3. On the hosted path an override would be **inert**: the gateway caps responses at
|
|
598
574
|
* ~30s (see `POLL_REQUEST_TIMEOUT_MS` above), so raising `timeoutMs` would still be
|
|
599
575
|
* cut off upstream, just with a less honest error.
|
|
@@ -601,6 +577,12 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
601
577
|
* If a static route ever genuinely needs longer, give the WHOLE static family one
|
|
602
578
|
* uniform transport-options parameter in a single pass — do not bolt it onto one
|
|
603
579
|
* route.
|
|
580
|
+
*
|
|
581
|
+
* The one exception is the crate family's `signal` (`CrateRouteOptions`), given to all three
|
|
582
|
+
* crate routes at once: a `directory`, `tree` or `contents` can cost the listing, the version
|
|
583
|
+
* handshake, the blob route and uploads before the request, client-side work a caller such as
|
|
584
|
+
* `prepareInputs` must be able to stop. It is read between those steps and stops nothing in flight, so it is no
|
|
585
|
+
* transport option and the reasons above still hold.
|
|
604
586
|
*/
|
|
605
587
|
private requestExtension;
|
|
606
588
|
/** The model deck the runner can route to — `GET /v1/models[?type=]`. */
|
|
@@ -630,6 +612,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
630
612
|
* The handshake for feature detection (hosted extensions or not).
|
|
631
613
|
*/
|
|
632
614
|
version(): Promise<VersionInfo>;
|
|
615
|
+
/** `GET /v1/version`, as `version` asks it, stopped by `signal`. */
|
|
616
|
+
private requestVersion;
|
|
633
617
|
/**
|
|
634
618
|
* Resolve a closure into its normalized library crate — `POST /v1/resolve`.
|
|
635
619
|
*
|
|
@@ -648,12 +632,22 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
648
632
|
* (fetch failure, no package at the address, an unknown or foreign-org id) is
|
|
649
633
|
* non-2xx too — never an `is_valid: false` verdict.
|
|
650
634
|
*
|
|
651
|
-
* The closure arrives in exactly one of three forms:
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
635
|
+
* The closure arrives in exactly one of three forms: the method's tree, as the
|
|
636
|
+
* protocol's `files` map or as a `directory`, `tree` or `contents` the client sends
|
|
637
|
+
* inline when small and by hash otherwise (see {@link CrateRequestBase}); an
|
|
638
|
+
* address-form `method_ref` (server-resolved, pipelex-api >= 0.21.0; the registry form
|
|
639
|
+
* stays a `501`); or a hosted `method_id` (platform-resolved — see
|
|
640
|
+
* {@link PipelexHostedToolingExtensions}). An empty map or string is absent.
|
|
641
|
+
*
|
|
642
|
+
* `options.signal` stops the call between the steps a `directory`, `tree` or `contents`
|
|
643
|
+
* costs before the request — the listing, the version handshake, the blob route, each
|
|
644
|
+
* read and upload of a missing blob — and before the request itself, throwing the
|
|
645
|
+
* abort; a request already sent runs to its end. A blob that fails to upload throws
|
|
646
|
+
* `MethodFileTransferError`, and a tree this client refuses to send (no file, two
|
|
647
|
+
* forms, a directory it cannot list, a `contents` value that is neither text nor
|
|
648
|
+
* bytes) `RequestArgumentError`, each before the route is asked.
|
|
655
649
|
*/
|
|
656
|
-
resolve(request: ResolveRequest): Promise<ResolveResponse>;
|
|
650
|
+
resolve(request: ResolveRequest, options?: CrateRouteOptions): Promise<ResolveResponse>;
|
|
657
651
|
/**
|
|
658
652
|
* Project a closure's crate into stamped typed artifacts — `POST /v1/codegen`.
|
|
659
653
|
*
|
|
@@ -669,7 +663,7 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
669
663
|
* unknown `kind`/`target`, a `pipe_ref` on the concept-set-wide `types` kind, or
|
|
670
664
|
* a malformed selector is a 422; a registry-form `method_ref` is a `501`.
|
|
671
665
|
*/
|
|
672
|
-
codegen(request: CodegenRequest): Promise<CodegenResponse>;
|
|
666
|
+
codegen(request: CodegenRequest, options?: CrateRouteOptions): Promise<CodegenResponse>;
|
|
673
667
|
/**
|
|
674
668
|
* Read a method's three I/O artifacts — `POST /v1/pipe-io`.
|
|
675
669
|
*
|
|
@@ -681,19 +675,20 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
681
675
|
* dry-runs every pipe; a caller that shows a method, prepares its inputs or generates
|
|
682
676
|
* types for it reads this, and one that needs the dry-run verdict stays on `validate`.
|
|
683
677
|
*
|
|
684
|
-
* Selection: the request's qualified `pipe_ref`, else
|
|
685
|
-
* `
|
|
686
|
-
*
|
|
687
|
-
* `include_files: true` echoes the
|
|
678
|
+
* Selection: the request's qualified `pipe_ref`, else the `main_pipe` of the
|
|
679
|
+
* `METHODS.toml` at the tree's root, sent in the tree or fetched with a package, else the
|
|
680
|
+
* closure's single `main_pipe` declaration. `all_pipes: true` describes every pipe
|
|
681
|
+
* instead, and never refuses for want of an entry pipe. `include_files: true` echoes the
|
|
682
|
+
* method's own `.mthds` bundles as `files`, a map from tree path to each bundle's text,
|
|
683
|
+
* in the shape of the request's `files` map.
|
|
688
684
|
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
691
|
-
*
|
|
692
|
-
* take it too (see {@link CrateRequestBase}).
|
|
685
|
+
* The files the closure's steps read, such as a `PipeDocGen` step's `template_file`, are
|
|
686
|
+
* files of the method's tree like any other; a step whose template file is not in the tree
|
|
687
|
+
* makes the closure invalid (see {@link CrateRequestBase}).
|
|
693
688
|
*
|
|
694
|
-
* Same 200-verdict discipline
|
|
695
|
-
* (the request
|
|
696
|
-
*
|
|
689
|
+
* Same 200-verdict discipline, same three-form closure selector and same `options` as
|
|
690
|
+
* {@link resolve} (the request's members are posted as given, its `directory`, `tree` or
|
|
691
|
+
* `contents` as the `files` map, and the selector XOR is the server's to enforce).
|
|
697
692
|
* Only a no-verdict condition throws `ApiResponseError`: a malformed selector and an
|
|
698
693
|
* over-limit file are `ValidationError` `422`s; a selection the route refuses is a
|
|
699
694
|
* `422` whose `errorType` is `EntryPipeNotFoundError` (an unknown `pipe_ref`, no entry
|
|
@@ -701,13 +696,35 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
701
696
|
* candidates in its `serverMessage`; a registry-form `method_ref` is a `501`; a pipe
|
|
702
697
|
* whose artifacts cannot be derived is a `500`.
|
|
703
698
|
*
|
|
704
|
-
* A `method_ref` gets the fetch-sized budget, as on the other crate routes
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
|
|
699
|
+
* A `method_ref` gets the fetch-sized budget, as on the other crate routes. On the
|
|
700
|
+
* hosted API the gateway caps a request at about 30 seconds whatever the client allows,
|
|
701
|
+
* so a cold `method_ref` clone can answer a `502` that a retry clears once the runner
|
|
702
|
+
* has cached the clone.
|
|
703
|
+
*/
|
|
704
|
+
pipeIo(request: PipeIORequest, options?: CrateRouteOptions): Promise<PipeIOResponse>;
|
|
705
|
+
/**
|
|
706
|
+
* Post a crate request: its members as given, and its tree as the `files` map a save would
|
|
707
|
+
* send, each key left off when there is nothing to send. An empty map or string is absent, as in
|
|
708
|
+
* the Python SDK: `files: {}` or `null`, `contents: {}`, `directory: ""` and `dependencies: {}`
|
|
709
|
+
* are not sent, so an empty one never reaches the wire as a second selector; a `directory` that
|
|
710
|
+
* is not a string is refused, as on a run. A `directory`, `tree` or `contents` is prepared
|
|
711
|
+
* through the path every request and save sends a tree by (`postMethodRequest`), inline when
|
|
712
|
+
* small and by hash otherwise, uploading the files the API lacks first; the blob route is asked
|
|
713
|
+
* under the request's `read_scope`, the scope its hash entries are read in. `signal` is read
|
|
714
|
+
* before each step and right before the request (see `TreeSendOptions`). The request gets the
|
|
715
|
+
* budget `crateRequestTimeoutMs` gives it for the `files` it carries.
|
|
709
716
|
*/
|
|
710
|
-
|
|
717
|
+
private crateRequest;
|
|
718
|
+
/**
|
|
719
|
+
* The request budget for a crate route's closure (`resolve`, `codegen`, `pipeIo`): the
|
|
720
|
+
* static-route default, unless the closure is a `method_ref`, which may make the server clone a
|
|
721
|
+
* repository first and gets the fetch-sized budget, or its `files` carry more inline than
|
|
722
|
+
* `INLINE_TREE_MAX_BYTES`, which gets the client's request ceiling (`requestTimeoutMs`): a tree
|
|
723
|
+
* sent to an API keeping no blob store travels inline whatever its weight, and so does a `files`
|
|
724
|
+
* map given as is, and the upload of the body is charged against the budget. A tree sent by
|
|
725
|
+
* hash keeps the default, its files uploaded before the request under the client's own ceiling.
|
|
726
|
+
*/
|
|
727
|
+
private crateRequestTimeoutMs;
|
|
711
728
|
/**
|
|
712
729
|
* Fetch a run's status by bare id — `GET /v1/runs/{pipeline_run_id}/status`.
|
|
713
730
|
*
|
|
@@ -798,6 +815,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
798
815
|
* gzip stream, which `requestRaw` reports as an `ApiUnreachableError` carrying
|
|
799
816
|
* the decompressor's code (see `isUndecodableBody`).
|
|
800
817
|
*
|
|
818
|
+
* `signal` stops the handshake: its abort is thrown as is and nothing is cached.
|
|
819
|
+
*
|
|
801
820
|
* @throws {ApiUnreachableError} The handshake got no answer. Nothing is cached,
|
|
802
821
|
* so the next call asks again, and no start is sent to a host that did not
|
|
803
822
|
* answer: sending it would wait a second time for the same silence.
|
|
@@ -818,9 +837,15 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
818
837
|
* run, so the caller knows until then that none exists (see
|
|
819
838
|
* `StartAndWaitForResultOptions`).
|
|
820
839
|
*
|
|
821
|
-
* `pollOptions.signal`
|
|
822
|
-
*
|
|
823
|
-
*
|
|
840
|
+
* `pollOptions.signal` also stops everything before the run is created: the version handshake,
|
|
841
|
+
* the listing of a `directory`, and the reads, the blob route and the uploads of a tree sent by
|
|
842
|
+
* hash, each of them stopped in flight. It is read again right before the start and before the
|
|
843
|
+
* blocking execute, so a caller that aborts before then gets its abort and no run is created.
|
|
844
|
+
* Once one of them is sent, the abort stops only the wait.
|
|
845
|
+
*
|
|
846
|
+
* The method's tree is prepared once, before the start: when a runner turns out to lack the
|
|
847
|
+
* durable routes, the blocking execute sends the same `files` map, its blobs already uploaded,
|
|
848
|
+
* rather than listing, reading and hashing the tree again.
|
|
824
849
|
*
|
|
825
850
|
* An error from the start, or from the blocking execute, says whether that request may still
|
|
826
851
|
* have started a run whose id never reached the caller (`runMayHaveStarted`); when it may have,
|
|
@@ -836,6 +861,12 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
836
861
|
* malformed key is refused before the version handshake.
|
|
837
862
|
*/
|
|
838
863
|
startAndWaitForResult(options: PipelexStartOptions, pollOptions?: StartAndWaitForResultOptions): Promise<RunResults>;
|
|
864
|
+
/**
|
|
865
|
+
* A run's tree prepared once for `startAndWaitForResult`, under `call`'s refusals: the run's
|
|
866
|
+
* arguments checked, the tree listed or read, and its `files` prepared, uploads included, under
|
|
867
|
+
* `signal`. A `files` map given as is, or no tree, needs no preparation.
|
|
868
|
+
*/
|
|
869
|
+
private prepareRunTree;
|
|
839
870
|
/** The authenticated user's profile — `GET /v1/me`. */
|
|
840
871
|
getMe(): Promise<UserProfile>;
|
|
841
872
|
/**
|
|
@@ -927,13 +958,6 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
927
958
|
* room for a publish.
|
|
928
959
|
*/
|
|
929
960
|
createMethod(input: MethodWriteInput): Promise<MethodData>;
|
|
930
|
-
/**
|
|
931
|
-
* The time limit of a save carrying `files`: the client's request ceiling, as for a `start`
|
|
932
|
-
* carrying its method, since a tree sent inline to a deployment with no blob store has no size
|
|
933
|
-
* bound and its whole upload is charged against the limit; the poll timeout for a save sending
|
|
934
|
-
* no tree.
|
|
935
|
-
*/
|
|
936
|
-
private saveTimeout;
|
|
937
961
|
/**
|
|
938
962
|
* Replace a method's draft — `PUT /v1/methods/{id}/draft` — and return the method with the
|
|
939
963
|
* draft's new token (`updated_at`) and digest (`draft_digest`).
|
|
@@ -957,11 +981,26 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
957
981
|
* when the method kept changing under the write.
|
|
958
982
|
*/
|
|
959
983
|
writeDraft(methodId: string, input: MethodDraftInput): Promise<MethodData>;
|
|
984
|
+
/**
|
|
985
|
+
* Send a save carrying a method's tree (`createMethod`, `writeDraft`) through the path every
|
|
986
|
+
* request sends a tree by (`postMethodRequest`), its body built by `bodyOf` from the `files`
|
|
987
|
+
* prepared, under `saveTimeoutMs`, and read the stored method it answers as
|
|
988
|
+
* `requestMethodData` reads it.
|
|
989
|
+
*/
|
|
990
|
+
private saveMethodTree;
|
|
991
|
+
/**
|
|
992
|
+
* The time limit of a save carrying `files`: the client's request ceiling, as for a `start`
|
|
993
|
+
* carrying its method, since a tree sent inline to a deployment with no blob store weighs up to
|
|
994
|
+
* its `max_inline_bytes`, a `files` map given as is whatever it weighs, and the whole upload is
|
|
995
|
+
* charged against the limit; the poll timeout for a save sending no tree.
|
|
996
|
+
*/
|
|
997
|
+
private saveTimeoutMs;
|
|
960
998
|
/**
|
|
961
999
|
* The limits the deployment holds a method's tree to — `GET /v1/version`, read from
|
|
962
1000
|
* `limits.method_tree` of the public handshake — in the shape the `mthds` package's
|
|
963
1001
|
* `listMethodTree` takes as its `limits` option, so a tree the platform would refuse is refused
|
|
964
|
-
* while it is listed, before any file is hashed
|
|
1002
|
+
* while it is listed, before any file is hashed. A `directory` given to any route is listed under
|
|
1003
|
+
* them already; they serve a caller listing a tree of its own:
|
|
965
1004
|
*
|
|
966
1005
|
* ```ts
|
|
967
1006
|
* import { listMethodTree } from "mthds";
|
|
@@ -971,14 +1010,18 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
971
1010
|
*
|
|
972
1011
|
* A limit the server does not announce is absent, so a bare runner, which announces none,
|
|
973
1012
|
* yields no limit, and none is ever assumed. A value that is not a positive integer is left out
|
|
974
|
-
* rather than trusted.
|
|
1013
|
+
* rather than trusted. The inline limit, `max_inline_bytes`, is no listing limit: the client
|
|
1014
|
+
* applies it itself when it chooses how a tree travels.
|
|
975
1015
|
*/
|
|
976
1016
|
methodTreeLimits(): Promise<MethodTreeLimits>;
|
|
977
1017
|
/**
|
|
978
|
-
* The version handshake, asked once per
|
|
979
|
-
* and a failure is thrown and not kept, so the next call asks again.
|
|
1018
|
+
* The version handshake, asked once per `HANDSHAKE_TTL_MS`: an answer is kept that long (see
|
|
1019
|
+
* `versionCache`), and a failure is thrown and not kept, so the next call asks again. `signal`
|
|
1020
|
+
* stops the ask, its abort thrown as is.
|
|
980
1021
|
*/
|
|
981
1022
|
private cachedVersion;
|
|
1023
|
+
/** Drop the kept handshake, which a refusal has shown to be stale. */
|
|
1024
|
+
private forgetHandshake;
|
|
982
1025
|
/**
|
|
983
1026
|
* Write a saved method's tree to disk: each file of a listing `getMethod` or `getMethodVersion`
|
|
984
1027
|
* served, at its tree path under `options.destination`. **Node only.**
|
|
@@ -1004,29 +1047,84 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1004
1047
|
destination: string;
|
|
1005
1048
|
}): Promise<void>;
|
|
1006
1049
|
/**
|
|
1007
|
-
* The
|
|
1008
|
-
*
|
|
1009
|
-
* `RequestArgumentError` before any request, naming `call
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
|
|
1023
|
-
|
|
1050
|
+
* The method's tree a call was given, made ready to prepare: a `directory` listed, `contents`
|
|
1051
|
+
* turned into a tree, a `tree` checked, `files` kept as given; `undefined` when the input gives
|
|
1052
|
+
* none. Two forms are refused with `RequestArgumentError` before any request, naming `call`, and
|
|
1053
|
+
* so are a `directory` that is not a string and a `tree` that is not a listed tree. A
|
|
1054
|
+
* `directory` is listed by the `mthds` package's lister under the limits the deployment
|
|
1055
|
+
* announces, so a tree past one is refused while it is listed, before any file is hashed; the
|
|
1056
|
+
* handshake that announces them is asked under `signal`. It is listed once per call: a request
|
|
1057
|
+
* sent again sends the tree this listing read.
|
|
1058
|
+
*/
|
|
1059
|
+
private treeToSend;
|
|
1060
|
+
/**
|
|
1061
|
+
* Post a request carrying a method's tree, by `mthds`'s `MthdsApiClient` rule: prepare the
|
|
1062
|
+
* tree's `files` (`prepareFiles`), hand them to `post`, which builds the body and sends it, and
|
|
1063
|
+
* answer the two refusals that call for sending the same request once more, as `mthds` does.
|
|
1064
|
+
*
|
|
1065
|
+
* - A `422` coded `request.blobs_missing` whose `missing_blobs` the tree sent by hash holds, such
|
|
1066
|
+
* as a blob dropped since the check: the blob route is asked again for those, they are
|
|
1067
|
+
* uploaded, and the request is sent once more (`postWithBlobRetry`).
|
|
1068
|
+
* - A `422` refusing a tree the client prepared as past one of the receiver's limits
|
|
1069
|
+
* (`isMethodTreeTooLarge`): the handshake that announced the limits may be stale, so it is
|
|
1070
|
+
* forgotten, and the tree prepared again on a fresh one and sent once more. A `files` map
|
|
1071
|
+
* given as is was not prepared, so it is never sent again; nor is a request whose
|
|
1072
|
+
* `options.retryTooLarge` is `false`, a start under an idempotency key, which the platform
|
|
1073
|
+
* binds to the refusal it stores.
|
|
1074
|
+
*
|
|
1075
|
+
* A `422` created nothing, so the request sent again is no repeat of one whose outcome is
|
|
1076
|
+
* unknown. `initial`, when given, is the tree already prepared for the first send, with the
|
|
1077
|
+
* bytes it read, so a caller sending one tree on two routes prepares it once. `options.signal`
|
|
1078
|
+
* is read before each step of the preparation and before each send. Answers the last answer
|
|
1079
|
+
* whole, its status unread, with the `files` it carried.
|
|
1080
|
+
*/
|
|
1081
|
+
private postMethodRequest;
|
|
1082
|
+
/**
|
|
1083
|
+
* Send a request whose tree may have travelled by hash. When it did and the receiver answers a
|
|
1084
|
+
* `422` coded `request.blobs_missing` whose `missing_blobs` the tree holds, the client asks the
|
|
1085
|
+
* blob route where to upload them, uploads them and sends the same request once more, which the
|
|
1086
|
+
* refusal left uncreated; any other answer, or a list naming a blob the tree does not hold, is
|
|
1087
|
+
* answered as it came.
|
|
1088
|
+
*/
|
|
1089
|
+
private postWithBlobRetry;
|
|
1090
|
+
/**
|
|
1091
|
+
* The `files` a request or a save sends for `source`: a `files` map as given, a tree prepared
|
|
1092
|
+
* (`prepareTree`), or none.
|
|
1093
|
+
*/
|
|
1094
|
+
private prepareFiles;
|
|
1095
|
+
/**
|
|
1096
|
+
* The `files` map that sends `tree`: inline, or by hash once the receiver holds every file —
|
|
1097
|
+
* `mthds`'s `MthdsApiClient` rule, read from the version handshake the client keeps.
|
|
1098
|
+
*
|
|
1099
|
+
* When the handshake declares a blob store, a tree whose inline map weighs no more than the
|
|
1100
|
+
* inline threshold travels inline, measured as the request spends it, its JSON with no
|
|
1101
|
+
* whitespace in UTF-8; the threshold is the lower of 256 KiB (`INLINE_TREE_MAX_BYTES`) and the
|
|
1102
|
+
* `max_inline_bytes` the handshake announces, and a tree whose files alone pass it is not read
|
|
1103
|
+
* to be weighed. A heavier tree travels by hash: `POST /v1/blobs/missing` is asked which files
|
|
1104
|
+
* the receiver lacks, naming the tree's digest, each one it lacks is uploaded once, and every
|
|
1105
|
+
* file travels by hash. A `404` from the blob route says the handshake that declared the store
|
|
1106
|
+
* is stale, so it is forgotten and the tree prepared once more on a fresh one. When the
|
|
1107
|
+
* handshake declares no blob store, the whole tree travels inline whatever its weight, held to
|
|
1108
|
+
* the announced `max_inline_bytes` (`inlineWithin`). Each file is read at most once into `read`,
|
|
1109
|
+
* so a file read to be weighed is uploaded from memory. A tree holding no file is refused with
|
|
1110
|
+
* `RequestArgumentError` before any request, `call` naming the caller's method.
|
|
1111
|
+
* `options.readScope` is the scope the blob route is asked under, and `options.signal` is read
|
|
1112
|
+
* before each read, the handshake, the blob route and each upload, and is passed to each of
|
|
1113
|
+
* them, so an abort also stops a request or an upload under way.
|
|
1114
|
+
*/
|
|
1115
|
+
private prepareTree;
|
|
1024
1116
|
/**
|
|
1025
1117
|
* Which of these blobs the organization lacks, and where to upload each —
|
|
1026
1118
|
* `POST /v1/blobs/missing` — with the answer it was read from, which carries signed links. A
|
|
1027
1119
|
* blob held is left out, and an empty `missing` means nothing to upload. An answer whose
|
|
1028
1120
|
* `missing` is not a list of blobs, each with its upload target, is an answer the SDK cannot
|
|
1029
1121
|
* read, thrown as an `ApiResponseError` holding the answer with its links hidden.
|
|
1122
|
+
*
|
|
1123
|
+
* `readScope`, a crate request's `read_scope`, is sent as the route's `read_scope` query, the
|
|
1124
|
+
* Pipelex API's extension naming the blob store asked, so the blobs are uploaded into the store
|
|
1125
|
+
* the request's hash entries are read from; each upload target is signed for that scope. The
|
|
1126
|
+
* hosted platform's own route reads the caller's organization instead. `signal` stops the
|
|
1127
|
+
* request, its abort thrown as is.
|
|
1030
1128
|
*/
|
|
1031
1129
|
private findMissingBlobs;
|
|
1032
1130
|
/**
|
|
@@ -1035,9 +1133,14 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1035
1133
|
* is the platform's fault, thrown before anything is sent as the `ApiResponseError` of an answer
|
|
1036
1134
|
* the SDK cannot read. The bytes the tree reads for a blob are checked against it before they
|
|
1037
1135
|
* are sent, since storage keeps a blob under the hash it is named by: bytes of another hash or
|
|
1038
|
-
* size are refused with `RequestArgumentError`, and nothing more is uploaded.
|
|
1136
|
+
* size are refused with `RequestArgumentError`, and nothing more is uploaded. `userSignal` is
|
|
1137
|
+
* read before each blob's read and before its upload, and reaches each upload under way: once it
|
|
1138
|
+
* has aborted, no further blob is read or sent, the uploads in flight are stopped, and the abort
|
|
1139
|
+
* is thrown rather than a transfer failure.
|
|
1039
1140
|
*/
|
|
1040
1141
|
private uploadMissing;
|
|
1142
|
+
/** Read, check and upload one missing blob (see `uploadMissing`). */
|
|
1143
|
+
private uploadOne;
|
|
1041
1144
|
/**
|
|
1042
1145
|
* Rename a method — `PATCH /v1/methods/{id}` — and return it. The name belongs to the method,
|
|
1043
1146
|
* not to a version: a rename changes nothing else, moves no token, and never commits the
|
|
@@ -1386,8 +1489,9 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1386
1489
|
* Name the method exactly one of three ways, all server-resolved through the
|
|
1387
1490
|
* one `pipeIo` call this composes:
|
|
1388
1491
|
*
|
|
1389
|
-
* -
|
|
1390
|
-
*
|
|
1492
|
+
* - the method's tree — a `directory`, `contents`, a listed `tree` or the `files`
|
|
1493
|
+
* map, sent as `pipeIo` sends it, with the files its steps read (a `PipeDocGen`
|
|
1494
|
+
* step's `template_file`) among its files;
|
|
1391
1495
|
* - `method_ref` — a published method's address, fetched by the runner;
|
|
1392
1496
|
* - `method_id` — a stored method's catalog id, resolved by the platform
|
|
1393
1497
|
* (hosted only; requires an API key).
|
|
@@ -1474,9 +1578,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1474
1578
|
/**
|
|
1475
1579
|
* The whole record for one run — `GET /v1/runs/{id}`.
|
|
1476
1580
|
*
|
|
1477
|
-
* The ONLY call that returns
|
|
1478
|
-
*
|
|
1479
|
-
* few seconds. A failed run's stored report, `error`, is checked field by
|
|
1581
|
+
* The ONLY call that returns what the run actually executed and its
|
|
1582
|
+
* `inputs`. Kept off the status read, which pollers hit every few seconds. A failed run's stored report, `error`, is checked field by
|
|
1480
1583
|
* field (see `RunErrorReport`).
|
|
1481
1584
|
*
|
|
1482
1585
|
* Read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the inputs is a
|
|
@@ -1486,6 +1589,14 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1486
1589
|
getRunDetail(runId: string): Promise<RunDetail>;
|
|
1487
1590
|
/** Patch a run's status (admin/manual) — `PUT /v1/runs/{id}`. */
|
|
1488
1591
|
updateRun(runId: string, input: UpdateRunInput): Promise<void>;
|
|
1592
|
+
/**
|
|
1593
|
+
* A run's arguments checked before anything is listed, read or sent, `call` naming the caller's
|
|
1594
|
+
* method in each refusal: the generic `extra` passthrough, the Pipelex API's and the hosted
|
|
1595
|
+
* API's own selectors, and the method's tree in its forms as the standard checks them; then the
|
|
1596
|
+
* "something to run" precondition, the `method_ref` pairings and the linkage form's bare
|
|
1597
|
+
* `method_id`.
|
|
1598
|
+
*/
|
|
1599
|
+
private runParts;
|
|
1489
1600
|
/**
|
|
1490
1601
|
* Blocking `POST /v1/execute` adapted onto `RunResults` — the bare-runner
|
|
1491
1602
|
* path. Forwards every protocol field PLUS every extension surface: the
|