@pipelex/sdk 0.38.0 → 0.40.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.
Files changed (52) hide show
  1. package/README.md +3 -2
  2. package/dist/bundle-resources.d.ts +62 -0
  3. package/dist/bundle-resources.js +165 -0
  4. package/dist/bundle-resources.js.map +1 -0
  5. package/dist/cli/run.js +8 -111
  6. package/dist/cli/run.js.map +1 -1
  7. package/dist/cli/script.d.ts +1 -1
  8. package/dist/cli/source.d.ts +2 -1
  9. package/dist/cli/source.js +61 -3
  10. package/dist/cli/source.js.map +1 -1
  11. package/dist/client.d.ts +116 -30
  12. package/dist/client.js +235 -75
  13. package/dist/client.js.map +1 -1
  14. package/dist/error-models.d.ts +64 -18
  15. package/dist/error-models.js +20 -9
  16. package/dist/error-models.js.map +1 -1
  17. package/dist/errors.d.ts +125 -23
  18. package/dist/errors.js +124 -22
  19. package/dist/errors.js.map +1 -1
  20. package/dist/execute-result.js +4 -4
  21. package/dist/execute-result.js.map +1 -1
  22. package/dist/hooks/bundle-gather.d.ts +28 -1
  23. package/dist/hooks/bundle-gather.js +163 -3
  24. package/dist/hooks/bundle-gather.js.map +1 -1
  25. package/dist/hooks/claude-mthds-check.d.ts +4 -2
  26. package/dist/hooks/claude-mthds-check.js +5 -2
  27. package/dist/hooks/claude-mthds-check.js.map +1 -1
  28. package/dist/index.d.ts +7 -5
  29. package/dist/index.js +6 -2
  30. package/dist/index.js.map +1 -1
  31. package/dist/models.d.ts +42 -4
  32. package/dist/prepare-inputs.d.ts +58 -4
  33. package/dist/prepare-inputs.js +307 -61
  34. package/dist/prepare-inputs.js.map +1 -1
  35. package/dist/product-models.d.ts +13 -5
  36. package/dist/run-may-have-started.d.ts +31 -0
  37. package/dist/run-may-have-started.js +138 -0
  38. package/dist/run-may-have-started.js.map +1 -0
  39. package/dist/runs.d.ts +95 -7
  40. package/dist/runs.js +18 -0
  41. package/dist/runs.js.map +1 -1
  42. package/dist/version.d.ts +1 -1
  43. package/dist/version.js +1 -1
  44. package/docs/architecture.md +6 -3
  45. package/docs/bundle-resources.md +107 -0
  46. package/docs/cli.md +2 -1
  47. package/docs/crate-routes.md +5 -1
  48. package/docs/errors.md +87 -17
  49. package/docs/hook-bundle.md +2 -0
  50. package/docs/input-preparation.md +26 -4
  51. package/docs/run-results.md +39 -0
  52. package/package.json +2 -2
@@ -8,19 +8,40 @@
8
8
  * Capped, because an under-supplied bundle can produce a FALSE invalid verdict
9
9
  * (missing cross-file refs) — on overflow the caller must treat validate as
10
10
  * unavailable rather than risk a wrong block.
11
+ *
12
+ * It also gathers the files the bundle's steps read, a `PipeDocGen` step's
13
+ * `template_file`, read beside the `.mthds` file whose step names it and sent as
14
+ * the request's `resources` under the path the step names, as the runtime reads
15
+ * a bundle loaded from disk: without them the server could only answer that the
16
+ * template file was not supplied, which would block every edit of such a bundle.
11
17
  */
12
18
  import type { MthdsFile } from "../client.js";
13
19
  export interface GatherCaps {
14
20
  maxFiles: number;
15
21
  maxTotalBytes: number;
22
+ /** How many template files the gather sends at most; the server's default limit when omitted. */
23
+ maxResourceFiles?: number;
24
+ /** How large one template file may be; the server's default limit when omitted. */
25
+ maxResourceFileBytes?: number;
26
+ /** How many bytes of template files the gather sends at most; the server's default when omitted. */
27
+ maxResourceBytes?: number;
16
28
  }
17
29
  export declare const DEFAULT_GATHER_CAPS: GatherCaps;
30
+ /**
31
+ * The gathered bundle, or why there is none to send. `resources` maps the path a
32
+ * step names to the template file's bytes. `conflict` is one path naming two
33
+ * different files beside two `.mthds` files of the bundle, or a file beside one
34
+ * and nothing beside the other: the request keys a file by its path alone, so it
35
+ * cannot say what loading each file from disk would find, and validate is
36
+ * unavailable rather than a wrong verdict.
37
+ */
18
38
  export type GatherResult = {
19
39
  ok: true;
20
40
  files: MthdsFile[];
41
+ resources: Record<string, Uint8Array>;
21
42
  } | {
22
43
  ok: false;
23
- reason: "overflow" | "unreadable";
44
+ reason: "overflow" | "unreadable" | "conflict";
24
45
  };
25
46
  /**
26
47
  * Gather the `.mthds` files under the edited file's parent directory, the
@@ -29,3 +50,9 @@ export type GatherResult = {
29
50
  * fresh from disk, so a format write-back is already reflected.
30
51
  */
31
52
  export declare function gatherBundle(editedFilePath: string, caps?: GatherCaps): GatherResult;
53
+ /**
54
+ * The paths of the template files the steps of one `.mthds` file name: each
55
+ * `PipeDocGen` pipe's `template_file`. A file that does not parse names none, the
56
+ * server giving its verdict on it.
57
+ */
58
+ export declare function templateFilesNamedBy(mthdsContent: string): string[];
@@ -8,9 +8,17 @@
8
8
  * Capped, because an under-supplied bundle can produce a FALSE invalid verdict
9
9
  * (missing cross-file refs) — on overflow the caller must treat validate as
10
10
  * unavailable rather than risk a wrong block.
11
+ *
12
+ * It also gathers the files the bundle's steps read, a `PipeDocGen` step's
13
+ * `template_file`, read beside the `.mthds` file whose step names it and sent as
14
+ * the request's `resources` under the path the step names, as the runtime reads
15
+ * a bundle loaded from disk: without them the server could only answer that the
16
+ * template file was not supplied, which would block every edit of such a bundle.
11
17
  */
12
- import { readdirSync, readFileSync, statSync } from "node:fs";
13
- import { dirname, join, relative, resolve } from "node:path";
18
+ import { readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
19
+ import { dirname, join, relative, resolve, sep } from "node:path";
20
+ import { parse as parseToml } from "smol-toml";
21
+ import { bundleResourcePathRefusal, canonicalBundleResourcePath } from "../bundle-resources.js";
14
22
  /** Mirror of pipelex's `scan_config.excluded_dirs` (dot-dirs are skipped wholesale). */
15
23
  const EXCLUDED_DIRS = new Set([
16
24
  "venv",
@@ -20,9 +28,16 @@ const EXCLUDED_DIRS = new Set([
20
28
  "node_modules",
21
29
  "results",
22
30
  ]);
31
+ /** The server's default bounds on the files a request sends with its bundle. */
32
+ const DEFAULT_MAX_RESOURCE_FILES = 32;
33
+ const DEFAULT_MAX_RESOURCE_FILE_BYTES = 5 * 1024 * 1024;
34
+ const DEFAULT_MAX_RESOURCE_BYTES = 10 * 1024 * 1024;
23
35
  export const DEFAULT_GATHER_CAPS = {
24
36
  maxFiles: 50,
25
37
  maxTotalBytes: 2 * 1024 * 1024,
38
+ maxResourceFiles: DEFAULT_MAX_RESOURCE_FILES,
39
+ maxResourceFileBytes: DEFAULT_MAX_RESOURCE_FILE_BYTES,
40
+ maxResourceBytes: DEFAULT_MAX_RESOURCE_BYTES,
26
41
  };
27
42
  /**
28
43
  * Recursively collect `.mthds` paths under `dir`. Throws if any directory in
@@ -87,6 +102,151 @@ export function gatherBundle(editedFilePath, caps = DEFAULT_GATHER_CAPS) {
87
102
  return { ok: false, reason: "unreadable" };
88
103
  }
89
104
  }
90
- return { ok: true, files };
105
+ const gathered = gatherTemplateFiles(parentDir, ordered, files, caps);
106
+ if (!gathered.ok)
107
+ return gathered;
108
+ return { ok: true, files, resources: gathered.resources };
109
+ }
110
+ /**
111
+ * The paths of the template files the steps of one `.mthds` file name: each
112
+ * `PipeDocGen` pipe's `template_file`. A file that does not parse names none, the
113
+ * server giving its verdict on it.
114
+ */
115
+ export function templateFilesNamedBy(mthdsContent) {
116
+ let document;
117
+ try {
118
+ document = parseToml(mthdsContent);
119
+ }
120
+ catch {
121
+ return [];
122
+ }
123
+ const pipes = isRecord(document) ? document["pipe"] : undefined;
124
+ if (!isRecord(pipes))
125
+ return [];
126
+ const named = [];
127
+ for (const pipe of Object.values(pipes)) {
128
+ if (isRecord(pipe) &&
129
+ pipe["type"] === "PipeDocGen" &&
130
+ typeof pipe["template_file"] === "string") {
131
+ named.push(pipe["template_file"]);
132
+ }
133
+ }
134
+ return named;
135
+ }
136
+ /**
137
+ * Read the template files the gathered `.mthds` files name, each beside the file
138
+ * whose step names it, keyed by the path the step names, as the runtime reads a
139
+ * bundle loaded from disk. A path the server would refuse is left out, and so is a
140
+ * file that is not there beside any `.mthds` file naming it, for the server to say
141
+ * the step's file was not supplied.
142
+ *
143
+ * Validate is unavailable rather than a wrong verdict when the request cannot carry
144
+ * what loading the bundle from disk would find: a file that leads out of the
145
+ * bundle's directory through a link is never read (`unreadable`), and one path that
146
+ * names different files beside different `.mthds` files, or a file beside one and
147
+ * nothing beside another, is a `conflict`. Every size is checked against the caps
148
+ * before any file is read, the bytes compared to tell two files apart included, so
149
+ * the hook never holds more than the caps allow (`overflow`).
150
+ */
151
+ function gatherTemplateFiles(parentDir, paths, files, caps) {
152
+ const maxFiles = caps.maxResourceFiles ?? DEFAULT_MAX_RESOURCE_FILES;
153
+ const maxFileBytes = caps.maxResourceFileBytes ?? DEFAULT_MAX_RESOURCE_FILE_BYTES;
154
+ const maxBytes = caps.maxResourceBytes ?? DEFAULT_MAX_RESOURCE_BYTES;
155
+ let root;
156
+ try {
157
+ root = realpathSync(parentDir);
158
+ }
159
+ catch {
160
+ return { ok: false, reason: "unreadable" };
161
+ }
162
+ // Each path a step names, once, with the file it names beside the first `.mthds` file
163
+ // naming it, or `null` when there is none there.
164
+ const located = new Map();
165
+ let fileCount = 0;
166
+ let totalBytes = 0;
167
+ for (const [index, mthdsPath] of paths.entries()) {
168
+ for (const named of templateFilesNamedBy(files[index].content)) {
169
+ if (bundleResourcePathRefusal(named) !== undefined)
170
+ continue;
171
+ const key = canonicalBundleResourcePath(named);
172
+ const found = locateRegularFile(join(dirname(mthdsPath), key));
173
+ if (found !== null) {
174
+ if (!found.real.startsWith(root + sep))
175
+ return { ok: false, reason: "unreadable" };
176
+ if (found.size > maxFileBytes)
177
+ return { ok: false, reason: "overflow" };
178
+ }
179
+ if (!located.has(key)) {
180
+ located.set(key, found);
181
+ if (found === null)
182
+ continue;
183
+ fileCount += 1;
184
+ if (fileCount > maxFiles)
185
+ return { ok: false, reason: "overflow" };
186
+ totalBytes += found.size;
187
+ if (totalBytes > maxBytes)
188
+ return { ok: false, reason: "overflow" };
189
+ continue;
190
+ }
191
+ const known = located.get(key);
192
+ if (known === null || found === null) {
193
+ if (known !== found)
194
+ return { ok: false, reason: "conflict" };
195
+ continue;
196
+ }
197
+ if (!sameFileContent(known, found))
198
+ return { ok: false, reason: "conflict" };
199
+ }
200
+ }
201
+ const resources = Object.create(null);
202
+ let readBytes = 0;
203
+ for (const [key, found] of located) {
204
+ if (found === null)
205
+ continue;
206
+ try {
207
+ const bytes = readFileSync(found.real);
208
+ // A file that grew since it was measured is held to the caps as read.
209
+ readBytes += bytes.length;
210
+ if (bytes.length > maxFileBytes || readBytes > maxBytes) {
211
+ return { ok: false, reason: "overflow" };
212
+ }
213
+ resources[key] = bytes;
214
+ }
215
+ catch {
216
+ return { ok: false, reason: "unreadable" };
217
+ }
218
+ }
219
+ return { ok: true, resources };
220
+ }
221
+ /** The regular file at `path`, link resolved, or `null` when there is none there. */
222
+ function locateRegularFile(path) {
223
+ try {
224
+ const real = realpathSync(path);
225
+ const stats = statSync(real);
226
+ return stats.isFile() ? { real, size: stats.size } : null;
227
+ }
228
+ catch {
229
+ return null;
230
+ }
231
+ }
232
+ /**
233
+ * Whether two files hold the same bytes. Their sizes were measured and held to the
234
+ * per-file cap before this reads either, so a comparison reads at most two files of
235
+ * that size; files of different sizes differ unread, and an unreadable one holds none.
236
+ */
237
+ function sameFileContent(left, right) {
238
+ if (left.real === right.real)
239
+ return true;
240
+ if (left.size !== right.size)
241
+ return false;
242
+ try {
243
+ return Buffer.compare(readFileSync(left.real), readFileSync(right.real)) === 0;
244
+ }
245
+ catch {
246
+ return false;
247
+ }
248
+ }
249
+ function isRecord(value) {
250
+ return typeof value === "object" && value !== null && !Array.isArray(value);
91
251
  }
92
252
  //# sourceMappingURL=bundle-gather.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle-gather.js","sourceRoot":"","sources":["../../src/hooks/bundle-gather.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG7D,wFAAwF;AACxF,MAAM,aAAa,G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AAC9E,CAAC"}
@@ -28,8 +28,10 @@
28
28
  * - no `.mthds` in the payload / unparseable stdin → pass silently
29
29
  * - WASM engine fails to load → no file is checked; the note above is still sent
30
30
  * - validate unavailable (no `PIPELEX_API_KEY`, network error, timeout, any
31
- * non-2xx, bundle-gather overflow) → the local lint/format verdicts already
32
- * applied; the validate stage passes silently
31
+ * non-2xx, bundle-gather overflow, a template file leading out of the bundle's
32
+ * directory, or one path naming two different template files, or a file beside
33
+ * one `.mthds` file and nothing beside another) → the local lint/format
34
+ * verdicts already applied; the validate stage passes silently
33
35
  *
34
36
  * The hook always exits 0; a block/deny is expressed on stdout, never via the
35
37
  * exit code.
@@ -28,8 +28,10 @@
28
28
  * - no `.mthds` in the payload / unparseable stdin → pass silently
29
29
  * - WASM engine fails to load → no file is checked; the note above is still sent
30
30
  * - validate unavailable (no `PIPELEX_API_KEY`, network error, timeout, any
31
- * non-2xx, bundle-gather overflow) → the local lint/format verdicts already
32
- * applied; the validate stage passes silently
31
+ * non-2xx, bundle-gather overflow, a template file leading out of the bundle's
32
+ * directory, or one path naming two different template files, or a file beside
33
+ * one `.mthds` file and nothing beside another) → the local lint/format
34
+ * verdicts already applied; the validate stage passes silently
33
35
  *
34
36
  * The hook always exits 0; a block/deny is expressed on stdout, never via the
35
37
  * exit code.
@@ -135,6 +137,7 @@ async function runValidateStage(filePath) {
135
137
  // request does not keep running after the hook has given up on it.
136
138
  const result = await client.validateFiles(gathered.files, {
137
139
  allowSignatures: true,
140
+ resources: gathered.resources,
138
141
  timeoutMs: VALIDATE_TIMEOUT_MS,
139
142
  });
140
143
  if (result.is_valid === true) {
@@ -1 +1 @@
1
- {"version":3,"file":"claude-mthds-check.js","sourceRoot":"","sources":["../../src/hooks/claude-mthds-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EA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O,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC;KACD,OAAO,CAAC,GAAG,EAAE;IACZ,0EAA0E;IAC1E,sEAAsE;IACtE,6BAA6B;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,7 +12,8 @@ export * from "mthds/protocol";
12
12
  export { PipelexApiClient, DEFAULT_API_BASE_URL, isGatewayCutOff } from "./client.js";
13
13
  export { buildUserAgent, validateAppInfo, MAX_USER_AGENT_LENGTH } from "./user-agent.js";
14
14
  export type { AppInfo, RuntimeInfo } from "./user-agent.js";
15
- export type { MthdsFile, PipelexApiRunExtensions, PipelexHostedRunExtensions, PipelexRunOptions, PipelexStartOptions, ValidateMethodSelector, ValidateFilesOptions, PipelexApiClientOptions, } from "./client.js";
15
+ export type { MthdsFile, PipelexApiRunExtensions, PipelexHostedRunExtensions, PipelexRunOptions, PipelexStartOptions, ValidateMethodSelector, ValidateFilesOptions, ValidateOptions, PipelexApiClientOptions, } from "./client.js";
16
+ export type { BundleResourceBytes, BundleResources } from "./bundle-resources.js";
16
17
  export { methodSourceToContents } from "./method-source.js";
17
18
  export { parseMethodSelector } from "./method-selector.js";
18
19
  export type { ParsedMethodSelector } from "./method-selector.js";
@@ -20,7 +21,8 @@ export { PipelexExecuteResult, resultsFromExecute } from "./execute-result.js";
20
21
  export type { UploadableAsset, UploadFileOptions, UploadRecord } from "./upload.js";
21
22
  export { uploadWithGrant } from "./upload-grant.js";
22
23
  export type { GrantedUpload, UploadWithGrantOptions } from "./upload-grant.js";
23
- export type { PrepareInputsBase, PrepareInputsClosure, PrepareInputsRequest, PreparedInputs, } from "./prepare-inputs.js";
24
+ export type { InputFormFault, PrepareInputsBase, PrepareInputsClosure, PrepareInputsRequest, PreparedInputs, } from "./prepare-inputs.js";
25
+ export { inputFormFault } from "./prepare-inputs.js";
24
26
  export { locateArtifacts, 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";
25
27
  export type { ArtifactItemError, ArtifactLocation, ArtifactScope, BulkResolveStorageUrlsInput, BulkResolvedStorageUrls, DownloadArtifactsOptions, DownloadArtifactsRequest, DownloadArtifactsResult, DownloadedArtifact, FetchArtifactOptions, ResolvedArtifact, } from "./artifacts.js";
26
28
  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, FixValue, SetKeyOp, EnsureTableOp, DeleteKeyOp, DeleteTableOp, RenameTableKeyOp, MoveKeyOp, RemapValueOp, FixOp, SuggestedFix, MthdsFileItem, CrateRequestBase, CrateInvalidReport, GeneratedArtifact, ResolveRequest, ResolveValidReport, ResolveResponse, CodegenKind, CodegenTarget, CodegenRequest, CodegenValidReport, CodegenResponse, PipeIORequest, PipeIOValidReport, PipeIOResponse, ModelCheckCategory, ModelReferenceKind, ModelReferenceResolution, ModelReferenceMatchBase, PresetMatch, AliasMatch, WaterfallMatch, HandleMatch, ModelReferenceMatch, ModelReferenceVerdictBase, PresetReferenceVerdict, AliasReferenceVerdict, WaterfallReferenceVerdict, HandleReferenceVerdict, ModelReferenceVerdict, } from "./models.js";
@@ -28,9 +30,9 @@ export { runCodegenCheck, isStampableArtifactPath, STAMPABLE_ARTIFACT_SUFFIXES,
28
30
  export type { CodegenCheckInput, CodegenCheckReport, CodegenDrift, CodegenDriftCategory, CodegenTreeFile, } from "./codegen-check.js";
29
31
  export type { UserProfile, ListMethodsQuery, ListMethodVersionsQuery, MethodData, MethodDeletionAccepted, MethodDeletionState, MethodDraftInput, MethodPage, MethodPublished, MethodPublishInput, MethodPublishOutcome, MethodPublishRefusalReason, MethodPublishRefused, MethodPublishResult, MethodPublishUnchanged, MethodRenameInput, MethodSummary, MethodVersion, MethodVersionPage, MethodVersionSummary, MethodWriteInput, Membership, MembershipsResponse, SubscriptionResponse, PlanView, InvoiceView, CheckoutResponse, ChangePlanResponse, BillingPortalResponse, PipelexApiKey, PipelexApiKeyCreated, PipelexApiKeyList, OnboardingRole, OnboardingCurrentTool, OnboardingInputType, OnboardingHeardFrom, OnboardingSubmission, ResolvedStorageUrl, UploadInput, UploadedFile, UploadGrantInput, UploadGrant, PipeStatus, ListRunsQuery, PipelineRun, RunDetail, RunHistoryItem, RunPage, UpdateRunInput, } from "./product-models.js";
30
32
  export { isTerminalRunStatus, isSuccessRunStatus, RUN_RESULT_ARTIFACTS } from "./runs.js";
31
- export type { GetRunResultOptions, RunResultArtifact, RunStatus, RunPublic, RunRead, RunResults, RunResultState, StartAndWaitForResultOptions, TokensUsageRecord, WaitForResultOptions, } from "./runs.js";
33
+ export type { DegradationReason, GetRunResultOptions, RunDegradation, RunResultArtifact, RunStatus, RunPublic, RunRead, RunResults, RunResultState, StartAndWaitForResultOptions, TokensUsageRecord, WaitForResultOptions, } from "./runs.js";
32
34
  export { summarizeUsage } from "./usage.js";
33
35
  export type { PipeUsageSummary, RunUsagePair, UsageSummary, UsageSummaryState, UsageTokenTotals, } from "./usage.js";
34
- export { PipelexRequestError, errorVerdictOf, RequestArgumentError, ApiResponseError, ApiUnreachableError, MissingMainStuffError, PagingNotTerminatingError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, InvalidInputValueError, MethodLoadError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, ArtifactOperationError, ArtifactAuthenticationError, ArtifactFetchError, ScopeUnavailableError, } from "./errors.js";
35
- export type { ApiResponseErrorOptions, ErrorDomain, ErrorVerdict, MethodErrorCode, RejectedAssetCode, UploadTransportCode, } from "./errors.js";
36
+ export { PipelexRequestError, errorVerdictOf, runMayHaveStartedOf, RequestArgumentError, ApiResponseError, ApiUnreachableError, MissingMainStuffError, PagingNotTerminatingError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, InvalidInputValueError, UploadNotAllowedError, MethodLoadError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, ArtifactOperationError, ArtifactAuthenticationError, ArtifactFetchError, ScopeUnavailableError, } from "./errors.js";
37
+ export type { ApiResponseErrorOptions, ErrorDomain, ErrorVerdict, MethodErrorCode, RejectedAssetCode, UploadNotAllowedKind, UploadTransportCode, } from "./errors.js";
36
38
  export type { FieldError, MigrationErrorBlock, ProblemDetails, ProviderErrorMetadata, RunErrorReport, UserAction, } from "./error-models.js";
package/dist/index.js CHANGED
@@ -29,6 +29,9 @@ export { PipelexExecuteResult, resultsFromExecute } from "./execute-result.js";
29
29
  // Except the upload grant's sender, which is standalone so the holder of the bytes needs
30
30
  // no client. It is also the browser-safe `@pipelex/sdk/upload` entry.
31
31
  export { uploadWithGrant } from "./upload-grant.js";
32
+ // The check `prepareInputs` makes of a pipe's input-form entry before walking it, for a caller
33
+ // that reads the entry itself, as the command's `--inputs-template` does.
34
+ export { inputFormFault } from "./prepare-inputs.js";
32
35
  // ── Artifacts (the download twin of input preparation) ──────────────
33
36
  // `locateArtifacts`, `collectArtifacts` and `artifactFilename` are pure and standalone;
34
37
  // the network operations (`resolveArtifacts` / `fetchArtifact` / `downloadArtifacts`) are
@@ -44,6 +47,7 @@ export { isTerminalRunStatus, isSuccessRunStatus, RUN_RESULT_ARTIFACTS } from ".
44
47
  // ── Usage summary (pure — folds a run's usage pair into one null-aware reading) ──
45
48
  export { summarizeUsage } from "./usage.js";
46
49
  // ── Typed errors (PipelineRequestError rides the protocol re-export above) ──
47
- // Every one carries a verdict — `retryable` and `errorDomain` — read with `errorVerdictOf`.
48
- export { PipelexRequestError, errorVerdictOf, RequestArgumentError, ApiResponseError, ApiUnreachableError, MissingMainStuffError, PagingNotTerminatingError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, InvalidInputValueError, MethodLoadError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, ArtifactOperationError, ArtifactAuthenticationError, ArtifactFetchError, ScopeUnavailableError, } from "./errors.js";
50
+ // Every one carries a verdict — `retryable` and `errorDomain` — read with `errorVerdictOf`, and
51
+ // `runMayHaveStarted`, read with `runMayHaveStartedOf`.
52
+ export { PipelexRequestError, errorVerdictOf, runMayHaveStartedOf, RequestArgumentError, ApiResponseError, ApiUnreachableError, MissingMainStuffError, PagingNotTerminatingError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, InputPreparationError, EmptyMethodSourceError, InvalidLocalSourceError, InvalidInputValueError, UploadNotAllowedError, MethodLoadError, RejectedAssetError, UnsupportedUploadCapabilityError, UploadAuthenticationError, UploadTransportError, ArtifactOperationError, ArtifactAuthenticationError, ArtifactFetchError, ScopeUnavailableError, } from "./errors.js";
49
53
  //# 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,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,oFAAoF;AACpF,kFAAkF;AAClF,mFAAmF;AACnF,wBAAwB;AACxB,cAAc,gBAAg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sB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAmFxB,+EAA+E;AAC/E,4EAA4E;AAC5E,iFAAiF;AACjF,0EAA0E;AAC1E,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AA8D5B,wEAAwE;AACxE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAgB1F,oFAAoF;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAS5C,+EAA+E;AAC/E,gGAAgG;AAChG,wDAAwD;AACxD,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,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
@@ -9,6 +9,7 @@
9
9
  * `mthds/protocol` subpath.
10
10
  */
11
11
  import type { InputForm, OutputForm, InvalidValidationReport, PipeIOContracts, RunResultExecute, RunResultStart, ValidationReport } from "mthds/protocol";
12
+ import type { BundleResources } from "./bundle-resources.js";
12
13
  export interface DictStuff {
13
14
  concept: string;
14
15
  content: unknown;
@@ -231,9 +232,15 @@ export interface PipelexValidationReport extends ValidationReport {
231
232
  /** Per-pipe dry-run sweep outcomes. */
232
233
  validated_pipes: ValidatedPipeEntry[];
233
234
  /**
234
- * Advisory lints on a VALID bundle — same item shape as `validation_errors[]`, so one
235
- * parser serves both channels, but these never flip `is_valid`. Empty when the bundle
236
- * is lint-free. Carries the advisory `hint_*` error types, which ride here exclusively.
235
+ * Advisory findings on a VALID bundle — same item shape as `validation_errors[]`, so one
236
+ * parser serves both channels, but these never flip `is_valid`. Empty when there is
237
+ * nothing to report. Their `error_type`s come in families, always in this order: the
238
+ * useless-`!` lint (`optional_force_redundant`), the entry pipe's vacuous-presence lint
239
+ * (`input_presence_vacuous`), the intent-hint lints (`hint_unknown_key`,
240
+ * `hint_unknown_intent`, `hint_inapplicable_intent`, which ride here exclusively), then the
241
+ * findings a `PipeDocGen` step's template check made in its office template file during
242
+ * the dry run (`template_check_warning`, a `dry_run` item carrying `pipe_code`,
243
+ * `domain_code`, `template_file` and `template_location`).
237
244
  */
238
245
  warnings: ValidationErrorItem[];
239
246
  /** Qualified refs of pipes still declared as `PipeSignature`. */
@@ -298,7 +305,11 @@ export type ValidationErrorCategory = "blueprint_validation" | "pipe_factory" |
298
305
  * only from its package root, which this SDK does not import (it takes `mthds` through
299
306
  * `mthds/protocol` alone, the rule `.dependency-cruiser.cjs` enforces); a type-level test
300
307
  * (`tests/validation-items.test.ts`) pins this declaration and `SuggestedFix`'s to the
301
- * standard's, so a member added on one side and not the other fails the typecheck.
308
+ * standard's, so a member added on one side and not the other fails the typecheck. The
309
+ * one difference it allows is the pair of template-check locators, `template_file` and
310
+ * `template_location`, which the runner's item carries and the `mthds` this SDK depends on
311
+ * does not declare yet; the test pins that difference too, so it fails the day `mthds`
312
+ * declares them.
302
313
  *
303
314
  * Only `category` and `message` are always present; the rest are populated per
304
315
  * `category`. Every other member is `?: T | null` — the one way this declaration
@@ -316,6 +327,12 @@ export type ValidationErrorCategory = "blueprint_validation" | "pipe_factory" |
316
327
  * carries the reference as written, the kind of model the field takes and the close
317
328
  * matches, and, when there is exactly one close match, a `suggested_fix` that remaps
318
329
  * the reference to it.
330
+ *
331
+ * A `template_check_warning` item, on the valid arm's `warnings[]` only, is a finding of a
332
+ * `PipeDocGen` step's template check in its office template file during the dry run, such
333
+ * as a field of the template that matches no input: a `dry_run` item carrying the step's
334
+ * `pipe_code` and `domain_code`, the template file as the step names it and the place in
335
+ * it the engine's finding names.
319
336
  */
320
337
  export interface ValidationErrorItem {
321
338
  category: ValidationErrorCategory;
@@ -344,6 +361,18 @@ export interface ValidationErrorItem {
344
361
  * reference the field accepts.
345
362
  */
346
363
  suggestions?: string[] | null;
364
+ /**
365
+ * On a `template_check_warning` item: the template file as the `PipeDocGen` step names it
366
+ * (`templates/invoice.xlsx`); `null` for a step of the server's own library, whose path is
367
+ * the server's and is never shown.
368
+ */
369
+ template_file?: string | null;
370
+ /**
371
+ * On a `template_check_warning` item: the place in the template file the finding names, in
372
+ * the engine's own words (a defined name, a table, a cell, a shape, a tag); `null` when the
373
+ * finding names none.
374
+ */
375
+ template_location?: string | null;
347
376
  /** The server's deterministic repair proposal for this error, when it has one. */
348
377
  suggested_fix?: SuggestedFix | null;
349
378
  }
@@ -507,10 +536,19 @@ export interface MthdsFileItem {
507
536
  * The XOR is a server-side invariant, not a type-level one: expressing it as a union
508
537
  * here would make the common `{ files }` call site pick a branch for no gain, and the
509
538
  * server rejects the illegal shapes with a typed `ApiResponseError` either way.
539
+ *
540
+ * `resources` accompanies inline `files`: the files the closure's steps read, such as a
541
+ * `PipeDocGen` step's `template_file`, keyed by the path the step names, each as its bytes,
542
+ * which the client encodes into the wire's base64 map before posting (see
543
+ * `docs/bundle-resources.md`). It is the one member the client does not post verbatim. Beside
544
+ * a `method_ref` it is the server's `422`, a published method's files being its package's
545
+ * own; a step whose template file was not sent makes the closure invalid.
510
546
  */
511
547
  export interface CrateRequestBase {
512
548
  files?: MthdsFileItem[];
513
549
  method_ref?: string;
550
+ /** The files the closure's steps read, keyed by the path a step names, each as its bytes. */
551
+ resources?: BundleResources | null;
514
552
  }
515
553
  /**
516
554
  * The `is_valid: false` arm shared by every crate route — `/v1/resolve`,
@@ -30,6 +30,7 @@
30
30
  * dict. See `docs/input-preparation.md`, which `pipelex-sdk-python` mirrors case
31
31
  * for case.
32
32
  */
33
+ import type { BundleResources } from "./bundle-resources.js";
33
34
  import type { MthdsFileItem, PipeIORequest, PipeIOResponse } from "./models.js";
34
35
  import type { UploadCapableClient, UploadRecord } from "./upload.js";
35
36
  /** The shared half of the request: the target pipe and the caller's inputs. */
@@ -52,6 +53,15 @@ export interface PrepareInputsBase {
52
53
  * abort. A request already sent runs to its end. It is not sent to the server.
53
54
  */
54
55
  signal?: AbortSignal;
56
+ /**
57
+ * Whether preparation may upload, `true` when omitted. With `false`, a value at a file input
58
+ * that would need an upload — a local path, a `data:` URL, bytes — is refused with an
59
+ * {@link UploadNotAllowedError} naming the input, and nothing is read from disk, decoded or
60
+ * sent to the upload route; `http(s)` URLs and `pipelex-storage://` references pass through as
61
+ * always. It is for a server preparing inputs on a caller's behalf, which must never read a file
62
+ * of its own because the caller named it. It is not sent to the server.
63
+ */
64
+ allowUploads?: boolean;
55
65
  }
56
66
  /**
57
67
  * How the method is named — exactly one of the three selectors, each pinning the
@@ -59,19 +69,28 @@ export interface PrepareInputsBase {
59
69
  * `ValidateMethodSelector` states for `validate`). All three reach the
60
70
  * server as-is: `files` inline, `method_ref` resolved by the runner, `method_id`
61
71
  * resolved by the platform.
72
+ *
73
+ * Inline `files` may bring `resources`, the files the closure's steps read, such
74
+ * as a `PipeDocGen` step's `template_file`, keyed by the path the step names, each
75
+ * as its bytes: the pipe I/O route loads the closure, and a step whose template file
76
+ * was not sent makes it fail to load. A published or stored method's files are its
77
+ * own, so the other two selectors take none.
62
78
  */
63
79
  export type PrepareInputsClosure = {
64
80
  files: MthdsFileItem[];
81
+ resources?: BundleResources | null;
65
82
  method_ref?: never;
66
83
  method_id?: never;
67
84
  } | {
68
85
  method_ref: string;
69
86
  files?: never;
70
87
  method_id?: never;
88
+ resources?: never;
71
89
  } | {
72
90
  method_id: string;
73
91
  files?: never;
74
92
  method_ref?: never;
93
+ resources?: never;
75
94
  };
76
95
  /** What `prepareInputs` takes: one method selector, the target pipe, the caller's inputs. */
77
96
  export type PrepareInputsRequest = PrepareInputsBase & PrepareInputsClosure;
@@ -90,19 +109,54 @@ export interface PreparedInputs {
90
109
  export interface PrepareCapableClient extends UploadCapableClient {
91
110
  pipeIo(request: PipeIORequest): Promise<PipeIOResponse>;
92
111
  }
112
+ /**
113
+ * Where an input-form entry breaks the shape `prepareInputs` reads, and what was
114
+ * found there.
115
+ */
116
+ export interface InputFormFault {
117
+ /** Where, in the entry's own terms (`fields[3].item`, `fields[2].fields[0].kind`); empty for the entry itself. */
118
+ path: string;
119
+ /** What was expected there and what was found. */
120
+ problem: string;
121
+ /** The two in one phrase: `malformed at fields[3].item: expected a node with a string kind, got null`. */
122
+ message: string;
123
+ }
124
+ /**
125
+ * The first fault of one pipe's input-form entry (`input_form[pipe_ref]`) in
126
+ * document order, or `undefined` when `prepareInputs` can walk it. It checks what
127
+ * the walk reads and only that: the entry is an object whose `fields` is a list;
128
+ * every field, at the top level or in an `object` node, is an object with a string
129
+ * `name`; every node, a field or a `list` node's `item`, has a string `kind` this
130
+ * SDK walks, the standard's vocabulary at the `mthds` it pins; an `object` node's
131
+ * `fields` is a list and a `list` node's `item` is a node. Members the walk does
132
+ * not read (`concept_ref`, `presence`, `hints`, …) are not checked. `prepareInputs`
133
+ * refuses an entry with a fault before it uploads anything; a caller that reads an
134
+ * entry itself, to render a form or a template, checks it here first.
135
+ */
136
+ export declare function inputFormFault(entry: unknown): InputFormFault | undefined;
93
137
  /**
94
138
  * Prepare a pipe's inputs: upload local/byte/data-URL assets at the signature's
95
139
  * file-bearing positions and return copy-on-write rewritten inputs plus upload
96
140
  * records. HTTP(S) URLs and existing `pipelex-storage://` URIs pass through
97
141
  * unchanged. All failures are raised before any run is created.
98
142
  *
143
+ * A value at a file input that cannot be a file — a value of a type no file input
144
+ * takes, or a `data:` URL that does not decode — throws
145
+ * {@link InvalidInputValueError}, naming the input and where inside it the value
146
+ * sits. With `allowUploads: false`, nothing is read from disk or uploaded: a value
147
+ * that would need either throws {@link UploadNotAllowedError}, naming them too.
148
+ *
99
149
  * The pipe and its signature come from one `POST /v1/pipe-io`, whatever the
100
150
  * selector — inline `files`, a `method_ref` the runner resolves, or a
101
151
  * `method_id` the platform resolves. A bare or alias-qualified `pipe_ref`, a
102
152
  * closure that does not load, and a selection the route refuses (an unknown
103
- * `pipe_ref`, no entry pipe, several) throw {@link InputPreparationError}; any
104
- * other failure from the route (a malformed selector, an unknown or foreign-org
105
- * id, no package at the address, auth, a server fault, a deployment that does not
106
- * serve the route) surfaces as `ApiResponseError`, unchanged.
153
+ * `pipe_ref`, no entry pipe, several) throw {@link InputPreparationError}. So
154
+ * does an answer that breaks the route's contract, with a `runtime` verdict that
155
+ * is not retryable: no boolean `is_valid`, an `input_form` that does not describe
156
+ * the selected pipe, or a descriptor that is malformed or names a kind this SDK
157
+ * does not know, which is checked whole before anything is uploaded. Any other
158
+ * failure from the route (a malformed selector, an unknown or foreign-org id, no
159
+ * package at the address, auth, a server fault, a deployment that does not serve
160
+ * the route) surfaces as `ApiResponseError`, unchanged.
107
161
  */
108
162
  export declare function prepareInputs(client: PrepareCapableClient, request: PrepareInputsRequest): Promise<PreparedInputs>;