@almadar/shell-node 0.1.0 → 1.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.
@@ -1,10 +1,10 @@
1
- import { EventPayload, EffectHandlers, EvaluationContextExtensions, KernelModule, HttpPortsOptions, OsGrantPort, OsHostPort, EntityRow, EventBus, TransitionObserver, TraitState } from '@almadar/shell-runtime';
2
- import { OrbitalEventRequest, OrbitalEventResponse, BusEventSource, Entity, OrbitalDefinition, Trait, TraitConfig, PersistenceAdapter, UserContext, OrbitalSchema, MessageCatalogs, RowSetRef, RowQueryPage, ExternalInput, ServiceHostPorts, DispatchRequestOutcome, ExternalInputRequest, ClientEffectTuple, InboundDelivery, InboundAnswer, TraitTick } from '@almadar/core';
3
- export { ClientEffectTuple, ClientNavigateBackTuple, ClientNavigateTuple, ClientRenderUITuple, OrbitalEventRequest, OrbitalEventResponse, TransitionRejection } from '@almadar/core';
1
+ import { EventPayload, EffectHandlers, EvaluationContextExtensions, KernelModule, SecretPortsOptions, OsGrantPort, OsHostPort, EventBus, TraitState } from '@almadar/shell-runtime';
2
+ import { EventRequest, EventResponse, BusEventSource, OrbitalDefinition, PersistenceAdapter, OrbitalSchema, RowSetRef, RowQueryPage, ExternalInput, UserContext, ServiceHostPorts, DispatchRequestOutcome, ExternalInputRequest, ClientEffectTuple, InboundDelivery, InboundAnswer } from '@almadar/core';
3
+ export { ClientEffectTuple, ClientNavigateBackTuple, ClientNavigateTuple, ClientRenderUITuple, EventRequest, EventResponse, TransitionRejection } from '@almadar/core';
4
4
 
5
5
  /**
6
6
  * OrbitalServerRuntime: the Node host that runs a registered program on the kernel. It answers the kernel's asks
7
- * (rows, services, `http`, `os` through the given os host, live streams), drives its ticks and mounts; it serves no
7
+ * (rows, services, secrets, `os` through the given os host, live streams), drives its ticks and mounts; it serves no
8
8
  * HTTP routes (a served program composes std-http-server for that).
9
9
  *
10
10
  * @packageDocumentation
@@ -14,10 +14,6 @@ export { ClientEffectTuple, ClientNavigateBackTuple, ClientNavigateTuple, Client
14
14
  type RuntimeOrbitalSchema = OrbitalSchema;
15
15
  /** @deprecated Use OrbitalDefinition from @almadar/core */
16
16
  type RuntimeOrbital = OrbitalDefinition;
17
- /** @deprecated Use Trait from @almadar/core */
18
- type RuntimeTrait = Trait;
19
- /** @deprecated Use TraitTick from @almadar/core */
20
- type RuntimeTraitTick = TraitTick;
21
17
  /**
22
18
  * Incremental-push item streamed to an SSE client mid-dispatch (an emitted
23
19
  * event or a client effect), before the response resolves.
@@ -38,37 +34,8 @@ type PushItem = {
38
34
  /**
39
35
  * Registered orbital with runtime state
40
36
  */
41
- /** One registered orbital as the API lists it. */
42
- interface OrbitalSummary {
43
- name: string;
44
- entity: string | undefined;
45
- traits: string[];
46
- }
47
- /** One registered orbital as the API describes it: its entity and each trait's current state, states and events. */
48
- interface OrbitalInfo {
49
- name: string;
50
- entity: Entity;
51
- traits: {
52
- name: string;
53
- currentState: string | undefined;
54
- states: string[];
55
- events: string[];
56
- }[];
57
- }
58
37
  interface RegisteredOrbital {
59
38
  schema: OrbitalDefinition;
60
- /** Resolved entity (never a string ref at runtime) */
61
- entity: Entity;
62
- /** Resolved inline traits (string refs filtered out) */
63
- traits: Trait[];
64
- /**
65
- * Call-site `config: { ... }` attached to each trait ref, keyed by trait
66
- * name. Used to populate the `@config.X` binding when running that trait's
67
- * effects. Preserved from the preprocessed schema's trait-ref wrapper
68
- * (`{ ref, config, linkedEntity, _resolved }`) before the wrapper is
69
- * unwrapped to its inline form.
70
- */
71
- configByTrait: Map<string, TraitConfig>;
72
39
  }
73
40
  /**
74
41
  * One persist-envelope success emit, handed to the live-broadcast sink
@@ -97,8 +64,8 @@ interface LiveBroadcastItem {
97
64
  */
98
65
  interface HostDispatchItem {
99
66
  orbitalName: string;
100
- request: OrbitalEventRequest;
101
- response: OrbitalEventResponse;
67
+ request: EventRequest;
68
+ response: EventResponse;
102
69
  originClientId?: string;
103
70
  }
104
71
  /**
@@ -124,13 +91,6 @@ interface OrbitalServerRuntimeConfig {
124
91
  effectHandlers?: Partial<EffectHandlers>;
125
92
  /** Persistence adapter for entity data */
126
93
  persistence?: PersistenceAdapter;
127
- /**
128
- * Data mode:
129
- * - 'mock': mock service answers and the std mock-seed dataset
130
- * - 'real': the actual persistence layer and services
131
- * Required: whoever starts the runtime states it; there is no default (EXEC-BOUND-2).
132
- */
133
- mode: 'mock' | 'real';
134
94
  /** Where a registered program with imports is resolved from (`orb resolve`). */
135
95
  loaderConfig?: LoaderConfig;
136
96
  /**
@@ -148,19 +108,6 @@ interface OrbitalServerRuntimeConfig {
148
108
  cwd: string;
149
109
  orbBin?: string;
150
110
  };
151
- /**
152
- * The persona a preview or verification run is looking at the app AS.
153
- *
154
- * `@user.id` / `@user.role` are what an app's ownership scoping and role
155
- * gates resolve against, so with no user every predicate takes its negative
156
- * branch and every owner filter matches nothing. A dev host (playground,
157
- * runtime-verify) sets it to make both branches reachable.
158
- *
159
- * Never an HTTP request's identity: `router()` resolves every request from
160
- * its verified token (or anonymous). It is the viewer for in-process calls,
161
- * ticks and the mock seeder's owner stamps.
162
- */
163
- defaultUser?: UserContext;
164
111
  /**
165
112
  * The initialised `@almadar/kernel` module that decides execution and whose I/O this runtime answers with its
166
113
  * persistence, service and program-host adapters. Absent, the runtime loads the installed `@almadar/kernel` itself
@@ -168,11 +115,10 @@ interface OrbitalServerRuntimeConfig {
168
115
  */
169
116
  kernel?: KernelModule;
170
117
  /**
171
- * What the `http` effect runs on: the kernel's request driver (`loadHttpKernel`), and optionally the secret store,
172
- * pinned fetch and resolver. The program's `egress` is read from the registered schema. Absent, an `http` effect
173
- * fails with `HTTP_KERNEL_UNAVAILABLE`.
118
+ * What the kernel's secret, random and credential asks run on: optionally the secret store, the CSPRNG and the
119
+ * credential administration port. Absent, those asks fail as unavailable.
174
120
  */
175
- http?: Omit<HttpPortsOptions, 'egress'>;
121
+ secretPorts?: SecretPortsOptions;
176
122
  /**
177
123
  * Builds the `os` host of the kernel engine from the grant port backed by the kernel (`createNodeOsHost` from
178
124
  * `@almadar/shell-node`). Absent, every `os` ask is denied, as the native host does with none.
@@ -226,10 +172,9 @@ interface OrbitalServerRuntimeConfig {
226
172
  declare class UnresolvedProgramError extends Error {
227
173
  constructor(schemaName: string);
228
174
  }
229
- /** What `register` takes beside the schema: the program's catalogs and the `uses lazy` behaviors the server runs alongside it. */
175
+ /** What `register` takes beside the schema: the folder its `uses lazy` behaviors sit beside (EXEC-LOAD-1). The program carries its own messages. */
230
176
  interface RegisterOptions {
231
- messages?: MessageCatalogs;
232
- lazy?: readonly OrbitalSchema[];
177
+ lazyDir?: string;
233
178
  }
234
179
  declare class OrbitalServerRuntime {
235
180
  protected orbitals: Map<string, RegisteredOrbital>;
@@ -237,46 +182,28 @@ declare class OrbitalServerRuntime {
237
182
  private config;
238
183
  /** The row store a host-supplied `persistence` replaces: the kernel's own `MemoryStore`, opened by the first `register()`. */
239
184
  private ownedStore;
240
- /** The owner cells the mock seed stamped, kept for a persona restamp. */
241
- private mockJournal;
242
- /** The std seed program resolved from the installed packages, once per runtime. */
243
- private seedProgram;
244
- /** Store writes (seed, reseed, restamp) run one after another. */
245
- private storeOps;
246
185
  /**
247
186
  * The bound persistence adapter (host-supplied, else the kernel's own memory store). Public so a test can
248
187
  * inspect committed rows honestly. A runtime that owns its store has one from the first `register()`.
249
188
  */
250
189
  get persistence(): PersistenceAdapter;
251
- /** Whether this runtime seeds generated mock rows: mock mode over the store it owns. */
252
- private seedsMock;
253
- private tickBindings;
254
190
  /** The kernel running the registered program; null before a program is registered. */
255
191
  private kernelEngine;
192
+ /** What the kernel holds of every trait of the registered program, read once when the kernel opens. */
193
+ private programSurface;
256
194
  /** The `os` handles of the program the kernel runs; closed when that program is replaced, reset or dropped. */
257
195
  private kernelOs;
258
- /** `orbital::trait` → the clients that have it mounted (Runtime Spec Clause 8.3). */
259
- private readonly mountedBy;
260
- private readonly tickScheduler;
261
- private readonly transitionObservers;
262
- private readonly transitionFanout;
196
+ /** Drives the kernel's one tick clock: every pass asks `KernelEngine.tickPass` which ticks are due. */
197
+ private tickTimer;
263
198
  private programHandlersPromise;
264
199
  private resolvedSchema;
265
- /** The program's declared `locales`, in declared order; the first is the default. */
266
- private appLocales;
267
- /** Merged message catalogs of every registered program (keys are behavior-qualified). */
268
- private messages;
200
+ /** The folder the program's lazy files sit beside; the pages that name them are on `resolvedSchema.lazyPages`. */
201
+ private lazyDir;
269
202
  /** Wired by the hosting server (e.g. the playground SSE endpoint) via `setLiveBroadcastSink`. */
270
203
  private readonly liveSubscribers;
271
204
  private liveBroadcastSink;
272
205
  private hostDispatchSink;
273
- /**
274
- * Tick-broadcast relay (T6): newest pending item per
275
- * (originClientId, orbital, event), flushed to the live-broadcast sink on
276
- * the `tickRelayIntervalMs` cadence — other tabs get the latest position
277
- * at snapshot rate, never 1:1 with emissions.
278
- */
279
- private readonly tickRelayPending;
206
+ /** The one-shot timer that flushes the kernel's coalesced tick relay window. */
280
207
  private tickRelayTimer;
281
208
  constructor(config: OrbitalServerRuntimeConfig);
282
209
  /**
@@ -326,20 +253,6 @@ declare class OrbitalServerRuntime {
326
253
  private doRegister;
327
254
  /** The kernel's own row store, opened once in the register phase when the host supplied none. */
328
255
  private openOwnedStore;
329
- /**
330
- * Returns the schema that this runtime is currently executing, post-
331
- * preprocessing. Safe to expose from an HTTP `/api/schema` endpoint — every
332
- * cross-orbital trait ref will have an inline `stateMachine` already, which
333
- * is what the browser's `schema-to-ir` resolver needs to wire button clicks
334
- * back to state transitions.
335
- *
336
- * Returns `null` if `register()` hasn't run yet.
337
- */
338
- /** The registered program's name, or null when nothing is registered (none yet, or after `unregisterAll`). */
339
- registeredSchemaName(): string | null;
340
- getResolvedSchema(): OrbitalSchema | null;
341
- /** The registered program's message catalogs (locale → qualified key → message), for a host's client. */
342
- getMessages(): MessageCatalogs;
343
256
  /**
344
257
  * One-call entry point: read an `.orb` file from disk, parse it, preprocess
345
258
  * cross-orbital imports, and register the result. Callers never touch raw
@@ -356,10 +269,12 @@ declare class OrbitalServerRuntime {
356
269
  */
357
270
  private registerOrbitalAsync;
358
271
  /** The adapters the kernel's I/O is answered with: this runtime's persistence, services and program host. */
359
- private httpPorts;
272
+ private secretPorts;
360
273
  private kernelPorts;
361
274
  /** One live message of a running `call-service`, stamped as its calling trait, to the requesting tab only. */
362
275
  private deliverLiveMessage;
276
+ /** The traits of one orbital as the kernel holds them. */
277
+ private traitsOf;
363
278
  /** The project root this runtime hands `orb` and the kernel's language data: the program host's cwd, else the loader base path. */
364
279
  private programRoot;
365
280
  /** The kernel module this runtime runs on: the one the host handed in, else the installed `@almadar/kernel`. */
@@ -368,53 +283,22 @@ declare class OrbitalServerRuntime {
368
283
  private openKernel;
369
284
  /** Run the kernel's boot mounts for the server side (EXEC-ENDPOINT-3): the host sends what the kernel lists and chooses nothing. */
370
285
  private mountBootEndpoints;
371
- /** The program whose rows the store holds, once seeded; absent before the first seed and after `unregisterAll`. */
372
- private seededProgram;
373
- /** The std mock-seed program, resolved by `orb` from the installed packages. */
374
- private resolveSeedProgram;
375
- /** Run `use` with the seed program forked off the kernel just opened; the fork is released after. */
376
- private withSeeder;
377
- /** Store writes (seed, reseed, restamp) run one after another, so a persona switch never interleaves a reseed. */
378
- private enqueueStoreOp;
379
- /**
380
- * Fill the store from the program, in the register phase: a mock runtime seeds every entity for the viewer, any
381
- * other runtime seeds the rows the program writes out and its browser-stored entities.
382
- */
383
- private seedStores;
384
- private managedProgram;
385
- /**
386
- * Name the program whose declared credentials this runtime's credential effects manage beside its own: an
387
- * integrations console serving the app a host shows saves and tests that app's keys. Naming another replaces it.
388
- */
389
- manageCredentialsOf(program: OrbitalSchema): void;
390
- /** A mock store seeds every entity; the `[runtime]` rows the kernel holds itself are seeded in the kernel. */
391
- private seedKernelRuntimeMock;
286
+ /** What answers the declared contract: the registered program's kernel, else the kernel's own program-less answers, which refuse every input and hook. */
287
+ private contractEngine;
392
288
  private requireKernelEngine;
393
- /**
394
- * Set up scheduled ticks for all traits
395
- */
396
- private setupTicks;
397
- /**
398
- * Register a single tick
399
- */
400
- private registerTick;
289
+ /** Ask the kernel's clock which ticks are due and start each as a `runTick` request to the orbital it names. */
290
+ private tickPass;
291
+ /** Run the kernel's clock on this host's timer when the program declares a tick. */
292
+ private restartTickClock;
401
293
  /** A tick: the host owns the timer, the kernel decides whether and over which rows it fires. */
402
294
  private executeTick;
403
- /** Tell the kernel which traits some client has mounted, so it can pause the other traits' ticks. */
404
- private syncTickMount;
405
295
  /**
406
- * Clean up all active ticks
296
+ * Stop the host's timers
407
297
  */
408
298
  private cleanupTicks;
409
299
  /**
410
300
  * Unregister all orbitals and clean up
411
301
  */
412
- /** A client mounts a trait by dispatching its lifecycle event and releases it with `$UNMOUNT`. */
413
- private recordMount;
414
- /** Drop every mount a disconnected client held, so its traits' mount-scoped ticks pause. */
415
- releaseClient(clientId: string): void;
416
- /** True while at least one client has `traitName` mounted. */
417
- isTraitMounted(orbitalName: string, traitName: string): boolean;
418
302
  unregisterAll(): void;
419
303
  /**
420
304
  * Bracket a multi-step app mutation (the classic swap is
@@ -451,20 +335,10 @@ declare class OrbitalServerRuntime {
451
335
  private bracketAls;
452
336
  private ensureBracketAls;
453
337
  withRegistrationMutation<T>(fn: () => Promise<T>): Promise<T>;
454
- /**
455
- * Reset the mock persistence store to a clean-slate re-seed without
456
- * unregistering orbitals. Exposed for verifier tools that want to
457
- * start each test with deterministic seeded rows, not the residue of
458
- * the previous walk's persist-creates. No-op when the runtime does not
459
- * seed a mock store of its own.
460
- */
461
- resetMockPersistence(): Promise<void>;
462
338
  /**
463
339
  * Return every registered orbital's circuit to boot: trait states to their
464
340
  * initial states, frames and row cache emptied, and a fresh mount (no trait
465
- * awaiting INIT, nothing held). The hermetic-reset twin of
466
- * `resetMockPersistence`: a reset walk must not inherit the previous walk's
467
- * circuit any more than its rows.
341
+ * awaiting INIT, nothing held).
468
342
  */
469
343
  resetCircuitState(): void;
470
344
  /**
@@ -481,58 +355,18 @@ declare class OrbitalServerRuntime {
481
355
  /** Run a follow-on step's call outcome as its own dispatch, and hand its result to the host-dispatch sink. */
482
356
  private runDeferredOutcome;
483
357
  /**
484
- * Switch the viewer a dev host presents the app as — see
485
- * `OrbitalServerRuntimeConfig.defaultUser`. Pass `undefined` for an
486
- * unauthenticated viewer. Takes effect on the next event; an authenticated
487
- * request still overrides it.
488
- *
489
- * Mock mode stamps the seeded owner columns for whichever id was `defaultUser`
490
- * at register time. Switching to a different id re-points those cells with
491
- * `restampMockOwner` instead of re-seeding, so an ownership-scoped view for
492
- * the new viewer has rows. The returned promise settles when the restamp has
493
- * landed (immediately when there is nothing seeded yet; register flushes it).
494
- */
495
- setDefaultUser(user: UserContext | undefined): Promise<void>;
496
- /** Whether the host named the viewer (constructor or `setDefaultUser`). If not, the viewer is
497
- * the app's first declared persona, resolved as soon as its roster is seeded. */
498
- private viewerNamedByHost;
499
- /** setDefaultUser can land before register() finishes resolving the schema
500
- * (a dev host pins a persona right after boot). An ungated restamp there
501
- * would hand a read-only persona authorship of drafts, so the restamp is
502
- * DEFERRED until the schema exists — register()/registerSync() flush it. */
503
- private pendingOwnerRestamp;
504
- /**
505
- * Re-point the seeded owner cells at `user` (a persona switch never reseeds). The seed program's policy gates decide
506
- * per row whether the persona could have created it. Deferred when the program is not seeded yet.
507
- */
508
- private restampOwnerGated;
509
- /** Flush a persona switch that arrived before the schema was resolved. */
510
- private flushPendingOwnerRestamp;
511
- /** The viewer a dev host is currently presenting the app as. */
512
- getDefaultUser(): UserContext | undefined;
513
- /**
514
- * Queue a tick-stamped dispatch for coalesced snapshot relay (T6). Newest
515
- * per (originClientId, orbital, event) wins between flushes — the standard
516
- * netcode position-broadcast discipline.
358
+ * A tick-stamped dispatch is a latest-state broadcast (T6): the kernel coalesces it with the others of the window
359
+ * (newest per origin client, orbital and event) and says how long the window stays open; this host only runs
360
+ * the timer.
517
361
  */
518
362
  private queueTickRelay;
519
363
  private flushTickRelay;
520
364
  /**
521
- * The registered app's declared persona roster: the live rows of its
522
- * `[identity]` entity, mapped onto viewers (`Almadar_LOLO_Identity.md` §4.3).
523
- * Live-store rows rather than a re-derivation, so the roster carries the ids
524
- * ownership scoping actually compares `@user.id` against. Empty when no
525
- * schema is registered or the app declares no `[identity]` entity — there is
526
- * no global fallback roster by design.
527
- */
528
- /**
529
- * `reference` resolved for `user` against the store as it is now: the rows that still match its query and the
530
- * viewer's `@read`, in the reference's order, `total` re-counted. The kernel resolves through its server
365
+ * `reference` resolved for the identity bound to `clientId`'s session (none: the anonymous viewer) against the store as it is now: the rows that still match its query and that identity's `@read`, in the reference's order, `total` re-counted. The kernel resolves through its server
531
366
  * resolve flight. A client reaches it with
532
- * `POST /:orbital/../resolve-rows` as the signed-in viewer.
367
+ * `POST /:orbital/../resolve-rows`.
533
368
  */
534
- resolveRows(reference: RowSetRef, user: UserContext): Promise<RowQueryPage>;
535
- getIdentityRoster(): Promise<UserContext[]>;
369
+ resolveRows(reference: RowSetRef, clientId: string | undefined): Promise<RowQueryPage>;
536
370
  /**
537
371
  * Process an event for an orbital — the stateful host's thin shell over
538
372
  * the unified `evaluateOrbitalEvent` composition (design:
@@ -567,12 +401,8 @@ declare class OrbitalServerRuntime {
567
401
  * milliseconds from landing. A failed mutation falls through to the miss.
568
402
  */
569
403
  private resolveRegisteredOrbital;
570
- /** The registered orbitals as `GET /` lists them. */
571
- listOrbitalSummaries(): OrbitalSummary[];
572
- /** One orbital as `GET /:orbital` describes it, awaiting an in-flight swap first (G-RUNTIME-038); `undefined` when it is not registered. */
573
- describeOrbital(orbitalName: string): Promise<OrbitalInfo | undefined>;
574
- /** An entity's full row set as `GET /:orbital/entities/:entityType` answers it (verification and tooling only); `undefined` when the orbital is not registered. */
575
- entityRows(orbitalName: string, entityType: string): Promise<EntityRow[] | undefined>;
404
+ /** The first request that names a `uses lazy` orbital registers it here; the kernel loads the same file on that request's dispatch (EXEC-LOAD-2). */
405
+ private loadLazyOrbital;
576
406
  /** The program's declared external inputs: what an outside client may send which trait. */
577
407
  listExternalInputs(): ExternalInput[];
578
408
  /**
@@ -593,11 +423,11 @@ declare class OrbitalServerRuntime {
593
423
  }, user: UserContext | undefined, message?: (payload: EventPayload) => void, assertReentry?: () => void): ServiceHostPorts;
594
424
  /**
595
425
  * A `program/dispatch` event request, as the events route (or with `input`, the inputs route) runs it: the
596
- * request's own `user` is its viewer, else the caller's. An unknown orbital is `ORBITAL_NOT_FOUND`, an undeclared
426
+ * runs as the session's identity, never a viewer the request names. An unknown orbital is `ORBITAL_NOT_FOUND`, an undeclared
597
427
  * locale `LOCALE_NOT_DECLARED`; an inbound-only event and an undeclared input are the routes' refusals.
598
428
  */
599
- dispatchEventRequest(orbital: string, request: OrbitalEventRequest, input: boolean, caller: UserContext | undefined, stream?: boolean): Promise<DispatchRequestOutcome>;
600
- dispatchExternalInput(orbitalName: string, request: ExternalInputRequest, onPush?: (item: PushItem) => void): Promise<OrbitalEventResponse>;
429
+ dispatchEventRequest(orbital: string, parsed: EventRequest, input: boolean, stream?: boolean): Promise<DispatchRequestOutcome>;
430
+ dispatchExternalInput(orbitalName: string, request: ExternalInputRequest, onPush?: (item: PushItem) => void): Promise<EventResponse>;
601
431
  /**
602
432
  * An inbound delivery (`/api/hooks/<name>`): the runtime decides whether the name is served, runs
603
433
  * the handler through `processOrbitalEvent` and answers; the host only carries the bytes.
@@ -606,13 +436,12 @@ declare class OrbitalServerRuntime {
606
436
  * An event that is an inbound hook's is delivered only by `deliverInbound`: the app's own event
607
437
  * route refuses it, as the input channel refuses an event that is no declared input.
608
438
  */
609
- refuseInboundOnly(orbitalName: string, request: Pick<OrbitalEventRequest, 'event' | 'targetTrait'>): OrbitalEventResponse | undefined;
439
+ refuseInboundOnly(orbitalName: string, request: Pick<EventRequest, 'event' | 'targetTrait'>): EventResponse | undefined;
610
440
  deliverInbound(name: string, delivery: InboundDelivery, onPush?: (item: PushItem) => void): Promise<InboundAnswer>;
611
- processOrbitalEvent(orbitalName: string, request: OrbitalEventRequest, onPush?: (item: PushItem) => void): Promise<OrbitalEventResponse>;
441
+ processOrbitalEvent(orbitalName: string, request: EventRequest, onPush?: (item: PushItem) => void): Promise<EventResponse>;
612
442
  /**
613
- * The enqueued critical section behind `processOrbitalEvent`: evaluate
614
- * one request through the composition, then relay its emits to
615
- * cross-orbital listeners. MUST only run holding the event queue.
443
+ * One request evaluated on the kernel, which orders it among every other (EXEC-CONC-2), then its emits relayed
444
+ * to the host sinks.
616
445
  */
617
446
  private evaluateForOrbital;
618
447
  /**
@@ -620,42 +449,12 @@ declare class OrbitalServerRuntime {
620
449
  * event bus (the public firehose) and `onPush` once the dispatch is done, in the order the response carries them.
621
450
  */
622
451
  private publishKernelResponse;
623
- /**
624
- * The runtime-wide event queue — ONE async serialization point for every
625
- * composition run (requests, cross-orbital relays, external emits, tick
626
- * relays). The composition commits manager state directly rather than
627
- * through the manager's per-(trait, entityId) actor queues, so without
628
- * this, two concurrent requests against the session manager could both
629
- * evaluate from the same held state and lose a transition. `run` sees
630
- * the caller's result (or throw); the queue itself never wedges on a
631
- * failure.
632
- */
633
- private eventQueue;
634
452
  /** This app's in-flight keyed `call-service`s, shared by every transition it runs (`cancel-call`). */
635
453
  private readonly inFlightCalls;
636
- /** Wait for the queue, then hold it until the returned release is called. FIFO. */
637
- private acquireEventQueue;
638
- /**
639
- * Hold the queue for `run`, handing it the hold so the work it reaches can
640
- * release it (`outsideEventQueue`). The hold is passed explicitly rather than
641
- * carried in async context: this runtime also runs in the browser (the orb
642
- * website), which has no AsyncLocalStorage.
643
- */
644
- private enqueueEvent;
645
- /**
646
- * Run `work` with this context's queue hold released, then re-acquire it (in
647
- * FIFO order behind whatever queued meanwhile). Dispatches that land while
648
- * released run as their own dispatches; their commits and the held run's
649
- * later commit follow server-arrival last-write-wins. Outside a hold, `work`
650
- * just runs.
651
- */
652
- private outsideEventQueue;
653
454
  /**
654
455
  * Get the event bus for manual event emission
655
456
  */
656
457
  getEventBus(): EventBus;
657
- /** Observe every executed hop (listener deliveries included) on every orbital; returns the unsubscribe. */
658
- observeTransitions(observer: TransitionObserver): () => void;
659
458
  /**
660
459
  * Get state for a specific orbital/trait
661
460
  */
@@ -668,27 +467,7 @@ declare class OrbitalServerRuntime {
668
467
  * Check if an orbital is registered
669
468
  */
670
469
  hasOrbital(name: string): boolean;
671
- /**
672
- * Get information about active ticks
673
- */
674
- getActiveTicks(): Array<{
675
- orbital: string;
676
- trait: string;
677
- tick: string;
678
- interval: number | string;
679
- hasGuard: boolean;
680
- }>;
681
- /** Halt every registered tick's shared clock. Delegates to `TickScheduler.pause`. */
682
- pauseTicks(): void;
683
- /** Resume ticks halted by `pauseTicks()`. Delegates to `TickScheduler.resume`. */
684
- resumeTicks(): void;
685
- /** True while ticks are paused. Delegates to `TickScheduler.isPaused`. */
686
- areTicksPaused(): boolean;
687
470
  }
688
- /**
689
- * Factory function to create a runtime instance
690
- */
691
- declare function createOrbitalServerRuntime(config: OrbitalServerRuntimeConfig): OrbitalServerRuntime;
692
471
 
693
- export { OrbitalServerRuntime, UnresolvedProgramError, createOrbitalServerRuntime };
694
- export type { HostDispatchItem, LiveBroadcastItem, LoaderConfig, OrbitalInfo, OrbitalServerRuntimeConfig, OrbitalSummary, PushItem, RegisterOptions, RegisteredOrbital, RuntimeOrbital, RuntimeOrbitalSchema, RuntimeTrait, RuntimeTraitTick };
472
+ export { OrbitalServerRuntime, UnresolvedProgramError };
473
+ export type { HostDispatchItem, LiveBroadcastItem, LoaderConfig, OrbitalServerRuntimeConfig, PushItem, RegisterOptions, RegisteredOrbital, RuntimeOrbital, RuntimeOrbitalSchema };
@@ -1,3 +1,3 @@
1
- export { OrbitalServerRuntime, UnresolvedProgramError, createOrbitalServerRuntime } from './chunk-A2TIXOLJ.js';
2
- import './chunk-23YAOI6P.js';
3
- import './chunk-UBZT5LDW.js';
1
+ export { OrbitalServerRuntime, UnresolvedProgramError } from './chunk-34JOE763.js';
2
+ import './chunk-VQVAHUAX.js';
3
+ import './chunk-EEYGL7AB.js';