@almadar/core 10.28.0 → 10.30.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.
@@ -1,5 +1,6 @@
1
- import { E as EntityField, a as EntityPersistence, R as RelationConfig } from './pattern-types-BeQXwgpZ.js';
2
- import { T as TraitEventListener, a as TraitReference } from './trait-DZkS625T.js';
1
+ import { E as EntityField, a as EntityPersistence, R as RelationConfig } from './pattern-types-CLcOXOmW.js';
2
+ import { T as TraitEventListener, a as TraitReference } from './trait-CwWjkU-1.js';
3
+ import { J as JsonValue } from './json-DOTchoRS.js';
3
4
 
4
5
  /**
5
6
  * Cross-cutting presentation knobs that don't live per orbital
@@ -68,62 +69,6 @@ interface OwnershipOverlayEntry {
68
69
  ownerField: string;
69
70
  }
70
71
 
71
- /**
72
- * JSON primitives — the universal "data crossed a boundary" type.
73
- *
74
- * Every value that arrives over the wire from an LLM (tool-call args),
75
- * from disk (workspace files), or from an HTTP body before
76
- * domain-specific validation is a `JsonValue`. Narrow with a typed
77
- * predicate (`is`-guard) at the boundary; don't widen back to `unknown`.
78
- *
79
- * `JsonObject` and `ToolArgs` are aliases for the common
80
- * `Record<string, JsonValue>` shape. `ToolArgs` is the name the
81
- * agent surface uses for LLM-emitted tool-call arguments; `JsonObject`
82
- * is the general-purpose alias. They are the same type — the alias
83
- * exists so call sites read at the right semantic level.
84
- *
85
- * Why not `Record<string, unknown>`? Two reasons. (1) `unknown` widens
86
- * back to anything, which defeats the purpose of typing the boundary.
87
- * (2) The `@almadar/eslint-plugin/no-record-string-unknown` rule blocks
88
- * the wider form — `JsonValue`-based records are the typed answer.
89
- *
90
- * @packageDocumentation
91
- */
92
- /**
93
- * Recursive JSON value union — every shape JSON can carry.
94
- */
95
- type JsonValue = string | number | boolean | null | JsonValue[] | {
96
- [key: string]: JsonValue;
97
- };
98
- /**
99
- * JSON object — keyed string→JsonValue. The wire form of arbitrary
100
- * structured data. Replaces `Record<string, unknown>` at typed
101
- * boundaries (LLM emits, file reads, HTTP bodies).
102
- */
103
- type JsonObject = {
104
- [key: string]: JsonValue;
105
- };
106
- /**
107
- * LLM tool-call arguments — same shape as `JsonObject`, named for the
108
- * agent-surface call site. Each tool's `execute(args: ToolArgs)`
109
- * receives this and narrows via an `is`-guard predicate before any
110
- * field access.
111
- */
112
- type ToolArgs = JsonObject;
113
- /**
114
- * Type guard: is the given value a JSON primitive (non-array,
115
- * non-object)? Used by walkers that decide whether to recurse.
116
- */
117
- declare function isJsonPrimitive(value: JsonValue): value is string | number | boolean | null;
118
- /**
119
- * Type guard: is the given value a JSON object (non-array, non-null)?
120
- */
121
- declare function isJsonObject(value: JsonValue): value is JsonObject;
122
- /**
123
- * Type guard: is the given value a JSON array?
124
- */
125
- declare function isJsonArray(value: JsonValue): value is JsonValue[];
126
-
127
72
  /**
128
73
  * Recursive JSON Schema. Intentionally narrow — only the keywords V2's
129
74
  * signature → schema generator emits. Custom `x-*` extensions carry
@@ -219,6 +164,14 @@ interface FactoryConfigParam {
219
164
  /** Key name as advertised by the trait. Matches the override path
220
165
  * `traitOverrides.<traitName>.config.<key>`. */
221
166
  key: string;
167
+ /** True when the atom's own state machine consumes this config value in
168
+ * an entity position (`['persist', op, '@config.<key>', …]` or
169
+ * `['fetch', '@config.<key>', …]`) — the value IS an entity name.
170
+ * Source-derived at signature extraction, never authored. Consumers
171
+ * threading a `params.entityName` rename must rewrite every
172
+ * entityRef-marked value equal to the renamed entity, or the baked
173
+ * default dangles against an entity that no longer exists. */
174
+ entityRef?: boolean;
222
175
  /** Type tag lifted from the `.lolo` config declaration. Drives the
223
176
  * question widget selection. Free-form to admit array/object
224
177
  * brackets (`[object]`, `[string]`) and atom-defined custom tags. */
@@ -305,6 +258,19 @@ interface FactoryTraitSignature {
305
258
  emittedEvents: ReadonlyArray<string>;
306
259
  /** Event keys this trait listens for. */
307
260
  listenedEvents: ReadonlyArray<string>;
261
+ /** Event keys the trait's own state machine transitions on
262
+ * (`stateMachine.transitions[].event`, post-rename) — the only valid
263
+ * `listens[].triggers` targets (ORB_X_LISTEN_TRIGGER_UNMATCHED
264
+ * otherwise). Present when the source trait carries a state machine
265
+ * (directly or inherited from its upstream atom); an EMPTY array means
266
+ * the trait is render-only and cannot accept a listens entry at all.
267
+ * Absent = topology unknown (legacy catalogs). */
268
+ transitionEvents?: ReadonlyArray<string>;
269
+ /** Call-site `events` rename map (old → new) authored on the trait ref.
270
+ * Renames rewrite the upstream atom's transition triggers, so catalog
271
+ * inheritance projects the atom's `transitionEvents` through this map
272
+ * before stamping them on the call site. */
273
+ eventRenames?: Readonly<Record<string, string>>;
308
274
  /** Structured emit + listen events with their `@description`/`@synonyms`/`@tier`
309
275
  * annotations. Parallel to `emittedEvents`/`listenedEvents` (kept as bare-key
310
276
  * back-compat); the curation event matcher reads this. */
@@ -437,6 +403,28 @@ interface FactorySignature {
437
403
  * (`computeSubstrateSignature`); recomputed every generation run.
438
404
  */
439
405
  substrateSignature?: string;
406
+ /**
407
+ * Organism-only dispatch smoke test. Stamped by pattern-sync gen-ts;
408
+ * `true` when the organism's factory dispatch with default params
409
+ * round-trips `orb resolve` clean. `false` = not factory ready (excluded
410
+ * from HIT retrieval; stays compose-palette if palette-exposed).
411
+ * Undefined = not yet swept (legacy catalogs).
412
+ */
413
+ factoryReady?: boolean;
414
+ /** Resolve/validate error strings when `factoryReady` is `false`. */
415
+ readinessErrors?: ReadonlyArray<string>;
416
+ /**
417
+ * Tier-agnostic (atoms/molecules/organisms alike). Stamped by
418
+ * pattern-sync gen-ts for every behavior entry: `true` when the
419
+ * registry `.orb` passes `orb validate` + `orb resolve` at bake time.
420
+ * `false` = source-broken (excluded from retrieval regardless of tier).
421
+ * Undefined = not yet swept (legacy catalogs). Distinct from
422
+ * `factoryReady`, which additionally requires an organism-level
423
+ * dispatch smoke test.
424
+ */
425
+ sourceValid?: boolean;
426
+ /** `orb validate`/`orb resolve` error strings when `sourceValid` is `false`. */
427
+ sourceErrors?: ReadonlyArray<string>;
440
428
  }
441
429
  /**
442
430
  * Aggregate catalog written to
@@ -500,4 +488,4 @@ type FactoryParamValue = string | number | boolean | ReadonlyArray<FactoryParamV
500
488
  readonly [key: string]: FactoryParamValue;
501
489
  };
502
490
 
503
- export { type FactoryCallSite as F, type JsonValue as J, type OwnershipOverlayEntry as O, type PresentationNavItem as P, type RuleOverlay as R, type SchemaFieldType as S, type ToolArgs as T, type FactoryCallSiteParams as a, type FactoryConfigParam as b, type FactoryConfigTier as c, type FactoryEntitySignature as d, type FactoryEventSignature as e, type FactoryExposure as f, type FactoryPageSignature as g, type FactoryParamValue as h, type FactoryProvenance as i, type FactorySignature as j, type FactorySignatureCatalog as k, type FactorySignatureEntityField as l, type FactoryTraitSignature as m, type JsonObject as n, type JsonSchema as o, type JsonSchemaType as p, type PresentationOverlay as q, type RuleOverlayEntry as r, type TraitOverlay as s, type TraitOverlayEntry as t, type TraitOverlayListener as u, isJsonArray as v, isJsonObject as w, isJsonPrimitive as x };
491
+ export type { FactoryCallSite as F, JsonSchema as J, OwnershipOverlayEntry as O, PresentationNavItem as P, RuleOverlay as R, SchemaFieldType as S, TraitOverlay as T, FactoryCallSiteParams as a, FactoryConfigParam as b, FactoryConfigTier as c, FactoryEntitySignature as d, FactoryEventSignature as e, FactoryExposure as f, FactoryPageSignature as g, FactoryParamValue as h, FactoryProvenance as i, FactorySignature as j, FactorySignatureCatalog as k, FactorySignatureEntityField as l, FactoryTraitSignature as m, JsonSchemaType as n, PresentationOverlay as o, RuleOverlayEntry as p, TraitOverlayEntry as q, TraitOverlayListener as r };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/core",
3
- "version": "10.28.0",
3
+ "version": "10.30.0",
4
4
  "description": "Core schema types and definitions for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -98,6 +98,12 @@ export const BINDING_DOCS = {
98
98
  examples: ['@user.id', '@user.role'],
99
99
  requiresPath: true,
100
100
  },
101
+ callsitePayload: {
102
+ description:
103
+ 'Call-site-captured event payload — emitted by the compiler\'s inline-trait hoisting when an extracted render block captured @payload; resolved at the composing effect by the runtime BindingResolver',
104
+ examples: ['@callsitePayload.error', '@callsitePayload.row'],
105
+ requiresPath: true,
106
+ },
101
107
  } as const;
102
108
 
103
109
  /**
@@ -110,9 +116,9 @@ export const BINDING_CONTEXT_RULES = {
110
116
  'Guards can access entity fields, event payload, current state, time, the call-site trait config (@config.X), and the authenticated user context (@user.id, @user.role) for ownership / role gates. Config access lets atoms write mode-aware guards — e.g. std-modal\'s OPEN can require @payload.row only when @config.mode equals "edit", letting create-mode legitimately fire OPEN with no row. Like effects, @config.X is substituted at molecule/organism inline time with the literal call-site value; at atom-scope validate, @config is allowed-but-unresolved.',
111
117
  },
112
118
  effect: {
113
- allowed: ['entity', 'payload', 'state', 'now', 'trait', 'config', 'user'] as const,
119
+ allowed: ['entity', 'payload', 'state', 'now', 'trait', 'config', 'user', 'callsitePayload'] as const,
114
120
  description:
115
- 'Effects can access and modify entity fields, use payload data, embed another trait\'s live frame via @trait.X inside render-ui children, read trait config values (@config.X) for atoms parameterized by their call-site, and read the authenticated user context (@user.id, @user.role). At molecule/organism inline time, @config.X is substituted with the literal value from the call-site config block; at atom-scope validate, @config is allowed-but-unresolved.',
121
+ 'Effects can access and modify entity fields, use payload data, embed another trait\'s live frame via @trait.X inside render-ui children, read trait config values (@config.X) for atoms parameterized by their call-site, and read the authenticated user context (@user.id, @user.role). At molecule/organism inline time, @config.X is substituted with the literal value from the call-site config block; at atom-scope validate, @config is allowed-but-unresolved. @callsitePayload.X is the call-site-captured event payload emitted by the compiler\'s inline-trait hoisting (a hoisted render block that captured @payload); it is resolved at the composing effect by the runtime BindingResolver.',
116
122
  },
117
123
  tick: {
118
124
  allowed: ['entity', 'state', 'now', 'config', 'user'] as const,