@eryx-org/eryx 0.0.0 → 0.15.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.
Files changed (63) hide show
  1. package/README.md +281 -4
  2. package/eryx-sandbox.conditional-host-import-0.wasm +0 -0
  3. package/eryx-sandbox.conditional-host-import-1.wasm +0 -0
  4. package/eryx-sandbox.conditional-suspending-1-i32-to-i32.wasm +0 -0
  5. package/eryx-sandbox.core.wasm +0 -0
  6. package/eryx-sandbox.core10.wasm +0 -0
  7. package/eryx-sandbox.core11.wasm +0 -0
  8. package/eryx-sandbox.core12.wasm +0 -0
  9. package/eryx-sandbox.core13.wasm +0 -0
  10. package/eryx-sandbox.core2.wasm +0 -0
  11. package/eryx-sandbox.core3.wasm +0 -0
  12. package/eryx-sandbox.core4.wasm +0 -0
  13. package/eryx-sandbox.core5.wasm +0 -0
  14. package/eryx-sandbox.core6.wasm +0 -0
  15. package/eryx-sandbox.core7.wasm +0 -0
  16. package/eryx-sandbox.core8.wasm +0 -0
  17. package/eryx-sandbox.core9.wasm +0 -0
  18. package/eryx-sandbox.d.ts +185 -0
  19. package/eryx-sandbox.js +55329 -0
  20. package/index.d.ts +331 -0
  21. package/index.js +698 -0
  22. package/instance.js +174 -0
  23. package/interfaces/eryx-net-tcp.d.ts +39 -0
  24. package/interfaces/eryx-net-tls.d.ts +33 -0
  25. package/interfaces/wasi-cli-environment.d.ts +3 -0
  26. package/interfaces/wasi-cli-exit.d.ts +3 -0
  27. package/interfaces/wasi-cli-stderr.d.ts +3 -0
  28. package/interfaces/wasi-cli-stdin.d.ts +3 -0
  29. package/interfaces/wasi-cli-stdout.d.ts +3 -0
  30. package/interfaces/wasi-cli-terminal-input.d.ts +8 -0
  31. package/interfaces/wasi-cli-terminal-output.d.ts +8 -0
  32. package/interfaces/wasi-cli-terminal-stderr.d.ts +3 -0
  33. package/interfaces/wasi-cli-terminal-stdin.d.ts +3 -0
  34. package/interfaces/wasi-cli-terminal-stdout.d.ts +3 -0
  35. package/interfaces/wasi-clocks-monotonic-clock.d.ts +8 -0
  36. package/interfaces/wasi-clocks-wall-clock.d.ts +7 -0
  37. package/interfaces/wasi-filesystem-preopens.d.ts +3 -0
  38. package/interfaces/wasi-filesystem-types.d.ts +288 -0
  39. package/interfaces/wasi-io-error.d.ts +8 -0
  40. package/interfaces/wasi-io-poll.d.ts +10 -0
  41. package/interfaces/wasi-io-streams.d.ts +51 -0
  42. package/interfaces/wasi-random-random.d.ts +2 -0
  43. package/interfaces/wasi-sockets-instance-network.d.ts +3 -0
  44. package/interfaces/wasi-sockets-ip-name-lookup.d.ts +21 -0
  45. package/interfaces/wasi-sockets-network.d.ts +92 -0
  46. package/interfaces/wasi-sockets-tcp-create-socket.d.ts +8 -0
  47. package/interfaces/wasi-sockets-tcp.d.ts +127 -0
  48. package/interfaces/wasi-sockets-udp-create-socket.d.ts +8 -0
  49. package/interfaces/wasi-sockets-udp.d.ts +93 -0
  50. package/package.json +69 -3
  51. package/python-stdlib.tar.gz +0 -0
  52. package/shims/callbacks.d.ts +45 -0
  53. package/shims/callbacks.js +469 -0
  54. package/shims/ip.js +46 -0
  55. package/shims/net-fetch.js +264 -0
  56. package/shims/net-node.js +236 -0
  57. package/shims/net.d.ts +84 -0
  58. package/shims/net.js +260 -0
  59. package/shims/preview2-node.js +35 -0
  60. package/shims/raw-json.js +111 -0
  61. package/shims/sockets.js +53 -0
  62. package/stdlib-loader.js +174 -0
  63. package/worker.js +100 -0
@@ -0,0 +1,51 @@
1
+ /** @module Interface wasi:io/streams@0.2.0 **/
2
+ export type Error = import('./wasi-io-error.js').Error;
3
+ export type Pollable = import('./wasi-io-poll.js').Pollable;
4
+ export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
5
+ export interface StreamErrorLastOperationFailed {
6
+ tag: 'last-operation-failed',
7
+ val: Error,
8
+ }
9
+ export interface StreamErrorClosed {
10
+ tag: 'closed',
11
+ }
12
+
13
+ export class InputStream {
14
+ /**
15
+ * This type does not have a public constructor.
16
+ */
17
+ private constructor();
18
+ /**
19
+ * @throws {StreamError} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
20
+ */
21
+ read(len: bigint): Uint8Array;
22
+ /**
23
+ * @throws {StreamError} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
24
+ */
25
+ blockingRead(len: bigint): Uint8Array;
26
+ subscribe(): Pollable;
27
+ }
28
+
29
+ export class OutputStream {
30
+ /**
31
+ * This type does not have a public constructor.
32
+ */
33
+ private constructor();
34
+ /**
35
+ * @throws {StreamError} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
36
+ */
37
+ checkWrite(): bigint;
38
+ /**
39
+ * @throws {StreamError} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
40
+ */
41
+ write(contents: Uint8Array): void;
42
+ /**
43
+ * @throws {StreamError} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
44
+ */
45
+ blockingWriteAndFlush(contents: Uint8Array): void;
46
+ /**
47
+ * @throws {StreamError} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
48
+ */
49
+ blockingFlush(): void;
50
+ subscribe(): Pollable;
51
+ }
@@ -0,0 +1,2 @@
1
+ /** @module Interface wasi:random/random@0.2.0 **/
2
+ export function getRandomBytes(len: bigint): Uint8Array;
@@ -0,0 +1,3 @@
1
+ /** @module Interface wasi:sockets/instance-network@0.2.0 **/
2
+ export function instanceNetwork(): Network;
3
+ export type Network = import('./wasi-sockets-network.js').Network;
@@ -0,0 +1,21 @@
1
+ /** @module Interface wasi:sockets/ip-name-lookup@0.2.0 **/
2
+ /**
3
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
4
+ */
5
+ export function resolveAddresses(network: Network, name: string): ResolveAddressStream;
6
+ export type IpAddress = import('./wasi-sockets-network.js').IpAddress;
7
+ export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
8
+ export type Pollable = import('./wasi-io-poll.js').Pollable;
9
+ export type Network = import('./wasi-sockets-network.js').Network;
10
+
11
+ export class ResolveAddressStream {
12
+ /**
13
+ * This type does not have a public constructor.
14
+ */
15
+ private constructor();
16
+ /**
17
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
18
+ */
19
+ resolveNextAddress(): IpAddress | undefined;
20
+ subscribe(): Pollable;
21
+ }
@@ -0,0 +1,92 @@
1
+ /** @module Interface wasi:sockets/network@0.2.0 **/
2
+ export type Ipv4Address = [number, number, number, number];
3
+ export interface Ipv4SocketAddress {
4
+ port: number,
5
+ address: Ipv4Address,
6
+ }
7
+ export type Ipv6Address = [number, number, number, number, number, number, number, number];
8
+ export interface Ipv6SocketAddress {
9
+ port: number,
10
+ flowInfo: number,
11
+ address: Ipv6Address,
12
+ scopeId: number,
13
+ }
14
+ export type IpSocketAddress = IpSocketAddressIpv4 | IpSocketAddressIpv6;
15
+ export interface IpSocketAddressIpv4 {
16
+ tag: 'ipv4',
17
+ val: Ipv4SocketAddress,
18
+ }
19
+ export interface IpSocketAddressIpv6 {
20
+ tag: 'ipv6',
21
+ val: Ipv6SocketAddress,
22
+ }
23
+ /**
24
+ * # Variants
25
+ *
26
+ * ## `"unknown"`
27
+ *
28
+ * ## `"access-denied"`
29
+ *
30
+ * ## `"not-supported"`
31
+ *
32
+ * ## `"invalid-argument"`
33
+ *
34
+ * ## `"out-of-memory"`
35
+ *
36
+ * ## `"timeout"`
37
+ *
38
+ * ## `"concurrency-conflict"`
39
+ *
40
+ * ## `"not-in-progress"`
41
+ *
42
+ * ## `"would-block"`
43
+ *
44
+ * ## `"invalid-state"`
45
+ *
46
+ * ## `"new-socket-limit"`
47
+ *
48
+ * ## `"address-not-bindable"`
49
+ *
50
+ * ## `"address-in-use"`
51
+ *
52
+ * ## `"remote-unreachable"`
53
+ *
54
+ * ## `"connection-refused"`
55
+ *
56
+ * ## `"connection-reset"`
57
+ *
58
+ * ## `"connection-aborted"`
59
+ *
60
+ * ## `"datagram-too-large"`
61
+ *
62
+ * ## `"name-unresolvable"`
63
+ *
64
+ * ## `"temporary-resolver-failure"`
65
+ *
66
+ * ## `"permanent-resolver-failure"`
67
+ */
68
+ export type ErrorCode = "unknown" | "access-denied" | "not-supported" | "invalid-argument" | "out-of-memory" | "timeout" | "concurrency-conflict" | "not-in-progress" | "would-block" | "invalid-state" | "new-socket-limit" | "address-not-bindable" | "address-in-use" | "remote-unreachable" | "connection-refused" | "connection-reset" | "connection-aborted" | "datagram-too-large" | "name-unresolvable" | "temporary-resolver-failure" | "permanent-resolver-failure";
69
+ export type IpAddress = IpAddressIpv4 | IpAddressIpv6;
70
+ export interface IpAddressIpv4 {
71
+ tag: 'ipv4',
72
+ val: Ipv4Address,
73
+ }
74
+ export interface IpAddressIpv6 {
75
+ tag: 'ipv6',
76
+ val: Ipv6Address,
77
+ }
78
+ /**
79
+ * # Variants
80
+ *
81
+ * ## `"ipv4"`
82
+ *
83
+ * ## `"ipv6"`
84
+ */
85
+ export type IpAddressFamily = "ipv4" | "ipv6";
86
+
87
+ export class Network {
88
+ /**
89
+ * This type does not have a public constructor.
90
+ */
91
+ private constructor();
92
+ }
@@ -0,0 +1,8 @@
1
+ /** @module Interface wasi:sockets/tcp-create-socket@0.2.0 **/
2
+ /**
3
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
4
+ */
5
+ export function createTcpSocket(addressFamily: IpAddressFamily): TcpSocket;
6
+ export type IpAddressFamily = import('./wasi-sockets-network.js').IpAddressFamily;
7
+ export type TcpSocket = import('./wasi-sockets-tcp.js').TcpSocket;
8
+ export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
@@ -0,0 +1,127 @@
1
+ /** @module Interface wasi:sockets/tcp@0.2.0 **/
2
+ export type Network = import('./wasi-sockets-network.js').Network;
3
+ export type IpSocketAddress = import('./wasi-sockets-network.js').IpSocketAddress;
4
+ export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
5
+ export type InputStream = import('./wasi-io-streams.js').InputStream;
6
+ export type OutputStream = import('./wasi-io-streams.js').OutputStream;
7
+ export type Duration = import('./wasi-clocks-monotonic-clock.js').Duration;
8
+ export type Pollable = import('./wasi-io-poll.js').Pollable;
9
+ /**
10
+ * # Variants
11
+ *
12
+ * ## `"receive"`
13
+ *
14
+ * ## `"send"`
15
+ *
16
+ * ## `"both"`
17
+ */
18
+ export type ShutdownType = "receive" | "send" | "both";
19
+
20
+ export class TcpSocket {
21
+ /**
22
+ * This type does not have a public constructor.
23
+ */
24
+ private constructor();
25
+ /**
26
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
27
+ */
28
+ startBind(network: Network, localAddress: IpSocketAddress): void;
29
+ /**
30
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
31
+ */
32
+ finishBind(): void;
33
+ /**
34
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
35
+ */
36
+ startConnect(network: Network, remoteAddress: IpSocketAddress): void;
37
+ /**
38
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
39
+ */
40
+ finishConnect(): [InputStream, OutputStream];
41
+ /**
42
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
43
+ */
44
+ startListen(): void;
45
+ /**
46
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
47
+ */
48
+ finishListen(): void;
49
+ /**
50
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
51
+ */
52
+ accept(): [TcpSocket, InputStream, OutputStream];
53
+ /**
54
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
55
+ */
56
+ localAddress(): IpSocketAddress;
57
+ /**
58
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
59
+ */
60
+ remoteAddress(): IpSocketAddress;
61
+ isListening(): boolean;
62
+ /**
63
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
64
+ */
65
+ setListenBacklogSize(value: bigint): void;
66
+ /**
67
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
68
+ */
69
+ keepAliveEnabled(): boolean;
70
+ /**
71
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
72
+ */
73
+ setKeepAliveEnabled(value: boolean): void;
74
+ /**
75
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
76
+ */
77
+ keepAliveIdleTime(): Duration;
78
+ /**
79
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
80
+ */
81
+ setKeepAliveIdleTime(value: Duration): void;
82
+ /**
83
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
84
+ */
85
+ keepAliveInterval(): Duration;
86
+ /**
87
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
88
+ */
89
+ setKeepAliveInterval(value: Duration): void;
90
+ /**
91
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
92
+ */
93
+ keepAliveCount(): number;
94
+ /**
95
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
96
+ */
97
+ setKeepAliveCount(value: number): void;
98
+ /**
99
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
100
+ */
101
+ hopLimit(): number;
102
+ /**
103
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
104
+ */
105
+ setHopLimit(value: number): void;
106
+ /**
107
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
108
+ */
109
+ receiveBufferSize(): bigint;
110
+ /**
111
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
112
+ */
113
+ setReceiveBufferSize(value: bigint): void;
114
+ /**
115
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
116
+ */
117
+ sendBufferSize(): bigint;
118
+ /**
119
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
120
+ */
121
+ setSendBufferSize(value: bigint): void;
122
+ subscribe(): Pollable;
123
+ /**
124
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
125
+ */
126
+ shutdown(shutdownType: ShutdownType): void;
127
+ }
@@ -0,0 +1,8 @@
1
+ /** @module Interface wasi:sockets/udp-create-socket@0.2.0 **/
2
+ /**
3
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
4
+ */
5
+ export function createUdpSocket(addressFamily: IpAddressFamily): UdpSocket;
6
+ export type IpAddressFamily = import('./wasi-sockets-network.js').IpAddressFamily;
7
+ export type UdpSocket = import('./wasi-sockets-udp.js').UdpSocket;
8
+ export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
@@ -0,0 +1,93 @@
1
+ /** @module Interface wasi:sockets/udp@0.2.0 **/
2
+ export type Network = import('./wasi-sockets-network.js').Network;
3
+ export type IpSocketAddress = import('./wasi-sockets-network.js').IpSocketAddress;
4
+ export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
5
+ export type Pollable = import('./wasi-io-poll.js').Pollable;
6
+ export interface IncomingDatagram {
7
+ data: Uint8Array,
8
+ remoteAddress: IpSocketAddress,
9
+ }
10
+ export interface OutgoingDatagram {
11
+ data: Uint8Array,
12
+ remoteAddress?: IpSocketAddress,
13
+ }
14
+
15
+ export class IncomingDatagramStream {
16
+ /**
17
+ * This type does not have a public constructor.
18
+ */
19
+ private constructor();
20
+ /**
21
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
22
+ */
23
+ receive(maxResults: bigint): Array<IncomingDatagram>;
24
+ subscribe(): Pollable;
25
+ }
26
+
27
+ export class OutgoingDatagramStream {
28
+ /**
29
+ * This type does not have a public constructor.
30
+ */
31
+ private constructor();
32
+ /**
33
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
34
+ */
35
+ checkSend(): bigint;
36
+ /**
37
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
38
+ */
39
+ send(datagrams: Array<OutgoingDatagram>): bigint;
40
+ subscribe(): Pollable;
41
+ }
42
+
43
+ export class UdpSocket {
44
+ /**
45
+ * This type does not have a public constructor.
46
+ */
47
+ private constructor();
48
+ /**
49
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
50
+ */
51
+ startBind(network: Network, localAddress: IpSocketAddress): void;
52
+ /**
53
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
54
+ */
55
+ finishBind(): void;
56
+ /**
57
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
58
+ */
59
+ stream(remoteAddress: IpSocketAddress | undefined): [IncomingDatagramStream, OutgoingDatagramStream];
60
+ /**
61
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
62
+ */
63
+ localAddress(): IpSocketAddress;
64
+ /**
65
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
66
+ */
67
+ remoteAddress(): IpSocketAddress;
68
+ /**
69
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
70
+ */
71
+ unicastHopLimit(): number;
72
+ /**
73
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
74
+ */
75
+ setUnicastHopLimit(value: number): void;
76
+ /**
77
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
78
+ */
79
+ receiveBufferSize(): bigint;
80
+ /**
81
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
82
+ */
83
+ setReceiveBufferSize(value: bigint): void;
84
+ /**
85
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
86
+ */
87
+ sendBufferSize(): bigint;
88
+ /**
89
+ * @throws {ErrorCode} To return the error of the result, throw it, or an `Error` that has it as its `payload`.
90
+ */
91
+ setSendBufferSize(value: bigint): void;
92
+ subscribe(): Pollable;
93
+ }
package/package.json CHANGED
@@ -1,12 +1,78 @@
1
1
  {
2
2
  "name": "@eryx-org/eryx",
3
- "version": "0.0.0",
4
- "description": "Placeholder for the first release of @eryx-org/eryx, formerly @bsull/eryx",
3
+ "type": "module",
4
+ "description": "A Python sandbox powered by WebAssembly, for browser and Node.js",
5
+ "version": "0.15.1",
5
6
  "license": "MIT OR Apache-2.0",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/eryx-org/eryx.git",
9
10
  "directory": "js/eryx"
10
11
  },
11
- "files": ["README.md"]
12
+ "files": [
13
+ "interfaces/*",
14
+ "shims/*",
15
+ "*.wasm",
16
+ "*.js",
17
+ "*.d.ts",
18
+ "python-stdlib.tar.gz",
19
+ "README.md"
20
+ ],
21
+ "main": "index.js",
22
+ "types": "index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./index.d.ts",
26
+ "default": "./index.js"
27
+ },
28
+ "./callbacks": {
29
+ "types": "./shims/callbacks.d.ts",
30
+ "default": "./shims/callbacks.js"
31
+ },
32
+ "./shims/net": {
33
+ "types": "./shims/net.d.ts",
34
+ "default": "./shims/net.js"
35
+ },
36
+ "./shims/sockets": {
37
+ "default": "./shims/sockets.js"
38
+ },
39
+ "./low-level": {
40
+ "types": "./eryx-sandbox.d.ts",
41
+ "default": "./eryx-sandbox.js"
42
+ }
43
+ },
44
+ "imports": {
45
+ "#preview2/cli": {
46
+ "node": "./shims/preview2-node.js",
47
+ "default": "@bytecodealliance/preview2-shim/cli"
48
+ },
49
+ "#preview2/clocks": {
50
+ "node": "./shims/preview2-node.js",
51
+ "default": "@bytecodealliance/preview2-shim/clocks"
52
+ },
53
+ "#preview2/filesystem": {
54
+ "node": "./shims/preview2-node.js",
55
+ "default": "@bytecodealliance/preview2-shim/filesystem"
56
+ },
57
+ "#preview2/io": {
58
+ "node": "./shims/preview2-node.js",
59
+ "default": "@bytecodealliance/preview2-shim/io"
60
+ },
61
+ "#preview2/random": {
62
+ "node": "./shims/preview2-node.js",
63
+ "default": "@bytecodealliance/preview2-shim/random"
64
+ }
65
+ },
66
+ "keywords": [
67
+ "python",
68
+ "sandbox",
69
+ "wasm",
70
+ "webassembly",
71
+ "component-model",
72
+ "interpreter"
73
+ ],
74
+ "dependencies": {
75
+ "@bytecodealliance/preview2-shim": "^0.31.0",
76
+ "@eryx-org/eryx-run": "^0.2.0"
77
+ }
12
78
  }
Binary file
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Set the default handler for trace events from the Python runtime, for every
3
+ * Sandbox that wasn't given its own `traceHandler` option.
4
+ */
5
+ export function setTraceHandler(
6
+ handler:
7
+ | ((lineno: number, eventJson: string, contextJson: string) => void)
8
+ | null,
9
+ ): void;
10
+
11
+ /** Host-controlled behavior for a single execution. */
12
+ export interface ExecutionOptions {
13
+ pythonTracing: boolean;
14
+ reuseEmptyCallbacks: boolean;
15
+ }
16
+
17
+ /** Return the default sandbox host's execution behavior. */
18
+ export function getExecutionOptions(): ExecutionOptions;
19
+
20
+ /**
21
+ * Set the default handler for streaming output (stdout/stderr) from the Python
22
+ * runtime, for every Sandbox that wasn't given its own `outputHandler` option.
23
+ *
24
+ * The handler is called in real-time as Python code writes to stdout or stderr,
25
+ * rather than waiting for execution to complete.
26
+ *
27
+ * @param handler - stream: 0 = stdout, 1 = stderr; data: the text written
28
+ */
29
+ export function setOutputHandler(
30
+ handler: ((stream: number, data: string) => void) | null,
31
+ ): void;
32
+
33
+ /**
34
+ * Thrown by a callback handler to suspend execution ("retry later").
35
+ *
36
+ * The guest halts immediately. Under `executeWithJournal()` the suspension is
37
+ * surfaced as `outcome.suspended` and the call is not journaled, so it re-runs
38
+ * live when the recorded journal is replayed. Under plain `execute()` it
39
+ * rejects like any other error.
40
+ */
41
+ export class SuspendCallback extends Error {
42
+ constructor(reason: string);
43
+ /** Opaque reason, surfaced as `outcome.suspended.reason`. */
44
+ readonly reason: string;
45
+ }