@pipelex/sdk 0.38.0 → 0.39.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.
@@ -52,6 +52,15 @@ export interface PrepareInputsBase {
52
52
  * abort. A request already sent runs to its end. It is not sent to the server.
53
53
  */
54
54
  signal?: AbortSignal;
55
+ /**
56
+ * Whether preparation may upload, `true` when omitted. With `false`, a value at a file input
57
+ * that would need an upload — a local path, a `data:` URL, bytes — is refused with an
58
+ * {@link UploadNotAllowedError} naming the input, and nothing is read from disk, decoded or
59
+ * sent to the upload route; `http(s)` URLs and `pipelex-storage://` references pass through as
60
+ * always. It is for a server preparing inputs on a caller's behalf, which must never read a file
61
+ * of its own because the caller named it. It is not sent to the server.
62
+ */
63
+ allowUploads?: boolean;
55
64
  }
56
65
  /**
57
66
  * How the method is named — exactly one of the three selectors, each pinning the
@@ -96,6 +105,10 @@ export interface PrepareCapableClient extends UploadCapableClient {
96
105
  * records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
97
106
  * unchanged. All failures are raised before any run is created.
98
107
  *
108
+ * With `allowUploads: false`, nothing is read from disk or uploaded: a value that
109
+ * would need either throws {@link UploadNotAllowedError}, naming the input and
110
+ * where inside it the value sits.
111
+ *
99
112
  * The pipe and its signature come from one `POST /v1/pipe-io`, whatever the
100
113
  * selector — inline `files`, a `method_ref` the runner resolves, or a
101
114
  * `method_id` the platform resolves. A bare or alias-qualified `pipe_ref`, a
@@ -32,7 +32,7 @@
32
32
  */
33
33
  import { isValidationItem } from "./error-models.js";
34
34
  import { throwIfAborted } from "./runs.js";
35
- import { ApiResponseError, InputPreparationError, InvalidInputValueError, MethodLoadError, } from "./errors.js";
35
+ import { ApiResponseError, InputPreparationError, InvalidInputValueError, MethodLoadError, UploadNotAllowedError, } from "./errors.js";
36
36
  import { uploadFile } from "./upload.js";
37
37
  const PIPELEX_STORAGE_SCHEME = "pipelex-storage://";
38
38
  const HTTP_URL_RE = /^https?:\/\//i;
@@ -123,54 +123,73 @@ function base64ToBytes(base64) {
123
123
  bytes[index] = binary.charCodeAt(index);
124
124
  return bytes;
125
125
  }
126
- /** Resolve one source (string reference or bytes) to the URL/URI to write, deduped by identity. */
126
+ function classifySource(source) {
127
+ if (typeof source === "string") {
128
+ if (source.startsWith(PIPELEX_STORAGE_SCHEME) || HTTP_URL_RE.test(source)) {
129
+ return { kind: "reference", value: source };
130
+ }
131
+ if (source.startsWith("data:"))
132
+ return { kind: "data_url", value: source };
133
+ // Anything else is a local filesystem path — Node only (uploadFile enforces it).
134
+ return { kind: "local_path", value: source };
135
+ }
136
+ if (source instanceof Blob || source instanceof ArrayBuffer || source instanceof Uint8Array) {
137
+ return { kind: "bytes", value: source };
138
+ }
139
+ return { kind: "unsupported", value: source };
140
+ }
141
+ /** Resolve one classified source to the URL/URI to write, deduped by the caller's value's identity. */
127
142
  function resolveSource(ctx, source) {
128
- const cached = ctx.dedup.get(source);
143
+ const cached = ctx.dedup.get(source.value);
129
144
  if (cached !== undefined)
130
145
  return cached;
131
146
  const pending = doResolveSource(ctx, source);
132
- ctx.dedup.set(source, pending);
147
+ ctx.dedup.set(source.value, pending);
133
148
  return pending;
134
149
  }
135
150
  async function doResolveSource(ctx, source) {
136
- if (typeof source === "string") {
137
- if (source.startsWith(PIPELEX_STORAGE_SCHEME))
138
- return source; // already prepared
139
- if (HTTP_URL_RE.test(source))
140
- return source; // reachable URL — pass through
141
- if (source.startsWith("data:")) {
142
- const { bytes, contentType } = decodeDataUrl(source);
151
+ switch (source.kind) {
152
+ case "reference":
153
+ return source.value; // already prepared, or a reachable URL — pass through
154
+ case "data_url": {
155
+ const { bytes, contentType } = decodeDataUrl(source.value);
143
156
  throwIfAborted(ctx.signal);
144
157
  const record = await uploadFile(ctx.client, bytes, { contentType, signal: ctx.signal });
145
158
  ctx.uploads.push(record);
146
159
  return record.uri;
147
160
  }
148
- // Anything else is a local filesystem path — Node only (uploadFile enforces it).
149
- throwIfAborted(ctx.signal);
150
- const record = await uploadFile(ctx.client, source, { signal: ctx.signal });
151
- ctx.uploads.push(record);
152
- return record.uri;
153
- }
154
- if (source instanceof Blob || source instanceof ArrayBuffer || source instanceof Uint8Array) {
155
- throwIfAborted(ctx.signal);
156
- const record = await uploadFile(ctx.client, source, { signal: ctx.signal });
157
- ctx.uploads.push(record);
158
- return record.uri;
161
+ case "local_path":
162
+ case "bytes": {
163
+ throwIfAborted(ctx.signal);
164
+ const record = await uploadFile(ctx.client, source.value, { signal: ctx.signal });
165
+ ctx.uploads.push(record);
166
+ return record.uri;
167
+ }
168
+ case "unsupported":
169
+ // An unrecognized value sits at a file-bearing position (neither a source string,
170
+ // bytes, nor a canonical `{url}` content dict). Fail with a typed error rather than
171
+ // letting a raw TypeError escape from the byte-extraction path.
172
+ throw new InvalidInputValueError(`Unsupported value at a file input: expected a path string, bytes (Blob/File/ArrayBuffer/Uint8Array), ` +
173
+ `a data URL, an http(s)/pipelex-storage:// URL, or canonical {url} content; got ${typeof source.value}.`);
159
174
  }
160
- // An unrecognized value sits at a file-bearing position (neither a source string,
161
- // bytes, nor a canonical `{url}` content dict). Fail with a typed error rather than
162
- // letting a raw TypeError escape from the byte-extraction path.
163
- throw new InvalidInputValueError(`Unsupported value at a file input: expected a path string, bytes (Blob/File/ArrayBuffer/Uint8Array), ` +
164
- `a data URL, an http(s)/pipelex-storage:// URL, or canonical {url} content; got ${typeof source}.`);
165
175
  }
166
- /** Resolve a value known to sit at a file position into canonical content with a rewritten `url`. */
167
- async function resolveFilePosition(ctx, callerValue) {
168
- if (isFileContent(callerValue)) {
169
- const resolved = await resolveSource(ctx, callerValue.url);
170
- return { ...callerValue, url: resolved };
176
+ /**
177
+ * Resolve a value known to sit at a file position into canonical content with a rewritten `url`.
178
+ * Under `allowUploads: false`, a source that would need an upload is refused here, before
179
+ * `resolveSource` could read, decode or upload it.
180
+ */
181
+ async function resolveFilePosition(ctx, callerValue, at) {
182
+ const fileContent = isFileContent(callerValue);
183
+ const source = classifySource(fileContent ? callerValue.url : callerValue);
184
+ if (!ctx.allowUploads && source.kind !== "reference" && source.kind !== "unsupported") {
185
+ throw new UploadNotAllowedError({
186
+ inputName: at.name,
187
+ inputPath: at.path,
188
+ valueKind: source.kind,
189
+ });
171
190
  }
172
- const resolved = await resolveSource(ctx, callerValue);
173
- return { url: resolved };
191
+ const resolved = await resolveSource(ctx, source);
192
+ return fileContent ? { ...callerValue, url: resolved } : { url: resolved };
174
193
  }
175
194
  /**
176
195
  * Descriptor-guided walk, discriminated on the node's `kind`:
@@ -190,18 +209,21 @@ async function resolveFilePosition(ctx, callerValue) {
190
209
  * non-array at a `list`) passes through for the run to reject — preparation never
191
210
  * second-guesses the signature.
192
211
  */
193
- async function resolveNode(ctx, node, callerValue) {
212
+ async function resolveNode(ctx, node, callerValue, at) {
194
213
  switch (node.kind) {
195
214
  case "document":
196
215
  case "image":
197
- return resolveFilePosition(ctx, callerValue);
216
+ return resolveFilePosition(ctx, callerValue, at);
198
217
  case "object": {
199
218
  if (!isPlainObject(callerValue))
200
219
  return callerValue;
201
220
  const result = { ...callerValue };
202
221
  for (const field of node.fields) {
203
222
  if (Object.hasOwn(callerValue, field.name)) {
204
- result[field.name] = await resolveNode(ctx, field, callerValue[field.name]);
223
+ result[field.name] = await resolveNode(ctx, field, callerValue[field.name], {
224
+ name: at.name,
225
+ path: `${at.path}.${field.name}`,
226
+ });
205
227
  }
206
228
  }
207
229
  return result;
@@ -209,7 +231,7 @@ async function resolveNode(ctx, node, callerValue) {
209
231
  case "list": {
210
232
  if (!Array.isArray(callerValue))
211
233
  return callerValue;
212
- return Promise.all(callerValue.map((element) => resolveNode(ctx, node.item, element)));
234
+ return Promise.all(callerValue.map((element, index) => resolveNode(ctx, node.item, element, { name: at.name, path: `${at.path}[${index}]` })));
213
235
  }
214
236
  default:
215
237
  return callerValue;
@@ -281,6 +303,18 @@ function normalizePipeRef(raw) {
281
303
  }
282
304
  return pipeRef;
283
305
  }
306
+ /**
307
+ * Read the caller's `allowUploads`: `true` when omitted, the boolean when given, and refused
308
+ * before any request otherwise. A value of the wrong type is not read as either answer, since
309
+ * reading a stray `"false"` as permission would upload exactly what the caller meant to refuse.
310
+ */
311
+ function resolveAllowUploads(raw) {
312
+ if (raw === undefined)
313
+ return true;
314
+ if (typeof raw === "boolean")
315
+ return raw;
316
+ throw new InputPreparationError(`Cannot prepare inputs: \`allowUploads\` must be a boolean, got ${raw === null ? "null" : typeof raw}.`);
317
+ }
284
318
  /**
285
319
  * Ask `POST /v1/pipe-io` for the pipe and its signature, whatever the selector,
286
320
  * and hand back the valid report.
@@ -364,6 +398,10 @@ function selectedDescriptor(report) {
364
398
  * records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
365
399
  * unchanged. All failures are raised before any run is created.
366
400
  *
401
+ * With `allowUploads: false`, nothing is read from disk or uploaded: a value that
402
+ * would need either throws {@link UploadNotAllowedError}, naming the input and
403
+ * where inside it the value sits.
404
+ *
367
405
  * The pipe and its signature come from one `POST /v1/pipe-io`, whatever the
368
406
  * selector — inline `files`, a `method_ref` the runner resolves, or a
369
407
  * `method_id` the platform resolves. A bare or alias-qualified `pipe_ref`, a
@@ -376,12 +414,19 @@ function selectedDescriptor(report) {
376
414
  export async function prepareInputs(client, request) {
377
415
  const selector = resolveSelector(request);
378
416
  const pipeRef = normalizePipeRef(request.pipe_ref);
417
+ const allowUploads = resolveAllowUploads(request.allowUploads);
379
418
  throwIfAborted(request.signal);
380
419
  const report = await fetchSignature(client, selector, pipeRef);
381
420
  throwIfAborted(request.signal);
382
421
  const descriptor = selectedDescriptor(report);
383
422
  const declared = new Map(descriptor.fields.map((field) => [field.name, field]));
384
- const ctx = { client, signal: request.signal, uploads: [], dedup: new Map() };
423
+ const ctx = {
424
+ client,
425
+ signal: request.signal,
426
+ allowUploads,
427
+ uploads: [],
428
+ dedup: new Map(),
429
+ };
385
430
  const rewritten = { ...request.inputs };
386
431
  for (const [name, callerValue] of Object.entries(request.inputs)) {
387
432
  const field = declared.get(name);
@@ -392,11 +437,11 @@ export async function prepareInputs(client, request) {
392
437
  // The caller filled the explicit `{ concept, content }` envelope: walk the
393
438
  // inner content against the same node, then re-wrap so the concept
394
439
  // annotation rides through to the run (the runtime accepts the envelope).
395
- const walked = await resolveNode(ctx, field, callerValue.content);
440
+ const walked = await resolveNode(ctx, field, callerValue.content, { name, path: name });
396
441
  rewritten[name] = { ...callerValue, content: walked };
397
442
  }
398
443
  else {
399
- rewritten[name] = await resolveNode(ctx, field, callerValue);
444
+ rewritten[name] = await resolveNode(ctx, field, callerValue, { name, path: name });
400
445
  }
401
446
  }
402
447
  return { inputs: rewritten, uploads: ctx.uploads };
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-inputs.js","sourceRoot":"","sources":["../src/prepare-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,GAChB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AACpD,MAAM,WAAW,GAAG,eAAe,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,0BAA0B,GAAwB,IAAI,GAAG,CAAC;IAC9D,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC,CAAC;AAiEH,2FAA2F;AAC3F,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,iBAAiB,CAAC;AACrE,CAAC;AAED,+EAA+E;AAC/E,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,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E,mEAAmE;YACnE,0EAA0E;YAC1E,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACxF,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QACxD,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;AACrD,CAAC"}
@@ -481,9 +481,9 @@ export interface PipelineRun {
481
481
  pipe_statuses?: Record<string, PipeStatus> | null;
482
482
  created_at: string;
483
483
  finished_at?: string | null;
484
- /** The runner's stored error report, typed whole — present only on a failed run
485
- * whose completion callback carried one. This is how a consumer tells the user
486
- * WHY a run failed rather than showing a generic message. */
484
+ /** The run's stored error report as the platform serves it, the runner's STRICT
485
+ * projection, typed whole (see `RunErrorReport` for which runs hold one). This is how a
486
+ * consumer tells the user WHY a run failed rather than showing a generic message. */
487
487
  error?: RunErrorReport | null;
488
488
  /**
489
489
  * Which version of its method the run ran: the version number for a run addressed by a
@@ -518,8 +518,9 @@ export interface RunHistoryItem {
518
518
  finished_at?: string | null;
519
519
  /** `null` when the runner resolved the pipe from the bundle's `main_pipe`. */
520
520
  pipe_code?: string | null;
521
- /** The runner's stored error report — present only on a failed run that recorded one,
522
- * so opening it from history shows why without another read. */
521
+ /** The run's stored error report, served as on the run detail — present only on a run
522
+ * that ended without completing and holds one, so opening it from history shows why
523
+ * without another read. */
523
524
  error?: RunErrorReport | null;
524
525
  /**
525
526
  * Which version of the method the run ran — a number, `"draft"`, or `null` for an inline
@@ -548,6 +549,13 @@ export interface RunDetail extends PipelineRun {
548
549
  mthds_contents?: string[] | null;
549
550
  /** The inputs the run was started with, as sent. */
550
551
  inputs?: Record<string, unknown> | null;
552
+ /**
553
+ * The id of the request that started the run — the one to quote to support, and the one the
554
+ * platform and the runner logged it under. `null` for a run saved before the platform recorded
555
+ * it; absent on a server that does not serve it. The run history does not carry it; the status
556
+ * read does, as `RunRead.request_id`.
557
+ */
558
+ request_id?: string | null;
551
559
  }
552
560
  /** Query for one page of run history. */
553
561
  export interface ListRunsQuery {
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Whether a failed request that may create a run, a start or a blocking execute, may still have
3
+ * started one whose id never reached the caller. `ApiUnreachableError` and `ApiResponseError` read
4
+ * it when the client tells them their request may create a run, and carry the answer as
5
+ * `runMayHaveStarted`; the Python twin, `pipelex-sdk`, reads the same failures the same way in
6
+ * `pipelex_sdk.run_may_have_started`.
7
+ *
8
+ * The reading errs on the safe side. A false "may have started" costs the person a look at the run
9
+ * history; a false "did not start" costs a second paid run. So every failure counts as one that
10
+ * may have started a run unless it proves otherwise: a transport failure that proves nothing was
11
+ * sent, and an answer that says the request was refused before anything ran.
12
+ */
13
+ /**
14
+ * Whether an answer to a request that may create a run leaves one possibly started:
15
+ *
16
+ * - any `2xx`, which the client met only because it could not read it: the server accepted the
17
+ * request, and only its acknowledgement was lost;
18
+ * - a `408`, which a proxy in front of the platform may answer for a request it forwarded;
19
+ * - every `5xx` but a `501`, which says the deployment does not serve the route, and a `503`
20
+ * carrying the platform's code `pipeline_start_unavailable`, which says the runner was never
21
+ * reached: the server or a gateway failed while handling the request.
22
+ *
23
+ * Any other status is the request refused before anything ran.
24
+ */
25
+ export declare function answerMayHaveStartedRun(status: number, code: string | undefined): boolean;
26
+ /**
27
+ * Whether a transport failure of a request that may create a run leaves one possibly started:
28
+ * every failure but one that proves nothing was sent. `cause` is the failure fetch threw, which
29
+ * `ApiUnreachableError` keeps as its own `cause`.
30
+ */
31
+ export declare function transportMayHaveStartedRun(cause: unknown): boolean;
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Whether a failed request that may create a run, a start or a blocking execute, may still have
3
+ * started one whose id never reached the caller. `ApiUnreachableError` and `ApiResponseError` read
4
+ * it when the client tells them their request may create a run, and carry the answer as
5
+ * `runMayHaveStarted`; the Python twin, `pipelex-sdk`, reads the same failures the same way in
6
+ * `pipelex_sdk.run_may_have_started`.
7
+ *
8
+ * The reading errs on the safe side. A false "may have started" costs the person a look at the run
9
+ * history; a false "did not start" costs a second paid run. So every failure counts as one that
10
+ * may have started a run unless it proves otherwise: a transport failure that proves nothing was
11
+ * sent, and an answer that says the request was refused before anything ran.
12
+ */
13
+ /**
14
+ * The platform code of the `503` a start answers when the platform could not reach the runner at
15
+ * all: it finalized the run's row `FAILED` and started nothing. Every other `503`, the platform's
16
+ * `service_unavailable` included, can follow a run the runner already started.
17
+ */
18
+ const START_UNAVAILABLE_CODE = "pipeline_start_unavailable";
19
+ /**
20
+ * Whether an answer to a request that may create a run leaves one possibly started:
21
+ *
22
+ * - any `2xx`, which the client met only because it could not read it: the server accepted the
23
+ * request, and only its acknowledgement was lost;
24
+ * - a `408`, which a proxy in front of the platform may answer for a request it forwarded;
25
+ * - every `5xx` but a `501`, which says the deployment does not serve the route, and a `503`
26
+ * carrying the platform's code `pipeline_start_unavailable`, which says the runner was never
27
+ * reached: the server or a gateway failed while handling the request.
28
+ *
29
+ * Any other status is the request refused before anything ran.
30
+ */
31
+ export function answerMayHaveStartedRun(status, code) {
32
+ if (status >= 200 && status < 300)
33
+ return true;
34
+ if (status === 408)
35
+ return true;
36
+ if (status === 501)
37
+ return false;
38
+ if (status === 503 && code === START_UNAVAILABLE_CODE)
39
+ return false;
40
+ return status >= 500 && status < 600;
41
+ }
42
+ /**
43
+ * Whether a transport failure of a request that may create a run leaves one possibly started:
44
+ * every failure but one that proves nothing was sent. `cause` is the failure fetch threw, which
45
+ * `ApiUnreachableError` keeps as its own `cause`.
46
+ */
47
+ export function transportMayHaveStartedRun(cause) {
48
+ return !provesNothingSent(cause);
49
+ }
50
+ /**
51
+ * Whether a transport failure proves the request never left, so that no run was created by it: it
52
+ * names a step of the connection's set-up, which no request follows. That is the name lookup or
53
+ * the connection itself failing (the system calls `getaddrinfo` and `connect`: an unknown host, a
54
+ * refused connection, no route to the host or the network, the system's connect time limit),
55
+ * undici's own connect time limit, which covers the TLS handshake, and a server certificate the
56
+ * TLS handshake refused. Several addresses each failing so, which Node reports together as an
57
+ * `AggregateError`, prove it too. A host that drops packets is a connection that never comes:
58
+ * undici gives it up after ten seconds (`UND_ERR_CONNECT_TIMEOUT`), before the time limit of any
59
+ * request that may create a run, as the Python SDK meets httpx's connect timeout first and reads
60
+ * it the same way.
61
+ *
62
+ * Anything else may have come once the request had left, the Python SDK reading the same failures
63
+ * the same way. A reset (`ECONNRESET`) comes from a `read` whether the connection dropped during
64
+ * the TLS handshake or after the request, and so does an `EHOSTUNREACH` met once connected, so
65
+ * neither proves anything; nor does another TLS failure, which may come after the handshake; nor
66
+ * does the SDK's own time limit (`ABORT_TIMEOUT`), which fetch cannot place before or after the
67
+ * connection was made; nor does a body that arrived and could not be decoded. Every request that
68
+ * may create a run has a limit longer than undici's connect limit, so with Node's own dispatcher
69
+ * it runs out only once the request has left.
70
+ */
71
+ function provesNothingSent(fetchFailure) {
72
+ // undici gives the transport's own failure as the `cause` of fetch's.
73
+ return fetchFailure instanceof Error && isConnectionSetupFailure(fetchFailure.cause);
74
+ }
75
+ function isConnectionSetupFailure(failure) {
76
+ if (failure instanceof AggregateError) {
77
+ return failure.errors.length > 0 && failure.errors.every(isConnectionSetupFailure);
78
+ }
79
+ if (typeof failure !== "object" || failure === null)
80
+ return false;
81
+ const { code, syscall } = failure;
82
+ if (typeof code === "string" && CONNECTION_SETUP_CODES.has(code))
83
+ return true;
84
+ return typeof syscall === "string" && CONNECTION_SETUP_CALLS.has(syscall);
85
+ }
86
+ /** The system calls that resolve the host's name and open the connection. */
87
+ const CONNECTION_SETUP_CALLS = new Set(["getaddrinfo", "connect"]);
88
+ /**
89
+ * The codes only a step of the connection's set-up gives: the name lookup's and the connect call's
90
+ * own (set even where Node reports several addresses together, without a system call), undici's
91
+ * connect time limit, Node's limit on one attempt among several addresses, Node's own check of the
92
+ * host's name, and every code Node gives a server certificate the TLS handshake refused.
93
+ */
94
+ const CONNECTION_SETUP_CODES = new Set([
95
+ "ECONNREFUSED",
96
+ "ENOTFOUND",
97
+ "EAI_AGAIN",
98
+ "UND_ERR_CONNECT_TIMEOUT",
99
+ "ERR_SOCKET_CONNECTION_TIMEOUT",
100
+ "ERR_TLS_CERT_ALTNAME_INVALID",
101
+ "ERR_TLS_CERT_ALTNAME_FORMAT",
102
+ // Node names the verdicts of OpenSSL's certificate check from a fixed table, the "X509 certificate
103
+ // error codes" of its `tls` docs, and gives every other verdict, such as an unhandled critical
104
+ // extension or a CA certificate that may not sign certificates, the code `UNSPECIFIED`. The
105
+ // error carries nothing else that marks it, so these codes are the mark: the table as Node 24
106
+ // compiles it, in its order, then its default. The Python SDK reads every
107
+ // `ssl.SSLCertVerificationError` the same way.
108
+ "UNABLE_TO_GET_ISSUER_CERT",
109
+ "UNABLE_TO_GET_CRL",
110
+ "UNABLE_TO_DECRYPT_CERT_SIGNATURE",
111
+ "UNABLE_TO_DECRYPT_CRL_SIGNATURE",
112
+ "UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",
113
+ "CERT_SIGNATURE_FAILURE",
114
+ "CRL_SIGNATURE_FAILURE",
115
+ "CERT_NOT_YET_VALID",
116
+ "CERT_HAS_EXPIRED",
117
+ "CRL_NOT_YET_VALID",
118
+ "CRL_HAS_EXPIRED",
119
+ "ERROR_IN_CERT_NOT_BEFORE_FIELD",
120
+ "ERROR_IN_CERT_NOT_AFTER_FIELD",
121
+ "ERROR_IN_CRL_LAST_UPDATE_FIELD",
122
+ "ERROR_IN_CRL_NEXT_UPDATE_FIELD",
123
+ "OUT_OF_MEM",
124
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
125
+ "SELF_SIGNED_CERT_IN_CHAIN",
126
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
127
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
128
+ "CERT_CHAIN_TOO_LONG",
129
+ "CERT_REVOKED",
130
+ "INVALID_CA",
131
+ "PATH_LENGTH_EXCEEDED",
132
+ "INVALID_PURPOSE",
133
+ "CERT_UNTRUSTED",
134
+ "CERT_REJECTED",
135
+ "HOSTNAME_MISMATCH",
136
+ "UNSPECIFIED",
137
+ ]);
138
+ //# sourceMappingURL=run-may-have-started.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-may-have-started.js","sourceRoot":"","sources":["../src/run-may-have-started.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,4BAA4B,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc,EAAE,IAAwB;IAC9E,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACjC,IAAI,MAAM,KAAK,GAAG,IAAI,IAAI,KAAK,sBAAsB;QAAE,OAAO,KAAK,CAAC;IACpE,OAAO,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAc;IACvD,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,iBAAiB,CAAC,YAAqB;IAC9C,sEAAsE;IACtE,OAAO,YAAY,YAAY,KAAK,IAAI,wBAA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AAmC;IACnC,iCAAiC;IACjC,qBAAqB;IACrB,cAAc;IACd,YAAY;IACZ,sBAAsB;IACtB,iBAAiB;IACjB,gBAAgB;IAChB,eAAe;IACf,mBAAmB;IACnB,aAAa;CACd,CAAC,CAAC"}
package/dist/runs.d.ts CHANGED
@@ -46,9 +46,16 @@ export interface RunPublic {
46
46
  created_at: string;
47
47
  finished_at?: string | null;
48
48
  /**
49
- * Why the run failed: the runner's stored error report, typed whole (see `RunErrorReport`).
50
- * `null` on a completed run and on a run that ended without a report — a cancelled,
51
- * terminated or timed-out run, or one the platform finalized itself; absent on a server that
49
+ * Why the run failed: the stored error report as the platform serves it, the runner's STRICT
50
+ * projection, typed whole (see `RunErrorReport`). The runner writes it for a run that fails
51
+ * while it runs; the platform writes one in the runner's shape for a run it ends or settles
52
+ * itself — a workflow task that kept failing (`WorkflowTaskKeptFailingError`), a timeout
53
+ * (`RunTimedOutError`), a workflow that vanished (`RunWorkflowNotFoundError`). A cancelled,
54
+ * terminated or timed-out run holds a report when a completion callback carried one, and a
55
+ * timed-out run otherwise the platform's timeout report. `null` on a completed run and on a
56
+ * run that ended without a report — one whose start failed, a blocking `execute` run, one
57
+ * cancelled, terminated or given its status by hand with no completion callback carrying a
58
+ * report, one that ended before the platform wrote reports of its own; absent on a server that
52
59
  * does not serve it. The results read of the same run carries the same object in its `409`,
53
60
  * which is where `getRunResult`'s failed arm and `RunFailedError` take it from.
54
61
  */
@@ -70,15 +77,96 @@ export interface RunPublic {
70
77
  [extension: string]: unknown;
71
78
  }
72
79
  /**
73
- * A run read through the self-healing path (`RunPublic` + `degraded`).
74
- * When `degraded` is true, Temporal was unreachable and `status` is the
75
- * last-known DB value, not a freshly-derived one — pair with
76
- * `retry_after_seconds` (parsed from the `Retry-After` header).
80
+ * Why a status read is `degraded` — `RunDegradation.reason`:
81
+ *
82
+ * - `status_unavailable`: the platform could not reach the workflow engine, so `status` is the
83
+ * last one recorded. It says nothing about the run itself, which may be fine; read again after
84
+ * `retry_after_seconds`.
85
+ * - `workflow_task_failing`: `status` is live, and the run is not making progress. The workflow
86
+ * task that drives it has failed `failed_attempts` times in a row since `failing_since`; the
87
+ * workflow engine keeps retrying it, and if it is still failing at `ends_at` the platform ends
88
+ * the run `FAILED` with a `WorkflowTaskKeptFailingError` report.
89
+ *
90
+ * Read open, as `RunDegradation.reason` types it: a reason a later platform adds arrives as its
91
+ * raw string rather than failing the read, and a consumer that does not know it should not tell
92
+ * the person the run is fine.
93
+ */
94
+ export type DegradationReason = "status_unavailable" | "workflow_task_failing";
95
+ /**
96
+ * What a `degraded` status read means for this run — `RunRead.degradation`.
97
+ *
98
+ * Branch on `reason` (see `DegradationReason`), never on the wording of `message`. Each field is
99
+ * checked by the read: a known field whose value does not have its type is absent, and members
100
+ * this SDK does not name are relayed as sent.
101
+ */
102
+ export interface RunDegradation {
103
+ /** Why the read is degraded: a `DegradationReason`, or the raw string of one this SDK does not know. */
104
+ reason: DegradationReason | (string & {});
105
+ /**
106
+ * What the platform says about it, in a sentence. For `workflow_task_failing` it says how many
107
+ * attempts have failed in a row, that the run is not making progress and when the platform will
108
+ * end it. It does not quote the worker's own failure text, which only a platform run locally
109
+ * with `ERROR_DISCLOSURE=verbose` adds. `failed_attempts` and `ends_at` carry the same facts as
110
+ * fields.
111
+ */
112
+ message?: string | null;
113
+ /** How many times in a row the run's workflow task has failed; `null` for `status_unavailable`. */
114
+ failed_attempts?: number | null;
115
+ /**
116
+ * ISO-8601 instant of the first failure in the current run of failures. `null` when the
117
+ * platform could not find the recorded failure in the workflow's history, and always for
118
+ * `status_unavailable`.
119
+ */
120
+ failing_since?: string | null;
121
+ /**
122
+ * ISO-8601 instant at which the platform ends the run `FAILED` if its workflow task is still
123
+ * failing. `null` when the platform could not find the recorded failure: it then does not end
124
+ * the run itself, and the run's own time limit ends it `TIMED_OUT`. Always `null` for
125
+ * `status_unavailable`.
126
+ */
127
+ ends_at?: string | null;
128
+ /** Members a later platform adds. */
129
+ [extension: string]: unknown;
130
+ }
131
+ /**
132
+ * A run read through the self-healing status path (`RunPublic` + `degraded`, `degradation`,
133
+ * `request_id` and the `Retry-After` hint).
134
+ *
135
+ * `degraded` is true when the read is not a plain fresh reading of a healthy run, and
136
+ * `degradation.reason` says which of two things holds (see `DegradationReason`): the platform
137
+ * could not reach the workflow engine and `status` is the last one recorded
138
+ * (`status_unavailable`, paired with `retry_after_seconds`), or `status` is live and the run is
139
+ * stuck, its workflow task failing until the platform ends it (`workflow_task_failing`). So
140
+ * `degraded` alone no longer means the run is fine. A platform older than the degradation sends
141
+ * `degraded` with no `degradation`; read that as `status_unavailable`, the only meaning `degraded`
142
+ * had then.
77
143
  */
78
144
  export interface RunRead extends RunPublic {
79
145
  degraded: boolean;
146
+ /**
147
+ * What `degraded` means for this run; `null` whenever `degraded` is false, and absent on a
148
+ * platform that predates it. Checked field by field, and `null` when it is not an object or its
149
+ * `reason` is not a string (see `RunDegradation`).
150
+ */
151
+ degradation?: RunDegradation | null;
152
+ /**
153
+ * The id of the request that started the run — the one to quote to support. `null` for a run
154
+ * saved before the platform recorded it; absent on a server that does not serve it.
155
+ */
156
+ request_id?: string | null;
157
+ /** The `Retry-After` header's delay, in seconds; set when the platform sent one. */
80
158
  retry_after_seconds?: number | null;
81
159
  }
160
+ /**
161
+ * A status read's `degradation`, checked field by field so that it never fails the poll carrying
162
+ * it: a value that is not an object, or whose `reason` is not a string, reads as `null`, since a
163
+ * degradation without a reason cannot be branched on; `message`, `failing_since` and `ends_at` are
164
+ * kept when they are strings and `failed_attempts` when it is an integer, `null` kept for each;
165
+ * members this SDK does not name are relayed as sent.
166
+ *
167
+ * Internal: `getRunStatus` applies it.
168
+ */
169
+ export declare function readRunDegradation(value: unknown): RunDegradation | null;
82
170
  /**
83
171
  * One inference call's token usage — the client-facing wire record.
84
172
  *