@pipelex/sdk 0.47.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/cli/script.d.ts +1 -1
- package/dist/cli/source.d.ts +8 -7
- package/dist/cli/source.js +11 -5
- package/dist/cli/source.js.map +1 -1
- package/dist/client.d.ts +321 -210
- package/dist/client.js +819 -514
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +5 -2
- package/dist/errors.js +5 -2
- package/dist/errors.js.map +1 -1
- package/dist/hooks/bundle-gather.d.ts +28 -40
- package/dist/hooks/bundle-gather.js +55 -230
- package/dist/hooks/bundle-gather.js.map +1 -1
- package/dist/hooks/claude-mthds-check.d.ts +7 -5
- package/dist/hooks/claude-mthds-check.js +8 -53
- package/dist/hooks/claude-mthds-check.js.map +1 -1
- package/dist/hooks/validate-stage.d.ts +27 -0
- package/dist/hooks/validate-stage.js +57 -0
- package/dist/hooks/validate-stage.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/method-trees.d.ts +208 -73
- package/dist/method-trees.js +221 -34
- package/dist/method-trees.js.map +1 -1
- package/dist/models.d.ts +162 -59
- package/dist/prepare-inputs.d.ts +46 -27
- package/dist/prepare-inputs.js +123 -42
- package/dist/prepare-inputs.js.map +1 -1
- package/dist/product-models.d.ts +14 -16
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +17 -18
- package/docs/cli.md +1 -1
- package/docs/crate-routes.md +42 -20
- package/docs/errors.md +5 -5
- package/docs/hook-bundle.md +1 -1
- package/docs/input-preparation.md +11 -11
- package/docs/method-trees.md +119 -21
- package/docs/run-results.md +5 -2
- package/package.json +2 -2
- package/dist/bundle-resources.d.ts +0 -62
- package/dist/bundle-resources.js +0 -165
- package/dist/bundle-resources.js.map +0 -1
- package/docs/bundle-resources.md +0 -107
package/README.md
CHANGED
|
@@ -48,11 +48,14 @@ const client = new PipelexApiClient({
|
|
|
48
48
|
apiKey: process.env.PIPELEX_API_KEY,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
// Validate
|
|
52
|
-
const report = await client.validate(
|
|
51
|
+
// Validate a method from its directory (a 200-diagnostic verdict, discriminated on `is_valid`).
|
|
52
|
+
const report = await client.validate({ directory: "methods/demo" });
|
|
53
53
|
if (report.is_valid) {
|
|
54
54
|
// Run it and wait for the result (durable start + poll on the hosted API).
|
|
55
|
-
const result = await client.startAndWaitForResult({
|
|
55
|
+
const result = await client.startAndWaitForResult({
|
|
56
|
+
directory: "methods/demo",
|
|
57
|
+
pipe_code: "demo.greet",
|
|
58
|
+
});
|
|
56
59
|
// Every completed run delivers a resolved `main_stuff`, and every named stuff of
|
|
57
60
|
// the run in `working_memory`.
|
|
58
61
|
console.log(result.main_stuff);
|
|
@@ -251,11 +254,10 @@ These pages ship inside the published package, so a reader who has only installe
|
|
|
251
254
|
| [`docs/run-usage.md`](./docs/run-usage.md) | What a run consumed, record by record, and `summarizeUsage` which folds them into one reading |
|
|
252
255
|
| [`docs/artifact-download.md`](./docs/artifact-download.md) | Turning the `pipelex-storage://` references a run produced back into bytes: `locateArtifacts`, `collectArtifacts`, `resolveArtifacts`, `fetchArtifact`, `downloadArtifacts`, and how a saved file is named after the field it fills |
|
|
253
256
|
| [`docs/input-preparation.md`](./docs/input-preparation.md) | The other direction — `uploadFile` and `prepareInputs`, which turn local files into references a run can take, and the upload grant a browser page sends a file with |
|
|
254
|
-
| [`docs/
|
|
255
|
-
| [`docs/method-trees.md`](./docs/method-trees.md) | A saved method's tree: the three forms a save takes it in, how it travels inline or by hash and what is uploaded, the deployment's limits, the read's listing with its links, `writeMethodTree`, and `MethodFileTransferError` |
|
|
257
|
+
| [`docs/method-trees.md`](./docs/method-trees.md) | A method's tree: the four forms a run, a validation, a save and the crate routes take it in (a directory on disk among them), how it travels inline or by hash and what is uploaded, the files a step reads, the template check's warnings and which step reads which file of the tree, the deployment's limits, the read's listing with its links, `writeMethodTree`, and `MethodFileTransferError` |
|
|
256
258
|
| [`docs/method-examples.md`](./docs/method-examples.md) | A method's saved examples: the create, the paged list and its iterator, the edit that raises the input revision, the latest-run write and its `recorded` or `stale` verdict, how an integer past `Number.MAX_SAFE_INTEGER` in the inputs stays exact, and what is refused before sending |
|
|
257
259
|
| [`docs/exact-integers.md`](./docs/exact-integers.md) | Which reads keep an integer past `Number.MAX_SAFE_INTEGER` exact, as a `bigint` (a run's inputs and outputs, an example's inputs), how a request body writes it back with its digits, and `parseExactJson` and `stringifyExactJson` for code showing such data as JSON text |
|
|
258
|
-
| [`docs/crate-routes.md`](./docs/crate-routes.md) | `resolve`, `codegen` and `pipeIo` — the normalized crate, the stamped types, and a method's I/O artifacts without a validation — and the offline `runCodegenCheck` that guards a committed tree |
|
|
260
|
+
| [`docs/crate-routes.md`](./docs/crate-routes.md) | `resolve`, `codegen` and `pipeIo` — the method's tree as the protocol's `files` map, with its dependencies, the normalized crate, the stamped types, and a method's I/O artifacts without a validation — and the offline `runCodegenCheck` that guards a committed tree |
|
|
259
261
|
| [`docs/client-identification.md`](./docs/client-identification.md) | The `User-Agent` every API request carries, and `appInfo`, the option that puts your program's name in front of it |
|
|
260
262
|
| [`docs/errors.md`](./docs/errors.md) | The verdict every error carries (`retryable`, `errorDomain`, `errorVerdictOf`), a failed run's stored error report on `RunFailedError` and `RunRead`, and every member of a refused request's `ApiResponseError`, with the fields to branch on |
|
|
261
263
|
|
package/dist/cli/script.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import type { CommandIO } from "./io.js";
|
|
|
15
15
|
* update notice and npm 12's run notices off the script's stderr, which carries the command's
|
|
16
16
|
* own lines, while npm's warnings and errors still print.
|
|
17
17
|
*/
|
|
18
|
-
export declare const SCRIPT_RUNNER = "npx --yes --no-update-notifier --loglevel=warn @pipelex/sdk@0.
|
|
18
|
+
export declare const SCRIPT_RUNNER = "npx --yes --no-update-notifier --loglevel=warn @pipelex/sdk@0.48.0";
|
|
19
19
|
export declare const SCRIPT_WRITER = "@pipelex/sdk";
|
|
20
20
|
export declare const SCRIPT_NEEDS = "Node 22.12 or later";
|
|
21
21
|
/** Run `pipelex-sdk script` and return its exit code. */
|
package/dist/cli/source.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The method as each route names it, and the one pipe I/O call that checks it.
|
|
3
3
|
*
|
|
4
|
-
* A bundle read from disk travels to the pipe I/O route as
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
4
|
+
* A bundle read from disk travels to the pipe I/O route as the method's tree, given as the `files`
|
|
5
|
+
* map, each file's text under its name in the bundle, sent as given; and to the run as the runner's
|
|
6
|
+
* `mthds_contents`, in the bundle's order, through the client's `extra` passthrough, as the Python
|
|
7
|
+
* CLI sends it: the client names only the method's tree on a run. The case files both CLIs run pin
|
|
8
|
+
* both bodies, the whole bundle inline with no version handshake before it, until the command
|
|
9
|
+
* sends a method's tree as the SDKs do. An address travels as `method_ref` and a catalog id as
|
|
10
|
+
* `method_id`, both resolved by the server.
|
|
7
11
|
*/
|
|
8
12
|
import type { PipeInputFormDescriptor, PipelexApiClient, PipeIOValidReport, PipelexStartOptions } from "../index.js";
|
|
9
13
|
import type { BundleFile } from "./bundle.js";
|
|
@@ -20,10 +24,7 @@ export type MethodSource = {
|
|
|
20
24
|
};
|
|
21
25
|
/** The method as the crate routes and the input preparation name it. */
|
|
22
26
|
export type CrateSelector = {
|
|
23
|
-
files:
|
|
24
|
-
content: string;
|
|
25
|
-
source: string;
|
|
26
|
-
}>;
|
|
27
|
+
files: Record<string, string>;
|
|
27
28
|
} | {
|
|
28
29
|
method_ref: string;
|
|
29
30
|
} | {
|
package/dist/cli/source.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The method as each route names it, and the one pipe I/O call that checks it.
|
|
3
3
|
*
|
|
4
|
-
* A bundle read from disk travels to the pipe I/O route as
|
|
5
|
-
*
|
|
6
|
-
* `
|
|
4
|
+
* A bundle read from disk travels to the pipe I/O route as the method's tree, given as the `files`
|
|
5
|
+
* map, each file's text under its name in the bundle, sent as given; and to the run as the runner's
|
|
6
|
+
* `mthds_contents`, in the bundle's order, through the client's `extra` passthrough, as the Python
|
|
7
|
+
* CLI sends it: the client names only the method's tree on a run. The case files both CLIs run pin
|
|
8
|
+
* both bodies, the whole bundle inline with no version handshake before it, until the command
|
|
9
|
+
* sends a method's tree as the SDKs do. An address travels as `method_ref` and a catalog id as
|
|
10
|
+
* `method_id`, both resolved by the server.
|
|
7
11
|
*/
|
|
8
12
|
import { inputFormFault } from "../index.js";
|
|
9
13
|
import { CommandError, EXIT_FAILED, untilInterrupted } from "./io.js";
|
|
@@ -11,7 +15,9 @@ import { loadFailureLines, METHOD_DOES_NOT_LOAD_SENTENCE } from "./present.js";
|
|
|
11
15
|
export function crateSelector(source) {
|
|
12
16
|
switch (source.kind) {
|
|
13
17
|
case "bundle":
|
|
14
|
-
return {
|
|
18
|
+
return {
|
|
19
|
+
files: Object.fromEntries(source.files.map((file) => [file.name, file.content])),
|
|
20
|
+
};
|
|
15
21
|
case "address":
|
|
16
22
|
return { method_ref: source.methodRef };
|
|
17
23
|
case "catalog":
|
|
@@ -22,7 +28,7 @@ export function crateSelector(source) {
|
|
|
22
28
|
export function runSelector(source) {
|
|
23
29
|
switch (source.kind) {
|
|
24
30
|
case "bundle":
|
|
25
|
-
return { mthds_contents: source.files.map((file) => file.content) };
|
|
31
|
+
return { extra: { mthds_contents: source.files.map((file) => file.content) } };
|
|
26
32
|
case "address":
|
|
27
33
|
return { method_ref: source.methodRef };
|
|
28
34
|
case "catalog":
|
package/dist/cli/source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/cli/source.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/cli/source.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