@almadar/core 11.3.0 → 11.5.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/behavior-package.js +1 -3
- package/dist/{builders-DXPLnmJy.d.ts → builders-JiXD6W1T.d.ts} +2266 -98
- package/dist/builders.d.ts +5 -5
- package/dist/builders.js +8 -10
- package/dist/{bus-CRxTnebm.d.ts → bus-__zVNcsp.d.ts} +133 -438
- package/dist/{chunk-DNS4GKQV.js → chunk-27Y5AXHB.js} +71 -45
- package/dist/chunk-2WLRKYD5.js +3823 -0
- package/dist/{chunk-B4MNHGBP.js → chunk-5IRZ6ROW.js} +0 -2
- package/dist/{chunk-7NDAXM2Z.js → chunk-6XYHVJ4J.js} +1 -3
- package/dist/{chunk-RGACZEYC.js → chunk-DDBAQMWA.js} +0 -2
- package/dist/{chunk-7GHJU5WI.js → chunk-GNLND5O2.js} +0 -2
- package/dist/{chunk-M4S2B5VJ.js → chunk-IU3WGC6Q.js} +0 -2
- package/dist/{chunk-LPJ7GKRM.js → chunk-J64IR3DR.js} +17 -9
- package/dist/{chunk-PYYHDYTD.js → chunk-J64YVVB4.js} +1 -3
- package/dist/{chunk-7B4JRMRL.js → chunk-JN3MMQTB.js} +15 -7
- package/dist/{chunk-VIHQKKTZ.js → chunk-LQZXCL47.js} +66 -32
- package/dist/{chunk-6H3UIZR2.js → chunk-OQ3Y5SL3.js} +4 -6
- package/dist/{chunk-3DZOFI53.js → chunk-Q4OJQNYY.js} +5 -4
- package/dist/{chunk-347APWFM.js → chunk-R3Y7ABF4.js} +2 -4
- package/dist/{chunk-N3CK4AYW.js → chunk-VC3HXUWQ.js} +7929 -404
- package/dist/{chunk-2NKK2X53.js → chunk-VQWE3FCB.js} +1 -3
- package/dist/{chunk-VG7BRFUD.js → chunk-W3UJRSYC.js} +0 -2
- package/dist/{chunk-XBWV3DXX.js → chunk-XYHBAUWE.js} +242 -10
- package/dist/{effect-C2VKm6kk.d.ts → effect-gddySYLX.d.ts} +215 -18
- package/dist/{effect-result-BFNANDJ-.d.ts → effect-result-BvBwmspK.d.ts} +131 -43
- package/dist/{expression-DirYKz-f.d.ts → expression-DxY6ct3t.d.ts} +1 -1
- package/dist/factory/index.d.ts +3 -3
- package/dist/factory/index.js +8 -10
- package/dist/factory-runtime/index.d.ts +3 -3
- package/dist/factory-runtime/index.js +15 -17
- package/dist/fixtures.d.ts +8 -7
- package/dist/fixtures.js +6 -8
- package/dist/i18n/index.js +2 -4
- package/dist/{index-DuHpwitt.d.ts → index-h6KrpmjR.d.ts} +23 -10
- package/dist/index.d.ts +15 -17
- package/dist/index.js +23 -25
- package/dist/kernel-wire.d.ts +3 -3
- package/dist/kernel-wire.js +3 -5
- package/dist/language/constructs.json +18 -3
- package/dist/language/program-types.json +28 -1
- package/dist/language/validation-codes.json +231 -1
- package/dist/language/vocabulary.json +63 -1
- package/dist/language-data.js +3 -5
- package/dist/lolo-document/index.js +0 -2
- package/dist/patterns/component-mapping.json +11 -1
- package/dist/patterns/definitions.d.ts +2 -2
- package/dist/patterns/definitions.js +1 -3
- package/dist/patterns/event-contracts.json +1 -1
- package/dist/patterns/index.d.ts +47 -3
- package/dist/patterns/index.js +3 -5
- package/dist/patterns/patterns-registry.json +7929 -402
- package/dist/patterns/registry.json +7929 -402
- package/dist/themes/index.js +2 -4
- package/dist/{trait-Cv3HTGFL.d.ts → trait-Oun4JgeZ.d.ts} +52 -22
- package/dist/types/index.d.ts +8 -8
- package/dist/types/index.js +12 -14
- package/dist/{types-wWEqi7vj.d.ts → types-B-r7Z7Lf.d.ts} +3 -3
- package/package.json +6 -6
- package/dist/behavior-package.js.map +0 -1
- package/dist/builders.js.map +0 -1
- package/dist/chunk-2NKK2X53.js.map +0 -1
- package/dist/chunk-347APWFM.js.map +0 -1
- package/dist/chunk-3DZOFI53.js.map +0 -1
- package/dist/chunk-6H3UIZR2.js.map +0 -1
- package/dist/chunk-7B4JRMRL.js.map +0 -1
- package/dist/chunk-7GHJU5WI.js.map +0 -1
- package/dist/chunk-7NDAXM2Z.js.map +0 -1
- package/dist/chunk-B4MNHGBP.js.map +0 -1
- package/dist/chunk-DNS4GKQV.js.map +0 -1
- package/dist/chunk-LPJ7GKRM.js.map +0 -1
- package/dist/chunk-M4S2B5VJ.js.map +0 -1
- package/dist/chunk-N3CK4AYW.js.map +0 -1
- package/dist/chunk-PYYHDYTD.js.map +0 -1
- package/dist/chunk-RGACZEYC.js.map +0 -1
- package/dist/chunk-VG7BRFUD.js.map +0 -1
- package/dist/chunk-VIHQKKTZ.js.map +0 -1
- package/dist/chunk-XBWV3DXX.js.map +0 -1
- package/dist/chunk-ZDIHVDTW.js +0 -3810
- package/dist/chunk-ZDIHVDTW.js.map +0 -1
- package/dist/factory/index.js.map +0 -1
- package/dist/factory-runtime/index.js.map +0 -1
- package/dist/fixtures.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kernel-wire.js.map +0 -1
- package/dist/language-data.js.map +0 -1
- package/dist/lolo-document/index.js.map +0 -1
- package/dist/patterns/definitions.js.map +0 -1
- package/dist/patterns/index.js.map +0 -1
- package/dist/themes/index.js.map +0 -1
- package/dist/types/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/factory-runtime/extract-manifest.ts","../../src/factory-runtime/apply-params-to-orb.ts","../../src/factory-runtime/apply-params-to-whole-orb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAM,mBAAA,GAAuD;AAAA,EAC3D;AAAA,IACE,IAAA,EAAM,QAAA;AAAA,IACN,IAAA,EAAM,eAAA;AAAA,IACN,WAAA,EAAa;AAAA,GACf;AAAA,EACA;AAAA,IACE,IAAA,EAAM,UAAA;AAAA,IACN,IAAA,EAAM,QAAA;AAAA,IACN,WAAA,EAAa;AAA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AAO,CAAA;AAC7C,MAAA,OAAO,EAAE,GAAG,CAAA,EAAG,IAAA,EAAM,OAAO,QAAA,EAAS;AAAA,IACvC,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,OAAO,KAAA;AACT;;;AC/3BO,SAAS,qBAAA,CACd,GAAA,EACA,SAAA,EACA,MAAA,EACe;AACf,EAAA,MAAM,iBAAA,uBAAwB,GAAA,EAAmC;AACjE,EAAA,KAAA,MAAW,KAAK,SAAA,EAAW;AACzB,IAAA,iBAAA,CAAkB,GAAA,CAAI,CAAA,CAAE,WAAA,EAAa,CAAC,CAAA;AAAA,EACxC;AACA,EAAA,MAAM,UAA+B,EAAC;AACtC,EAAA,KAAA,MAAW,OAAA,IAAW,IAAI,QAAA,EAAU;AAClC,IAAA,MAAM,QAAA,GAAW,iBAAA,CAAkB,GAAA,CAAI,OAAA,CAAQ,IAAI,CAAA;AACnD,IAAA,IAAI,CAAC,QAAA,EAAU;AACb,MAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AACpB,MAAA;AAAA,IACF;AACA,IAAA,OAAA,CAAQ,KAAK,gBAAA,CAAiB,GAAA,EAAK,QAAQ,IAAA,EAAM,QAAA,EAAU,MAAM,CAAC,CAAA;AAAA,EACpE;AACA,EAAA,OAAO,EAAE,GAAG,GAAA,EAAK,QAAA,EAAU,OAAA,EAAQ;AACrC","file":"index.js","sourcesContent":["/**\n * `extractManifest(orb)` — derive the typed `OrbitalParamsManifest[]` from a\n * resolved `.orb`, one entry per orbital.\n *\n * Pure data → data. No I/O. No behavior-specific branching.\n *\n * @packageDocumentation\n */\n\nimport type {\n DeclaredTraitConfig,\n EntityPersistence,\n OrbitalEntity,\n OrbitalSchema,\n TraitReference,\n} from '../types/index.js';\nimport { persistenceModeAllowsOverrides } from '../types/index.js';\nimport { orbitalTouchesOwnRecord } from '../data-bearing.js';\nimport type { OrbitalParamsManifest, ParamFieldDescriptor } from './manifest-types.js';\n\nconst STATIC_PARAM_FIELDS: readonly ParamFieldDescriptor[] = [\n {\n name: 'fields',\n type: 'EntityField[]',\n description: 'Extra fields appended to the canonical entity.',\n },\n {\n name: 'pagePath',\n type: 'string',\n description: 'URL override for the orbital first page.',\n },\n {\n name: 'persistence',\n type: \"'persistent' | 'runtime'\",\n description: 'Override the canonical entity persistence mode.',\n },\n {\n name: 'entityName',\n type: 'string',\n description:\n \"Rename the canonical entity. PascalCase singular, ≤32 chars. Threads through every trait's linkedEntity binding; compiler rewrites @Entity.x refs.\",\n },\n {\n name: 'collection',\n type: 'string',\n description:\n 'Override derived collection key. Defaults to plural(entityName).toLowerCase().',\n },\n {\n name: 'traitOverrides',\n type: 'Partial<Record<TraitName, { config?, linkedEntity?, events?, name?, emitsScope?, listens? }>>',\n description:\n \".lolo's native trait-composition surface 1:1: per-imported-trait config, linkedEntity, events, name, emitsScope, listens. effects is excluded (atom-owned; use listens via a sibling trait).\",\n },\n {\n name: 'config',\n type: 'Readonly<Record<string, TraitConfigValue>>',\n description:\n \"Override this orbital's own declared config knobs (Orbital.config) by key.\",\n },\n] as const;\n\ninterface SplitTraits {\n readonly refTraitNames: readonly string[];\n readonly inlineTraitNames: readonly string[];\n}\n\nfunction entityPersistence(\n entity: OrbitalSchema['orbitals'][number]['entity'],\n): EntityPersistence | undefined {\n if (entity && typeof entity === 'object' && !('extends' in entity)) {\n return (entity as OrbitalEntity).persistence;\n }\n return undefined;\n}\n\nfunction declaredConfigKeys(config: DeclaredTraitConfig | undefined): readonly string[] | undefined {\n if (config === undefined) return undefined;\n const keys = Object.keys(config).sort();\n return keys.length > 0 ? keys : undefined;\n}\n\n/**\n * The param descriptors this orbital actually accepts — the closed L1 delta\n * allow-list, gated per orbital exactly like `persistence`/`collection`\n * (dropped when the entity's persistence mode disallows overrides): `config`\n * is dropped when the orbital declares no config knobs of its own.\n */\nexport function paramFieldsFor(\n _orb: OrbitalSchema,\n orbital: OrbitalSchema['orbitals'][number],\n): readonly ParamFieldDescriptor[] {\n const allowPersistenceOverride = persistenceModeAllowsOverrides(entityPersistence(orbital.entity), orbitalTouchesOwnRecord(orbital));\n const hasConfig = declaredConfigKeys(orbital.config) !== undefined;\n return STATIC_PARAM_FIELDS.filter((f) => {\n if ((f.name === 'persistence' || f.name === 'collection') && !allowPersistenceOverride) {\n return false;\n }\n if (f.name === 'config' && !hasConfig) return false;\n return true;\n });\n}\n\nfunction splitTraits(traits: OrbitalSchema['orbitals'][number]['traits']): SplitTraits {\n const refTraitNames: string[] = [];\n const inlineTraitNames: string[] = [];\n for (const t of traits) {\n if (!t || typeof t !== 'object') continue;\n const tName = typeof (t as TraitReference).name === 'string'\n ? (t as TraitReference).name\n : null;\n if (!tName) continue;\n if (typeof (t as TraitReference).ref === 'string') {\n refTraitNames.push(tName);\n } else {\n inlineTraitNames.push(tName);\n }\n }\n return { refTraitNames, inlineTraitNames };\n}\n\nexport function extractManifest(orb: OrbitalSchema): readonly OrbitalParamsManifest[] {\n const behaviorName = orb.name;\n return orb.orbitals.map((orbital) => {\n const { refTraitNames, inlineTraitNames } = splitTraits(orbital.traits);\n const configKeys = declaredConfigKeys(orbital.config);\n return {\n organism: behaviorName,\n orbitalName: orbital.name,\n paramFields: paramFieldsFor(orb, orbital),\n traitNames: refTraitNames,\n inlineTraitNames,\n ...(configKeys !== undefined ? { configKeys } : {}),\n };\n });\n}\n","/**\n * `applyParamsToOrb` — pure runtime overlay function. Equivalent to the body\n * the std-ts codegen emits inline for every std factory, lifted out so that:\n * 1. team-published behaviors (Firestore-stored) can dispatch through the\n * same overlay as std behaviors;\n * 2. std factories can collapse to one-line wrappers calling this function.\n *\n * Reference: `docs/Almadar_Studio_SDK.md` §7.4.2.\n *\n * Pure data → data. No I/O.\n *\n * @packageDocumentation\n */\n\nimport type {\n Effect,\n Entity,\n EntityField,\n Expression,\n OrbitalDefinition,\n OrbitalEntity,\n OrbitalSchema,\n PageRefObject,\n PageTraitRef,\n SExpr,\n CallSiteConfig,\n CallSiteConfigEntry,\n Trait,\n TraitConfigValue,\n TraitEventContract,\n TraitEventListener,\n TraitReference,\n TraitTick,\n TraitId,\n} from '../types/index.js';\nimport {\n isCallSiteConfigDeclaration,\n isConfigFieldSchema,\n mergeCallSiteConfigOverrides,\n overrideDeclaredKnobs,\n persistenceModeAllowsOverrides,\n ledgerRename,\n} from '../types/index.js';\nimport type {\n MakePageRefOpts,\n MakeTraitRefOpts,\n} from '../builders.js';\nimport {\n makeOrbitalWithUses,\n makePageRef,\n makeTraitRef,\n} from '../builders.js';\nimport type { OrbitalParamsManifest } from './manifest-types.js';\nimport type {\n OrbitalFactoryParams,\n OrbitalTraitOverride,\n ParamValidationResult,\n} from './types.js';\nimport { orbitalTouchesOwnRecord } from '../data-bearing.js';\n\n/**\n * Structural validation of caller-supplied params against the manifest.\n * Rejects unknown top-level keys and unknown `traitOverrides` keys (the\n * latter against the manifest's `traitNames` allow-list).\n */\nexport function validateOrbitalFactoryParams(\n manifest: OrbitalParamsManifest,\n raw: object,\n): ParamValidationResult {\n if (raw === null || Array.isArray(raw)) {\n return {\n ok: false,\n error: { kind: 'not-object', received: Array.isArray(raw) ? 'array' : 'null' },\n };\n }\n\n const ALLOWED_KEYS = new Set<string>(manifest.paramFields.map((f) => f.name));\n for (const key of Object.keys(raw)) {\n if (!ALLOWED_KEYS.has(key)) {\n return { ok: false, error: { kind: 'unknown-key', key } };\n }\n }\n\n const candidate = raw as OrbitalFactoryParams;\n if (candidate.traitOverrides !== undefined) {\n const to = candidate.traitOverrides;\n if (to === null || typeof to !== 'object' || Array.isArray(to)) {\n return {\n ok: false,\n error: {\n kind: 'trait-overrides-not-object',\n received: Array.isArray(to) ? 'array' : typeof to,\n },\n };\n }\n const allowed = new Set<string>(manifest.traitNames);\n for (const traitName of Object.keys(to)) {\n if (!allowed.has(traitName)) {\n return {\n ok: false,\n error: {\n kind: 'unknown-trait-override',\n trait: traitName,\n allowed: manifest.traitNames,\n },\n };\n }\n }\n }\n\n if (candidate.config !== undefined) {\n const cfg = candidate.config;\n if (cfg === null || typeof cfg !== 'object' || Array.isArray(cfg)) {\n return {\n ok: false,\n error: { kind: 'config-not-object', received: Array.isArray(cfg) ? 'array' : typeof cfg },\n };\n }\n const allowedKeys = manifest.configKeys ?? [];\n for (const key of Object.keys(cfg)) {\n if (!allowedKeys.includes(key)) {\n return { ok: false, error: { kind: 'unknown-config-key', key, allowed: allowedKeys } };\n }\n }\n }\n\n return { ok: true, params: candidate };\n}\n\ninterface OverlayContext {\n readonly canonicalEntityName: string;\n readonly canonicalEntity: OrbitalEntity;\n readonly dataBearing: boolean;\n}\n\nfunction assertResolvedEntity(\n entity: OrbitalSchema['orbitals'][number]['entity'],\n orbitalName: string,\n orbName: string,\n): OrbitalEntity {\n if (typeof entity === 'string') {\n throw new Error(\n `applyParamsToOrb: orbital \"${orbitalName}\" in orb \"${orbName}\" has an unresolved entity reference (string form). Pass a resolved .orb.`,\n );\n }\n if ('extends' in entity) {\n throw new Error(\n `applyParamsToOrb: orbital \"${orbitalName}\" in orb \"${orbName}\" has an unresolved EntityCall (\"extends\" form). Pass a resolved .orb.`,\n );\n }\n return entity;\n}\n\nfunction findOrbitalOrThrow(\n orb: OrbitalSchema,\n orbitalName: string,\n): OrbitalSchema['orbitals'][number] {\n const orbital = orb.orbitals.find((o) => o.name === orbitalName);\n if (!orbital) {\n throw new Error(\n `applyParamsToOrb: orbital \"${orbitalName}\" not found in orb \"${orb.name}\". Available: ${orb.orbitals\n .map((o) => o.name)\n .join(', ')}`,\n );\n }\n return orbital;\n}\n\nfunction buildEntity(\n ctx: OverlayContext,\n effectiveName: string,\n effectiveCollection: string | undefined,\n params: OrbitalFactoryParams,\n): Entity {\n const canonicalFields: readonly EntityField[] = Array.isArray(ctx.canonicalEntity.fields)\n ? ctx.canonicalEntity.fields\n : [];\n\n const extras: readonly EntityField[] = params.fields ?? [];\n\n for (const f of extras) {\n if (f.type === 'enum') {\n if (!Array.isArray(f.values) || f.values.length === 0) {\n throw new Error(\n `Field \"${f.name ?? '<unnamed>'}\" (type: \"enum\") requires a non-empty \\`values: string[]\\` array. ` +\n `Got: ${f.values === undefined ? 'undefined' : JSON.stringify(f.values)}.`,\n );\n }\n }\n if (f.type === 'relation') {\n const rel = f.relation;\n if (!rel || typeof rel.entity !== 'string' || rel.entity.length === 0) {\n throw new Error(\n `Field \"${f.name ?? '<unnamed>'}\" (type: \"relation\") requires \\`relation: { entity: <EntityName>, cardinality: \"one\" | \"many\" }\\`. ` +\n `Got: ${rel === undefined ? 'undefined' : JSON.stringify(rel)}.`,\n );\n }\n if (rel.cardinality !== 'one' && rel.cardinality !== 'many') {\n throw new Error(\n `Field \"${f.name ?? '<unnamed>'}\" (type: \"relation\") requires \\`relation.cardinality: \"one\" | \"many\"\\`. ` +\n `Got: ${rel.cardinality === undefined ? 'undefined' : JSON.stringify(rel.cardinality)}.`,\n );\n }\n }\n }\n\n let mergedFields: readonly EntityField[];\n if (extras.length === 0) {\n mergedFields = canonicalFields;\n } else {\n const extraNames = new Set(extras.map((f) => f.name));\n mergedFields = [\n ...canonicalFields.filter((f) => !extraNames.has(f.name)),\n ...extras,\n ];\n }\n\n const allowPersistenceOverride = persistenceModeAllowsOverrides(\n ctx.canonicalEntity.persistence,\n ctx.dataBearing,\n );\n\n const entity: Entity = {\n name: effectiveName,\n persistence: allowPersistenceOverride\n ? (params.persistence ?? ctx.canonicalEntity.persistence)\n : ctx.canonicalEntity.persistence,\n fields: [...mergedFields],\n };\n if (allowPersistenceOverride && effectiveCollection !== undefined) {\n entity.collection = effectiveCollection;\n } else if (allowPersistenceOverride && entity.persistence === 'persistent' && ctx.canonicalEntity.persistence === 'runtime') {\n // A runtime record made persistent has no canonical collection to inherit.\n entity.collection = `${(params.entityName ?? effectiveName).toLowerCase()}s`;\n }\n return entity;\n}\n\ntype TraitOrInline = OrbitalSchema['orbitals'][number]['traits'][number];\ntype PageOrRef = NonNullable<OrbitalSchema['orbitals'][number]['pages']>[number];\n\ntype TraitRefObject = Extract<TraitOrInline, { ref: string }>;\n\nfunction isTraitReferenceObject(t: TraitOrInline): t is TraitRefObject {\n if (t === null || typeof t !== 'object') return false;\n if (!('ref' in t)) return false;\n return typeof t.ref === 'string';\n}\n\nfunction isPageRefObject(p: PageOrRef): p is PageRefObject {\n if (p === null || typeof p !== 'object') return false;\n if (!('ref' in p)) return false;\n return typeof p.ref === 'string';\n}\n\nfunction rewriteInlineLinkedEntity<T extends { linkedEntity?: string }>(\n shape: T,\n oldName: string,\n newName: string,\n): T {\n if (shape.linkedEntity !== oldName) return shape;\n return { ...shape, linkedEntity: newName };\n}\n\nconst ENTITY_POSITIONAL_OPS: ReadonlyArray<{\n readonly op: string;\n readonly actionGuard?: ReadonlySet<string>;\n readonly entityIndex: number;\n}> = [\n { op: 'fetch', entityIndex: 1 },\n { op: 'spawn', entityIndex: 1 },\n { op: 'persist', actionGuard: new Set(['create', 'update', 'delete']), entityIndex: 2 },\n];\n\nconst ENTITY_VALUED_PROPS: ReadonlySet<string> = new Set([\n 'entity',\n 'source',\n 'entityType',\n 'linkedEntity',\n]);\n\ninterface SExprMap { readonly [k: string]: SExpr }\n\nfunction rewriteEntityInSExpr(value: SExpr, oldName: string, newName: string): SExpr {\n if (value === null) return null;\n if (typeof value === 'boolean' || typeof value === 'number') return value;\n if (typeof value === 'string') {\n const prefix = `@${oldName}`;\n if (value === prefix || value.startsWith(`${prefix}.`)) {\n return `@${newName}${value.slice(prefix.length)}`;\n }\n return value;\n }\n if (Array.isArray(value)) {\n const first = value[0];\n if (typeof first === 'string') {\n for (const entry of ENTITY_POSITIONAL_OPS) {\n if (first !== entry.op) continue;\n if (entry.actionGuard !== undefined) {\n const action = value[1];\n if (typeof action !== 'string' || !entry.actionGuard.has(action)) continue;\n }\n const at = entry.entityIndex;\n const slot = value[at];\n if (typeof slot !== 'string' || slot !== oldName) continue;\n const rewritten: SExpr[] = [];\n for (let i = 0; i < value.length; i++) {\n rewritten.push(i === at ? newName : rewriteEntityInSExpr(value[i], oldName, newName));\n }\n return rewritten;\n }\n }\n return value.map((v) => rewriteEntityInSExpr(v, oldName, newName));\n }\n return rewriteEntityInSExprMap(value as SExprMap, oldName, newName);\n}\n\nfunction rewriteEntityInSExprMap(obj: SExprMap, oldName: string, newName: string): SExprMap {\n const next: { [k: string]: SExpr } = {};\n for (const [k, v] of Object.entries(obj)) {\n if (ENTITY_VALUED_PROPS.has(k) && typeof v === 'string' && v === oldName) {\n next[k] = newName;\n } else {\n next[k] = rewriteEntityInSExpr(v, oldName, newName);\n }\n }\n return next;\n}\n\nfunction rewritePayloadFieldType(typeStr: string, oldName: string, newName: string): string {\n if (typeStr === oldName) return newName;\n if (typeStr === `[${oldName}]`) return `[${newName}]`;\n return typeStr;\n}\n\nfunction rewriteEventContract(\n contract: TraitEventContract,\n oldName: string,\n newName: string,\n): TraitEventContract {\n if (!contract.payloadSchema || contract.payloadSchema.length === 0) return contract;\n return {\n ...contract,\n payloadSchema: contract.payloadSchema.map((f) => {\n const next = { ...f, type: rewritePayloadFieldType(f.type, oldName, newName) };\n if (typeof f.entity === 'string' && f.entity === oldName) {\n next.entity = newName;\n }\n return next;\n }),\n };\n}\n\nfunction rewriteListener(\n listener: TraitEventListener,\n oldName: string,\n newName: string,\n): TraitEventListener {\n if (!listener.payloadMapping) return listener;\n const nextMapping: Record<string, SExpr> = {};\n for (const [k, v] of Object.entries(listener.payloadMapping)) {\n nextMapping[k] = rewriteEntityInSExpr(v, oldName, newName);\n }\n return { ...listener, payloadMapping: nextMapping };\n}\n\nfunction rewriteTick(tick: TraitTick, oldName: string, newName: string): TraitTick {\n const next: TraitTick = { ...tick };\n if (next.guard !== undefined && next.guard !== null) {\n next.guard = rewriteEntityInSExpr(next.guard as SExpr, oldName, newName) as Expression;\n }\n next.effects = next.effects.map(\n (e) => rewriteEntityInSExpr(e as SExpr, oldName, newName) as Effect,\n );\n return next;\n}\n\n/**\n * Rebind an inline `Trait` to a renamed entity. Combines top-level\n * `linkedEntity` rewrite + body-level entity-ref rewriting (SExpr literals\n * in transitions / effects / ticks / payloads / listens).\n */\nexport function rebindInlineTraitEntity(trait: Trait, oldName: string, newName: string): Trait {\n if (oldName === newName) return trait;\n return rewriteEntityInInlineTrait(rewriteInlineLinkedEntity(trait, oldName, newName), oldName, newName);\n}\n\nexport function rewriteEntityInInlineTrait(trait: Trait, oldName: string, newName: string): Trait {\n if (oldName === newName) return trait;\n const next: Trait = { ...trait };\n\n if (next.stateMachine) {\n next.stateMachine = {\n ...next.stateMachine,\n transitions: next.stateMachine.transitions.map((t) => {\n const updated = { ...t };\n if (updated.guard !== undefined && updated.guard !== null) {\n updated.guard = rewriteEntityInSExpr(updated.guard as SExpr, oldName, newName) as Expression;\n }\n if (updated.effects) {\n updated.effects = updated.effects.map(\n (e) => rewriteEntityInSExpr(e as SExpr, oldName, newName) as Effect,\n );\n }\n return updated;\n }),\n };\n }\n\n if (next.initialEffects) {\n next.initialEffects = next.initialEffects.map(\n (e) => rewriteEntityInSExpr(e as SExpr, oldName, newName) as Effect,\n );\n }\n\n if (next.ticks) {\n next.ticks = next.ticks.map((t) => rewriteTick(t, oldName, newName));\n }\n\n if (next.emits) {\n next.emits = next.emits.map((c) => rewriteEventContract(c, oldName, newName));\n }\n\n if (next.listens) {\n next.listens = next.listens.map((l) => rewriteListener(l, oldName, newName));\n }\n\n return next;\n}\n\ntype TraitInput = OrbitalSchema['orbitals'][number]['traits'][number];\ntype PageInput = NonNullable<OrbitalSchema['orbitals'][number]['pages']>[number];\n\n// V4-W4 stamp-before-rename: traits/pages are emitted CANONICAL. Inline traits\n// (and string refs) pass through untouched — their `@entity.<canonical>` tokens\n// + `linkedEntity` stay canonical and resolve by stamped id. Reference objects\n// are still normalised through `makeTraitRef`/`makePageRef` (shape only, no\n// entity rewrite); their canonical `linkedEntity` is renamed post-stamp.\nfunction rebuildTraits(\n traits: OrbitalSchema['orbitals'][number]['traits'],\n): OrbitalDefinition['traits'] {\n return traits.map((t): TraitInput => {\n if (!isTraitReferenceObject(t)) return t;\n return makeTraitRef({ ...t } as MakeTraitRefOpts);\n });\n}\n\nfunction rebuildPages(\n pages: OrbitalSchema['orbitals'][number]['pages'],\n): NonNullable<OrbitalDefinition['pages']> {\n if (!pages) return [];\n return pages.map((p): PageInput => {\n if (!isPageRefObject(p)) return p;\n return makePageRef({ ...p } as MakePageRefOpts);\n });\n}\n\nexport { mergeCallSiteConfigOverrides } from '../types/index.js';\n\n/**\n * Read-only structural view over the JSON lattice the reference-rewrite\n * walker traverses — same trick as the expectation shape union (`SExpr` and\n * `TraitConfigValue` both assign to it). Exported alongside\n * `rewriteTraitRefsInTree` for the rabit composer's dedupe backstop.\n */\nexport type WalkableData =\n | string\n | number\n | boolean\n | null\n | ReadonlyArray<WalkableData>\n | { readonly [key: string]: WalkableData };\n\n/**\n * Boundary-checked `@trait.<from>` → `@trait.<to>` rewrite of one string\n * (next char `.`/`[`/end), mirroring the compiler's\n * `rewrite_trait_embed_in_sexpr`.\n */\nfunction rewriteTraitRefToken(value: string, renames: ReadonlyMap<string, string>): string {\n const prefix = '@trait.';\n if (!value.startsWith(prefix)) return value;\n const rest = value.slice(prefix.length);\n const splitAt = rest.search(/[.[]/);\n const name = splitAt === -1 ? rest : rest.slice(0, splitAt);\n const to = renames.get(name);\n if (to === undefined) return value;\n return `${prefix}${to}${splitAt === -1 ? '' : rest.slice(splitAt)}`;\n}\n\n/**\n * Deep `@trait.<from>` → `@trait.<to>` token rewrite over a JSON tree —\n * config values at any depth, state-machine trees, listen/tick arms. The\n * rename pass (`applyDeclarationTraitRenames`) and the rabit composer's\n * inline-trait dedupe backstop share this one walker so both cover exactly\n * the positions the compiled path's `rewrite_trait_embed_in_sexpr` does.\n */\nexport function rewriteTraitRefsInTree(node: WalkableData, renames: ReadonlyMap<string, string>): WalkableData {\n if (typeof node === 'string') return rewriteTraitRefToken(node, renames);\n if (Array.isArray(node)) return node.map((item) => rewriteTraitRefsInTree(item, renames));\n if (node !== null && typeof node === 'object') {\n const out: { [key: string]: WalkableData } = {};\n for (const [key, value] of Object.entries(node)) out[key] = rewriteTraitRefsInTree(value, renames);\n return out;\n }\n return node;\n}\n\n/**\n * Re-key a `traitEmbedIds` side-map for the renamed tokens: the map is keyed\n * by the token NAME as it appears in the body, so after the body tokens move\n * to the new name the side-map key must follow (id value unchanged — the\n * compiled path's `identity_normalize` then sees token == current name and\n * no-ops, and the runtime's id-primary lookup keeps resolving).\n */\nfunction rekeyTraitEmbedIds(\n embedIds: Record<string, TraitId>,\n renames: ReadonlyMap<string, string>,\n): Record<string, TraitId> {\n let out: Record<string, TraitId> | undefined;\n for (const [token, id] of Object.entries(embedIds)) {\n const to = renames.get(token);\n if (to === undefined) continue;\n out = out ?? { ...embedIds };\n delete out[token];\n out[to] = id;\n }\n return out ?? embedIds;\n}\n\n/**\n * Apply `traitOverrides.<T>.name` renames to trait DECLARATIONS, AFTER the\n * schema has been stamped (V4-W4 stamp-before-rename).\n *\n * The rename moves the declaration (`traits[].name` for inline traits, the\n * ref object's local `name` for reference traits), the ledger `curName` of\n * each renamed declaration id, AND every name-based reference to the old\n * name: `@trait.<old>` tokens in config values and state-machine/tick effect\n * trees, the `traitEmbedIds` side-map keys that index those tokens, and page\n * trait refs (`pages[].traits[].ref`). The dual-carry ids (`refId`,\n * `traitEmbedIds` values) are untouched, so the compiled path's\n * `identity_normalize` pass observes tokens already equal to the id-resolved\n * current name and no-ops, while the JS runtime — which resolves `@trait.X`\n * config knobs (e.g. `DashboardLayout.config.tile2Trait`) and page refs BY\n * NAME — never sees a dangling reference (FIX-H, dashboard-edit-title-string\n * 2026-08-06: the declaration-only rename left `@trait.DefaultRevenueChart`\n * in a sibling's config and the page ref while validate stayed green).\n *\n * The keys are canonical names because stamping ran while the declaration\n * still carried its canonical name (the factory no longer renames — see\n * `applyParamsToOrb`), so `trait.name === canonicalKey` at this point.\n *\n * Pure — returns a new schema. Applied per orbital; the same override key\n * renames the matching declaration in every orbital that owns it (matches\n * the former per-orbital `applyParamsToOrb` semantics).\n */\nexport function applyDeclarationTraitRenames(\n schema: OrbitalSchema,\n renames: ReadonlyMap<string, string>,\n /**\n * Rename timestamp (ISO string) for the ledger `renames[]` audit row. Threaded\n * from the persistence layer (which owns the clock). The stamp keyed each inline\n * trait's ledger `curName` to its canonical name; without this update the renamed\n * declaration disagrees with `curName` → `ORB_ID_NAME_MISMATCH` on the page ref.\n */\n at: string,\n): OrbitalSchema {\n if (renames.size === 0) return schema;\n\n type TraitElem = OrbitalDefinition['traits'][number];\n const renamedTraitIds: Array<{ id: string; to: string }> = [];\n const renameDeclaration = (t: TraitElem): TraitElem => {\n if (typeof t !== 'object' || t === null) return t;\n let next = t;\n const named = t as { name?: string };\n if (typeof named.name === 'string') {\n const renamed = renames.get(named.name);\n if (renamed !== undefined) {\n const id = (t as { id?: string }).id;\n if (typeof id === 'string') renamedTraitIds.push({ id, to: renamed });\n next = { ...next, name: renamed };\n }\n }\n const walked = rewriteTraitRefsInTree(next as WalkableData, renames) as TraitElem;\n // `walked` is the walker's fresh copy — re-keying its side-map mutates no input.\n const embedIds = (walked as { traitEmbedIds?: Record<string, TraitId> }).traitEmbedIds;\n if (embedIds !== undefined) {\n const rekeyed = rekeyTraitEmbedIds(embedIds, renames);\n if (rekeyed !== embedIds) {\n (walked as { traitEmbedIds?: Record<string, TraitId> }).traitEmbedIds = rekeyed;\n }\n }\n return walked;\n };\n const renamePageTraitRefs = (p: PageInput): PageInput => {\n if (typeof p !== 'object' || p === null) return p;\n // Deep walk first: page-trait `config` values can carry `@trait.<old>` too\n // (the compiler's config-ref normalization covers page-ref config).\n const walked = rewriteTraitRefsInTree(p as WalkableData, renames) as Exclude<PageInput, string>;\n const traits = (walked as { traits?: ReadonlyArray<PageTraitRef | string> }).traits;\n if (!Array.isArray(traits)) return walked;\n return {\n ...walked,\n traits: traits.map((t) => {\n if (typeof t === 'string') return renames.get(t) ?? t;\n const to = renames.get(t.ref);\n return to === undefined ? t : { ...t, ref: to };\n }),\n } as PageInput;\n };\n\n const orbitals = schema.orbitals.map((orbital) => {\n if (!('traits' in orbital) || !Array.isArray(orbital.traits)) return orbital;\n return {\n ...orbital,\n traits: orbital.traits.map(renameDeclaration),\n ...(orbital.pages !== undefined ? { pages: orbital.pages.map(renamePageTraitRefs) } : {}),\n };\n });\n\n // Update the ledger `curName` for each renamed trait declaration id so the\n // declaration + ledger agree — clears `ORB_ID_NAME_MISMATCH`; the compiler's\n // identity-normalization pass then rewrites the canonical page `ref` /\n // `@trait.<canonical>` tokens by id. Covers inline bodies AND Reference-form\n // declarations (both carry a local `id` since the composed-surface backbone).\n let ledger = schema.ledger;\n if (ledger !== undefined) {\n for (const { id, to } of renamedTraitIds) {\n ledger = ledgerRename(ledger, id, to, at);\n }\n }\n\n return { ...schema, orbitals, ...(ledger !== schema.ledger ? { ledger } : {}) };\n}\n\n/** The entity name an orbital declares: its inline entity's, or an import's `reference.entity`. */\nexport function declaredEntityName(orbital: OrbitalDefinition): string | null {\n const entity = orbital.entity;\n if (typeof entity === 'object' && entity !== null && typeof entity.name === 'string') return entity.name;\n return orbital.reference?.entity ?? null;\n}\n\n/** A single entity display rename: `from` (canonical name at stamp) → `to`. */\nexport interface EntityDeclarationRename {\n readonly from: string;\n readonly to: string;\n}\n\n/**\n * Apply an entity rename to DECLARATIONS only, AFTER the schema has been\n * stamped (V4-W4 stamp-before-rename). The entity, its `@entity.<from>` body\n * tokens, and every trait/page `linkedEntity` were all emitted CANONICAL by\n * the factory, so stamping keyed `entityRefIds`/`linkedEntityId` by `from`.\n *\n * This renames only the visible declaration surface — `entity.name` and every\n * trait/page `linkedEntity` whose value is `from` — leaving the `@entity.<from>`\n * body tokens and every stamped id untouched. Readers resolve those tokens by\n * `entityRefIds` id and resolve `linkedEntity` by `linkedEntityId`, so the\n * rename lands on the right declaration without any body rewrite (this is what\n * lets the factory stop calling `rebindInlineTraitEntity`). Collection is not\n * renamed here — its effective value was already baked at build time.\n *\n * Pure — returns a new schema. Applied to every orbital whose primary entity\n * is named `from` (mirrors the former per-orbital `applyParamsToOrb` scope for\n * a single-orbital write).\n */\nexport function applyDeclarationEntityRename(\n schema: OrbitalSchema,\n rename: EntityDeclarationRename,\n /**\n * Rename timestamp (ISO string) for the ledger `renames[]` audit row. Threaded\n * from the persistence layer (which owns the clock). The stamp keyed the ledger\n * `curName` to the canonical entity name; without this update the renamed\n * declaration disagrees with `curName` → `ORB_ID_NAME_MISMATCH`.\n */\n at: string,\n): OrbitalSchema {\n if (rename.from === rename.to) return schema;\n\n const linkedEntityIsFrom = (shape: object): boolean =>\n (shape as { linkedEntity?: string }).linkedEntity === rename.from;\n\n const renamedEntityIds: string[] = [];\n const orbitals = schema.orbitals.map((orbital) => {\n const entity = orbital.entity;\n if (orbital.reference !== undefined && orbital.reference.entity === rename.from) {\n return {\n ...orbital,\n reference: { ...orbital.reference, entity: rename.to },\n traits: orbital.traits.map((t): TraitInput =>\n typeof t === 'object' && t !== null && linkedEntityIsFrom(t) ? { ...t, linkedEntity: rename.to } : t,\n ),\n };\n }\n if (typeof entity !== 'object' || entity === null || entity.name !== rename.from) {\n return orbital;\n }\n const entityId = (entity as { id?: string }).id;\n if (typeof entityId === 'string') renamedEntityIds.push(entityId);\n\n const traits = orbital.traits.map((t): TraitInput =>\n typeof t === 'object' && t !== null && linkedEntityIsFrom(t)\n ? { ...t, linkedEntity: rename.to }\n : t,\n );\n const pages = orbital.pages?.map((p): PageInput =>\n typeof p === 'object' && p !== null && linkedEntityIsFrom(p)\n ? { ...p, linkedEntity: rename.to }\n : p,\n );\n\n return {\n ...orbital,\n entity: { ...entity, name: rename.to },\n traits,\n ...(pages !== undefined ? { pages } : {}),\n };\n });\n\n // Update the ledger `curName` for each renamed entity id (route to the\n // canonical owner) so the declaration + ledger agree — clears\n // `ORB_ID_NAME_MISMATCH`; the compiler's identity-normalization pass then\n // rewrites the canonical `@entity`/`fetch`/`persist` tokens by id.\n let ledger = schema.ledger;\n if (ledger !== undefined) {\n for (const id of renamedEntityIds) {\n ledger = ledgerRename(ledger, id, rename.to, at);\n }\n }\n\n return { ...schema, orbitals, ...(ledger !== schema.ledger ? { ledger } : {}) };\n}\n\n/**\n * Ledger/declaration agreement heal for the factory build path: every entity\n * declaration carrying an id must find its ledger row naming the SAME name\n * the declaration carries. A re-instantiate adopts the prior `.orb`'s ledger\n * via `orb stamp --prior` — including rename rows an earlier build recorded —\n * while the factory re-emits the entity at its baked/requested name, so a\n * stale `curName` would survive a corrective rebuild unchanged and\n * manufacture an `ORB_ID_NAME_MISMATCH` no repair pass can edit away\n * (battery 2026-08-06 domain-rule: param-fill renamed MarketplaceUserOrbital's\n * entity to `Product`; the corrective re-instantiate at `entityName:\n * \"MarketplaceUser\"` applies NO rename — from === to — and the adopted row\n * kept `curName: \"Product\"` against a `MarketplaceUser` declaration).\n *\n * Sound on this path only: the factory always re-emits the declaration at the\n * requested/baked name, so the declaration is the build's truth and the\n * adopted row carries identity (the id) forward. No-op when they agree.\n */\nexport function healEntityLedgerRows(schema: OrbitalSchema, at: string): OrbitalSchema {\n let ledger = schema.ledger;\n if (ledger === undefined) return schema;\n for (const orbital of schema.orbitals) {\n const entity = orbital.entity;\n if (typeof entity !== 'object' || entity === null) continue;\n const id = (entity as { id?: string }).id;\n const name = entity.name;\n if (typeof id !== 'string' || typeof name !== 'string') continue;\n const entry = ledger.entries[id];\n if (entry === undefined || entry.kind !== 'entity' || entry.curName === name) continue;\n ledger = ledgerRename(ledger, id, name, at);\n }\n return ledger !== schema.ledger ? { ...schema, ledger } : schema;\n}\n\n/**\n * Trait-declaration sibling of `healEntityLedgerRows`. A re-instantiate with\n * NO trait renames in its params (a corrective rebuild, or the plan-repair\n * reset-to-factory-defaults verb) adopts the prior `.orb`'s ledger — including\n * trait rename rows an earlier build recorded — while the factory re-emits\n * every trait declaration at its baked/requested name, so the stale `curName`\n * would manufacture an `ORB_ID_NAME_MISMATCH` (the entity twin of this is the\n * battery 2026-08-06 `healEntityLedgerRows` case). Same soundness argument:\n * on this path the factory re-emission is the build's truth and the adopted\n * row carries identity (the id) forward. Reference-form declarations resolve\n * their current name as `name ?? <ref last segment>` (mirrors the compiler's\n * `collect_trait_id_names`). No-op when they agree.\n */\nexport function healTraitLedgerRows(schema: OrbitalSchema, at: string): OrbitalSchema {\n let ledger = schema.ledger;\n if (ledger === undefined) return schema;\n for (const orbital of schema.orbitals) {\n for (const trait of orbital.traits ?? []) {\n if (typeof trait !== 'object' || trait === null) continue;\n const id = (trait as { id?: string }).id;\n if (typeof id !== 'string') continue;\n const declared = (trait as { name?: string; ref?: string });\n const name =\n typeof declared.name === 'string'\n ? declared.name\n : typeof declared.ref === 'string'\n ? declared.ref.slice(declared.ref.lastIndexOf('.') + 1)\n : undefined;\n if (name === undefined) continue;\n const entry = ledger.entries[id];\n if (entry === undefined || entry.kind !== 'trait' || entry.curName === name) continue;\n ledger = ledgerRename(ledger, id, name, at);\n }\n }\n return ledger !== schema.ledger ? { ...schema, ledger } : schema;\n}\n\n/**\n * The overlay. Resolves the effective entity name + collection, calls\n * `makeOrbitalWithUses` with the rewritten data, then applies the params'\n * trait/page overrides post-hoc.\n */\nexport function applyParamsToOrb(\n orb: OrbitalSchema,\n orbitalName: string,\n _manifest: OrbitalParamsManifest,\n params: OrbitalFactoryParams,\n): OrbitalDefinition {\n const orbital = findOrbitalOrThrow(orb, orbitalName);\n const canonicalEntity = assertResolvedEntity(orbital.entity, orbitalName, orb.name);\n const canonicalEntityName = canonicalEntity.name;\n // V4-W4 stamp-before-rename: emit the entity + every `@entity`/`linkedEntity`\n // ref CANONICAL. The effective-name rename is a declaration-only concern\n // applied post-stamp (see `applyDeclarationEntityRename`), so the stamped\n // `entityRefIds`/`linkedEntityId` side-maps are keyed by the canonical name\n // that still agrees with the un-rewritten `@entity.<canonical>` tokens.\n // Readers resolve those tokens by stable id onto the renamed declaration.\n // The collection is inert for stamping (not an identity key), so its\n // effective value is baked at build time — only name + linkedEntity rename.\n const effectiveCollection =\n typeof canonicalEntity.collection === 'string'\n ? (params.collection ??\n (params.entityName\n ? `${params.entityName.toLowerCase()}s`\n : canonicalEntity.collection))\n : params.collection;\n\n const ctx: OverlayContext = { canonicalEntityName, canonicalEntity, dataBearing: orbitalTouchesOwnRecord(orbital) };\n\n const built = makeOrbitalWithUses({\n name: orbital.name,\n uses: orbital.uses ?? [],\n // Derived `expects` declarations ride the overlay untouched — they name\n // SIBLING entities (never the orbital's own), so the entityName rename\n // below cannot affect them.\n ...(orbital.expects !== undefined ? { expects: orbital.expects } : {}),\n entity: buildEntity(ctx, canonicalEntityName, effectiveCollection, params),\n traits: rebuildTraits(orbital.traits),\n pages: rebuildPages(orbital.pages),\n });\n\n // This orbital's OWN declared knobs (`Orbital.config`) ride through\n // untouched when the caller supplies no override, and get their\n // `default`s folded when `params.config` is set. Silently no-ops when the\n // orbital declares no config of its own — mirrors `buildEntity`'s\n // persistence-override gate (an override with nothing to apply to is\n // ignored, not an error; `validateOrbitalFactoryParams` is what rejects a\n // `config` param against a manifest with no `configKeys`).\n if (orbital.config !== undefined) {\n built.config =\n params.config !== undefined\n ? overrideDeclaredKnobs(orbital.config, params.config)\n : orbital.config;\n }\n\n if (built.traits && params.traitOverrides !== undefined) {\n built.traits = built.traits.map((t) => {\n if (!isTraitReferenceObject(t) || typeof t.name !== 'string') return t;\n const override: OrbitalTraitOverride | undefined = params.traitOverrides?.[t.name];\n if (!override) return t;\n const merged: TraitReference = { ...t };\n if (override.config !== undefined) {\n merged.config = mergeCallSiteConfigOverrides(t.config ?? {}, override.config);\n }\n if (override.linkedEntity !== undefined) merged.linkedEntity = override.linkedEntity;\n if (override.events !== undefined) {\n if (\n override.events === null ||\n typeof override.events !== 'object' ||\n Array.isArray(override.events)\n ) {\n throw new Error(\n `traitOverrides[\"${t.name}\"].events must be a Record<string,string> ` +\n `(rename map like { \"OPEN\": \"ADD_ITEM\" }), got ${\n Array.isArray(override.events) ? 'an array' : typeof override.events\n }`,\n );\n }\n for (const [k, v] of Object.entries(override.events)) {\n if (typeof v !== 'string') {\n throw new Error(\n `traitOverrides[\"${t.name}\"].events[\"${k}\"] must be a string ` +\n `(target event name), got ${typeof v}`,\n );\n }\n }\n merged.events = { ...(t.events ?? {}), ...override.events };\n }\n // V4-W4: the trait NAME override is NOT applied here. Names are a\n // display concern applied declaration-only AFTER stamping (see\n // `applyDeclarationTraitRenames`), so the stamped ids/side-maps/page\n // refIds are keyed by canonical names that still agree with the\n // (un-rewritten) `@trait.<canonical>` tokens + page `ref`s. Readers\n // then resolve those tokens by stable id onto the renamed declaration —\n // no token rewrite (the deleted `applyTraitRenames`) required.\n if (override.emitsScope !== undefined) merged.emitsScope = override.emitsScope;\n if (override.listens !== undefined) merged.listens = override.listens;\n return merged;\n });\n }\n\n if (built.pages && params.pagePath !== undefined) {\n built.pages = built.pages.map((p, idx) => {\n if (!isPageRefObject(p) || idx !== 0) return p;\n return { ...p, path: params.pagePath } as PageRefObject;\n });\n }\n\n return built;\n}\n","/**\n * `applyParamsToWholeOrb` — pure runtime overlay for an ENTIRE stored orb.\n *\n * Companion to `applyParamsToOrb` (single-orbital). Applies the same overlay\n * to every orbital in the schema by joining each orbital to its matching\n * manifest entry from `manifests[]`. Returns a new `OrbitalSchema`.\n *\n * Reference: `docs/Almadar_Studio_SDK.md` §7.4.4.\n *\n * Pure data → data. No I/O.\n *\n * @packageDocumentation\n */\n\nimport type { OrbitalDefinition, OrbitalSchema } from '../types/index.js';\nimport type { OrbitalParamsManifest } from './manifest-types.js';\nimport type { OrbitalFactoryParams } from './types.js';\nimport { applyParamsToOrb } from './apply-params-to-orb.js';\n\nexport function applyParamsToWholeOrb(\n orb: OrbitalSchema,\n manifests: readonly OrbitalParamsManifest[],\n params: OrbitalFactoryParams,\n): OrbitalSchema {\n const manifestByOrbital = new Map<string, OrbitalParamsManifest>();\n for (const m of manifests) {\n manifestByOrbital.set(m.orbitalName, m);\n }\n const rebuilt: OrbitalDefinition[] = [];\n for (const orbital of orb.orbitals) {\n const manifest = manifestByOrbital.get(orbital.name);\n if (!manifest) {\n rebuilt.push(orbital);\n continue;\n }\n rebuilt.push(applyParamsToOrb(orb, orbital.name, manifest, params));\n }\n return { ...orb, orbitals: rebuilt };\n}\n"]}
|
package/dist/fixtures.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fixtures.ts"],"names":[],"mappings":";;;;;;;;;;;AA8CO,IAAM,mBAAA,GAAsB;AAe5B,IAAM,wBAAA,GAA8C;AAAA,EACzD,wBAAA;AAAA,EACA,yBAAA;AAAA,EACA,2BAAA;AAAA,EACA,gBAAA;AAAA,EACA,2BAAA;AAAA,EACA,gBAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EACA,YAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF;AAMA,IAAM,YAAA,GAAe,KAAK,OAAA,CAAQ,aAAA,CAAc,YAAY,GAAG,CAAC,GAAG,IAAI,CAAA;AAEvE,SAAS,iBAAiB,IAAA,EAAqC;AAC7D,EAAA,IAAI;AACF,IAAA,MAAM,OAAkB,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,IAAA,EAAM,MAAM,CAAC,CAAA;AAC7D,IAAA,OAAO,IAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,IAAK,KAAA,CAAgC,IAAA,KAAS,QAAA,EAAU,OAAO,MAAA;AAC/D,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAIA,SAAS,aAAA,CAAiB,OAAA,EAAiB,IAAA,EAAc,MAAA,EAA+C;AACtG,EAAA,MAAM,IAAA,GAAO,gBAAA,CAAiB,IAAA,CAAK,OAAA,EAAS,IAAI,CAAC,CAAA;AACjD,EAAA,OAAO,IAAA,KAAS,MAAA,GAAY,MAAA,GAAY,MAAA,CAAO,IAAI,CAAA;AACrD;AAQO,SAAS,qBAAqB,QAAA,EAAoC;AACvE,EAAA,IAAI,CAAC,wBAAA,CAAyB,QAAA,CAAS,QAAQ,CAAA,EAAG;AAChD,IAAA,MAAM,IAAI,MAAM,CAAA,kCAAA,EAAqC,QAAQ,mBAAmB,wBAAA,CAAyB,IAAA,CAAK,IAAI,CAAC,CAAA,CAAE,CAAA;AAAA,EACvH;AACA,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,YAAA,EAAc,UAAA,EAAY,eAAe,QAAQ,CAAA;AACtE,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,aAAA,CAAc,OAAA,EAAS,cAAA,EAAgB,kBAAkB,CAAA;AAAA,IAClE,QAAA,EAAU,aAAA,CAAc,OAAA,EAAS,eAAA,EAAiB,mBAAmB,CAAA;AAAA,IACrE,MAAA,EAAQ,aAAA,CAAc,OAAA,EAAS,aAAA,EAAe,CAAC,IAAA,KAAS,CAAA,CAAE,KAAA,CAAM,mBAAmB,CAAA,CAAE,KAAA,CAAM,IAAI,CAAC,CAAA;AAAA,IAChG,QAAA,EAAU,cAAc,OAAA,EAAS,gBAAA,EAAkB,CAAC,IAAA,KAAS,uBAAA,CAAwB,KAAA,CAAM,IAAI,CAAC;AAAA,GAClG;AACF","file":"fixtures.js","sourcesContent":["/**\n * Event-wire fixtures (Program A, §156, wave A2) — the ONE recorded fixture\n * set every server and client test loads: vitest in `@almadar/runtime` /\n * `@almadar/ui` / `almadar-playground-runtime`, `cargo test` in\n * `orbital-core` / `orbital-server` / `orbital-client` and the native\n * (Android/iOS) shell decoders, the Hono codegen contract test, and `orb\n * verify --server`. Generated by `scripts/generate-event-wire-fixtures.ts`\n * (`pnpm run build:fixtures`, wired into `build`) into\n * `fixtures/events-wire/<case>/{request,response}.json` (+ `stream.json` for\n * `sse-stream`, `live-push.json` for `live-push`), each already validated\n * against the zod schemas at generation time.\n *\n * Node-only (reads from disk with `node:fs`) — this module is exported ONLY\n * from the `@almadar/core/fixtures` subpath, never the main entry, so\n * browser bundles (`@almadar/ui`, the playground client, both of which the\n * root workspace Vite pre-bundles `@almadar/core` through) never pull in\n * `node:fs`. Mirrors the `@almadar/core/mock` subpath precedent for\n * Node/build-only surface area.\n *\n * @packageDocumentation\n */\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { z } from 'zod';\n\nimport {\n type EventStreamItem,\n EventStreamItemSchema,\n type LiveBroadcastItem,\n LiveBroadcastItemSchema,\n} from './types/bus.js';\nimport type { JsonValue } from './types/json.js';\nimport { decodeEventRequest, decodeEventResponse, type EventRequest, type EventResponse } from './generated/kernel-wire.js';\n\n/**\n * One SSE stream item, as written by the `POST .../events?stream=true`\n * endpoint's `onPush` calls plus its final write — see `stream.json`'s\n * generator comment (`scripts/generate-event-wire-fixtures.ts`) for the\n * exact source lines. Not part of `types/bus.ts`: the enclosing envelope is\n * `@almadar/server`'s `SSEEvent<T>` transport shape, downstream of core.\n */\nexport type SSEStreamItem = EventStreamItem;\n\n/** Zod twin of `SSEStreamItem` — validates at generation AND on load. Input\n * slot is `object` for the reason given at `BusEventSourceSchema`. */\nexport const SSEStreamItemSchema = EventStreamItemSchema;\n\n/** One loaded fixture case — the files actually present under `<case>/`. */\nexport interface EventWireFixture {\n request?: EventRequest;\n response?: EventResponse;\n stream?: SSEStreamItem[];\n livePush?: LiveBroadcastItem;\n}\n\n/**\n * Case names under `fixtures/events-wire/`, in sync with\n * `scripts/generate-event-wire-fixtures.ts` (a generator-time assertion\n * fails the build if the two lists diverge).\n */\nexport const EVENT_WIRE_FIXTURE_CASES: readonly string[] = [\n 'cascade-emitted-events',\n 'client-effects-by-trait',\n 'client-effects-provenance',\n 'effect-results',\n 'effect-results-every-kind',\n 'guard-rejected',\n 'live-push',\n 'navigate-1',\n 'navigate-2',\n 'navigate-3',\n 'navigate-back',\n 'render-ui-3',\n 'render-ui-clear',\n 'sse-stream',\n 'stateless-traits',\n 'tick-run-leg',\n];\n\n// `src/fixtures.ts` and its built output `dist/fixtures.js` are both exactly\n// one path segment below the package root, so a single `..` resolves\n// correctly whether this module runs from source (tests, via tsx/vitest) or\n// from the published `dist/`.\nconst PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');\n\nfunction readJsonIfExists(path: string): JsonValue | undefined {\n try {\n const json: JsonValue = JSON.parse(readFileSync(path, 'utf8'));\n return json;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') return undefined;\n throw error;\n }\n}\n\n/** Reads `<caseDir>/<file>` and validates it through its schema — the load is\n * typed by the parse, never by a cast. */\nfunction loadValidated<T>(caseDir: string, file: string, decode: (json: JsonValue) => T): T | undefined {\n const json = readJsonIfExists(join(caseDir, file));\n return json === undefined ? undefined : decode(json);\n}\n\n/**\n * Loads one case of the recorded event-wire fixture set from disk, relative\n * to the package root (works both from `packages/almadar-core` source and\n * from an installed `node_modules/@almadar/core`, since `fixtures/` ships\n * alongside `dist/` — see `package.json` `files`).\n */\nexport function loadEventWireFixture(caseName: string): EventWireFixture {\n if (!EVENT_WIRE_FIXTURE_CASES.includes(caseName)) {\n throw new Error(`Unknown event-wire fixture case: \"${caseName}\". Known cases: ${EVENT_WIRE_FIXTURE_CASES.join(', ')}`);\n }\n const caseDir = join(PACKAGE_ROOT, 'fixtures', 'events-wire', caseName);\n return {\n request: loadValidated(caseDir, 'request.json', decodeEventRequest),\n response: loadValidated(caseDir, 'response.json', decodeEventResponse),\n stream: loadValidated(caseDir, 'stream.json', (json) => z.array(SSEStreamItemSchema).parse(json)),\n livePush: loadValidated(caseDir, 'live-push.json', (json) => LiveBroadcastItemSchema.parse(json)),\n };\n}\n"]}
|
package/dist/i18n/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|