@almadar/core 11.2.0 → 11.4.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 (92) hide show
  1. package/dist/behavior-package.js +1 -3
  2. package/dist/{builders-C4TIhiks.d.ts → builders-CAQ_shuO.d.ts} +274 -274
  3. package/dist/builders.d.ts +6 -6
  4. package/dist/builders.js +8 -10
  5. package/dist/{bus-do1P9luP.d.ts → bus-QFvlnIfW.d.ts} +113 -438
  6. package/dist/{chunk-B4MNHGBP.js → chunk-5IRZ6ROW.js} +0 -2
  7. package/dist/{chunk-7NDAXM2Z.js → chunk-6XYHVJ4J.js} +1 -3
  8. package/dist/{chunk-2NKK2X53.js → chunk-7JO77HA6.js} +1 -3
  9. package/dist/chunk-AIRZM37O.js +3809 -0
  10. package/dist/{chunk-RGACZEYC.js → chunk-DDBAQMWA.js} +0 -2
  11. package/dist/{chunk-VOFHP52Z.js → chunk-DHWP7B4S.js} +147 -7
  12. package/dist/{chunk-7GHJU5WI.js → chunk-GNLND5O2.js} +0 -2
  13. package/dist/{chunk-PYYHDYTD.js → chunk-ISAUHHDU.js} +1 -3
  14. package/dist/{chunk-M4S2B5VJ.js → chunk-IU3WGC6Q.js} +0 -2
  15. package/dist/{chunk-VIHQKKTZ.js → chunk-JCRN3F6T.js} +10 -12
  16. package/dist/{chunk-7B4JRMRL.js → chunk-JPJQCTJI.js} +12 -6
  17. package/dist/{chunk-6H3UIZR2.js → chunk-O2ZUOWNK.js} +4 -6
  18. package/dist/{chunk-IE6WCCJP.js → chunk-OLSKERKZ.js} +51 -47
  19. package/dist/{chunk-N3CK4AYW.js → chunk-QV6J4EAF.js} +560 -58
  20. package/dist/{chunk-347APWFM.js → chunk-R3Y7ABF4.js} +2 -4
  21. package/dist/{chunk-3DZOFI53.js → chunk-TOAMAGC7.js} +2 -4
  22. package/dist/{chunk-LPJ7GKRM.js → chunk-UCP26C3C.js} +4 -6
  23. package/dist/{chunk-VG7BRFUD.js → chunk-W3UJRSYC.js} +0 -2
  24. package/dist/{effect-Dr--GXRe.d.ts → effect--PY8R4Oi.d.ts} +72 -38
  25. package/dist/{effect-result-geymPT9w.d.ts → effect-result-fH1ZTxn6.d.ts} +59 -38
  26. package/dist/{expression-DirYKz-f.d.ts → expression-DxY6ct3t.d.ts} +1 -1
  27. package/dist/factory/index.d.ts +3 -3
  28. package/dist/factory/index.js +8 -10
  29. package/dist/factory-runtime/index.d.ts +4 -4
  30. package/dist/factory-runtime/index.js +15 -17
  31. package/dist/fixtures.d.ts +8 -7
  32. package/dist/fixtures.js +6 -8
  33. package/dist/i18n/index.js +2 -4
  34. package/dist/{index-C8mF8btS.d.ts → index-Dk2AoJdI.d.ts} +43 -30
  35. package/dist/index.d.ts +17 -19
  36. package/dist/index.js +23 -25
  37. package/dist/kernel-wire.d.ts +3 -3
  38. package/dist/kernel-wire.js +3 -5
  39. package/dist/language/constructs.json +5 -0
  40. package/dist/language/program-types.json +6 -0
  41. package/dist/language/validation-codes.json +140 -0
  42. package/dist/language/vocabulary.json +45 -1
  43. package/dist/language-data.js +3 -5
  44. package/dist/lolo-document/index.js +0 -2
  45. package/dist/patterns/component-mapping.json +1 -1
  46. package/dist/patterns/definitions.d.ts +2 -2
  47. package/dist/patterns/definitions.js +1 -3
  48. package/dist/patterns/event-contracts.json +1 -1
  49. package/dist/patterns/index.d.ts +9 -3
  50. package/dist/patterns/index.js +3 -5
  51. package/dist/patterns/patterns-registry.json +560 -56
  52. package/dist/patterns/registry.json +560 -56
  53. package/dist/themes/index.js +2 -4
  54. package/dist/{trait-D9MjuwGC.d.ts → trait-BO2gbBte.d.ts} +82 -92
  55. package/dist/types/index.d.ts +9 -9
  56. package/dist/types/index.js +12 -14
  57. package/dist/{types-Bi-KSa0a.d.ts → types-CSBhbbse.d.ts} +3 -3
  58. package/package.json +6 -6
  59. package/dist/behavior-package.js.map +0 -1
  60. package/dist/builders.js.map +0 -1
  61. package/dist/chunk-2NKK2X53.js.map +0 -1
  62. package/dist/chunk-347APWFM.js.map +0 -1
  63. package/dist/chunk-3DZOFI53.js.map +0 -1
  64. package/dist/chunk-6H3UIZR2.js.map +0 -1
  65. package/dist/chunk-7B4JRMRL.js.map +0 -1
  66. package/dist/chunk-7GHJU5WI.js.map +0 -1
  67. package/dist/chunk-7NDAXM2Z.js.map +0 -1
  68. package/dist/chunk-B4MNHGBP.js.map +0 -1
  69. package/dist/chunk-IE6WCCJP.js.map +0 -1
  70. package/dist/chunk-LPJ7GKRM.js.map +0 -1
  71. package/dist/chunk-M4S2B5VJ.js.map +0 -1
  72. package/dist/chunk-N3CK4AYW.js.map +0 -1
  73. package/dist/chunk-PYYHDYTD.js.map +0 -1
  74. package/dist/chunk-RGACZEYC.js.map +0 -1
  75. package/dist/chunk-VG7BRFUD.js.map +0 -1
  76. package/dist/chunk-VIHQKKTZ.js.map +0 -1
  77. package/dist/chunk-VOFHP52Z.js.map +0 -1
  78. package/dist/chunk-ZDIHVDTW.js +0 -3810
  79. package/dist/chunk-ZDIHVDTW.js.map +0 -1
  80. package/dist/factory/index.js.map +0 -1
  81. package/dist/factory-runtime/index.js.map +0 -1
  82. package/dist/fixtures.js.map +0 -1
  83. package/dist/i18n/index.js.map +0 -1
  84. package/dist/index.js.map +0 -1
  85. package/dist/kernel-wire.js.map +0 -1
  86. package/dist/language-data.js.map +0 -1
  87. package/dist/lolo-document/index.js.map +0 -1
  88. package/dist/patterns/definitions.js.map +0 -1
  89. package/dist/patterns/index.js.map +0 -1
  90. package/dist/themes/index.js.map +0 -1
  91. package/dist/types/index.js.map +0 -1
  92. package/dist/{domain-JuWUUeJ3.d.ts → domain-Cpmja5ak.d.ts} +51 -51
@@ -1,7 +1,7 @@
1
- import './effect-Dr--GXRe.js';
2
- export { bP as ComposeConnection, bQ as ComposePage, G as EventWiringEntry, S as LayoutStrategy, bR as MakeAtomOrbitalOpts, bS as MakeAtomOrbitalTraitOverrides, bT as MakeEntityOpts, bU as MakeLayoutTraitOpts, bV as MakeOrbitalWithUsesOpts, bW as MakePageOpts, bX as MakePageRefOpts, bY as MakePageRefOptsTyped, M as MakeTraitRefOpts, bZ as MakeTraitRefOptsTyped, a2 as ORBITAL_VALUE_IMPORT_ALIAS, b_ as applyTraitConfigOverrides, b$ as compose, c0 as connect, c1 as ensureIdField, c2 as extractTrait, c3 as makeAtomOrbital, c4 as makeEntity, c5 as makeLayoutTrait, c6 as makeOrbital, c7 as makeOrbitalWithUses, c8 as makePage, c9 as makePageRef, ca as makeRenderUI, cb as makeSchema, cc as makeSlot, cd as makeTraitRef, ce as mergeOrbitals, bA as orbitalImportFromValue, bI as parseProgram, cf as pipe, cg as plural, ch as wire } from './builders-C4TIhiks.js';
3
- import './trait-D9MjuwGC.js';
4
- import './expression-DirYKz-f.js';
1
+ import './effect--PY8R4Oi.js';
2
+ export { bP as ComposeConnection, bQ as ComposePage, G as EventWiringEntry, S as LayoutStrategy, bR as MakeAtomOrbitalOpts, bS as MakeAtomOrbitalTraitOverrides, bT as MakeEntityOpts, bU as MakeLayoutTraitOpts, bV as MakeOrbitalWithUsesOpts, bW as MakePageOpts, bX as MakePageRefOpts, bY as MakePageRefOptsTyped, M as MakeTraitRefOpts, bZ as MakeTraitRefOptsTyped, a2 as ORBITAL_VALUE_IMPORT_ALIAS, b_ as applyTraitConfigOverrides, b$ as compose, c0 as connect, c1 as ensureIdField, c2 as extractTrait, c3 as makeAtomOrbital, c4 as makeEntity, c5 as makeLayoutTrait, c6 as makeOrbital, c7 as makeOrbitalWithUses, c8 as makePage, c9 as makePageRef, ca as makeRenderUI, cb as makeSchema, cc as makeSlot, cd as makeTraitRef, ce as mergeOrbitals, bA as orbitalImportFromValue, bI as parseProgram, cf as pipe, cg as plural, ch as wire } from './builders-CAQ_shuO.js';
3
+ import './trait-BO2gbBte.js';
4
+ import './expression-DxY6ct3t.js';
5
5
  import 'zod';
6
- import './domain-JuWUUeJ3.js';
7
- import './effect-result-geymPT9w.js';
6
+ import './domain-Cpmja5ak.js';
7
+ import './effect-result-fH1ZTxn6.js';
package/dist/builders.js CHANGED
@@ -1,10 +1,8 @@
1
- export { ORBITAL_VALUE_IMPORT_ALIAS, applyTraitConfigOverrides, compose, connect, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, orbitalImportFromValue, parseProgram, pipe, plural, wire } from './chunk-2NKK2X53.js';
2
- import './chunk-LPJ7GKRM.js';
3
- import './chunk-M4S2B5VJ.js';
4
- import './chunk-7B4JRMRL.js';
5
- import './chunk-347APWFM.js';
6
- import './chunk-VG7BRFUD.js';
7
- import './chunk-B4MNHGBP.js';
8
- import './chunk-7GHJU5WI.js';
9
- //# sourceMappingURL=builders.js.map
10
- //# sourceMappingURL=builders.js.map
1
+ export { ORBITAL_VALUE_IMPORT_ALIAS, applyTraitConfigOverrides, compose, connect, ensureIdField, extractTrait, makeAtomOrbital, makeEntity, makeLayoutTrait, makeOrbital, makeOrbitalWithUses, makePage, makePageRef, makeRenderUI, makeSchema, makeSlot, makeTraitRef, mergeOrbitals, orbitalImportFromValue, parseProgram, pipe, plural, wire } from './chunk-7JO77HA6.js';
2
+ import './chunk-UCP26C3C.js';
3
+ import './chunk-IU3WGC6Q.js';
4
+ import './chunk-JPJQCTJI.js';
5
+ import './chunk-R3Y7ABF4.js';
6
+ import './chunk-W3UJRSYC.js';
7
+ import './chunk-5IRZ6ROW.js';
8
+ import './chunk-GNLND5O2.js';
@@ -1,9 +1,107 @@
1
1
  import { z } from 'zod';
2
- import { E as EventPayloadValue, c as EventPayload, L as LogMeta, R as RuntimeValue, a as JsonObject, J as JsonValue } from './expression-DirYKz-f.js';
3
- import { c as EntityRow, i as FieldValue, j as ServiceParams, O as OrbitalId, T as TraitId, b as EventId } from './effect-Dr--GXRe.js';
4
- import { V as Viewer, H as HostAskCompletion, a as EventResponse, E as EventRequest } from './effect-result-geymPT9w.js';
5
- import { P as PayloadField } from './trait-D9MjuwGC.js';
6
- import { J as JsonSchema } from './types-Bi-KSa0a.js';
2
+ import { b as EventPayloadValue, c as EventPayload, L as LogMeta, J as JsonValue, a as JsonObject } from './expression-DxY6ct3t.js';
3
+ import { V as Viewer, R as RowQuery, Q as QueryCapabilities, c as RowIdPage, d as RowWriteOp, e as RowWriteOutcome, f as RowWriteBatch, W as WriteCapabilities, g as RowCommitWrite, B as BusEventSource, C as ClientEffect, H as HostAskCompletion, D as DeliveryRecord, h as DispatchLog, a as EventResponse, b as EmittedEvent, E as EventRequest, i as RowSetRef } from './effect-result-fH1ZTxn6.js';
4
+ import { i as FieldValue, c as EntityRow, S as ServiceParams } from './effect--PY8R4Oi.js';
5
+ import { P as PayloadField } from './trait-BO2gbBte.js';
6
+ import { J as JsonSchema } from './types-CSBhbbse.js';
7
+
8
+ /**
9
+ * Authenticated user context — what `@user.x` resolves against.
10
+ *
11
+ * The canonical shape for the `user` binding root, shared by both execution
12
+ * paths: the JS interpreter resolves `@user.id` through
13
+ * `EvaluationContext.user`, and the compiled shell emits `user?.id` against the
14
+ * `UserContext` its `@app/shared` re-exports from here.
15
+ *
16
+ * `id` is the field the behavior library reads for ownership scoping and `role`
17
+ * the field it reads for capability gating. Auth providers that name the subject
18
+ * `uid` must normalize at their boundary — {@link normalizeUserContext} does that.
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+
23
+ /**
24
+ * What a host's auth provider has resolved the viewer to be — from session
25
+ * resolution only, never from an interactive sign-in action: `pending` until
26
+ * the session is known; `anonymous` / `authenticated` once it is; `failed`
27
+ * when connecting or resolving the session failed; `unavailable` when the host
28
+ * has no sign-in configured. An `access: authenticated` page mounts only on
29
+ * `authenticated`.
30
+ */
31
+ type ViewerAuthority = 'pending' | 'anonymous' | 'authenticated' | 'failed' | 'unavailable';
32
+ /**
33
+ * The `@user` binding: a {@link Viewer} held flat. Its named fields are the viewer's; each claim is a key holding its
34
+ * JSON value, readable as `@user.<claim>`. The Rust twin of the conversion is `orbital_core_base::viewer`
35
+ * (`Viewer::from_user` / `Viewer::to_user`).
36
+ */
37
+ type UserContext = Omit<Viewer, 'claims'> & {
38
+ [key: string]: FieldValue;
39
+ };
40
+ /** Zod twin of the generated {@link Viewer}: the record a `.lolo` program names as `Viewer`. */
41
+ declare const ViewerSchema: z.ZodType<Viewer>;
42
+ /**
43
+ * The identity of an unauthenticated viewer. A resolvable object rather than
44
+ * `undefined` so a role predicate evaluates to a definite `false` instead of
45
+ * comparing against nothing.
46
+ */
47
+ declare const ANONYMOUS_USER: UserContext;
48
+ /** Provider-shaped identity claims, before normalization. */
49
+ type RawUserClaims = {
50
+ id?: string;
51
+ uid?: string;
52
+ email?: string | null;
53
+ name?: string | null;
54
+ displayName?: string | null;
55
+ /** Absent or `null` when the token carries none, as the kernel's `Viewer.role` (`Option`). */
56
+ role?: string | null;
57
+ permissions?: string[] | null;
58
+ } & {
59
+ [key: string]: FieldValue;
60
+ };
61
+ /** Zod twin of `RawUserClaims` — the wire shape of `EventRequest.user`. */
62
+ declare const RawUserClaimsSchema: z.ZodType<RawUserClaims>;
63
+ /**
64
+ * Normalize provider claims into a {@link UserContext}.
65
+ *
66
+ * Firebase (and most OIDC providers) name the subject `uid` and the display name
67
+ * `displayName`, while every `.lolo` behavior reads `@user.id` / `@user.name`.
68
+ * Without this normalization `@user.id` is `undefined` against a fully
69
+ * authenticated request and every ownership filter silently matches no rows.
70
+ * `uid` is preserved so `@user.uid` keeps working.
71
+ *
72
+ * Returns `undefined` for absent or subject-less claims so callers can
73
+ * distinguish "no auth ran" from "anonymous"; use {@link ANONYMOUS_USER} where a
74
+ * definite identity is required.
75
+ */
76
+ declare function normalizeUserContext(claims: RawUserClaims | null | undefined): UserContext | undefined;
77
+ /**
78
+ * Turn a row of an app's `[identity]` entity into a viewer.
79
+ *
80
+ * There is no separate persona shape: an identity row IS the persona
81
+ * (`Almadar_LOLO_Identity.md` §4.3), so this only guards the one field the
82
+ * behavior library requires — a non-empty string `id` — and passes every other
83
+ * declared field through as a `@user.<field>` claim. Rows without a usable id
84
+ * yield `undefined` rather than a persona nobody can own rows as.
85
+ */
86
+ declare function personaFromIdentityRow(row: Record<string, FieldValue | undefined>): UserContext | undefined;
87
+ /** Look a persona up in a roster by id, or by role when no id matches. */
88
+ declare function findPersonaInRoster(roster: readonly UserContext[], idOrRole: string): UserContext | undefined;
89
+ /**
90
+ * Resolve a persona spec — a bare id/role (`Person Id 3`, `moderator`) or a full
91
+ * JSON `UserContext` — into a viewer. This is the `ALMADAR_PERSONA` contract,
92
+ * shared by every host that presents an app as somebody.
93
+ *
94
+ * The roster is the app's OWN declared personas — the seeded rows of its
95
+ * `[identity]` entity (`Almadar_LOLO_Identity.md` §4.3) — supplied by the host
96
+ * that has them in hand (the runtime's live store on the interpreter path, the
97
+ * schema-derived seed rows on the compiled path). There is no global roster:
98
+ * an app without an `[identity]` entity resolves only JSON-form specs.
99
+ *
100
+ * Throws on anything unresolvable rather than returning `undefined`: "no persona"
101
+ * and "persona silently ignored" look identical on screen, so a bad spec must
102
+ * fail at boot instead of rendering as nobody.
103
+ */
104
+ declare function resolvePersonaSpec(spec: string, roster: readonly UserContext[]): UserContext;
7
105
 
8
106
  /**
9
107
  * Service Contract Types
@@ -155,216 +253,8 @@ type RowPage<T> = {
155
253
  /** Rows matching the filters and search, across all pages. */
156
254
  total: number;
157
255
  };
158
- /** The comparison members of `StoreFilterOp`. */
159
- type RowCompareOp = Extract<StoreFilterOp, "==" | "!=" | "<" | "<=" | ">" | ">=">;
160
- /**
161
- * A row predicate with two-valued logic: a missing or null field satisfies only `!=` against a
162
- * non-null value and `isNull: true`, and fails every other leaf, so `not` of a failing leaf holds.
163
- * Leaves reuse the `StoreFilterOp` meanings: `member` is `in`, `hasElement` is `array-contains`,
164
- * `contains` is a substring test.
165
- */
166
- type RowPredicate = {
167
- kind: "compare";
168
- field: string;
169
- op: RowCompareOp;
170
- value: FieldValue;
171
- } | {
172
- kind: "member";
173
- field: string;
174
- values: FieldValue[];
175
- } | {
176
- kind: "hasElement";
177
- field: string;
178
- value: FieldValue;
179
- } | {
180
- kind: "contains";
181
- field: string;
182
- text: string;
183
- caseSensitive: boolean;
184
- } | {
185
- kind: "isNull";
186
- field: string;
187
- isNull: boolean;
188
- } | {
189
- kind: "all";
190
- of: RowPredicate[];
191
- } | {
192
- kind: "any";
193
- of: RowPredicate[];
194
- } | {
195
- kind: "not";
196
- of: RowPredicate;
197
- } | {
198
- kind: "const";
199
- value: boolean;
200
- };
201
- /** One sort key. Missing and null values sort last in both directions; ties break by `id` ascending. A query with no `order` is ordered by `createdAt` ascending, then `id` (EXEC-FETCH-1). */
202
- type RowOrder = {
203
- field: string;
204
- direction: "asc" | "desc";
205
- };
206
- /**
207
- * A vector-similarity query: up to `k` rows ordered by descending cosine similarity of `field` to `vector`
208
- * (EXEC-FETCH-2). A row whose field is absent, null or of zero norm is skipped; a stored vector that is not a
209
- * `[number]` of the query's length, a zero-norm query or a non-positive `k` fails.
210
- */
211
- type RowNearest = {
212
- field: string;
213
- vector: number[];
214
- k: number;
215
- };
216
- /**
217
- * A pushed-down query: rows matching `policy` AND `filter`, ordered, then windowed. `policy` is the
218
- * entity's `@read` predicate already specialised to the viewer; `filter` is the call-site filter.
219
- */
220
- type RowQuery = {
221
- policy?: RowPredicate;
222
- filter?: RowPredicate;
223
- /** Absent = `createdAt` ascending, then `id` ascending (EXEC-FETCH-1). */
224
- order?: RowOrder;
225
- offset?: number;
226
- /** Absent = no limit. */
227
- limit?: number;
228
- /** Absent = `exact`. With `none` the store need not count; `total` is then only the window's size. */
229
- total?: RowTotalMode;
230
- /** The nearest `k` rows among those `policy` and `filter` admit. Excludes `order`, `offset` and `limit`; `total` is the count returned. */
231
- nearest?: RowNearest;
232
- };
233
256
  /** The answer to a `RowQuery`: the window, and `total` = every match before the window. */
234
257
  type RowQueryPage = RowPage<EntityRow>;
235
- /** Value kinds a store can compare, in `compare`/`member`/`hasElement` operands. */
236
- type RowValueKind = "string" | "number" | "boolean" | "date" | "null";
237
- /** Every operator a `RowPredicate` leaf can carry. */
238
- type RowOperator = RowCompareOp | "member" | "hasElement" | "contains";
239
- /** The value kinds one operator accepts on a store; an operator not listed accepts every kind. */
240
- type OperatorValueKinds = {
241
- operator: RowOperator;
242
- valueKinds: RowValueKind[];
243
- };
244
- /** Whether `total` counts every match (`exact`, the default) or the store may skip the count (`none`). */
245
- type RowTotalMode = "exact" | "none";
246
- /** What an adapter's `queryPage` honours for one entity type. */
247
- type QueryCapabilities = {
248
- leaves: ("compare" | "member" | "hasElement" | "contains" | "isNull")[];
249
- combinators: ("all" | "any" | "not")[];
250
- compareOps: RowCompareOp[];
251
- /** Per operator x value kind restrictions; absent = every kind for every declared operator. */
252
- operatorValueKinds?: OperatorValueKinds[];
253
- orderableFields: {
254
- kind: "every-field";
255
- } | {
256
- kind: "listed";
257
- fields: string[];
258
- };
259
- /** offset and limit. */
260
- window: boolean;
261
- /** `total` counts every match, not the window. Needed only for `total: exact` queries. */
262
- exactTotal: boolean;
263
- /** `queryIds` is implemented. */
264
- idsOnly?: boolean;
265
- /** `nearest` is pushed down: the store ranks by cosine similarity itself (EXEC-FETCH-2). */
266
- nearest?: boolean;
267
- };
268
- /** The answer to a `queryIds`: the window's ids in order, and `total` as in `RowQueryPage`. */
269
- type RowIdPage = {
270
- ids: string[];
271
- total: number;
272
- };
273
- /**
274
- * One write. `create` fails (`duplicate-id`) when its id is taken. `upsert` creates the row or replaces it
275
- * whole by id (`created` / `updated`), keeping the existing `createdAt`. `update` changes an existing row only
276
- * (never an upsert) and merges `data` over it with `id` stamped last; `guard` is tested against the pre-image.
277
- * `delete` likewise. Native `rekey` moves an existing id with insertion-order collision semantics; support is explicit.
278
- */
279
- type RowWriteOp = {
280
- kind: "create";
281
- entityType: string;
282
- data: EntityRow;
283
- } | {
284
- kind: "upsert";
285
- entityType: string;
286
- data: EntityRow;
287
- } | {
288
- kind: "update";
289
- entityType: string;
290
- id: string;
291
- data: EntityRow;
292
- guard?: RowPredicate;
293
- } | {
294
- kind: "delete";
295
- entityType: string;
296
- id: string;
297
- guard?: RowPredicate;
298
- } | {
299
- kind: "rekey";
300
- entityType: string;
301
- id: string;
302
- newId: string;
303
- guard?: RowPredicate;
304
- };
305
- /**
306
- * What one write did. `before` (the pre-image) is present exactly when the op carried a guard.
307
- * `rolled-back` is only produced inside an `atomic` batch that failed: the op had succeeded and was undone.
308
- */
309
- type RowWriteOutcome = {
310
- kind: "created";
311
- row: EntityRow;
312
- } | {
313
- kind: "updated";
314
- row: EntityRow;
315
- before?: EntityRow;
316
- } | {
317
- kind: "deleted";
318
- before?: EntityRow;
319
- } | {
320
- kind: "not-found";
321
- } | {
322
- kind: "duplicate-id";
323
- } | {
324
- kind: "refused";
325
- } | {
326
- kind: "failed";
327
- message: string;
328
- } | {
329
- kind: "rolled-back";
330
- };
331
- /**
332
- * `atomic`: all ops apply or none do (a `persist batch`); on failure the outcomes are `rolled-back` for
333
- * every earlier op, then the failing outcome, and nothing is written.
334
- * `stop`: ops apply in order and stop at the first failure; earlier ops stay applied, later ones are
335
- * not attempted and have no outcome (a run of plain `persist` effects).
336
- */
337
- type RowWriteFailureMode = "atomic" | "stop";
338
- type RowWriteBatch = {
339
- ops: RowWriteOp[];
340
- onFailure: RowWriteFailureMode;
341
- };
342
- /** What an adapter's `writeWhere`/`writeBatch` honours for one entity type. */
343
- type WriteCapabilities = {
344
- /** The guard predicates the store can test; a `Pick` of the query capabilities. */
345
- guards: Pick<QueryCapabilities, "leaves" | "combinators" | "compareOps">;
346
- /** `writeWhere` tests the guard and the existence of the row in one step. */
347
- conditional: boolean;
348
- /** Outcomes carry the written row. */
349
- returnsRow: boolean;
350
- /** `writeBatch` with `onFailure: "stop"`. */
351
- stopRuns: boolean;
352
- /** `writeBatch` with `onFailure: "atomic"`; needs transactions. */
353
- atomicBatch: boolean;
354
- /** Native id moves; absent means unsupported. */
355
- rekey?: boolean;
356
- /** The store commits rows the kernel decided (`commitRows`) and holds no write semantics (EXEC-STORE-5). */
357
- commitRows?: boolean;
358
- };
359
- /** What a compare-and-commit does to one row the kernel read. */
360
- type RowCommitWrite = {
361
- kind: "keep";
362
- } | {
363
- kind: "put";
364
- row: EntityRow;
365
- } | {
366
- kind: "delete";
367
- };
368
258
  /** One row of a compare-and-commit: the version the kernel read (`null` when absent) and what it writes (EXEC-STORE-5). */
369
259
  type RowCommit = {
370
260
  entityType: string;
@@ -470,125 +360,6 @@ interface LazyService<T> {
470
360
  */
471
361
  declare function createLazyService<T>(factory: () => T): LazyService<T>;
472
362
 
473
- /**
474
- * A fetched page by reference: `ids` = the window in order, `total` = matches before the window at
475
- * dispatch time, `query` = what produced it (its predicates, incl. the @read policy, re-count `total`; order and window are ignored).
476
- */
477
- type RowSetRef = {
478
- entityType: string;
479
- ids: string[];
480
- total: number;
481
- query: RowQuery;
482
- };
483
- declare const RowSetRefSchema: z.ZodType<RowSetRef>;
484
- /** Tag property of a `RowSetMarker`; `$`-prefixed so it never collides with a pattern prop key. */
485
- declare const ROW_SET_MARKER: "$rowSet";
486
- /** A render prop leaf resolved to rows at paint time by the kernel (`@read` applied there). */
487
- type RowSetMarker = {
488
- readonly [ROW_SET_MARKER]: true;
489
- readonly ref: RowSetRef;
490
- };
491
- declare function rowSetMarker(ref: RowSetRef): RowSetMarker;
492
- declare function isRowSetMarker(value: RuntimeValue): value is RowSetMarker;
493
-
494
- /**
495
- * Authenticated user context — what `@user.x` resolves against.
496
- *
497
- * The canonical shape for the `user` binding root, shared by both execution
498
- * paths: the JS interpreter resolves `@user.id` through
499
- * `EvaluationContext.user`, and the compiled shell emits `user?.id` against the
500
- * `UserContext` its `@app/shared` re-exports from here.
501
- *
502
- * `id` is the field the behavior library reads for ownership scoping and `role`
503
- * the field it reads for capability gating. Auth providers that name the subject
504
- * `uid` must normalize at their boundary — {@link normalizeUserContext} does that.
505
- *
506
- * @packageDocumentation
507
- */
508
-
509
- /**
510
- * What a host's auth provider has resolved the viewer to be — from session
511
- * resolution only, never from an interactive sign-in action: `pending` until
512
- * the session is known; `anonymous` / `authenticated` once it is; `failed`
513
- * when connecting or resolving the session failed; `unavailable` when the host
514
- * has no sign-in configured. An `access: authenticated` page mounts only on
515
- * `authenticated`.
516
- */
517
- type ViewerAuthority = 'pending' | 'anonymous' | 'authenticated' | 'failed' | 'unavailable';
518
- /**
519
- * The `@user` binding: a {@link Viewer} held flat. Its named fields are the viewer's; each claim is a key holding its
520
- * JSON value, readable as `@user.<claim>`. The Rust twin of the conversion is `orbital_core_base::viewer`
521
- * (`Viewer::from_user` / `Viewer::to_user`).
522
- */
523
- type UserContext = Omit<Viewer, 'claims'> & {
524
- [key: string]: FieldValue;
525
- };
526
- /** Zod twin of the generated {@link Viewer}: the record a `.lolo` program names as `Viewer`. */
527
- declare const ViewerSchema: z.ZodType<Viewer>;
528
- /**
529
- * The identity of an unauthenticated viewer. A resolvable object rather than
530
- * `undefined` so a role predicate evaluates to a definite `false` instead of
531
- * comparing against nothing.
532
- */
533
- declare const ANONYMOUS_USER: UserContext;
534
- /** Provider-shaped identity claims, before normalization. */
535
- type RawUserClaims = {
536
- id?: string;
537
- uid?: string;
538
- email?: string | null;
539
- name?: string | null;
540
- displayName?: string | null;
541
- /** Absent or `null` when the token carries none, as the kernel's `Viewer.role` (`Option`). */
542
- role?: string | null;
543
- permissions?: string[] | null;
544
- } & {
545
- [key: string]: FieldValue;
546
- };
547
- /** Zod twin of `RawUserClaims` — the wire shape of `EventRequest.user`. */
548
- declare const RawUserClaimsSchema: z.ZodType<RawUserClaims>;
549
- /**
550
- * Normalize provider claims into a {@link UserContext}.
551
- *
552
- * Firebase (and most OIDC providers) name the subject `uid` and the display name
553
- * `displayName`, while every `.lolo` behavior reads `@user.id` / `@user.name`.
554
- * Without this normalization `@user.id` is `undefined` against a fully
555
- * authenticated request and every ownership filter silently matches no rows.
556
- * `uid` is preserved so `@user.uid` keeps working.
557
- *
558
- * Returns `undefined` for absent or subject-less claims so callers can
559
- * distinguish "no auth ran" from "anonymous"; use {@link ANONYMOUS_USER} where a
560
- * definite identity is required.
561
- */
562
- declare function normalizeUserContext(claims: RawUserClaims | null | undefined): UserContext | undefined;
563
- /**
564
- * Turn a row of an app's `[identity]` entity into a viewer.
565
- *
566
- * There is no separate persona shape: an identity row IS the persona
567
- * (`Almadar_LOLO_Identity.md` §4.3), so this only guards the one field the
568
- * behavior library requires — a non-empty string `id` — and passes every other
569
- * declared field through as a `@user.<field>` claim. Rows without a usable id
570
- * yield `undefined` rather than a persona nobody can own rows as.
571
- */
572
- declare function personaFromIdentityRow(row: Record<string, FieldValue | undefined>): UserContext | undefined;
573
- /** Look a persona up in a roster by id, or by role when no id matches. */
574
- declare function findPersonaInRoster(roster: readonly UserContext[], idOrRole: string): UserContext | undefined;
575
- /**
576
- * Resolve a persona spec — a bare id/role (`Person Id 3`, `moderator`) or a full
577
- * JSON `UserContext` — into a viewer. This is the `ALMADAR_PERSONA` contract,
578
- * shared by every host that presents an app as somebody.
579
- *
580
- * The roster is the app's OWN declared personas — the seeded rows of its
581
- * `[identity]` entity (`Almadar_LOLO_Identity.md` §4.3) — supplied by the host
582
- * that has them in hand (the runtime's live store on the interpreter path, the
583
- * schema-derived seed rows on the compiled path). There is no global roster:
584
- * an app without an `[identity]` entity resolves only JSON-form specs.
585
- *
586
- * Throws on anything unresolvable rather than returning `undefined`: "no persona"
587
- * and "persona silently ignored" look identical on screen, so a bad spec must
588
- * fail at boot instead of rendering as nobody.
589
- */
590
- declare function resolvePersonaSpec(spec: string, roster: readonly UserContext[]): UserContext;
591
-
592
363
  declare const ExternalInputSchema: z.ZodObject<{
593
364
  orbital: z.ZodString;
594
365
  trait: z.ZodString;
@@ -763,90 +534,7 @@ type EventEmit<P> = string & {
763
534
  type EventListen<P> = string & {
764
535
  readonly __listenPayload?: P;
765
536
  };
766
- /**
767
- * Identifies the origin of a bus event. Used by cross-trait listeners to
768
- * filter emits from specific orbitals, traits, transitions, or ticks.
769
- *
770
- * `transition` and `tick` are optional runtime-internal details; most
771
- * consumers only care about `orbital` and `trait`.
772
- */
773
- type BusEventSource = {
774
- orbital?: string;
775
- /** V4 dual-carry id sibling of `orbital` — stable across an orbital rename. */
776
- orbitalId?: OrbitalId;
777
- trait?: string;
778
- /** V4 dual-carry id sibling of `trait` — stable across a trait rename. */
779
- traitId?: TraitId;
780
- /** V4 dual-carry id of the emitted event — stable across an event rename. */
781
- eventId?: EventId;
782
- transition?: string;
783
- tick?: string;
784
- /**
785
- * True when the orbital bridge re-broadcasts an event onto the bus
786
- * (any source — both echoes of the dispatched event and server-side
787
- * cascade emits via `(emit X)` / `fetch.emit.success`). Cross-trait
788
- * listeners filter on this flag so the click-time qualified emit
789
- * (which has no `fromBridge`) doesn't double-fire alongside the
790
- * post-server bridge confirmation. See `dispatched` for the narrower
791
- * "echo of the just-dispatched event" signal.
792
- */
793
- fromBridge?: boolean;
794
- /**
795
- * True ONLY for bridge echoes the receiving tab already processed, so
796
- * the originating trait's self-subscription skips them instead of
797
- * re-dispatching its own echo (infinite loop / double execution).
798
- * Set by path 1 of useOrbitalBridge (compiled shell — echo of the
799
- * just-dispatched event; server-side cascade emits there carry
800
- * `fromBridge: true` but NOT `dispatched`, so they still reach the
801
- * source trait's transition handler, e.g. `loading -> browsing` on a
802
- * fetch's `emit.success`) and by ServerBridge (runtime path — stamped
803
- * on exactly one response-cascade echo per event the dispatch delivered
804
- * locally on the bare key, `stampLocallyDeliveredEchoes`; server-only
805
- * results stay unstamped). Cross-trait `listens` never filter on this
806
- * flag, so their delivery is unaffected. Push-leg events from OTHER
807
- * tabs (multiplayer) are never stamped.
808
- */
809
- dispatched?: boolean;
810
- /**
811
- * The client that originated the dispatch whose effects emitted this
812
- * event (from `EventRequest.clientId`); absent for headless
813
- * dispatches (ticks, circuit-router probes, walkers). The server-side
814
- * listens fan-out skips client-originated cascade emits — under dual
815
- * execution the originating client relays every cascade hop through the
816
- * bridge itself, so the server dispatching the same hop double-ran it
817
- * (one Send persisted two rows). Headless topology keeps the fan-out:
818
- * there is no client to drive the circuit.
819
- */
820
- originClientId?: string;
821
- /**
822
- * Per-activation key a UI control stamps on the event it emits, so it can
823
- * show its own busy state for exactly as long as the dispatches that event
824
- * started are in flight (`@almadar/ui` lib/pendingDispatch). Never set by
825
- * the bridge or the server.
826
- */
827
- pendingKey?: string;
828
- /**
829
- * Set by a server-role kernel on a `persist` effect's `emit.success` envelope: the one emit a live-push
830
- * host (`setLiveBroadcastSink`) also fans out to every other connected client.
831
- */
832
- persistSuccess?: boolean;
833
- /**
834
- * The row of the emitting trait's entity that made the emit, when the trait's rows are addressed by a `per`
835
- * listener. A listener with a `per` clause evaluates its own key; one without ignores this.
836
- */
837
- instanceKey?: string;
838
- };
839
- /** The delivery a transition is processing: `@event`, and one element of `@prevEvents` (Runtime Spec Clause 5.5). */
840
- type DeliveryRecord = {
841
- event: string;
842
- payload?: EventPayload;
843
- source: BusEventSource;
844
- };
845
- /** A trait's log so far in a dispatch that began elsewhere (`@prevEvents` / `@prevStates`), carried on the request. */
846
- type DispatchLog = {
847
- prevEvents: DeliveryRecord[];
848
- prevStates: string[];
849
- };
537
+
850
538
  /** Zod twin of `BusEventSource`. */
851
539
  declare const BusEventSourceSchema: z.ZodType<BusEventSource, object>;
852
540
  /** Zod twin of `DeliveryRecord`. */
@@ -874,18 +562,7 @@ type BusEvent = {
874
562
  type BusEventListener = (event: BusEvent) => void;
875
563
  /** Returned by `on()` / `once()` to detach a listener. */
876
564
  type Unsubscribe = () => void;
877
- /**
878
- * One event a transition's effects emitted, carried back to the client to
879
- * re-dispatch (in order) so the state machine advances through the
880
- * cascade without server-side recursion. Named/shaped to match the
881
- * generated compiled-path `EmittedEvent` (orbital-shell-typescript's
882
- * `shared/types.ts`) so the two execution paths agree on one shape.
883
- */
884
- type EmittedEvent = {
885
- event: string;
886
- payload?: EventPayload;
887
- source?: BusEventSource;
888
- };
565
+
889
566
  /** Zod twin of `EmittedEvent`. Third type param `object`, see `BusEventSourceSchema`. */
890
567
  declare const EmittedEventSchema: z.ZodType<EmittedEvent, object>;
891
568
  /**
@@ -914,7 +591,8 @@ type ClientNavigateBackTuple = ['navigate-back'];
914
591
  /** A `runsOn: client` host-port effect (`auth/sign-out`, `audio/*`) the client host answers; its arguments are resolved. */
915
592
  type ClientHostAskTuple = ['host-ask', string, JsonValue[]] | ['host-ask', string, JsonValue[], HostAskCompletion];
916
593
 
917
- type ClientEffectTuple = ClientRenderUITuple | ClientNavigateTuple | ClientNavigateBackTuple | ClientHostAskTuple;
594
+ /** The effect tuple shipped in `EventResponse.clientEffectsByTrait`: the generated kernel wire `ClientEffect`, one copy. */
595
+ type ClientEffectTuple = ClientEffect;
918
596
  /** Zod twin of `ClientRenderUITuple`. */
919
597
  declare const ClientRenderUITupleSchema: z.ZodTuple<[z.ZodLiteral<"render-ui">, z.ZodString, z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>], null>;
920
598
  /** Zod twin of `ClientNavigateTuple` — one variant per fixed arity (2/3/4), unioned. */
@@ -951,11 +629,7 @@ declare function normalizeEventKey(eventKey: string): string;
951
629
  /** The event a tick firing carries on the wire (`EventRequest.event` of a `runTick` leg). */
952
630
  declare function tickEventKey(tickName: string): string;
953
631
  type LifecycleEvent = (typeof LIFECYCLE_EVENTS)[number];
954
- /** One trait of a mount batch and the lifecycle event it runs. */
955
- type MountSeed = {
956
- trait: string;
957
- event: LifecycleEvent;
958
- };
632
+
959
633
  declare const MountSeedSchema: z.ZodObject<{
960
634
  trait: z.ZodString;
961
635
  event: z.ZodEnum<{
@@ -1002,7 +676,7 @@ declare const EventStreamItemSchema: z.ZodUnion<readonly [z.ZodObject<{
1002
676
  timestamp: z.ZodNumber;
1003
677
  }, z.core.$strip>, z.ZodObject<{
1004
678
  type: z.ZodLiteral<"effect">;
1005
- data: z.ZodType<ClientEffectTuple, unknown, z.core.$ZodTypeInternals<ClientEffectTuple, unknown>>;
679
+ data: z.ZodType<ClientEffect, unknown, z.core.$ZodTypeInternals<ClientEffect, unknown>>;
1006
680
  timestamp: z.ZodNumber;
1007
681
  }, z.core.$strip>, z.ZodObject<{
1008
682
  type: z.ZodLiteral<"complete">;
@@ -1049,10 +723,11 @@ interface ServiceHostPorts {
1049
723
  * A `program/dispatch` event request (owner, 2026-10-21): dispatch `request` on `orbital` as the HTTP events
1050
724
  * route does (`input: true` admits only a declared external input, as the inputs route). `request` is what the kernel
1051
725
  * parsed (`EventRequest::from_dispatch`); its `user` is the dispatch's viewer when the call names one.
726
+ * `wire` answers a browser: the response is the kernel's client view (EXEC-DIST-8).
1052
727
  * A host that does not serve event requests leaves it out.
1053
728
  */
1054
729
  supportsDispatchStream?: true;
1055
- dispatchRequest?(orbital: string, request: EventRequest, input: boolean, stream?: boolean): Promise<DispatchRequestOutcome>;
730
+ dispatchRequest?(orbital: string, request: EventRequest, input: boolean, stream?: boolean, wire?: boolean): Promise<DispatchRequestOutcome>;
1056
731
  /** A `program/dispatch { inbound }` delivery through the inbound route, credential check and answer path. */
1057
732
  deliverInbound?(name: string, delivery: {
1058
733
  headers: Readonly<Record<string, string>>;
@@ -1110,5 +785,5 @@ interface LiveBroadcastItem {
1110
785
  /** Zod twin of `LiveBroadcastItem`. Third type param `object`, see `BusEventSourceSchema`. */
1111
786
  declare const LiveBroadcastItemSchema: z.ZodType<LiveBroadcastItem, object>;
1112
787
 
1113
- export { PayloadJsonSchemaSchema as $, ANONYMOUS_USER as A, InboundFoundSchema as G, HostAskCompletionSchema as H, InboundOnlySchema as J, InboundRouteSchema as M, LIFECYCLE_EVENTS as N, LiveBroadcastItemSchema as Q, MountSeedSchema as S, NameListSchema as T, OptionalNameSchema as W, OrbitalRegisterResponseSchema as Y, PayloadIssueSchema as _, ROW_SET_MARKER as a3, RawUserClaimsSchema as a5, UNMOUNT_EVENT as aA, ViewerSchema as aD, createLazyService as aF, createTypedEventBus as aG, findPersonaInRoster as aH, isRowSetMarker as aI, normalizeEventKey as aJ, normalizeUserContext as aK, personaFromIdentityRow as aL, resolvePersonaSpec as aM, rowSetMarker as aN, tickEventKey as aO, RowSetRefSchema as aj, ServerTopologySchema as ar, BusEventSourceSchema as d, ClientEffectTupleSchema as e, ClientHostAskTupleSchema as g, ClientNavigateBackTupleSchema as i, ClientNavigateTupleSchema as k, ClientRenderUITupleSchema as m, DeliveryRecordSchema as n, DispatchLogSchema as p, EmittedEventSchema as r, EventStreamItemSchema as v, ExternalInputSchema as y, InboundAnswerSchema as z };
1114
- export type { BusEvent as B, ClientEffectTuple as C, DeliveryRecord as D, EventStreamItem as E, InboundDelivery as F, InboundAnswer as I, InboundRoute as K, LiveBroadcastItem as L, LazyService as O, LifecycleEvent as P, MountSeed as R, UserContext as U, OperatorValueKinds as V, OrbitalRegisterResponse as X, PayloadIssue as Z, EmittedEvent as a, PersistActionName as a0, PersistenceAdapter as a1, QueryCapabilities as a2, RawUserClaims as a4, RowCommit as a6, RowCommitWrite as a7, RowCompareOp as a8, RowIdPage as a9, Unsubscribe as aB, ViewerAuthority as aC, WriteCapabilities as aE, RowOperator as aa, RowOrder as ab, RowPage as ac, RowPageRequest as ad, RowPredicate as ae, RowQuery as af, RowQueryPage as ag, RowSetMarker as ah, RowSetRef as ai, RowTotalMode as ak, RowValueKind as al, RowWriteBatch as am, RowWriteFailureMode as an, RowWriteOp as ao, RowWriteOutcome as ap, ServerTopology as aq, ServiceAction as as, ServiceActionName as at, ServiceContract as au, ServiceEvents as av, ServiceHostPorts as aw, StoreContract as ax, StoreFilter as ay, StoreFilterOp as az, BusEventListener as b, BusEventSource as c, ClientHostAskTuple as f, ClientNavigateBackTuple as h, ClientNavigateTuple as j, ClientRenderUITuple as l, DispatchLog as o, DispatchRequestOutcome as q, EventEmit as s, EventKey as t, EventListen as u, ExternalInput as w, ExternalInputRequest as x };
788
+ export { ANONYMOUS_USER as A, DeliveryRecordSchema as D, InboundRouteSchema as F, LIFECYCLE_EVENTS as G, HostAskCompletionSchema as H, LiveBroadcastItemSchema as M, MountSeedSchema as N, NameListSchema as O, OptionalNameSchema as P, OrbitalRegisterResponseSchema as R, PayloadIssueSchema as T, PayloadJsonSchemaSchema as V, RawUserClaimsSchema as Z, ServerTopologySchema as a3, UNMOUNT_EVENT as ac, ViewerSchema as af, createLazyService as ag, createTypedEventBus as ah, findPersonaInRoster as ai, normalizeEventKey as aj, normalizeUserContext as ak, personaFromIdentityRow as al, resolvePersonaSpec as am, tickEventKey as an, BusEventSourceSchema as b, ClientEffectTupleSchema as c, ClientHostAskTupleSchema as e, ClientNavigateBackTupleSchema as g, ClientNavigateTupleSchema as i, ClientRenderUITupleSchema as k, DispatchLogSchema as l, EmittedEventSchema as n, EventStreamItemSchema as r, ExternalInputSchema as u, InboundAnswerSchema as v, InboundFoundSchema as x, InboundOnlySchema as y };
789
+ export type { RowPage as $, BusEvent as B, ClientEffectTuple as C, EventStreamItem as E, InboundAnswer as I, LazyService as J, LifecycleEvent as K, LiveBroadcastItem as L, OrbitalRegisterResponse as Q, PayloadIssue as S, UserContext as U, PersistActionName as W, PersistenceAdapter as X, RawUserClaims as Y, RowCommit as _, BusEventListener as a, RowPageRequest as a0, RowQueryPage as a1, ServerTopology as a2, ServiceAction as a4, ServiceActionName as a5, ServiceContract as a6, ServiceEvents as a7, ServiceHostPorts as a8, StoreContract as a9, StoreFilter as aa, StoreFilterOp as ab, Unsubscribe as ad, ViewerAuthority as ae, ClientHostAskTuple as d, ClientNavigateBackTuple as f, ClientNavigateTuple as h, ClientRenderUITuple as j, DispatchRequestOutcome as m, EventEmit as o, EventKey as p, EventListen as q, ExternalInput as s, ExternalInputRequest as t, InboundDelivery as w, InboundRoute as z };
@@ -4,5 +4,3 @@ function setOwn(target, key, value) {
4
4
  }
5
5
 
6
6
  export { setOwn };
7
- //# sourceMappingURL=chunk-B4MNHGBP.js.map
8
- //# sourceMappingURL=chunk-B4MNHGBP.js.map