viem 2.57.15 → 2.57.16
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 +14 -0
- package/_cjs/errors/version.js +1 -1
- package/_cjs/tempo/Gateway.js +195 -0
- package/_cjs/tempo/Gateway.js.map +1 -0
- package/_cjs/tempo/GatewayDecorator.js +168 -0
- package/_cjs/tempo/GatewayDecorator.js.map +1 -0
- package/_cjs/tempo/actions/ai.js +69 -0
- package/_cjs/tempo/actions/ai.js.map +1 -0
- package/_cjs/tempo/actions/bucket.js +85 -0
- package/_cjs/tempo/actions/bucket.js.map +1 -0
- package/_cjs/tempo/actions/compute.js +165 -0
- package/_cjs/tempo/actions/compute.js.map +1 -0
- package/_cjs/tempo/actions/gateway.js +8 -0
- package/_cjs/tempo/actions/gateway.js.map +1 -0
- package/_cjs/tempo/actions/index.js +6 -1
- package/_cjs/tempo/actions/index.js.map +1 -1
- package/_cjs/tempo/actions/kv.js +44 -0
- package/_cjs/tempo/actions/kv.js.map +1 -0
- package/_cjs/tempo/index.js +4 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/tempo/internal/ndjson.js +43 -0
- package/_cjs/tempo/internal/ndjson.js.map +1 -0
- package/_cjs/utils/buildRequest.js +4 -0
- package/_cjs/utils/buildRequest.js.map +1 -1
- package/_cjs/utils/hash/toSignatureHash.js +10 -1
- package/_cjs/utils/hash/toSignatureHash.js.map +1 -1
- package/_cjs/utils/rpc/http.js +6 -3
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/rpc/socket.js +20 -9
- package/_cjs/utils/rpc/socket.js.map +1 -1
- package/_cjs/zksync/actions/finalizeWithdrawal.js +4 -2
- package/_cjs/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_cjs/zksync/actions/isWithdrawalFinalized.js +4 -5
- package/_cjs/zksync/actions/isWithdrawalFinalized.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/tempo/Gateway.js +294 -0
- package/_esm/tempo/Gateway.js.map +1 -0
- package/_esm/tempo/GatewayDecorator.js +207 -0
- package/_esm/tempo/GatewayDecorator.js.map +1 -0
- package/_esm/tempo/actions/ai.js +132 -0
- package/_esm/tempo/actions/ai.js.map +1 -0
- package/_esm/tempo/actions/bucket.js +181 -0
- package/_esm/tempo/actions/bucket.js.map +1 -0
- package/_esm/tempo/actions/compute.js +424 -0
- package/_esm/tempo/actions/compute.js.map +1 -0
- package/_esm/tempo/actions/gateway.js +22 -0
- package/_esm/tempo/actions/gateway.js.map +1 -0
- package/_esm/tempo/actions/index.js +10 -0
- package/_esm/tempo/actions/index.js.map +1 -1
- package/_esm/tempo/actions/kv.js +124 -0
- package/_esm/tempo/actions/kv.js.map +1 -0
- package/_esm/tempo/index.js +9 -0
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/tempo/internal/ndjson.js +45 -0
- package/_esm/tempo/internal/ndjson.js.map +1 -0
- package/_esm/utils/buildRequest.js +6 -0
- package/_esm/utils/buildRequest.js.map +1 -1
- package/_esm/utils/hash/toSignatureHash.js +11 -1
- package/_esm/utils/hash/toSignatureHash.js.map +1 -1
- package/_esm/utils/rpc/http.js +11 -3
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/rpc/socket.js +24 -9
- package/_esm/utils/rpc/socket.js.map +1 -1
- package/_esm/zksync/actions/finalizeWithdrawal.js +5 -2
- package/_esm/zksync/actions/finalizeWithdrawal.js.map +1 -1
- package/_esm/zksync/actions/isWithdrawalFinalized.js +5 -5
- package/_esm/zksync/actions/isWithdrawalFinalized.js.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/tempo/Gateway.d.ts +337 -0
- package/_types/tempo/Gateway.d.ts.map +1 -0
- package/_types/tempo/GatewayDecorator.d.ts +635 -0
- package/_types/tempo/GatewayDecorator.d.ts.map +1 -0
- package/_types/tempo/actions/ai.d.ts +145 -0
- package/_types/tempo/actions/ai.d.ts.map +1 -0
- package/_types/tempo/actions/bucket.d.ts +210 -0
- package/_types/tempo/actions/bucket.d.ts.map +1 -0
- package/_types/tempo/actions/compute.d.ts +628 -0
- package/_types/tempo/actions/compute.d.ts.map +1 -0
- package/_types/tempo/actions/gateway.d.ts +25 -0
- package/_types/tempo/actions/gateway.d.ts.map +1 -0
- package/_types/tempo/actions/index.d.ts +10 -0
- package/_types/tempo/actions/index.d.ts.map +1 -1
- package/_types/tempo/actions/kv.d.ts +167 -0
- package/_types/tempo/actions/kv.d.ts.map +1 -0
- package/_types/tempo/index.d.ts +11 -0
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/tempo/internal/ndjson.d.ts +9 -0
- package/_types/tempo/internal/ndjson.d.ts.map +1 -0
- package/_types/utils/buildRequest.d.ts.map +1 -1
- package/_types/utils/hash/toSignatureHash.d.ts +1 -1
- package/_types/utils/hash/toSignatureHash.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/rpc/socket.d.ts.map +1 -1
- package/errors/version.ts +1 -1
- package/package.json +5 -1
- package/tempo/Gateway.ts +477 -0
- package/tempo/GatewayDecorator.ts +909 -0
- package/tempo/actions/ai.ts +250 -0
- package/tempo/actions/bucket.ts +324 -0
- package/tempo/actions/compute.ts +894 -0
- package/tempo/actions/gateway.ts +33 -0
- package/tempo/actions/index.ts +10 -0
- package/tempo/actions/kv.ts +229 -0
- package/tempo/index.ts +12 -0
- package/tempo/internal/ndjson.ts +51 -0
- package/utils/buildRequest.ts +4 -0
- package/utils/hash/toSignatureHash.ts +12 -2
- package/utils/rpc/http.ts +11 -3
- package/utils/rpc/socket.ts +28 -15
- package/zksync/actions/finalizeWithdrawal.ts +5 -2
- package/zksync/actions/isWithdrawalFinalized.ts +5 -5
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
import * as Gateway from '../Gateway.js';
|
|
2
|
+
/**
|
|
3
|
+
* GPU types a Gateway sandbox can run on.
|
|
4
|
+
*
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
export type Gpu = 'A100-40GB' | 'A100-80GB' | 'A10G' | 'B200' | 'H100' | 'H200' | 'L4' | 'L40S' | 'T4';
|
|
8
|
+
/**
|
|
9
|
+
* Gateway sandbox.
|
|
10
|
+
*
|
|
11
|
+
* @experimental
|
|
12
|
+
*/
|
|
13
|
+
export type Sandbox = {
|
|
14
|
+
/** Creation time as a Unix timestamp in milliseconds. */
|
|
15
|
+
createdAt: number;
|
|
16
|
+
/** End of the paid lifetime as a Unix timestamp in milliseconds. */
|
|
17
|
+
expiresAt: number;
|
|
18
|
+
/** GPU, such as `H100` or `H100:2`, or `null` on CPU. */
|
|
19
|
+
gpu: string | null;
|
|
20
|
+
/** Container image, or the snapshot it started from. */
|
|
21
|
+
image: string;
|
|
22
|
+
/** End of the paid lease as a Unix timestamp in milliseconds. */
|
|
23
|
+
paidUntil: number;
|
|
24
|
+
/** Sandbox ID. */
|
|
25
|
+
sandboxId: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Starts a sandbox that can live up to `timeout` seconds, from a container image
|
|
29
|
+
* with optional `apt/pip` layers or from a snapshot. Compute is metered: creation
|
|
30
|
+
* pays for `lease` seconds at the sandbox's GPU, CPU, and memory rate (see
|
|
31
|
+
* `Gateway.getCapabilities`), and `renew` pays for more. `ports` are served
|
|
32
|
+
* over public HTTPS tunnels returned in `tunnels`.
|
|
33
|
+
*
|
|
34
|
+
* @experimental
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
39
|
+
*
|
|
40
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
41
|
+
*
|
|
42
|
+
* const sandbox = await Actions.compute.create(gateway, {
|
|
43
|
+
* gpu: 'T4',
|
|
44
|
+
* image: 'pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime',
|
|
45
|
+
* ports: [8000],
|
|
46
|
+
* timeout: 1200,
|
|
47
|
+
* })
|
|
48
|
+
* const url = sandbox.tunnels[8000]
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param gateway - Gateway connection.
|
|
52
|
+
* @param parameters - Parameters.
|
|
53
|
+
* @returns The sandbox and its tunnels.
|
|
54
|
+
*/
|
|
55
|
+
export declare function create<const ports extends readonly number[] = readonly []>(gateway: Gateway.Gateway, parameters?: create.Parameters<ports>): Promise<create.ReturnValue<ports>>;
|
|
56
|
+
export declare namespace create {
|
|
57
|
+
type Parameters<ports extends readonly number[] = readonly number[]> = {
|
|
58
|
+
/** Block all network access from the sandbox. */
|
|
59
|
+
blockNetwork?: boolean | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* CPU cores.
|
|
62
|
+
*
|
|
63
|
+
* @default 1
|
|
64
|
+
*/
|
|
65
|
+
cpu?: number | undefined;
|
|
66
|
+
/** Environment variables. */
|
|
67
|
+
env?: Record<string, string> | undefined;
|
|
68
|
+
/** Seconds without activity after which the sandbox ends. */
|
|
69
|
+
idleTimeout?: number | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Seconds paid at creation. Pay for more with `renew`; the sandbox is
|
|
72
|
+
* terminated about a minute after its lease ends.
|
|
73
|
+
*
|
|
74
|
+
* @default 300, or `timeout` if shorter
|
|
75
|
+
*/
|
|
76
|
+
lease?: number | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Memory in MiB.
|
|
79
|
+
*
|
|
80
|
+
* @default 1024
|
|
81
|
+
*/
|
|
82
|
+
memory?: number | undefined;
|
|
83
|
+
/** Ports to serve over public HTTPS tunnels, up to 4. */
|
|
84
|
+
ports?: ports | undefined;
|
|
85
|
+
/** Signal to abort the request. */
|
|
86
|
+
signal?: AbortSignal | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Longest lifetime in seconds, whatever is paid.
|
|
89
|
+
*
|
|
90
|
+
* @default 300
|
|
91
|
+
*/
|
|
92
|
+
timeout?: number | undefined;
|
|
93
|
+
/** Working directory. */
|
|
94
|
+
workdir?: string | undefined;
|
|
95
|
+
} & ({
|
|
96
|
+
/** Debian packages to install on the image. */
|
|
97
|
+
apt?: readonly string[] | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Container image.
|
|
100
|
+
*
|
|
101
|
+
* @default 'python:3.12-slim'
|
|
102
|
+
*/
|
|
103
|
+
image?: string | undefined;
|
|
104
|
+
/** pip requirements to install on the image. */
|
|
105
|
+
pip?: readonly string[] | undefined;
|
|
106
|
+
snapshot?: undefined;
|
|
107
|
+
} | {
|
|
108
|
+
apt?: undefined;
|
|
109
|
+
image?: undefined;
|
|
110
|
+
pip?: undefined;
|
|
111
|
+
/** Snapshot ID from `snapshot` to start from instead of an image. */
|
|
112
|
+
snapshot: string;
|
|
113
|
+
}) & ({
|
|
114
|
+
/** GPU type. Omit to run on CPU. */
|
|
115
|
+
gpu: Gpu;
|
|
116
|
+
/**
|
|
117
|
+
* Number of GPUs.
|
|
118
|
+
*
|
|
119
|
+
* @default 1
|
|
120
|
+
*/
|
|
121
|
+
gpuCount?: number | undefined;
|
|
122
|
+
} | {
|
|
123
|
+
gpu?: undefined;
|
|
124
|
+
gpuCount?: undefined;
|
|
125
|
+
});
|
|
126
|
+
type ReturnValue<ports extends readonly number[] = readonly number[]> = Sandbox & {
|
|
127
|
+
/** Public HTTPS URL of each requested port. */
|
|
128
|
+
tunnels: {
|
|
129
|
+
[port in ports[number] as `${port}`]: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Runs a command in a sandbox and waits up to `timeout` seconds (at most 120)
|
|
136
|
+
* for it to finish. Use `spawn` for longer jobs. Paid per request.
|
|
137
|
+
*
|
|
138
|
+
* @experimental
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
143
|
+
*
|
|
144
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
145
|
+
*
|
|
146
|
+
* const { exitCode, stdout } = await Actions.compute.exec(gateway, {
|
|
147
|
+
* command: ['python', '-c', 'print(1 + 1)'],
|
|
148
|
+
* sandboxId: sandbox.sandboxId,
|
|
149
|
+
* })
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @param gateway - Gateway connection.
|
|
153
|
+
* @param parameters - Parameters.
|
|
154
|
+
* @returns The command's output and exit code.
|
|
155
|
+
*/
|
|
156
|
+
export declare function exec(gateway: Gateway.Gateway, parameters: exec.Parameters): Promise<exec.ReturnValue>;
|
|
157
|
+
export declare namespace exec {
|
|
158
|
+
type Parameters = {
|
|
159
|
+
/** Program and arguments, run without a shell. */
|
|
160
|
+
command: readonly [string, ...string[]];
|
|
161
|
+
/** Environment variables. */
|
|
162
|
+
env?: Record<string, string> | undefined;
|
|
163
|
+
/** Sandbox ID. */
|
|
164
|
+
sandboxId: string;
|
|
165
|
+
/** Signal to abort the request. */
|
|
166
|
+
signal?: AbortSignal | undefined;
|
|
167
|
+
/**
|
|
168
|
+
* Command timeout in seconds, at most 120.
|
|
169
|
+
*
|
|
170
|
+
* @default 30
|
|
171
|
+
*/
|
|
172
|
+
timeout?: number | undefined;
|
|
173
|
+
/** Working directory. */
|
|
174
|
+
workdir?: string | undefined;
|
|
175
|
+
};
|
|
176
|
+
type ReturnValue = {
|
|
177
|
+
/** Exit code, or `null` if the command did not exit. */
|
|
178
|
+
exitCode: number | null;
|
|
179
|
+
/** Standard error. */
|
|
180
|
+
stderr: string;
|
|
181
|
+
/** Standard output. */
|
|
182
|
+
stdout: string;
|
|
183
|
+
/** Whether the command was stopped at its timeout. */
|
|
184
|
+
timedOut: boolean;
|
|
185
|
+
/** Whether output was cut at 1 MiB per stream. */
|
|
186
|
+
truncated: boolean;
|
|
187
|
+
};
|
|
188
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Lists the app's sandboxes that have not ended. Paid per request.
|
|
192
|
+
*
|
|
193
|
+
* @experimental
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```ts
|
|
197
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
198
|
+
*
|
|
199
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
200
|
+
*
|
|
201
|
+
* const { sandboxes } = await Actions.compute.list(gateway)
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @param gateway - Gateway connection.
|
|
205
|
+
* @param parameters - Parameters.
|
|
206
|
+
* @returns A page of sandboxes and the next cursor.
|
|
207
|
+
*/
|
|
208
|
+
export declare function list(gateway: Gateway.Gateway, parameters?: list.Parameters): Promise<list.ReturnValue>;
|
|
209
|
+
export declare namespace list {
|
|
210
|
+
type Parameters = {
|
|
211
|
+
/** Cursor from a previous page. */
|
|
212
|
+
cursor?: string | undefined;
|
|
213
|
+
/** Maximum sandboxes per page. */
|
|
214
|
+
limit?: number | undefined;
|
|
215
|
+
/** Signal to abort the request. */
|
|
216
|
+
signal?: AbortSignal | undefined;
|
|
217
|
+
};
|
|
218
|
+
type ReturnValue = {
|
|
219
|
+
/** Cursor of the next page, or `null` on the last page. */
|
|
220
|
+
cursor: string | null;
|
|
221
|
+
/** Sandboxes on this page. */
|
|
222
|
+
sandboxes: readonly Sandbox[];
|
|
223
|
+
};
|
|
224
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Reads a file from a sandbox, from `offset` for up to `length` bytes (8 MiB
|
|
228
|
+
* per request). Returns `null` when the file does not exist. Paid per request.
|
|
229
|
+
*
|
|
230
|
+
* @experimental
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
235
|
+
*
|
|
236
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
237
|
+
*
|
|
238
|
+
* const log = await Actions.compute.read(gateway, {
|
|
239
|
+
* offset: 0,
|
|
240
|
+
* path: job.logPath,
|
|
241
|
+
* sandboxId: sandbox.sandboxId,
|
|
242
|
+
* })
|
|
243
|
+
* const text = log && (await new Response(log.body).text())
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* @param gateway - Gateway connection.
|
|
247
|
+
* @param parameters - Parameters.
|
|
248
|
+
* @returns The bytes read and the whole file size, or `null`.
|
|
249
|
+
*/
|
|
250
|
+
export declare function read(gateway: Gateway.Gateway, parameters: read.Parameters): Promise<read.ReturnValue>;
|
|
251
|
+
export declare namespace read {
|
|
252
|
+
type Parameters = {
|
|
253
|
+
/** Maximum bytes to read, at most 8 MiB. */
|
|
254
|
+
length?: number | undefined;
|
|
255
|
+
/**
|
|
256
|
+
* Byte offset to read from.
|
|
257
|
+
*
|
|
258
|
+
* @default 0
|
|
259
|
+
*/
|
|
260
|
+
offset?: number | undefined;
|
|
261
|
+
/** Absolute file path. */
|
|
262
|
+
path: string;
|
|
263
|
+
/** Sandbox ID. */
|
|
264
|
+
sandboxId: string;
|
|
265
|
+
/** Signal to abort the request. */
|
|
266
|
+
signal?: AbortSignal | undefined;
|
|
267
|
+
};
|
|
268
|
+
type ReturnValue = {
|
|
269
|
+
/** Bytes read. */
|
|
270
|
+
body: ReadableStream<Uint8Array>;
|
|
271
|
+
/** Offset the bytes start at. */
|
|
272
|
+
offset: number;
|
|
273
|
+
/** Size of the whole file in bytes. */
|
|
274
|
+
size: number;
|
|
275
|
+
} | null;
|
|
276
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Saves a sandbox's filesystem as a snapshot kept for 30 days. Pass it to
|
|
280
|
+
* `create` to start new sandboxes from it. Paid per request.
|
|
281
|
+
*
|
|
282
|
+
* @experimental
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
287
|
+
*
|
|
288
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
289
|
+
*
|
|
290
|
+
* const { snapshot } = await Actions.compute.snapshot(gateway, {
|
|
291
|
+
* sandboxId: sandbox.sandboxId,
|
|
292
|
+
* })
|
|
293
|
+
* const copy = await Actions.compute.create(gateway, { snapshot })
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @param gateway - Gateway connection.
|
|
297
|
+
* @param parameters - Parameters.
|
|
298
|
+
* @returns The snapshot ID and its expiry.
|
|
299
|
+
*/
|
|
300
|
+
export declare function snapshot(gateway: Gateway.Gateway, parameters: snapshot.Parameters): Promise<snapshot.ReturnValue>;
|
|
301
|
+
export declare namespace snapshot {
|
|
302
|
+
type Parameters = {
|
|
303
|
+
/** Sandbox ID. */
|
|
304
|
+
sandboxId: string;
|
|
305
|
+
/** Signal to abort the request. */
|
|
306
|
+
signal?: AbortSignal | undefined;
|
|
307
|
+
};
|
|
308
|
+
type ReturnValue = {
|
|
309
|
+
/** Creation time as a Unix timestamp in milliseconds. */
|
|
310
|
+
createdAt: number;
|
|
311
|
+
/** Expiry as a Unix timestamp in milliseconds. */
|
|
312
|
+
expiresAt: number;
|
|
313
|
+
/** Snapshot ID. */
|
|
314
|
+
snapshot: string;
|
|
315
|
+
};
|
|
316
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Starts a command in the background and returns at once. Its output goes to
|
|
320
|
+
* `logPath` and its exit code to `exitPath` when it finishes; poll both with
|
|
321
|
+
* `read`. Paid per request.
|
|
322
|
+
*
|
|
323
|
+
* @experimental
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```ts
|
|
327
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
328
|
+
*
|
|
329
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
330
|
+
*
|
|
331
|
+
* const job = await Actions.compute.spawn(gateway, {
|
|
332
|
+
* command: ['python', 'train.py'],
|
|
333
|
+
* sandboxId: sandbox.sandboxId,
|
|
334
|
+
* })
|
|
335
|
+
* ```
|
|
336
|
+
*
|
|
337
|
+
* @param gateway - Gateway connection.
|
|
338
|
+
* @param parameters - Parameters.
|
|
339
|
+
* @returns The process ID and the paths of its log and exit code.
|
|
340
|
+
*/
|
|
341
|
+
export declare function spawn(gateway: Gateway.Gateway, parameters: spawn.Parameters): Promise<spawn.ReturnValue>;
|
|
342
|
+
export declare namespace spawn {
|
|
343
|
+
type Parameters = {
|
|
344
|
+
/** Program and arguments, run without a shell. */
|
|
345
|
+
command: readonly [string, ...string[]];
|
|
346
|
+
/** Environment variables. */
|
|
347
|
+
env?: Record<string, string> | undefined;
|
|
348
|
+
/** Sandbox ID. */
|
|
349
|
+
sandboxId: string;
|
|
350
|
+
/** Signal to abort the request. */
|
|
351
|
+
signal?: AbortSignal | undefined;
|
|
352
|
+
/** Working directory. */
|
|
353
|
+
workdir?: string | undefined;
|
|
354
|
+
};
|
|
355
|
+
type ReturnValue = {
|
|
356
|
+
/** File that holds the exit code once the command finishes. */
|
|
357
|
+
exitPath: string;
|
|
358
|
+
/** File with the command's standard output and error. */
|
|
359
|
+
logPath: string;
|
|
360
|
+
/** Process ID. */
|
|
361
|
+
pid: number;
|
|
362
|
+
};
|
|
363
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Reads whether a sandbox is running. Paid per request.
|
|
367
|
+
*
|
|
368
|
+
* @experimental
|
|
369
|
+
*
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
373
|
+
*
|
|
374
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
375
|
+
*
|
|
376
|
+
* const { status } = await Actions.compute.status(gateway, {
|
|
377
|
+
* sandboxId: sandbox.sandboxId,
|
|
378
|
+
* })
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @param gateway - Gateway connection.
|
|
382
|
+
* @param parameters - Parameters.
|
|
383
|
+
* @returns The sandbox and its status.
|
|
384
|
+
*/
|
|
385
|
+
export declare function status(gateway: Gateway.Gateway, parameters: status.Parameters): Promise<status.ReturnValue>;
|
|
386
|
+
export declare namespace status {
|
|
387
|
+
type Parameters = {
|
|
388
|
+
/** Sandbox ID. */
|
|
389
|
+
sandboxId: string;
|
|
390
|
+
/** Signal to abort the request. */
|
|
391
|
+
signal?: AbortSignal | undefined;
|
|
392
|
+
};
|
|
393
|
+
type ReturnValue = Sandbox & {
|
|
394
|
+
/** Exit code once terminated, otherwise `null`. */
|
|
395
|
+
exitCode: number | null;
|
|
396
|
+
/** Sandbox status. */
|
|
397
|
+
status: 'running' | 'terminated';
|
|
398
|
+
};
|
|
399
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Terminates a sandbox. The Gateway credits the unused rest of its lease back
|
|
403
|
+
* to the payment channel. Paid per request.
|
|
404
|
+
*
|
|
405
|
+
* @experimental
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```ts
|
|
409
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
410
|
+
*
|
|
411
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
412
|
+
*
|
|
413
|
+
* await Actions.compute.terminate(gateway, { sandboxId: sandbox.sandboxId })
|
|
414
|
+
* ```
|
|
415
|
+
*
|
|
416
|
+
* @param gateway - Gateway connection.
|
|
417
|
+
* @param parameters - Parameters.
|
|
418
|
+
* @returns The final status.
|
|
419
|
+
*/
|
|
420
|
+
export declare function terminate(gateway: Gateway.Gateway, parameters: terminate.Parameters): Promise<terminate.ReturnValue>;
|
|
421
|
+
export declare namespace terminate {
|
|
422
|
+
type Parameters = {
|
|
423
|
+
/** Sandbox ID. */
|
|
424
|
+
sandboxId: string;
|
|
425
|
+
/** Signal to abort the request. */
|
|
426
|
+
signal?: AbortSignal | undefined;
|
|
427
|
+
};
|
|
428
|
+
type ReturnValue = {
|
|
429
|
+
/** Exit code of the sandbox, or `null`. */
|
|
430
|
+
exitCode: number | null;
|
|
431
|
+
/** Amount credited back for the unused lease, in currency units. */
|
|
432
|
+
refunded: number;
|
|
433
|
+
/** Sandbox ID. */
|
|
434
|
+
sandboxId: string;
|
|
435
|
+
/** Sandbox status. */
|
|
436
|
+
status: 'terminated';
|
|
437
|
+
};
|
|
438
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Writes a file into a sandbox at an absolute path, creating its directories.
|
|
442
|
+
* Up to 8 MiB. Paid per request.
|
|
443
|
+
*
|
|
444
|
+
* @experimental
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```ts
|
|
448
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
449
|
+
*
|
|
450
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
451
|
+
*
|
|
452
|
+
* await Actions.compute.write(gateway, {
|
|
453
|
+
* path: '/root/train.py',
|
|
454
|
+
* sandboxId: sandbox.sandboxId,
|
|
455
|
+
* value: 'print("training")',
|
|
456
|
+
* })
|
|
457
|
+
* ```
|
|
458
|
+
*
|
|
459
|
+
* @param gateway - Gateway connection.
|
|
460
|
+
* @param parameters - Parameters.
|
|
461
|
+
* @returns The path and size written.
|
|
462
|
+
*/
|
|
463
|
+
export declare function write(gateway: Gateway.Gateway, parameters: write.Parameters): Promise<write.ReturnValue>;
|
|
464
|
+
export declare namespace write {
|
|
465
|
+
type Parameters = {
|
|
466
|
+
/** Absolute file path. */
|
|
467
|
+
path: string;
|
|
468
|
+
/** Sandbox ID. */
|
|
469
|
+
sandboxId: string;
|
|
470
|
+
/** Signal to abort the request. */
|
|
471
|
+
signal?: AbortSignal | undefined;
|
|
472
|
+
/** File contents. */
|
|
473
|
+
value: Blob | Uint8Array | ArrayBuffer | string;
|
|
474
|
+
};
|
|
475
|
+
type ReturnValue = {
|
|
476
|
+
/** Absolute file path. */
|
|
477
|
+
path: string;
|
|
478
|
+
/** Bytes written. */
|
|
479
|
+
size: number;
|
|
480
|
+
};
|
|
481
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Pays for more seconds of a sandbox at its per-second rate, up to its
|
|
485
|
+
* `timeout`. A sandbox whose `paidUntil` passes is terminated within about a
|
|
486
|
+
* minute. Paid per request.
|
|
487
|
+
*
|
|
488
|
+
* @experimental
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```ts
|
|
492
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
493
|
+
*
|
|
494
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
495
|
+
*
|
|
496
|
+
* const { paidUntil } = await Actions.compute.renew(gateway, {
|
|
497
|
+
* sandboxId: sandbox.sandboxId,
|
|
498
|
+
* seconds: 300,
|
|
499
|
+
* })
|
|
500
|
+
* ```
|
|
501
|
+
*
|
|
502
|
+
* @param gateway - Gateway connection.
|
|
503
|
+
* @param parameters - Parameters.
|
|
504
|
+
* @returns The sandbox with its new `paidUntil`.
|
|
505
|
+
*/
|
|
506
|
+
export declare function renew(gateway: Gateway.Gateway, parameters: renew.Parameters): Promise<renew.ReturnValue>;
|
|
507
|
+
export declare namespace renew {
|
|
508
|
+
type Parameters = {
|
|
509
|
+
/** Sandbox ID. */
|
|
510
|
+
sandboxId: string;
|
|
511
|
+
/** Seconds to pay for. */
|
|
512
|
+
seconds: number;
|
|
513
|
+
/** Signal to abort the request. */
|
|
514
|
+
signal?: AbortSignal | undefined;
|
|
515
|
+
};
|
|
516
|
+
type ReturnValue = Sandbox;
|
|
517
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Runs a command in a sandbox and yields its output as it is written, then
|
|
521
|
+
* its exit. Up to `timeout` seconds (at most 3600). Paid per request.
|
|
522
|
+
*
|
|
523
|
+
* @experimental
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```ts
|
|
527
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
528
|
+
*
|
|
529
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
530
|
+
*
|
|
531
|
+
* for await (const event of Actions.compute.stream(gateway, {
|
|
532
|
+
* command: ['python', 'train.py'],
|
|
533
|
+
* sandboxId: sandbox.sandboxId,
|
|
534
|
+
* })) {
|
|
535
|
+
* if (event.type === 'exit') console.log('exit', event.exitCode)
|
|
536
|
+
* else process.stdout.write(event.data)
|
|
537
|
+
* }
|
|
538
|
+
* ```
|
|
539
|
+
*
|
|
540
|
+
* @param gateway - Gateway connection.
|
|
541
|
+
* @param parameters - Parameters.
|
|
542
|
+
* @returns Output and exit events.
|
|
543
|
+
*/
|
|
544
|
+
export declare function stream(gateway: Gateway.Gateway, parameters: stream.Parameters): AsyncGenerator<stream.Event>;
|
|
545
|
+
export declare namespace stream {
|
|
546
|
+
type Parameters = Omit<exec.Parameters, 'timeout'> & {
|
|
547
|
+
/**
|
|
548
|
+
* Command timeout in seconds, at most `limits.streamSeconds` (3600).
|
|
549
|
+
*
|
|
550
|
+
* @default 600
|
|
551
|
+
*/
|
|
552
|
+
timeout?: number | undefined;
|
|
553
|
+
};
|
|
554
|
+
type Event = {
|
|
555
|
+
/** Output text. */
|
|
556
|
+
data: string;
|
|
557
|
+
/** Output stream. */
|
|
558
|
+
type: 'stderr' | 'stdout';
|
|
559
|
+
} | {
|
|
560
|
+
/** Exit code, or `null` if the command did not exit. */
|
|
561
|
+
exitCode: number | null;
|
|
562
|
+
/** Whether the command was stopped at its timeout. */
|
|
563
|
+
timedOut: boolean;
|
|
564
|
+
type: 'exit';
|
|
565
|
+
};
|
|
566
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Follows the log of a command started with `spawn` from `offset` and yields
|
|
570
|
+
* it as it grows, then the exit code. After an hour it yields `end` with the
|
|
571
|
+
* offset to resume from. Paid per request.
|
|
572
|
+
*
|
|
573
|
+
* @experimental
|
|
574
|
+
*
|
|
575
|
+
* @example
|
|
576
|
+
* ```ts
|
|
577
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
578
|
+
*
|
|
579
|
+
* const gateway = Gateway.from({ fetch: mppx.fetch })
|
|
580
|
+
*
|
|
581
|
+
* for await (const event of Actions.compute.logs(gateway, {
|
|
582
|
+
* logPath: job.logPath,
|
|
583
|
+
* sandboxId: sandbox.sandboxId,
|
|
584
|
+
* })) {
|
|
585
|
+
* if (event.type === 'log') process.stdout.write(event.data)
|
|
586
|
+
* }
|
|
587
|
+
* ```
|
|
588
|
+
*
|
|
589
|
+
* @param gateway - Gateway connection.
|
|
590
|
+
* @param parameters - Parameters.
|
|
591
|
+
* @returns Log, exit, and end events.
|
|
592
|
+
*/
|
|
593
|
+
export declare function logs(gateway: Gateway.Gateway, parameters: logs.Parameters): AsyncGenerator<logs.Event>;
|
|
594
|
+
export declare namespace logs {
|
|
595
|
+
type Parameters = {
|
|
596
|
+
/** Log path returned by `spawn`. */
|
|
597
|
+
logPath: string;
|
|
598
|
+
/**
|
|
599
|
+
* Byte offset to start from.
|
|
600
|
+
*
|
|
601
|
+
* @default 0
|
|
602
|
+
*/
|
|
603
|
+
offset?: number | undefined;
|
|
604
|
+
/** Sandbox ID. */
|
|
605
|
+
sandboxId: string;
|
|
606
|
+
/** Signal to abort the request. */
|
|
607
|
+
signal?: AbortSignal | undefined;
|
|
608
|
+
};
|
|
609
|
+
type Event = {
|
|
610
|
+
/** Log text. */
|
|
611
|
+
data: string;
|
|
612
|
+
/** Byte offset after this chunk. */
|
|
613
|
+
offset: number;
|
|
614
|
+
type: 'log';
|
|
615
|
+
} | {
|
|
616
|
+
/** Exit code of the command. */
|
|
617
|
+
exitCode: number | null;
|
|
618
|
+
/** Byte offset at the end of the log. */
|
|
619
|
+
offset: number;
|
|
620
|
+
type: 'exit';
|
|
621
|
+
} | {
|
|
622
|
+
/** Byte offset to resume from. */
|
|
623
|
+
offset: number;
|
|
624
|
+
type: 'end';
|
|
625
|
+
};
|
|
626
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
627
|
+
}
|
|
628
|
+
//# sourceMappingURL=compute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../../tempo/actions/compute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAGxC;;;;GAIG;AACH,MAAM,MAAM,GAAG,GACX,WAAW,GACX,WAAW,GACX,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,IAAI,GACJ,MAAM,GACN,IAAI,CAAA;AAER;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,MAAM,CAC1B,KAAK,CAAC,KAAK,SAAS,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,EAEnD,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,UAAU,GAAE,MAAM,CAAC,UAAU,CAAC,KAAK,CAAkC,GACpE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAyCpC;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,KAAK,UAAU,CAAC,K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sDAAsD;QACtD,QAAQ,EAAE,OAAO,CAAA;QACjB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IAEL,KAAK,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAA;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAuB,IAAI,CACzB,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,UAAU,EAAE,IAAI,CAAC,UAAU,GAC1B,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAQ5B;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,KAAK,UAAU,GAAG;QAChB,oCAAoC;QACpC,OAAO,EAAE,MAAM,CAAA;QACf;;;;WAIG;QACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAC3B,kBAAkB;QAClB,SAAS,EAAE,MAAM,CAAA;QACjB,mCAAmC;QACnC,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;KACjC,CAAA;IAED,KAAK,KAAK,GACN;QACE,gBAAgB;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,oCAAoC;QACpC,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,KAAK,CAAA;KACZ,GACD;QACE,gCAAgC;QAChC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;QACvB,yCAAyC;QACzC,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAA;KACb,GACD;QACE,kCAAkC;QAClC,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,KAAK,CAAA;KACZ,CAAA;IAEL,KAAK,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAA;CAC3C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Gateway from '../Gateway.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the Gateway's free discovery document: chain, currencies, prices,
|
|
4
|
+
* limits, and models.
|
|
5
|
+
*
|
|
6
|
+
* @experimental
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { Actions, Gateway } from 'viem/tempo'
|
|
11
|
+
*
|
|
12
|
+
* const capabilities = await Actions.gateway.getCapabilities(Gateway.from())
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param gateway - Gateway connection.
|
|
16
|
+
* @param parameters - Parameters.
|
|
17
|
+
* @returns The Gateway capabilities.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCapabilities(gateway: Gateway.Gateway, parameters?: getCapabilities.Parameters): Promise<getCapabilities.ReturnValue>;
|
|
20
|
+
export declare namespace getCapabilities {
|
|
21
|
+
type Parameters = Gateway.getCapabilities.Options;
|
|
22
|
+
type ReturnValue = Gateway.Capabilities;
|
|
23
|
+
type ErrorType = Gateway.request.ErrorType;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../tempo/actions/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,CAAC,OAAO,EACxB,UAAU,GAAE,eAAe,CAAC,UAAe,GAC1C,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CAEtC;AAED,MAAM,CAAC,OAAO,WAAW,eAAe,CAAC;IACvC,KAAK,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAA;IAEjD,KAAK,WAAW,GAAG,OAAO,CAAC,YAAY,CAAA;IAEvC,KAAK,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAA;CAC3C"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
export * as accessKey from './accessKey.js';
|
|
2
2
|
export * as accounts from './accounts.js';
|
|
3
|
+
/** @experimental */
|
|
4
|
+
export * as ai from './ai.js';
|
|
3
5
|
export * as amm from './amm.js';
|
|
6
|
+
/** @experimental */
|
|
7
|
+
export * as bucket from './bucket.js';
|
|
4
8
|
export * as channel from './channel.js';
|
|
9
|
+
/** @experimental */
|
|
10
|
+
export * as compute from './compute.js';
|
|
5
11
|
export * as dex from './dex.js';
|
|
6
12
|
export * as earn from './earn.js';
|
|
7
13
|
export * as faucet from './faucet.js';
|
|
8
14
|
export * as fee from './fee.js';
|
|
15
|
+
/** @experimental */
|
|
16
|
+
export * as gateway from './gateway.js';
|
|
17
|
+
/** @experimental */
|
|
18
|
+
export * as kv from './kv.js';
|
|
9
19
|
export * as nonce from './nonce.js';
|
|
10
20
|
export * as policy from './policy.js';
|
|
11
21
|
export * as propAmm from './propAmm.js';
|