@sapiom/tools 0.3.0 → 0.5.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/CHANGELOG.md +17 -1
- package/README.md +13 -2
- package/dist/cjs/agent/index.d.ts +43 -10
- package/dist/cjs/agent/index.d.ts.map +1 -1
- package/dist/cjs/agent/index.js +93 -1
- package/dist/cjs/agent/index.js.map +1 -1
- package/dist/cjs/client.d.ts +10 -0
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +6 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/content-generation/errors.d.ts +16 -0
- package/dist/cjs/content-generation/errors.d.ts.map +1 -0
- package/dist/cjs/content-generation/errors.js +36 -0
- package/dist/cjs/content-generation/errors.js.map +1 -0
- package/dist/cjs/content-generation/index.d.ts +87 -0
- package/dist/cjs/content-generation/index.d.ts.map +1 -0
- package/dist/cjs/content-generation/index.js +77 -0
- package/dist/cjs/content-generation/index.js.map +1 -0
- package/dist/cjs/file-storage/errors.d.ts +2 -2
- package/dist/cjs/file-storage/errors.js +2 -2
- package/dist/cjs/file-storage/index.d.ts +14 -18
- package/dist/cjs/file-storage/index.d.ts.map +1 -1
- package/dist/cjs/file-storage/index.js +9 -11
- package/dist/cjs/file-storage/index.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +13 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/stub/index.d.ts.map +1 -1
- package/dist/cjs/stub/index.js +31 -14
- package/dist/cjs/stub/index.js.map +1 -1
- package/dist/esm/agent/index.d.ts +43 -10
- package/dist/esm/agent/index.d.ts.map +1 -1
- package/dist/esm/agent/index.js +90 -0
- package/dist/esm/agent/index.js.map +1 -1
- package/dist/esm/client.d.ts +10 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +6 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/content-generation/errors.d.ts +16 -0
- package/dist/esm/content-generation/errors.d.ts.map +1 -0
- package/dist/esm/content-generation/errors.js +31 -0
- package/dist/esm/content-generation/errors.js.map +1 -0
- package/dist/esm/content-generation/index.d.ts +87 -0
- package/dist/esm/content-generation/index.d.ts.map +1 -0
- package/dist/esm/content-generation/index.js +73 -0
- package/dist/esm/content-generation/index.js.map +1 -0
- package/dist/esm/file-storage/errors.d.ts +2 -2
- package/dist/esm/file-storage/errors.js +2 -2
- package/dist/esm/file-storage/index.d.ts +14 -18
- package/dist/esm/file-storage/index.d.ts.map +1 -1
- package/dist/esm/file-storage/index.js +9 -11
- package/dist/esm/file-storage/index.js.map +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stub/index.d.ts.map +1 -1
- package/dist/esm/stub/index.js +32 -15
- package/dist/esm/stub/index.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +6 -1
- package/src/content-generation/README.md +61 -0
- package/src/file-storage/README.md +12 -15
package/dist/esm/client.js
CHANGED
|
@@ -19,6 +19,7 @@ import { Sandbox } from "./sandboxes/index.js";
|
|
|
19
19
|
import { Repository } from "./repositories/index.js";
|
|
20
20
|
import { run as codingRun, launch as codingLaunch } from "./agent/index.js";
|
|
21
21
|
import * as fileStorage from "./file-storage/index.js";
|
|
22
|
+
import * as contentGeneration from "./content-generation/index.js";
|
|
22
23
|
/** Bind every capability namespace to a transport. `withAttribution` rebinds to a derived one. */
|
|
23
24
|
function bind(transport) {
|
|
24
25
|
return {
|
|
@@ -46,6 +47,11 @@ function bind(transport) {
|
|
|
46
47
|
delete: (fileId) => fileStorage.delete(fileId, transport),
|
|
47
48
|
setVisibility: (fileId, visibility) => fileStorage.setVisibility(fileId, visibility, transport),
|
|
48
49
|
},
|
|
50
|
+
contentGeneration: {
|
|
51
|
+
images: {
|
|
52
|
+
create: (input) => contentGeneration.createImage(input, transport),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
49
55
|
withAttribution: (attribution) => bind(transport.withAttribution(attribution)),
|
|
50
56
|
};
|
|
51
57
|
}
|
package/dist/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,SAAS,EACT,kBAAkB,GAGnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM5E,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,SAAS,EACT,kBAAkB,GAGnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAM5E,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AASvD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AAuDnE,kGAAkG;AAClG,SAAS,IAAI,CAAC,SAAoB;IAChC,OAAO;QACL,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YAC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AE,SAAS,CAAC;YACzD,aAAa,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CACpC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC;SAC3D;QACD,iBAAiB,EAAE;YACjB,MAAM,EAAE;gBACN,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;aACnE;SACF;QACD,eAAe,EAAE,CAAC,WAAW,EAAE,EAAE,CAC/B,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAwB;IACnD,OAAO,IAAI,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,CAAC,IAAI,SAAS,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown by the `contentGeneration` capability when a request fails
|
|
3
|
+
* (non-2xx response). Exposes `status` (HTTP status code) and `body` (parsed JSON
|
|
4
|
+
* body, or raw text when the body isn't JSON) for programmatic inspection.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ContentGenerationHttpError extends Error {
|
|
7
|
+
readonly status: number;
|
|
8
|
+
readonly body: unknown;
|
|
9
|
+
constructor(message: string, status: number, body: unknown);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Return the response when 2xx, otherwise throw a {@link ContentGenerationHttpError}.
|
|
13
|
+
* Parses the error body as JSON when possible; falls back to raw text.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureOk(response: Response, errorPrefix: string): Promise<Response>;
|
|
16
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/content-generation/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,QAAQ,CAAC,CAcnB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown by the `contentGeneration` capability when a request fails
|
|
3
|
+
* (non-2xx response). Exposes `status` (HTTP status code) and `body` (parsed JSON
|
|
4
|
+
* body, or raw text when the body isn't JSON) for programmatic inspection.
|
|
5
|
+
*/
|
|
6
|
+
export class ContentGenerationHttpError extends Error {
|
|
7
|
+
constructor(message, status, body) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "ContentGenerationHttpError";
|
|
10
|
+
this.status = status;
|
|
11
|
+
this.body = body;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Return the response when 2xx, otherwise throw a {@link ContentGenerationHttpError}.
|
|
16
|
+
* Parses the error body as JSON when possible; falls back to raw text.
|
|
17
|
+
*/
|
|
18
|
+
export async function ensureOk(response, errorPrefix) {
|
|
19
|
+
if (response.ok)
|
|
20
|
+
return response;
|
|
21
|
+
let body;
|
|
22
|
+
const text = await response.text().catch(() => "");
|
|
23
|
+
try {
|
|
24
|
+
body = JSON.parse(text);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
body = text;
|
|
28
|
+
}
|
|
29
|
+
throw new ContentGenerationHttpError(`${errorPrefix}: ${response.status} ${text}`, response.status, body);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/content-generation/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAInD,YAAY,OAAe,EAAE,MAAc,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,QAAkB,EAClB,WAAmB;IAEnB,IAAI,QAAQ,CAAC,EAAE;QAAE,OAAO,QAAQ,CAAC;IACjC,IAAI,IAAa,CAAC;IAClB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,0BAA0B,CAClC,GAAG,WAAW,KAAK,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE,EAC5C,QAAQ,CAAC,MAAM,EACf,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `contentGeneration` capability — generate media (images today; video and audio
|
|
3
|
+
* to come), with an optional `storage` param that persists each output to Sapiom
|
|
4
|
+
* file storage so you get a durable `fileId` back inline.
|
|
5
|
+
*
|
|
6
|
+
* import { contentGeneration } from "@sapiom/tools"; // ambient auth
|
|
7
|
+
* const out = await contentGeneration.images.create({
|
|
8
|
+
* prompt: "a red bicycle",
|
|
9
|
+
* storage: { visibility: "private" }, // optional — persist outputs
|
|
10
|
+
* });
|
|
11
|
+
* out.images[0].url; // hosted URL of the generated image
|
|
12
|
+
* out.images[0].fileId; // present when `storage` was passed → use with fileStorage
|
|
13
|
+
*
|
|
14
|
+
* Or via an explicit client: `createClient({ apiKey }).contentGeneration.images.create(...)`.
|
|
15
|
+
*/
|
|
16
|
+
import { Transport } from "../_client/index.js";
|
|
17
|
+
import { ContentGenerationHttpError } from "./errors.js";
|
|
18
|
+
export { ContentGenerationHttpError };
|
|
19
|
+
export interface StorageOptions {
|
|
20
|
+
/**
|
|
21
|
+
* Visibility of the persisted output.
|
|
22
|
+
* - "private" — download requires the owning tenant (default).
|
|
23
|
+
* - "public" — download URL is reachable by any tenant.
|
|
24
|
+
*/
|
|
25
|
+
visibility?: "private" | "public";
|
|
26
|
+
}
|
|
27
|
+
export interface ImageCreateInput {
|
|
28
|
+
/** Text prompt describing the image to generate. */
|
|
29
|
+
prompt: string;
|
|
30
|
+
/** Number of images to generate. */
|
|
31
|
+
numImages?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Optional model selector. Defaults to a fast image model; most callers omit it.
|
|
34
|
+
* (Model identifiers are an advanced, evolving surface.)
|
|
35
|
+
*/
|
|
36
|
+
model?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional: persist each generated output to Sapiom file storage. When set, every
|
|
39
|
+
* item in `images` comes back annotated with `fileId` (or `storageError` if
|
|
40
|
+
* persisting that one failed).
|
|
41
|
+
*/
|
|
42
|
+
storage?: StorageOptions;
|
|
43
|
+
/**
|
|
44
|
+
* Advanced: extra model-specific parameters, forwarded verbatim
|
|
45
|
+
* (e.g. `image_size`, `seed`, `guidance_scale`).
|
|
46
|
+
*/
|
|
47
|
+
params?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export interface GeneratedImage {
|
|
50
|
+
/** Hosted URL of the generated image. */
|
|
51
|
+
url: string;
|
|
52
|
+
/** MIME type, when reported. */
|
|
53
|
+
contentType?: string;
|
|
54
|
+
width?: number;
|
|
55
|
+
height?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Present when `storage` was requested and this output was persisted — pass to
|
|
58
|
+
* `fileStorage.getDownloadUrl(fileId)` to retrieve it.
|
|
59
|
+
*/
|
|
60
|
+
fileId?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Present when `storage` was requested but persisting THIS output failed
|
|
63
|
+
* (best-effort: other images in the same response may still carry `fileId`).
|
|
64
|
+
*/
|
|
65
|
+
storageError?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ImageGenerationResult {
|
|
68
|
+
/** Generated images. */
|
|
69
|
+
images?: GeneratedImage[];
|
|
70
|
+
/** Additional model-specific fields (e.g. `seed`, `timings`), returned as-is. */
|
|
71
|
+
[key: string]: unknown;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Generate one or more images from a prompt. Pass `storage` to persist each output
|
|
75
|
+
* (the returned images then carry `fileId`). Failed requests throw
|
|
76
|
+
* {@link ContentGenerationHttpError}.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createImage(input: ImageCreateInput, transport?: Transport, baseUrl?: string): Promise<ImageGenerationResult>;
|
|
79
|
+
/**
|
|
80
|
+
* The `images` sub-namespace, so `contentGeneration.images.create(...)` reads the
|
|
81
|
+
* same whether imported from the barrel or used on a client. Video and audio will
|
|
82
|
+
* land here as sibling sub-namespaces.
|
|
83
|
+
*/
|
|
84
|
+
export declare const images: {
|
|
85
|
+
create: typeof createImage;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-generation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB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
|
3
|
+
* to come), with an optional `storage` param that persists each output to Sapiom
|
|
4
|
+
* file storage so you get a durable `fileId` back inline.
|
|
5
|
+
*
|
|
6
|
+
* import { contentGeneration } from "@sapiom/tools"; // ambient auth
|
|
7
|
+
* const out = await contentGeneration.images.create({
|
|
8
|
+
* prompt: "a red bicycle",
|
|
9
|
+
* storage: { visibility: "private" }, // optional — persist outputs
|
|
10
|
+
* });
|
|
11
|
+
* out.images[0].url; // hosted URL of the generated image
|
|
12
|
+
* out.images[0].fileId; // present when `storage` was passed → use with fileStorage
|
|
13
|
+
*
|
|
14
|
+
* Or via an explicit client: `createClient({ apiKey }).contentGeneration.images.create(...)`.
|
|
15
|
+
*/
|
|
16
|
+
import { defaultTransport } from "../_client/index.js";
|
|
17
|
+
import { ensureOk, ContentGenerationHttpError } from "./errors.js";
|
|
18
|
+
export { ContentGenerationHttpError };
|
|
19
|
+
const DEFAULT_BASE_URL = process.env.SAPIOM_CONTENT_GENERATION_URL || "https://fal.services.sapiom.ai";
|
|
20
|
+
/** Default image model when the caller doesn't pick one — a fast, low-cost model. */
|
|
21
|
+
const DEFAULT_IMAGE_MODEL = "fal-ai/flux/schnell";
|
|
22
|
+
function mapImage(raw) {
|
|
23
|
+
return {
|
|
24
|
+
url: raw.url,
|
|
25
|
+
...(raw.content_type !== undefined && { contentType: raw.content_type }),
|
|
26
|
+
...(raw.width !== undefined && { width: raw.width }),
|
|
27
|
+
...(raw.height !== undefined && { height: raw.height }),
|
|
28
|
+
...(raw.file_id !== undefined && { fileId: raw.file_id }),
|
|
29
|
+
...(raw.storage_error !== undefined && { storageError: raw.storage_error }),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function mapResult(raw) {
|
|
33
|
+
const { images, ...rest } = raw;
|
|
34
|
+
return images === undefined
|
|
35
|
+
? { ...rest }
|
|
36
|
+
: { ...rest, images: images.map(mapImage) };
|
|
37
|
+
}
|
|
38
|
+
// ----- Capability operations -----
|
|
39
|
+
/** Encode a model id into a URL path, preserving its `/` separators. */
|
|
40
|
+
function modelToPath(model) {
|
|
41
|
+
return model.split("/").filter(Boolean).map(encodeURIComponent).join("/");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Generate one or more images from a prompt. Pass `storage` to persist each output
|
|
45
|
+
* (the returned images then carry `fileId`). Failed requests throw
|
|
46
|
+
* {@link ContentGenerationHttpError}.
|
|
47
|
+
*/
|
|
48
|
+
export async function createImage(input, transport = defaultTransport(), baseUrl = DEFAULT_BASE_URL) {
|
|
49
|
+
const path = modelToPath(input.model || DEFAULT_IMAGE_MODEL);
|
|
50
|
+
const body = {
|
|
51
|
+
prompt: input.prompt,
|
|
52
|
+
...input.params,
|
|
53
|
+
};
|
|
54
|
+
if (input.numImages !== undefined)
|
|
55
|
+
body.num_images = input.numImages;
|
|
56
|
+
// Truthy check (not `!== undefined`) so a caller passing `storage: null` is
|
|
57
|
+
// treated as "no storage" rather than sending a null field.
|
|
58
|
+
if (input.storage)
|
|
59
|
+
body.storage = input.storage;
|
|
60
|
+
const res = await ensureOk(await transport.fetch(`${baseUrl}/run/${path}`, {
|
|
61
|
+
method: "POST",
|
|
62
|
+
headers: { "content-type": "application/json" },
|
|
63
|
+
body: JSON.stringify(body),
|
|
64
|
+
}), "Failed to generate image");
|
|
65
|
+
return mapResult((await res.json()));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The `images` sub-namespace, so `contentGeneration.images.create(...)` reads the
|
|
69
|
+
* same whether imported from the barrel or used on a client. Video and audio will
|
|
70
|
+
* land here as sibling sub-namespaces.
|
|
71
|
+
*/
|
|
72
|
+
export const images = { create: createImage };
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content-generation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAa,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA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
|
+
* Error thrown by the file-storage capability when a request fails (non-2xx
|
|
3
|
+
* response). Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
4
4
|
* raw text when the body isn't JSON) for programmatic inspection.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FileStorageHttpError extends Error {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Error thrown by the file-storage capability when
|
|
3
|
-
* response. Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
2
|
+
* Error thrown by the file-storage capability when a request fails (non-2xx
|
|
3
|
+
* response). Exposes `status` (HTTP status code) and `body` (parsed JSON body, or
|
|
4
4
|
* raw text when the body isn't JSON) for programmatic inspection.
|
|
5
5
|
*/
|
|
6
6
|
export class FileStorageHttpError extends Error {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `fileStorage` capability — tenant-scoped object storage
|
|
2
|
+
* `fileStorage` capability — tenant-scoped object storage with presigned URLs.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* You transfer the bytes yourself: `upload` hands back a presigned URL you PUT the
|
|
5
|
+
* bytes to (so you own streaming / progress / resumable uploads), and
|
|
6
6
|
* `getDownloadUrl` hands back a presigned URL you GET. `list`, `setVisibility`, and
|
|
7
7
|
* `delete` round out the lifecycle.
|
|
8
8
|
*
|
|
@@ -15,9 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Or via an explicit client: `createClient({ apiKey }).fileStorage.upload(...)`.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* so `expectedFileSize` / `actualFileSize` on returned metadata are `string | null`.
|
|
18
|
+
* Byte-size fields (`expectedFileSize` / `actualFileSize` on returned metadata) are
|
|
19
|
+
* returned as `string | null` to stay precise for large files.
|
|
21
20
|
*/
|
|
22
21
|
import { Transport } from "../_client/index.js";
|
|
23
22
|
import { FileStorageHttpError } from "./errors.js";
|
|
@@ -33,13 +32,13 @@ export interface UploadInput {
|
|
|
33
32
|
* - "public" — download URL is unauthenticated.
|
|
34
33
|
*/
|
|
35
34
|
visibility?: "private" | "public";
|
|
36
|
-
/** Expected file size in bytes.
|
|
35
|
+
/** Expected file size in bytes. */
|
|
37
36
|
expectedFileSize?: number;
|
|
38
37
|
}
|
|
39
38
|
export interface UploadResponse {
|
|
40
39
|
/** Unique file identifier. Use this in subsequent calls. */
|
|
41
40
|
fileId: string;
|
|
42
|
-
/**
|
|
41
|
+
/** Presigned upload URL. PUT the file bytes here directly. Expires at `expiresAt`. */
|
|
43
42
|
uploadUrl: string;
|
|
44
43
|
/** ISO-8601 timestamp when the upload URL expires. */
|
|
45
44
|
expiresAt: string;
|
|
@@ -47,7 +46,7 @@ export interface UploadResponse {
|
|
|
47
46
|
requiredHeaders: Record<string, string>;
|
|
48
47
|
}
|
|
49
48
|
export interface DownloadUrlResponse {
|
|
50
|
-
/** Presigned
|
|
49
|
+
/** Presigned download URL. Expires at `expiresAt`. */
|
|
51
50
|
downloadUrl: string;
|
|
52
51
|
/** ISO-8601 timestamp when the download URL expires. */
|
|
53
52
|
expiresAt: string;
|
|
@@ -63,12 +62,9 @@ export interface FileMetadata {
|
|
|
63
62
|
visibility: "private" | "public";
|
|
64
63
|
/** Upload lifecycle status (e.g. "pending_upload", "uploaded", "deleted"). */
|
|
65
64
|
status: string;
|
|
66
|
-
/**
|
|
67
|
-
* Expected (client-declared) size in bytes — a string (int64, precision-safe),
|
|
68
|
-
* `null` when not declared.
|
|
69
|
-
*/
|
|
65
|
+
/** Expected (client-declared) size in bytes — a string, `null` when not declared. */
|
|
70
66
|
expectedFileSize?: string | null;
|
|
71
|
-
/** Actual size in bytes after upload (string; `null` until the
|
|
67
|
+
/** Actual size in bytes after upload (string; `null` until the upload is verified). */
|
|
72
68
|
actualFileSize?: string | null;
|
|
73
69
|
/** ISO-8601 timestamp when the record was created. */
|
|
74
70
|
createdAt: string;
|
|
@@ -96,8 +92,8 @@ export interface ListResponse {
|
|
|
96
92
|
hasMore: boolean;
|
|
97
93
|
}
|
|
98
94
|
/**
|
|
99
|
-
* Initiate an upload. Returns a presigned
|
|
100
|
-
*
|
|
95
|
+
* Initiate an upload. Returns a presigned URL; PUT the bytes to `uploadUrl` with
|
|
96
|
+
* `requiredHeaders` yourself.
|
|
101
97
|
*/
|
|
102
98
|
export declare function upload(input: UploadInput, transport?: Transport, baseUrl?: string): Promise<UploadResponse>;
|
|
103
99
|
/** Generate a presigned download URL for a file. */
|
|
@@ -107,8 +103,8 @@ export declare function list(opts?: ListOptions, transport?: Transport, baseUrl?
|
|
|
107
103
|
/** Update a file's visibility. */
|
|
108
104
|
export declare function setVisibility(fileId: string, visibility: "private" | "public", transport?: Transport, baseUrl?: string): Promise<FileMetadata>;
|
|
109
105
|
/**
|
|
110
|
-
* Delete a file. Idempotent
|
|
111
|
-
*
|
|
106
|
+
* Delete a file. Idempotent (deleting an already-deleted file is a no-op success).
|
|
107
|
+
* Exported as `delete`:
|
|
112
108
|
* `import { fileStorage } from "@sapiom/tools"; await fileStorage.delete(id)`.
|
|
113
109
|
*/
|
|
114
110
|
declare function deleteFile(fileId: string, transport?: Transport, baseUrl?: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAY,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAQhC,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,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,WAAW,YAAY;IAC3B,iCAAiC;IACjC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,OAAO,EAAE,OAAO,CAAC;CAClB;AA4DD;;;GAGG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,WAAW,EAClB,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,cAAc,CAAC,CAuBzB;AAED,oDAAoD;AACpD,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAO9B;AAED,oDAAoD;AACpD,wBAAsB,IAAI,CACxB,IAAI,CAAC,EAAE,WAAW,EAClB,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,YAAY,CAAC,CAmBvB;AAED,kCAAkC;AAClC,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,SAAS,GAAG,QAAQ,EAChC,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,YAAY,CAAC,CAWvB;AAED;;;;GAIG;AACH,iBAAe,UAAU,CACvB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `fileStorage` capability — tenant-scoped object storage
|
|
2
|
+
* `fileStorage` capability — tenant-scoped object storage with presigned URLs.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* You transfer the bytes yourself: `upload` hands back a presigned URL you PUT the
|
|
5
|
+
* bytes to (so you own streaming / progress / resumable uploads), and
|
|
6
6
|
* `getDownloadUrl` hands back a presigned URL you GET. `list`, `setVisibility`, and
|
|
7
7
|
* `delete` round out the lifecycle.
|
|
8
8
|
*
|
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Or via an explicit client: `createClient({ apiKey }).fileStorage.upload(...)`.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* so `expectedFileSize` / `actualFileSize` on returned metadata are `string | null`.
|
|
18
|
+
* Byte-size fields (`expectedFileSize` / `actualFileSize` on returned metadata) are
|
|
19
|
+
* returned as `string | null` to stay precise for large files.
|
|
21
20
|
*/
|
|
22
21
|
import { defaultTransport } from "../_client/index.js";
|
|
23
22
|
import { ensureOk, FileStorageHttpError } from "./errors.js";
|
|
24
23
|
export { FileStorageHttpError };
|
|
25
|
-
/** Object storage service. Host routing is an internal detail — override via SAPIOM_FILE_STORAGE_URL. */
|
|
26
24
|
const DEFAULT_BASE_URL = process.env.SAPIOM_FILE_STORAGE_URL ||
|
|
27
25
|
"https://file-storage.services.sapiom.ai";
|
|
28
26
|
function mapFileMetadata(raw) {
|
|
@@ -46,8 +44,8 @@ function mapFileMetadata(raw) {
|
|
|
46
44
|
}
|
|
47
45
|
// ----- capability operations -----
|
|
48
46
|
/**
|
|
49
|
-
* Initiate an upload. Returns a presigned
|
|
50
|
-
*
|
|
47
|
+
* Initiate an upload. Returns a presigned URL; PUT the bytes to `uploadUrl` with
|
|
48
|
+
* `requiredHeaders` yourself.
|
|
51
49
|
*/
|
|
52
50
|
export async function upload(input, transport = defaultTransport(), baseUrl = DEFAULT_BASE_URL) {
|
|
53
51
|
const body = { content_type: input.contentType };
|
|
@@ -106,8 +104,8 @@ export async function setVisibility(fileId, visibility, transport = defaultTrans
|
|
|
106
104
|
return mapFileMetadata(raw);
|
|
107
105
|
}
|
|
108
106
|
/**
|
|
109
|
-
* Delete a file. Idempotent
|
|
110
|
-
*
|
|
107
|
+
* Delete a file. Idempotent (deleting an already-deleted file is a no-op success).
|
|
108
|
+
* Exported as `delete`:
|
|
111
109
|
* `import { fileStorage } from "@sapiom/tools"; await fileStorage.delete(id)`.
|
|
112
110
|
*/
|
|
113
111
|
async function deleteFile(fileId, transport = defaultTransport(), baseUrl = DEFAULT_BASE_URL) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAa,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAEhC,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,uBAAuB;IACnC,yCAAyC,CAAC;AAoH5C,SAAS,eAAe,CAAC,GAAoB;IAC3C,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC;QAC/D,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,GAAG,CAAC,GAAG,CAAC,kBAAkB,KAAK,SAAS,IAAI;YAC1C,gBAAgB,EAAE,GAAG,CAAC,kBAAkB;SACzC,CAAC;QACF,GAAG,CAAC,GAAG,CAAC,gBAAgB,KAAK,SAAS,IAAI;YACxC,cAAc,EAAE,GAAG,CAAC,gBAAgB;SACrC,CAAC;QACF,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,GAAG,CAAC,GAAG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AC9C,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,oBAAoB,CAC5B,0BAA0B,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,EAC1D,GAAG,CAAC,MAAM,EACV,MAAM,CACP,CAAC;IACJ,CAAC;IACD,qCAAqC;AACvC,CAAC;AAED,OAAO,EAAE,UAAU,IAAI,MAAM,EAAE,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -21,7 +21,10 @@ export * as repositories from "./repositories/index.js";
|
|
|
21
21
|
export { Repository } from "./repositories/index.js";
|
|
22
22
|
export * as agent from "./agent/index.js";
|
|
23
23
|
export { CODING_RESULT_SIGNAL } from "./agent/index.js";
|
|
24
|
-
export type { CodingResultPayload } from "./agent/index.js";
|
|
24
|
+
export type { CodingResultPayload, ExecutionEnvironmentRef, } from "./agent/index.js";
|
|
25
|
+
export { codingResultSchema, CodingResultSchemaError, toResumePayload, EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX, } from "./agent/index.js";
|
|
25
26
|
export * as fileStorage from "./file-storage/index.js";
|
|
26
27
|
export { FileStorageHttpError } from "./file-storage/index.js";
|
|
28
|
+
export * as contentGeneration from "./content-generation/index.js";
|
|
29
|
+
export { ContentGenerationHttpError } from "./content-generation/index.js";
|
|
27
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;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AAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -19,6 +19,11 @@ export { Repository } from "./repositories/index.js";
|
|
|
19
19
|
export * as agent from "./agent/index.js";
|
|
20
20
|
// Surfaced top-level for the static `pause: { signal }` decl on a workflow step.
|
|
21
21
|
export { CODING_RESULT_SIGNAL } from "./agent/index.js";
|
|
22
|
+
// Validate / build a `CodingResultPayload`, and the env `type` whose `id` is a
|
|
23
|
+
// sandbox name for `sandboxes.attach(id)`.
|
|
24
|
+
export { codingResultSchema, CodingResultSchemaError, toResumePayload, EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX, } from "./agent/index.js";
|
|
22
25
|
export * as fileStorage from "./file-storage/index.js";
|
|
23
26
|
export { FileStorageHttpError } from "./file-storage/index.js";
|
|
27
|
+
export * as contentGeneration from "./content-generation/index.js";
|
|
28
|
+
export { ContentGenerationHttpError } from "./content-generation/index.js";
|
|
24
29
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQhE,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,iFAAiF;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQhE,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,iFAAiF;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAOxD,+EAA+E;AAC/E,2CAA2C;AAC3C,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,oCAAoC,GACrC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAW3C,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAC5C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AA0TD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,iBAAsB,GAAG,MAAM,CAsKrE"}
|
package/dist/esm/stub/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* replaces that capability's default; a function `(…args) => value` computes it
|
|
19
19
|
* from the call arguments.
|
|
20
20
|
*/
|
|
21
|
-
import { CODING_RESULT_SIGNAL } from "../agent/index.js";
|
|
21
|
+
import { CODING_RESULT_SIGNAL, toResumePayload } from "../agent/index.js";
|
|
22
22
|
import { Repository } from "../repositories/index.js";
|
|
23
23
|
import { Sandbox } from "../sandboxes/index.js";
|
|
24
24
|
// Module-scoped so correlation ids are unique across launches within a run.
|
|
@@ -37,16 +37,15 @@ function isDispatchHandle(v) {
|
|
|
37
37
|
* stub method wraps its returned handle in this — the result a `pauseUntilSignal`
|
|
38
38
|
* resumes with is exactly what the handle's `wait()` resolves to.
|
|
39
39
|
*/
|
|
40
|
-
async function dispatchable(handle, signals) {
|
|
40
|
+
async function dispatchable(handle, signals, resumePayload) {
|
|
41
41
|
if (signals && isDispatchHandle(handle)) {
|
|
42
|
-
// The resume payload
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
signals.set(handle.dispatch.correlationId, toPlainJson(await handle.wait()));
|
|
42
|
+
// The resume payload crosses a wire boundary — it reaches the resumed step as
|
|
43
|
+
// plain JSON, never a live handle. A capability may supply `resumePayload` to
|
|
44
|
+
// produce that wire shape; absent, the awaited result IS the payload. Round-trip
|
|
45
|
+
// it either way so a local run sees exactly the wire shape — no local-only
|
|
46
|
+
// handle methods to lean on.
|
|
47
|
+
const payload = resumePayload ? await resumePayload() : await handle.wait();
|
|
48
|
+
signals.set(handle.dispatch.correlationId, toPlainJson(payload));
|
|
50
49
|
}
|
|
51
50
|
return handle;
|
|
52
51
|
}
|
|
@@ -284,15 +283,17 @@ export function createStubClient(opts = {}) {
|
|
|
284
283
|
run: (spec) => Promise.resolve(resolveCodingResult(spec, "agent.coding.run")),
|
|
285
284
|
launch: (spec) => {
|
|
286
285
|
const correlationId = `stub-run-${++launchSeq}`;
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
//
|
|
286
|
+
// `launch()` honors the key matching the call the author wrote
|
|
287
|
+
// (`agent.coding.launch`) first, then the shared `agent.coding.run`
|
|
288
|
+
// that controls both paths.
|
|
290
289
|
const result = {
|
|
291
290
|
...resolveCodingResult(spec, dispatchedKeys("agent.coding")),
|
|
292
291
|
runId: correlationId,
|
|
293
292
|
};
|
|
294
|
-
//
|
|
295
|
-
|
|
293
|
+
// Register for pause-resume with the wire shape a resumed step receives:
|
|
294
|
+
// `toResumePayload` maps the live result to a `CodingResultPayload` (an
|
|
295
|
+
// `executionEnvironment` reference, not a live sandbox handle).
|
|
296
|
+
return dispatchable(stubRunHandle(overrides, correlationId, result), opts.signals, () => toResumePayload(result));
|
|
296
297
|
},
|
|
297
298
|
},
|
|
298
299
|
},
|
|
@@ -323,6 +324,22 @@ export function createStubClient(opts = {}) {
|
|
|
323
324
|
downloadRequestCount: 0,
|
|
324
325
|
}))),
|
|
325
326
|
},
|
|
327
|
+
contentGeneration: {
|
|
328
|
+
images: {
|
|
329
|
+
create: (input) => Promise.resolve(r("contentGeneration.images.create", [input], () => ({
|
|
330
|
+
images: [
|
|
331
|
+
{
|
|
332
|
+
url: "https://content.local/stub-image.png",
|
|
333
|
+
contentType: "image/png",
|
|
334
|
+
width: 512,
|
|
335
|
+
height: 512,
|
|
336
|
+
// mirror the real stitch: a fileId only when storage was requested.
|
|
337
|
+
...(input.storage ? { fileId: "stub-file" } : {}),
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
}))),
|
|
341
|
+
},
|
|
342
|
+
},
|
|
326
343
|
withAttribution: () => client,
|
|
327
344
|
};
|
|
328
345
|
return client;
|