@pipelex/sdk 0.48.1 → 0.50.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 +29 -11
- package/dist/cli/script.d.ts +1 -1
- package/dist/client.d.ts +341 -18
- package/dist/client.js +615 -28
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +100 -12
- package/dist/errors.js +49 -7
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/prepare-inputs.d.ts +12 -1
- package/dist/prepare-inputs.js +26 -3
- package/dist/prepare-inputs.js.map +1 -1
- package/dist/product-models.d.ts +677 -22
- package/dist/product-models.js +2 -2
- package/dist/upload-grant.d.ts +134 -40
- package/dist/upload-grant.js +328 -136
- package/dist/upload-grant.js.map +1 -1
- package/dist/upload.d.ts +39 -11
- package/dist/upload.js +115 -8
- package/dist/upload.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +7 -5
- package/docs/errors.md +12 -3
- package/docs/files.md +258 -0
- package/docs/input-preparation.md +57 -23
- package/docs/method-examples.md +36 -3
- package/docs/organization-branding.md +102 -0
- package/package.json +1 -1
package/dist/upload-grant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-grant.js","sourceRoot":"","sources":["../src/upload-grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG9F,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG/D,6FAA6F;AAC7F,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAG9F;;;;;GAKG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MA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C,UAAU,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,wBAAwB;SACtG,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3D,OAAO;YACL,IAAI,EAAE,iBAAiB;YACvB,MAAM,EACJ,oFAAoF;gBACpF,0BAA0B;SAC7B,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,MAAM,EACJ,OAAO,CAAC,OAAO;YACf,8EAA8E;KACjF,CAAC;AACJ,CAAC;AAED,kGAAkG;AAClG,SAAS,SAAS,CAAC,KAAkB,EAAE,IAAU;IAC/C,MAAM,IAAI,GAAI,IAA2B,CAAC,IAAI,CAAC;IAC/C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;AAC5C,CAAC"}
|
package/dist/upload.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* The MIME type and size are known client-side at upload time, so the record is
|
|
8
8
|
* built without extending the `/v1/upload` response.
|
|
9
9
|
*/
|
|
10
|
+
import type { UploadInput, UploadKind } from "./product-models.js";
|
|
10
11
|
/** A local asset `uploadFile` accepts. A path string is Node-only (see {@link readLocalPath}). */
|
|
11
12
|
export type UploadableAsset = Blob | ArrayBuffer | Uint8Array | string;
|
|
12
13
|
/**
|
|
@@ -24,8 +25,27 @@ export interface UploadRecord {
|
|
|
24
25
|
/** Size of the uploaded bytes. */
|
|
25
26
|
size: number;
|
|
26
27
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* What an upload is recorded as, sent with it to `POST /v1/upload`: its `kind` and, for a test
|
|
30
|
+
* file, the method it is for. `uploadFile` takes these among its options and `prepareInputs` as
|
|
31
|
+
* its `upload` member, for every file it uploads. Both are checked as the upload route checks
|
|
32
|
+
* them, before any file is read: `kind: "test"` needs `method_id`, a bare catalog id, and only a
|
|
33
|
+
* test file names a method.
|
|
34
|
+
*/
|
|
35
|
+
export interface UploadKindOptions {
|
|
36
|
+
/** What the upload is recorded as; `uploaded` when omitted. */
|
|
37
|
+
kind?: UploadKind;
|
|
38
|
+
/**
|
|
39
|
+
* The bare catalog id of the method a `test` file is for, required with `kind: "test"`
|
|
40
|
+
* and refused without it.
|
|
41
|
+
*/
|
|
42
|
+
method_id?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Per-call options for {@link uploadFile}. Fill in a filename/MIME for nameless byte sources, and
|
|
46
|
+
* a `kind` with its `method_id` for a test file.
|
|
47
|
+
*/
|
|
48
|
+
export interface UploadFileOptions extends UploadKindOptions {
|
|
29
49
|
filename?: string;
|
|
30
50
|
contentType?: string;
|
|
31
51
|
/**
|
|
@@ -37,15 +57,21 @@ export interface UploadFileOptions {
|
|
|
37
57
|
}
|
|
38
58
|
/** The subset of the client `uploadFile` needs — the raw base64 `upload` wire call. */
|
|
39
59
|
export interface UploadCapableClient {
|
|
40
|
-
upload(input: {
|
|
41
|
-
filename: string;
|
|
42
|
-
data: string;
|
|
43
|
-
content_type: string;
|
|
44
|
-
}): Promise<{
|
|
60
|
+
upload(input: UploadInput): Promise<{
|
|
45
61
|
uri: string;
|
|
46
62
|
filename: string;
|
|
47
63
|
}>;
|
|
48
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* The `kind` and `method_id` an upload is sent with, checked as the upload route checks them, so
|
|
67
|
+
* a request the route would refuse with a `422` is refused before any file is read: a `kind` is
|
|
68
|
+
* `uploaded` or `test`, a `method_id` is a bare catalog id, `kind: "test"` needs one and only a
|
|
69
|
+
* test file names one. Returns the members to send, each only when given; `null` reads as
|
|
70
|
+
* absent, as it does on the route. A refusal is an `InputPreparationError` whose message opens
|
|
71
|
+
* with `refusal` and names each member as `field` prefixes it, so `prepareInputs` names its
|
|
72
|
+
* `upload.kind`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function uploadKindFields(given: UploadKindOptions, refusal: string, field?: string): UploadKindOptions;
|
|
49
75
|
/** MIME guess from a filename extension; `application/octet-stream` when unknown. */
|
|
50
76
|
export declare function guessContentType(filename: string): string;
|
|
51
77
|
/**
|
|
@@ -60,9 +86,11 @@ export declare function readLocalPath(path: string): Promise<Uint8Array>;
|
|
|
60
86
|
/** Base64-encode bytes, cross-runtime (Buffer when present, else chunked btoa). */
|
|
61
87
|
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
62
88
|
/**
|
|
63
|
-
* Upload one local asset and return its {@link UploadRecord}.
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
89
|
+
* Upload one local asset and return its {@link UploadRecord}. A `kind` and its `method_id` in
|
|
90
|
+
* the options are checked before the asset is read and sent with it (see
|
|
91
|
+
* {@link UploadKindOptions}). Maps the raw `upload()` transport errors onto the semantic
|
|
92
|
+
* input-preparation errors: a `413` is a rejected asset, a test file refused for its role or its
|
|
93
|
+
* method a {@link TestFileRefusedError}, any other `401`/`403` an auth failure, any other `404`
|
|
94
|
+
* an unsupported upload capability, an unreachable host a transport failure.
|
|
67
95
|
*/
|
|
68
96
|
export declare function uploadFile(client: UploadCapableClient, asset: UploadableAsset, options?: UploadFileOptions): Promise<UploadRecord>;
|
package/dist/upload.js
CHANGED
|
@@ -7,10 +7,68 @@
|
|
|
7
7
|
* The MIME type and size are known client-side at upload time, so the record is
|
|
8
8
|
* built without extending the `/v1/upload` response.
|
|
9
9
|
*/
|
|
10
|
-
import { InvalidLocalSourceError, RejectedAssetError, UploadAuthenticationError, UploadTransportError, UnsupportedUploadCapabilityError, } from "./errors.js";
|
|
10
|
+
import { InputPreparationError, InvalidLocalSourceError, RejectedAssetError, TestFileRefusedError, UploadAuthenticationError, UploadTransportError, UnsupportedUploadCapabilityError, } from "./errors.js";
|
|
11
11
|
import { ApiResponseError, ApiUnreachableError } from "./errors.js";
|
|
12
|
+
import { parseMethodSelector } from "./method-selector.js";
|
|
12
13
|
import { absenceCause, loadNodeHost } from "./node-host.js";
|
|
13
14
|
import { throwIfAborted } from "./runs.js";
|
|
15
|
+
/** The kinds an upload is recorded as, in the order the refusal of another one lists them. */
|
|
16
|
+
const UPLOAD_KINDS = ["uploaded", "test"];
|
|
17
|
+
/** A value an upload's kind or method was given as, described for a refusal without quoting more than an id. */
|
|
18
|
+
function describedArgument(value) {
|
|
19
|
+
if (value === null)
|
|
20
|
+
return "null";
|
|
21
|
+
if (typeof value === "string")
|
|
22
|
+
return JSON.stringify(value);
|
|
23
|
+
return typeof value;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The `kind` and `method_id` an upload is sent with, checked as the upload route checks them, so
|
|
27
|
+
* a request the route would refuse with a `422` is refused before any file is read: a `kind` is
|
|
28
|
+
* `uploaded` or `test`, a `method_id` is a bare catalog id, `kind: "test"` needs one and only a
|
|
29
|
+
* test file names one. Returns the members to send, each only when given; `null` reads as
|
|
30
|
+
* absent, as it does on the route. A refusal is an `InputPreparationError` whose message opens
|
|
31
|
+
* with `refusal` and names each member as `field` prefixes it, so `prepareInputs` names its
|
|
32
|
+
* `upload.kind`.
|
|
33
|
+
*/
|
|
34
|
+
export function uploadKindFields(given, refusal, field = "") {
|
|
35
|
+
const raw = given;
|
|
36
|
+
const kind = raw.kind ?? undefined;
|
|
37
|
+
const methodId = raw.method_id ?? undefined;
|
|
38
|
+
if (kind !== undefined && !UPLOAD_KINDS.includes(kind)) {
|
|
39
|
+
throw new InputPreparationError(`${refusal}: \`${field}kind\` is "uploaded" or "test", got ${describedArgument(kind)}.`);
|
|
40
|
+
}
|
|
41
|
+
if (methodId !== undefined) {
|
|
42
|
+
if (typeof methodId !== "string") {
|
|
43
|
+
throw new InputPreparationError(`${refusal}: \`${field}method_id\` names a method by its bare catalog id, got ` +
|
|
44
|
+
`${describedArgument(methodId)}.`);
|
|
45
|
+
}
|
|
46
|
+
let bare;
|
|
47
|
+
try {
|
|
48
|
+
bare = parseMethodSelector(methodId).version === null;
|
|
49
|
+
}
|
|
50
|
+
catch (cause) {
|
|
51
|
+
throw new InputPreparationError(`${refusal}: \`${field}method_id\` ${JSON.stringify(methodId)} is not a catalog id, ` +
|
|
52
|
+
"which is mt_ followed by letters, digits, _ or -.", { cause });
|
|
53
|
+
}
|
|
54
|
+
if (!bare) {
|
|
55
|
+
throw new InputPreparationError(`${refusal}: \`${field}method_id\` names the method a test file is for by its bare ` +
|
|
56
|
+
`catalog id, with no version suffix, got ${JSON.stringify(methodId)}.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (kind === "test" && methodId === undefined) {
|
|
60
|
+
throw new InputPreparationError(`${refusal}: a test file names the method it is for; give \`${field}method_id\` with ` +
|
|
61
|
+
`\`${field}kind: "test"\`.`);
|
|
62
|
+
}
|
|
63
|
+
if (kind !== "test" && methodId !== undefined) {
|
|
64
|
+
throw new InputPreparationError(`${refusal}: only a test file names a method; give \`${field}method_id\` with ` +
|
|
65
|
+
`\`${field}kind: "test"\` alone.`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...(kind === undefined ? {} : { kind: kind }),
|
|
69
|
+
...(methodId === undefined ? {} : { method_id: methodId }),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
14
72
|
const DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
|
15
73
|
const DEFAULT_FILENAME = "upload.bin";
|
|
16
74
|
const EXTENSION_MIME = {
|
|
@@ -103,22 +161,25 @@ function assetBytesFromBuffer(bytes, options) {
|
|
|
103
161
|
return { bytes, filename, contentType: options.contentType ?? guessContentType(filename) };
|
|
104
162
|
}
|
|
105
163
|
/**
|
|
106
|
-
* Upload one local asset and return its {@link UploadRecord}.
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
164
|
+
* Upload one local asset and return its {@link UploadRecord}. A `kind` and its `method_id` in
|
|
165
|
+
* the options are checked before the asset is read and sent with it (see
|
|
166
|
+
* {@link UploadKindOptions}). Maps the raw `upload()` transport errors onto the semantic
|
|
167
|
+
* input-preparation errors: a `413` is a rejected asset, a test file refused for its role or its
|
|
168
|
+
* method a {@link TestFileRefusedError}, any other `401`/`403` an auth failure, any other `404`
|
|
169
|
+
* an unsupported upload capability, an unreachable host a transport failure.
|
|
110
170
|
*/
|
|
111
171
|
export async function uploadFile(client, asset, options = {}) {
|
|
172
|
+
const claimed = uploadKindFields(options, "Cannot upload");
|
|
112
173
|
const { bytes, filename, contentType } = await toAssetBytes(asset, options);
|
|
113
174
|
// A slow read, or a Blob's `arrayBuffer()`, may outlast the caller's patience.
|
|
114
175
|
throwIfAborted(options.signal);
|
|
115
176
|
const data = bytesToBase64(bytes);
|
|
116
177
|
let uploaded;
|
|
117
178
|
try {
|
|
118
|
-
uploaded = await client.upload({ filename, data, content_type: contentType });
|
|
179
|
+
uploaded = await client.upload({ filename, data, content_type: contentType, ...claimed });
|
|
119
180
|
}
|
|
120
181
|
catch (error) {
|
|
121
|
-
throw mapUploadError(error, filename);
|
|
182
|
+
throw mapUploadError(error, filename, claimed.method_id);
|
|
122
183
|
}
|
|
123
184
|
// The record guarantees a filename: an answer that names none keeps the one sent.
|
|
124
185
|
const stored = uploaded.filename;
|
|
@@ -129,8 +190,42 @@ export async function uploadFile(client, asset, options = {}) {
|
|
|
129
190
|
size: bytes.length,
|
|
130
191
|
};
|
|
131
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Which refusal of a test file an upload's error is, or `undefined` for any other. Each is read
|
|
195
|
+
* off the platform's code, never the status alone: a `403` without `role_not_permitted` is a
|
|
196
|
+
* refused credential, and a `404` is an unknown method only when the upload named one and the
|
|
197
|
+
* answer is the platform's domain miss (`not_found`, `input`), not the `404` of a deployment
|
|
198
|
+
* without the route, which the platform answers as `config` and a bare runner without a code.
|
|
199
|
+
*/
|
|
200
|
+
function testFileRefusalOf(error, methodId) {
|
|
201
|
+
if (error.code === "role_not_permitted")
|
|
202
|
+
return "role_not_permitted";
|
|
203
|
+
if (error.code === "method_being_deleted")
|
|
204
|
+
return "method_being_deleted";
|
|
205
|
+
if (error.status === 404 &&
|
|
206
|
+
error.code === "not_found" &&
|
|
207
|
+
error.errorDomain === "input" &&
|
|
208
|
+
methodId !== undefined) {
|
|
209
|
+
return "method_not_found";
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
/** The message of a test file's refusal, naming the file, the method and what to do. */
|
|
214
|
+
function testFileRefusalMessage(code, error, filename, methodId) {
|
|
215
|
+
const refused = `Upload of "${filename}" as a test file was refused (${error.status})`;
|
|
216
|
+
const method = methodId === undefined ? "the method it names" : `the method "${methodId}"`;
|
|
217
|
+
switch (code) {
|
|
218
|
+
case "role_not_permitted":
|
|
219
|
+
return (`${refused}: ${error.serverMessage ?? "the caller's role may not change methods"}. ` +
|
|
220
|
+
'Upload it as "uploaded", or with the credential of a member who may change methods.');
|
|
221
|
+
case "method_not_found":
|
|
222
|
+
return `${refused}: ${method} is not one of the organization's methods.`;
|
|
223
|
+
case "method_being_deleted":
|
|
224
|
+
return `${refused}: ${method} is being deleted.`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
132
227
|
/** Translate a raw `upload()` transport error into the matching preparation error. */
|
|
133
|
-
function mapUploadError(error, filename) {
|
|
228
|
+
function mapUploadError(error, filename, methodId) {
|
|
134
229
|
if (error instanceof ApiResponseError) {
|
|
135
230
|
// A 2xx the client could not read: storage may hold the file, but under no reference the SDK
|
|
136
231
|
// can return.
|
|
@@ -138,6 +233,18 @@ function mapUploadError(error, filename) {
|
|
|
138
233
|
return new UploadTransportError(`Upload of "${filename}" was answered (${error.status}) with a body the SDK could not ` +
|
|
139
234
|
"read, so whether and where the file was stored is unknown.", { cause: error, status: error.status, code: "unexpected", filename });
|
|
140
235
|
}
|
|
236
|
+
// A test file refused for what it claims, its role or its method, before the status alone is
|
|
237
|
+
// read as a refused credential or a deployment without upload.
|
|
238
|
+
const refusal = testFileRefusalOf(error, methodId);
|
|
239
|
+
if (refusal !== undefined) {
|
|
240
|
+
return new TestFileRefusedError(testFileRefusalMessage(refusal, error, filename, methodId), {
|
|
241
|
+
cause: error,
|
|
242
|
+
status: error.status,
|
|
243
|
+
code: refusal,
|
|
244
|
+
filename,
|
|
245
|
+
...(methodId === undefined ? {} : { methodId }),
|
|
246
|
+
});
|
|
247
|
+
}
|
|
141
248
|
switch (error.status) {
|
|
142
249
|
case 413:
|
|
143
250
|
return new RejectedAssetError(`The server rejected "${filename}": ${error.serverMessage ?? "asset exceeds the service size limit"}.`, filename, error.status, { cause: error, code: "too_large" });
|
package/dist/upload.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,gCAAgC,GACjC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,gCAAgC,GACjC,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CA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AAE,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY;oBACzD,QAAQ;iBACT,CACF,CAAC;QACN,CAAC;IACH,CAAC;IACD,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;QACzC,OAAO,IAAI,oBAAoB,CAC7B,cAAc,QAAQ,sCAAsC,KAAK,CAAC,IAAI,IAAI,aAAa,IAAI;QAC3F,mFAAmF;QACnF,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IACD,iFAAiF;IACjF,mFAAmF;IACnF,kFAAkF;IAClF,8EAA8E;IAC9E,6DAA6D;IAC7D,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtE,OAAO,IAAI,oBAAoB,CAAC,cAAc,QAAQ,0BAA0B,MAAM,GAAG,EAAE;QACzF,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,YAAY;QAClB,QAAQ;KACT,CAAC,CAAC;AACL,CAAC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/docs/architecture.md
CHANGED
|
@@ -38,7 +38,7 @@ The package also declares one `bin`, `pipelex-sdk`, which is `dist/cli.js` with
|
|
|
38
38
|
|
|
39
39
|
Condition order in `exports` matters: `types` is listed first (TS/Node resolution convention — the type-checker looks at the first matching condition), then `import`, then `default` as the CJS fallback.
|
|
40
40
|
|
|
41
|
-
The map has a second entry, **`@pipelex/sdk/upload`** (`dist/upload-grant.js`), the one a page that stores a file imports. The client holds an API key and belongs on a server, so a page imports the main entry for its error classes, its types and its pure helpers, never to construct a client, and the subpath carries only what a page needs to store a file with an upload grant: `uploadWithGrant`, the grant types and the three error classes
|
|
41
|
+
The map has a second entry, **`@pipelex/sdk/upload`** (`dist/upload-grant.js`), the one a page that stores a file imports. The client holds an API key and belongs on a server, so a page imports the main entry for its error classes, its types and its pure helpers, never to construct a client, and the subpath carries only what a page needs to store a file with an upload grant: `describeUpload`, which reads the file's name, type, size and SHA-256 for the grant request, `uploadWithGrant`, the grant types and the three error classes they raise. Its runtime import graph is `errors.ts` (with the fallback table it reads, `error-verdicts.ts`), `timers.ts` and `mthds/protocol`, nothing else. Both entries load the same `dist/errors.js` and `dist/upload-grant.js`, so the function and the error classes are identical whichever entry a consumer imports them through.
|
|
42
42
|
|
|
43
43
|
**Both entries bundle for the browser with nothing marked external.** A Next.js client component importing an error class from `@pipelex/sdk` puts the barrel's whole graph in the browser bundle, the modules it loads by dynamic import included, since a bundler bundles a dynamic import with a literal specifier like a static one; in 0.48.0 that graph reached `node:fs` through the `mthds` package's root entry, which Turbopack's `next build` tolerated and its `next dev` did not, panicking and answering `500` for the page. `tests/browser-bundle.test.ts` is the gate the templates' builds are not: it builds the package with `tsc` into a scratch directory laid out as the published package, bundles every entry of the `exports` map for the browser with esbuild, and fails on any Node built-in, `undici` or the `mthds` root entry it reaches, naming each import and the module that made it.
|
|
44
44
|
|
|
@@ -112,11 +112,11 @@ Flat `src/` (mirrors `mthds-js`'s `runners/api` flatness — the SDK has one cli
|
|
|
112
112
|
|
|
113
113
|
- `client.ts` — `PipelexApiClient`: the `request()` pipeline (auth, base URL, timeouts/abort, problem-details parsing) and every route. It implements the standard's `MTHDSProtocol<DictPipeOutput>` for every route but `validate`, so the protocol-execution methods stay shaped like the standard: `validate` answers Pipelex's own verdict, `PipelexValidationResult`, because the hosted plane still sends the verdict that predates the protocol's problem items, where the standard's `ValidationResult` lists them.
|
|
114
114
|
- `models.ts` — Dict-serialized concretes (`DictStuff` / `DictWorkingMemory` / `DictPipeOutput` / `DictRunResultExecute`), the `/v1/validate` surface (`PipelexValidationResult`, whose two arms are declared whole rather than as narrowings of the standard's `ValidationResult`, `ValidationErrorItem`, and the `SuggestedFix` / `FixOp` repair vocabulary its items carry — the hosted plane's shapes, which predate the standard's problem items, their operation and safety vocabularies pinned to the standard's by a type-level test, see [errors.md](./errors.md#a-validation-item--validationerroritem)), the tools surface (`Diagnostic` / `LintResponse` / `FormatResponse`), and the crate-route request/response models — the shared `CrateRequestBase` / `CrateInvalidReport` vocabulary plus the `/v1/resolve`, `/v1/codegen` and `/v1/pipe-io` shapes built on it, `GeneratedArtifact` among them.
|
|
115
|
-
- `product-models.ts` — the snake_case wire shapes for the hosted-product management routes (profile, methods catalog, organizations, billing, API keys, onboarding, storage, runs list/detail/update). Each interface models only the fields the product actually consumes — no speculative mirrors.
|
|
115
|
+
- `product-models.ts` — the snake_case wire shapes for the hosted-product management routes (profile, methods catalog, organizations, billing, API keys, onboarding, storage, an organization's files, runs list/detail/update). Each interface models only the fields the product actually consumes — no speculative mirrors.
|
|
116
116
|
- `error-models.ts` — the error-report wire models: `RunErrorReport`, the runner's `ErrorReport` typed with every field it carries (with `UserAction`, `ProviderErrorMetadata` and `MigrationErrorBlock`), which is the one type for a failed run's report on `RunPublic.error`, `PipelineRun.error`, `RunHistoryItem.error`, the failed arm of `RunResultState` and `RunFailedError.error`; and `ProblemDetails` / `FieldError`, the typed members of a problem document that `ApiResponseError` exposes. Every field is optional and every interface keeps an index signature, because the runner owns the shape and adds fields without asking. It also holds the one function that checks a stored report, the internal `readRunErrorReport`, which every read handing a report back applies: each named field is kept only when it has its declared type, and members the SDK does not name are relayed as sent. It imports the `ValidationErrorItem` type and nothing else. See [errors.md](./errors.md#a-failed-run--runerrorreport).
|
|
117
117
|
- `method-trees.ts` — a saved method's tree on the client side: `MethodTreeSource`, the shape a save reads a tree from, which the `mthds` package's `MethodTree` satisfies; the choice between sending a tree inline and by hash (`INLINE_TREE_MAX_BYTES`), the wire types of `POST /v1/blobs/missing` and the upload of a blob the platform lacks; `redactSignedLinks`, which every error built from an answer holding signed links reads its body through; the tree of an in-memory map; the tree limits a version handshake announces; the listing of a `directory`, by the `mthds` package's lister, which it gets from the Node host only when a directory is given; and the Node-only write of a saved listing to disk, with the file system it gets from the Node host when called. Outside Node, both are refused with `RequestArgumentError`. Its tree-sending half mirrors the `mthds` package's own helpers, which the `mthds/protocol` subpath does not export yet, so it holds the same rules with Web Crypto's SHA-256 and a Base64 writer of its own. See [method-trees.md](./method-trees.md).
|
|
118
118
|
- `codegen-check.ts` — `runCodegenCheck`, the **pure** offline drift check over a committed codegen tree: the stamp grammar, the `codegen.lock` parser, the hash, and the drift taxonomy, ported from pipelex's `codegen/check.py` so a verdict computed here equals the one `pipelex codegen check` computes over the same bytes (the drift `detail` sentences included, verbatim). It touches neither the client nor `mthds/protocol` — its only runtime imports are `smol-toml` and the plain-object guard of the pure `error-models.ts` — and it hashes through WebCrypto rather than `node:crypto` so it adds no Node builtin to the barrel's import graph. It raises `CodegenLockError`, which extends `Error` rather than the protocol base and declares the error verdict itself (`input`, not retryable). No filesystem, no fetch, no API key — the caller walks its own tree and hands in the text. See [crate-routes.md](./crate-routes.md#the-offline-check--runcodegencheck).
|
|
119
|
-
- `upload-grant.ts` —
|
|
119
|
+
- `upload-grant.ts` — the halves of an upload grant (`requestUploadGrant`, `POST /v1/upload/grant`) that run where the bytes are. `describeUpload` reads a file's name, type and size and computes its SHA-256 with Web Crypto, leaving the hash out, and the file unread, past a size bound of 50 MiB by default, and leaving it out where the runtime has no digest. `uploadWithGrant` sends nothing for a grant that answers `stored: true`, and otherwise sends the file as the raw body of a `PUT` to the grant's URL with its signed headers unchanged, redirects refused, a `412` read as stored for a grant that names its bytes, a `409 ConditionalRequestConflict` sent again after a short pause a few times, the whole exchange bounded by a time limit scaled by the file's size unless the caller passes `timeoutMs`, only the first 16 KiB of storage's error body read, and storage's refusals mapped onto the input-preparation errors (`RejectedAssetError` with a `code` for a `4xx` such as the `412` of a used hashless grant, the `403` of a signature mismatch or the `400 BadDigest` of bytes other than the hashed ones, `UploadTransportError` with a `code` for the time limit running out, a `5xx`, storage's `RequestTimeout`, a `409` conflict that outlasted every attempt, a redirect or no response). It is the browser-safe `@pipelex/sdk/upload` entry, so it imports the error classes, the timer bound in `timers.ts` and the wire types only, never the client. See [input-preparation.md](./input-preparation.md#uploading-with-a-grant--requestuploadgrant--uploadwithgrant).
|
|
120
120
|
- `artifacts.ts` — the artifact stack, the download twin of `prepareInputs`, in layers: `locateArtifacts` (a pure, exported walk for `pipelex-storage://` references, each with every `$`-rooted path it sits at) and `collectArtifacts` (the same walk's bare references), `resolveArtifacts` (the bulk resolve route over a whole list, chunked at its bound), `fetchArtifact` (one reference as a bounded `Response`) and `downloadArtifacts` (Node-only, a run's produced files saved under a directory as a produced verdict), plus `artifactFilename`, the rule that names a saved file after the field it fills. The three network operations are client methods over a small structural seam (`ArtifactCapableClient`: the raw `resolveStorageUrls` call and `getRunResult`); the module's graph, static and dynamic, stays free of Node builtins, because `node:fs/promises`, `node:path` and `undici` come from the Node host. `undici` is a runtime dependency for one reason: the fetch runs on an `Agent` carrying `headersTimeout` and `bodyTimeout`, the per-stall bounds an `AbortSignal` budget does not give, and Node exposes its bundled undici's `fetch` but not its `Agent`. See [artifact-download.md](./artifact-download.md).
|
|
121
121
|
- `runs.ts` — the run-lifecycle types (`RunStatus`, `RunRead`, `RunResults`, `RunResultState`) and the single poll loop (`pollUntilResult`). `RunResults.main_stuff` (the resolved main output content) is always present for a completed run: on the hosted path it is the `main_stuff.json` S3 artifact; on the bare-runner blocking path the SDK resolves it from the returned working memory via the response's `main_stuff_name`, so both paths deliver the same shape. Consumers read `main_stuff` directly. `working_memory` — every named stuff of the run, `{ root, aliases }`, typed `DictWorkingMemory` from `models.ts` — reads the same on both paths: the hosted path relays the `working_memory.json` artifact, and the blocking path lifts it off `pipe_output`, which still rides whole (blocking path only). `graph_spec` — the executed graph — also reaches the client on both paths: the hosted path relays the `graphspec.json` artifact, and the blocking path lifts it off `pipe_output` beside `graph_assembly_error`, the graph's twin of `usage_assembly_error`. That error field is declared ahead of the wire on the hosted side, where the platform's results body relays no such key and the field is therefore absent, reading `undefined` rather than `null`. A completed run that cannot deliver a main stuff throws `MissingMainStuffError` when the read asked for it. `runs.ts` also declares `RUN_RESULT_ARTIFACTS` / `RunResultArtifact`, the artifacts a results read can be narrowed to with `getRunResult`'s `artifacts` option; with a selection an unselected artifact is absent while a selected unwritten one is `null`. `runs.ts` also owns `TokensUsageRecord` — one client-facing usage record per inference call, carried by `RunResults.tokens_usages` on both paths. That is a mirror of a wire contract this SDK does not own (inference accounting is a Pipelex runtime extension rather than part of the MTHDS standard): every field is optional and the interface carries an index signature so pre-contract artifacts (relayed verbatim, never migrated) still type-check. See [`run-usage.md`](./run-usage.md) for the field reference, the cost/null semantics, and the old-artifact rules, and [`run-results.md`](./run-results.md) for the field-by-field account of `RunResults` — the durable handle, the output and how to read it, the run's working memory, the executed graph and how to render or keep it, and the produced files with their short-lived links.
|
|
122
122
|
- `usage.ts` — `summarizeUsage`, the **pure** fold of a run's usage pair (`tokens_usages` / `usage_assembly_error`) into one `UsageSummary`: a `state` (`records`, `no_inference` or `unavailable`), the null-aware total cost with its `cost_partial` flag, the `input` and `output` token totals, the call count, the relayed assembly error, and a `by_pipe` rollup sorted by cost with the unattributed calls grouped under a `null` `pipe_code`. It applies the rules [`run-usage.md`](./run-usage.md#summarizing-a-run--summarizeusage) states, so that every consumer reads one computation rather than re-deriving those rules by hand. It imports types from `runs.ts` and nothing else: no client, no fetch, no `mthds/protocol`.
|
|
@@ -153,13 +153,15 @@ The hosted catalog/account routes the webapp drives. All ride the same `{base}/v
|
|
|
153
153
|
|
|
154
154
|
- **User profile:** `getMe` (`GET /v1/me`).
|
|
155
155
|
- **Methods catalog:** `listMethods`, `getMethod`, `createMethod`, `writeDraft`, `renameMethod`, `publishMethod`, `listMethodVersions`, `getMethodVersion`, `deleteMethod`. **A saved method has a draft and immutable published versions.** Its draft is a method tree with its `input_data`, which `writeDraft` (`PUT /v1/methods/{id}/draft`) replaces whole, without validating it; `updated_at` is the draft's token, which moves on every draft write and nothing else, and `draft_digest` the draft's tree digest (`sha256:` and 64 hex digits), `null` for an empty draft. A save takes the tree as `files`, sent as given, or as `directory`, `tree` or `contents`, sent inline or by hash after uploading the blobs the organization lacks, and a read lists the tree's files, each with a short-lived link to its bytes, which `writeMethodTree` writes to disk ([method-trees.md](./method-trees.md)). A draft write may carry `expected_updated_at`, the token the caller last saw, and is then a compare-and-swap: a draft that moved since is a `409` `method_update_conflict` and nothing is written. `renameMethod` (`PATCH /v1/methods/{id}`) changes the name alone and moves no token. `publishMethod` (`POST /v1/methods/{id}/publish`) takes the required `expected_draft_updated_at` and answers a `MethodPublishResult` discriminated on `outcome` — `published` with the new version, `unchanged` with the existing latest version when the draft's digest equals it, `refused` with a `reason` (`invalid` or `not_runnable`), a `message` and the runner's `validation` verdict — every arm carrying the `method`; the SDK reads the nested method as `getMethod` does, and an answer whose `outcome` is none of these is an answer it cannot read. A publish that produced no verdict is thrown rather than answered: only a draft that differs from the latest version reaches the runner, and a runner that cannot be reached, answers unusably or does not finish within the platform's deadline is a `502` or `503` with nothing written, so a retry is safe, and a retry of a publish that landed while its answer was lost answers `unchanged` with the version it wrote. A method is stored as one item that keeps room for the summary a publish adds, so a draft that saves can always be published: a creation or a draft write is a `413` `payload_too_large` when it would grow the method past that room, below the store's item limit, and a rename is the same `413` for a name so long it would leave the method too large to publish. A version is numbered from 1, never reused, and holds the draft's tree as it stood, its `tree_digest` (`null` for a version stored before methods were trees), its `crate_fingerprint` (`null` when the runner could not resolve the bundle in memory), the runner's version, and when and by whom it was published; `listMethodVersions` pages the summaries newest first (`MethodVersionPage`, `{items, nextCursor}`, a `limit` from 1 to 100, 20 by default, and a `422` outside that range), and `getMethodVersion` reads one with its `files` listed as a method's are, or answers a `409` `conflict`, whose verdict is `runtime`, for a version stored before methods were trees and never rewritten as one. A method read carries `latest_version` and `latest_published`, both `null` until the first publish, so the publish state is derived: never published, draft unchanged (`draft_digest` not `null` and equal to `latest_published.tree_digest`), or draft ahead. The method routes take a bare id and address the method itself, never one of its versions; the platform does not parse a suffix there, so `mt_x@3` would answer a `404` that reads as a method that does not exist, and each route refuses a suffixed id with `RequestArgumentError` before anything is sent, naming `parseMethodSelector` and `getMethodVersion`. The whole-method `updateMethod` is gone, replaced by the draft write and the rename. **`deleteMethod` is asynchronous and its return type says so:** `DELETE /v1/methods/{id}` answers `202` with a `MethodDeletionAccepted` (`method_id`, `deletion_state`, `deletion_job_id`) the moment the platform has claimed the method and terminated its in-flight workflows — the rest of the cascade (runs, events, S3 objects) is enqueued. A resolved promise means "accepted", never "gone"; completion is the row disappearing from `listMethods`, not any field of that body. The claim is a conditional write, so a double-clicked delete is a `409 method_being_deleted` rather than a second cascade over the same runs, and an unknown or foreign-org id is a `404`. The erasure deletes the method's versions with the rest. (This doc previously stated the SDK had no `delete` because the platform had no such route — the route has always existed; the claim was simply false.) `listMethods` returns **one page**, not the whole catalog — a `MethodPage` (`{items, nextCursor}`) served from a narrow index projection, so its cost is the page size rather than the size of the catalog. It used to return every method with its full `.mthds` bundle attached, which hit DynamoDB's 1 MB page cap at a couple hundred methods and came back truncated with no error and no flag, so methods silently vanished from the UI. Rows are therefore `MethodSummary`, **not** `MethodDetail`: no `files`, no `updated_at`, because neither is in the projection and putting the source back is what restored the truncation. Reach for `getMethod(id)` when you need a method's files. `query.q` is applied server-side across the whole catalog, not over the page — filtering one page client-side would be searching 50 rows of 10,000 and calling it a search. `query.published` filters the same way, sent as `published=true` (the methods with a published version) or `published=false` (those never published), and combines with `q`. Each row carries the method's publish state, so a list tells its methods apart without reading each one: `latest_version` and `latest_published` (a `MethodVersionSummary`), both `null` when the method was never published, and `draft_digest`, `null` for an empty draft; all three are optional, absent from a platform that does not serve them. Never published is `latest_version === null`, the draft unchanged is a `draft_digest` that is not `null` and equals `latest_published.tree_digest`, and the draft ahead is two digests that differ. Both filters run after the index read, so **a filtered page can come back empty and still carry a `nextCursor`**: an empty page is not the end of the list, and only a `null` cursor is. `iterateMethods` is the async iterator that follows the cursor for callers who genuinely want everything (`for await (const m of client.iterateMethods())`); it keeps going **past empty pages**, since `{items: [], nextCursor: "…"}` means "nothing matched in the slice I just read, keep going". A server that keeps minting fresh cursors forever stops it at a page ceiling far past any real catalog with a `PagingNotTerminatingError` carrying `pageLimit`, never a silently truncated stream; `iterateRuns` shares the same loop. It gives up only when the server stops advancing its cursor, and **throws** rather than returning a partial answer; like `iterateRuns` it is deliberately not a `listAllMethods(): Promise<MethodSummary[]>`, because an all-at-once helper needs a page cap and a cap means silently returning a truncated list. `MethodSummary.deletion_state` rides the list rows: a method mid-erasure stays listed so the UI can render it as "Deleting…", while `getMethod` refuses it with a 409. Full read responses (`MethodDetail`, from `getMethod`) carry `org_id`, `created_by_user_id`, a server-derived `description` (recomputed from the draft's top-level `description` on every draft write), the draft token and digest, the latest version's summary and the draft's `files` on top of the write contract's `name` / `input_data`; the writes and the rename answer `MethodData`, the same method without `files`.
|
|
156
|
-
- **Method examples:** `createMethodExample`, `listMethodExamples`, `iterateMethodExamples`, `getMethodExample`, `updateMethodExample`, `recordMethodExampleLatestRun`, `deleteMethodExample`, on `/v1/methods/{id}/examples`. An example is a named set of inputs saved on a method, shared across the organization, with an `input_revision` that rises each time its inputs change and the `latest_run_id` of those inputs, which an inputs edit clears. `recordMethodExampleLatestRun` records a run against the revision whose inputs it used and answers a `MethodExampleLatestRunResult` discriminated on `outcome`, `recorded` or `stale`, each arm carrying the `example`: a run that outlasted an edit is a verdict, never thrown, and an answer off the union is one the SDK cannot read; one helper, `readVerdict`, reads
|
|
156
|
+
- **Method examples:** `createMethodExample`, `listMethodExamples`, `iterateMethodExamples`, `getMethodExample`, `updateMethodExample`, `recordMethodExampleLatestRun`, `saveAssistantMethodExample`, `deleteMethodExample`, on `/v1/methods/{id}/examples`. An example is a named set of inputs saved on a method, shared across the organization, with an `input_revision` that rises each time its inputs change and the `latest_run_id` of those inputs, which an inputs edit clears. `recordMethodExampleLatestRun` records a run against the revision whose inputs it used and answers a `MethodExampleLatestRunResult` discriminated on `outcome`, `recorded` or `stale`, each arm carrying the `example`: a run that outlasted an edit is a verdict, never thrown, and an answer off the union is one the SDK cannot read; `saveAssistantMethodExample` is the build assistant's save, which writes into the example it names only while that example is still the assistant's (`kept_by_assistant`) at the revision it read, and otherwise creates one, answering a `MethodExampleAssistantSaveResult` discriminated on `outcome`, `kept` or `created`; one helper, `readVerdict`, reads these verdicts and `publishMethod`'s, the example checked once, by the reader every example goes through. Every answer carrying an example is read with `parseExactJson` and every request body written with `stringifyExactJson`, so an integer past `Number.MAX_SAFE_INTEGER` in the inputs reads as a `bigint` and goes back digit for digit, to an edit or as a run's inputs; `3.0` still reads as `3`, and inputs holding one sent back unchanged are an edit for the platform, which compares inputs as canonical JSON. Every example the client hands back, the page rows and the verdict's `example` included, is checked by `readMethodExample` against the fields the Python SDK's model requires, with the strict types it holds them to, an example breaking one being an answer the SDK cannot read. The list is paged oldest first by an opaque cursor, and a page may be short while `nextCursor` is set; `iterateMethodExamples` follows it through the loop `iterateMethods` and `iterateRuns` share, and refuses a method id at the call rather than at the first pull. Every method takes a bare catalog id, and the client refuses an example id that is empty, `.` or `..` or holds a lone surrogate, a create without its name or inputs or whose `run_id` is given but empty, an edit naming neither `name` nor `inputs`, and a latest-run write without a run id or a positive integer revision before sending. See [method-examples.md](./method-examples.md).
|
|
157
157
|
- **Organizations:** `listMemberships`, `createOrganization`, `renameOrganization` (`PATCH`). Each membership carries the caller's `role_in_org`, an `OrgRole` (`admin`, `member` or `runner`) read open: a role a later platform adds arrives as its raw string, so a `switch` over it says what an unknown role does. The role is for display; what it may do is the platform's to decide, and a call refused to the caller's role is an `ApiResponseError`. The org "switch" is a WorkOS-session op (`/api/active-org`), not a `/v1` route — out of SDK scope.
|
|
158
|
+
- **Organization branding:** `getBranding` (`GET /v1/branding`, any role, web session or API key) and `updateOrganizationBranding` (`PATCH /v1/organizations/{org_id}/branding`, an admin's write) answer the same `OrganizationBranding`: the organization's name, its light and dark colour sets (`BrandingColors`) and its square and wide logos (`LogoDescriptor`). The write's `OrganizationBrandingUpdate` sets a key given a value, clears a key given `null` and keeps a key left out; a refused logo or colour is named in `ApiResponseError.errors`, by slot or by dotted key, a logo the platform measured with a `LogoRefusalCode`. See [organization-branding.md](./organization-branding.md).
|
|
158
159
|
- **Billing:** `getSubscription`, `listPlans`, `listInvoices`, `createCheckout`, `changePlan` (409 `conflict` ⇒ no subscription), `getBillingPortal` (409 `conflict` ⇒ no subscription).
|
|
159
160
|
- **Pipelex API keys (`plx_sk_…`):** `listPipelexApiKeys`, `createPipelexApiKey` (409 `pipelex_api_key_limit_reached`), `revokePipelexApiKey`, `rotatePipelexApiKey`. The plaintext `api_key` is returned once, on create/rotate.
|
|
160
161
|
- **Onboarding:** `submitOnboarding`.
|
|
161
|
-
- **Storage:** `resolveStorageUrl`, `resolveStorageUrls` (`POST /v1/resolve-storage-url/bulk` — the single route applied to a list of at most 100 references, one verdict per reference in request order, a refused reference a value on its item; a deployment without the route answers a `404` `ApiResponseError`), `upload` (JSON base64 — the multipart hop is browser→BFF only), `requestUploadGrant` (`POST /v1/upload/grant` — a presigned, create-only `PUT` for
|
|
162
|
+
- **Storage:** `resolveStorageUrl`, `resolveStorageUrls` (`POST /v1/resolve-storage-url/bulk` — the single route applied to a list of at most 100 references, one verdict per reference in request order, a refused reference a value on its item; a deployment without the route answers a `404` `ApiResponseError`), `upload` (JSON base64 — the multipart hop is browser→BFF only — answering the file's `uri`, its `filename` and the `file_id` of its record), `requestUploadGrant` (`POST /v1/upload/grant` — for a file described by its name, size and, from `describeUpload`, its SHA-256: either `stored: true`, the organization already holding those bytes, or a presigned, create-only `PUT` for the object, which the holder of the bytes sends with the standalone `uploadWithGrant`; both helpers are also exported from the browser-safe `@pipelex/sdk/upload` entry; a declared size over the cap is a `413` `ApiResponseError`). The higher-level `uploadFile` / `prepareInputs` preparation surface is built on top of `upload`; `prepareInputs` additionally composes one `pipeIo` call, which selects the pipe and answers with the input-form descriptor it walks, and takes the method as its tree, a `method_ref` or a `method_id` like every other method-taking operation — see [input-preparation.md](./input-preparation.md). The download twin — `locateArtifacts`, `collectArtifacts`, `resolveArtifacts`, `fetchArtifact`, `downloadArtifacts` — is built on top of `resolveStorageUrls` and `getRunResult`, never on the embedded `public_url`, and is documented on [artifact-download.md](./artifact-download.md); downloading is a separate explicit gesture, and no run call takes a `download` option.
|
|
162
163
|
- **Runs list/detail/update:** `listRuns` (by `method_id`) returns **one page**, not the whole history — a `RunPage` (`{items, nextCursor}`) served from a time-ordered index, so its cost is the page size rather than the size of the history. Its rows are `RunHistoryItem`, **not** `PipelineRun`: the id, `status`, `created_at`, `finished_at`, `pipe_code`, for a failed run `error`, and `method_version` and `source_digest`, which version of the method the run ran (a number, `"draft"`, or `null` for an inline source) and the SHA-256 of the sources it sent as text, 64 hex digits with no prefix and `null` for a run whose `files` held bytes as Base64 or by hash — what a history row shows. `getRunDetail` also carries the run's `tree_digest` and `crate_fingerprint`, each `null` for a run that recorded none. The history lists the runs of every version and of the draft together, by the bare id. `method_version` and `source_digest` are optional on every run record (`RunPublic`, `RunRead`, `PipelineRun`, `RunDetail`, `RunHistoryItem`), since a run recorded before the platform recorded them carries neither. The run's organization, creator, method, workflow id and result location are not on the list; `getRunDetail` returns them. `iterateRuns` is the async iterator that follows the cursor for callers who genuinely want everything (`for await (const run of client.iterateRuns(id))`); it is deliberately not a `listAllRuns(): Promise<RunHistoryItem[]>`, because an all-at-once helper needs a page cap and a cap means silently returning a truncated list. Both accept `createdFrom` / `createdTo`, applied server-side as index key conditions — these are **instants, not days** (ISO-8601 with a UTC offset; a naive timestamp is a 400), because only the caller knows which timezone's day it means. Both also accept `createdBy: "me"`, sent as `created_by=me`, which keeps the runs the caller started (the platform resolves "me" from the authenticated identity and takes no other value), and `status`, a list of `RunStatus` sent as one repeated `status=` parameter per status, deduplicated into the platform's order, which keeps the runs in any of them: the caller's own latest unfinished run is `{ createdBy: "me", status: ["PENDING", "STARTED", "RUNNING"], limit: 1 }`. An empty `status` list would be sent as no parameter at all, which lists every status, so it is a `RequestArgumentError` before any request, as is a name that is no `RunStatus`. These two are filters applied after the index read, so **a filtered page can hold fewer runs than `limit`, or none, and still carry a `nextCursor`**: an empty page is not the end of the history, a `null` cursor is, and `iterateRuns` keeps following the cursor through one. It runs the same loop as `iterateMethods`, so it also stops on a cursor the server failed to advance and throws `PagingNotTerminatingError` past the same page ceiling. `getRunDetail` (`GET /v1/runs/{id}`) is the only call returning `mthds_contents` — what the run actually executed — and `inputs`; it is kept off the status read that pollers hit every few seconds and off the list, where the bundle would be multiplied by the page size. `updateRun` is the admin/manual status patch. The status/results/start lifecycle routes live in the run-lifecycle section above.
|
|
164
|
+
- **An organization's files:** `listFiles` (`GET /v1/files`) returns **one page** of the organization's listed files, newest first, a `FilePage` (`{items, nextCursor}`) of `FileSummary` rows, each with the `uri` a run's inputs take as any address, its name, type, size, `kind` (`uploaded`, `generated` or `test`) and `origin`. Its `ListFilesQuery` follows `ListRunsQuery`'s camelCase and is sent under the API's names: `methodId`, `runId` and `createdBy` choose the method's, the run's (in the order of its addresses), one member's or the organization's list, and `q`, `kind`, `format`, `mediaType`, `createdFrom` and `createdTo` filter it, `format` and `mediaType` as one repeated parameter per value, an empty list of either refused with `RequestArgumentError` before any request since it would be sent as no filter at all. The filters apply after the index read, so a filtered page can be short or empty and still carry a `nextCursor`, which is bound to the list and filters that issued it; `iterateFiles` follows it through the loop the other iterators share. An upload is recorded as a method's test file by `kind: "test"` with its `method_id`, the pair `UploadInput`, `uploadFile`'s options and `prepareInputs`' nested `upload` all take, checked before any file is read; the upload route's refusals of a test file, for the caller's role or for its method, are a `TestFileRefusedError`. The rest of the files surface reads and acts on one file or a selection: `getFile` answers a `FileDetail`, the whole `FileRecord` with its `method_ids` and one page of its uses, whose cursor stays inside the answer as `uses.next_cursor`; `getFilesByUri` the records holding one address, the one a surface shows first; `renameFile` the record under the name the platform's one rule saved; and `linkFiles` one `FileLink` per requested file, in order, each a link or an `error`, a `200` either way, read through `withLinks` so an answer the SDK cannot read hides every link. A zip is two calls, `requestFileArchive` (answered `202`, `queued`) and `getFileArchive`, read until `ready` or `failed`, with no waiting helper; a selection past a cap is a `422` `file_archive_too_large` whose `limit` member `problemDocument` carries. `listRunFiles` (`GET /v1/runs/{id}/files`) answers a `RunFilesPage` of a run's inputs, outputs, intermediate files and web links, its `next_cursor` read as `nextCursor` and its `state` `listing` until every record is written. `copyFileIntoDraft` copies a file into a method's draft and answers a `200` discriminated on `blob`, `copied` or `already_held`, with the new draft token on its `method`. Each answer is checked on the member a caller branches on before it is handed back. See [files.md](./files.md).
|
|
163
165
|
|
|
164
166
|
## Hook bundle (`dist-hooks/check.mjs`)
|
|
165
167
|
|
package/docs/errors.md
CHANGED
|
@@ -50,10 +50,11 @@ On an error from a request that may have started a run, `retryable` is `false` w
|
|
|
50
50
|
| `RunTimeoutError`, `RunStillRunningError` | `runtime` | yes | The run is still going; waiting again, by its id, can succeed. |
|
|
51
51
|
| `RunLifecycleUnavailableError` | `config` | no | The base URL points at a bare runner without the run lifecycle. |
|
|
52
52
|
| `MissingMainStuffError` | `runtime` | no | The API broke its own contract on a completed run. |
|
|
53
|
-
| `PagingNotTerminatingError` | `runtime` | no | A server minting cursors forever; `pageLimit` is the ceiling `iterateMethods`, `iterateRuns` or `
|
|
53
|
+
| `PagingNotTerminatingError` | `runtime` | no | A server minting cursors forever; `pageLimit` is the ceiling `iterateMethods`, `iterateRuns`, `iterateMethodExamples` or `iterateFiles` stopped at. |
|
|
54
54
|
| `InputPreparationError` and `InvalidLocalSourceError`, `InvalidInputValueError`, `UploadNotAllowedError`, `MethodLoadError`, `RejectedAssetError` | `input` | no | The asset, the inputs or the method selector must change. The family's base takes an optional `verdict` in its options, so a subclass of your own can declare another; `prepareInputs` declares `runtime` for a pipe I/O answer that breaks the route's contract: no boolean `is_valid`, an `input_form` that does not describe the pipe it selected, or a descriptor that is malformed or names a kind this SDK does not know. |
|
|
55
|
+
| `TestFileRefusedError` | the cause's, else by `code` | no | The upload route refused a test file (`kind: "test"`) for what it claims, never for its bytes. `uploadFile` and `prepareInputs` wrap the platform's `ApiResponseError` and take its verdict; without such a cause, `code` decides: `role_not_permitted`, the `403` of a role that may not change methods, is `config`, since an admin must change the role, and `method_not_found` (`404`) and `method_being_deleted` (`409`) are `input`, since the upload must name another method ([files.md](./files.md#uploading-a-test-file)). |
|
|
55
56
|
| `UnsupportedUploadCapabilityError`, `UploadAuthenticationError` | `config` | no | The deployment or the credential must change. |
|
|
56
|
-
| `UploadTransportError` | the cause's, else by `code` | the cause's, else by `code` | `uploadFile` wraps the `ApiResponseError` or `ApiUnreachableError` the client threw, and takes its verdict, so a wrapped `402` is `config` and not retryable. Without such a cause, which is always the case from `uploadWithGrant`: `timeout`, `storage_timeout` and `conflict` are `runtime` and retryable, `conflict` because storage documents its `409 ConditionalRequestConflict` as retryable and the grant is not spent by it (a spent grant is the `412` of a `RejectedAssetError` with code `grant_used
|
|
57
|
+
| `UploadTransportError` | the cause's, else by `code` | the cause's, else by `code` | `uploadFile` wraps the `ApiResponseError` or `ApiUnreachableError` the client threw, and takes its verdict, so a wrapped `402` is `config` and not retryable. Without such a cause, which is always the case from `uploadWithGrant`: `timeout`, `storage_timeout` and `conflict` are `runtime` and retryable, `conflict` because storage documents its `409 ConditionalRequestConflict` as retryable and the grant is not spent by it, even once `uploadWithGrant`'s own few attempts have all met it (a spent grant is the `412` of a `RejectedAssetError` with code `grant_used`, which only a grant asked for without the file's hash can meet); `server_error` is `runtime`, and retryable when [the fallback table](#a-refused-requests-verdict) would call its `status` retryable, any `5xx` but the `501` storage answers for a request it does not implement, or when it carries no status; `unexpected` is `runtime`, and retryable when that table would call its `status` retryable, which is the `408` or `429` storage answers when it times out or throttles the request rather than refusing the file, and not retryable for any other status or none; `unreachable` is `config` and retryable; `redirected` is `config` and not retryable; `invalid_grant_url` is `runtime` and not retryable. |
|
|
57
58
|
| `MethodFileTransferError` | `runtime` | by `code` | A method's file could not be moved between this machine and storage: uploaded by `createMethod` or `writeDraft`, so the method was not saved, or by a run, `validate`, `resolve`, `codegen`, `pipeIo` or `prepareInputs` sending a `directory`, `tree` or `contents` by hash, so the request was not sent, or downloaded by `writeMethodTree`. `unreachable` (no answer), `storage_error` (`408`, `429` or a `5xx` other than `501`) and `mismatch` (downloaded bytes that are not the file listed) are retryable; `refused`, any other status, an expired link among them, is not. It carries `operation`, `code`, `sha256`, `path` and `status`, and neither the link, nor storage's error body, nor a cause ([method-trees.md](./method-trees.md#when-a-transfer-fails)). |
|
|
58
59
|
| `ArtifactOperationError`, `ScopeUnavailableError` | `runtime` | no | The family's base also takes an optional `verdict`: the SDK declares `input` where it refuses an argument (a `scope`, a bound, a location) and `config` where the environment refuses the download (a runtime with no filesystem, a directory that cannot be created). |
|
|
59
60
|
| `ArtifactAuthenticationError` | `config` | no | The credential must change. Its `verdict` member is the download's result so far, not the error's. |
|
|
@@ -260,7 +261,7 @@ So `caller_facing_message` is how a consumer tells the author's copy from the pl
|
|
|
260
261
|
|
|
261
262
|
Every non-2xx answer from a `/v1` route is a problem document, and the SDK throws an `ApiResponseError` whose fields are its members. Each field is `undefined` when the document did not carry it, and a member of the wrong type (a numeric `type`, a `retryable` of `"no"`, a `user_action` without a `detail`) reads as absent rather than as a wrong value. The nested members are checked one level down, exactly as a [stored report's](#a-failed-run--runerrorreport) are: `providerMetadata` and `migration` keep each named field only when it has its type, `validationErrors` keeps only the items that are objects with a string `category` and `message`, and each item of `errors` keeps its `field`, `code` and `detail` only when they are strings; members the SDK does not name are relayed as sent. The verdict is the exception: `errorDomain` and `retryable` are always decided, the server's value when it sent a valid one and otherwise [as the verdict section says](#a-refused-requests-verdict).
|
|
262
263
|
|
|
263
|
-
**An answer the SDK could not read is an `ApiResponseError` too.** A `2xx` whose body is not JSON, such as a gateway's HTML page or an empty body where the route answers one, is no result the SDK can hand back, so every route throws an `ApiResponseError` for it instead of letting the runtime's `SyntaxError` escape. Every body is read by the rules the protocol reads a problem body by (`parseJsonBody` in `mthds/protocol`, as `pipelex-sdk` reads it), so JSON nested deeper than `MAX_BODY_NESTING`, or holding a number past the range of a double, such as `1e999` or an integer that long, which `JSON.parse` reads as `Infinity`, is a body that is not JSON too; a refusal whose body is such JSON carries no hosted member and no `problemDocument`. So is a `2xx` read exactly, such as a run's results or a method example, that holds a number past `Number.MAX_SAFE_INTEGER` on a runtime whose `JSON.parse` hands a reviver no source text, which could only read it rounded; its `cause` is the reader's `ExactJsonUnsupportedError` ([exact-integers.md](./exact-integers.md)). So is a `2xx` whose body is JSON but not the object the route answers — `null`, a number, a string, an array — on every protocol, extension and run-lifecycle route, on `health()`, and on the product routes whose answer the SDK or its caller reads before anything else (`listMethods`, `getMethod`, `createMethod`, `writeDraft`, `renameMethod`, `publishMethod`, `listMethodVersions`, `getMethodVersion`, the method example routes, `listRuns`, `getRunDetail`, `upload`, `requestUploadGrant`, `resolveStorageUrls`), instead of the `TypeError` that reading it would raise. So is an object missing the member those reads depend on: a page of `listMethods`, `listMethodVersions`, `listMethodExamples` or `
|
|
264
|
+
**An answer the SDK could not read is an `ApiResponseError` too.** A `2xx` whose body is not JSON, such as a gateway's HTML page or an empty body where the route answers one, is no result the SDK can hand back, so every route throws an `ApiResponseError` for it instead of letting the runtime's `SyntaxError` escape. Every body is read by the rules the protocol reads a problem body by (`parseJsonBody` in `mthds/protocol`, as `pipelex-sdk` reads it), so JSON nested deeper than `MAX_BODY_NESTING`, or holding a number past the range of a double, such as `1e999` or an integer that long, which `JSON.parse` reads as `Infinity`, is a body that is not JSON too; a refusal whose body is such JSON carries no hosted member and no `problemDocument`. So is a `2xx` read exactly, such as a run's results or a method example, that holds a number past `Number.MAX_SAFE_INTEGER` on a runtime whose `JSON.parse` hands a reviver no source text, which could only read it rounded; its `cause` is the reader's `ExactJsonUnsupportedError` ([exact-integers.md](./exact-integers.md)). So is a `2xx` whose body is JSON but not the object the route answers — `null`, a number, a string, an array — on every protocol, extension and run-lifecycle route, on `health()`, and on the product routes whose answer the SDK or its caller reads before anything else (`listMethods`, `getMethod`, `createMethod`, `writeDraft`, `renameMethod`, `publishMethod`, `listMethodVersions`, `getMethodVersion`, the method example routes, `listRuns`, `getRunDetail`, `listRunFiles`, the files routes from `listFiles` to `copyFileIntoDraft`, `upload`, `requestUploadGrant`, `resolveStorageUrls`), instead of the `TypeError` that reading it would raise. So is an object missing the member those reads depend on: a page of `listMethods`, `listMethodVersions`, `listMethodExamples`, `listRuns` or `listFiles` whose `items` is not an array or whose `next_cursor` is neither a string nor `null`, which the iterators could not walk or would follow forever; a publish result whose `outcome` is not `published`, `unchanged` or `refused`, or whose `method` is not an object, a latest-run result whose `outcome` is not `recorded` or `stale`, or whose `example` is not an object, an assistant save result whose `outcome` is not `kept` or `created`, or whose `example` is not an object, a copy into a draft whose `blob` is not `copied` or `already_held`, or whose `file` or `method` is not an object, and an archive whose `state` is not `queued`, `building`, `ready` or `failed`, which a caller branching on that field could not read; a file whose `uses` is not a page, a page of a run's files whose `state` is unknown or whose lists are not arrays, and an answer of `linkFiles` that is not one item per requested file, each with its link or its error; a method example, as `createMethodExample`, `getMethodExample` and `updateMethodExample` answer it, as a row of `listMethodExamples` and as a latest-run or assistant save result's `example`, that misses a field the Python SDK's model of an example requires or holds one of another type, its message naming the field; an `upload` answer with no non-empty string `uri`, which names no stored file; a stored method or a published version, as `getMethod` and `getMethodVersion` answer it, whose `files` is not a listing of files, each with its string `path`, `url` and `expires_at`, a `sha256` of 64 lower-case hex digits and a non-negative integer `size`; and an answer of `POST /v1/blobs/missing` asking for a blob the tree being saved does not hold: that is server data no change to the call fixes, not an argument the caller passed. Its `status` is the `2xx`, `responseBody` the raw text, `cause` what made the answer unreadable (the parse failure; nothing for a body that parsed to something the route does not answer, nor for JSON the protocol refuses), `problemDocument` and the hosted problem members are `undefined`, `problem` is the standard's reading of such an answer (`client.response_unreadable`, or `client.outcome_unknown` on `start` and `execute`), an answer that carries signed links (a stored method, a published version, the upload targets of `POST /v1/blobs/missing`, the links of `linkFiles` and an archive of `requestFileArchive` or `getFileArchive`) has every link redacted in `responseBody`, each `url` member and each link's query replaced by `[redacted]`, and keeps no `cause` at all, since a link is a bearer credential; and its verdict is the fallback's for a status no refusal carries: `runtime`, not retryable. On `start` and `execute` its `runMayHaveStarted` is `true`, since the server accepted the request; that includes a start acknowledgement whose `pipeline_run_id` is not a string, and an `execute` `202` that names no run, which leave the caller a run it could not follow, and an `execute` answer that is not the completed run: one whose `pipeline_run_id` is not a string, or whose `pipe_output` carries no string `pipeline_run_id` or no `working_memory` with `root` and `aliases` objects, the members the Python SDK's model of the answer requires. A product route that answers a `2xx` with no body at all, such as `revokePipelexApiKey`, still resolves to `undefined`, and the other product routes hand their decoded body back as it came.
|
|
264
265
|
|
|
265
266
|
| Field | Wire member | Meaning |
|
|
266
267
|
|---|---|---|
|
|
@@ -317,6 +318,14 @@ A refusal about a saved method or one of its versions carries one of the platfor
|
|
|
317
318
|
|
|
318
319
|
A malformed version suffix (`@0`, `@03`, `@Draft`, two suffixes) is a `422` `validation_failed` whose `errors` name the field `method_id`; `parseMethodSelector` refuses the same selectors locally with a `RequestArgumentError`, before anything is sent. So is any suffix on the run routes' linkage form, a `method_id` beside an inline source, which `execute` and `start` refuse locally the same way.
|
|
319
320
|
|
|
321
|
+
### The branding codes
|
|
322
|
+
|
|
323
|
+
A refused branding write (`updateOrganizationBranding`) names each logo or colour it refused in `errors`: the entry's `field` is the logo's slot, `square_logo` or `wide_logo`, or the colour's dotted key, such as `colors.action`, and its `detail` the sentence a settings screen shows under that control. A logo the platform read and refused is a `422` `validation_failed` with one entry per broken rule, both slots at once, each `code` one the exported type `LogoRefusalCode` names (`logo_too_large`, `logo_not_square`, `logo_too_small`, …); a logo URI refused before any read names its slot the same way, under `400` `invalid_storage_uri` or `403` `forbidden`. [organization-branding.md](./organization-branding.md#when-a-write-is-refused) lists every code with a sentence of each.
|
|
324
|
+
|
|
325
|
+
### The files codes
|
|
326
|
+
|
|
327
|
+
A zip asked for past a cap (`requestFileArchive`) is a `422` `file_archive_too_large`, `input` and not retryable, whose problem document carries a `limit` member beside the others, read from `problemDocument` and typed `FileArchiveLimit`: the cap's `name` (`max_files` or `max_total_bytes`), its `value` and what the selection `reached`, so a client can say how far over the selection is and split it. A rename by a role that may only rename its own files, and a copy into a draft by a role that may not change methods, are a `403` `role_not_permitted` whose `detail` names the caller's role. A file link refused for one file is not an error at all but that item's `error` in a `200` answer. [files.md](./files.md) gives every refusal of each files route.
|
|
328
|
+
|
|
320
329
|
## A validation item — `ValidationErrorItem`
|
|
321
330
|
|
|
322
331
|
A method refused for what it says, rather than for how its run went, comes back as a list of validation items. They ride the `/v1/validate` verdict (its invalid arm's `validation_errors[]`, and the advisory `warnings[]` of its valid arm) and the crate routes' invalid verdict (`CrateInvalidReport.validation_errors[]`), each a `200` because an invalid bundle is a produced verdict; the `422` a run route answers when the runner refuses the method for its validation errors, as `ApiResponseError.validationErrors`; and a failed run's report, as `validation_errors`. Each item has a `category` and a `message`; the other members locate the error and say what to do next, and each is present only when the runner knows it:
|