@pipelex/sdk 0.46.1 → 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 +20 -9
- 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 +455 -237
- package/dist/client.js +1067 -522
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +49 -19
- package/dist/errors.js +50 -21
- 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 +7 -7
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/method-trees.d.ts +344 -0
- package/dist/method-trees.js +876 -0
- package/dist/method-trees.js.map +1 -0
- 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 +97 -75
- package/dist/runs.d.ts +5 -3
- package/dist/runs.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +20 -21
- package/docs/cli.md +1 -1
- package/docs/crate-routes.md +42 -20
- package/docs/errors.md +7 -6
- package/docs/hook-bundle.md +1 -1
- package/docs/input-preparation.md +15 -40
- package/docs/method-trees.md +199 -0
- 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/dist/method-source.d.ts +0 -19
- package/dist/method-source.js +0 -50
- package/dist/method-source.js.map +0 -1
- package/docs/bundle-resources.md +0 -107
package/dist/client.d.ts
CHANGED
|
@@ -1,27 +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,
|
|
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
|
-
import type { BillingPortalResponse, ChangePlanResponse, CheckoutResponse, InvoiceView, Membership, MembershipsResponse, ListMethodExamplesQuery, ListMethodsQuery, ListMethodVersionsQuery, MethodData, MethodDeletionAccepted, MethodDraftInput, MethodExample, MethodExampleCreateInput, MethodExampleLatestRunInput, MethodExampleLatestRunResult, MethodExamplePage, MethodExampleUpdateInput, MethodPage, MethodPublishInput, MethodPublishResult, MethodRenameInput, MethodSummary, MethodVersion, MethodVersionPage, MethodWriteInput, OnboardingSubmission, PipelexApiKeyCreated, PipelexApiKeyList, ListRunsQuery, RunHistoryItem, RunDetail, RunPage, PlanView, ResolvedStorageUrl, SubscriptionResponse, UpdateRunInput, UploadGrant, UploadGrantInput, UploadInput, UploadedFile, UserProfile } from "./product-models.js";
|
|
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 { MethodTreeForms, MethodTreeLimits } from "./method-trees.js";
|
|
5
6
|
import type { AppInfo } from "./user-agent.js";
|
|
6
7
|
import type { UploadableAsset, UploadFileOptions, UploadRecord } from "./upload.js";
|
|
7
|
-
import type { BundleResources } from "./bundle-resources.js";
|
|
8
8
|
import type { PrepareInputsRequest, PreparedInputs } from "./prepare-inputs.js";
|
|
9
9
|
import type { BulkResolveStorageUrlsInput, BulkResolvedStorageUrls, DownloadArtifactsRequest, DownloadArtifactsResult, FetchArtifactOptions, ResolvedArtifact } from "./artifacts.js";
|
|
10
10
|
import { PipelexExecuteResult } from "./execute-result.js";
|
|
11
|
-
export interface MthdsFile {
|
|
12
|
-
/** File contents to validate. */
|
|
13
|
-
content: string;
|
|
14
|
-
/** Optional provenance URI threaded into validation diagnostics. */
|
|
15
|
-
uri?: string;
|
|
16
|
-
}
|
|
17
11
|
/**
|
|
18
|
-
* The Pipelex API's own run
|
|
19
|
-
* reads, beside the protocol's
|
|
20
|
-
*
|
|
21
|
-
* deployment, bare or hosted (on `api.pipelex.com`, once the platform deploy
|
|
22
|
-
* 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.
|
|
23
15
|
*
|
|
24
|
-
*
|
|
16
|
+
* A named option rather than an `extra` entry, for the same reason as the hosted
|
|
25
17
|
* extensions below: `extra` remains the escape hatch for an extension this
|
|
26
18
|
* client does not know about, never the way to pass one it does.
|
|
27
19
|
*/
|
|
@@ -33,32 +25,18 @@ export interface PipelexApiRunExtensions {
|
|
|
33
25
|
* default branch at HEAD), the package is located by manifest identity, and
|
|
34
26
|
* the resolved commit SHA comes back as `method_provenance` on the response.
|
|
35
27
|
*
|
|
36
|
-
* A complete run source of its own — the fetched package carries its
|
|
37
|
-
* and its entry pipe — so it pairs with NOTHING: exclusive with
|
|
38
|
-
*
|
|
39
|
-
* the hosted `method_id` (an address run has its own provenance and
|
|
40
|
-
* linkage id). `pipe_code` beside it is fine — it overrides the
|
|
41
|
-
* `main_pipe` to pick which pipe in the fetched package to run. This
|
|
42
|
-
* rejects the illegal pairings before anything hits the wire, mirroring
|
|
43
|
-
* 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.
|
|
44
36
|
*
|
|
45
37
|
* An empty string is treated as absent and is not sent.
|
|
46
38
|
*/
|
|
47
39
|
method_ref?: string | null;
|
|
48
|
-
/**
|
|
49
|
-
* The files the bundle's steps read, such as a `PipeDocGen` step's `template_file`, keyed
|
|
50
|
-
* by the path the step names (`templates/invoice.docx`), each as its bytes (a `Uint8Array`,
|
|
51
|
-
* a Node `Buffer` included, an `ArrayBuffer` or a `Blob`). The client sends them as the
|
|
52
|
-
* wire's `resources`, each file in standard base64; see `docs/bundle-resources.md`.
|
|
53
|
-
*
|
|
54
|
-
* They accompany the bundle whose steps read them: inline `mthds_contents` or a method
|
|
55
|
-
* bundle (`files` / `bundle_b64`), or a hosted `method_id` the platform resolves. Beside a
|
|
56
|
-
* `method_ref` (whose files are its package's own), or with no source at all, they are
|
|
57
|
-
* rejected client-side, mirroring the server's `422`. A key that cannot name a file inside
|
|
58
|
-
* the bundle (absolute, a `..` segment, a backslash, a colon) is rejected client-side too.
|
|
59
|
-
* An absent, `null` or empty map is not sent.
|
|
60
|
-
*/
|
|
61
|
-
resources?: BundleResources | null;
|
|
62
40
|
}
|
|
63
41
|
/**
|
|
64
42
|
* The hosted API's own run arguments — the layer-3 extensions this client adds
|
|
@@ -87,14 +65,14 @@ export interface PipelexHostedRunExtensions {
|
|
|
87
65
|
* for a version never published; `mt_…@draft` runs the draft. The suffix
|
|
88
66
|
* rides the string untouched, any other suffix is a `422`, and the answer's
|
|
89
67
|
* `method_version` says which version runs.
|
|
90
|
-
* - **Alongside
|
|
91
|
-
* — 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
|
|
92
70
|
* **run-history linkage** on the Run row. That linkage is what writes the
|
|
93
71
|
* index key `GET /v1/runs?method_id=` queries, so a run started without it
|
|
94
72
|
* is absent from its method's history permanently. The id must be bare
|
|
95
|
-
* there: the
|
|
96
|
-
*
|
|
97
|
-
*
|
|
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).
|
|
98
76
|
* - **Alongside `method_ref`** — rejected client-side (and a 422 on the
|
|
99
77
|
* hosted API): an address run carries its own provenance, so it takes no
|
|
100
78
|
* linkage id.
|
|
@@ -103,8 +81,21 @@ export interface PipelexHostedRunExtensions {
|
|
|
103
81
|
*/
|
|
104
82
|
method_id?: string | null;
|
|
105
83
|
}
|
|
106
|
-
/**
|
|
107
|
-
|
|
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;
|
|
108
99
|
/**
|
|
109
100
|
* What a run start sends beside its body: the request's own headers, which no run argument
|
|
110
101
|
* reaches. Each is camelCase, since none of them is a wire field of the run request.
|
|
@@ -135,52 +126,32 @@ export interface PipelexStartRequestOptions {
|
|
|
135
126
|
* `start()` / `startAndWaitForResult()` options — the same, for the durable path, plus the start
|
|
136
127
|
* request's own `idempotencyKey`.
|
|
137
128
|
*/
|
|
138
|
-
export type PipelexStartOptions = StartOptions & PipelexApiRunExtensions & PipelexHostedRunExtensions & PipelexStartRequestOptions;
|
|
129
|
+
export type PipelexStartOptions = StartOptions & MethodTreeForms & PipelexApiRunExtensions & PipelexHostedRunExtensions & PipelexStartRequestOptions;
|
|
139
130
|
/**
|
|
140
|
-
* The method selector `validate()` takes in place of
|
|
141
|
-
* 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
|
|
142
133
|
* path consumers have always used.
|
|
143
134
|
*/
|
|
144
|
-
export type { ValidateMethodSelector };
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
allowSignatures?: boolean;
|
|
148
|
-
/** Optional validate presentation hints, e.g. ["markdown"]. */
|
|
149
|
-
render?: string[];
|
|
150
|
-
/** Optional structured-view opt-in tokens, e.g. ["input_form", "output_form"]; sent only when given. */
|
|
151
|
-
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 {
|
|
152
138
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
139
|
+
* Validate presentation hints, a list of view-format tokens. The client always adds
|
|
140
|
+
* `"markdown"`, so both arms carry `rendered_markdown`.
|
|
155
141
|
*/
|
|
156
|
-
|
|
142
|
+
render?: string[];
|
|
143
|
+
/** Structured-view opt-in tokens, e.g. `["input_form", "output_form"]`; sent only when given. */
|
|
144
|
+
views?: string[];
|
|
157
145
|
/**
|
|
158
146
|
* Per-call request ceiling; defaults to the 20-min execute ceiling. A positive number
|
|
159
147
|
* no larger than 2147483647, the longest delay a timer honours, else a `RangeError`.
|
|
160
148
|
*/
|
|
161
149
|
timeoutMs?: number;
|
|
162
|
-
/** Caller-driven cancellation; the abort reason propagates untouched. */
|
|
163
|
-
signal?: AbortSignal;
|
|
164
|
-
}
|
|
165
|
-
/** `validate()`'s last argument: what rides beside the method, and the call's own transport. */
|
|
166
|
-
export interface ValidateOptions {
|
|
167
150
|
/**
|
|
168
|
-
*
|
|
169
|
-
* the
|
|
170
|
-
*
|
|
171
|
-
* file in standard base64; see `docs/bundle-resources.md`. They accompany inline contents, or
|
|
172
|
-
* a hosted `{ method_id }` the platform resolves; beside a `{ method_ref }` they are rejected
|
|
173
|
-
* client-side, mirroring the server's `422`. A step whose template file was not sent makes the
|
|
174
|
-
* verdict invalid, saying so; the dry run checks an office template file it was sent and adds
|
|
175
|
-
* 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).
|
|
176
154
|
*/
|
|
177
|
-
resources?: BundleResources | null;
|
|
178
|
-
/**
|
|
179
|
-
* Per-call request ceiling; defaults to the 20-min execute ceiling. A positive number
|
|
180
|
-
* no larger than 2147483647, the longest delay a timer honours, else a `RangeError`.
|
|
181
|
-
*/
|
|
182
|
-
timeoutMs?: number;
|
|
183
|
-
/** Caller-driven cancellation; the abort reason propagates untouched. */
|
|
184
155
|
signal?: AbortSignal;
|
|
185
156
|
}
|
|
186
157
|
export interface PipelexApiClientOptions {
|
|
@@ -203,6 +174,15 @@ export interface PipelexApiClientOptions {
|
|
|
203
174
|
* beside the specs' tests.
|
|
204
175
|
*/
|
|
205
176
|
appInfo?: AppInfo;
|
|
177
|
+
/**
|
|
178
|
+
* The client's request ceiling, in milliseconds: the time limit of a request given no
|
|
179
|
+
* `timeoutMs` of its own, the blocking `execute`, a `start` carrying its method and a save
|
|
180
|
+
* carrying a method's tree (`createMethod`, `writeDraft`) among them, and of each transfer of a method's file to or from storage, an upload before a save or a
|
|
181
|
+
* download by `writeMethodTree`. Defaults to 20 minutes, the runner's blocking execute ceiling.
|
|
182
|
+
* A positive number no larger than 2147483647, the longest delay a timer honours, else a
|
|
183
|
+
* `RangeError` at construction.
|
|
184
|
+
*/
|
|
185
|
+
requestTimeoutMs?: number;
|
|
206
186
|
}
|
|
207
187
|
/** Hosted default — the client composes every endpoint as `{base}/v1/{endpoint}`. */
|
|
208
188
|
export declare const DEFAULT_API_BASE_URL = "https://api.pipelex.com";
|
|
@@ -219,6 +199,16 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
219
199
|
private readonly originUrl;
|
|
220
200
|
/** Cached `/v1/version` handshake outcome — whether the durable lifecycle is served. */
|
|
221
201
|
private lifecycleAvailable;
|
|
202
|
+
/**
|
|
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`).
|
|
208
|
+
*/
|
|
209
|
+
private versionCache;
|
|
210
|
+
/** The client's request ceiling (`PipelexApiClientOptions.requestTimeoutMs`). */
|
|
211
|
+
private readonly requestTimeoutMs;
|
|
222
212
|
/**
|
|
223
213
|
* The `User-Agent` sent on every API request, computed once at construction;
|
|
224
214
|
* `undefined` in a browser, where no header may be set.
|
|
@@ -262,19 +252,18 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
262
252
|
*/
|
|
263
253
|
private requestProductObject;
|
|
264
254
|
/**
|
|
265
|
-
* A methods-catalog route answering one stored method (`
|
|
266
|
-
* `
|
|
255
|
+
* A methods-catalog route answering one stored method (`createMethod`, `writeDraft`,
|
|
256
|
+
* `renameMethod`), read as `readObjectAnswer` reads it.
|
|
267
257
|
*/
|
|
268
258
|
private requestMethodData;
|
|
269
259
|
/**
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* change to the call fixes it. `subject` names what carried them in the message.
|
|
260
|
+
* A route answering a saved tree's listing beside what names it (`getMethod`,
|
|
261
|
+
* `getMethodVersion`), read as `readObjectAnswer` reads it, then its `files` checked: a listing
|
|
262
|
+
* that is not an array of `{ path, sha256, size, url, expires_at }`, each a string but `size`, a
|
|
263
|
+
* non-negative integer, is an answer the SDK cannot read, since `writeMethodTree` would write
|
|
264
|
+
* from it. Throws the `ApiResponseError` `unreadableAnswer` builds, `subject` naming the answer.
|
|
276
265
|
*/
|
|
277
|
-
private
|
|
266
|
+
private readSavedTree;
|
|
278
267
|
/**
|
|
279
268
|
* A verdict, the `200` a route answers discriminated on `outcome` with the object the verdict
|
|
280
269
|
* is about as one `member`: `publishMethod`'s `method`, `recordMethodExampleLatestRun`'s
|
|
@@ -315,7 +304,10 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
315
304
|
* member included.
|
|
316
305
|
*/
|
|
317
306
|
private readMethodExample;
|
|
318
|
-
/**
|
|
307
|
+
/**
|
|
308
|
+
* Issue a product request and return its 2xx answer, a non-2xx thrown as `ApiResponseError`.
|
|
309
|
+
* The request takes the poll timeout unless `options.timeoutMs` gives another.
|
|
310
|
+
*/
|
|
319
311
|
private requestProductAnswer;
|
|
320
312
|
private throwApiResponseError;
|
|
321
313
|
/** The JSON body of a `/v1` route's 2xx answer; see `readAnswerAt`. */
|
|
@@ -349,7 +341,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
349
341
|
* `API <method> <path> answered <status> with <what>`: the answer's status, its raw text as
|
|
350
342
|
* `responseBody`, no hosted problem member but the `X-Request-ID` header, the failure that made it
|
|
351
343
|
* unreadable as `cause`, and the verdict the fallback gives a 2xx, `runtime` and not retryable.
|
|
352
|
-
*
|
|
344
|
+
* An answer that carries signed links (`RawResponse.carriesLinks`) is held with every link
|
|
345
|
+
* hidden, and with no `cause`, which could quote one. On a request that may create a run, the run may have started: the server accepted it.
|
|
353
346
|
*/
|
|
354
347
|
private unreadableAnswer;
|
|
355
348
|
/**
|
|
@@ -403,8 +396,21 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
403
396
|
*
|
|
404
397
|
* The answer is read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the
|
|
405
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.
|
|
406
405
|
*/
|
|
407
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;
|
|
408
414
|
/**
|
|
409
415
|
* Start a method asynchronously — `POST /v1/start` (202, no output yet).
|
|
410
416
|
*
|
|
@@ -424,33 +430,51 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
424
430
|
* `runMayHaveStarted` is true can be retried unchanged (see
|
|
425
431
|
* `PipelexStartRequestOptions`). A malformed key is a `RequestArgumentError`
|
|
426
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.
|
|
427
439
|
*/
|
|
428
440
|
start(options: PipelexStartOptions): Promise<PipelexRunResultStart>;
|
|
429
441
|
/**
|
|
430
|
-
*
|
|
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`.
|
|
431
447
|
*
|
|
432
448
|
* `/validate` is a diagnostic endpoint: every produced verdict rides a **200**,
|
|
433
449
|
* discriminated on `is_valid`. This returns the `PipelexValidationResult` union
|
|
434
450
|
* verbatim — `is_valid: true` ⇒ the typed `PipelexValidationReport` (structural
|
|
435
451
|
* artifacts), `is_valid: false` ⇒ a `PipelexInvalidReport` (`validation_errors[]`).
|
|
436
|
-
* An invalid
|
|
437
|
-
* *no-verdict* condition (a malformed request,
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
* `source`
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
444
|
-
* - **
|
|
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`;
|
|
445
469
|
* - **`{ method_ref }`** — a published method's address, resolved by the
|
|
446
470
|
* server (pipelex-api >= 0.21.0) through the same fetch path as a
|
|
447
|
-
* `method_ref` run, the package's real
|
|
471
|
+
* `method_ref` run, the package's real tree paths feeding the diagnostics'
|
|
448
472
|
* source labels;
|
|
449
473
|
* - **`{ method_id }`** — a stored method's catalog id, hosted-only: the
|
|
450
|
-
* platform resolves the version it names and
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
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.
|
|
454
478
|
*
|
|
455
479
|
* A selector-resolution failure (fetch failure, no package at the address, an
|
|
456
480
|
* unknown or foreign-org id, a bare id of a method never published, `409`
|
|
@@ -459,40 +483,23 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
459
483
|
* `ApiResponseError` — never an `is_valid: false` verdict, which is reserved
|
|
460
484
|
* for actual MTHDS content.
|
|
461
485
|
*
|
|
462
|
-
* `
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
*
|
|
471
|
-
* `
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
* top-level field to the valid arm — `input_form` and `output_form`. Unlike `render`,
|
|
480
|
-
* this client sends `views` ONLY when the caller asks: the point of an opt-in view
|
|
481
|
-
* is that the default response stays byte-identical, and the highest-frequency
|
|
482
|
-
* consumers (hook pipelines, CI gates, agent loops) never pay for bytes they
|
|
483
|
-
* discard. `pipelex-api` gates `input_form` on this token as of 0.18.0; a 0.17.0
|
|
484
|
-
* runner resolved no token (the key is silently ignored, never a 422) and emitted
|
|
485
|
-
* the field regardless — which is why `PipelexValidationReport.input_form` is typed
|
|
486
|
-
* optional rather than required.
|
|
487
|
-
*
|
|
488
|
-
* `options.resources` sends the files the bundle's steps read, such as a
|
|
489
|
-
* `PipeDocGen` step's `template_file`, keyed by the path the step names, each as
|
|
490
|
-
* its bytes (see {@link ValidateOptions}). A step whose template file was not sent
|
|
491
|
-
* is an `is_valid: false` verdict saying so, and a template check's findings in an
|
|
492
|
-
* office template file ride the valid arm's `warnings`. A key no step names, or
|
|
493
|
-
* files over the server's limits, are no-verdict refusals: a `422`
|
|
494
|
-
* `BundleResourceNotNamedError`, a `413` `PayloadTooLarge` or
|
|
495
|
-
* `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.
|
|
496
503
|
*
|
|
497
504
|
* A `{ method_ref }` source makes the server clone a repository before it
|
|
498
505
|
* validates anything, and it needs no special budget here: this route already
|
|
@@ -502,16 +509,7 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
502
509
|
* exists to RAISE routes whose default is the ~30s poll ceiling; applying it here
|
|
503
510
|
* would lower this one.
|
|
504
511
|
*/
|
|
505
|
-
validate(source:
|
|
506
|
-
/**
|
|
507
|
-
* Validate paired MTHDS files while preserving URI attribution for diagnostics.
|
|
508
|
-
*
|
|
509
|
-
* This adapter intentionally keeps the low-level `validate(...)` payload shape
|
|
510
|
-
* intact for existing consumers. When any file has a URI, every content gets a
|
|
511
|
-
* parallel source label; inline labels are deterministic so the server never
|
|
512
|
-
* sees a length-mismatched `mthds_sources` array.
|
|
513
|
-
*/
|
|
514
|
-
validateFiles(files: MthdsFile[], options?: ValidateFilesOptions): Promise<PipelexValidationResult>;
|
|
512
|
+
validate(source: PipelexValidateSource, allowSignatures?: boolean, options?: ValidateOptions): Promise<PipelexValidationResult>;
|
|
515
513
|
/**
|
|
516
514
|
* Lint one `.mthds` file against the embedded MTHDS schema — `POST /v1/lint`.
|
|
517
515
|
*
|
|
@@ -553,11 +551,10 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
553
551
|
* never on a message.
|
|
554
552
|
*
|
|
555
553
|
* All of these are static and inference-free, so they default to the management-call
|
|
556
|
-
* timeout. The internal
|
|
554
|
+
* timeout. The internal raise is `crateRequestTimeoutMs`'s: the fetch-sized budget a
|
|
557
555
|
* crate route gets when its closure is a `method_ref`, because the server may clone a
|
|
558
|
-
* repository before it answers
|
|
559
|
-
*
|
|
560
|
-
* 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.
|
|
561
558
|
*
|
|
562
559
|
* **These routes deliberately expose no `timeoutMs` / `signal`, and that is not an
|
|
563
560
|
* oversight to be "fixed" per route.** Automated reviewers have proposed adding them
|
|
@@ -568,11 +565,11 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
568
565
|
* ceiling and takes caller transport options; every extension route rides the
|
|
569
566
|
* static core. Giving one static route an override while its siblings lack one is
|
|
570
567
|
* the inconsistency.
|
|
571
|
-
* 2. The input is **bounded server-side** — the
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
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.
|
|
576
573
|
* 3. On the hosted path an override would be **inert**: the gateway caps responses at
|
|
577
574
|
* ~30s (see `POLL_REQUEST_TIMEOUT_MS` above), so raising `timeoutMs` would still be
|
|
578
575
|
* cut off upstream, just with a less honest error.
|
|
@@ -580,6 +577,12 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
580
577
|
* If a static route ever genuinely needs longer, give the WHOLE static family one
|
|
581
578
|
* uniform transport-options parameter in a single pass — do not bolt it onto one
|
|
582
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.
|
|
583
586
|
*/
|
|
584
587
|
private requestExtension;
|
|
585
588
|
/** The model deck the runner can route to — `GET /v1/models[?type=]`. */
|
|
@@ -609,6 +612,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
609
612
|
* The handshake for feature detection (hosted extensions or not).
|
|
610
613
|
*/
|
|
611
614
|
version(): Promise<VersionInfo>;
|
|
615
|
+
/** `GET /v1/version`, as `version` asks it, stopped by `signal`. */
|
|
616
|
+
private requestVersion;
|
|
612
617
|
/**
|
|
613
618
|
* Resolve a closure into its normalized library crate — `POST /v1/resolve`.
|
|
614
619
|
*
|
|
@@ -627,12 +632,22 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
627
632
|
* (fetch failure, no package at the address, an unknown or foreign-org id) is
|
|
628
633
|
* non-2xx too — never an `is_valid: false` verdict.
|
|
629
634
|
*
|
|
630
|
-
* The closure arrives in exactly one of three forms:
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
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.
|
|
634
649
|
*/
|
|
635
|
-
resolve(request: ResolveRequest): Promise<ResolveResponse>;
|
|
650
|
+
resolve(request: ResolveRequest, options?: CrateRouteOptions): Promise<ResolveResponse>;
|
|
636
651
|
/**
|
|
637
652
|
* Project a closure's crate into stamped typed artifacts — `POST /v1/codegen`.
|
|
638
653
|
*
|
|
@@ -648,7 +663,7 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
648
663
|
* unknown `kind`/`target`, a `pipe_ref` on the concept-set-wide `types` kind, or
|
|
649
664
|
* a malformed selector is a 422; a registry-form `method_ref` is a `501`.
|
|
650
665
|
*/
|
|
651
|
-
codegen(request: CodegenRequest): Promise<CodegenResponse>;
|
|
666
|
+
codegen(request: CodegenRequest, options?: CrateRouteOptions): Promise<CodegenResponse>;
|
|
652
667
|
/**
|
|
653
668
|
* Read a method's three I/O artifacts — `POST /v1/pipe-io`.
|
|
654
669
|
*
|
|
@@ -660,19 +675,20 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
660
675
|
* dry-runs every pipe; a caller that shows a method, prepares its inputs or generates
|
|
661
676
|
* types for it reads this, and one that needs the dry-run verdict stays on `validate`.
|
|
662
677
|
*
|
|
663
|
-
* Selection: the request's qualified `pipe_ref`, else
|
|
664
|
-
* `
|
|
665
|
-
*
|
|
666
|
-
* `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.
|
|
667
684
|
*
|
|
668
|
-
*
|
|
669
|
-
*
|
|
670
|
-
*
|
|
671
|
-
* 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}).
|
|
672
688
|
*
|
|
673
|
-
* Same 200-verdict discipline
|
|
674
|
-
* (the request
|
|
675
|
-
*
|
|
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).
|
|
676
692
|
* Only a no-verdict condition throws `ApiResponseError`: a malformed selector and an
|
|
677
693
|
* over-limit file are `ValidationError` `422`s; a selection the route refuses is a
|
|
678
694
|
* `422` whose `errorType` is `EntryPipeNotFoundError` (an unknown `pipe_ref`, no entry
|
|
@@ -680,13 +696,35 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
680
696
|
* candidates in its `serverMessage`; a registry-form `method_ref` is a `501`; a pipe
|
|
681
697
|
* whose artifacts cannot be derived is a `500`.
|
|
682
698
|
*
|
|
683
|
-
* A `method_ref` gets the fetch-sized budget, as on the other crate routes
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
* that a retry clears once the runner has cached the clone.
|
|
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.
|
|
688
703
|
*/
|
|
689
|
-
pipeIo(request: PipeIORequest): Promise<PipeIOResponse>;
|
|
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.
|
|
716
|
+
*/
|
|
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;
|
|
690
728
|
/**
|
|
691
729
|
* Fetch a run's status by bare id — `GET /v1/runs/{pipeline_run_id}/status`.
|
|
692
730
|
*
|
|
@@ -777,6 +815,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
777
815
|
* gzip stream, which `requestRaw` reports as an `ApiUnreachableError` carrying
|
|
778
816
|
* the decompressor's code (see `isUndecodableBody`).
|
|
779
817
|
*
|
|
818
|
+
* `signal` stops the handshake: its abort is thrown as is and nothing is cached.
|
|
819
|
+
*
|
|
780
820
|
* @throws {ApiUnreachableError} The handshake got no answer. Nothing is cached,
|
|
781
821
|
* so the next call asks again, and no start is sent to a host that did not
|
|
782
822
|
* answer: sending it would wait a second time for the same silence.
|
|
@@ -797,9 +837,15 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
797
837
|
* run, so the caller knows until then that none exists (see
|
|
798
838
|
* `StartAndWaitForResultOptions`).
|
|
799
839
|
*
|
|
800
|
-
* `pollOptions.signal`
|
|
801
|
-
*
|
|
802
|
-
*
|
|
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.
|
|
803
849
|
*
|
|
804
850
|
* An error from the start, or from the blocking execute, says whether that request may still
|
|
805
851
|
* have started a run whose id never reached the caller (`runMayHaveStarted`); when it may have,
|
|
@@ -815,6 +861,12 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
815
861
|
* malformed key is refused before the version handshake.
|
|
816
862
|
*/
|
|
817
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;
|
|
818
870
|
/** The authenticated user's profile — `GET /v1/me`. */
|
|
819
871
|
getMe(): Promise<UserProfile>;
|
|
820
872
|
/**
|
|
@@ -864,10 +916,13 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
864
916
|
*/
|
|
865
917
|
iterateMethods(query?: Omit<ListMethodsQuery, "cursor">): AsyncGenerator<MethodSummary, void, undefined>;
|
|
866
918
|
/**
|
|
867
|
-
* Read one method — `GET /v1/methods/{id}`: its identity, its draft
|
|
868
|
-
* `input_data`) with the draft's token (`updated_at`) and digest (`draft_digest`),
|
|
869
|
-
* latest published version's summary (`latest_version`, `latest_published`), whatever
|
|
870
|
-
* publish state. A method never published reads with both `null`, never as an error.
|
|
919
|
+
* Read one method with its draft's files — `GET /v1/methods/{id}`: its identity, its draft
|
|
920
|
+
* (`files`, `input_data`) with the draft's token (`updated_at`) and digest (`draft_digest`),
|
|
921
|
+
* and its latest published version's summary (`latest_version`, `latest_published`), whatever
|
|
922
|
+
* the publish state. A method never published reads with both `null`, never as an error.
|
|
923
|
+
* `files` lists the draft's tree in tree path order, each file with its SHA-256, its size and a
|
|
924
|
+
* link to its bytes valid for about fifteen minutes, and is empty for an empty draft;
|
|
925
|
+
* `writeMethodTree` brings the tree to disk.
|
|
871
926
|
*
|
|
872
927
|
* Takes a bare catalog id: the method routes address the method itself, never a version of
|
|
873
928
|
* it. A caller holding `mt_…@3` strips the suffix with `parseMethodSelector` and reads that
|
|
@@ -875,42 +930,32 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
875
930
|
* suffixed id, before any request, rather than read back the `404` the platform would answer,
|
|
876
931
|
* and for an id that is empty, `.` or `..`, which the URL would resolve into another route's
|
|
877
932
|
* path.
|
|
878
|
-
*/
|
|
879
|
-
getMethod(methodId: string): Promise<MethodData>;
|
|
880
|
-
/**
|
|
881
|
-
* Resolve a stored method's id into the runnable MTHDS closure of its DRAFT — a
|
|
882
|
-
* client-side semantic layer over `getMethod` (the platform has no route that
|
|
883
|
-
* returns a parsed closure). Fetches the method, parses its draft's polymorphic
|
|
884
|
-
* `mthds` source with `methodSourceToContents`, and labels each resulting file
|
|
885
|
-
* with the `method_id` as its `source` provenance.
|
|
886
|
-
*
|
|
887
|
-
* **This is the draft, not what a bare id runs.** A run, a validation or a pipe I/O
|
|
888
|
-
* read by a bare `method_id` resolves to the latest PUBLISHED version, which the
|
|
889
|
-
* draft may be ahead of. For the closure of a version, read it with
|
|
890
|
-
* `getMethodVersion` and parse its `mthds` with `methodSourceToContents`.
|
|
891
933
|
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
* `prepareInputs`, which composes a `pipeIo` of its own) take the id as a
|
|
897
|
-
* pass-through instead; nothing in this client expands an id behind your back.
|
|
898
|
-
*
|
|
899
|
-
* Takes a bare catalog id, as `getMethod` does. Requires an API key: the methods
|
|
900
|
-
* catalog is org-scoped to the key's org, so an unknown OR foreign-org id is a
|
|
901
|
-
* `getMethod` `404` (`ApiResponseError` `not_found`), which propagates unchanged. A
|
|
902
|
-
* real, in-org method whose draft parses to nothing throws `EmptyMethodSourceError`
|
|
903
|
-
* (distinct from the 404) — the row exists but has no runnable source yet.
|
|
934
|
+
* Throws `ApiResponseError`: `404` `not_found` for an unknown or foreign-org method, `409`
|
|
935
|
+
* `method_being_deleted` while its erasure runs, and a `409` whose verdict is `runtime` for a
|
|
936
|
+
* method whose draft names a tree the platform holds no record of. An answer whose `files` is
|
|
937
|
+
* not a listing is an answer the SDK cannot read, thrown as an `ApiResponseError` too.
|
|
904
938
|
*/
|
|
905
|
-
|
|
939
|
+
getMethod(methodId: string): Promise<MethodDetail>;
|
|
906
940
|
/**
|
|
907
|
-
* Create a method — `POST /v1/methods`. The new method holds
|
|
908
|
-
*
|
|
909
|
-
*
|
|
941
|
+
* Create a method — `POST /v1/methods`. The new method holds its tree as its draft and has no
|
|
942
|
+
* published version, so its bare id answers `409 method_not_published` on the run and tooling
|
|
943
|
+
* routes until its first `publishMethod`; its draft runs as `mt_…@draft` at once.
|
|
944
|
+
*
|
|
945
|
+
* The tree is `files`, sent as given, or `tree` or `contents`, which the client sends inline
|
|
946
|
+
* when its inline map weighs 256 KiB or less, or when the platform keeps no blob store, and
|
|
947
|
+
* otherwise every file by hash, after asking `POST /v1/blobs/missing` which files the
|
|
948
|
+
* organization lacks and uploading those: a file uploaded once is never uploaded again. With
|
|
949
|
+
* none of the three, the draft is empty (see `docs/method-trees.md`).
|
|
910
950
|
*
|
|
911
|
-
* Throws `
|
|
912
|
-
*
|
|
913
|
-
*
|
|
951
|
+
* Throws `RequestArgumentError` for two forms of the tree, or `contents` holding no file, before
|
|
952
|
+
* any request; `MethodFileTransferError` when a file the organization lacks could not be
|
|
953
|
+
* uploaded, and nothing is saved. Throws `ApiResponseError`: `422` `invalid_method_files` for a
|
|
954
|
+
* map the standard refuses, with its `tree_refusal`; `422` `method_tree_too_large` for a tree
|
|
955
|
+
* past one of the deployment's limits, named in its `limit`; `422` `blob_mismatch` for a hash
|
|
956
|
+
* stated at another size than the one held; `422` `missing_blobs` for a hash entry whose bytes
|
|
957
|
+
* the organization does not hold; `413` `payload_too_large` for a method that would leave no
|
|
958
|
+
* room for a publish.
|
|
914
959
|
*/
|
|
915
960
|
createMethod(input: MethodWriteInput): Promise<MethodData>;
|
|
916
961
|
/**
|
|
@@ -919,20 +964,183 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
919
964
|
*
|
|
920
965
|
* The draft is never validated on write, and writing it changes nothing for the callers of
|
|
921
966
|
* the method's bare id, who run the latest published version until the next `publishMethod`.
|
|
922
|
-
*
|
|
967
|
+
* The write replaces the draft's whole tree, given in exactly one form: `files`, sent as given,
|
|
968
|
+
* `files: null` emptying the draft, or `tree` or `contents`, sent inline or by hash as
|
|
969
|
+
* `createMethod` sends them. `input_data` is three-way (see `MethodDraftInput`). With
|
|
923
970
|
* `expected_updated_at`, the write is a compare-and-swap on the draft token: a draft that
|
|
924
971
|
* moved since is refused with a `409` whose `code` is `method_update_conflict`, and nothing is
|
|
925
972
|
* written. Without it, last writer wins.
|
|
926
973
|
*
|
|
927
|
-
* Takes a bare catalog id, as `getMethod` does. Throws `
|
|
928
|
-
*
|
|
929
|
-
* `
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
*
|
|
974
|
+
* Takes a bare catalog id, as `getMethod` does. Throws `RequestArgumentError` for a draft that
|
|
975
|
+
* gives its tree in no form or in two, or `contents` holding no file, before any request;
|
|
976
|
+
* `MethodFileTransferError` when a file the organization lacks could not be uploaded. Throws
|
|
977
|
+
* `ApiResponseError`: `404` `not_found` for an unknown or foreign-org method, `409`
|
|
978
|
+
* `method_being_deleted` while its erasure runs, the `422` refusals of a tree `createMethod`
|
|
979
|
+
* lists, `413` `payload_too_large` for a draft that would grow the method past the room a
|
|
980
|
+
* publish needs, `403` for a read-only key, and a `503` that wrote nothing, safe to retry,
|
|
981
|
+
* when the method kept changing under the write.
|
|
934
982
|
*/
|
|
935
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;
|
|
998
|
+
/**
|
|
999
|
+
* The limits the deployment holds a method's tree to — `GET /v1/version`, read from
|
|
1000
|
+
* `limits.method_tree` of the public handshake — in the shape the `mthds` package's
|
|
1001
|
+
* `listMethodTree` takes as its `limits` option, so a tree the platform would refuse is refused
|
|
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:
|
|
1004
|
+
*
|
|
1005
|
+
* ```ts
|
|
1006
|
+
* import { listMethodTree } from "mthds";
|
|
1007
|
+
* const tree = await listMethodTree("methods/receipts", { limits: await client.methodTreeLimits() });
|
|
1008
|
+
* await client.createMethod({ name: "Receipts", tree });
|
|
1009
|
+
* ```
|
|
1010
|
+
*
|
|
1011
|
+
* A limit the server does not announce is absent, so a bare runner, which announces none,
|
|
1012
|
+
* yields no limit, and none is ever assumed. A value that is not a positive integer is left out
|
|
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.
|
|
1015
|
+
*/
|
|
1016
|
+
methodTreeLimits(): Promise<MethodTreeLimits>;
|
|
1017
|
+
/**
|
|
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.
|
|
1021
|
+
*/
|
|
1022
|
+
private cachedVersion;
|
|
1023
|
+
/** Drop the kept handshake, which a refusal has shown to be stale. */
|
|
1024
|
+
private forgetHandshake;
|
|
1025
|
+
/**
|
|
1026
|
+
* Write a saved method's tree to disk: each file of a listing `getMethod` or `getMethodVersion`
|
|
1027
|
+
* served, at its tree path under `options.destination`. **Node only.**
|
|
1028
|
+
*
|
|
1029
|
+
* Each file is downloaded through its link, at most eight at a time, with no credential of this
|
|
1030
|
+
* client, and checked against the listing: its size and its SHA-256 must be the ones listed, so
|
|
1031
|
+
* what lands on disk is the tree the method's digest names. The files are written into a fresh
|
|
1032
|
+
* hidden directory beside the destination, which takes its name only once every file is
|
|
1033
|
+
* written: an interrupted or failed write never leaves a partial tree under that name. The
|
|
1034
|
+
* destination must not exist, or be an empty directory; one holding anything is refused rather
|
|
1035
|
+
* than written into or replaced. An empty listing writes an empty directory.
|
|
1036
|
+
*
|
|
1037
|
+
* The links expire about fifteen minutes after the read that served them: write the tree soon
|
|
1038
|
+
* after reading the method, and read it again for fresh links when a download is refused.
|
|
1039
|
+
*
|
|
1040
|
+
* Throws `RequestArgumentError` before any download when the destination exists and is not an
|
|
1041
|
+
* empty directory, or the listing holds a path that is not a tree path, the same path twice, or
|
|
1042
|
+
* paths that collide once case-folded or where one names a directory of another;
|
|
1043
|
+
* `MethodFileTransferError` when a file could not be downloaded, or its bytes are not the file
|
|
1044
|
+
* listed, and nothing is left under the destination.
|
|
1045
|
+
*/
|
|
1046
|
+
writeMethodTree(files: readonly SavedMethodFile[], options: {
|
|
1047
|
+
destination: string;
|
|
1048
|
+
}): Promise<void>;
|
|
1049
|
+
/**
|
|
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;
|
|
1116
|
+
/**
|
|
1117
|
+
* Which of these blobs the organization lacks, and where to upload each —
|
|
1118
|
+
* `POST /v1/blobs/missing` — with the answer it was read from, which carries signed links. A
|
|
1119
|
+
* blob held is left out, and an empty `missing` means nothing to upload. An answer whose
|
|
1120
|
+
* `missing` is not a list of blobs, each with its upload target, is an answer the SDK cannot
|
|
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.
|
|
1128
|
+
*/
|
|
1129
|
+
private findMissingBlobs;
|
|
1130
|
+
/**
|
|
1131
|
+
* Upload each missing blob from the tree's bytes, a few at a time, stopping at the first
|
|
1132
|
+
* failure. A blob the platform asks for that the tree does not hold, or holds at another size,
|
|
1133
|
+
* is the platform's fault, thrown before anything is sent as the `ApiResponseError` of an answer
|
|
1134
|
+
* the SDK cannot read. The bytes the tree reads for a blob are checked against it before they
|
|
1135
|
+
* are sent, since storage keeps a blob under the hash it is named by: bytes of another hash or
|
|
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.
|
|
1140
|
+
*/
|
|
1141
|
+
private uploadMissing;
|
|
1142
|
+
/** Read, check and upload one missing blob (see `uploadMissing`). */
|
|
1143
|
+
private uploadOne;
|
|
936
1144
|
/**
|
|
937
1145
|
* Rename a method — `PATCH /v1/methods/{id}` — and return it. The name belongs to the method,
|
|
938
1146
|
* not to a version: a rename changes nothing else, moves no token, and never commits the
|
|
@@ -979,7 +1187,7 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
979
1187
|
*/
|
|
980
1188
|
publishMethod(methodId: string, input: MethodPublishInput): Promise<MethodPublishResult>;
|
|
981
1189
|
/**
|
|
982
|
-
* One page of a method's published versions, newest first, without their
|
|
1190
|
+
* One page of a method's published versions, newest first, without their files —
|
|
983
1191
|
* `GET /v1/methods/{id}/versions`.
|
|
984
1192
|
*
|
|
985
1193
|
* Pass the page's `nextCursor` back as `cursor` to continue; `null` is the last page. A page
|
|
@@ -993,14 +1201,16 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
993
1201
|
*/
|
|
994
1202
|
listMethodVersions(methodId: string, query?: ListMethodVersionsQuery): Promise<MethodVersionPage>;
|
|
995
1203
|
/**
|
|
996
|
-
* One published version of a method, with its
|
|
997
|
-
* `
|
|
998
|
-
*
|
|
1204
|
+
* One published version of a method, with its files — `GET /v1/methods/{id}/versions/{n}`.
|
|
1205
|
+
* `files` lists the version's tree as `getMethod` lists the draft's, each file with a link to
|
|
1206
|
+
* its bytes valid for about fifteen minutes, which `writeMethodTree` writes to disk.
|
|
999
1207
|
*
|
|
1000
1208
|
* Takes a bare catalog id, as `getMethod` does, and the version number. Throws
|
|
1001
1209
|
* `RequestArgumentError` for a `version` that is not a positive integer, before any request.
|
|
1002
1210
|
* Throws `ApiResponseError`: `404` `method_version_not_found` for a version the method never
|
|
1003
|
-
* published, `404` `not_found` for an unknown method, `409` `method_being_deleted
|
|
1211
|
+
* published, `404` `not_found` for an unknown method, `409` `method_being_deleted`, and `409`
|
|
1212
|
+
* `conflict`, whose verdict is `runtime`, for a version stored before methods were trees and
|
|
1213
|
+
* never rewritten as one, which names no tree to serve.
|
|
1004
1214
|
*/
|
|
1005
1215
|
getMethodVersion(methodId: string, version: number): Promise<MethodVersion>;
|
|
1006
1216
|
/**
|
|
@@ -1279,8 +1489,9 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1279
1489
|
* Name the method exactly one of three ways, all server-resolved through the
|
|
1280
1490
|
* one `pipeIo` call this composes:
|
|
1281
1491
|
*
|
|
1282
|
-
* -
|
|
1283
|
-
*
|
|
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;
|
|
1284
1495
|
* - `method_ref` — a published method's address, fetched by the runner;
|
|
1285
1496
|
* - `method_id` — a stored method's catalog id, resolved by the platform
|
|
1286
1497
|
* (hosted only; requires an API key).
|
|
@@ -1367,9 +1578,8 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1367
1578
|
/**
|
|
1368
1579
|
* The whole record for one run — `GET /v1/runs/{id}`.
|
|
1369
1580
|
*
|
|
1370
|
-
* The ONLY call that returns
|
|
1371
|
-
*
|
|
1372
|
-
* 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
|
|
1373
1583
|
* field (see `RunErrorReport`).
|
|
1374
1584
|
*
|
|
1375
1585
|
* Read with `parseExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the inputs is a
|
|
@@ -1379,6 +1589,14 @@ export declare class PipelexApiClient implements HostedProtocolSurface {
|
|
|
1379
1589
|
getRunDetail(runId: string): Promise<RunDetail>;
|
|
1380
1590
|
/** Patch a run's status (admin/manual) — `PUT /v1/runs/{id}`. */
|
|
1381
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;
|
|
1382
1600
|
/**
|
|
1383
1601
|
* Blocking `POST /v1/execute` adapted onto `RunResults` — the bare-runner
|
|
1384
1602
|
* path. Forwards every protocol field PLUS every extension surface: the
|