@northtalk/ts 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,273 @@
1
+ import { Ct as integerOf, V as text, c as bool, g as decimalParts, k as map, t as HostError, wt as isInteger } from "./errors-DHwz1Vho.js";
2
+ import { r as registerStandardChecks, u as ScriptError, vt as defineCapability, xt as shape } from "./encoding-DWlbPq-e.js";
3
+ import { c as fixed, s as costOf } from "./store-capability-CDoVafZL.js";
4
+ //#region src/locale-tag.ts
5
+ const grandfathered = /^(?:en-gb-oed|i-(?:ami|bnn|default|enochian|hak|klingon|lux|mingo|navajo|pwn|tao|tay|tsu)|sgn-(?:be-fr|be-nl|ch-de))$/i;
6
+ const alpha = /^[a-z]+$/i;
7
+ const variant = /^(?:[\da-z]{5,8}|\d[\da-z]{3})$/i;
8
+ const wellFormedLocale = (tag) => {
9
+ if (!tag.length || /[^\da-z-]/i.test(tag)) return false;
10
+ if (grandfathered.test(tag)) return true;
11
+ const parts = tag.split("-");
12
+ if (parts.some((part) => part.length < 1 || part.length > 8)) return false;
13
+ let i = 0;
14
+ const language = parts[i++];
15
+ if (/^x$/i.test(language)) return parts.length > 1;
16
+ if (language.length < 2 || !alpha.test(language)) return false;
17
+ if (language.length <= 3) for (let extlangs = 0; extlangs < 3 && /^[a-z]{3}$/i.test(parts[i] ?? ""); extlangs++) i++;
18
+ if (/^[a-z]{4}$/i.test(parts[i] ?? "")) i++;
19
+ if (/^(?:[a-z]{2}|\d{3})$/i.test(parts[i] ?? "")) i++;
20
+ while (variant.test(parts[i] ?? "")) i++;
21
+ while (/^[\da-wyz]$/i.test(parts[i] ?? "")) {
22
+ i++;
23
+ const start = i;
24
+ while (i < parts.length && parts[i].length >= 2) i++;
25
+ if (i === start) return false;
26
+ }
27
+ if (/^x$/i.test(parts[i] ?? "")) return i + 1 < parts.length;
28
+ return i === parts.length;
29
+ };
30
+ //#endregion
31
+ //#region src/locale-capability.ts
32
+ const collationShape = shape.map({
33
+ sensitivity: {
34
+ optional: true,
35
+ shape: shape.text
36
+ },
37
+ numeric: {
38
+ optional: true,
39
+ shape: shape.bool
40
+ }
41
+ });
42
+ const nameShape = shape.map({
43
+ width: {
44
+ optional: true,
45
+ shape: shape.text
46
+ },
47
+ form: {
48
+ optional: true,
49
+ shape: shape.text
50
+ }
51
+ });
52
+ const textList = shape.listOf(shape.text);
53
+ const symbolsShape = shape.map({
54
+ decimal: shape.text,
55
+ group: shape.text,
56
+ minus: shape.text,
57
+ digits: textList,
58
+ primaryGroup: shape.number,
59
+ secondaryGroup: shape.number,
60
+ minGrouping: shape.number
61
+ });
62
+ const collationDefaults = map([["sensitivity", text("variant")], ["numeric", bool(false)]]);
63
+ const nameDefaults = map([["width", text("long")], ["form", text("format")]]);
64
+ const words = {
65
+ sensitivity: [
66
+ "base",
67
+ "accent",
68
+ "case",
69
+ "variant"
70
+ ],
71
+ width: [
72
+ "long",
73
+ "short",
74
+ "narrow"
75
+ ],
76
+ form: ["format", "standalone"]
77
+ };
78
+ const domainError = (name, value) => {
79
+ throw new ScriptError("out of domain", [["function", text(name)], ["value", value]], true);
80
+ };
81
+ const optionalParts = (args, required, options) => {
82
+ const first = args[required];
83
+ return {
84
+ options: options && first?.kind === "map" ? first : void 0,
85
+ tag: options && first?.kind !== "text" ? args[required + 1]?.asText() : first?.asText()
86
+ };
87
+ };
88
+ const checkArguments = (name, required, options, args, binding) => {
89
+ if (options && args.length > required + 1 && args[required]?.kind === "text") domainError(name, args[required]);
90
+ const parts = optionalParts(args, required, options);
91
+ for (const [key, value] of parts.options?.entries() ?? []) if (words[key] && !words[key].includes(value.asText())) domainError(name, value);
92
+ const tag = parts.tag ?? binding;
93
+ if (typeof tag !== "string") throw new HostError("invalid value", "Locale binding must be a tag");
94
+ if (!wellFormedLocale(tag)) throw new ScriptError("bad locale", [["locale", text(tag)]], true);
95
+ };
96
+ const withDefaults = (given, defaults) => map(defaults.entries().map(([key, value]) => [key, given && given.get(key).kind !== "nothing" ? given.get(key) : value]));
97
+ const integer = (value) => {
98
+ const n = value.kind === "number" ? decimalParts(value.asDecimal()) : void 0;
99
+ return n && isInteger(n) ? integerOf(n) : void 0;
100
+ };
101
+ const validRank = (value, args) => {
102
+ const texts = args[0];
103
+ const wanted = /* @__PURE__ */ new Set();
104
+ for (let i = 1; i <= texts.length; i++) wanted.add(texts.index(i).asText());
105
+ const entries = value.entries();
106
+ if (entries.length !== wanted.size) return false;
107
+ const ranks = /* @__PURE__ */ new Set();
108
+ for (const [key, rank] of entries) {
109
+ const n = integer(rank);
110
+ if (!wanted.has(key) || n === void 0 || n < 1n || n > BigInt(entries.length)) return false;
111
+ ranks.add(n);
112
+ }
113
+ for (let i = 1; i <= ranks.size; i++) if (!ranks.has(BigInt(i))) return false;
114
+ return true;
115
+ };
116
+ const validSymbols = (value) => {
117
+ for (const key of [
118
+ "decimal",
119
+ "group",
120
+ "minus"
121
+ ]) if (!value.get(key).asText()) return false;
122
+ const digits = value.get("digits");
123
+ if (digits.length !== 10) return false;
124
+ for (let i = 1; i <= 10; i++) if (!digits.index(i).asText()) return false;
125
+ return [
126
+ "primaryGroup",
127
+ "secondaryGroup",
128
+ "minGrouping"
129
+ ].every((key) => (integer(value.get(key)) ?? 0n) >= 1n);
130
+ };
131
+ /** The Host resolves tags and provides every Operation for each Locale. */
132
+ const localeCapability = (impl, costs) => {
133
+ for (const name of [
134
+ "compare",
135
+ "rank",
136
+ "upper",
137
+ "lower",
138
+ "numberSymbols",
139
+ "monthNames",
140
+ "dayNames",
141
+ "tag"
142
+ ]) if (!impl || typeof impl[name] !== "function") throw new HostError("invalid value", `Locale needs ${name}`);
143
+ const operations = {};
144
+ const add = (name, args, result, doCall, options, resultCheck) => {
145
+ const required = args.length;
146
+ const optionShape = options === collationDefaults ? collationShape : nameShape;
147
+ const op = {
148
+ mode: "immediate",
149
+ args: [
150
+ ...args,
151
+ ...options ? [shape.optional(shape.oneOf(optionShape, shape.text))] : [],
152
+ shape.optional(shape.text)
153
+ ],
154
+ result,
155
+ errors: [],
156
+ cost: costOf(costs, name),
157
+ do: (call, ...values) => {
158
+ const parts = optionalParts(values, required, !!options);
159
+ return doCall(call, values, options ? withDefaults(parts.options, options) : map([]), parts.tag);
160
+ }
161
+ };
162
+ registerStandardChecks(op, {
163
+ arguments: (values, binding) => checkArguments(name, required, !!options, values, binding),
164
+ ...resultCheck ? { result: resultCheck } : {}
165
+ });
166
+ operations[name] = op;
167
+ };
168
+ add("compare", [shape.text, shape.text], shape.number, (call, args, opts, tag) => impl.compare(call, args[0], args[1], opts, tag), collationDefaults, (value) => {
169
+ const n = integer(value);
170
+ return n !== void 0 && n >= -1n && n <= 1n;
171
+ });
172
+ add("rank", [textList], shape.openMap({}), (call, args, opts, tag) => impl.rank(call, args[0], opts, tag), collationDefaults, validRank);
173
+ add("upper", [shape.text], shape.text, (call, args, _opts, tag) => impl.upper(call, args[0], tag));
174
+ add("lower", [shape.text], shape.text, (call, args, _opts, tag) => impl.lower(call, args[0], tag));
175
+ add("numberSymbols", [], symbolsShape, (call, _args, _opts, tag) => impl.numberSymbols(call, tag), void 0, validSymbols);
176
+ add("monthNames", [], textList, (call, _args, opts, tag) => impl.monthNames(call, opts, tag), nameDefaults, (value) => value.length === 12);
177
+ add("dayNames", [], textList, (call, _args, opts, tag) => impl.dayNames(call, opts, tag), nameDefaults, (value) => value.length === 7);
178
+ add("tag", [], shape.text, (call, _args, _opts, tag) => impl.tag(call, tag), void 0, (value) => wellFormedLocale(value.asText()));
179
+ return fixed(defineCapability("locale", operations));
180
+ };
181
+ //#endregion
182
+ //#region src/user-capability.ts
183
+ /** Every `confirm`, `choose` and `enter` waits as long as `console`'s `read`. */
184
+ const USER_MAX_PENDING_MS = 2147483647;
185
+ const optionalText = shape.optional(shape.text);
186
+ const options = (fields) => shape.optional(shape.map(Object.fromEntries(Object.entries(fields).map(([key, s]) => [key, {
187
+ optional: true,
188
+ shape: s
189
+ }]))));
190
+ const userBusy = [{
191
+ code: "user busy",
192
+ fields: {}
193
+ }];
194
+ const itemsOf = (list) => Array.from({ length: list.length }, (_, i) => list.index(i + 1));
195
+ const option = (options, key) => {
196
+ const value = options?.kind === "map" ? options.get(key) : void 0;
197
+ return value?.kind === "nothing" ? void 0 : value;
198
+ };
199
+ const optionText = (options, key) => option(options, key)?.asText() ?? "";
200
+ const multipleOf = (options) => option(options, "multiple")?.asBool() === true;
201
+ const chosen = (answer, args) => {
202
+ if (answer.kind === "nothing") return true;
203
+ const items = itemsOf(args[0]);
204
+ if (!multipleOf(args[1])) return answer.kind === "text" && items.some((item) => item.equals(answer));
205
+ if (answer.kind !== "list") return false;
206
+ let at = 0;
207
+ for (const item of itemsOf(answer)) {
208
+ while (at < items.length && !items[at].equals(item)) at += 1;
209
+ if (at === items.length) return false;
210
+ at += 1;
211
+ }
212
+ return true;
213
+ };
214
+ /** Optional for Hosts. The binding is ignored. */
215
+ const userCapability = (impl, costs) => {
216
+ for (const name of [
217
+ "confirm",
218
+ "choose",
219
+ "enter",
220
+ "notify"
221
+ ]) if (!impl || typeof impl[name] !== "function") throw new HostError("invalid value", `User needs ${name}`);
222
+ const operations = {
223
+ confirm: {
224
+ mode: "suspending",
225
+ args: [shape.text],
226
+ result: shape.bool,
227
+ errors: userBusy,
228
+ maxPendingMs: USER_MAX_PENDING_MS,
229
+ cost: costOf(costs, "confirm"),
230
+ start: (call, message) => impl.confirm(call, message.asText())
231
+ },
232
+ choose: {
233
+ mode: "suspending",
234
+ args: [shape.listOf(shape.text), options({
235
+ prompt: optionalText,
236
+ multiple: shape.optional(shape.bool)
237
+ })],
238
+ result: shape.optional(shape.oneOf(shape.text, shape.listOf(shape.text))),
239
+ errors: userBusy,
240
+ maxPendingMs: USER_MAX_PENDING_MS,
241
+ cost: costOf(costs, "choose"),
242
+ start: (call, items, options) => impl.choose(call, itemsOf(items).map((item) => item.asText()), optionText(options, "prompt"), multipleOf(options))
243
+ },
244
+ enter: {
245
+ mode: "suspending",
246
+ args: [shape.text, options({ default: optionalText })],
247
+ result: optionalText,
248
+ errors: userBusy,
249
+ maxPendingMs: USER_MAX_PENDING_MS,
250
+ cost: costOf(costs, "enter"),
251
+ start: (call, message, options) => impl.enter(call, message.asText(), optionText(options, "default"))
252
+ },
253
+ notify: {
254
+ mode: "fire-and-forget",
255
+ args: [shape.text, options({ title: optionalText })],
256
+ errors: [],
257
+ cost: costOf(costs, "notify"),
258
+ fire: (call, message, options) => impl.notify(call, message.asText(), optionText(options, "title"))
259
+ }
260
+ };
261
+ for (const [name, op] of Object.entries(operations)) registerStandardChecks(op, {
262
+ error: (code) => code === "user busy" && name !== "notify",
263
+ ...name === "choose" ? {
264
+ arguments: (args) => {
265
+ if (args[0].length === 0) throw new ScriptError("out of domain", [["function", text("choose")], ["value", args[0]]], true);
266
+ },
267
+ result: chosen
268
+ } : {}
269
+ });
270
+ return fixed(defineCapability("user", operations));
271
+ };
272
+ //#endregion
273
+ export { localeCapability as n, userCapability as t };
package/wasm.d.ts ADDED
@@ -0,0 +1,223 @@
1
+ import { $t as shape, At as Call, Bt as ImmediateOp, C as Requested, Ct as HostObject, D as Settlement, Dt as PropDef, Et as ObjectKindDef, Ft as ErrorDecl, Gt as ScopeDecl, Ht as Operation, It as FieldShape, Jt as SegmentGrant, Kt as SegmentContext, Lt as FireOp, Mt as CoordinatedLifecycle, N as LibrarySource, Nt as Cost, O as Verdict, P as OperationRef, Pt as EffectResult, Rt as Grant, S as Report, St as parseInstant, T as RestoreResult, Tt as ObjectKind, Ut as ReleaseHook, Vt as LimitReached, Wt as ReleaseReason, Xt as Shape, Yt as SegmentLifecycle, Zt as SuspendingOp, _ as LoadOptions, _t as range, an as ScriptError, at as Value, b as PumpOptions, bt as text, c as CancellationOptions, ct as civilDate, d as Decided, en as HostError, f as Deciding, ft as list, g as Inspection, gt as quantity, h as GroupOptions, ht as num, in as MailboxFull, it as Kind, j as Library, jt as CapabilityDef, kt as GrantDecls, l as CarryOver, lt as dec, mt as nothing, nn as LoadDiagnostic, ot as bool, p as EffectFailure, pt as map, qt as SegmentCoordinator, rn as LoadError, rt as Decimal, st as bytes, tn as HostErrorCode, u as Counters, ut as instant, v as Message, vt as record, w as RestoreOptions, x as PumpResult, xt as formatInstant, y as PendingCall, zt as GrantContext } from "./debug-D8Z_u244.js";
2
+ import { a as ManifestSpec, c as decodeJson, i as readDisplay, l as encodeJson, n as Json, o as MessageDecl, r as decodeValue, s as exportManifest, u as encodeValue } from "./readers-Oh4tO2dK.js";
3
+ import { a as SqliteImpl, d as Costs, f as TimerImpl, i as SqliteBinding, l as CalendarImpl, n as SqlRows, r as SqlValue, s as LocaleImpl, t as SqlParams, u as ConsoleImpl } from "./sqlite-capability-C7-SYdD7.js";
4
+ import { i as add, r as StoreImpl, t as UserImpl } from "./user-capability-CLkDsrCX.js";
5
+ //#region src/wasm/reactor.d.ts
6
+ /** Text the reactor writes to stdout or stderr, such as a fatal error. */
7
+ type Diagnostics = (line: string) => void;
8
+ /** Thrown when the instance traps or replies with something unreadable: it is lost. */
9
+ export declare class InstanceLostError extends Error {
10
+ name: string;
11
+ }
12
+ declare class Reactor {
13
+ #private;
14
+ /** Synchronous: the module is compiled once, by createCore. */
15
+ constructor(module: WebAssembly.Module, diagnostics: Diagnostics);
16
+ /** One frame of JSON in, its reply out. */
17
+ frame(json: string): string;
18
+ /** The instance's linear memory, in bytes. */
19
+ memoryBytes(): number;
20
+ }
21
+ //#endregion
22
+ //#region src/wasm/wire.d.ts
23
+ declare const raw: unique symbol;
24
+ /** Text already in JSON, such as a Value Encoding, placed in a frame as is. */
25
+ declare class Raw {
26
+ readonly json: string;
27
+ readonly [raw] = true;
28
+ constructor(json: string);
29
+ }
30
+ type Frame = null | boolean | number | string | Raw | readonly Frame[] | {
31
+ readonly [key: string]: Frame | undefined;
32
+ };
33
+ //#endregion
34
+ //#region src/wasm/session.d.ts
35
+ type Versions = {
36
+ core: string;
37
+ costModel: string;
38
+ language: string;
39
+ saveFormat: string;
40
+ unicode: string;
41
+ };
42
+ /** Answers one interim need with its `…-result` fields. */
43
+ type NeedHandler = (need: Json, packet: Json) => Record<string, Frame>;
44
+ /** Sees every reply of an exchange, interim ones included. */
45
+ type Observer = (packet: Json, m: string) => void;
46
+ /** The Core's names for its definitions, shared by every guest it makes. */
47
+ type Registry = {
48
+ handleOf(def: CapabilityDef<unknown>): string;
49
+ readonly kinds: readonly ObjectKind[];
50
+ };
51
+ declare class Session {
52
+ #private;
53
+ private readonly registry;
54
+ readonly reactor: Reactor;
55
+ readonly versions: Versions;
56
+ /** Whether the guest accepts Object Collection declarations. */
57
+ readonly elements: boolean;
58
+ constructor(module: WebAssembly.Module, diagnostics: Diagnostics, registry: Registry);
59
+ /**
60
+ * One complete exchange: the message, then every need answered under its
61
+ * ref, until the final reply. Returns its `ok`, or throws its `err`.
62
+ * A callback may start other exchanges meanwhile, under their own refs.
63
+ */
64
+ exchange(m: string, fields: Record<string, Frame | undefined>, answer?: NeedHandler, observe?: Observer): Json;
65
+ /** The guest's handle for a Capability, declared on first use. */
66
+ define(def: CapabilityDef<unknown>): string;
67
+ /** The guest's handle for a Grant, made on first use. */
68
+ grant(grant: Grant<unknown>): number;
69
+ /** A declared Capability's name, from the handle the guest reports. */
70
+ capabilityName(handle: string): string | undefined;
71
+ /** The coordinator a Grant's effect need names, by the name given it here. */
72
+ coordinator(name: string): SegmentCoordinator | undefined;
73
+ /** Declares every Object Kind the Core knows that this guest doesn't yet. */
74
+ syncKinds(): void;
75
+ /** Whether this guest has compiled a Library, by its identity. */
76
+ hasLibrary(identity: string): boolean;
77
+ addedLibrary(identity: string): void;
78
+ }
79
+ //#endregion
80
+ //#region src/wasm/group.d.ts
81
+ /** What a Group needs of the Core that made it. */
82
+ type GroupCore = {
83
+ /** Compiles a Library and its imports into a guest, once each. */
84
+ install(session: Session, library: Library): void;
85
+ kind(name: string): ObjectKind | undefined;
86
+ /** A guest with every definition the Core knows available to declare. */
87
+ session(): Session;
88
+ };
89
+ type GroupOptions$1 = {
90
+ name: string;
91
+ onReady?(): void;
92
+ /** The `random` generator's seed, 0 to 2⁶⁴ − 1; 0 when omitted. */
93
+ seed?: bigint;
94
+ trace?: (line: string) => void;
95
+ };
96
+ /** A handle for calls addressed to one Script. */
97
+ export declare class WasmScript {
98
+ private readonly group;
99
+ readonly name: string;
100
+ constructor(group: WasmGroup, name: string);
101
+ grants(): Record<string, string[]>;
102
+ counters(): Counters;
103
+ deliver(m: Message): string;
104
+ request(m: Message, o?: CancellationOptions): Requested;
105
+ decide(m: Message, o?: CancellationOptions): Deciding;
106
+ reload(source: string, carry: CarryOver, o?: {
107
+ keepMailbox?: boolean;
108
+ }): Report[];
109
+ extend(source: string): void;
110
+ stop(reason: string): void;
111
+ cancelRun(runId: string): void;
112
+ rewindRun(runId: string): void;
113
+ revoke(grantName: string): void;
114
+ }
115
+ export declare class WasmGroup {
116
+ #private;
117
+ readonly name: string;
118
+ /** @internal Made by WasmCore. */
119
+ constructor(core: GroupCore, o: GroupOptions$1, restoring?: {
120
+ options: RestoreOptions;
121
+ save: Uint8Array;
122
+ });
123
+ /** @internal One exchange for this Group, its needs answered here. */
124
+ send(m: string, fields?: Record<string, Frame | undefined>): Json;
125
+ /**
126
+ * A worker call. Made from a callback, the guest refuses it as
127
+ * `reentrant call`, with its refusal record, as the in-process Core does.
128
+ */
129
+ worker(m: string, fields?: Record<string, Frame | undefined>): Json;
130
+ /** @internal */
131
+ queue(m: string, fields: Record<string, Frame | undefined>, message?: Message): string;
132
+ /** @internal */
133
+ ask(to: Record<string, Frame>, m: Message, o?: CancellationOptions): Requested;
134
+ /** @internal */
135
+ decision(fields: Record<string, Frame>, m: Message, o?: CancellationOptions): Deciding;
136
+ /** @internal Queued controls, which make the Group runnable. */
137
+ control(m: string, fields: Record<string, Frame | undefined>): void;
138
+ script(name: string): WasmScript | undefined;
139
+ scriptNames(): string[];
140
+ load(o: LoadOptions): WasmScript;
141
+ addLibrary(l: Library): void;
142
+ replaceLibrary(l: Library, carry: CarryOver): Report[];
143
+ /** @internal Reload and Library replacement end Runs and settle their futures. */
144
+ lifecycle(m: string, fields: Record<string, Frame | undefined>): Report[];
145
+ object<N>(kind: ObjectKind<N>, id: string, native: N): HostObject<N>;
146
+ objectById(kind: string, id: string): HostObject | undefined;
147
+ setParent(o: HostObject, parent: HostObject | undefined): void;
148
+ dispose(o: HostObject): void;
149
+ deliver(to: HostObject, m: Message): string;
150
+ request(to: HostObject, m: Message, o?: CancellationOptions): Requested;
151
+ broadcast(m: Message): string;
152
+ decide(to: HostObject, m: Message, o?: CancellationOptions): Deciding;
153
+ decideBroadcast(m: Message, o?: CancellationOptions): Deciding;
154
+ call(fn: Value, args: Value[], o?: CancellationOptions & {
155
+ limits?: Message['limits'];
156
+ }): Requested;
157
+ pump(now: bigint, o?: PumpOptions): PumpResult;
158
+ save(): Uint8Array;
159
+ fingerprint(): Uint8Array;
160
+ inspect(): Inspection;
161
+ settle(callId: string, s: Settlement): Call<unknown> | undefined;
162
+ /** @internal */
163
+ restore(save: Uint8Array, o: RestoreOptions): RestoreResult;
164
+ /** This Group's guest linear memory, in bytes. */
165
+ memoryBytes(): number;
166
+ /** @internal Rebinds a restored handle's native, as the TS Core does. */
167
+ rebind(o: HostObject, native: unknown): void;
168
+ }
169
+ //#endregion
170
+ //#region src/wasm/core.d.ts
171
+ /** Where `talk.wasm` comes from. A URL or path is fetched; `file:` URLs are read. */
172
+ type WasmSource = WebAssembly.Module | BufferSource | Response | PromiseLike<Response> | URL | string;
173
+ type CoreOptions = {
174
+ /** Lines the reactor writes to stdout or stderr. Defaults to console.warn. */
175
+ diagnostics?: (line: string) => void;
176
+ /** The reactor. Defaults to `talk.wasm` beside this module. */
177
+ wasm?: WasmSource;
178
+ };
179
+ export declare class WasmCore {
180
+ #private;
181
+ /** The reactor's `hello`: its Core, language, Cost Model, Unicode and save format. */
182
+ readonly versions: Versions;
183
+ /** @internal Use createCore. */
184
+ constructor(module: WebAssembly.Module, diagnostics: (line: string) => void);
185
+ defineCapability: <B = void>(name: string, ops: Record<string, Operation<B>>, lifecycle?: SegmentLifecycle<B> | CoordinatedLifecycle<B>, release?: ReleaseHook<B>) => CapabilityDef<B>;
186
+ clockCapability: (costs: Costs) => CapabilityDef<void>;
187
+ calendarCapability: (impl: CalendarImpl, costs: Costs) => CapabilityDef<string>;
188
+ localeCapability: (impl: LocaleImpl, costs: Costs) => CapabilityDef<string>;
189
+ timerCapability: (impl: TimerImpl, costs: Costs) => CapabilityDef<unknown>;
190
+ consoleCapability: (impl: ConsoleImpl, costs: Costs) => CapabilityDef<unknown>;
191
+ storeCapability: (impl: StoreImpl, costs: Costs) => CapabilityDef<string>;
192
+ sqliteCapability: (impl: SqliteImpl, costs: Costs, perRow: number) => CapabilityDef<SqliteBinding>;
193
+ userCapability: (impl: UserImpl, costs: Costs) => CapabilityDef<unknown>;
194
+ defineObjectKind<N>(k: ObjectKindDef<N>): ObjectKind<N>;
195
+ /** Checked in a guest the Core keeps; each Group's guest compiles it again when added. */
196
+ compileLibrary(src: LibrarySource, imports?: Library[], declarations?: GrantDecls): Library;
197
+ newGroup(o: GroupOptions): WasmGroup;
198
+ restore(save: Uint8Array, o: RestoreOptions): {
199
+ group: WasmGroup;
200
+ result: RestoreResult;
201
+ };
202
+ }
203
+ /**
204
+ * Compiles `talk.wasm` once and returns a Core over it. The one asynchronous
205
+ * call: `await createCore()` also works with the TS Core's synchronous one.
206
+ */
207
+ export declare const createCore: (o?: CoreOptions) => Promise<WasmCore>;
208
+ //#endregion
209
+ //#region src/wasm/index.d.ts
210
+ /** Chapter 9's default Limits, which the reactor shares. */
211
+ export declare const defaultLimits: Readonly<{
212
+ fuelPerRun: number;
213
+ allocPerRun: number;
214
+ persistentState: number;
215
+ callDepth: number;
216
+ patternSize: number;
217
+ mailboxDepth: number;
218
+ maxWaitMs: number;
219
+ maxJoin: number;
220
+ cleanupBudget: number;
221
+ }>;
222
+ //#endregion
223
+ export { type CalendarImpl, type Call, type CancellationOptions, type CapabilityDef, type CarryOver, type ConsoleImpl, type CoordinatedLifecycle, type WasmCore as Core, type CoreOptions, type Cost, type Costs, type Counters, type Decided, type Deciding, Decimal, type EffectFailure, type EffectResult, type ErrorDecl, type FieldShape, type FireOp, type Grant, type GrantContext, type GrantDecls, type WasmGroup as Group, type GroupOptions, HostError, type HostErrorCode, type HostObject, type ImmediateOp, type Inspection, type Kind, type Library, type LibrarySource, LimitReached, type LoadDiagnostic, LoadError, type LoadOptions, type LocaleImpl, MailboxFull, type ManifestSpec, type Message, type MessageDecl, type ObjectKind, type ObjectKindDef, type Operation, type OperationRef, type PendingCall, type PropDef, type PumpOptions, type PumpResult, type ReleaseHook, type ReleaseReason, type Report, type Requested, type RestoreOptions, type RestoreResult, type ScopeDecl, type WasmScript as Script, ScriptError, type SegmentContext, type SegmentCoordinator, type SegmentGrant, type SegmentLifecycle, type Settlement, type Shape, type SqlParams, type SqlRows, type SqlValue, type SqliteBinding, type SqliteImpl, type StoreImpl, type SuspendingOp, type TimerImpl, type UserImpl, Value, type Verdict, type Versions, type WasmSource, add, bool, bytes, civilDate, dec, decodeJson, decodeValue, encodeJson, encodeValue, exportManifest, formatInstant, instant, list, map, nothing, num, parseInstant, quantity, range, readDisplay, record, shape, text };