@earendil-works/chord 1.2.0 → 1.3.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +14 -13
  3. package/dist/cell.d.ts +30 -9
  4. package/dist/cell.d.ts.map +1 -1
  5. package/dist/cell.js +52 -12
  6. package/dist/cell.js.map +1 -1
  7. package/dist/cluster.d.ts +4 -3
  8. package/dist/cluster.d.ts.map +1 -1
  9. package/dist/cluster.js +58 -42
  10. package/dist/cluster.js.map +1 -1
  11. package/dist/connection.d.ts +171 -58
  12. package/dist/connection.d.ts.map +1 -1
  13. package/dist/connection.js +676 -217
  14. package/dist/connection.js.map +1 -1
  15. package/dist/contract.d.ts +120 -45
  16. package/dist/contract.d.ts.map +1 -1
  17. package/dist/contract.js +104 -15
  18. package/dist/contract.js.map +1 -1
  19. package/dist/declare.d.ts +11 -48
  20. package/dist/declare.d.ts.map +1 -1
  21. package/dist/declare.js +1 -21
  22. package/dist/declare.js.map +1 -1
  23. package/dist/delta/index.d.ts +2 -1
  24. package/dist/delta/index.d.ts.map +1 -1
  25. package/dist/delta/index.js +4 -0
  26. package/dist/delta/index.js.map +1 -1
  27. package/dist/errors.d.ts +4 -3
  28. package/dist/errors.d.ts.map +1 -1
  29. package/dist/errors.js +15 -0
  30. package/dist/errors.js.map +1 -1
  31. package/dist/host.d.ts +214 -120
  32. package/dist/host.d.ts.map +1 -1
  33. package/dist/host.js +446 -241
  34. package/dist/host.js.map +1 -1
  35. package/dist/index.d.ts +8 -8
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/link.d.ts +47 -12
  40. package/dist/link.d.ts.map +1 -1
  41. package/dist/link.js +200 -14
  42. package/dist/link.js.map +1 -1
  43. package/dist/loader.d.ts.map +1 -1
  44. package/dist/loader.js +7 -2
  45. package/dist/loader.js.map +1 -1
  46. package/dist/manager.d.ts.map +1 -1
  47. package/dist/manager.js +35 -9
  48. package/dist/manager.js.map +1 -1
  49. package/dist/object.d.ts +438 -0
  50. package/dist/object.d.ts.map +1 -0
  51. package/dist/{record.js → object.js} +614 -335
  52. package/dist/object.js.map +1 -0
  53. package/dist/output.d.ts +85 -0
  54. package/dist/output.d.ts.map +1 -0
  55. package/dist/output.js +350 -0
  56. package/dist/output.js.map +1 -0
  57. package/dist/registry.d.ts +3 -3
  58. package/dist/registry.d.ts.map +1 -1
  59. package/dist/registry.js +1 -1
  60. package/dist/registry.js.map +1 -1
  61. package/dist/reload.d.ts +35 -27
  62. package/dist/reload.d.ts.map +1 -1
  63. package/dist/reload.js +256 -192
  64. package/dist/reload.js.map +1 -1
  65. package/dist/remote.d.ts +130 -35
  66. package/dist/remote.d.ts.map +1 -1
  67. package/dist/remote.js +493 -189
  68. package/dist/remote.js.map +1 -1
  69. package/dist/types.d.ts +39 -28
  70. package/dist/types.d.ts.map +1 -1
  71. package/dist/types.js.map +1 -1
  72. package/dist/websocket.d.ts +4 -5
  73. package/dist/websocket.d.ts.map +1 -1
  74. package/dist/websocket.js +3 -2
  75. package/dist/websocket.js.map +1 -1
  76. package/dist/wire.d.ts +210 -129
  77. package/dist/wire.d.ts.map +1 -1
  78. package/dist/wire.js +108 -55
  79. package/dist/wire.js.map +1 -1
  80. package/docs/guide.md +267 -203
  81. package/docs/spec.md +141 -114
  82. package/docs/tutorial.md +257 -235
  83. package/package.json +6 -1
  84. package/dist/record.d.ts +0 -320
  85. package/dist/record.d.ts.map +0 -1
  86. package/dist/record.js.map +0 -1
@@ -0,0 +1,438 @@
1
+ import type { Static, TSchema } from "typebox";
2
+ import { Cell, Derived, HYDRATION, type Hydration, type Sources, type SourceValues } from "./cell.ts";
3
+ import { type Accepts, type Adapter, type AnyContract, type ImplementationOf, type InputOf, type LocalContract, type MemberDescription, type Ref } from "./contract.ts";
4
+ import type { EventOf, ListenerDecl, Resource, ResourceDeclaration, Subscribable, ValueOf } from "./declare.ts";
5
+ import type { Registration, Registry } from "./registry.ts";
6
+ import type { RemoteHost } from "./remote.ts";
7
+ import type { Ctx, Exposed, GetOptions, Readable, RefStatus, Shape, StateEvent } from "./types.ts";
8
+ /**
9
+ * `serve` options. `lifetime` says how long objects of the type live. `"referenced"` (default): created at the first
10
+ * `get` of an address, disposed after the last reference is released (plus `linger`). `"host"`: one object, created when
11
+ * its facet loads (loading waits until it is live) and kept until the host closes or a reload removes its facet. Only
12
+ * local types whose input accepts `{}` may have it (`ServeOptionsFor` checks that at compile time, `serve` again at
13
+ * runtime); every `get` reaches that one object, created for the host principal. Only such objects may register into
14
+ * registries.
15
+ */
16
+ export type ServeOptions = ReferencedServeOptions | HostServeOptions;
17
+ export interface ReferencedServeOptions {
18
+ readonly lifetime?: "referenced";
19
+ /** Milliseconds an object stays alive after its last reference is released. */
20
+ readonly linger?: number;
21
+ /** Adapters for consumers built against older contract versions. */
22
+ readonly accepts?: Accepts;
23
+ }
24
+ export interface HostServeOptions {
25
+ readonly lifetime: "host";
26
+ /** An object of lifetime `"host"` lives as long as the host: it does not linger. */
27
+ readonly linger?: undefined;
28
+ /** Adapters for consumers built against older contract versions. */
29
+ readonly accepts?: Accepts;
30
+ }
31
+ /**
32
+ * The options `serve` accepts for `C`: `lifetime: "host"` only for a local type whose input has no required fields
33
+ * (the type's one object has the empty input).
34
+ */
35
+ export type ServeOptionsFor<C extends AnyContract> = C extends LocalContract ? Record<never, never> extends InputOf<C> ? ServeOptions : ReferencedServeOptions : ReferencedServeOptions;
36
+ export type Lifetime = "referenced" | "host";
37
+ /** A type's factory. `P` is the app's principal type: `principal` is the caller the object is created for. */
38
+ export type Factory<C extends AnyContract, P = unknown> = (input: InputOf<C>, principal: P, self: Self<P>) => ImplementationOf<C, P>;
39
+ type AnyFactory = (input: unknown, principal: unknown, self: Self) => unknown;
40
+ export interface Service {
41
+ readonly contract: AnyContract;
42
+ readonly factory: AnyFactory;
43
+ readonly options: ServeOptions;
44
+ readonly facet: string;
45
+ }
46
+ export declare const makeService: <C extends AnyContract>(contract: C, factory: Factory<C>, options: ServeOptions, facet: string) => Service;
47
+ /** Whether objects of `service` have `lifetime: "host"`. */
48
+ export declare const hostLifetime: (service: Service) => boolean;
49
+ /** Options of `self.state`. */
50
+ export interface StateOptions<T> {
51
+ /** The meaning of the cell's value (default 1). A reload that raises it runs `migrate`. */
52
+ readonly version?: number;
53
+ /**
54
+ * Maps the value of an older version (`from`) to this version's, at the reload that raised the version. The cell
55
+ * may be several versions behind. Without it, the value is kept and must fit the new schema.
56
+ */
57
+ readonly migrate?: (old: unknown, from: number) => T;
58
+ }
59
+ /**
60
+ * A cell's first value from its source: `init` runs after the object's resources are open and its references are live,
61
+ * before the object goes live, so no call, listener or subscriber sees a value that is not from the source. It runs in
62
+ * a root of its own (acting as the host principal) and may be async; the inits of one object run in parallel. Its
63
+ * value is validated against the schema; a throw or an invalid value fails the activation.
64
+ */
65
+ export interface StateInit<T, P = unknown> {
66
+ readonly init: (ctx: Ctx<P>) => T | Promise<T>;
67
+ }
68
+ /** What a factory declares through. `P` is the app's principal type (`ctx.principal` of its listeners and tasks). */
69
+ export interface Self<P = unknown> {
70
+ /**
71
+ * A state cell named `name`: its schema (required: there is no TypeScript at runtime) and its initial value
72
+ * (validated), or `{ init }` to read the first value from its source before the object goes live. The name identifies
73
+ * the cell across reloads: a reload keeps the cell and its value (`initial` is ignored, `init` does not run), migrates
74
+ * it when its version rises, and refuses a schema change without a version bump. A cell a reload adds runs its `init`
75
+ * while the reload prepares.
76
+ */
77
+ state<S extends TSchema>(name: string, schema: S, initial: Static<S> | StateInit<Static<S>, P>, options?: StateOptions<Static<S>>): Cell<Static<S>>;
78
+ /** An object-owned reference, identified by its address. */
79
+ get<C extends AnyContract>(type: C, input: InputOf<C>, options?: GetOptions<P>): Ref<C>;
80
+ /**
81
+ * A resource named `name`: opened before the object goes live, closed after it is disposed. A reload keeps it unless
82
+ * its `version`, `deps` or `exclusive` changed.
83
+ */
84
+ resource<T>(name: string, declaration: ResourceDeclaration<T>): Resource<T>;
85
+ /**
86
+ * Reacts to `source` once the object is live: a readable (cell, derivation, reference state member) delivers its
87
+ * current value, then every new value; an event source (or a resource whose value is one) delivers its events.
88
+ * With `select`, subscribes to `select(value)` instead (the opened value for a resource). Each event runs `handler`
89
+ * in a fresh root. The name keeps the subscription across reloads while its source and `select` are unchanged; a
90
+ * listener on state whose source the reload replaced (a derivation is new at every reload) subscribes again and
91
+ * gets the current value again, so a handler of state must reconcile, not count.
92
+ */
93
+ on<S>(name: string, source: S, handler: (event: EventOf<S>, ctx: Ctx<P>) => void | Promise<void>): void;
94
+ on<S, E>(name: string, source: S, select: (value: ValueOf<S>) => Subscribable<E>, handler: (event: E, ctx: Ctx<P>) => void | Promise<void>): void;
95
+ /** Long-running work of the live object (a code holder: its calls start fresh roots), restarted at every reload. */
96
+ task(fn: (ctx: Ctx<P>) => Promise<void>): void;
97
+ /** A synchronous projection of readables, recomputed when they change; a new one at every reload. */
98
+ derive<const S extends Sources, T>(sources: S, fn: (...values: SourceValues<S>) => T): Readable<T>;
99
+ /** Objects of lifetime `"host"` only. Keys are the registry's own keys. */
100
+ register<V>(registry: Registry<V>, entries: Readonly<Record<string, V>>): void;
101
+ /**
102
+ * A member backed by one of this object's resources, for local contracts: references read the resource's value once
103
+ * the object is live (`undefined` before). Typically an `opaque` member: `{ harness: self.expose(durable) }`.
104
+ */
105
+ expose<T>(resource: Resource<T>): Exposed<T>;
106
+ }
107
+ export declare class ResourceImpl<T = unknown> implements Resource<T> {
108
+ #private;
109
+ readonly key: string;
110
+ /** The declaration of the factory run whose code is current: a kept resource adopts the new one at commit. */
111
+ spec: ResourceDeclaration<T>;
112
+ readonly deps: readonly (RefCore | ResourceImpl)[];
113
+ /** `unavailable`: a close/reopen failed during a reload rollback; the value is gone for good. */
114
+ state: "closed" | "opening" | "open" | "unavailable";
115
+ constructor(key: string, spec: ResourceDeclaration<T>, deps: readonly (RefCore | ResourceImpl)[]);
116
+ get value(): T;
117
+ get exclusive(): boolean;
118
+ /**
119
+ * Opens the resource. An open that completes after `signal` aborted (rollback, abandonment) closes the value it
120
+ * produced at once: nobody owns it any more.
121
+ */
122
+ open(signal: AbortSignal, order: ResourceImpl[]): Promise<void>;
123
+ close(order: ResourceImpl[]): Promise<void>;
124
+ markUnavailable(): void;
125
+ /**
126
+ * A reload kept this resource (same version, deps and exclusivity): its later `close` is the new declaration's, and
127
+ * the old declaration (with the old code it closes over) is no longer referenced.
128
+ */
129
+ adopt(spec: ResourceDeclaration<T>): void;
130
+ }
131
+ type TaskFn = (ctx: Ctx) => Promise<void>;
132
+ /** Everything one factory run declared, by kind and key. */
133
+ export declare class Decls {
134
+ readonly cells: Map<string, Cell<unknown>>;
135
+ readonly cellSchemas: Map<string, TSchema>;
136
+ readonly cellVersions: Map<string, number>;
137
+ readonly cellMigrations: Map<string, (old: unknown, from: number) => unknown>;
138
+ readonly refs: Map<string, RefCore>;
139
+ readonly resources: Map<string, ResourceImpl<unknown>>;
140
+ /** Resources this run kept from the previous one, with this run's declarations (adopted at commit). */
141
+ readonly adopted: Map<ResourceImpl<unknown>, ResourceDeclaration<unknown>>;
142
+ readonly listeners: Map<string, ListenerDecl>;
143
+ /** By position (`#0`, `#1`, …): tasks have no names. */
144
+ readonly tasks: Map<string, TaskFn>;
145
+ /** By position: derivations have no names and are new at every run. */
146
+ readonly derives: Map<string, Derived<unknown>>;
147
+ readonly registrations: Map<string, Registration>;
148
+ }
149
+ type InitFn = (ctx: Ctx) => unknown;
150
+ /** One factory run: its implementation, declarations and the objects it created (not reused from the previous run). */
151
+ export interface Run {
152
+ readonly implementation: Record<string, unknown>;
153
+ readonly decls: Decls;
154
+ readonly created: {
155
+ readonly refs: RefCore[];
156
+ readonly resources: ResourceImpl[];
157
+ readonly derives: Derived<unknown>[];
158
+ /** Cells this run created with `init`, which fills them before they are used. */
159
+ readonly inits: (readonly [Cell<unknown>, InitFn])[];
160
+ };
161
+ }
162
+ export interface Installed {
163
+ readonly codeVersion: number;
164
+ readonly service: Service;
165
+ readonly implementation: Record<string, unknown>;
166
+ readonly decls: Decls;
167
+ }
168
+ export interface HostCore {
169
+ readonly name: string;
170
+ readonly dev: boolean;
171
+ readonly principal: unknown;
172
+ inFactory: number;
173
+ /** Set when a commit failed midway: the host admits no more work (terminal). */
174
+ readonly failed: unknown;
175
+ report(error: unknown): void;
176
+ currentCodeVersion(): number;
177
+ hasCodeVersion(codeVersion: number): boolean;
178
+ retainedCodeVersions(): Iterable<readonly [number, ReadonlyMap<string, Service>]>;
179
+ pendingCodeVersion(): number | undefined;
180
+ service(typeName: string): Service | undefined;
181
+ acquire(type: AnyContract, input: unknown, options: GetOptions | undefined, owner: RefOwner, from?: ObjectImpl, candidate?: boolean): RefCore;
182
+ addressOf(type: AnyContract, input: unknown, principal: unknown, candidate?: boolean): string;
183
+ root<T>(fn: (ctx: Ctx) => T | Promise<T>, options?: {
184
+ codeVersion?: number;
185
+ signal?: AbortSignal;
186
+ }): Promise<T>;
187
+ touch(rootId: string, object: ObjectImpl): void;
188
+ forget(object: ObjectImpl): void;
189
+ /** The object finished its disposal. */
190
+ disposed(object: ObjectImpl): void;
191
+ /** Milliseconds a reload waits for aborted tasks to finish before starting their replacements. */
192
+ readonly taskStopDeadline: number;
193
+ /**
194
+ * Milliseconds an activation or a reload's prepare waits for its references to be ready and hydrated before it fails
195
+ * (`unavailable/ready_timeout`; a reference cycle across hosts never resolves).
196
+ */
197
+ readonly readyTimeout: number;
198
+ checkRegistrations(object: ObjectImpl, decls: Decls): void;
199
+ /** Rebuilds the current registry tables from live objects (plus `including`, which is finishing activation). */
200
+ registriesChanged(including?: ObjectImpl): void;
201
+ }
202
+ export declare class CtxImpl implements Ctx {
203
+ #private;
204
+ readonly host: HostCore;
205
+ readonly signal: AbortSignal;
206
+ readonly rootId: string;
207
+ readonly codeVersion: number;
208
+ readonly principal: unknown;
209
+ /** Code holders (tasks): every call they make starts a fresh root. */
210
+ readonly holder: boolean;
211
+ /** True after the call or root that received this ctx settled: it may no longer start work. */
212
+ get closed(): boolean;
213
+ /** Throws unless this ctx may start work on `host` (the called reference's host) now: not expired, aborted or foreign. */
214
+ check(host: HostCore | RemoteHost): void;
215
+ /** `signals`: the ctx is aborted with the first of them; it stops following them when it closes. */
216
+ constructor(host: HostCore, fields: {
217
+ signals: readonly AbortSignal[];
218
+ rootId: string;
219
+ codeVersion: number;
220
+ principal: unknown;
221
+ holder?: boolean;
222
+ });
223
+ get<C extends AnyContract>(type: C, input: InputOf<C>, options?: GetOptions): Promise<Ref<C>>;
224
+ /**
225
+ * A context for a call into `object`: same root and code version, its own call-owned references, aborted on forced
226
+ * disposal. Code inside an object acts as the host principal.
227
+ */
228
+ child(object: ObjectImpl): CtxImpl;
229
+ close(): void;
230
+ }
231
+ /**
232
+ * A signal aborted with the first of `sources` to abort, until `release()`. Not `AbortSignal.any`: Node keeps a
233
+ * dependant of a long-lived source (an object's or a code version's) reachable while it has abort listeners, so every
234
+ * call or task context would keep its listeners, and the code they close over, alive as long as the source.
235
+ */
236
+ export declare function linkedSignal(sources: readonly AbortSignal[]): {
237
+ readonly signal: AbortSignal;
238
+ release(): void;
239
+ };
240
+ /**
241
+ * Waits until `ref` is ready, at most `ms` and until a signal aborts; on failure the reference is released (only it: a
242
+ * binding other references share stays) and the error is rethrown: the activation error, `aborted`, or
243
+ * `unavailable/ready_timeout`.
244
+ */
245
+ export declare function awaitReady(ref: RefCore, signals: readonly AbortSignal[], ms: number): Promise<void>;
246
+ export declare function raceSignal<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
247
+ /** Who a reference belongs to. `connection`: a peer host over a link; `client`: a browser (not a reload participant). */
248
+ export type RefOwner = "object" | "call" | "host" | "external" | "connection" | "client";
249
+ /** A claim on an object: a local `RefImpl`, or a `RemoteRef` on another host (no object here). */
250
+ export interface RefCore {
251
+ readonly address: string;
252
+ readonly contract: AnyContract;
253
+ readonly status: RefStatus;
254
+ readonly ready: Promise<void>;
255
+ readonly proxy: object;
256
+ readonly object: ObjectImpl | undefined;
257
+ release(): void;
258
+ }
259
+ export declare const REF_BASE: ReadonlySet<PropertyKey>;
260
+ export type StatusListener = (status: RefStatus, error: unknown) => void;
261
+ /** Queues a status notification (after the change that caused it is complete, like every publication). */
262
+ export declare function notifyStatus(listeners: ReadonlySet<StatusListener>, status: RefStatus, error: unknown, report: (error: unknown) => void): void;
263
+ /** Proxy → reference, for `deps: [ref]` and links. */
264
+ export declare const refsByProxy: WeakMap<object, RefCore>;
265
+ export declare const refOf: (value: unknown) => RefCore | undefined;
266
+ /**
267
+ * A reference's state member: a stable readable that follows whatever source the current implementation exposes under
268
+ * that name. Reading throws `not_ready` until the reference is live, `not_in_variant` while the variant lacks the
269
+ * member. A listener added before the member is readable gets its snapshot then. Rebinding (reload, variant) delivers a
270
+ * reset. Upstream is subscribed only while someone listens.
271
+ */
272
+ declare class MemberReadable implements Readable<unknown> {
273
+ #private;
274
+ constructor(ref: RefImpl, name: string);
275
+ get value(): unknown;
276
+ /** Not hydrated while the reference is not live, or while its source (a forwarded remote member) is not. */
277
+ get [HYDRATION](): Hydration | undefined;
278
+ subscribe(listener: (value: unknown) => void): () => void;
279
+ events(listener: (event: StateEvent<unknown>) => void): () => void;
280
+ /** (Re)subscribes upstream to the current source; a changed source is announced as a reset. */
281
+ bind(): void;
282
+ stop(): void;
283
+ }
284
+ /** One reference on an object. Exposed through a Proxy so members bind late to the current implementation. */
285
+ export declare class RefImpl {
286
+ #private;
287
+ readonly object: ObjectImpl;
288
+ readonly contract: AnyContract;
289
+ readonly owner: RefOwner;
290
+ readonly address: string;
291
+ readonly proxy: object;
292
+ readonly ready: Promise<void>;
293
+ status: RefStatus;
294
+ error: unknown;
295
+ readonly shapeListeners: Set<(shape: Shape) => void>;
296
+ /** Internal: notified when the reference becomes gone (links forward it). */
297
+ readonly goneListeners: Set<(error: unknown) => void>;
298
+ readonly readables: Map<string, MemberReadable>;
299
+ /** Weak: a retired code version's service (and the factory code it holds) must not be kept alive by its consumers. */
300
+ readonly bindings: WeakMap<Service, Adapter | undefined>;
301
+ readonly views: WeakMap<Record<string, unknown>, Record<string, unknown>>;
302
+ readonly callers: Map<string, (...given: unknown[]) => Promise<unknown>>;
303
+ constructor(object: ObjectImpl, contract: AnyContract, owner: RefOwner);
304
+ get variant(): string | undefined;
305
+ get shape(): Shape | undefined;
306
+ onShape(listener: (shape: Shape) => void): () => void;
307
+ onStatus(listener: StatusListener): () => void;
308
+ release(): void;
309
+ live(): void;
310
+ gone(error: unknown): void;
311
+ shapeChanged(): void;
312
+ terminalError(): unknown;
313
+ /** The implementation as this consumer sees it (through an accepts adapter when bound to another version). */
314
+ viewOf(installed: Installed): Record<string, unknown>;
315
+ currentView(): Record<string, unknown> | undefined;
316
+ describe(variant: string | undefined, member: string): MemberDescription | undefined;
317
+ /** Remote consumers see only the members their contract lists for the current variant. */
318
+ inVariant(view: Record<string, unknown>, name: string): boolean;
319
+ member(name: string): unknown;
320
+ caller(name: string): (...given: unknown[]) => Promise<unknown>;
321
+ }
322
+ export declare const variantOf: (implementation: Record<string, unknown>) => string | undefined;
323
+ export type ObjectStatus = "activating" | "live" | "failed" | "disposing" | "disposed";
324
+ interface Gate {
325
+ readonly grandfathered: Set<string>;
326
+ readonly queue: {
327
+ readonly key: string;
328
+ readonly event: unknown;
329
+ }[];
330
+ drained: () => void;
331
+ }
332
+ /** Listener subscriptions made ahead of a commit: `activate` switches over, `discard` drops them. */
333
+ export interface StagedListeners {
334
+ activate(): void;
335
+ discard(): void;
336
+ }
337
+ export interface ObjectIdentity {
338
+ readonly address: string;
339
+ readonly typeName: string;
340
+ readonly input: unknown;
341
+ readonly principal: unknown;
342
+ /** The one object of a `lifetime: "host"` type. */
343
+ readonly hostLifetime: boolean;
344
+ }
345
+ export declare class ObjectImpl {
346
+ #private;
347
+ readonly host: HostCore;
348
+ readonly address: string;
349
+ readonly typeName: string;
350
+ readonly input: unknown;
351
+ readonly principal: unknown;
352
+ /** The one object of a `lifetime: "host"` type: only such objects may register. */
353
+ readonly hostLifetime: boolean;
354
+ status: ObjectStatus;
355
+ ready: Promise<void>;
356
+ service: Service | undefined;
357
+ /** Calls carrying an older code version are rejected upgrade_conflict (state bump or exclusive resource replaced). */
358
+ minCodeVersion: number;
359
+ decls: Decls;
360
+ /** Declarations of a factory run that has not been installed yet (activation or reload candidate). */
361
+ readonly pending: Set<Decls>;
362
+ readonly implementations: Map<number, Installed>;
363
+ readonly refs: Set<RefImpl>;
364
+ readonly leases: Map<string, number>;
365
+ readonly openOrder: ResourceImpl[];
366
+ readonly callAbort: AbortController;
367
+ readonly activationAbort: AbortController;
368
+ gate: Gate | undefined;
369
+ /** Served only by a running reload's pending code version: listeners, tasks and registrations start at its commit. */
370
+ deferredRuntime: boolean;
371
+ constructor(host: HostCore, identity: ObjectIdentity);
372
+ start(after: Promise<void> | undefined): void;
373
+ /**
374
+ * Runs the factory synchronously. With `previous`, runs in recording mode for a reload prepare. The run's
375
+ * declarations stay in `pending` (visible to the cycle check) until the caller installs or discards them.
376
+ */
377
+ run(service: Service, previous: Decls | undefined): Run;
378
+ /** Opens resources (dependencies first) and waits for references; settles all before failing. */
379
+ open(resources: readonly ResourceImpl[], refs: readonly RefCore[], signal: AbortSignal): Promise<void>;
380
+ /**
381
+ * Waits until the state sources a run exposes or derives from have their values: a local object goes live only with
382
+ * its state, also where it forwards or derives from a remote reference's member.
383
+ */
384
+ waitHydrated(run: Run): Promise<void>;
385
+ /** `work` within the host's `readyTimeout`; a timeout names what is still awaited. */
386
+ withinReadyTimeout<T>(work: Promise<T>, waiting: () => readonly string[]): Promise<T>;
387
+ /**
388
+ * Fills the cells `run` created with `init`, each in a root of its own, in parallel; settles all before failing. Runs
389
+ * after the run's resources are open and its references live, before anything reads the cells.
390
+ */
391
+ initCells(run: Run, signal: AbortSignal): Promise<void>;
392
+ /** Undoes the objects a run created: closes its resources (reverse order) and releases its references. */
393
+ unwind(run: Run): Promise<void>;
394
+ currentInstalled(): Installed | undefined;
395
+ /** Every state source exposed as a remote state member gets that member's schema (checked per write in dev mode). */
396
+ refreshSchemas(): void;
397
+ allDecls(): Set<Decls>;
398
+ /**
399
+ * Subscribes the listeners of `decls` without delivering: events are buffered until `activate`. A listener declared
400
+ * on the same resource (or source) with the same `select` keeps its subscription without calling `select` again
401
+ * (only its function is swapped, by name), so sources that accept a single subscriber survive reloads. Throws, with
402
+ * nothing left subscribed, if any source fails.
403
+ */
404
+ stageListeners(decls: Decls): StagedListeners;
405
+ startRuntime(): void;
406
+ /**
407
+ * Starts the tasks of the current declarations. Runs aborted by `stopTasks` (a reload, a gate) may still be finishing:
408
+ * their replacements start once they all finished, or after `taskStopDeadline` (reported), so the old and the new run
409
+ * of a task never work side by side. A later start or stop, or the object leaving `live`, cancels a delayed start.
410
+ */
411
+ startTasks(): void;
412
+ stopListeners(): void;
413
+ /**
414
+ * Aborts running tasks (and cancels a delayed start). Their completion is awaited by the next `startTasks` and at
415
+ * disposal; each leaves `#stopped` when it finishes.
416
+ */
417
+ stopTasks(): void;
418
+ /** Opens the object's gate and replays queued listener events through the current listeners. */
419
+ openGate(): void;
420
+ /** Admission for a call or write carrying `ctx`. */
421
+ admit(ctx: Ctx): void;
422
+ /** Records that the root of `ctx` touched this object (a reload gate grandfathers it). */
423
+ lease(ctx: Ctx): void;
424
+ guard: (ctx: Ctx) => void;
425
+ call(ref: RefImpl, name: string, args: unknown, ctx: CtxImpl): Promise<unknown>;
426
+ rootEnded(rootId: string): void;
427
+ addRef(ref: RefImpl): void;
428
+ release(ref: RefImpl): void;
429
+ /**
430
+ * Disposes the object. Forced: references become gone at once (new calls are rejected) and running invocations are
431
+ * cancelled. Either way, resources close only after every invocation settled.
432
+ */
433
+ dispose(forced: boolean, reason?: unknown): Promise<void>;
434
+ }
435
+ /** The remote state-member schemas an implementation exposes, by source. */
436
+ export declare function memberSchemas(service: Service, implementation: Record<string, unknown>): Map<Readable<unknown>, TSchema[]>;
437
+ export {};
438
+ //# sourceMappingURL=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