@almadar/core 7.26.0 → 8.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.
- package/dist/builders.d.ts +3 -2
- package/dist/{compose-behaviors-CHAMivlZ.d.ts → compose-behaviors-DsgVjsAB.d.ts} +1 -1
- package/dist/factory/index.d.ts +339 -0
- package/dist/factory/index.js +432 -0
- package/dist/factory/index.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +125 -6353
- package/dist/index.js.map +1 -1
- package/dist/{schema-BVni4uNf.d.ts → schema-Cov1FvVJ.d.ts} +3 -5719
- package/dist/trait-g5-2JR48.d.ts +5721 -0
- package/dist/types/index.d.ts +4 -2
- package/package.json +5 -5
- package/dist/domain-language/index.d.ts +0 -1474
- package/dist/domain-language/index.js +0 -7639
- package/dist/domain-language/index.js.map +0 -1
package/dist/builders.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bK as UISlot, t as Effect, bg as Trait, aC as RenderUIEffect, bs as TraitEventContract, y as Entity, bu as TraitEventListener, bj as TraitConfig, B as EntityField, H as EntityPersistence, L as EntityRow, bx as TraitRef, bz as TraitReference } from './trait-g5-2JR48.js';
|
|
2
|
+
import { aA as UseDeclaration, B as EntityRef, ab as PageRef, X as OrbitalDefinition, a3 as OrbitalSchema, aa as Page, ac as PageRefObject } from './schema-Cov1FvVJ.js';
|
|
2
3
|
import { S as SExpr } from './expression-BVRFm0sV.js';
|
|
3
|
-
export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-
|
|
4
|
+
export { C as ComposeBehaviorsInput, a as ComposeBehaviorsResult, E as EventWiringEntry, L as LayoutStrategy, b as applyEventWiring, c as composeBehaviors, d as detectLayoutStrategy } from './compose-behaviors-DsgVjsAB.js';
|
|
4
5
|
import { AnyPatternConfig } from '@almadar/patterns';
|
|
5
6
|
import 'zod';
|
|
6
7
|
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { B as EntityField, H as EntityPersistence, bz as TraitReference, bu as TraitEventListener } from '../trait-g5-2JR48.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
import '../expression-BVRFm0sV.js';
|
|
4
|
+
import '@almadar/patterns';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* OrbitalSchema field type tags. The factory-signature extractor lifts
|
|
8
|
+
* these directly from the resolved `.orb`; consumers narrow further at
|
|
9
|
+
* dispatch time.
|
|
10
|
+
*/
|
|
11
|
+
type SchemaFieldType = 'string' | 'number' | 'boolean' | 'date' | 'timestamp' | 'datetime' | 'array' | 'object' | 'enum' | 'relation';
|
|
12
|
+
interface FactorySignatureEntityField {
|
|
13
|
+
name: string;
|
|
14
|
+
type: SchemaFieldType;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The canonical entity a factory produces. Almost always one entity
|
|
19
|
+
* per orbital; modeled as an array to keep the door open for orbitals
|
|
20
|
+
* that compose multiple entities.
|
|
21
|
+
*/
|
|
22
|
+
interface FactoryEntitySignature {
|
|
23
|
+
/** Canonical entity name the factory's params build (e.g. `"ChatMessage"`). */
|
|
24
|
+
name: string;
|
|
25
|
+
/** Fields the factory emits, post-auto-field stripping. */
|
|
26
|
+
fields: ReadonlyArray<FactorySignatureEntityField>;
|
|
27
|
+
/** Persistence mode declared on the canonical entity in the `.orb`. */
|
|
28
|
+
persistence: EntityPersistence;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One trait the factory composes into the orbital. The projector reads
|
|
32
|
+
* these to determine which factory's trait stack covers a given
|
|
33
|
+
* orbital + which override knobs a presentation overlay can target.
|
|
34
|
+
*/
|
|
35
|
+
interface FactoryTraitSignature {
|
|
36
|
+
/** Canonical trait name post-rename (e.g. `"ChatMessageList"`). */
|
|
37
|
+
name: string;
|
|
38
|
+
/** Event keys this trait emits (post-rename). */
|
|
39
|
+
emittedEvents: ReadonlyArray<string>;
|
|
40
|
+
/** Event keys this trait listens for. */
|
|
41
|
+
listenedEvents: ReadonlyArray<string>;
|
|
42
|
+
/** Config keys overridable via `traitOverrides.<name>.config.<key>`. */
|
|
43
|
+
overridableConfigKeys: ReadonlyArray<string>;
|
|
44
|
+
/** Capability tags lifted directly from the source `.lolo` trait's
|
|
45
|
+
* header annotations. Free-form strings — the translator overlay
|
|
46
|
+
* matches rules to traits by exact set membership. */
|
|
47
|
+
capabilities: ReadonlyArray<string>;
|
|
48
|
+
}
|
|
49
|
+
/** One page the factory emits. The path is the factory default; the
|
|
50
|
+
* projector may override via `params.pagePaths`. */
|
|
51
|
+
interface FactoryPageSignature {
|
|
52
|
+
name: string;
|
|
53
|
+
defaultPath: string;
|
|
54
|
+
primaryEntity: string;
|
|
55
|
+
}
|
|
56
|
+
interface FactorySignature {
|
|
57
|
+
/** Organism the factory belongs to (e.g. `"std-realtime-chat"`). */
|
|
58
|
+
organism: string;
|
|
59
|
+
/** Orbital this factory builds within that organism. */
|
|
60
|
+
orbital: string;
|
|
61
|
+
/** Tier the factory sits in (informational). */
|
|
62
|
+
tier: 'atoms' | 'molecules' | 'organisms';
|
|
63
|
+
/** Path of the generated factory source (relative to the std root). */
|
|
64
|
+
factoryPath: string;
|
|
65
|
+
/** Canonical entity surface(s) the factory produces. */
|
|
66
|
+
entities: ReadonlyArray<FactoryEntitySignature>;
|
|
67
|
+
/** Trait stack the factory composes. */
|
|
68
|
+
traits: ReadonlyArray<FactoryTraitSignature>;
|
|
69
|
+
/** Pages the factory emits. */
|
|
70
|
+
pages: ReadonlyArray<FactoryPageSignature>;
|
|
71
|
+
/** Union of all `traits[].emittedEvents`. */
|
|
72
|
+
emittedEvents: ReadonlyArray<string>;
|
|
73
|
+
/** Union of all `traits[].listenedEvents`. */
|
|
74
|
+
listenedEvents: ReadonlyArray<string>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Aggregate catalog written to
|
|
78
|
+
* `packages/almadar-std/behaviors/registry/factory-signatures.json`.
|
|
79
|
+
* Sorted by organism then orbital.
|
|
80
|
+
*/
|
|
81
|
+
interface FactorySignatureCatalog {
|
|
82
|
+
/** Generated-by version stamp (the `@almadar/std` minor it shipped in). */
|
|
83
|
+
generatedFromStdVersion: string;
|
|
84
|
+
/** Sorted list of factory signatures. */
|
|
85
|
+
signatures: ReadonlyArray<FactorySignature>;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A single factory invocation, as the typed result of the translator.
|
|
89
|
+
* Lower into runtime by calling the factory at `factoryPath` with
|
|
90
|
+
* these `params`. Stable identity for downstream diffing is
|
|
91
|
+
* `(organism, orbital)`.
|
|
92
|
+
*/
|
|
93
|
+
interface FactoryCallSite {
|
|
94
|
+
organism: string;
|
|
95
|
+
orbital: string;
|
|
96
|
+
factoryPath: string;
|
|
97
|
+
params: FactoryCallSiteParams;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The typed param surface every factory's call site populates. Each
|
|
101
|
+
* field corresponds to one row in the translator's overlay → factory
|
|
102
|
+
* mapping table.
|
|
103
|
+
*/
|
|
104
|
+
interface FactoryCallSiteParams {
|
|
105
|
+
/** Override `signature.entities[0].name` (entity rename). */
|
|
106
|
+
entityName?: string;
|
|
107
|
+
/** Additional or overriding entity fields. Caller wins on collision. */
|
|
108
|
+
entityFields?: ReadonlyArray<EntityField>;
|
|
109
|
+
/** Override `signature.entities[0].persistence`. */
|
|
110
|
+
persistence?: EntityPersistence;
|
|
111
|
+
/** Override the entity's storage collection key. */
|
|
112
|
+
collection?: string;
|
|
113
|
+
/** Per-page path overrides keyed by `signature.pages[i].name`. */
|
|
114
|
+
pagePaths?: Readonly<Record<string, string>>;
|
|
115
|
+
/** Trait config overrides keyed by `signature.traits[i].name`. */
|
|
116
|
+
traitOverrides?: Readonly<Record<string, {
|
|
117
|
+
config?: Readonly<Record<string, FactoryParamValue>>;
|
|
118
|
+
}>>;
|
|
119
|
+
/** Extra traits to compose into the orbital that aren't part of the
|
|
120
|
+
* canonical signature trait stack. */
|
|
121
|
+
extraTraits?: ReadonlyArray<TraitReference>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Allowed leaf values for the typed factory-param surface.
|
|
125
|
+
*/
|
|
126
|
+
type FactoryParamValue = string | number | boolean | ReadonlyArray<FactoryParamValue> | {
|
|
127
|
+
readonly [key: string]: FactoryParamValue;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Cross-cutting presentation knobs that don't live per orbital
|
|
132
|
+
* because they're factory-layer concerns (nav items live on a layout
|
|
133
|
+
* trait; theme is a separate `ThemeRef`). The translator reads these
|
|
134
|
+
* and threads them into the matching factory params.
|
|
135
|
+
*/
|
|
136
|
+
interface PresentationOverlay {
|
|
137
|
+
/** Nav items to add to the orbital's layout trait. The translator
|
|
138
|
+
* looks for a `signature.traits[i]` with `overridableConfigKeys`
|
|
139
|
+
* including `navItems` and writes into `traitOverrides[name].config.navItems`. */
|
|
140
|
+
navAdditions?: ReadonlyArray<PresentationNavItem>;
|
|
141
|
+
/** Optional theme ref override for the orbital. */
|
|
142
|
+
themeRef?: string;
|
|
143
|
+
}
|
|
144
|
+
interface PresentationNavItem {
|
|
145
|
+
label: string;
|
|
146
|
+
path: string;
|
|
147
|
+
icon?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* LLM-authored trait-level overrides keyed by trait name (matches
|
|
151
|
+
* `signature.traits[].name`). Each entry's `config` keys are validated
|
|
152
|
+
* against `signature.traits[i].overridableConfigKeys`.
|
|
153
|
+
*/
|
|
154
|
+
type TraitOverlay = Readonly<Record<string, TraitOverlayEntry>>;
|
|
155
|
+
interface TraitOverlayEntry {
|
|
156
|
+
config?: Readonly<Record<string, FactoryParamValue>>;
|
|
157
|
+
linkedEntity?: string;
|
|
158
|
+
events?: Readonly<Record<string, string>>;
|
|
159
|
+
name?: string;
|
|
160
|
+
emitsScope?: 'internal' | 'external';
|
|
161
|
+
listens?: ReadonlyArray<TraitEventListener>;
|
|
162
|
+
}
|
|
163
|
+
type TraitOverlayListener = TraitEventListener;
|
|
164
|
+
/**
|
|
165
|
+
* Rules carry a free-form `capability: string` that the translator
|
|
166
|
+
* matches against `signature.traits[].capabilities` (source-tagged
|
|
167
|
+
* in `.lolo`).
|
|
168
|
+
*/
|
|
169
|
+
interface RuleOverlay {
|
|
170
|
+
rules: ReadonlyArray<RuleOverlayEntry>;
|
|
171
|
+
/** Entity-level ownership signal. The translator threads it into
|
|
172
|
+
* the matched trait's `config.ownerField` (when the matched trait
|
|
173
|
+
* advertises that key in `overridableConfigKeys`). */
|
|
174
|
+
ownership?: ReadonlyArray<OwnershipOverlayEntry>;
|
|
175
|
+
}
|
|
176
|
+
interface RuleOverlayEntry {
|
|
177
|
+
id: string;
|
|
178
|
+
/** Free-form capability label, matched against
|
|
179
|
+
* `signature.traits[].capabilities` by exact set membership. */
|
|
180
|
+
capability: string;
|
|
181
|
+
description: string;
|
|
182
|
+
/** Entity names this rule binds to. Empty array = cross-cutting. */
|
|
183
|
+
appliesTo: ReadonlyArray<string>;
|
|
184
|
+
/** Optional role name (e.g. `"admin"`) when the rule is role-scoped. */
|
|
185
|
+
role?: string;
|
|
186
|
+
/** Optional extra config knobs threaded into the matched trait's
|
|
187
|
+
* `config`. Validated against the trait's `overridableConfigKeys`. */
|
|
188
|
+
config?: Readonly<Record<string, FactoryParamValue>>;
|
|
189
|
+
}
|
|
190
|
+
interface OwnershipOverlayEntry {
|
|
191
|
+
/** Entity name (matches the orbital's bound entity name). */
|
|
192
|
+
entity: string;
|
|
193
|
+
/** Field name on the entity that carries the owner identifier. */
|
|
194
|
+
ownerField: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The per-orbital binding the agent assembles when it picks a
|
|
199
|
+
* signature. Carries the user-authored overrides directly; no shared
|
|
200
|
+
* domain ontology, no DomainDocument.
|
|
201
|
+
*/
|
|
202
|
+
interface TranslationBinding {
|
|
203
|
+
/** Entity name override. When equal to `signature.entities[0].name`,
|
|
204
|
+
* no rename is emitted. */
|
|
205
|
+
entityName: string;
|
|
206
|
+
/** Extra fields beyond the signature's canonical entity surface. */
|
|
207
|
+
entityFields?: ReadonlyArray<EntityField>;
|
|
208
|
+
/** Persistence override. */
|
|
209
|
+
persistence?: EntityPersistence;
|
|
210
|
+
/** Collection name override. */
|
|
211
|
+
collection?: string;
|
|
212
|
+
/** Per-page path overrides keyed by `signature.pages[i].name`. */
|
|
213
|
+
pagePaths?: Readonly<Record<string, string>>;
|
|
214
|
+
}
|
|
215
|
+
interface TranslationWarning {
|
|
216
|
+
/** Dotted path of the binding field that couldn't be lowered. */
|
|
217
|
+
field: string;
|
|
218
|
+
/** Human-readable reason. */
|
|
219
|
+
reason: string;
|
|
220
|
+
}
|
|
221
|
+
interface TranslationResult {
|
|
222
|
+
callSite: FactoryCallSite;
|
|
223
|
+
warnings: ReadonlyArray<TranslationWarning>;
|
|
224
|
+
}
|
|
225
|
+
declare function translateOverlaysToParams(binding: TranslationBinding, signature: FactorySignature, presentation?: PresentationOverlay, ruleOverlay?: RuleOverlay, traitOverlay?: TraitOverlay, catalog?: ReadonlyArray<FactorySignature>): TranslationResult;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Structural diff between two `FactoryCallSite[]` lists. Pure typed,
|
|
229
|
+
* no side effects. Used by downstream consumers (agent planner, UI
|
|
230
|
+
* cascade view) to turn a "previous calls" + "next calls" pair into a
|
|
231
|
+
* minimal change set.
|
|
232
|
+
*
|
|
233
|
+
* Identity for diffing is `(organism, orbital)`. Renames are not
|
|
234
|
+
* handled here — they show up as a delete + add. The agent layer is
|
|
235
|
+
* expected to merge those back into a `'rename'` op if it can prove
|
|
236
|
+
* the underlying domain entity was renamed.
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
type CallSiteDiff = {
|
|
240
|
+
kind: 'add';
|
|
241
|
+
orbitalName: string;
|
|
242
|
+
next: FactoryCallSite;
|
|
243
|
+
} | {
|
|
244
|
+
kind: 'delete';
|
|
245
|
+
orbitalName: string;
|
|
246
|
+
prior: FactoryCallSite;
|
|
247
|
+
} | {
|
|
248
|
+
kind: 'edit';
|
|
249
|
+
orbitalName: string;
|
|
250
|
+
prior: FactoryCallSite;
|
|
251
|
+
next: FactoryCallSite;
|
|
252
|
+
} | {
|
|
253
|
+
kind: 'keep';
|
|
254
|
+
orbitalName: string;
|
|
255
|
+
call: FactoryCallSite;
|
|
256
|
+
};
|
|
257
|
+
declare function diffFactoryCalls(prior: ReadonlyArray<FactoryCallSite>, next: ReadonlyArray<FactoryCallSite>): ReadonlyArray<CallSiteDiff>;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* One slot the agent emits per orbital. Slim shape — agent-facing,
|
|
261
|
+
* carries only what factory dispatch needs. The studio renders forms
|
|
262
|
+
* over this; the projector turns it into a `FactoryCallSite`.
|
|
263
|
+
*/
|
|
264
|
+
interface OrbitalCallInput {
|
|
265
|
+
orbitalName: string;
|
|
266
|
+
organism?: string;
|
|
267
|
+
orbital?: string;
|
|
268
|
+
entityName?: string;
|
|
269
|
+
entityFields?: ReadonlyArray<EntityField>;
|
|
270
|
+
persistence?: EntityPersistence;
|
|
271
|
+
collection?: string;
|
|
272
|
+
pagePaths?: Readonly<Record<string, string>>;
|
|
273
|
+
traitOverlay?: Readonly<Record<string, {
|
|
274
|
+
config?: Readonly<Record<string, FactoryParamValue>>;
|
|
275
|
+
linkedEntity?: string;
|
|
276
|
+
name?: string;
|
|
277
|
+
}>>;
|
|
278
|
+
extraTraits?: ReadonlyArray<TraitReference>;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Discriminated union of typed edits. Each variant carries only the
|
|
282
|
+
* payload pieces that change. The reducer is total over the union.
|
|
283
|
+
*/
|
|
284
|
+
type FactoryCallPlanMutation = {
|
|
285
|
+
kind: 'set-orbital-entity-fields';
|
|
286
|
+
orbitalName: string;
|
|
287
|
+
fields: ReadonlyArray<EntityField>;
|
|
288
|
+
} | {
|
|
289
|
+
kind: 'set-orbital-entity-name';
|
|
290
|
+
orbitalName: string;
|
|
291
|
+
name: string;
|
|
292
|
+
} | {
|
|
293
|
+
kind: 'set-orbital-persistence';
|
|
294
|
+
orbitalName: string;
|
|
295
|
+
persistence: EntityPersistence;
|
|
296
|
+
} | {
|
|
297
|
+
kind: 'set-orbital-collection';
|
|
298
|
+
orbitalName: string;
|
|
299
|
+
collection: string;
|
|
300
|
+
} | {
|
|
301
|
+
kind: 'set-orbital-page-path';
|
|
302
|
+
orbitalName: string;
|
|
303
|
+
pageName: string;
|
|
304
|
+
path: string;
|
|
305
|
+
} | {
|
|
306
|
+
kind: 'set-trait-override-config';
|
|
307
|
+
orbitalName: string;
|
|
308
|
+
traitName: string;
|
|
309
|
+
key: string;
|
|
310
|
+
value: FactoryParamValue;
|
|
311
|
+
} | {
|
|
312
|
+
kind: 'add-extra-trait';
|
|
313
|
+
orbitalName: string;
|
|
314
|
+
trait: TraitReference;
|
|
315
|
+
} | {
|
|
316
|
+
kind: 'remove-extra-trait';
|
|
317
|
+
orbitalName: string;
|
|
318
|
+
ref: string;
|
|
319
|
+
} | {
|
|
320
|
+
kind: 'set-rule';
|
|
321
|
+
rule: RuleOverlayEntry;
|
|
322
|
+
} | {
|
|
323
|
+
kind: 'remove-rule';
|
|
324
|
+
ruleId: string;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* State shape the reducer operates on. Mirrors the slice of the
|
|
328
|
+
* agent's analysis result that incremental edits target.
|
|
329
|
+
*/
|
|
330
|
+
interface FactoryCallPlanState {
|
|
331
|
+
orbitals: ReadonlyArray<OrbitalCallInput>;
|
|
332
|
+
ruleOverlay?: RuleOverlay;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Immutable reducer. Returns a new state; never mutates input.
|
|
336
|
+
*/
|
|
337
|
+
declare function applyFactoryCallPlanMutation(state: FactoryCallPlanState, m: FactoryCallPlanMutation): FactoryCallPlanState;
|
|
338
|
+
|
|
339
|
+
export { type CallSiteDiff, type FactoryCallPlanMutation, type FactoryCallPlanState, type FactoryCallSite, type FactoryCallSiteParams, type FactoryEntitySignature, type FactoryPageSignature, type FactoryParamValue, type FactorySignature, type FactorySignatureCatalog, type FactorySignatureEntityField, type FactoryTraitSignature, type OrbitalCallInput, type OwnershipOverlayEntry, type PresentationNavItem, type PresentationOverlay, type RuleOverlay, type RuleOverlayEntry, type SchemaFieldType, type TraitOverlay, type TraitOverlayEntry, type TraitOverlayListener, type TranslationBinding, type TranslationResult, type TranslationWarning, applyFactoryCallPlanMutation, diffFactoryCalls, translateOverlaysToParams };
|