@almadar/core 10.56.0 → 10.58.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.
@@ -1117,6 +1117,9 @@ type EntityFieldBase = {
1117
1117
  name?: string;
1118
1118
  /** Whether the field is required */
1119
1119
  required?: boolean;
1120
+ /** Primary-key marker. Mirrors Rust's `FieldDefinition.primary_key`
1121
+ * (serde `primaryKey`). */
1122
+ primaryKey?: boolean;
1120
1123
  /** Default value — parsed from `.orb`, always JSON-shaped. */
1121
1124
  default?: JsonValue;
1122
1125
  /** Minimum value (for number) or length (for string) */
@@ -2427,7 +2430,7 @@ type EntityData = Record<string, EntityRow[]>;
2427
2430
  *
2428
2431
  * DO NOT EDIT MANUALLY — regenerated by almadar-pattern-sync `patterns` command.
2429
2432
  *
2430
- * Generated: 2026-08-05T01:21:57.577Z
2433
+ * Generated: 2026-08-16T04:34:48.543Z
2431
2434
  * Pattern count: 269
2432
2435
  */
2433
2436
 
@@ -4035,6 +4038,7 @@ interface PatternPropsMap {
4035
4038
  className?: string | SExpr;
4036
4039
  showLabels?: boolean | string | SExpr;
4037
4040
  zoomToFit?: boolean | string | SExpr;
4041
+ layout?: string | SExpr;
4038
4042
  };
4039
4043
  'grid': {
4040
4044
  type: 'grid';
@@ -5977,12 +5981,35 @@ type CallServiceConfig = {
5977
5981
  * lets the TS effect type express it.
5978
5982
  */
5979
5983
  type RenderBinding = `@${string}`;
5984
+ /**
5985
+ * A binding reference resolving to a {@link UISlot} at inline time — a trait
5986
+ * `config` knob holding the slot name, e.g. `"@config.reviewSlot"`. Mirrors
5987
+ * {@link RenderBinding} for the SLOT position: the compiler's inline phase
5988
+ * substitutes the config value before anything renders, and the Rust
5989
+ * validator accepts the pre-substitution form (worked example:
5990
+ * `std-approval-gate`'s review queue renders into `@config.reviewSlot`).
5991
+ * This variant lets the TS effect type express the template-layer form.
5992
+ */
5993
+ type SlotBinding = `@config.${string}`;
5994
+ /**
5995
+ * Template-layer pattern node: a render tree whose discriminant and/or props
5996
+ * are still bindings (`type: '@config.viewPattern'`, `title: '@config.title'`)
5997
+ * or loose nested descriptors the compiler's inline phase resolves. The
5998
+ * resolved layer is {@link AnyPatternConfig}; this variant lets generated
5999
+ * behavior descriptors (std-ts) carry the pre-substitution form the Rust
6000
+ * validator accepts (worked example: `std-graphs` renders
6001
+ * `{ type: '@config.viewPattern', chartType: '@config.chartType', … }`).
6002
+ */
6003
+ type TemplatePatternConfig = {
6004
+ type: PatternType | RenderBinding;
6005
+ } & Record<string, JsonValue>;
5980
6006
  /**
5981
6007
  * Render UI effect - displays a pattern in a UI slot.
5982
6008
  * @example ['render-ui', 'main', { patternType: 'entity-table', columns: ['name'] }]
5983
6009
  * @example ['render-ui', 'main', '@config.bodyContent'] // a {@link RenderBinding} target
6010
+ * @example ['render-ui', '@config.reviewSlot', { patternType: 'entity-table' }] // a {@link SlotBinding} slot
5984
6011
  */
5985
- type RenderUIEffect = ['render-ui', UISlot, AnyPatternConfig] | ['render-ui', UISlot, AnyPatternConfig, ResolvedPatternProps] | ['render-ui', UISlot, RenderBinding] | ['render-ui', UISlot, null];
6012
+ type RenderUIEffect = ['render-ui', UISlot | SlotBinding, AnyPatternConfig] | ['render-ui', UISlot | SlotBinding, AnyPatternConfig, ResolvedPatternProps] | ['render-ui', UISlot | SlotBinding, TemplatePatternConfig] | ['render-ui', UISlot | SlotBinding, RenderBinding] | ['render-ui', UISlot | SlotBinding, null];
5986
6013
  /**
5987
6014
  * Lambda expression for per-item rendering in data-grid/data-list.
5988
6015
  * The compiler generates: {(paramName: Record<string, unknown>) => (<>JSX</>)}
@@ -6007,7 +6034,7 @@ type RenderChildrenMap = ['array/map', SExpr, RenderItemLambda];
6007
6034
  * @example ['navigate', '/tasks'] or ['navigate', '/tasks/:id', { id: '123' }]
6008
6035
  * @example ['navigate', 'https://example.com']
6009
6036
  */
6010
- type NavigateEffect = ['navigate', string | SExpr] | ['navigate', string | SExpr, Record<string, string>];
6037
+ type NavigateEffect = ['navigate', string | SExpr] | ['navigate', string | SExpr, Record<string, string | SExpr>];
6011
6038
  /**
6012
6039
  * Emit effect - emits an event, optionally with payload.
6013
6040
  * @example ['emit', 'SAVE'] or ['emit', 'PLAYER_DIED', { playerId: '@entity.id' }]
@@ -6087,7 +6114,10 @@ type PersistEmitConfig = {
6087
6114
  * runtime, binding strings and expressions resolve to `EntityRow` values
6088
6115
  * before the persist op runs — both paths evaluate the expression first.
6089
6116
  */
6090
- type PersistData = EntityRow | string | SExpr[];
6117
+ type PersistRowInput = {
6118
+ id?: string | SExpr;
6119
+ } & Record<string, FieldValue | SExpr | undefined>;
6120
+ type PersistData = EntityRow | PersistRowInput | string | SExpr[];
6091
6121
  /**
6092
6122
  * Persist effect - creates, updates, deletes, or clears entities.
6093
6123
  *
@@ -6136,8 +6166,8 @@ type DespawnEffect = ['despawn', string];
6136
6166
  type DoEffect = ['do', ...SExpr[]];
6137
6167
  /**
6138
6168
  * Notify effect - sends a notification.
6139
- * @example ['notify', 'in_app', 'Task created successfully']
6140
- * @example ['notify', 'in_app', ['str/concat', 'Item: ', '@entity.name']]
6169
+ * @example ['notify', 'in-app', 'Task created successfully']
6170
+ * @example ['notify', 'in-app', ['str/concat', 'Item: ', '@entity.name']]
6141
6171
  */
6142
6172
  type NotifyEffect = ['notify', string, string | SExpr] | ['notify', string, string | SExpr, string];
6143
6173
  /**
@@ -6151,10 +6181,12 @@ type FetchOptions = {
6151
6181
  id?: string;
6152
6182
  /** Filter expression (S-expression) */
6153
6183
  filter?: SExpr;
6154
- /** Maximum number of entities to return */
6155
- limit?: number;
6156
- /** Number of entities to skip */
6157
- offset?: number;
6184
+ /** Maximum number of entities to return. The template layer may carry a
6185
+ * binding (`'@config.pageSize'`) or a computed S-expression — the
6186
+ * compiler's inline phase resolves it to a number. */
6187
+ limit?: number | RenderBinding | SExpr[];
6188
+ /** Number of entities to skip — same template-layer forms as `limit`. */
6189
+ offset?: number | RenderBinding | SExpr[];
6158
6190
  /** Relations to populate (entity field names) */
6159
6191
  include?: string[];
6160
6192
  /** Lifecycle events to emit on resolve / reject */
@@ -6570,10 +6602,10 @@ declare function despawn(entityId: string): DespawnEffect;
6570
6602
  declare function doEffects(...effects: SExpr[]): DoEffect;
6571
6603
  /**
6572
6604
  * Create a notify effect
6573
- * @example ["notify", "in_app", "Task created successfully"]
6605
+ * @example ["notify", "in-app", "Task created successfully"]
6574
6606
  */
6575
- declare function notify(channel: 'email' | 'push' | 'sms' | 'in_app', message: string): NotifyEffect;
6576
- declare function notify(channel: 'email' | 'push' | 'sms' | 'in_app', message: string, recipient: string): NotifyEffect;
6607
+ declare function notify(channel: 'email' | 'push' | 'sms' | 'in-app', message: string): NotifyEffect;
6608
+ declare function notify(channel: 'email' | 'push' | 'sms' | 'in-app', message: string, recipient: string): NotifyEffect;
6577
6609
  /**
6578
6610
  * Create a ref effect (reactive entity subscription).
6579
6611
  *
@@ -1,4 +1,4 @@
1
- import { O as OrbitalSchema } from './schema-Nk1usPv6.js';
1
+ import { O as OrbitalSchema } from './schema-Sk_irLOY.js';
2
2
  import { S as SExpr } from './expression-Fk8bQWef.js';
3
3
 
4
4
  /**
@@ -1,7 +1,7 @@
1
- import { h as FactoryParamValue, c as FactoryConfigTier, b as FactoryConfigParam, F as FactoryCallSite, j as FactorySignature, R as RuleOverlay, p as RuleOverlayEntry, o as PresentationOverlay, T as TraitOverlay } from '../types-C4YztU2N.js';
2
- export { a as FactoryCallSiteParams, d as FactoryEntitySignature, e as FactoryEventSignature, f as FactoryExposure, g as FactoryPageSignature, i as FactoryProvenance, k as FactorySignatureCatalog, l as FactorySignatureEntityField, m as FactoryTraitSignature, J as JsonSchema, n as JsonSchemaType, O as OwnershipOverlayEntry, P as PresentationNavItem, S as SchemaFieldType, q as TraitOverlayEntry, r as TraitOverlayListener } from '../types-C4YztU2N.js';
3
- import { a as EntityPersistence, E as EntityField } from '../effect-DxD-XTI8.js';
4
- import { a as TraitReference } from '../trait-WnYkvPdZ.js';
1
+ import { h as FactoryParamValue, c as FactoryConfigTier, b as FactoryConfigParam, F as FactoryCallSite, j as FactorySignature, R as RuleOverlay, p as RuleOverlayEntry, o as PresentationOverlay, T as TraitOverlay } from '../types-D71hY_4A.js';
2
+ export { a as FactoryCallSiteParams, d as FactoryEntitySignature, e as FactoryEventSignature, f as FactoryExposure, g as FactoryPageSignature, i as FactoryProvenance, k as FactorySignatureCatalog, l as FactorySignatureEntityField, m as FactoryTraitSignature, J as JsonSchema, n as JsonSchemaType, O as OwnershipOverlayEntry, P as PresentationNavItem, S as SchemaFieldType, q as TraitOverlayEntry, r as TraitOverlayListener } from '../types-D71hY_4A.js';
3
+ import { a as EntityPersistence, E as EntityField } from '../effect-BH2k4oK6.js';
4
+ import { a as TraitReference } from '../trait-Bw4nWHu1.js';
5
5
  export { J as JsonValue } from '../expression-Fk8bQWef.js';
6
6
  import 'zod';
7
7
 
@@ -1,6 +1,6 @@
1
- import { O as OrbitalSchema, a as OrbitalDefinition } from '../schema-Nk1usPv6.js';
2
- import { h as CallSiteConfig, i as CallSiteConfigEntry, g as Trait } from '../trait-WnYkvPdZ.js';
3
- import { E as EntityField, a as EntityPersistence } from '../effect-DxD-XTI8.js';
1
+ import { O as OrbitalSchema, a as OrbitalDefinition } from '../schema-Sk_irLOY.js';
2
+ import { h as CallSiteConfig, i as CallSiteConfigEntry, g as Trait } from '../trait-Bw4nWHu1.js';
3
+ import { E as EntityField, a as EntityPersistence } from '../effect-BH2k4oK6.js';
4
4
  import { MakeTraitRefOpts } from '../builders.js';
5
5
  import '../expression-Fk8bQWef.js';
6
6
  import 'zod';
@@ -150,18 +150,39 @@ declare function rewriteEntityInInlineTrait(trait: Trait, oldName: string, newNa
150
150
  */
151
151
  declare function mergeCallSiteConfigOverrides(base: CallSiteConfig, overrides: CallSiteConfig): Record<string, CallSiteConfigEntry>;
152
152
  /**
153
- * Apply `traitOverrides.<T>.name` renames to trait DECLARATIONS only,
154
- * AFTER the schema has been stamped (V4-W4 stamp-before-rename).
153
+ * Read-only structural view over the JSON lattice the reference-rewrite
154
+ * walker traverses same trick as `derive-expectations.ts` (`SExpr` and
155
+ * `TraitConfigValue` both assign to it). Exported alongside
156
+ * `rewriteTraitRefsInTree` for the rabit composer's dedupe backstop.
157
+ */
158
+ type WalkableData = string | number | boolean | null | ReadonlyArray<WalkableData> | {
159
+ readonly [key: string]: WalkableData;
160
+ };
161
+ /**
162
+ * Deep `@trait.<from>` → `@trait.<to>` token rewrite over a JSON tree —
163
+ * config values at any depth, state-machine trees, listen/tick arms. The
164
+ * rename pass (`applyDeclarationTraitRenames`) and the rabit composer's
165
+ * inline-trait dedupe backstop share this one walker so both cover exactly
166
+ * the positions the compiled path's `rewrite_trait_embed_in_sexpr` does.
167
+ */
168
+ declare function rewriteTraitRefsInTree(node: WalkableData, renames: ReadonlyMap<string, string>): WalkableData;
169
+ /**
170
+ * Apply `traitOverrides.<T>.name` renames to trait DECLARATIONS, AFTER the
171
+ * schema has been stamped (V4-W4 stamp-before-rename).
155
172
  *
156
- * A trait rename is a pure display-name change: it renames the declaration
157
- * (`traits[].name` for inline traits, the ref object's local `name` for
158
- * reference traits) and nothing else. Every REFERENCE to the trait —
159
- * `pages[].traits[].ref`, `@trait.<canonical>` tokens in sibling config /
160
- * stateMachine effect trees is left carrying its canonical name AND its
161
- * stamped id (page ref `refId`, the referring trait's `traitEmbedIds`
162
- * side-map). Readers resolve those references by stable id onto the renamed
163
- * declaration, so no token/page-ref rewrite is needed (this replaced the
164
- * deleted `applyTraitRenames`).
173
+ * The rename moves the declaration (`traits[].name` for inline traits, the
174
+ * ref object's local `name` for reference traits), the ledger `curName` of
175
+ * each renamed declaration id, AND every name-based reference to the old
176
+ * name: `@trait.<old>` tokens in config values and state-machine/tick effect
177
+ * trees, the `traitEmbedIds` side-map keys that index those tokens, and page
178
+ * trait refs (`pages[].traits[].ref`). The dual-carry ids (`refId`,
179
+ * `traitEmbedIds` values) are untouched, so the compiled path's
180
+ * `identity_normalize` pass observes tokens already equal to the id-resolved
181
+ * current name and no-ops, while the JS runtime — which resolves `@trait.X`
182
+ * config knobs (e.g. `DashboardLayout.config.tile2Trait`) and page refs BY
183
+ * NAME — never sees a dangling reference (FIX-H, dashboard-edit-title-string
184
+ * 2026-08-06: the declaration-only rename left `@trait.DefaultRevenueChart`
185
+ * in a sibling's config and the page ref while validate stayed green).
165
186
  *
166
187
  * The keys are canonical names because stamping ran while the declaration
167
188
  * still carried its canonical name (the factory no longer renames — see
@@ -228,6 +249,20 @@ at: string): OrbitalSchema;
228
249
  * adopted row carries identity (the id) forward. No-op when they agree.
229
250
  */
230
251
  declare function healEntityLedgerRows(schema: OrbitalSchema, at: string): OrbitalSchema;
252
+ /**
253
+ * Trait-declaration sibling of `healEntityLedgerRows`. A re-instantiate with
254
+ * NO trait renames in its params (a corrective rebuild, or the plan-repair
255
+ * reset-to-factory-defaults verb) adopts the prior `.orb`'s ledger — including
256
+ * trait rename rows an earlier build recorded — while the factory re-emits
257
+ * every trait declaration at its baked/requested name, so the stale `curName`
258
+ * would manufacture an `ORB_ID_NAME_MISMATCH` (the entity twin of this is the
259
+ * battery 2026-08-06 `healEntityLedgerRows` case). Same soundness argument:
260
+ * on this path the factory re-emission is the build's truth and the adopted
261
+ * row carries identity (the id) forward. Reference-form declarations resolve
262
+ * their current name as `name ?? <ref last segment>` (mirrors the compiler's
263
+ * `collect_trait_id_names`). No-op when they agree.
264
+ */
265
+ declare function healTraitLedgerRows(schema: OrbitalSchema, at: string): OrbitalSchema;
231
266
  /**
232
267
  * The overlay. Resolves the effective entity name + collection, calls
233
268
  * `makeOrbitalWithUses` with the rewritten data, then applies the params'
@@ -251,4 +286,4 @@ declare function applyParamsToOrb(orb: OrbitalSchema, orbitalName: string, _mani
251
286
 
252
287
  declare function applyParamsToWholeOrb(orb: OrbitalSchema, manifests: readonly OrbitalParamsManifest[], params: OrbitalFactoryParams): OrbitalSchema;
253
288
 
254
- export { type EntityDeclarationRename, type OrbitalFactoryParams, type OrbitalParamsManifest, type OrbitalTraitOverride, type ParamFieldDescriptor, type ParamValidationError, type ParamValidationResult, applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, validateOrbitalFactoryParams };
289
+ export { type EntityDeclarationRename, type OrbitalFactoryParams, type OrbitalParamsManifest, type OrbitalTraitOverride, type ParamFieldDescriptor, type ParamValidationError, type ParamValidationResult, type WalkableData, applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, healTraitLedgerRows, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, rewriteTraitRefsInTree, validateOrbitalFactoryParams };
@@ -148,6 +148,7 @@ var EntityFieldSchema = z.lazy(() => {
148
148
  const baseFieldShape = {
149
149
  name: z.string().min(1, "Field name is required").optional(),
150
150
  required: z.boolean().optional(),
151
+ primaryKey: z.boolean().optional(),
151
152
  default: JsonValueSchema.optional(),
152
153
  min: z.number().optional(),
153
154
  max: z.number().optional(),
@@ -555,7 +556,10 @@ var TraitEntityFieldSchema = z.object({
555
556
  "url",
556
557
  "phone",
557
558
  "uuid",
558
- "image"
559
+ "image",
560
+ "trait",
561
+ "slot",
562
+ "pattern"
559
563
  ]),
560
564
  required: z.boolean().optional(),
561
565
  default: TraitConfigValueSchema.optional(),
@@ -665,7 +669,7 @@ var TraitEventListenerSchema = z.object({
665
669
  });
666
670
  var RequiredFieldSchema = z.object({
667
671
  name: z.string().min(1),
668
- type: z.enum(["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum", "email", "url", "phone", "uuid", "image"]),
672
+ type: z.enum(["string", "number", "boolean", "date", "array", "object", "timestamp", "datetime", "enum", "email", "url", "phone", "uuid", "image", "trait", "slot", "pattern"]),
669
673
  description: z.string().optional()
670
674
  });
671
675
  var TraitReferenceSchema = z.object({
@@ -1592,6 +1596,7 @@ function makeOrbitalWithUses(opts) {
1592
1596
  uses: opts.uses,
1593
1597
  ...opts.expects !== void 0 ? { expects: opts.expects } : {},
1594
1598
  entity: opts.entity,
1599
+ ...opts.auxiliaryEntities !== void 0 ? { auxiliaryEntities: opts.auxiliaryEntities } : {},
1595
1600
  traits: opts.traits,
1596
1601
  pages: opts.pages ?? []
1597
1602
  };
@@ -1884,22 +1889,83 @@ function mergeCallSiteConfigOverrides(base, overrides) {
1884
1889
  }
1885
1890
  return next;
1886
1891
  }
1892
+ function rewriteTraitRefToken(value, renames) {
1893
+ const prefix = "@trait.";
1894
+ if (!value.startsWith(prefix)) return value;
1895
+ const rest = value.slice(prefix.length);
1896
+ const splitAt = rest.search(/[.[]/);
1897
+ const name = splitAt === -1 ? rest : rest.slice(0, splitAt);
1898
+ const to = renames.get(name);
1899
+ if (to === void 0) return value;
1900
+ return `${prefix}${to}${splitAt === -1 ? "" : rest.slice(splitAt)}`;
1901
+ }
1902
+ function rewriteTraitRefsInTree(node, renames) {
1903
+ if (typeof node === "string") return rewriteTraitRefToken(node, renames);
1904
+ if (Array.isArray(node)) return node.map((item) => rewriteTraitRefsInTree(item, renames));
1905
+ if (node !== null && typeof node === "object") {
1906
+ const out = {};
1907
+ for (const [key, value] of Object.entries(node)) out[key] = rewriteTraitRefsInTree(value, renames);
1908
+ return out;
1909
+ }
1910
+ return node;
1911
+ }
1912
+ function rekeyTraitEmbedIds(embedIds, renames) {
1913
+ let out;
1914
+ for (const [token, id] of Object.entries(embedIds)) {
1915
+ const to = renames.get(token);
1916
+ if (to === void 0) continue;
1917
+ out = out ?? { ...embedIds };
1918
+ delete out[token];
1919
+ out[to] = id;
1920
+ }
1921
+ return out ?? embedIds;
1922
+ }
1887
1923
  function applyDeclarationTraitRenames(schema, renames, at) {
1888
1924
  if (renames.size === 0) return schema;
1889
1925
  const renamedTraitIds = [];
1890
1926
  const renameDeclaration = (t) => {
1891
1927
  if (typeof t !== "object" || t === null) return t;
1928
+ let next = t;
1892
1929
  const named = t;
1893
- if (typeof named.name !== "string") return t;
1894
- const renamed = renames.get(named.name);
1895
- if (renamed === void 0) return t;
1896
- const id = t.id;
1897
- if (typeof id === "string") renamedTraitIds.push({ id, to: renamed });
1898
- return { ...t, name: renamed };
1930
+ if (typeof named.name === "string") {
1931
+ const renamed = renames.get(named.name);
1932
+ if (renamed !== void 0) {
1933
+ const id = t.id;
1934
+ if (typeof id === "string") renamedTraitIds.push({ id, to: renamed });
1935
+ next = { ...next, name: renamed };
1936
+ }
1937
+ }
1938
+ const walked = rewriteTraitRefsInTree(next, renames);
1939
+ const embedIds = walked.traitEmbedIds;
1940
+ if (embedIds !== void 0) {
1941
+ const rekeyed = rekeyTraitEmbedIds(embedIds, renames);
1942
+ if (rekeyed !== embedIds) {
1943
+ walked.traitEmbedIds = rekeyed;
1944
+ }
1945
+ }
1946
+ return walked;
1947
+ };
1948
+ const renamePageTraitRefs = (p) => {
1949
+ if (typeof p !== "object" || p === null) return p;
1950
+ const walked = rewriteTraitRefsInTree(p, renames);
1951
+ const traits = walked.traits;
1952
+ if (!Array.isArray(traits)) return walked;
1953
+ return {
1954
+ ...walked,
1955
+ traits: traits.map((t) => {
1956
+ if (typeof t === "string") return renames.get(t) ?? t;
1957
+ const to = renames.get(t.ref);
1958
+ return to === void 0 ? t : { ...t, ref: to };
1959
+ })
1960
+ };
1899
1961
  };
1900
1962
  const orbitals = schema.orbitals.map((orbital) => {
1901
1963
  if (!("traits" in orbital) || !Array.isArray(orbital.traits)) return orbital;
1902
- return { ...orbital, traits: orbital.traits.map(renameDeclaration) };
1964
+ return {
1965
+ ...orbital,
1966
+ traits: orbital.traits.map(renameDeclaration),
1967
+ ...orbital.pages !== void 0 ? { pages: orbital.pages.map(renamePageTraitRefs) } : {}
1968
+ };
1903
1969
  });
1904
1970
  let ledger = schema.ledger;
1905
1971
  if (ledger !== void 0) {
@@ -1956,6 +2022,24 @@ function healEntityLedgerRows(schema, at) {
1956
2022
  }
1957
2023
  return ledger !== schema.ledger ? { ...schema, ledger } : schema;
1958
2024
  }
2025
+ function healTraitLedgerRows(schema, at) {
2026
+ let ledger = schema.ledger;
2027
+ if (ledger === void 0) return schema;
2028
+ for (const orbital of schema.orbitals) {
2029
+ for (const trait of orbital.traits ?? []) {
2030
+ if (typeof trait !== "object" || trait === null) continue;
2031
+ const id = trait.id;
2032
+ if (typeof id !== "string") continue;
2033
+ const declared = trait;
2034
+ const name = typeof declared.name === "string" ? declared.name : typeof declared.ref === "string" ? declared.ref.slice(declared.ref.lastIndexOf(".") + 1) : void 0;
2035
+ if (name === void 0) continue;
2036
+ const entry = ledger.entries[id];
2037
+ if (entry === void 0 || entry.kind !== "trait" || entry.curName === name) continue;
2038
+ ledger = ledgerRename(ledger, id, name, at);
2039
+ }
2040
+ }
2041
+ return ledger !== schema.ledger ? { ...schema, ledger } : schema;
2042
+ }
1959
2043
  function applyParamsToOrb(orb, orbitalName, _manifest, params) {
1960
2044
  const orbital = findOrbitalOrThrow(orb, orbitalName);
1961
2045
  const canonicalEntity = assertResolvedEntity(orbital.entity, orbitalName, orb.name);
@@ -2030,6 +2114,6 @@ function applyParamsToWholeOrb(orb, manifests, params) {
2030
2114
  return { ...orb, orbitals: rebuilt };
2031
2115
  }
2032
2116
 
2033
- export { applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, validateOrbitalFactoryParams };
2117
+ export { applyDeclarationEntityRename, applyDeclarationTraitRenames, applyParamsToOrb, applyParamsToWholeOrb, extractManifest, healEntityLedgerRows, healTraitLedgerRows, mergeCallSiteConfigOverrides, rebindInlineTraitEntity, rewriteEntityInInlineTrait, rewriteTraitRefsInTree, validateOrbitalFactoryParams };
2034
2118
  //# sourceMappingURL=index.js.map
2035
2119
  //# sourceMappingURL=index.js.map