@pipelex/sdk 0.16.0 → 0.18.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 +4 -2
- package/dist/artifacts.d.ts +284 -0
- package/dist/artifacts.js +841 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/client.d.ts +82 -25
- package/dist/client.js +99 -22
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +69 -3
- package/dist/errors.js +80 -3
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +49 -1
- package/dist/prepare-inputs.d.ts +72 -43
- package/dist/prepare-inputs.js +218 -81
- package/dist/prepare-inputs.js.map +1 -1
- package/dist/runs.d.ts +36 -5
- package/dist/runs.js.map +1 -1
- package/dist/usage.d.ts +87 -0
- package/dist/usage.js +121 -0
- package/dist/usage.js.map +1 -0
- package/package.json +4 -3
package/dist/errors.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { PipelineRequestError } from "mthds/protocol";
|
|
7
7
|
import type { ValidationErrorItem } from "./models.js";
|
|
8
|
+
import type { ArtifactScope, DownloadArtifactsResult } from "./artifacts.js";
|
|
8
9
|
export { PipelineRequestError };
|
|
9
10
|
export declare class ClientAuthenticationError extends Error {
|
|
10
11
|
constructor(message: string);
|
|
@@ -21,9 +22,11 @@ export declare class InputPreparationError extends PipelineRequestError {
|
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
|
-
* The stored method resolved by `getMethodClosure`
|
|
25
|
-
* `
|
|
26
|
-
*
|
|
25
|
+
* The stored method resolved by `getMethodClosure` has no MTHDS source yet — its
|
|
26
|
+
* `MethodData.mthds` parses to an empty closure (a blank string, a JSON `[]`, or
|
|
27
|
+
* an all-blank file array). `getMethodClosure` is the only raiser: the operations
|
|
28
|
+
* that take a `method_id` natively — `prepareInputs` among them — pass the id to
|
|
29
|
+
* the server, which answers a sourceless method with a `422`.
|
|
27
30
|
*
|
|
28
31
|
* Distinct from a transport failure: the `getMethod` fetch succeeded (`200`) and
|
|
29
32
|
* the id is real and in-org; the row simply carries no runnable source. A missing
|
|
@@ -87,6 +90,69 @@ export declare class UploadTransportError extends InputPreparationError {
|
|
|
87
90
|
cause?: unknown;
|
|
88
91
|
});
|
|
89
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Base class for the failures the artifact operations raise on their own
|
|
95
|
+
* (`fetchArtifact` / `downloadArtifacts`) — the download twin of
|
|
96
|
+
* `InputPreparationError`. Catch this to handle any artifact failure; catch a
|
|
97
|
+
* subclass to branch on the category. A per-reference failure inside a
|
|
98
|
+
* `downloadArtifacts` verdict is a value on the item, never one of these: the
|
|
99
|
+
* operation throws only when it can produce no verdict at all. Transport
|
|
100
|
+
* failures on the resolve route (`ApiResponseError`, `ApiUnreachableError`)
|
|
101
|
+
* and the run-lifecycle errors propagate unchanged, so they are not subclasses.
|
|
102
|
+
*/
|
|
103
|
+
export declare class ArtifactOperationError extends PipelineRequestError {
|
|
104
|
+
constructor(message: string, options?: {
|
|
105
|
+
cause?: unknown;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The scope `downloadArtifacts` was asked to walk has no artifact on the run's
|
|
110
|
+
* results: `main_stuff` or `working_memory` is `null`, or the key is missing
|
|
111
|
+
* from the body altogether. Distinct from an empty walk over a present scope,
|
|
112
|
+
* which is a produced verdict with no artifacts. `scope` names the scope,
|
|
113
|
+
* `runId` the run.
|
|
114
|
+
*/
|
|
115
|
+
export declare class ScopeUnavailableError extends ArtifactOperationError {
|
|
116
|
+
readonly scope: ArtifactScope;
|
|
117
|
+
readonly runId: string;
|
|
118
|
+
constructor(scope: ArtifactScope, runId: string, options?: {
|
|
119
|
+
cause?: unknown;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* One reference could not be turned into a bounded response by `fetchArtifact`.
|
|
124
|
+
* `code` says why, in a closed vocabulary the download verdict shares for its
|
|
125
|
+
* per-item errors: the resolve route's own per-reference codes
|
|
126
|
+
* (`invalid_storage_uri`, `forbidden`), then the fetch boundary's —
|
|
127
|
+
* `unsupported_url`, `plain_http_refused`, `redirect_refused`, `store_refused`
|
|
128
|
+
* (a 401/403 from the object store), `not_found` (404/410), `store_error`
|
|
129
|
+
* (any other non-2xx), `too_large`, `timeout`, `network`. `status` is the
|
|
130
|
+
* store's HTTP status when one was received. `downloadArtifacts` never lets
|
|
131
|
+
* this escape: it becomes the item's `error`.
|
|
132
|
+
*/
|
|
133
|
+
export declare class ArtifactFetchError extends ArtifactOperationError {
|
|
134
|
+
readonly uri: string;
|
|
135
|
+
readonly code: string;
|
|
136
|
+
readonly status: number | undefined;
|
|
137
|
+
constructor(message: string, uri: string, code: string, status?: number, options?: {
|
|
138
|
+
cause?: unknown;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The resolve route refused the caller's credential (`401` / `403`) during a
|
|
143
|
+
* `downloadArtifacts` call. No further reference can be resolved with it, so
|
|
144
|
+
* the download stops — but the files already saved are real, and `verdict`
|
|
145
|
+
* carries the result as it stood: every item saved before the refusal, and
|
|
146
|
+
* the rest marked `aborted`. `status` is the route's status; the wrapped
|
|
147
|
+
* `ApiResponseError` is reachable via `cause`.
|
|
148
|
+
*/
|
|
149
|
+
export declare class ArtifactAuthenticationError extends ArtifactOperationError {
|
|
150
|
+
readonly status: number;
|
|
151
|
+
readonly verdict: DownloadArtifactsResult;
|
|
152
|
+
constructor(message: string, status: number, verdict: DownloadArtifactsResult, options?: {
|
|
153
|
+
cause?: unknown;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
90
156
|
/**
|
|
91
157
|
* Thrown when the Pipelex API host cannot be reached at all (DNS failure,
|
|
92
158
|
* connection refused, TLS handshake failure, request timeout). The HTTP
|
package/dist/errors.js
CHANGED
|
@@ -24,9 +24,11 @@ export class InputPreparationError extends PipelineRequestError {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* The stored method resolved by `getMethodClosure`
|
|
28
|
-
* `
|
|
29
|
-
*
|
|
27
|
+
* The stored method resolved by `getMethodClosure` has no MTHDS source yet — its
|
|
28
|
+
* `MethodData.mthds` parses to an empty closure (a blank string, a JSON `[]`, or
|
|
29
|
+
* an all-blank file array). `getMethodClosure` is the only raiser: the operations
|
|
30
|
+
* that take a `method_id` natively — `prepareInputs` among them — pass the id to
|
|
31
|
+
* the server, which answers a sourceless method with a `422`.
|
|
30
32
|
*
|
|
31
33
|
* Distinct from a transport failure: the `getMethod` fetch succeeded (`200`) and
|
|
32
34
|
* the id is real and in-org; the row simply carries no runnable source. A missing
|
|
@@ -101,6 +103,81 @@ export class UploadTransportError extends InputPreparationError {
|
|
|
101
103
|
this.name = "UploadTransportError";
|
|
102
104
|
}
|
|
103
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Base class for the failures the artifact operations raise on their own
|
|
108
|
+
* (`fetchArtifact` / `downloadArtifacts`) — the download twin of
|
|
109
|
+
* `InputPreparationError`. Catch this to handle any artifact failure; catch a
|
|
110
|
+
* subclass to branch on the category. A per-reference failure inside a
|
|
111
|
+
* `downloadArtifacts` verdict is a value on the item, never one of these: the
|
|
112
|
+
* operation throws only when it can produce no verdict at all. Transport
|
|
113
|
+
* failures on the resolve route (`ApiResponseError`, `ApiUnreachableError`)
|
|
114
|
+
* and the run-lifecycle errors propagate unchanged, so they are not subclasses.
|
|
115
|
+
*/
|
|
116
|
+
export class ArtifactOperationError extends PipelineRequestError {
|
|
117
|
+
constructor(message, options) {
|
|
118
|
+
super(message, options);
|
|
119
|
+
this.name = "ArtifactOperationError";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The scope `downloadArtifacts` was asked to walk has no artifact on the run's
|
|
124
|
+
* results: `main_stuff` or `working_memory` is `null`, or the key is missing
|
|
125
|
+
* from the body altogether. Distinct from an empty walk over a present scope,
|
|
126
|
+
* which is a produced verdict with no artifacts. `scope` names the scope,
|
|
127
|
+
* `runId` the run.
|
|
128
|
+
*/
|
|
129
|
+
export class ScopeUnavailableError extends ArtifactOperationError {
|
|
130
|
+
scope;
|
|
131
|
+
runId;
|
|
132
|
+
constructor(scope, runId, options) {
|
|
133
|
+
super(`Run "${runId}" carries no "${scope}" artifact to walk for produced files — ` +
|
|
134
|
+
"it is null or absent from the results body.", options);
|
|
135
|
+
this.name = "ScopeUnavailableError";
|
|
136
|
+
this.scope = scope;
|
|
137
|
+
this.runId = runId;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* One reference could not be turned into a bounded response by `fetchArtifact`.
|
|
142
|
+
* `code` says why, in a closed vocabulary the download verdict shares for its
|
|
143
|
+
* per-item errors: the resolve route's own per-reference codes
|
|
144
|
+
* (`invalid_storage_uri`, `forbidden`), then the fetch boundary's —
|
|
145
|
+
* `unsupported_url`, `plain_http_refused`, `redirect_refused`, `store_refused`
|
|
146
|
+
* (a 401/403 from the object store), `not_found` (404/410), `store_error`
|
|
147
|
+
* (any other non-2xx), `too_large`, `timeout`, `network`. `status` is the
|
|
148
|
+
* store's HTTP status when one was received. `downloadArtifacts` never lets
|
|
149
|
+
* this escape: it becomes the item's `error`.
|
|
150
|
+
*/
|
|
151
|
+
export class ArtifactFetchError extends ArtifactOperationError {
|
|
152
|
+
uri;
|
|
153
|
+
code;
|
|
154
|
+
status;
|
|
155
|
+
constructor(message, uri, code, status, options) {
|
|
156
|
+
super(message, options);
|
|
157
|
+
this.name = "ArtifactFetchError";
|
|
158
|
+
this.uri = uri;
|
|
159
|
+
this.code = code;
|
|
160
|
+
this.status = status;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The resolve route refused the caller's credential (`401` / `403`) during a
|
|
165
|
+
* `downloadArtifacts` call. No further reference can be resolved with it, so
|
|
166
|
+
* the download stops — but the files already saved are real, and `verdict`
|
|
167
|
+
* carries the result as it stood: every item saved before the refusal, and
|
|
168
|
+
* the rest marked `aborted`. `status` is the route's status; the wrapped
|
|
169
|
+
* `ApiResponseError` is reachable via `cause`.
|
|
170
|
+
*/
|
|
171
|
+
export class ArtifactAuthenticationError extends ArtifactOperationError {
|
|
172
|
+
status;
|
|
173
|
+
verdict;
|
|
174
|
+
constructor(message, status, verdict, options) {
|
|
175
|
+
super(message, options);
|
|
176
|
+
this.name = "ArtifactAuthenticationError";
|
|
177
|
+
this.status = status;
|
|
178
|
+
this.verdict = verdict;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
104
181
|
/**
|
|
105
182
|
* Thrown when the Pipelex API host cannot be reached at all (DNS failure,
|
|
106
183
|
* connection refused, TLS handshake failure, request timeout). The HTTP
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IAC1C,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,oBAAoB;IAC7D,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;I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 @@
|
|
|
7
7
|
* errors. Consumers should import everything they need from `@pipelex/sdk`.
|
|
8
8
|
*/
|
|
9
9
|
/** Package version. Kept in sync with `package.json` — enforced by `tests/index.test.ts`. */
|
|
10
|
-
export declare const SDK_VERSION = "0.
|
|
10
|
+
export declare const SDK_VERSION = "0.18.0";
|
|
11
11
|
export * from "mthds/protocol";
|
|
12
12
|
export { PipelexApiClient, DEFAULT_API_BASE_URL } from "./client.js";
|
|
13
13
|
export type { MthdsFile, PipelexApiRunExtensions, PipelexHostedRunExtensions, PipelexRunOptions, PipelexStartOptions, ValidateMethodSelector, ValidateFilesOptions, PipelexApiClientOptions, } from "./client.js";
|
|
14
14
|
export { methodSourceToContents } from "./method-source.js";
|
|
15
15
|
export { PipelexExecuteResult } from "./execute-result.js";
|
|
16
16
|
export type { UploadableAsset, UploadFileOptions, UploadRecord } from "./upload.js";
|
|
17
|
-
export type { PrepareInputsRequest, PreparedInputs } from "./prepare-inputs.js";
|
|
17
|
+
export type { PrepareInputsBase, PrepareInputsClosure, PrepareInputsRequest, PreparedInputs, } from "./prepare-inputs.js";
|
|
18
|
+
export { collectArtifacts, artifactFilename, PIPELEX_STORAGE_SCHEME, BULK_RESOLVE_MAX_URIS, DEFAULT_ARTIFACT_MAX_BYTES, DEFAULT_ARTIFACT_TIMEOUT_MS, DEFAULT_DOWNLOAD_MAX_TOTAL_BYTES, DEFAULT_DOWNLOAD_CONCURRENCY, } from "./artifacts.js";
|
|
19
|
+
export type { ArtifactItemError, ArtifactScope, BulkResolveStorageUrlsInput, BulkResolvedStorageUrls, DownloadArtifactsOptions, DownloadArtifactsRequest, DownloadArtifactsResult, DownloadedArtifact, FetchArtifactOptions, ResolvedArtifact, } from "./artifacts.js";
|
|
18
20
|
export type { DiagnosticKind, DiagnosticRange, Diagnostic, LintResponse, FormatResponse, DictStuff, DictWorkingMemory, DictPipeOutput, DictRunResultExecute, MethodProvenance, PipelexRunResultStart, PipelexHostedToolingExtensions, DryRunStatus, ValidatedPipeEntry, LiftablePipeEntry, PipelexValidationReport, PipelexInvalidReport, PipelexValidationResult, ValidationErrorCategory, ValidationErrorItem, FixSafety, FixOpKind, TomlScalar, TomlValue, SetKeyOp, EnsureTableOp, DeleteKeyOp, DeleteTableOp, RenameTableKeyOp, MoveKeyOp, RemapValueOp, FixOp, SuggestedFix, ConceptRepresentationFormat, InputsTemplateFormat, MthdsFileItem, CrateRequestBase, BuildRequestBase, BuildInputsRequest, BuildOutputRequest, BuildRunnerRequest, ConceptRequest, PipeSpecRequest, CrateInvalidReport, BuildInputsValidReport, BuildOutputValidReport, BuildRunnerValidReport, GeneratedArtifact, RunnerStructures, BuildInputsResponse, BuildOutputResponse, BuildRunnerResponse, ConceptResponse, PipeSpecResponse, ResolveRequest, ResolveValidReport, ResolveResponse, CodegenKind, CodegenTarget, CodegenRequest, CodegenValidReport, CodegenResponse, } from "./models.js";
|
|
19
21
|
export { runCodegenCheck, isStampableArtifactPath, STAMPABLE_ARTIFACT_SUFFIXES, CodegenLockError, } from "./codegen-check.js";
|
|
20
22
|
export type { CodegenCheckInput, CodegenCheckReport, CodegenDrift, CodegenDriftCategory, CodegenTreeFile, } from "./codegen-check.js";
|
|
21
23
|
export type { UserProfile, ListMethodsQuery, MethodData, MethodDeletionAccepted, MethodDeletionState, MethodPage, MethodSummary, MethodWriteInput, Membership, MembershipsResponse, SubscriptionResponse, PlanView, InvoiceView, CheckoutResponse, ChangePlanResponse, BillingPortalResponse, PipelexApiKey, PipelexApiKeyCreated, PipelexApiKeyList, GatewayApiKey, GatewayApiKeyStatus, OnboardingRole, OnboardingCurrentTool, OnboardingInputType, OnboardingHeardFrom, OnboardingSubmission, ResolvedStorageUrl, UploadInput, UploadedFile, PipeStatus, ListRunsQuery, PipelineRun, RunDetail, RunErrorReport, RunPage, UpdateRunInput, } from "./product-models.js";
|
|
22
24
|
export { isTerminalRunStatus, isSuccessRunStatus } from "./runs.js";
|
|
23
25
|
export type { RunStatus, RunPublic, RunRead, RunResults, RunResultState, TokensUsageRecord, WaitForResultOptions, } from "./runs.js";
|
|
24
|
-
export {
|
|
26
|
+
export { summarizeUsage } from "./usage.js";
|
|
27
|
+
export type { PipeUsageSummary, RunUsagePair, UsageSummary, UsageSummaryState, UsageTokenTotals, } from "./usage.js";
|
|
28
|
+
export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, MissingMainStuffError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, ArtifactOperationError, ArtifactAuthenticationError, ArtifactFetchError, ScopeUnavailableError, } from "./errors.js";
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* errors. Consumers should import everything they need from `@pipelex/sdk`.
|
|
8
8
|
*/
|
|
9
9
|
/** Package version. Kept in sync with `package.json` — enforced by `tests/index.test.ts`. */
|
|
10
|
-
export const SDK_VERSION = "0.
|
|
10
|
+
export const SDK_VERSION = "0.18.0";
|
|
11
11
|
// ── Pure MTHDS Protocol surface (re-exported from the `mthds/protocol` subpath) ──
|
|
12
12
|
// The standard's interface, wire models, request/options surface, abstract domain
|
|
13
13
|
// shapes, and the protocol-base `PipelineRequestError`. Re-exported so apps have a
|
|
@@ -19,6 +19,11 @@ export { PipelexApiClient, DEFAULT_API_BASE_URL } from "./client.js";
|
|
|
19
19
|
export { methodSourceToContents } from "./method-source.js";
|
|
20
20
|
// The blocking `execute()` result — a `DictRunResultExecute` with a resolved `.main_stuff`.
|
|
21
21
|
export { PipelexExecuteResult } from "./execute-result.js";
|
|
22
|
+
// ── Artifacts (the download twin of input preparation) ──────────────
|
|
23
|
+
// `collectArtifacts` and `artifactFilename` are pure and standalone; the network
|
|
24
|
+
// operations (`resolveArtifacts` / `fetchArtifact` / `downloadArtifacts`) are client
|
|
25
|
+
// methods, and only their public types and bounds travel with the barrel.
|
|
26
|
+
export { collectArtifacts, artifactFilename, PIPELEX_STORAGE_SCHEME, BULK_RESOLVE_MAX_URIS, DEFAULT_ARTIFACT_MAX_BYTES, DEFAULT_ARTIFACT_TIMEOUT_MS, DEFAULT_DOWNLOAD_MAX_TOTAL_BYTES, DEFAULT_DOWNLOAD_CONCURRENCY, } from "./artifacts.js";
|
|
22
27
|
// ── Offline codegen drift check (pure — no filesystem, no network, no key) ──
|
|
23
28
|
// The CI half of the codegen trust chain: hand it a committed tree plus its
|
|
24
29
|
// `codegen.lock` and it returns the structured drift verdict. Regeneration needs
|
|
@@ -26,6 +31,8 @@ export { PipelexExecuteResult } from "./execute-result.js";
|
|
|
26
31
|
export { runCodegenCheck, isStampableArtifactPath, STAMPABLE_ARTIFACT_SUFFIXES, CodegenLockError, } from "./codegen-check.js";
|
|
27
32
|
// ── Run lifecycle (hosted extension — NOT part of the protocol) ──────
|
|
28
33
|
export { isTerminalRunStatus, isSuccessRunStatus } from "./runs.js";
|
|
34
|
+
// ── Usage summary (pure — folds a run's usage pair into one null-aware reading) ──
|
|
35
|
+
export { summarizeUsage } from "./usage.js";
|
|
29
36
|
// ── Typed errors (PipelineRequestError rides the protocol re-export above) ──
|
|
30
|
-
export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, MissingMainStuffError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, } from "./errors.js";
|
|
37
|
+
export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, MissingMainStuffError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, ArtifactOperationError, ArtifactAuthenticationError, ArtifactFetchError, ScopeUnavailableError, } from "./errors.js";
|
|
31
38
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC,oFAAoF;AACpF,kFAAkF;AAClF,mFAAmF;AACnF,wBAAwB;AACxB,cAAc,gBAAgB,CAAC;AAE/B,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAYrE,+FAA+F;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,4FAA4F;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEpC,oFAAoF;AACpF,kFAAkF;AAClF,mFAAmF;AACnF,wBAAwB;AACxB,cAAc,gBAAgB,CAAC;AAE/B,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAYrE,+FAA+F;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,4FAA4F;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAY3D,uEAAuE;AACvE,iFAAiF;AACjF,qFAAqF;AACrF,0EAA0E;AAC1E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAgFxB,+EAA+E;AAC/E,4EAA4E;AAC5E,iFAAiF;AACjF,0EAA0E;AAC1E,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAiD5B,wEAAwE;AACxE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAWpE,oFAAoF;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAS5C,+EAA+E;AAC/E,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
|
package/dist/models.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* the `/v1/build/*` request/response models. Built on the protocol wire types
|
|
8
8
|
* imported from the `mthds/protocol` subpath.
|
|
9
9
|
*/
|
|
10
|
-
import type { InputForm, InvalidValidationReport, PipeIOContracts, RunResultExecute, RunResultStart, ValidationReport } from "mthds/protocol";
|
|
10
|
+
import type { InputForm, OutputForm, InvalidValidationReport, PipeIOContracts, RunResultExecute, RunResultStart, ValidationReport } from "mthds/protocol";
|
|
11
11
|
export interface DictStuff {
|
|
12
12
|
concept: string;
|
|
13
13
|
content: unknown;
|
|
@@ -82,6 +82,24 @@ export interface PipelexHostedToolingExtensions {
|
|
|
82
82
|
/** A stored method's catalog id (`mt_…`) — hosted-only, resolved server-side. */
|
|
83
83
|
method_id?: string;
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* The method selector the tooling routes take in place of inline contents: a
|
|
87
|
+
* `method_ref` address (server-resolved by the runner through the same fetch
|
|
88
|
+
* path as a `method_ref` run) OR a hosted `method_id` (platform-resolved) —
|
|
89
|
+
* never both. The tooling routes are stateless, so the strict XOR applies:
|
|
90
|
+
* exactly one of inline contents / `method_ref` / `method_id` per request.
|
|
91
|
+
*
|
|
92
|
+
* Lives here, beside the other wire shapes, rather than on the client: it is
|
|
93
|
+
* the request's shape, and `prepareInputs` composes a `validate` call of its own
|
|
94
|
+
* without importing the client back (which would close a module cycle).
|
|
95
|
+
*/
|
|
96
|
+
export type ValidateMethodSelector = {
|
|
97
|
+
method_ref: string;
|
|
98
|
+
method_id?: never;
|
|
99
|
+
} | {
|
|
100
|
+
method_id: string;
|
|
101
|
+
method_ref?: never;
|
|
102
|
+
};
|
|
85
103
|
/** Per-pipe dry-run verdict in `validated_pipes[]` — mirror of pipelex's `DryRunStatus`. */
|
|
86
104
|
export type DryRunStatus = "SUCCESS" | "FAILURE" | "SKIPPED";
|
|
87
105
|
/** One entry of `PipelexValidationReport.validated_pipes` — `{pipe_ref, status}`. */
|
|
@@ -156,8 +174,38 @@ export interface PipelexValidationReport extends ValidationReport {
|
|
|
156
174
|
* single call site that opts in.
|
|
157
175
|
*/
|
|
158
176
|
input_form?: InputForm;
|
|
177
|
+
/**
|
|
178
|
+
* Per-pipe OUTPUT-form descriptors — the standard's `OutputForm` artifact, the twin of
|
|
179
|
+
* `input_form` on the other side of the pipe. One `field` rather than a list of them,
|
|
180
|
+
* carrying no `presence` and no `gating`, because a result is not a slot a caller
|
|
181
|
+
* fills. Keyed over the same `pipe_ref` set as `pipe_io_contracts`.
|
|
182
|
+
*
|
|
183
|
+
* Paired with that contract's `output.json_schema` it is everything a renderer needs to
|
|
184
|
+
* lay a run's result out without inspecting the payload — the descriptor says what the
|
|
185
|
+
* result IS, the schema names the property it arrives under. A consumer holding one but
|
|
186
|
+
* not the other is back to inferring the other from the value, which is the guessing
|
|
187
|
+
* these artifacts exist to end.
|
|
188
|
+
*
|
|
189
|
+
* OPTIONAL for the same reason as `input_form`: an opt-in structured view, requested
|
|
190
|
+
* through `views: ["output_form"]` and absent from any verdict that did not ask.
|
|
191
|
+
*/
|
|
192
|
+
output_form?: OutputForm;
|
|
159
193
|
/** Pipes the runtime may skip when an optional slot resolves absent. */
|
|
160
194
|
liftable_pipes: LiftablePipeEntry[];
|
|
195
|
+
/**
|
|
196
|
+
* The qualified `pipe_ref` a caller gets by omitting the pipe selector on the run
|
|
197
|
+
* and build routes — the bundle's declared `main_pipe` qualified by its domain and,
|
|
198
|
+
* for a `method_ref` package, the manifest's `main_pipe` the way the runner's
|
|
199
|
+
* `resolve_requested_pipe` reads it. `null` when the closure declares none or
|
|
200
|
+
* several.
|
|
201
|
+
*
|
|
202
|
+
* OPTIONAL because it is younger than the report: a server that predates it sends
|
|
203
|
+
* nothing, and a consumer that needs a default (`prepareInputs`) reads it when
|
|
204
|
+
* present and falls back to the opaque `bundle_blueprint.main_pipe`. It exists so
|
|
205
|
+
* that descriptor consumers stop reading a blueprint this SDK types opaque on
|
|
206
|
+
* purpose.
|
|
207
|
+
*/
|
|
208
|
+
default_pipe_ref?: string | null;
|
|
161
209
|
/** Best-effort execution graph of the main pipe; `null` with no `main_pipe` or on degrade. */
|
|
162
210
|
graph_spec: unknown;
|
|
163
211
|
/** Per-pipe dry-run sweep outcomes. */
|
package/dist/prepare-inputs.d.ts
CHANGED
|
@@ -1,44 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `prepareInputs` — signature-driven input preparation. Resolves the target
|
|
3
|
-
* pipe's declared inputs
|
|
4
|
-
* caller's inputs top-down against it, uploads the
|
|
5
|
-
* returns rewritten inputs (canonical content carrying
|
|
6
|
-
* `url`) plus one upload record per prepared asset.
|
|
3
|
+
* pipe's declared inputs from the **input-form descriptor** on the validate
|
|
4
|
+
* report, interprets the caller's inputs top-down against it, uploads the
|
|
5
|
+
* file-bearing values, and returns rewritten inputs (canonical content carrying
|
|
6
|
+
* `pipelex-storage://` in `url`) plus one upload record per prepared asset.
|
|
7
|
+
*
|
|
8
|
+
* The method is named the same three ways every other method-taking operation
|
|
9
|
+
* takes it — inline `files`, a `method_ref` address, or a stored `method_id` —
|
|
10
|
+
* exactly one per call. All three are pass-throughs to `POST /v1/validate`,
|
|
11
|
+
* which resolves an address on the runner and an id on the platform, so nothing
|
|
12
|
+
* is expanded client-side.
|
|
7
13
|
*
|
|
8
14
|
* Per input, the caller may submit EITHER the **compact** value (a bare source /
|
|
9
|
-
* canonical `{url}` content) OR the explicit `{ concept, content }` envelope
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `
|
|
15
|
+
* canonical `{url}` content) OR the explicit `{ concept, content }` envelope —
|
|
16
|
+
* its `content` is interpreted exactly as the compact value would be, and the
|
|
17
|
+
* envelope is preserved on output (the `concept` annotation rides through; the
|
|
18
|
+
* runtime accepts it — see `pipelex`'s `input_shaper.py` `_is_explicit` /
|
|
19
|
+
* `input_normalizer.py`).
|
|
14
20
|
*
|
|
15
|
-
* The
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* **The descriptor is the classifier, never the value's shape.** `input_form`
|
|
22
|
+
* (the MTHDS standard's artifact, opted into with `views: ["input_form"]`)
|
|
23
|
+
* states the kind at every depth — `document` / `image` mark a file position,
|
|
24
|
+
* `object` recurses through `fields`, `list` through `item`, everything else
|
|
25
|
+
* passes through. That is what makes an OPTIONAL nested file field prepare like
|
|
26
|
+
* a required one, and a `text` field merely *named* `url` stay untouched: both
|
|
27
|
+
* were misread while the signature came from the rendered inputs template, whose
|
|
28
|
+
* file signal was a `url`-bearing dict. See `docs/input-preparation.md` and the
|
|
29
|
+
* shared behavior matrix (`wip/upload/behavior-matrix.md`).
|
|
22
30
|
*/
|
|
23
|
-
import type {
|
|
31
|
+
import type { MthdsFileItem, PipelexValidationResult, ValidateMethodSelector } from "./models.js";
|
|
24
32
|
import type { UploadCapableClient, UploadRecord } from "./upload.js";
|
|
25
|
-
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** The method closure — inline MTHDS files. This is the signature source. */
|
|
36
|
-
files: MthdsFileItem[];
|
|
37
|
-
/** The pipe to prepare inputs for, as a qualified `domain.pipe_code`; omit to default to the closure's `main_pipe`. */
|
|
33
|
+
/** The shared half of the request: the target pipe and the caller's inputs. */
|
|
34
|
+
export interface PrepareInputsBase {
|
|
35
|
+
/**
|
|
36
|
+
* The pipe to prepare inputs for, as a QUALIFIED `domain.pipe_code` ref. Omit
|
|
37
|
+
* it to default — see "Pipe selection" in `docs/input-preparation.md`. A bare
|
|
38
|
+
* `pipe_code` is refused: the descriptor is keyed by qualified refs, and search
|
|
39
|
+
* is a run-route affordance this helper deliberately does not grow. So is an
|
|
40
|
+
* `alias->domain.pipe_code` ref: the alias names a dependency package's pipe,
|
|
41
|
+
* which the descriptor does not describe (it covers the method's own pipes).
|
|
42
|
+
*/
|
|
38
43
|
pipe_ref?: string;
|
|
39
|
-
/** The caller's
|
|
44
|
+
/** The caller's inputs (variable name → value), compact or explicit-envelope per input. */
|
|
40
45
|
inputs: Record<string, unknown>;
|
|
41
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* How the method is named — exactly one of the three selectors, each pinning the
|
|
49
|
+
* other two to `never` so a second one is a compile error (the same XOR
|
|
50
|
+
* `ValidateMethodSelector` states for the tooling routes). All three reach the
|
|
51
|
+
* server as-is: `files` inline, `method_ref` resolved by the runner, `method_id`
|
|
52
|
+
* resolved by the platform.
|
|
53
|
+
*/
|
|
54
|
+
export type PrepareInputsClosure = {
|
|
55
|
+
files: MthdsFileItem[];
|
|
56
|
+
method_ref?: never;
|
|
57
|
+
method_id?: never;
|
|
58
|
+
} | {
|
|
59
|
+
method_ref: string;
|
|
60
|
+
files?: never;
|
|
61
|
+
method_id?: never;
|
|
62
|
+
} | {
|
|
63
|
+
method_id: string;
|
|
64
|
+
files?: never;
|
|
65
|
+
method_ref?: never;
|
|
66
|
+
};
|
|
67
|
+
/** What `prepareInputs` takes: one method selector, the target pipe, the caller's inputs. */
|
|
68
|
+
export type PrepareInputsRequest = PrepareInputsBase & PrepareInputsClosure;
|
|
42
69
|
/** The result of `prepareInputs`: rewritten inputs (copy-on-write) plus upload records. */
|
|
43
70
|
export interface PreparedInputs {
|
|
44
71
|
/** A copy of `inputs` with each file-bearing value rewritten to canonical content carrying `pipelex-storage://` in `url`. */
|
|
@@ -47,16 +74,15 @@ export interface PreparedInputs {
|
|
|
47
74
|
uploads: UploadRecord[];
|
|
48
75
|
}
|
|
49
76
|
/**
|
|
50
|
-
* The client surface `prepareInputs` needs: raw `upload
|
|
51
|
-
* signature source.
|
|
77
|
+
* The client surface `prepareInputs` needs: raw `upload`, and `validate` as the
|
|
78
|
+
* signature source. Typed as the client's own `validate` signature so
|
|
79
|
+
* `PipelexApiClient` satisfies it structurally.
|
|
52
80
|
*/
|
|
53
81
|
export interface PrepareCapableClient extends UploadCapableClient {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
explicit?: boolean;
|
|
59
|
-
}): Promise<BuildInputsResponse>;
|
|
82
|
+
validate(source: string[] | ValidateMethodSelector, allowSignatures?: boolean, mthdsSources?: string[], render?: string[], views?: string[], options?: {
|
|
83
|
+
timeoutMs?: number;
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}): Promise<PipelexValidationResult>;
|
|
60
86
|
}
|
|
61
87
|
/**
|
|
62
88
|
* Prepare a pipe's inputs: upload local/byte/data-URL assets at the signature's
|
|
@@ -64,9 +90,12 @@ export interface PrepareCapableClient extends UploadCapableClient {
|
|
|
64
90
|
* records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
|
|
65
91
|
* unchanged. All failures are raised before any run is created.
|
|
66
92
|
*
|
|
67
|
-
* The
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
93
|
+
* The signature comes from one `POST /v1/validate` with `views: ["input_form"]`,
|
|
94
|
+
* whatever the selector — inline `files`, a `method_ref` the runner resolves, or
|
|
95
|
+
* a `method_id` the platform resolves. A closure that does not load, an unknown
|
|
96
|
+
* `pipe_ref`, no default pipe, or a report with no descriptor throw
|
|
97
|
+
* {@link InputPreparationError}; a no-verdict condition from the route (a
|
|
98
|
+
* malformed selector, an unknown or foreign-org id, no package at the address,
|
|
99
|
+
* auth, a server fault) surfaces as `ApiResponseError`, unchanged.
|
|
71
100
|
*/
|
|
72
101
|
export declare function prepareInputs(client: PrepareCapableClient, request: PrepareInputsRequest): Promise<PreparedInputs>;
|