@almadar/shell-runtime 0.1.0 → 1.0.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 (167) hide show
  1. package/dist/chunk-57SBCUSM.js +62 -0
  2. package/dist/chunk-625EP7W2.js +108 -0
  3. package/dist/{chunk-NATGCIVM.js → chunk-7WB6VWRK.js} +344 -129
  4. package/dist/{chunk-Q2H75UYT.js → chunk-A2JJT4GA.js} +1 -37
  5. package/dist/chunk-BAS26HBN.js +10 -0
  6. package/dist/{chunk-REPX5QPI.js → chunk-BOVU4TCQ.js} +11 -3
  7. package/dist/chunk-BY5G4225.js +6 -0
  8. package/dist/chunk-DFDNHVDW.js +284 -0
  9. package/dist/chunk-I3TKINSO.js +398 -0
  10. package/dist/{chunk-DYOJGLIX.js → chunk-LKWYCYX5.js} +2 -5
  11. package/dist/chunk-LYFIQPXX.js +1 -0
  12. package/dist/{chunk-VNMG7NKY.js → chunk-MU335ZA4.js} +20 -26
  13. package/dist/{chunk-ODJCZ27I.js → chunk-N7HYNKK6.js} +35 -2
  14. package/dist/{chunk-4J2QEIUV.js → chunk-NTFQ36UN.js} +4 -30
  15. package/dist/chunk-NU6LVKGS.js +15 -0
  16. package/dist/chunk-P2N6K2IV.js +20 -0
  17. package/dist/{chunk-QQRDUMB2.js → chunk-QCJWPXLH.js} +11 -11
  18. package/dist/{chunk-QELZ6TEJ.js → chunk-UD2CXYSJ.js} +39 -3
  19. package/dist/{chunk-UJHOUZAL.js → chunk-V4EMDPCO.js} +2 -5
  20. package/dist/chunk-VNGXRYFF.js +9 -0
  21. package/dist/{chunk-HNOAZWFH.js → chunk-WGCWJOT2.js} +2 -0
  22. package/dist/chunk-X6W44WHO.js +26 -0
  23. package/dist/chunk-ZUSM4VW4.js +197 -0
  24. package/dist/client/EventTransport.d.ts +23 -7
  25. package/dist/client/EventTransport.js +1 -2
  26. package/dist/client/awaiting.js +0 -1
  27. package/dist/client/channel-transport.d.ts +6 -6
  28. package/dist/client/channel-transport.js +0 -1
  29. package/dist/client/circuit-store.d.ts +16 -5
  30. package/dist/client/circuit-store.js +2 -3
  31. package/dist/client/client-kernel.d.ts +36 -15
  32. package/dist/client/declared-input-dispatch.d.ts +19 -2
  33. package/dist/client/declared-input-dispatch.js +1 -2
  34. package/dist/client/inbound-dispatch.d.ts +21 -2
  35. package/dist/client/inbound-dispatch.js +1 -2
  36. package/dist/client/local-fold.d.ts +15 -8
  37. package/dist/client/local-fold.js +1 -2
  38. package/dist/client/render-sigils.js +0 -1
  39. package/dist/client/state-book.d.ts +9 -16
  40. package/dist/client/state-book.js +1 -2
  41. package/dist/client/trait-mount-error.js +0 -1
  42. package/dist/credentials/env-vars.d.ts +5 -1
  43. package/dist/credentials/env-vars.js +1 -3
  44. package/dist/credentials/scope.d.ts +8 -7
  45. package/dist/credentials/scope.js +0 -1
  46. package/dist/credentials/vault.d.ts +142 -0
  47. package/dist/credentials/vault.js +1 -0
  48. package/dist/effects/in-flight-calls.js +0 -1
  49. package/dist/effects/on-device-model.js +0 -1
  50. package/dist/events/EventBus.d.ts +1 -4
  51. package/dist/events/EventBus.js +0 -1
  52. package/dist/events/emit-stamp.js +0 -1
  53. package/dist/index.d.ts +25 -42
  54. package/dist/index.js +27 -45
  55. package/dist/kernel/decode.d.ts +8 -10
  56. package/dist/kernel/decode.js +1 -2
  57. package/dist/kernel/engine.d.ts +132 -31
  58. package/dist/kernel/engine.js +7 -9
  59. package/dist/kernel/frame-applier.d.ts +8 -7
  60. package/dist/kernel/frame-applier.js +1 -2
  61. package/dist/kernel/host.d.ts +127 -16
  62. package/dist/kernel/host.js +4 -7
  63. package/dist/kernel/lane.d.ts +1 -22
  64. package/dist/kernel/lane.js +1 -2
  65. package/dist/kernel/os-fetch-port.d.ts +7 -0
  66. package/dist/kernel/os-fetch-port.js +3 -0
  67. package/dist/kernel/os-port.d.ts +30 -8
  68. package/dist/kernel/os-port.js +1 -2
  69. package/dist/kernel/program-effects.d.ts +11 -28
  70. package/dist/kernel/program-effects.js +1 -2
  71. package/dist/kernel/secret-ports.d.ts +139 -0
  72. package/dist/kernel/secret-ports.js +2 -0
  73. package/dist/kernel/wire.d.ts +50 -12
  74. package/dist/loader/fetch-loader.d.ts +26 -0
  75. package/dist/loader/fetch-loader.js +1 -0
  76. package/dist/loader/lazy-page.js +0 -1
  77. package/dist/loader/schema-loader.d.ts +1 -17
  78. package/dist/persistence/native-memory.js +0 -1
  79. package/dist/runtime/entities/declaredCollections.d.ts +6 -0
  80. package/dist/runtime/entities/declaredCollections.js +1 -0
  81. package/dist/runtime/evaluation/local-store-transport.d.ts +14 -23
  82. package/dist/runtime/evaluation/local-store-transport.js +9 -13
  83. package/dist/runtime/evaluation/residence-transport.d.ts +3 -3
  84. package/dist/runtime/evaluation/residence-transport.js +1 -2
  85. package/dist/runtime/evaluation/routed-persistence.js +0 -1
  86. package/dist/runtime/events/identity/routing.d.ts +2 -53
  87. package/dist/runtime/events/identity/routing.js +1 -2
  88. package/dist/runtime/types.d.ts +5 -205
  89. package/dist/runtime/types.js +1 -2
  90. package/dist/service/default-call-service.js +0 -1
  91. package/dist/service/service-provider.js +0 -1
  92. package/package.json +8 -5
  93. package/dist/chunk-2JU7Y4KU.js +0 -21
  94. package/dist/chunk-46RWK2B5.js +0 -28
  95. package/dist/chunk-4ZICQ5PM.js +0 -192
  96. package/dist/chunk-53IPZXDP.js +0 -76
  97. package/dist/chunk-5D63EMO5.js +0 -16
  98. package/dist/chunk-CPSQXEJ6.js +0 -55
  99. package/dist/chunk-CQP5XAX6.js +0 -173
  100. package/dist/chunk-CROS2GEX.js +0 -49
  101. package/dist/chunk-D4XJTBLB.js +0 -217
  102. package/dist/chunk-D5USD2EX.js +0 -232
  103. package/dist/chunk-EV56K4GB.js +0 -63
  104. package/dist/chunk-FQ6IZMIU.js +0 -10
  105. package/dist/chunk-HMK6YMQS.js +0 -135
  106. package/dist/chunk-IHQLE5M7.js +0 -62
  107. package/dist/chunk-JFWFDUTR.js +0 -35
  108. package/dist/chunk-MHYSHSRG.js +0 -54
  109. package/dist/chunk-MLKGABMK.js +0 -7
  110. package/dist/chunk-NAECVIAR.js +0 -322
  111. package/dist/chunk-Q7JK4KY7.js +0 -9
  112. package/dist/chunk-RBUMDYFS.js +0 -681
  113. package/dist/chunk-SAS5KKCR.js +0 -43
  114. package/dist/chunk-SWPDU752.js +0 -28
  115. package/dist/chunk-T775TUCD.js +0 -18
  116. package/dist/chunk-VMOBW7RK.js +0 -21
  117. package/dist/chunk-WNPNNYXY.js +0 -22
  118. package/dist/chunk-XB5GYODW.js +0 -28
  119. package/dist/chunk-YL2SO5TP.js +0 -334
  120. package/dist/chunk-YO4LWS3I.js +0 -606
  121. package/dist/chunk-ZAQSS47X.js +0 -157
  122. package/dist/chunk-ZCQUUJIF.js +0 -129
  123. package/dist/client/ServerBridge.d.ts +0 -126
  124. package/dist/client/ServerBridge.js +0 -3
  125. package/dist/credentials/seed.d.ts +0 -21
  126. package/dist/credentials/seed.js +0 -2
  127. package/dist/credentials/store.d.ts +0 -110
  128. package/dist/credentials/store.js +0 -2
  129. package/dist/index-hT1xCdTq.d.ts +0 -46
  130. package/dist/kernel/beacon.d.ts +0 -32
  131. package/dist/kernel/beacon.js +0 -2
  132. package/dist/kernel/http.d.ts +0 -302
  133. package/dist/kernel/http.js +0 -6
  134. package/dist/kernel/oauth-effects.d.ts +0 -25
  135. package/dist/kernel/oauth-effects.js +0 -7
  136. package/dist/kernel/oauth-port.d.ts +0 -31
  137. package/dist/kernel/oauth-port.js +0 -2
  138. package/dist/loader/http-loader.d.ts +0 -111
  139. package/dist/loader/http-loader.js +0 -2
  140. package/dist/runtime/effects/composition/compose-behaviors.d.ts +0 -58
  141. package/dist/runtime/effects/composition/compose-behaviors.js +0 -4
  142. package/dist/runtime/effects/composition/event-wiring.d.ts +0 -38
  143. package/dist/runtime/effects/composition/event-wiring.js +0 -2
  144. package/dist/runtime/effects/composition/index.d.ts +0 -5
  145. package/dist/runtime/effects/composition/index.js +0 -6
  146. package/dist/runtime/effects/composition/layout-strategy.d.ts +0 -35
  147. package/dist/runtime/effects/composition/layout-strategy.js +0 -2
  148. package/dist/runtime/effects/composition/pipe.d.ts +0 -25
  149. package/dist/runtime/effects/composition/pipe.js +0 -2
  150. package/dist/runtime/entities/mockStoreSeed.d.ts +0 -56
  151. package/dist/runtime/entities/mockStoreSeed.js +0 -3
  152. package/dist/runtime/entities/seedBrowserStore.d.ts +0 -28
  153. package/dist/runtime/entities/seedBrowserStore.js +0 -2
  154. package/dist/runtime/entities/std-mock-seed.d.ts +0 -87
  155. package/dist/runtime/entities/std-mock-seed.js +0 -2
  156. package/dist/runtime/time/TickScheduler.d.ts +0 -77
  157. package/dist/runtime/time/TickScheduler.js +0 -3
  158. package/dist/runtime/time/cron.d.ts +0 -25
  159. package/dist/runtime/time/cron.js +0 -2
  160. package/dist/runtime/time/duration.d.ts +0 -20
  161. package/dist/runtime/time/duration.js +0 -2
  162. package/dist/runtime/traits/OrbitalTraitParsing.d.ts +0 -34
  163. package/dist/runtime/traits/OrbitalTraitParsing.js +0 -2
  164. package/dist/runtime/traits/listen-targets.d.ts +0 -16
  165. package/dist/runtime/traits/listen-targets.js +0 -3
  166. package/dist/runtime/traits/trait-index.d.ts +0 -35
  167. package/dist/runtime/traits/trait-index.js +0 -3
@@ -1,25 +0,0 @@
1
- /**
2
- * Pipe Behaviors
3
- *
4
- * Left-to-right composition. Each step receives the previous result as its
5
- * first argument and returns the value handed to the next step.
6
- *
7
- * @packageDocumentation
8
- */
9
- /**
10
- * A single step in a behavior pipeline.
11
- */
12
- type PipeStep<I, O> = (input: I) => O;
13
- /**
14
- * Apply a series of transformation steps to a seed value, left to right.
15
- * Each step receives the previous step's output as its first argument.
16
- *
17
- * @example
18
- * ```ts
19
- * pipeBehaviors(1, (n) => n + 1, (n) => n * 10); // -> 20
20
- * ```
21
- */
22
- declare function pipeBehaviors<T>(seed: T, ...steps: Array<PipeStep<T, T>>): T;
23
-
24
- export { pipeBehaviors };
25
- export type { PipeStep };
@@ -1,2 +0,0 @@
1
- export { pipeBehaviors } from '../../../chunk-FQ6IZMIU.js';
2
- import '../../../chunk-MLKGABMK.js';
@@ -1,56 +0,0 @@
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 };
@@ -1,3 +0,0 @@
1
- export { bindDeclaredCollections, restampMockOwner, seedMockStore } from '../../chunk-JFWFDUTR.js';
2
- import '../../chunk-HMK6YMQS.js';
3
- import '../../chunk-MLKGABMK.js';
@@ -1,28 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- export { seedBrowserStore } from '../../chunk-T775TUCD.js';
2
- import '../../chunk-MLKGABMK.js';
@@ -1,87 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- export { StdMockSeed, declaredSeedConfig, readSeededStores } from '../../chunk-HMK6YMQS.js';
2
- import '../../chunk-MLKGABMK.js';
@@ -1,77 +0,0 @@
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 };
@@ -1,3 +0,0 @@
1
- export { TickScheduler, createTickScheduler } from '../../chunk-CQP5XAX6.js';
2
- import '../../chunk-CROS2GEX.js';
3
- import '../../chunk-MLKGABMK.js';
@@ -1,25 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- export { cronMatches, cronMinuteKey, isValidCronExpression, parseCron, parseCronField } from '../../chunk-CROS2GEX.js';
2
- import '../../chunk-MLKGABMK.js';
@@ -1,20 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- export { isValidDurationString, parseDurationString } from '../../chunk-46RWK2B5.js';
2
- import '../../chunk-MLKGABMK.js';
@@ -1,34 +0,0 @@
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 };
@@ -1,2 +0,0 @@
1
- export { parseOrbitalTraits } from '../../chunk-SAS5KKCR.js';
2
- import '../../chunk-MLKGABMK.js';
@@ -1,16 +0,0 @@
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 };
@@ -1,3 +0,0 @@
1
- export { collectListenerTargets } from '../../chunk-XB5GYODW.js';
2
- import '../../chunk-IHQLE5M7.js';
3
- import '../../chunk-MLKGABMK.js';
@@ -1,35 +0,0 @@
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 };
@@ -1,3 +0,0 @@
1
- export { buildTraitIndex } from '../../chunk-CPSQXEJ6.js';
2
- import '../../chunk-SAS5KKCR.js';
3
- import '../../chunk-MLKGABMK.js';