@shiwano/ggen 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shogo Iwano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,30 @@
1
- # Temporary Holding Version
1
+ # @shiwano/ggen
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Image, video, and audio generation for TypeScript. `GGen.open()` downloads the [ggen](https://github.com/shiwano/ggen) binary for your platform on first use and runs it on the local GPU, and a generation downloads the weights it needs.
4
+
5
+ ```sh
6
+ npm install @shiwano/ggen
7
+ ```
8
+
9
+ ```ts
10
+ import { GGen } from "@shiwano/ggen";
11
+
12
+ await using ggen = await GGen.open();
13
+
14
+ const { image } = await ggen.generate("krea2/image.generate", {
15
+ inputs: {
16
+ prompt: "A white ceramic teapot on a blue linen cloth in afternoon light.",
17
+ width: 1280,
18
+ height: 720,
19
+ },
20
+ });
21
+ await image.save("teapot.png");
22
+ ```
23
+
24
+ It runs on Linux x86_64 (CUDA, ROCm, Vulkan, CPU), Windows x64 (CUDA, ROCm, Vulkan, CPU), and macOS arm64 (Metal).
25
+
26
+ The operations, progress and cancellation, where the files go, and how to ship ggen with an app are in the [ggen README](https://github.com/shiwano/ggen#readme).
27
+
28
+ ## License
29
+
30
+ [MIT](https://github.com/shiwano/ggen/blob/main/LICENSE)
@@ -0,0 +1,38 @@
1
+ export type GGenBackend = "cpu" | "cuda" | "rocm" | "vulkan" | "metal";
2
+ export interface Manifest {
3
+ version: string;
4
+ archives: Record<string, {
5
+ url: string;
6
+ sha256: string;
7
+ size: number;
8
+ }>;
9
+ }
10
+ export interface GGenDownloadProgress {
11
+ backend: GGenBackend;
12
+ completed: number;
13
+ total: number;
14
+ }
15
+ export interface BinaryOptions {
16
+ binaryDir?: string | undefined;
17
+ backend?: GGenBackend | "auto" | undefined;
18
+ download?: boolean | undefined;
19
+ onDownload?: ((progress: GGenDownloadProgress) => void) | undefined;
20
+ manifest?: Manifest | undefined;
21
+ }
22
+ /** The server version this package runs. */
23
+ export declare function serverVersion(): string;
24
+ export declare function platform(): string;
25
+ export declare function defaultBinaryDir(version: string): string;
26
+ /** Returns the `ggen` executable and its backend, downloading it unless `download` is false. */
27
+ export declare function resolveBinary(options?: BinaryOptions): Promise<{
28
+ path: string;
29
+ backend: GGenBackend;
30
+ }>;
31
+ /**
32
+ * Calls `start` with the binary of each backend `options` allows, in order, until one succeeds.
33
+ * Under `auto` a backend whose binary cannot be had or started falls through to the next.
34
+ */
35
+ export declare function withBinary<T>(options: BinaryOptions, start: (binary: {
36
+ path: string;
37
+ backend: GGenBackend;
38
+ }) => Promise<T>): Promise<T>;
package/dist/binary.js ADDED
@@ -0,0 +1,397 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { readFileSync } from "node:fs";
4
+ import { access, chmod, mkdir, mkdtemp, open, readFile, readdir, rename, rm, writeFile, } from "node:fs/promises";
5
+ import { homedir } from "node:os";
6
+ import { join } from "node:path";
7
+ import { Readable } from "node:stream";
8
+ import { GGenError } from "./errors.js";
9
+ import { extractZip } from "./zip.js";
10
+ const AUTO_ORDER = ["cuda", "vulkan", "cpu"];
11
+ const BACKENDS = ["cpu", "cuda", "rocm", "vulkan", "metal"];
12
+ let server;
13
+ /** The server version this package runs. */
14
+ export function serverVersion() {
15
+ server ??= JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).ggen.server;
16
+ return server;
17
+ }
18
+ const RELEASES = "https://github.com/shiwano/ggen/releases/download";
19
+ const MANIFEST = "manifest.json";
20
+ const fetching = new Map();
21
+ function parseManifest(text, origin) {
22
+ const manifest = JSON.parse(text);
23
+ if (typeof manifest?.version !== "string" || !isObject(manifest.archives)) {
24
+ throw new Error(`${origin}: not a manifest`);
25
+ }
26
+ for (const [key, entry] of Object.entries(manifest.archives)) {
27
+ if (!isObject(entry) ||
28
+ typeof entry.sha256 !== "string" ||
29
+ typeof entry.url !== "string" ||
30
+ !/^[0-9a-f]{64}$/i.test(entry.sha256) ||
31
+ !(entry.size > 0) ||
32
+ !/^https?:\/\//.test(entry.url)) {
33
+ throw new Error(`${origin}: invalid entry ${key}`);
34
+ }
35
+ }
36
+ return manifest;
37
+ }
38
+ function isObject(value) {
39
+ return typeof value === "object" && value !== null && !Array.isArray(value);
40
+ }
41
+ /** `<binaryDir>/manifest.json`, unless it is absent or unreadable; one of another version is refused. */
42
+ async function savedManifest(binaryDir, version) {
43
+ const path = join(binaryDir, MANIFEST);
44
+ const text = await readFile(path, "utf8").catch(() => undefined);
45
+ if (text === undefined)
46
+ return undefined;
47
+ let manifest;
48
+ try {
49
+ manifest = parseManifest(text, path);
50
+ }
51
+ catch {
52
+ return undefined;
53
+ }
54
+ if (manifest.version !== version) {
55
+ throw new GGenError("BINARY_UNAVAILABLE", `${binaryDir} holds the binaries of ggen ${manifest.version}, not ${version}; use another binaryDir`);
56
+ }
57
+ return manifest;
58
+ }
59
+ /** The manifest of the release of `version`, saved as `<binaryDir>/manifest.json` when none is there. */
60
+ function releaseManifest(binaryDir, version) {
61
+ const key = `${binaryDir}\0${version}`;
62
+ let pending = fetching.get(key);
63
+ if (!pending) {
64
+ pending = (async () => {
65
+ const url = `${RELEASES}/v${version}/${MANIFEST}`;
66
+ let text;
67
+ let manifest;
68
+ try {
69
+ const response = await fetch(url);
70
+ if (!response.ok)
71
+ throw new Error(`HTTP ${response.status}`);
72
+ text = await response.text();
73
+ manifest = parseManifest(text, url);
74
+ if (manifest.version !== version) {
75
+ throw new Error(`version ${manifest.version}, expected ${version}`);
76
+ }
77
+ }
78
+ catch (cause) {
79
+ throw new GGenError("BINARY_UNAVAILABLE", `${url}: ${String(cause)}`, { cause });
80
+ }
81
+ await save(binaryDir, text);
82
+ await savedManifest(binaryDir, version);
83
+ return manifest;
84
+ })();
85
+ fetching.set(key, pending);
86
+ const settled = () => fetching.delete(key);
87
+ pending.then(settled, settled);
88
+ }
89
+ return pending;
90
+ }
91
+ /** Writes `text` as `<binaryDir>/manifest.json` unless a readable one is there. */
92
+ async function save(binaryDir, text) {
93
+ const path = join(binaryDir, MANIFEST);
94
+ const current = await readFile(path, "utf8").catch(() => undefined);
95
+ if (current !== undefined && readable(current))
96
+ return;
97
+ await mkdir(binaryDir, { recursive: true });
98
+ const temp = join(binaryDir, `.${MANIFEST}.${randomUUID()}`);
99
+ await writeFile(temp, text);
100
+ await rename(temp, path);
101
+ }
102
+ function readable(text) {
103
+ try {
104
+ parseManifest(text, MANIFEST);
105
+ return true;
106
+ }
107
+ catch {
108
+ return false;
109
+ }
110
+ }
111
+ export function platform() {
112
+ const os = { linux: "linux", darwin: "darwin", win32: "windows" }[process.platform];
113
+ const arch = { x64: "x86_64", arm64: "arm64" }[process.arch];
114
+ if (!os || !arch) {
115
+ throw new GGenError("BINARY_UNAVAILABLE", `unsupported platform ${process.platform}-${process.arch}`);
116
+ }
117
+ return `${os}-${arch}`;
118
+ }
119
+ export function defaultBinaryDir(version) {
120
+ const env = (name) => process.env[name] || undefined;
121
+ const cache = env("GGEN_CACHE_DIR") ?? join(env("XDG_CACHE_HOME") ?? join(homedir(), ".cache"), "ggen");
122
+ return join(cache, "bin", version);
123
+ }
124
+ const ARCHIVE_DIGEST = ".archive-sha256";
125
+ function executable(binaryDir, backend) {
126
+ return join(binaryDir, `${platform()}-${backend}`, "bin", process.platform === "win32" ? "ggen.exe" : "ggen");
127
+ }
128
+ async function exists(path) {
129
+ return access(path).then(() => true, () => false);
130
+ }
131
+ /** Returns the `ggen` executable and its backend, downloading it unless `download` is false. */
132
+ export async function resolveBinary(options = {}) {
133
+ return withBinary(options, async (binary) => binary);
134
+ }
135
+ /**
136
+ * Calls `start` with the binary of each backend `options` allows, in order, until one succeeds.
137
+ * Under `auto` a backend whose binary cannot be had or started falls through to the next.
138
+ */
139
+ export async function withBinary(options, start) {
140
+ const version = options.manifest?.version ?? serverVersion();
141
+ const binaryDir = options.binaryDir ?? defaultBinaryDir(version);
142
+ const download = options.download ?? true;
143
+ const given = options.manifest;
144
+ const known = async () => given ?? (await savedManifest(binaryDir, version));
145
+ let pending;
146
+ const merged = () => {
147
+ if (given)
148
+ return Promise.resolve(given);
149
+ pending ??= (async () => {
150
+ const release = await releaseManifest(binaryDir, version);
151
+ const saved = await savedManifest(binaryDir, version);
152
+ return { version, archives: { ...release.archives, ...saved?.archives } };
153
+ })();
154
+ pending.catch(() => (pending = undefined));
155
+ return pending;
156
+ };
157
+ const ensure = async (backend) => {
158
+ const path = executable(binaryDir, backend);
159
+ if (await exists(path)) {
160
+ const key = `${platform()}-${backend}`;
161
+ const expected = (await known())?.archives[key]?.sha256;
162
+ const recorded = await readFile(join(binaryDir, key, ARCHIVE_DIGEST), "utf8").catch(() => undefined);
163
+ if (!expected || !recorded) {
164
+ await checkVersion(path, version);
165
+ }
166
+ else if (recorded.trim().toLowerCase() !== expected.toLowerCase()) {
167
+ throw new GGenError("BINARY_UNAVAILABLE", `${join(binaryDir, key)} holds another archive than the manifest of ${version}; remove it`);
168
+ }
169
+ return path;
170
+ }
171
+ if (!download) {
172
+ throw new GGenError("BINARY_UNAVAILABLE", `${path} not found and download is false`);
173
+ }
174
+ const local = await known();
175
+ const key = `${platform()}-${backend}`;
176
+ const source = local && key in local.archives ? local : await merged();
177
+ await install(source, binaryDir, backend, options.onDownload);
178
+ return path;
179
+ };
180
+ const tried = [];
181
+ const errors = [];
182
+ const attempt = async (order) => {
183
+ for (const backend of order) {
184
+ if (tried.includes(backend))
185
+ continue;
186
+ tried.push(backend);
187
+ try {
188
+ return { value: await start({ path: await ensure(backend), backend }) };
189
+ }
190
+ catch (error) {
191
+ errors.push(error);
192
+ }
193
+ }
194
+ return undefined;
195
+ };
196
+ if (options.backend !== undefined && options.backend !== "auto") {
197
+ const done = await attempt([options.backend]);
198
+ if (done)
199
+ return done.value;
200
+ }
201
+ else {
202
+ const plan = (remote) => detect(known, merged, given !== undefined, version, binaryDir, download, ensure, remote);
203
+ let failure;
204
+ const first = await plan(false).catch((error) => {
205
+ failure = error;
206
+ return undefined;
207
+ });
208
+ let second;
209
+ if (first?.missing) {
210
+ second = await plan(true).catch(() => undefined);
211
+ const done = second && (await attempt(second.order));
212
+ if (done)
213
+ return done.value;
214
+ }
215
+ const done = first && (await attempt(first.order));
216
+ if (done)
217
+ return done.value;
218
+ if (download && !first?.consulted && !second) {
219
+ second = await plan(true).catch(() => undefined);
220
+ const more = second && (await attempt(second.order));
221
+ if (more)
222
+ return more.value;
223
+ }
224
+ if (tried.length === 0)
225
+ throw failure;
226
+ }
227
+ if (errors.length === 1)
228
+ throw errors[0];
229
+ const last = errors.at(-1);
230
+ throw new GGenError(last instanceof GGenError ? last.code : "BINARY_UNAVAILABLE", tried.map((backend, i) => `${backend}: ${errors[i].message}`).join("; "), { cause: last });
231
+ }
232
+ async function detect(known, merged, given, version, binaryDir, download, ensure, remote) {
233
+ const key = platform();
234
+ if (key === "darwin-arm64")
235
+ return { order: ["metal"], consulted: true };
236
+ const present = (await readdir(binaryDir).catch(() => []))
237
+ .filter((name) => name.startsWith(`${key}-`))
238
+ .map((name) => name.slice(key.length + 1))
239
+ .filter((b) => BACKENDS.includes(b));
240
+ const installed = [];
241
+ for (const b of present)
242
+ if (await exists(executable(binaryDir, b)))
243
+ installed.push(b);
244
+ let archives = {};
245
+ let unreachable = "";
246
+ let consulted = given;
247
+ if (download) {
248
+ const local = await known();
249
+ if (given || (!remote && local)) {
250
+ archives = local.archives;
251
+ }
252
+ else if (remote || !AUTO_ORDER.some((b) => installed.includes(b))) {
253
+ consulted = true;
254
+ try {
255
+ archives = (await merged()).archives;
256
+ }
257
+ catch (error) {
258
+ unreachable = ` (${error.message})`;
259
+ }
260
+ }
261
+ }
262
+ const candidates = AUTO_ORDER.filter((b) => installed.includes(b) || `${key}-${b}` in archives);
263
+ if (candidates.length === 0) {
264
+ const where = download ? `${binaryDir} or the manifest of ${version}` : binaryDir;
265
+ const rocm = installed.includes("rocm") ? '; pass backend: "rocm" to use rocm' : "";
266
+ throw new GGenError("BINARY_UNAVAILABLE", `no ggen binary for ${key} in ${where}${rocm}${unreachable}`);
267
+ }
268
+ if ((consulted || !download) && candidates.length === 1 && candidates[0] === "cpu") {
269
+ return { order: ["cpu"], consulted };
270
+ }
271
+ const probes = [
272
+ ...candidates.filter((b) => b === "cpu"),
273
+ ...candidates.filter((b) => b !== "cpu" && installed.includes(b)),
274
+ ...candidates.filter((b) => b !== "cpu" && !installed.includes(b)),
275
+ ];
276
+ const failures = [];
277
+ for (const probe of probes) {
278
+ let available;
279
+ try {
280
+ available = await devices(await ensure(probe));
281
+ }
282
+ catch (error) {
283
+ failures.push(`${probe}: ${error.message}`);
284
+ continue;
285
+ }
286
+ const usable = candidates.filter((b) => available.has(b));
287
+ const better = AUTO_ORDER.slice(0, AUTO_ORDER.indexOf(usable[0]));
288
+ const missing = download &&
289
+ !consulted &&
290
+ better.some((b) => available.has(b) && !installed.includes(b) && !(`${key}-${b}` in archives));
291
+ if (usable.length > 0)
292
+ return { order: usable, consulted, missing };
293
+ failures.push(`${probe}: none of ${candidates.join(", ")} has a device`);
294
+ break;
295
+ }
296
+ if (candidates.includes("cpu"))
297
+ return { order: ["cpu"], consulted };
298
+ throw new GGenError("BINARY_UNAVAILABLE", `no ggen backend for ${key} runs here (${failures.join("; ")})`);
299
+ }
300
+ async function checkVersion(binary, version) {
301
+ const output = await run(binary, ["--version"]);
302
+ const actual = output.trim().split(/\s+/).at(-1);
303
+ if (actual !== version) {
304
+ throw new GGenError("BINARY_UNAVAILABLE", `${binary} is ggen ${actual}, not ${version}; use another binaryDir`);
305
+ }
306
+ }
307
+ async function run(binary, args) {
308
+ const child = spawn(binary, args, {
309
+ stdio: ["ignore", "pipe", "pipe"],
310
+ windowsHide: true,
311
+ });
312
+ let stdout = "";
313
+ let stderr = "";
314
+ child.stdout.setEncoding("utf8").on("data", (chunk) => (stdout += chunk));
315
+ child.stderr.setEncoding("utf8").on("data", (chunk) => (stderr += chunk));
316
+ const command = `${binary} ${args.join(" ")}`;
317
+ const code = await new Promise((resolve, reject) => {
318
+ child.once("error", reject);
319
+ child.once("close", resolve);
320
+ }).catch((cause) => {
321
+ throw new GGenError("PROCESS_EXITED", `${command}: ${String(cause)}`, { cause });
322
+ });
323
+ if (code !== 0) {
324
+ throw new GGenError("PROCESS_EXITED", `${command} exited with ${code}`, {
325
+ stderr: stderr.slice(-8192),
326
+ });
327
+ }
328
+ return stdout;
329
+ }
330
+ async function devices(binary) {
331
+ const { devices } = JSON.parse(await run(binary, ["devices"]));
332
+ return new Set(devices.map((device) => device.backend));
333
+ }
334
+ async function install(source, binaryDir, backend, onDownload) {
335
+ const key = `${platform()}-${backend}`;
336
+ const entry = source.archives[key];
337
+ if (!entry) {
338
+ throw new GGenError("BINARY_UNAVAILABLE", `no archive for ${key} in the manifest of ${source.version}`);
339
+ }
340
+ const dest = join(binaryDir, key);
341
+ await mkdir(binaryDir, { recursive: true });
342
+ const temp = await mkdtemp(join(binaryDir, `.${key}-`));
343
+ try {
344
+ const archive = join(temp, "archive.zip");
345
+ try {
346
+ await fetchArchive(entry, archive, (completed) => onDownload?.({ backend, completed, total: entry.size }));
347
+ await extractZip(archive, join(temp, key));
348
+ }
349
+ catch (cause) {
350
+ if (cause instanceof GGenError)
351
+ throw cause;
352
+ throw new GGenError("BINARY_UNAVAILABLE", `${entry.url}: ${String(cause)}`, { cause });
353
+ }
354
+ if (!(await exists(executable(temp, backend)))) {
355
+ throw new GGenError("BINARY_UNAVAILABLE", `${entry.url}: no ggen executable in the archive`);
356
+ }
357
+ if (process.platform !== "win32")
358
+ await chmod(executable(temp, backend), 0o755);
359
+ await writeFile(join(temp, key, ARCHIVE_DIGEST), `${entry.sha256}\n`);
360
+ await rename(join(temp, key), dest).catch(async (cause) => {
361
+ if (!(await exists(executable(binaryDir, backend)))) {
362
+ throw new GGenError("BINARY_UNAVAILABLE", `${dest} exists without the ggen executable; remove it (${String(cause)})`, { cause });
363
+ }
364
+ const recorded = await readFile(join(dest, ARCHIVE_DIGEST), "utf8").catch(() => "");
365
+ if (recorded.trim().toLowerCase() !== entry.sha256.toLowerCase()) {
366
+ throw new GGenError("BINARY_UNAVAILABLE", `${dest} holds another archive than ${entry.url}; remove it`, { cause });
367
+ }
368
+ });
369
+ }
370
+ finally {
371
+ await rm(temp, { recursive: true, force: true });
372
+ }
373
+ }
374
+ async function fetchArchive(entry, path, progress) {
375
+ const response = await fetch(entry.url);
376
+ if (!response.ok || !response.body) {
377
+ throw new GGenError("BINARY_UNAVAILABLE", `${entry.url}: HTTP ${response.status}`);
378
+ }
379
+ const hash = createHash("sha256");
380
+ const file = await open(path, "w");
381
+ let completed = 0;
382
+ try {
383
+ for await (const chunk of Readable.fromWeb(response.body)) {
384
+ hash.update(chunk);
385
+ await file.write(chunk);
386
+ completed += chunk.byteLength;
387
+ progress(completed);
388
+ }
389
+ }
390
+ finally {
391
+ await file.close();
392
+ }
393
+ const digest = hash.digest("hex");
394
+ if (digest !== entry.sha256.toLowerCase()) {
395
+ throw new GGenError("BINARY_UNAVAILABLE", `${entry.url}: SHA-256 ${digest} does not match ${entry.sha256}`);
396
+ }
397
+ }
@@ -0,0 +1,56 @@
1
+ import type { components } from "./openapi.ts";
2
+ type S = components["schemas"];
3
+ export type Health = S["Health"];
4
+ export type Job = S["Job"];
5
+ export type JobLog = S["JobLog"];
6
+ export type JobRequest = S["JobRequest"];
7
+ export type JobStatus = S["JobStatus"];
8
+ export type JobSummary = S["JobSummary"];
9
+ export type OperationDefinition = S["OperationDefinition"];
10
+ export type Upload = S["Upload"];
11
+ export type UploadId = S["UploadId"];
12
+ export type MediaType = Upload["mediaType"];
13
+ export type BinaryInput = Uint8Array | ArrayBuffer | Blob;
14
+ export interface GGenClientOptions {
15
+ baseUrl: string | URL;
16
+ apiKey?: string | undefined;
17
+ fetch?: typeof fetch | undefined;
18
+ }
19
+ export interface RequestOptions {
20
+ signal?: AbortSignal | undefined;
21
+ }
22
+ export interface GetJobOptions extends RequestOptions {
23
+ since?: number | undefined;
24
+ waitMs?: number | undefined;
25
+ }
26
+ export declare function isTerminal(status: JobStatus): boolean;
27
+ export declare function uploadId(data: BinaryInput): Promise<UploadId>;
28
+ /** HTTP client of `ggen serve`. */
29
+ export declare class GGenClient {
30
+ #private;
31
+ readonly baseUrl: URL;
32
+ constructor(options: GGenClientOptions);
33
+ health(options?: RequestOptions): Promise<Health>;
34
+ operations(options?: RequestOptions): Promise<OperationDefinition[]>;
35
+ unload(options?: RequestOptions): Promise<Health>;
36
+ submitJob(jobId: string, request: JobRequest, options?: RequestOptions): Promise<{
37
+ job: Job;
38
+ created: boolean;
39
+ }>;
40
+ listJobs(options?: RequestOptions & {
41
+ status?: readonly JobStatus[];
42
+ }): Promise<JobSummary[]>;
43
+ getJob(jobId: string, options?: GetJobOptions): Promise<Job>;
44
+ cancelJob(jobId: string, options?: RequestOptions): Promise<Job>;
45
+ deleteJob(jobId: string, options?: RequestOptions): Promise<void>;
46
+ getJobLog(jobId: string, options?: RequestOptions & {
47
+ offset?: number;
48
+ }): Promise<JobLog>;
49
+ /** The output `name`, or item `index` of an `images` output. */
50
+ getJobOutput(jobId: string, name: string, index?: number, options?: RequestOptions): Promise<ReadableStream<Uint8Array>>;
51
+ listUploads(options?: RequestOptions): Promise<Upload[]>;
52
+ putUpload(data: BinaryInput, mediaType: MediaType, options?: RequestOptions): Promise<Upload>;
53
+ hasUpload(id: UploadId, options?: RequestOptions): Promise<boolean>;
54
+ deleteUpload(id: UploadId, options?: RequestOptions): Promise<void>;
55
+ }
56
+ export {};