@northtalk/ts 0.2.0 → 0.4.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/README.md +16 -14
- package/{base64-DORMd3Hv.js → base64-Dtqaz_0A.js} +880 -409
- package/{binary-value-CEmh60GC.d.ts → binary-value-Bb6HPDtM.d.ts} +2 -2
- package/{capabilities-CH0FkRMq.js → capabilities-Bi5Qm6Fr.js} +39 -20
- package/{checker-Dc1jl2WH.js → checker-DMI4LiRm.js} +321 -112
- package/core-BzGUgjL6.d.ts +22 -0
- package/{debug-CQBxKnJB.d.ts → debug-C72o2pZy.d.ts} +506 -50
- package/debug.d.ts +3 -3
- package/debug.js +1 -1
- package/driver-ClV_UDEK.d.ts +63 -0
- package/driver.d.ts +2 -40
- package/driver.js +24 -4
- package/{encoding-nlrpj-Pb.js → encoding-C3Q7pIC9.js} +2 -2
- package/{engine-BGaJ9dAk.js → engine-BpdGfAND.js} +6 -6
- package/{engine-vbYInVYF.d.ts → engine-Dtby_FkE.d.ts} +3 -3
- package/{errors-LYJZ_c8h.js → errors-BKJES3Zu.js} +1060 -751
- package/{group-B742gg4T.js → group-vuUL2tq-.js} +6526 -1725
- package/http.d.ts +2 -2
- package/http.js +3 -3
- package/index-ByF5j53i.d.ts +779 -0
- package/index.d.ts +6 -651
- package/index.js +23 -15
- package/{http-capability-CSTkw1Yt.js → inline-grants-Cx0Z9XAt.js} +109 -24
- package/manifest-Dw-8Unmf.js +256 -0
- package/message-layer.d.ts +3 -3
- package/message-layer.js +2 -2
- package/notify.d.ts +2 -2
- package/notify.js +1 -1
- package/{objects-Db7IB5vQ.js → objects-BC4fS0vq.js} +1 -1
- package/{objects-DJ3QtCCs.d.ts → objects-Dnqor7Gn.d.ts} +12 -4
- package/{operation-promises-EgZXG5N_.js → operation-promises-ClA1BTaS.js} +10 -5
- package/package.json +2 -2
- package/{readers-CjJHKHvH.js → readers-B5e5bBrY.js} +2 -2
- package/{readers-BFPuosPk.d.ts → readers-DAFVvvq4.d.ts} +2 -2
- package/{request-pump-binary-DdY3X-yl.js → request-pump-binary-BjnyqXV5.js} +4 -4
- package/{router--71qvxtY.js → router-BCHEfs4x.js} +5 -5
- package/{router-Zhrw5l__.d.ts → router-BspOCPA0.d.ts} +3 -3
- package/session.d.ts +41 -3
- package/session.js +260 -179
- package/setup.d.ts +2 -2
- package/setup.js +4 -4
- package/sha256-9CGf5BS_.js +168 -0
- package/sqlite.d.ts +5 -5
- package/sqlite.js +27 -21
- package/{store-hJrRULMx.js → store-DTQa0lyE.js} +2 -2
- package/{store-capability-OZp4hXmj.js → store-capability-BxXgiRM7.js} +4 -4
- package/store.d.ts +3 -3
- package/store.js +2 -2
- package/{user-capability-BK4Asg7D.js → user-capability-5-IvCeZI.js} +5 -5
- package/wasm.d.ts +12 -8
- package/wasm.js +67 -39
- package/core-DptnvQT9.d.ts +0 -14
- package/manifest-BscyH_rW.d.ts +0 -70
- package/manifest-DjsxDSuB.js +0 -129
- package/sha256-B_kyYw3Z.js +0 -124
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
2
|
//#region src/syntax.d.ts
|
|
3
|
-
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
|
+
type SyntaxErrorCode = 'unterminated interpolation' | 'empty interpolation' | 'invalid text escape' | 'invalid text indentation' | 'invalid text delimiter' | 'bad character' | 'unterminated text' | 'bad unit' | 'unit without number' | 'unexpected token' | 'not a container';
|
|
4
4
|
/** All offsets index the original TS string; line and col count Unicode scalars. */
|
|
5
5
|
type Trivia = {
|
|
6
6
|
col: number;
|
|
@@ -60,12 +60,14 @@ declare class Lexer {
|
|
|
60
60
|
private readonly lineStarts;
|
|
61
61
|
private readonly surrogateOffsets;
|
|
62
62
|
constructor(src: string);
|
|
63
|
+
private lastLine;
|
|
63
64
|
where(pos: number): {
|
|
64
65
|
col: number;
|
|
65
66
|
line: number;
|
|
66
67
|
};
|
|
68
|
+
private findLine;
|
|
67
69
|
private surrogatesBefore;
|
|
68
|
-
tok(t: TokType, v: string, pos: number, end: number, spaceBefore: boolean, mode: Mode, code?: SyntaxErrorCode): Token;
|
|
70
|
+
tok(t: TokType, v: string, pos: number, end: number, spaceBefore: boolean, mode: Mode, code?: SyntaxErrorCode, leadingTrivia?: Trivia[]): Token;
|
|
69
71
|
private trivia;
|
|
70
72
|
private fenced;
|
|
71
73
|
private scanFenced;
|
|
@@ -850,7 +852,6 @@ type AbandonReason = 'cancelled' | 'effect-failed' | 'join-ended' | 'join-failed
|
|
|
850
852
|
type LimitName = 'fuelPerRun' | 'allocPerRun' | 'persistentState' | 'callDepth' | 'patternSize' | 'mailboxDepth' | 'maxWaitMs' | 'maxJoin' | 'cleanupBudget';
|
|
851
853
|
type Limits = Record<LimitName, number>;
|
|
852
854
|
declare const defaultLimits: Limits;
|
|
853
|
-
/** A code unit that can't load: a literal pattern past its limit, or a failed initialiser. */
|
|
854
855
|
declare class UnitLoadError extends Error {
|
|
855
856
|
readonly code: 'pattern too large' | 'initialiser failed';
|
|
856
857
|
readonly line: number;
|
|
@@ -941,9 +942,12 @@ type Replacement = {
|
|
|
941
942
|
end: number;
|
|
942
943
|
start: number;
|
|
943
944
|
}[];
|
|
945
|
+
/** Where in `cs` the output so far ends: past the last replaced match. */
|
|
946
|
+
from: number;
|
|
944
947
|
k: 'replacement';
|
|
945
948
|
matches: Value[];
|
|
946
|
-
|
|
949
|
+
/** The output so far: the Text up to `from`, each match replaced. */
|
|
950
|
+
pieces: string;
|
|
947
951
|
subject: Value;
|
|
948
952
|
};
|
|
949
953
|
type Item = Value | Iterator | Replacement | Reader | Receiver | Deadline;
|
|
@@ -971,7 +975,6 @@ type Dispatch = {
|
|
|
971
975
|
next: number;
|
|
972
976
|
};
|
|
973
977
|
type Frame = {
|
|
974
|
-
activation?: boolean;
|
|
975
978
|
body: Body;
|
|
976
979
|
/** A clause's `clause` charge, added to its first instruction's. */
|
|
977
980
|
clauseCharge: boolean;
|
|
@@ -980,12 +983,106 @@ type Frame = {
|
|
|
980
983
|
dispatch: Dispatch | null;
|
|
981
984
|
handler: string;
|
|
982
985
|
locals: Value[];
|
|
983
|
-
owner?: Frame;
|
|
984
986
|
pc: number;
|
|
985
|
-
/** Inherited by calls and
|
|
987
|
+
/** Inherited by calls, and by the policy and cleanup code it runs. */
|
|
986
988
|
restricted: boolean;
|
|
987
989
|
stack: Item[];
|
|
988
990
|
};
|
|
991
|
+
/**
|
|
992
|
+
* A search bound: down to `frame`, and in it only the Unwind Table entries
|
|
993
|
+
* before `entry`, which lie inside the policy or `finally` block that bounds
|
|
994
|
+
* it.
|
|
995
|
+
*/
|
|
996
|
+
type Limit = {
|
|
997
|
+
entry: number;
|
|
998
|
+
frame: number;
|
|
999
|
+
};
|
|
1000
|
+
/**
|
|
1001
|
+
* Where a catch search is: the frame and the first entry in it still to test,
|
|
1002
|
+
* the top frame's place, its bound, the frames below `position` it has yet to
|
|
1003
|
+
* charge for leaving, and the entries `skip` says already ran their `finally`
|
|
1004
|
+
* blocks.
|
|
1005
|
+
*/
|
|
1006
|
+
type Search = {
|
|
1007
|
+
entry: number;
|
|
1008
|
+
frame: number;
|
|
1009
|
+
limit: Limit | null;
|
|
1010
|
+
position: number;
|
|
1011
|
+
raised: number;
|
|
1012
|
+
skip: Limit | null;
|
|
1013
|
+
};
|
|
1014
|
+
/**
|
|
1015
|
+
* A catch's tests, or a Recovery policy, running in frame `owner`. The failed
|
|
1016
|
+
* frames above it are held aside; the owner's own stack and pc wait in
|
|
1017
|
+
* `ownerStack` and `ownerPc`. `search` goes on from the next entry when the
|
|
1018
|
+
* catch declines.
|
|
1019
|
+
*/
|
|
1020
|
+
type DispatchControl = {
|
|
1021
|
+
error: Value;
|
|
1022
|
+
held: Frame[];
|
|
1023
|
+
k: 'dispatch';
|
|
1024
|
+
owner: number;
|
|
1025
|
+
ownerPc: number;
|
|
1026
|
+
ownerStack: Item[];
|
|
1027
|
+
place: number;
|
|
1028
|
+
search: Search;
|
|
1029
|
+
};
|
|
1030
|
+
/**
|
|
1031
|
+
* A `finally` block a cleanup runs: its frame, target, the stack depth it
|
|
1032
|
+
* starts at and its entry. `leave` ends the dispatch under the cleanup, once a
|
|
1033
|
+
* policy's own `finally` blocks have run.
|
|
1034
|
+
*/
|
|
1035
|
+
type CleanupStep = {
|
|
1036
|
+
depth: number;
|
|
1037
|
+
entry: number;
|
|
1038
|
+
frame: number;
|
|
1039
|
+
leave: boolean;
|
|
1040
|
+
target: number;
|
|
1041
|
+
};
|
|
1042
|
+
/** What a cleanup does after its last `finally` block. */
|
|
1043
|
+
type Then = {
|
|
1044
|
+
frame: number;
|
|
1045
|
+
k: 'accept';
|
|
1046
|
+
pc: number;
|
|
1047
|
+
stack: Item[];
|
|
1048
|
+
} | {
|
|
1049
|
+
k: 'end';
|
|
1050
|
+
} | {
|
|
1051
|
+
k: 'cancel';
|
|
1052
|
+
} | {
|
|
1053
|
+
args: Value[];
|
|
1054
|
+
attempt: number;
|
|
1055
|
+
frame: number;
|
|
1056
|
+
k: 'transfer';
|
|
1057
|
+
limit: Limit | null;
|
|
1058
|
+
offer: number;
|
|
1059
|
+
offerEntry: number;
|
|
1060
|
+
record: number;
|
|
1061
|
+
} | {
|
|
1062
|
+
k: 'search';
|
|
1063
|
+
search: Search;
|
|
1064
|
+
};
|
|
1065
|
+
/**
|
|
1066
|
+
* `finally` blocks running for `error`, then `then`. `failed` is the logical
|
|
1067
|
+
* size of the operand stack the running block cut from the failed continuation
|
|
1068
|
+
* of frame `failedFrame`, with what each held frame's own block cut; `held`
|
|
1069
|
+
* keeps the failed frames above the running block (chapter 8, Pending cleanup
|
|
1070
|
+
* state). A cancellation holds none.
|
|
1071
|
+
*/
|
|
1072
|
+
type CleanupControl = {
|
|
1073
|
+
cleanups: CleanupStep[];
|
|
1074
|
+
error: Value;
|
|
1075
|
+
failed: number;
|
|
1076
|
+
failedFrame: number | null;
|
|
1077
|
+
held: Frame[];
|
|
1078
|
+
k: 'cleanup';
|
|
1079
|
+
/** Whether its `leave` has ended the dispatch under it. */
|
|
1080
|
+
left: boolean;
|
|
1081
|
+
next: number;
|
|
1082
|
+
then: Then;
|
|
1083
|
+
};
|
|
1084
|
+
/** A Run's error control, innermost last (chapter 8, The Unwind Table). */
|
|
1085
|
+
type Control = DispatchControl | CleanupControl;
|
|
989
1086
|
/**
|
|
990
1087
|
* What happened in a Run that a Trace records: each raise, caught or not,
|
|
991
1088
|
* and each clause or branch a guard region skipped, with its error's code or
|
|
@@ -1023,6 +1120,8 @@ type RunRecord = {
|
|
|
1023
1120
|
args: Value[];
|
|
1024
1121
|
automatic?: boolean;
|
|
1025
1122
|
charged: number;
|
|
1123
|
+
/** A metered call's refused `charge`, beside the accepted `charged`. */
|
|
1124
|
+
chargeRefused?: boolean;
|
|
1026
1125
|
error?: Value;
|
|
1027
1126
|
id: string;
|
|
1028
1127
|
kind: 'call';
|
|
@@ -1154,6 +1253,8 @@ type Member = {
|
|
|
1154
1253
|
call: CallContext | null;
|
|
1155
1254
|
id: string;
|
|
1156
1255
|
ms: number;
|
|
1256
|
+
/** Its wait's place in the timer order, taken when it starts (#1752). */
|
|
1257
|
+
order?: number;
|
|
1157
1258
|
/** A Script reply received before its preempted Join closes. */
|
|
1158
1259
|
reply?: Resumption;
|
|
1159
1260
|
/** The checked member instruction retains its destination and owning frame. */
|
|
@@ -1199,7 +1300,7 @@ type Resumption = {
|
|
|
1199
1300
|
answers: Resumption[];
|
|
1200
1301
|
k: 'joined';
|
|
1201
1302
|
} | {
|
|
1202
|
-
binds:
|
|
1303
|
+
binds: number;
|
|
1203
1304
|
branch: number;
|
|
1204
1305
|
k: 'event';
|
|
1205
1306
|
message: Value;
|
|
@@ -1249,12 +1350,19 @@ type RunHost = {
|
|
|
1249
1350
|
isRevoked?(name: string): boolean;
|
|
1250
1351
|
/** Whether a name is a Script of the Group. */
|
|
1251
1352
|
isScript(name: string): boolean;
|
|
1353
|
+
/**
|
|
1354
|
+
* Records a call id as issued, for the Group's lifetime, with whether it
|
|
1355
|
+
* may request charges (Metered Operations).
|
|
1356
|
+
*/
|
|
1357
|
+
issue?(id: string, metered?: boolean): void;
|
|
1252
1358
|
isUnbound?(name: string): boolean;
|
|
1253
1359
|
/** The object the Script owns, or Nothing. */
|
|
1254
1360
|
readonly me: Value;
|
|
1255
1361
|
readonly now: bigint;
|
|
1256
1362
|
/** The well-known Host Object the Host bound to a name at load. */
|
|
1257
1363
|
object(name: string): Value | undefined;
|
|
1364
|
+
/** Queues a charge request for an issued call, as `call.requestCharge`. */
|
|
1365
|
+
requestCharge(id: string, fuel: number): ChargeRequest;
|
|
1258
1366
|
/**
|
|
1259
1367
|
* Puts a message in the mailbox of a Script, or of an object's nearest
|
|
1260
1368
|
* Owning Script, or throws ScriptError `mailbox full`; `reply` is the call
|
|
@@ -1264,6 +1372,10 @@ type RunHost = {
|
|
|
1264
1372
|
send(to: string | ObjectState, message: string, args: Value[], reply: string | null): string | null;
|
|
1265
1373
|
/** Sends a Command Call with no Handler up the Message Path, as `send` does. */
|
|
1266
1374
|
sendUp(message: string, args: Value[], reply: string | null): string | null;
|
|
1375
|
+
/** Reserves a Join Member's place among timers, set when the Join suspends. */
|
|
1376
|
+
timerOrder?(): number;
|
|
1377
|
+
/** The next wait's place in the order waits began. */
|
|
1378
|
+
waitOrder?(): number;
|
|
1267
1379
|
};
|
|
1268
1380
|
type Receiver = {
|
|
1269
1381
|
k: 'receiver';
|
|
@@ -1315,6 +1427,43 @@ type Outcome = {
|
|
|
1315
1427
|
};
|
|
1316
1428
|
kind: 'cancelled';
|
|
1317
1429
|
};
|
|
1430
|
+
/**
|
|
1431
|
+
* A Run's state as a save writes it and a restore sets it (save-runs.ts).
|
|
1432
|
+
* Its fields are the Run's own, so a change to one fails to compile here
|
|
1433
|
+
* rather than at save time.
|
|
1434
|
+
*/
|
|
1435
|
+
type RunState = {
|
|
1436
|
+
abandoning: string[];
|
|
1437
|
+
alloc: number;
|
|
1438
|
+
calls: number;
|
|
1439
|
+
cancellationAbandons: string[];
|
|
1440
|
+
clause: number;
|
|
1441
|
+
cleanupFrom: number | null;
|
|
1442
|
+
controls: Control[];
|
|
1443
|
+
during: Value;
|
|
1444
|
+
faultAbandons: string[];
|
|
1445
|
+
frames: Frame[];
|
|
1446
|
+
fuel: number;
|
|
1447
|
+
id: string;
|
|
1448
|
+
join: {
|
|
1449
|
+
frame: Frame;
|
|
1450
|
+
members: Member[];
|
|
1451
|
+
start: number;
|
|
1452
|
+
} | null;
|
|
1453
|
+
readonly limits: Limits;
|
|
1454
|
+
offerAttempt: number;
|
|
1455
|
+
openVerdict: boolean;
|
|
1456
|
+
raisedAt: CodePosition | null;
|
|
1457
|
+
records: RunRecord[];
|
|
1458
|
+
resumption: Resumption | null;
|
|
1459
|
+
readonly script: Script$1;
|
|
1460
|
+
segment: number;
|
|
1461
|
+
segmentBase: Value[];
|
|
1462
|
+
suspended: Suspension | null;
|
|
1463
|
+
target: Value;
|
|
1464
|
+
viaFallback: boolean;
|
|
1465
|
+
waitedOn: Suspension | null;
|
|
1466
|
+
};
|
|
1318
1467
|
declare class Run {
|
|
1319
1468
|
readonly script: Script$1;
|
|
1320
1469
|
readonly limits: Limits;
|
|
@@ -1355,6 +1504,12 @@ declare class Run {
|
|
|
1355
1504
|
fuel: number;
|
|
1356
1505
|
alloc: number;
|
|
1357
1506
|
charging: boolean;
|
|
1507
|
+
/**
|
|
1508
|
+
* A `set` through a property's value is between its `hold` and its
|
|
1509
|
+
* `set-property` or raise: crossings there don't land queued inputs, and no
|
|
1510
|
+
* Fuel Slice preempts it (ADR 0135).
|
|
1511
|
+
*/
|
|
1512
|
+
holding: boolean;
|
|
1358
1513
|
records: RunRecord[];
|
|
1359
1514
|
/**
|
|
1360
1515
|
* The Script's Persistent State, measured at the Segment's end without this
|
|
@@ -1364,19 +1519,20 @@ declare class Run {
|
|
|
1364
1519
|
persistentState: () => number;
|
|
1365
1520
|
/** The Script Variables when the Segment began, for rollback (ADR 0006). */
|
|
1366
1521
|
segmentBase: Value[];
|
|
1367
|
-
private
|
|
1368
|
-
|
|
1522
|
+
private controls;
|
|
1523
|
+
/** Where its current error was raised, for an errored outcome. */
|
|
1524
|
+
private raisedAt;
|
|
1369
1525
|
private offerAttempt;
|
|
1370
1526
|
private outcome;
|
|
1371
1527
|
private entryError;
|
|
1372
1528
|
private m;
|
|
1529
|
+
private instructionCharge;
|
|
1373
1530
|
private clause;
|
|
1374
1531
|
/** Its entry dispatch reached the Fallback Handler's clauses (ADR 0064). */
|
|
1375
1532
|
private viaFallback;
|
|
1376
1533
|
private during;
|
|
1377
|
-
|
|
1378
|
-
private
|
|
1379
|
-
private cleanupFuel;
|
|
1534
|
+
/** Its Fuel when its cancellation cleanup began, if it has been cancelled. */
|
|
1535
|
+
private cleanupFrom;
|
|
1380
1536
|
/** Calls abandoned when cancellation landed, traced after the cancel Segment. */
|
|
1381
1537
|
cancellationAbandons: string[];
|
|
1382
1538
|
rebindCalls(): void;
|
|
@@ -1388,6 +1544,13 @@ declare class Run {
|
|
|
1388
1544
|
/** A pending call's context: the one suspended on, or an open Join's. */
|
|
1389
1545
|
pendingCall(id: string): Pick<Member, 'abort' | 'call'> | undefined;
|
|
1390
1546
|
callAdoptable(id: string): boolean;
|
|
1547
|
+
/**
|
|
1548
|
+
* Settles a charge request for a pending call (Metered Operations): an
|
|
1549
|
+
* affordable one is spent, and one the Run can't pay faults it at the call,
|
|
1550
|
+
* a Join Member at its own site. A suspended Run keeps its committed
|
|
1551
|
+
* Segment; a preempted Join body rolls its open one back.
|
|
1552
|
+
*/
|
|
1553
|
+
requestedCharge(id: string, fuel: number): 'accepted' | 'limit';
|
|
1391
1554
|
/** Reconnect the Host side of a saved suspending Operation. */
|
|
1392
1555
|
restoredCall(id: string, grantName: string, args: Value[], reissue: boolean): {
|
|
1393
1556
|
call: Call<unknown>;
|
|
@@ -1400,22 +1563,65 @@ declare class Run {
|
|
|
1400
1563
|
restore(state: Record<string, unknown>): void;
|
|
1401
1564
|
/** Validate decoded control after the graph is complete, before Host rebinding. */
|
|
1402
1565
|
validateSnapshot(knownCode: ReadonlySet<object>): void;
|
|
1566
|
+
/**
|
|
1567
|
+
* The error control's records: each refers to the frames, Unwind Table
|
|
1568
|
+
* entries and offers it names, and they nest as the machine makes them.
|
|
1569
|
+
*/
|
|
1570
|
+
private validateControls;
|
|
1571
|
+
/**
|
|
1572
|
+
* The frames as control `i` had them, before the controls after it held
|
|
1573
|
+
* some aside: each later dispatch gives back the frames it holds above its
|
|
1574
|
+
* owner, whose place is its own pc again, and each later cleanup those it
|
|
1575
|
+
* holds above its running block. `pcs` has the places that differ.
|
|
1576
|
+
*/
|
|
1577
|
+
private framesAt;
|
|
1403
1578
|
private validateControl;
|
|
1404
1579
|
get cancelling(): boolean;
|
|
1405
1580
|
/** Drop a new Run immediately after dispatch, without entering its body. */
|
|
1406
1581
|
drop(): void;
|
|
1407
1582
|
/** Roll back the active Segment and abandon every pending call without unwinding. */
|
|
1408
1583
|
discard(reason: AbandonReason, betweenSegments?: boolean): string[];
|
|
1409
|
-
/**
|
|
1584
|
+
/**
|
|
1585
|
+
* Cancellation lands here: its Segment rolls back, and its `finally`
|
|
1586
|
+
* blocks run, once, innermost first, on the Cleanup Budget; nothing is
|
|
1587
|
+
* unwound (chapter 6, Cancellation and Stop).
|
|
1588
|
+
*/
|
|
1410
1589
|
cancel(betweenSegments?: boolean): void;
|
|
1411
|
-
/**
|
|
1412
|
-
|
|
1413
|
-
/**
|
|
1414
|
-
|
|
1590
|
+
/** The index of a cancellation's cleanup among the controls, if it has one. */
|
|
1591
|
+
private cancelControl;
|
|
1592
|
+
/**
|
|
1593
|
+
* Each frame and held frame a cancellation's remaining cleanup needs, with
|
|
1594
|
+
* the size it keeps, or null for a frame it no longer needs (chapter 8,
|
|
1595
|
+
* Pending cleanup state). The running cleanup, and what it calls, keep
|
|
1596
|
+
* their whole stacks; each interrupted stack keeps only the prefix its
|
|
1597
|
+
* `finally` entries need, and an owner or activation none of them needs is
|
|
1598
|
+
* gone. The interrupted dispatch contexts count nothing.
|
|
1599
|
+
*/
|
|
1600
|
+
private cancelKept;
|
|
1601
|
+
/**
|
|
1602
|
+
* The stack prefix the `finally` entries of frame `f` covering `place`
|
|
1603
|
+
* need, only those before entry `before` if given, or null when none does.
|
|
1604
|
+
*/
|
|
1605
|
+
private finallyPrefix;
|
|
1606
|
+
/** A new Segment: its id moves on, and a rollback returns to here. */
|
|
1607
|
+
private newSegment;
|
|
1608
|
+
/** The same Segment, rolled back to here from now on. */
|
|
1609
|
+
private rebase;
|
|
1610
|
+
/**
|
|
1611
|
+
* Where the Segment stands as the Run is dispatched. A Run that
|
|
1612
|
+
* cancellation made ready rolls back to here, as other Runs may have
|
|
1613
|
+
* committed since. A parked Run resumes after dispatch, with no resumption
|
|
1614
|
+
* instruction, in a new Segment: its park ended the first (chapter 11,
|
|
1615
|
+
* Segment ids).
|
|
1616
|
+
*/
|
|
1617
|
+
enterDispatch(how: 'continue' | 'resume' | 'start', cleanupReady: boolean): void;
|
|
1415
1618
|
park(): boolean;
|
|
1416
|
-
private nextCancellationCleanup;
|
|
1417
1619
|
/** The failed Run’s message for an internally queued error Delivery. */
|
|
1418
1620
|
setDuring(value: Value): void;
|
|
1621
|
+
/** This Run's state, for a save to write (save-runs.ts). */
|
|
1622
|
+
savedState(): RunState;
|
|
1623
|
+
/** Sets this Run's state from a save, as `savedState` reads it. */
|
|
1624
|
+
restoreState({ script: _, limits: __, ...state }: RunState): void;
|
|
1419
1625
|
constructor(script: Script$1, entry: Body | Body[], args: Value[], limits?: Limits, code?: Code,
|
|
1420
1626
|
/** The Selector of a Delivery that may reach a Fallback Handler. */
|
|
1421
1627
|
fallback?: string);
|
|
@@ -1441,7 +1647,12 @@ declare class Run {
|
|
|
1441
1647
|
/** Whether a dispatch has a clause left to try after the current one. */
|
|
1442
1648
|
private static more;
|
|
1443
1649
|
private get frame();
|
|
1444
|
-
/**
|
|
1650
|
+
/**
|
|
1651
|
+
* Tooling-only control views; never part of Inspect or saved state. The
|
|
1652
|
+
* frames each control retains come first, a dispatch's owner at its own
|
|
1653
|
+
* place, then those it holds aside; then the frames running, where a
|
|
1654
|
+
* policy or a `finally` block runs in a view of its retained owner.
|
|
1655
|
+
*/
|
|
1445
1656
|
debugFrames(): {
|
|
1446
1657
|
frame: Frame;
|
|
1447
1658
|
owner?: number;
|
|
@@ -1449,6 +1660,12 @@ declare class Run {
|
|
|
1449
1660
|
}[];
|
|
1450
1661
|
/** Charge an instruction, faulting before it does anything if it can't pay. */
|
|
1451
1662
|
private pay;
|
|
1663
|
+
/** The Fuel the Run has left: of its Cleanup Budget while cancelling. */
|
|
1664
|
+
private fuelLeft;
|
|
1665
|
+
/** The limit a charge the Run can't cover faults on. */
|
|
1666
|
+
private get fuelLimit();
|
|
1667
|
+
/** Spends Fuel the Run can cover; a call's `Take` (call-meter.ts). */
|
|
1668
|
+
private readonly spend;
|
|
1452
1669
|
private payAmount;
|
|
1453
1670
|
private pop;
|
|
1454
1671
|
private popN;
|
|
@@ -1463,13 +1680,25 @@ declare class Run {
|
|
|
1463
1680
|
* The Group calls this only when no tooling observes the steps.
|
|
1464
1681
|
*/
|
|
1465
1682
|
fastSteps(room: number): void;
|
|
1683
|
+
/**
|
|
1684
|
+
* Run instructions, fast and general, while they spend less than `room`
|
|
1685
|
+
* Fuel and the Group has nothing to do between them: none writes a record
|
|
1686
|
+
* or ends, suspends or cancels the Run. Returns whether any took the
|
|
1687
|
+
* general step, whose aftermath the Group then handles. Like `fastSteps`,
|
|
1688
|
+
* only for a Run whose clause is selected and that no tooling observes.
|
|
1689
|
+
*/
|
|
1690
|
+
stepMany(room: number): boolean;
|
|
1466
1691
|
/** Internal: also called after a debug-deferred unwind. */
|
|
1467
1692
|
finishInstruction(): void;
|
|
1468
1693
|
/** TS tooling: a resumption consumes the suspension instruction, not a new statement. */
|
|
1469
1694
|
get resumingInstruction(): boolean;
|
|
1470
1695
|
/** Retain a reply while a Fuel Slice has preempted an open Join's body. */
|
|
1471
1696
|
replyToOpenJoin(id: string, reply: Resumption): boolean;
|
|
1472
|
-
/**
|
|
1697
|
+
/**
|
|
1698
|
+
* The replies retained while the Join's body was preempted, replayed in
|
|
1699
|
+
* member start order once it starts waiting, so the earliest-started
|
|
1700
|
+
* member's failure is raised (chapter 5, Joins).
|
|
1701
|
+
*/
|
|
1473
1702
|
takeJoinReplies(): {
|
|
1474
1703
|
id: string;
|
|
1475
1704
|
reply: Resumption;
|
|
@@ -1513,6 +1742,11 @@ declare class Run {
|
|
|
1513
1742
|
private selectElement;
|
|
1514
1743
|
/** `the number of elements of o` (#1143): the Host's count, one callback. */
|
|
1515
1744
|
private countElements;
|
|
1745
|
+
/**
|
|
1746
|
+
* `the elements of o` (#1627): the 3-Fuel base, the receiver's checks,
|
|
1747
|
+
* one `Count`, one `At` per position, then the list's own charge.
|
|
1748
|
+
*/
|
|
1749
|
+
private listElements;
|
|
1516
1750
|
private elementCall;
|
|
1517
1751
|
private elementResultDetail;
|
|
1518
1752
|
/** `set the p of o to v`: the Host's `Set`, after the value's Shape check. */
|
|
@@ -1536,25 +1770,104 @@ declare class Run {
|
|
|
1536
1770
|
* for the frames search leaves, then dispatch there.
|
|
1537
1771
|
*/
|
|
1538
1772
|
private unwind;
|
|
1773
|
+
/**
|
|
1774
|
+
* Whether no guard or catch in any frame covers the place an error is
|
|
1775
|
+
* raised now, so its search would end the Run. A covering catch whose
|
|
1776
|
+
* tests decline still counts as covering.
|
|
1777
|
+
*/
|
|
1778
|
+
private uncovered;
|
|
1539
1779
|
private unwindNow;
|
|
1540
1780
|
private activeEntries;
|
|
1541
|
-
private realOwner;
|
|
1542
1781
|
private callWouldExceedDepth;
|
|
1543
|
-
private
|
|
1544
|
-
|
|
1545
|
-
private
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
private
|
|
1552
|
-
|
|
1553
|
-
|
|
1782
|
+
private depth;
|
|
1783
|
+
/** The place frame `index` is at: `raised` for the top frame. */
|
|
1784
|
+
private framePc;
|
|
1785
|
+
/**
|
|
1786
|
+
* Whether entry `ei` of frame `index` is one a search or a cleanup may use:
|
|
1787
|
+
* in the frame's own body, inside `limit` at its frame, and not one `skip`
|
|
1788
|
+
* has already done.
|
|
1789
|
+
*/
|
|
1790
|
+
private usable;
|
|
1791
|
+
/**
|
|
1792
|
+
* The innermost control bounding an error raised now: a dispatch's policy,
|
|
1793
|
+
* or the `finally` block a cleanup is running.
|
|
1794
|
+
*/
|
|
1795
|
+
private limitOf;
|
|
1796
|
+
/**
|
|
1797
|
+
* Searches for a catch from `s`'s frame and entry outward, within its
|
|
1798
|
+
* limit. A covering catch starts its dispatch; an error that escapes its
|
|
1799
|
+
* bound goes on outward from it (chapter 6, Catching).
|
|
1800
|
+
*/
|
|
1801
|
+
private search;
|
|
1802
|
+
/**
|
|
1803
|
+
* Starts a catch's tests in frame `owner`: its own operand stack, the
|
|
1804
|
+
* owner's iterator prefix and the error, over the owner's locals. The
|
|
1805
|
+
* failed frames above it are held aside until the dispatch ends.
|
|
1806
|
+
*/
|
|
1807
|
+
private beginDispatch;
|
|
1808
|
+
/**
|
|
1809
|
+
* Ends the top dispatch: the owner gets its own stack and place back, and
|
|
1810
|
+
* the held frames return.
|
|
1811
|
+
*/
|
|
1812
|
+
private endDispatch;
|
|
1813
|
+
/** `catch-next`: the search goes on outward from the next entry. */
|
|
1554
1814
|
private nextCatch;
|
|
1815
|
+
/**
|
|
1816
|
+
* `catch-accept`: the exited `finally` blocks run, innermost first, then
|
|
1817
|
+
* the owner goes on after the instruction with the activation's stack.
|
|
1818
|
+
*/
|
|
1819
|
+
private acceptCatch;
|
|
1820
|
+
/**
|
|
1821
|
+
* An error escaping a Recovery policy: its original error becomes the new
|
|
1822
|
+
* one's `during`, the policy's exited `finally` blocks and then the
|
|
1823
|
+
* failure's run, and the search goes on outward from the catching `try`,
|
|
1824
|
+
* past its other catches (chapter 6, Catching).
|
|
1825
|
+
*/
|
|
1826
|
+
private abortRecovery;
|
|
1827
|
+
/**
|
|
1828
|
+
* The `finally` entries covering each frame's place from the top down to
|
|
1829
|
+
* `low`, innermost first: in `low`, only those before `before`, and none
|
|
1830
|
+
* `skip` has run.
|
|
1831
|
+
*/
|
|
1832
|
+
private collect;
|
|
1833
|
+
/** Pushes a cleanup, then runs its first `finally` block or what follows. */
|
|
1834
|
+
private startCleanup;
|
|
1835
|
+
/** Runs the next scheduled `finally` block, or what follows the last. */
|
|
1836
|
+
private nextCleanup;
|
|
1837
|
+
/**
|
|
1838
|
+
* Ends the dispatch under the running cleanup once its policy's own
|
|
1839
|
+
* `finally` blocks have run, and schedules the failure's: down to the
|
|
1840
|
+
* offering frame for a transfer, or to the catching one for an abort.
|
|
1841
|
+
*/
|
|
1842
|
+
private leaveDispatch;
|
|
1843
|
+
private addDuring;
|
|
1844
|
+
private withDuring;
|
|
1845
|
+
/** The innermost dispatch, whose failure chain offers are chosen from. */
|
|
1846
|
+
private recovery;
|
|
1847
|
+
/**
|
|
1848
|
+
* The current recovery's failure chain: the innermost dispatch's, or once
|
|
1849
|
+
* a transfer's dispatch has ended, the frames its cleanup is leaving, whose
|
|
1850
|
+
* offers stay eligible until the action is entered.
|
|
1851
|
+
*/
|
|
1852
|
+
private chain;
|
|
1853
|
+
/**
|
|
1854
|
+
* Looks `name` up in a failure chain: a dispatch's held frames, its owner at
|
|
1855
|
+
* its place, then the frames below it within its limit; or the Run's
|
|
1856
|
+
* frames. Innermost first, each try's offers in source order; `frames`
|
|
1857
|
+
* counts the frames scanned.
|
|
1858
|
+
*/
|
|
1555
1859
|
private lookupOffer;
|
|
1860
|
+
/**
|
|
1861
|
+
* `choose-offer`: the nearest offer named `name` in the failure chain, with
|
|
1862
|
+
* exactly `count` arguments. Its policy's own `finally` blocks run, then
|
|
1863
|
+
* the failure's down to the offering `try`, then the action is entered.
|
|
1864
|
+
*/
|
|
1556
1865
|
private chooseOffer;
|
|
1557
|
-
|
|
1866
|
+
/**
|
|
1867
|
+
* Enters a chosen action: the frames above its `try` are gone, its
|
|
1868
|
+
* parameters bind at once, and it starts at its entry.
|
|
1869
|
+
*/
|
|
1870
|
+
private enterOffer;
|
|
1558
1871
|
private checkState;
|
|
1559
1872
|
private returnFrom;
|
|
1560
1873
|
private callBody;
|
|
@@ -1693,8 +2006,11 @@ type SqlRows = {
|
|
|
1693
2006
|
readonly rows: readonly (readonly SqlValue[])[];
|
|
1694
2007
|
};
|
|
1695
2008
|
/**
|
|
1696
|
-
* The Core has checked the Shapes and max
|
|
1697
|
-
* rules
|
|
2009
|
+
* The Core has checked the Shapes and max and converted params by the chapter
|
|
2010
|
+
* 7 rules. query and change call `beforeStep` exactly once immediately before
|
|
2011
|
+
* every SQLite statement step, including the completion check and the probe
|
|
2012
|
+
* past max, and let its LimitReached propagate without stepping (Metered
|
|
2013
|
+
* Operations, SQLite step authorization). The Core converts the result, raising `sql` for a
|
|
1698
2014
|
* column named twice and `unrepresentable` for a double it can't hold.
|
|
1699
2015
|
* change, begin, commit and rollback are Segment-bound: they act inside the
|
|
1700
2016
|
* calling Segment's transaction, which the coordinator publishes or discards.
|
|
@@ -1705,17 +2021,17 @@ type SqlRows = {
|
|
|
1705
2021
|
*/
|
|
1706
2022
|
type SqliteImpl = {
|
|
1707
2023
|
begin(call: Call<SqliteBinding>): void;
|
|
1708
|
-
change(call: Call<SqliteBinding>, sql: string, params: SqlParams, max: number): SqlRows & {
|
|
2024
|
+
change(call: Call<SqliteBinding>, sql: string, params: SqlParams, max: number, beforeStep: () => void): SqlRows & {
|
|
1709
2025
|
readonly changes: number;
|
|
1710
2026
|
};
|
|
1711
2027
|
commit(call: Call<SqliteBinding>): void;
|
|
1712
2028
|
/** Called once per Grant. The same database gives the same coordinator. */
|
|
1713
2029
|
coordinator(database: string): SegmentCoordinator;
|
|
1714
|
-
query(call: Call<SqliteBinding>, sql: string, params: SqlParams, max: number): SqlRows;
|
|
2030
|
+
query(call: Call<SqliteBinding>, sql: string, params: SqlParams, max: number, beforeStep: () => void): SqlRows;
|
|
1715
2031
|
rollback(call: Call<SqliteBinding>): void;
|
|
1716
2032
|
};
|
|
1717
|
-
/** Optional for Hosts.
|
|
1718
|
-
declare const sqliteCapability: (impl: SqliteImpl, costs: Costs,
|
|
2033
|
+
/** Optional for Hosts. perStep is whole Fuel charged before each SQLite step. */
|
|
2034
|
+
declare const sqliteCapability: (impl: SqliteImpl, costs: Costs, perStep: number) => CapabilityDef<SqliteBinding>;
|
|
1719
2035
|
//#endregion
|
|
1720
2036
|
//#region src/store-capability.d.ts
|
|
1721
2037
|
/**
|
|
@@ -1802,6 +2118,8 @@ type Core = {
|
|
|
1802
2118
|
result: RestoreResult;
|
|
1803
2119
|
};
|
|
1804
2120
|
sqliteCapability: typeof sqliteCapability;
|
|
2121
|
+
/** Throws `invalid save` or `save mismatch`. */
|
|
2122
|
+
stateFingerprint(save: Uint8Array): Uint8Array;
|
|
1805
2123
|
storeCapability: typeof storeCapability;
|
|
1806
2124
|
timerCapability: typeof timerCapability;
|
|
1807
2125
|
userCapability: typeof userCapability;
|
|
@@ -1839,6 +2157,8 @@ type Group = {
|
|
|
1839
2157
|
scriptNames(): string[];
|
|
1840
2158
|
setParent(o: HostObject, parent: HostObject | undefined): void;
|
|
1841
2159
|
settle(callId: string, s: Settlement): Call<unknown> | undefined;
|
|
2160
|
+
/** Worker. Throws as save() would. */
|
|
2161
|
+
stateFingerprint(): Uint8Array;
|
|
1842
2162
|
};
|
|
1843
2163
|
/** A loaded Script's handle. */
|
|
1844
2164
|
type Script = {
|
|
@@ -2010,12 +2330,34 @@ type Call<B, R = Value> = {
|
|
|
2010
2330
|
readonly group: Group;
|
|
2011
2331
|
readonly id: string;
|
|
2012
2332
|
readonly now: bigint;
|
|
2333
|
+
/**
|
|
2334
|
+
* Queues a request for more Fuel, settled at the end of the Pump that
|
|
2335
|
+
* processes it (Metered Operations). Only a suspending Operation declared
|
|
2336
|
+
* `metering: 'read-only'` may ask, one request at a time.
|
|
2337
|
+
*/
|
|
2338
|
+
requestCharge(fuel: number): ChargeRequest;
|
|
2013
2339
|
readonly runId: string;
|
|
2014
2340
|
readonly scopeName?: string;
|
|
2015
2341
|
readonly scriptName: string;
|
|
2016
2342
|
readonly segmentId: string;
|
|
2017
2343
|
readonly signal: AbortSignal;
|
|
2018
2344
|
};
|
|
2345
|
+
/** A queued charge request: its Group-wide id and its outcome. */
|
|
2346
|
+
type ChargeRequest = {
|
|
2347
|
+
readonly id: string;
|
|
2348
|
+
/** Settles at the end of the Pump that processes the request. */
|
|
2349
|
+
readonly result: Promise<ChargeResult>;
|
|
2350
|
+
};
|
|
2351
|
+
type ChargeResult = {
|
|
2352
|
+
readonly call: string;
|
|
2353
|
+
/** The requested amount; only an accepted request spends it. */
|
|
2354
|
+
readonly fuel: number;
|
|
2355
|
+
readonly kind: 'charge result';
|
|
2356
|
+
readonly request: string;
|
|
2357
|
+
readonly status: 'accepted' | 'limit' | 'inactive';
|
|
2358
|
+
};
|
|
2359
|
+
/** How an Operation may charge as it works (Metered Operations). */
|
|
2360
|
+
type Metering = 'read-only' | 'segment-bound';
|
|
2019
2361
|
/**
|
|
2020
2362
|
* The JS type a Host function receives for an argument of Shape S (#1420):
|
|
2021
2363
|
* scalars as their JS forms, Nothing as null, a Host Object as its handle,
|
|
@@ -2027,13 +2369,19 @@ type PlainResult<R> = [R] extends [undefined] ? Value : (R extends Shape<infer T
|
|
|
2027
2369
|
type PlainArgs<A extends readonly Shape[]> = { -readonly [K in keyof A]: PlainArg<A[K]>; };
|
|
2028
2370
|
type ImmediateOp<B, A extends readonly Shape[] = Shape[], R = Shape> = OpBase<A, R> & {
|
|
2029
2371
|
do(call: Call<B, PlainResult<R>>, ...args: PlainArgs<A>): PlainResult<R>;
|
|
2372
|
+
metering?: Metering;
|
|
2030
2373
|
mode: 'immediate';
|
|
2031
2374
|
scope?: ScopeDecl;
|
|
2032
2375
|
segmentBound?: boolean;
|
|
2033
2376
|
};
|
|
2034
2377
|
type SuspendingOp<B, A extends readonly Shape[] = Shape[], R = Shape> = OpBase<A, R> & {
|
|
2035
2378
|
maxPendingMs?: number;
|
|
2379
|
+
metering?: 'read-only';
|
|
2036
2380
|
mode: 'suspending';
|
|
2381
|
+
/**
|
|
2382
|
+
* Must honour `call.signal` and settle once it aborts: `drive.close()`
|
|
2383
|
+
* awaits every `run` Promise, including abandoned calls, with no timeout.
|
|
2384
|
+
*/
|
|
2037
2385
|
run?(call: Call<B, PlainResult<R>>, ...args: PlainArgs<A>): Promise<PlainResult<R>>;
|
|
2038
2386
|
start?(call: Call<B, PlainResult<R>>, ...args: PlainArgs<A>): void;
|
|
2039
2387
|
};
|
|
@@ -2046,12 +2394,14 @@ type Operation<B, A extends readonly Shape[] = Shape[], R = Shape> = ImmediateOp
|
|
|
2046
2394
|
/** The Core's own form: every argument and result is a Value. */
|
|
2047
2395
|
type ValueImmediateOp<B> = OpBase & {
|
|
2048
2396
|
do(call: Call<B>, ...args: Value[]): Value;
|
|
2397
|
+
metering?: Metering;
|
|
2049
2398
|
mode: 'immediate';
|
|
2050
2399
|
scope?: ScopeDecl;
|
|
2051
2400
|
segmentBound?: boolean;
|
|
2052
2401
|
};
|
|
2053
2402
|
type ValueSuspendingOp<B> = OpBase & {
|
|
2054
2403
|
maxPendingMs?: number;
|
|
2404
|
+
metering?: 'read-only';
|
|
2055
2405
|
mode: 'suspending';
|
|
2056
2406
|
run?(call: Call<B>, ...args: Value[]): Promise<Value>;
|
|
2057
2407
|
start?(call: Call<B>, ...args: Value[]): void;
|
|
@@ -2290,9 +2640,10 @@ declare class Decimal {
|
|
|
2290
2640
|
/** Immutable, opaque value. Host code uses the named constructors. */
|
|
2291
2641
|
declare class Value {
|
|
2292
2642
|
#private;
|
|
2293
|
-
readonly kind: Kind;
|
|
2294
2643
|
private constructor();
|
|
2295
2644
|
static isValue(input: unknown): input is Value;
|
|
2645
|
+
get kind(): Kind;
|
|
2646
|
+
/** Returns the text payload, or undefined for kinds other than text. */
|
|
2296
2647
|
asText(): string | undefined;
|
|
2297
2648
|
asBool(): boolean | undefined;
|
|
2298
2649
|
asDecimal(): Decimal | undefined;
|
|
@@ -2331,7 +2682,7 @@ declare class Value {
|
|
|
2331
2682
|
get length(): number;
|
|
2332
2683
|
index(i: number): Value;
|
|
2333
2684
|
get(key: string): Value;
|
|
2334
|
-
/**
|
|
2685
|
+
/** A detached view, including copies of the individual pairs. */
|
|
2335
2686
|
mapPairs(): Pairs | undefined;
|
|
2336
2687
|
get mapSize(): number;
|
|
2337
2688
|
hasKey(key: string): boolean;
|
|
@@ -2551,11 +2902,11 @@ type ScriptSources = {
|
|
|
2551
2902
|
type RestoreOptions = GroupOptions & {
|
|
2552
2903
|
grants(script: string, name: string): Grant<unknown> | undefined;
|
|
2553
2904
|
libraries: readonly Library[];
|
|
2554
|
-
onMismatch: 'reject' | 'variables only';
|
|
2905
|
+
onMismatch: 'reject' | 'variables only' | 'reload changed';
|
|
2555
2906
|
resolve(kind: string, id: string): {
|
|
2556
2907
|
native: unknown;
|
|
2557
2908
|
} | undefined;
|
|
2558
|
-
/** Native TS external-source snapshots only. Different code requires variables-only
|
|
2909
|
+
/** Native TS external-source snapshots only. Different code requires a variables-only or Partial Restore. */
|
|
2559
2910
|
scriptSources?(request: ScriptCodeRequest): ScriptSources | undefined;
|
|
2560
2911
|
};
|
|
2561
2912
|
type PendingCall = {
|
|
@@ -2574,6 +2925,8 @@ type RestoreResult = {
|
|
|
2574
2925
|
disposed: [string, string][];
|
|
2575
2926
|
droppedMessages: string[];
|
|
2576
2927
|
pending: PendingCall[];
|
|
2928
|
+
/** The Scripts a Partial Restore rebuilt from their new code, in load order. */
|
|
2929
|
+
reloaded: string[];
|
|
2577
2930
|
reports: Report[];
|
|
2578
2931
|
variablesOnly: boolean;
|
|
2579
2932
|
};
|
|
@@ -2615,7 +2968,7 @@ type EffectFailure = {
|
|
|
2615
2968
|
segment: string;
|
|
2616
2969
|
status: 'failed' | 'unknown';
|
|
2617
2970
|
};
|
|
2618
|
-
type Report = AccountingReport | {
|
|
2971
|
+
type Report = AccountingReport | ChargeResult | {
|
|
2619
2972
|
code: HostErrorCode;
|
|
2620
2973
|
detail?: string;
|
|
2621
2974
|
kind: 'host error';
|
|
@@ -2775,6 +3128,21 @@ declare class TsGroup implements Group {
|
|
|
2775
3128
|
private inputs;
|
|
2776
3129
|
private deliveries;
|
|
2777
3130
|
private broadcasts;
|
|
3131
|
+
/**
|
|
3132
|
+
* Each Run's issued call ids' ranges, for the Group's lifetime, with
|
|
3133
|
+
* whether their calls may request charges (Metered Operations).
|
|
3134
|
+
*/
|
|
3135
|
+
private issued;
|
|
3136
|
+
/** The last charge request id issued. */
|
|
3137
|
+
private chargeCounter;
|
|
3138
|
+
/** Admitted charge requests whose futures haven't settled, in order. */
|
|
3139
|
+
private charges;
|
|
3140
|
+
/** How many waits have been set: the next wait's order. */
|
|
3141
|
+
private waitOrder;
|
|
3142
|
+
/** Each root's discarded messages, for the Group's lifetime. */
|
|
3143
|
+
private rootDiscards;
|
|
3144
|
+
/** The name a restored Group's save gave it, which its saves keep. */
|
|
3145
|
+
private savedName;
|
|
2778
3146
|
private saves;
|
|
2779
3147
|
private lastClock;
|
|
2780
3148
|
private randomState;
|
|
@@ -2800,21 +3168,56 @@ declare class TsGroup implements Group {
|
|
|
2800
3168
|
private accountStart;
|
|
2801
3169
|
private accountEnd;
|
|
2802
3170
|
private accountDrop;
|
|
3171
|
+
/**
|
|
3172
|
+
* The roots whose work changed since the last accounting tail, which its
|
|
3173
|
+
* next tail reports: as a save holds them, without reporting them.
|
|
3174
|
+
*/
|
|
3175
|
+
private changedRoots;
|
|
2803
3176
|
private flushAccounting;
|
|
2804
3177
|
/** TS tooling only, outside the embedding interface and Trace parity. */
|
|
2805
3178
|
debug(): DebugController;
|
|
3179
|
+
/** Fuel an evaluation may spend before it fails. */
|
|
3180
|
+
private static readonly EVALUATION_FUEL;
|
|
3181
|
+
private debugEvaluate;
|
|
3182
|
+
private static refuse;
|
|
3183
|
+
private evaluationHost;
|
|
2806
3184
|
private advanceDebugPump;
|
|
2807
3185
|
private attachSession;
|
|
2808
3186
|
/** Worker. A Fingerprint covers code, declarations and limits, never state. */
|
|
2809
3187
|
fingerprint(): Uint8Array;
|
|
2810
|
-
/** Worker. Host callbacks, bindings and native objects aren't in the bytes. */
|
|
2811
|
-
private references;
|
|
2812
3188
|
save(o?: SaveOptions): Uint8Array;
|
|
3189
|
+
/** Worker. Refused as a save would be, but writes no Trace record. */
|
|
3190
|
+
stateFingerprint(): Uint8Array;
|
|
3191
|
+
private effectsPending;
|
|
3192
|
+
private snapshot;
|
|
2813
3193
|
/** Build and check the complete replacement before publishing the Group. */
|
|
2814
3194
|
static restore(bytes: Uint8Array, o: TsRestoreOptions): {
|
|
2815
3195
|
group: TsGroup;
|
|
2816
3196
|
result: RestoreResult;
|
|
2817
3197
|
};
|
|
3198
|
+
/**
|
|
3199
|
+
* A save's second pass: its values, read against the restored Scripts'
|
|
3200
|
+
* code, and every section that holds them.
|
|
3201
|
+
*/
|
|
3202
|
+
private readState;
|
|
3203
|
+
/** A unit's code, relative to a Script, as a save names it. */
|
|
3204
|
+
private unitCode;
|
|
3205
|
+
/** Publishes a save's state in the restored Group. */
|
|
3206
|
+
private applyState;
|
|
3207
|
+
/** Restores the wait table: each wait's timers, in the order waits began. */
|
|
3208
|
+
private importWaits;
|
|
3209
|
+
/** A queued Host input from its record, with the Trace line it was given. */
|
|
3210
|
+
private inputOf;
|
|
3211
|
+
/**
|
|
3212
|
+
* Tooling: each of a Script's code units by identity, with its named
|
|
3213
|
+
* functions' Declaration Documentation, so a Session Host can keep it
|
|
3214
|
+
* for Function Values that go stale (chapter 9, `script-units`).
|
|
3215
|
+
*/
|
|
3216
|
+
scriptUnitDocs(name: string): [string, Map<string, string>][];
|
|
3217
|
+
/** The code units restored Runs may name. */
|
|
3218
|
+
private knownCode;
|
|
3219
|
+
/** A Library's code a Script imports, by its unit name. */
|
|
3220
|
+
private libraryCode;
|
|
2818
3221
|
private discardedDecisions;
|
|
2819
3222
|
private unsettled;
|
|
2820
3223
|
private restored;
|
|
@@ -2823,6 +3226,16 @@ declare class TsGroup implements Group {
|
|
|
2823
3226
|
/** Queued, and accepted only before the restored Group's first Pump. */
|
|
2824
3227
|
settle(id: string, settlement: Settlement): Call<unknown> | undefined;
|
|
2825
3228
|
private applySettlement;
|
|
3229
|
+
private issuedEligibility;
|
|
3230
|
+
/**
|
|
3231
|
+
* Queues a charge request for an issued call (Metered Operations). A call
|
|
3232
|
+
* the Group never issued is `unknown call`; an ineligible one, an invalid
|
|
3233
|
+
* amount or a second unresolved request is `invalid value`, with no id.
|
|
3234
|
+
*/
|
|
3235
|
+
private requestCharge;
|
|
3236
|
+
private drainCharge;
|
|
3237
|
+
private settleCharges;
|
|
3238
|
+
private endFaulted;
|
|
2826
3239
|
private pendingCall;
|
|
2827
3240
|
private holders;
|
|
2828
3241
|
private pendingOperations;
|
|
@@ -2851,6 +3264,13 @@ declare class TsGroup implements Group {
|
|
|
2851
3264
|
private releaseGrant;
|
|
2852
3265
|
private releaseGrants;
|
|
2853
3266
|
private reportStop;
|
|
3267
|
+
/**
|
|
3268
|
+
* A Partial Restore's Reload of a changed Script (ADR 0143). The rest of
|
|
3269
|
+
* the Group sees what a live Reload would give it, but no Host function
|
|
3270
|
+
* runs: this Script's Grants, Segments and scopes were never live here.
|
|
3271
|
+
* Its open Decision recipients are discarded, reported at the first Pump.
|
|
3272
|
+
*/
|
|
3273
|
+
private reloadRestored;
|
|
2854
3274
|
private dropStoppedMailbox;
|
|
2855
3275
|
private acceptDelivery;
|
|
2856
3276
|
private recordRefusal;
|
|
@@ -2891,6 +3311,12 @@ declare class TsGroup implements Group {
|
|
|
2891
3311
|
private settleReply;
|
|
2892
3312
|
private observe;
|
|
2893
3313
|
private suspended;
|
|
3314
|
+
/**
|
|
3315
|
+
* What a save keeps of a Run's wait: its order among waits, its Suspension
|
|
3316
|
+
* Point and, once the wait settles, what it waited on.
|
|
3317
|
+
*/
|
|
3318
|
+
private markWait;
|
|
3319
|
+
private suspendedWait;
|
|
2894
3320
|
private checkFunctionGroups;
|
|
2895
3321
|
/** A queued Delivery: its id now, its line and its mailbox entry at the next Pump. */
|
|
2896
3322
|
private queueDelivery;
|
|
@@ -2942,6 +3368,8 @@ declare class TsGroup implements Group {
|
|
|
2942
3368
|
private pumpAtClock;
|
|
2943
3369
|
private moveDelivery;
|
|
2944
3370
|
private turn;
|
|
3371
|
+
private handlerOf;
|
|
3372
|
+
private writeEnding;
|
|
2945
3373
|
private writeCancellationAbandons;
|
|
2946
3374
|
private callFailed;
|
|
2947
3375
|
private releaseRecords;
|
|
@@ -3008,6 +3436,16 @@ type DebugSnapshot = Omit<Inspection, 'scripts'> & {
|
|
|
3008
3436
|
})[];
|
|
3009
3437
|
})[];
|
|
3010
3438
|
};
|
|
3439
|
+
/**
|
|
3440
|
+
* What `evaluate` gave: the body's result, or why it failed. A failure to
|
|
3441
|
+
* compile gives each diagnostic's line in the body, from 1.
|
|
3442
|
+
*/
|
|
3443
|
+
type DebugEvaluation = {
|
|
3444
|
+
error: string;
|
|
3445
|
+
line?: number;
|
|
3446
|
+
} | {
|
|
3447
|
+
value: Value;
|
|
3448
|
+
};
|
|
3011
3449
|
type DebugSource = {
|
|
3012
3450
|
script?: string;
|
|
3013
3451
|
statements: number[];
|
|
@@ -3018,6 +3456,7 @@ declare class DebugController {
|
|
|
3018
3456
|
private readonly read;
|
|
3019
3457
|
private readonly advance;
|
|
3020
3458
|
private readonly readSources;
|
|
3459
|
+
private readonly evaluateIn;
|
|
3021
3460
|
paused: ((pause: DebugPause) => void) | null;
|
|
3022
3461
|
private breaks;
|
|
3023
3462
|
private faults;
|
|
@@ -3032,18 +3471,35 @@ declare class DebugController {
|
|
|
3032
3471
|
private notifying;
|
|
3033
3472
|
private since;
|
|
3034
3473
|
private elapsed;
|
|
3035
|
-
constructor(read: () => DebugSnapshot, advance: () => PumpResult, readSources: () => DebugSource[]);
|
|
3474
|
+
constructor(read: () => DebugSnapshot, advance: () => PumpResult, readSources: () => DebugSource[], evaluateIn: (body: string, frame: number | undefined) => DebugEvaluation);
|
|
3036
3475
|
/** Detached lowerings of the code actually loaded, including extensions. */
|
|
3037
3476
|
sources(): DebugSource[];
|
|
3038
3477
|
get isPaused(): boolean;
|
|
3039
3478
|
get current(): DebugPause | null;
|
|
3040
3479
|
breakAt(instructions: readonly DebugInstruction[]): void;
|
|
3041
3480
|
clearBreaks(): void;
|
|
3481
|
+
/**
|
|
3482
|
+
* Pause before a raised error unwinds (`error`), only before one no catch
|
|
3483
|
+
* or guard covers (`uncaughtError`), or before a Limit Fault. A catch
|
|
3484
|
+
* whose tests all decline still counts as covering, so `uncaughtError`
|
|
3485
|
+
* can miss an error such a catch lets past, but never stops at one that
|
|
3486
|
+
* is caught.
|
|
3487
|
+
*/
|
|
3042
3488
|
pauseOn(options: {
|
|
3043
3489
|
error?: boolean;
|
|
3044
3490
|
limitFault?: boolean;
|
|
3491
|
+
uncaughtError?: boolean;
|
|
3045
3492
|
}): void;
|
|
3046
3493
|
snapshot(): DebugSnapshot;
|
|
3494
|
+
/**
|
|
3495
|
+
* Runs a Handler body in the paused Run's Script, where Script Variables
|
|
3496
|
+
* read and write as in any of its Handlers, and the named locals of the
|
|
3497
|
+
* paused Run's frame `frame` (an index into its snapshot's frames, the
|
|
3498
|
+
* innermost by default) read as parameters but can't be assigned. The body
|
|
3499
|
+
* runs at once, alone, and writes no Trace: a send, wait, random draw or
|
|
3500
|
+
* Operation call fails it, as does running out of Fuel.
|
|
3501
|
+
*/
|
|
3502
|
+
evaluate(body: string, frame?: number): DebugEvaluation;
|
|
3047
3503
|
pausedTime(): number;
|
|
3048
3504
|
resume(): PumpResult;
|
|
3049
3505
|
step(): PumpResult;
|
|
@@ -3062,4 +3518,4 @@ declare class DebugController {
|
|
|
3062
3518
|
enter(pause: DebugPause): void;
|
|
3063
3519
|
}
|
|
3064
3520
|
//#endregion
|
|
3065
|
-
export {
|
|
3521
|
+
export { instant as $, Body as $n, Script as $t, ScriptSources as A, compileLibrary as An, syntaxSelector as Ar, FireOp as At, restore as B, defaultLimits as Bn, ReleaseHook as Bt, Report as C, consoleCapability as Cn, TokType as Cr, ChargeRequest as Ct, RunEvent as D, LibrarySource as Dn, SyntaxNode as Dr, EffectResult as Dt, RestoreResult as E, LibraryOptions as En, SyntaxErrorCode as Er, Cost as Et, TsGroupOptions as F, Run as Fn, Metering as Ft, RunStarted as G, waitUs as Gn, SegmentGrant as Gt, RunAccounting as H, loadScript as Hn, ScopeDecl as Ht, TsRestoreOptions as I, RunRecord as In, Operation as It, Value as J, LoadDiagnostic as Jn, SuspendingOp as Jt, Decimal as K, HostError as Kn, SegmentLifecycle as Kt, TsScript as L, Script$1 as Ln, Operations as Lt, SessionPort as M, LimitName as Mn, GrantContext as Mt, Settlement as N, Limits as Nn, ImmediateOp as Nt, SaveOptions as O, OperationRef as On, SyntaxRule as Or, ErrorDecl as Ot, TsGroup as P, Outcome as Pn, LimitReached as Pt, dec as Q, SendFailedReason as Qn, Group as Qt, Verdict as R, UnitLoadError as Rn, PlainArg as Rt, PumpedRequest as S, clockCapability as Sn, Mode as Sr, CapabilityDefiner as St, RestoreOptions as T, Library as Tn, SyntaxElement as Tr, CoordinatedLifecycle as Tt, RunAncestry as U, NotImplementedError as Un, SegmentContext as Ut, CausalWork as V, deliver as Vn, ReleaseReason as Vt, RunDiscarded as W, canConvert as Wn, SegmentCoordinator as Wt, bytes as X, MailboxFull as Xn, shape as Xt, bool as Y, LoadError as Yn, defineCapability as Yt, civilDate as Z, ScriptError as Zn, Core as Zt, LoadOptions as _, CalendarImpl as _n, SemanticScope as _r, PropDef as _t, DebugPause as a, userCapability as an, Operand as ar, quantity as at, PumpOptions as b, TimerImpl as bn, SourceSpan as br, Call as bt, RepeatedEffect as c, storeCapability as cn, Binding as cr, sourceForm as ct, Counters as d, SqlValue as dn, FunctionContract as dr, nowMicros as dt, Versions as en, BodyKind as er, isReadable as et, Decided as f, SqliteBinding as fn, LibraryExport as fr, parseInstant as ft, Inspection as g, localeCapability as gn, SemanticNode as gr, ObjectKindDef as gt, GroupOptions as h, LocaleImpl as hn, SemanticName as hr, ObjectKind as ht, DebugInstruction as i, UserImpl as in, Instruction as ir, num as it, SessionControls as j, replacementLibraries as jn, syntaxText as jr, Grant as jt, ScriptCodeRequest as k, codeIdentity as kn, Trivia as kr, FieldShape as kt, CancellationOptions as l, SqlParams as ln, BindingKind as lr, text as lt, EffectFailure as m, sqliteCapability as mn, SemanticElement as mr, ObjectElements as mt, DebugEvaluation as n, HttpImpl as nn, EventBranch as nr, map as nt, DebugSnapshot as o, StoreImpl as on, UnwindEntry as or, range as ot, Deciding as p, SqliteImpl as pn, NameRole as pr, HostObject as pt, Kind as q, HostErrorCode as qn, Shape as qt, DebugFrame as r, httpCapability as rn, EventEntry as rr, nothing as rt, DebugSource as s, add as sn, disassemble as sr, record as st, DebugController as t, coreVersions as tn, CodeUnit as tr, list as tt, CarryOver as u, SqlRows as un, ExportKind as ur, formatInstant as ut, Message as v, ConsoleImpl as vn, SemanticToken as vr, defineObjectKind as vt, Requested as w, timerCapability as wn, Token as wr, ChargeResult as wt, PumpResult as x, calendarCapability as xn, Lexer as xr, CapabilityDef as xt, PendingCall as y, Costs as yn, SemanticTree as yr, GrantDecls as yt, newGroup as z, callFunction as zn, PlainResult as zt };
|