@fabricorg/platform 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +2 -0
  3. package/dist/actions/index.cjs +6 -6
  4. package/dist/actions/index.d.cts +76 -1
  5. package/dist/actions/index.d.ts +76 -1
  6. package/dist/actions/index.js +1 -1
  7. package/dist/certification/index.cjs +6 -6
  8. package/dist/certification/index.js +3 -3
  9. package/dist/{chunk-VZ6C4LXC.cjs → chunk-45OKKLNY.cjs} +17 -9
  10. package/dist/chunk-45OKKLNY.cjs.map +1 -0
  11. package/dist/{chunk-OZWUNGJE.js → chunk-6QX4I45I.js} +5 -2
  12. package/dist/chunk-6QX4I45I.js.map +1 -0
  13. package/dist/{chunk-TMMP4U2D.cjs → chunk-DBTAUI6C.cjs} +5 -2
  14. package/dist/chunk-DBTAUI6C.cjs.map +1 -0
  15. package/dist/{chunk-UYCQV65U.js → chunk-EMSAFNPX.js} +3 -3
  16. package/dist/{chunk-UYCQV65U.js.map → chunk-EMSAFNPX.js.map} +1 -1
  17. package/dist/{chunk-JFVEPAED.js → chunk-GU3LZWJD.js} +17 -9
  18. package/dist/chunk-GU3LZWJD.js.map +1 -0
  19. package/dist/{chunk-XS7EUS4T.cjs → chunk-MCWSUGB3.cjs} +4 -4
  20. package/dist/{chunk-XS7EUS4T.cjs.map → chunk-MCWSUGB3.cjs.map} +1 -1
  21. package/dist/{chunk-QHV6LOS6.js → chunk-PDN5DOLQ.js} +3 -3
  22. package/dist/{chunk-QHV6LOS6.js.map → chunk-PDN5DOLQ.js.map} +1 -1
  23. package/dist/{chunk-ZF5HDNSU.js → chunk-WNZP53GI.js} +5 -2
  24. package/dist/chunk-WNZP53GI.js.map +1 -0
  25. package/dist/{chunk-2URHPZXL.cjs → chunk-WQ3BYI7T.cjs} +6 -6
  26. package/dist/{chunk-2URHPZXL.cjs.map → chunk-WQ3BYI7T.cjs.map} +1 -1
  27. package/dist/{chunk-DDX5FKOM.cjs → chunk-XCAOO6KG.cjs} +5 -2
  28. package/dist/chunk-XCAOO6KG.cjs.map +1 -0
  29. package/dist/index.cjs +35 -35
  30. package/dist/index.d.cts +2 -2
  31. package/dist/index.d.ts +2 -2
  32. package/dist/index.js +5 -5
  33. package/dist/manifest/index.cjs +8 -8
  34. package/dist/manifest/index.js +2 -2
  35. package/dist/modules/index.cjs +9 -9
  36. package/dist/modules/index.js +1 -1
  37. package/dist/policies/index.cjs +9 -9
  38. package/dist/policies/index.d.cts +14 -1
  39. package/dist/policies/index.d.ts +14 -1
  40. package/dist/policies/index.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/chunk-DDX5FKOM.cjs.map +0 -1
  43. package/dist/chunk-JFVEPAED.js.map +0 -1
  44. package/dist/chunk-OZWUNGJE.js.map +0 -1
  45. package/dist/chunk-TMMP4U2D.cjs.map +0 -1
  46. package/dist/chunk-VZ6C4LXC.cjs.map +0 -1
  47. package/dist/chunk-ZF5HDNSU.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../manifest/index.ts"],"names":[],"mappings":";;;;AA+BO,IAAM,uBAAA,GAA0B;AAkKhC,SAAS,wBACf,QAAA,EACiB;AACjB,EAAA,MAAM,UAAkB,QAAA,CAAS,eAAA;AACjC,EAAA,IAAI,OAAA,KAAY,CAAA,IAAK,OAAA,KAAY,uBAAA,EAAyB;AACzD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qCAAA,EAAwC,MAAA,CAAO,OAAO,CAAC,CAAA,CAAE,CAAA;AAAA,EAC1E;AACA,EAAA,MAAM,KAAA,GAAQ,OAAA,IAAW,QAAA,IAAY,KAAA,CAAM,OAAA,CAAQ,SAAS,KAAK,CAAA,GAAI,QAAA,CAAS,KAAA,GAAQ,EAAC;AAEvF,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,OAAO,CAAA;AACjC,IAAA,KAAA,MAA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A,KAAW,MAAS,CAAA;AAAA,IACzE,aAAA,EAAA,CAAgB,MAAA,CAAO,aAAA,IAAiB,EAAC,EACvC,GAAA,CAAI,kBAAkB,CAAA,CACtB,MAAA,CAAO,CAAC,OAAA,KAAmD,OAAA,KAAY,MAAS,CAAA;AAAA,IAClF,QAAQ,MAAA,CAAO,KAAA,IAAS,EAAC,EAAG,IAAI,UAAU;AAAA,GAC3C;AAEA,EAAA,IAAI,MAAA,CAAO,OAAA,KAAY,MAAA,EAAW,QAAA,CAAS,UAAU,MAAA,CAAO,OAAA;AAC5D,EAAA,IAAI,MAAA,CAAO,WAAA,KAAgB,MAAA,EAAW,QAAA,CAAS,cAAc,MAAA,CAAO,WAAA;AACpE,EAAA,IAAI,MAAA,CAAO,WAAA,KAAgB,MAAA,EAAW,QAAA,CAAS,cAAc,MAAA,CAAO,WAAA;AACpE,EAAA,IAAI,OAAO,UAAA,KAAe,MAAA,WAAoB,UAAA,GAAa,SAAA,CAAU,OAAO,UAAU,CAAA;AAEtF,EAAA,OAAO,QAAA;AACR;AAMO,SAAS,2BACf,OAAA,EACuB;AACvB,EAAA,OAAO;AAAA,IACN,eAAA,EAAiB,uBAAA;AAAA,IACjB,OAAA,EAAS,OAAA,CAAQ,GAAA,CAAI,oBAAoB;AAAA,GAC1C;AACD","file":"chunk-QHV6LOS6.js","sourcesContent":["import { assertSurfaceDeclaration, type SurfaceDeclaration } from \"../discovery\";\nimport type {\n\tActionExecutionContract,\n\tActionDefinition,\n\tAdapterStepRetryPolicy,\n\tSchemaValidator,\n} from \"../actions\";\nimport {\n\tgetEventTypeName,\n\tgetModuleDependencyNamespace,\n\tgetObjectTypeName,\n\ttype FabricModule,\n\ttype CapabilityMetadata,\n\ttype DeclarativeInvariant,\n\ttype ModuleDependency,\n\ttype ModuleDependencyInput,\n\ttype ObjectRelationDefinition,\n} from \"../modules\";\nimport type { JsonValue, PortableJsonSchema } from \"../objects\";\nimport type {\n\tDataPolicyDefinition,\n\tPolicyFallbackDefinition,\n\tPolicyKind,\n} from \"../policies\";\nimport type { StateDefinition, StateMachineDefinition } from \"../state-machines\";\nimport type { ViewContract } from \"../projections\";\n\n/**\n * Version of the module manifest contract. Bump when the serialized shape\n * changes in a way consumers must detect.\n */\nexport const MODULE_MANIFEST_VERSION = 2 as const;\n\nexport interface ModuleManifestObjectType {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport interface ModuleManifestIdPrefix {\n\tprefix: string;\n\tname: string;\n}\n\nexport interface ModuleManifestEventType {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n\tschema?: PortableJsonSchema;\n}\n\nexport interface ModuleManifestActionStateMachine {\n\tentityType: string;\n\t/** Present only when the binding declares a static target state. */\n\ttargetState?: string;\n}\n\nexport interface ModuleManifestAdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n}\n\nexport interface ModuleManifestAction extends SurfaceDeclaration {\n\tactionId: string;\n\tversion: number;\n\tkind: \"atomic\" | \"saga\";\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\temitsEvents: string[];\n\tpolicies?: string[];\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\texecution?: ActionExecutionContract;\n\t/**\n\t * JSON Schema for the action parameters, present only when the action's\n\t * `schema` validator implements {@link JsonSchemaExportableValidator}.\n\t */\n\tparameterSchema?: unknown;\n\tparameterSchemaFormat?: \"json-schema\";\n\tresultSchema?: unknown;\n\tresultSchemaFormat?: \"json-schema\";\n\tstateMachine?: ModuleManifestActionStateMachine;\n\tadapterSteps?: ModuleManifestAdapterStep[];\n}\n\nexport interface ModuleManifestCodePolicy {\n\ttype: \"code\";\n\tpolicyId: string;\n\tversion: number;\n\tpreviewSafe?: boolean;\n}\n\nexport interface ModuleManifestDataPolicy {\n\ttype: \"data\";\n\tpolicyId: string;\n\tpolicyVersion: number;\n\tkind: PolicyKind;\n\tdataDefinition?: DataPolicyDefinition;\n\tcodeEvaluatorPolicyId?: string;\n\tfallback?: PolicyFallbackDefinition;\n}\n\nexport type ModuleManifestPolicy = ModuleManifestCodePolicy | ModuleManifestDataPolicy;\n\nexport interface ModuleManifestStateMachineTransition {\n\tfrom: string;\n\tto: string;\n\tcausedByAction: string;\n\t/** `true` when the transition declares a guard function. The guard itself is never serialized. */\n\thasGuard: boolean;\n}\n\nexport interface ModuleManifestStateMachine {\n\tentityType: string;\n\t/** States in declaration order (`Object.values` order of the definition record). */\n\tstates: StateDefinition[];\n\ttransitions: ModuleManifestStateMachineTransition[];\n}\n\nexport interface ModuleManifestView extends SurfaceDeclaration {\n\tname: string;\n\tversion: string;\n\tshape: PortableJsonSchema;\n\tparameterSchema?: PortableJsonSchema;\n\tconsumes: Array<{ eventType: string; schemaVersions: number[] }>;\n\tscope: \"tenant-space\";\n\tsnapshotVersion: number;\n\tcompatibleSnapshotVersions?: number[];\n\tusage?: ViewContract[\"usage\"];\n}\n\n/**\n * Stable, JSON-serializable description of a {@link FabricModule}'s ontology:\n * object types, subject types, id prefixes, event types, actions, policies,\n * and state machines. Intended for downstream tooling (semantics exporters,\n * docs generators, tool generators) that cannot consume live module code.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields (`handler`, `evaluate`, `guard`,\n * dynamic `targetState`, adapter `getInput`) are never serialized.\n */\nexport interface ModuleManifest {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\tnamespace: string;\n\tversion?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies: ModuleDependency[];\n\tobjectTypes: ModuleManifestObjectType[];\n\tsubjectTypes: string[];\n\tidPrefixes: ModuleManifestIdPrefix[];\n\teventTypes: ModuleManifestEventType[];\n\tactions: ModuleManifestAction[];\n\tpolicies: ModuleManifestPolicy[];\n\tstateMachines: ModuleManifestStateMachine[];\n\tviews: ModuleManifestView[];\n}\n\nexport interface ModuleManifestBundle {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\t/** Manifests in the input module order. */\n\tmodules: ModuleManifest[];\n}\n\n/** Manifest v1 remains accepted by v2 readers; missing v2 fields normalize to absence. */\nexport type ModuleManifestObjectTypeV1 = Omit<\n\tModuleManifestObjectType,\n\t\"schema\" | \"semantics\" | \"relations\" | \"invariants\"\n>;\nexport type ModuleManifestActionV1 = Omit<\n\tModuleManifestAction,\n\t\"resultSchema\" | \"resultSchemaFormat\"\n>;\nexport type ModuleManifestV1 = Omit<\n\tModuleManifest,\n\t\"manifestVersion\" | \"objectTypes\" | \"actions\" | \"views\"\n> & {\n\tmanifestVersion: 1;\n\tobjectTypes: ModuleManifestObjectTypeV1[];\n\tactions: ModuleManifestActionV1[];\n};\nexport type ModuleManifestBundleV1 = Omit<ModuleManifestBundle, \"manifestVersion\" | \"modules\"> & {\n\tmanifestVersion: 1;\n\tmodules: ModuleManifestV1[];\n};\n\nexport function normalizeModuleManifest(\n\tmanifest: ModuleManifest | ModuleManifestV1,\n): ModuleManifest {\n\tconst version: number = manifest.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest version: ${String(version)}`);\n\t}\n\tconst views = \"views\" in manifest && Array.isArray(manifest.views) ? manifest.views : [];\n\t// Preserve the normalizer's legacy tolerance for absent/non-array fields.\n\tif (Array.isArray(manifest.actions))\n\t\tfor (const [index, action] of manifest.actions.entries())\n\t\t\tassertSurfaceDeclaration(action, `Module \"${manifest.namespace}\" action[${index}] \"${action?.actionId ?? \"unknown\"}\"`);\n\tfor (const [index, view] of views.entries())\n\t\tassertSurfaceDeclaration(view, `Module \"${manifest.namespace}\" view[${index}] \"${view?.name ?? \"unknown\"}\"`);\n\treturn {\n\t\t...manifest,\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tviews,\n\t};\n}\n\nexport function normalizeModuleManifestBundle(\n\tbundle: ModuleManifestBundle | ModuleManifestBundleV1,\n): ModuleManifestBundle {\n\tconst version: number = bundle.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest bundle version: ${String(version)}`);\n\t}\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: bundle.modules.map((manifest) => normalizeModuleManifest(manifest)),\n\t};\n}\n\n/**\n * A {@link SchemaValidator} that can also export its parameter schema as JSON\n * Schema (for example a Zod 4 schema via `z.toJSONSchema`). Keeps the platform\n * zero-dependency while letting schema-bearing actions flow into manifests.\n */\nexport interface JsonSchemaExportableValidator extends SchemaValidator {\n\ttoJSONSchema(): Record<string, unknown>;\n}\n\nexport function isJsonSchemaExportableValidator(\n\tschema: SchemaValidator,\n): schema is JsonSchemaExportableValidator {\n\treturn (\n\t\ttypeof (schema as Partial<JsonSchemaExportableValidator>).toJSONSchema === \"function\"\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction exportDependency(dependency: ModuleDependencyInput): ModuleDependency {\n\tconst namespace = getModuleDependencyNamespace(dependency);\n\tif (typeof dependency === \"string\") {\n\t\treturn { namespace };\n\t}\n\tconst normalized: ModuleDependency = { namespace };\n\tif (dependency.version !== undefined) normalized.version = dependency.version;\n\tif (dependency.optional !== undefined) normalized.optional = dependency.optional;\n\treturn normalized;\n}\n\nfunction exportObjectType(\n\tobjectType: NonNullable<FabricModule[\"objectTypes\"]>[number],\n): ModuleManifestObjectType {\n\tif (typeof objectType === \"string\") {\n\t\treturn { type: objectType };\n\t}\n\tconst normalized: ModuleManifestObjectType = { type: getObjectTypeName(objectType) };\n\tif (objectType.displayName !== undefined) normalized.displayName = objectType.displayName;\n\tif (objectType.idPrefix !== undefined) normalized.idPrefix = objectType.idPrefix;\n\tif (objectType.schema !== undefined) normalized.schema = cloneJson(objectType.schema);\n\tif (objectType.semantics !== undefined) normalized.semantics = cloneJson(objectType.semantics);\n\tif (objectType.relations !== undefined) {\n\t\tnormalized.relations = objectType.relations.map((relation) => ({ ...relation }));\n\t}\n\tif (objectType.invariants !== undefined) {\n\t\tnormalized.invariants = objectType.invariants.map((invariant) => ({ ...invariant }));\n\t}\n\treturn normalized;\n}\n\nfunction cloneJson<T>(value: T): T {\n\tif (Array.isArray(value)) return value.map((item) => cloneJson(item)) as T;\n\tif (value !== null && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>).map(([key, child]) => [key, cloneJson(child)]),\n\t\t) as T;\n\t}\n\treturn value;\n}\n\nfunction exportEventType(\n\teventType: NonNullable<FabricModule[\"eventTypes\"]>[number],\n): ModuleManifestEventType {\n\tif (typeof eventType === \"string\") {\n\t\t// String registrations carry no explicit schema version; the events\n\t\t// registry treats the bare name as the initial version of the type.\n\t\treturn { eventType, schemaVersion: 1 };\n\t}\n\tconst normalized: ModuleManifestEventType = {\n\t\teventType: getEventTypeName(eventType),\n\t\tschemaVersion: eventType.schemaVersion,\n\t};\n\tif (eventType.description !== undefined) normalized.description = eventType.description;\n\tif (eventType.schema !== undefined) normalized.schema = cloneJson(eventType.schema);\n\treturn normalized;\n}\n\nfunction exportAction(action: ActionDefinition): ModuleManifestAction {\n\tassertSurfaceDeclaration(action, `Action \"${action?.actionId ?? \"unknown\"}\"`);\n\tconst manifest: ModuleManifestAction = {\n\t\tactionId: action.actionId,\n\t\tversion: action.version,\n\t\tkind: action.kind ?? \"atomic\",\n\t\tidempotent: action.idempotent,\n\t\tmutatesDomain: action.mutatesDomain,\n\t\temitsEvents: [...action.emitsEvents],\n\t};\n\n\tif (action.surface !== undefined) manifest.surface = action.surface;\n\tif (action.surfaceReason !== undefined) manifest.surfaceReason = action.surfaceReason;\n\tif (action.policies !== undefined) manifest.policies = [...action.policies];\n\tif (action.requiredRoles !== undefined) manifest.requiredRoles = [...action.requiredRoles];\n\tif (action.requiredPermissions !== undefined) {\n\t\tmanifest.requiredPermissions = [...action.requiredPermissions];\n\t}\n\tif (action.eventPhase !== undefined) manifest.eventPhase = action.eventPhase;\n\tif (action.execution !== undefined) manifest.execution = cloneJson(action.execution);\n\n\tif (isJsonSchemaExportableValidator(action.schema)) {\n\t\ttry {\n\t\t\tmanifest.parameterSchema = action.schema.toJSONSchema();\n\t\t\tmanifest.parameterSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// Runtime-valid schemas that cannot be represented portably remain executable;\n\t\t\t// build-time consumers see the schema as unavailable rather than crashing export.\n\t\t}\n\t}\n\tif (action.resultSchema && isJsonSchemaExportableValidator(action.resultSchema)) {\n\t\ttry {\n\t\t\tmanifest.resultSchema = action.resultSchema.toJSONSchema();\n\t\t\tmanifest.resultSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// See parameter-schema behavior above.\n\t\t}\n\t}\n\n\tif (action.stateMachine !== undefined) {\n\t\tconst binding: ModuleManifestActionStateMachine = {\n\t\t\tentityType: action.stateMachine.entityType,\n\t\t};\n\t\tif (typeof action.stateMachine.targetState === \"string\") {\n\t\t\tbinding.targetState = action.stateMachine.targetState;\n\t\t}\n\t\tmanifest.stateMachine = binding;\n\t}\n\n\tif (action.adapterSteps !== undefined) {\n\t\tmanifest.adapterSteps = action.adapterSteps.map((step) => {\n\t\t\tconst exported: ModuleManifestAdapterStep = {\n\t\t\t\tadapterType: step.adapterType,\n\t\t\t\toperation: step.operation,\n\t\t\t};\n\t\t\tif (step.retryPolicy !== undefined) exported.retryPolicy = { ...step.retryPolicy };\n\t\t\treturn exported;\n\t\t});\n\t}\n\n\treturn manifest;\n}\n\nfunction exportPolicy(policy: unknown): ModuleManifestPolicy | undefined {\n\tif (!isRecord(policy) || typeof policy.policyId !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// Code evaluator: identified by its `evaluate` function (never serialized).\n\tif (typeof policy.evaluate === \"function\") {\n\t\tconst exported: ModuleManifestCodePolicy = {\n\t\t\ttype: \"code\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tversion: typeof policy.version === \"number\" ? policy.version : 1,\n\t\t};\n\t\tif (typeof policy.previewSafe === \"boolean\") exported.previewSafe = policy.previewSafe;\n\t\treturn exported;\n\t}\n\n\t// Declarative runtime policy definition: pure data, serialized as-is.\n\tif (typeof policy.kind === \"string\" && typeof policy.policyVersion === \"number\") {\n\t\tconst exported: ModuleManifestDataPolicy = {\n\t\t\ttype: \"data\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tpolicyVersion: policy.policyVersion,\n\t\t\tkind: policy.kind as PolicyKind,\n\t\t};\n\t\tif (isRecord(policy.dataDefinition)) {\n\t\t\texported.dataDefinition = policy.dataDefinition as unknown as DataPolicyDefinition;\n\t\t}\n\t\tif (typeof policy.codeEvaluatorPolicyId === \"string\") {\n\t\t\texported.codeEvaluatorPolicyId = policy.codeEvaluatorPolicyId;\n\t\t}\n\t\tif (isRecord(policy.fallback)) {\n\t\t\texported.fallback = policy.fallback as unknown as PolicyFallbackDefinition;\n\t\t}\n\t\treturn exported;\n\t}\n\n\t// Unknown policy shape: omit rather than guess.\n\treturn undefined;\n}\n\nfunction exportStateMachine(machine: unknown): ModuleManifestStateMachine | undefined {\n\tif (\n\t\t!isRecord(machine) ||\n\t\ttypeof machine.entityType !== \"string\" ||\n\t\t!isRecord(machine.states) ||\n\t\t!Array.isArray(machine.transitions)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst definition = machine as unknown as StateMachineDefinition;\n\treturn {\n\t\tentityType: definition.entityType,\n\t\tstates: Object.values(definition.states),\n\t\ttransitions: definition.transitions.map((transition) => ({\n\t\t\tfrom: transition.from,\n\t\t\tto: transition.to,\n\t\t\tcausedByAction: transition.causedByAction,\n\t\t\thasGuard: typeof transition.guard === \"function\",\n\t\t})),\n\t};\n}\n\nfunction exportView(view: ViewContract): ModuleManifestView {\n\tassertSurfaceDeclaration(view, `View \"${view?.name ?? \"unknown\"}\"`);\n\tconst output: ModuleManifestView = {\n\t\tname: view.name,\n\t\tversion: view.version,\n\t\tshape: cloneJson(view.shape),\n\t\tconsumes: view.consumes.map((consumption) => ({\n\t\t\teventType: consumption.eventType,\n\t\t\tschemaVersions: [...consumption.schemaVersions],\n\t\t})),\n\t\tscope: view.scope,\n\t\tsnapshotVersion: view.snapshotVersion,\n\t};\n\tif (view.surface !== undefined) output.surface = view.surface;\n\tif (view.surfaceReason !== undefined) output.surfaceReason = view.surfaceReason;\n\tif (view.parameterSchema !== undefined) output.parameterSchema = cloneJson(view.parameterSchema);\n\tif (view.compatibleSnapshotVersions) output.compatibleSnapshotVersions = [...view.compatibleSnapshotVersions];\n\tif (view.usage) output.usage = cloneJson(view.usage);\n\treturn output;\n}\n\n/**\n * Export a stable, JSON-serializable manifest of a module's ontology.\n *\n * This is a pure function of the module object: it does not read or mutate the\n * global module/action/policy/state-machine registries, and the module does\n * not need to be registered first. Declaration order is preserved everywhere\n * (nothing is sorted), so the same module object always produces a\n * byte-identical `JSON.stringify` result.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields are elided (`handler`,\n * policy `evaluate`, transition `guard` → `hasGuard`, dynamic `targetState`,\n * adapter `getInput`).\n */\nexport function exportModuleManifest(module: FabricModule<unknown>): ModuleManifest {\n\tconst manifest: ModuleManifest = {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tnamespace: module.namespace,\n\t\tdependencies: (module.dependencies ?? []).map(exportDependency),\n\t\tobjectTypes: (module.objectTypes ?? []).map(exportObjectType),\n\t\tsubjectTypes: [...(module.subjectTypes ?? [])],\n\t\tidPrefixes: (module.idPrefixes ?? []).map((registration) => ({\n\t\t\tprefix: registration.prefix,\n\t\t\tname: registration.name,\n\t\t})),\n\t\teventTypes: (module.eventTypes ?? []).map(exportEventType),\n\t\tactions: (module.actions ?? []).map(exportAction),\n\t\tpolicies: (module.policies ?? [])\n\t\t\t.map(exportPolicy)\n\t\t\t.filter((policy): policy is ModuleManifestPolicy => policy !== undefined),\n\t\tstateMachines: (module.stateMachines ?? [])\n\t\t\t.map(exportStateMachine)\n\t\t\t.filter((machine): machine is ModuleManifestStateMachine => machine !== undefined),\n\t\tviews: (module.views ?? []).map(exportView),\n\t};\n\n\tif (module.version !== undefined) manifest.version = module.version;\n\tif (module.displayName !== undefined) manifest.displayName = module.displayName;\n\tif (module.description !== undefined) manifest.description = module.description;\n\tif (module.capability !== undefined) manifest.capability = cloneJson(module.capability);\n\n\treturn manifest;\n}\n\n/**\n * Export manifests for a set of modules, preserving the input order.\n * Like {@link exportModuleManifest}, this is pure and registry-free.\n */\nexport function exportModuleManifestBundle(\n\tmodules: FabricModule<unknown>[],\n): ModuleManifestBundle {\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: modules.map(exportModuleManifest),\n\t};\n}\n"]}
1
+ {"version":3,"sources":["../manifest/index.ts"],"names":[],"mappings":";;;;AA+BO,IAAM,uBAAA,GAA0B;AAkKhC,SAAS,wBACf,QAAA,EACiB;AACjB,EAAA,MAAM,UAAkB,QAAA,CAAS,eAAA;AACjC,EAAA,IAAI,OAAA,KAAY,CAAA,IAAK,OAAA,KAAY,uBAAA,EAAyB;AACzD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qCAAA,EAAwC,MAAA,CAAO,OAAO,CAAC,CAAA,CAAE,CAAA;AAAA,EAC1E;AACA,EAAA,MAAM,KAAA,GAAQ,OAAA,IAAW,QAAA,IAAY,KAAA,CAAM,OAAA,CAAQ,SAAS,KAAK,CAAA,GAAI,QAAA,CAAS,KAAA,GAAQ,EAAC;AAEvF,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,OAAO,CAAA;AACjC,IAAA,KAAA,MAAW,CAAC,KAAA,EAAO,MAAM,CAAA,IAAK,QAAA,CAAS,QAAQ,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CAAO,aAAA,IAAiB,EAAC,EACvC,GAAA,CAAI,kBAAkB,CAAA,CACtB,MAAA,CAAO,CAAC,OAAA,KAAmD,OAAA,KAAY,MAAS,CAAA;AAAA,IAClF,QAAQ,MAAA,CAAO,KAAA,IAAS,EAAC,EAAG,IAAI,UAAU;AAAA,GAC3C;AAEA,EAAA,IAAI,MAAA,CAAO,OAAA,KAAY,MAAA,EAAW,QAAA,CAAS,UAAU,MAAA,CAAO,OAAA;AAC5D,EAAA,IAAI,MAAA,CAAO,WAAA,KAAgB,MAAA,EAAW,QAAA,CAAS,cAAc,MAAA,CAAO,WAAA;AACpE,EAAA,IAAI,MAAA,CAAO,WAAA,KAAgB,MAAA,EAAW,QAAA,CAAS,cAAc,MAAA,CAAO,WAAA;AACpE,EAAA,IAAI,OAAO,UAAA,KAAe,MAAA,WAAoB,UAAA,GAAa,SAAA,CAAU,OAAO,UAAU,CAAA;AAEtF,EAAA,OAAO,QAAA;AACR;AAMO,SAAS,2BACf,OAAA,EACuB;AACvB,EAAA,OAAO;AAAA,IACN,eAAA,EAAiB,uBAAA;AAAA,IACjB,OAAA,EAAS,OAAA,CAAQ,GAAA,CAAI,oBAAoB;AAAA,GAC1C;AACD","file":"chunk-PDN5DOLQ.js","sourcesContent":["import { assertSurfaceDeclaration, type SurfaceDeclaration } from \"../discovery\";\nimport type {\n\tActionExecutionContract,\n\tActionDefinition,\n\tAdapterStepRetryPolicy,\n\tSchemaValidator,\n} from \"../actions\";\nimport {\n\tgetEventTypeName,\n\tgetModuleDependencyNamespace,\n\tgetObjectTypeName,\n\ttype FabricModule,\n\ttype CapabilityMetadata,\n\ttype DeclarativeInvariant,\n\ttype ModuleDependency,\n\ttype ModuleDependencyInput,\n\ttype ObjectRelationDefinition,\n} from \"../modules\";\nimport type { JsonValue, PortableJsonSchema } from \"../objects\";\nimport type {\n\tDataPolicyDefinition,\n\tPolicyFallbackDefinition,\n\tPolicyKind,\n} from \"../policies\";\nimport type { StateDefinition, StateMachineDefinition } from \"../state-machines\";\nimport type { ViewContract } from \"../projections\";\n\n/**\n * Version of the module manifest contract. Bump when the serialized shape\n * changes in a way consumers must detect.\n */\nexport const MODULE_MANIFEST_VERSION = 2 as const;\n\nexport interface ModuleManifestObjectType {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport interface ModuleManifestIdPrefix {\n\tprefix: string;\n\tname: string;\n}\n\nexport interface ModuleManifestEventType {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n\tschema?: PortableJsonSchema;\n}\n\nexport interface ModuleManifestActionStateMachine {\n\tentityType: string;\n\t/** Present only when the binding declares a static target state. */\n\ttargetState?: string;\n}\n\nexport interface ModuleManifestAdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n}\n\nexport interface ModuleManifestAction extends SurfaceDeclaration {\n\tactionId: string;\n\tversion: number;\n\tkind: \"atomic\" | \"saga\";\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\temitsEvents: string[];\n\tpolicies?: string[];\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\texecution?: ActionExecutionContract;\n\t/**\n\t * JSON Schema for the action parameters, present only when the action's\n\t * `schema` validator implements {@link JsonSchemaExportableValidator}.\n\t */\n\tparameterSchema?: unknown;\n\tparameterSchemaFormat?: \"json-schema\";\n\tresultSchema?: unknown;\n\tresultSchemaFormat?: \"json-schema\";\n\tstateMachine?: ModuleManifestActionStateMachine;\n\tadapterSteps?: ModuleManifestAdapterStep[];\n}\n\nexport interface ModuleManifestCodePolicy {\n\ttype: \"code\";\n\tpolicyId: string;\n\tversion: number;\n\tpreviewSafe?: boolean;\n}\n\nexport interface ModuleManifestDataPolicy {\n\ttype: \"data\";\n\tpolicyId: string;\n\tpolicyVersion: number;\n\tkind: PolicyKind;\n\tdataDefinition?: DataPolicyDefinition;\n\tcodeEvaluatorPolicyId?: string;\n\tfallback?: PolicyFallbackDefinition;\n}\n\nexport type ModuleManifestPolicy = ModuleManifestCodePolicy | ModuleManifestDataPolicy;\n\nexport interface ModuleManifestStateMachineTransition {\n\tfrom: string;\n\tto: string;\n\tcausedByAction: string;\n\t/** `true` when the transition declares a guard function. The guard itself is never serialized. */\n\thasGuard: boolean;\n}\n\nexport interface ModuleManifestStateMachine {\n\tentityType: string;\n\t/** States in declaration order (`Object.values` order of the definition record). */\n\tstates: StateDefinition[];\n\ttransitions: ModuleManifestStateMachineTransition[];\n}\n\nexport interface ModuleManifestView extends SurfaceDeclaration {\n\tname: string;\n\tversion: string;\n\tshape: PortableJsonSchema;\n\tparameterSchema?: PortableJsonSchema;\n\tconsumes: Array<{ eventType: string; schemaVersions: number[] }>;\n\tscope: \"tenant-space\";\n\tsnapshotVersion: number;\n\tcompatibleSnapshotVersions?: number[];\n\tusage?: ViewContract[\"usage\"];\n}\n\n/**\n * Stable, JSON-serializable description of a {@link FabricModule}'s ontology:\n * object types, subject types, id prefixes, event types, actions, policies,\n * and state machines. Intended for downstream tooling (semantics exporters,\n * docs generators, tool generators) that cannot consume live module code.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields (`handler`, `evaluate`, `guard`,\n * dynamic `targetState`, adapter `getInput`) are never serialized.\n */\nexport interface ModuleManifest {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\tnamespace: string;\n\tversion?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies: ModuleDependency[];\n\tobjectTypes: ModuleManifestObjectType[];\n\tsubjectTypes: string[];\n\tidPrefixes: ModuleManifestIdPrefix[];\n\teventTypes: ModuleManifestEventType[];\n\tactions: ModuleManifestAction[];\n\tpolicies: ModuleManifestPolicy[];\n\tstateMachines: ModuleManifestStateMachine[];\n\tviews: ModuleManifestView[];\n}\n\nexport interface ModuleManifestBundle {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\t/** Manifests in the input module order. */\n\tmodules: ModuleManifest[];\n}\n\n/** Manifest v1 remains accepted by v2 readers; missing v2 fields normalize to absence. */\nexport type ModuleManifestObjectTypeV1 = Omit<\n\tModuleManifestObjectType,\n\t\"schema\" | \"semantics\" | \"relations\" | \"invariants\"\n>;\nexport type ModuleManifestActionV1 = Omit<\n\tModuleManifestAction,\n\t\"resultSchema\" | \"resultSchemaFormat\"\n>;\nexport type ModuleManifestV1 = Omit<\n\tModuleManifest,\n\t\"manifestVersion\" | \"objectTypes\" | \"actions\" | \"views\"\n> & {\n\tmanifestVersion: 1;\n\tobjectTypes: ModuleManifestObjectTypeV1[];\n\tactions: ModuleManifestActionV1[];\n};\nexport type ModuleManifestBundleV1 = Omit<ModuleManifestBundle, \"manifestVersion\" | \"modules\"> & {\n\tmanifestVersion: 1;\n\tmodules: ModuleManifestV1[];\n};\n\nexport function normalizeModuleManifest(\n\tmanifest: ModuleManifest | ModuleManifestV1,\n): ModuleManifest {\n\tconst version: number = manifest.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest version: ${String(version)}`);\n\t}\n\tconst views = \"views\" in manifest && Array.isArray(manifest.views) ? manifest.views : [];\n\t// Preserve the normalizer's legacy tolerance for absent/non-array fields.\n\tif (Array.isArray(manifest.actions))\n\t\tfor (const [index, action] of manifest.actions.entries())\n\t\t\tassertSurfaceDeclaration(action, `Module \"${manifest.namespace}\" action[${index}] \"${action?.actionId ?? \"unknown\"}\"`);\n\tfor (const [index, view] of views.entries())\n\t\tassertSurfaceDeclaration(view, `Module \"${manifest.namespace}\" view[${index}] \"${view?.name ?? \"unknown\"}\"`);\n\treturn {\n\t\t...manifest,\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tviews,\n\t};\n}\n\nexport function normalizeModuleManifestBundle(\n\tbundle: ModuleManifestBundle | ModuleManifestBundleV1,\n): ModuleManifestBundle {\n\tconst version: number = bundle.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest bundle version: ${String(version)}`);\n\t}\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: bundle.modules.map((manifest) => normalizeModuleManifest(manifest)),\n\t};\n}\n\n/**\n * A {@link SchemaValidator} that can also export its parameter schema as JSON\n * Schema (for example a Zod 4 schema via `z.toJSONSchema`). Keeps the platform\n * zero-dependency while letting schema-bearing actions flow into manifests.\n */\nexport interface JsonSchemaExportableValidator extends SchemaValidator {\n\ttoJSONSchema(): Record<string, unknown>;\n}\n\nexport function isJsonSchemaExportableValidator(\n\tschema: SchemaValidator,\n): schema is JsonSchemaExportableValidator {\n\treturn (\n\t\ttypeof (schema as Partial<JsonSchemaExportableValidator>).toJSONSchema === \"function\"\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction exportDependency(dependency: ModuleDependencyInput): ModuleDependency {\n\tconst namespace = getModuleDependencyNamespace(dependency);\n\tif (typeof dependency === \"string\") {\n\t\treturn { namespace };\n\t}\n\tconst normalized: ModuleDependency = { namespace };\n\tif (dependency.version !== undefined) normalized.version = dependency.version;\n\tif (dependency.optional !== undefined) normalized.optional = dependency.optional;\n\treturn normalized;\n}\n\nfunction exportObjectType(\n\tobjectType: NonNullable<FabricModule[\"objectTypes\"]>[number],\n): ModuleManifestObjectType {\n\tif (typeof objectType === \"string\") {\n\t\treturn { type: objectType };\n\t}\n\tconst normalized: ModuleManifestObjectType = { type: getObjectTypeName(objectType) };\n\tif (objectType.displayName !== undefined) normalized.displayName = objectType.displayName;\n\tif (objectType.idPrefix !== undefined) normalized.idPrefix = objectType.idPrefix;\n\tif (objectType.schema !== undefined) normalized.schema = cloneJson(objectType.schema);\n\tif (objectType.semantics !== undefined) normalized.semantics = cloneJson(objectType.semantics);\n\tif (objectType.relations !== undefined) {\n\t\tnormalized.relations = objectType.relations.map((relation) => ({ ...relation }));\n\t}\n\tif (objectType.invariants !== undefined) {\n\t\tnormalized.invariants = objectType.invariants.map((invariant) => ({ ...invariant }));\n\t}\n\treturn normalized;\n}\n\nfunction cloneJson<T>(value: T): T {\n\tif (Array.isArray(value)) return value.map((item) => cloneJson(item)) as T;\n\tif (value !== null && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>).map(([key, child]) => [key, cloneJson(child)]),\n\t\t) as T;\n\t}\n\treturn value;\n}\n\nfunction exportEventType(\n\teventType: NonNullable<FabricModule[\"eventTypes\"]>[number],\n): ModuleManifestEventType {\n\tif (typeof eventType === \"string\") {\n\t\t// String registrations carry no explicit schema version; the events\n\t\t// registry treats the bare name as the initial version of the type.\n\t\treturn { eventType, schemaVersion: 1 };\n\t}\n\tconst normalized: ModuleManifestEventType = {\n\t\teventType: getEventTypeName(eventType),\n\t\tschemaVersion: eventType.schemaVersion,\n\t};\n\tif (eventType.description !== undefined) normalized.description = eventType.description;\n\tif (eventType.schema !== undefined) normalized.schema = cloneJson(eventType.schema);\n\treturn normalized;\n}\n\nfunction exportAction(action: ActionDefinition): ModuleManifestAction {\n\tassertSurfaceDeclaration(action, `Action \"${action?.actionId ?? \"unknown\"}\"`);\n\tconst manifest: ModuleManifestAction = {\n\t\tactionId: action.actionId,\n\t\tversion: action.version,\n\t\tkind: action.kind ?? \"atomic\",\n\t\tidempotent: action.idempotent,\n\t\tmutatesDomain: action.mutatesDomain,\n\t\temitsEvents: [...action.emitsEvents],\n\t};\n\n\tif (action.surface !== undefined) manifest.surface = action.surface;\n\tif (action.surfaceReason !== undefined) manifest.surfaceReason = action.surfaceReason;\n\tif (action.policies !== undefined) manifest.policies = [...action.policies];\n\tif (action.requiredRoles !== undefined) manifest.requiredRoles = [...action.requiredRoles];\n\tif (action.requiredPermissions !== undefined) {\n\t\tmanifest.requiredPermissions = [...action.requiredPermissions];\n\t}\n\tif (action.eventPhase !== undefined) manifest.eventPhase = action.eventPhase;\n\tif (action.execution !== undefined) manifest.execution = cloneJson(action.execution);\n\n\tif (isJsonSchemaExportableValidator(action.schema)) {\n\t\ttry {\n\t\t\tmanifest.parameterSchema = action.schema.toJSONSchema();\n\t\t\tmanifest.parameterSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// Runtime-valid schemas that cannot be represented portably remain executable;\n\t\t\t// build-time consumers see the schema as unavailable rather than crashing export.\n\t\t}\n\t}\n\tif (action.resultSchema && isJsonSchemaExportableValidator(action.resultSchema)) {\n\t\ttry {\n\t\t\tmanifest.resultSchema = action.resultSchema.toJSONSchema();\n\t\t\tmanifest.resultSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// See parameter-schema behavior above.\n\t\t}\n\t}\n\n\tif (action.stateMachine !== undefined) {\n\t\tconst binding: ModuleManifestActionStateMachine = {\n\t\t\tentityType: action.stateMachine.entityType,\n\t\t};\n\t\tif (typeof action.stateMachine.targetState === \"string\") {\n\t\t\tbinding.targetState = action.stateMachine.targetState;\n\t\t}\n\t\tmanifest.stateMachine = binding;\n\t}\n\n\tif (action.adapterSteps !== undefined) {\n\t\tmanifest.adapterSteps = action.adapterSteps.map((step) => {\n\t\t\tconst exported: ModuleManifestAdapterStep = {\n\t\t\t\tadapterType: step.adapterType,\n\t\t\t\toperation: step.operation,\n\t\t\t};\n\t\t\tif (step.retryPolicy !== undefined) exported.retryPolicy = { ...step.retryPolicy };\n\t\t\treturn exported;\n\t\t});\n\t}\n\n\treturn manifest;\n}\n\nfunction exportPolicy(policy: unknown): ModuleManifestPolicy | undefined {\n\tif (!isRecord(policy) || typeof policy.policyId !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// Code evaluator: identified by its `evaluate` function (never serialized).\n\tif (typeof policy.evaluate === \"function\") {\n\t\tconst exported: ModuleManifestCodePolicy = {\n\t\t\ttype: \"code\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tversion: typeof policy.version === \"number\" ? policy.version : 1,\n\t\t};\n\t\tif (typeof policy.previewSafe === \"boolean\") exported.previewSafe = policy.previewSafe;\n\t\treturn exported;\n\t}\n\n\t// Declarative runtime policy definition: pure data, serialized as-is.\n\tif (typeof policy.kind === \"string\" && typeof policy.policyVersion === \"number\") {\n\t\tconst exported: ModuleManifestDataPolicy = {\n\t\t\ttype: \"data\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tpolicyVersion: policy.policyVersion,\n\t\t\tkind: policy.kind as PolicyKind,\n\t\t};\n\t\tif (isRecord(policy.dataDefinition)) {\n\t\t\texported.dataDefinition = policy.dataDefinition as unknown as DataPolicyDefinition;\n\t\t}\n\t\tif (typeof policy.codeEvaluatorPolicyId === \"string\") {\n\t\t\texported.codeEvaluatorPolicyId = policy.codeEvaluatorPolicyId;\n\t\t}\n\t\tif (isRecord(policy.fallback)) {\n\t\t\texported.fallback = policy.fallback as unknown as PolicyFallbackDefinition;\n\t\t}\n\t\treturn exported;\n\t}\n\n\t// Unknown policy shape: omit rather than guess.\n\treturn undefined;\n}\n\nfunction exportStateMachine(machine: unknown): ModuleManifestStateMachine | undefined {\n\tif (\n\t\t!isRecord(machine) ||\n\t\ttypeof machine.entityType !== \"string\" ||\n\t\t!isRecord(machine.states) ||\n\t\t!Array.isArray(machine.transitions)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst definition = machine as unknown as StateMachineDefinition;\n\treturn {\n\t\tentityType: definition.entityType,\n\t\tstates: Object.values(definition.states),\n\t\ttransitions: definition.transitions.map((transition) => ({\n\t\t\tfrom: transition.from,\n\t\t\tto: transition.to,\n\t\t\tcausedByAction: transition.causedByAction,\n\t\t\thasGuard: typeof transition.guard === \"function\",\n\t\t})),\n\t};\n}\n\nfunction exportView(view: ViewContract): ModuleManifestView {\n\tassertSurfaceDeclaration(view, `View \"${view?.name ?? \"unknown\"}\"`);\n\tconst output: ModuleManifestView = {\n\t\tname: view.name,\n\t\tversion: view.version,\n\t\tshape: cloneJson(view.shape),\n\t\tconsumes: view.consumes.map((consumption) => ({\n\t\t\teventType: consumption.eventType,\n\t\t\tschemaVersions: [...consumption.schemaVersions],\n\t\t})),\n\t\tscope: view.scope,\n\t\tsnapshotVersion: view.snapshotVersion,\n\t};\n\tif (view.surface !== undefined) output.surface = view.surface;\n\tif (view.surfaceReason !== undefined) output.surfaceReason = view.surfaceReason;\n\tif (view.parameterSchema !== undefined) output.parameterSchema = cloneJson(view.parameterSchema);\n\tif (view.compatibleSnapshotVersions) output.compatibleSnapshotVersions = [...view.compatibleSnapshotVersions];\n\tif (view.usage) output.usage = cloneJson(view.usage);\n\treturn output;\n}\n\n/**\n * Export a stable, JSON-serializable manifest of a module's ontology.\n *\n * This is a pure function of the module object: it does not read or mutate the\n * global module/action/policy/state-machine registries, and the module does\n * not need to be registered first. Declaration order is preserved everywhere\n * (nothing is sorted), so the same module object always produces a\n * byte-identical `JSON.stringify` result.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields are elided (`handler`,\n * policy `evaluate`, transition `guard` → `hasGuard`, dynamic `targetState`,\n * adapter `getInput`).\n */\nexport function exportModuleManifest(module: FabricModule<unknown>): ModuleManifest {\n\tconst manifest: ModuleManifest = {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tnamespace: module.namespace,\n\t\tdependencies: (module.dependencies ?? []).map(exportDependency),\n\t\tobjectTypes: (module.objectTypes ?? []).map(exportObjectType),\n\t\tsubjectTypes: [...(module.subjectTypes ?? [])],\n\t\tidPrefixes: (module.idPrefixes ?? []).map((registration) => ({\n\t\t\tprefix: registration.prefix,\n\t\t\tname: registration.name,\n\t\t})),\n\t\teventTypes: (module.eventTypes ?? []).map(exportEventType),\n\t\tactions: (module.actions ?? []).map(exportAction),\n\t\tpolicies: (module.policies ?? [])\n\t\t\t.map(exportPolicy)\n\t\t\t.filter((policy): policy is ModuleManifestPolicy => policy !== undefined),\n\t\tstateMachines: (module.stateMachines ?? [])\n\t\t\t.map(exportStateMachine)\n\t\t\t.filter((machine): machine is ModuleManifestStateMachine => machine !== undefined),\n\t\tviews: (module.views ?? []).map(exportView),\n\t};\n\n\tif (module.version !== undefined) manifest.version = module.version;\n\tif (module.displayName !== undefined) manifest.displayName = module.displayName;\n\tif (module.description !== undefined) manifest.description = module.description;\n\tif (module.capability !== undefined) manifest.capability = cloneJson(module.capability);\n\n\treturn manifest;\n}\n\n/**\n * Export manifests for a set of modules, preserving the input order.\n * Like {@link exportModuleManifest}, this is pure and registry-free.\n */\nexport function exportModuleManifestBundle(\n\tmodules: FabricModule<unknown>[],\n): ModuleManifestBundle {\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: modules.map(exportModuleManifest),\n\t};\n}\n"]}
@@ -252,6 +252,9 @@ function validateManifest(module, context = {}) {
252
252
  `Action "${action.actionId}" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`
253
253
  );
254
254
  }
255
+ if (action.admitSubmission !== void 0 && typeof action.admitSubmission !== "function") {
256
+ throw new Error(`Action "${action.actionId}" declares admitSubmission that is not a function.`);
257
+ }
255
258
  }
256
259
  const viewKeys = /* @__PURE__ */ new Set();
257
260
  for (const view of module.views ?? []) {
@@ -379,5 +382,5 @@ function registerFabricModule(module) {
379
382
  }
380
383
 
381
384
  export { createModuleRegistry, getEventTypeName, getModuleDependencyNamespace, getObjectTypeName, registerFabricModule, registerFabricModules, validateAndOrderFabricModules, validateModuleNamespace };
382
- //# sourceMappingURL=chunk-ZF5HDNSU.js.map
383
- //# sourceMappingURL=chunk-ZF5HDNSU.js.map
385
+ //# sourceMappingURL=chunk-WNZP53GI.js.map
386
+ //# sourceMappingURL=chunk-WNZP53GI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../modules/index.ts"],"names":[],"mappings":";;;;;;AAyLO,SAAS,6BAA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;AAC7E,EAAA,MAAM,oBAAoB,IAAI,GAAA;AAAA,IAC7B,OAAA,CAAQ,OAAA,CAAQ,CAAC,MAAA,KAAA,CAAY,MAAA,CAAO,cAAc,EAAC,EAAG,GAAA,CAAI,gBAAgB,CAAC;AAAA,GAC5E;AACA,EAAA,KAAA,MAAW,aAAa,2BAAA,EAA4B,CAAE,YAAW,EAAG,iBAAA,CAAkB,IAAI,SAAS,CAAA;AACnG,EAAA,MAAM,oBAAA,uBAA2B,GAAA,CAAI;AAAA,IACpC,GAAG,OAAA,CAAQ,OAAA;AAAA,MAAQ,CAAC,MAAA,KAAA,CAClB,MAAA,CAAO,WAAA,IAAe,EAAC,EAAG,GAAA,CAAI,CAAC,UAAA,KAAe,oBAAoB,MAAA,CAAO,SAAA,EAAW,iBAAA,CAAkB,UAAU,CAAC,CAAC;AAAA;AACpH,GACA,CAAA;AAED,EAAA,KAAA,MAAW,UAAU,OAAA,EAAS;AAC7B,IAAA,gBAAA,CAAiB,MAAA,EAAiC,EAAE,mBAAA,EAAqB,iBAAA,EAAmB,sBAAsB,CAAA;AAAA,EACnH;AACA,EAAA,sBAAA,CAAuB,OAAkC,CAAA;AACzD,EAAA,OAAO,wBAAwB,OAAkC,CAAA;AAClE;AAGO,SAAS,sBAAqC,OAAA,EAAmD;AACvG,EAAA,OAAO,8BAA8B,OAAO,CAAA;AAC7C;AAGO,SAAS,qBAAoC,MAAA,EAAiC;AACpF,EAAA,6BAAA,CAA8B,CAAC,MAAM,CAAC,CAAA;AACvC","file":"chunk-WNZP53GI.js","sourcesContent":["import { assertSurfaceDeclaration } from \"../discovery\";\nimport type { ActionDefinition } from \"../actions\";\nimport { createEventContractRegistry } from \"../events\";\nimport {\n\tassertPortableJsonSchema,\n\ttype JsonValue,\n\ttype PortableJsonSchema,\n} from \"../objects\";\nimport type { PolicyEvaluator, PolicyId } from \"../policies\";\nimport type { StateMachineDefinition } from \"../state-machines\";\nimport { viewContractKey, type ViewContract } from \"../projections\";\n\nexport interface ModuleDependency {\n\tnamespace: string;\n\tversion?: string;\n\toptional?: boolean;\n}\n\nexport type ModuleDependencyInput = string | ModuleDependency;\n\nexport interface IdPrefixRegistration {\n\tprefix: string;\n\tname: string;\n\tmodule: string;\n}\n\nexport interface EventTypeRegistration {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n\tschema?: PortableJsonSchema;\n}\n\nexport type EventTypeRegistrationInput = string | EventTypeRegistration;\n\nexport interface ObjectTypeRegistration {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tisCoreModuleType?: boolean;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport type ObjectRelationCardinality = \"one\" | \"many\";\nexport type ObjectRelationSemantics = \"reference\" | \"owned\";\nexport type ObjectRelationDeleteBehavior = \"restrict\" | \"cascade\" | \"set-null\";\n\nexport interface ObjectRelationDefinition {\n\tname: string;\n\ttarget: `${string}.${string}`;\n\tcardinality: ObjectRelationCardinality;\n\trequired?: boolean;\n\tsemantics: ObjectRelationSemantics;\n\tonTargetDelete: ObjectRelationDeleteBehavior;\n}\n\nexport type InvariantEnforcement =\n\t| \"json-schema\"\n\t| \"state-machine\"\n\t| \"policy\"\n\t| \"host-adapter\"\n\t| \"application\";\n\nexport interface DeclarativeInvariant {\n\tid: string;\n\tdescription: string;\n\trequired?: boolean;\n\tenforcement: InvariantEnforcement;\n\tenforcementRef?: string;\n}\n\nexport type ObjectTypeRegistrationInput = string | ObjectTypeRegistration;\n\nexport interface PolicyRegistration {\n\tid: string;\n\tversion?: string;\n\tdescription?: string;\n}\n\nexport interface StateMachineRegistration {\n\tentityType: string;\n\tstates: string[];\n}\n\nexport interface CapabilityPortRequirement {\n\tname: string;\n\tversion?: string;\n\tstandard?: { name: string; version?: string };\n}\n\nexport interface CapabilityRequirements {\n\tports?: CapabilityPortRequirement[];\n\tpermissions?: string[];\n\tentitlements?: string[];\n\tfeatureFlags?: string[];\n}\n\nexport interface CapabilityWorkflowTimer {\n\t/** Workflow-local identity of the deadline, for example \"right-to-cure\". */\n\tname: string;\n\t/** Configuration key the duration is resolved from when the workflow starts. */\n\tconfigKey: string;\n\tdescription?: string;\n}\n\nexport interface CapabilityWorkflowCompensation {\n\t/** Workflow step whose effect this reverses. */\n\tstep: string;\n\t/** Governed action that performs the reversal. Must belong to the declaring module. */\n\tactionId: `${string}.${string}`;\n}\n\n/**\n * A durable workflow this capability owns. Declaring it makes durability a\n * reviewable fact of the contract rather than a property of worker deployment:\n * the queue it runs on, the deadlines it carries, and what reverses each step\n * are all diffable.\n */\nexport interface CapabilityWorkflowDeclaration {\n\tname: string;\n\t/** Routing identity, conventionally `capability.vertical`. */\n\ttaskQueue: string;\n\t/** Event type whose arrival starts this workflow by choreography. */\n\tstartedBy?: string;\n\ttimers?: CapabilityWorkflowTimer[];\n\tcompensations?: CapabilityWorkflowCompensation[];\n}\n\nexport interface CapabilityMetadata {\n\tdisplayName: string;\n\tdescription: string;\n\tstability: \"experimental\" | \"beta\" | \"stable\" | \"deprecated\";\n\tdeprecated?: { since: string; replacement?: string; message: string };\n\trequirements?: CapabilityRequirements;\n\tcertification?: { profile: string; required: boolean };\n\t/** Durable workflows this capability owns, with their queues, deadlines and reversals. */\n\tworkflows?: CapabilityWorkflowDeclaration[];\n\t/** Namespaced declared data preserved by Platform and interpreted only by its owning package. */\n\textensions?: Record<string, JsonValue>;\n}\n\nexport interface FabricModule<TDb = unknown> {\n\tnamespace: string;\n\tversion?: string;\n\t/** Compiler manifest digest for exact runtime assembly verification. */\n\tmanifestDigest?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies?: ModuleDependencyInput[];\n\tobjectTypes?: ObjectTypeRegistrationInput[];\n\tsubjectTypes?: string[];\n\tidPrefixes?: IdPrefixRegistration[];\n\teventTypes?: EventTypeRegistrationInput[];\n\tactions?: ActionDefinition<TDb>[];\n\tpolicies?: unknown[];\n\tstateMachines?: unknown[];\n\tadapterDefinitions?: unknown[];\n\tpermissions?: unknown[];\n\troles?: unknown[];\n\tredactionRules?: unknown[];\n\tdataClassifications?: unknown[];\n\tretentionRules?: unknown[];\n\tevidenceRenderers?: unknown[];\n\tviews?: ViewContract[];\n}\n\nexport interface ModuleRegistry<TDb = unknown> {\n\tmodules: ReadonlyMap<string, FabricModule<TDb>>;\n\torderedModules: readonly FabricModule<TDb>[];\n\tresolveAction(actionId: `${string}.${string}`): ActionDefinition<TDb> | undefined;\n\tresolvePolicy(policyId: PolicyId): PolicyEvaluator | undefined;\n\tresolveStateMachine(entityType: string): StateMachineDefinition | undefined;\n\tresolveView(name: string, version: string): ViewContract | undefined;\n}\n\ninterface ModuleValidationContext {\n\tavailableNamespaces?: Set<string>;\n\tplannedEventTypes?: Set<string>;\n\tavailableObjectTypes?: Set<string>;\n}\n\nexport function getModuleDependencyNamespace(dependency: ModuleDependencyInput): string {\n\treturn typeof dependency === \"string\" ? dependency : dependency.namespace;\n}\n\nexport function getObjectTypeName(objectType: ObjectTypeRegistrationInput): string {\n\treturn typeof objectType === \"string\" ? objectType : objectType.type;\n}\n\nexport function getEventTypeName(eventType: EventTypeRegistrationInput): string {\n\treturn typeof eventType === \"string\" ? eventType : eventType.eventType;\n}\n\nexport function validateModuleNamespace(namespace: string): void {\n\tif (!namespace) {\n\t\tthrow new Error(\"Module namespace cannot be empty\");\n\t}\n\tif (!/^[a-z][a-z0-9-]*$/.test(namespace)) {\n\t\tthrow new Error(\n\t\t\t`Invalid module namespace: \"${namespace}\". Must be lowercase letters, numbers, and hyphens only.`,\n\t\t);\n\t}\n}\n\nexport function createModuleRegistry<TDb = unknown>(\n\tmodules: FabricModule<TDb>[] = [],\n): ModuleRegistry<TDb> {\n\tconst orderedModules = validateAndOrderFabricModules(modules);\n\tconst registered = new Map(orderedModules.map((module) => [module.namespace, module]));\n\tconst actions = new Map(orderedModules.flatMap((module) => (module.actions ?? []).map((action) => [action.actionId, action] as const)));\n\tconst policies = new Map(orderedModules.flatMap((module) => (module.policies ?? []).map((policy) => {\n\t\tconst evaluator = policy as PolicyEvaluator;\n\t\treturn [evaluator.policyId, evaluator] as const;\n\t})));\n\tconst machines = new Map(orderedModules.flatMap((module) => (module.stateMachines ?? []).map((machine) => {\n\t\tconst definition = machine as StateMachineDefinition;\n\t\treturn [definition.entityType, definition] as const;\n\t})));\n\tconst views = new Map(orderedModules.flatMap((module) => (module.views ?? []).map((view) => [viewContractKey(view), view] as const)));\n\treturn {\n\t\tmodules: registered,\n\t\torderedModules,\n\t\tresolveAction: (actionId) => actions.get(actionId),\n\t\tresolvePolicy: (policyId) => policies.get(policyId),\n\t\tresolveStateMachine: (entityType) => machines.get(entityType),\n\t\tresolveView: (name, version) => views.get(`${name}@${version}`),\n\t};\n}\n\nfunction validateIdentifierList(\n\tvalues: string[] | undefined,\n\tlabel: string,\n\tnamespace: string,\n): void {\n\tfor (const value of values ?? []) {\n\t\tif (!value) {\n\t\t\tthrow new Error(`Module \"${namespace}\" has an empty ${label} entry.`);\n\t\t}\n\t}\n}\n\nfunction assertJsonValue(value: unknown, path: string): asserts value is JsonValue {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return;\n\tif (typeof value === \"number\" && Number.isFinite(value)) return;\n\tif (Array.isArray(value)) {\n\t\tvalue.forEach((item, index) => assertJsonValue(item, `${path}[${index}]`));\n\t\treturn;\n\t}\n\tif (typeof value === \"object\") {\n\t\tfor (const [key, child] of Object.entries(value as Record<string, unknown>)) {\n\t\t\tassertJsonValue(child, `${path}.${key}`);\n\t\t}\n\t\treturn;\n\t}\n\tthrow new Error(`${path} must contain JSON-serializable values.`);\n}\n\nfunction qualifiedObjectType(namespace: string, type: string): string {\n\treturn `${namespace}.${type}`;\n}\n\nfunction validateObjectDefinition(\n\tobjectType: ObjectTypeRegistrationInput,\n\tnamespace: string,\n\tcontext: ModuleValidationContext,\n): void {\n\tif (typeof objectType === \"string\") return;\n\tif (objectType.schema !== undefined) {\n\t\tassertPortableJsonSchema(objectType.schema, `Module \"${namespace}\" object \"${objectType.type}\" schema`);\n\t}\n\tif (objectType.semantics !== undefined) {\n\t\tassertJsonValue(objectType.semantics, `Module \"${namespace}\" object \"${objectType.type}\" semantics`);\n\t}\n\tconst relationNames = new Set<string>();\n\tfor (const relation of objectType.relations ?? []) {\n\t\tif (!/^[a-z][a-zA-Z0-9]*$/.test(relation.name)) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has invalid relation name \"${relation.name}\".`);\n\t\t}\n\t\tif (relationNames.has(relation.name)) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has duplicate relation \"${relation.name}\".`);\n\t\t}\n\t\trelationNames.add(relation.name);\n\t\tif (!/^[a-z][a-z0-9-]*\\.[A-Z][a-zA-Z0-9]*$/.test(relation.target)) {\n\t\t\tthrow new Error(`Relation \"${relation.name}\" target \"${relation.target}\" must be module-qualified.`);\n\t\t}\n\t\tif (context.availableObjectTypes && !context.availableObjectTypes.has(relation.target)) {\n\t\t\tthrow new Error(`Relation \"${relation.name}\" targets missing object type \"${relation.target}\".`);\n\t\t}\n\t\tif (relation.required && relation.onTargetDelete === \"set-null\") {\n\t\t\tthrow new Error(`Required relation \"${relation.name}\" cannot use onTargetDelete \"set-null\".`);\n\t\t}\n\t}\n\tconst invariantIds = new Set<string>();\n\tfor (const invariant of objectType.invariants ?? []) {\n\t\tif (!invariant.id.trim() || !invariant.description.trim()) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has an invariant without an id or description.`);\n\t\t}\n\t\tif (invariantIds.has(invariant.id)) {\n\t\t\tthrow new Error(`Module \"${namespace}\" object \"${objectType.type}\" has duplicate invariant \"${invariant.id}\".`);\n\t\t}\n\t\tinvariantIds.add(invariant.id);\n\t\tif (invariant.required && !invariant.enforcementRef?.trim()) {\n\t\t\tthrow new Error(`Required invariant \"${invariant.id}\" must declare enforcementRef.`);\n\t\t}\n\t}\n}\n\nfunction validateCapabilityWorkflows(module: FabricModule<unknown>, context: ModuleValidationContext): void {\n\tconst workflows = module.capability?.workflows ?? [];\n\tconst actionsById = new Map((module.actions ?? []).map((action) => [action.actionId, action]));\n\tconst names = new Set<string>();\n\tfor (const workflow of workflows) {\n\t\tif (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(workflow.name)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" declares invalid workflow name \"${workflow.name}\".`);\n\t\t}\n\t\tif (names.has(workflow.name)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" declares duplicate workflow \"${workflow.name}\".`);\n\t\t}\n\t\tnames.add(workflow.name);\n\t\tif (!/^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*)*$/.test(workflow.taskQueue)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares invalid task queue \"${workflow.taskQueue}\".`);\n\t\t}\n\t\tif (workflow.startedBy !== undefined) {\n\t\t\tconst known = context.plannedEventTypes?.has(workflow.startedBy)\n\t\t\t\t?? (module.eventTypes ?? []).some((eventType) => getEventTypeName(eventType) === workflow.startedBy);\n\t\t\tif (!known) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" is started by unknown event type \"${workflow.startedBy}\".`);\n\t\t\t}\n\t\t}\n\t\tconst timerNames = new Set<string>();\n\t\tfor (const timer of workflow.timers ?? []) {\n\t\t\tif (!timer.name.trim() || !timer.configKey.trim()) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" has a timer without a name or configKey.`);\n\t\t\t}\n\t\t\tif (timerNames.has(timer.name)) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate timer \"${timer.name}\".`);\n\t\t\t}\n\t\t\ttimerNames.add(timer.name);\n\t\t}\n\t\tconst steps = new Set<string>();\n\t\tfor (const compensation of workflow.compensations ?? []) {\n\t\t\tif (!compensation.step.trim()) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" has a compensation without a step.`);\n\t\t\t}\n\t\t\tif (steps.has(compensation.step)) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" declares duplicate compensation for step \"${compensation.step}\".`);\n\t\t\t}\n\t\t\tsteps.add(compensation.step);\n\t\t\tconst compensatingAction = actionsById.get(compensation.actionId);\n\t\t\tif (!compensatingAction) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with unknown action \"${compensation.actionId}\".`);\n\t\t\t}\n\t\t\t// An unwind is retried like any other durable step, so a reversal that cannot be\n\t\t\t// safely repeated would turn one failure into a different kind of corruption.\n\t\t\tif (!compensatingAction.idempotent || compensatingAction.execution?.idempotency === \"prohibited\") {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" workflow \"${workflow.name}\" compensates step \"${compensation.step}\" with non-idempotent action \"${compensation.actionId}\"; a reversal must be safely repeatable.`);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction validateManifest(module: FabricModule<unknown>, context: ModuleValidationContext = {}): void {\n\tvalidateModuleNamespace(module.namespace);\n\n\tconst dependencies = (module.dependencies ?? []).map(getModuleDependencyNamespace);\n\tconst objectTypes = (module.objectTypes ?? []).map(getObjectTypeName);\n\tconst eventTypes = (module.eventTypes ?? []).map(getEventTypeName);\n\tif (module.capability) {\n\t\tif (!module.capability.displayName.trim() || !module.capability.description.trim()) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" capability requires displayName and description.`);\n\t\t}\n\t\tfor (const namespace of Object.keys(module.capability.extensions ?? {})) {\n\t\t\tif (!/^[a-z][a-z0-9.-]*\\.[a-z0-9.-]+\\/v[1-9][0-9]*$/.test(namespace)) {\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" capability has invalid extension namespace \"${namespace}\".`);\n\t\t\t}\n\t\t}\n\t\tfor (const port of module.capability.requirements?.ports ?? []) {\n\t\t\t// Dotted segments are permitted so a capability can require a port\n\t\t\t// defined outside this repository: an enterprise integrates hundreds\n\t\t\t// of external systems, and namespacing is what keeps two of them from\n\t\t\t// colliding on a name. Widening only, so existing names still parse.\n\t\t\tif (!/^[a-z][a-z0-9-]*(?:\\.[a-z0-9-]+)*$/.test(port.name)) throw new Error(`Module \"${module.namespace}\" capability has invalid port requirement \"${port.name}\".`);\n\t\t}\n\t\tvalidateCapabilityWorkflows(module, context);\n\t}\n\tfor (const eventType of module.eventTypes ?? []) if (typeof eventType !== \"string\" && eventType.schema) assertPortableJsonSchema(eventType.schema, `Event \"${eventType.eventType}\" schema`);\n\tfor (const action of module.actions ?? []) {\n\t\tif (action.execution?.idempotency === \"required\" && !action.idempotent) throw new Error(`Action \"${action.actionId}\" requires idempotency but is not declared idempotent.`);\n\t\tif (action.execution?.connectivity === \"offline-capturable\" && action.execution.idempotency === \"prohibited\") throw new Error(`Offline action \"${action.actionId}\" cannot prohibit idempotency.`);\n\t\tif (action.execution?.completionDeadlineMs !== undefined && !(typeof action.execution.completionDeadlineMs === \"number\" && action.execution.completionDeadlineMs > 0)) throw new Error(`Action \"${action.actionId}\" completionDeadlineMs must be a positive number of milliseconds.`);\n\t\tif (action.execution?.completion === \"immediate\" && action.execution.completionDeadlineMs !== undefined) throw new Error(`Immediate action \"${action.actionId}\" cannot declare a completion deadline; nothing external completes it.`);\n\t}\n\tfor (const view of module.views ?? []) if (view.usage?.collection?.filterSchema) assertPortableJsonSchema(view.usage.collection.filterSchema, `View \"${view.name}\" filter schema`);\n\n\tfor (const dependency of dependencies) {\n\t\tvalidateModuleNamespace(dependency);\n\t\tif (dependency === module.namespace) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" cannot depend on itself.`);\n\t\t}\n\t\tif (context.availableNamespaces && !context.availableNamespaces.has(dependency)) {\n\t\t\tthrow new Error(`Module \"${module.namespace}\" depends on missing module \"${dependency}\".`);\n\t\t}\n\t}\n\n\tvalidateIdentifierList(objectTypes, \"objectTypes\", module.namespace);\n\tvalidateIdentifierList(module.subjectTypes, \"subjectTypes\", module.namespace);\n\tvalidateIdentifierList(eventTypes, \"eventTypes\", module.namespace);\n\n\tfor (const objectType of objectTypes) {\n\t\tif (!/^[A-Z][a-zA-Z0-9]*$/.test(objectType)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid object type: \"${objectType}\". Object types must be PascalCase alphanumeric.`,\n\t\t\t);\n\t\t}\n\t}\n\tfor (const objectType of module.objectTypes ?? []) {\n\t\tif (typeof objectType !== \"string\") {\n\t\t\tfor (const relation of objectType.relations ?? []) {\n\t\t\t\tconst targetNamespace = relation.target.slice(0, relation.target.indexOf(\".\"));\n\t\t\t\tif (targetNamespace !== module.namespace && !dependencies.includes(targetNamespace)) {\n\t\t\t\t\tthrow new Error(`Module \"${module.namespace}\" relation \"${relation.name}\" targets module \"${targetNamespace}\" without declaring it as a dependency.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvalidateObjectDefinition(objectType, module.namespace, context);\n\t}\n\n\tfor (const action of module.actions ?? []) {\n\t\tassertSurfaceDeclaration(action, `Action \"${action?.actionId ?? \"unknown\"}\"`);\n\t\tlet parameterSchema: unknown;\n\t\ttry { parameterSchema = (action.schema as { toJSONSchema?: () => unknown }).toJSONSchema?.(); } catch { parameterSchema = undefined; }\n\t\tif (parameterSchema !== undefined) assertPortableJsonSchema(parameterSchema, `Action \"${action.actionId}\" parameters`);\n\t\tlet resultSchema: unknown;\n\t\ttry { resultSchema = (action.resultSchema as { toJSONSchema?: () => unknown } | undefined)?.toJSONSchema?.(); } catch { resultSchema = undefined; }\n\t\tif (resultSchema !== undefined) assertPortableJsonSchema(resultSchema, `Action \"${action.actionId}\" result`);\n\t\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(action.actionId)) {\n\t\t\tthrow new Error(`Invalid action ID: ${action.actionId}`);\n\t\t}\n\n\t\tif (action.namespace !== module.namespace) {\n\t\t\tthrow new Error(\n\t\t\t\t`Action \"${action.actionId}\" declares namespace \"${action.namespace}\" ` +\n\t\t\t\t\t`but is registered by module \"${module.namespace}\".`,\n\t\t\t);\n\t\t}\n\n\t\tif (!action.actionId.startsWith(`${module.namespace}.`)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Action \"${action.actionId}\" must start with module namespace \"${module.namespace}.\"`,\n\t\t\t);\n\t\t}\n\n\t\tif (action.mutatesDomain && action.emitsEvents.length === 0) {\n\t\t\tthrow new Error(\n\t\t\t\t`Action \"${action.actionId}\" mutates domain but emits no events. ` +\n\t\t\t\t\t`Every mutating action must emit at least one AssetEvent.`,\n\t\t\t);\n\t\t}\n\n\t\tif (action.admitSubmission !== undefined && typeof action.admitSubmission !== \"function\") {\n\t\t\tthrow new Error(`Action \"${action.actionId}\" declares admitSubmission that is not a function.`);\n\t\t}\n\t}\n\n\tconst viewKeys = new Set<string>();\n\tfor (const view of module.views ?? []) {\n\t\tassertSurfaceDeclaration(view, `View \"${view?.name ?? \"unknown\"}\"`);\n\t\tif (!view.name.startsWith(`${module.namespace}/`) || !/^[a-z][a-z0-9-]*\\/[a-z][a-z0-9/_-]*$/.test(view.name)) {\n\t\t\tthrow new Error(`View \"${view.name}\" must start with module namespace \"${module.namespace}/\" and use lowercase path segments.`);\n\t\t}\n\t\tif (!view.version.trim()) throw new Error(`View \"${view.name}\" must declare a version.`);\n\t\tconst key = `${view.name}@${view.version}`;\n\t\tif (viewKeys.has(key)) throw new Error(`Module \"${module.namespace}\" has duplicate view contract \"${key}\".`);\n\t\tviewKeys.add(key);\n\t\tassertPortableJsonSchema(view.shape, `View \"${key}\" shape`);\n\t\tif (view.parameterSchema !== undefined) assertPortableJsonSchema(view.parameterSchema, `View \"${key}\" parameters`);\n\t\tif (!Number.isInteger(view.snapshotVersion) || view.snapshotVersion < 1) {\n\t\t\tthrow new Error(`View \"${key}\" snapshotVersion must be a positive integer.`);\n\t\t}\n\t\tif ((view.compatibleSnapshotVersions?.some((version) => version !== view.snapshotVersion) ?? false) && !view.upgradeSnapshot) {\n\t\t\tthrow new Error(`View \"${key}\" declares older compatible snapshots but no upgradeSnapshot function.`);\n\t\t}\n\t\tfor (const consumption of view.consumes) {\n\t\t\tconst isPlanned = context.plannedEventTypes?.has(consumption.eventType) ?? false;\n\t\t\tconst isModuleEvent = eventTypes.includes(consumption.eventType);\n\t\t\tif (!isPlanned && !isModuleEvent) {\n\t\t\t\tthrow new Error(`View \"${key}\" consumes unknown event type \"${consumption.eventType}\".`);\n\t\t\t}\n\t\t\tif (consumption.schemaVersions.length === 0 || consumption.schemaVersions.some((version) => !Number.isInteger(version) || version < 1)) {\n\t\t\t\tthrow new Error(`View \"${key}\" must declare positive consumed schema versions for \"${consumption.eventType}\".`);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction sortModulesByDependency(\n\tmodules: FabricModule<unknown>[],\n\tregisteredNamespaces: ReadonlySet<string> = new Set(),\n): FabricModule<unknown>[] {\n\tconst modulesByNamespace = new Map<string, FabricModule<unknown>>();\n\n\tfor (const module of modules) {\n\t\tvalidateModuleNamespace(module.namespace);\n\t\tif (modulesByNamespace.has(module.namespace)) {\n\t\t\tthrow new Error(`Duplicate FabricModule namespace \"${module.namespace}\".`);\n\t\t}\n\t\tmodulesByNamespace.set(module.namespace, module);\n\t}\n\n\tconst sorted: FabricModule<unknown>[] = [];\n\tconst visiting = new Set<string>();\n\tconst visited = new Set<string>();\n\n\tfunction visit(module: FabricModule<unknown>, path: string[]): void {\n\t\tif (visited.has(module.namespace)) {\n\t\t\treturn;\n\t\t}\n\t\tif (visiting.has(module.namespace)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cyclic Fabric module dependency detected: ${[...path, module.namespace].join(\" -> \")}`,\n\t\t\t);\n\t\t}\n\n\t\tvisiting.add(module.namespace);\n\t\tfor (const dependency of (module.dependencies ?? []).map(getModuleDependencyNamespace)) {\n\t\t\tconst dependencyModule = modulesByNamespace.get(dependency);\n\t\t\tif (!dependencyModule) {\n\t\t\t\tif (registeredNamespaces.has(dependency)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow new Error(`Module \"${module.namespace}\" depends on missing module \"${dependency}\".`);\n\t\t\t}\n\t\t\tvisit(dependencyModule, [...path, module.namespace]);\n\t\t}\n\t\tvisiting.delete(module.namespace);\n\t\tvisited.add(module.namespace);\n\t\tsorted.push(module);\n\t}\n\n\tfor (const module of modules) {\n\t\tvisit(module, []);\n\t}\n\n\treturn sorted;\n}\n\nfunction assertAcyclicRelations(modules: FabricModule<unknown>[]): void {\n\tconst relationKinds = [\n\t\t{ label: \"owned containment\", include: (relation: ObjectRelationDefinition) => relation.semantics === \"owned\" },\n\t\t{ label: \"cascade-delete\", include: (relation: ObjectRelationDefinition) => relation.onTargetDelete === \"cascade\" },\n\t\t{ label: \"required-construction\", include: (relation: ObjectRelationDefinition) => relation.required === true },\n\t];\n\tfor (const kind of relationKinds) {\n\t\tconst edges = new Map<string, string[]>();\n\t\tfor (const module of modules) {\n\t\t\tfor (const objectType of module.objectTypes ?? []) {\n\t\t\t\tif (typeof objectType === \"string\") continue;\n\t\t\t\tconst source = qualifiedObjectType(module.namespace, objectType.type);\n\t\t\t\tedges.set(source, (objectType.relations ?? []).filter(kind.include).map((relation) => relation.target));\n\t\t\t}\n\t\t}\n\t\tconst visiting = new Set<string>();\n\t\tconst visited = new Set<string>();\n\t\tconst visit = (node: string, path: string[]): void => {\n\t\t\tif (visiting.has(node)) {\n\t\t\t\tthrow new Error(`${kind.label} relation cycle detected: ${[...path, node].join(\" -> \")}`);\n\t\t\t}\n\t\t\tif (visited.has(node)) return;\n\t\t\tvisiting.add(node);\n\t\t\tfor (const target of edges.get(node) ?? []) visit(target, [...path, node]);\n\t\t\tvisiting.delete(node);\n\t\t\tvisited.add(node);\n\t\t};\n\t\tfor (const node of edges.keys()) visit(node, []);\n\t}\n}\n\nexport function validateAndOrderFabricModules<TDb = unknown>(modules: FabricModule<TDb>[]): FabricModule<TDb>[] {\n\tconst availableNamespaces = new Set(modules.map((module) => module.namespace));\n\tconst plannedEventTypes = new Set(\n\t\tmodules.flatMap((module) => (module.eventTypes ?? []).map(getEventTypeName)),\n\t);\n\tfor (const eventType of createEventContractRegistry().eventTypes()) plannedEventTypes.add(eventType);\n\tconst availableObjectTypes = new Set([\n\t\t...modules.flatMap((module) =>\n\t\t\t(module.objectTypes ?? []).map((objectType) => qualifiedObjectType(module.namespace, getObjectTypeName(objectType))),\n\t\t),\n\t]);\n\n\tfor (const module of modules) {\n\t\tvalidateManifest(module as FabricModule<unknown>, { availableNamespaces, plannedEventTypes, availableObjectTypes });\n\t}\n\tassertAcyclicRelations(modules as FabricModule<unknown>[]);\n\treturn sortModulesByDependency(modules as FabricModule<unknown>[]) as FabricModule<TDb>[];\n}\n\n/** @deprecated Use createModuleRegistry(); registration is now explicit and instance-scoped. */\nexport function registerFabricModules<TDb = unknown>(modules: FabricModule<TDb>[]): FabricModule<TDb>[] {\n\treturn validateAndOrderFabricModules(modules);\n}\n\n/** @deprecated Use createModuleRegistry([module]); registration is now explicit and instance-scoped. */\nexport function registerFabricModule<TDb = unknown>(module: FabricModule<TDb>): void {\n\tvalidateAndOrderFabricModules([module]);\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkTMMP4U2D_cjs = require('./chunk-TMMP4U2D.cjs');
3
+ var chunkDBTAUI6C_cjs = require('./chunk-DBTAUI6C.cjs');
4
4
  var chunkD4SWRBUH_cjs = require('./chunk-D4SWRBUH.cjs');
5
5
 
6
6
  // manifest/index.ts
@@ -39,7 +39,7 @@ function isRecord(value) {
39
39
  return value !== null && typeof value === "object" && !Array.isArray(value);
40
40
  }
41
41
  function exportDependency(dependency) {
42
- const namespace = chunkTMMP4U2D_cjs.getModuleDependencyNamespace(dependency);
42
+ const namespace = chunkDBTAUI6C_cjs.getModuleDependencyNamespace(dependency);
43
43
  if (typeof dependency === "string") {
44
44
  return { namespace };
45
45
  }
@@ -52,7 +52,7 @@ function exportObjectType(objectType) {
52
52
  if (typeof objectType === "string") {
53
53
  return { type: objectType };
54
54
  }
55
- const normalized = { type: chunkTMMP4U2D_cjs.getObjectTypeName(objectType) };
55
+ const normalized = { type: chunkDBTAUI6C_cjs.getObjectTypeName(objectType) };
56
56
  if (objectType.displayName !== void 0) normalized.displayName = objectType.displayName;
57
57
  if (objectType.idPrefix !== void 0) normalized.idPrefix = objectType.idPrefix;
58
58
  if (objectType.schema !== void 0) normalized.schema = cloneJson(objectType.schema);
@@ -79,7 +79,7 @@ function exportEventType(eventType) {
79
79
  return { eventType, schemaVersion: 1 };
80
80
  }
81
81
  const normalized = {
82
- eventType: chunkTMMP4U2D_cjs.getEventTypeName(eventType),
82
+ eventType: chunkDBTAUI6C_cjs.getEventTypeName(eventType),
83
83
  schemaVersion: eventType.schemaVersion
84
84
  };
85
85
  if (eventType.description !== void 0) normalized.description = eventType.description;
@@ -245,5 +245,5 @@ exports.exportModuleManifestBundle = exportModuleManifestBundle;
245
245
  exports.isJsonSchemaExportableValidator = isJsonSchemaExportableValidator;
246
246
  exports.normalizeModuleManifest = normalizeModuleManifest;
247
247
  exports.normalizeModuleManifestBundle = normalizeModuleManifestBundle;
248
- //# sourceMappingURL=chunk-2URHPZXL.cjs.map
249
- //# sourceMappingURL=chunk-2URHPZXL.cjs.map
248
+ //# sourceMappingURL=chunk-WQ3BYI7T.cjs.map
249
+ //# sourceMappingURL=chunk-WQ3BYI7T.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../manifest/index.ts"],"names":["assertSurfaceDeclaration","getModuleDependencyNamespace","getObjectTypeName","getEventTypeName"],"mappings":";;;;;;AA+BO,IAAM,uBAAA,GAA0B;AAkKhC,SAAS,wBACf,QAAA,EACiB;AACjB,EAAA,MAAM,UAAkB,QAAA,CAAS,eAAA;AACjC,EAAA,IAAI,OAAA,KAAY,CAAA,IAAK,OAAA,KAAY,uBAAA,E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ery\";\nimport type {\n\tActionExecutionContract,\n\tActionDefinition,\n\tAdapterStepRetryPolicy,\n\tSchemaValidator,\n} from \"../actions\";\nimport {\n\tgetEventTypeName,\n\tgetModuleDependencyNamespace,\n\tgetObjectTypeName,\n\ttype FabricModule,\n\ttype CapabilityMetadata,\n\ttype DeclarativeInvariant,\n\ttype ModuleDependency,\n\ttype ModuleDependencyInput,\n\ttype ObjectRelationDefinition,\n} from \"../modules\";\nimport type { JsonValue, PortableJsonSchema } from \"../objects\";\nimport type {\n\tDataPolicyDefinition,\n\tPolicyFallbackDefinition,\n\tPolicyKind,\n} from \"../policies\";\nimport type { StateDefinition, StateMachineDefinition } from \"../state-machines\";\nimport type { ViewContract } from \"../projections\";\n\n/**\n * Version of the module manifest contract. Bump when the serialized shape\n * changes in a way consumers must detect.\n */\nexport const MODULE_MANIFEST_VERSION = 2 as const;\n\nexport interface ModuleManifestObjectType {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport interface ModuleManifestIdPrefix {\n\tprefix: string;\n\tname: string;\n}\n\nexport interface ModuleManifestEventType {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n\tschema?: PortableJsonSchema;\n}\n\nexport interface ModuleManifestActionStateMachine {\n\tentityType: string;\n\t/** Present only when the binding declares a static target state. */\n\ttargetState?: string;\n}\n\nexport interface ModuleManifestAdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n}\n\nexport interface ModuleManifestAction extends SurfaceDeclaration {\n\tactionId: string;\n\tversion: number;\n\tkind: \"atomic\" | \"saga\";\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\temitsEvents: string[];\n\tpolicies?: string[];\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\texecution?: ActionExecutionContract;\n\t/**\n\t * JSON Schema for the action parameters, present only when the action's\n\t * `schema` validator implements {@link JsonSchemaExportableValidator}.\n\t */\n\tparameterSchema?: unknown;\n\tparameterSchemaFormat?: \"json-schema\";\n\tresultSchema?: unknown;\n\tresultSchemaFormat?: \"json-schema\";\n\tstateMachine?: ModuleManifestActionStateMachine;\n\tadapterSteps?: ModuleManifestAdapterStep[];\n}\n\nexport interface ModuleManifestCodePolicy {\n\ttype: \"code\";\n\tpolicyId: string;\n\tversion: number;\n\tpreviewSafe?: boolean;\n}\n\nexport interface ModuleManifestDataPolicy {\n\ttype: \"data\";\n\tpolicyId: string;\n\tpolicyVersion: number;\n\tkind: PolicyKind;\n\tdataDefinition?: DataPolicyDefinition;\n\tcodeEvaluatorPolicyId?: string;\n\tfallback?: PolicyFallbackDefinition;\n}\n\nexport type ModuleManifestPolicy = ModuleManifestCodePolicy | ModuleManifestDataPolicy;\n\nexport interface ModuleManifestStateMachineTransition {\n\tfrom: string;\n\tto: string;\n\tcausedByAction: string;\n\t/** `true` when the transition declares a guard function. The guard itself is never serialized. */\n\thasGuard: boolean;\n}\n\nexport interface ModuleManifestStateMachine {\n\tentityType: string;\n\t/** States in declaration order (`Object.values` order of the definition record). */\n\tstates: StateDefinition[];\n\ttransitions: ModuleManifestStateMachineTransition[];\n}\n\nexport interface ModuleManifestView extends SurfaceDeclaration {\n\tname: string;\n\tversion: string;\n\tshape: PortableJsonSchema;\n\tparameterSchema?: PortableJsonSchema;\n\tconsumes: Array<{ eventType: string; schemaVersions: number[] }>;\n\tscope: \"tenant-space\";\n\tsnapshotVersion: number;\n\tcompatibleSnapshotVersions?: number[];\n\tusage?: ViewContract[\"usage\"];\n}\n\n/**\n * Stable, JSON-serializable description of a {@link FabricModule}'s ontology:\n * object types, subject types, id prefixes, event types, actions, policies,\n * and state machines. Intended for downstream tooling (semantics exporters,\n * docs generators, tool generators) that cannot consume live module code.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields (`handler`, `evaluate`, `guard`,\n * dynamic `targetState`, adapter `getInput`) are never serialized.\n */\nexport interface ModuleManifest {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\tnamespace: string;\n\tversion?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies: ModuleDependency[];\n\tobjectTypes: ModuleManifestObjectType[];\n\tsubjectTypes: string[];\n\tidPrefixes: ModuleManifestIdPrefix[];\n\teventTypes: ModuleManifestEventType[];\n\tactions: ModuleManifestAction[];\n\tpolicies: ModuleManifestPolicy[];\n\tstateMachines: ModuleManifestStateMachine[];\n\tviews: ModuleManifestView[];\n}\n\nexport interface ModuleManifestBundle {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\t/** Manifests in the input module order. */\n\tmodules: ModuleManifest[];\n}\n\n/** Manifest v1 remains accepted by v2 readers; missing v2 fields normalize to absence. */\nexport type ModuleManifestObjectTypeV1 = Omit<\n\tModuleManifestObjectType,\n\t\"schema\" | \"semantics\" | \"relations\" | \"invariants\"\n>;\nexport type ModuleManifestActionV1 = Omit<\n\tModuleManifestAction,\n\t\"resultSchema\" | \"resultSchemaFormat\"\n>;\nexport type ModuleManifestV1 = Omit<\n\tModuleManifest,\n\t\"manifestVersion\" | \"objectTypes\" | \"actions\" | \"views\"\n> & {\n\tmanifestVersion: 1;\n\tobjectTypes: ModuleManifestObjectTypeV1[];\n\tactions: ModuleManifestActionV1[];\n};\nexport type ModuleManifestBundleV1 = Omit<ModuleManifestBundle, \"manifestVersion\" | \"modules\"> & {\n\tmanifestVersion: 1;\n\tmodules: ModuleManifestV1[];\n};\n\nexport function normalizeModuleManifest(\n\tmanifest: ModuleManifest | ModuleManifestV1,\n): ModuleManifest {\n\tconst version: number = manifest.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest version: ${String(version)}`);\n\t}\n\tconst views = \"views\" in manifest && Array.isArray(manifest.views) ? manifest.views : [];\n\t// Preserve the normalizer's legacy tolerance for absent/non-array fields.\n\tif (Array.isArray(manifest.actions))\n\t\tfor (const [index, action] of manifest.actions.entries())\n\t\t\tassertSurfaceDeclaration(action, `Module \"${manifest.namespace}\" action[${index}] \"${action?.actionId ?? \"unknown\"}\"`);\n\tfor (const [index, view] of views.entries())\n\t\tassertSurfaceDeclaration(view, `Module \"${manifest.namespace}\" view[${index}] \"${view?.name ?? \"unknown\"}\"`);\n\treturn {\n\t\t...manifest,\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tviews,\n\t};\n}\n\nexport function normalizeModuleManifestBundle(\n\tbundle: ModuleManifestBundle | ModuleManifestBundleV1,\n): ModuleManifestBundle {\n\tconst version: number = bundle.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest bundle version: ${String(version)}`);\n\t}\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: bundle.modules.map((manifest) => normalizeModuleManifest(manifest)),\n\t};\n}\n\n/**\n * A {@link SchemaValidator} that can also export its parameter schema as JSON\n * Schema (for example a Zod 4 schema via `z.toJSONSchema`). Keeps the platform\n * zero-dependency while letting schema-bearing actions flow into manifests.\n */\nexport interface JsonSchemaExportableValidator extends SchemaValidator {\n\ttoJSONSchema(): Record<string, unknown>;\n}\n\nexport function isJsonSchemaExportableValidator(\n\tschema: SchemaValidator,\n): schema is JsonSchemaExportableValidator {\n\treturn (\n\t\ttypeof (schema as Partial<JsonSchemaExportableValidator>).toJSONSchema === \"function\"\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction exportDependency(dependency: ModuleDependencyInput): ModuleDependency {\n\tconst namespace = getModuleDependencyNamespace(dependency);\n\tif (typeof dependency === \"string\") {\n\t\treturn { namespace };\n\t}\n\tconst normalized: ModuleDependency = { namespace };\n\tif (dependency.version !== undefined) normalized.version = dependency.version;\n\tif (dependency.optional !== undefined) normalized.optional = dependency.optional;\n\treturn normalized;\n}\n\nfunction exportObjectType(\n\tobjectType: NonNullable<FabricModule[\"objectTypes\"]>[number],\n): ModuleManifestObjectType {\n\tif (typeof objectType === \"string\") {\n\t\treturn { type: objectType };\n\t}\n\tconst normalized: ModuleManifestObjectType = { type: getObjectTypeName(objectType) };\n\tif (objectType.displayName !== undefined) normalized.displayName = objectType.displayName;\n\tif (objectType.idPrefix !== undefined) normalized.idPrefix = objectType.idPrefix;\n\tif (objectType.schema !== undefined) normalized.schema = cloneJson(objectType.schema);\n\tif (objectType.semantics !== undefined) normalized.semantics = cloneJson(objectType.semantics);\n\tif (objectType.relations !== undefined) {\n\t\tnormalized.relations = objectType.relations.map((relation) => ({ ...relation }));\n\t}\n\tif (objectType.invariants !== undefined) {\n\t\tnormalized.invariants = objectType.invariants.map((invariant) => ({ ...invariant }));\n\t}\n\treturn normalized;\n}\n\nfunction cloneJson<T>(value: T): T {\n\tif (Array.isArray(value)) return value.map((item) => cloneJson(item)) as T;\n\tif (value !== null && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>).map(([key, child]) => [key, cloneJson(child)]),\n\t\t) as T;\n\t}\n\treturn value;\n}\n\nfunction exportEventType(\n\teventType: NonNullable<FabricModule[\"eventTypes\"]>[number],\n): ModuleManifestEventType {\n\tif (typeof eventType === \"string\") {\n\t\t// String registrations carry no explicit schema version; the events\n\t\t// registry treats the bare name as the initial version of the type.\n\t\treturn { eventType, schemaVersion: 1 };\n\t}\n\tconst normalized: ModuleManifestEventType = {\n\t\teventType: getEventTypeName(eventType),\n\t\tschemaVersion: eventType.schemaVersion,\n\t};\n\tif (eventType.description !== undefined) normalized.description = eventType.description;\n\tif (eventType.schema !== undefined) normalized.schema = cloneJson(eventType.schema);\n\treturn normalized;\n}\n\nfunction exportAction(action: ActionDefinition): ModuleManifestAction {\n\tassertSurfaceDeclaration(action, `Action \"${action?.actionId ?? \"unknown\"}\"`);\n\tconst manifest: ModuleManifestAction = {\n\t\tactionId: action.actionId,\n\t\tversion: action.version,\n\t\tkind: action.kind ?? \"atomic\",\n\t\tidempotent: action.idempotent,\n\t\tmutatesDomain: action.mutatesDomain,\n\t\temitsEvents: [...action.emitsEvents],\n\t};\n\n\tif (action.surface !== undefined) manifest.surface = action.surface;\n\tif (action.surfaceReason !== undefined) manifest.surfaceReason = action.surfaceReason;\n\tif (action.policies !== undefined) manifest.policies = [...action.policies];\n\tif (action.requiredRoles !== undefined) manifest.requiredRoles = [...action.requiredRoles];\n\tif (action.requiredPermissions !== undefined) {\n\t\tmanifest.requiredPermissions = [...action.requiredPermissions];\n\t}\n\tif (action.eventPhase !== undefined) manifest.eventPhase = action.eventPhase;\n\tif (action.execution !== undefined) manifest.execution = cloneJson(action.execution);\n\n\tif (isJsonSchemaExportableValidator(action.schema)) {\n\t\ttry {\n\t\t\tmanifest.parameterSchema = action.schema.toJSONSchema();\n\t\t\tmanifest.parameterSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// Runtime-valid schemas that cannot be represented portably remain executable;\n\t\t\t// build-time consumers see the schema as unavailable rather than crashing export.\n\t\t}\n\t}\n\tif (action.resultSchema && isJsonSchemaExportableValidator(action.resultSchema)) {\n\t\ttry {\n\t\t\tmanifest.resultSchema = action.resultSchema.toJSONSchema();\n\t\t\tmanifest.resultSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// See parameter-schema behavior above.\n\t\t}\n\t}\n\n\tif (action.stateMachine !== undefined) {\n\t\tconst binding: ModuleManifestActionStateMachine = {\n\t\t\tentityType: action.stateMachine.entityType,\n\t\t};\n\t\tif (typeof action.stateMachine.targetState === \"string\") {\n\t\t\tbinding.targetState = action.stateMachine.targetState;\n\t\t}\n\t\tmanifest.stateMachine = binding;\n\t}\n\n\tif (action.adapterSteps !== undefined) {\n\t\tmanifest.adapterSteps = action.adapterSteps.map((step) => {\n\t\t\tconst exported: ModuleManifestAdapterStep = {\n\t\t\t\tadapterType: step.adapterType,\n\t\t\t\toperation: step.operation,\n\t\t\t};\n\t\t\tif (step.retryPolicy !== undefined) exported.retryPolicy = { ...step.retryPolicy };\n\t\t\treturn exported;\n\t\t});\n\t}\n\n\treturn manifest;\n}\n\nfunction exportPolicy(policy: unknown): ModuleManifestPolicy | undefined {\n\tif (!isRecord(policy) || typeof policy.policyId !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// Code evaluator: identified by its `evaluate` function (never serialized).\n\tif (typeof policy.evaluate === \"function\") {\n\t\tconst exported: ModuleManifestCodePolicy = {\n\t\t\ttype: \"code\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tversion: typeof policy.version === \"number\" ? policy.version : 1,\n\t\t};\n\t\tif (typeof policy.previewSafe === \"boolean\") exported.previewSafe = policy.previewSafe;\n\t\treturn exported;\n\t}\n\n\t// Declarative runtime policy definition: pure data, serialized as-is.\n\tif (typeof policy.kind === \"string\" && typeof policy.policyVersion === \"number\") {\n\t\tconst exported: ModuleManifestDataPolicy = {\n\t\t\ttype: \"data\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tpolicyVersion: policy.policyVersion,\n\t\t\tkind: policy.kind as PolicyKind,\n\t\t};\n\t\tif (isRecord(policy.dataDefinition)) {\n\t\t\texported.dataDefinition = policy.dataDefinition as unknown as DataPolicyDefinition;\n\t\t}\n\t\tif (typeof policy.codeEvaluatorPolicyId === \"string\") {\n\t\t\texported.codeEvaluatorPolicyId = policy.codeEvaluatorPolicyId;\n\t\t}\n\t\tif (isRecord(policy.fallback)) {\n\t\t\texported.fallback = policy.fallback as unknown as PolicyFallbackDefinition;\n\t\t}\n\t\treturn exported;\n\t}\n\n\t// Unknown policy shape: omit rather than guess.\n\treturn undefined;\n}\n\nfunction exportStateMachine(machine: unknown): ModuleManifestStateMachine | undefined {\n\tif (\n\t\t!isRecord(machine) ||\n\t\ttypeof machine.entityType !== \"string\" ||\n\t\t!isRecord(machine.states) ||\n\t\t!Array.isArray(machine.transitions)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst definition = machine as unknown as StateMachineDefinition;\n\treturn {\n\t\tentityType: definition.entityType,\n\t\tstates: Object.values(definition.states),\n\t\ttransitions: definition.transitions.map((transition) => ({\n\t\t\tfrom: transition.from,\n\t\t\tto: transition.to,\n\t\t\tcausedByAction: transition.causedByAction,\n\t\t\thasGuard: typeof transition.guard === \"function\",\n\t\t})),\n\t};\n}\n\nfunction exportView(view: ViewContract): ModuleManifestView {\n\tassertSurfaceDeclaration(view, `View \"${view?.name ?? \"unknown\"}\"`);\n\tconst output: ModuleManifestView = {\n\t\tname: view.name,\n\t\tversion: view.version,\n\t\tshape: cloneJson(view.shape),\n\t\tconsumes: view.consumes.map((consumption) => ({\n\t\t\teventType: consumption.eventType,\n\t\t\tschemaVersions: [...consumption.schemaVersions],\n\t\t})),\n\t\tscope: view.scope,\n\t\tsnapshotVersion: view.snapshotVersion,\n\t};\n\tif (view.surface !== undefined) output.surface = view.surface;\n\tif (view.surfaceReason !== undefined) output.surfaceReason = view.surfaceReason;\n\tif (view.parameterSchema !== undefined) output.parameterSchema = cloneJson(view.parameterSchema);\n\tif (view.compatibleSnapshotVersions) output.compatibleSnapshotVersions = [...view.compatibleSnapshotVersions];\n\tif (view.usage) output.usage = cloneJson(view.usage);\n\treturn output;\n}\n\n/**\n * Export a stable, JSON-serializable manifest of a module's ontology.\n *\n * This is a pure function of the module object: it does not read or mutate the\n * global module/action/policy/state-machine registries, and the module does\n * not need to be registered first. Declaration order is preserved everywhere\n * (nothing is sorted), so the same module object always produces a\n * byte-identical `JSON.stringify` result.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields are elided (`handler`,\n * policy `evaluate`, transition `guard` → `hasGuard`, dynamic `targetState`,\n * adapter `getInput`).\n */\nexport function exportModuleManifest(module: FabricModule<unknown>): ModuleManifest {\n\tconst manifest: ModuleManifest = {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tnamespace: module.namespace,\n\t\tdependencies: (module.dependencies ?? []).map(exportDependency),\n\t\tobjectTypes: (module.objectTypes ?? []).map(exportObjectType),\n\t\tsubjectTypes: [...(module.subjectTypes ?? [])],\n\t\tidPrefixes: (module.idPrefixes ?? []).map((registration) => ({\n\t\t\tprefix: registration.prefix,\n\t\t\tname: registration.name,\n\t\t})),\n\t\teventTypes: (module.eventTypes ?? []).map(exportEventType),\n\t\tactions: (module.actions ?? []).map(exportAction),\n\t\tpolicies: (module.policies ?? [])\n\t\t\t.map(exportPolicy)\n\t\t\t.filter((policy): policy is ModuleManifestPolicy => policy !== undefined),\n\t\tstateMachines: (module.stateMachines ?? [])\n\t\t\t.map(exportStateMachine)\n\t\t\t.filter((machine): machine is ModuleManifestStateMachine => machine !== undefined),\n\t\tviews: (module.views ?? []).map(exportView),\n\t};\n\n\tif (module.version !== undefined) manifest.version = module.version;\n\tif (module.displayName !== undefined) manifest.displayName = module.displayName;\n\tif (module.description !== undefined) manifest.description = module.description;\n\tif (module.capability !== undefined) manifest.capability = cloneJson(module.capability);\n\n\treturn manifest;\n}\n\n/**\n * Export manifests for a set of modules, preserving the input order.\n * Like {@link exportModuleManifest}, this is pure and registry-free.\n */\nexport function exportModuleManifestBundle(\n\tmodules: FabricModule<unknown>[],\n): ModuleManifestBundle {\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: modules.map(exportModuleManifest),\n\t};\n}\n"]}
1
+ {"version":3,"sources":["../manifest/index.ts"],"names":["assertSurfaceDeclaration","getModuleDependencyNamespace","getObjectTypeName","getEventTypeName"],"mappings":";;;;;;AA+BO,IAAM,uBAAA,GAA0B;AAkKhC,SAAS,wBACf,QAAA,EACiB;AACjB,EAAA,MAAM,UAAkB,QAAA,CAAS,eAAA;AACjC,EAAA,IAAI,OAAA,KAAY,CAAA,IAAK,OAAA,KAAY,uB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} from \"../discovery\";\nimport type {\n\tActionExecutionContract,\n\tActionDefinition,\n\tAdapterStepRetryPolicy,\n\tSchemaValidator,\n} from \"../actions\";\nimport {\n\tgetEventTypeName,\n\tgetModuleDependencyNamespace,\n\tgetObjectTypeName,\n\ttype FabricModule,\n\ttype CapabilityMetadata,\n\ttype DeclarativeInvariant,\n\ttype ModuleDependency,\n\ttype ModuleDependencyInput,\n\ttype ObjectRelationDefinition,\n} from \"../modules\";\nimport type { JsonValue, PortableJsonSchema } from \"../objects\";\nimport type {\n\tDataPolicyDefinition,\n\tPolicyFallbackDefinition,\n\tPolicyKind,\n} from \"../policies\";\nimport type { StateDefinition, StateMachineDefinition } from \"../state-machines\";\nimport type { ViewContract } from \"../projections\";\n\n/**\n * Version of the module manifest contract. Bump when the serialized shape\n * changes in a way consumers must detect.\n */\nexport const MODULE_MANIFEST_VERSION = 2 as const;\n\nexport interface ModuleManifestObjectType {\n\ttype: string;\n\tdisplayName?: string;\n\tidPrefix?: string;\n\tschema?: PortableJsonSchema;\n\tsemantics?: Record<string, JsonValue>;\n\trelations?: ObjectRelationDefinition[];\n\tinvariants?: DeclarativeInvariant[];\n}\n\nexport interface ModuleManifestIdPrefix {\n\tprefix: string;\n\tname: string;\n}\n\nexport interface ModuleManifestEventType {\n\teventType: string;\n\tschemaVersion: number;\n\tdescription?: string;\n\tschema?: PortableJsonSchema;\n}\n\nexport interface ModuleManifestActionStateMachine {\n\tentityType: string;\n\t/** Present only when the binding declares a static target state. */\n\ttargetState?: string;\n}\n\nexport interface ModuleManifestAdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n}\n\nexport interface ModuleManifestAction extends SurfaceDeclaration {\n\tactionId: string;\n\tversion: number;\n\tkind: \"atomic\" | \"saga\";\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\temitsEvents: string[];\n\tpolicies?: string[];\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\texecution?: ActionExecutionContract;\n\t/**\n\t * JSON Schema for the action parameters, present only when the action's\n\t * `schema` validator implements {@link JsonSchemaExportableValidator}.\n\t */\n\tparameterSchema?: unknown;\n\tparameterSchemaFormat?: \"json-schema\";\n\tresultSchema?: unknown;\n\tresultSchemaFormat?: \"json-schema\";\n\tstateMachine?: ModuleManifestActionStateMachine;\n\tadapterSteps?: ModuleManifestAdapterStep[];\n}\n\nexport interface ModuleManifestCodePolicy {\n\ttype: \"code\";\n\tpolicyId: string;\n\tversion: number;\n\tpreviewSafe?: boolean;\n}\n\nexport interface ModuleManifestDataPolicy {\n\ttype: \"data\";\n\tpolicyId: string;\n\tpolicyVersion: number;\n\tkind: PolicyKind;\n\tdataDefinition?: DataPolicyDefinition;\n\tcodeEvaluatorPolicyId?: string;\n\tfallback?: PolicyFallbackDefinition;\n}\n\nexport type ModuleManifestPolicy = ModuleManifestCodePolicy | ModuleManifestDataPolicy;\n\nexport interface ModuleManifestStateMachineTransition {\n\tfrom: string;\n\tto: string;\n\tcausedByAction: string;\n\t/** `true` when the transition declares a guard function. The guard itself is never serialized. */\n\thasGuard: boolean;\n}\n\nexport interface ModuleManifestStateMachine {\n\tentityType: string;\n\t/** States in declaration order (`Object.values` order of the definition record). */\n\tstates: StateDefinition[];\n\ttransitions: ModuleManifestStateMachineTransition[];\n}\n\nexport interface ModuleManifestView extends SurfaceDeclaration {\n\tname: string;\n\tversion: string;\n\tshape: PortableJsonSchema;\n\tparameterSchema?: PortableJsonSchema;\n\tconsumes: Array<{ eventType: string; schemaVersions: number[] }>;\n\tscope: \"tenant-space\";\n\tsnapshotVersion: number;\n\tcompatibleSnapshotVersions?: number[];\n\tusage?: ViewContract[\"usage\"];\n}\n\n/**\n * Stable, JSON-serializable description of a {@link FabricModule}'s ontology:\n * object types, subject types, id prefixes, event types, actions, policies,\n * and state machines. Intended for downstream tooling (semantics exporters,\n * docs generators, tool generators) that cannot consume live module code.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields (`handler`, `evaluate`, `guard`,\n * dynamic `targetState`, adapter `getInput`) are never serialized.\n */\nexport interface ModuleManifest {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\tnamespace: string;\n\tversion?: string;\n\tdisplayName?: string;\n\tdescription?: string;\n\tcapability?: CapabilityMetadata;\n\tdependencies: ModuleDependency[];\n\tobjectTypes: ModuleManifestObjectType[];\n\tsubjectTypes: string[];\n\tidPrefixes: ModuleManifestIdPrefix[];\n\teventTypes: ModuleManifestEventType[];\n\tactions: ModuleManifestAction[];\n\tpolicies: ModuleManifestPolicy[];\n\tstateMachines: ModuleManifestStateMachine[];\n\tviews: ModuleManifestView[];\n}\n\nexport interface ModuleManifestBundle {\n\tmanifestVersion: typeof MODULE_MANIFEST_VERSION;\n\t/** Manifests in the input module order. */\n\tmodules: ModuleManifest[];\n}\n\n/** Manifest v1 remains accepted by v2 readers; missing v2 fields normalize to absence. */\nexport type ModuleManifestObjectTypeV1 = Omit<\n\tModuleManifestObjectType,\n\t\"schema\" | \"semantics\" | \"relations\" | \"invariants\"\n>;\nexport type ModuleManifestActionV1 = Omit<\n\tModuleManifestAction,\n\t\"resultSchema\" | \"resultSchemaFormat\"\n>;\nexport type ModuleManifestV1 = Omit<\n\tModuleManifest,\n\t\"manifestVersion\" | \"objectTypes\" | \"actions\" | \"views\"\n> & {\n\tmanifestVersion: 1;\n\tobjectTypes: ModuleManifestObjectTypeV1[];\n\tactions: ModuleManifestActionV1[];\n};\nexport type ModuleManifestBundleV1 = Omit<ModuleManifestBundle, \"manifestVersion\" | \"modules\"> & {\n\tmanifestVersion: 1;\n\tmodules: ModuleManifestV1[];\n};\n\nexport function normalizeModuleManifest(\n\tmanifest: ModuleManifest | ModuleManifestV1,\n): ModuleManifest {\n\tconst version: number = manifest.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest version: ${String(version)}`);\n\t}\n\tconst views = \"views\" in manifest && Array.isArray(manifest.views) ? manifest.views : [];\n\t// Preserve the normalizer's legacy tolerance for absent/non-array fields.\n\tif (Array.isArray(manifest.actions))\n\t\tfor (const [index, action] of manifest.actions.entries())\n\t\t\tassertSurfaceDeclaration(action, `Module \"${manifest.namespace}\" action[${index}] \"${action?.actionId ?? \"unknown\"}\"`);\n\tfor (const [index, view] of views.entries())\n\t\tassertSurfaceDeclaration(view, `Module \"${manifest.namespace}\" view[${index}] \"${view?.name ?? \"unknown\"}\"`);\n\treturn {\n\t\t...manifest,\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tviews,\n\t};\n}\n\nexport function normalizeModuleManifestBundle(\n\tbundle: ModuleManifestBundle | ModuleManifestBundleV1,\n): ModuleManifestBundle {\n\tconst version: number = bundle.manifestVersion;\n\tif (version !== 1 && version !== MODULE_MANIFEST_VERSION) {\n\t\tthrow new Error(`Unsupported module manifest bundle version: ${String(version)}`);\n\t}\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: bundle.modules.map((manifest) => normalizeModuleManifest(manifest)),\n\t};\n}\n\n/**\n * A {@link SchemaValidator} that can also export its parameter schema as JSON\n * Schema (for example a Zod 4 schema via `z.toJSONSchema`). Keeps the platform\n * zero-dependency while letting schema-bearing actions flow into manifests.\n */\nexport interface JsonSchemaExportableValidator extends SchemaValidator {\n\ttoJSONSchema(): Record<string, unknown>;\n}\n\nexport function isJsonSchemaExportableValidator(\n\tschema: SchemaValidator,\n): schema is JsonSchemaExportableValidator {\n\treturn (\n\t\ttypeof (schema as Partial<JsonSchemaExportableValidator>).toJSONSchema === \"function\"\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction exportDependency(dependency: ModuleDependencyInput): ModuleDependency {\n\tconst namespace = getModuleDependencyNamespace(dependency);\n\tif (typeof dependency === \"string\") {\n\t\treturn { namespace };\n\t}\n\tconst normalized: ModuleDependency = { namespace };\n\tif (dependency.version !== undefined) normalized.version = dependency.version;\n\tif (dependency.optional !== undefined) normalized.optional = dependency.optional;\n\treturn normalized;\n}\n\nfunction exportObjectType(\n\tobjectType: NonNullable<FabricModule[\"objectTypes\"]>[number],\n): ModuleManifestObjectType {\n\tif (typeof objectType === \"string\") {\n\t\treturn { type: objectType };\n\t}\n\tconst normalized: ModuleManifestObjectType = { type: getObjectTypeName(objectType) };\n\tif (objectType.displayName !== undefined) normalized.displayName = objectType.displayName;\n\tif (objectType.idPrefix !== undefined) normalized.idPrefix = objectType.idPrefix;\n\tif (objectType.schema !== undefined) normalized.schema = cloneJson(objectType.schema);\n\tif (objectType.semantics !== undefined) normalized.semantics = cloneJson(objectType.semantics);\n\tif (objectType.relations !== undefined) {\n\t\tnormalized.relations = objectType.relations.map((relation) => ({ ...relation }));\n\t}\n\tif (objectType.invariants !== undefined) {\n\t\tnormalized.invariants = objectType.invariants.map((invariant) => ({ ...invariant }));\n\t}\n\treturn normalized;\n}\n\nfunction cloneJson<T>(value: T): T {\n\tif (Array.isArray(value)) return value.map((item) => cloneJson(item)) as T;\n\tif (value !== null && typeof value === \"object\") {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>).map(([key, child]) => [key, cloneJson(child)]),\n\t\t) as T;\n\t}\n\treturn value;\n}\n\nfunction exportEventType(\n\teventType: NonNullable<FabricModule[\"eventTypes\"]>[number],\n): ModuleManifestEventType {\n\tif (typeof eventType === \"string\") {\n\t\t// String registrations carry no explicit schema version; the events\n\t\t// registry treats the bare name as the initial version of the type.\n\t\treturn { eventType, schemaVersion: 1 };\n\t}\n\tconst normalized: ModuleManifestEventType = {\n\t\teventType: getEventTypeName(eventType),\n\t\tschemaVersion: eventType.schemaVersion,\n\t};\n\tif (eventType.description !== undefined) normalized.description = eventType.description;\n\tif (eventType.schema !== undefined) normalized.schema = cloneJson(eventType.schema);\n\treturn normalized;\n}\n\nfunction exportAction(action: ActionDefinition): ModuleManifestAction {\n\tassertSurfaceDeclaration(action, `Action \"${action?.actionId ?? \"unknown\"}\"`);\n\tconst manifest: ModuleManifestAction = {\n\t\tactionId: action.actionId,\n\t\tversion: action.version,\n\t\tkind: action.kind ?? \"atomic\",\n\t\tidempotent: action.idempotent,\n\t\tmutatesDomain: action.mutatesDomain,\n\t\temitsEvents: [...action.emitsEvents],\n\t};\n\n\tif (action.surface !== undefined) manifest.surface = action.surface;\n\tif (action.surfaceReason !== undefined) manifest.surfaceReason = action.surfaceReason;\n\tif (action.policies !== undefined) manifest.policies = [...action.policies];\n\tif (action.requiredRoles !== undefined) manifest.requiredRoles = [...action.requiredRoles];\n\tif (action.requiredPermissions !== undefined) {\n\t\tmanifest.requiredPermissions = [...action.requiredPermissions];\n\t}\n\tif (action.eventPhase !== undefined) manifest.eventPhase = action.eventPhase;\n\tif (action.execution !== undefined) manifest.execution = cloneJson(action.execution);\n\n\tif (isJsonSchemaExportableValidator(action.schema)) {\n\t\ttry {\n\t\t\tmanifest.parameterSchema = action.schema.toJSONSchema();\n\t\t\tmanifest.parameterSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// Runtime-valid schemas that cannot be represented portably remain executable;\n\t\t\t// build-time consumers see the schema as unavailable rather than crashing export.\n\t\t}\n\t}\n\tif (action.resultSchema && isJsonSchemaExportableValidator(action.resultSchema)) {\n\t\ttry {\n\t\t\tmanifest.resultSchema = action.resultSchema.toJSONSchema();\n\t\t\tmanifest.resultSchemaFormat = \"json-schema\";\n\t\t} catch {\n\t\t\t// See parameter-schema behavior above.\n\t\t}\n\t}\n\n\tif (action.stateMachine !== undefined) {\n\t\tconst binding: ModuleManifestActionStateMachine = {\n\t\t\tentityType: action.stateMachine.entityType,\n\t\t};\n\t\tif (typeof action.stateMachine.targetState === \"string\") {\n\t\t\tbinding.targetState = action.stateMachine.targetState;\n\t\t}\n\t\tmanifest.stateMachine = binding;\n\t}\n\n\tif (action.adapterSteps !== undefined) {\n\t\tmanifest.adapterSteps = action.adapterSteps.map((step) => {\n\t\t\tconst exported: ModuleManifestAdapterStep = {\n\t\t\t\tadapterType: step.adapterType,\n\t\t\t\toperation: step.operation,\n\t\t\t};\n\t\t\tif (step.retryPolicy !== undefined) exported.retryPolicy = { ...step.retryPolicy };\n\t\t\treturn exported;\n\t\t});\n\t}\n\n\treturn manifest;\n}\n\nfunction exportPolicy(policy: unknown): ModuleManifestPolicy | undefined {\n\tif (!isRecord(policy) || typeof policy.policyId !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// Code evaluator: identified by its `evaluate` function (never serialized).\n\tif (typeof policy.evaluate === \"function\") {\n\t\tconst exported: ModuleManifestCodePolicy = {\n\t\t\ttype: \"code\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tversion: typeof policy.version === \"number\" ? policy.version : 1,\n\t\t};\n\t\tif (typeof policy.previewSafe === \"boolean\") exported.previewSafe = policy.previewSafe;\n\t\treturn exported;\n\t}\n\n\t// Declarative runtime policy definition: pure data, serialized as-is.\n\tif (typeof policy.kind === \"string\" && typeof policy.policyVersion === \"number\") {\n\t\tconst exported: ModuleManifestDataPolicy = {\n\t\t\ttype: \"data\",\n\t\t\tpolicyId: policy.policyId,\n\t\t\tpolicyVersion: policy.policyVersion,\n\t\t\tkind: policy.kind as PolicyKind,\n\t\t};\n\t\tif (isRecord(policy.dataDefinition)) {\n\t\t\texported.dataDefinition = policy.dataDefinition as unknown as DataPolicyDefinition;\n\t\t}\n\t\tif (typeof policy.codeEvaluatorPolicyId === \"string\") {\n\t\t\texported.codeEvaluatorPolicyId = policy.codeEvaluatorPolicyId;\n\t\t}\n\t\tif (isRecord(policy.fallback)) {\n\t\t\texported.fallback = policy.fallback as unknown as PolicyFallbackDefinition;\n\t\t}\n\t\treturn exported;\n\t}\n\n\t// Unknown policy shape: omit rather than guess.\n\treturn undefined;\n}\n\nfunction exportStateMachine(machine: unknown): ModuleManifestStateMachine | undefined {\n\tif (\n\t\t!isRecord(machine) ||\n\t\ttypeof machine.entityType !== \"string\" ||\n\t\t!isRecord(machine.states) ||\n\t\t!Array.isArray(machine.transitions)\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst definition = machine as unknown as StateMachineDefinition;\n\treturn {\n\t\tentityType: definition.entityType,\n\t\tstates: Object.values(definition.states),\n\t\ttransitions: definition.transitions.map((transition) => ({\n\t\t\tfrom: transition.from,\n\t\t\tto: transition.to,\n\t\t\tcausedByAction: transition.causedByAction,\n\t\t\thasGuard: typeof transition.guard === \"function\",\n\t\t})),\n\t};\n}\n\nfunction exportView(view: ViewContract): ModuleManifestView {\n\tassertSurfaceDeclaration(view, `View \"${view?.name ?? \"unknown\"}\"`);\n\tconst output: ModuleManifestView = {\n\t\tname: view.name,\n\t\tversion: view.version,\n\t\tshape: cloneJson(view.shape),\n\t\tconsumes: view.consumes.map((consumption) => ({\n\t\t\teventType: consumption.eventType,\n\t\t\tschemaVersions: [...consumption.schemaVersions],\n\t\t})),\n\t\tscope: view.scope,\n\t\tsnapshotVersion: view.snapshotVersion,\n\t};\n\tif (view.surface !== undefined) output.surface = view.surface;\n\tif (view.surfaceReason !== undefined) output.surfaceReason = view.surfaceReason;\n\tif (view.parameterSchema !== undefined) output.parameterSchema = cloneJson(view.parameterSchema);\n\tif (view.compatibleSnapshotVersions) output.compatibleSnapshotVersions = [...view.compatibleSnapshotVersions];\n\tif (view.usage) output.usage = cloneJson(view.usage);\n\treturn output;\n}\n\n/**\n * Export a stable, JSON-serializable manifest of a module's ontology.\n *\n * This is a pure function of the module object: it does not read or mutate the\n * global module/action/policy/state-machine registries, and the module does\n * not need to be registered first. Declaration order is preserved everywhere\n * (nothing is sorted), so the same module object always produces a\n * byte-identical `JSON.stringify` result.\n *\n * The manifest contains definitions only — never raw parameter values,\n * secrets, or runtime data. Function fields are elided (`handler`,\n * policy `evaluate`, transition `guard` → `hasGuard`, dynamic `targetState`,\n * adapter `getInput`).\n */\nexport function exportModuleManifest(module: FabricModule<unknown>): ModuleManifest {\n\tconst manifest: ModuleManifest = {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tnamespace: module.namespace,\n\t\tdependencies: (module.dependencies ?? []).map(exportDependency),\n\t\tobjectTypes: (module.objectTypes ?? []).map(exportObjectType),\n\t\tsubjectTypes: [...(module.subjectTypes ?? [])],\n\t\tidPrefixes: (module.idPrefixes ?? []).map((registration) => ({\n\t\t\tprefix: registration.prefix,\n\t\t\tname: registration.name,\n\t\t})),\n\t\teventTypes: (module.eventTypes ?? []).map(exportEventType),\n\t\tactions: (module.actions ?? []).map(exportAction),\n\t\tpolicies: (module.policies ?? [])\n\t\t\t.map(exportPolicy)\n\t\t\t.filter((policy): policy is ModuleManifestPolicy => policy !== undefined),\n\t\tstateMachines: (module.stateMachines ?? [])\n\t\t\t.map(exportStateMachine)\n\t\t\t.filter((machine): machine is ModuleManifestStateMachine => machine !== undefined),\n\t\tviews: (module.views ?? []).map(exportView),\n\t};\n\n\tif (module.version !== undefined) manifest.version = module.version;\n\tif (module.displayName !== undefined) manifest.displayName = module.displayName;\n\tif (module.description !== undefined) manifest.description = module.description;\n\tif (module.capability !== undefined) manifest.capability = cloneJson(module.capability);\n\n\treturn manifest;\n}\n\n/**\n * Export manifests for a set of modules, preserving the input order.\n * Like {@link exportModuleManifest}, this is pure and registry-free.\n */\nexport function exportModuleManifestBundle(\n\tmodules: FabricModule<unknown>[],\n): ModuleManifestBundle {\n\treturn {\n\t\tmanifestVersion: MODULE_MANIFEST_VERSION,\n\t\tmodules: modules.map(exportModuleManifest),\n\t};\n}\n"]}
@@ -30,6 +30,9 @@ function createActionRegistry(definitions = []) {
30
30
  if (definition.mutatesDomain && definition.emitsEvents.length === 0) {
31
31
  throw new Error(`Action "${definition.actionId}" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`);
32
32
  }
33
+ if (definition.admitSubmission !== void 0 && typeof definition.admitSubmission !== "function") {
34
+ throw new Error(`Action "${definition.actionId}" declares admitSubmission that is not a function.`);
35
+ }
33
36
  actions.set(definition.actionId, definition);
34
37
  };
35
38
  for (const definition of definitions) register(definition);
@@ -49,5 +52,5 @@ exports.assertActionId = assertActionId;
49
52
  exports.assertActorType = assertActorType;
50
53
  exports.createActionRegistry = createActionRegistry;
51
54
  exports.isActorType = isActorType;
52
- //# sourceMappingURL=chunk-DDX5FKOM.cjs.map
53
- //# sourceMappingURL=chunk-DDX5FKOM.cjs.map
55
+ //# sourceMappingURL=chunk-XCAOO6KG.cjs.map
56
+ //# sourceMappingURL=chunk-XCAOO6KG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../actions/index.ts"],"names":[],"mappings":";;;AAyBO,IAAM,WAAA,GAAoC;AAAA,EAChD,gBAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACD;AAEO,SAAS,YAAY,KAAA,EAAmC;AAC9D,EAAA,OAAQ,WAAA,CAAkC,SAAS,KAAK,CAAA;AACzD;AAEO,SAAS,gBAAgB,KAAA,EAA2C;AAC1E,EAAA,IAAI,CAAC,WAAA,CAAY,KAAK,CAAA,EAAG;AACxB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,mBAAA,EAAsB,KAAK,CAAA,CAAE,CAAA;AAAA,EAC9C;AACD;AAmQO,SAAS,eAAe,QAAA,EAAgD;AAC9E,EAAA,IAAI,CAAC,oCAAA,CAAqC,IAAA,CAAK,QAAQ,CAAA,EAAG;AACzD,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,mBAAA,EAAsB,QAAQ,CAAA,CAAE,CAAA;AAAA,EACjD;AACD;AAUO,SAAS,oBAAA,CAAoC,WAAA,GAAgD,EAAC,EAAwB;AAC5H,EAAA,MAAM,OAAA,uBAAc,GAAA,EAAqC;AACzD,EAAA,MAAM,QAAA,GAAW,CAAC,UAAA,KAA4C;AAC7D,IAAA,cAAA,CAAe,WAAW,QAAQ,CAAA;AAClC,IAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,UAAA,CAAW,QAAQ,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,CAAA,QAAA,EAAW,UAAA,CAAW,QAAQ,CAAA,uBAAA,CAAyB,CAAA;AAC7G,IAAA,IAAI,UAAA,CAAW,aAAA,IAAiB,UAAA,CAAW,WAAA,CAAY,WAAW,CAAA,EAAG;AACpE,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,QAAA,EAAW,UAAA,CAAW,QAAQ,CAAA,8FAAA,CAAgG,CAAA;AAAA,IAC/I;AACA,IAAA,IAAI,WAAW,eAAA,KAAoB,MAAA,IAAa,OAAO,UAAA,CAAW,oBAAoB,UAAA,EAAY;AACjG,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,QAAA,EAAW,UAAA,CAAW,QAAQ,CAAA,kDAAA,CAAoD,CAAA;AAAA,IACnG;AACA,IAAA,OAAA,CAAQ,GAAA,CAAI,UAAA,CAAW,QAAA,EAAU,UAAU,CAAA;AAAA,EAC5C,CAAA;AACA,EAAA,KAAA,MAAW,UAAA,IAAc,WAAA,EAAa,QAAA,CAAS,UAAU,CAAA;AACzD,EAAA,OAAO;AAAA,IACN,QAAA;AAAA,IACA,kBAAkB,UAAA,EAAY;AAC7B,MAAA,IAAI,CAAC,OAAA,CAAQ,GAAA,CAAI,WAAW,QAAQ,CAAA,WAAY,UAAU,CAAA;AAAA,IAC3D,CAAA;AAAA,IACA,OAAA,EAAS,CAAC,QAAA,KAAa,OAAA,CAAQ,IAAI,QAAQ,CAAA;AAAA,IAC3C,GAAA,EAAK,CAAC,QAAA,KAAmC,OAAA,CAAQ,IAAI,QAAoB,CAAA;AAAA,IACzE,KAAK,MAAM,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,MAAM;AAAA,GACrC;AACD","file":"chunk-XCAOO6KG.cjs","sourcesContent":["import type { SurfaceDeclaration } from \"../discovery\";\nexport type ActionId = `${string}.${string}`;\n\nexport interface SchemaParseIssue {\n\tpath: PropertyKey[];\n\tmessage: string;\n}\n\nexport type SchemaParseResult<T = unknown> =\n\t| { success: true; data: T }\n\t| { success: false; error: { issues: SchemaParseIssue[] } };\n\nexport interface SchemaValidator<T = unknown> {\n\tparse(input: unknown): T;\n\tsafeParse(input: unknown): SchemaParseResult<T>;\n}\n\nexport type ActorType =\n\t| \"natural_person\"\n\t| \"agent\"\n\t| \"system\"\n\t| \"service_account\"\n\t| \"external_system\"\n\t| \"integration\";\n\nexport const ACTOR_TYPES: readonly ActorType[] = [\n\t\"natural_person\",\n\t\"agent\",\n\t\"system\",\n\t\"service_account\",\n\t\"external_system\",\n\t\"integration\",\n] as const;\n\nexport function isActorType(value: string): value is ActorType {\n\treturn (ACTOR_TYPES as readonly string[]).includes(value);\n}\n\nexport function assertActorType(value: string): asserts value is ActorType {\n\tif (!isActorType(value)) {\n\t\tthrow new Error(`Invalid actorType: ${value}`);\n\t}\n}\n\nexport type ActionStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"blocked_by_policy\"\n\t| \"waiting_for_approval\"\n\t| \"reconciliation_required\"\n\t| \"validation_failed\";\n\nexport interface FabricRuntimeServices {\n\treadonly [serviceName: string]: unknown;\n}\n\nexport interface ActionContext<TDb = unknown> {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tactorId: string;\n\tactorType: ActorType;\n\tcorrelationId: string;\n\tcausationId?: string;\n\tprovenance?: { source: string; auditAttributes?: Record<string, string> };\n\tdb: TDb;\n\tservices?: FabricRuntimeServices;\n\t/**\n\t * When the host admitted this invocation's submission through the\n\t * action's `admitSubmission` check, read from the durable invocation\n\t * record. Absent when the action declares no check, or when the runtime\n\t * that built this context does not run declared admission checks (a host\n\t * older than the one that introduced them). A handler whose action\n\t * declares `admitSubmission` can refuse to run without it.\n\t */\n\tadmittedAt?: Date;\n}\n\n/**\n * Trusted facts a host gives an action's `admitSubmission` check. Scope and\n * actor come from the host's authenticated submission, never from the\n * parameters.\n */\nexport interface ActionAdmissionInput {\n\treadonly actionId: ActionId;\n\treadonly tenantId: string;\n\treadonly spaceId: string;\n\treadonly actorId: string;\n\treadonly actorType: ActorType;\n\t/**\n\t * The submitted parameters, unvalidated, as a copy made for this check.\n\t * `@fabricorg/platform-host` records its own copy of the same value, taken\n\t * before the check ran, and only if the check admits it; changing this\n\t * copy changes nothing the host records.\n\t */\n\treadonly parameters: Readonly<Record<string, unknown>>;\n\t/**\n\t * Aborted when the host's admission deadline passes. Hosts pass an\n\t * `AbortSignal`. `@fabricorg/platform-host` refuses an answer that settles\n\t * at or after the deadline, even one that settles before the abort.\n\t */\n\treadonly signal: ActionAdmissionSignal;\n}\n\n/**\n * The part of an `AbortSignal` an admission check can rely on. Declared\n * structurally so this module compiles without DOM or Node type libraries; a\n * host passes a real `AbortSignal`, which satisfies it.\n */\nexport interface ActionAdmissionSignal {\n\treadonly aborted: boolean;\n\taddEventListener(type: \"abort\", listener: () => void, options?: { once?: boolean }): void;\n\tremoveEventListener(type: \"abort\", listener: () => void): void;\n}\n\n/**\n * An admission check's answer. Only `{ admitted: true }` admits. A refusal's\n * `code` must be a fixed code chosen by the action (lower-case first letter,\n * then letters, digits, `_`, `.`, `:` or `-`, at most 128 characters), never\n * a submitted value: the host puts it in the error it throws.\n */\nexport type ActionAdmissionDecision =\n\t| { readonly admitted: true }\n\t| { readonly admitted: false; readonly code: string };\n\n/**\n * Decides whether a submission may be recorded at all. A host that supports\n * it runs the check after authorizing the submitter and before it writes\n * anything durable for the submission; a refusal, a throw, a timeout or any\n * answer other than `{ admitted: true }` refuses the submission.\n */\nexport type ActionAdmission = (input: ActionAdmissionInput) => Promise<ActionAdmissionDecision>;\n\nexport interface ActionResult {\n\tsuccess: boolean;\n\tdata?: Record<string, unknown>;\n\terror?: string;\n}\n\nexport type ActionHandler<TDb = unknown> = (\n\tctx: ActionContext<TDb>,\n\tparams: unknown,\n) => Promise<ActionResult>;\n\nexport interface AdapterStepRetryPolicy {\n\tidempotent: boolean;\n\tmaxAttempts?: number;\n\tinitialDelayMs?: number;\n\tbackoffMultiplier?: number;\n\tmaxDelayMs?: number;\n}\n\nexport interface AdapterStep {\n\tadapterType: string;\n\toperation: string;\n\tretryPolicy?: AdapterStepRetryPolicy;\n\tgetInput: (\n\t\tparams: unknown,\n\t\thandlerResult: Record<string, unknown>,\n\t) => Record<string, unknown> | undefined;\n}\n\nexport interface ActionStateMachineBinding {\n\tentityType: string;\n\ttargetState: string | ((params: unknown) => string);\n\tgetEntityId: (params: unknown) => string | undefined;\n}\n\nexport interface ActionDefinition<TDb = unknown> extends SurfaceDeclaration {\n\tactionId: ActionId;\n\tnamespace: string;\n\tversion: number;\n\tschema: SchemaValidator;\n\t/**\n\t * Optional check a host runs on every submission before it records\n\t * anything durable for it (invocation, idempotency key, events, errors).\n\t * Use it when parameters must be validated against trusted context, for\n\t * example a secret reference the tenant's secret store must hold, before\n\t * they may be persisted. `@fabricorg/platform-host` runs it from the\n\t * release that introduced it; an older host ignores it, so a handler that\n\t * relies on it should require `ActionContext.admittedAt`.\n\t */\n\tadmitSubmission?: ActionAdmission;\n\t/** Optional validation contract for the public handler result data. */\n\tresultSchema?: SchemaValidator;\n\thandler?: ActionHandler<TDb>;\n\trequiredRoles?: string[];\n\trequiredPermissions?: string[];\n\tpolicies?: `${string}.v${number}`[];\n\temitsEvents: string[];\n\tidempotent: boolean;\n\tmutatesDomain: boolean;\n\t/** Portable execution semantics used by hosts, gateways, and generated capability contracts. */\n\texecution?: ActionExecutionContract;\n\tstateMachine?: ActionStateMachineBinding;\n\tadapterSteps?: AdapterStep[];\n\t/** Completion actions can attest only after all external adapter work succeeds. */\n\teventPhase?: \"before_adapters\" | \"after_adapters\";\n\t/**\n\t * If \"saga\", the action is a multi-step orchestration. The worker dispatches\n\t * to a registered saga implementation instead of running `handler` directly.\n\t */\n\tkind?: \"atomic\" | \"saga\";\n}\n\nexport type ActionConnectivity = \"online-required\" | \"offline-capturable\";\nexport type AuthorityMoment = \"capture\" | \"execution\" | \"both\";\nexport type ActionIdempotencyStance = \"required\" | \"supported\" | \"prohibited\";\nexport type ActionCompletionMode = \"immediate\" | \"accepted\" | \"long-running\";\nexport type ActionConsistency = \"authoritative-now\" | \"provisional-until-reconciled\";\nexport type ActionDataSensitivity = \"public\" | \"internal\" | \"confidential\" | \"restricted\";\n\nexport interface ActionExecutionContract {\n\tconnectivity: ActionConnectivity;\n\tauthorityMoment: AuthorityMoment;\n\tidempotency: ActionIdempotencyStance;\n\t/**\n\t * `immediate`: the invocation settles within the host's execution.\n\t * `accepted` and `long-running`: an adapter may hand the work to an\n\t * external system and the invocation stays running until that system\n\t * completes it by reference through the host's completion ingress.\n\t * Declare `completionDeadlineMs` on a `long-running` action so a callback\n\t * that never comes is noticed rather than waited on forever.\n\t */\n\tcompletion: ActionCompletionMode;\n\t/**\n\t * How long an accepted handoff may wait for its completion before the host\n\t * moves the invocation to reconciliation. Without it, nothing sweeps the\n\t * handoff. Refused on `immediate`, since nothing external completes it.\n\t */\n\tcompletionDeadlineMs?: number;\n\tconsistency: ActionConsistency;\n\tsensitivity?: ActionDataSensitivity;\n}\n\nexport interface SagaContext {\n\tactionInvocationId: string;\n\ttenantId: string;\n\tspaceId: string;\n\tparameters: unknown;\n\tsleep?: (delayMs: number) => Promise<void>;\n\tquery?: <T = unknown>(model: string, operation: string, args: unknown) => Promise<T>;\n\t/**\n\t * Wait for a named external signal carrying a payload of `T`, with a timeout.\n\t *\n\t * Resolves with the payload of the first signal received, or `null` if the timeout\n\t * fires first. Subsequent signals with the same name received before another\n\t * `awaitSignal` call are buffered (FIFO) so no signal is lost.\n\t *\n\t * Intended for agent-driven and webhook-driven coordination: replace polling loops\n\t * with push-based wakeups while preserving the saga's deterministic replay\n\t * semantics (the runtime is responsible for capturing signals into workflow history).\n\t *\n\t * Optional. Runtimes that cannot implement push-based signaling (e.g. an in-memory\n\t * test harness) may omit this; sagas should treat absence as a fallback condition\n\t * and use `sleep` + `query` polling instead.\n\t *\n\t * Signal *senders* are runtime-specific (e.g. a Temporal `WorkflowClient.signal()`\n\t * call from an action handler). Apps that need to send signals from action\n\t * handlers should expose a coordination service via `ActionContext.services`\n\t * — the platform does not prescribe the sender API.\n\t *\n\t * @example\n\t * const payload = await ctx.awaitSignal?.<{ result: Record<string, unknown> }>(\n\t * \"userInputProcessed\",\n\t * 5 * 60 * 1000,\n\t * );\n\t * if (payload) { /* handle pushed result *\\/ }\n\t * else { /* timeout — fall back to deterministic path *\\/ }\n\t */\n\tawaitSignal?: <T = unknown>(signalName: string, timeoutMs: number) => Promise<T | null>;\n}\n\nexport interface SagaChildActionInput {\n\tsuffix: string;\n\tactionId: string;\n\tparameters: Record<string, unknown>;\n}\n\nexport type SagaRunChild = (input: SagaChildActionInput) => Promise<Record<string, unknown>>;\n\nexport interface SagaCompletionEvent {\n\teventType: string;\n\tsubjectType: string;\n\tsubjectId: string;\n\tpayload: unknown;\n\teventSchemaVersion?: number;\n}\n\nexport interface SagaCompletion {\n\tresultData: Record<string, unknown>;\n\tevent?: SagaCompletionEvent;\n}\n\nexport type SagaImplementation = (\n\tctx: SagaContext,\n\trunChild: SagaRunChild,\n) => Promise<SagaCompletion>;\n\nexport function assertActionId(actionId: string): asserts actionId is ActionId {\n\tif (!/^[a-z][a-z0-9-]*\\.[a-z][a-z0-9_]*$/.test(actionId)) {\n\t\tthrow new Error(`Invalid action ID: ${actionId}`);\n\t}\n}\n\nexport interface ActionRegistry<TDb = unknown> {\n\tregister(definition: ActionDefinition<TDb>): void;\n\tregisterIfMissing(definition: ActionDefinition<TDb>): void;\n\tresolve(actionId: ActionId): ActionDefinition<TDb> | undefined;\n\thas(actionId: string): actionId is ActionId;\n\tids(): ActionId[];\n}\n\nexport function createActionRegistry<TDb = unknown>(definitions: readonly ActionDefinition<TDb>[] = []): ActionRegistry<TDb> {\n\tconst actions = new Map<ActionId, ActionDefinition<TDb>>();\n\tconst register = (definition: ActionDefinition<TDb>): void => {\n\t\tassertActionId(definition.actionId);\n\t\tif (actions.has(definition.actionId)) throw new Error(`Action \"${definition.actionId}\" is already registered`);\n\t\tif (definition.mutatesDomain && definition.emitsEvents.length === 0) {\n\t\t\tthrow new Error(`Action \"${definition.actionId}\" mutates domain but emits no events. Every mutating action must emit at least one AssetEvent.`);\n\t\t}\n\t\tif (definition.admitSubmission !== undefined && typeof definition.admitSubmission !== \"function\") {\n\t\t\tthrow new Error(`Action \"${definition.actionId}\" declares admitSubmission that is not a function.`);\n\t\t}\n\t\tactions.set(definition.actionId, definition);\n\t};\n\tfor (const definition of definitions) register(definition);\n\treturn {\n\t\tregister,\n\t\tregisterIfMissing(definition) {\n\t\t\tif (!actions.has(definition.actionId)) register(definition);\n\t\t},\n\t\tresolve: (actionId) => actions.get(actionId),\n\t\thas: (actionId): actionId is ActionId => actions.has(actionId as ActionId),\n\t\tids: () => Array.from(actions.keys()),\n\t};\n}\n"]}