@hatchet-dev/sandbox 0.1.3 → 0.1.5
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 +16 -0
- package/README.md +10 -10
- package/dist/index.cjs +202 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -26
- package/dist/index.d.ts +9 -26
- package/dist/index.js +202 -118
- package/dist/index.js.map +1 -1
- package/dist/wire.cjs +51 -0
- package/dist/wire.cjs.map +1 -0
- package/dist/wire.d.cts +52 -0
- package/dist/wire.d.ts +52 -0
- package/dist/wire.js +44 -0
- package/dist/wire.js.map +1 -0
- package/package.json +14 -6
package/dist/wire.cjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/wire.ts
|
|
6
|
+
var positiveInt = zod.z.int().positive();
|
|
7
|
+
var metadata = zod.z.record(zod.z.string(), zod.z.string());
|
|
8
|
+
var resources = zod.z.strictObject({
|
|
9
|
+
vcpu: positiveInt.optional(),
|
|
10
|
+
memoryMib: positiveInt.optional(),
|
|
11
|
+
diskMib: positiveInt.optional()
|
|
12
|
+
});
|
|
13
|
+
var turnInput = zod.z.strictObject({
|
|
14
|
+
fn: zod.z.string().min(1),
|
|
15
|
+
input: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
16
|
+
sandboxId: zod.z.string().min(1).optional(),
|
|
17
|
+
image: zod.z.string().min(1).optional(),
|
|
18
|
+
snapshotId: zod.z.string().min(1).optional(),
|
|
19
|
+
metadata: metadata.optional(),
|
|
20
|
+
idleTtlMs: positiveInt.optional(),
|
|
21
|
+
inheritMetadata: zod.z.boolean().optional(),
|
|
22
|
+
resources: resources.optional()
|
|
23
|
+
});
|
|
24
|
+
var turnResult = zod.z.looseObject({
|
|
25
|
+
output: zod.z.looseObject({}),
|
|
26
|
+
sandboxId: zod.z.string(),
|
|
27
|
+
snapshotId: zod.z.string().optional(),
|
|
28
|
+
timings: zod.z.record(zod.z.string(), zod.z.number()).optional()
|
|
29
|
+
});
|
|
30
|
+
var commandOutput = zod.z.looseObject({
|
|
31
|
+
stdout: zod.z.string(),
|
|
32
|
+
stderr: zod.z.string(),
|
|
33
|
+
exitCode: zod.z.int()
|
|
34
|
+
});
|
|
35
|
+
var sandboxInfo = zod.z.looseObject({
|
|
36
|
+
sandboxId: zod.z.string(),
|
|
37
|
+
metadata: metadata.optional(),
|
|
38
|
+
live: zod.z.boolean(),
|
|
39
|
+
latestSnapshot: zod.z.string().optional(),
|
|
40
|
+
createdAt: zod.z.coerce.date(),
|
|
41
|
+
lastUsed: zod.z.coerce.date().optional()
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
exports.commandOutput = commandOutput;
|
|
45
|
+
exports.metadata = metadata;
|
|
46
|
+
exports.resources = resources;
|
|
47
|
+
exports.sandboxInfo = sandboxInfo;
|
|
48
|
+
exports.turnInput = turnInput;
|
|
49
|
+
exports.turnResult = turnResult;
|
|
50
|
+
//# sourceMappingURL=wire.cjs.map
|
|
51
|
+
//# sourceMappingURL=wire.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/wire.ts"],"names":["z"],"mappings":";;;;;AAEA,IAAM,WAAA,GAAcA,KAAA,CAAE,GAAA,EAAI,CAAE,QAAA,EAAS;AAG9B,IAAM,QAAA,GAAWA,MAAE,MAAA,CAAOA,KAAA,CAAE,QAAO,EAAGA,KAAA,CAAE,QAAQ;AAGhD,IAAM,SAAA,GAAYA,MAAE,YAAA,CAAa;AAAA,EACtC,IAAA,EAAM,YAAY,QAAA,EAAS;AAAA,EAC3B,SAAA,EAAW,YAAY,QAAA,EAAS;AAAA,EAChC,OAAA,EAAS,YAAY,QAAA;AACvB,CAAC;AAGM,IAAM,SAAA,GAAYA,MAAE,YAAA,CAAa;AAAA,EACtC,EAAA,EAAIA,KAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,KAAA,EAAOA,MAAE,MAAA,CAAOA,KAAA,CAAE,QAAO,EAAGA,KAAA,CAAE,SAAS,CAAA;AAAA,EACvC,WAAWA,KAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EACtC,OAAOA,KAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EAClC,YAAYA,KAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EACvC,QAAA,EAAU,SAAS,QAAA,EAAS;AAAA,EAC5B,SAAA,EAAW,YAAY,QAAA,EAAS;AAAA,EAChC,eAAA,EAAiBA,KAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,EACtC,SAAA,EAAW,UAAU,QAAA;AACvB,CAAC;AAIM,IAAM,UAAA,GAAaA,MAAE,WAAA,CAAY;AAAA,EACtC,MAAA,EAAQA,KAAA,CAAE,WAAA,CAAY,EAAE,CAAA;AAAA,EACxB,SAAA,EAAWA,MAAE,MAAA,EAAO;AAAA,EACpB,UAAA,EAAYA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,OAAA,EAASA,KAAA,CAAE,MAAA,CAAOA,KAAA,CAAE,MAAA,IAAUA,KAAA,CAAE,MAAA,EAAQ,CAAA,CAAE,QAAA;AAC5C,CAAC;AAIM,IAAM,aAAA,GAAgBA,MAAE,WAAA,CAAY;AAAA,EACzC,MAAA,EAAQA,MAAE,MAAA,EAAO;AAAA,EACjB,MAAA,EAAQA,MAAE,MAAA,EAAO;AAAA,EACjB,QAAA,EAAUA,MAAE,GAAA;AACd,CAAC;AAGM,IAAM,WAAA,GAAcA,MAAE,WAAA,CAAY;AAAA,EACvC,SAAA,EAAWA,MAAE,MAAA,EAAO;AAAA,EACpB,QAAA,EAAU,SAAS,QAAA,EAAS;AAAA,EAC5B,IAAA,EAAMA,MAAE,OAAA,EAAQ;AAAA,EAChB,cAAA,EAAgBA,KAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACpC,SAAA,EAAWA,KAAA,CAAE,MAAA,CAAO,IAAA,EAAK;AAAA,EACzB,QAAA,EAAUA,KAAA,CAAE,MAAA,CAAO,IAAA,GAAO,QAAA;AAC5B,CAAC","file":"wire.cjs","sourcesContent":["import { z } from 'zod';\n\nconst positiveInt = z.int().positive();\n\n/** Tags on a sandbox. */\nexport const metadata = z.record(z.string(), z.string());\n\n/** Machine size as the provider receives it. Sizes are MiB. */\nexport const resources = z.strictObject({\n vcpu: positiveInt.optional(),\n memoryMib: positiveInt.optional(),\n diskMib: positiveInt.optional(),\n});\n\n/** Input of one sandbox task run. `fn` names the operation, such as `$create`, `$command` or `$fs.read`. */\nexport const turnInput = z.strictObject({\n fn: z.string().min(1),\n input: z.record(z.string(), z.unknown()),\n sandboxId: z.string().min(1).optional(),\n image: z.string().min(1).optional(),\n snapshotId: z.string().min(1).optional(),\n metadata: metadata.optional(),\n idleTtlMs: positiveInt.optional(),\n inheritMetadata: z.boolean().optional(),\n resources: resources.optional(),\n});\nexport type TurnInput = z.input<typeof turnInput>;\n\n/** Output of one sandbox task run. `output` is the operation's own result. */\nexport const turnResult = z.looseObject({\n output: z.looseObject({}),\n sandboxId: z.string(),\n snapshotId: z.string().optional(),\n timings: z.record(z.string(), z.number()).optional(),\n});\nexport type TurnResult = z.infer<typeof turnResult>;\n\n/** `output` of a `$command` turn. */\nexport const commandOutput = z.looseObject({\n stdout: z.string(),\n stderr: z.string(),\n exitCode: z.int(),\n});\n\n/** One row of a `$list` turn's `output.sandboxes`. */\nexport const sandboxInfo = z.looseObject({\n sandboxId: z.string(),\n metadata: metadata.optional(),\n live: z.boolean(),\n latestSnapshot: z.string().optional(),\n createdAt: z.coerce.date(),\n lastUsed: z.coerce.date().optional(),\n});\n"]}
|
package/dist/wire.d.cts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Tags on a sandbox. */
|
|
4
|
+
declare const metadata: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
5
|
+
/** Machine size as the provider receives it. Sizes are MiB. */
|
|
6
|
+
declare const resources: z.ZodObject<{
|
|
7
|
+
vcpu: z.ZodOptional<z.ZodInt>;
|
|
8
|
+
memoryMib: z.ZodOptional<z.ZodInt>;
|
|
9
|
+
diskMib: z.ZodOptional<z.ZodInt>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
/** Input of one sandbox task run. `fn` names the operation, such as `$create`, `$command` or `$fs.read`. */
|
|
12
|
+
declare const turnInput: z.ZodObject<{
|
|
13
|
+
fn: z.ZodString;
|
|
14
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
15
|
+
sandboxId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
image: z.ZodOptional<z.ZodString>;
|
|
17
|
+
snapshotId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
idleTtlMs: z.ZodOptional<z.ZodInt>;
|
|
20
|
+
inheritMetadata: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
vcpu: z.ZodOptional<z.ZodInt>;
|
|
23
|
+
memoryMib: z.ZodOptional<z.ZodInt>;
|
|
24
|
+
diskMib: z.ZodOptional<z.ZodInt>;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
type TurnInput = z.input<typeof turnInput>;
|
|
28
|
+
/** Output of one sandbox task run. `output` is the operation's own result. */
|
|
29
|
+
declare const turnResult: z.ZodObject<{
|
|
30
|
+
output: z.ZodObject<{}, z.core.$loose>;
|
|
31
|
+
sandboxId: z.ZodString;
|
|
32
|
+
snapshotId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
timings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
34
|
+
}, z.core.$loose>;
|
|
35
|
+
type TurnResult = z.infer<typeof turnResult>;
|
|
36
|
+
/** `output` of a `$command` turn. */
|
|
37
|
+
declare const commandOutput: z.ZodObject<{
|
|
38
|
+
stdout: z.ZodString;
|
|
39
|
+
stderr: z.ZodString;
|
|
40
|
+
exitCode: z.ZodInt;
|
|
41
|
+
}, z.core.$loose>;
|
|
42
|
+
/** One row of a `$list` turn's `output.sandboxes`. */
|
|
43
|
+
declare const sandboxInfo: z.ZodObject<{
|
|
44
|
+
sandboxId: z.ZodString;
|
|
45
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
46
|
+
live: z.ZodBoolean;
|
|
47
|
+
latestSnapshot: z.ZodOptional<z.ZodString>;
|
|
48
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
49
|
+
lastUsed: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
50
|
+
}, z.core.$loose>;
|
|
51
|
+
|
|
52
|
+
export { type TurnInput, type TurnResult, commandOutput, metadata, resources, sandboxInfo, turnInput, turnResult };
|
package/dist/wire.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Tags on a sandbox. */
|
|
4
|
+
declare const metadata: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
5
|
+
/** Machine size as the provider receives it. Sizes are MiB. */
|
|
6
|
+
declare const resources: z.ZodObject<{
|
|
7
|
+
vcpu: z.ZodOptional<z.ZodInt>;
|
|
8
|
+
memoryMib: z.ZodOptional<z.ZodInt>;
|
|
9
|
+
diskMib: z.ZodOptional<z.ZodInt>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
/** Input of one sandbox task run. `fn` names the operation, such as `$create`, `$command` or `$fs.read`. */
|
|
12
|
+
declare const turnInput: z.ZodObject<{
|
|
13
|
+
fn: z.ZodString;
|
|
14
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
15
|
+
sandboxId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
image: z.ZodOptional<z.ZodString>;
|
|
17
|
+
snapshotId: z.ZodOptional<z.ZodString>;
|
|
18
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
idleTtlMs: z.ZodOptional<z.ZodInt>;
|
|
20
|
+
inheritMetadata: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
resources: z.ZodOptional<z.ZodObject<{
|
|
22
|
+
vcpu: z.ZodOptional<z.ZodInt>;
|
|
23
|
+
memoryMib: z.ZodOptional<z.ZodInt>;
|
|
24
|
+
diskMib: z.ZodOptional<z.ZodInt>;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
type TurnInput = z.input<typeof turnInput>;
|
|
28
|
+
/** Output of one sandbox task run. `output` is the operation's own result. */
|
|
29
|
+
declare const turnResult: z.ZodObject<{
|
|
30
|
+
output: z.ZodObject<{}, z.core.$loose>;
|
|
31
|
+
sandboxId: z.ZodString;
|
|
32
|
+
snapshotId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
timings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
34
|
+
}, z.core.$loose>;
|
|
35
|
+
type TurnResult = z.infer<typeof turnResult>;
|
|
36
|
+
/** `output` of a `$command` turn. */
|
|
37
|
+
declare const commandOutput: z.ZodObject<{
|
|
38
|
+
stdout: z.ZodString;
|
|
39
|
+
stderr: z.ZodString;
|
|
40
|
+
exitCode: z.ZodInt;
|
|
41
|
+
}, z.core.$loose>;
|
|
42
|
+
/** One row of a `$list` turn's `output.sandboxes`. */
|
|
43
|
+
declare const sandboxInfo: z.ZodObject<{
|
|
44
|
+
sandboxId: z.ZodString;
|
|
45
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
46
|
+
live: z.ZodBoolean;
|
|
47
|
+
latestSnapshot: z.ZodOptional<z.ZodString>;
|
|
48
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
49
|
+
lastUsed: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
50
|
+
}, z.core.$loose>;
|
|
51
|
+
|
|
52
|
+
export { type TurnInput, type TurnResult, commandOutput, metadata, resources, sandboxInfo, turnInput, turnResult };
|
package/dist/wire.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/wire.ts
|
|
4
|
+
var positiveInt = z.int().positive();
|
|
5
|
+
var metadata = z.record(z.string(), z.string());
|
|
6
|
+
var resources = z.strictObject({
|
|
7
|
+
vcpu: positiveInt.optional(),
|
|
8
|
+
memoryMib: positiveInt.optional(),
|
|
9
|
+
diskMib: positiveInt.optional()
|
|
10
|
+
});
|
|
11
|
+
var turnInput = z.strictObject({
|
|
12
|
+
fn: z.string().min(1),
|
|
13
|
+
input: z.record(z.string(), z.unknown()),
|
|
14
|
+
sandboxId: z.string().min(1).optional(),
|
|
15
|
+
image: z.string().min(1).optional(),
|
|
16
|
+
snapshotId: z.string().min(1).optional(),
|
|
17
|
+
metadata: metadata.optional(),
|
|
18
|
+
idleTtlMs: positiveInt.optional(),
|
|
19
|
+
inheritMetadata: z.boolean().optional(),
|
|
20
|
+
resources: resources.optional()
|
|
21
|
+
});
|
|
22
|
+
var turnResult = z.looseObject({
|
|
23
|
+
output: z.looseObject({}),
|
|
24
|
+
sandboxId: z.string(),
|
|
25
|
+
snapshotId: z.string().optional(),
|
|
26
|
+
timings: z.record(z.string(), z.number()).optional()
|
|
27
|
+
});
|
|
28
|
+
var commandOutput = z.looseObject({
|
|
29
|
+
stdout: z.string(),
|
|
30
|
+
stderr: z.string(),
|
|
31
|
+
exitCode: z.int()
|
|
32
|
+
});
|
|
33
|
+
var sandboxInfo = z.looseObject({
|
|
34
|
+
sandboxId: z.string(),
|
|
35
|
+
metadata: metadata.optional(),
|
|
36
|
+
live: z.boolean(),
|
|
37
|
+
latestSnapshot: z.string().optional(),
|
|
38
|
+
createdAt: z.coerce.date(),
|
|
39
|
+
lastUsed: z.coerce.date().optional()
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { commandOutput, metadata, resources, sandboxInfo, turnInput, turnResult };
|
|
43
|
+
//# sourceMappingURL=wire.js.map
|
|
44
|
+
//# sourceMappingURL=wire.js.map
|
package/dist/wire.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/wire.ts"],"names":[],"mappings":";;;AAEA,IAAM,WAAA,GAAc,CAAA,CAAE,GAAA,EAAI,CAAE,QAAA,EAAS;AAG9B,IAAM,QAAA,GAAW,EAAE,MAAA,CAAO,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,QAAQ;AAGhD,IAAM,SAAA,GAAY,EAAE,YAAA,CAAa;AAAA,EACtC,IAAA,EAAM,YAAY,QAAA,EAAS;AAAA,EAC3B,SAAA,EAAW,YAAY,QAAA,EAAS;AAAA,EAChC,OAAA,EAAS,YAAY,QAAA;AACvB,CAAC;AAGM,IAAM,SAAA,GAAY,EAAE,YAAA,CAAa;AAAA,EACtC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,KAAA,EAAO,EAAE,MAAA,CAAO,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,SAAS,CAAA;AAAA,EACvC,WAAW,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EACtC,OAAO,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EAClC,YAAY,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EACvC,QAAA,EAAU,SAAS,QAAA,EAAS;AAAA,EAC5B,SAAA,EAAW,YAAY,QAAA,EAAS;AAAA,EAChC,eAAA,EAAiB,CAAA,CAAE,OAAA,EAAQ,CAAE,QAAA,EAAS;AAAA,EACtC,SAAA,EAAW,UAAU,QAAA;AACvB,CAAC;AAIM,IAAM,UAAA,GAAa,EAAE,WAAA,CAAY;AAAA,EACtC,MAAA,EAAQ,CAAA,CAAE,WAAA,CAAY,EAAE,CAAA;AAAA,EACxB,SAAA,EAAW,EAAE,MAAA,EAAO;AAAA,EACpB,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,OAAA,EAAS,CAAA,CAAE,MAAA,CAAO,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,MAAA,EAAQ,CAAA,CAAE,QAAA;AAC5C,CAAC;AAIM,IAAM,aAAA,GAAgB,EAAE,WAAA,CAAY;AAAA,EACzC,MAAA,EAAQ,EAAE,MAAA,EAAO;AAAA,EACjB,MAAA,EAAQ,EAAE,MAAA,EAAO;AAAA,EACjB,QAAA,EAAU,EAAE,GAAA;AACd,CAAC;AAGM,IAAM,WAAA,GAAc,EAAE,WAAA,CAAY;AAAA,EACvC,SAAA,EAAW,EAAE,MAAA,EAAO;AAAA,EACpB,QAAA,EAAU,SAAS,QAAA,EAAS;AAAA,EAC5B,IAAA,EAAM,EAAE,OAAA,EAAQ;AAAA,EAChB,cAAA,EAAgB,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EACpC,SAAA,EAAW,CAAA,CAAE,MAAA,CAAO,IAAA,EAAK;AAAA,EACzB,QAAA,EAAU,CAAA,CAAE,MAAA,CAAO,IAAA,GAAO,QAAA;AAC5B,CAAC","file":"wire.js","sourcesContent":["import { z } from 'zod';\n\nconst positiveInt = z.int().positive();\n\n/** Tags on a sandbox. */\nexport const metadata = z.record(z.string(), z.string());\n\n/** Machine size as the provider receives it. Sizes are MiB. */\nexport const resources = z.strictObject({\n vcpu: positiveInt.optional(),\n memoryMib: positiveInt.optional(),\n diskMib: positiveInt.optional(),\n});\n\n/** Input of one sandbox task run. `fn` names the operation, such as `$create`, `$command` or `$fs.read`. */\nexport const turnInput = z.strictObject({\n fn: z.string().min(1),\n input: z.record(z.string(), z.unknown()),\n sandboxId: z.string().min(1).optional(),\n image: z.string().min(1).optional(),\n snapshotId: z.string().min(1).optional(),\n metadata: metadata.optional(),\n idleTtlMs: positiveInt.optional(),\n inheritMetadata: z.boolean().optional(),\n resources: resources.optional(),\n});\nexport type TurnInput = z.input<typeof turnInput>;\n\n/** Output of one sandbox task run. `output` is the operation's own result. */\nexport const turnResult = z.looseObject({\n output: z.looseObject({}),\n sandboxId: z.string(),\n snapshotId: z.string().optional(),\n timings: z.record(z.string(), z.number()).optional(),\n});\nexport type TurnResult = z.infer<typeof turnResult>;\n\n/** `output` of a `$command` turn. */\nexport const commandOutput = z.looseObject({\n stdout: z.string(),\n stderr: z.string(),\n exitCode: z.int(),\n});\n\n/** One row of a `$list` turn's `output.sandboxes`. */\nexport const sandboxInfo = z.looseObject({\n sandboxId: z.string(),\n metadata: metadata.optional(),\n live: z.boolean(),\n latestSnapshot: z.string().optional(),\n createdAt: z.coerce.date(),\n lastUsed: z.coerce.date().optional(),\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hatchet-dev/sandbox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Hatchet Sandbox TypeScript SDK",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
"require": "./dist/index.cjs",
|
|
28
28
|
"default": "./dist/index.js"
|
|
29
29
|
},
|
|
30
|
+
"./wire": {
|
|
31
|
+
"types": "./dist/wire.d.ts",
|
|
32
|
+
"import": "./dist/wire.js",
|
|
33
|
+
"require": "./dist/wire.cjs",
|
|
34
|
+
"default": "./dist/wire.js"
|
|
35
|
+
},
|
|
30
36
|
"./package.json": "./package.json"
|
|
31
37
|
},
|
|
32
38
|
"peerDependencies": {
|
|
@@ -37,7 +43,8 @@
|
|
|
37
43
|
"@opentelemetry/core": "^2.0.0",
|
|
38
44
|
"@opentelemetry/exporter-trace-otlp-grpc": "^0.221.0",
|
|
39
45
|
"@opentelemetry/instrumentation": "^0.221.0",
|
|
40
|
-
"@opentelemetry/sdk-trace-base": "^2.0.0"
|
|
46
|
+
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
47
|
+
"zod": "^4.6.7"
|
|
41
48
|
},
|
|
42
49
|
"devDependencies": {
|
|
43
50
|
"@eslint/js": "^10.0.1",
|
|
@@ -59,12 +66,13 @@
|
|
|
59
66
|
"build:sdk": "cd ../typescript && pnpm install --frozen-lockfile --config.strict-dep-builds=false && pnpm tsc:build && pnpm prepublish",
|
|
60
67
|
"build": "tsup",
|
|
61
68
|
"typecheck": "tsc --noEmit",
|
|
69
|
+
"test": "node --test test/*.test.mjs",
|
|
62
70
|
"lint": "pnpm run eslint:check && pnpm run prettier:check",
|
|
63
71
|
"lint:fix": "pnpm run eslint:fix && pnpm run prettier:fix",
|
|
64
|
-
"eslint:check": "eslint \"src/**/*.ts\"",
|
|
65
|
-
"eslint:fix": "eslint \"src/**/*.ts\" --fix",
|
|
66
|
-
"prettier:check": "prettier \"src/**/*.ts\" \"*.md\" --list-different",
|
|
67
|
-
"prettier:fix": "prettier \"src/**/*.ts\" \"*.md\" --write",
|
|
72
|
+
"eslint:check": "eslint \"src/**/*.ts\" \"examples/**/*.ts\"",
|
|
73
|
+
"eslint:fix": "eslint \"src/**/*.ts\" \"examples/**/*.ts\" --fix",
|
|
74
|
+
"prettier:check": "prettier \"src/**/*.ts\" \"examples/**/*.ts\" \"test/**/*.mjs\" \"*.md\" --list-different",
|
|
75
|
+
"prettier:fix": "prettier \"src/**/*.ts\" \"examples/**/*.ts\" \"test/**/*.mjs\" \"*.md\" --write",
|
|
68
76
|
"publish:ci": "pnpm run build && pnpm publish --access public --no-git-checks",
|
|
69
77
|
"publish:ci:alpha": "pnpm run build && pnpm publish --access public --no-git-checks --tag alpha",
|
|
70
78
|
"release:local": "pnpm run build:sdk && pnpm install && pnpm run lint && pnpm run build && pnpm publish --access public --no-git-checks"
|