@gadgetinc/substrate 0.1.0-rc.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 (181) hide show
  1. package/dist/assets/kernel.wasm +0 -0
  2. package/dist/assets/manifest.json +32 -0
  3. package/dist/assets/network-driver.js +2 -0
  4. package/dist/assets/network-driver.js.map +1 -0
  5. package/dist/assets/runtime.js +264 -0
  6. package/dist/assets/runtime.js.map +1 -0
  7. package/dist/binaries.d.ts +58 -0
  8. package/dist/binaries.d.ts.map +1 -0
  9. package/dist/boot/index.d.ts +318 -0
  10. package/dist/boot/index.d.ts.map +1 -0
  11. package/dist/index.d.ts +8 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +4589 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/kernel/bridge.d.ts +64 -0
  16. package/dist/kernel/bridge.d.ts.map +1 -0
  17. package/dist/kernel/types.d.ts +518 -0
  18. package/dist/kernel/types.d.ts.map +1 -0
  19. package/dist/kernel/wasm.d.ts +20 -0
  20. package/dist/kernel/wasm.d.ts.map +1 -0
  21. package/dist/node/assert.d.ts +99 -0
  22. package/dist/node/assert.d.ts.map +1 -0
  23. package/dist/node/async_hooks.d.ts +88 -0
  24. package/dist/node/async_hooks.d.ts.map +1 -0
  25. package/dist/node/buffer.d.ts +62 -0
  26. package/dist/node/buffer.d.ts.map +1 -0
  27. package/dist/node/child_process.d.ts +300 -0
  28. package/dist/node/child_process.d.ts.map +1 -0
  29. package/dist/node/cluster.d.ts +37 -0
  30. package/dist/node/cluster.d.ts.map +1 -0
  31. package/dist/node/constants.d.ts +306 -0
  32. package/dist/node/constants.d.ts.map +1 -0
  33. package/dist/node/crypto.d.ts +176 -0
  34. package/dist/node/crypto.d.ts.map +1 -0
  35. package/dist/node/dgram.d.ts +44 -0
  36. package/dist/node/dgram.d.ts.map +1 -0
  37. package/dist/node/diagnostics_channel.d.ts +57 -0
  38. package/dist/node/diagnostics_channel.d.ts.map +1 -0
  39. package/dist/node/dns.d.ts +278 -0
  40. package/dist/node/dns.d.ts.map +1 -0
  41. package/dist/node/domain.d.ts +21 -0
  42. package/dist/node/domain.d.ts.map +1 -0
  43. package/dist/node/events.d.ts +54 -0
  44. package/dist/node/events.d.ts.map +1 -0
  45. package/dist/node/fs/promises.d.ts +116 -0
  46. package/dist/node/fs/promises.d.ts.map +1 -0
  47. package/dist/node/fs.d.ts +536 -0
  48. package/dist/node/fs.d.ts.map +1 -0
  49. package/dist/node/http.d.ts +471 -0
  50. package/dist/node/http.d.ts.map +1 -0
  51. package/dist/node/http2.d.ts +508 -0
  52. package/dist/node/http2.d.ts.map +1 -0
  53. package/dist/node/https.d.ts +42 -0
  54. package/dist/node/https.d.ts.map +1 -0
  55. package/dist/node/inspector.d.ts +25 -0
  56. package/dist/node/inspector.d.ts.map +1 -0
  57. package/dist/node/net.d.ts +231 -0
  58. package/dist/node/net.d.ts.map +1 -0
  59. package/dist/node/os.d.ts +318 -0
  60. package/dist/node/os.d.ts.map +1 -0
  61. package/dist/node/path.d.ts +144 -0
  62. package/dist/node/path.d.ts.map +1 -0
  63. package/dist/node/process.d.ts +105 -0
  64. package/dist/node/process.d.ts.map +1 -0
  65. package/dist/node/punycode.d.ts +34 -0
  66. package/dist/node/punycode.d.ts.map +1 -0
  67. package/dist/node/querystring.d.ts +49 -0
  68. package/dist/node/querystring.d.ts.map +1 -0
  69. package/dist/node/readline.d.ts +99 -0
  70. package/dist/node/readline.d.ts.map +1 -0
  71. package/dist/node/stream.d.ts +409 -0
  72. package/dist/node/stream.d.ts.map +1 -0
  73. package/dist/node/string_decoder.d.ts +46 -0
  74. package/dist/node/string_decoder.d.ts.map +1 -0
  75. package/dist/node/timers.d.ts +79 -0
  76. package/dist/node/timers.d.ts.map +1 -0
  77. package/dist/node/tls.d.ts +159 -0
  78. package/dist/node/tls.d.ts.map +1 -0
  79. package/dist/node/trace_events.d.ts +18 -0
  80. package/dist/node/trace_events.d.ts.map +1 -0
  81. package/dist/node/tty.d.ts +67 -0
  82. package/dist/node/tty.d.ts.map +1 -0
  83. package/dist/node/url.d.ts +85 -0
  84. package/dist/node/url.d.ts.map +1 -0
  85. package/dist/node/util.d.ts +252 -0
  86. package/dist/node/util.d.ts.map +1 -0
  87. package/dist/node/v8.d.ts +134 -0
  88. package/dist/node/v8.d.ts.map +1 -0
  89. package/dist/node/vm.d.ts +89 -0
  90. package/dist/node/vm.d.ts.map +1 -0
  91. package/dist/node/wasi.d.ts +25 -0
  92. package/dist/node/wasi.d.ts.map +1 -0
  93. package/dist/node/worker_threads.d.ts +206 -0
  94. package/dist/node/worker_threads.d.ts.map +1 -0
  95. package/dist/node/ws.d.ts +110 -0
  96. package/dist/node/ws.d.ts.map +1 -0
  97. package/dist/node/zlib.d.ts +328 -0
  98. package/dist/node/zlib.d.ts.map +1 -0
  99. package/dist/persistence/opfs-store.d.ts +93 -0
  100. package/dist/persistence/opfs-store.d.ts.map +1 -0
  101. package/dist/runtime/async-function-shim.d.ts +27 -0
  102. package/dist/runtime/async-function-shim.d.ts.map +1 -0
  103. package/dist/runtime/fs-interface.d.ts +60 -0
  104. package/dist/runtime/fs-interface.d.ts.map +1 -0
  105. package/dist/runtime/index.d.ts +113 -0
  106. package/dist/runtime/index.d.ts.map +1 -0
  107. package/dist/runtime/loader.d.ts +50 -0
  108. package/dist/runtime/loader.d.ts.map +1 -0
  109. package/dist/runtime/loaders/async-transform.d.ts +40 -0
  110. package/dist/runtime/loaders/async-transform.d.ts.map +1 -0
  111. package/dist/runtime/loaders/cjs.d.ts +37 -0
  112. package/dist/runtime/loaders/cjs.d.ts.map +1 -0
  113. package/dist/runtime/loaders/detect-module-type.d.ts +21 -0
  114. package/dist/runtime/loaders/detect-module-type.d.ts.map +1 -0
  115. package/dist/runtime/loaders/esm.d.ts +140 -0
  116. package/dist/runtime/loaders/esm.d.ts.map +1 -0
  117. package/dist/runtime/loaders/source-map-registry.d.ts +43 -0
  118. package/dist/runtime/loaders/source-map-registry.d.ts.map +1 -0
  119. package/dist/runtime/loaders/source-map.d.ts +50 -0
  120. package/dist/runtime/loaders/source-map.d.ts.map +1 -0
  121. package/dist/runtime/loaders/utils.d.ts +6 -0
  122. package/dist/runtime/loaders/utils.d.ts.map +1 -0
  123. package/dist/runtime/native-globals.d.ts +24 -0
  124. package/dist/runtime/native-globals.d.ts.map +1 -0
  125. package/dist/runtime/network-driver.d.ts +78 -0
  126. package/dist/runtime/network-driver.d.ts.map +1 -0
  127. package/dist/runtime/process-context.d.ts +96 -0
  128. package/dist/runtime/process-context.d.ts.map +1 -0
  129. package/dist/runtime/process-event-loop.d.ts +356 -0
  130. package/dist/runtime/process-event-loop.d.ts.map +1 -0
  131. package/dist/runtime/process-handler.d.ts +71 -0
  132. package/dist/runtime/process-handler.d.ts.map +1 -0
  133. package/dist/runtime/process-handlers/node.d.ts +22 -0
  134. package/dist/runtime/process-handlers/node.d.ts.map +1 -0
  135. package/dist/runtime/process-handlers/npm.d.ts +20 -0
  136. package/dist/runtime/process-handlers/npm.d.ts.map +1 -0
  137. package/dist/runtime/process-handlers/npx.d.ts +11 -0
  138. package/dist/runtime/process-handlers/npx.d.ts.map +1 -0
  139. package/dist/runtime/process-handlers/pnpm.d.ts +12 -0
  140. package/dist/runtime/process-handlers/pnpm.d.ts.map +1 -0
  141. package/dist/runtime/process-handlers/shell.d.ts +24 -0
  142. package/dist/runtime/process-handlers/shell.d.ts.map +1 -0
  143. package/dist/runtime/process-handlers/yarn.d.ts +12 -0
  144. package/dist/runtime/process-handlers/yarn.d.ts.map +1 -0
  145. package/dist/runtime/process-helpers.d.ts +17 -0
  146. package/dist/runtime/process-helpers.d.ts.map +1 -0
  147. package/dist/runtime/process-manager.d.ts +87 -0
  148. package/dist/runtime/process-manager.d.ts.map +1 -0
  149. package/dist/runtime/process-scheduler.d.ts +123 -0
  150. package/dist/runtime/process-scheduler.d.ts.map +1 -0
  151. package/dist/runtime/process-waker.d.ts +24 -0
  152. package/dist/runtime/process-waker.d.ts.map +1 -0
  153. package/dist/runtime/promise.d.ts +44 -0
  154. package/dist/runtime/promise.d.ts.map +1 -0
  155. package/dist/runtime/stack-trace.d.ts +52 -0
  156. package/dist/runtime/stack-trace.d.ts.map +1 -0
  157. package/dist/runtime/wasm-package-interceptor.d.ts +141 -0
  158. package/dist/runtime/wasm-package-interceptor.d.ts.map +1 -0
  159. package/dist/runtime/web-streams.d.ts +57 -0
  160. package/dist/runtime/web-streams.d.ts.map +1 -0
  161. package/dist/runtime/websocket.d.ts +102 -0
  162. package/dist/runtime/websocket.d.ts.map +1 -0
  163. package/dist/shim/websocket-shim-inline.d.ts +9 -0
  164. package/dist/shim/websocket-shim-inline.d.ts.map +1 -0
  165. package/dist/shim/websocket-shim.d.ts +15 -0
  166. package/dist/shim/websocket-shim.d.ts.map +1 -0
  167. package/dist/sw/index.d.ts +53 -0
  168. package/dist/sw/index.d.ts.map +1 -0
  169. package/dist/utils/debug.d.ts +75 -0
  170. package/dist/utils/debug.d.ts.map +1 -0
  171. package/dist/utils/path.d.ts +20 -0
  172. package/dist/utils/path.d.ts.map +1 -0
  173. package/dist/utils/tarball.d.ts +37 -0
  174. package/dist/utils/tarball.d.ts.map +1 -0
  175. package/dist/utils/websocket-protocol.d.ts +102 -0
  176. package/dist/utils/websocket-protocol.d.ts.map +1 -0
  177. package/dist/worker/host.d.ts +14 -0
  178. package/dist/worker/host.d.ts.map +1 -0
  179. package/dist/worker/types.d.ts +209 -0
  180. package/dist/worker/types.d.ts.map +1 -0
  181. package/package.json +53 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Kernel Bridge
3
+ *
4
+ * Global kernel instance and syscall helpers.
5
+ */
6
+ import type { KernelBridge, KernelResponse, SyscallArgs } from "./types.js";
7
+ /**
8
+ * Register a hook to be called after every syscall.
9
+ * This allows the runtime to wake event loops without the bridge
10
+ * needing to know about event loop internals.
11
+ */
12
+ export declare function setPostSyscallHook(hook: (() => void) | null): void;
13
+ /**
14
+ * Initialize the kernel bridge. Must be called before using any Node APIs.
15
+ */
16
+ export declare function initKernel(bridge: KernelBridge): void;
17
+ /**
18
+ * Get the kernel bridge, throwing if not initialized
19
+ */
20
+ export declare function getKernel(): KernelBridge;
21
+ /**
22
+ * Check if kernel is initialized
23
+ */
24
+ export declare function isKernelInitialized(): boolean;
25
+ /**
26
+ * Reset kernel (for testing)
27
+ */
28
+ export declare function resetKernel(): void;
29
+ /**
30
+ * Direct memory FS interface — bypasses msgpack serialization for file content.
31
+ * Methods throw on error with the same Error shape as syscall() (err.code = "ENOENT", etc.).
32
+ */
33
+ export interface DirectFS {
34
+ /** Read entire file content. Returns an owned Uint8Array (copied from WASM memory). */
35
+ readFile(path: string): Uint8Array;
36
+ /** Write entire file content. flags: bit 0 = create, bit 1 = truncate. Returns bytes written. */
37
+ writeFile(path: string, data: Uint8Array, flags: number): number;
38
+ }
39
+ /**
40
+ * Initialize the direct memory FS bridge. Called by the runtime after loading the WASM kernel.
41
+ */
42
+ export declare function initDirectFS(dfs: DirectFS): void;
43
+ /**
44
+ * Get the direct memory FS bridge, or null if not initialized.
45
+ */
46
+ export declare function getDirectFS(): DirectFS | null;
47
+ /**
48
+ * Notify that an event-emitting operation has occurred (wakes event loops).
49
+ * Used by fs-interface after direct memory writes.
50
+ */
51
+ export declare function notifyEventEmission(): void;
52
+ /**
53
+ * Execute a typed syscall and unwrap the result, throwing on error.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const { pid } = syscall("proc_spawn", { parent_pid: 1 });
58
+ * const stat = syscall("fs_stat", { path: "/foo" });
59
+ * ```
60
+ */
61
+ export declare const syscall: <Op extends keyof import("./types.js").SyscallMap>(op: Op, args?: SyscallArgs<Op> | undefined) => import("./types.js").SyscallMap[Op]["result"];
62
+ export declare const syscallSafe: <Op extends keyof import("./types.js").SyscallMap>(op: Op, args?: SyscallArgs<Op> | undefined) => import("./types.js").SyscallMap[Op]["result"] | null;
63
+ export type { KernelBridge, KernelResponse };
64
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/kernel/bridge.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AAcvF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAElE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,YAAY,CAKxC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAMD;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IACnC,iGAAiG;IACjG,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAClE;AAID;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAEhD;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,QAAQ,GAAG,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AA8BD;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAAI,EAAE,4IAgBzB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,EAAE,mJAM7B,CAAC;AAGF,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,518 @@
1
+ /**
2
+ * Kernel Types
3
+ *
4
+ * Type definitions for the Substrate kernel interface.
5
+ */
6
+ export interface KernelError {
7
+ code: string;
8
+ message: string;
9
+ details?: Uint8Array;
10
+ }
11
+ /**
12
+ * Kernel response envelope.
13
+ *
14
+ * All syscalls return this shape, with either `ok: true` and a `result`,
15
+ * or `ok: false` and an `error`.
16
+ */
17
+ export type KernelResponse<T> = {
18
+ ok: true;
19
+ result: T;
20
+ logs?: LogEvent[];
21
+ } | {
22
+ ok: false;
23
+ error: KernelError;
24
+ logs?: LogEvent[];
25
+ };
26
+ export interface StatResult {
27
+ kind: "file" | "dir" | "symlink" | "fifo";
28
+ /** Full POSIX st_mode (file-type bits OR'd with permission bits) */
29
+ mode: number;
30
+ size: number;
31
+ ino: number;
32
+ nlink: number;
33
+ uid: number;
34
+ gid: number;
35
+ dev: number;
36
+ rdev: number;
37
+ blksize: number;
38
+ blocks: number;
39
+ atime_ms: number;
40
+ mtime_ms: number;
41
+ ctime_ms: number;
42
+ birthtime_ms: number;
43
+ }
44
+ export interface DirEntry {
45
+ name: string;
46
+ kind: "file" | "dir" | "symlink";
47
+ }
48
+ export type ProcessState = "running" | "exited";
49
+ export interface ProcessInfo {
50
+ pid: number;
51
+ parent_pid?: number;
52
+ state: ProcessState;
53
+ exit_code?: number;
54
+ signal?: string;
55
+ }
56
+ export type WaitResult = {
57
+ pid: number;
58
+ exit_code: number;
59
+ signal?: string;
60
+ } | Record<string, never>;
61
+ export interface FsWatchEvent {
62
+ type: "fs_watch_event";
63
+ watch_id: number;
64
+ path: string;
65
+ kind: string;
66
+ }
67
+ export interface NetAcceptEvent {
68
+ type: "net_accept";
69
+ server_id: number;
70
+ conn_id: number;
71
+ meta: {
72
+ protocol: string;
73
+ client_addr?: string;
74
+ client_port?: number;
75
+ method?: string;
76
+ url?: string;
77
+ headers?: [string, string][];
78
+ };
79
+ }
80
+ export interface NetReadableEvent {
81
+ type: "net_readable";
82
+ conn_id: number;
83
+ }
84
+ export interface NetClosedEvent {
85
+ type: "net_closed";
86
+ conn_id: number;
87
+ reason?: string;
88
+ }
89
+ export interface NetOutboundWritableEvent {
90
+ type: "net_outbound_writable";
91
+ conn_id: number;
92
+ }
93
+ export interface ProcExitEvent {
94
+ type: "proc_exit";
95
+ pid: number;
96
+ code: number;
97
+ signal?: string;
98
+ }
99
+ export interface PipeReadableEvent {
100
+ type: "pipe_readable";
101
+ pipe_id: number;
102
+ pid: number;
103
+ fd: number;
104
+ }
105
+ export interface LogEvent {
106
+ type: "log";
107
+ level: string;
108
+ component: string;
109
+ msg: string;
110
+ }
111
+ /**
112
+ * Map of syscall names to their argument and return types.
113
+ * This enables type-safe syscall invocations.
114
+ */
115
+ export interface SyscallMap {
116
+ fs_read_file: {
117
+ args: {
118
+ path: string;
119
+ };
120
+ result: {
121
+ bytes: Uint8Array;
122
+ };
123
+ };
124
+ fs_write_file: {
125
+ args: {
126
+ path: string;
127
+ bytes: Uint8Array | number[];
128
+ create?: boolean;
129
+ truncate?: boolean;
130
+ mode?: number;
131
+ };
132
+ result: {
133
+ size: number;
134
+ };
135
+ };
136
+ fs_write_at: {
137
+ args: {
138
+ path: string;
139
+ bytes: Uint8Array | number[];
140
+ offset: number;
141
+ };
142
+ result: {
143
+ size: number;
144
+ };
145
+ };
146
+ fs_stat: {
147
+ args: {
148
+ path: string;
149
+ follow?: boolean;
150
+ };
151
+ result: StatResult;
152
+ };
153
+ fs_mkdir: {
154
+ args: {
155
+ path: string;
156
+ recursive?: boolean;
157
+ mode?: number;
158
+ };
159
+ result: void;
160
+ };
161
+ fs_unlink: {
162
+ args: {
163
+ path: string;
164
+ recursive?: boolean;
165
+ };
166
+ result: void;
167
+ };
168
+ fs_rename: {
169
+ args: {
170
+ from: string;
171
+ to: string;
172
+ };
173
+ result: void;
174
+ };
175
+ fs_readdir: {
176
+ args: {
177
+ path: string;
178
+ };
179
+ result: {
180
+ entries: DirEntry[];
181
+ };
182
+ };
183
+ fs_chmod: {
184
+ args: {
185
+ path: string;
186
+ mode: number;
187
+ };
188
+ result: void;
189
+ };
190
+ fs_fchmod: {
191
+ args: {
192
+ fd: number;
193
+ pid: number;
194
+ mode: number;
195
+ };
196
+ result: void;
197
+ };
198
+ fs_link: {
199
+ args: {
200
+ from: string;
201
+ to: string;
202
+ };
203
+ result: void;
204
+ };
205
+ fs_symlink: {
206
+ args: {
207
+ target: string;
208
+ path: string;
209
+ };
210
+ result: void;
211
+ };
212
+ fs_readlink: {
213
+ args: {
214
+ path: string;
215
+ };
216
+ result: {
217
+ target: string;
218
+ };
219
+ };
220
+ fs_realpath: {
221
+ args: {
222
+ path: string;
223
+ };
224
+ result: {
225
+ path: string;
226
+ };
227
+ };
228
+ fs_open: {
229
+ args: {
230
+ path: string;
231
+ flags_str: string;
232
+ pid?: number;
233
+ mode?: number;
234
+ };
235
+ result: {
236
+ fd: number;
237
+ };
238
+ };
239
+ fs_close_fd: {
240
+ args: {
241
+ fd: number;
242
+ pid?: number;
243
+ };
244
+ result: void;
245
+ };
246
+ fs_read_fd: {
247
+ args: {
248
+ fd: number;
249
+ length?: number;
250
+ position?: number;
251
+ pid?: number;
252
+ };
253
+ result: {
254
+ bytes: Uint8Array;
255
+ bytes_read: number;
256
+ eof?: boolean;
257
+ };
258
+ };
259
+ fs_write_fd: {
260
+ args: {
261
+ fd: number;
262
+ bytes: Uint8Array | number[];
263
+ position?: number;
264
+ pid?: number;
265
+ };
266
+ result: {
267
+ bytes_written: number;
268
+ };
269
+ };
270
+ fs_fstat: {
271
+ args: {
272
+ fd: number;
273
+ pid?: number;
274
+ };
275
+ result: StatResult;
276
+ };
277
+ fs_ftruncate: {
278
+ args: {
279
+ fd: number;
280
+ size: number;
281
+ pid?: number;
282
+ };
283
+ result: void;
284
+ };
285
+ fs_fsync: {
286
+ args: {
287
+ fd: number;
288
+ pid?: number;
289
+ };
290
+ result: void;
291
+ };
292
+ fs_watch: {
293
+ args: {
294
+ path: string;
295
+ recursive?: boolean;
296
+ eq_id?: number;
297
+ };
298
+ result: {
299
+ watch_id: number;
300
+ };
301
+ };
302
+ fs_unwatch: {
303
+ args: {
304
+ watch_id: number;
305
+ };
306
+ result: void;
307
+ };
308
+ proc_spawn: {
309
+ args: {
310
+ parent_pid?: number;
311
+ eq_id?: number;
312
+ };
313
+ result: {
314
+ pid: number;
315
+ /** Parent's fd to write to child's stdin */
316
+ stdin_fd: number;
317
+ /** Parent's fd to read from child's stdout */
318
+ stdout_fd: number;
319
+ /** Parent's fd to read from child's stderr */
320
+ stderr_fd: number;
321
+ };
322
+ };
323
+ proc_exit: {
324
+ args: {
325
+ pid: number;
326
+ exit_code?: number;
327
+ };
328
+ result: void;
329
+ };
330
+ proc_kill: {
331
+ args: {
332
+ pid: number;
333
+ signal?: string;
334
+ };
335
+ result: {
336
+ exit_code: number;
337
+ };
338
+ };
339
+ proc_wait: {
340
+ args: {
341
+ pid: number;
342
+ parent_pid?: number;
343
+ };
344
+ result: WaitResult | void;
345
+ };
346
+ proc_set_eq_id: {
347
+ args: {
348
+ pid: number;
349
+ eq_id?: number;
350
+ };
351
+ result: void;
352
+ };
353
+ proc_get_info: {
354
+ args: {
355
+ pid: number;
356
+ };
357
+ result: ProcessInfo;
358
+ };
359
+ proc_list: {
360
+ args: {
361
+ include_exited?: boolean;
362
+ };
363
+ result: {
364
+ processes: ProcessInfo[];
365
+ };
366
+ };
367
+ proc_has_running_children: {
368
+ args: {
369
+ pid: number;
370
+ };
371
+ result: {
372
+ value: boolean;
373
+ };
374
+ };
375
+ eq_create: {
376
+ args: Record<string, never>;
377
+ result: {
378
+ eq_id: number;
379
+ };
380
+ };
381
+ eq_poll: {
382
+ args: {
383
+ eq_id: number;
384
+ max?: number;
385
+ };
386
+ result: {
387
+ events: KernelEvent[];
388
+ };
389
+ };
390
+ eq_close: {
391
+ args: {
392
+ eq_id: number;
393
+ };
394
+ result: void;
395
+ };
396
+ net_listen: {
397
+ args: {
398
+ port: number;
399
+ eq_id?: number;
400
+ };
401
+ result: {
402
+ server_id: number;
403
+ };
404
+ };
405
+ net_connect: {
406
+ args: {
407
+ port: number;
408
+ eq_id?: number;
409
+ };
410
+ result: {
411
+ conn_id: number;
412
+ };
413
+ };
414
+ net_conn_read: {
415
+ args: {
416
+ conn_id: number;
417
+ max_bytes?: number;
418
+ };
419
+ result: {
420
+ bytes: Uint8Array;
421
+ eof: boolean;
422
+ };
423
+ };
424
+ net_conn_write: {
425
+ args: {
426
+ conn_id: number;
427
+ bytes: Uint8Array | number[];
428
+ };
429
+ result: {
430
+ wrote: number;
431
+ };
432
+ };
433
+ net_conn_close: {
434
+ args: {
435
+ conn_id: number;
436
+ };
437
+ result: void;
438
+ };
439
+ net_conn_drain_outbound: {
440
+ args: {
441
+ conn_id: number;
442
+ max_bytes?: number;
443
+ };
444
+ result: {
445
+ bytes: Uint8Array;
446
+ };
447
+ };
448
+ net_server_info: {
449
+ args: {
450
+ port: number;
451
+ };
452
+ result: {
453
+ server_id: number;
454
+ eq_id: number | null;
455
+ };
456
+ };
457
+ ping: {
458
+ args: Record<string, never>;
459
+ result: {
460
+ pong: boolean;
461
+ };
462
+ };
463
+ debug_set_log_level: {
464
+ args: {
465
+ level?: LogLevel;
466
+ };
467
+ result: void;
468
+ };
469
+ }
470
+ /** Known syscall operation names */
471
+ export type SyscallOp = keyof SyscallMap;
472
+ /** Get the argument type for a syscall */
473
+ export type SyscallArgs<Op extends SyscallOp> = SyscallMap[Op]["args"];
474
+ /** Get the result type for a syscall */
475
+ type SyscallResult_<Op extends SyscallOp> = SyscallMap[Op]["result"];
476
+ export type LogLevel = "off" | "error" | "warn" | "info" | "debug" | "trace";
477
+ export interface LogConfig {
478
+ level?: LogLevel;
479
+ components?: string[];
480
+ }
481
+ export type KernelEvent = FsWatchEvent | NetAcceptEvent | NetReadableEvent | NetClosedEvent | NetOutboundWritableEvent | ProcExitEvent | PipeReadableEvent | LogEvent | {
482
+ type: string;
483
+ [key: string]: unknown;
484
+ };
485
+ export interface KernelConfig {
486
+ limits?: {
487
+ max_file_bytes?: number;
488
+ max_total_bytes?: number;
489
+ max_conn_buffer_bytes?: number;
490
+ };
491
+ features?: {
492
+ net_listen?: boolean;
493
+ proc_spawn?: boolean;
494
+ fs_watch?: boolean;
495
+ persistence?: boolean;
496
+ };
497
+ logging?: LogConfig;
498
+ }
499
+ export type KernelResponseFor<Op extends SyscallOp> = KernelResponse<SyscallResult_<Op>>;
500
+ /**
501
+ * The kernel bridge interface - abstraction over the WASM kernel
502
+ */
503
+ export interface KernelBridge {
504
+ /**
505
+ * Execute a syscall against the kernel
506
+ * @param op - The syscall operation name
507
+ * @param args - Optional syscall arguments
508
+ */
509
+ syscall<Op extends SyscallOp>(op: Op, args?: SyscallArgs<Op>): KernelResponseFor<Op>;
510
+ /**
511
+ * Deliver a message to the kernel (from drivers)
512
+ */
513
+ deliver(msg: Record<string, unknown>): KernelResponse<{
514
+ delivered: boolean;
515
+ }>;
516
+ }
517
+ export {};
518
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/kernel/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAA;CAAE,GAC1C;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC;AAEzD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1C,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CA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O,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,CAAC,EAAE,SAAS,SAAS,IAAI,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAErF;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,cAAc,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC/E"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Substrate CDN asset URLs.
3
+ *
4
+ * Assets (kernel WASM, runtime worker, network driver) are distributed via
5
+ * the Gadget CDN at versioned paths. They also ship inside the npm package
6
+ * under dist/assets/ for consumers who want to self-host.
7
+ */
8
+ /** CDN base URL for all Substrate assets. */
9
+ export declare const SUBSTRATE_CDN_BASE = "https://assets.gadget.dev/substrate";
10
+ /** Package version — kept in sync by scripts/release.mjs. */
11
+ export declare const SUBSTRATE_VERSION = "0.1.0-rc.1";
12
+ /** Get the CDN URL for the kernel WASM binary. */
13
+ export declare function getKernelUrl(version?: string): string;
14
+ /** Get the CDN URL for the Substrate runtime bundle. */
15
+ export declare function getRuntimeUrl(version?: string): string;
16
+ /** Get the CDN URL for the Substrate network driver bundle. */
17
+ export declare function getNetworkDriverUrl(version?: string): string;
18
+ /** Get the CDN URL for a binary tarball (e.g., npm, yarn, pnpm). */
19
+ export declare function getBinaryTarballUrl(binary: string, binaryVersion: string, version?: string): string;
20
+ //# sourceMappingURL=wasm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../src/kernel/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,kBAAkB,wCAAwC,CAAC;AAExE,+DAA6D;AAC7D,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAE9C,kDAAkD;AAClD,wBAAgB,YAAY,CAAC,OAAO,SAAoB,GAAG,MAAM,CAEhE;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,SAAoB,GAAG,MAAM,CAEjE;AAED,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,OAAO,SAAoB,GAAG,MAAM,CAEvE;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,SAAoB,GAC1B,MAAM,CAER"}