@atolljs/core 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Justin Henry
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,7 +1,12 @@
1
- # AtollJS
1
+ <picture>
2
+ <source media="(prefers-color-scheme: dark)" srcset="assets/atoll-horizontal-dark.svg" />
3
+ <source media="(prefers-color-scheme: light)" srcset="assets/atoll-horizontal-light.svg" />
4
+ <img src="assets/atoll-horizontal-light.svg" alt="Atoll — islands of framework workers around a shared core" width="420" />
5
+ </picture>
2
6
 
3
- [![CI](https://github.com/jwhenry3/atolljs/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/jwhenry3/atolljs/actions/workflows/ci.yml)
4
- [![codecov](https://codecov.io/gh/jwhenry3/atolljs/graph/badge.svg?branch=master)](https://codecov.io/gh/jwhenry3/atolljs)
7
+ [![CI](https://github.com/jwhenry3/atolljs/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jwhenry3/atolljs/actions/workflows/ci.yml)
8
+ [![codecov](https://codecov.io/gh/jwhenry3/atolljs/graph/badge.svg?branch=main)](https://codecov.io/gh/jwhenry3/atolljs)
9
+ [![Socket Badge](https://badge.socket.dev/npm/package/@atolljs/core)](https://badge.socket.dev/npm/package/@atolljs/core)
5
10
 
6
11
  Typed shared-memory worker pools for TypeScript — deterministic `SharedArrayBuffer`
7
12
  layouts, first-class task methods, and cross-thread reactive state. A worker
@@ -9,7 +14,7 @@ atoll: pools and shared workers joined to your app through one shared-memory
9
14
  fabric, so work is offloaded as typed method calls while large state stays put
10
15
  (zero-copy, no postMessage serialization of the values themselves).
11
16
 
12
- **[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/#/quickstart)**
17
+ **[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)**
13
18
 
14
19
  ## Install
15
20
 
@@ -89,7 +94,7 @@ Shared memory is opt-in: leave `sharedMemory` out of both `defineWorker` and
89
94
  `connectWorker` and you get a typed, pooled, cancellable worker RPC that runs
90
95
  anywhere Workers do — no isolation headers needed. With shared memory,
91
96
  `SharedArrayBuffer` requires
92
- [cross-origin isolation headers](https://jwhenry3.github.io/atolljs/consumer/#/hosting)
97
+ [cross-origin isolation headers](https://jwhenry3.github.io/atolljs/consumer/hosting/)
93
98
  (COOP/COEP) in the browser; Node needs nothing.
94
99
 
95
100
  ## Packages
@@ -101,35 +106,35 @@ install only what you use.
101
106
 
102
107
  | Framework | Package | What it is | Docs |
103
108
  |---|---|---|---|
104
- | React | [`@atolljs/react`](https://www.npmjs.com/package/@atolljs/react) | Hooks — `useObservable`, `useSharedValue`, `useTask` | [React guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-react) |
105
- | Vue | [`@atolljs/vue`](https://www.npmjs.com/package/@atolljs/vue) | Composables — `useObservable`, `useSharedValue`, `useTask` | [Vue guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-vue) |
106
- | SolidJS | [`@atolljs/solidjs`](https://www.npmjs.com/package/@atolljs/solidjs) | Primitives — `createObservable`, `createSharedValue`, `createTask` | [SolidJS guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-solid) |
107
- | Svelte | [`@atolljs/svelte`](https://www.npmjs.com/package/@atolljs/svelte) | Svelte 5 rune bindings — `observableValue`, `sharedValue`, `taskState` | [Svelte guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-svelte) |
108
- | Angular | [`@atolljs/angular`](https://www.npmjs.com/package/@atolljs/angular) | Signals + DI — `observableSignal`, `sharedValue`, `taskState`, `provideAtoll` | [Angular guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-angular) |
109
- | Next.js | [`@atolljs/nextjs`](https://www.npmjs.com/package/@atolljs/nextjs) | Client-component bindings (React re-export) | [Next.js guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-nextjs) |
110
- | NestJS | [`@atolljs/nestjs`](https://www.npmjs.com/package/@atolljs/nestjs) | Server-side module/decorators for worker pools | [NestJS guide](https://jwhenry3.github.io/atolljs/consumer/#/fw-nestjs) |
109
+ | React | [`@atolljs/react`](https://www.npmjs.com/package/@atolljs/react) | Hooks — `useObservable`, `useSharedValue`, `useTask` | [React guide](https://jwhenry3.github.io/atolljs/consumer/fw-react/) |
110
+ | Vue | [`@atolljs/vue`](https://www.npmjs.com/package/@atolljs/vue) | Composables — `useObservable`, `useSharedValue`, `useTask` | [Vue guide](https://jwhenry3.github.io/atolljs/consumer/fw-vue/) |
111
+ | SolidJS | [`@atolljs/solidjs`](https://www.npmjs.com/package/@atolljs/solidjs) | Primitives — `createObservable`, `createSharedValue`, `createTask` | [SolidJS guide](https://jwhenry3.github.io/atolljs/consumer/fw-solid/) |
112
+ | Svelte | [`@atolljs/svelte`](https://www.npmjs.com/package/@atolljs/svelte) | Svelte 5 rune bindings — `observableValue`, `sharedValue`, `taskState` | [Svelte guide](https://jwhenry3.github.io/atolljs/consumer/fw-svelte/) |
113
+ | Angular | [`@atolljs/angular`](https://www.npmjs.com/package/@atolljs/angular) | Signals + DI — `observableSignal`, `sharedValue`, `taskState`, `provideAtoll` | [Angular guide](https://jwhenry3.github.io/atolljs/consumer/fw-angular/) |
114
+ | Next.js | [`@atolljs/nextjs`](https://www.npmjs.com/package/@atolljs/nextjs) | Client-component bindings (React re-export) | [Next.js guide](https://jwhenry3.github.io/atolljs/consumer/fw-nextjs/) |
115
+ | NestJS | [`@atolljs/nestjs`](https://www.npmjs.com/package/@atolljs/nestjs) | Server-side module/decorators for worker pools | [NestJS guide](https://jwhenry3.github.io/atolljs/consumer/fw-nestjs/) |
111
116
 
112
117
  ### Worker islands — render framework trees off the main thread
113
118
 
114
119
  | Framework | Package | What it is | Docs |
115
120
  |---|---|---|---|
116
- | *(engine)* | [`@atolljs/islands`](https://www.npmjs.com/package/@atolljs/islands) | `mountIsland`, op protocol, proxy DOM, worker runtimes | [Worker islands](https://jwhenry3.github.io/atolljs/consumer/#/islands) |
117
- | React | [`@atolljs/react-island`](https://www.npmjs.com/package/@atolljs/react-island) | `<Island/>`, `islandComponent`, `lazyIsland` | [React islands](https://jwhenry3.github.io/atolljs/consumer/#/fw-react/worker-islands) |
118
- | Vue | [`@atolljs/vue-island`](https://www.npmjs.com/package/@atolljs/vue-island) | `useIsland`, `<AtollIsland>` + Vue worker renderer | [Vue islands](https://jwhenry3.github.io/atolljs/consumer/#/fw-vue/worker-islands) |
119
- | Svelte | [`@atolljs/svelte-island`](https://www.npmjs.com/package/@atolljs/svelte-island) | `use:island`, `createIslandState` + Svelte 5 worker renderer | [Svelte islands](https://jwhenry3.github.io/atolljs/consumer/#/fw-svelte/worker-islands) |
120
- | SolidJS | [`@atolljs/solid-island`](https://www.npmjs.com/package/@atolljs/solid-island) | `createIsland`, `Island` + `solid-js/universal` worker renderer | [Solid islands](https://jwhenry3.github.io/atolljs/consumer/#/fw-solid/worker-islands) |
121
- | Angular | [`@atolljs/angular-island`](https://www.npmjs.com/package/@atolljs/angular-island) | `<atoll-island>`, `[atollIsland]` + `Renderer2` worker renderer | [Angular islands](https://jwhenry3.github.io/atolljs/consumer/#/fw-angular/worker-islands) |
121
+ | *(engine)* | [`@atolljs/islands`](https://www.npmjs.com/package/@atolljs/islands) | `mountIsland`, op protocol, proxy DOM, worker runtimes | [Worker islands](https://jwhenry3.github.io/atolljs/consumer/islands/) |
122
+ | React | [`@atolljs/react-island`](https://www.npmjs.com/package/@atolljs/react-island) | `<Island/>`, `islandComponent`, `lazyIsland` | [React islands](https://jwhenry3.github.io/atolljs/consumer/fw-react/worker-islands/) |
123
+ | Vue | [`@atolljs/vue-island`](https://www.npmjs.com/package/@atolljs/vue-island) | `useIsland`, `<AtollIsland>` + Vue worker renderer | [Vue islands](https://jwhenry3.github.io/atolljs/consumer/fw-vue/worker-islands/) |
124
+ | Svelte | [`@atolljs/svelte-island`](https://www.npmjs.com/package/@atolljs/svelte-island) | `use:island`, `createIslandState` + Svelte 5 worker renderer | [Svelte islands](https://jwhenry3.github.io/atolljs/consumer/fw-svelte/worker-islands/) |
125
+ | SolidJS | [`@atolljs/solid-island`](https://www.npmjs.com/package/@atolljs/solid-island) | `createIsland`, `Island`, `islandComponent`, `lazyIsland` + `solid-js/universal` worker renderer | [Solid islands](https://jwhenry3.github.io/atolljs/consumer/fw-solid/worker-islands/) |
126
+ | Angular | [`@atolljs/angular-island`](https://www.npmjs.com/package/@atolljs/angular-island) | `islandComponent` facades typed off `@AngularIsland` worker components, `<atoll-island>`/`[atollIsland]` + `Renderer2` worker renderer | [Angular islands](https://jwhenry3.github.io/atolljs/consumer/fw-angular/worker-islands/) |
122
127
 
123
128
  ### Runtimes
124
129
 
125
130
  | Package | What it is | Docs |
126
131
  |---|---|---|
127
- | [`@atolljs/core`](https://www.npmjs.com/package/@atolljs/core) | Core SDK — `defineWorker`/`connectWorker` typed worker clients over `WorkerPool`, shared-memory contracts, `watch`/`observe`, codecs | [Quickstart](https://jwhenry3.github.io/atolljs/consumer/#/quickstart) · [Shared memory](https://jwhenry3.github.io/atolljs/consumer/#/shared-memory) · [Tasks](https://jwhenry3.github.io/atolljs/consumer/#/tasks) |
128
- | [`@atolljs/node`](https://www.npmjs.com/package/@atolljs/node) | `node:worker_threads` runtime adapter | [Tasks](https://jwhenry3.github.io/atolljs/consumer/#/tasks) |
132
+ | [`@atolljs/core`](https://www.npmjs.com/package/@atolljs/core) | Core SDK — `defineWorker`/`connectWorker` typed worker clients over `WorkerPool`, shared-memory contracts, `watch`/`observe`, codecs | [Quickstart](https://jwhenry3.github.io/atolljs/consumer/quickstart/) · [Shared memory](https://jwhenry3.github.io/atolljs/consumer/shared-memory/) · [Tasks](https://jwhenry3.github.io/atolljs/consumer/tasks/) |
133
+ | [`@atolljs/node`](https://www.npmjs.com/package/@atolljs/node) | `node:worker_threads` runtime adapter | [Tasks](https://jwhenry3.github.io/atolljs/consumer/tasks/) |
129
134
 
130
135
  ## Documentation
131
136
 
132
- - **[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/#/quickstart)** —
137
+ - **[Atoll — package documentation](https://jwhenry3.github.io/atolljs/consumer/quickstart/)** —
133
138
  the consumer-facing site: quickstart, API guides, framework pages, islands,
134
139
  hosting & headers.
135
140
  - [`docs/`](docs/README.md) — in-repo documentation covering internals,
@@ -144,7 +149,7 @@ packages/<fw>/ independently publishable framework bindings
144
149
  packages/incidents/ demo domain package (contract + worker + pool)
145
150
  examples/<fw>/ per-framework demo apps
146
151
  docs/ in-repo markdown documentation (internals + bindings)
147
- docs-consumer/ consumer docs site (deploys to GitHub Pages on master)
152
+ docs-consumer/ consumer docs site (deploys to GitHub Pages on main)
148
153
  ```
149
154
 
150
155
  ```bash
@@ -1,4 +1,4 @@
1
- import { z } from './zod';
1
+ import { z, type Fluent } from './zod';
2
2
  import type { ListFieldSpec, ListFields, ListMember } from './sharedMemory';
3
3
  /** Maps a list member to the zod shape whose inferred output type is
4
4
  * identical to `ListRecord<F>[K]` — zod members pass through as
@@ -12,7 +12,7 @@ export type ListZodShape<F extends ListFields> = {
12
12
  };
13
13
  /**
14
14
  * Builds a zod object schema from a member map — the shape you would pass
15
- * to `mz.object(...)` for `field.list({ schema, count })`. Members may be
15
+ * to `reef.object(...)` for `field.list({ schema, count })`. Members may be
16
16
  * spec tokens or zod schemas; the result's `z.infer` is the record type:
17
17
  *
18
18
  * ```ts
@@ -25,7 +25,7 @@ export type ListZodShape<F extends ListFields> = {
25
25
  * capacity the connector enforces; zod `z.string().meta({ bytes: n })`
26
26
  * members get the same bound attached to the declared schema.
27
27
  */
28
- export declare function listSchema<F extends ListFields>(fields: F): z.ZodObject<ListZodShape<F>>;
28
+ export declare function listSchema<F extends ListFields>(fields: F): Fluent<z.ZodMiniObject<ListZodShape<F>>>;
29
29
  /**
30
30
  * Compiles one fixed-layout member — a spec token or a zod schema — to its
31
31
  * binary layout form. Throws for members that can't express a fixed-width
@@ -43,5 +43,5 @@ export declare function zodArrayInfo(schema: unknown): {
43
43
  element: z.ZodTypeAny;
44
44
  capacity: number | null;
45
45
  } | null;
46
- /** The byte budget carried by `mz.string(n)` / `z.string().meta({ bytes: n })` — null otherwise. */
46
+ /** The byte budget carried by `reef.string(n)` / `z.string().meta({ bytes: n })` — null otherwise. */
47
47
  export declare function zodStringBytes(schema: unknown): number | null;
@@ -0,0 +1,377 @@
1
+ import { z } from './zod';
2
+ /**
3
+ * Reef — the atoll's structural barrier: the fixed-width schema
4
+ * vocabulary standing between your data and the raw buffer. Every helper
5
+ * mints a schema the layout compiler can read a byte width from: number
6
+ * formats (`reef.u32()`), int bounds (`reef.int(0, 3)` → u8), byte budgets
7
+ * (`reef.string(10)`), or flags (`reef.boolean()` → u8). There are no unfixed
8
+ * members — `reef.number()`/`z.date()`/`z.enum()` aren't exposed because they
9
+ * can't promise a width.
10
+ *
11
+ * Schemas are minted by the vendored engine in `./zod.ts` — a zod-shaped
12
+ * `_zod.def` surface (`type`/`format`/`checks`/`shape`/`element`), so no
13
+ * zod dependency ships. Width coverage: int32/uint32/float32/float64/
14
+ * int64/uint64 are format-tagged; reef fills the gaps (i8/u8/i16/u16 via
15
+ * bounded ints, which the compiler narrows identically) so all ten scalar
16
+ * kinds have one spelling.
17
+ *
18
+ * Composition derives byte width upward — `reef.object({...})` members lay out
19
+ * as a fixed record (field.object derives byteLength from it, no maxBytes),
20
+ * `reef.array(el).max(n)` bounds element capacity for field.array, and
21
+ * `reef.string(n)` carries the budget for field.string. Schemas keep the
22
+ * classic chain spellings — `.meta()`, `.refine()`, `.max()`/`.length()` —
23
+ * and consumer-supplied zod schemas introspect identically through their
24
+ * `_zod.def`, so `reef.object({ id: z.uint32() })` mixes freely.
25
+ */
26
+ export declare const reef: {
27
+ i8: () => import("./zod").Fluent<{
28
+ readonly _zod: {
29
+ output: number;
30
+ input: number;
31
+ def: import("./zod").SchemaDef & {
32
+ type: 'number';
33
+ };
34
+ };
35
+ inner(v: unknown): number;
36
+ parse(value: unknown): number;
37
+ safeParse(value: unknown): {
38
+ success: true;
39
+ data: number;
40
+ } | {
41
+ success: false;
42
+ error: unknown;
43
+ };
44
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
45
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
46
+ }>;
47
+ u8: () => import("./zod").Fluent<{
48
+ readonly _zod: {
49
+ output: number;
50
+ input: number;
51
+ def: import("./zod").SchemaDef & {
52
+ type: 'number';
53
+ };
54
+ };
55
+ inner(v: unknown): number;
56
+ parse(value: unknown): number;
57
+ safeParse(value: unknown): {
58
+ success: true;
59
+ data: number;
60
+ } | {
61
+ success: false;
62
+ error: unknown;
63
+ };
64
+ check(...checks: import("./zod").Check[]): any;
65
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
66
+ }>;
67
+ i16: () => import("./zod").Fluent<{
68
+ readonly _zod: {
69
+ output: number;
70
+ input: number;
71
+ def: import("./zod").SchemaDef & {
72
+ type: 'number';
73
+ };
74
+ };
75
+ inner(v: unknown): number;
76
+ parse(value: unknown): number;
77
+ safeParse(value: unknown): {
78
+ success: true;
79
+ data: number;
80
+ } | {
81
+ success: false;
82
+ error: unknown;
83
+ };
84
+ check(...checks: import("./zod").Check[]): any;
85
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
86
+ }>;
87
+ u16: () => import("./zod").Fluent<{
88
+ readonly _zod: {
89
+ output: number;
90
+ input: number;
91
+ def: import("./zod").SchemaDef & {
92
+ type: 'number';
93
+ };
94
+ };
95
+ inner(v: unknown): number;
96
+ parse(value: unknown): number;
97
+ safeParse(value: unknown): {
98
+ success: true;
99
+ data: number;
100
+ } | {
101
+ success: false;
102
+ error: unknown;
103
+ };
104
+ check(...checks: import("./zod").Check[]): any;
105
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
106
+ }>;
107
+ i32: () => import("./zod").Fluent<{
108
+ readonly _zod: {
109
+ output: number;
110
+ input: number;
111
+ def: import("./zod").SchemaDef & {
112
+ type: 'number';
113
+ };
114
+ };
115
+ inner(v: unknown): number;
116
+ parse(value: unknown): number;
117
+ safeParse(value: unknown): {
118
+ success: true;
119
+ data: number;
120
+ } | {
121
+ success: false;
122
+ error: unknown;
123
+ };
124
+ check(...checks: import("./zod").Check[]): any;
125
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
126
+ }>;
127
+ u32: () => import("./zod").Fluent<{
128
+ readonly _zod: {
129
+ output: number;
130
+ input: number;
131
+ def: import("./zod").SchemaDef & {
132
+ type: 'number';
133
+ };
134
+ };
135
+ inner(v: unknown): number;
136
+ parse(value: unknown): number;
137
+ safeParse(value: unknown): {
138
+ success: true;
139
+ data: number;
140
+ } | {
141
+ success: false;
142
+ error: unknown;
143
+ };
144
+ check(...checks: import("./zod").Check[]): any;
145
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
146
+ }>;
147
+ f32: () => import("./zod").Fluent<{
148
+ readonly _zod: {
149
+ output: number;
150
+ input: number;
151
+ def: import("./zod").SchemaDef & {
152
+ type: 'number';
153
+ };
154
+ };
155
+ inner(v: unknown): number;
156
+ parse(value: unknown): number;
157
+ safeParse(value: unknown): {
158
+ success: true;
159
+ data: number;
160
+ } | {
161
+ success: false;
162
+ error: unknown;
163
+ };
164
+ check(...checks: import("./zod").Check[]): any;
165
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
166
+ }>;
167
+ f64: () => import("./zod").Fluent<{
168
+ readonly _zod: {
169
+ output: number;
170
+ input: number;
171
+ def: import("./zod").SchemaDef & {
172
+ type: 'number';
173
+ };
174
+ };
175
+ inner(v: unknown): number;
176
+ parse(value: unknown): number;
177
+ safeParse(value: unknown): {
178
+ success: true;
179
+ data: number;
180
+ } | {
181
+ success: false;
182
+ error: unknown;
183
+ };
184
+ check(...checks: import("./zod").Check[]): any;
185
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
186
+ }>;
187
+ i64: () => import("./zod").Fluent<{
188
+ readonly _zod: {
189
+ output: bigint;
190
+ input: bigint;
191
+ def: import("./zod").SchemaDef & {
192
+ type: 'bigint';
193
+ };
194
+ };
195
+ inner(v: unknown): bigint;
196
+ parse(value: unknown): bigint;
197
+ safeParse(value: unknown): {
198
+ success: true;
199
+ data: bigint;
200
+ } | {
201
+ success: false;
202
+ error: unknown;
203
+ };
204
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
205
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
206
+ }>;
207
+ u64: () => import("./zod").Fluent<{
208
+ readonly _zod: {
209
+ output: bigint;
210
+ input: bigint;
211
+ def: import("./zod").SchemaDef & {
212
+ type: 'bigint';
213
+ };
214
+ };
215
+ inner(v: unknown): bigint;
216
+ parse(value: unknown): bigint;
217
+ safeParse(value: unknown): {
218
+ success: true;
219
+ data: bigint;
220
+ } | {
221
+ success: false;
222
+ error: unknown;
223
+ };
224
+ check(...checks: import("./zod").Check[]): any;
225
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): any;
226
+ }>;
227
+ /** Bounded int — compiles to the narrowest covering kind (0..3 → u8). */
228
+ int: (min: number, max: number) => import("./zod").Fluent<{
229
+ readonly _zod: {
230
+ output: number;
231
+ input: number;
232
+ def: import("./zod").SchemaDef & {
233
+ type: 'number';
234
+ };
235
+ };
236
+ inner(v: unknown): number;
237
+ parse(value: unknown): number;
238
+ safeParse(value: unknown): {
239
+ success: true;
240
+ data: number;
241
+ } | {
242
+ success: false;
243
+ error: unknown;
244
+ };
245
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
246
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
247
+ }>;
248
+ /** A flag byte — reads and writes as boolean. */
249
+ boolean: () => import("./zod").Fluent<{
250
+ readonly _zod: {
251
+ output: boolean;
252
+ input: boolean;
253
+ def: import("./zod").SchemaDef & {
254
+ type: 'boolean';
255
+ };
256
+ };
257
+ inner(v: unknown): boolean;
258
+ parse(value: unknown): boolean;
259
+ safeParse(value: unknown): {
260
+ success: true;
261
+ data: boolean;
262
+ } | {
263
+ success: false;
264
+ error: unknown;
265
+ };
266
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
267
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
268
+ }>;
269
+ /** Fixed-capacity inline UTF-8 string — `bytes` is the byte budget. The
270
+ * schema itself refuses over-budget values, so `.parse` and connector
271
+ * writes enforce the same limit. */
272
+ string: (bytes: number) => import("./zod").Fluent<{
273
+ readonly _zod: {
274
+ output: string;
275
+ input: string;
276
+ def: import("./zod").SchemaDef & {
277
+ type: 'string';
278
+ };
279
+ };
280
+ inner(v: unknown): string;
281
+ parse(value: unknown): string;
282
+ safeParse(value: unknown): {
283
+ success: true;
284
+ data: string;
285
+ } | {
286
+ success: false;
287
+ error: unknown;
288
+ };
289
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
290
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
291
+ }>;
292
+ /** A fixed-layout record shape — every member must be a fixed-width schema. */
293
+ object: <S extends z.ZodRawShape>(shape: S) => import("./zod").Fluent<{
294
+ readonly _zod: {
295
+ output: { [K in keyof S]: S[K] extends {
296
+ _zod: {
297
+ output: infer O;
298
+ };
299
+ } ? O : never; };
300
+ input: { [K in keyof S]: S[K] extends {
301
+ _zod: {
302
+ output: infer O;
303
+ };
304
+ } ? O : never; };
305
+ def: import("./zod").SchemaDef & {
306
+ type: 'object';
307
+ shape: S;
308
+ };
309
+ };
310
+ get shape(): S;
311
+ inner(v: unknown): { [K in keyof S]: S[K] extends {
312
+ _zod: {
313
+ output: infer O;
314
+ };
315
+ } ? O : never; };
316
+ parse(value: unknown): { [K in keyof S]: S[K] extends {
317
+ _zod: {
318
+ output: infer O;
319
+ };
320
+ } ? O : never; };
321
+ safeParse(value: unknown): {
322
+ success: true;
323
+ data: { [K in keyof S]: S[K] extends {
324
+ _zod: {
325
+ output: infer O;
326
+ };
327
+ } ? O : never; };
328
+ } | {
329
+ success: false;
330
+ error: unknown;
331
+ };
332
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
333
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
334
+ }>;
335
+ /** A fixed-stride element — bound it with `.max(n)` or `.length(n)` before field.array. */
336
+ array: <E extends z.ZodTypeAny>(element: E) => import("./zod").Fluent<{
337
+ readonly _zod: {
338
+ output: (E extends {
339
+ _zod: {
340
+ output: infer O;
341
+ };
342
+ } ? O : never)[];
343
+ input: (E extends {
344
+ _zod: {
345
+ output: infer O;
346
+ };
347
+ } ? O : never)[];
348
+ def: import("./zod").SchemaDef & {
349
+ type: 'array';
350
+ element: E;
351
+ };
352
+ };
353
+ inner(v: unknown): (E extends {
354
+ _zod: {
355
+ output: infer O;
356
+ };
357
+ } ? O : never)[];
358
+ parse(value: unknown): (E extends {
359
+ _zod: {
360
+ output: infer O;
361
+ };
362
+ } ? O : never)[];
363
+ safeParse(value: unknown): {
364
+ success: true;
365
+ data: (E extends {
366
+ _zod: {
367
+ output: infer O;
368
+ };
369
+ } ? O : never)[];
370
+ } | {
371
+ success: false;
372
+ error: unknown;
373
+ };
374
+ check(...checks: import("./zod").Check[]): /*elided*/ any;
375
+ register(registry: import("./zod").Registry, meta: Record<string, unknown>): /*elided*/ any;
376
+ }>;
377
+ };
@@ -91,7 +91,7 @@ export type ListSpec = Record<string, ListFieldSpec>;
91
91
  /**
92
92
  * A fixed-width member inside a record or element position — a binary spec
93
93
  * token (`'u32'`, `{ string: n }`, `{ bool: true }`) or a zod schema that
94
- * expresses the same thing (`mz.u32()`, `mz.int(0, 3)`, `mz.string(n)`).
94
+ * expresses the same thing (`reef.u32()`, `reef.int(0, 3)`, `reef.string(n)`).
95
95
  * Schemas are compiled to tokens for layout and kept as the field's
96
96
  * validation schema — one declaration.
97
97
  */
@@ -102,7 +102,7 @@ export type ListRecord<S extends z.ZodObject> = z.output<S>;
102
102
  export interface ListDescriptor<S extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>> extends Omit<FieldDescriptor<ListRecord<S>[]>, 'schema'> {
103
103
  readonly kind: 'list';
104
104
  /**
105
- * The declared record schema — an `mz.object` of fixed-width members. It
105
+ * The declared record schema — a `reef.object` of fixed-width members. It
106
106
  * IS the layout source AND the record validator (`schemas.lists.x` is this
107
107
  * same object). Note it parses one record, not the whole array.
108
108
  */
@@ -173,7 +173,7 @@ export interface FixedArrayDescriptor<T = unknown> extends FieldDescriptor<T[]>
173
173
  interface ObjectFieldFactory {
174
174
  /**
175
175
  * Inline fixed layout — the schema is a zod object of fixed-width members
176
- * (`mz` helpers, `z.uint32()`, bounded ints, `mz.string(n)`, `z.boolean()`);
176
+ * (`reef` helpers, `z.uint32()`, bounded ints, `reef.string(n)`, `z.boolean()`);
177
177
  * `byteLength` derives from the member widths. Compile fails loudly for
178
178
  * members with no fixed width (unbounded strings, nested objects).
179
179
  */
@@ -193,9 +193,9 @@ interface ObjectFieldFactory {
193
193
  interface ArrayFieldFactory {
194
194
  /**
195
195
  * Inline fixed layout — the schema is a bounded zod array
196
- * (`mz.array(mz.u32()).max(n)`, `.length(n)`); `byteLength` derives from
196
+ * (`reef.array(reef.u32()).max(n)`, `.length(n)`); `byteLength` derives from
197
197
  * the element width × the bound. Elements must be fixed-width members
198
- * (scalars, `mz.string(n)`, booleans) — use `field.list` for record arrays.
198
+ * (scalars, `reef.string(n)`, booleans) — use `field.list` for record arrays.
199
199
  */
200
200
  <S extends z.ZodArray>(options: {
201
201
  schema: S;
@@ -216,7 +216,7 @@ interface StringFieldFactory {
216
216
  maxBytes: number;
217
217
  schema?: Schema<string>;
218
218
  }): FieldDescriptor<string>;
219
- /** Budget derived from the schema — `mz.string(n)` / `z.string().meta({ bytes: n })`. */
219
+ /** Budget derived from the schema — `reef.string(n)` / `z.string().meta({ bytes: n })`. */
220
220
  (options: {
221
221
  schema: Schema<string>;
222
222
  }): FieldDescriptor<string>;
@@ -243,9 +243,9 @@ export declare const field: {
243
243
  length: number;
244
244
  }) => FieldDescriptor<Uint8Array>;
245
245
  /**
246
- * A fixed-layout array of `count` records. `schema` is an `mz.object` of
247
- * fixed-width members (`mz.u32()`, `mz.int(0, 3)`, `mz.string(n)`,
248
- * `mz.boolean()`) — the same schema `field.object` takes, repeated `count`
246
+ * A fixed-layout array of `count` records. `schema` is a `reef.object` of
247
+ * fixed-width members (`reef.u32()`, `reef.int(0, 3)`, `reef.string(n)`,
248
+ * `reef.boolean()`) — the same schema `field.object` takes, repeated `count`
249
249
  * times. Every record occupies `recordSize` bytes at a computable offset:
250
250
  * reads and writes are direct memory access, no serialization.
251
251
  */
@@ -255,13 +255,13 @@ export declare const field: {
255
255
  }) => ListDescriptor<S>;
256
256
  };
257
257
  /**
258
- * The zod schema for a field's logical unit: the declared `schema` for
258
+ * The schema for a field's logical unit: the declared `schema` for
259
259
  * object/array/list fields (for lists, the record schema), and a derived
260
260
  * scalar/typed-array schema for everything else.
261
261
  */
262
262
  export type FieldSchema<D> = 'schema' extends keyof D ? NonNullable<D['schema']> : z.ZodType<InferField<D>>;
263
263
  /**
264
- * A zod schema per field — `memory.schemas.<field>` re-exports what the spec
264
+ * A schema per field — `memory.schemas.<field>` re-exports what the spec
265
265
  * declared inline. Intent groups mirror their spec shape:
266
266
  * `memory.schemas.lists.incidents` is the record schema.
267
267
  */
@@ -280,9 +280,9 @@ export declare class SharedMemory<S extends SharedSpec = SharedSpec> {
280
280
  /** The field descriptors the contract was defined with — the inline spec. */
281
281
  readonly spec: S;
282
282
  /**
283
- * One zod schema per field, derived from the spec: declared schemas on
283
+ * One schema per field, derived from the spec: declared schemas on
284
284
  * object/array fields, the record schema on list fields, and derived
285
- * scalar schemas (z.number(), z.string(), …) elsewhere.
285
+ * scalar schemas elsewhere.
286
286
  */
287
287
  readonly schemas: SpecSchemas<S>;
288
288
  private readonly codec;