@northtalk/ts 0.0.0-stage → 0.1.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 +21 -0
- package/README.md +55 -2
- package/UNICODE-LICENSE.txt +39 -0
- package/core-eU5KaYkz.d.ts +23 -0
- package/debug-D8Z_u244.d.ts +2698 -0
- package/debug.d.ts +2 -0
- package/debug.js +1 -0
- package/driver.d.ts +27 -0
- package/driver.js +74 -0
- package/encoding-DWlbPq-e.js +7792 -0
- package/engine-BPFnHT9N.d.ts +86 -0
- package/engine-CgCMdGGd.js +324 -0
- package/errors-DHwz1Vho.js +3661 -0
- package/group-B4eyJKTA.js +15958 -0
- package/index.d.ts +645 -0
- package/index.js +37 -0
- package/manifest-DKe2Je6Z.js +208 -0
- package/notify.d.ts +2 -0
- package/notify.js +1 -0
- package/objects-MeXIDDFo.d.ts +625 -0
- package/package.json +62 -4
- package/readers-DyjxJEkL.js +479 -0
- package/readers-Oh4tO2dK.d.ts +57 -0
- package/router-DHPJNvbt.js +341 -0
- package/router-DpDpAJjz.d.ts +54 -0
- package/session.d.ts +8 -0
- package/session.js +3476 -0
- package/setup.d.ts +2 -0
- package/setup.js +189 -0
- package/sha256-0jiTgVJu.js +123 -0
- package/sqlite-capability-C7-SYdD7.d.ts +87 -0
- package/sqlite-capability-CrCej3Po.js +478 -0
- package/sqlite.d.ts +75 -0
- package/sqlite.js +528 -0
- package/store-DrYjcoru.js +59 -0
- package/store-capability-CDoVafZL.js +387 -0
- package/store.d.ts +20 -0
- package/store.js +3 -0
- package/user-capability-CLkDsrCX.d.ts +40 -0
- package/user-capability-Cv0oJhhv.js +273 -0
- package/wasm.d.ts +223 -0
- package/wasm.js +1453 -0
|
@@ -0,0 +1,2698 @@
|
|
|
1
|
+
//#region src/syntax.d.ts
|
|
2
|
+
type SyntaxErrorCode = 'unterminated interpolation' | 'empty interpolation' | 'invalid text escape' | 'invalid text indentation' | 'invalid text delimiter' | 'bad character' | 'unterminated text' | 'bad unit' | 'unexpected token' | 'not a container';
|
|
3
|
+
/** All offsets index the original TS string; line and col count Unicode scalars. */
|
|
4
|
+
type Trivia = {
|
|
5
|
+
col: number;
|
|
6
|
+
end: number;
|
|
7
|
+
kind: 'bom' | 'space' | 'comment' | 'continuation';
|
|
8
|
+
line: number;
|
|
9
|
+
pos: number;
|
|
10
|
+
raw: string;
|
|
11
|
+
};
|
|
12
|
+
type SyntaxRule = 'Source' | 'Entry' | 'Error' | 'Declaration' | 'Use' | 'Handler' | 'Parameter' | 'Function' | 'Block' | 'Body' | 'Statement' | 'SimpleStatement' | 'ExpressionList' | 'Container' | 'AndWait' | 'Send' | 'AskTell' | 'TellBlock' | 'TimeoutBlock' | 'OperationLine' | 'Wait' | 'Event' | 'If' | 'Repeat' | 'Collecting' | 'Match' | 'Try' | 'OfferClause' | 'OfferParameter' | 'RecoveryMarker' | 'ChooseOffer' | 'Replace' | 'IgnoringCase' | 'Expression' | 'Lambda' | 'Whose' | 'EveryHead' | 'WhoseKey' | 'Default' | 'Or' | 'And' | 'Not' | 'Comparison' | 'Concat' | 'Range' | 'Additive' | 'Multiplicative' | 'Power' | 'Unary' | 'Conversion' | 'Kind' | 'ChunkLevel' | 'Postfix' | 'Key' | 'Call' | 'Primary' | 'Interpolated' | 'Chunk' | 'The' | 'List' | 'MapKey' | 'Map' | 'Pattern' | 'PatternPrimary' | 'TextPattern' | 'Alternation' | 'Element' | 'Atom' | 'BinaryPattern' | 'Field' | 'AsText' | 'FieldType' | 'BinaryBuild' | 'Name' | 'MessageName' | 'Label';
|
|
13
|
+
type SyntaxElement = SyntaxNode | Token;
|
|
14
|
+
/** Children are ordered and own each source character exactly once. Spans include trivia. */
|
|
15
|
+
type SyntaxNode = {
|
|
16
|
+
children: readonly SyntaxElement[];
|
|
17
|
+
end: number;
|
|
18
|
+
kind: 'node';
|
|
19
|
+
rule: SyntaxRule;
|
|
20
|
+
start: number;
|
|
21
|
+
};
|
|
22
|
+
/** Reconstruct source by walking the tree, without retaining a second source copy. */
|
|
23
|
+
declare const syntaxText: (tree: SyntaxNode) => string;
|
|
24
|
+
/** A labelled message uses its Selector as its semantic and dispatch name. */
|
|
25
|
+
declare const syntaxSelector: (node: SyntaxNode, name: string) => string;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/lexer.d.ts
|
|
28
|
+
type Mode = 'operand' | 'operator' | 'pattern' | 'unit' | 'type';
|
|
29
|
+
type TokType = 'num' | 'str' | 'template' | 'word' | 'op' | 'unit' | 'patopen' | 'patclose' | 'binopen' | 'nl' | 'eof' | 'error';
|
|
30
|
+
type Token = {
|
|
31
|
+
code?: SyntaxErrorCode;
|
|
32
|
+
col: number;
|
|
33
|
+
end: number;
|
|
34
|
+
incomplete?: boolean;
|
|
35
|
+
kind: 'token';
|
|
36
|
+
leadingTrivia: readonly Trivia[];
|
|
37
|
+
line: number;
|
|
38
|
+
mode: Mode;
|
|
39
|
+
parts?: TextPart[];
|
|
40
|
+
pos: number;
|
|
41
|
+
raw: string;
|
|
42
|
+
spaceBefore: boolean;
|
|
43
|
+
t: TokType;
|
|
44
|
+
v: string;
|
|
45
|
+
};
|
|
46
|
+
type TextPart = {
|
|
47
|
+
end: number;
|
|
48
|
+
hole?: {
|
|
49
|
+
at: number;
|
|
50
|
+
end: number;
|
|
51
|
+
start: number;
|
|
52
|
+
};
|
|
53
|
+
start: number;
|
|
54
|
+
value: string;
|
|
55
|
+
};
|
|
56
|
+
declare class Lexer {
|
|
57
|
+
readonly src: string;
|
|
58
|
+
private readonly fences;
|
|
59
|
+
private readonly lineStarts;
|
|
60
|
+
private readonly surrogateOffsets;
|
|
61
|
+
constructor(src: string);
|
|
62
|
+
where(pos: number): {
|
|
63
|
+
col: number;
|
|
64
|
+
line: number;
|
|
65
|
+
};
|
|
66
|
+
private surrogatesBefore;
|
|
67
|
+
tok(t: TokType, v: string, pos: number, end: number, spaceBefore: boolean, mode: Mode, code?: SyntaxErrorCode): Token;
|
|
68
|
+
private trivia;
|
|
69
|
+
private fenced;
|
|
70
|
+
private scanFenced;
|
|
71
|
+
lex(start: number, mode: Mode): Token;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/semantic.d.ts
|
|
75
|
+
/** Half-open UTF-16 offsets, with a 1-based Unicode scalar start position. */
|
|
76
|
+
type SourceSpan = {
|
|
77
|
+
col: number;
|
|
78
|
+
end: number;
|
|
79
|
+
line: number;
|
|
80
|
+
start: number;
|
|
81
|
+
};
|
|
82
|
+
type BindingKind = 'local' | 'parameter' | 'script variable' | 'constant' | 'function' | 'handler' | 'object' | 'builtin constant' | 'builtin function';
|
|
83
|
+
type ExportKind = 'constant' | 'function' | 'handler';
|
|
84
|
+
/** Argument counts accepted by a statically named function. */
|
|
85
|
+
type FunctionContract = {
|
|
86
|
+
required: number;
|
|
87
|
+
total: number;
|
|
88
|
+
/** Takes any number of arguments past `required`. */
|
|
89
|
+
variadic?: boolean;
|
|
90
|
+
};
|
|
91
|
+
type LibraryExport = ExportKind | {
|
|
92
|
+
contract?: FunctionContract;
|
|
93
|
+
kind: ExportKind;
|
|
94
|
+
maySuspend?: boolean;
|
|
95
|
+
};
|
|
96
|
+
type Binding = {
|
|
97
|
+
contract?: FunctionContract;
|
|
98
|
+
id: number;
|
|
99
|
+
importedFrom?: {
|
|
100
|
+
library: string;
|
|
101
|
+
name: string;
|
|
102
|
+
};
|
|
103
|
+
initial: 'nothing' | 'parameter' | 'declaration';
|
|
104
|
+
kind: BindingKind;
|
|
105
|
+
name: string;
|
|
106
|
+
scope: number;
|
|
107
|
+
span: SourceSpan | null;
|
|
108
|
+
};
|
|
109
|
+
type SemanticScope = {
|
|
110
|
+
bindings: readonly Binding[];
|
|
111
|
+
captures: readonly Binding[];
|
|
112
|
+
id: number;
|
|
113
|
+
kind: 'unit' | 'handler' | 'function' | 'lambda';
|
|
114
|
+
parent: number | null;
|
|
115
|
+
};
|
|
116
|
+
type NameRole = 'declaration' | 'binding' | 'capture' | 'value' | 'call' | 'write' | 'binary size' | 'command' | 'message' | 'offer' | 'grant' | 'receiver' | 'import' | 'library';
|
|
117
|
+
type SemanticName = {
|
|
118
|
+
binding: Binding | null;
|
|
119
|
+
kind: 'name';
|
|
120
|
+
role: NameRole;
|
|
121
|
+
span: SourceSpan;
|
|
122
|
+
text: string;
|
|
123
|
+
};
|
|
124
|
+
type SemanticToken = {
|
|
125
|
+
kind: 'token';
|
|
126
|
+
raw: string;
|
|
127
|
+
span: SourceSpan;
|
|
128
|
+
text: string;
|
|
129
|
+
type: Exclude<TokType, 'nl' | 'eof' | 'error'>;
|
|
130
|
+
};
|
|
131
|
+
/** Production/operator structure is retained for lowering; trivia is omitted. */
|
|
132
|
+
type SemanticNode = {
|
|
133
|
+
children: readonly SemanticElement[];
|
|
134
|
+
kind: 'node';
|
|
135
|
+
rule: SyntaxRule;
|
|
136
|
+
scope: number;
|
|
137
|
+
span: SourceSpan;
|
|
138
|
+
};
|
|
139
|
+
type SemanticElement = SemanticNode | SemanticName | SemanticToken;
|
|
140
|
+
type SemanticTree = {
|
|
141
|
+
/**
|
|
142
|
+
* Each Host Command call, as `offset grant.operation tell|ask`, in source
|
|
143
|
+
* order. Resolution depends on the Grants, so it joins the compile cache key.
|
|
144
|
+
*/
|
|
145
|
+
commands?: readonly string[];
|
|
146
|
+
/** Each top-level declaration's Declaration Documentation, in source order. */
|
|
147
|
+
docs?: readonly string[];
|
|
148
|
+
/** The unit's Handlers that may suspend (chapter 5, Suspension Points). */
|
|
149
|
+
maySuspend?: readonly string[];
|
|
150
|
+
root: SemanticNode;
|
|
151
|
+
scopes: readonly SemanticScope[];
|
|
152
|
+
};
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/view.d.ts
|
|
155
|
+
type Pos = {
|
|
156
|
+
col: number;
|
|
157
|
+
line: number;
|
|
158
|
+
};
|
|
159
|
+
type Expr = {
|
|
160
|
+
k: 'number';
|
|
161
|
+
pos: Pos;
|
|
162
|
+
text: string;
|
|
163
|
+
} | {
|
|
164
|
+
k: 'quantity';
|
|
165
|
+
number: string;
|
|
166
|
+
pos: Pos;
|
|
167
|
+
unit: string;
|
|
168
|
+
} | {
|
|
169
|
+
k: 'text';
|
|
170
|
+
pos: Pos;
|
|
171
|
+
value: string;
|
|
172
|
+
} | {
|
|
173
|
+
k: 'literal';
|
|
174
|
+
pos: Pos;
|
|
175
|
+
value: 'true' | 'false' | 'nothing';
|
|
176
|
+
} | {
|
|
177
|
+
k: 'me';
|
|
178
|
+
pos: Pos;
|
|
179
|
+
} | {
|
|
180
|
+
k: 'target';
|
|
181
|
+
pos: Pos;
|
|
182
|
+
} | {
|
|
183
|
+
k: 'name';
|
|
184
|
+
name: SemanticName;
|
|
185
|
+
pos: Pos;
|
|
186
|
+
} | {
|
|
187
|
+
k: 'pin';
|
|
188
|
+
name: SemanticName;
|
|
189
|
+
pos: Pos;
|
|
190
|
+
} | {
|
|
191
|
+
fold: boolean;
|
|
192
|
+
k: 'binary';
|
|
193
|
+
l: Expr;
|
|
194
|
+
op: string;
|
|
195
|
+
pos: Pos;
|
|
196
|
+
r: Expr;
|
|
197
|
+
} | {
|
|
198
|
+
fold: boolean;
|
|
199
|
+
k: 'member';
|
|
200
|
+
l: Expr;
|
|
201
|
+
neg: boolean;
|
|
202
|
+
pos: Pos;
|
|
203
|
+
r: Expr;
|
|
204
|
+
} | {
|
|
205
|
+
k: 'is-kind';
|
|
206
|
+
kind: string;
|
|
207
|
+
l: Expr;
|
|
208
|
+
neg: boolean;
|
|
209
|
+
pos: Pos;
|
|
210
|
+
} | {
|
|
211
|
+
k: 'is-empty';
|
|
212
|
+
l: Expr;
|
|
213
|
+
neg: boolean;
|
|
214
|
+
pos: Pos;
|
|
215
|
+
} | {
|
|
216
|
+
e: Expr;
|
|
217
|
+
k: 'can-convert' | 'convert';
|
|
218
|
+
kind: string;
|
|
219
|
+
pos: Pos;
|
|
220
|
+
} | {
|
|
221
|
+
e: Expr;
|
|
222
|
+
k: 'not' | 'negate';
|
|
223
|
+
pos: Pos;
|
|
224
|
+
} | {
|
|
225
|
+
k: 'and' | 'or' | 'otherwise';
|
|
226
|
+
l: Expr;
|
|
227
|
+
pos: Pos;
|
|
228
|
+
r: Expr;
|
|
229
|
+
} | {
|
|
230
|
+
base: Expr;
|
|
231
|
+
k: 'key';
|
|
232
|
+
key: string;
|
|
233
|
+
optional?: boolean;
|
|
234
|
+
pos: Pos;
|
|
235
|
+
} | {
|
|
236
|
+
base: Expr;
|
|
237
|
+
k: 'computed';
|
|
238
|
+
key: Expr;
|
|
239
|
+
optional?: boolean;
|
|
240
|
+
pos: Pos;
|
|
241
|
+
} | {
|
|
242
|
+
base: Expr;
|
|
243
|
+
delimiter: Expr | null;
|
|
244
|
+
k: 'property';
|
|
245
|
+
name: string;
|
|
246
|
+
pos: Pos;
|
|
247
|
+
} | {
|
|
248
|
+
base: Expr;
|
|
249
|
+
delimiter: Expr | null;
|
|
250
|
+
index: Expr | number;
|
|
251
|
+
k: 'chunk';
|
|
252
|
+
kind: string;
|
|
253
|
+
pos: Pos;
|
|
254
|
+
} | {
|
|
255
|
+
base: Expr;
|
|
256
|
+
index: Expr | number;
|
|
257
|
+
k: 'element';
|
|
258
|
+
pos: Pos;
|
|
259
|
+
} | {
|
|
260
|
+
base: Expr;
|
|
261
|
+
k: 'element-count';
|
|
262
|
+
pos: Pos;
|
|
263
|
+
} | {
|
|
264
|
+
items: {
|
|
265
|
+
e: Expr;
|
|
266
|
+
spread: boolean;
|
|
267
|
+
}[];
|
|
268
|
+
k: 'list';
|
|
269
|
+
pos: Pos;
|
|
270
|
+
} | {
|
|
271
|
+
entries: {
|
|
272
|
+
key: string;
|
|
273
|
+
value: Expr;
|
|
274
|
+
}[];
|
|
275
|
+
k: 'map';
|
|
276
|
+
pos: Pos;
|
|
277
|
+
} | {
|
|
278
|
+
k: 'pattern';
|
|
279
|
+
pattern: TextPattern;
|
|
280
|
+
pos: Pos;
|
|
281
|
+
} | {
|
|
282
|
+
fields: BuildField[];
|
|
283
|
+
k: 'build';
|
|
284
|
+
pos: Pos;
|
|
285
|
+
} | {
|
|
286
|
+
k: 'match-all';
|
|
287
|
+
pat: Expr;
|
|
288
|
+
pos: Pos;
|
|
289
|
+
src: Expr;
|
|
290
|
+
} | Replace | {
|
|
291
|
+
args: Expr[];
|
|
292
|
+
k: 'call';
|
|
293
|
+
name: SemanticName;
|
|
294
|
+
pos: Pos;
|
|
295
|
+
} | Lambda | Whose | {
|
|
296
|
+
k: 'whose-it';
|
|
297
|
+
pos: Pos;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* `every K of x whose c`, or `the o K of x whose c` (ADR 0074). `index` is
|
|
301
|
+
* the ordinal's, -1 for `last`, or null for `every`; `at` is the chunk word.
|
|
302
|
+
*/
|
|
303
|
+
type Whose = {
|
|
304
|
+
at: Pos;
|
|
305
|
+
cond: Expr;
|
|
306
|
+
delimiter: Expr | null;
|
|
307
|
+
index: number | null;
|
|
308
|
+
k: 'whose';
|
|
309
|
+
kind: string;
|
|
310
|
+
pos: Pos;
|
|
311
|
+
src: Expr;
|
|
312
|
+
};
|
|
313
|
+
type Replace = {
|
|
314
|
+
first: boolean;
|
|
315
|
+
k: 'replace';
|
|
316
|
+
pat: Expr;
|
|
317
|
+
pos: Pos;
|
|
318
|
+
target: Expr;
|
|
319
|
+
value: Expr;
|
|
320
|
+
};
|
|
321
|
+
type Lambda = {
|
|
322
|
+
body: Expr | Stmt[];
|
|
323
|
+
end: Pos | null;
|
|
324
|
+
k: 'lambda';
|
|
325
|
+
params: Pattern[];
|
|
326
|
+
pos: Pos;
|
|
327
|
+
scope: number;
|
|
328
|
+
};
|
|
329
|
+
type TextPattern = {
|
|
330
|
+
els: PatternElement[];
|
|
331
|
+
pos: Pos;
|
|
332
|
+
};
|
|
333
|
+
type PatternElement = {
|
|
334
|
+
k: 'text';
|
|
335
|
+
value: string;
|
|
336
|
+
} | {
|
|
337
|
+
e: PatternElement;
|
|
338
|
+
k: 'count';
|
|
339
|
+
n: string;
|
|
340
|
+
} | {
|
|
341
|
+
els: PatternElement[];
|
|
342
|
+
k: 'group';
|
|
343
|
+
} | {
|
|
344
|
+
e: Expr;
|
|
345
|
+
k: 'splice';
|
|
346
|
+
} | {
|
|
347
|
+
e: PatternElement;
|
|
348
|
+
k: 'capture';
|
|
349
|
+
name: SemanticName;
|
|
350
|
+
} | {
|
|
351
|
+
k: 'words';
|
|
352
|
+
words: string;
|
|
353
|
+
} | {
|
|
354
|
+
e: PatternElement;
|
|
355
|
+
k: 'repeat';
|
|
356
|
+
phrase: 'one or more of' | 'zero or more of' | 'optional';
|
|
357
|
+
} | {
|
|
358
|
+
k: 'typed';
|
|
359
|
+
kind: string;
|
|
360
|
+
} | {
|
|
361
|
+
k: 'alternation';
|
|
362
|
+
options: PatternElement[];
|
|
363
|
+
} | {
|
|
364
|
+
as: string | null;
|
|
365
|
+
e: PatternElement;
|
|
366
|
+
fold: boolean;
|
|
367
|
+
k: 'suffixed';
|
|
368
|
+
lazily: boolean;
|
|
369
|
+
};
|
|
370
|
+
type Literal = {
|
|
371
|
+
k: 'number';
|
|
372
|
+
negative: boolean;
|
|
373
|
+
text: string;
|
|
374
|
+
unit: string | null;
|
|
375
|
+
} | {
|
|
376
|
+
k: 'text';
|
|
377
|
+
value: string;
|
|
378
|
+
} | {
|
|
379
|
+
k: 'word';
|
|
380
|
+
value: 'true' | 'false' | 'nothing';
|
|
381
|
+
};
|
|
382
|
+
type Pattern = {
|
|
383
|
+
k: 'bind';
|
|
384
|
+
name: SemanticName;
|
|
385
|
+
pos: Pos;
|
|
386
|
+
} | {
|
|
387
|
+
k: 'wildcard';
|
|
388
|
+
pos: Pos;
|
|
389
|
+
} | {
|
|
390
|
+
k: 'as';
|
|
391
|
+
name: SemanticName;
|
|
392
|
+
p: Pattern;
|
|
393
|
+
pos: Pos;
|
|
394
|
+
} | {
|
|
395
|
+
k: 'literal';
|
|
396
|
+
pos: Pos;
|
|
397
|
+
value: Literal;
|
|
398
|
+
} | {
|
|
399
|
+
k: 'pin';
|
|
400
|
+
name: SemanticName;
|
|
401
|
+
pos: Pos;
|
|
402
|
+
} | {
|
|
403
|
+
items: Pattern[];
|
|
404
|
+
k: 'list';
|
|
405
|
+
pos: Pos;
|
|
406
|
+
rest: {
|
|
407
|
+
name: SemanticName | null;
|
|
408
|
+
} | null;
|
|
409
|
+
} | {
|
|
410
|
+
entries: {
|
|
411
|
+
key: string;
|
|
412
|
+
value: Pattern;
|
|
413
|
+
}[];
|
|
414
|
+
k: 'map';
|
|
415
|
+
pos: Pos;
|
|
416
|
+
} | {
|
|
417
|
+
k: 'text';
|
|
418
|
+
pattern: TextPattern;
|
|
419
|
+
pos: Pos;
|
|
420
|
+
} | {
|
|
421
|
+
fields: BinaryField[];
|
|
422
|
+
k: 'binary';
|
|
423
|
+
pos: Pos;
|
|
424
|
+
};
|
|
425
|
+
type Size = {
|
|
426
|
+
k: 'number';
|
|
427
|
+
text: string;
|
|
428
|
+
} | {
|
|
429
|
+
k: 'pin';
|
|
430
|
+
name: SemanticName;
|
|
431
|
+
pos: Pos;
|
|
432
|
+
} | {
|
|
433
|
+
k: 'name';
|
|
434
|
+
name: SemanticName;
|
|
435
|
+
pos: Pos;
|
|
436
|
+
} | {
|
|
437
|
+
e: Expr;
|
|
438
|
+
k: 'expr';
|
|
439
|
+
};
|
|
440
|
+
type FieldType = {
|
|
441
|
+
k: 'int';
|
|
442
|
+
order: string | null;
|
|
443
|
+
type: string;
|
|
444
|
+
} | {
|
|
445
|
+
asText: boolean;
|
|
446
|
+
k: 'sized';
|
|
447
|
+
size: Size;
|
|
448
|
+
unit: 'bits' | 'bytes';
|
|
449
|
+
};
|
|
450
|
+
type BinaryField = {
|
|
451
|
+
k: 'literal';
|
|
452
|
+
pos: Pos;
|
|
453
|
+
value: Literal;
|
|
454
|
+
} | {
|
|
455
|
+
asText: boolean;
|
|
456
|
+
k: 'rest';
|
|
457
|
+
name: SemanticName | null;
|
|
458
|
+
pos: Pos;
|
|
459
|
+
} | {
|
|
460
|
+
k: 'field';
|
|
461
|
+
name: SemanticName | null;
|
|
462
|
+
pos: Pos;
|
|
463
|
+
type: FieldType;
|
|
464
|
+
};
|
|
465
|
+
type BuildField = {
|
|
466
|
+
pos: Pos;
|
|
467
|
+
type: FieldType | null;
|
|
468
|
+
value: Expr;
|
|
469
|
+
};
|
|
470
|
+
/** A Guard, and its first token, which its test is placed at. */
|
|
471
|
+
type Guard = {
|
|
472
|
+
e: Expr;
|
|
473
|
+
pos: Pos;
|
|
474
|
+
};
|
|
475
|
+
type Event = {
|
|
476
|
+
from: Expr | null;
|
|
477
|
+
message: string;
|
|
478
|
+
pats: Pattern[];
|
|
479
|
+
pos: Pos;
|
|
480
|
+
};
|
|
481
|
+
type WaitBranch = {
|
|
482
|
+
body: Stmt[];
|
|
483
|
+
event: Event;
|
|
484
|
+
guard: Guard | null;
|
|
485
|
+
k: 'when';
|
|
486
|
+
pos: Pos;
|
|
487
|
+
} | {
|
|
488
|
+
body: Stmt[];
|
|
489
|
+
duration: Expr;
|
|
490
|
+
k: 'after';
|
|
491
|
+
pos: Pos;
|
|
492
|
+
};
|
|
493
|
+
type Collecting = {
|
|
494
|
+
pos: Pos;
|
|
495
|
+
target: SemanticName;
|
|
496
|
+
value: Expr;
|
|
497
|
+
};
|
|
498
|
+
type RepeatHead = {
|
|
499
|
+
k: 'each';
|
|
500
|
+
pat: Pattern;
|
|
501
|
+
src: Expr;
|
|
502
|
+
} | {
|
|
503
|
+
cond: Expr;
|
|
504
|
+
k: 'while' | 'until';
|
|
505
|
+
} | {
|
|
506
|
+
k: 'forever';
|
|
507
|
+
} | {
|
|
508
|
+
count: Expr;
|
|
509
|
+
k: 'times';
|
|
510
|
+
};
|
|
511
|
+
type Offer = {
|
|
512
|
+
body: Stmt[];
|
|
513
|
+
name: string;
|
|
514
|
+
params: SemanticName[];
|
|
515
|
+
pos: Pos;
|
|
516
|
+
};
|
|
517
|
+
type Catch = {
|
|
518
|
+
body: Stmt[];
|
|
519
|
+
guard: Guard | null;
|
|
520
|
+
pat: Pattern;
|
|
521
|
+
pos: Pos;
|
|
522
|
+
recovery: boolean;
|
|
523
|
+
};
|
|
524
|
+
type Try = {
|
|
525
|
+
body: Stmt[];
|
|
526
|
+
catches: Catch[];
|
|
527
|
+
finally: Stmt[] | null;
|
|
528
|
+
k: 'try';
|
|
529
|
+
offers: Offer[];
|
|
530
|
+
pos: Pos;
|
|
531
|
+
};
|
|
532
|
+
type Stmt = {
|
|
533
|
+
args: Expr[];
|
|
534
|
+
k: 'choose-offer';
|
|
535
|
+
name: string;
|
|
536
|
+
pos: Pos;
|
|
537
|
+
} | {
|
|
538
|
+
k: 'put';
|
|
539
|
+
pos: Pos;
|
|
540
|
+
prep: 'into' | 'after' | 'before';
|
|
541
|
+
spread: boolean;
|
|
542
|
+
target: Expr;
|
|
543
|
+
value: Expr;
|
|
544
|
+
} | {
|
|
545
|
+
k: 'let';
|
|
546
|
+
pat: Pattern;
|
|
547
|
+
pos: Pos;
|
|
548
|
+
value: Expr;
|
|
549
|
+
} | {
|
|
550
|
+
k: 'set';
|
|
551
|
+
pos: Pos;
|
|
552
|
+
target: Expr;
|
|
553
|
+
value: Expr;
|
|
554
|
+
} | {
|
|
555
|
+
k: 'arithmetic';
|
|
556
|
+
op: 'add' | 'subtract' | 'multiply' | 'divide';
|
|
557
|
+
pos: Pos;
|
|
558
|
+
target: Expr;
|
|
559
|
+
value: Expr;
|
|
560
|
+
} | {
|
|
561
|
+
k: 'delete';
|
|
562
|
+
pos: Pos;
|
|
563
|
+
target: Expr;
|
|
564
|
+
} | {
|
|
565
|
+
args: Expr[];
|
|
566
|
+
k: 'send';
|
|
567
|
+
/** The message name, or for `send (e)` the expression that computes it. */
|
|
568
|
+
message: string | Expr;
|
|
569
|
+
pos: Pos;
|
|
570
|
+
/** Which `with` items are spreads, when any is (ADR 0064). */
|
|
571
|
+
spread?: boolean[];
|
|
572
|
+
target: Expr;
|
|
573
|
+
wait: boolean;
|
|
574
|
+
} | {
|
|
575
|
+
args: Expr[];
|
|
576
|
+
grant: string;
|
|
577
|
+
k: 'ask' | 'tell';
|
|
578
|
+
operation: string;
|
|
579
|
+
pos: Pos;
|
|
580
|
+
wait: boolean;
|
|
581
|
+
} |
|
|
582
|
+
/** A `tell` block's lines, each the call the checker chose (ADR 0063). */
|
|
583
|
+
{
|
|
584
|
+
k: 'tell-block';
|
|
585
|
+
lines: Stmt[];
|
|
586
|
+
pos: Pos;
|
|
587
|
+
} | {
|
|
588
|
+
duration: Expr;
|
|
589
|
+
k: 'wait';
|
|
590
|
+
pos: Pos;
|
|
591
|
+
} | {
|
|
592
|
+
event: Event;
|
|
593
|
+
k: 'wait-for';
|
|
594
|
+
pos: Pos;
|
|
595
|
+
timeout: Expr | null;
|
|
596
|
+
} | {
|
|
597
|
+
branches: WaitBranch[];
|
|
598
|
+
k: 'wait-block';
|
|
599
|
+
pos: Pos;
|
|
600
|
+
} | {
|
|
601
|
+
body: Stmt[];
|
|
602
|
+
end: Pos;
|
|
603
|
+
k: 'join';
|
|
604
|
+
pos: Pos;
|
|
605
|
+
} |
|
|
606
|
+
/** A Timeout Block (ADR 0073). */
|
|
607
|
+
{
|
|
608
|
+
body: Stmt[];
|
|
609
|
+
duration: Expr;
|
|
610
|
+
k: 'timeout-block';
|
|
611
|
+
pos: Pos;
|
|
612
|
+
} | {
|
|
613
|
+
k: 'return' | 'veto';
|
|
614
|
+
pos: Pos;
|
|
615
|
+
value: Expr | null;
|
|
616
|
+
} | {
|
|
617
|
+
k: 'pass';
|
|
618
|
+
message: string;
|
|
619
|
+
pos: Pos;
|
|
620
|
+
} | {
|
|
621
|
+
k: 'exit' | 'next';
|
|
622
|
+
pos: Pos;
|
|
623
|
+
} | {
|
|
624
|
+
k: 'throw';
|
|
625
|
+
pos: Pos;
|
|
626
|
+
value: Expr;
|
|
627
|
+
} | (Omit<Replace, 'k'> & {
|
|
628
|
+
k: 'replace-statement';
|
|
629
|
+
}) | {
|
|
630
|
+
call: Expr & {
|
|
631
|
+
k: 'call';
|
|
632
|
+
};
|
|
633
|
+
k: 'call';
|
|
634
|
+
pos: Pos;
|
|
635
|
+
wait: boolean;
|
|
636
|
+
} | {
|
|
637
|
+
args: Expr[];
|
|
638
|
+
k: 'command';
|
|
639
|
+
name: SemanticName;
|
|
640
|
+
pos: Pos;
|
|
641
|
+
wait: boolean;
|
|
642
|
+
} | {
|
|
643
|
+
arms: {
|
|
644
|
+
body: Stmt[];
|
|
645
|
+
cond: Expr;
|
|
646
|
+
}[];
|
|
647
|
+
else: Stmt[] | null;
|
|
648
|
+
k: 'if';
|
|
649
|
+
pos: Pos;
|
|
650
|
+
} | {
|
|
651
|
+
body: Stmt[];
|
|
652
|
+
collect: Collecting | null;
|
|
653
|
+
head: RepeatHead;
|
|
654
|
+
k: 'repeat';
|
|
655
|
+
pos: Pos;
|
|
656
|
+
} | {
|
|
657
|
+
branches: {
|
|
658
|
+
body: Stmt[];
|
|
659
|
+
guard: Guard | null;
|
|
660
|
+
pat: Pattern;
|
|
661
|
+
pos: Pos;
|
|
662
|
+
search: boolean;
|
|
663
|
+
}[];
|
|
664
|
+
else: Stmt[] | null;
|
|
665
|
+
fold: boolean;
|
|
666
|
+
k: 'match';
|
|
667
|
+
pos: Pos;
|
|
668
|
+
subject: Expr;
|
|
669
|
+
} | Try;
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region src/code-unit.d.ts
|
|
672
|
+
type Operand = number | string;
|
|
673
|
+
type Instruction = {
|
|
674
|
+
col: number;
|
|
675
|
+
line: number;
|
|
676
|
+
op: string;
|
|
677
|
+
/** `op`'s index in the instruction table. The machine dispatches on it. */
|
|
678
|
+
opcode: number;
|
|
679
|
+
operands: Operand[];
|
|
680
|
+
/** The Cost Model rate it charges, from `rateOf`, or -1 if none. */
|
|
681
|
+
rate: number;
|
|
682
|
+
};
|
|
683
|
+
type BodyKind = 'init' | 'function' | 'handler' | 'fallback' | 'lambda' | 'event';
|
|
684
|
+
type Body = {
|
|
685
|
+
/** First body instruction after successful Handler dispatch. */
|
|
686
|
+
acceptedAt?: number;
|
|
687
|
+
captures: number;
|
|
688
|
+
/** The slot of the first capture, for a Lambda or an event test. */
|
|
689
|
+
captureStart: number;
|
|
690
|
+
clause: number | null;
|
|
691
|
+
deciding?: boolean;
|
|
692
|
+
/** For a function, each parameter's default definition, or null. */
|
|
693
|
+
defaults: (number | null)[];
|
|
694
|
+
/** A top-level function's or Handler Clause's Declaration Documentation. */
|
|
695
|
+
doc?: string;
|
|
696
|
+
/** Local slot bound by an error Handler’s `during` suffix. */
|
|
697
|
+
duringSlot?: number;
|
|
698
|
+
/** One past the body's last instruction. */
|
|
699
|
+
end: number;
|
|
700
|
+
index: number;
|
|
701
|
+
kind: BodyKind;
|
|
702
|
+
/** The name of each local slot: a name, or a temp's `(slot)`. */
|
|
703
|
+
locals: string[];
|
|
704
|
+
maySuspend: boolean;
|
|
705
|
+
name: string;
|
|
706
|
+
/** Each parameter's name, or `…` for a pattern. */
|
|
707
|
+
params: string[];
|
|
708
|
+
policy?: 'queued' | 'dropping' | 'replacing';
|
|
709
|
+
start: number;
|
|
710
|
+
};
|
|
711
|
+
type UnwindEntry = {
|
|
712
|
+
depth: number;
|
|
713
|
+
/** One past the range's last instruction. */
|
|
714
|
+
end: number;
|
|
715
|
+
kind: 'catch' | 'finally' | 'guard' | 'offer';
|
|
716
|
+
start: number;
|
|
717
|
+
target: number;
|
|
718
|
+
};
|
|
719
|
+
type OfferEntry = {
|
|
720
|
+
body: number;
|
|
721
|
+
depth: number;
|
|
722
|
+
end: number;
|
|
723
|
+
offers: {
|
|
724
|
+
binds: number[];
|
|
725
|
+
name: string;
|
|
726
|
+
target: number;
|
|
727
|
+
}[];
|
|
728
|
+
};
|
|
729
|
+
type EventBranch = {
|
|
730
|
+
binds: number[];
|
|
731
|
+
body: number | null;
|
|
732
|
+
captures: number;
|
|
733
|
+
from: boolean;
|
|
734
|
+
kind: 'when';
|
|
735
|
+
message: string;
|
|
736
|
+
} | {
|
|
737
|
+
kind: 'after';
|
|
738
|
+
};
|
|
739
|
+
type EventEntry = {
|
|
740
|
+
branches: EventBranch[];
|
|
741
|
+
timeout: boolean;
|
|
742
|
+
};
|
|
743
|
+
type CodeUnit = {
|
|
744
|
+
bodies: Body[];
|
|
745
|
+
code: Instruction[];
|
|
746
|
+
/** Each constant's display form, in pool order. */
|
|
747
|
+
constants: string[];
|
|
748
|
+
definitions: string[];
|
|
749
|
+
events: EventEntry[];
|
|
750
|
+
kind: 'script' | 'library';
|
|
751
|
+
name: string;
|
|
752
|
+
objects: string[];
|
|
753
|
+
offers?: OfferEntry[];
|
|
754
|
+
/**
|
|
755
|
+
* The elements of each Text Pattern constant, by its pool index, for the
|
|
756
|
+
* machine that runs the unit; a template's splices stay in place.
|
|
757
|
+
*/
|
|
758
|
+
patterns: Map<number, readonly PatternElement[]>;
|
|
759
|
+
unwind: UnwindEntry[];
|
|
760
|
+
variables: string[];
|
|
761
|
+
};
|
|
762
|
+
/** Chapter 8's canonical disassembly: LF line ends, ending with one. */
|
|
763
|
+
declare const disassemble: (unit: CodeUnit) => string;
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region src/errors.d.ts
|
|
766
|
+
type HostErrorCode = 'clock backwards' | 'parent cycle' | 'duplicate object id' | 'name reused' | 'reentrant call' | 'wrong group' | 'library mismatch' | 'reserved name' | 'not adoptable' | 'invalid value' | 'invalid save' | 'save mismatch' | 'unknown call' | 'state too large' | 'effects pending' | 'effect state unknown' | 'invalid checkpoint';
|
|
767
|
+
declare class HostError extends Error {
|
|
768
|
+
readonly code: HostErrorCode;
|
|
769
|
+
constructor(code: HostErrorCode, message?: string);
|
|
770
|
+
}
|
|
771
|
+
/** A load-time diagnostic, or the first syntax error, as a LoadError carries it. */
|
|
772
|
+
type LoadDiagnostic = {
|
|
773
|
+
code: string;
|
|
774
|
+
col: number;
|
|
775
|
+
line: number;
|
|
776
|
+
message: string;
|
|
777
|
+
unit: string;
|
|
778
|
+
};
|
|
779
|
+
/** A rejected Load (chapter 9): its diagnostics, in order. */
|
|
780
|
+
declare class LoadError extends Error {
|
|
781
|
+
readonly diagnostics: readonly LoadDiagnostic[];
|
|
782
|
+
constructor(diagnostics: readonly LoadDiagnostic[]);
|
|
783
|
+
}
|
|
784
|
+
/** Load shedding at a Delivery's call, not a bug (chapter 9, Deliveries). */
|
|
785
|
+
declare class MailboxFull extends Error {
|
|
786
|
+
name: string;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* A Script-level error as the Host sees it, such as a Request's `send failed`
|
|
790
|
+
* or a `run end`'s error. Its `data` is a map, or Nothing.
|
|
791
|
+
*/
|
|
792
|
+
declare class ScriptError extends Error {
|
|
793
|
+
readonly code: string;
|
|
794
|
+
readonly data: Value;
|
|
795
|
+
constructor(code: string, message: string, data?: Value);
|
|
796
|
+
}
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/capabilities.d.ts
|
|
799
|
+
type Shape = {
|
|
800
|
+
k: 'any';
|
|
801
|
+
} | {
|
|
802
|
+
k: 'value';
|
|
803
|
+
} | {
|
|
804
|
+
k: 'kind';
|
|
805
|
+
kind: string;
|
|
806
|
+
} | {
|
|
807
|
+
k: 'object';
|
|
808
|
+
kind: string;
|
|
809
|
+
} | {
|
|
810
|
+
k: 'quantity';
|
|
811
|
+
unit: string;
|
|
812
|
+
} | {
|
|
813
|
+
k: 'unitKind';
|
|
814
|
+
kind: string;
|
|
815
|
+
} | {
|
|
816
|
+
k: 'list';
|
|
817
|
+
of: Shape;
|
|
818
|
+
} | {
|
|
819
|
+
fields: readonly {
|
|
820
|
+
key: string;
|
|
821
|
+
optional: boolean;
|
|
822
|
+
shape: Shape;
|
|
823
|
+
}[];
|
|
824
|
+
k: 'map';
|
|
825
|
+
open: boolean;
|
|
826
|
+
} | {
|
|
827
|
+
k: 'oneOf';
|
|
828
|
+
of: readonly Shape[];
|
|
829
|
+
} | {
|
|
830
|
+
k: 'optional';
|
|
831
|
+
of: Shape;
|
|
832
|
+
};
|
|
833
|
+
type FieldShape = Shape | {
|
|
834
|
+
optional: true;
|
|
835
|
+
shape: Shape;
|
|
836
|
+
};
|
|
837
|
+
/** The Shape constructors of `talk.ts`. */
|
|
838
|
+
declare const shape: {
|
|
839
|
+
any: Shape;
|
|
840
|
+
value: Shape;
|
|
841
|
+
nothing: Shape;
|
|
842
|
+
bool: Shape;
|
|
843
|
+
number: Shape;
|
|
844
|
+
text: Shape;
|
|
845
|
+
bytes: Shape;
|
|
846
|
+
instant: Shape;
|
|
847
|
+
civilDate: Shape;
|
|
848
|
+
range: Shape;
|
|
849
|
+
pattern: Shape;
|
|
850
|
+
function: Shape;
|
|
851
|
+
object: <N>(kind: ObjectKind<N>) => Shape;
|
|
852
|
+
quantityOf: (unit: string) => Shape;
|
|
853
|
+
quantityKind: (unitKind: string) => Shape;
|
|
854
|
+
listOf: (of: Shape) => Shape;
|
|
855
|
+
map: (fields: Record<string, FieldShape>) => Shape;
|
|
856
|
+
openMap: (fields: Record<string, FieldShape>) => Shape;
|
|
857
|
+
oneOf: (...of: Shape[]) => Shape;
|
|
858
|
+
optional: (of: Shape) => Shape;
|
|
859
|
+
};
|
|
860
|
+
type ScopeDecl = {
|
|
861
|
+
abandon: string;
|
|
862
|
+
opens: string;
|
|
863
|
+
} | {
|
|
864
|
+
closes: string;
|
|
865
|
+
};
|
|
866
|
+
/** Synchronous, unmetered participant lifecycle work. */
|
|
867
|
+
type SegmentContext<B> = {
|
|
868
|
+
readonly binding: B;
|
|
869
|
+
/** The first enrolled Grant. */
|
|
870
|
+
readonly grantName: string;
|
|
871
|
+
/** Enrolled, in enrollment order; `begin` sees only the first. */
|
|
872
|
+
readonly grants: readonly SegmentGrant<B>[];
|
|
873
|
+
readonly group: Group;
|
|
874
|
+
readonly now: bigint;
|
|
875
|
+
readonly runId: string;
|
|
876
|
+
readonly scriptName: string;
|
|
877
|
+
readonly segmentId: string;
|
|
878
|
+
};
|
|
879
|
+
type SegmentGrant<B> = {
|
|
880
|
+
readonly binding: B;
|
|
881
|
+
readonly grantName: string;
|
|
882
|
+
};
|
|
883
|
+
type EffectResult = {
|
|
884
|
+
detail?: string;
|
|
885
|
+
status: 'ok' | 'failed' | 'unknown';
|
|
886
|
+
};
|
|
887
|
+
type SegmentLifecycle<B> = {
|
|
888
|
+
begin(context: SegmentContext<B>): EffectResult;
|
|
889
|
+
commit(context: SegmentContext<B>): EffectResult;
|
|
890
|
+
rollback(context: SegmentContext<B>): EffectResult;
|
|
891
|
+
};
|
|
892
|
+
/** Compared by identity: Grants mapped to one coordinator share a Segment's participant (ADR 0069). */
|
|
893
|
+
type SegmentCoordinator = SegmentLifecycle<unknown>;
|
|
894
|
+
/** Maps each binding to its coordinator once, when a Grant is created. */
|
|
895
|
+
type CoordinatedLifecycle<B> = {
|
|
896
|
+
coordinator(binding: B): SegmentCoordinator;
|
|
897
|
+
};
|
|
898
|
+
type Cost = {
|
|
899
|
+
alloc?: number;
|
|
900
|
+
fuel: number;
|
|
901
|
+
};
|
|
902
|
+
type ErrorDecl = {
|
|
903
|
+
code: string;
|
|
904
|
+
fields?: Record<string, FieldShape>;
|
|
905
|
+
};
|
|
906
|
+
type OpBase = {
|
|
907
|
+
args?: Shape[];
|
|
908
|
+
/** Also callable as a Host Command, by its name alone (ADR 0094). */
|
|
909
|
+
command?: boolean;
|
|
910
|
+
cost: Cost;
|
|
911
|
+
/** Plain-text documentation, carried only by the Host Manifest. */
|
|
912
|
+
description?: string;
|
|
913
|
+
errors?: ErrorDecl[];
|
|
914
|
+
examples?: string[];
|
|
915
|
+
result?: Shape;
|
|
916
|
+
};
|
|
917
|
+
/** What the Core gives a Host function at each call (chapter 9, The call). */
|
|
918
|
+
type Call<B> = {
|
|
919
|
+
/** Queued, for a suspending call; ignored once the call isn't pending. */
|
|
920
|
+
answer(v: Value, lateCost?: {
|
|
921
|
+
fuel: number;
|
|
922
|
+
}): void;
|
|
923
|
+
readonly automatic: boolean;
|
|
924
|
+
readonly binding: B;
|
|
925
|
+
/** Draws more Fuel, before the work. Throws LimitReached. */
|
|
926
|
+
charge(fuel: number): void;
|
|
927
|
+
fail(e: ScriptError): void;
|
|
928
|
+
readonly grantName: string;
|
|
929
|
+
readonly group: Group;
|
|
930
|
+
readonly id: string;
|
|
931
|
+
readonly now: bigint;
|
|
932
|
+
readonly runId: string;
|
|
933
|
+
readonly scopeName?: string;
|
|
934
|
+
readonly scriptName: string;
|
|
935
|
+
readonly segmentId: string;
|
|
936
|
+
readonly signal: AbortSignal;
|
|
937
|
+
};
|
|
938
|
+
type ImmediateOp<B> = OpBase & {
|
|
939
|
+
do(call: Call<B>, ...args: Value[]): Value;
|
|
940
|
+
mode: 'immediate';
|
|
941
|
+
scope?: ScopeDecl;
|
|
942
|
+
segmentBound?: boolean;
|
|
943
|
+
};
|
|
944
|
+
type SuspendingOp<B> = OpBase & {
|
|
945
|
+
maxPendingMs?: number;
|
|
946
|
+
mode: 'suspending';
|
|
947
|
+
run?(call: Call<B>, ...args: Value[]): Promise<Value>;
|
|
948
|
+
start?(call: Call<B>, ...args: Value[]): void;
|
|
949
|
+
};
|
|
950
|
+
type FireOp<B> = OpBase & {
|
|
951
|
+
fire(call: Call<B>, ...args: Value[]): void;
|
|
952
|
+
mode: 'fire-and-forget';
|
|
953
|
+
};
|
|
954
|
+
type Operation<B> = ImmediateOp<B> | SuspendingOp<B> | FireOp<B>;
|
|
955
|
+
/** Thrown by `call.charge` when the Run's Fuel can't cover it. */
|
|
956
|
+
declare class LimitReached extends Error {
|
|
957
|
+
name: string;
|
|
958
|
+
}
|
|
959
|
+
type ReleaseReason = 'stop' | 'reload' | 'revoke' | 'disable';
|
|
960
|
+
/** One loaded Script's named Grant, identified within its Group. */
|
|
961
|
+
type GrantContext<B> = {
|
|
962
|
+
readonly binding: B;
|
|
963
|
+
readonly grantName: string;
|
|
964
|
+
readonly group: Group;
|
|
965
|
+
readonly now: bigint;
|
|
966
|
+
readonly reason: ReleaseReason;
|
|
967
|
+
readonly scriptName: string;
|
|
968
|
+
};
|
|
969
|
+
/** Synchronous, unmetered cleanup. Exceptions cannot refuse release. */
|
|
970
|
+
type ReleaseHook<B> = (context: GrantContext<B>) => void;
|
|
971
|
+
type CapabilityDef<B> = {
|
|
972
|
+
/** Maps a Grant's binding to its Segment Coordinator. */
|
|
973
|
+
coordinator?(binding: B): SegmentCoordinator;
|
|
974
|
+
/** A reusable template. Each load binds it to one Script. */
|
|
975
|
+
grant(ops: readonly string[] | 'all', binding: B): Grant<B>;
|
|
976
|
+
/** A plain lifecycle, making each Grant its own coordinator. */
|
|
977
|
+
readonly lifecycle?: SegmentLifecycle<B>;
|
|
978
|
+
readonly name: string;
|
|
979
|
+
/** Its Operations, ordered by name. */
|
|
980
|
+
readonly operations: ReadonlyMap<string, Operation<B>>;
|
|
981
|
+
release?(context: GrantContext<B>): void;
|
|
982
|
+
};
|
|
983
|
+
type Grant<B> = {
|
|
984
|
+
readonly binding: B;
|
|
985
|
+
readonly capability: CapabilityDef<B>;
|
|
986
|
+
/** Resolved at Grant creation; absent when the Grant is its own coordinator. */
|
|
987
|
+
readonly coordinator?: SegmentCoordinator;
|
|
988
|
+
readonly ops: ReadonlySet<string>;
|
|
989
|
+
};
|
|
990
|
+
/** Define a Capability, once per process (chapter 9, Capabilities). */
|
|
991
|
+
declare const defineCapability: <B = void>(name: string, ops: Record<string, Operation<B>>, lifecycle?: SegmentLifecycle<B> | CoordinatedLifecycle<B>, release?: ReleaseHook<B>) => CapabilityDef<B>;
|
|
992
|
+
//#endregion
|
|
993
|
+
//#region src/effects.d.ts
|
|
994
|
+
type OperationMode = 'immediate' | 'suspending' | 'fire-and-forget';
|
|
995
|
+
/** Each Grant's Operations, by the name the Script uses. */
|
|
996
|
+
type GrantDecls = Readonly<Record<string, Readonly<Record<string, {
|
|
997
|
+
args: readonly Shape[];
|
|
998
|
+
command?: boolean;
|
|
999
|
+
mode: OperationMode;
|
|
1000
|
+
}>>>>;
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/objects.d.ts
|
|
1003
|
+
type PropDef<N> = {
|
|
1004
|
+
get(o: HostObject<N>): Value;
|
|
1005
|
+
getCost?: Cost;
|
|
1006
|
+
/** Omit for read-only. Throw ScriptError to refuse. */
|
|
1007
|
+
set?(o: HostObject<N>, v: Value): void;
|
|
1008
|
+
setCost?: Cost;
|
|
1009
|
+
shape?: Shape;
|
|
1010
|
+
};
|
|
1011
|
+
/**
|
|
1012
|
+
* An Object Kind's ordered, named collection of Host Objects (#1143). Its
|
|
1013
|
+
* callbacks are synchronous and read-only, like a property's `get`; `at`
|
|
1014
|
+
* gets a nonzero index, negative from the end.
|
|
1015
|
+
*/
|
|
1016
|
+
type ObjectElements<N> = {
|
|
1017
|
+
at(o: HostObject<N>, index: number): Value;
|
|
1018
|
+
atCost: Cost;
|
|
1019
|
+
count(o: HostObject<N>): Value;
|
|
1020
|
+
countCost: Cost;
|
|
1021
|
+
find(o: HostObject<N>, name: string): Value;
|
|
1022
|
+
findCost: Cost;
|
|
1023
|
+
shape: Shape;
|
|
1024
|
+
};
|
|
1025
|
+
type ObjectKindDef<N> = {
|
|
1026
|
+
/** Omit for a kind with no collection. */
|
|
1027
|
+
elements?: ObjectElements<N>;
|
|
1028
|
+
name: string;
|
|
1029
|
+
/** For the Host Manifest only; `setParent` doesn't check it. */
|
|
1030
|
+
parentKinds?: string[];
|
|
1031
|
+
props: Record<string, PropDef<N>>;
|
|
1032
|
+
};
|
|
1033
|
+
type ObjectKind<N = unknown> = {
|
|
1034
|
+
readonly elements: Readonly<ObjectElements<N>> | null;
|
|
1035
|
+
readonly name: string;
|
|
1036
|
+
readonly parentKinds: readonly string[];
|
|
1037
|
+
readonly props: ReadonlyMap<string, PropDef<N>>;
|
|
1038
|
+
};
|
|
1039
|
+
/** Define an Object Kind, once per process. */
|
|
1040
|
+
declare const defineObjectKind: <N>(k: ObjectKindDef<N>) => ObjectKind<N>;
|
|
1041
|
+
/** A Group-scoped handle to something the Host owns. */
|
|
1042
|
+
type HostObject<N = unknown> = {
|
|
1043
|
+
readonly id: string;
|
|
1044
|
+
readonly kind: ObjectKind<N>;
|
|
1045
|
+
readonly native: N;
|
|
1046
|
+
readonly value: Value;
|
|
1047
|
+
};
|
|
1048
|
+
/** What the Group holds for each of its objects (chapter 9, Host Objects). */
|
|
1049
|
+
type ObjectState = {
|
|
1050
|
+
disposed: boolean;
|
|
1051
|
+
handle: HostObject;
|
|
1052
|
+
/** The Script that owns it, by name. */
|
|
1053
|
+
owner: string | null;
|
|
1054
|
+
parent: ObjectState | null;
|
|
1055
|
+
};
|
|
1056
|
+
//#endregion
|
|
1057
|
+
//#region src/dates.d.ts
|
|
1058
|
+
/** A Civil Date: a date, and a time of day as microseconds since midnight, or null. */
|
|
1059
|
+
type CivilRef = {
|
|
1060
|
+
readonly day: number;
|
|
1061
|
+
readonly month: number;
|
|
1062
|
+
/** Microseconds since midnight, for a date-time; null for a date-only value. */
|
|
1063
|
+
readonly us: bigint | null;
|
|
1064
|
+
readonly year: number;
|
|
1065
|
+
};
|
|
1066
|
+
/** A Civil Date from its fields, or a reason it isn't one. */
|
|
1067
|
+
declare const civilFromFields: (f: {
|
|
1068
|
+
day: number;
|
|
1069
|
+
hour?: number;
|
|
1070
|
+
microsecond?: number;
|
|
1071
|
+
minute?: number;
|
|
1072
|
+
month: number;
|
|
1073
|
+
second?: number;
|
|
1074
|
+
year: number;
|
|
1075
|
+
}) => CivilRef | string;
|
|
1076
|
+
/** A Civil Date's fields, as the Host reads them. */
|
|
1077
|
+
declare const civilFields: (c: CivilRef) => {
|
|
1078
|
+
year: number;
|
|
1079
|
+
month: number;
|
|
1080
|
+
day: number;
|
|
1081
|
+
} | {
|
|
1082
|
+
hour: number;
|
|
1083
|
+
minute: number;
|
|
1084
|
+
second: number;
|
|
1085
|
+
microsecond: number;
|
|
1086
|
+
year: number;
|
|
1087
|
+
month: number;
|
|
1088
|
+
day: number;
|
|
1089
|
+
};
|
|
1090
|
+
/** An Instant's text form, always in UTC: `2026-09-27T13:30:00Z`. */
|
|
1091
|
+
declare const formatInstant: (us: bigint) => string;
|
|
1092
|
+
/** An Instant's display form as epoch microseconds, for the Host and the Trace. */
|
|
1093
|
+
declare const parseInstant: (s: string) => bigint;
|
|
1094
|
+
//#endregion
|
|
1095
|
+
//#region src/units.d.ts
|
|
1096
|
+
/** One slot of a Unit: a Unit of a Unit Kind, and its exponent. */
|
|
1097
|
+
type Slot = {
|
|
1098
|
+
readonly exponent: number;
|
|
1099
|
+
readonly unit: string;
|
|
1100
|
+
};
|
|
1101
|
+
/** A Unit's slots in Kind order. An empty Unit is a plain number. */
|
|
1102
|
+
type UnitSpec = readonly Slot[];
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/values.d.ts
|
|
1105
|
+
/** The kinds implemented so far; the rest of chapter 3's follow with #126. */
|
|
1106
|
+
type Kind = 'nothing' | 'boolean' | 'number' | 'quantity' | 'text' | 'bytes' | 'list' | 'map' | 'range' | 'instant' | 'civil date' | 'pattern' | 'function' | 'object';
|
|
1107
|
+
type Pairs = readonly (readonly [string, Value])[];
|
|
1108
|
+
/**
|
|
1109
|
+
* A Function Value (chapter 3, ADR 0025): its Home Script, where its code is,
|
|
1110
|
+
* its captured values in capture-slot order, and its may-suspend flag. `code`
|
|
1111
|
+
* is the Abstract Machine's own reference, which no Host or Script sees.
|
|
1112
|
+
*/
|
|
1113
|
+
type FunctionRef = {
|
|
1114
|
+
readonly captures: Pairs;
|
|
1115
|
+
readonly code: unknown;
|
|
1116
|
+
/** The extension unit used in the display form, while home remains the Script. */
|
|
1117
|
+
readonly displayHome?: string;
|
|
1118
|
+
/** The Core's Group identity; rebound by same-family restore. */
|
|
1119
|
+
readonly group?: object;
|
|
1120
|
+
readonly home: string;
|
|
1121
|
+
/** Equal for the same Lambda or named function in the same Home Script. */
|
|
1122
|
+
readonly identity: string;
|
|
1123
|
+
readonly maySuspend: boolean;
|
|
1124
|
+
/** Where its code is, as its display form shows it: `12:3`, `tax`, `text:pad`. */
|
|
1125
|
+
readonly place: string;
|
|
1126
|
+
};
|
|
1127
|
+
/** A Text Pattern: its canonical source, and the matcher's own data. */
|
|
1128
|
+
type PatternRef = {
|
|
1129
|
+
readonly data: unknown;
|
|
1130
|
+
/** The number of instructions in its compiled program. */
|
|
1131
|
+
readonly program: number;
|
|
1132
|
+
readonly source: string;
|
|
1133
|
+
};
|
|
1134
|
+
/**
|
|
1135
|
+
* A Host Object (chapter 3): its kind and its id, and the Group's own handle,
|
|
1136
|
+
* whose identity is the object's, so two are equal only when they are one.
|
|
1137
|
+
*/
|
|
1138
|
+
type ObjectRef = {
|
|
1139
|
+
readonly handle: unknown;
|
|
1140
|
+
readonly id: string;
|
|
1141
|
+
readonly kind: string;
|
|
1142
|
+
};
|
|
1143
|
+
/** A Quantity: its number and its Unit, in Kind order (chapter 3). */
|
|
1144
|
+
type QuantityRef = {
|
|
1145
|
+
readonly number: Decimal;
|
|
1146
|
+
readonly unit: UnitSpec;
|
|
1147
|
+
};
|
|
1148
|
+
declare class Decimal {
|
|
1149
|
+
#private;
|
|
1150
|
+
private constructor();
|
|
1151
|
+
toString(): string;
|
|
1152
|
+
toBigInt(): bigint;
|
|
1153
|
+
toNumberLossy(): number;
|
|
1154
|
+
}
|
|
1155
|
+
/** Immutable, opaque value. Host code uses the named constructors. */
|
|
1156
|
+
declare class Value {
|
|
1157
|
+
#private;
|
|
1158
|
+
readonly kind: Kind;
|
|
1159
|
+
private constructor();
|
|
1160
|
+
static isValue(input: unknown): input is Value;
|
|
1161
|
+
asText(): string | undefined;
|
|
1162
|
+
asBool(): boolean | undefined;
|
|
1163
|
+
asDecimal(): Decimal | undefined;
|
|
1164
|
+
/** A Quantity's number and its Unit in normal form, as the Host reads it. */
|
|
1165
|
+
asQuantity(): {
|
|
1166
|
+
number: Decimal;
|
|
1167
|
+
unit: string;
|
|
1168
|
+
} | undefined;
|
|
1169
|
+
/** The Abstract Machine's view of a Quantity: its Unit's slots. */
|
|
1170
|
+
asQuantityRef(): QuantityRef | undefined;
|
|
1171
|
+
/** An Instant as epoch microseconds. */
|
|
1172
|
+
asInstant(): bigint | undefined;
|
|
1173
|
+
/** A Civil Date's fields; a date-only value has no time fields. */
|
|
1174
|
+
asCivilDate(): ReturnType<typeof civilFields> | undefined;
|
|
1175
|
+
/** The Abstract Machine's view of a Civil Date. */
|
|
1176
|
+
civilRef(): CivilRef | undefined;
|
|
1177
|
+
/** A copy of the bytes. */
|
|
1178
|
+
asBytes(): Uint8Array | undefined;
|
|
1179
|
+
/** The Abstract Machine's view of Bytes, which it never writes to. */
|
|
1180
|
+
bytesView(): Uint8Array | undefined;
|
|
1181
|
+
asRange(): {
|
|
1182
|
+
from: Value;
|
|
1183
|
+
to: Value;
|
|
1184
|
+
} | undefined;
|
|
1185
|
+
/** A Function Value's Home Script, its only Host-visible read. */
|
|
1186
|
+
homeScript(): string | undefined;
|
|
1187
|
+
/** A Text Pattern's canonical source, for display. */
|
|
1188
|
+
patternSource(): string | undefined;
|
|
1189
|
+
asPattern(): PatternRef | undefined;
|
|
1190
|
+
/** The Host Object handle this value stands for (chapter 9). */
|
|
1191
|
+
asObject(): HostObject | undefined;
|
|
1192
|
+
/** A Host Object's kind, id and handle. */
|
|
1193
|
+
asObjectRef(): ObjectRef | undefined;
|
|
1194
|
+
/** The Abstract Machine's view of a Function Value. */
|
|
1195
|
+
asFunction(): FunctionRef | undefined;
|
|
1196
|
+
get length(): number;
|
|
1197
|
+
index(i: number): Value;
|
|
1198
|
+
get(key: string): Value;
|
|
1199
|
+
/** Internal: the frozen pairs themselves, without copying. */
|
|
1200
|
+
mapPairs(): Pairs | undefined;
|
|
1201
|
+
get mapSize(): number;
|
|
1202
|
+
hasKey(key: string): boolean;
|
|
1203
|
+
entries(): [string, Value][];
|
|
1204
|
+
equals(other: Value): boolean;
|
|
1205
|
+
toString(): string;
|
|
1206
|
+
}
|
|
1207
|
+
declare const nothing: Value;
|
|
1208
|
+
declare const bool: (b: boolean) => Value;
|
|
1209
|
+
declare const text: (s: string) => Value;
|
|
1210
|
+
declare const dec: (s: string) => Value;
|
|
1211
|
+
/** ECMAScript's shortest round-trip digits, expanded without rounding. */
|
|
1212
|
+
declare const num: (n: number | bigint) => Value;
|
|
1213
|
+
declare const list: (...vs: Value[]) => Value;
|
|
1214
|
+
/** Two numbers, or two Quantities of one dimension, kept as given (ADR 0034). */
|
|
1215
|
+
declare const range: (from: Value, to: Value) => Value;
|
|
1216
|
+
/**
|
|
1217
|
+
* A Quantity of a number Value in a Unit spelled as a Script spells it, such
|
|
1218
|
+
* as `"kg"`. A Unit whose slots all drop, such as `"m/m"`, leaves the number.
|
|
1219
|
+
*/
|
|
1220
|
+
declare const quantity: (n: Value, unit: string) => Value;
|
|
1221
|
+
/** An Instant, from epoch microseconds; a JS Date is never accepted. */
|
|
1222
|
+
declare const instant: (epochMicros: bigint) => Value;
|
|
1223
|
+
type DateFields = Parameters<typeof civilFromFields>[0];
|
|
1224
|
+
/** A Civil Date, from its fields or from text in the `as civil date` form. */
|
|
1225
|
+
declare const civilDate: (f: DateFields | string) => Value;
|
|
1226
|
+
/** Bytes, copied in. */
|
|
1227
|
+
declare const bytes: (b: Uint8Array) => Value;
|
|
1228
|
+
declare const map: (input: Map<string, Value> | Iterable<[string, Value]>) => Value;
|
|
1229
|
+
declare const record: (input: Record<string, Value>) => Value;
|
|
1230
|
+
/**
|
|
1231
|
+
* Tooling's source form: the display form, with the substitutions that make it
|
|
1232
|
+
* source that reads back as an equal value with the same display form. Nothing
|
|
1233
|
+
* about it is normative (ADR 0028). An unreadable value keeps its display form.
|
|
1234
|
+
*/
|
|
1235
|
+
declare const sourceForm: (value: Value) => string;
|
|
1236
|
+
/** A value is readable when it contains no Function Value or Host Object. */
|
|
1237
|
+
declare const isReadable: (value: Value) => boolean;
|
|
1238
|
+
//#endregion
|
|
1239
|
+
//#region src/run-accounting.d.ts
|
|
1240
|
+
type RunAncestry = {
|
|
1241
|
+
parentCall?: string;
|
|
1242
|
+
parentRun?: string;
|
|
1243
|
+
rootDelivery: string;
|
|
1244
|
+
};
|
|
1245
|
+
type RunStarted = RunAncestry & {
|
|
1246
|
+
args: Value[];
|
|
1247
|
+
delivery?: string;
|
|
1248
|
+
fn?: Value;
|
|
1249
|
+
kind: 'run started';
|
|
1250
|
+
run: string;
|
|
1251
|
+
script: string;
|
|
1252
|
+
selector?: string;
|
|
1253
|
+
};
|
|
1254
|
+
type RunDiscarded = RunAncestry & {
|
|
1255
|
+
kind: 'run discarded';
|
|
1256
|
+
reason: string;
|
|
1257
|
+
run: string;
|
|
1258
|
+
script: string;
|
|
1259
|
+
};
|
|
1260
|
+
type RunAccounting = RunAncestry & {
|
|
1261
|
+
fuel: number;
|
|
1262
|
+
kind: 'run accounting';
|
|
1263
|
+
run: string;
|
|
1264
|
+
script: string;
|
|
1265
|
+
state: 'live' | 'terminal' | 'discarded';
|
|
1266
|
+
};
|
|
1267
|
+
type CausalWork = {
|
|
1268
|
+
discardedMessages: number;
|
|
1269
|
+
kind: 'causal work';
|
|
1270
|
+
liveRuns: number;
|
|
1271
|
+
queuedMessages: number;
|
|
1272
|
+
rootDelivery: string;
|
|
1273
|
+
};
|
|
1274
|
+
type AccountingReport = RunStarted | RunDiscarded | RunAccounting | CausalWork;
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/binary.d.ts
|
|
1277
|
+
/** A reader: Bytes and the position of the next byte to read. */
|
|
1278
|
+
type Reader = {
|
|
1279
|
+
at: number;
|
|
1280
|
+
bytes: Uint8Array;
|
|
1281
|
+
k: 'reader';
|
|
1282
|
+
};
|
|
1283
|
+
//#endregion
|
|
1284
|
+
//#region src/operations.d.ts
|
|
1285
|
+
/** Behaviour this Core doesn't implement yet; never a Script error. */
|
|
1286
|
+
declare class NotImplementedError extends Error {
|
|
1287
|
+
name: string;
|
|
1288
|
+
}
|
|
1289
|
+
/** `wait d`'s duration in microseconds; anything but an exact duration is `wrong kind`. */
|
|
1290
|
+
declare const waitUs: (v: Value) => bigint;
|
|
1291
|
+
/** A verified static Unit target, owned by its loaded code unit. */
|
|
1292
|
+
type UnitConversion = {
|
|
1293
|
+
readonly to: string;
|
|
1294
|
+
readonly unit: UnitSpec;
|
|
1295
|
+
};
|
|
1296
|
+
declare const canConvert: (v: Value, kind: string, prepared?: UnitConversion) => Value;
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region src/machine.d.ts
|
|
1299
|
+
type LimitName = 'fuelPerRun' | 'allocPerRun' | 'persistentState' | 'callDepth' | 'patternSize' | 'mailboxDepth' | 'maxWaitMs' | 'maxJoin' | 'cleanupBudget';
|
|
1300
|
+
type Limits = Record<LimitName, number>;
|
|
1301
|
+
declare const defaultLimits: Limits;
|
|
1302
|
+
/** A code unit that can't load: a literal pattern past its limit, or a failed initialiser. */
|
|
1303
|
+
declare class UnitLoadError extends Error {
|
|
1304
|
+
readonly code: 'pattern too large' | 'initialiser failed';
|
|
1305
|
+
readonly line: number;
|
|
1306
|
+
readonly col: number;
|
|
1307
|
+
readonly error: Value | null;
|
|
1308
|
+
constructor(code: 'pattern too large' | 'initialiser failed', line: number, col: number, error?: Value | null);
|
|
1309
|
+
}
|
|
1310
|
+
type Constant = {
|
|
1311
|
+
k: 'value';
|
|
1312
|
+
value: Value;
|
|
1313
|
+
} | {
|
|
1314
|
+
els: readonly PatternElement[];
|
|
1315
|
+
k: 'template';
|
|
1316
|
+
} | {
|
|
1317
|
+
k: 'unimplemented';
|
|
1318
|
+
what: string;
|
|
1319
|
+
};
|
|
1320
|
+
/**
|
|
1321
|
+
* A loaded code unit, a Script's or a Library's: its constants, definitions
|
|
1322
|
+
* and Handler clauses, linked to the Libraries its `use` lines name.
|
|
1323
|
+
*/
|
|
1324
|
+
declare class Code {
|
|
1325
|
+
readonly unit: CodeUnit;
|
|
1326
|
+
readonly identity: string;
|
|
1327
|
+
/** Static conversion metadata; rebuilt on Load, Reload and Restore. */
|
|
1328
|
+
readonly conversions: Map<Instruction, UnitConversion>;
|
|
1329
|
+
readonly constants: Constant[];
|
|
1330
|
+
readonly definitions: Value[];
|
|
1331
|
+
readonly clauses: Map<string, Body[]>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Its Fallback Handler's clauses, in source order. They are kept apart
|
|
1334
|
+
* from `clauses`, so no Selector finds them (ADR 0064).
|
|
1335
|
+
*/
|
|
1336
|
+
fallback: Body[];
|
|
1337
|
+
/** The Libraries it imports, by name. */
|
|
1338
|
+
readonly libraries: Map<string, Code>;
|
|
1339
|
+
/** Whether it is a stdlib Library's, whose errors name the caller (ADR 0037). */
|
|
1340
|
+
stdlib: boolean;
|
|
1341
|
+
/**
|
|
1342
|
+
* Whether its errors name the caller, as a stdlib Library's do. A Host may
|
|
1343
|
+
* ask this of any Library, outside the Spec, as `northtalk test` does.
|
|
1344
|
+
*/
|
|
1345
|
+
atCaller: boolean;
|
|
1346
|
+
constructor(unit: CodeUnit, identity?: string);
|
|
1347
|
+
get name(): string;
|
|
1348
|
+
constant(i: number): Value;
|
|
1349
|
+
/** The Library that holds an import, written `library:name`. */
|
|
1350
|
+
library(name: string): {
|
|
1351
|
+
code: Code;
|
|
1352
|
+
name: string;
|
|
1353
|
+
};
|
|
1354
|
+
/** An exported function's body. */
|
|
1355
|
+
function(name: string): Body;
|
|
1356
|
+
/** Link the Libraries it imports, and take the Constants it imports from them. */
|
|
1357
|
+
link(libraries: ReadonlyMap<string, Code>, home?: Script$1): void;
|
|
1358
|
+
}
|
|
1359
|
+
/** A loaded Script: its code, and its Script Variables. */
|
|
1360
|
+
declare class Script$1 extends Code {
|
|
1361
|
+
readonly limits: Limits;
|
|
1362
|
+
readonly home?: Script$1 | undefined;
|
|
1363
|
+
variables: Value[];
|
|
1364
|
+
functionGroup?: object;
|
|
1365
|
+
readonly boundConstants: Map<Value, Value>;
|
|
1366
|
+
live: boolean;
|
|
1367
|
+
readonly units: Code[];
|
|
1368
|
+
variableNames: string[];
|
|
1369
|
+
constructor(unit: CodeUnit, limits?: Limits, home?: Script$1 | undefined, identity?: string);
|
|
1370
|
+
codeFor(body: Body): Code;
|
|
1371
|
+
attach(extension: Script$1): void;
|
|
1372
|
+
/** The Script Variables' share of Persistent State. */
|
|
1373
|
+
variablesSize(): number;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Load a code unit: check each literal Text Pattern against the size limit,
|
|
1377
|
+
* then run the initialiser, which is never charged (chapter 8, Charging).
|
|
1378
|
+
*/
|
|
1379
|
+
declare const loadScript: (unit: CodeUnit, limits?: Partial<Limits>, libraries?: ReadonlyMap<string, Code>, initialVariables?: readonly Value[], home?: Script$1, identity?: string, functionGroup?: object) => Script$1;
|
|
1380
|
+
type Iterator = {
|
|
1381
|
+
at: number;
|
|
1382
|
+
count: number;
|
|
1383
|
+
k: 'iterator';
|
|
1384
|
+
source: Value | null;
|
|
1385
|
+
};
|
|
1386
|
+
type Replacement = {
|
|
1387
|
+
at: number;
|
|
1388
|
+
cs: readonly string[];
|
|
1389
|
+
found: {
|
|
1390
|
+
end: number;
|
|
1391
|
+
start: number;
|
|
1392
|
+
}[];
|
|
1393
|
+
k: 'replacement';
|
|
1394
|
+
matches: Value[];
|
|
1395
|
+
pieces: string[];
|
|
1396
|
+
subject: Value;
|
|
1397
|
+
};
|
|
1398
|
+
type Item = Value | Iterator | Replacement | Reader | Receiver | Deadline;
|
|
1399
|
+
/**
|
|
1400
|
+
* A Timeout Block's deadline, kept on the stack below its body: the Instant
|
|
1401
|
+
* in Clock microseconds, and the block's duration in `ms` (ADR 0073).
|
|
1402
|
+
*/
|
|
1403
|
+
type Deadline = {
|
|
1404
|
+
after: Value;
|
|
1405
|
+
at: bigint;
|
|
1406
|
+
k: 'deadline';
|
|
1407
|
+
};
|
|
1408
|
+
type Dispatch = {
|
|
1409
|
+
args: Value[];
|
|
1410
|
+
clauses: Body[];
|
|
1411
|
+
code: Code;
|
|
1412
|
+
/**
|
|
1413
|
+
* A Delivery that may reach a Fallback Handler: its clauses, tried after
|
|
1414
|
+
* `clauses` with the message map, and the message's Selector (ADR 0064).
|
|
1415
|
+
*/
|
|
1416
|
+
fallback?: {
|
|
1417
|
+
clauses: Body[];
|
|
1418
|
+
selector: string;
|
|
1419
|
+
};
|
|
1420
|
+
next: number;
|
|
1421
|
+
};
|
|
1422
|
+
type Frame = {
|
|
1423
|
+
activation?: boolean;
|
|
1424
|
+
body: Body;
|
|
1425
|
+
/** A clause's `clause` charge, added to its first instruction's. */
|
|
1426
|
+
clauseCharge: boolean;
|
|
1427
|
+
/** The code unit the body is in: the Script's own, or a Library's. */
|
|
1428
|
+
code: Code;
|
|
1429
|
+
dispatch: Dispatch | null;
|
|
1430
|
+
handler: string;
|
|
1431
|
+
locals: Value[];
|
|
1432
|
+
owner?: Frame;
|
|
1433
|
+
pc: number;
|
|
1434
|
+
/** Inherited by calls and retained recovery/cleanup activations. */
|
|
1435
|
+
restricted: boolean;
|
|
1436
|
+
stack: Item[];
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* What happened in a Run that a Trace records: each raise, caught or not,
|
|
1440
|
+
* and each clause or branch a guard region skipped, with its error's code or
|
|
1441
|
+
* the value its Guard gave that wasn't a boolean.
|
|
1442
|
+
*/
|
|
1443
|
+
type RunRecord = {
|
|
1444
|
+
args: Value[];
|
|
1445
|
+
at: {
|
|
1446
|
+
pc: number;
|
|
1447
|
+
unit: string;
|
|
1448
|
+
};
|
|
1449
|
+
attempt: number;
|
|
1450
|
+
kind: 'offer-chosen';
|
|
1451
|
+
name: string;
|
|
1452
|
+
target: {
|
|
1453
|
+
pc: number;
|
|
1454
|
+
unit: string;
|
|
1455
|
+
};
|
|
1456
|
+
} | {
|
|
1457
|
+
attempt: number;
|
|
1458
|
+
kind: 'offer-entered';
|
|
1459
|
+
target: {
|
|
1460
|
+
pc: number;
|
|
1461
|
+
unit: string;
|
|
1462
|
+
};
|
|
1463
|
+
} | {
|
|
1464
|
+
code?: string;
|
|
1465
|
+
col: number;
|
|
1466
|
+
kind: 'raise' | 'guard-skip';
|
|
1467
|
+
line: number;
|
|
1468
|
+
pc: number;
|
|
1469
|
+
unit: string;
|
|
1470
|
+
value?: Value;
|
|
1471
|
+
} | {
|
|
1472
|
+
args: Value[];
|
|
1473
|
+
automatic?: boolean;
|
|
1474
|
+
charged: number;
|
|
1475
|
+
error?: Value;
|
|
1476
|
+
id: string;
|
|
1477
|
+
kind: 'call';
|
|
1478
|
+
op: string;
|
|
1479
|
+
result?: Value;
|
|
1480
|
+
} | {
|
|
1481
|
+
action: 'opened' | 'closed' | 'abandoned' | 'failed';
|
|
1482
|
+
grant: string;
|
|
1483
|
+
id: string;
|
|
1484
|
+
kind: 'scope';
|
|
1485
|
+
name: string;
|
|
1486
|
+
} | {
|
|
1487
|
+
detail: string;
|
|
1488
|
+
grant: string;
|
|
1489
|
+
kind: 'effect-failure';
|
|
1490
|
+
phase: EffectFailure['phase'];
|
|
1491
|
+
scope?: string;
|
|
1492
|
+
segment: string;
|
|
1493
|
+
status: 'failed' | 'unknown';
|
|
1494
|
+
} | {
|
|
1495
|
+
grant: string;
|
|
1496
|
+
kind: 'effect';
|
|
1497
|
+
phase: 'begin' | 'commit' | 'rollback';
|
|
1498
|
+
segment: string;
|
|
1499
|
+
status: EffectResult['status'];
|
|
1500
|
+
} | {
|
|
1501
|
+
detail: string;
|
|
1502
|
+
id: string;
|
|
1503
|
+
kind: 'call-failed';
|
|
1504
|
+
op: string;
|
|
1505
|
+
} | {
|
|
1506
|
+
id: string;
|
|
1507
|
+
kind: 'abandon';
|
|
1508
|
+
} | {
|
|
1509
|
+
args: Value[];
|
|
1510
|
+
kind: 'unhandled';
|
|
1511
|
+
message: string;
|
|
1512
|
+
target: Value | null;
|
|
1513
|
+
} | {
|
|
1514
|
+
error?: Value;
|
|
1515
|
+
kind: 'prop';
|
|
1516
|
+
name: string;
|
|
1517
|
+
object: Value;
|
|
1518
|
+
op: 'get' | 'set' | 'count' | 'at' | 'find';
|
|
1519
|
+
selector?: Value;
|
|
1520
|
+
value?: Value;
|
|
1521
|
+
} | {
|
|
1522
|
+
args: Value[];
|
|
1523
|
+
fn?: Value;
|
|
1524
|
+
/** The call id of a send that waits for its reply. */
|
|
1525
|
+
id?: string;
|
|
1526
|
+
/** A Join Member's send. */
|
|
1527
|
+
join?: boolean;
|
|
1528
|
+
kind: 'send';
|
|
1529
|
+
message?: string;
|
|
1530
|
+
to: string;
|
|
1531
|
+
};
|
|
1532
|
+
type CallContext = {
|
|
1533
|
+
adoptable?: boolean;
|
|
1534
|
+
/** A suspending Standard Capability call's arguments, for its answer rules. */
|
|
1535
|
+
args?: readonly Value[];
|
|
1536
|
+
declared: number;
|
|
1537
|
+
id: string;
|
|
1538
|
+
named: [string, Value][];
|
|
1539
|
+
op: Operation<unknown>;
|
|
1540
|
+
/** As the Trace names it, `<granted name>.<operation>`. */
|
|
1541
|
+
opName: string;
|
|
1542
|
+
/** The rate the call is charged by. */
|
|
1543
|
+
rate: number;
|
|
1544
|
+
};
|
|
1545
|
+
/** Why a Run suspended, which its Group waits on (chapter 5, Suspension Points). */
|
|
1546
|
+
type Suspension = ({
|
|
1547
|
+
k: 'wait';
|
|
1548
|
+
us: bigint;
|
|
1549
|
+
} | {
|
|
1550
|
+
abort: AbortController;
|
|
1551
|
+
call: CallContext;
|
|
1552
|
+
k: 'ask';
|
|
1553
|
+
ms: number;
|
|
1554
|
+
} | {
|
|
1555
|
+
args: Value[];
|
|
1556
|
+
id: string;
|
|
1557
|
+
k: 'send';
|
|
1558
|
+
message: string;
|
|
1559
|
+
to: string;
|
|
1560
|
+
} | {
|
|
1561
|
+
args: Value[];
|
|
1562
|
+
fn: Value;
|
|
1563
|
+
id: string;
|
|
1564
|
+
k: 'call-value';
|
|
1565
|
+
to: string;
|
|
1566
|
+
} | {
|
|
1567
|
+
k: 'join';
|
|
1568
|
+
members: Member[];
|
|
1569
|
+
} | WaitFor) & {
|
|
1570
|
+
/** The Timeout Block deadline it is written in, if any (ADR 0073). */
|
|
1571
|
+
deadline?: Deadline;
|
|
1572
|
+
};
|
|
1573
|
+
/**
|
|
1574
|
+
* A `wait for`, one-line or block: its `when` branches with their `from`
|
|
1575
|
+
* Scripts or objects and captures, its `after` branches' durations and its timeout,
|
|
1576
|
+
* each branch numbered from 1 in source order.
|
|
1577
|
+
*/
|
|
1578
|
+
type WaitFor = {
|
|
1579
|
+
afters: {
|
|
1580
|
+
branch: number;
|
|
1581
|
+
us: bigint;
|
|
1582
|
+
}[];
|
|
1583
|
+
any: boolean;
|
|
1584
|
+
code: Code;
|
|
1585
|
+
k: 'wait-for';
|
|
1586
|
+
timeout: bigint | null;
|
|
1587
|
+
whens: {
|
|
1588
|
+
binds: number[];
|
|
1589
|
+
body: number | null;
|
|
1590
|
+
branch: number;
|
|
1591
|
+
captures: Value[];
|
|
1592
|
+
from: string | Value | null;
|
|
1593
|
+
message: string;
|
|
1594
|
+
}[];
|
|
1595
|
+
};
|
|
1596
|
+
/** A Join Member: its call id, and for a Capability call, its context. */
|
|
1597
|
+
type Member = {
|
|
1598
|
+
abort: AbortController | null;
|
|
1599
|
+
/** An answer that arrived early, which Persistent State counts. */
|
|
1600
|
+
answer?: Value;
|
|
1601
|
+
/** Its deadline: the Clock of the Pump that started it, plus `ms`. */
|
|
1602
|
+
at: bigint;
|
|
1603
|
+
call: CallContext | null;
|
|
1604
|
+
id: string;
|
|
1605
|
+
ms: number;
|
|
1606
|
+
/** A Script reply received before its preempted Join closes. */
|
|
1607
|
+
reply?: Resumption;
|
|
1608
|
+
};
|
|
1609
|
+
/** What resumes a suspended Run. */
|
|
1610
|
+
type Resumption = {
|
|
1611
|
+
k: 'wake';
|
|
1612
|
+
} | {
|
|
1613
|
+
code: 'call lost' | 'capability revoked';
|
|
1614
|
+
k: 'restore-fail';
|
|
1615
|
+
} | {
|
|
1616
|
+
fuel: number;
|
|
1617
|
+
k: 'answer';
|
|
1618
|
+
value: Value;
|
|
1619
|
+
} | {
|
|
1620
|
+
detail?: string;
|
|
1621
|
+
error: ScriptError | null;
|
|
1622
|
+
k: 'fail';
|
|
1623
|
+
} |
|
|
1624
|
+
/** With `deadline`, a Timeout Block's deadline ended it, after that long. */
|
|
1625
|
+
{
|
|
1626
|
+
after: number;
|
|
1627
|
+
deadline?: Value;
|
|
1628
|
+
k: 'timeout';
|
|
1629
|
+
} |
|
|
1630
|
+
/** A Timeout Block's deadline ended a wait or Join, abandoning these. */
|
|
1631
|
+
{
|
|
1632
|
+
abandon: string[];
|
|
1633
|
+
after: Value;
|
|
1634
|
+
k: 'deadline';
|
|
1635
|
+
} | {
|
|
1636
|
+
k: 'reply';
|
|
1637
|
+
value: Value;
|
|
1638
|
+
} | {
|
|
1639
|
+
error: Value | null;
|
|
1640
|
+
k: 'send failed';
|
|
1641
|
+
reason: string;
|
|
1642
|
+
} | {
|
|
1643
|
+
answers: Resumption[];
|
|
1644
|
+
k: 'joined';
|
|
1645
|
+
} | {
|
|
1646
|
+
binds: Value[];
|
|
1647
|
+
branch: number;
|
|
1648
|
+
k: 'event';
|
|
1649
|
+
message: Value;
|
|
1650
|
+
} | {
|
|
1651
|
+
branch: number;
|
|
1652
|
+
k: 'event-timeout';
|
|
1653
|
+
} | {
|
|
1654
|
+
abandon: string[];
|
|
1655
|
+
failure: Resumption;
|
|
1656
|
+
index: number;
|
|
1657
|
+
k: 'join-failed';
|
|
1658
|
+
};
|
|
1659
|
+
/**
|
|
1660
|
+
* What a Run reaches outside its Script through, which its Group gives it:
|
|
1661
|
+
* the Script's Grants, the Pump's Clock reading, and other Scripts' mailboxes.
|
|
1662
|
+
*/
|
|
1663
|
+
type RunHost = {
|
|
1664
|
+
/** Queues a suspending call's answer, as the Host Input `answer`. */
|
|
1665
|
+
answer(id: string, value: Value, fuel: number): void;
|
|
1666
|
+
/** Queues a foreign Function Value in its Home Script's mailbox. */
|
|
1667
|
+
callValue(fn: Value, args: Value[], reply: string): string;
|
|
1668
|
+
/** Land Stop and CancelRun after the crossing record, before conversion. */
|
|
1669
|
+
crossing?(): boolean;
|
|
1670
|
+
disableGrant(name: string): void;
|
|
1671
|
+
expose?(tree: unknown): void;
|
|
1672
|
+
/**
|
|
1673
|
+
* Queues its failure, as `fail`; null fails with what isn't a Script error,
|
|
1674
|
+
* which `detail` describes for the `call failed` report.
|
|
1675
|
+
*/
|
|
1676
|
+
fail(id: string, error: ScriptError | null, detail?: string): void;
|
|
1677
|
+
readonly grants: ReadonlyMap<string, Grant<unknown>>;
|
|
1678
|
+
readonly group: Group;
|
|
1679
|
+
isDisabled(name: string): boolean;
|
|
1680
|
+
isRevoked?(name: string): boolean;
|
|
1681
|
+
/** Whether a name is a Script of the Group. */
|
|
1682
|
+
isScript(name: string): boolean;
|
|
1683
|
+
isUnbound?(name: string): boolean;
|
|
1684
|
+
/** The object the Script owns, or Nothing. */
|
|
1685
|
+
readonly me: Value;
|
|
1686
|
+
readonly now: bigint;
|
|
1687
|
+
/** The well-known Host Object the Host bound to a name at load. */
|
|
1688
|
+
object(name: string): Value | undefined;
|
|
1689
|
+
/**
|
|
1690
|
+
* Puts a message in the mailbox of a Script, or of an object's nearest
|
|
1691
|
+
* Owning Script, or throws ScriptError `mailbox full`; `reply` is the call
|
|
1692
|
+
* id of a send that waits for its reply. Gives the Script it reached, or
|
|
1693
|
+
* null for a message no Script on its path takes.
|
|
1694
|
+
*/
|
|
1695
|
+
send(to: string | ObjectState, message: string, args: Value[], reply: string | null): string | null;
|
|
1696
|
+
/** Sends a Command Call with no Handler up the Message Path, as `send` does. */
|
|
1697
|
+
sendUp(message: string, args: Value[], reply: string | null): string | null;
|
|
1698
|
+
};
|
|
1699
|
+
type Receiver = {
|
|
1700
|
+
k: 'receiver';
|
|
1701
|
+
name: string;
|
|
1702
|
+
};
|
|
1703
|
+
/** An instruction's code position and source position (chapter 9, Reports). */
|
|
1704
|
+
type CodePosition = {
|
|
1705
|
+
col: number;
|
|
1706
|
+
/** The frame's Handler, as an error's `at` names it. */
|
|
1707
|
+
handler: string;
|
|
1708
|
+
line: number;
|
|
1709
|
+
pc: number;
|
|
1710
|
+
/** The code unit the instruction is in. */
|
|
1711
|
+
unit: string;
|
|
1712
|
+
};
|
|
1713
|
+
type Outcome = {
|
|
1714
|
+
kind: 'completed';
|
|
1715
|
+
passed?: boolean;
|
|
1716
|
+
result: Value;
|
|
1717
|
+
veto?: Value;
|
|
1718
|
+
} |
|
|
1719
|
+
/** `at` is the raise that no Unwind Table entry caught. */
|
|
1720
|
+
{
|
|
1721
|
+
at: CodePosition;
|
|
1722
|
+
error: Value;
|
|
1723
|
+
kind: 'errored';
|
|
1724
|
+
} | {
|
|
1725
|
+
col: number;
|
|
1726
|
+
/** The faulting frame's Handler. */
|
|
1727
|
+
handler: string;
|
|
1728
|
+
kind: 'limit fault';
|
|
1729
|
+
limit: LimitName;
|
|
1730
|
+
line: number;
|
|
1731
|
+
pc: number;
|
|
1732
|
+
/** The Script Variables the rollback changed back, in declaration order. */
|
|
1733
|
+
rollback: string[];
|
|
1734
|
+
/** The code unit the faulting instruction is in. */
|
|
1735
|
+
unit: string;
|
|
1736
|
+
} | {
|
|
1737
|
+
effect: EffectFailure;
|
|
1738
|
+
kind: 'effect failed';
|
|
1739
|
+
} | {
|
|
1740
|
+
kind: 'unhandled' | 'dropped';
|
|
1741
|
+
} | {
|
|
1742
|
+
cleanupFailed?: {
|
|
1743
|
+
code: string;
|
|
1744
|
+
} | {
|
|
1745
|
+
limit: LimitName;
|
|
1746
|
+
};
|
|
1747
|
+
kind: 'cancelled';
|
|
1748
|
+
};
|
|
1749
|
+
declare class Run {
|
|
1750
|
+
readonly script: Script$1;
|
|
1751
|
+
readonly limits: Limits;
|
|
1752
|
+
/** Its id in the Trace, such as `orders/r2`, which its call ids extend. */
|
|
1753
|
+
id: string;
|
|
1754
|
+
/** Whether this Run holds a Decision’s open Verdict. */
|
|
1755
|
+
openVerdict: boolean;
|
|
1756
|
+
/** `the target`: the object its message was delivered to, or Nothing. */
|
|
1757
|
+
target: Value;
|
|
1758
|
+
host: RunHost | null;
|
|
1759
|
+
/** Why it suspended, until its Group resumes it. */
|
|
1760
|
+
suspended: Suspension | null;
|
|
1761
|
+
private resumption;
|
|
1762
|
+
private abandoning;
|
|
1763
|
+
/** The calls a Limit Fault abandoned, which the Trace writes after it. */
|
|
1764
|
+
faultAbandons: string[];
|
|
1765
|
+
/** The Join open in this Run, with the members it has started. */
|
|
1766
|
+
private join;
|
|
1767
|
+
private waitedOn;
|
|
1768
|
+
private calls;
|
|
1769
|
+
private segment;
|
|
1770
|
+
private scopes;
|
|
1771
|
+
private participant;
|
|
1772
|
+
private participantAbandonment;
|
|
1773
|
+
effectStateUnknown: boolean;
|
|
1774
|
+
get hasParticipant(): boolean;
|
|
1775
|
+
/** The participant's first enrolled Grant, which the Trace names. */
|
|
1776
|
+
private get participantName();
|
|
1777
|
+
private enrolled;
|
|
1778
|
+
/** Whether a Segment-bound call through this Grant joins the participant. */
|
|
1779
|
+
private sharesParticipant;
|
|
1780
|
+
private lifecycle;
|
|
1781
|
+
private effectFailure;
|
|
1782
|
+
private rollbackParticipant;
|
|
1783
|
+
/** After charges/state checks, before any Segment outcome becomes visible. */
|
|
1784
|
+
finalizeEffects(rollback?: boolean): void;
|
|
1785
|
+
get hasOpenScopes(): boolean;
|
|
1786
|
+
/** Still in the Segment it started in, so it can be rewound (ADR 0068). */
|
|
1787
|
+
get rewindable(): boolean;
|
|
1788
|
+
get segmentId(): string;
|
|
1789
|
+
private checkScopeBoundary;
|
|
1790
|
+
/** Reserved Host cleanup, called by the Group before publishing termination. */
|
|
1791
|
+
abandonScopes(only?: (grantName: string) => boolean): void;
|
|
1792
|
+
private crossingCall;
|
|
1793
|
+
frames: Frame[];
|
|
1794
|
+
fuel: number;
|
|
1795
|
+
alloc: number;
|
|
1796
|
+
charging: boolean;
|
|
1797
|
+
records: RunRecord[];
|
|
1798
|
+
/**
|
|
1799
|
+
* The Script's Persistent State, measured at the Segment's end without this
|
|
1800
|
+
* Run, since a Run that is ending keeps nothing (chapter 6, Limits). The
|
|
1801
|
+
* Group adds what else the Script holds, such as its mailbox.
|
|
1802
|
+
*/
|
|
1803
|
+
persistentState: () => number;
|
|
1804
|
+
/** The Script Variables when the Segment began, for rollback (ADR 0006). */
|
|
1805
|
+
segmentBase: Value[];
|
|
1806
|
+
private cleanups;
|
|
1807
|
+
private recoveries;
|
|
1808
|
+
private offerAttempt;
|
|
1809
|
+
private outcome;
|
|
1810
|
+
private entryError;
|
|
1811
|
+
private m;
|
|
1812
|
+
private clause;
|
|
1813
|
+
/** Its entry dispatch reached the Fallback Handler's clauses (ADR 0064). */
|
|
1814
|
+
private viaFallback;
|
|
1815
|
+
private during;
|
|
1816
|
+
private cancellation;
|
|
1817
|
+
private cancellationOwners;
|
|
1818
|
+
private cleanupFuel;
|
|
1819
|
+
/** Calls abandoned when cancellation landed, traced after the cancel Segment. */
|
|
1820
|
+
cancellationAbandons: string[];
|
|
1821
|
+
rebindCalls(): void;
|
|
1822
|
+
/**
|
|
1823
|
+
* The Capability calls an open Join started and hasn't heard from, while a
|
|
1824
|
+
* Fuel Slice has preempted its body: they are pending too (chapter 8).
|
|
1825
|
+
*/
|
|
1826
|
+
openJoinCalls(): Member[];
|
|
1827
|
+
/** A pending call's context: the one suspended on, or an open Join's. */
|
|
1828
|
+
pendingCall(id: string): Pick<Member, 'abort' | 'call'> | undefined;
|
|
1829
|
+
callAdoptable(id: string): boolean;
|
|
1830
|
+
/** Reconnect the Host side of a saved suspending Operation. */
|
|
1831
|
+
restoredCall(id: string, grantName: string, args: Value[], reissue: boolean): {
|
|
1832
|
+
call: Call<unknown>;
|
|
1833
|
+
failure?: Resumption;
|
|
1834
|
+
};
|
|
1835
|
+
/** The plain machine state, without its Group's Host functions. */
|
|
1836
|
+
snapshot(): Record<string, unknown>;
|
|
1837
|
+
/** Allocate before linking shared frames and Join state from a save. */
|
|
1838
|
+
static empty(): Run;
|
|
1839
|
+
restore(state: Record<string, unknown>): void;
|
|
1840
|
+
/** Validate decoded control after the graph is complete, before Host rebinding. */
|
|
1841
|
+
validateSnapshot(knownCode: ReadonlySet<object>): void;
|
|
1842
|
+
private validateControl;
|
|
1843
|
+
get cancelling(): boolean;
|
|
1844
|
+
/** Drop a new Run immediately after dispatch, without entering its body. */
|
|
1845
|
+
drop(): void;
|
|
1846
|
+
/** Roll back the active Segment and abandon every pending call without unwinding. */
|
|
1847
|
+
discard(betweenSegments?: boolean): string[];
|
|
1848
|
+
/** Cancellation lands here; only finally copies are kept for the next turn. */
|
|
1849
|
+
cancel(betweenSegments?: boolean): void;
|
|
1850
|
+
/** Other Runs may have committed since cancellation made this Run ready. */
|
|
1851
|
+
beginCleanupSegment(): void;
|
|
1852
|
+
/** A parked Run resumes after dispatch, with no resumption instruction. */
|
|
1853
|
+
beginReadySegment(): void;
|
|
1854
|
+
park(): boolean;
|
|
1855
|
+
private nextCancellationCleanup;
|
|
1856
|
+
/** The failed Run’s message for an internally queued error Delivery. */
|
|
1857
|
+
setDuring(value: Value): void;
|
|
1858
|
+
constructor(script: Script$1, entry: Body | Body[], args: Value[], limits?: Limits, code?: Code,
|
|
1859
|
+
/** The Selector of a Delivery that may reach a Fallback Handler. */
|
|
1860
|
+
fallback?: string);
|
|
1861
|
+
/** Whether a Fallback Handler clause runs, or is being tried (ADR 0064). */
|
|
1862
|
+
get fallback(): boolean;
|
|
1863
|
+
/** A mailbox call has no Handler Clause and starts in the value's code unit. */
|
|
1864
|
+
static fromFunction(script: Script$1, fn: Value, args: Value[], limits: Limits): Run;
|
|
1865
|
+
/** The clause number the Run's dispatch chose, or is trying. */
|
|
1866
|
+
get clauseNumber(): number;
|
|
1867
|
+
/** A successful entry dispatch, at its first body instruction. */
|
|
1868
|
+
get selectedClause(): Body | null;
|
|
1869
|
+
/** Whether entry dispatch still shares its charge with a body instruction. */
|
|
1870
|
+
get clauseChargePending(): boolean;
|
|
1871
|
+
/** Empty parameter/Guard regions still pay the clause's dispatch rate. */
|
|
1872
|
+
acceptClause(dispatchOnly: boolean): boolean;
|
|
1873
|
+
/** Run to the end of the Run. */
|
|
1874
|
+
finish(): Outcome;
|
|
1875
|
+
get done(): boolean;
|
|
1876
|
+
/** How the Run ended, once it has. */
|
|
1877
|
+
get ended(): Outcome | null;
|
|
1878
|
+
private push;
|
|
1879
|
+
private dispatch;
|
|
1880
|
+
/** Whether a dispatch has a clause left to try after the current one. */
|
|
1881
|
+
private static more;
|
|
1882
|
+
private get frame();
|
|
1883
|
+
/** Tooling-only control views; never part of Inspect or saved state. */
|
|
1884
|
+
debugFrames(): {
|
|
1885
|
+
frame: Frame;
|
|
1886
|
+
owner?: number;
|
|
1887
|
+
role?: 'retained' | 'dispatch';
|
|
1888
|
+
}[];
|
|
1889
|
+
/** Charge an instruction, faulting before it does anything if it can't pay. */
|
|
1890
|
+
private pay;
|
|
1891
|
+
private payAmount;
|
|
1892
|
+
private pop;
|
|
1893
|
+
private popN;
|
|
1894
|
+
private reader;
|
|
1895
|
+
private peek;
|
|
1896
|
+
step(clausePaid?: () => void): void;
|
|
1897
|
+
/** Internal: also called after a debug-deferred unwind. */
|
|
1898
|
+
finishInstruction(): void;
|
|
1899
|
+
/** TS tooling: a resumption consumes the suspension instruction, not a new statement. */
|
|
1900
|
+
get resumingInstruction(): boolean;
|
|
1901
|
+
/** Retain a reply while a Fuel Slice has preempted an open Join's body. */
|
|
1902
|
+
replyToOpenJoin(id: string, reply: Resumption): boolean;
|
|
1903
|
+
/** Replay buffered replies in arrival order once the Join starts waiting. */
|
|
1904
|
+
takeJoinReplies(): {
|
|
1905
|
+
id: string;
|
|
1906
|
+
reply: Resumption;
|
|
1907
|
+
}[];
|
|
1908
|
+
/** Make a suspended Run ready: its next step resumes it with `r`. */
|
|
1909
|
+
wake(r: Resumption): void;
|
|
1910
|
+
private suspend;
|
|
1911
|
+
private blockDeadline;
|
|
1912
|
+
private checkDeadline;
|
|
1913
|
+
/**
|
|
1914
|
+
* Resume at the instruction the Run suspended at, in a new Segment: an
|
|
1915
|
+
* answer is checked and its conversion charged by that instruction's rate,
|
|
1916
|
+
* then pushed; a failure or timeout raises there (chapter 8, Charging).
|
|
1917
|
+
*/
|
|
1918
|
+
private resume;
|
|
1919
|
+
private settled;
|
|
1920
|
+
private withIndex;
|
|
1921
|
+
/**
|
|
1922
|
+
* Whether a message a `wait for` is waiting on fires one of its `when`
|
|
1923
|
+
* branches: the first in source order whose message, `from` and test
|
|
1924
|
+
* match. The test runs on its own, and its Fuel and allocation count
|
|
1925
|
+
* toward this Run (chapter 8, The event table).
|
|
1926
|
+
*/
|
|
1927
|
+
matchEvent(message: string, args: Value[], from: string | null, target?: Value): Extract<Resumption, {
|
|
1928
|
+
k: 'event';
|
|
1929
|
+
}> | null;
|
|
1930
|
+
/**
|
|
1931
|
+
* `the p of o` on a Host Object (chapter 4, Keys): its Core-held `id`, or
|
|
1932
|
+
* the Host's property, charged as a Capability result is, recorded as
|
|
1933
|
+
* `prop`. A key its Object Kind doesn't define gives Nothing.
|
|
1934
|
+
*/
|
|
1935
|
+
private getProperty;
|
|
1936
|
+
private collectionOf;
|
|
1937
|
+
/**
|
|
1938
|
+
* `element s of o` (#1143): the selector is checked, then the receiver,
|
|
1939
|
+
* and one Host callback answers, charged and recorded as a property
|
|
1940
|
+
* getter is. Zero and positions past 2^53 - 1 select nothing.
|
|
1941
|
+
*/
|
|
1942
|
+
private getElement;
|
|
1943
|
+
private selectElement;
|
|
1944
|
+
/** `the number of elements of o` (#1143): the Host's count, one callback. */
|
|
1945
|
+
private countElements;
|
|
1946
|
+
private elementCall;
|
|
1947
|
+
private elementResultDetail;
|
|
1948
|
+
/** `set the p of o to v`: the Host's `Set`, after the value's Shape check. */
|
|
1949
|
+
private setProperty;
|
|
1950
|
+
private propContext;
|
|
1951
|
+
private joinWidth;
|
|
1952
|
+
/** Its logical size, as Persistent State counts a suspended Run (chapter 8). */
|
|
1953
|
+
size(s?: Suspension | null): number;
|
|
1954
|
+
private leaveJoin;
|
|
1955
|
+
private abandonJoin;
|
|
1956
|
+
private fault;
|
|
1957
|
+
private faultNow;
|
|
1958
|
+
private raiseCore;
|
|
1959
|
+
/** A Core-raised error map: `code`, `message`, its fields, then `at` (chapter 6). */
|
|
1960
|
+
errorMap(code: string, fields: readonly (readonly [string, Value])[], ins: Instruction): Value;
|
|
1961
|
+
private at;
|
|
1962
|
+
private record;
|
|
1963
|
+
/**
|
|
1964
|
+
* Unwind an error from the current instruction (chapter 8, The Unwind
|
|
1965
|
+
* Table): find the first entry that holds a frame's place, charge `unwind`
|
|
1966
|
+
* for the frames search leaves, then dispatch there.
|
|
1967
|
+
*/
|
|
1968
|
+
private unwind;
|
|
1969
|
+
private unwindNow;
|
|
1970
|
+
private activeEntries;
|
|
1971
|
+
private realOwner;
|
|
1972
|
+
private callWouldExceedDepth;
|
|
1973
|
+
private realDepth;
|
|
1974
|
+
private searchCatch;
|
|
1975
|
+
private entryKey;
|
|
1976
|
+
private dispatchEntries;
|
|
1977
|
+
private excludeEntry;
|
|
1978
|
+
private escapePolicy;
|
|
1979
|
+
private withDuring;
|
|
1980
|
+
private leaveCleanupSearch;
|
|
1981
|
+
private escapeCleanup;
|
|
1982
|
+
private exitedCleanups;
|
|
1983
|
+
private acceptCatch;
|
|
1984
|
+
private nextCatch;
|
|
1985
|
+
private lookupOffer;
|
|
1986
|
+
private chooseOffer;
|
|
1987
|
+
private advanceTransfer;
|
|
1988
|
+
private checkState;
|
|
1989
|
+
private returnFrom;
|
|
1990
|
+
private callBody;
|
|
1991
|
+
private fillDefaults;
|
|
1992
|
+
private functionValue;
|
|
1993
|
+
private popArgs;
|
|
1994
|
+
/**
|
|
1995
|
+
* A Capability call (chapter 9): the arguments checked against their
|
|
1996
|
+
* Shapes, uncharged; the declared cost; the Host function, which may
|
|
1997
|
+
* `Charge` more while it starts; then an immediate call's result checked
|
|
1998
|
+
* and its conversion charged. A suspending call suspends the Run until it
|
|
1999
|
+
* is answered, fails or times out. A `Fail` raises its code, and anything
|
|
2000
|
+
* else the Host does wrong is `host error`.
|
|
2001
|
+
*/
|
|
2002
|
+
private capability;
|
|
2003
|
+
private forwardResult;
|
|
2004
|
+
private hostCrossing;
|
|
2005
|
+
private hostError;
|
|
2006
|
+
private payConversion;
|
|
2007
|
+
/**
|
|
2008
|
+
* What a call's failure raises: a `Fail` with a code the Operation may
|
|
2009
|
+
* use raises it, its Data converted and charged; anything else, given as
|
|
2010
|
+
* null, is `host error` (chapter 6, Errors from Capabilities). `record`
|
|
2011
|
+
* writes the call's failure first, when the call record carries it.
|
|
2012
|
+
*/
|
|
2013
|
+
private failure;
|
|
2014
|
+
private restrictedOperation;
|
|
2015
|
+
private execute;
|
|
2016
|
+
private replace;
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Start a Run by dispatching a message to a Handler's clauses, and then, for
|
|
2020
|
+
* a message that may reach one, to the Script's Fallback Handler's (ADR 0064).
|
|
2021
|
+
*/
|
|
2022
|
+
declare const deliver: (script: Script$1, message: string, args: Value[], limits?: Partial<Limits>, fallback?: boolean) => Run;
|
|
2023
|
+
/** Call a named function of the unit, as a Run on its own. */
|
|
2024
|
+
declare const callFunction: (script: Script$1, name: string, args: Value[]) => Run;
|
|
2025
|
+
//#endregion
|
|
2026
|
+
//#region src/library.d.ts
|
|
2027
|
+
type OperationRef = {
|
|
2028
|
+
capability: string;
|
|
2029
|
+
operation: string;
|
|
2030
|
+
};
|
|
2031
|
+
type LibrarySource = {
|
|
2032
|
+
name: string;
|
|
2033
|
+
source: string;
|
|
2034
|
+
version: string;
|
|
2035
|
+
};
|
|
2036
|
+
/** A compiled Library, which any Group may add (chapter 9). */
|
|
2037
|
+
type Library = {
|
|
2038
|
+
/** 32 bytes. */
|
|
2039
|
+
readonly identity: Uint8Array;
|
|
2040
|
+
readonly imports: readonly Library[];
|
|
2041
|
+
readonly name: string;
|
|
2042
|
+
readonly needs: readonly OperationRef[];
|
|
2043
|
+
readonly source: string;
|
|
2044
|
+
readonly version: string;
|
|
2045
|
+
};
|
|
2046
|
+
/** A unit's code identity, given its direct imports' identities (chapter 9). */
|
|
2047
|
+
declare const codeIdentity: (unit: "script" | "library" | "extension", name: string, source: string, imports?: readonly string[]) => string;
|
|
2048
|
+
/** How a Host asks a Library to be compiled, outside the Spec. */
|
|
2049
|
+
type LibraryOptions = {
|
|
2050
|
+
/**
|
|
2051
|
+
* An error raised in it gets an `at` naming the call that entered it, as
|
|
2052
|
+
* for stdlib code (ADR 0037), rather than its own position.
|
|
2053
|
+
*/
|
|
2054
|
+
atCaller?: boolean;
|
|
2055
|
+
};
|
|
2056
|
+
/**
|
|
2057
|
+
* Compile a Library, once per process for each code identity. `imports` holds
|
|
2058
|
+
* every Library its `use` lines name, other than the stdlib's, which are
|
|
2059
|
+
* always there. Throws LoadError.
|
|
2060
|
+
*/
|
|
2061
|
+
declare const compileLibrary: (src: LibrarySource, imports?: readonly Library[], declarations?: GrantDecls, options?: LibraryOptions) => Library;
|
|
2062
|
+
/** Recompile the complete dependent Library graph without changing its registrations. */
|
|
2063
|
+
declare const replacementLibraries: (available: ReadonlyMap<string, Library>, replacement: Library) => Map<string, Library>;
|
|
2064
|
+
//#endregion
|
|
2065
|
+
//#region src/group.d.ts
|
|
2066
|
+
type GroupOptions = {
|
|
2067
|
+
name: string;
|
|
2068
|
+
/**
|
|
2069
|
+
* Called once per queued Host Input. Don't pump inside it.
|
|
2070
|
+
* Inputs queued during a Pump notify in a microtask after it returns.
|
|
2071
|
+
*/
|
|
2072
|
+
onReady?(): void;
|
|
2073
|
+
/**
|
|
2074
|
+
* Seeds the generator `random` draws from, a whole number 0 to 2^64 - 1;
|
|
2075
|
+
* 0 when absent (chapter 7, Random numbers).
|
|
2076
|
+
*/
|
|
2077
|
+
seed?: bigint;
|
|
2078
|
+
/** Receives each Trace line, without its LF. */
|
|
2079
|
+
trace?: (line: string) => void;
|
|
2080
|
+
};
|
|
2081
|
+
/**
|
|
2082
|
+
* TS-internal, and not exported from the package: the Trace records a
|
|
2083
|
+
* Session Host follows its Runs through (ADR 0045), as typed values.
|
|
2084
|
+
*/
|
|
2085
|
+
type RunEvent = {
|
|
2086
|
+
/** Suspended: the calls, replies or Join Members it still waits for. */
|
|
2087
|
+
calls: string[];
|
|
2088
|
+
/** At a start, its Delivery. */
|
|
2089
|
+
delivery?: string;
|
|
2090
|
+
end: string;
|
|
2091
|
+
how: 'start' | 'resume' | 'continue';
|
|
2092
|
+
k: 'seg';
|
|
2093
|
+
run: string;
|
|
2094
|
+
until?: bigint;
|
|
2095
|
+
} | {
|
|
2096
|
+
call: string;
|
|
2097
|
+
k: 'call';
|
|
2098
|
+
run: string;
|
|
2099
|
+
} | {
|
|
2100
|
+
args: Value[];
|
|
2101
|
+
k: 'unhandled';
|
|
2102
|
+
message: string;
|
|
2103
|
+
run?: string;
|
|
2104
|
+
} | {
|
|
2105
|
+
delivery?: string;
|
|
2106
|
+
error?: Value;
|
|
2107
|
+
k: 'run';
|
|
2108
|
+
outcome: string;
|
|
2109
|
+
run: string;
|
|
2110
|
+
};
|
|
2111
|
+
declare const observeValues: unique symbol;
|
|
2112
|
+
declare const sessionReply: unique symbol;
|
|
2113
|
+
declare const observeRuns: unique symbol;
|
|
2114
|
+
declare const queuedInputs: unique symbol;
|
|
2115
|
+
type LoadOptions = {
|
|
2116
|
+
/** Its Grants, by the name the Script uses for each. */
|
|
2117
|
+
grants?: Readonly<Record<string, Grant<any>>>;
|
|
2118
|
+
/** Keep only Operations used by this source and its Libraries. */
|
|
2119
|
+
grantsAsUsed?: boolean;
|
|
2120
|
+
limits?: Partial<Limits>;
|
|
2121
|
+
name: string;
|
|
2122
|
+
/** Its well-known Host Objects, by the name the Script uses. */
|
|
2123
|
+
objects?: Readonly<Record<string, HostObject>>;
|
|
2124
|
+
/** The Host Object it owns: the start of its Message Path. */
|
|
2125
|
+
owner?: HostObject;
|
|
2126
|
+
source: string;
|
|
2127
|
+
};
|
|
2128
|
+
type LimitOverride = Partial<Pick<Limits, 'fuelPerRun' | 'allocPerRun' | 'maxWaitMs' | 'maxJoin'>>;
|
|
2129
|
+
type Message = {
|
|
2130
|
+
args?: Value[];
|
|
2131
|
+
limits?: LimitOverride;
|
|
2132
|
+
name: string;
|
|
2133
|
+
};
|
|
2134
|
+
type Verdict = 'allowed' | 'vetoed' | 'undecided';
|
|
2135
|
+
type Decided = {
|
|
2136
|
+
broadcast?: string;
|
|
2137
|
+
delivery?: string;
|
|
2138
|
+
undecided: {
|
|
2139
|
+
outcome: RunOutcome;
|
|
2140
|
+
run?: string;
|
|
2141
|
+
script: string;
|
|
2142
|
+
}[];
|
|
2143
|
+
verdict: Verdict;
|
|
2144
|
+
vetoes: {
|
|
2145
|
+
reason: Value;
|
|
2146
|
+
run: string;
|
|
2147
|
+
script: string;
|
|
2148
|
+
}[];
|
|
2149
|
+
};
|
|
2150
|
+
type Deciding = {
|
|
2151
|
+
decided: Promise<Decided>;
|
|
2152
|
+
id: string;
|
|
2153
|
+
};
|
|
2154
|
+
type Requested = {
|
|
2155
|
+
id: string;
|
|
2156
|
+
result: Promise<Value>;
|
|
2157
|
+
};
|
|
2158
|
+
type RestoreOptions = GroupOptions & {
|
|
2159
|
+
grants(script: string, name: string): Grant<unknown> | undefined;
|
|
2160
|
+
libraries: readonly Library[];
|
|
2161
|
+
onMismatch: 'reject' | 'variables only';
|
|
2162
|
+
resolve(kind: string, id: string): {
|
|
2163
|
+
native: unknown;
|
|
2164
|
+
} | undefined;
|
|
2165
|
+
};
|
|
2166
|
+
type PendingCall = {
|
|
2167
|
+
args: Value[];
|
|
2168
|
+
grant: string;
|
|
2169
|
+
id: string;
|
|
2170
|
+
operation: {
|
|
2171
|
+
capability: string;
|
|
2172
|
+
operation: string;
|
|
2173
|
+
};
|
|
2174
|
+
script: string;
|
|
2175
|
+
};
|
|
2176
|
+
type RestoreResult = {
|
|
2177
|
+
abandonedCalls: string[];
|
|
2178
|
+
discardedRuns: string[];
|
|
2179
|
+
disposed: [string, string][];
|
|
2180
|
+
droppedMessages: string[];
|
|
2181
|
+
pending: PendingCall[];
|
|
2182
|
+
reports: Report[];
|
|
2183
|
+
variablesOnly: boolean;
|
|
2184
|
+
};
|
|
2185
|
+
type Settlement = {
|
|
2186
|
+
answer: Value;
|
|
2187
|
+
} | {
|
|
2188
|
+
fail: ScriptError;
|
|
2189
|
+
} | {
|
|
2190
|
+
reissue: true;
|
|
2191
|
+
} | {
|
|
2192
|
+
adopt: true;
|
|
2193
|
+
};
|
|
2194
|
+
type CarryOver = 'reset variables' | 'carry variables';
|
|
2195
|
+
type CancellationOptions = {
|
|
2196
|
+
signal?: AbortSignal;
|
|
2197
|
+
};
|
|
2198
|
+
type PumpOptions = {
|
|
2199
|
+
fuelCap?: number;
|
|
2200
|
+
fuelSlice?: number;
|
|
2201
|
+
};
|
|
2202
|
+
type RunOutcome = 'completed' | 'errored' | 'limit fault' | 'cancelled' | 'unhandled' | 'dropped' | 'effect failed';
|
|
2203
|
+
/** The Trace's name for a limit a Limit Fault or failed cleanup passed. */
|
|
2204
|
+
type LimitWord = 'fuel' | 'alloc' | 'persistent' | 'depth' | 'pattern' | 'join' | 'cleanup';
|
|
2205
|
+
/** Where a Run ended: a code position and its source position. */
|
|
2206
|
+
type Location = {
|
|
2207
|
+
col: number;
|
|
2208
|
+
handler: string;
|
|
2209
|
+
line: number;
|
|
2210
|
+
pc: number;
|
|
2211
|
+
unit: string;
|
|
2212
|
+
};
|
|
2213
|
+
type EffectFailure = {
|
|
2214
|
+
detail?: string;
|
|
2215
|
+
grant: string;
|
|
2216
|
+
phase: 'abandon' | 'begin' | 'commit' | 'rollback';
|
|
2217
|
+
run: string;
|
|
2218
|
+
scope?: string;
|
|
2219
|
+
script: string;
|
|
2220
|
+
segment: string;
|
|
2221
|
+
status: 'failed' | 'unknown';
|
|
2222
|
+
};
|
|
2223
|
+
type Report = AccountingReport | {
|
|
2224
|
+
code: HostErrorCode;
|
|
2225
|
+
detail?: string;
|
|
2226
|
+
kind: 'host error';
|
|
2227
|
+
} | ({
|
|
2228
|
+
kind: 'effect failure';
|
|
2229
|
+
} & EffectFailure) | {
|
|
2230
|
+
alloc: number;
|
|
2231
|
+
/** `errored`: the raise no Unwind Table entry caught; `limit fault`: the faulting instruction. */
|
|
2232
|
+
at?: Location;
|
|
2233
|
+
broadcast?: string;
|
|
2234
|
+
cleanupFailed?: {
|
|
2235
|
+
code: string;
|
|
2236
|
+
} | {
|
|
2237
|
+
limit: Exclude<LimitWord, 'fuel'>;
|
|
2238
|
+
};
|
|
2239
|
+
delivery?: string;
|
|
2240
|
+
effect?: EffectFailure;
|
|
2241
|
+
error?: ScriptError;
|
|
2242
|
+
/** Set when a Fallback Handler clause ran it; `handler` is then the Selector. */
|
|
2243
|
+
fallback?: boolean;
|
|
2244
|
+
fuel: number;
|
|
2245
|
+
handler?: string;
|
|
2246
|
+
kind: 'run end';
|
|
2247
|
+
limit?: LimitWord;
|
|
2248
|
+
outcome: RunOutcome;
|
|
2249
|
+
result?: Value;
|
|
2250
|
+
run?: string;
|
|
2251
|
+
script: string;
|
|
2252
|
+
} | {
|
|
2253
|
+
delivery: string;
|
|
2254
|
+
kind: 'unhandled';
|
|
2255
|
+
message: Message;
|
|
2256
|
+
/** The object it was delivered to; absent when addressed to a Script. */
|
|
2257
|
+
target?: HostObject;
|
|
2258
|
+
} | {
|
|
2259
|
+
call: string;
|
|
2260
|
+
/** What the Host did wrong; the Script saw only `host error`. */
|
|
2261
|
+
detail: string;
|
|
2262
|
+
kind: 'call failed';
|
|
2263
|
+
operation: OperationRef;
|
|
2264
|
+
script: string;
|
|
2265
|
+
} | {
|
|
2266
|
+
discardedRuns: string[];
|
|
2267
|
+
droppedMessages: string[];
|
|
2268
|
+
kind: 'stop';
|
|
2269
|
+
pendingCalls: string[];
|
|
2270
|
+
reason: string;
|
|
2271
|
+
script: string;
|
|
2272
|
+
} | ({
|
|
2273
|
+
kind: 'decided';
|
|
2274
|
+
} & Decided);
|
|
2275
|
+
type PumpResult = {
|
|
2276
|
+
fuelUsed: number;
|
|
2277
|
+
/** The earliest deadline the next Pump could fire, if there is one. */
|
|
2278
|
+
nextDeadline?: bigint;
|
|
2279
|
+
reports: Report[];
|
|
2280
|
+
state: 'idle' | 'sliced' | 'stopped' | 'rewound';
|
|
2281
|
+
};
|
|
2282
|
+
/** A snapshot of lifetime work and current retained state. */
|
|
2283
|
+
type Counters = {
|
|
2284
|
+
allocTotal: number;
|
|
2285
|
+
faults: number;
|
|
2286
|
+
fuelTotal: number;
|
|
2287
|
+
mailboxLen: number;
|
|
2288
|
+
persistentState: number;
|
|
2289
|
+
runs: number;
|
|
2290
|
+
};
|
|
2291
|
+
type RunView = {
|
|
2292
|
+
/** Suspended: the calls, replies or Join Members it still waits for. */
|
|
2293
|
+
calls?: string[];
|
|
2294
|
+
handler: string;
|
|
2295
|
+
id: string;
|
|
2296
|
+
status: 'preempted' | 'ready' | 'suspended' | 'parked';
|
|
2297
|
+
/** Suspended: its deadline, as its `seg` record's `until` gives it. */
|
|
2298
|
+
until?: bigint;
|
|
2299
|
+
/** Suspended: the `seg` end reason it suspended at. */
|
|
2300
|
+
wait?: string;
|
|
2301
|
+
};
|
|
2302
|
+
type MessageView = {
|
|
2303
|
+
/** Absent for a message a Script sent. */
|
|
2304
|
+
delivery?: string;
|
|
2305
|
+
/** For a message a Script sent, the call or Run that sent it. */
|
|
2306
|
+
from?: string;
|
|
2307
|
+
message: Message;
|
|
2308
|
+
};
|
|
2309
|
+
type Inspection = {
|
|
2310
|
+
scripts: {
|
|
2311
|
+
disabledGrants?: string[];
|
|
2312
|
+
mailbox: MessageView[];
|
|
2313
|
+
name: string;
|
|
2314
|
+
runs: RunView[];
|
|
2315
|
+
vars: [string, Value][];
|
|
2316
|
+
}[];
|
|
2317
|
+
};
|
|
2318
|
+
type Decision = {
|
|
2319
|
+
ballots: Ballot[];
|
|
2320
|
+
broadcast: boolean;
|
|
2321
|
+
discarded?: boolean;
|
|
2322
|
+
id: string;
|
|
2323
|
+
resolve: (v: Decided) => void;
|
|
2324
|
+
settled?: boolean;
|
|
2325
|
+
unsubscribe?: () => void;
|
|
2326
|
+
};
|
|
2327
|
+
type Ballot = {
|
|
2328
|
+
decision: Decision;
|
|
2329
|
+
result?: {
|
|
2330
|
+
undecided?: Decided['undecided'][number];
|
|
2331
|
+
verdict: Verdict;
|
|
2332
|
+
veto?: Decided['vetoes'][number];
|
|
2333
|
+
};
|
|
2334
|
+
};
|
|
2335
|
+
type Delivery = {
|
|
2336
|
+
ancestry?: RunAncestry;
|
|
2337
|
+
args: Value[];
|
|
2338
|
+
/** The object whose Owning Script holds it, which it climbs on from. */
|
|
2339
|
+
at: ObjectState | null;
|
|
2340
|
+
ballot?: Ballot;
|
|
2341
|
+
broadcast?: string;
|
|
2342
|
+
/** The failed message, for an internal `error` Delivery. */
|
|
2343
|
+
during?: Value;
|
|
2344
|
+
fn?: Value;
|
|
2345
|
+
/** For a message a Script sent, the sending Run. */
|
|
2346
|
+
from: string | null;
|
|
2347
|
+
/** The delivery id; a message a Script sent has none. */
|
|
2348
|
+
id: string | null;
|
|
2349
|
+
limits: LimitOverride;
|
|
2350
|
+
message: string;
|
|
2351
|
+
/** The current path starts here; a climb excludes the last owner that handled it. */
|
|
2352
|
+
path?: {
|
|
2353
|
+
after: boolean;
|
|
2354
|
+
from: ObjectState;
|
|
2355
|
+
};
|
|
2356
|
+
/** For a `send … and wait`, the sender's call id, which the Run's end settles. */
|
|
2357
|
+
reply: string | null;
|
|
2358
|
+
request: {
|
|
2359
|
+
reject: (e: Error) => void;
|
|
2360
|
+
resolve: (v: Value) => void;
|
|
2361
|
+
} | null;
|
|
2362
|
+
/** The object it was addressed to: `the target` all the way up. */
|
|
2363
|
+
target: ObjectState | null;
|
|
2364
|
+
unsubscribe?: () => void;
|
|
2365
|
+
};
|
|
2366
|
+
/** A handle for calls addressed to one Script. */
|
|
2367
|
+
declare class Script {
|
|
2368
|
+
private readonly group;
|
|
2369
|
+
readonly name: string;
|
|
2370
|
+
constructor(group: Group, name: string);
|
|
2371
|
+
/** Worker. A snapshot of kept Operations, including revoked Grants. */
|
|
2372
|
+
grants(): Record<string, string[]>;
|
|
2373
|
+
/** Worker. Lifetime totals and current state, without draining inputs. */
|
|
2374
|
+
counters(): Counters;
|
|
2375
|
+
/** Queued. Returns the delivery id. */
|
|
2376
|
+
deliver(m: Message): string;
|
|
2377
|
+
/** Queued. Asks for a Verdict sealed in a Pump. */
|
|
2378
|
+
decide(m: Message, o?: CancellationOptions): Deciding;
|
|
2379
|
+
/** Queued. Settles when a Pump ends the Run, or rejects with `send failed`. */
|
|
2380
|
+
request(m: Message, o?: CancellationOptions): Requested;
|
|
2381
|
+
reload(source: string, carry: CarryOver, o?: {
|
|
2382
|
+
keepMailbox?: boolean;
|
|
2383
|
+
}): Report[];
|
|
2384
|
+
extend(source: string): void;
|
|
2385
|
+
stop(reason: string): void;
|
|
2386
|
+
cancelRun(runId: string): void;
|
|
2387
|
+
/** Queued, landing as cancelRun does (ADR 0068). */
|
|
2388
|
+
rewindRun(runId: string): void;
|
|
2389
|
+
/** Queued. In-flight calls are left to the Host. */
|
|
2390
|
+
revoke(grantName: string): void;
|
|
2391
|
+
}
|
|
2392
|
+
declare class Group {
|
|
2393
|
+
private valueObserver?;
|
|
2394
|
+
[observeValues](observer: (tree: unknown) => void): void;
|
|
2395
|
+
[sessionReply](id: string, reply: Resumption): void;
|
|
2396
|
+
readonly name: string;
|
|
2397
|
+
private readonly trace;
|
|
2398
|
+
private readonly onReady;
|
|
2399
|
+
private readonly scripts;
|
|
2400
|
+
private readonly libraries;
|
|
2401
|
+
private readonly pending;
|
|
2402
|
+
private readonly functionGroup;
|
|
2403
|
+
private readonly objects;
|
|
2404
|
+
private drainReports;
|
|
2405
|
+
private accounting;
|
|
2406
|
+
private discardReason;
|
|
2407
|
+
private timers;
|
|
2408
|
+
private timerSeq;
|
|
2409
|
+
private inputs;
|
|
2410
|
+
private deliveries;
|
|
2411
|
+
private broadcasts;
|
|
2412
|
+
private saves;
|
|
2413
|
+
private lastClock;
|
|
2414
|
+
private randomState;
|
|
2415
|
+
private pumping;
|
|
2416
|
+
private cleaning;
|
|
2417
|
+
private effectStateUnknown;
|
|
2418
|
+
private terminalReports;
|
|
2419
|
+
private active;
|
|
2420
|
+
private activeStop;
|
|
2421
|
+
/** A Rewind landed in this Pump, which returns at once (ADR 0068). */
|
|
2422
|
+
private rewound;
|
|
2423
|
+
private drainingTrace;
|
|
2424
|
+
private debugController;
|
|
2425
|
+
private debugPump;
|
|
2426
|
+
/**
|
|
2427
|
+
* The next `random(n)` draw from the Group's generator; `commit` advances
|
|
2428
|
+
* the generator past it (chapter 7, Random numbers).
|
|
2429
|
+
*/
|
|
2430
|
+
drawRandom(n: bigint): {
|
|
2431
|
+
commit(): void;
|
|
2432
|
+
value: bigint;
|
|
2433
|
+
};
|
|
2434
|
+
private ancestry;
|
|
2435
|
+
private accountStart;
|
|
2436
|
+
private accountEnd;
|
|
2437
|
+
private accountDrop;
|
|
2438
|
+
private flushAccounting;
|
|
2439
|
+
/** TS tooling only, outside the embedding interface and Trace parity. */
|
|
2440
|
+
debug(): DebugController;
|
|
2441
|
+
private advanceDebugPump;
|
|
2442
|
+
private observer;
|
|
2443
|
+
/** TS-internal: receives the records a Session Host follows (ADR 0045). */
|
|
2444
|
+
[observeRuns](observer: ((r: RunEvent) => void) | null): void;
|
|
2445
|
+
/** TS-internal: whether Host Inputs wait for the next Pump (chapter 12, The foreground). */
|
|
2446
|
+
[queuedInputs](): boolean;
|
|
2447
|
+
/** Worker. A Fingerprint covers code, declarations and limits, never state. */
|
|
2448
|
+
fingerprint(): Uint8Array;
|
|
2449
|
+
private snapshotReferences;
|
|
2450
|
+
/** Worker. Host callbacks, bindings and native objects aren't in the bytes. */
|
|
2451
|
+
save(): Uint8Array;
|
|
2452
|
+
/** Build and check the complete replacement before publishing the Group. */
|
|
2453
|
+
static restore(bytes: Uint8Array, o: RestoreOptions): {
|
|
2454
|
+
group: Group;
|
|
2455
|
+
result: RestoreResult;
|
|
2456
|
+
};
|
|
2457
|
+
private discardedDecisions;
|
|
2458
|
+
private unsettled;
|
|
2459
|
+
private restored;
|
|
2460
|
+
private discardDecision;
|
|
2461
|
+
private drainCharges;
|
|
2462
|
+
/** Queued, and accepted only before the restored Group's first Pump. */
|
|
2463
|
+
settle(id: string, settlement: Settlement): Call<unknown> | undefined;
|
|
2464
|
+
private applySettlement;
|
|
2465
|
+
private pendingCall;
|
|
2466
|
+
private openJoinCalls;
|
|
2467
|
+
private pendingOperations;
|
|
2468
|
+
/** A Request's signal lives until its Run ends; a Decision's until its seal. */
|
|
2469
|
+
watchCancellation(delivery: Delivery, signal?: AbortSignal): void;
|
|
2470
|
+
/** Queue the Host Input produced by aborting a Request, Decision or Host call. */
|
|
2471
|
+
cancelDelivery(id: string): void;
|
|
2472
|
+
private cancelDeliveryNow;
|
|
2473
|
+
queueCancelRun(name: string, id: string): void;
|
|
2474
|
+
queueRewindRun(name: string, id: string): void;
|
|
2475
|
+
queueStop(name: string, reason: string): void;
|
|
2476
|
+
queueRevoke(name: string, grant: string): void;
|
|
2477
|
+
private applyInput;
|
|
2478
|
+
private runsOf;
|
|
2479
|
+
private forgetWait;
|
|
2480
|
+
private cancelRunning;
|
|
2481
|
+
/**
|
|
2482
|
+
* Roll back a Run's first Segment, end it and put its message back at the
|
|
2483
|
+
* head of the mailbox. The running Pump returns at once (ADR 0068).
|
|
2484
|
+
*/
|
|
2485
|
+
private rewindRunning;
|
|
2486
|
+
private stoppedDelivery;
|
|
2487
|
+
private stopState;
|
|
2488
|
+
private stopUnknownEffects;
|
|
2489
|
+
private requireKnownEffects;
|
|
2490
|
+
private releaseGrant;
|
|
2491
|
+
private releaseGrants;
|
|
2492
|
+
private reportStop;
|
|
2493
|
+
private dropStoppedMailbox;
|
|
2494
|
+
private acceptDelivery;
|
|
2495
|
+
private recordRefusal;
|
|
2496
|
+
private landUrgentInputs;
|
|
2497
|
+
constructor(options: GroupOptions);
|
|
2498
|
+
script(name: string): Script | undefined;
|
|
2499
|
+
/** Any time, inside a Pump too. Its Scripts' names, in load order; not a Host Input. */
|
|
2500
|
+
scriptNames(): string[];
|
|
2501
|
+
private queueInput;
|
|
2502
|
+
private worker;
|
|
2503
|
+
private finalizeEffects;
|
|
2504
|
+
private accumulateRunCosts;
|
|
2505
|
+
scriptCounters(name: string): Counters;
|
|
2506
|
+
scriptGrants(name: string): Record<string, string[]>;
|
|
2507
|
+
/** Worker. Compiles, checks and loads a Script, or throws LoadError. */
|
|
2508
|
+
load(o: LoadOptions): Script;
|
|
2509
|
+
private loadPrepared;
|
|
2510
|
+
private writeDiagnostics;
|
|
2511
|
+
private replacement;
|
|
2512
|
+
/** Worker. Check and initialise before discarding any old work. */
|
|
2513
|
+
reload(name: string, source: string, carry: CarryOver, keepMailbox?: boolean): Report[];
|
|
2514
|
+
private extension;
|
|
2515
|
+
private applyExtension;
|
|
2516
|
+
/** Worker. Existing code units and Runs remain untouched. */
|
|
2517
|
+
extend(name: string, source: string): void;
|
|
2518
|
+
private replaceScripts;
|
|
2519
|
+
/**
|
|
2520
|
+
* Worker, Host Input. Adds a compiled Library, whose imports the Group must
|
|
2521
|
+
* already hold, under a name it doesn't hold yet.
|
|
2522
|
+
*/
|
|
2523
|
+
addLibrary(l: Library): void;
|
|
2524
|
+
/** Worker. Prepare every dependent before changing the Group. */
|
|
2525
|
+
replaceLibrary(l: Library, carry: CarryOver): Report[];
|
|
2526
|
+
private hostFor;
|
|
2527
|
+
private enqueue;
|
|
2528
|
+
private timer;
|
|
2529
|
+
private fireTimer;
|
|
2530
|
+
private ready;
|
|
2531
|
+
private settleReply;
|
|
2532
|
+
private endWaiter;
|
|
2533
|
+
private observe;
|
|
2534
|
+
private suspended;
|
|
2535
|
+
private checkFunctionGroups;
|
|
2536
|
+
/** A queued Delivery: its id now, its line and its mailbox entry at the next Pump. */
|
|
2537
|
+
queueDelivery(record: 'deliver' | 'request' | 'decide' | 'call-value', to: string | ObjectState, m: Message, request: Delivery['request'], ballot?: Ballot, fn?: Value): Delivery;
|
|
2538
|
+
/** Queued. Asks the object's Message Path for a Verdict. */
|
|
2539
|
+
decide(to: HostObject, m: Message, o?: CancellationOptions): Deciding;
|
|
2540
|
+
queueDecision(to: string | ObjectState, m: Message, o?: CancellationOptions): Deciding;
|
|
2541
|
+
/** Queued. Takes recipients at drain, then waits for every Verdict. */
|
|
2542
|
+
decideBroadcast(m: Message, o?: CancellationOptions): Deciding;
|
|
2543
|
+
/** Queued. Delivers to recipients taken in load order at drain. */
|
|
2544
|
+
broadcast(m: Message): string;
|
|
2545
|
+
private queueBroadcast;
|
|
2546
|
+
private broadcastLine;
|
|
2547
|
+
private seal;
|
|
2548
|
+
private reportDecision;
|
|
2549
|
+
/** Queued. Routes to the object's nearest Owning Script; returns the delivery id. */
|
|
2550
|
+
deliver(to: HostObject, m: Message): string;
|
|
2551
|
+
/** Queued. As `deliver`, and settles when a Pump ends the Run. */
|
|
2552
|
+
request(to: HostObject, m: Message, o?: CancellationOptions): Requested;
|
|
2553
|
+
/** Queued. Calls a Function Value as a Request to its Home Script. */
|
|
2554
|
+
call(fn: Value, args: Value[], o?: CancellationOptions & {
|
|
2555
|
+
limits?: LimitOverride;
|
|
2556
|
+
}): Requested;
|
|
2557
|
+
/** Makes a handle for a Host-owned thing, the first time it crosses in. */
|
|
2558
|
+
object<N>(kind: ObjectKind<N>, id: string, native: N): HostObject<N>;
|
|
2559
|
+
/** The handle with this Object Kind name and id, disposed or not, such as one Restore made. */
|
|
2560
|
+
objectById(kind: string, id: string): HostObject | undefined;
|
|
2561
|
+
/** Whether an object value is one of this Group's handles. */
|
|
2562
|
+
holdsObject(v: Value): boolean;
|
|
2563
|
+
private held;
|
|
2564
|
+
private parentError;
|
|
2565
|
+
/** Queued. Refuses cycles and disposed children at admission and again at drain. */
|
|
2566
|
+
setParent(o: HostObject, parent: HostObject | undefined): void;
|
|
2567
|
+
/** Queued. Disposes an object: it stays a value, and sends to it raise `object gone`. */
|
|
2568
|
+
dispose(o: HostObject): void;
|
|
2569
|
+
private route;
|
|
2570
|
+
private unhandled;
|
|
2571
|
+
private answer;
|
|
2572
|
+
private deliveryLine;
|
|
2573
|
+
/** Worker. One Clock reading, the queue drained, then turns until done (chapter 5). */
|
|
2574
|
+
pump(now: bigint, o?: PumpOptions): PumpResult;
|
|
2575
|
+
private pumpAtClock;
|
|
2576
|
+
private moveDelivery;
|
|
2577
|
+
private turn;
|
|
2578
|
+
private writeCancellationAbandons;
|
|
2579
|
+
private callFailed;
|
|
2580
|
+
private releaseRecords;
|
|
2581
|
+
private writeRecords;
|
|
2582
|
+
private endRun;
|
|
2583
|
+
private releaseParked;
|
|
2584
|
+
/** A Script's Persistent State: its Script Variables and the messages it holds. */
|
|
2585
|
+
private persistentState;
|
|
2586
|
+
/** Worker, and the Host Input `vars`: the Group, read without changing it. */
|
|
2587
|
+
private waitView;
|
|
2588
|
+
/** A Run's calls and sends that a Rewind leaves done (ADR 0068). */
|
|
2589
|
+
private repeatedEffects;
|
|
2590
|
+
private debugSnapshot;
|
|
2591
|
+
inspect(): Inspection;
|
|
2592
|
+
private inspection;
|
|
2593
|
+
}
|
|
2594
|
+
declare const newGroup: (o: GroupOptions) => Group;
|
|
2595
|
+
declare const restore: (bytes: Uint8Array, options: RestoreOptions) => {
|
|
2596
|
+
group: Group;
|
|
2597
|
+
result: RestoreResult;
|
|
2598
|
+
};
|
|
2599
|
+
//#endregion
|
|
2600
|
+
//#region src/debug.d.ts
|
|
2601
|
+
type DebugInstruction = {
|
|
2602
|
+
pc: number;
|
|
2603
|
+
run?: string;
|
|
2604
|
+
script?: string;
|
|
2605
|
+
unit?: string;
|
|
2606
|
+
};
|
|
2607
|
+
type DebugPause = Location & {
|
|
2608
|
+
error?: Value;
|
|
2609
|
+
hostInputIndex?: number;
|
|
2610
|
+
limit?: LimitName;
|
|
2611
|
+
reason: 'breakpoint' | 'step' | 'error' | 'limitFault' | 'replay';
|
|
2612
|
+
run: string;
|
|
2613
|
+
script: string;
|
|
2614
|
+
};
|
|
2615
|
+
type DebugFrame = Location & {
|
|
2616
|
+
locals: [string, Value][];
|
|
2617
|
+
/** Zero-based index of the shared-local owner in this Run's frame view. */
|
|
2618
|
+
owner?: number;
|
|
2619
|
+
role?: 'retained' | 'dispatch';
|
|
2620
|
+
};
|
|
2621
|
+
/** An effect a Rewind leaves done, so it happens again (ADR 0068). */
|
|
2622
|
+
type RepeatedEffect = {
|
|
2623
|
+
id: string;
|
|
2624
|
+
kind: 'call';
|
|
2625
|
+
op: string;
|
|
2626
|
+
} | {
|
|
2627
|
+
kind: 'send';
|
|
2628
|
+
message?: string;
|
|
2629
|
+
to: string;
|
|
2630
|
+
};
|
|
2631
|
+
type DebugSnapshot = Omit<Inspection, 'scripts'> & {
|
|
2632
|
+
scripts: (Omit<Inspection['scripts'][number], 'runs'> & {
|
|
2633
|
+
runs: (Inspection['scripts'][number]['runs'][number] & {
|
|
2634
|
+
frames: DebugFrame[];
|
|
2635
|
+
fuel: number;
|
|
2636
|
+
/** Effects so far that a Rewind would repeat; empty unless rewindable. */
|
|
2637
|
+
repeated: RepeatedEffect[];
|
|
2638
|
+
/** It hasn't passed a Suspension Point, so it can be rewound. */
|
|
2639
|
+
rewindable: boolean;
|
|
2640
|
+
segment: number;
|
|
2641
|
+
})[];
|
|
2642
|
+
})[];
|
|
2643
|
+
};
|
|
2644
|
+
type DebugSource = {
|
|
2645
|
+
script?: string;
|
|
2646
|
+
statements: number[];
|
|
2647
|
+
unit: CodeUnit;
|
|
2648
|
+
};
|
|
2649
|
+
/** Tooling only; chapter 9's embedding declarations do not expose this API. */
|
|
2650
|
+
declare class DebugController {
|
|
2651
|
+
private readonly read;
|
|
2652
|
+
private readonly advance;
|
|
2653
|
+
private readonly readSources;
|
|
2654
|
+
paused: ((pause: DebugPause) => void) | null;
|
|
2655
|
+
private breaks;
|
|
2656
|
+
private faults;
|
|
2657
|
+
private stepping;
|
|
2658
|
+
private parents;
|
|
2659
|
+
private landing;
|
|
2660
|
+
/** Pause at the next Run of this Script to start, once (Fix and Continue). */
|
|
2661
|
+
private restart;
|
|
2662
|
+
private readonly seen;
|
|
2663
|
+
private pause;
|
|
2664
|
+
private pauseDepth;
|
|
2665
|
+
private notifying;
|
|
2666
|
+
private since;
|
|
2667
|
+
private elapsed;
|
|
2668
|
+
constructor(read: () => DebugSnapshot, advance: () => PumpResult, readSources: () => DebugSource[]);
|
|
2669
|
+
/** Detached lowerings of the code actually loaded, including extensions. */
|
|
2670
|
+
sources(): DebugSource[];
|
|
2671
|
+
get isPaused(): boolean;
|
|
2672
|
+
get current(): DebugPause | null;
|
|
2673
|
+
breakAt(instructions: readonly DebugInstruction[]): void;
|
|
2674
|
+
clearBreaks(): void;
|
|
2675
|
+
pauseOn(options: {
|
|
2676
|
+
error?: boolean;
|
|
2677
|
+
limitFault?: boolean;
|
|
2678
|
+
}): void;
|
|
2679
|
+
snapshot(): DebugSnapshot;
|
|
2680
|
+
pausedTime(): number;
|
|
2681
|
+
resume(): PumpResult;
|
|
2682
|
+
step(): PumpResult;
|
|
2683
|
+
stepOver(): PumpResult;
|
|
2684
|
+
stepOut(): PumpResult;
|
|
2685
|
+
/** Pause, as a step, at the first instruction of the Script's next new Run. */
|
|
2686
|
+
pauseAtNextStart(script: string): void;
|
|
2687
|
+
landAt(hostInputIndex: number, pc: DebugInstruction | number): void;
|
|
2688
|
+
private stepped;
|
|
2689
|
+
private assertCanContinue;
|
|
2690
|
+
private continue;
|
|
2691
|
+
/** Internal scheduler integration. */
|
|
2692
|
+
attach(run: Run, from: string | null): void;
|
|
2693
|
+
ended(run: Run): void;
|
|
2694
|
+
boundary(run: Run, script: string): DebugPause | null;
|
|
2695
|
+
enter(pause: DebugPause): void;
|
|
2696
|
+
}
|
|
2697
|
+
//#endregion
|
|
2698
|
+
export { RunAccounting as $, shape as $t, restore as A, TokType as An, Call as At, Outcome as B, ImmediateOp as Bt, Requested as C, SemanticNode as Cn, HostObject as Ct, Settlement as D, SourceSpan as Dn, PropDef as Dt, Script as E, SemanticTree as En, ObjectKindDef as Et, codeIdentity as F, SyntaxRule as Fn, ErrorDecl as Ft, callFunction as G, ScopeDecl as Gt, RunRecord as H, Operation as Ht, compileLibrary as I, Trivia as In, FieldShape as It, loadScript as J, SegmentGrant as Jt, defaultLimits as K, SegmentContext as Kt, replacementLibraries as L, syntaxSelector as Ln, FireOp as Lt, LibraryOptions as M, SyntaxElement as Mn, CoordinatedLifecycle as Mt, LibrarySource as N, SyntaxErrorCode as Nn, Cost as Nt, Verdict as O, Lexer as On, defineObjectKind as Ot, OperationRef as P, SyntaxNode as Pn, EffectResult as Pt, CausalWork as Q, defineCapability as Qt, LimitName as R, syntaxText as Rn, Grant as Rt, Report as S, SemanticName as Sn, parseInstant as St, RestoreResult as T, SemanticToken as Tn, ObjectKind as Tt, Script$1 as U, ReleaseHook as Ut, Run as V, LimitReached as Vt, UnitLoadError as W, ReleaseReason as Wt, canConvert as X, Shape as Xt, NotImplementedError as Y, SegmentLifecycle as Yt, waitUs as Z, SuspendingOp as Zt, LoadOptions as _, ExportKind as _n, range as _t, DebugSnapshot as a, ScriptError as an, Value as at, PumpOptions as b, NameRole as bn, text as bt, CancellationOptions as c, CodeUnit as cn, civilDate as ct, Decided as d, Instruction as dn, isReadable as dt, HostError as en, RunAncestry as et, Deciding as f, Operand as fn, list as ft, Inspection as g, BindingKind as gn, quantity as gt, GroupOptions as h, Binding as hn, num as ht, DebugPause as i, MailboxFull as in, Kind as it, Library as j, Token as jn, CapabilityDef as jt, newGroup as k, Mode as kn, GrantDecls as kt, CarryOver as l, EventBranch as ln, dec as lt, Group as m, disassemble as mn, nothing as mt, DebugFrame as n, LoadDiagnostic as nn, RunStarted as nt, DebugSource as o, Body as on, bool as ot, EffectFailure as p, UnwindEntry as pn, map as pt, deliver as q, SegmentCoordinator as qt, DebugInstruction as r, LoadError as rn, Decimal as rt, RepeatedEffect as s, BodyKind as sn, bytes as st, DebugController as t, HostErrorCode as tn, RunDiscarded as tt, Counters as u, EventEntry as un, instant as ut, Message as v, FunctionContract as vn, record as vt, RestoreOptions as w, SemanticScope as wn, ObjectElements as wt, PumpResult as x, SemanticElement as xn, formatInstant as xt, PendingCall as y, LibraryExport as yn, sourceForm as yt, Limits as z, GrantContext as zt };
|