@cronch/kernel 0.0.0-stage → 0.12.0
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/LICENSE +201 -0
- package/cbor.js +177 -0
- package/cli.js +197 -0
- package/examples/claude-code/agent.pata +31 -0
- package/examples/claude-code/brain.json +25 -0
- package/examples/claude-code/fs.json +10 -0
- package/examples/claude-code/mcp.json +25 -0
- package/examples/claude-code/net.json +56 -0
- package/examples/claude-code/session.json +1 -0
- package/examples/claude-code/shell.json +29 -0
- package/index.d.ts +813 -0
- package/index.js +96 -0
- package/kernel.sha256 +1 -0
- package/kernel.wasm +0 -0
- package/package.json +48 -4
- package/run.d.ts +67 -0
- package/run.js +145 -0
- package/README.md +0 -3
package/index.d.ts
ADDED
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
// Types and expressions (`crates/kernel/src/ir.rs`). Values are plain JSON.
|
|
2
|
+
|
|
3
|
+
export type Value = null | boolean | number | string | Value[] | { [field: string]: Value };
|
|
4
|
+
|
|
5
|
+
/** A structural type. `Int` conforms to `Float`, and wider records to narrower ones. What no contract has typed is text. */
|
|
6
|
+
export type Type =
|
|
7
|
+
| "Int"
|
|
8
|
+
| "Float"
|
|
9
|
+
| "String"
|
|
10
|
+
| "Bool"
|
|
11
|
+
| { readonly List: Type }
|
|
12
|
+
| { readonly Record: Readonly<Record<string, Type>> }
|
|
13
|
+
/** A record whose `tag` field names its case, and which has that case's type. */
|
|
14
|
+
| { readonly Variant: { readonly tag: string; readonly cases: Readonly<Record<string, Type>> } };
|
|
15
|
+
|
|
16
|
+
export interface Param {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly type: Type;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A pure expression. `fold` is the only iteration, so evaluation always ends. */
|
|
22
|
+
export type Expr =
|
|
23
|
+
| { readonly e: "lit"; readonly v: Value }
|
|
24
|
+
| { readonly e: "var"; readonly name: string }
|
|
25
|
+
| { readonly e: "op"; readonly op: string; readonly args: readonly Expr[] }
|
|
26
|
+
| {
|
|
27
|
+
readonly e: "let";
|
|
28
|
+
readonly name: string;
|
|
29
|
+
readonly be: Expr;
|
|
30
|
+
readonly in: Expr;
|
|
31
|
+
/** Checked against, and the type `name` has. */
|
|
32
|
+
readonly type?: Type;
|
|
33
|
+
}
|
|
34
|
+
| { readonly e: "if"; readonly cond: Expr; readonly then: Expr; readonly else: Expr }
|
|
35
|
+
| { readonly e: "record"; readonly fields: Readonly<Record<string, Expr>> }
|
|
36
|
+
| { readonly e: "list"; readonly items: readonly Expr[] }
|
|
37
|
+
| { readonly e: "get"; readonly of: Expr; readonly field: string }
|
|
38
|
+
/** The untrusted sources a value may depend on, as a sorted list. Empty: trusted. */
|
|
39
|
+
| { readonly e: "label"; readonly of: Expr }
|
|
40
|
+
/** `then` with `bind` holding `of` at `type` if it has that type, `else` if not. */
|
|
41
|
+
/** The case of a variant, read off its `on` field (`kind` by default), with `bind` holding it at that case's type. */
|
|
42
|
+
| {
|
|
43
|
+
readonly e: "match";
|
|
44
|
+
readonly of: Expr;
|
|
45
|
+
readonly on?: string;
|
|
46
|
+
readonly cases: Readonly<Record<string, { readonly bind: string; readonly body: Expr }>>;
|
|
47
|
+
readonly otherwise?: Expr;
|
|
48
|
+
}
|
|
49
|
+
| {
|
|
50
|
+
readonly e: "fold";
|
|
51
|
+
readonly over: Expr;
|
|
52
|
+
readonly init: Expr;
|
|
53
|
+
readonly acc: string;
|
|
54
|
+
readonly item: string;
|
|
55
|
+
readonly body: Expr;
|
|
56
|
+
/** The accumulator's type, which `init` and `body` are checked against. */
|
|
57
|
+
readonly type?: Type;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** A `/`-separated path into an expression; `""` is the root. */
|
|
61
|
+
export type Path = string;
|
|
62
|
+
|
|
63
|
+
export type Arity =
|
|
64
|
+
| { readonly arity: "exactly"; readonly n: number }
|
|
65
|
+
| { readonly arity: "between"; readonly min: number; readonly max: number }
|
|
66
|
+
| { readonly arity: "atLeast"; readonly n: number };
|
|
67
|
+
|
|
68
|
+
export type OpTypeError =
|
|
69
|
+
| { readonly kind: "arity"; readonly expected: Arity; readonly got: number }
|
|
70
|
+
| {
|
|
71
|
+
readonly kind: "operand";
|
|
72
|
+
readonly index: number;
|
|
73
|
+
readonly expected: Type;
|
|
74
|
+
readonly got: Type;
|
|
75
|
+
}
|
|
76
|
+
/** An operand that had to be a list, of anything. */
|
|
77
|
+
| { readonly kind: "notAList"; readonly index: number; readonly got: Type };
|
|
78
|
+
|
|
79
|
+
export type OpEvalError =
|
|
80
|
+
| { readonly kind: "divisionByZero" }
|
|
81
|
+
| { readonly kind: "overflow" }
|
|
82
|
+
| { readonly kind: "notFinite" }
|
|
83
|
+
| {
|
|
84
|
+
readonly kind: "operand";
|
|
85
|
+
readonly index: number;
|
|
86
|
+
readonly expected: Type;
|
|
87
|
+
readonly got: Value;
|
|
88
|
+
}
|
|
89
|
+
| { readonly kind: "notAList"; readonly index: number; readonly got: Value };
|
|
90
|
+
|
|
91
|
+
/** What makes an expression ill-typed (`crates/kernel/src/check.rs`). */
|
|
92
|
+
export type Problem =
|
|
93
|
+
| { readonly kind: "unknownVariable"; readonly at: Path; readonly name: string }
|
|
94
|
+
| { readonly kind: "unknownOperator"; readonly at: Path; readonly op: string }
|
|
95
|
+
| {
|
|
96
|
+
readonly kind: "operator";
|
|
97
|
+
readonly at: Path;
|
|
98
|
+
readonly op: string;
|
|
99
|
+
readonly error: OpTypeError;
|
|
100
|
+
}
|
|
101
|
+
| { readonly kind: "mismatch"; readonly at: Path; readonly expected: Type; readonly got: Type }
|
|
102
|
+
| { readonly kind: "notARecord"; readonly at: Path; readonly got: Type }
|
|
103
|
+
| { readonly kind: "noSuchField"; readonly at: Path; readonly field: string; readonly of: Type }
|
|
104
|
+
/** A field only some of a variant's cases have: match first. */
|
|
105
|
+
| { readonly kind: "notEveryCase"; readonly at: Path; readonly field: string; readonly of: Type }
|
|
106
|
+
| { readonly kind: "notAList"; readonly at: Path; readonly got: Type }
|
|
107
|
+
/** `null`, or an empty list where nothing says what it holds. */
|
|
108
|
+
| { readonly kind: "untyped"; readonly at: Path }
|
|
109
|
+
| { readonly kind: "notAVariant"; readonly at: Path; readonly on: string; readonly got: Type }
|
|
110
|
+
| { readonly kind: "noSuchCase"; readonly at: Path; readonly case: string }
|
|
111
|
+
| { readonly kind: "notExhaustive"; readonly at: Path; readonly missing: readonly string[] };
|
|
112
|
+
|
|
113
|
+
/** Why an expression failed to evaluate (`crates/kernel/src/labeled.rs`). */
|
|
114
|
+
export type EvalError =
|
|
115
|
+
| {
|
|
116
|
+
readonly kind: "operator";
|
|
117
|
+
readonly at: Path;
|
|
118
|
+
readonly op: string;
|
|
119
|
+
readonly error: OpEvalError;
|
|
120
|
+
}
|
|
121
|
+
| { readonly kind: "unknownVariable"; readonly at: Path; readonly name: string }
|
|
122
|
+
| { readonly kind: "unknownOperator"; readonly at: Path; readonly op: string }
|
|
123
|
+
| { readonly kind: "notABool"; readonly at: Path; readonly got: Value }
|
|
124
|
+
| { readonly kind: "noSuchField"; readonly at: Path; readonly field: string; readonly of: Value }
|
|
125
|
+
| { readonly kind: "notAList"; readonly at: Path; readonly got: Value }
|
|
126
|
+
| { readonly kind: "noCase"; readonly at: Path; readonly got: Value };
|
|
127
|
+
|
|
128
|
+
/** Untrusted sources. Empty: trusted. */
|
|
129
|
+
export type Label = readonly string[];
|
|
130
|
+
|
|
131
|
+
/** A value with a label on every node. */
|
|
132
|
+
export type LValue =
|
|
133
|
+
| { readonly scalar: { readonly label?: Label; readonly value: Value } }
|
|
134
|
+
| { readonly list: { readonly label?: Label; readonly items: readonly LValue[] } }
|
|
135
|
+
| {
|
|
136
|
+
readonly record: {
|
|
137
|
+
readonly label?: Label;
|
|
138
|
+
readonly fields: Readonly<Record<string, LValue>>;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Harnesses and interfaces (`crates/kernel/src/harness.rs`).
|
|
143
|
+
|
|
144
|
+
/** `(A, S, s0, step)`. `step` is over `state` and `input`, and gives `{ state, actions }`. */
|
|
145
|
+
export interface Harness {
|
|
146
|
+
readonly arg: Type;
|
|
147
|
+
/** What a run halts with; a halt outside it fails the step. */
|
|
148
|
+
readonly result: Type;
|
|
149
|
+
/**
|
|
150
|
+
* The children it may spawn, by name. A `spawn` action names one, and starts only a harness with that signature,
|
|
151
|
+
* and its result arrives as `ret` on the operation `spawn.<name>`.
|
|
152
|
+
*/
|
|
153
|
+
readonly spawns?: Readonly<Record<string, Signature>>;
|
|
154
|
+
readonly state: Type;
|
|
155
|
+
readonly init: Value;
|
|
156
|
+
readonly step: Expr;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface Signature {
|
|
160
|
+
readonly arg: Type;
|
|
161
|
+
readonly result: Type;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** An operation and its contract. Every expression is over `args`, and as named: `grant`, `result`. */
|
|
165
|
+
export interface Operation {
|
|
166
|
+
readonly input: Type;
|
|
167
|
+
readonly output: Type;
|
|
168
|
+
readonly mode?: "single" | "stream";
|
|
169
|
+
/** Over `args` and `grant`: the call is performed only if it holds. */
|
|
170
|
+
readonly pre?: Expr;
|
|
171
|
+
/** Over `args` and `result`: results that break it are withheld. */
|
|
172
|
+
readonly post?: Expr;
|
|
173
|
+
/** Over `args`: the sources of what the call delivers. Absent: the arguments' labels. */
|
|
174
|
+
readonly ret?: Expr;
|
|
175
|
+
readonly raise?: Label;
|
|
176
|
+
readonly effect?: boolean;
|
|
177
|
+
/** Over `args`: what the call may touch, recorded on the trace. */
|
|
178
|
+
readonly footprint?: Expr;
|
|
179
|
+
/** Over `args` and `grant`: the fields of the grant state it changes, when the call is performed. */
|
|
180
|
+
readonly onCall?: Expr;
|
|
181
|
+
/** Over `args`, `result` and `grant`: the fields of the grant state it changes, when a trusted result arrives. */
|
|
182
|
+
readonly onResult?: Expr;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface Channel {
|
|
186
|
+
readonly type: Type;
|
|
187
|
+
readonly label?: Label;
|
|
188
|
+
/** Over `value`: messages that break it are withheld. */
|
|
189
|
+
readonly inv?: Expr;
|
|
190
|
+
/** Over `value` and `grant`: the fields of the grant state it changes, on a trusted channel. */
|
|
191
|
+
readonly onMsg?: Expr;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface Interface {
|
|
195
|
+
readonly operations?: Readonly<Record<string, Operation>>;
|
|
196
|
+
readonly channels?: Readonly<Record<string, Channel>>;
|
|
197
|
+
/**
|
|
198
|
+
* The type of the grant state its contracts read and write; installing merges each capability's part. Absent:
|
|
199
|
+
* the empty record, so contracts that read the grant must declare it.
|
|
200
|
+
*/
|
|
201
|
+
readonly grant?: Type;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Why capabilities can't be installed together. */
|
|
205
|
+
export type InstallError =
|
|
206
|
+
| { readonly kind: "clash"; readonly name: string }
|
|
207
|
+
| { readonly kind: "grantClash"; readonly field: string };
|
|
208
|
+
|
|
209
|
+
export interface Installation {
|
|
210
|
+
readonly prefix?: string;
|
|
211
|
+
readonly capability: Interface;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Narrowing only ever removes, strengthens or distrusts: there is no way to widen. */
|
|
215
|
+
export type Narrowing =
|
|
216
|
+
| { readonly kind: "drop"; readonly op: string }
|
|
217
|
+
| { readonly kind: "only"; readonly ops: readonly string[] }
|
|
218
|
+
| { readonly kind: "dropChannel"; readonly channel: string }
|
|
219
|
+
| { readonly kind: "restrict"; readonly op: string; readonly pre: Expr }
|
|
220
|
+
| { readonly kind: "raise"; readonly op: string; readonly label: Label };
|
|
221
|
+
|
|
222
|
+
export type HarnessPlace =
|
|
223
|
+
| { readonly in: "step" }
|
|
224
|
+
| { readonly in: "operation"; readonly name: string; readonly part: string }
|
|
225
|
+
| { readonly in: "channel"; readonly name: string; readonly part: string };
|
|
226
|
+
|
|
227
|
+
export type HarnessProblem =
|
|
228
|
+
| { readonly kind: "expr"; readonly place: HarnessPlace; readonly problem: Problem }
|
|
229
|
+
| { readonly kind: "init"; readonly expected: Type; readonly got: Value }
|
|
230
|
+
| { readonly kind: "step"; readonly expected: Type; readonly got: Type }
|
|
231
|
+
| { readonly kind: "spawnClash"; readonly name: string }
|
|
232
|
+
/** The grant has no empty value to start from: a variant in it has no `none` case that holds nothing. */
|
|
233
|
+
| { readonly kind: "grant"; readonly got: Type }
|
|
234
|
+
| {
|
|
235
|
+
readonly kind: "part";
|
|
236
|
+
readonly place: HarnessPlace;
|
|
237
|
+
readonly expected: Type;
|
|
238
|
+
readonly got: Type;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// Elaboration (`crates/surface`).
|
|
242
|
+
|
|
243
|
+
/** A place in a source: line and column, both from 1, the column in characters. */
|
|
244
|
+
export interface Pos {
|
|
245
|
+
readonly line: number;
|
|
246
|
+
readonly column: number;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** The source from `start` up to, not including, `end`. */
|
|
250
|
+
export interface Span {
|
|
251
|
+
readonly start: Pos;
|
|
252
|
+
readonly end: Pos;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** A capability a harness uses, and the prefix it is installed under for every run of the harness. */
|
|
256
|
+
export interface Binding {
|
|
257
|
+
readonly name: string;
|
|
258
|
+
readonly capability: string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** An invariant of an elaborated harness's state, over the variable `state`. */
|
|
262
|
+
export interface Invariant {
|
|
263
|
+
readonly name: string;
|
|
264
|
+
readonly expr: Expr;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Where each named thing of a source is. */
|
|
268
|
+
export interface SourceMap {
|
|
269
|
+
readonly nodes: Readonly<Record<string, Span>>;
|
|
270
|
+
readonly properties: Readonly<Record<string, Span>>;
|
|
271
|
+
readonly invariants: Readonly<Record<string, Span>>;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** A registered harness a harness spawns, by the name it uses for it. */
|
|
275
|
+
export interface HarnessBinding {
|
|
276
|
+
readonly name: string;
|
|
277
|
+
readonly harness: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export type SourceProblem = { readonly span: Span } & (
|
|
281
|
+
| { readonly kind: "syntax"; readonly expected: string; readonly found: string }
|
|
282
|
+
| { readonly kind: "duplicate"; readonly name: string }
|
|
283
|
+
| { readonly kind: "unknownName"; readonly name: string }
|
|
284
|
+
| { readonly kind: "unknownType"; readonly name: string }
|
|
285
|
+
| { readonly kind: "recursiveType"; readonly name: string }
|
|
286
|
+
| { readonly kind: "noReturn" }
|
|
287
|
+
| { readonly kind: "notAValue"; readonly name: string }
|
|
288
|
+
| { readonly kind: "unknownFunction"; readonly name: string }
|
|
289
|
+
| { readonly kind: "unknownCapability"; readonly name: string; readonly capability: string }
|
|
290
|
+
| { readonly kind: "unknownOperation"; readonly op: string }
|
|
291
|
+
| { readonly kind: "unknownChannel"; readonly channel: string }
|
|
292
|
+
| { readonly kind: "grantClash"; readonly field: string }
|
|
293
|
+
| { readonly kind: "unknownHarness"; readonly name: string; readonly harness: string }
|
|
294
|
+
| { readonly kind: "notAHarness"; readonly name: string }
|
|
295
|
+
| { readonly kind: "child"; readonly name: string; readonly problems: readonly HarnessProblem[] }
|
|
296
|
+
| { readonly kind: "until"; readonly name: string }
|
|
297
|
+
| { readonly kind: "filterReadsNode"; readonly node: string }
|
|
298
|
+
| { readonly kind: "nestedCall"; readonly op: string }
|
|
299
|
+
| { readonly kind: "argument"; readonly expected: string }
|
|
300
|
+
| { readonly kind: "guardOnValue"; readonly node: string }
|
|
301
|
+
| { readonly kind: "cycle"; readonly nodes: readonly string[] }
|
|
302
|
+
| { readonly kind: "mayBeSkipped"; readonly node: string; readonly via: string }
|
|
303
|
+
| { readonly kind: "uncovered"; readonly node: string; readonly outcome: string }
|
|
304
|
+
| { readonly kind: "noSuchOutcome"; readonly outcome: string }
|
|
305
|
+
| { readonly kind: "mixedPatterns" }
|
|
306
|
+
| { readonly kind: "noDefault" }
|
|
307
|
+
| { readonly kind: "propertyOnly"; readonly construct: string }
|
|
308
|
+
| { readonly kind: "notASlot"; readonly node: string }
|
|
309
|
+
| { readonly kind: "helper"; readonly name: string; readonly expected: string }
|
|
310
|
+
| { readonly kind: "nestedAlways" }
|
|
311
|
+
| { readonly kind: "needsOtherwise"; readonly node: string }
|
|
312
|
+
| { readonly kind: "otherwiseReadsNode"; readonly node: string }
|
|
313
|
+
| { readonly kind: "carryReads"; readonly name: string }
|
|
314
|
+
| { readonly kind: "notACarry"; readonly name: string }
|
|
315
|
+
| { readonly kind: "nextWithoutLoop" }
|
|
316
|
+
| { readonly kind: "roundNeedsOtherwise" }
|
|
317
|
+
| { readonly kind: "type"; readonly problem: Problem }
|
|
318
|
+
| { readonly kind: "mismatch"; readonly expected: Type; readonly got: Type }
|
|
319
|
+
/** The kernel rejected the elaborated term: a bug in the elaborator, not the source. */
|
|
320
|
+
| { readonly kind: "internal"; readonly problems: readonly HarnessProblem[] }
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
// Runs (`crates/kernel/src/run.rs`).
|
|
324
|
+
|
|
325
|
+
export type WorldInput =
|
|
326
|
+
| { readonly kind: "start"; readonly value: Value; readonly label?: Label }
|
|
327
|
+
| { readonly kind: "ret"; readonly call: number; readonly value: Value }
|
|
328
|
+
| { readonly kind: "end"; readonly call: number }
|
|
329
|
+
/** `step` receives `error` as `{ kind: "world", detail: error }`: see `CallError`. */
|
|
330
|
+
| { readonly kind: "failed"; readonly call: number; readonly error: Value }
|
|
331
|
+
| { readonly kind: "msg"; readonly channel: string; readonly value: Value };
|
|
332
|
+
|
|
333
|
+
/** Why a call or a child failed, as `step` receives it. */
|
|
334
|
+
export type CallError =
|
|
335
|
+
| { readonly kind: "cancelled" }
|
|
336
|
+
| { readonly kind: "child"; readonly error: string }
|
|
337
|
+
| { readonly kind: "world"; readonly detail: string };
|
|
338
|
+
|
|
339
|
+
/** An input from the world, to the run at `to` (a path of spawn identifiers; `[]` is the root). */
|
|
340
|
+
export interface Delivery {
|
|
341
|
+
readonly to?: readonly number[];
|
|
342
|
+
readonly input: WorldInput;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export type Withheld =
|
|
346
|
+
| { readonly kind: "noSuchRun" }
|
|
347
|
+
| { readonly kind: "ended" }
|
|
348
|
+
| { readonly kind: "notStarted" }
|
|
349
|
+
| { readonly kind: "alreadyStarted" }
|
|
350
|
+
| { readonly kind: "notPending"; readonly call: number }
|
|
351
|
+
| { readonly kind: "notAStream"; readonly call: number }
|
|
352
|
+
| { readonly kind: "noSuchChannel"; readonly channel: string }
|
|
353
|
+
| { readonly kind: "mismatch"; readonly expected: Type; readonly got: Value }
|
|
354
|
+
| { readonly kind: "postcondition"; readonly call: number }
|
|
355
|
+
| { readonly kind: "invariant"; readonly channel: string }
|
|
356
|
+
| { readonly kind: "returnLabel"; readonly call: number };
|
|
357
|
+
|
|
358
|
+
export type StepError =
|
|
359
|
+
| { readonly kind: "eval"; readonly error: EvalError }
|
|
360
|
+
| { readonly kind: "notAStep"; readonly got: Value }
|
|
361
|
+
| { readonly kind: "badAction"; readonly action: Value }
|
|
362
|
+
| { readonly kind: "runaway" }
|
|
363
|
+
| { readonly kind: "result"; readonly expected: Type; readonly got: Value };
|
|
364
|
+
|
|
365
|
+
export type Outcome =
|
|
366
|
+
| { readonly kind: "halted"; readonly value: Value; readonly label?: Label }
|
|
367
|
+
| { readonly kind: "failed"; readonly error: StepError };
|
|
368
|
+
|
|
369
|
+
export interface Pending {
|
|
370
|
+
readonly call: number;
|
|
371
|
+
readonly op: string;
|
|
372
|
+
readonly args: LValue;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export interface Run {
|
|
376
|
+
readonly harness: Harness;
|
|
377
|
+
readonly interface: Interface;
|
|
378
|
+
readonly state: LValue;
|
|
379
|
+
readonly pending: readonly Pending[];
|
|
380
|
+
readonly next: number;
|
|
381
|
+
readonly queue: readonly { readonly input: Value; readonly label?: Label }[];
|
|
382
|
+
readonly started: boolean;
|
|
383
|
+
readonly outcome?: Outcome;
|
|
384
|
+
/** What this run's preconditions read. The root starts with the empty grant; a child with a copy of its parent's. */
|
|
385
|
+
readonly grant: Value;
|
|
386
|
+
readonly seen?: Label;
|
|
387
|
+
readonly children?: readonly { readonly call: number; readonly run: Run }[];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** A configuration. Hosts keep it between deliveries and hand it back unchanged. */
|
|
391
|
+
export interface System {
|
|
392
|
+
readonly root: Run;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export type Event =
|
|
396
|
+
| {
|
|
397
|
+
readonly kind: "in";
|
|
398
|
+
readonly origin: readonly number[];
|
|
399
|
+
readonly input: Value;
|
|
400
|
+
readonly label?: Label;
|
|
401
|
+
readonly state: Value;
|
|
402
|
+
}
|
|
403
|
+
| {
|
|
404
|
+
readonly kind: "out";
|
|
405
|
+
readonly origin: readonly number[];
|
|
406
|
+
readonly call?: number;
|
|
407
|
+
readonly action: Value;
|
|
408
|
+
readonly performed: boolean;
|
|
409
|
+
readonly effect?: boolean;
|
|
410
|
+
readonly footprint?: Value;
|
|
411
|
+
/** The action's labels, shaped like the action. */
|
|
412
|
+
readonly labels: Value;
|
|
413
|
+
readonly state: Value;
|
|
414
|
+
}
|
|
415
|
+
| {
|
|
416
|
+
readonly kind: "withheld";
|
|
417
|
+
readonly origin: readonly number[];
|
|
418
|
+
readonly input: WorldInput;
|
|
419
|
+
readonly reason: Withheld;
|
|
420
|
+
}
|
|
421
|
+
| {
|
|
422
|
+
readonly kind: "failed";
|
|
423
|
+
readonly origin: readonly number[];
|
|
424
|
+
readonly input: Value;
|
|
425
|
+
readonly error: StepError;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* An event as a property reads it (`crates/kernel/src/view.rs`): every field it can have is present. A call, spawn or
|
|
430
|
+
* cancel carries its identifier as `action.call`, and a call its operation's footprint as `action.footprint`; an action
|
|
431
|
+
* that wasn't performed is `refused`. A child run's events have no `state`.
|
|
432
|
+
*/
|
|
433
|
+
export type EventView =
|
|
434
|
+
| {
|
|
435
|
+
readonly kind: "in";
|
|
436
|
+
readonly origin: readonly number[];
|
|
437
|
+
readonly input: Value;
|
|
438
|
+
readonly label: Label;
|
|
439
|
+
readonly state?: Value;
|
|
440
|
+
}
|
|
441
|
+
| {
|
|
442
|
+
readonly kind: "out";
|
|
443
|
+
readonly origin: readonly number[];
|
|
444
|
+
readonly action: Value;
|
|
445
|
+
readonly effect: boolean;
|
|
446
|
+
readonly labels: Value;
|
|
447
|
+
readonly state?: Value;
|
|
448
|
+
}
|
|
449
|
+
| {
|
|
450
|
+
readonly kind: "refused";
|
|
451
|
+
readonly origin: readonly number[];
|
|
452
|
+
readonly action: Value;
|
|
453
|
+
readonly labels: Value;
|
|
454
|
+
readonly state?: Value;
|
|
455
|
+
}
|
|
456
|
+
| Extract<Event, { readonly kind: "withheld" | "failed" }>;
|
|
457
|
+
|
|
458
|
+
// Properties (`crates/kernel/src/property.rs`).
|
|
459
|
+
|
|
460
|
+
export type Formula =
|
|
461
|
+
/** An expression over `event` and bound variables. One that fails to evaluate is false. */
|
|
462
|
+
| { readonly f: "atom"; readonly holds: Expr }
|
|
463
|
+
| { readonly f: "not"; readonly of: Formula }
|
|
464
|
+
| { readonly f: "and"; readonly of: readonly Formula[] }
|
|
465
|
+
| { readonly f: "or"; readonly of: readonly Formula[] }
|
|
466
|
+
| { readonly f: "implies"; readonly if: Formula; readonly then: Formula }
|
|
467
|
+
/** `var` ranges over the values `of` gave at the events so far. */
|
|
468
|
+
| { readonly f: "exists"; readonly var: string; readonly of: Expr; readonly body: Formula }
|
|
469
|
+
| { readonly f: "forall"; readonly var: string; readonly of: Expr; readonly body: Formula }
|
|
470
|
+
| { readonly f: "prev"; readonly of: Formula }
|
|
471
|
+
| { readonly f: "since"; readonly left: Formula; readonly right: Formula }
|
|
472
|
+
| { readonly f: "once"; readonly of: Formula }
|
|
473
|
+
| { readonly f: "historically"; readonly of: Formula };
|
|
474
|
+
|
|
475
|
+
/** `always`: a formula that holds at every event of every run. */
|
|
476
|
+
export interface Property {
|
|
477
|
+
readonly name: string;
|
|
478
|
+
readonly always: Formula;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export interface PropertyProblem {
|
|
482
|
+
readonly at: string;
|
|
483
|
+
readonly problem: Problem;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export type Monitored =
|
|
487
|
+
| { readonly verdict: "holds" }
|
|
488
|
+
| { readonly verdict: "violated"; readonly at: number };
|
|
489
|
+
|
|
490
|
+
/** The incremental monitor's state: each subformula's value at the last event. Hosts hand it back unchanged. */
|
|
491
|
+
export interface MonitorState {
|
|
492
|
+
readonly last?: readonly boolean[];
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export type MonitorError =
|
|
496
|
+
/** Quantifiers need the values seen so far: such properties are checked on whole traces. */
|
|
497
|
+
| { readonly kind: "quantified" }
|
|
498
|
+
/** The state isn't one this property's monitor could be in. */
|
|
499
|
+
| { readonly kind: "state"; readonly expected: number; readonly got: number };
|
|
500
|
+
|
|
501
|
+
// Evidence (`crates/kernel/src/evidence.rs`).
|
|
502
|
+
|
|
503
|
+
export interface Subject {
|
|
504
|
+
readonly harness: Harness;
|
|
505
|
+
readonly interface?: Interface;
|
|
506
|
+
readonly property: Property;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export type Template =
|
|
510
|
+
| { readonly kind: "start"; readonly value: Value; readonly label?: Label }
|
|
511
|
+
| { readonly kind: "ret"; readonly value: Value; readonly op?: string }
|
|
512
|
+
| { readonly kind: "end"; readonly op?: string }
|
|
513
|
+
| { readonly kind: "failed"; readonly error: Value; readonly op?: string }
|
|
514
|
+
| { readonly kind: "msg"; readonly channel: string; readonly value: Value };
|
|
515
|
+
|
|
516
|
+
export interface Choice {
|
|
517
|
+
readonly to?: readonly number[];
|
|
518
|
+
readonly input: Template;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** A configuration as a certificate lists it. */
|
|
522
|
+
export interface Configuration {
|
|
523
|
+
readonly system: System;
|
|
524
|
+
readonly monitor?: { readonly last?: readonly boolean[] };
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export type Method =
|
|
528
|
+
| { readonly kind: "counterexample"; readonly deliveries: readonly Delivery[] }
|
|
529
|
+
| { readonly kind: "bounded"; readonly depth: number; readonly alphabet: readonly Choice[] }
|
|
530
|
+
| { readonly kind: "exhaustive"; readonly alphabet: readonly Choice[]; readonly limit?: number }
|
|
531
|
+
/** An inductive invariant over `config`, with the configurations it holds of. */
|
|
532
|
+
| {
|
|
533
|
+
readonly kind: "invariant";
|
|
534
|
+
readonly invariant: Expr;
|
|
535
|
+
readonly configurations: readonly Configuration[];
|
|
536
|
+
readonly alphabet: readonly Choice[];
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
export type Verdict =
|
|
540
|
+
| {
|
|
541
|
+
readonly verdict: "refuted";
|
|
542
|
+
readonly counterexample: readonly Delivery[];
|
|
543
|
+
readonly at: number;
|
|
544
|
+
}
|
|
545
|
+
| { readonly verdict: "holdsUpTo"; readonly depth: number }
|
|
546
|
+
| { readonly verdict: "holds" };
|
|
547
|
+
|
|
548
|
+
export type Assumption =
|
|
549
|
+
| { readonly kind: "contracts"; readonly interface: string }
|
|
550
|
+
| { readonly kind: "checker"; readonly kernel: string }
|
|
551
|
+
| { readonly kind: "environment"; readonly alphabet: string }
|
|
552
|
+
| { readonly kind: "runtime" };
|
|
553
|
+
|
|
554
|
+
export type Evidence = {
|
|
555
|
+
readonly harness: string;
|
|
556
|
+
readonly interface: string;
|
|
557
|
+
readonly property: string;
|
|
558
|
+
readonly method: Method;
|
|
559
|
+
readonly assumptions: readonly Assumption[];
|
|
560
|
+
} & Verdict;
|
|
561
|
+
|
|
562
|
+
export type ProveError =
|
|
563
|
+
| { readonly kind: "init"; readonly error: InitError }
|
|
564
|
+
| { readonly kind: "property"; readonly problems: readonly PropertyProblem[] }
|
|
565
|
+
| { readonly kind: "inadmissible"; readonly index: number; readonly reason: Withheld }
|
|
566
|
+
| { readonly kind: "notViolated" }
|
|
567
|
+
| { readonly kind: "quantified" }
|
|
568
|
+
| { readonly kind: "inconclusive"; readonly explored: number }
|
|
569
|
+
| { readonly kind: "refuted"; readonly counterexample: readonly Delivery[] }
|
|
570
|
+
| { readonly kind: "initiation" }
|
|
571
|
+
| { readonly kind: "notInvariant"; readonly index: number }
|
|
572
|
+
| { readonly kind: "notClosed"; readonly index: number; readonly delivery: Delivery }
|
|
573
|
+
| { readonly kind: "unsafe"; readonly index: number; readonly delivery: Delivery };
|
|
574
|
+
|
|
575
|
+
export type InitError =
|
|
576
|
+
| { readonly kind: "harness"; readonly problems: readonly HarnessProblem[] }
|
|
577
|
+
| { readonly kind: "interface"; readonly problems: readonly HarnessProblem[] };
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* `logEntry`: an entry of a run's log, `{ seq, prev, delivery, events }`.
|
|
581
|
+
* `module`: a capability's code, `{ main, modules: { [name]: source } }`, which the kernel never reads.
|
|
582
|
+
*/
|
|
583
|
+
export type Kind =
|
|
584
|
+
| "harness"
|
|
585
|
+
| "interface"
|
|
586
|
+
| "property"
|
|
587
|
+
| "grant"
|
|
588
|
+
| "alphabet"
|
|
589
|
+
| "evidence"
|
|
590
|
+
| "logEntry"
|
|
591
|
+
| "module";
|
|
592
|
+
|
|
593
|
+
// SMT-LIB (`crates/kernel/src/smtlib`).
|
|
594
|
+
|
|
595
|
+
export interface Definition {
|
|
596
|
+
readonly name: string;
|
|
597
|
+
readonly params?: readonly Param[];
|
|
598
|
+
readonly body: Expr;
|
|
599
|
+
/** The type `body` is checked and encoded at. Absent, it is the type the body has. */
|
|
600
|
+
readonly result?: Type;
|
|
601
|
+
readonly description?: string;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export type Floats = "exact" | "real";
|
|
605
|
+
|
|
606
|
+
export type NoReading =
|
|
607
|
+
/** A shape the checker refuses, where only checked terms are read. */
|
|
608
|
+
| { readonly kind: "unchecked" }
|
|
609
|
+
| { readonly kind: "operator"; readonly op: string }
|
|
610
|
+
| { readonly kind: "equality"; readonly left: Type; readonly right: Type }
|
|
611
|
+
| { readonly kind: "fold" }
|
|
612
|
+
| { readonly kind: "label" }
|
|
613
|
+
| { readonly kind: "emptyVariant" }
|
|
614
|
+
| { readonly kind: "roundingDigits" }
|
|
615
|
+
| { readonly kind: "recordSize" }
|
|
616
|
+
| { readonly kind: "undeclaredField"; readonly field: string }
|
|
617
|
+
| { readonly kind: "name"; readonly name: string }
|
|
618
|
+
| { readonly kind: "character"; readonly code: number }
|
|
619
|
+
| { readonly kind: "value"; readonly expected: Type; readonly got: Value };
|
|
620
|
+
|
|
621
|
+
export type SmtlibRefusal = { readonly definition: string } & (
|
|
622
|
+
| { readonly kind: "illFormed"; readonly problems: readonly Problem[] }
|
|
623
|
+
| {
|
|
624
|
+
readonly kind: "noReading";
|
|
625
|
+
readonly place:
|
|
626
|
+
| { readonly in: "param"; readonly name: string }
|
|
627
|
+
| { readonly in: "body"; readonly at: Path };
|
|
628
|
+
readonly reason: NoReading;
|
|
629
|
+
}
|
|
630
|
+
);
|
|
631
|
+
|
|
632
|
+
export type Unreadable =
|
|
633
|
+
| { readonly kind: "syntax"; readonly detail: string }
|
|
634
|
+
| { readonly kind: "count"; readonly expected: number; readonly got: number }
|
|
635
|
+
| { readonly kind: "value"; readonly type: Type; readonly got: string }
|
|
636
|
+
| { readonly kind: "notFinite" }
|
|
637
|
+
| { readonly kind: "tooLarge" };
|
|
638
|
+
|
|
639
|
+
type Refusable<K extends string, T> =
|
|
640
|
+
| ({ readonly kind: K } & T)
|
|
641
|
+
| { readonly kind: "refused"; readonly error: unknown };
|
|
642
|
+
|
|
643
|
+
export interface Kernel {
|
|
644
|
+
/** With `expected`, the expression is checked against it: a record literal naming a case is that variant. */
|
|
645
|
+
infer(
|
|
646
|
+
expr: Expr,
|
|
647
|
+
vars?: Readonly<Record<string, Type>>,
|
|
648
|
+
expected?: Type,
|
|
649
|
+
): { readonly type: Type | null; readonly problems: readonly Problem[] };
|
|
650
|
+
evaluate(
|
|
651
|
+
expr: Expr,
|
|
652
|
+
vars?: Readonly<Record<string, Value>>,
|
|
653
|
+
):
|
|
654
|
+
| { readonly kind: "value"; readonly value: Value }
|
|
655
|
+
| { readonly kind: "failed"; readonly error: EvalError };
|
|
656
|
+
/** The harness's input is typed by `inputType`, and its actions by the interface's operations. */
|
|
657
|
+
checkHarness(harness: Harness, iface: Interface): readonly HarnessProblem[];
|
|
658
|
+
inputType(harness: Harness, iface: Interface): Type;
|
|
659
|
+
/**
|
|
660
|
+
* What a step's actions are against an interface, halting with a value of `result`. A spawn is a variant over
|
|
661
|
+
* `spawns`, each case holding the child's harness and narrowing as text and its argument at the signature's `arg`.
|
|
662
|
+
*/
|
|
663
|
+
actionType(iface: Interface, result: Type, spawns?: Readonly<Record<string, Signature>>): Type;
|
|
664
|
+
checkInterface(iface: Interface): readonly HarnessProblem[];
|
|
665
|
+
install(
|
|
666
|
+
capabilities: readonly Installation[],
|
|
667
|
+
): Refusable<"installed", { readonly interface: Interface }>;
|
|
668
|
+
narrow(
|
|
669
|
+
iface: Interface,
|
|
670
|
+
narrowings: readonly Narrowing[],
|
|
671
|
+
): Refusable<"narrowed", { readonly interface: Interface }>;
|
|
672
|
+
/** Every run starts with the empty grant of the interface's grant type: nothing pre-fills one. */
|
|
673
|
+
init(input: {
|
|
674
|
+
readonly harness: Harness;
|
|
675
|
+
readonly interface?: Interface;
|
|
676
|
+
}): Refusable<"ready", { readonly system: System }>;
|
|
677
|
+
/** Deliver one input: the next configuration, and what happened. */
|
|
678
|
+
deliver(
|
|
679
|
+
system: System,
|
|
680
|
+
delivery: Delivery,
|
|
681
|
+
): { readonly system: System; readonly events: readonly Event[] };
|
|
682
|
+
/** Events as a property reads them. */
|
|
683
|
+
view(events: readonly Event[]): readonly EventView[];
|
|
684
|
+
/** What a property may read of an event: every field some event has, at the type every event that has it gives it. */
|
|
685
|
+
eventType(harness: Harness, iface: Interface): Type;
|
|
686
|
+
/** Problems with a property of runs of this harness against this interface. */
|
|
687
|
+
checkProperty(property: Property, harness: Harness, iface: Interface): readonly PropertyProblem[];
|
|
688
|
+
/** Over recorded events: the kernel reads each as its view. */
|
|
689
|
+
monitor(property: Property, trace: readonly Event[]): Monitored;
|
|
690
|
+
/** The incremental monitor before any event, for a quantifier-free property. */
|
|
691
|
+
monitorStart(
|
|
692
|
+
property: Property,
|
|
693
|
+
):
|
|
694
|
+
| { readonly kind: "started"; readonly state: MonitorState }
|
|
695
|
+
| { readonly kind: "refused"; readonly error: MonitorError };
|
|
696
|
+
/** The monitor over more events. On a violation it stops there, with `at` counted from the first of `events`. */
|
|
697
|
+
monitorStep(
|
|
698
|
+
property: Property,
|
|
699
|
+
state: MonitorState,
|
|
700
|
+
events: readonly Event[],
|
|
701
|
+
):
|
|
702
|
+
| ({ readonly kind: "stepped"; readonly state: MonitorState } & Monitored)
|
|
703
|
+
| { readonly kind: "refused"; readonly error: MonitorError };
|
|
704
|
+
prove(
|
|
705
|
+
subject: Subject,
|
|
706
|
+
method: Method,
|
|
707
|
+
):
|
|
708
|
+
| { readonly kind: "evidence"; readonly key: string; readonly evidence: Evidence }
|
|
709
|
+
| { readonly kind: "refused"; readonly error: ProveError };
|
|
710
|
+
verify(
|
|
711
|
+
subject: Subject,
|
|
712
|
+
evidence: Evidence,
|
|
713
|
+
): { readonly valid: true } | { readonly valid: false; readonly error: unknown };
|
|
714
|
+
/** The configurations an `invariant` certificate lists, found by search. */
|
|
715
|
+
certificate(
|
|
716
|
+
subject: Subject,
|
|
717
|
+
alphabet: readonly Choice[],
|
|
718
|
+
limit?: number,
|
|
719
|
+
):
|
|
720
|
+
| { readonly kind: "certificate"; readonly configurations: readonly Configuration[] }
|
|
721
|
+
| { readonly kind: "refused"; readonly error: ProveError };
|
|
722
|
+
/** Initiation, decided, and consecution as an SMT-LIB query whose models are counterexamples to induction. */
|
|
723
|
+
obligation(input: {
|
|
724
|
+
readonly harness: Harness;
|
|
725
|
+
readonly interface?: Interface;
|
|
726
|
+
readonly invariant: Expr;
|
|
727
|
+
readonly floats?: Floats;
|
|
728
|
+
}):
|
|
729
|
+
| {
|
|
730
|
+
readonly kind: "obligation";
|
|
731
|
+
readonly initiation: boolean;
|
|
732
|
+
readonly text: string;
|
|
733
|
+
/** The types to read a model's state and input at. */
|
|
734
|
+
readonly reads: readonly [Type, Type];
|
|
735
|
+
}
|
|
736
|
+
| { readonly kind: "refused"; readonly error: unknown };
|
|
737
|
+
/** The kernel's check of a solver's counterexample to induction. */
|
|
738
|
+
checkInduction(input: {
|
|
739
|
+
readonly harness: Harness;
|
|
740
|
+
readonly interface?: Interface;
|
|
741
|
+
readonly invariant: Expr;
|
|
742
|
+
readonly state: Value;
|
|
743
|
+
readonly input: Value;
|
|
744
|
+
}):
|
|
745
|
+
| { readonly kind: "preserved"; readonly next: Value }
|
|
746
|
+
| { readonly kind: "notInductive"; readonly next: Value }
|
|
747
|
+
| {
|
|
748
|
+
readonly kind: "refused";
|
|
749
|
+
readonly error: { readonly kind: "invariant" | "state" | "input" | "notHeld" | "step" };
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* A harness from source, against the contracts of the capabilities its `uses` header names, and the terms of the
|
|
753
|
+
* harnesses it spawns, each by identifier.
|
|
754
|
+
*/
|
|
755
|
+
elaborate(
|
|
756
|
+
source: string,
|
|
757
|
+
capabilities: Readonly<Record<string, Interface>>,
|
|
758
|
+
harnesses?: Readonly<Record<string, Harness>>,
|
|
759
|
+
):
|
|
760
|
+
| {
|
|
761
|
+
readonly kind: "elaborated";
|
|
762
|
+
readonly harness: Harness;
|
|
763
|
+
readonly uses: readonly Binding[];
|
|
764
|
+
readonly harnesses: readonly HarnessBinding[];
|
|
765
|
+
readonly properties: readonly Property[];
|
|
766
|
+
readonly invariants: readonly Invariant[];
|
|
767
|
+
readonly sourceMap: SourceMap;
|
|
768
|
+
}
|
|
769
|
+
| { readonly kind: "problems"; readonly problems: readonly SourceProblem[] };
|
|
770
|
+
key(kind: Kind, object: unknown): string;
|
|
771
|
+
smtlib(
|
|
772
|
+
definitions: readonly Definition[],
|
|
773
|
+
floats?: Floats,
|
|
774
|
+
):
|
|
775
|
+
| { readonly kind: "exported"; readonly text: string }
|
|
776
|
+
| { readonly kind: "refused"; readonly error: SmtlibRefusal };
|
|
777
|
+
ruleObligations(input: {
|
|
778
|
+
readonly interface: Interface;
|
|
779
|
+
readonly rule: Rule;
|
|
780
|
+
readonly floats?: Floats;
|
|
781
|
+
/** `"lean"` writes each obligation as the Lean statement that its query is `unsat`. */
|
|
782
|
+
readonly format?: "smtlib" | "lean";
|
|
783
|
+
}):
|
|
784
|
+
| {
|
|
785
|
+
readonly kind: "obligations";
|
|
786
|
+
readonly obligations: readonly { readonly name: string; readonly text: string }[];
|
|
787
|
+
readonly framed: readonly string[];
|
|
788
|
+
}
|
|
789
|
+
| { readonly kind: "refused"; readonly error: RuleError };
|
|
790
|
+
readValues(
|
|
791
|
+
reply: string,
|
|
792
|
+
types: readonly Type[],
|
|
793
|
+
):
|
|
794
|
+
| { readonly kind: "values"; readonly values: readonly Value[] }
|
|
795
|
+
| { readonly kind: "unreadable"; readonly error: Unreadable };
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/** `op` can't happen until an approval has been given (`crates/kernel/src/rules.rs`). */
|
|
799
|
+
export interface Rule {
|
|
800
|
+
readonly op: string;
|
|
801
|
+
/** Each `when` reads `args` (the call's), `approval` (this operation's arguments) and `result`. */
|
|
802
|
+
readonly approvedBy?: readonly { readonly op: string; readonly when: Expr }[];
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
export type RuleError =
|
|
806
|
+
| { readonly kind: "interface"; readonly problems: readonly unknown[] }
|
|
807
|
+
| { readonly kind: "noSuchOperation"; readonly name: string }
|
|
808
|
+
| { readonly kind: "grantNotARecord" }
|
|
809
|
+
| { readonly kind: "unreadable"; readonly update: string }
|
|
810
|
+
| { readonly kind: "refused"; readonly place: string; readonly refusal: SmtlibRefusal };
|
|
811
|
+
|
|
812
|
+
/** Instantiate the kernel from its bytes, or from a compiled module where bytes can't be compiled (a Worker). */
|
|
813
|
+
export function instantiate(source: BufferSource | WebAssembly.Module): Promise<Kernel>;
|