@northtalk/ts 0.3.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 +1 -1
- package/{base64-DA7UgjG2.js → base64-Dtqaz_0A.js} +3 -3
- package/{binary-value-BcHcwVLO.d.ts → binary-value-Bb6HPDtM.d.ts} +1 -1
- package/{capabilities-BCw9uREe.js → capabilities-Bi5Qm6Fr.js} +10 -1
- package/{checker-Dmnm2SeU.js → checker-DMI4LiRm.js} +13 -5
- package/core-BzGUgjL6.d.ts +22 -0
- package/{debug-CY9x_Wsi.d.ts → debug-C72o2pZy.d.ts} +475 -45
- package/debug.d.ts +2 -2
- package/debug.js +1 -1
- package/{driver-CwmL5M32.d.ts → driver-ClV_UDEK.d.ts} +1 -1
- package/driver.d.ts +1 -1
- package/driver.js +1 -1
- package/{encoding-BUhsrLPK.js → encoding-C3Q7pIC9.js} +2 -2
- package/{engine-Dj9My1qX.js → engine-BpdGfAND.js} +6 -6
- package/{engine-CCzaBIoi.d.ts → engine-Dtby_FkE.d.ts} +2 -2
- package/{errors-CPPJmAAh.js → errors-BKJES3Zu.js} +1 -1
- package/{group-CnpvKoLw.js → group-vuUL2tq-.js} +5903 -1387
- package/http.d.ts +1 -1
- package/http.js +3 -3
- package/index-ByF5j53i.d.ts +779 -0
- package/index.d.ts +5 -659
- package/index.js +16 -15
- package/{inline-grants-Bvk-2aUL.js → inline-grants-Cx0Z9XAt.js} +25 -20
- package/{manifest-BTwN3NiP.js → manifest-Dw-8Unmf.js} +124 -5
- package/message-layer.d.ts +2 -2
- package/message-layer.js +2 -2
- package/notify.d.ts +1 -1
- package/notify.js +1 -1
- package/{objects-CawjPfhl.js → objects-BC4fS0vq.js} +1 -1
- package/{objects-BdWn56Ia.d.ts → objects-Dnqor7Gn.d.ts} +11 -3
- package/package.json +1 -1
- package/{readers-C2YMRjC3.js → readers-B5e5bBrY.js} +2 -2
- package/{readers-DMCXzY3X.d.ts → readers-DAFVvvq4.d.ts} +1 -1
- package/{request-pump-binary-Cp3RGZIJ.js → request-pump-binary-BjnyqXV5.js} +4 -4
- package/{router-BSREiSux.js → router-BCHEfs4x.js} +5 -5
- package/{router-BE5Tbbd7.d.ts → router-BspOCPA0.d.ts} +2 -2
- package/session.d.ts +40 -2
- package/session.js +109 -27
- package/setup.d.ts +1 -1
- package/setup.js +4 -4
- package/sha256-9CGf5BS_.js +168 -0
- package/sqlite.d.ts +4 -4
- package/sqlite.js +26 -20
- package/{store-DwESnByX.js → store-DTQa0lyE.js} +2 -2
- package/{store-capability-BYghoYSd.js → store-capability-BxXgiRM7.js} +4 -4
- package/store.d.ts +2 -2
- package/store.js +2 -2
- package/{user-capability-kDFbi3sm.js → user-capability-5-IvCeZI.js} +5 -5
- package/wasm.d.ts +10 -6
- package/wasm.js +50 -27
- package/core-D902b5Nu.d.ts +0 -14
- package/manifest-CeavwKxo.d.ts +0 -122
- package/sha256-B_kyYw3Z.js +0 -124
package/wasm.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as decodeValue, n as Json, o as readDisplay } from "./readers-
|
|
5
|
-
import { t as BinaryValueOptions } from "./binary-value-
|
|
2
|
+
import { $ as instant, $t as Script, At as FireOp, Bt as ReleaseHook, C as Report, Ct as ChargeRequest, Dn as LibrarySource, Dt as EffectResult, E as RestoreResult, Et as Cost, Ft as Metering, G as RunStarted, Gt as SegmentGrant, H as RunAccounting, Ht as ScopeDecl, It as Operation, J as Value, Jn as LoadDiagnostic, Jt as SuspendingOp, K as Decimal, Kn as HostError, Kt as SegmentLifecycle, Lt as Operations, Mn as LimitName, Mt as GrantContext, N as Settlement, Nn as Limits, Nt as ImmediateOp, On as OperationRef, Ot as ErrorDecl, Pn as Outcome, Pt as LimitReached, Q as dec, Qn as SendFailedReason, Qt as Group, R as Verdict, Rt as PlainArg, S as PumpedRequest, St as CapabilityDefiner, T as RestoreOptions, Tn as Library, Tt as CoordinatedLifecycle, U as RunAncestry, Ut as SegmentContext, V as CausalWork, Vt as ReleaseReason, W as RunDiscarded, Wt as SegmentCoordinator, X as bytes, Xn as MailboxFull, Xt as shape, Y as bool, Yn as LoadError, Yt as defineCapability, Z as civilDate, Zn as ScriptError, Zt as Core, _ as LoadOptions, _n as CalendarImpl, _t as PropDef, at as quantity, b as PumpOptions, bn as TimerImpl, bt as Call, d as Counters, dn as SqlValue, dt as nowMicros, en as Versions, f as Decided, fn as SqliteBinding, ft as parseInstant, g as Inspection, gt as ObjectKindDef, h as GroupOptions, hn as LocaleImpl, ht as ObjectKind, in as UserImpl, it as num, jt as Grant, kt as FieldShape, l as CancellationOptions, ln as SqlParams, lt as text, m as EffectFailure, mt as ObjectElements, nn as HttpImpl, nt as map, on as StoreImpl, ot as range, p as Deciding, pn as SqliteImpl, pt as HostObject, q as Kind, qn as HostErrorCode, qt as Shape, rt as nothing, sn as add, st as record, tt as list, u as CarryOver, un as SqlRows, ut as formatInstant, v as Message, vn as ConsoleImpl, w as Requested, wt as ChargeResult, x as PumpResult, xt as CapabilityDef, y as PendingCall, yn as Costs, yt as GrantDecls, zt as PlainResult } from "./debug-C72o2pZy.js";
|
|
3
|
+
import { A as ToValueOptions, C as handlersOf, D as encodeValue, M as toValue, N as talk, O as FromValueOptions, S as ScriptWithHandlers, T as encodeJson, b as createGroup, d as MessageDecl, f as exportManifest, h as inlineGrants, j as fromValue, k as PlainValue, m as InlineOperation, p as InlineFunction, u as ManifestSpec, v as CreateGroupOptions, w as decodeJson, x as Handlers, y as DrivenGroup } from "./index-ByF5j53i.js";
|
|
4
|
+
import { a as decodeValue, n as Json, o as readDisplay } from "./readers-DAFVvvq4.js";
|
|
5
|
+
import { t as BinaryValueOptions } from "./binary-value-Bb6HPDtM.js";
|
|
6
6
|
//#region src/wasm/reactor.d.ts
|
|
7
7
|
/** Text the reactor writes to stdout or stderr, such as a fatal error. */
|
|
8
8
|
type Diagnostics = (line: string) => void;
|
|
@@ -173,6 +173,8 @@ export declare class WasmGroup implements Group {
|
|
|
173
173
|
pump(now: bigint, o?: PumpOptions): PumpResult;
|
|
174
174
|
save(): Uint8Array;
|
|
175
175
|
fingerprint(): Uint8Array;
|
|
176
|
+
/** The State Fingerprint (ADR 0142): the Group's save without its save id. */
|
|
177
|
+
stateFingerprint(): Uint8Array;
|
|
176
178
|
inspect(): Inspection;
|
|
177
179
|
settle(callId: string, s: Settlement): Call<unknown> | undefined;
|
|
178
180
|
/** @internal */
|
|
@@ -208,13 +210,15 @@ export declare class WasmCore implements Core {
|
|
|
208
210
|
timerCapability: (impl: TimerImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
209
211
|
consoleCapability: (impl: ConsoleImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
210
212
|
storeCapability: (impl: StoreImpl, costs: Costs) => CapabilityDef<string>;
|
|
211
|
-
sqliteCapability: (impl: SqliteImpl, costs: Costs,
|
|
213
|
+
sqliteCapability: (impl: SqliteImpl, costs: Costs, perStep: number) => CapabilityDef<SqliteBinding>;
|
|
212
214
|
userCapability: (impl: UserImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
213
215
|
httpCapability: (impl: HttpImpl, costs: Costs) => CapabilityDef<unknown>;
|
|
214
216
|
defineObjectKind<N>(k: ObjectKindDef<N>): ObjectKind<N>;
|
|
215
217
|
/** Checked in a guest the Core keeps; each Group's guest compiles it again when added. */
|
|
216
218
|
compileLibrary(src: LibrarySource, imports?: Library[], declarations?: GrantDecls): Library;
|
|
217
219
|
newGroup(o: GroupOptions): WasmGroup;
|
|
220
|
+
/** A save's State Fingerprint, without restoring it (ADR 0142). */
|
|
221
|
+
stateFingerprint(save: Uint8Array): Uint8Array;
|
|
218
222
|
restore(save: Uint8Array, o: RestoreOptions): {
|
|
219
223
|
group: WasmGroup;
|
|
220
224
|
result: RestoreResult;
|
|
@@ -240,4 +244,4 @@ export declare const defaultLimits: Readonly<{
|
|
|
240
244
|
cleanupBudget: number;
|
|
241
245
|
}>;
|
|
242
246
|
//#endregion
|
|
243
|
-
export { type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ConsoleImpl, type CoordinatedLifecycle, type Core, type CoreOptions, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type DrivenGroup, type EffectFailure, type EffectResult, type ErrorDecl, type FieldShape, type FireOp, type FromValueOptions, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Kind, type Library, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operation, type OperationRef, type Operations, type Outcome, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, type RunAccounting, type RunAncestry, type RunDiscarded, type RunStarted, type ScopeDecl, type Script, ScriptError, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SendFailedReason, type Settlement, type Shape, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StoreImpl, type SuspendingOp, type TimerImpl, type ToValueOptions, type UserImpl, Value, type Verdict, type Versions, type WasmSource, add, bool, bytes, civilDate, createGroup, dec, decodeJson, decodeValue, encodeJson, encodeValue, exportManifest, formatInstant, fromValue, handlersOf, inlineGrants, instant, list, map, nothing, nowMicros, num, parseInstant, quantity, range, readDisplay, record, shape, talk, text, toValue };
|
|
247
|
+
export { type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CapabilityDefiner, type CarryOver, type CausalWork, type ChargeRequest, type ChargeResult, type ConsoleImpl, type CoordinatedLifecycle, type Core, type CoreOptions, type Cost, type Costs, type Counters, type CreateGroupOptions, type Decided, type Deciding, Decimal, type DrivenGroup, type EffectFailure, type EffectResult, type ErrorDecl, type FieldShape, type FireOp, type FromValueOptions, type Grant, type GrantContext, type GrantDecls, type Group, type GroupOptions, type Handlers, HostError, type HostErrorCode, type HostObject, type HttpImpl, type ImmediateOp, type InlineFunction, type InlineOperation, type Inspection, type Kind, type Library, type LibrarySource, type LimitName, LimitReached, type Limits, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type Metering, type ObjectElements, type ObjectKind, type ObjectKindDef, type Operation, type OperationRef, type Operations, type Outcome, type PendingCall, type PlainArg, type PlainResult, type PlainValue, type PropDef, type PumpOptions, type PumpResult, type PumpedRequest, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, type RunAccounting, type RunAncestry, type RunDiscarded, type RunStarted, type ScopeDecl, type Script, ScriptError, type ScriptWithHandlers, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type SendFailedReason, type Settlement, type Shape, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StoreImpl, type SuspendingOp, type TimerImpl, type ToValueOptions, type UserImpl, Value, type Verdict, type Versions, type WasmSource, add, bool, bytes, civilDate, createGroup, dec, decodeJson, decodeValue, encodeJson, encodeValue, exportManifest, formatInstant, fromValue, handlersOf, inlineGrants, instant, list, map, nothing, nowMicros, num, parseInstant, quantity, range, readDisplay, record, shape, talk, text, toValue };
|
package/wasm.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
import { G as record,
|
|
3
|
-
import { a as rebindObject, n as makeObject, t as defineObjectKind } from "./objects-
|
|
4
|
-
import { i as defineCapability, t as LimitReached, u as shape } from "./capabilities-
|
|
5
|
-
import {
|
|
2
|
+
import { G as record, H as quantity, K as requireArgs, Kt as formatInstant, L as nothing, N as map, Q as text, R as num, S as functionValue, T as instant, V as patternValue, W as range, Yt as nowMicros, Zt as parseInstant, c as Decimal, d as bytes, i as ScriptError, k as list, l as Value, m as civilDate, n as LoadError, o as invalidValue, q as requireValue, r as MailboxFull, s as sendFailed, t as HostError, u as bool, v as dec, z as objectValue } from "./errors-BKJES3Zu.js";
|
|
3
|
+
import { a as rebindObject, n as makeObject, t as defineObjectKind } from "./objects-BC4fS0vq.js";
|
|
4
|
+
import { i as defineCapability, t as LimitReached, u as shape } from "./capabilities-Bi5Qm6Fr.js";
|
|
5
|
+
import { ht as limitDefaults, n as toBase64, t as fromBase64 } from "./base64-Dtqaz_0A.js";
|
|
6
|
+
import { c as CallMeter, i as operationData, n as exportManifest, o as shapeData, s as invoke } from "./manifest-Dw-8Unmf.js";
|
|
6
7
|
import { n as trackOperation } from "./operation-promises-ClA1BTaS.js";
|
|
7
|
-
import { a as fromJson, c as readDisplay, l as readOrderedJSON, n as JsonObject, o as isJsonNumber, r as decodeValue, s as isJsonObject, t as JsonNumber } from "./readers-
|
|
8
|
-
import { i as standardChecks, n as quoteJSON, t as encodeValue } from "./encoding-
|
|
9
|
-
import { a as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { a as
|
|
13
|
-
import { a as encodeResult, c as isRequestPumpBinary, d as valueNode, i as encodeBinaryFrame, l as placeholderValues, n as decodeBinaryFrame, o as heldValue, r as decodeNeed, s as isBinaryNeed, t as callbacksFeature, u as requestPumpFeature } from "./request-pump-binary-Cp3RGZIJ.js";
|
|
8
|
+
import { a as fromJson, c as readDisplay, l as readOrderedJSON, n as JsonObject, o as isJsonNumber, r as decodeValue, s as isJsonObject, t as JsonNumber } from "./readers-B5e5bBrY.js";
|
|
9
|
+
import { i as standardChecks, n as quoteJSON, t as encodeValue } from "./encoding-C3Q7pIC9.js";
|
|
10
|
+
import { a as sqliteCapability, c as fromValue, i as httpCapability, l as toValue, n as createGroup, o as decodeJson, r as handlersOf, s as encodeJson, t as inlineGrants, u as talk } from "./inline-grants-Cx0Z9XAt.js";
|
|
11
|
+
import { n as localeCapability, t as userCapability } from "./user-capability-5-IvCeZI.js";
|
|
12
|
+
import { a as clockCapability, i as calendarCapability, l as timerCapability, o as consoleCapability, r as storeCapability, t as add } from "./store-capability-BxXgiRM7.js";
|
|
13
|
+
import { a as encodeResult, c as isRequestPumpBinary, d as valueNode, i as encodeBinaryFrame, l as placeholderValues, n as decodeBinaryFrame, o as heldValue, r as decodeNeed, s as isBinaryNeed, t as callbacksFeature, u as requestPumpFeature } from "./request-pump-binary-BjnyqXV5.js";
|
|
14
14
|
//#region src/wasm/wire.ts
|
|
15
15
|
const raw = Symbol("raw JSON");
|
|
16
16
|
const sep = Symbol("separator");
|
|
@@ -461,6 +461,8 @@ var WasmGroup = class {
|
|
|
461
461
|
#decisions = /* @__PURE__ */ new Map();
|
|
462
462
|
#runs = /* @__PURE__ */ new Map();
|
|
463
463
|
#calls = /* @__PURE__ */ new Map();
|
|
464
|
+
/** Each queued charge request's future, until a Pump reports it. */
|
|
465
|
+
#charges = /* @__PURE__ */ new Map();
|
|
464
466
|
#failureDetails = /* @__PURE__ */ new Map();
|
|
465
467
|
#propertyDetails = [];
|
|
466
468
|
#effectDetails = /* @__PURE__ */ new Map();
|
|
@@ -586,6 +588,7 @@ var WasmGroup = class {
|
|
|
586
588
|
now: parseInstant(textOf(field(need, "now"))),
|
|
587
589
|
signal: pending.abort.signal,
|
|
588
590
|
charge,
|
|
591
|
+
requestCharge: (fuel) => this.#requestCharge(id, fuel),
|
|
589
592
|
answer: (v, late) => this.#settleCall(id, pending, "answer", {
|
|
590
593
|
value: encode(this.#codec, v),
|
|
591
594
|
fuel: late?.fuel
|
|
@@ -593,6 +596,21 @@ var WasmGroup = class {
|
|
|
593
596
|
fail: (e) => this.#settleCall(id, pending, "fail", { error: e instanceof ScriptError ? this.#failure(e) : void 0 })
|
|
594
597
|
});
|
|
595
598
|
}
|
|
599
|
+
#requestCharge(call, fuel) {
|
|
600
|
+
const ok = this.send("request-charge", {
|
|
601
|
+
call,
|
|
602
|
+
fuel: Number.isSafeInteger(fuel) ? fuel : "invalid"
|
|
603
|
+
});
|
|
604
|
+
const id = textOf(field(ok, "request"));
|
|
605
|
+
const result = new Promise((resolve) => {
|
|
606
|
+
this.#charges.set(id, resolve);
|
|
607
|
+
});
|
|
608
|
+
this.#ready();
|
|
609
|
+
return {
|
|
610
|
+
id,
|
|
611
|
+
result
|
|
612
|
+
};
|
|
613
|
+
}
|
|
596
614
|
#settleCall(id, pending, m, fields) {
|
|
597
615
|
if (pending.starting) {
|
|
598
616
|
if (!pending.queued) {
|
|
@@ -638,27 +656,19 @@ var WasmGroup = class {
|
|
|
638
656
|
}
|
|
639
657
|
const automatic = boolOf(field(need, "automatic")) ?? false;
|
|
640
658
|
const left = intOf(field(need, "fuelLeft"));
|
|
641
|
-
|
|
642
|
-
const charge = (fuel) => {
|
|
643
|
-
if (!starting || automatic) throw new HostError("invalid value", "Charge only while starting");
|
|
644
|
-
if (!Number.isSafeInteger(fuel) || fuel < 0) throw new HostError("invalid value", "Fuel must be a whole number");
|
|
645
|
-
if (reached || left !== void 0 && charged + fuel > left) {
|
|
646
|
-
reached = true;
|
|
647
|
-
throw new LimitReached("the Run can’t cover this charge");
|
|
648
|
-
}
|
|
649
|
-
charged += fuel;
|
|
650
|
-
};
|
|
659
|
+
const meter = new CallMeter((fuel, charged) => left === void 0 || charged + fuel <= left);
|
|
651
660
|
const pending = {
|
|
652
661
|
abort: new AbortController(),
|
|
653
662
|
live: true,
|
|
654
663
|
starting: true
|
|
655
664
|
};
|
|
656
|
-
const call = this.#callOf(need, grant, pending, charge);
|
|
665
|
+
const call = this.#callOf(need, grant, pending, meter.charge);
|
|
657
666
|
const out = {};
|
|
658
667
|
try {
|
|
659
668
|
out.charged = 0;
|
|
660
|
-
const
|
|
661
|
-
|
|
669
|
+
const invoke = () => this.#invoke(op, call, args, pending);
|
|
670
|
+
const result = automatic ? invoke() : meter.starting(invoke);
|
|
671
|
+
if (meter.refused) out.limit = true;
|
|
662
672
|
else if (op.mode === "suspending") out.started = true;
|
|
663
673
|
else if (op.mode === "fire-and-forget") out.done = true;
|
|
664
674
|
else try {
|
|
@@ -667,7 +677,7 @@ var WasmGroup = class {
|
|
|
667
677
|
out.hostError = detailOf(error);
|
|
668
678
|
}
|
|
669
679
|
} catch (error) {
|
|
670
|
-
if (
|
|
680
|
+
if (meter.refused || isLimitReached(error)) out.limit = true;
|
|
671
681
|
else if (error instanceof ScriptError) try {
|
|
672
682
|
out.fail = this.#failure(error);
|
|
673
683
|
} catch (encodeError) {
|
|
@@ -675,10 +685,9 @@ var WasmGroup = class {
|
|
|
675
685
|
}
|
|
676
686
|
else out.hostError = detailOf(error);
|
|
677
687
|
} finally {
|
|
678
|
-
starting = false;
|
|
679
688
|
pending.starting = false;
|
|
680
689
|
}
|
|
681
|
-
out.charged = charged;
|
|
690
|
+
out.charged = meter.charged;
|
|
682
691
|
if (typeof out.hostError === "string") this.#failureDetails.set(id, out.hostError);
|
|
683
692
|
if (op.mode === "suspending" && out.started) {
|
|
684
693
|
if (pending.live) this.#calls.set(id, pending);
|
|
@@ -878,6 +887,10 @@ var WasmGroup = class {
|
|
|
878
887
|
const unhandled = new Set(rows.flatMap((r) => r.kind === "unhandled" ? [r.delivery] : []));
|
|
879
888
|
for (const r of rows) {
|
|
880
889
|
switch (r.kind) {
|
|
890
|
+
case "charge result":
|
|
891
|
+
this.#charges.get(r.request)?.(r);
|
|
892
|
+
this.#charges.delete(r.request);
|
|
893
|
+
break;
|
|
881
894
|
case "run started":
|
|
882
895
|
if (r.delivery) this.#runs.set(r.run, r.delivery);
|
|
883
896
|
break;
|
|
@@ -1252,6 +1265,10 @@ var WasmGroup = class {
|
|
|
1252
1265
|
fingerprint() {
|
|
1253
1266
|
return bytesOfFrame(field(this.worker("fingerprint"), "fingerprint"));
|
|
1254
1267
|
}
|
|
1268
|
+
/** The State Fingerprint (ADR 0142): the Group's save without its save id. */
|
|
1269
|
+
stateFingerprint() {
|
|
1270
|
+
return bytesOfFrame(field(this.worker("state-fingerprint"), "stateFingerprint"));
|
|
1271
|
+
}
|
|
1255
1272
|
inspect() {
|
|
1256
1273
|
const ok = this.worker("inspect");
|
|
1257
1274
|
return { scripts: listOf(field(ok, "scripts")).map((s) => {
|
|
@@ -1353,6 +1370,7 @@ var WasmGroup = class {
|
|
|
1353
1370
|
return {
|
|
1354
1371
|
reports: this.#reports(ok),
|
|
1355
1372
|
variablesOnly: boolOf(field(ok, "variablesOnly")) ?? false,
|
|
1373
|
+
reloaded: textsOf(field(ok, "reloaded")),
|
|
1356
1374
|
pending,
|
|
1357
1375
|
discardedRuns: textsOf(field(ok, "discardedRuns")),
|
|
1358
1376
|
disposed: listOf(field(ok, "disposed")).map((d) => textsOf(d)),
|
|
@@ -1718,6 +1736,11 @@ var WasmCore = class {
|
|
|
1718
1736
|
newGroup(o) {
|
|
1719
1737
|
return new WasmGroup(this.#groupCore, o);
|
|
1720
1738
|
}
|
|
1739
|
+
/** A save's State Fingerprint, without restoring it (ADR 0142). */
|
|
1740
|
+
stateFingerprint(save) {
|
|
1741
|
+
const ok = this.#libraries.exchange("save-state-fingerprint", { save: bytesFrame(save) });
|
|
1742
|
+
return bytesOfFrame(field(ok, "stateFingerprint"));
|
|
1743
|
+
}
|
|
1721
1744
|
restore(save, o) {
|
|
1722
1745
|
const group = new WasmGroup(this.#groupCore, o, {
|
|
1723
1746
|
save,
|
package/core-D902b5Nu.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import { En as compileLibrary, R as newGroup, _t as defineObjectKind, qt as Core, z as restore } from "./debug-CY9x_Wsi.js";
|
|
3
|
-
//#region src/core.d.ts
|
|
4
|
-
/** The TS Core: the embedding interface's Core, with its Groups typed as TsGroup. */
|
|
5
|
-
type TsCore = Omit<Core, 'compileLibrary' | 'defineObjectKind' | 'newGroup' | 'restore'> & {
|
|
6
|
-
compileLibrary: typeof compileLibrary;
|
|
7
|
-
defineObjectKind: typeof defineObjectKind;
|
|
8
|
-
newGroup: typeof newGroup;
|
|
9
|
-
restore: typeof restore;
|
|
10
|
-
};
|
|
11
|
-
/** Return the process-wide Core, also used by the free-function helpers. */
|
|
12
|
-
declare const createCore: () => TsCore;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { createCore as n, TsCore as t };
|
package/manifest-CeavwKxo.d.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/// <reference lib="esnext.disposable" />
|
|
2
|
-
import { G as Decimal, Jt as Group, Ot as Grant, Ut as Shape, Yt as Script, g as LoadOptions, mt as ObjectKind, q as Value, qt as Core, xn as Library } from "./debug-CY9x_Wsi.js";
|
|
3
|
-
import { n as Drive, r as DrivenGroupOptions } from "./driver-CwmL5M32.js";
|
|
4
|
-
//#region src/talk.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Dedents NorthTalk source; rejects JS interpolation.
|
|
7
|
-
*
|
|
8
|
-
* Write NorthTalk's own interpolation as `\${…}` and its backticks as `` \` ``.
|
|
9
|
-
* Pass values as Request arguments instead of splicing them into source. The
|
|
10
|
-
* longest whitespace prefix shared by every non-blank line is removed, compared
|
|
11
|
-
* exactly, so tabs and spaces never match each other.
|
|
12
|
-
*/
|
|
13
|
-
declare const talk: (strings: TemplateStringsArray, ...values: unknown[]) => string;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/plain.d.ts
|
|
16
|
-
/** Plain JS data, as `fromValue` writes it (ADR 0119). */
|
|
17
|
-
type PlainValue = null | boolean | string | Decimal | Uint8Array | Value | PlainValue[] | {
|
|
18
|
-
[key: string]: PlainValue;
|
|
19
|
-
} | Map<string, PlainValue>;
|
|
20
|
-
type ToValueOptions = {
|
|
21
|
-
/**
|
|
22
|
-
* `integer` reads safe integers through `num`; `decimal` uses `num` for
|
|
23
|
-
* any JS number. The default refuses JS numbers.
|
|
24
|
-
*/
|
|
25
|
-
numbers?: 'refuse' | 'integer' | 'decimal';
|
|
26
|
-
};
|
|
27
|
-
type FromValueOptions = {
|
|
28
|
-
maps?: 'object' | 'map';
|
|
29
|
-
numbers?: 'decimal' | 'string';
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Plain JS data to a Value by the named constructors (ADR 0119). Anything
|
|
33
|
-
* the table doesn't name, and cyclic data, throws `invalid value`.
|
|
34
|
-
*/
|
|
35
|
-
declare const toValue: (plain: unknown, options?: ToValueOptions) => Value;
|
|
36
|
-
/** A Value as plain JS data (ADR 0119); kinds with no JS form stay Values. */
|
|
37
|
-
declare const fromValue: (v: Value, options?: FromValueOptions) => PlainValue;
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/encoding.d.ts
|
|
40
|
-
/**
|
|
41
|
-
* A Message Layer adapter's own spelling of a Function Value or a Text
|
|
42
|
-
* Pattern, which the Value Encoding doesn't hold.
|
|
43
|
-
*/
|
|
44
|
-
type AdapterEncoder = (v: Value) => string;
|
|
45
|
-
declare const encodeValue: (value: Value, adapter?: AdapterEncoder) => string;
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/json.d.ts
|
|
48
|
-
/** Read exact decimal digits, NFC strings and insertion-ordered maps. */
|
|
49
|
-
declare const decodeJson: (source: string) => Value;
|
|
50
|
-
/** Compact JSON, with canonical numbers and chapter 7's string escapes. */
|
|
51
|
-
declare const encodeJson: (value: Value) => string;
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/handlers.d.ts
|
|
54
|
-
/** Untyped Handler calls accept safe-integer JS numbers and plain data. */
|
|
55
|
-
type Handlers = {
|
|
56
|
-
[name: string]: (...args: (PlainValue | number | bigint)[]) => Promise<PlainValue>;
|
|
57
|
-
};
|
|
58
|
-
/** The Host supplies T without runtime checking of its arguments or results. */
|
|
59
|
-
type ScriptWithHandlers<T = Handlers> = Script & {
|
|
60
|
-
readonly handlers: T;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Calls invoke with integer-mode toValue arguments and default fromValue answers.
|
|
64
|
-
* The Script's existing driver or Host Pump loop still runs the Requests.
|
|
65
|
-
* Promise hooks, symbols and non-message properties read as undefined.
|
|
66
|
-
*/
|
|
67
|
-
declare const handlersOf: <T = Handlers>(script: Script) => T;
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/group-helper.d.ts
|
|
70
|
-
/** A Group whose driver closes explicitly or at the end of an `await using` scope. */
|
|
71
|
-
type DrivenGroup = Omit<Group, 'load'> & Pick<Drive, 'close' | typeof Symbol.asyncDispose> & {
|
|
72
|
-
load<T = Handlers>(o: LoadOptions): ScriptWithHandlers<T>;
|
|
73
|
-
};
|
|
74
|
-
/** The Zig Host Adapter requires its asynchronously created Core. */
|
|
75
|
-
type CreateGroupOptions = DrivenGroupOptions & {
|
|
76
|
-
core: Core;
|
|
77
|
-
};
|
|
78
|
-
/** Creates a driven Group on the supplied Core; close has the driver's shutdown semantics. */
|
|
79
|
-
declare const createGroup: (o: CreateGroupOptions) => DrivenGroup;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/inline-grants.d.ts
|
|
82
|
-
/** Argument and result types are supplied by the Host, without runtime checking. */
|
|
83
|
-
type InlineFunction = (...args: never[]) => unknown;
|
|
84
|
-
type InlineOperation = InlineFunction | {
|
|
85
|
-
arity?: number;
|
|
86
|
-
fn: InlineFunction;
|
|
87
|
-
} | {
|
|
88
|
-
arity?: number;
|
|
89
|
-
async: InlineFunction;
|
|
90
|
-
maxPendingMs?: number;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Defines one Capability per key and grants all its Operations. Arguments use
|
|
94
|
-
* default fromValue; results use integer-mode toValue. Arity is fn.length unless
|
|
95
|
-
* overridden, including for async functions, which also receive a final signal.
|
|
96
|
-
*/
|
|
97
|
-
declare const inlineGrants: (capabilities: Readonly<Record<string, Readonly<Record<string, InlineOperation>>>>) => Record<string, Grant<void>>;
|
|
98
|
-
//#endregion
|
|
99
|
-
//#region src/manifest.d.ts
|
|
100
|
-
type MessageDecl = {
|
|
101
|
-
args?: readonly Shape[];
|
|
102
|
-
description?: string;
|
|
103
|
-
/** NorthTalk source, each sending this message. */
|
|
104
|
-
examples?: readonly string[];
|
|
105
|
-
name: string;
|
|
106
|
-
receivers?: readonly ObjectKind[];
|
|
107
|
-
};
|
|
108
|
-
type ManifestSpec = {
|
|
109
|
-
grants: Readonly<Record<string, Grant<any>>>;
|
|
110
|
-
kind: string;
|
|
111
|
-
libraries?: readonly Library[];
|
|
112
|
-
messages?: readonly MessageDecl[];
|
|
113
|
-
objectKinds?: readonly ObjectKind[];
|
|
114
|
-
objects?: Readonly<Record<string, ObjectKind>>;
|
|
115
|
-
/** The Owner Kind: one of objectKinds, the kind of `me` for tooling. */
|
|
116
|
-
ownerKind?: ObjectKind;
|
|
117
|
-
version: string;
|
|
118
|
-
};
|
|
119
|
-
/** Chapter 9's deterministic JSON file, ending in LF; never calls the Host. */
|
|
120
|
-
declare const exportManifest: (m: ManifestSpec) => string;
|
|
121
|
-
//#endregion
|
|
122
|
-
export { PlainValue as _, InlineOperation as a, toValue as b, DrivenGroup as c, ScriptWithHandlers as d, handlersOf as f, FromValueOptions as g, encodeValue as h, InlineFunction as i, createGroup as l, encodeJson as m, MessageDecl as n, inlineGrants as o, decodeJson as p, exportManifest as r, CreateGroupOptions as s, ManifestSpec as t, Handlers as u, ToValueOptions as v, talk as x, fromValue as y };
|
package/sha256-B_kyYw3Z.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/sha256.ts
|
|
3
|
-
const K = new Uint32Array([
|
|
4
|
-
1116352408,
|
|
5
|
-
1899447441,
|
|
6
|
-
3049323471,
|
|
7
|
-
3921009573,
|
|
8
|
-
961987163,
|
|
9
|
-
1508970993,
|
|
10
|
-
2453635748,
|
|
11
|
-
2870763221,
|
|
12
|
-
3624381080,
|
|
13
|
-
310598401,
|
|
14
|
-
607225278,
|
|
15
|
-
1426881987,
|
|
16
|
-
1925078388,
|
|
17
|
-
2162078206,
|
|
18
|
-
2614888103,
|
|
19
|
-
3248222580,
|
|
20
|
-
3835390401,
|
|
21
|
-
4022224774,
|
|
22
|
-
264347078,
|
|
23
|
-
604807628,
|
|
24
|
-
770255983,
|
|
25
|
-
1249150122,
|
|
26
|
-
1555081692,
|
|
27
|
-
1996064986,
|
|
28
|
-
2554220882,
|
|
29
|
-
2821834349,
|
|
30
|
-
2952996808,
|
|
31
|
-
3210313671,
|
|
32
|
-
3336571891,
|
|
33
|
-
3584528711,
|
|
34
|
-
113926993,
|
|
35
|
-
338241895,
|
|
36
|
-
666307205,
|
|
37
|
-
773529912,
|
|
38
|
-
1294757372,
|
|
39
|
-
1396182291,
|
|
40
|
-
1695183700,
|
|
41
|
-
1986661051,
|
|
42
|
-
2177026350,
|
|
43
|
-
2456956037,
|
|
44
|
-
2730485921,
|
|
45
|
-
2820302411,
|
|
46
|
-
3259730800,
|
|
47
|
-
3345764771,
|
|
48
|
-
3516065817,
|
|
49
|
-
3600352804,
|
|
50
|
-
4094571909,
|
|
51
|
-
275423344,
|
|
52
|
-
430227734,
|
|
53
|
-
506948616,
|
|
54
|
-
659060556,
|
|
55
|
-
883997877,
|
|
56
|
-
958139571,
|
|
57
|
-
1322822218,
|
|
58
|
-
1537002063,
|
|
59
|
-
1747873779,
|
|
60
|
-
1955562222,
|
|
61
|
-
2024104815,
|
|
62
|
-
2227730452,
|
|
63
|
-
2361852424,
|
|
64
|
-
2428436474,
|
|
65
|
-
2756734187,
|
|
66
|
-
3204031479,
|
|
67
|
-
3329325298
|
|
68
|
-
]);
|
|
69
|
-
const rotr = (x, n) => x >>> n | x << 32 - n;
|
|
70
|
-
const sha256 = (input) => {
|
|
71
|
-
const bytes = typeof input === "string" ? new TextEncoder().encode(input) : input;
|
|
72
|
-
const length = bytes.length;
|
|
73
|
-
const padded = new Uint8Array(Math.ceil((length + 9) / 64) * 64);
|
|
74
|
-
padded.set(bytes);
|
|
75
|
-
padded[length] = 128;
|
|
76
|
-
const view = new DataView(padded.buffer);
|
|
77
|
-
view.setUint32(padded.length - 8, Math.floor(length / 536870912));
|
|
78
|
-
view.setUint32(padded.length - 4, length * 8 >>> 0);
|
|
79
|
-
const h = new Uint32Array([
|
|
80
|
-
1779033703,
|
|
81
|
-
3144134277,
|
|
82
|
-
1013904242,
|
|
83
|
-
2773480762,
|
|
84
|
-
1359893119,
|
|
85
|
-
2600822924,
|
|
86
|
-
528734635,
|
|
87
|
-
1541459225
|
|
88
|
-
]);
|
|
89
|
-
const w = /* @__PURE__ */ new Uint32Array(64);
|
|
90
|
-
for (let block = 0; block < padded.length; block += 64) {
|
|
91
|
-
for (let i = 0; i < 16; i++) w[i] = view.getUint32(block + i * 4);
|
|
92
|
-
for (let i = 16; i < 64; i++) {
|
|
93
|
-
const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ w[i - 15] >>> 3;
|
|
94
|
-
const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ w[i - 2] >>> 10;
|
|
95
|
-
w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
|
|
96
|
-
}
|
|
97
|
-
let a = h[0], b = h[1], c = h[2], d = h[3], e = h[4], f = h[5], g = h[6], hh = h[7];
|
|
98
|
-
for (let i = 0; i < 64; i++) {
|
|
99
|
-
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
100
|
-
const ch = e & f ^ ~e & g;
|
|
101
|
-
const t1 = hh + s1 + ch + K[i] + w[i] >>> 0;
|
|
102
|
-
const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
|
|
103
|
-
hh = g;
|
|
104
|
-
g = f;
|
|
105
|
-
f = e;
|
|
106
|
-
e = d + t1 >>> 0;
|
|
107
|
-
d = c;
|
|
108
|
-
c = b;
|
|
109
|
-
b = a;
|
|
110
|
-
a = t1 + t2 >>> 0;
|
|
111
|
-
}
|
|
112
|
-
h[0] = h[0] + a >>> 0;
|
|
113
|
-
h[1] = h[1] + b >>> 0;
|
|
114
|
-
h[2] = h[2] + c >>> 0;
|
|
115
|
-
h[3] = h[3] + d >>> 0;
|
|
116
|
-
h[4] = h[4] + e >>> 0;
|
|
117
|
-
h[5] = h[5] + f >>> 0;
|
|
118
|
-
h[6] = h[6] + g >>> 0;
|
|
119
|
-
h[7] = h[7] + hh >>> 0;
|
|
120
|
-
}
|
|
121
|
-
return Array.from(h, (x) => x.toString(16).padStart(8, "0")).join("");
|
|
122
|
-
};
|
|
123
|
-
//#endregion
|
|
124
|
-
export { sha256 as t };
|