@hew-lang/sandbox-vm 0.6.2 → 0.6.4
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/README.md +43 -4
- package/cli/test-runner.mjs +4 -1
- package/dist/interpreter/interpreter.d.ts +1 -1
- package/dist/interpreter/interpreter.js +1 -1
- package/dist/interpreter/parity-runner.js +26 -1
- package/dist/interpreter/run-program.d.ts +3 -2
- package/dist/interpreter/run-program.js +5 -3
- package/dist/interpreter/schema-validator.d.ts +9 -4
- package/dist/interpreter/schema-validator.js +15 -49
- package/dist/interpreter/types.d.ts +4 -0
- package/dist/interpreter/v1/browser-directory.d.ts +107 -0
- package/dist/interpreter/v1/browser-directory.js +288 -0
- package/dist/interpreter/v1/calendar.d.ts +4 -0
- package/dist/interpreter/v1/calendar.js +64 -0
- package/dist/interpreter/v1/codecs.js +2 -2
- package/dist/interpreter/v1/exec.d.ts +2 -2
- package/dist/interpreter/v1/exec.js +439 -183
- package/dist/interpreter/v1/instructions.generated.d.ts +1135 -0
- package/dist/interpreter/v1/instructions.generated.js +106 -0
- package/dist/interpreter/v1/package-graph.d.ts +2 -0
- package/dist/interpreter/v1/package-graph.js +729 -0
- package/dist/interpreter/v1/package-validator.generated.d.ts +3 -0
- package/dist/interpreter/v1/package-validator.generated.js +75846 -0
- package/dist/interpreter/v1/package.d.ts +5 -680
- package/dist/interpreter/v1/package.js +0 -12
- package/dist/interpreter/v1/scheduler.d.ts +5 -1
- package/dist/interpreter/v1/scheduler.js +32 -3
- package/dist/interpreter/v1/shims.d.ts +250 -7
- package/dist/interpreter/v1/shims.js +429 -150
- package/dist/interpreter/v1/structural.d.ts +2 -28
- package/dist/interpreter/v1/timestamp.d.ts +7 -0
- package/dist/interpreter/v1/timestamp.js +54 -0
- package/dist/interpreter/v1/validate.d.ts +8 -2
- package/dist/interpreter/v1/validate.js +190 -202
- package/dist/interpreter/v1/value-operations.d.ts +7 -2
- package/dist/interpreter/v1/value-operations.js +13 -6
- package/dist/interpreter/values.d.ts +4 -0
- package/dist/interpreter/values.js +6 -0
- package/dist/interpreter/worker.js +4 -3
- package/package.json +4 -4
|
@@ -1,682 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export type BoundaryDecision
|
|
3
|
-
export type TrapName = "integer_overflow" | "divide_by_zero" | "shift_out_of_range" | "vector_bounds" | "actor_refused";
|
|
4
|
-
export interface SpanV1 {
|
|
5
|
-
start: number;
|
|
6
|
-
end: number;
|
|
7
|
-
}
|
|
1
|
+
import type { TermV1, VariantShape, RuntimeVariantRole } from "./instructions.generated.js";
|
|
2
|
+
export type { Own, BoundaryDecision, TrapName, SpanV1, BoundaryOperand, Edge, ValueDef, CallResult, OpV1, OpName, TermV1, TermName, SwitchArm, CheckedFailure, RequestShapes, ActorProtocol, ActorOperation, RuntimeFamilyEntry, AggregateShape, VariantCase, VariantShape, RuntimeVariantRole, ExternEntry, PlaceDecl, ValueCapability, ValueComponentCapabilities, ClosureShape, VtableShape, FunctionV1, BlockV1, EntryPlan, ActorShape, SupervisorShape, PackageV1, Resource, StructuralRecipe, } from "./instructions.generated.js";
|
|
8
3
|
export type Operand = number;
|
|
9
|
-
export
|
|
10
|
-
value: number;
|
|
11
|
-
decision: BoundaryDecision;
|
|
12
|
-
}
|
|
13
|
-
export interface Edge {
|
|
14
|
-
to: number;
|
|
15
|
-
args: Operand[];
|
|
16
|
-
}
|
|
17
|
-
export interface ValueDef {
|
|
18
|
-
value: number;
|
|
19
|
-
own: Own;
|
|
20
|
-
}
|
|
21
|
-
export type CallResult = null | "never" | ValueDef;
|
|
22
|
-
export interface AggregateShape {
|
|
23
|
-
id: number;
|
|
24
|
-
name: string;
|
|
25
|
-
fields: string[];
|
|
26
|
-
}
|
|
27
|
-
export interface VariantCase {
|
|
28
|
-
name: string;
|
|
29
|
-
fields: string[];
|
|
30
|
-
}
|
|
31
|
-
export interface VariantShape {
|
|
32
|
-
id: number;
|
|
33
|
-
name: string;
|
|
34
|
-
cases: VariantCase[];
|
|
35
|
-
runtime_tags?: Partial<Record<RuntimeVariantRole, number>>;
|
|
36
|
-
}
|
|
37
|
-
export type RuntimeVariantRole = "CrashKindFault" | "CrashKindHeapExceeded" | "CrashKindPartitionDetected" | "CrashKindHandlerFailed" | "CrashKindTimerOverdue" | "OptionSome" | "OptionNone" | "ResultOk" | "ResultErr" | "ActorErrorRejected" | "ActorErrorFailed" | "ActorErrorTrapped" | "ActorErrorRefused" | "CallerActor" | "CallerTask" | "CallerTimer" | "CallerNode" | "ActorErrorDead" | "ActorErrorTimedOut" | "ActorErrorNodeNotRunning" | "ActorErrorRoutingFailed" | "ActorErrorEncodeFailed" | "ActorErrorConnectionDropped" | "ActorErrorPartition" | "SendErrorFull" | "SendErrorClosed" | "SendErrorPartition" | "SendErrorStaleRef" | "SendErrorLocalShutdown" | "SendErrorCancelled" | "SendErrorVersionMismatch" | "SendErrorBackpressure" | "SendErrorDead" | "SendErrorUnauthorized" | "SendErrorInvalidMessage" | "SendErrorTimedOut" | "SendErrorWriteTimedOut" | "DeliveryAccepted" | "DeliveryDiscarded" | "LinkErrorNoContext";
|
|
38
|
-
export declare function runtimeTag(shape: VariantShape, role: RuntimeVariantRole): number;
|
|
39
|
-
export interface RuntimeFamilyEntry {
|
|
40
|
-
id: number;
|
|
41
|
-
family: string;
|
|
42
|
-
detail?: unknown;
|
|
43
|
-
}
|
|
44
|
-
export interface ExternEntry {
|
|
45
|
-
id: number;
|
|
46
|
-
symbol: string;
|
|
47
|
-
native_capability?: string;
|
|
48
|
-
}
|
|
49
|
-
export type PlaceDecl = {
|
|
50
|
-
id: number;
|
|
51
|
-
origin: "local";
|
|
52
|
-
} | {
|
|
53
|
-
id: number;
|
|
54
|
-
origin: "aggregate";
|
|
55
|
-
base: {
|
|
56
|
-
place: number;
|
|
57
|
-
} | {
|
|
58
|
-
value: number;
|
|
59
|
-
};
|
|
60
|
-
shape?: number;
|
|
61
|
-
field: number;
|
|
62
|
-
} | {
|
|
63
|
-
id: number;
|
|
64
|
-
origin: "capture";
|
|
65
|
-
environment: number;
|
|
66
|
-
field: number;
|
|
67
|
-
} | {
|
|
68
|
-
id: number;
|
|
69
|
-
origin: "actor_state";
|
|
70
|
-
environment: number;
|
|
71
|
-
field: number;
|
|
72
|
-
initialized: boolean;
|
|
73
|
-
} | {
|
|
74
|
-
id: number;
|
|
75
|
-
origin: "runtime";
|
|
76
|
-
};
|
|
77
|
-
export interface ValueCapability {
|
|
78
|
-
id: number;
|
|
79
|
-
capability: "Eq" | "Hash" | "Less" | "LessEqual" | "Greater" | "GreaterEqual";
|
|
80
|
-
ty: string;
|
|
81
|
-
callable?: number;
|
|
82
|
-
components?: ValueComponentCapabilities[];
|
|
83
|
-
variants?: ValueComponentCapabilities[][];
|
|
84
|
-
}
|
|
85
|
-
export interface ValueComponentCapabilities {
|
|
86
|
-
selected: number;
|
|
87
|
-
ordering?: {
|
|
88
|
-
less: number;
|
|
89
|
-
less_equal: number;
|
|
90
|
-
greater: number;
|
|
91
|
-
greater_equal: number;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
export interface ClosureShape {
|
|
95
|
-
id: number;
|
|
96
|
-
entries: Array<{
|
|
97
|
-
body: number;
|
|
98
|
-
specialization: number | null;
|
|
99
|
-
}>;
|
|
100
|
-
fields: number;
|
|
101
|
-
}
|
|
102
|
-
export interface VtableShape {
|
|
103
|
-
id: number;
|
|
104
|
-
slots: Array<{
|
|
105
|
-
slot: number;
|
|
106
|
-
method: string;
|
|
107
|
-
callee: number;
|
|
108
|
-
receiver: BoundaryDecision;
|
|
109
|
-
receiver_handback?: boolean;
|
|
110
|
-
}>;
|
|
111
|
-
}
|
|
112
|
-
export interface FunctionV1 {
|
|
113
|
-
actor_construction?: boolean;
|
|
114
|
-
id: number;
|
|
115
|
-
name: string;
|
|
116
|
-
params: ValueDef[];
|
|
117
|
-
entry: number;
|
|
118
|
-
places: PlaceDecl[];
|
|
119
|
-
blocks: BlockV1[];
|
|
120
|
-
}
|
|
121
|
-
export interface BlockV1 {
|
|
122
|
-
id: number;
|
|
123
|
-
params: ValueDef[];
|
|
124
|
-
ops: OpV1[];
|
|
125
|
-
term: TermV1;
|
|
126
|
-
}
|
|
127
|
-
interface OpBase {
|
|
128
|
-
own?: Own;
|
|
129
|
-
dst?: number | null;
|
|
130
|
-
span?: SpanV1 | null;
|
|
131
|
-
}
|
|
132
|
-
export type OpV1 = (OpBase & {
|
|
133
|
-
op: "coverage.hit";
|
|
134
|
-
counter: number;
|
|
135
|
-
}) | (OpBase & {
|
|
136
|
-
op: "const.int";
|
|
137
|
-
dst: number;
|
|
138
|
-
value: string;
|
|
139
|
-
ty: string;
|
|
140
|
-
}) | (OpBase & {
|
|
141
|
-
op: "const.bool";
|
|
142
|
-
dst: number;
|
|
143
|
-
value: boolean;
|
|
144
|
-
}) | (OpBase & {
|
|
145
|
-
op: "const.float";
|
|
146
|
-
dst: number;
|
|
147
|
-
value?: number;
|
|
148
|
-
ty: string;
|
|
149
|
-
nonfinite?: "nan" | "inf" | "-inf";
|
|
150
|
-
}) | (OpBase & {
|
|
151
|
-
op: "const.char";
|
|
152
|
-
dst: number;
|
|
153
|
-
value: string;
|
|
154
|
-
}) | (OpBase & {
|
|
155
|
-
op: "const.unit";
|
|
156
|
-
dst: number;
|
|
157
|
-
}) | (OpBase & {
|
|
158
|
-
op: "const.duration";
|
|
159
|
-
dst: number;
|
|
160
|
-
nanos: string;
|
|
161
|
-
}) | (OpBase & {
|
|
162
|
-
op: "const.str";
|
|
163
|
-
dst: number;
|
|
164
|
-
str: number;
|
|
165
|
-
}) | (OpBase & {
|
|
166
|
-
op: "const.bytes";
|
|
167
|
-
dst: number;
|
|
168
|
-
bytes: number;
|
|
169
|
-
}) | (OpBase & {
|
|
170
|
-
op: "copy_value";
|
|
171
|
-
dst: number;
|
|
172
|
-
source: Operand;
|
|
173
|
-
}) | (OpBase & {
|
|
174
|
-
op: "move";
|
|
175
|
-
dst: number;
|
|
176
|
-
source: Operand;
|
|
177
|
-
}) | (OpBase & {
|
|
178
|
-
op: "fork";
|
|
179
|
-
dst: number;
|
|
180
|
-
source: Operand;
|
|
181
|
-
}) | (OpBase & {
|
|
182
|
-
op: "destroy_value";
|
|
183
|
-
value: Operand;
|
|
184
|
-
}) | (OpBase & {
|
|
185
|
-
op: "begin_borrow";
|
|
186
|
-
dst: number;
|
|
187
|
-
owner: Operand;
|
|
188
|
-
}) | (OpBase & {
|
|
189
|
-
op: "end_borrow";
|
|
190
|
-
borrow: Operand;
|
|
191
|
-
}) | (OpBase & {
|
|
192
|
-
op: "finish_linear_receiver";
|
|
193
|
-
}) | (OpBase & {
|
|
194
|
-
op: "alloc_place";
|
|
195
|
-
place: number;
|
|
196
|
-
}) | (OpBase & {
|
|
197
|
-
op: "store.init";
|
|
198
|
-
place: number;
|
|
199
|
-
value: Operand;
|
|
200
|
-
}) | (OpBase & {
|
|
201
|
-
op: "store.assign";
|
|
202
|
-
place: number;
|
|
203
|
-
value: Operand;
|
|
204
|
-
}) | (OpBase & {
|
|
205
|
-
op: "load.copy";
|
|
206
|
-
dst: number;
|
|
207
|
-
place: number;
|
|
208
|
-
}) | (OpBase & {
|
|
209
|
-
op: "load.take";
|
|
210
|
-
dst: number;
|
|
211
|
-
place: number;
|
|
212
|
-
}) | (OpBase & {
|
|
213
|
-
op: "load.borrow";
|
|
214
|
-
dst: number;
|
|
215
|
-
place: number;
|
|
216
|
-
}) | (OpBase & {
|
|
217
|
-
op: "end_lifetime";
|
|
218
|
-
place: number;
|
|
219
|
-
}) | (OpBase & {
|
|
220
|
-
op: "tuple.make";
|
|
221
|
-
dst: number;
|
|
222
|
-
elements: Operand[];
|
|
223
|
-
}) | (OpBase & {
|
|
224
|
-
op: "tuple.get";
|
|
225
|
-
dst: number;
|
|
226
|
-
tuple: Operand;
|
|
227
|
-
index: number;
|
|
228
|
-
}) | (OpBase & {
|
|
229
|
-
op: "aggregate.make";
|
|
230
|
-
dst: number;
|
|
231
|
-
shape: number;
|
|
232
|
-
fields: Operand[];
|
|
233
|
-
}) | (OpBase & {
|
|
234
|
-
op: "aggregate.project_copy";
|
|
235
|
-
dst: number;
|
|
236
|
-
shape: number;
|
|
237
|
-
aggregate: Operand;
|
|
238
|
-
field: number;
|
|
239
|
-
}) | (OpBase & {
|
|
240
|
-
op: "aggregate.project_borrow";
|
|
241
|
-
dst: number;
|
|
242
|
-
shape: number;
|
|
243
|
-
aggregate: Operand;
|
|
244
|
-
field: number;
|
|
245
|
-
}) | (OpBase & {
|
|
246
|
-
op: "destructure";
|
|
247
|
-
shape: number | null;
|
|
248
|
-
aggregate: Operand;
|
|
249
|
-
results: number[];
|
|
250
|
-
}) | (OpBase & {
|
|
251
|
-
op: "array.make";
|
|
252
|
-
dst: number;
|
|
253
|
-
elements: Operand[];
|
|
254
|
-
}) | (OpBase & {
|
|
255
|
-
op: "array.repeat";
|
|
256
|
-
dst: number;
|
|
257
|
-
value: Operand;
|
|
258
|
-
count?: number;
|
|
259
|
-
}) | (OpBase & {
|
|
260
|
-
op: "variant.make";
|
|
261
|
-
dst: number;
|
|
262
|
-
shape: number;
|
|
263
|
-
variant: number;
|
|
264
|
-
fields: Operand[];
|
|
265
|
-
}) | (OpBase & {
|
|
266
|
-
op: "variant.is";
|
|
267
|
-
dst: number;
|
|
268
|
-
shape: number;
|
|
269
|
-
variant: number;
|
|
270
|
-
source: Operand;
|
|
271
|
-
}) | (OpBase & {
|
|
272
|
-
op: "variant.project_copy";
|
|
273
|
-
dst: number;
|
|
274
|
-
shape: number;
|
|
275
|
-
variant: number;
|
|
276
|
-
source: Operand;
|
|
277
|
-
field: number;
|
|
278
|
-
}) | (OpBase & {
|
|
279
|
-
op: "variant.project_borrow";
|
|
280
|
-
dst: number;
|
|
281
|
-
shape: number;
|
|
282
|
-
variant: number;
|
|
283
|
-
source: Operand;
|
|
284
|
-
field: number;
|
|
285
|
-
}) | (OpBase & {
|
|
286
|
-
op: "variant.destructure";
|
|
287
|
-
shape: number;
|
|
288
|
-
variant: number;
|
|
289
|
-
source: Operand;
|
|
290
|
-
results: number[];
|
|
291
|
-
}) | (OpBase & {
|
|
292
|
-
op: "unary";
|
|
293
|
-
dst: number;
|
|
294
|
-
unary_op: string;
|
|
295
|
-
value: Operand;
|
|
296
|
-
ty: string;
|
|
297
|
-
}) | (OpBase & {
|
|
298
|
-
op: "binary";
|
|
299
|
-
dst: number;
|
|
300
|
-
binary_op: string;
|
|
301
|
-
lhs: Operand;
|
|
302
|
-
rhs: Operand;
|
|
303
|
-
ty: string;
|
|
304
|
-
}) | (OpBase & {
|
|
305
|
-
op: "cast";
|
|
306
|
-
dst: number;
|
|
307
|
-
value: Operand;
|
|
308
|
-
from: string;
|
|
309
|
-
to: string;
|
|
310
|
-
}) | (OpBase & {
|
|
311
|
-
op: "str.eq";
|
|
312
|
-
dst: number;
|
|
313
|
-
lhs: Operand;
|
|
314
|
-
rhs: Operand;
|
|
315
|
-
}) | (OpBase & {
|
|
316
|
-
op: "bytes.eq";
|
|
317
|
-
dst: number;
|
|
318
|
-
lhs: Operand;
|
|
319
|
-
rhs: Operand;
|
|
320
|
-
}) | (OpBase & {
|
|
321
|
-
op: "function.make";
|
|
322
|
-
dst: number;
|
|
323
|
-
callable: number;
|
|
324
|
-
}) | (OpBase & {
|
|
325
|
-
op: "closure.make";
|
|
326
|
-
dst: number;
|
|
327
|
-
closure: number;
|
|
328
|
-
fields: Operand[];
|
|
329
|
-
}) | (OpBase & {
|
|
330
|
-
op: "callable.coerce";
|
|
331
|
-
dst: number;
|
|
332
|
-
source: Operand;
|
|
333
|
-
specialization: number | null;
|
|
334
|
-
}) | (OpBase & {
|
|
335
|
-
op: "dyn.make";
|
|
336
|
-
dst: number;
|
|
337
|
-
vtable: number;
|
|
338
|
-
value: Operand;
|
|
339
|
-
}) | (OpBase & {
|
|
340
|
-
op: "register_defer";
|
|
341
|
-
defer: number;
|
|
342
|
-
scope: number;
|
|
343
|
-
dependencies: Operand[];
|
|
344
|
-
}) | (OpBase & {
|
|
345
|
-
op: "generator.make";
|
|
346
|
-
dst: number;
|
|
347
|
-
closure: number;
|
|
348
|
-
callable: Operand;
|
|
349
|
-
}) | (OpBase & {
|
|
350
|
-
op: "actor.ingress_adapter";
|
|
351
|
-
}) | (OpBase & {
|
|
352
|
-
op: "stream.pipe";
|
|
353
|
-
capacity: number;
|
|
354
|
-
results: ValueDef[];
|
|
355
|
-
}) | (OpBase & {
|
|
356
|
-
op: "task_scope.enter";
|
|
357
|
-
scope: number;
|
|
358
|
-
parent: number | null;
|
|
359
|
-
duration: Operand | null;
|
|
360
|
-
}) | (OpBase & {
|
|
361
|
-
op: "task_scope.close";
|
|
362
|
-
scope: number;
|
|
363
|
-
}) | (OpBase & {
|
|
364
|
-
op: "task.race";
|
|
365
|
-
dst: number;
|
|
366
|
-
scope: number;
|
|
367
|
-
members: Operand[];
|
|
368
|
-
}) | (OpBase & {
|
|
369
|
-
op: "task.spawn";
|
|
370
|
-
dst: number;
|
|
371
|
-
scope: number;
|
|
372
|
-
callable: Operand;
|
|
373
|
-
}) | (OpBase & {
|
|
374
|
-
op: "task.invoke";
|
|
375
|
-
dst: number;
|
|
376
|
-
scope: number;
|
|
377
|
-
callee: {
|
|
378
|
-
direct: number;
|
|
379
|
-
} | {
|
|
380
|
-
mutable: number;
|
|
381
|
-
receiver: BoundaryOperand;
|
|
382
|
-
staged: boolean;
|
|
383
|
-
} | {
|
|
384
|
-
dyn: number;
|
|
385
|
-
method: string;
|
|
386
|
-
receiver: BoundaryOperand;
|
|
387
|
-
} | {
|
|
388
|
-
receiver: BoundaryOperand;
|
|
389
|
-
specialization: number | null;
|
|
390
|
-
};
|
|
391
|
-
args: BoundaryOperand[];
|
|
392
|
-
});
|
|
393
|
-
export type OpName = OpV1["op"];
|
|
394
|
-
interface TermBase {
|
|
395
|
-
span?: SpanV1 | null;
|
|
396
|
-
}
|
|
397
|
-
export interface SwitchArm {
|
|
398
|
-
variant: number;
|
|
399
|
-
fields: ValueDef[];
|
|
400
|
-
edge: Edge;
|
|
401
|
-
}
|
|
402
|
-
export interface CheckedFailure {
|
|
403
|
-
trap: TrapName;
|
|
404
|
-
edge: Edge;
|
|
405
|
-
}
|
|
406
|
-
export interface RequestShapes {
|
|
407
|
-
failure: number | null;
|
|
408
|
-
reason: number | null;
|
|
409
|
-
message: number | null;
|
|
410
|
-
request: number | null;
|
|
411
|
-
}
|
|
412
|
-
export interface CallShape {
|
|
413
|
-
args: BoundaryOperand[];
|
|
414
|
-
result: CallResult;
|
|
415
|
-
normal?: Edge;
|
|
416
|
-
unwind: Edge | null;
|
|
417
|
-
request_shapes?: RequestShapes;
|
|
418
|
-
}
|
|
419
|
-
export type TermV1 = (TermBase & {
|
|
420
|
-
op: "return";
|
|
421
|
-
value: BoundaryOperand | null;
|
|
422
|
-
}) | (TermBase & {
|
|
423
|
-
op: "goto";
|
|
424
|
-
edge: Edge;
|
|
425
|
-
}) | (TermBase & {
|
|
426
|
-
op: "branch";
|
|
427
|
-
condition: Operand;
|
|
428
|
-
then: Edge;
|
|
429
|
-
else: Edge;
|
|
430
|
-
}) | (TermBase & {
|
|
431
|
-
op: "switch.variant";
|
|
432
|
-
shape: number;
|
|
433
|
-
scrutinee: Operand;
|
|
434
|
-
arms: SwitchArm[];
|
|
435
|
-
}) | (TermBase & {
|
|
436
|
-
op: "checked.binary";
|
|
437
|
-
binary_op: string;
|
|
438
|
-
lhs: Operand;
|
|
439
|
-
rhs: Operand;
|
|
440
|
-
result: ValueDef;
|
|
441
|
-
normal: Edge;
|
|
442
|
-
failures: CheckedFailure[];
|
|
443
|
-
ty: string;
|
|
444
|
-
}) | (TermBase & {
|
|
445
|
-
op: "unreachable";
|
|
446
|
-
}) | (TermBase & CallShape & {
|
|
4
|
+
export type CallShape = Pick<Extract<TermV1, {
|
|
447
5
|
op: "call";
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}) | (TermBase & CallShape & {
|
|
451
|
-
op: "indirect.call";
|
|
452
|
-
callee: BoundaryOperand;
|
|
453
|
-
specialization: number | null;
|
|
454
|
-
}) | (TermBase & CallShape & {
|
|
455
|
-
op: "dyn.call";
|
|
456
|
-
receiver: BoundaryOperand;
|
|
457
|
-
slot: number;
|
|
458
|
-
}) | (TermBase & CallShape & {
|
|
459
|
-
op: "value.call";
|
|
460
|
-
plan: number;
|
|
461
|
-
}) | (TermBase & CallShape & {
|
|
462
|
-
op: "wire.codec";
|
|
463
|
-
codec: number;
|
|
464
|
-
format: number;
|
|
465
|
-
direction: "encode" | "decode" | "test_input";
|
|
466
|
-
decoded: {
|
|
467
|
-
shape: number;
|
|
468
|
-
ok: number;
|
|
469
|
-
error: number;
|
|
470
|
-
error_root: number;
|
|
471
|
-
} | null;
|
|
472
|
-
callbacks: Record<string, number[]>;
|
|
473
|
-
}) | (TermBase & CallShape & {
|
|
474
|
-
op: "runtime.call";
|
|
475
|
-
shared_payload_type?: string;
|
|
476
|
-
family: number;
|
|
477
|
-
structural?: number | null;
|
|
478
|
-
callbacks?: number[];
|
|
479
|
-
releases_contents?: boolean;
|
|
480
|
-
keeps_inputs_on_failure?: boolean;
|
|
481
|
-
result_member_shapes?: Array<number | null>;
|
|
482
|
-
variant_result_shapes?: {
|
|
483
|
-
error: number;
|
|
484
|
-
error_len: number;
|
|
485
|
-
};
|
|
486
|
-
result_shape: number | null;
|
|
487
|
-
}) | (TermBase & CallShape & {
|
|
488
|
-
op: "extern.call";
|
|
489
|
-
extern: number;
|
|
490
|
-
result_shape: number | null;
|
|
491
|
-
}) | (TermBase & CallShape & {
|
|
492
|
-
op: "actor.call";
|
|
493
|
-
operation: ActorOperation;
|
|
494
|
-
submission_shapes?: {
|
|
495
|
-
success: number | null;
|
|
496
|
-
failure: number | null;
|
|
497
|
-
reason: number | null;
|
|
498
|
-
};
|
|
499
|
-
result_shape: number | null;
|
|
500
|
-
error_shape: number | null;
|
|
501
|
-
}) | (TermBase & {
|
|
502
|
-
op: "panic";
|
|
503
|
-
message: BoundaryOperand;
|
|
504
|
-
assertion?: [BoundaryOperand, BoundaryOperand, BoundaryOperand] | null;
|
|
505
|
-
cleanup: Edge;
|
|
506
|
-
}) | (TermBase & {
|
|
507
|
-
op: "trap";
|
|
508
|
-
trap: TrapName;
|
|
509
|
-
}) | (TermBase & {
|
|
510
|
-
op: "checked_raise";
|
|
511
|
-
trap: TrapName;
|
|
512
|
-
cleanup: Edge;
|
|
513
|
-
}) | (TermBase & {
|
|
514
|
-
op: "cleanup.dispatch";
|
|
515
|
-
normal: Edge;
|
|
516
|
-
fault: Edge;
|
|
517
|
-
}) | (TermBase & {
|
|
518
|
-
op: "resume_unwind";
|
|
519
|
-
handback?: BoundaryOperand | null;
|
|
520
|
-
}) | (TermBase & {
|
|
521
|
-
op: "enter_defer";
|
|
522
|
-
defer: number;
|
|
523
|
-
park: number;
|
|
524
|
-
body: Edge;
|
|
525
|
-
}) | (TermBase & {
|
|
526
|
-
op: "finish_defer";
|
|
527
|
-
defer: number;
|
|
528
|
-
park: number;
|
|
529
|
-
next: Edge;
|
|
530
|
-
}) | (TermBase & {
|
|
531
|
-
op: "recover_fault";
|
|
532
|
-
result_shape?: number | null;
|
|
533
|
-
result: ValueDef;
|
|
534
|
-
deadline_variant: number;
|
|
535
|
-
fault_variant: number;
|
|
536
|
-
normal: Edge;
|
|
537
|
-
unwind: Edge | null;
|
|
538
|
-
}) | (TermBase & {
|
|
539
|
-
op: "suspend";
|
|
540
|
-
kind: string;
|
|
541
|
-
detail?: any;
|
|
542
|
-
request_shapes?: RequestShapes;
|
|
543
|
-
result_shape?: number | null;
|
|
544
|
-
error_shape?: number | null;
|
|
545
|
-
inputs: BoundaryOperand[];
|
|
546
|
-
result: CallResult;
|
|
547
|
-
resumes: Edge[];
|
|
548
|
-
cancel: Edge | null;
|
|
549
|
-
unwind: Edge | null;
|
|
550
|
-
});
|
|
551
|
-
export type TermName = TermV1["op"];
|
|
552
|
-
export interface EntryPlan {
|
|
553
|
-
function: number;
|
|
554
|
-
exit: "unit" | "status";
|
|
555
|
-
}
|
|
556
|
-
export interface ActorProtocol {
|
|
557
|
-
actor: number;
|
|
558
|
-
message: number;
|
|
559
|
-
policy: "reject" | "wait" | "drop_newest";
|
|
560
|
-
sealed: boolean;
|
|
561
|
-
}
|
|
562
|
-
export type ActorOperation = {
|
|
563
|
-
op: "identity";
|
|
564
|
-
} | {
|
|
565
|
-
op: "spawn" | "self_handle" | "stop" | "terminate" | "await_stopped" | "await_restarted";
|
|
566
|
-
actor: number;
|
|
567
|
-
} | {
|
|
568
|
-
op: "call_start" | "call_take";
|
|
569
|
-
protocol: ActorProtocol;
|
|
570
|
-
} | {
|
|
571
|
-
op: "submit";
|
|
572
|
-
actor: number;
|
|
573
|
-
policy: ActorProtocol["policy"];
|
|
574
|
-
} | {
|
|
575
|
-
op: "stream_start";
|
|
576
|
-
actor: number;
|
|
577
|
-
message: number;
|
|
578
|
-
} | {
|
|
579
|
-
op: "timer_schedule";
|
|
580
|
-
actor: number;
|
|
581
|
-
message: number;
|
|
582
|
-
resource: number;
|
|
583
|
-
policy: "reject" | "drop_newest";
|
|
584
|
-
} | {
|
|
585
|
-
op: "local_observation";
|
|
586
|
-
kind: string;
|
|
587
|
-
} | {
|
|
588
|
-
op: "supervisor_spawn" | "stop" | "terminate" | "await_stopped" | "await_restarted";
|
|
589
|
-
supervisor: number;
|
|
590
|
-
} | {
|
|
591
|
-
op: "supervisor_child" | "supervisor_pool_view";
|
|
592
|
-
supervisor: number;
|
|
593
|
-
child: number;
|
|
594
|
-
};
|
|
595
|
-
export interface ActorShape {
|
|
596
|
-
id: number;
|
|
597
|
-
name: string;
|
|
598
|
-
state_fields: Array<{
|
|
599
|
-
mutable: boolean;
|
|
600
|
-
deferred: boolean;
|
|
601
|
-
}>;
|
|
602
|
-
init?: number;
|
|
603
|
-
start?: number;
|
|
604
|
-
stop: number[];
|
|
605
|
-
crash?: number;
|
|
606
|
-
crash_info?: number;
|
|
607
|
-
crash_kind?: number;
|
|
608
|
-
crash_action?: number;
|
|
609
|
-
exit?: number;
|
|
610
|
-
down?: number;
|
|
611
|
-
handlers: Array<{
|
|
612
|
-
name: string;
|
|
613
|
-
message_id: number;
|
|
614
|
-
callable: number;
|
|
615
|
-
params: number;
|
|
616
|
-
streams: boolean;
|
|
617
|
-
fallible: boolean;
|
|
618
|
-
result_shape: number | null;
|
|
619
|
-
every_ns?: number;
|
|
620
|
-
}>;
|
|
621
|
-
mailbox_capacity?: number;
|
|
622
|
-
overflow: string;
|
|
623
|
-
coalesce?: {
|
|
624
|
-
fallback: string;
|
|
625
|
-
keys: Array<{
|
|
626
|
-
message: number;
|
|
627
|
-
param: number;
|
|
628
|
-
}>;
|
|
629
|
-
};
|
|
630
|
-
max_heap_bytes?: number;
|
|
631
|
-
}
|
|
632
|
-
export interface SupervisorShape {
|
|
633
|
-
id: number;
|
|
634
|
-
strategy: string;
|
|
635
|
-
max_restarts: number;
|
|
636
|
-
window_secs: number;
|
|
637
|
-
children: Array<{
|
|
638
|
-
name: string;
|
|
639
|
-
role: {
|
|
640
|
-
actor: number;
|
|
641
|
-
} | {
|
|
642
|
-
supervisor: number;
|
|
643
|
-
};
|
|
644
|
-
restart: string;
|
|
645
|
-
stop_ns?: number | null;
|
|
646
|
-
stop_config?: number;
|
|
647
|
-
is_pool?: boolean;
|
|
648
|
-
spawn: number;
|
|
649
|
-
}>;
|
|
650
|
-
}
|
|
651
|
-
export interface PackageV1 {
|
|
652
|
-
codecs?: string[];
|
|
653
|
-
resources?: Array<{
|
|
654
|
-
kind: string;
|
|
655
|
-
ty?: string;
|
|
656
|
-
shape?: number;
|
|
657
|
-
close?: number;
|
|
658
|
-
release?: string;
|
|
659
|
-
}>;
|
|
660
|
-
structural_render?: import("./structural.js").StructuralRecipe[];
|
|
661
|
-
schema_version: "hew.sandbox.bytecode.v1";
|
|
662
|
-
hew_version: string;
|
|
663
|
-
compiler_version: string;
|
|
664
|
-
profile: string;
|
|
665
|
-
entry?: EntryPlan;
|
|
666
|
-
strings: string[];
|
|
667
|
-
bytes: number[][];
|
|
668
|
-
regex_patterns: string[];
|
|
669
|
-
aggregates: AggregateShape[];
|
|
670
|
-
variants: VariantShape[];
|
|
671
|
-
runtime_families: RuntimeFamilyEntry[];
|
|
672
|
-
externs: ExternEntry[];
|
|
673
|
-
suspend_kinds: string[];
|
|
674
|
-
value_capabilities: ValueCapability[];
|
|
675
|
-
closures: ClosureShape[];
|
|
676
|
-
vtables: VtableShape[];
|
|
677
|
-
actors?: ActorShape[];
|
|
678
|
-
supervisors?: SupervisorShape[];
|
|
679
|
-
functions: FunctionV1[];
|
|
680
|
-
}
|
|
681
|
-
export declare function isPackageV1(input: unknown): input is PackageV1;
|
|
682
|
-
export {};
|
|
6
|
+
}>, "args" | "result" | "normal" | "unwind" | "request_shapes">;
|
|
7
|
+
export declare function runtimeTag(shape: VariantShape, role: RuntimeVariantRole): number;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/// TypeScript shape of `hew.sandbox.bytecode.v1`, mirroring
|
|
2
|
-
/// `bytecode/sandbox-bytecode-v1.schema.json` and `bytecode/opcodes-v1.md`.
|
|
3
|
-
///
|
|
4
|
-
/// The package is a projection of verified ownership SIR. Every fact here was
|
|
5
|
-
/// proved by SIR verification, so the executor reads these fields; it does not
|
|
6
|
-
/// re-derive them from a type, a name or a symbol spelling.
|
|
7
1
|
export function runtimeTag(shape, role) {
|
|
8
2
|
const tag = shape.runtime_tags?.[role];
|
|
9
3
|
if (tag === undefined ||
|
|
@@ -13,9 +7,3 @@ export function runtimeTag(shape, role) {
|
|
|
13
7
|
throw new Error(`variant shape ${shape.id} has no checked ${role} tag`);
|
|
14
8
|
return tag;
|
|
15
9
|
}
|
|
16
|
-
export function isPackageV1(input) {
|
|
17
|
-
return (typeof input === "object" &&
|
|
18
|
-
input !== null &&
|
|
19
|
-
input.schema_version ===
|
|
20
|
-
"hew.sandbox.bytecode.v1");
|
|
21
|
-
}
|
|
@@ -8,11 +8,15 @@ export declare class FrameScheduler {
|
|
|
8
8
|
private readonly replaySteps;
|
|
9
9
|
private nextTicket;
|
|
10
10
|
private replayIndex;
|
|
11
|
+
private readonly pendingHostOperations;
|
|
12
|
+
private hostReady;
|
|
13
|
+
submitHost<T>(id: string, operation: Promise<T>, completed: (result: T) => void, failed: (error: unknown) => void): void;
|
|
14
|
+
retireHost(): Promise<void>;
|
|
11
15
|
constructor(trace: TraceBuilder, policy: "round_robin" | "chaos");
|
|
12
16
|
enqueue(id: string, resume: () => void): void;
|
|
13
17
|
after(nanos: bigint, wake: () => void): () => void;
|
|
14
18
|
hasRunnableWork(): boolean;
|
|
15
19
|
advanceSlice(): void;
|
|
16
20
|
private fireTimers;
|
|
17
|
-
run(): void
|
|
21
|
+
run(): Promise<void>;
|
|
18
22
|
}
|