@almadar/shell-runtime 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.
Files changed (180) hide show
  1. package/dist/chunk-2JU7Y4KU.js +21 -0
  2. package/dist/chunk-46RWK2B5.js +28 -0
  3. package/dist/chunk-4J2QEIUV.js +78 -0
  4. package/dist/chunk-4SEK5ER2.js +8 -0
  5. package/dist/chunk-4ZICQ5PM.js +192 -0
  6. package/dist/chunk-53IPZXDP.js +76 -0
  7. package/dist/chunk-5D63EMO5.js +16 -0
  8. package/dist/chunk-64IH2SMY.js +22 -0
  9. package/dist/chunk-7SDV3QWR.js +67 -0
  10. package/dist/chunk-CPSQXEJ6.js +55 -0
  11. package/dist/chunk-CQP5XAX6.js +173 -0
  12. package/dist/chunk-CROS2GEX.js +49 -0
  13. package/dist/chunk-D4XJTBLB.js +217 -0
  14. package/dist/chunk-D5USD2EX.js +232 -0
  15. package/dist/chunk-DYOJGLIX.js +25 -0
  16. package/dist/chunk-ELBLT2HZ.js +1 -0
  17. package/dist/chunk-EV56K4GB.js +63 -0
  18. package/dist/chunk-EZZYLTWY.js +1 -0
  19. package/dist/chunk-FQ6IZMIU.js +10 -0
  20. package/dist/chunk-FWA5K7Q2.js +48 -0
  21. package/dist/chunk-HC6ERSAH.js +55 -0
  22. package/dist/chunk-HLOUDLPI.js +48 -0
  23. package/dist/chunk-HMK6YMQS.js +135 -0
  24. package/dist/chunk-HNOAZWFH.js +19 -0
  25. package/dist/chunk-IHQLE5M7.js +62 -0
  26. package/dist/chunk-IOPUS6Q5.js +15 -0
  27. package/dist/chunk-JFWFDUTR.js +35 -0
  28. package/dist/chunk-LZIOTBFX.js +1 -0
  29. package/dist/chunk-MHYSHSRG.js +54 -0
  30. package/dist/chunk-MLKGABMK.js +7 -0
  31. package/dist/chunk-MZKIL5IN.js +74 -0
  32. package/dist/chunk-NAECVIAR.js +322 -0
  33. package/dist/chunk-NATGCIVM.js +583 -0
  34. package/dist/chunk-O57GKTYU.js +30 -0
  35. package/dist/chunk-ODJCZ27I.js +50 -0
  36. package/dist/chunk-P53CKOME.js +1 -0
  37. package/dist/chunk-Q2H75UYT.js +92 -0
  38. package/dist/chunk-Q7JK4KY7.js +9 -0
  39. package/dist/chunk-QELZ6TEJ.js +208 -0
  40. package/dist/chunk-QQRDUMB2.js +40 -0
  41. package/dist/chunk-RBUMDYFS.js +681 -0
  42. package/dist/chunk-REPX5QPI.js +57 -0
  43. package/dist/chunk-SAS5KKCR.js +43 -0
  44. package/dist/chunk-SKLMWHQD.js +109 -0
  45. package/dist/chunk-SOQDEPME.js +131 -0
  46. package/dist/chunk-SWPDU752.js +28 -0
  47. package/dist/chunk-T775TUCD.js +18 -0
  48. package/dist/chunk-UBN5JJKZ.js +26 -0
  49. package/dist/chunk-UJHOUZAL.js +36 -0
  50. package/dist/chunk-UP6GGGAN.js +34 -0
  51. package/dist/chunk-VMOBW7RK.js +21 -0
  52. package/dist/chunk-VNMG7NKY.js +69 -0
  53. package/dist/chunk-WNPNNYXY.js +22 -0
  54. package/dist/chunk-XB5GYODW.js +28 -0
  55. package/dist/chunk-XXWNMJI6.js +15 -0
  56. package/dist/chunk-YL2SO5TP.js +334 -0
  57. package/dist/chunk-YO4LWS3I.js +606 -0
  58. package/dist/chunk-ZAQSS47X.js +157 -0
  59. package/dist/chunk-ZCQUUJIF.js +129 -0
  60. package/dist/client/EventTransport.d.ts +131 -0
  61. package/dist/client/EventTransport.js +2 -0
  62. package/dist/client/ServerBridge.d.ts +126 -0
  63. package/dist/client/ServerBridge.js +3 -0
  64. package/dist/client/awaiting.d.ts +28 -0
  65. package/dist/client/awaiting.js +2 -0
  66. package/dist/client/channel-transport.d.ts +69 -0
  67. package/dist/client/channel-transport.js +2 -0
  68. package/dist/client/circuit-store.d.ts +76 -0
  69. package/dist/client/circuit-store.js +4 -0
  70. package/dist/client/client-kernel.d.ts +113 -0
  71. package/dist/client/client-kernel.js +1 -0
  72. package/dist/client/declared-input-dispatch.d.ts +5 -0
  73. package/dist/client/declared-input-dispatch.js +2 -0
  74. package/dist/client/inbound-dispatch.d.ts +5 -0
  75. package/dist/client/inbound-dispatch.js +2 -0
  76. package/dist/client/local-fold.d.ts +26 -0
  77. package/dist/client/local-fold.js +2 -0
  78. package/dist/client/render-sigils.d.ts +24 -0
  79. package/dist/client/render-sigils.js +2 -0
  80. package/dist/client/state-book.d.ts +37 -0
  81. package/dist/client/state-book.js +2 -0
  82. package/dist/client/trait-mount-error.d.ts +9 -0
  83. package/dist/client/trait-mount-error.js +2 -0
  84. package/dist/client/trait-types.d.ts +67 -0
  85. package/dist/client/trait-types.js +1 -0
  86. package/dist/credentials/env-vars.d.ts +14 -0
  87. package/dist/credentials/env-vars.js +3 -0
  88. package/dist/credentials/scope.d.ts +50 -0
  89. package/dist/credentials/scope.js +2 -0
  90. package/dist/credentials/seed.d.ts +21 -0
  91. package/dist/credentials/seed.js +2 -0
  92. package/dist/credentials/store.d.ts +110 -0
  93. package/dist/credentials/store.js +2 -0
  94. package/dist/effects/in-flight-calls.d.ts +36 -0
  95. package/dist/effects/in-flight-calls.js +2 -0
  96. package/dist/effects/on-device-model.d.ts +22 -0
  97. package/dist/effects/on-device-model.js +2 -0
  98. package/dist/events/EventBus.d.ts +90 -0
  99. package/dist/events/EventBus.js +2 -0
  100. package/dist/events/emit-stamp.d.ts +47 -0
  101. package/dist/events/emit-stamp.js +2 -0
  102. package/dist/index-hT1xCdTq.d.ts +46 -0
  103. package/dist/index.d.ts +60 -0
  104. package/dist/index.js +59 -0
  105. package/dist/kernel/beacon.d.ts +32 -0
  106. package/dist/kernel/beacon.js +2 -0
  107. package/dist/kernel/decode.d.ts +15 -0
  108. package/dist/kernel/decode.js +2 -0
  109. package/dist/kernel/engine.d.ts +94 -0
  110. package/dist/kernel/engine.js +11 -0
  111. package/dist/kernel/frame-applier.d.ts +43 -0
  112. package/dist/kernel/frame-applier.js +2 -0
  113. package/dist/kernel/host.d.ts +95 -0
  114. package/dist/kernel/host.js +9 -0
  115. package/dist/kernel/http.d.ts +302 -0
  116. package/dist/kernel/http.js +6 -0
  117. package/dist/kernel/lane.d.ts +28 -0
  118. package/dist/kernel/lane.js +2 -0
  119. package/dist/kernel/oauth-effects.d.ts +25 -0
  120. package/dist/kernel/oauth-effects.js +7 -0
  121. package/dist/kernel/oauth-port.d.ts +31 -0
  122. package/dist/kernel/oauth-port.js +2 -0
  123. package/dist/kernel/os-port.d.ts +133 -0
  124. package/dist/kernel/os-port.js +2 -0
  125. package/dist/kernel/program-effects.d.ts +65 -0
  126. package/dist/kernel/program-effects.js +2 -0
  127. package/dist/kernel/wire.d.ts +66 -0
  128. package/dist/kernel/wire.js +1 -0
  129. package/dist/loader/http-loader.d.ts +111 -0
  130. package/dist/loader/http-loader.js +2 -0
  131. package/dist/loader/lazy-page.d.ts +12 -0
  132. package/dist/loader/lazy-page.js +2 -0
  133. package/dist/loader/schema-loader.d.ts +160 -0
  134. package/dist/loader/schema-loader.js +1 -0
  135. package/dist/persistence/native-memory.d.ts +28 -0
  136. package/dist/persistence/native-memory.js +2 -0
  137. package/dist/runtime/effects/composition/compose-behaviors.d.ts +58 -0
  138. package/dist/runtime/effects/composition/compose-behaviors.js +4 -0
  139. package/dist/runtime/effects/composition/event-wiring.d.ts +38 -0
  140. package/dist/runtime/effects/composition/event-wiring.js +2 -0
  141. package/dist/runtime/effects/composition/index.d.ts +5 -0
  142. package/dist/runtime/effects/composition/index.js +6 -0
  143. package/dist/runtime/effects/composition/layout-strategy.d.ts +35 -0
  144. package/dist/runtime/effects/composition/layout-strategy.js +2 -0
  145. package/dist/runtime/effects/composition/pipe.d.ts +25 -0
  146. package/dist/runtime/effects/composition/pipe.js +2 -0
  147. package/dist/runtime/entities/mockStoreSeed.d.ts +56 -0
  148. package/dist/runtime/entities/mockStoreSeed.js +3 -0
  149. package/dist/runtime/entities/seedBrowserStore.d.ts +28 -0
  150. package/dist/runtime/entities/seedBrowserStore.js +2 -0
  151. package/dist/runtime/entities/std-mock-seed.d.ts +87 -0
  152. package/dist/runtime/entities/std-mock-seed.js +2 -0
  153. package/dist/runtime/evaluation/local-store-transport.d.ts +68 -0
  154. package/dist/runtime/evaluation/local-store-transport.js +18 -0
  155. package/dist/runtime/evaluation/residence-transport.d.ts +15 -0
  156. package/dist/runtime/evaluation/residence-transport.js +2 -0
  157. package/dist/runtime/evaluation/routed-persistence.d.ts +9 -0
  158. package/dist/runtime/evaluation/routed-persistence.js +2 -0
  159. package/dist/runtime/events/identity/routing.d.ts +84 -0
  160. package/dist/runtime/events/identity/routing.js +2 -0
  161. package/dist/runtime/time/TickScheduler.d.ts +77 -0
  162. package/dist/runtime/time/TickScheduler.js +3 -0
  163. package/dist/runtime/time/cron.d.ts +25 -0
  164. package/dist/runtime/time/cron.js +2 -0
  165. package/dist/runtime/time/duration.d.ts +20 -0
  166. package/dist/runtime/time/duration.js +2 -0
  167. package/dist/runtime/traits/OrbitalTraitParsing.d.ts +34 -0
  168. package/dist/runtime/traits/OrbitalTraitParsing.js +2 -0
  169. package/dist/runtime/traits/listen-targets.d.ts +16 -0
  170. package/dist/runtime/traits/listen-targets.js +3 -0
  171. package/dist/runtime/traits/trait-index.d.ts +35 -0
  172. package/dist/runtime/traits/trait-index.js +3 -0
  173. package/dist/runtime/types.d.ts +574 -0
  174. package/dist/runtime/types.js +2 -0
  175. package/dist/service/default-call-service.d.ts +23 -0
  176. package/dist/service/default-call-service.js +3 -0
  177. package/dist/service/service-provider.d.ts +37 -0
  178. package/dist/service/service-provider.js +2 -0
  179. package/package.json +46 -3
  180. package/README.md +0 -3
@@ -0,0 +1,56 @@
1
+ import { PersistenceAdapter, UserContext, Entity, OrbitalSchema } from '@almadar/core';
2
+ import { StdMockSeed, SeedOwnerJournal } from './std-mock-seed.js';
3
+ import '../../kernel/engine.js';
4
+ import '../../kernel/host.js';
5
+ import '../../effects/in-flight-calls.js';
6
+ import '../../service/service-provider.js';
7
+ import '../../kernel/program-effects.js';
8
+ import '../../kernel/http.js';
9
+ import '../../kernel/beacon.js';
10
+ import '../../credentials/store.js';
11
+ import '../../kernel/decode.js';
12
+ import '@almadar/core/kernel-wire';
13
+ import '../../kernel/os-port.js';
14
+ import '../../kernel/wire.js';
15
+
16
+ /**
17
+ * The one mock-store seed both JS hosts of a mock program run. The native `std-mock-seed` program decides the rows,
18
+ * the owner columns and who owns them, and writes them through the kernel; this module binds the declared collections
19
+ * and hands the program the app's resolved schema.
20
+ *
21
+ * @packageDocumentation
22
+ */
23
+
24
+ interface MockSeedHost {
25
+ /** The kernel running the std seed program. */
26
+ seeder: StdMockSeed;
27
+ persistence: PersistenceAdapter;
28
+ /** The clock mock dates and seed stamps resolve against, in epoch milliseconds. */
29
+ nowMs: number;
30
+ }
31
+ interface MockSeedViewer {
32
+ /** Whether the host named the viewer; when it did not, the viewer is the declared `defaultPersona` (anonymous when none). */
33
+ namedByHost: boolean;
34
+ /** The viewer at evaluation time. */
35
+ current: () => UserContext | undefined;
36
+ /** Whether the `[identity]` entity (the persona roster) seeds now; a host that seeds it elsewhere passes false. */
37
+ seedIdentity: boolean;
38
+ }
39
+ interface MockSeeded {
40
+ viewer: UserContext | undefined;
41
+ /** The owner cells the seed stamped, kept for a later persona restamp. */
42
+ journal: SeedOwnerJournal;
43
+ }
44
+ /** Tells the store each server-persisted entity's declared `[persistent: tbl]` collection (EXEC-STORE-1). */
45
+ declare function bindDeclaredCollections(store: PersistenceAdapter, entities: readonly Entity[]): void;
46
+ /**
47
+ * A whole program's mock store, seeded for the viewer. A named viewer owns the rows from the first seed; otherwise
48
+ * the roster seeds unstamped and the viewer is the identity row the declared `defaultPersona` names, whose tracked
49
+ * owner cells restamp to it; with no `defaultPersona` the viewer is anonymous and nothing restamps.
50
+ */
51
+ declare function seedMockStore(host: MockSeedHost, schema: OrbitalSchema, viewer: MockSeedViewer): Promise<MockSeeded>;
52
+ /** Re-point the seeded owner cells at `user` after a persona switch; the rows are the store's current ones. */
53
+ declare function restampMockOwner(host: MockSeedHost, schema: OrbitalSchema, journal: SeedOwnerJournal, user: UserContext): Promise<SeedOwnerJournal>;
54
+
55
+ export { bindDeclaredCollections, restampMockOwner, seedMockStore };
56
+ export type { MockSeedHost, MockSeedViewer, MockSeeded };
@@ -0,0 +1,3 @@
1
+ export { bindDeclaredCollections, restampMockOwner, seedMockStore } from '../../chunk-JFWFDUTR.js';
2
+ import '../../chunk-HMK6YMQS.js';
3
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,28 @@
1
+ import { PersistenceAdapter, OrbitalEntity } from '@almadar/core';
2
+ import { MockSeedRun, StdMockSeed } from './std-mock-seed.js';
3
+ import '../../kernel/engine.js';
4
+ import '../../kernel/host.js';
5
+ import '../../effects/in-flight-calls.js';
6
+ import '../../service/service-provider.js';
7
+ import '../../kernel/program-effects.js';
8
+ import '../../kernel/http.js';
9
+ import '../../kernel/beacon.js';
10
+ import '../../credentials/store.js';
11
+ import '../../kernel/decode.js';
12
+ import '@almadar/core/kernel-wire';
13
+ import '../../kernel/os-port.js';
14
+ import '../../kernel/wire.js';
15
+
16
+ /**
17
+ * The one seed rule for browser-stored entities (`[persistent: x, browser]`): an EMPTY store gets the rows the native
18
+ * `std-mock-seed` program selects for the viewer's locale (the entity's written-out rows, or generated rows when it
19
+ * declares `mock`), written by that program through the kernel. Rows the user already has are never overwritten.
20
+ */
21
+
22
+ interface BrowserSeedHost extends Pick<MockSeedRun, 'nowMs'> {
23
+ seeder: StdMockSeed;
24
+ }
25
+ declare function seedBrowserStore(store: PersistenceAdapter, entities: readonly OrbitalEntity[], locale: string | undefined, host: BrowserSeedHost): Promise<void>;
26
+
27
+ export { seedBrowserStore };
28
+ export type { BrowserSeedHost };
@@ -0,0 +1,2 @@
1
+ export { seedBrowserStore } from '../../chunk-T775TUCD.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,87 @@
1
+ import { UserContext, OrbitalSchema, EntityRow, PersistenceAdapter } from '@almadar/core';
2
+ import { KernelEngine } from '../../kernel/engine.js';
3
+ import '../../kernel/host.js';
4
+ import '../../effects/in-flight-calls.js';
5
+ import '../../service/service-provider.js';
6
+ import '../../kernel/program-effects.js';
7
+ import '../../kernel/http.js';
8
+ import '../../kernel/beacon.js';
9
+ import '../../credentials/store.js';
10
+ import '../../kernel/decode.js';
11
+ import '@almadar/core/kernel-wire';
12
+ import '../../kernel/os-port.js';
13
+ import '../../kernel/wire.js';
14
+
15
+ /**
16
+ * The host side of the native `std-mock-seed` program. Sampling, owner provenance and persona restamp are decided by
17
+ * that program on the kernel (`DATASET_INPUT`, `RESTAMP_INPUT`), which also writes the rows and owner changes through
18
+ * the kernel's `persist batch`; this module only forwards its inputs and reads its typed answers.
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+
23
+ /** The kernel running the std seed program (`app.forkProgram(seedProgram)`); only dispatch is used. */
24
+ type MockSeedEngine = Pick<KernelEngine, 'evaluate'>;
25
+ interface SeedOwnerCell {
26
+ store: string;
27
+ id: string;
28
+ column: string;
29
+ }
30
+ interface SeedOwnerJournal {
31
+ viewerId: string;
32
+ stamped: SeedOwnerCell[];
33
+ deferred: SeedOwnerCell[];
34
+ }
35
+ interface SeedOwnerChange extends SeedOwnerCell {
36
+ kind: 'set' | 'rekey';
37
+ ownerId: string;
38
+ }
39
+ interface SeededDataset {
40
+ /** Rows by declared collection. */
41
+ stores: Record<string, EntityRow[]>;
42
+ journal: SeedOwnerJournal;
43
+ }
44
+ interface SeedRestamp {
45
+ journal: SeedOwnerJournal;
46
+ changes: SeedOwnerChange[];
47
+ }
48
+ /** The seeding values a program declares: the std-mock-seed config knobs, as the app's composition sets them, else the atom's defaults. */
49
+ interface SeedConfig {
50
+ count: number;
51
+ seed: number;
52
+ /** The identity row id the viewer is when the host names none; empty means anonymous. */
53
+ defaultPersona: string;
54
+ restampOnPersona: boolean;
55
+ }
56
+ interface MockSeedRun {
57
+ /** The clock relative mock dates and seed stamps resolve against, in epoch milliseconds. */
58
+ nowMs: number;
59
+ /** The viewer the dataset's owner columns are stamped for; absent, the rows seed unstamped. */
60
+ viewerId?: string;
61
+ locale?: string;
62
+ }
63
+ declare class StdMockSeed {
64
+ private readonly engine;
65
+ readonly config: SeedConfig;
66
+ private readonly user?;
67
+ constructor(engine: MockSeedEngine, config: SeedConfig, user?: UserContext | undefined);
68
+ private ask;
69
+ /** Sample the program's dataset (`DATASET_INPUT`). */
70
+ dataset(program: OrbitalSchema, run: MockSeedRun): Promise<SeededDataset>;
71
+ /**
72
+ * Re-point the dataset's tracked owner cells at `viewer` (`RESTAMP_INPUT`); `stores` are the current authoritative rows.
73
+ * `firstOwner` marks the stamp right after seeding; a persona switch restamps only when the program's
74
+ * `restampOnPersona` config says so, otherwise it answers no changes.
75
+ */
76
+ restamp(program: OrbitalSchema, stores: Record<string, EntityRow[]>, journal: SeedOwnerJournal, viewer: UserContext, firstOwner: boolean): Promise<SeedRestamp>;
77
+ }
78
+ /**
79
+ * The seeding values as `.lolo` declares them: the std-mock-seed program's own config defaults, overlaid by the
80
+ * config an app's composition of it sets (an orbital that `uses` std-mock-seed and references its MockSeed trait).
81
+ */
82
+ declare function declaredSeedConfig(seedProgram: OrbitalSchema, app?: OrbitalSchema): SeedConfig;
83
+ /** The current rows of every collection the program declares, as the restamp takes them. */
84
+ declare function readSeededStores(persistence: PersistenceAdapter, program: OrbitalSchema): Promise<Record<string, EntityRow[]>>;
85
+
86
+ export { StdMockSeed, declaredSeedConfig, readSeededStores };
87
+ export type { MockSeedEngine, MockSeedRun, SeedConfig, SeedOwnerCell, SeedOwnerChange, SeedOwnerJournal, SeedRestamp, SeededDataset };
@@ -0,0 +1,2 @@
1
+ export { StdMockSeed, declaredSeedConfig, readSeededStores } from '../../chunk-HMK6YMQS.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,68 @@
1
+ import { OrbitalSchema, PersistenceAdapter, OnDeviceModelPorts, BrowserTabPort, MessageCatalogs, UserContext, RowSetRef, RowQueryPage } from '@almadar/core';
2
+ import { EffectHandlers } from '../types.js';
3
+ import { KernelEngine } from '../../kernel/engine.js';
4
+ import { KernelHostPorts } from '../../kernel/host.js';
5
+ import { HttpPorts } from '../../kernel/http.js';
6
+ import { KernelModule } from '../../kernel/wire.js';
7
+ import { EventTransport } from '../../client/EventTransport.js';
8
+ import '../../service/default-call-service.js';
9
+ import '../../service/service-provider.js';
10
+ import '../../kernel/program-effects.js';
11
+ import '../effects/composition/compose-behaviors.js';
12
+ import '../effects/composition/event-wiring.js';
13
+ import '../effects/composition/layout-strategy.js';
14
+ import '../effects/composition/pipe.js';
15
+ import '../../effects/in-flight-calls.js';
16
+ import '../../kernel/beacon.js';
17
+ import '../../credentials/store.js';
18
+ import '../../kernel/decode.js';
19
+ import '@almadar/core/kernel-wire';
20
+ import '../../kernel/os-port.js';
21
+
22
+ /**
23
+ * An in-process transport over a local store: every request runs on the kernel opened over that store
24
+ * (`openLocalKernel`), and this host answers its I/O. The offline preview and the browser-stored side of a
25
+ * residence-routed host both use it.
26
+ */
27
+
28
+ interface LocalKernelOptions {
29
+ /** The initialised `@almadar/kernel` module. */
30
+ kernel: KernelModule;
31
+ /** The language bundle as JSON (`LanguageBundle`), installed into `kernel` before it opens: a browser has no `node_modules` to read it from. */
32
+ language: string;
33
+ schema: OrbitalSchema;
34
+ /** Every row the kernel reads and writes (`localStorePersistence` over a browser store). */
35
+ persistence: PersistenceAdapter;
36
+ /** Answers every `call-service`; absent, the default provider. */
37
+ callService?: EffectHandlers['callService'];
38
+ /** The running app lent to `call-service` providers; absent, a provider reads the rows its viewer may read and dispatches no input. */
39
+ servicePorts?: KernelHostPorts['servicePorts'];
40
+ /** Where a follow-on call's outcome is dispatched; absent, nowhere. */
41
+ deferCallOutcome?: KernelHostPorts['deferCallOutcome'];
42
+ pageFacts?: KernelHostPorts['pageFacts'];
43
+ http?: HttpPorts;
44
+ onDevice?: OnDeviceModelPorts;
45
+ tabs?: BrowserTabPort;
46
+ /** The program's message catalogs, so `i18n/t` resolves for the request's locale. */
47
+ messages?: MessageCatalogs;
48
+ }
49
+ /** A local store's rows as the kernel holds them: browser-stored entities in `store`, every other entity in `memory` (a native `MemoryStore` adapter). */
50
+ declare function localStorePersistence(schema: OrbitalSchema, store: PersistenceAdapter, memory: PersistenceAdapter): PersistenceAdapter;
51
+ /** A kernel over a local store, answering its I/O with `persistence` and the given ports. */
52
+ declare function openLocalKernel(options: LocalKernelOptions): KernelEngine;
53
+ interface LocalStoreTransportOptions {
54
+ /** The kernel the requests run on (`openLocalKernel`), or its promise while the kernel module loads. */
55
+ kernelEngine: KernelEngine | Promise<KernelEngine>;
56
+ /** The viewer every request runs as, or its promise while the host resolves it (a mock store's seeded persona). */
57
+ user?: UserContext | Promise<UserContext | undefined>;
58
+ /** Releases the host's request queue while a `call-service` awaits its provider. */
59
+ outsideEventQueue?: <T>(work: () => Promise<T>) => Promise<T>;
60
+ /** The program the kernel runs; given, the transport resolves row-set references on that kernel. */
61
+ schema?: OrbitalSchema;
62
+ }
63
+ declare function createLocalStoreTransport(options: LocalStoreTransportOptions): EventTransport;
64
+ /** `reference` resolved on a local kernel for `user`: the kernel applies the viewer's `@read`, the host answers its row reads. */
65
+ declare function resolveLocalRows(engine: KernelEngine, schema: OrbitalSchema, user: UserContext | undefined, reference: RowSetRef): Promise<RowQueryPage>;
66
+
67
+ export { createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows };
68
+ export type { LocalKernelOptions, LocalStoreTransportOptions };
@@ -0,0 +1,18 @@
1
+ export { createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows } from '../../chunk-VNMG7NKY.js';
2
+ import '../../chunk-4SEK5ER2.js';
3
+ import '../../chunk-UBN5JJKZ.js';
4
+ import '../../chunk-O57GKTYU.js';
5
+ import '../../chunk-CPSQXEJ6.js';
6
+ import '../../chunk-SAS5KKCR.js';
7
+ import '../../chunk-D4XJTBLB.js';
8
+ import '../../chunk-NATGCIVM.js';
9
+ import '../../chunk-HNOAZWFH.js';
10
+ import '../../chunk-53IPZXDP.js';
11
+ import '../../chunk-YO4LWS3I.js';
12
+ import '../../chunk-MZKIL5IN.js';
13
+ import '../../chunk-FWA5K7Q2.js';
14
+ import '../../chunk-VMOBW7RK.js';
15
+ import '../../chunk-RBUMDYFS.js';
16
+ import '../../chunk-HLOUDLPI.js';
17
+ import '../../chunk-QELZ6TEJ.js';
18
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,15 @@
1
+ import { EventTransport } from '../../client/EventTransport.js';
2
+ import { TraitIndex } from '@almadar/core';
3
+
4
+ interface ResidenceTransportOptions {
5
+ /** In-process transport over the browser store. */
6
+ local: EventTransport;
7
+ /** The server; absent on a static host. */
8
+ remote?: EventTransport;
9
+ /** The program's entities, for where a row-set reference's rows live. */
10
+ traitIndex: TraitIndex;
11
+ }
12
+ declare function createResidenceTransport(options: ResidenceTransportOptions): EventTransport;
13
+
14
+ export { createResidenceTransport };
15
+ export type { ResidenceTransportOptions };
@@ -0,0 +1,2 @@
1
+ export { createResidenceTransport } from '../../chunk-UJHOUZAL.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,9 @@
1
+ import { PersistenceAdapter } from '@almadar/core';
2
+
3
+ /**
4
+ * One persistence over two stores: `stored` entities (a program's browser-stored ones) go to `stored`, every other entity to
5
+ * `other`. The kernel reads and writes every entity through one adapter; a batch is one store's transaction, so it stays in one.
6
+ */
7
+ declare function routeByEntity(storedEntities: ReadonlySet<string>, stored: PersistenceAdapter, other: PersistenceAdapter): PersistenceAdapter;
8
+
9
+ export { routeByEntity };
@@ -0,0 +1,2 @@
1
+ export { routeByEntity } from '../../chunk-O57GKTYU.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,84 @@
1
+ import { TraitId, OrbitalId, EventId } from '@almadar/core';
2
+
3
+ /**
4
+ * Identity-keyed routing (Almadar Rabit V4, Phase 4 — interpreter path).
5
+ *
6
+ * The runtime routes cross-trait events by NAME today: the bus key is the
7
+ * event name and source filtering compares orbital/trait name strings. A
8
+ * mid-session rename (a ledger `curName` edit that updates a node's own
9
+ * display name but deliberately does NOT rewrite the name strings held by
10
+ * every reference) therefore breaks name routing — the emitter now stamps
11
+ * the new name while the listener still holds the old one.
12
+ *
13
+ * These helpers make routing resolve by ID when the schema carries ids
14
+ * (ledger-backed, V4), and fall back to name while dual-carry. Ids are the
15
+ * stable edge keys: a rename never touches a node's id or any `*Id`
16
+ * reference, so id-routed bindings survive it. Legacy id-free schemas take
17
+ * the name path unchanged — byte-for-byte the previous behavior.
18
+ *
19
+ * @packageDocumentation
20
+ */
21
+
22
+ /**
23
+ * The bus subscription/delivery key for an event. When an `eventId` is
24
+ * present the key is the id (namespaced so it can never collide with a
25
+ * bare event name); otherwise it is the event name (legacy path).
26
+ *
27
+ * The event ENVELOPE keeps the human name as its `type` — only the routing
28
+ * key changes — so observability, the client re-broadcast wire shape, and
29
+ * wildcard listeners are untouched.
30
+ */
31
+ declare function eventRouteKey(eventName: string, eventId?: EventId | string): string;
32
+ /** Structured `listens {}` source, carrying V4 dual-carry ids when present. */
33
+ type ListenSourceDescriptor = {
34
+ kind: 'any';
35
+ } | {
36
+ kind: 'trait';
37
+ trait: string;
38
+ traitId?: TraitId;
39
+ } | {
40
+ kind: 'orbital';
41
+ orbital: string;
42
+ trait: string;
43
+ orbitalId?: OrbitalId;
44
+ traitId?: TraitId;
45
+ };
46
+ /**
47
+ * The subset of a bus event's `source` metadata the matcher reads. Kept
48
+ * structural (no index signature) so `BusEventSource` assigns to it cleanly.
49
+ */
50
+ interface RouteSourceMeta {
51
+ orbital?: string;
52
+ orbitalId?: OrbitalId;
53
+ trait?: string;
54
+ traitId?: TraitId;
55
+ }
56
+ /**
57
+ * Build a source-scope matcher for a `listens {}` entry.
58
+ *
59
+ * ID-first: when the listen source carries the id(s) for its scope, the
60
+ * matcher compares ids ONLY (exact-match, rename-proof). Otherwise it
61
+ * compares names against `listenerOrbital` — the exact legacy predicate.
62
+ * No name-similarity, ever: an id present on one side but absent on the
63
+ * other is a mismatch, never a fuzzy fallback.
64
+ */
65
+ declare function buildSourceMatcher(src: ListenSourceDescriptor, listenerOrbital: string): (source: RouteSourceMeta | undefined) => boolean;
66
+ /**
67
+ * Parse one `listens {}` entry into its bare event name + source matcher.
68
+ * Relocated here (was module-private to `OrbitalServerRuntime.ts`) so the
69
+ * stateless `@almadar-io/playground-runtime` path can reuse the EXACT same
70
+ * matching predicate for its own cross-orbital cascade (Fix A2) instead of
71
+ * a second, divergent copy — this function only ever depended on
72
+ * `ListenSourceDescriptor`/`buildSourceMatcher`, both already local to this
73
+ * module.
74
+ */
75
+ declare function parseListenSource(listener: {
76
+ event: string;
77
+ source?: ListenSourceDescriptor;
78
+ }, listenerOrbital: string): {
79
+ bareEvent: string;
80
+ matcher: (source: RouteSourceMeta | undefined) => boolean;
81
+ };
82
+
83
+ export { buildSourceMatcher, eventRouteKey, parseListenSource };
84
+ export type { ListenSourceDescriptor, RouteSourceMeta };
@@ -0,0 +1,2 @@
1
+ export { buildSourceMatcher, eventRouteKey, parseListenSource } from '../../../chunk-IHQLE5M7.js';
2
+ import '../../../chunk-MLKGABMK.js';
@@ -0,0 +1,77 @@
1
+ /**
2
+ * TickScheduler — a single coalesced clock for every registered tick.
3
+ *
4
+ * Replaces "one independent timer per tick" with ONE requestAnimationFrame
5
+ * accumulator loop (falling back to a single ~60fps `setInterval` where rAF
6
+ * isn't available, e.g. Node/SSR) that walks every registered tick each pass
7
+ * and fires whichever one(s) have crossed their own interval — so ticks due
8
+ * in the same pass commit together instead of on independent, uncoordinated
9
+ * timers. Each interval tick fires AT MOST ONCE per pass: missed beats are
10
+ * dropped (the phase remainder is kept, so healthy cadence is unchanged),
11
+ * because bursting catch-up firings after a slow pass multiplies the work
12
+ * that made the pass slow — an unbounded accumulator is a spiral-of-death
13
+ * amplifier that pegs the main thread and starves input. Framework-light:
14
+ * no React, usable from `OrbitalServerRuntime` (this package) and from
15
+ * `@almadar/ui`'s `useTraitStateMachine` alike.
16
+ *
17
+ * @packageDocumentation
18
+ */
19
+ interface TickHandle {
20
+ /** Stop just this tick; the shared loop keeps running for any others still registered. */
21
+ stop(): void;
22
+ }
23
+ /**
24
+ * Coalesced tick scheduler. One instance drives every tick registered on it
25
+ * through a single shared clock.
26
+ */
27
+ declare class TickScheduler {
28
+ private ticks;
29
+ private nextId;
30
+ private running;
31
+ private paused;
32
+ private frameHandle;
33
+ private readonly hasRaf;
34
+ constructor();
35
+ /**
36
+ * Register a tick. `intervalMs <= 0` means "every pass" (a frame-interval
37
+ * tick, matching LOLO's `interval: "frame"`). Returns a handle to stop
38
+ * just this tick.
39
+ */
40
+ add(intervalMs: number, onDue: () => void): TickHandle;
41
+ /**
42
+ * Register a cron-scheduled tick (`ticks { ... every "0 9 * * *" }`).
43
+ * Fires at most once per matching calendar minute. Throws if `expression` isn't a valid 5-field cron
44
+ * string; callers on a path the compiler has already validated (e.g.
45
+ * generated code) won't hit this, but a raw runtime value might.
46
+ */
47
+ addCron(expression: string, onDue: () => void): TickHandle;
48
+ /** Stop every tick and the shared loop. */
49
+ stopAll(): void;
50
+ /** True while the scheduler is paused (no tick callback fires and no backlog accumulates). */
51
+ get isPaused(): boolean;
52
+ /**
53
+ * Halt the shared loop without dropping registered ticks. No `onDue`
54
+ * fires again until `resume()`. A no-op if already paused.
55
+ */
56
+ pause(): void;
57
+ /**
58
+ * Restart the shared loop after `pause()`. Every registered tick's phase
59
+ * is reset (`lastTimestamp = null`) so the paused duration is never
60
+ * counted as elapsed time — the same "first pass just captures the
61
+ * timestamp" behavior a freshly `add()`-ed tick gets, which is what keeps
62
+ * resume from bursting a backlog of missed beats. A no-op if not paused.
63
+ */
64
+ resume(): void;
65
+ private ensureRunning;
66
+ private maybeStop;
67
+ /** Cancel the active rAF/interval loop, if any, and clear the running flag. */
68
+ private stopLoop;
69
+ private advance;
70
+ /** Cron ticks check calendar-match at most once a second, deduped per matching minute. */
71
+ private advanceCron;
72
+ }
73
+ /** Construct a new, independent `TickScheduler`. */
74
+ declare function createTickScheduler(): TickScheduler;
75
+
76
+ export { TickScheduler, createTickScheduler };
77
+ export type { TickHandle };
@@ -0,0 +1,3 @@
1
+ export { TickScheduler, createTickScheduler } from '../../chunk-CQP5XAX6.js';
2
+ import '../../chunk-CROS2GEX.js';
3
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Cron expression parsing and matching — the ONE canonical implementation
3
+ * every engine that schedules a cron-shaped interval delegates to (`OrbitalServerRuntime`,
4
+ * `TickScheduler`, and generated client codegen). No Node.js dependencies, so
5
+ * it's safe to import client-side too.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ interface CronFields {
10
+ minute: Set<number>;
11
+ hour: Set<number>;
12
+ day: Set<number>;
13
+ month: Set<number>;
14
+ weekday: Set<number>;
15
+ }
16
+ declare function parseCronField(field: string, min: number, max: number): Set<number>;
17
+ declare function parseCron(expression: string): CronFields;
18
+ /** Returns true if `expression` is a syntactically valid 5-field cron expression. */
19
+ declare function isValidCronExpression(expression: string): boolean;
20
+ declare function cronMatches(fields: CronFields, date: Date): boolean;
21
+ /** Calendar-minute key for once-per-minute dedup — the same shape `os/watch-cron` uses. */
22
+ declare function cronMinuteKey(date: Date): number;
23
+
24
+ export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField };
25
+ export type { CronFields };
@@ -0,0 +1,2 @@
1
+ export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from '../../chunk-CROS2GEX.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Duration-string parsing — the one canonical parser for a tick interval
3
+ * written as `'5ms'`/`'5s'`/`'1m'`/`'1h'` (as opposed to a cron expression;
4
+ * see `./cron.js`). Shared by `OrbitalServerRuntime` and any client consumer
5
+ * (`@almadar/ui`'s `useTraitStateMachine`) so both agree on the same
6
+ * milliseconds for the same string.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * Parse a duration string to milliseconds. Supports `'5ms'`/`'5s'`/`'1m'`/`'1h'`,
12
+ * and a bare number-as-string (assumed ms). Throws on anything else — a
13
+ * caller should check `isValidCronExpression` first if the string might be
14
+ * cron-shaped instead.
15
+ */
16
+ declare function parseDurationString(interval: string): number;
17
+ /** Returns true if `interval` matches the duration-string shape `parseDurationString` accepts. */
18
+ declare function isValidDurationString(interval: string): boolean;
19
+
20
+ export { isValidDurationString, parseDurationString };
@@ -0,0 +1,2 @@
1
+ export { isValidDurationString, parseDurationString } from '../../chunk-46RWK2B5.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,34 @@
1
+ import { TraitDefinition, Trait, TraitConfig, Entity, OrbitalDefinition } from '@almadar/core';
2
+
3
+ /**
4
+ * OrbitalTraitParsing — turn a resolved `OrbitalSchema.traits` array into the
5
+ * `TraitDefinition[]` shape `processEvent` (`StateMachineCore.ts`) consumes.
6
+ *
7
+ * Extracted from `OrbitalServerRuntime.register()` (the trait-unwrap +
8
+ * config-by-trait block) so a SECOND consumer — a stateless, per-request
9
+ * transition handler that never instantiates the full stateful
10
+ * `OrbitalServerRuntime` — can reuse the exact same parsing instead of a
11
+ * second copy. `register()` now calls this too; behavior is unchanged.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+
16
+ interface ParsedOrbitalTraits {
17
+ /** Inline (unwrapped) traits, ready for `processEvent`. */
18
+ traits: TraitDefinition[];
19
+ /** The same traits at IR level (`@almadar/core` `Trait`) — `registered.traits`'s shape, kept for callers that need more than states/transitions/listens (e.g. `stateMachine.events` for payload validation). */
20
+ inlineTraits: Trait[];
21
+ /** Call-site `config` block per resolved trait name, from `uses` refs. */
22
+ configByTrait: Map<string, TraitConfig>;
23
+ /** The orbital's entity, resolved from a string ref / `EntityCall` / inline `Entity`. */
24
+ entity: Entity;
25
+ }
26
+ /**
27
+ * Parse `orbital.traits` (already-resolved — no `uses` left to expand) into
28
+ * `TraitDefinition[]` + the call-site config map, and resolve `orbital.entity`
29
+ * to a concrete `Entity`. Pure — no I/O, no instance state.
30
+ */
31
+ declare function parseOrbitalTraits(orbital: OrbitalDefinition): ParsedOrbitalTraits;
32
+
33
+ export { parseOrbitalTraits };
34
+ export type { ParsedOrbitalTraits };
@@ -0,0 +1,2 @@
1
+ export { parseOrbitalTraits } from '../../chunk-SAS5KKCR.js';
2
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,16 @@
1
+ import { IndexedTrait, TraitEventListener, EventId, EventPayload, TraitIndex, BusEventSource } from '@almadar/core';
2
+
3
+ interface CollectedListenerTarget {
4
+ listenerTrait: string;
5
+ /** The listener's index entry. */
6
+ entry: IndexedTrait;
7
+ /** The matched listener declaration (its `when` already held). */
8
+ listener: TraitEventListener;
9
+ triggers: string;
10
+ triggersId?: EventId;
11
+ payload: EventPayload | undefined;
12
+ }
13
+ declare function collectListenerTargets(traitIndex: TraitIndex, sourceStamp: BusEventSource | undefined, event: string, payload: EventPayload | undefined): CollectedListenerTarget[];
14
+
15
+ export { collectListenerTargets };
16
+ export type { CollectedListenerTarget };
@@ -0,0 +1,3 @@
1
+ export { collectListenerTargets } from '../../chunk-XB5GYODW.js';
2
+ import '../../chunk-IHQLE5M7.js';
3
+ import '../../chunk-MLKGABMK.js';
@@ -0,0 +1,35 @@
1
+ import { OrbitalDefinition, TraitIndex } from '@almadar/core';
2
+
3
+ /**
4
+ * trait-index — build the per-trait evaluation index ONE time, for every
5
+ * execution path.
6
+ *
7
+ * The index is the composition's view of a resolved schema: for each
8
+ * trait, its flat `TraitDefinition` (the shape `processEvent` consumes),
9
+ * its IR-level trait (payload schemas, `emits` contracts), its RESOLVED
10
+ * linked entity (a trait's `linkedEntity` can name another orbital's
11
+ * primary or an auxiliary entity — resolved against every orbital's
12
+ * entities, never stubbed silently), its host orbital's name + V4 id
13
+ * (emit stamping), and its entity-frame key (the `$shared::<entity>`
14
+ * group key `OrbitalServerRuntime.sharedFieldKey` computes, resolved here
15
+ * ONCE from the entity declaration's own `shared` flag instead of
16
+ * re-walking per lookup).
17
+ *
18
+ * Consumers: the unified `evaluateOrbitalEvent` composition (both the
19
+ * stateful server's session view and the stateless per-request handler's
20
+ * compiled-behavior cache). Pure — no I/O, no instance state.
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+
25
+ /**
26
+ * Build the trait index from a RESOLVED schema's orbitals (no `uses`
27
+ * left to expand — the compiler's inline phase already ran). Pure derived
28
+ * data: safe to cache per schema (the stateless deployment caches one
29
+ * index per catalog behavior; the stateful server builds one per
30
+ * registered orbital set).
31
+ * A trait's config is the kernel's (`traitConfig`), never merged here.
32
+ */
33
+ declare function buildTraitIndex(orbitals: readonly OrbitalDefinition[]): TraitIndex;
34
+
35
+ export { buildTraitIndex };
@@ -0,0 +1,3 @@
1
+ export { buildTraitIndex } from '../../chunk-CPSQXEJ6.js';
2
+ import '../../chunk-SAS5KKCR.js';
3
+ import '../../chunk-MLKGABMK.js';