@mark1russell7/coeval 0.0.0-stage → 0.2.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.
@@ -0,0 +1,1600 @@
1
+ //#region src/doc.d.ts
2
+ /** A JSON value. A document is JSON. */
3
+ type Json = null | boolean | number | string | readonly Json[] | {
4
+ readonly [key: string]: Json;
5
+ };
6
+ /** A JSON record. */
7
+ type JsonRecord = {
8
+ readonly [key: string]: Json;
9
+ };
10
+ /** One step of a path that is a plain key: a name, or an index of a list. */
11
+ type Key = string | number;
12
+ /**
13
+ * The type of a document is a reference into the world (the registry of kinds).
14
+ *
15
+ * - A text is a base reference with one key: `"add"`.
16
+ * - A list of keys is a base reference with a path: `["git", "push"]`.
17
+ * - A document of type `ref` is the same reference, expanded. Its path starts at the root `world`.
18
+ *
19
+ * The kernel resolves a base reference itself. The expanded form is necessary only to attach more to the
20
+ * reference. Thus the chain of types stops at a base reference.
21
+ */
22
+ type TypeRef = string | readonly Key[] | {
23
+ readonly type: "ref";
24
+ readonly value: readonly Json[];
25
+ };
26
+ /**
27
+ * A typed document: an envelope with a header and a value. The header names the type of the value. The value is
28
+ * not changed by the envelope at any time. Thus any JSON value can have a type: a number, a list, a text or a record.
29
+ */
30
+ type Envelope = {
31
+ /** The type: a reference to a kind of the world. */
32
+ readonly type: TypeRef;
33
+ /** The value. */
34
+ readonly value: Json;
35
+ /** The name of a binding. A sequence gives the result of this document to the later steps under this name. */
36
+ readonly name?: string;
37
+ /** The own entries: one evaluator name for each verb. An own entry changes only this document. */
38
+ readonly own?: Readonly<Record<string, string>>;
39
+ };
40
+ /** The keys that an envelope can have. */
41
+ export declare const ENVELOPE_KEYS: readonly ["type", "value", "name", "own"];
42
+ /**
43
+ * This function tells if a value is a plain record: an object with the prototype of a plain object, or with no
44
+ * prototype. A list, `null`, a date, a map and an instance of a class are not plain records.
45
+ *
46
+ * @param value - The value to examine.
47
+ * @returns `true` for a plain record.
48
+ */
49
+ export declare function isRecord(value: unknown): value is JsonRecord;
50
+ /**
51
+ * This function reads a field of a record. It reads only the own fields, thus `constructor` is not a field.
52
+ *
53
+ * @param record - The record.
54
+ * @param key - The name of the field.
55
+ * @returns The value of the field, or `undefined` when the record has no such field.
56
+ */
57
+ export declare function field(record: JsonRecord, key: string): Json | undefined;
58
+ /**
59
+ * This function tells if a value is a key of a path: a text, or a whole number from 0.
60
+ *
61
+ * @param value - The value to examine.
62
+ * @returns `true` for a key.
63
+ */
64
+ export declare function isKey(value: unknown): value is Key;
65
+ /**
66
+ * This function tells if a value is a reference to a type. The reference is a text, a list of keys, or a document
67
+ * of type `ref` whose path starts at the root `world`.
68
+ *
69
+ * @param value - The value to examine.
70
+ * @returns `true` for a reference to a type.
71
+ */
72
+ export declare function isTypeRef(value: unknown): value is TypeRef;
73
+ /**
74
+ * This function gives the path of a reference to a type, from the root of the world.
75
+ *
76
+ * @param type - The reference.
77
+ * @returns The keys from the root of the world, or `undefined` for a computed step that has no fixed key.
78
+ */
79
+ export declare function typePath(type: TypeRef): readonly Key[] | undefined;
80
+ /**
81
+ * This function gives the text of a type for a reader: its keys, joined with a dot.
82
+ *
83
+ * @param type - The reference to the type.
84
+ * @returns The text, for example `git.push`.
85
+ */
86
+ export declare function typeName(type: TypeRef): string;
87
+ /**
88
+ * This function tells if a value has the form of an envelope. That form is a record with a reference to a type
89
+ * and a `value`. It has no other keys than the keys of an envelope. A contract decides where an envelope is
90
+ * expected. This function only checks the form.
91
+ *
92
+ * @param value - The value to examine.
93
+ * @returns `true` when the value has the form of an envelope.
94
+ */
95
+ export declare function isEnvelope(value: unknown): value is JsonRecord & Envelope;
96
+ /** A stored document: an envelope, and the keys of its store beside it, for example `_id`. */
97
+ interface Stored {
98
+ readonly envelope: Envelope;
99
+ /** The keys of the store, with their values. */
100
+ readonly header: Readonly<Record<string, Json>>;
101
+ }
102
+ /**
103
+ * This function reads a stored document: an envelope that also has the keys of a store, for example `{ _id, type,
104
+ * value }`. Only the keys in the list can be beside the keys of the envelope.
105
+ *
106
+ * @param value - The value to examine.
107
+ * @param header - The keys of the store that the document can have.
108
+ * @returns The envelope and the keys of the store, or `undefined` when the value has another form.
109
+ */
110
+ export declare function stored(value: unknown, header: readonly string[]): Stored | undefined;
111
+ /**
112
+ * This function makes an envelope.
113
+ *
114
+ * @param type - The reference to the kind.
115
+ * @param value - The value.
116
+ * @param header - The optional name and own entries.
117
+ * @returns The envelope.
118
+ */
119
+ export declare function typed(type: TypeRef, value: Json, header?: {
120
+ readonly name?: string;
121
+ readonly own?: Record<string, string>;
122
+ }): Envelope;
123
+ /**
124
+ * This function makes a reference document: a path from a root of the context.
125
+ *
126
+ * @param path - The steps. The first step is a root: `self`, `names`, `world`, `event` or `caps`.
127
+ * @returns The document of type `ref`.
128
+ */
129
+ export declare function ref(...path: readonly Json[]): Envelope;
130
+ /**
131
+ * This function gives an envelope as a JSON record, for a store or for a view.
132
+ *
133
+ * @param doc - The envelope.
134
+ * @returns The same envelope as JSON.
135
+ */
136
+ export declare function toJson(doc: Envelope): JsonRecord;
137
+ /**
138
+ * This function reads an envelope from JSON. A value without the form of an envelope gives `undefined`.
139
+ *
140
+ * @param value - The JSON value.
141
+ * @returns The envelope, or `undefined`.
142
+ */
143
+ export declare function fromJson(value: unknown): Envelope | undefined;
144
+ /**
145
+ * This function tells if two JSON values are equal. Equal values have the same texts, numbers and truth values,
146
+ * the same items in the same order, and the same fields. The order of the fields does not matter. It does not use the stack for the
147
+ * depth, thus a deep document cannot overflow it.
148
+ *
149
+ * @param a - The first value.
150
+ * @param b - The second value.
151
+ * @returns `true` when the values are equal.
152
+ */
153
+ export declare function docEquals(a: unknown, b: unknown): boolean;
154
+ //#endregion
155
+ //#region src/errors.d.ts
156
+ /** The codes that the kernel gives. */
157
+ type KernelCode = "#KIND?" | "#NOEVAL" | "#PART?" | "#NAME?" | "#REF!" | "#N/A" | "#CYCLE!" | "#STEP?" | "#VALUE!" | "#NUM!" | "#ARGS" | "#CAP!" | "#CALC!" | "#DEPTH!" | "#ABORT";
158
+ /** The code of an error value. A language can add its own codes. Each code starts with `#`. */
159
+ type ErrorCode = KernelCode | `#${string}`;
160
+ /**
161
+ * An error value: a code and a reason. An evaluation gives an error value, and it does not throw.
162
+ *
163
+ * - `place`: the keys from the root document to the document that failed.
164
+ * - `cause`: the error of the host that caused this error, for example the exception of an effect.
165
+ */
166
+ interface EvalError {
167
+ readonly code: ErrorCode;
168
+ readonly reason: string;
169
+ readonly place?: readonly Key[];
170
+ readonly cause?: unknown;
171
+ }
172
+ /** The result of an evaluation: a value, or an error value. A value can be any value of the host. */
173
+ type Result<V = unknown> = {
174
+ readonly ok: true;
175
+ readonly value: V;
176
+ } | {
177
+ readonly ok: false;
178
+ readonly error: EvalError;
179
+ };
180
+ /** A result with an error value. */
181
+ type Failed = {
182
+ readonly ok: false;
183
+ readonly error: EvalError;
184
+ };
185
+ /**
186
+ * This function makes a result with a value.
187
+ *
188
+ * @param value - The value.
189
+ * @returns The result.
190
+ */
191
+ export declare function ok<V>(value: V): Result<V>;
192
+ /**
193
+ * This function makes a result with an error value.
194
+ *
195
+ * @param code - The code of the error.
196
+ * @param reason - One sentence that tells the cause.
197
+ * @param more - The place and the cause of the error, when they are known.
198
+ * @returns The result.
199
+ */
200
+ export declare function fail(code: ErrorCode, reason: string, more?: {
201
+ readonly place?: readonly Key[];
202
+ readonly cause?: unknown;
203
+ }): Failed;
204
+ /**
205
+ * This function gives a failed result its place, when it has none. A result with a value, or an error with a
206
+ * place, stays the same object.
207
+ *
208
+ * @param result - The result.
209
+ * @param place - The keys from the root document to the document that failed.
210
+ * @returns The result with a place.
211
+ */
212
+ export declare function placed<V>(result: Result<V>, place: readonly Key[]): Result<V>;
213
+ /**
214
+ * An exception that carries an error value through code of the host. A closure of a formula throws it when the
215
+ * host calls the closure and the closure fails. The kernel catches it and gives its error value again.
216
+ */
217
+ export declare class Failure extends Error {
218
+ readonly error: EvalError;
219
+ /**
220
+ * This constructor makes the exception.
221
+ *
222
+ * @param error - The error value that the exception carries.
223
+ */
224
+ constructor(error: EvalError);
225
+ }
226
+ /**
227
+ * This function tells if an exception is the overflow of the stack of the host.
228
+ *
229
+ * @param error - The exception.
230
+ * @returns `true` for a stack overflow.
231
+ */
232
+ export declare function isStackOverflow(error: unknown): boolean;
233
+ /**
234
+ * This function changes an exception into an error value. A `Failure` gives its error value. A stack overflow
235
+ * gives `#DEPTH!`. Each other exception gives `#CALC!`, with the exception as the cause.
236
+ *
237
+ * @param error - The exception.
238
+ * @param who - A short text that names the code that threw, for example `the evaluator math.add`.
239
+ * @returns The failed result.
240
+ */
241
+ export declare function thrown(error: unknown, who: string): Failed;
242
+ /**
243
+ * This function gives a short text for an exception or any value. It does not throw.
244
+ *
245
+ * @param value - The value.
246
+ * @returns The text.
247
+ */
248
+ export declare function describe(value: unknown): string;
249
+ //#endregion
250
+ //#region src/world.d.ts
251
+ /** The two sides of evaluation. `derive` is pure. `run` causes effects in order. */
252
+ type Side = "derive" | "run";
253
+ /**
254
+ * Where the parts of a value are: the shape of the value. A part is a typed document that the evaluator gets
255
+ * sealed. `of` is the type of a bare part: a part without an envelope gets this type from its position.
256
+ *
257
+ * - `none`: the value is data. It has no parts.
258
+ * - `term`: the value itself is one part.
259
+ * - `list`: the value is a list. Each item has the shape `item` (the default is a part).
260
+ * - `map`: the value is a record. Each field has the shape `item` (the default is a part).
261
+ * - `record`: the value is a record. Each named field has its shape. A list of names makes each named field a
262
+ * part. The other fields have the shape `rest` (the default is data). `required` names the fields that must be.
263
+ * - `deep`: each envelope at any depth of the value is a part, and the rest is data.
264
+ */
265
+ type Shape = {
266
+ readonly shape: "none";
267
+ } | {
268
+ readonly shape: "term";
269
+ readonly of?: string;
270
+ } | {
271
+ readonly shape: "list";
272
+ readonly of?: string;
273
+ readonly item?: Shape;
274
+ } | {
275
+ readonly shape: "map";
276
+ readonly of?: string;
277
+ readonly item?: Shape;
278
+ } | {
279
+ readonly shape: "record";
280
+ readonly fields: readonly string[] | Readonly<Record<string, Shape>>;
281
+ readonly of?: string;
282
+ readonly required?: readonly string[];
283
+ readonly rest?: Shape;
284
+ } | {
285
+ readonly shape: "deep";
286
+ readonly of?: string;
287
+ };
288
+ /** The former name of `Shape`. */
289
+ type PartsSpec = Shape;
290
+ /**
291
+ * Where the names of a scope rule come from.
292
+ *
293
+ * - `fixed`: the names in the list.
294
+ * - `keysAt`: the keys of the record at this path of the value, for example the bindings of a `let`.
295
+ * - `listAt`: the texts of the list at this path of the value, for example the parameters of a `fn`.
296
+ * - `textAt`: the text at this path of the value, or `otherwise` when the value has no text there.
297
+ * - `headers`: the binding name (`name`) of each part that the rule covers.
298
+ */
299
+ type NamesSource = {
300
+ readonly fixed: readonly string[];
301
+ } | {
302
+ readonly keysAt: readonly Key[];
303
+ } | {
304
+ readonly listAt: readonly Key[];
305
+ } | {
306
+ readonly textAt: readonly Key[];
307
+ readonly otherwise?: string;
308
+ } | {
309
+ readonly headers: true;
310
+ };
311
+ /**
312
+ * A scope rule of a kind: names that the kind binds, and the parts that see them. The static kit reads the rules,
313
+ * and the evaluator of the kind binds the same names when it evaluates the parts.
314
+ */
315
+ interface ScopeRule {
316
+ readonly names: NamesSource;
317
+ /** The parts that see the names, as patterns of their paths in the value. The key `"*"` matches each key. */
318
+ readonly in: readonly (readonly Key[])[];
319
+ /** `true`: a part sees only the names of the parts before it, as in a sequence. */
320
+ readonly sequential?: boolean;
321
+ }
322
+ /** A kind gives the name of an evaluator for each verb, and the contract of its value. */
323
+ interface Kind {
324
+ readonly verbs: Readonly<Record<string, string>>;
325
+ /** Where the parts of the value are. The default is `none`. */
326
+ readonly parts?: Shape;
327
+ /** The names that the kind binds for its parts. */
328
+ readonly scope?: readonly ScopeRule[];
329
+ /** The side of the kind. A kind of the run side causes effects. The default is `derive`. */
330
+ readonly side?: Side;
331
+ /**
332
+ * The effects that a document of this kind can cause. It is a list of the kinds of the effects. The text
333
+ * `"type"` means that the kind of the effect is the type of the document itself, as for a call.
334
+ */
335
+ readonly effects?: "type" | readonly string[];
336
+ /** One sentence that tells what the kind is. */
337
+ readonly summary?: string;
338
+ }
339
+ /** A namespace: a group of entries under one key of the world. `fallback` is the kind of each other key in it. */
340
+ interface Namespace {
341
+ readonly kinds: Readonly<Record<string, WorldEntry>>;
342
+ readonly fallback?: Kind;
343
+ }
344
+ /** An alias: a reference to another entry of the world. The lookup follows it (collapse). */
345
+ type Alias = {
346
+ readonly type: "ref";
347
+ readonly value: readonly Json[];
348
+ };
349
+ /** One entry of the world: a kind, a namespace, or an alias. */
350
+ type WorldEntry = Kind | Namespace | Alias;
351
+ /** A world holds the kinds and the defaults that answer the questions. */
352
+ interface World {
353
+ readonly kinds: Readonly<Record<string, WorldEntry>>;
354
+ readonly defaults: Readonly<Record<string, string>>;
355
+ }
356
+ /** The result of a lookup of a type in the world. */
357
+ type Lookup = {
358
+ readonly ok: true;
359
+ readonly kind: Kind;
360
+ readonly path: readonly Key[];
361
+ readonly aliases: number;
362
+ } | {
363
+ readonly ok: false;
364
+ readonly reason: "unknown" | "cycle" | "not-a-kind" | "computed";
365
+ readonly path: readonly Key[];
366
+ };
367
+ /**
368
+ * This function tells if an entry of the world is a kind.
369
+ *
370
+ * @param entry - The entry.
371
+ * @returns `true` for a kind.
372
+ */
373
+ export declare function isKind(entry: WorldEntry | undefined): entry is Kind;
374
+ /**
375
+ * This function tells if an entry of the world is an alias.
376
+ *
377
+ * @param entry - The entry.
378
+ * @returns `true` for an alias.
379
+ */
380
+ export declare function isAlias(entry: WorldEntry | undefined): entry is Alias;
381
+ /**
382
+ * This function tells if an entry of the world is a namespace.
383
+ *
384
+ * @param entry - The entry.
385
+ * @returns `true` for a namespace.
386
+ */
387
+ export declare function isNamespace(entry: WorldEntry | undefined): entry is Namespace;
388
+ /**
389
+ * This function finds the kind that a type names. It walks the path from the root of the world, one key at a
390
+ * time. An alias on the way is followed until a kind answers (collapse). A cycle of aliases stops the lookup. In a
391
+ * namespace with a fallback, a key that the namespace does not have gets the fallback kind.
392
+ *
393
+ * @param world - The world.
394
+ * @param type - The reference to the type.
395
+ * @returns The kind and the path of the kind after each alias, or the reason of a failure.
396
+ */
397
+ export declare function lookupKind(world: World, type: TypeRef): Lookup;
398
+ /**
399
+ * This function gives the entries of a world as a JSON record, so that a reference can walk it. A kind is a
400
+ * record with its verbs, an alias is a reference document, and a namespace is a record of its entries.
401
+ *
402
+ * @param entries - The entries.
403
+ * @returns The JSON form.
404
+ */
405
+ export declare function entriesAsJson(entries: Readonly<Record<string, WorldEntry>>): Json;
406
+ /**
407
+ * This function makes the document of a kind, so that a view can draw it as each other document.
408
+ *
409
+ * @param name - The name of the kind.
410
+ * @param kind - The kind.
411
+ * @returns The document of type `kind`.
412
+ */
413
+ export declare function kindDocument(name: string, kind: Kind): Envelope;
414
+ /**
415
+ * This function tells if a JSON value is the record of a kind.
416
+ *
417
+ * @param value - The value.
418
+ * @returns `true` when the value has verbs.
419
+ */
420
+ export declare function looksLikeKind(value: unknown): boolean;
421
+ //#endregion
422
+ //#region src/ladder.d.ts
423
+ /** The rungs of the ladder, in the order that a question visits them. */
424
+ export declare const RUNGS: readonly ["own", "kind", "default"];
425
+ /** One rung of the ladder. */
426
+ type Rung = (typeof RUNGS)[number];
427
+ /** The place where the ladder found the type. */
428
+ type KindSource = "document" | "container";
429
+ /**
430
+ * The outcome of one rung.
431
+ *
432
+ * - `answers`: the rung gives an evaluator.
433
+ * - `no-entry`: the rung has nothing for this verb, thus the question goes to the next rung.
434
+ * - `skipped`: the rung does not apply, because no type is known.
435
+ * - `unknown-kind`: the type is not a kind of the world. The question stops.
436
+ */
437
+ type Outcome = "answers" | "no-entry" | "skipped" | "unknown-kind";
438
+ /** The record of one rung that a question visited. */
439
+ interface Step {
440
+ readonly rung: Rung;
441
+ readonly outcome: Outcome;
442
+ /** The evaluator, when the outcome is `answers`. */
443
+ readonly evaluator?: string;
444
+ /** The text of the type, at the kind rung. */
445
+ readonly kind?: string;
446
+ /** The place of the type, at the kind rung. */
447
+ readonly source?: KindSource;
448
+ }
449
+ /** The answer to a question. It keeps the record of each rung that the question visited. */
450
+ interface Answer {
451
+ readonly verb: string;
452
+ /** The evaluator that answers. A question that stops with an error has no evaluator. */
453
+ readonly evaluator?: string;
454
+ /** The rung that answered. */
455
+ readonly rung?: Rung;
456
+ /** The reason when no rung answers. */
457
+ readonly error?: "unknown-kind" | "no-answer";
458
+ readonly steps: readonly Step[];
459
+ }
460
+ /**
461
+ * The header that the ladder reads: the type and the own entries. An envelope is a header. A bare value has an
462
+ * empty header, and its position can declare its type.
463
+ */
464
+ interface Header {
465
+ readonly type?: TypeRef;
466
+ readonly own?: Readonly<Record<string, string>>;
467
+ }
468
+ /** The options of a question. */
469
+ interface AskOptions {
470
+ /** The type that the position of a bare value declares. The type of an envelope wins. */
471
+ readonly declaredType?: string;
472
+ }
473
+ /**
474
+ * This function finds the kind that a type names, and follows each alias. It gives `undefined` for an unknown
475
+ * type.
476
+ *
477
+ * @param world - The world.
478
+ * @param type - The reference to the type.
479
+ * @returns The kind, or `undefined`.
480
+ */
481
+ export declare function kindOf(world: World, type: TypeRef): Kind | undefined;
482
+ /**
483
+ * This function finds a kind by a text type. It is the same as `kindOf` for a one-key reference.
484
+ *
485
+ * @param world - The world.
486
+ * @param name - The text of the type.
487
+ * @returns The kind, or `undefined`.
488
+ */
489
+ export declare function kindNamed(world: World, name: TypeRef): Kind | undefined;
490
+ /**
491
+ * This function asks a document a question, and gives the evaluator that answers it.
492
+ *
493
+ * The question visits the rungs in order: the own entry of the envelope, then its kind, then the default of the
494
+ * world. The type comes from the envelope, or else from the type that the position declares. The type is a
495
+ * reference into the world. The ladder does not guess a type from the shape of a value.
496
+ *
497
+ * @param world - The kinds and the defaults.
498
+ * @param doc - The header of the document: an envelope, or `{}` for a bare value.
499
+ * @param verb - The verb of the question, for example `eval` or `view`.
500
+ * @param options - The type that the position declares.
501
+ * @returns The answer, with the record of each rung that the question visited.
502
+ */
503
+ export declare function ask(world: World, doc: Header, verb: string, options?: AskOptions): Answer;
504
+ //#endregion
505
+ //#region src/deref.d.ts
506
+ /**
507
+ * The brand of a host thing: an object of the host that answers the steps of a path itself. The brand is a
508
+ * global symbol, thus two copies of the kernel in one program know the things of each other.
509
+ */
510
+ export declare const THING: unique symbol;
511
+ /**
512
+ * A host thing: an object that answers the steps of a path itself, for example a node of a live tree. It is the
513
+ * own entry of the ladder for the verb `deref`.
514
+ */
515
+ interface HostThing {
516
+ readonly [THING]: true;
517
+ /** A short text for a reader, for example `node card`. */
518
+ readonly label: string;
519
+ /**
520
+ * This function answers one step.
521
+ *
522
+ * @param key - The key of the step.
523
+ * @returns What the step reaches, or `undefined` when it reaches nothing.
524
+ */
525
+ deref(key: Key): Thing | undefined;
526
+ /**
527
+ * This function gives the thing as a value, when a reference ends on it.
528
+ *
529
+ * @returns The value.
530
+ */
531
+ toJson(): unknown;
532
+ /**
533
+ * This optional function answers all the steps of a path that are keys, in one call. A store uses it to read a
534
+ * path without one call for each step.
535
+ *
536
+ * @param keys - The keys.
537
+ * @returns What the keys reach, or `undefined` when they reach nothing.
538
+ */
539
+ resolve?(keys: readonly Key[]): {
540
+ readonly thing: Thing;
541
+ } | undefined;
542
+ }
543
+ /** Something that a path can reach: any value of the host, or a host thing. */
544
+ type Thing = unknown;
545
+ /**
546
+ * This function tells if a thing is a host thing.
547
+ *
548
+ * @param thing - The thing.
549
+ * @returns `true` for a host thing.
550
+ */
551
+ export declare function isHostThing(thing: unknown): thing is HostThing;
552
+ /** The roots of a context. Each path starts with one of them. */
553
+ export declare const ROOTS: readonly ["self", "names", "world", "event", "caps"];
554
+ /** One root of a context. */
555
+ type Root = (typeof ROOTS)[number];
556
+ /**
557
+ * A capability: the name of a kind of effect, or its keys. A capability permits its kind and each kind under it.
558
+ * Keys are necessary when a key has a dot in it.
559
+ */
560
+ type Cap = string | readonly Key[];
561
+ /**
562
+ * The context of a term: a record with five roots. A reference reaches outside its term only through them.
563
+ *
564
+ * - `self`: the node that the term is part of.
565
+ * - `names`: the values that the evaluators around the term bound.
566
+ * - `world`: the registry of kinds.
567
+ * - `event`: the event that started a run.
568
+ * - `caps`: the effects that the term can cause.
569
+ */
570
+ interface Context {
571
+ readonly self: Thing;
572
+ readonly names: Readonly<Record<string, unknown>>;
573
+ readonly world: Thing;
574
+ readonly event: Thing;
575
+ readonly caps: readonly Cap[];
576
+ }
577
+ /** The code of a `deref` evaluator: it answers one step of a path on a document of its kind. */
578
+ type DerefCode = (doc: Envelope, key: Key) => Thing | undefined;
579
+ /** The result of a step document: what it reached, or the reason of a failure. */
580
+ type WalkResult = {
581
+ readonly ok: true;
582
+ readonly thing: Thing;
583
+ } | {
584
+ readonly ok: false;
585
+ readonly reason: string;
586
+ };
587
+ /** The input of a walker: the code of a step document, for example `nearest`. */
588
+ interface WalkInput {
589
+ /** The value of the step document. */
590
+ readonly data: Json;
591
+ /** The thing that the path reached before this step. */
592
+ readonly here: Thing;
593
+ readonly context: Context;
594
+ /**
595
+ * This function answers one step on a thing, through the ladder.
596
+ *
597
+ * @param thing - The thing.
598
+ * @param key - The key.
599
+ * @returns What the step reaches, or `undefined`.
600
+ */
601
+ deref(thing: Thing, key: Key): Thing | undefined;
602
+ }
603
+ /** A walker: the code of the verb `step` of a kind of step documents. */
604
+ type Walker = (input: WalkInput) => WalkResult;
605
+ /**
606
+ * What a resolution needs: the world, and the code of the `deref` evaluators and of the walkers.
607
+ *
608
+ * - `plain`: `true` when the values are data. Then a step does not ask the kind of an envelope, and a reference
609
+ * that a step reaches stays a value (no collapse).
610
+ * - `roots`: the roots that a path can start at. The default is each root.
611
+ */
612
+ interface Navigator {
613
+ readonly world: World;
614
+ readonly derefs?: Readonly<Record<string, DerefCode>>;
615
+ readonly walkers?: Readonly<Record<string, Walker>>;
616
+ readonly plain?: boolean;
617
+ readonly roots?: readonly Root[];
618
+ }
619
+ /** The way that one hop of a path was answered. */
620
+ type HopBy = "root" | "own" | "kind" | "default" | "step" | "collapse";
621
+ /** One hop of a path: the step, what it reached, and who answered it. */
622
+ interface Hop {
623
+ readonly step: Json;
624
+ readonly thing: Thing;
625
+ readonly by: HopBy;
626
+ }
627
+ /** The codes of a failed resolution. */
628
+ type ResolveCode = "#REF!" | "#NAME?" | "#N/A" | "#CYCLE!" | "#STEP?";
629
+ /** The result of a resolution: what the path reached, with each hop, or an error with the hops before it. */
630
+ type Resolution = {
631
+ readonly ok: true;
632
+ readonly thing: Thing;
633
+ readonly hops: readonly Hop[];
634
+ } | {
635
+ readonly ok: false;
636
+ readonly code: ResolveCode;
637
+ readonly reason: string;
638
+ readonly hops: readonly Hop[];
639
+ };
640
+ /** The options of a resolution. */
641
+ interface ResolveOptions {
642
+ /** `false`: do not record the hops. The default is `true`. */
643
+ readonly hops?: boolean;
644
+ }
645
+ /**
646
+ * This function answers one step of a path on a thing, through the ladder of the verb `deref`. A host thing
647
+ * answers for itself (own). A document asks its own entry, then its kind. The default goes into the value: an own
648
+ * field of an object, or an item of a list.
649
+ *
650
+ * @param nav - The world and the code of the evaluators.
651
+ * @param thing - The thing that the path reached.
652
+ * @param key - The key of the step.
653
+ * @returns What the step reaches and the rung that answered, or `undefined` when it reaches nothing.
654
+ */
655
+ export declare function derefStep(nav: Navigator, thing: Thing, key: Key): {
656
+ readonly thing: Thing;
657
+ readonly by: HopBy;
658
+ } | undefined;
659
+ /**
660
+ * This function tells if a thing is a reference document: an envelope of the type `ref` with a list for its path.
661
+ *
662
+ * @param thing - The thing.
663
+ * @returns `true` for a reference document.
664
+ */
665
+ export declare function isRef(thing: unknown): thing is Envelope & {
666
+ readonly value: readonly Json[];
667
+ };
668
+ /**
669
+ * This function makes the thing of the root `world`: the entries of the world as JSON. An alias is a reference
670
+ * document in it, thus a walk through the world follows each alias (collapse). The thing of a world is made one
671
+ * time.
672
+ *
673
+ * @param world - The world.
674
+ * @returns The thing.
675
+ */
676
+ export declare function worldThing(world: World): Json;
677
+ /**
678
+ * This function makes a context. The world comes from the navigator when the call gives none.
679
+ *
680
+ * @param parts - The roots to set.
681
+ * @returns The context.
682
+ */
683
+ export declare function context(parts?: Partial<Context>): Context;
684
+ /**
685
+ * This function resolves a path from a context, and records each hop.
686
+ *
687
+ * The first step is a root of the context. Each later step is a key or a step document. A key goes up the ladder
688
+ * of the verb `deref` on the thing that the path reached. A step document is evaluated by the walker of its kind,
689
+ * with the thing that the path reached. After each hop, a reference document is followed until the path reaches
690
+ * something else (collapse), except in a plain navigation.
691
+ *
692
+ * The codes of a failure:
693
+ *
694
+ * - `#REF!`: the path has no root, or a root that is not open here.
695
+ * - `#NAME?`: the root `names` has no such name.
696
+ * - `#N/A`: a step reaches nothing.
697
+ * - `#STEP?`: a step is not a key and not a step document.
698
+ * - `#CYCLE!`: the references form a cycle.
699
+ *
700
+ * @param nav - The world and the code of the evaluators.
701
+ * @param ctx - The context.
702
+ * @param path - The steps.
703
+ * @param options - `hops: false` does not record the hops.
704
+ * @returns What the path reached and each hop, or an error.
705
+ */
706
+ export declare function resolve(nav: Navigator, ctx: Context, path: readonly unknown[], options?: ResolveOptions): Resolution;
707
+ /**
708
+ * This function gives the value of a thing: the value that a host thing gives, or else the thing itself.
709
+ *
710
+ * @param thing - The thing.
711
+ * @returns The value.
712
+ */
713
+ export declare function valueOfThing(thing: Thing): unknown;
714
+ //#endregion
715
+ //#region src/classify.d.ts
716
+ /** A shape proposes a kind for each document that has all of its fields. */
717
+ interface Shape$1 {
718
+ readonly name: string;
719
+ readonly fields: readonly string[];
720
+ readonly kind: string;
721
+ }
722
+ /** The result of a classification. */
723
+ interface Classification {
724
+ /** The kind of the one most specific shape. */
725
+ readonly kind?: string;
726
+ /** The names of the most specific shapes. */
727
+ readonly candidates: readonly string[];
728
+ /** `no-match`: no shape applies. `ambiguous`: two or more shapes match equally well. */
729
+ readonly error?: "no-match" | "ambiguous";
730
+ }
731
+ /**
732
+ * This function proposes a kind for a value without a type, from the fields that the value has.
733
+ * A shape applies when the value has each field of the shape. The most specific shapes are the ones that
734
+ * no other applicable shape contains. A host uses a classifier when data comes in, and then tags the data.
735
+ * The ladder does not call a classifier.
736
+ *
737
+ * @param shapes - The shapes to examine.
738
+ * @param value - The value without a type.
739
+ * @returns The proposed kind, or an error with the candidates.
740
+ */
741
+ export declare function classify(shapes: readonly Shape$1[], value: Json): Classification;
742
+ /**
743
+ * This function puts a value in an envelope with a type. The value does not change.
744
+ *
745
+ * @param value - The value.
746
+ * @param kind - The name of the kind.
747
+ * @returns The envelope.
748
+ */
749
+ export declare function tag(value: Json, kind: string): Envelope;
750
+ //#endregion
751
+ //#region src/parts.d.ts
752
+ /** One part of a value: its place in the value, the JSON of the part, and the type that its position declares. */
753
+ interface PartSlot {
754
+ /** The keys from the value of the document to the part. */
755
+ readonly path: readonly Key[];
756
+ /** The path as one text, with a dot between the keys, for example `bind.x`. A part of a list has its index. */
757
+ readonly key: string;
758
+ readonly item: Json;
759
+ readonly of?: string;
760
+ }
761
+ /** The value of a document, split into its parts, by the shape that its kind declares. */
762
+ type Split = {
763
+ readonly ok: true;
764
+ /** The parts, in the order of the value. */
765
+ readonly parts: readonly PartSlot[];
766
+ /** The value without the parts: a field that holds a part is not in it, and a list of parts gives `null`. */
767
+ readonly data: Json;
768
+ /**
769
+ * This function gives the value with a handle in the place of each part.
770
+ *
771
+ * @param handles - One handle for each part, in the order of `parts`.
772
+ * @returns The value with the handles.
773
+ */
774
+ fill<P>(handles: readonly P[]): unknown;
775
+ } | {
776
+ readonly ok: false;
777
+ readonly reason: string;
778
+ readonly at: readonly Key[];
779
+ };
780
+ /**
781
+ * This function splits a value into its parts, by the shape that its kind declares. The evaluator, the view and
782
+ * the static kit use the same split, thus each one sees the same parts.
783
+ *
784
+ * @param shape - The shape of the value. The default is data.
785
+ * @param value - The value of the document.
786
+ * @returns The parts and a way to fill their places, or the reason why the value does not have the shape.
787
+ */
788
+ export declare function splitParts(shape: Shape | undefined, value: Json): Split;
789
+ /**
790
+ * This function tells if the path of a part matches a pattern of a scope rule. The key `"*"` of a pattern matches
791
+ * each key.
792
+ *
793
+ * @param path - The path of the part.
794
+ * @param pattern - The pattern.
795
+ * @returns `true` when the path matches.
796
+ */
797
+ export declare function pathMatches(path: readonly Key[], pattern: readonly Key[]): boolean;
798
+ //#endregion
799
+ //#region src/evaluate.d.ts
800
+ /**
801
+ * This function makes a context with names and capabilities. The other roots are empty, and an evaluation sets
802
+ * the world.
803
+ *
804
+ * @param names - The names and their values.
805
+ * @param caps - The effects that the term can cause.
806
+ * @param self - The node of the term, if it has one.
807
+ * @returns The context.
808
+ */
809
+ export declare function makeContext(names?: Readonly<Record<string, unknown>>, caps?: readonly Cap[], self?: Thing): Context;
810
+ /**
811
+ * This function gives the keys of a capability or of a kind of effect: a text is split at its dots.
812
+ *
813
+ * @param kind - The text or the keys.
814
+ * @returns The keys, as texts.
815
+ */
816
+ export declare function capKeys(kind: Cap): readonly string[];
817
+ /**
818
+ * This function tells if the capabilities permit an effect. A capability permits the kind of its name, and each kind
819
+ * under it: `store` permits `store.update`. The comparison is key by key, thus `fs.read` does not permit the
820
+ * kind with the keys `fs` and `read.json`.
821
+ *
822
+ * @param caps - The capabilities of the context.
823
+ * @param kind - The kind of the effect: a text with dots, or its keys.
824
+ * @returns `true` when one capability permits it.
825
+ */
826
+ export declare function permits(caps: readonly Cap[], kind: Cap): boolean;
827
+ /**
828
+ * This function narrows a context for a part: the part keeps only the capabilities that the context of its parent
829
+ * permits. Thus an evaluator cannot give a part more effects than it has.
830
+ *
831
+ * @param parent - The context of the parent.
832
+ * @param next - The context that the evaluator gives the part.
833
+ * @returns The context of the part.
834
+ */
835
+ export declare function narrow(parent: Context, next: Context): Context;
836
+ /**
837
+ * The steps of an evaluation that can wait. It yields a promise only when the host makes it wait. A runner takes the
838
+ * result of a part with `yield*`, thus a run goes on at once until an effect waits. A runner does not yield a
839
+ * promise itself: it uses `yield*` on the steps that the kernel gives.
840
+ */
841
+ type Steps = Generator<Promise<unknown>, Result, unknown>;
842
+ /** An effect that an evaluation caused, in the order of the effects. */
843
+ interface Effect {
844
+ readonly index: number;
845
+ /** The kind of the effect, as a text with dots. */
846
+ readonly kind: string;
847
+ /** The keys of the kind of the effect. */
848
+ readonly path: readonly Key[];
849
+ readonly payload: unknown;
850
+ /** The ID of the trace node that caused the effect, or -1 without a trace. */
851
+ readonly node: number;
852
+ /** The number of events before the effect. The effect comes before the end of its node. */
853
+ readonly at: number;
854
+ /** The keys from the root document to the document that caused the effect. */
855
+ readonly place: readonly Key[];
856
+ /** The context of the document that caused the effect: its names, its node and its capabilities. */
857
+ readonly context: Context;
858
+ }
859
+ /** The host side of a run: it does one effect, and gives its result. A throw or a rejection is an error value. */
860
+ type Perform = (effect: Effect) => unknown;
861
+ /**
862
+ * The runtime of one evaluation or run. Compiled code gets it with the context, and asks it to resolve paths and
863
+ * to cause effects.
864
+ */
865
+ interface Runtime {
866
+ readonly machine: Machine;
867
+ /** `true` in a run: the host does each effect, and a part that waits needs a parent that can wait. */
868
+ readonly running: boolean;
869
+ /**
870
+ * This function resolves a path from a context.
871
+ *
872
+ * @param ctx - The context.
873
+ * @param path - The steps. The first step is a root.
874
+ * @param options - `hops: true` records each hop. The default records them only in a traced evaluation.
875
+ * @returns What the path reached, or an error.
876
+ */
877
+ resolve(ctx: Context, path: readonly unknown[], options?: ResolveOptions): Resolution;
878
+ /**
879
+ * This function causes an effect from an evaluator. In a run, an evaluator cannot cause an effect: the host does
880
+ * each effect, thus only a runner can wait for it.
881
+ *
882
+ * @param ctx - The context of the document.
883
+ * @param kind - The kind of the effect.
884
+ * @param payload - The data of the effect.
885
+ * @param place - The place of the document.
886
+ * @returns The payload, or an error value.
887
+ */
888
+ effect(ctx: Context, kind: Cap, payload: unknown, place: readonly Key[]): Result;
889
+ /**
890
+ * This function causes an effect from a runner. In a run, the host does it, and the steps wait when the host
891
+ * waits.
892
+ *
893
+ * @param ctx - The context of the document.
894
+ * @param kind - The kind of the effect.
895
+ * @param payload - The data of the effect.
896
+ * @param place - The place of the document.
897
+ * @returns The steps that give the result of the host, or an error value.
898
+ */
899
+ runEffect(ctx: Context, kind: Cap, payload: unknown, place: readonly Key[]): Steps;
900
+ /**
901
+ * This function drives several steps at the same time. When one waits, the others go on.
902
+ *
903
+ * @param list - One function for each item. Each function starts the steps of its item.
904
+ * @param options - The most items that run at the same time. The default is each item.
905
+ * @returns The steps that give each result, in the order of the list.
906
+ */
907
+ all(list: readonly (() => Steps)[], options?: {
908
+ readonly concurrency?: number;
909
+ }): Generator<Promise<unknown>, readonly Result[], unknown>;
910
+ }
911
+ /** Compiled code: the evaluation of a document in a context. */
912
+ type Code = (ctx: Context, rt: Runtime) => Result;
913
+ /** Compiled code that can wait: the run of a document in a context. */
914
+ type RunCode = (ctx: Context, rt: Runtime) => Steps;
915
+ /** A compiled part: its place in its parent, its binding name, and its code. It has no field with its value. */
916
+ interface CompiledPart {
917
+ /** The path in the value of the parent as one text, for example `0` or `bind.x`. */
918
+ readonly key: string;
919
+ /** The keys from the value of the parent to the part. */
920
+ readonly path: readonly Key[];
921
+ /** The binding name from the header of the part. */
922
+ readonly name?: string;
923
+ /** The code that evaluates the part. */
924
+ readonly code: Code;
925
+ /** The code that runs the part. Its steps can wait. */
926
+ readonly run: RunCode;
927
+ }
928
+ /** The input of a compiler: the document, its kind, and its parts, compiled. */
929
+ interface CompileInput {
930
+ /** The text of the type of the document, for example `add` or `math.sum` after its alias. */
931
+ readonly kind: string;
932
+ /** The keys of the kind after each alias. */
933
+ readonly typePath: readonly Key[];
934
+ readonly doc: Envelope;
935
+ /** The value of the document with a compiled part in the place of each part. */
936
+ readonly value: unknown;
937
+ /** The value of the document without its parts. */
938
+ readonly data: Json;
939
+ /** The compiled parts, in the order of the value. */
940
+ readonly parts: readonly CompiledPart[];
941
+ /** The keys from the root document to this document. */
942
+ readonly place: readonly Key[];
943
+ readonly machine: Machine;
944
+ }
945
+ /**
946
+ * A sealed part. An evaluator can read the binding name of a part and evaluate it. It cannot read the value of the
947
+ * part, thus two parts that give the same results can replace each other.
948
+ */
949
+ interface Part$1 {
950
+ /** The path in the value of the parent as one text, for example `0` or `bind.x`. */
951
+ readonly key: string;
952
+ /** The keys from the value of the parent to the part. */
953
+ readonly path: readonly Key[];
954
+ /** The binding name from the header of the part. */
955
+ readonly name?: string;
956
+ /**
957
+ * This function evaluates the part. Each call is a new evaluation.
958
+ *
959
+ * @param context - The context for the part. The default is the context of the parent.
960
+ * @returns The result of the part.
961
+ */
962
+ evaluate(context?: Context): Result;
963
+ }
964
+ /** The input of an evaluator. */
965
+ interface EvalInput {
966
+ /** The text of the type of the document, for example `add` or `math.sum` after its alias. */
967
+ readonly kind: string;
968
+ /** The keys of the kind after each alias. */
969
+ readonly typePath: readonly Key[];
970
+ readonly doc: Envelope;
971
+ /** The value of the document with a sealed part in the place of each part. */
972
+ readonly value: unknown;
973
+ /** The value of the document without its parts. */
974
+ readonly data: Json;
975
+ /** The parts, in the order of the value. */
976
+ readonly parts: readonly Part$1[];
977
+ /** The context of the document. */
978
+ readonly context: Context;
979
+ /** The keys from the root document to this document. */
980
+ readonly place: readonly Key[];
981
+ /**
982
+ * This function resolves a path from the context of the document.
983
+ *
984
+ * @param path - The steps. The first step is a root.
985
+ * @param options - `hops: true` records each hop.
986
+ * @returns What the path reached, or an error.
987
+ */
988
+ resolve(path: readonly unknown[], options?: ResolveOptions): Resolution;
989
+ /**
990
+ * This function causes an effect. The context must have the capability for the kind of the effect. In a run, an
991
+ * evaluator cannot cause an effect: the host does each effect, thus only a runner can wait for it.
992
+ *
993
+ * @param kind - The kind of the effect, for example `log`.
994
+ * @param payload - The data of the effect.
995
+ * @returns The payload, or the error `#CAP!`.
996
+ */
997
+ effect(kind: Cap, payload: unknown): Result;
998
+ }
999
+ /** A part for a runner. Its evaluation can wait for the effects in it. */
1000
+ interface RunPart {
1001
+ /** The path in the value of the parent as one text. */
1002
+ readonly key: string;
1003
+ /** The keys from the value of the parent to the part. */
1004
+ readonly path: readonly Key[];
1005
+ /** The binding name from the header of the part. */
1006
+ readonly name?: string;
1007
+ /**
1008
+ * This function evaluates the part. Each call is a new evaluation. Take its result with `yield*`.
1009
+ *
1010
+ * @param context - The context for the part. The default is the context of the parent.
1011
+ * @returns The steps of the evaluation of the part.
1012
+ */
1013
+ evaluate(context?: Context): Steps;
1014
+ }
1015
+ /** The input of a runner: the input of an evaluator, with parts and effects that can wait. */
1016
+ interface RunInput {
1017
+ readonly kind: string;
1018
+ readonly typePath: readonly Key[];
1019
+ readonly doc: Envelope;
1020
+ /** The value of the document with a part for a runner in the place of each part. */
1021
+ readonly value: unknown;
1022
+ readonly data: Json;
1023
+ readonly parts: readonly RunPart[];
1024
+ readonly context: Context;
1025
+ readonly place: readonly Key[];
1026
+ resolve(path: readonly unknown[], options?: ResolveOptions): Resolution;
1027
+ /**
1028
+ * This function causes an effect. In a run, the host does the effect, and the steps wait when the host waits. In
1029
+ * an evaluation, the effect gives its payload. Take its result with `yield*`.
1030
+ *
1031
+ * @param kind - The kind of the effect, for example `log`.
1032
+ * @param payload - The data of the effect.
1033
+ * @returns The steps that give the result of the host, or an error value.
1034
+ */
1035
+ effect(kind: Cap, payload: unknown): Steps;
1036
+ /**
1037
+ * This function evaluates parts at the same time. Take the results with `yield*`.
1038
+ *
1039
+ * @param parts - The parts.
1040
+ * @param options - The most parts that run at the same time.
1041
+ * @returns The steps that give each result, in the order of the parts.
1042
+ */
1043
+ all(parts: readonly RunPart[], options?: {
1044
+ readonly concurrency?: number;
1045
+ }): Generator<Promise<unknown>, readonly Result[], unknown>;
1046
+ }
1047
+ /** An evaluator that is a function of its input. The kernel calls it for each evaluation. */
1048
+ type EvalFn = (input: EvalInput) => Result;
1049
+ /** An evaluator that compiles a document one time into code. The code then evaluates it many times. */
1050
+ interface CompiledEvaluator {
1051
+ /**
1052
+ * This function compiles a document.
1053
+ *
1054
+ * @param input - The document, its kind and its compiled parts.
1055
+ * @returns The code that evaluates the document.
1056
+ */
1057
+ readonly compile: (input: CompileInput) => Code;
1058
+ }
1059
+ /** An evaluator: a function of its input, or a compiler. */
1060
+ type Evaluator = EvalFn | CompiledEvaluator;
1061
+ /** A runner that is a generator function of its input. */
1062
+ type RunFn = (input: RunInput) => Steps;
1063
+ /** A runner that compiles a document one time into code that can wait. */
1064
+ interface CompiledRunner {
1065
+ /**
1066
+ * This function compiles a document.
1067
+ *
1068
+ * @param input - The document, its kind and its compiled parts.
1069
+ * @returns The code that runs the document.
1070
+ */
1071
+ readonly compileRun: (input: CompileInput) => RunCode;
1072
+ }
1073
+ /**
1074
+ * A runner: the code of a kind whose parts or effects can wait. The same runner serves an evaluation, which does
1075
+ * not wait at any time, and a run, in which the host does each effect.
1076
+ */
1077
+ type Runner = RunFn | CompiledRunner;
1078
+ /**
1079
+ * A machine: a world of kinds, and the code of each evaluator name, of each `deref` and of each walker.
1080
+ *
1081
+ * - `maxDepth`: the deepest nesting of documents. The default is 1000.
1082
+ * - `permits`: the rule of the host for an effect. The default is the function `permits` on the capabilities.
1083
+ */
1084
+ interface Machine extends Navigator {
1085
+ readonly evaluators: Readonly<Record<string, Evaluator>>;
1086
+ /** The runners, by evaluator name. A runner wins over an evaluator of the same name. */
1087
+ readonly runners?: Readonly<Record<string, Runner>>;
1088
+ readonly maxDepth?: number;
1089
+ readonly permits?: (caps: readonly Cap[], kind: readonly Key[], context: Context) => boolean;
1090
+ }
1091
+ /** One evaluation in a trace. The children are the evaluations of its parts, in the order that they started. */
1092
+ interface TraceNode {
1093
+ readonly id: number;
1094
+ /** The keys from the root document to this document, as texts. */
1095
+ readonly path: readonly string[];
1096
+ /** The document. A bare value has the type that its position declares. */
1097
+ readonly doc: Envelope;
1098
+ /** `true` when the type came from the container and not from an envelope. */
1099
+ readonly declared: boolean;
1100
+ /** The answer of the ladder to the verb `eval`. */
1101
+ readonly answer: Answer;
1102
+ readonly side: Side;
1103
+ /** The names that the document could read when its evaluation started. */
1104
+ readonly names: readonly string[];
1105
+ /** The names and their values when the evaluation started. */
1106
+ readonly scope: Readonly<Record<string, unknown>>;
1107
+ /** The capabilities that the document had when its evaluation started. */
1108
+ readonly caps: readonly Cap[];
1109
+ /** A short text for the root `self` when the evaluation started. */
1110
+ readonly self: string;
1111
+ /** The time of the start. Each start and each end takes one tick. */
1112
+ readonly enter: number;
1113
+ /** The time of the end. */
1114
+ readonly exit: number;
1115
+ readonly result: Result;
1116
+ readonly children: readonly TraceNode[];
1117
+ /** The indices of the effects that this document caused itself. */
1118
+ readonly effects: readonly number[];
1119
+ }
1120
+ /** The record of one evaluation of a document. */
1121
+ interface Run {
1122
+ readonly result: Result;
1123
+ readonly trace: TraceNode;
1124
+ readonly effects: readonly Effect[];
1125
+ /** The number of ticks. */
1126
+ readonly time: number;
1127
+ }
1128
+ /** A signal of the host that stops a run: the shape of the standard `AbortSignal`. */
1129
+ interface StopSignal {
1130
+ readonly aborted: boolean;
1131
+ readonly reason?: unknown;
1132
+ addEventListener(type: "abort", listener: () => void, options?: {
1133
+ readonly once?: boolean;
1134
+ }): void;
1135
+ }
1136
+ /** The options of a run. */
1137
+ interface RunOptions {
1138
+ /** The host code that does each effect. Without it, an effect gives its payload, as in an evaluation. */
1139
+ readonly perform?: Perform;
1140
+ /** The type of a bare root value. */
1141
+ readonly declaredType?: string;
1142
+ /** A signal of the host. When it aborts, the run stops with `#ABORT`. */
1143
+ readonly signal?: StopSignal;
1144
+ }
1145
+ /** The options of an evaluation of a plan. */
1146
+ interface EvalOptions {
1147
+ /** A list that gets each effect, in its order. */
1148
+ readonly effects?: Effect[];
1149
+ }
1150
+ /** The options of a compilation. */
1151
+ interface PrepareOptions {
1152
+ /** The type of a bare root value. */
1153
+ readonly declaredType?: string;
1154
+ /** `true`: each evaluation records a trace. The default is `false`. */
1155
+ readonly trace?: boolean;
1156
+ }
1157
+ /** A compiled document. It evaluates many times, and it does the work of the ladder one time. */
1158
+ interface Plan {
1159
+ readonly machine: Machine;
1160
+ /** `true` when each evaluation records a trace. */
1161
+ readonly traced: boolean;
1162
+ /** The compiled root document. */
1163
+ readonly root: CompiledPart;
1164
+ /**
1165
+ * This function evaluates the document. It does not wait, and the host does no effect.
1166
+ *
1167
+ * @param context - The names and the capabilities at the root.
1168
+ * @param options - A list that gets the effects.
1169
+ * @returns The result.
1170
+ */
1171
+ evaluate(context?: Context, options?: EvalOptions): Result;
1172
+ /**
1173
+ * This function runs the document: the host does each effect, and the run waits when the host waits.
1174
+ *
1175
+ * @param context - The names and the capabilities at the root.
1176
+ * @param options - The host code that does the effects, and a signal to stop the run.
1177
+ * @returns The result, when the run ends.
1178
+ */
1179
+ run(context?: Context, options?: RunOptions): Promise<Result>;
1180
+ }
1181
+ /**
1182
+ * This function compiles a document into a plan. The ladder, the kinds and the parts are known after it. A plan
1183
+ * evaluates many times. A document that does not compile gives a plan that fails with the reason, when it evaluates.
1184
+ *
1185
+ * @param machine - The world and the code of the evaluators.
1186
+ * @param doc - The document, as JSON.
1187
+ * @param options - The type of a bare root value, and a trace.
1188
+ * @returns The plan.
1189
+ */
1190
+ export declare function prepare(machine: Machine, doc: unknown, options?: PrepareOptions): Plan;
1191
+ /**
1192
+ * This function makes a cache of plans for one machine. A document object compiles one time. Use it only for
1193
+ * documents that do not change after they are made.
1194
+ *
1195
+ * @param machine - The machine.
1196
+ * @param options - The options of each compilation.
1197
+ * @returns A function that gives the plan of a document.
1198
+ */
1199
+ export declare function planner(machine: Machine, options?: PrepareOptions): (doc: unknown) => Plan;
1200
+ /**
1201
+ * This function evaluates a document, and records each evaluation in a trace.
1202
+ *
1203
+ * The verb `eval` goes up the ladder for each document. The kind of the document tells where its parts are. The
1204
+ * evaluator gets each part sealed: it can evaluate the part, and it cannot read its value. A failure gives an error
1205
+ * value, and the function does not throw. An effect is recorded in its order, and nothing does it.
1206
+ *
1207
+ * @param machine - The world and the code of the evaluators.
1208
+ * @param doc - The document, as JSON.
1209
+ * @param context - The names and the capabilities at the root.
1210
+ * @param declaredType - The type of a bare root value.
1211
+ * @returns The result, the trace and the effects in their order.
1212
+ */
1213
+ export declare function evaluate(machine: Machine, doc: unknown, context?: Context, declaredType?: string): Run;
1214
+ /**
1215
+ * This function runs a document: an evaluation in which the host does each effect. A runner waits for its
1216
+ * parts and for its effects, thus a step can read the result of the step before. The part of the run before the
1217
+ * first wait happens at once, in the call. The run records a trace.
1218
+ *
1219
+ * @param machine - The world, the evaluators and the runners.
1220
+ * @param doc - The document, as JSON.
1221
+ * @param context - The names and the capabilities at the root.
1222
+ * @param options - The host code that does the effects, the type of a bare root value, and a signal.
1223
+ * @returns The result, the trace and the effects in their order, when the run ends.
1224
+ */
1225
+ export declare function run(machine: Machine, doc: unknown, context?: Context, options?: RunOptions): Promise<Run>;
1226
+ /**
1227
+ * This function finds a node of a trace by its path.
1228
+ *
1229
+ * @param trace - The root of the trace.
1230
+ * @param path - The keys from the root.
1231
+ * @returns The first evaluation at that path, or `undefined` when the document did not evaluate.
1232
+ */
1233
+ export declare function nodeAt(trace: TraceNode, path: readonly Key[]): TraceNode | undefined;
1234
+ /**
1235
+ * This function lists the nodes of a trace in the order of their start.
1236
+ *
1237
+ * @param trace - The root of the trace.
1238
+ * @returns Each node, the root first.
1239
+ */
1240
+ export declare function flatten(trace: TraceNode): readonly TraceNode[];
1241
+ /**
1242
+ * This function lists the errors of a trace: each node whose result is an error and whose parts did not fail
1243
+ * the same way. These nodes are where each error started.
1244
+ *
1245
+ * @param trace - The root of the trace.
1246
+ * @returns The errors, in the order of their start.
1247
+ */
1248
+ export declare function failures(trace: TraceNode): readonly EvalError[];
1249
+ //#endregion
1250
+ //#region src/stdlib.d.ts
1251
+ /**
1252
+ * The world of the examples: small kinds for numbers, lists, conditions, names, sequences and effects.
1253
+ * Each kind names an evaluator for `eval` and a view for `view`. The site draws each document with its view.
1254
+ */
1255
+ export declare const STD_WORLD: World;
1256
+ /** The code of the evaluators of the standard world, by name. */
1257
+ export declare const STD_EVALUATORS: Readonly<Record<string, Evaluator>>;
1258
+ /** The options of a walker `nearest`. */
1259
+ interface NearestOptions {
1260
+ /**
1261
+ * This function tells if a node has the wanted type. The default compares the field `type` of a host thing.
1262
+ *
1263
+ * @param node - The node that the walk reached.
1264
+ * @param wanted - The type that the step document asks for.
1265
+ * @returns `true` when the node has the type.
1266
+ */
1267
+ readonly matches?: (node: Thing, wanted: Json | undefined) => boolean;
1268
+ /** The most hops of one walk. The default is 256. */
1269
+ readonly maxHops?: number;
1270
+ }
1271
+ /**
1272
+ * This function makes a walker `nearest`. The walker follows a key (the default is `parent`) until the node that it
1273
+ * reaches has the wanted type. With `self: true`, the node where the walk starts is the first candidate. A node
1274
+ * without that key ends the walk with an error.
1275
+ *
1276
+ * @param options - The test of a type and the most hops.
1277
+ * @returns The walker.
1278
+ */
1279
+ export declare function nearestWalker(options?: NearestOptions): Walker;
1280
+ /** The walkers of the standard world, by name. */
1281
+ export declare const STD_WALKERS: Readonly<Record<string, Walker>>;
1282
+ /**
1283
+ * The runners of the standard world, by name: the kinds that can hold effects. Each one evaluates its parts in
1284
+ * order. In a run, an effect ends before the next step starts.
1285
+ */
1286
+ export declare const STD_RUNNERS: Readonly<Record<string, Runner>>;
1287
+ /** The machine of the examples: the standard world, its evaluators, its runners and its walkers. */
1288
+ export declare const STD_MACHINE: Machine;
1289
+ /** The capabilities of the examples at the root: the two effects of the standard world. */
1290
+ export declare const STD_CAPS: readonly string[];
1291
+ //#endregion
1292
+ //#region src/order.d.ts
1293
+ /** One step of a sequence: its name, the names of the earlier steps that it reads, and if it has an effect. */
1294
+ interface StepSpec {
1295
+ readonly id: string;
1296
+ readonly reads: readonly string[];
1297
+ readonly effect: boolean;
1298
+ }
1299
+ /** An edge from a step that must come first to a step that must come after it. */
1300
+ type Edge = readonly [before: string, after: string];
1301
+ /** A reference that a sequence cannot resolve. */
1302
+ interface OrderProblem {
1303
+ readonly step: string;
1304
+ readonly reads: string;
1305
+ /** `unknown-name`: no step has this name. `read-before-defined`: the step with this name comes later. */
1306
+ readonly problem: "unknown-name" | "read-before-defined";
1307
+ }
1308
+ /**
1309
+ * This function finds the references that a sequence cannot resolve. A step can read only the steps before it.
1310
+ *
1311
+ * @param steps - The steps, in the written order.
1312
+ * @returns One problem for each bad reference, in the written order.
1313
+ */
1314
+ export declare function checkSteps(steps: readonly StepSpec[]): readonly OrderProblem[];
1315
+ /**
1316
+ * This function gives the data edges: a step comes after each earlier step that it reads.
1317
+ *
1318
+ * @param steps - The steps, in the written order.
1319
+ * @returns The edges. A bad reference gives no edge.
1320
+ */
1321
+ export declare function dataEdges(steps: readonly StepSpec[]): readonly Edge[];
1322
+ /**
1323
+ * This function gives the effect edges: each step with an effect comes after the previous step with an effect.
1324
+ * Effects keep their written order. Steps without an effect get no effect edge.
1325
+ *
1326
+ * @param steps - The steps, in the written order.
1327
+ * @returns The edges, one for each pair of consecutive effect steps.
1328
+ */
1329
+ export declare function effectEdges(steps: readonly StepSpec[]): readonly Edge[];
1330
+ /**
1331
+ * This function tells if an order of the steps gives the same meaning as the written order.
1332
+ * The order must contain each step one time, and it must obey the data edges and the effect edges.
1333
+ *
1334
+ * @param steps - The steps, in the written order.
1335
+ * @param order - The names of the steps in the order to examine.
1336
+ * @returns `true` when the order is permitted.
1337
+ */
1338
+ export declare function isAllowedOrder(steps: readonly StepSpec[], order: readonly string[]): boolean;
1339
+ /**
1340
+ * This function puts the steps in layers. Each step goes one layer after the last step that it must follow.
1341
+ * The steps of one layer do not depend on each other, thus they can run at the same time.
1342
+ *
1343
+ * @param steps - The steps, in the written order.
1344
+ * @returns The layers, first to last. Each layer keeps the written order.
1345
+ */
1346
+ export declare function layers(steps: readonly StepSpec[]): readonly (readonly string[])[];
1347
+ //#endregion
1348
+ //#region src/context.d.ts
1349
+ /** The parts of a context. A term can reach outside itself only through these parts. */
1350
+ export declare const PARTS: readonly ["self", "names", "world", "event", "caps"];
1351
+ /** One part of a context. */
1352
+ type Part = (typeof PARTS)[number];
1353
+ /** The description of one part of a context. */
1354
+ interface PartInfo {
1355
+ readonly part: Part;
1356
+ readonly title: string;
1357
+ /** What a reference through this part reaches. */
1358
+ readonly reaches: string;
1359
+ /** The direction in which a reference through this part goes. */
1360
+ readonly direction: string;
1361
+ }
1362
+ /** The descriptions of the parts, in the order of `PARTS`. */
1363
+ export declare const PART_INFO: readonly PartInfo[];
1364
+ /**
1365
+ * What a construct gives the parts of its body, for one part of the context.
1366
+ *
1367
+ * - `same`: the parts get the same value.
1368
+ * - `extends`: the parts get the value with more names.
1369
+ * - `moves`: the parts get a new position.
1370
+ * - `narrows`: the parts get a smaller set.
1371
+ * - `sets`: the parts get a new value.
1372
+ * - `none`: the parts get nothing.
1373
+ */
1374
+ type Give = "same" | "extends" | "moves" | "narrows" | "sets" | "none";
1375
+ /** How a construct uses one part of the context. */
1376
+ interface Use {
1377
+ readonly reads: boolean;
1378
+ readonly gives: Give;
1379
+ readonly note: string;
1380
+ }
1381
+ /** A construct of a language, and how it uses each part of the context. */
1382
+ interface Construct {
1383
+ readonly id: string;
1384
+ readonly title: string;
1385
+ readonly side: Side;
1386
+ readonly summary: string;
1387
+ readonly example: Envelope;
1388
+ readonly uses: Readonly<Record<Part, Use>>;
1389
+ }
1390
+ /** Six constructs that show the range of the context. */
1391
+ export declare const CONSTRUCTS: readonly Construct[];
1392
+ //#endregion
1393
+ //#region src/static.d.ts
1394
+ /** One document that a walk visits. */
1395
+ interface DocVisit {
1396
+ /** The keys from the root document to this document, through the parts. It is the place of an error. */
1397
+ readonly place: readonly Key[];
1398
+ /** The keys from the root JSON value to this document. A change at this path changes this document. */
1399
+ readonly at: readonly Key[];
1400
+ /** The document. A bare value has the type that its position declares. */
1401
+ readonly doc: Envelope;
1402
+ /** `true` when the type came from the position and not from an envelope. */
1403
+ readonly declared: boolean;
1404
+ /** The kind of the document, when the world has it. */
1405
+ readonly kind?: Kind;
1406
+ /** The keys of the kind after each alias. */
1407
+ readonly typePath?: readonly Key[];
1408
+ /** The number of documents around this document. The root has 0. */
1409
+ readonly depth: number;
1410
+ /** The names that the kinds around this document bind for it. */
1411
+ readonly names: ReadonlySet<string>;
1412
+ /** The names that a sequence around this document binds only for the parts after it. */
1413
+ readonly later: ReadonlySet<string>;
1414
+ }
1415
+ /** A position that a walk cannot read as a document. */
1416
+ interface WalkProblem {
1417
+ readonly place: readonly Key[];
1418
+ readonly at: readonly Key[];
1419
+ readonly code: "#PART?" | "#VALUE!";
1420
+ readonly reason: string;
1421
+ }
1422
+ /** The options of a walk. */
1423
+ interface WalkOptions {
1424
+ /** The type of a bare root value. */
1425
+ readonly declaredType?: string;
1426
+ /** The names that the host binds at the root. */
1427
+ readonly names?: readonly string[];
1428
+ /**
1429
+ * This function gets each position that is not a document.
1430
+ *
1431
+ * @param problem - The position and the reason.
1432
+ */
1433
+ readonly problem?: (problem: WalkProblem) => void;
1434
+ }
1435
+ /**
1436
+ * This function visits each document of a document: the root and each part at each depth, by the contracts of the
1437
+ * kinds. A part of a kind that the world does not have is not visited. The walk uses no stack of the host for the
1438
+ * depth, thus a deep document cannot overflow it.
1439
+ *
1440
+ * @param world - The world of the kinds.
1441
+ * @param doc - The document, as JSON.
1442
+ * @param visit - The function that gets each document. It gives `"skip"` to not visit the parts of a document.
1443
+ * @param options - The type of a bare root value, the names of the host, and a function for the problems.
1444
+ */
1445
+ export declare function walk(world: World, doc: unknown, visit: (visit: DocVisit) => void | "skip", options?: WalkOptions): void;
1446
+ /** One reference of a document. */
1447
+ interface RefUse {
1448
+ /** The place of the reference document, through the parts. */
1449
+ readonly place: readonly Key[];
1450
+ /** The keys from the root JSON value to the reference document. */
1451
+ readonly at: readonly Key[];
1452
+ /** The path of the reference: its root and its steps. */
1453
+ readonly path: readonly Json[];
1454
+ readonly root: string;
1455
+ /** `false` when a kind around the reference binds its first name. A reference to another root is free. */
1456
+ readonly free: boolean;
1457
+ }
1458
+ /**
1459
+ * This function finds each reference of a document: each document of the type `ref` that a walk reaches. A
1460
+ * reference to a name that a kind around it binds is not free. The others are what the document reads from
1461
+ * outside: its dependencies.
1462
+ *
1463
+ * @param world - The world of the kinds.
1464
+ * @param doc - The document, as JSON.
1465
+ * @param options - The type of a bare root value. The names of the host do not change the result.
1466
+ * @returns The references, in the order of the document.
1467
+ */
1468
+ export declare function refsOf(world: World, doc: unknown, options?: WalkOptions): readonly RefUse[];
1469
+ /**
1470
+ * This function changes the free references of a document. The document is not changed: the function gives a new
1471
+ * document that shares each part without a change.
1472
+ *
1473
+ * @param world - The world of the kinds.
1474
+ * @param doc - The document, as JSON.
1475
+ * @param change - The function that gives the new document of a reference, or `undefined` to keep it.
1476
+ * @param options - The type of a bare root value, and the names that the host binds at the root.
1477
+ * @returns The new document.
1478
+ */
1479
+ export declare function mapRefs(world: World, doc: unknown, change: (use: RefUse) => unknown, options?: WalkOptions): unknown;
1480
+ /** A problem that a check finds before a document runs. */
1481
+ interface Issue {
1482
+ readonly code: ErrorCode;
1483
+ /** The keys from the root document to the document with the problem. */
1484
+ readonly place: readonly Key[];
1485
+ readonly reason: string;
1486
+ }
1487
+ /** The options of a check. */
1488
+ interface CheckOptions {
1489
+ /** The type of a bare root value. */
1490
+ readonly declaredType?: string;
1491
+ /** The names that the host binds at the root. `"any"` does not check the names. The default is no names. */
1492
+ readonly names?: readonly string[] | "any";
1493
+ /** The capabilities at the root. Without them, the check does not check the effects. */
1494
+ readonly caps?: readonly Cap[];
1495
+ }
1496
+ /**
1497
+ * This function checks a document before an evaluation, by the contracts of its kinds. It finds the problems
1498
+ * that an evaluation finds when it reaches them:
1499
+ *
1500
+ * - `#KIND?`: a kind that the world does not have.
1501
+ * - `#NOEVAL`: no evaluator.
1502
+ * - `#VALUE!`: a value without the shape of its kind.
1503
+ * - `#PART?`: a value without a type.
1504
+ * - `#DEPTH!`: too much nesting.
1505
+ * - `#REF!` and `#STEP?`: a bad path.
1506
+ * - `#NAME?`: a name that nothing binds.
1507
+ * - `#CAP!`: an effect that the capabilities do not permit.
1508
+ *
1509
+ * @param machine - The world and the code of the evaluators.
1510
+ * @param doc - The document, as JSON.
1511
+ * @param options - The type of a bare root value, the names of the host and the capabilities.
1512
+ * @returns The problems, in the order of the document.
1513
+ */
1514
+ export declare function check(machine: Machine, doc: unknown, options?: CheckOptions): readonly Issue[];
1515
+ //#endregion
1516
+ //#region src/formula.d.ts
1517
+ /** An operation of a formula language: a function of the values of its arguments. */
1518
+ type OpFn = (...args: never[]) => unknown;
1519
+ /**
1520
+ * A lazy operation: it gets one function for each argument. It evaluates only the arguments that it needs, for
1521
+ * example a default for an error.
1522
+ */
1523
+ type LazyOp = (args: readonly (() => Result)[]) => Result;
1524
+ /** The code of an extension: it gives the value of the data of an extension document. */
1525
+ type ExtFn = (data: Json) => Result;
1526
+ /**
1527
+ * The rules of one formula language: its operations, and the rules that differ between languages.
1528
+ *
1529
+ * - `ops`: the operations of the namespace `ops`, by their name (the keys after `ops`, with dots between them).
1530
+ * - `lazy`: the operations that evaluate their arguments themselves.
1531
+ * - `ext`: the extensions of the namespace `ext`, by their name. The kit has `ext.undefined` and `ext.number`.
1532
+ * - `truthy`: the truth of a value for `if`, `and` and `or`. `undefined` is an error `#VALUE!`. The default
1533
+ * accepts only `true` and `false`.
1534
+ * - `otherwise`: the value of an `if` without `else`. The default is `null`.
1535
+ * - `logic`: what `and` and `or` give: a truth value (the default), or the value that decided.
1536
+ * - `omit`: the errors that leave a field out of a `record`, as an absent value.
1537
+ * - `missing`: the values that a reference cannot give. Such a value gives `#N/A`.
1538
+ * - `check`: a check of the value of an operation, for example "a number must be finite".
1539
+ */
1540
+ interface FormulaProfile {
1541
+ readonly ops?: Readonly<Record<string, OpFn>> | ((name: string) => OpFn | undefined);
1542
+ readonly lazy?: Readonly<Record<string, LazyOp>>;
1543
+ readonly ext?: Readonly<Record<string, ExtFn>>;
1544
+ readonly truthy?: (value: unknown) => boolean | undefined;
1545
+ readonly otherwise?: unknown;
1546
+ readonly logic?: "boolean" | "value";
1547
+ readonly omit?: (error: EvalError) => boolean;
1548
+ readonly missing?: (value: unknown) => boolean;
1549
+ readonly check?: (value: unknown, op: string) => Result | undefined;
1550
+ }
1551
+ /** The value of a name whose binding failed. A reference to the name gives the error. */
1552
+ export declare class Held {
1553
+ readonly error: EvalError;
1554
+ constructor(error: EvalError);
1555
+ }
1556
+ declare const CLOSURE: unique symbol;
1557
+ /** A function that the construct `fn` made. It throws a `Failure` when its body fails. */
1558
+ type Closure = ((...args: readonly unknown[]) => unknown) & {
1559
+ readonly [CLOSURE]: {
1560
+ readonly params: readonly string[];
1561
+ };
1562
+ };
1563
+ /**
1564
+ * This function tells if a value is a function that the construct `fn` made.
1565
+ *
1566
+ * @param value - The value.
1567
+ * @returns `true` for a closure.
1568
+ */
1569
+ export declare function isClosure(value: unknown): value is Closure;
1570
+ /** The standard extensions: the values that JSON cannot write. */
1571
+ export declare const STD_EXT: Readonly<Record<string, ExtFn>>;
1572
+ /** The truth of a value in the rules of JavaScript: `0`, `""`, `null`, `undefined` and `NaN` are false. */
1573
+ export declare function jsTruthy(value: unknown): boolean;
1574
+ /**
1575
+ * This function makes the kinds of the formula kit, for a world. The kinds are the shared constructs of D13 and
1576
+ * the namespaces `ops` and `ext`. A bare value in a position of a term is a literal.
1577
+ *
1578
+ * @returns The entries of the world, by their key.
1579
+ */
1580
+ export declare function formulaKinds(): Readonly<Record<string, WorldEntry>>;
1581
+ /**
1582
+ * This function makes the evaluators of the formula kit for one language. Each evaluator compiles its document
1583
+ * one time into code.
1584
+ *
1585
+ * @param profile - The operations and the rules of the language.
1586
+ * @returns The evaluators, by their name.
1587
+ */
1588
+ export declare function formulaEvaluators(profile?: FormulaProfile): Readonly<Record<string, Evaluator>>;
1589
+ /**
1590
+ * This function makes a machine for a formula language. The machine has the kinds and the evaluators of the
1591
+ * formula kit. It also has the kinds, the evaluators and the walkers that the language adds.
1592
+ *
1593
+ * @param profile - The operations and the rules of the language.
1594
+ * @param more - The parts of a machine that the language adds. Its kinds win over the kinds of the kit.
1595
+ * @returns The machine.
1596
+ */
1597
+ export declare function formulaMachine(profile?: FormulaProfile, more?: Partial<Machine>): Machine;
1598
+ //#endregion
1599
+ export type { Alias, Answer, AskOptions, Cap, CheckOptions, Classification, Closure, Code, CompileInput, CompiledEvaluator, CompiledPart, CompiledRunner, Construct, Context, Part as ContextPart, DerefCode, DocVisit, Edge, Effect, Envelope, ErrorCode, EvalError, EvalFn, EvalInput, EvalOptions, Evaluator, ExtFn, Failed, FormulaProfile, Give, Header, Hop, HopBy, HostThing, Issue, Json, JsonRecord, KernelCode, Key, Kind, KindSource, LazyOp, Lookup, Machine, NamesSource, Namespace, Navigator, NearestOptions, OpFn, OrderProblem, Outcome, Part$1 as Part, PartInfo, Shape as PartShape, PartSlot, PartsSpec, Perform, Plan, PrepareOptions, RefUse, Resolution, ResolveCode, ResolveOptions, Result, Root, Run, RunCode, RunFn, RunInput, RunOptions, RunPart, Rung, Runner, Runtime, ScopeRule, Shape$1 as Shape, Side, Split, Step, StepSpec, Steps, StopSignal, Stored, Thing, TraceNode, TypeRef, Use, WalkInput, WalkOptions, WalkProblem, WalkResult, Walker, World, WorldEntry };
1600
+ //# sourceMappingURL=index.d.ts.map