@almadar/shell-runtime 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.
Files changed (167) hide show
  1. package/dist/chunk-2WCVOMZ2.js +112 -0
  2. package/dist/chunk-57SBCUSM.js +62 -0
  3. package/dist/{chunk-Q2H75UYT.js → chunk-A2JJT4GA.js} +1 -37
  4. package/dist/chunk-BAS26HBN.js +10 -0
  5. package/dist/{chunk-REPX5QPI.js → chunk-BOVU4TCQ.js} +11 -3
  6. package/dist/chunk-BY5G4225.js +6 -0
  7. package/dist/chunk-DFDNHVDW.js +284 -0
  8. package/dist/{chunk-NATGCIVM.js → chunk-JVSREWQO.js} +378 -130
  9. package/dist/{chunk-DYOJGLIX.js → chunk-LKWYCYX5.js} +2 -5
  10. package/dist/chunk-LYFIQPXX.js +1 -0
  11. package/dist/{chunk-ODJCZ27I.js → chunk-N7HYNKK6.js} +35 -2
  12. package/dist/{chunk-4J2QEIUV.js → chunk-NTFQ36UN.js} +4 -30
  13. package/dist/chunk-NU6LVKGS.js +15 -0
  14. package/dist/{chunk-VNMG7NKY.js → chunk-OQVSN7DP.js} +21 -26
  15. package/dist/chunk-P2N6K2IV.js +20 -0
  16. package/dist/{chunk-QQRDUMB2.js → chunk-QCJWPXLH.js} +11 -11
  17. package/dist/{chunk-QELZ6TEJ.js → chunk-UD2CXYSJ.js} +39 -3
  18. package/dist/{chunk-UJHOUZAL.js → chunk-V4EMDPCO.js} +2 -5
  19. package/dist/chunk-VKQA2DJX.js +409 -0
  20. package/dist/chunk-VNGXRYFF.js +9 -0
  21. package/dist/{chunk-HNOAZWFH.js → chunk-WGCWJOT2.js} +2 -0
  22. package/dist/chunk-XZGVOBY6.js +33 -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 +10 -10
  56. package/dist/kernel/decode.js +1 -2
  57. package/dist/kernel/engine.d.ts +133 -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 +148 -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 +113 -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 +16 -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,23 +1,17 @@
1
- import { OrbitalSchema, PersistenceAdapter, OnDeviceModelPorts, BrowserTabPort, MessageCatalogs, UserContext, RowSetRef, RowQueryPage } from '@almadar/core';
1
+ import { OrbitalSchema, PersistenceAdapter, OnDeviceModelPorts, BrowserTabPort, RowSetRef, RowQueryPage } from '@almadar/core';
2
2
  import { EffectHandlers } from '../types.js';
3
3
  import { KernelEngine } from '../../kernel/engine.js';
4
4
  import { KernelHostPorts } from '../../kernel/host.js';
5
- import { HttpPorts } from '../../kernel/http.js';
5
+ import { OsHostPort } from '../../kernel/os-port.js';
6
+ import { SecretPorts } from '../../kernel/secret-ports.js';
6
7
  import { KernelModule } from '../../kernel/wire.js';
7
8
  import { EventTransport } from '../../client/EventTransport.js';
8
9
  import '../../service/default-call-service.js';
9
10
  import '../../service/service-provider.js';
10
11
  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
12
  import '@almadar/core/kernel-wire';
20
- import '../../kernel/os-port.js';
13
+ import '../../effects/in-flight-calls.js';
14
+ import '../../credentials/vault.js';
21
15
 
22
16
  /**
23
17
  * An in-process transport over a local store: every request runs on the kernel opened over that store
@@ -26,10 +20,8 @@ import '../../kernel/os-port.js';
26
20
  */
27
21
 
28
22
  interface LocalKernelOptions {
29
- /** The initialised `@almadar/kernel` module. */
23
+ /** The initialised `@almadar/kernel` module with its language already installed (`loadBrowserKernel`): opening a kernel installs nothing. */
30
24
  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
25
  schema: OrbitalSchema;
34
26
  /** Every row the kernel reads and writes (`localStorePersistence` over a browser store). */
35
27
  persistence: PersistenceAdapter;
@@ -40,11 +32,14 @@ interface LocalKernelOptions {
40
32
  /** Where a follow-on call's outcome is dispatched; absent, nowhere. */
41
33
  deferCallOutcome?: KernelHostPorts['deferCallOutcome'];
42
34
  pageFacts?: KernelHostPorts['pageFacts'];
43
- http?: HttpPorts;
35
+ hostActions?: KernelHostPorts['hostActions'];
36
+ secretPorts?: SecretPorts;
44
37
  onDevice?: OnDeviceModelPorts;
45
38
  tabs?: BrowserTabPort;
46
- /** The program's message catalogs, so `i18n/t` resolves for the request's locale. */
47
- messages?: MessageCatalogs;
39
+ /** The host's `os` port (`createFetchOsHost` in a browser); absent, every `os` ask is denied. */
40
+ os?: OsHostPort;
41
+ /** The browser's GPU answerer (the kernel module's `GpuHost`), installed into the kernel; absent, every `gpu/` ask answers `unsupported`. */
42
+ gpu?: KernelHostPorts['gpu'];
48
43
  }
49
44
  /** 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
45
  declare function localStorePersistence(schema: OrbitalSchema, store: PersistenceAdapter, memory: PersistenceAdapter): PersistenceAdapter;
@@ -53,16 +48,14 @@ declare function openLocalKernel(options: LocalKernelOptions): KernelEngine;
53
48
  interface LocalStoreTransportOptions {
54
49
  /** The kernel the requests run on (`openLocalKernel`), or its promise while the kernel module loads. */
55
50
  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
51
  /** The program the kernel runs; given, the transport resolves row-set references on that kernel. */
61
52
  schema?: OrbitalSchema;
53
+ /** The page's locale, read per request: a request naming none runs in it, as a server request carries its viewer's. */
54
+ locale?: () => string | undefined;
62
55
  }
63
56
  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>;
57
+ /** `reference` resolved on a local kernel: the kernel applies the session identity's `@read`, the host answers its row reads. */
58
+ declare function resolveLocalRows(engine: KernelEngine, reference: RowSetRef): Promise<RowQueryPage>;
66
59
 
67
60
  export { createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows };
68
61
  export type { LocalKernelOptions, LocalStoreTransportOptions };
@@ -1,18 +1,14 @@
1
- export { createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows } from '../../chunk-VNMG7NKY.js';
1
+ export { createLocalStoreTransport, localStorePersistence, openLocalKernel, resolveLocalRows } from '../../chunk-OQVSN7DP.js';
2
2
  import '../../chunk-4SEK5ER2.js';
3
3
  import '../../chunk-UBN5JJKZ.js';
4
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';
5
+ import '../../chunk-VKQA2DJX.js';
6
+ import '../../chunk-NU6LVKGS.js';
7
+ import '../../chunk-XZGVOBY6.js';
8
+ import '../../chunk-JVSREWQO.js';
9
+ import '../../chunk-WGCWJOT2.js';
10
+ import '../../chunk-ZUSM4VW4.js';
13
11
  import '../../chunk-FWA5K7Q2.js';
14
- import '../../chunk-VMOBW7RK.js';
15
- import '../../chunk-RBUMDYFS.js';
16
12
  import '../../chunk-HLOUDLPI.js';
17
- import '../../chunk-QELZ6TEJ.js';
18
- import '../../chunk-MLKGABMK.js';
13
+ import '../../chunk-MZKIL5IN.js';
14
+ import '../../chunk-UD2CXYSJ.js';
@@ -1,13 +1,13 @@
1
1
  import { EventTransport } from '../../client/EventTransport.js';
2
- import { TraitIndex } from '@almadar/core';
2
+ import '@almadar/core';
3
3
 
4
4
  interface ResidenceTransportOptions {
5
5
  /** In-process transport over the browser store. */
6
6
  local: EventTransport;
7
7
  /** The server; absent on a static host. */
8
8
  remote?: EventTransport;
9
- /** The program's entities, for where a row-set reference's rows live. */
10
- traitIndex: TraitIndex;
9
+ /** The program's browser-stored entities (the kernel's `programSurface`): a row-set reference to one of them is resolved in-process. */
10
+ browserEntities: ReadonlySet<string>;
11
11
  }
12
12
  declare function createResidenceTransport(options: ResidenceTransportOptions): EventTransport;
13
13
 
@@ -1,2 +1 @@
1
- export { createResidenceTransport } from '../../chunk-UJHOUZAL.js';
2
- import '../../chunk-MLKGABMK.js';
1
+ export { createResidenceTransport } from '../../chunk-V4EMDPCO.js';
@@ -1,2 +1 @@
1
1
  export { routeByEntity } from '../../chunk-O57GKTYU.js';
2
- import '../../chunk-MLKGABMK.js';
@@ -1,4 +1,4 @@
1
- import { TraitId, OrbitalId, EventId } from '@almadar/core';
1
+ import { EventId } from '@almadar/core';
2
2
 
3
3
  /**
4
4
  * Identity-keyed routing (Almadar Rabit V4, Phase 4 — interpreter path).
@@ -29,56 +29,5 @@ import { TraitId, OrbitalId, EventId } from '@almadar/core';
29
29
  * wildcard listeners are untouched.
30
30
  */
31
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
32
 
83
- export { buildSourceMatcher, eventRouteKey, parseListenSource };
84
- export type { ListenSourceDescriptor, RouteSourceMeta };
33
+ export { eventRouteKey };
@@ -1,2 +1 @@
1
- export { buildSourceMatcher, eventRouteKey, parseListenSource } from '../../../chunk-IHQLE5M7.js';
2
- import '../../../chunk-MLKGABMK.js';
1
+ export { eventRouteKey } from '../../../chunk-BY5G4225.js';
@@ -1,12 +1,9 @@
1
1
  import { CallServiceHandler } from '../service/default-call-service.js';
2
2
  import { ServiceCallContext } from '../service/service-provider.js';
3
- import { EventPayload, BusEventSource, BusEventListener, Unsubscribe as Unsubscribe$1, BusEvent, EntityRow, TraitConfig, UserContext, NavItem, RuntimeValue, TraitId, OrbitalId, EventId, FieldValue, SExpr, FetchResult, RowSetRef, PatternConfig, OrbitalDefinition, PageFactField, BrowserPageFacts, JsonValue, ServiceHostPorts, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, ResolvedPatternProps } from '@almadar/core';
3
+ import { EventPayload, BusEventSource, BusEventListener, Unsubscribe as Unsubscribe$1, BusEvent, EntityRow, TraitConfig, UserContext, NavItem, RuntimeValue, FieldValue, SExpr, FetchResult, RowSetRef, PatternConfig, PageFactField, BrowserPageFacts, JsonValue, ServiceHostPorts, AgentContext, LlmContext, WorkspaceContext, SessionContext, MemoryContext, TraceContext, ResolvedPatternProps } from '@almadar/core';
4
4
  export { EntityRow, EventPayload, FetchResult, ServiceParams } from '@almadar/core';
5
5
  import { ProgramEffectName, ProgramEffectOutcome } from '../kernel/program-effects.js';
6
- import { ComposeBehaviorsInput, ComposeBehaviorsResult } from './effects/composition/compose-behaviors.js';
7
- import { EventWiringEntry } from './effects/composition/event-wiring.js';
8
- import { LayoutStrategy } from './effects/composition/layout-strategy.js';
9
- import { PipeStep } from './effects/composition/pipe.js';
6
+ import '@almadar/core/kernel-wire';
10
7
 
11
8
  /**
12
9
  * Unified Runtime Types
@@ -18,24 +15,6 @@ import { PipeStep } from './effects/composition/pipe.js';
18
15
 
19
16
  /** Alias for ResolvedPatternProps to avoid breaking internal consumers */
20
17
  type PatternProps = ResolvedPatternProps;
21
- /**
22
- * Value a render-ui pattern prop can carry AFTER interpolation. Mirrors
23
- * `FieldValue` but extends with `RuntimeRenderPattern` so nested pattern
24
- * configs (children, slot props that are themselves render-ui nodes)
25
- * round-trip without an `unknown` escape hatch.
26
- */
27
- type RuntimePatternValue = string | number | boolean | null | undefined | EntityRow | EntityRow[] | readonly RuntimePatternValue[] | RuntimeRenderPattern;
28
- /**
29
- * Shape of a render-ui pattern AFTER interpolation, as the runtime hands
30
- * it to `EffectHandlers.renderUI`. Different from `ResolvedPatternProps`
31
- * (`@almadar/core`) because the post-interpolation pattern carries
32
- * resolved EntityRow values (e.g. `{ entity: <row> }` from `@payload.row`)
33
- * not just primitives. Used by render-ui observability helpers to narrow
34
- * safely without `unknown` casts.
35
- */
36
- interface RuntimeRenderPattern {
37
- readonly [prop: string]: RuntimePatternValue;
38
- }
39
18
 
40
19
  type ConfigContext = TraitConfig;
41
20
  /**
@@ -65,40 +44,12 @@ interface IEventBus {
65
44
  /** Clear all listeners */
66
45
  clear(): void;
67
46
  }
68
- /**
69
- * Result of processing an event through a state machine
70
- */
71
- interface TransitionResult {
72
- /** Whether a transition was executed */
73
- executed: boolean;
74
- /** New state after transition (same as current if not executed) */
75
- newState: string;
76
- /** Previous state before transition */
77
- previousState: string;
78
- /** Effects to execute (empty if guard failed or no transition found) */
79
- effects: SExpr[];
80
- /** The transition that was executed (undefined if none) */
81
- transition?: {
82
- from: string;
83
- to: string;
84
- event: string;
85
- };
86
- /** Guard evaluation result (undefined if no guard) */
87
- guardResult?: boolean;
88
- }
89
47
  /**
90
48
  * Effect handlers interface - platform-specific implementations
91
49
  *
92
50
  * Client: React hooks, DOM, router
93
51
  * Server: Express, database, integrators
94
52
  */
95
- /** What one `http` effect came to: the `<METHOD> <origin><path>` it addressed and, on failure, the declared `emit.failure` event the program routed it to. */
96
- interface HttpEffectReport {
97
- success: boolean;
98
- target: string;
99
- error?: string;
100
- routed?: string;
101
- }
102
53
  interface EffectHandlers {
103
54
  /**
104
55
  * Emit an event to the event bus.
@@ -179,8 +130,6 @@ interface EffectHandlers {
179
130
  * the instant a real async persistence backend (Firestore) was wired in.
180
131
  */
181
132
  set: (entityId: string, field: string, value: FieldValue) => void | Promise<void>;
182
- /** Report the outcome of an `http` effect to the host's effect trace. */
183
- httpResult?: (report: HttpEffectReport) => void;
184
133
  /** Call an external service. `context` carries the caller's identity
185
134
  * (the same viewer entity ACL enforces against) so role-gated services
186
135
  * can enforce server-side; hosts forward it to the integration factory. */
@@ -255,37 +204,6 @@ interface EffectHandlers {
255
204
  navigateBack?: () => void;
256
205
  /** Log a message */
257
206
  log?: (message: string, level?: 'log' | 'warn' | 'error', data?: RuntimeValue) => void;
258
- /** Ref: declarative data subscription (server: same as fetch) */
259
- ref?: (entityType: string, options?: {
260
- id?: string;
261
- filter?: SExpr | Record<string, RuntimeValue>;
262
- limit?: number;
263
- offset?: number;
264
- include?: string[];
265
- }) => Promise<FetchResult | null>;
266
- /** Deref: one-shot data read (server: same as fetch) */
267
- deref?: (entityType: string, options?: {
268
- id?: string;
269
- filter?: SExpr | Record<string, RuntimeValue>;
270
- }) => Promise<FetchResult | null>;
271
- /** Swap!: atomic read-modify-write on an entity */
272
- swap?: (entityType: string, entityId: string, transform: SExpr) => Promise<EntityRow | null>;
273
- /** Watch: client-side reactive subscription (no-op on server) */
274
- watch?: (entityType: string, options?: {
275
- id?: string;
276
- filter?: SExpr | Record<string, RuntimeValue>;
277
- limit?: number;
278
- }) => void;
279
- /** Atomic: execute inner effects as a transaction */
280
- atomic?: (effects: SExpr[]) => Promise<void>;
281
- /** Compose multiple orbitals into one schema. Compile-time only. */
282
- composeBehaviors?: (input: ComposeBehaviorsInput) => ComposeBehaviorsResult;
283
- /** Apply cross-orbital event wiring. Compile-time only. */
284
- applyEventWiring?: (orbitals: OrbitalDefinition[], wiring: EventWiringEntry[]) => OrbitalDefinition[];
285
- /** Auto-detect layout strategy. Compile-time only. */
286
- detectLayoutStrategy?: (orbitals: OrbitalDefinition[], wiring?: EventWiringEntry[]) => LayoutStrategy;
287
- /** Left-to-right behavior pipeline. Compile-time only. */
288
- pipeBehaviors?: <T>(seed: T, ...steps: Array<PipeStep<T, T>>) => T;
289
207
  /** browser/open-file-picker — resolves with `{ files }` inside `result` */
290
208
  browserOpenFilePicker?: (options?: BrowserFilePickerOptions) => Promise<{
291
209
  files: BrowserFileMeta[];
@@ -321,33 +239,6 @@ interface EffectHandlers {
321
239
  programEffect?: (op: ProgramEffectName, args: readonly JsonValue[], context?: Pick<ServiceCallContext, 'principal' | 'role'>) => Promise<ProgramEffectOutcome>;
322
240
  agentPorts?: () => ServiceHostPorts | undefined;
323
241
  }
324
- /**
325
- * What a `batch` persist hands back — the shape `canonical-operators.json`
326
- * declares for persist's batch branch, so the `emit: { success }` envelope
327
- * carries exactly what the type system promises. Before this existed the
328
- * envelope emitted the raw INPUT array, so `?completedCount` / `?totalCount`
329
- * read `undefined` at runtime.
330
- *
331
- * Structurally an {@link EntityRow} — `operations` is an array of rows and the
332
- * counts are numbers, all valid `FieldValue`s — so `EffectHandlers.persist`
333
- * needs no widened return type and no cast: a batch summary reaches the bus by
334
- * the same path a create/update row does.
335
- *
336
- * Declared as a `type` alias, NOT an `interface`, deliberately: only an object
337
- * type alias gets TypeScript's implicit index signature, which is what makes it
338
- * assignable to `EntityRow`'s `Record<string, FieldValue | undefined>` half. As
339
- * an interface it fails that assignment (TS2322) and the only way to ship it
340
- * would be a cast — which the type-safety rule forbids, and rightly: the cast
341
- * would have hidden that the contract, not the value, was wrong.
342
- */
343
- type PersistBatchSummary = {
344
- /** One result row per attempted operation, in submission order. */
345
- operations: EntityRow[];
346
- /** How many operations completed before the batch stopped. */
347
- completedCount: number;
348
- /** How many were submitted. */
349
- totalCount: number;
350
- };
351
242
  /** Options for `browser/open-file-picker`. */
352
243
  interface BrowserFilePickerOptions {
353
244
  /** Allow selecting multiple files. */
@@ -390,11 +281,11 @@ interface BindingContext {
390
281
  user?: UserContext;
391
282
  /** The dispatch's one `now` stamp (ms epoch) — every guard, effect and time operator in it reads this. */
392
283
  now?: number;
393
- /** `@locale`: the viewer's locale (`OrbitalEventRequest.locale`, else the program's first declared locale). */
284
+ /** `@locale`: the viewer's locale (`EventRequest.locale`, else the program's first declared locale). */
394
285
  locale?: string;
395
286
  /** That locale's catalog — `i18n/t` reads it. */
396
287
  messages?: Readonly<Record<string, string>>;
397
- /** `@event`: the delivery being processed (`deliveryRecordValue`, Runtime Spec Clause 5.5). */
288
+ /** `@event`: the delivery being processed (Runtime Spec Clause 5.5). */
398
289
  event?: EventPayload;
399
290
  /** `@prevEvents`: deliveries this trait already received this dispatch. */
400
291
  prevEvents?: EventPayload[];
@@ -447,58 +338,6 @@ interface BindingContext {
447
338
  * narrow it to `Effect[]` at the executor boundary with {@link isEffectTuple}.
448
339
  */
449
340
  type Effect = [string, ...RuntimeValue[]];
450
- /**
451
- * Type guard: is this value an executable effect tuple (operator + args)?
452
- * Narrows wire-level `SExpr` effect lists to the executor-input `Effect`
453
- * without a cast. (Parameter is `RuntimeValue`, not `SExpr`, because a type
454
- * predicate's type must be assignable to its parameter's type — `Effect`'s
455
- * `RuntimeValue` tail is wider than `SExpr`. Every `SExpr` is a `RuntimeValue`,
456
- * so call sites pass either.)
457
- */
458
- declare function isEffectTuple(value: RuntimeValue): value is Effect;
459
- /**
460
- * Effect execution context
461
- */
462
- interface EffectContext {
463
- /** Trait name */
464
- traitName: string;
465
- /** Orbital that owns the firing trait. Used to stamp the source
466
- * metadata on emits so source-scoped listens (`TraitName EVENT` for
467
- * intra-orbital, `Orbital.TraitName EVENT` for cross-orbital) can
468
- * filter by emitter identity. */
469
- orbitalName?: string;
470
- /**
471
- * V4 dual-carry id sibling of `traitName` — stamped onto emit sources
472
- * so id-scoped `listens` (`buildSourceMatcher`) match by id,
473
- * rename-proof. The matcher compares ids ONLY when the listen source
474
- * carries one, so a name-only stamp never matches a `traitId`-carrying
475
- * listen (the chat SAVE → DO_CREATE relay died on the stateful path,
476
- * 2026-09-22). Parity with `OrbitalServerRuntime`'s emit stamp.
477
- */
478
- traitId?: TraitId;
479
- /**
480
- * V4 dual-carry id sibling of `orbitalName` — same contract as
481
- * `traitId`, for `kind: 'orbital'` listen sources.
482
- */
483
- orbitalId?: OrbitalId;
484
- /**
485
- * The trait's emit contracts — the emit-source stamp reads `eventId`
486
- * from the matching contract (parity with `OrbitalServerRuntime`'s
487
- * `emitContract?.eventId`).
488
- */
489
- emits?: ReadonlyArray<{
490
- event: string;
491
- eventId?: EventId;
492
- }>;
493
- /** Current state */
494
- state: string;
495
- /** Transition description */
496
- transition: string;
497
- /** Linked entity name */
498
- linkedEntity?: string;
499
- /** Entity ID (if available) */
500
- entityId?: string;
501
- }
502
341
  /**
503
342
  * Result of executing a single effect, with status tracking.
504
343
  */
@@ -517,33 +356,6 @@ interface EffectResult {
517
356
  * required field), so no handler recorded it — the host reports it. */
518
357
  refusedBeforeHandler?: boolean;
519
358
  }
520
- /**
521
- * Runtime configuration for strictness and safety modes.
522
- *
523
- * These options control how the runtime handles edge cases:
524
- * - `strictBindings`: Log warnings when bindings resolve to undefined (RCG-01)
525
- * - `maxEventDepth`: Prevent infinite event loops (RCG-05)
526
- */
527
- interface RuntimeConfig {
528
- /**
529
- * When true, log warnings when bindings like @entity.field resolve to undefined.
530
- * Helps detect typos and missing fields early. (RCG-01)
531
- * @default false
532
- */
533
- strictBindings?: boolean;
534
- /**
535
- * Maximum event emission depth before triggering circuit breaker. (RCG-05)
536
- * Prevents infinite loops from circular emit/listen chains.
537
- * @default 10
538
- */
539
- maxEventDepth?: number;
540
- /**
541
- * Additional fields to spread onto every EvaluationContext.
542
- * Used to inject module contexts (e.g., { agent: AgentContext }).
543
- * The evaluator dispatches agent/* operators to ctx.agent.
544
- */
545
- contextExtensions?: EvaluationContextExtensions;
546
- }
547
359
  /**
548
360
  * Typed extensions that get spread onto every EvaluationContext.
549
361
  * Each field here corresponds to an optional field on EvaluationContext.
@@ -558,17 +370,5 @@ interface EvaluationContextExtensions {
558
370
  memory?: MemoryContext;
559
371
  trace?: TraceContext;
560
372
  }
561
- /**
562
- * Execution context for handler manifest validation.
563
- * Defines which effect handlers should be available in each environment.
564
- */
565
- type ExecutionEnvironment = "client" | "server" | "test" | "ssr";
566
- /**
567
- * Effect handlers each execution environment is expected to carry. `client`
568
- * and `server` derive from the registry's `runsOn`; `ssr` is a render mode
569
- * (one server-side page render), not an execution site, so it stays listed.
570
- */
571
- declare const HANDLER_MANIFEST: Record<ExecutionEnvironment, string[]>;
572
373
 
573
- export { HANDLER_MANIFEST, isEffectTuple };
574
- export type { BindingContext, BrowserFileMeta, BrowserFilePickerOptions, BrowserGeolocationOptions, BrowserGeolocationPosition, ConfigContext, Effect, EffectContext, EffectHandlers, EffectResult, EvaluationContextExtensions, EventListener, ExecutionEnvironment, HttpEffectReport, IEventBus, PatternProps, PersistBatchSummary, RuntimeConfig, RuntimeEvent, RuntimePatternValue, RuntimeRenderPattern, TransitionResult, Unsubscribe };
374
+ export type { BindingContext, Effect, EffectHandlers, EffectResult, EvaluationContextExtensions, EventListener, IEventBus, PatternProps, RuntimeEvent, Unsubscribe };
@@ -1,2 +1 @@
1
- export { HANDLER_MANIFEST, isEffectTuple } from '../chunk-WNPNNYXY.js';
2
- import '../chunk-MLKGABMK.js';
1
+ import '../chunk-LYFIQPXX.js';
@@ -1,3 +1,2 @@
1
1
  export { defaultCallService } from '../chunk-4SEK5ER2.js';
2
2
  import '../chunk-UBN5JJKZ.js';
3
- import '../chunk-MLKGABMK.js';
@@ -1,2 +1 @@
1
1
  export { ServiceCallError, callRegisteredService, registerServiceProvider, registeredServices, unregisterServiceProvider } from '../chunk-UBN5JJKZ.js';
2
- import '../chunk-MLKGABMK.js';
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@almadar/shell-runtime",
3
- "version": "0.1.0",
3
+ "version": "1.1.0",
4
+ "orbRelease": {
5
+ "severity": "normal"
6
+ },
4
7
  "description": "Renderer-neutral kernel adapters and client orchestration for Almadar TypeScript hosts.",
5
8
  "license": "BUSL-1.1",
6
9
  "type": "module",
@@ -21,10 +24,10 @@
21
24
  ],
22
25
  "sideEffects": false,
23
26
  "dependencies": {
24
- "@almadar/core": "^10.129.0",
25
- "@almadar/kernel": "^18.0.0",
26
- "@almadar/logger": "^1.18.0",
27
- "@almadar/std": "^16.255.0"
27
+ "@almadar/core": "^11.3.0",
28
+ "@almadar/kernel": "^19.0.1",
29
+ "@almadar/logger": "^2.3.0",
30
+ "@almadar/std": "^17.1.0"
28
31
  },
29
32
  "devDependencies": {
30
33
  "@types/node": "^20.0.0",
@@ -1,21 +0,0 @@
1
- import { findInbound, unknownHook, credentialUnset, inboundPayload, inboundAnswerOf, dispatchFailed } from '@almadar/core';
2
-
3
- // src/client/inbound-dispatch.ts
4
- async function dispatchInbound(schema, name, delivery, send, credential) {
5
- const route = schema ? findInbound(schema, name) : void 0;
6
- if (route === void 0) return unknownHook(name);
7
- try {
8
- const held = route.verifies !== void 0 ? await credential(route.verifies.credential) : void 0;
9
- if (route.verifies !== void 0 && (held === void 0 || held === null || held === "")) return credentialUnset(route.verifies.credential);
10
- const response = await send(route.orbital, {
11
- event: route.event,
12
- payload: inboundPayload(route, delivery, held),
13
- targetTrait: route.trait
14
- });
15
- return inboundAnswerOf(route, response.emittedEvents, response.error);
16
- } catch (error) {
17
- return dispatchFailed(error instanceof Error ? error.message : String(error));
18
- }
19
- }
20
-
21
- export { dispatchInbound };
@@ -1,28 +0,0 @@
1
- // src/runtime/time/duration.ts
2
- function parseDurationString(interval) {
3
- const match = interval.match(/^(\d+)(ms|s|m|h)?$/);
4
- if (!match) {
5
- throw new Error(
6
- `Invalid duration '${interval}': expected a shape like '5ms'/'5s'/'1m'/'1h'`
7
- );
8
- }
9
- const value = parseInt(match[1], 10);
10
- const unit = match[2] || "ms";
11
- switch (unit) {
12
- case "ms":
13
- return value;
14
- case "s":
15
- return value * 1e3;
16
- case "m":
17
- return value * 60 * 1e3;
18
- case "h":
19
- return value * 60 * 60 * 1e3;
20
- default:
21
- return value;
22
- }
23
- }
24
- function isValidDurationString(interval) {
25
- return /^(\d+)(ms|s|m|h)?$/.test(interval);
26
- }
27
-
28
- export { isValidDurationString, parseDurationString };