@open-mercato/cli 0.6.8-develop.6931.1.4a1e1c786b → 0.6.8-develop.6940.1.177ea30c6e

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 (168) hide show
  1. package/.turbo/turbo-build.log +65 -1
  2. package/build.mjs +57 -7
  3. package/dist/agentic/guides/backend-ui.md +7 -1
  4. package/dist/agentic/guides/module-facts.json +565 -224
  5. package/dist/agentic/guides/module-facts.v2.json +122933 -0
  6. package/dist/agentic/guides/modules/ai_assistant.md +2 -2
  7. package/dist/agentic/guides/modules/api_docs.md +2 -2
  8. package/dist/agentic/guides/modules/api_keys.md +2 -2
  9. package/dist/agentic/guides/modules/attachments.md +2 -2
  10. package/dist/agentic/guides/modules/audit_logs.md +2 -2
  11. package/dist/agentic/guides/modules/auth.md +2 -2
  12. package/dist/agentic/guides/modules/business_rules.md +2 -2
  13. package/dist/agentic/guides/modules/catalog.md +11 -4
  14. package/dist/agentic/guides/modules/channel_gmail.md +2 -2
  15. package/dist/agentic/guides/modules/channel_imap.md +2 -2
  16. package/dist/agentic/guides/modules/checkout.md +8 -2
  17. package/dist/agentic/guides/modules/communication_channels.md +6 -6
  18. package/dist/agentic/guides/modules/configs.md +2 -2
  19. package/dist/agentic/guides/modules/content.md +2 -2
  20. package/dist/agentic/guides/modules/currencies.md +2 -2
  21. package/dist/agentic/guides/modules/customer_accounts.md +2 -2
  22. package/dist/agentic/guides/modules/customers.md +8 -8
  23. package/dist/agentic/guides/modules/dashboards.md +12 -12
  24. package/dist/agentic/guides/modules/data_sync.md +4 -4
  25. package/dist/agentic/guides/modules/design_system.md +2 -2
  26. package/dist/agentic/guides/modules/dictionaries.md +2 -2
  27. package/dist/agentic/guides/modules/directory.md +2 -2
  28. package/dist/agentic/guides/modules/entities.md +3 -3
  29. package/dist/agentic/guides/modules/eudr.md +3 -3
  30. package/dist/agentic/guides/modules/events.md +2 -2
  31. package/dist/agentic/guides/modules/feature_toggles.md +2 -2
  32. package/dist/agentic/guides/modules/gateway_stripe.md +2 -2
  33. package/dist/agentic/guides/modules/generators.md +2 -2
  34. package/dist/agentic/guides/modules/inbox_ops.md +2 -2
  35. package/dist/agentic/guides/modules/integrations.md +5 -2
  36. package/dist/agentic/guides/modules/messages.md +2 -2
  37. package/dist/agentic/guides/modules/notifications.md +2 -2
  38. package/dist/agentic/guides/modules/onboarding.md +2 -2
  39. package/dist/agentic/guides/modules/payment_gateways.md +7 -3
  40. package/dist/agentic/guides/modules/perspectives.md +2 -2
  41. package/dist/agentic/guides/modules/planner.md +2 -2
  42. package/dist/agentic/guides/modules/portal.md +2 -2
  43. package/dist/agentic/guides/modules/progress.md +2 -2
  44. package/dist/agentic/guides/modules/query_index.md +2 -2
  45. package/dist/agentic/guides/modules/record_locks.md +3 -3
  46. package/dist/agentic/guides/modules/resources.md +2 -2
  47. package/dist/agentic/guides/modules/sales.md +13 -4
  48. package/dist/agentic/guides/modules/scheduler.md +2 -2
  49. package/dist/agentic/guides/modules/search.md +4 -4
  50. package/dist/agentic/guides/modules/security.md +3 -3
  51. package/dist/agentic/guides/modules/shipping_carriers.md +2 -2
  52. package/dist/agentic/guides/modules/sso.md +2 -2
  53. package/dist/agentic/guides/modules/staff.md +7 -4
  54. package/dist/agentic/guides/modules/storage_s3.md +2 -2
  55. package/dist/agentic/guides/modules/sync_akeneo.md +4 -4
  56. package/dist/agentic/guides/modules/sync_excel.md +2 -2
  57. package/dist/agentic/guides/modules/system_status_overlays.md +2 -2
  58. package/dist/agentic/guides/modules/translations.md +2 -2
  59. package/dist/agentic/guides/modules/webhooks.md +2 -2
  60. package/dist/agentic/guides/modules/wms.md +31 -4
  61. package/dist/agentic/guides/modules/workflows.md +2 -2
  62. package/dist/agentic/guides/reference-module-facts.json +8335 -0
  63. package/dist/agentic/guides/reference-modules/example.md +489 -0
  64. package/dist/agentic/guides/spec-delivery.md +34 -0
  65. package/dist/agentic/guides/testing-debugging.md +2 -1
  66. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +3 -2
  67. package/dist/agentic/guides/upstream/manifest.json +2 -2
  68. package/dist/agentic/shared/AGENTS.md.template +10 -14
  69. package/dist/agentic/shared/ai/harness/README.md +4 -4
  70. package/dist/agentic/shared/ai/harness/RELEASE.md +4 -4
  71. package/dist/agentic/shared/ai/harness/cases.json +11350 -5088
  72. package/dist/agentic/shared/ai/harness/cases.schema.json +70 -7
  73. package/dist/agentic/shared/ai/harness/design-system-inventory.json +6697 -0
  74. package/dist/agentic/shared/ai/harness/fixtures/index.json +3 -1
  75. package/dist/agentic/shared/ai/harness/fixtures/seeds.json +4 -0
  76. package/dist/agentic/shared/ai/harness/knowledge-change.schema.json +228 -0
  77. package/dist/agentic/shared/ai/harness/release-matrix.json +9 -4
  78. package/dist/agentic/shared/ai/harness/result.schema.json +60 -0
  79. package/dist/agentic/shared/ai/harness/routing-response.schema.json +10 -0
  80. package/dist/agentic/shared/ai/harness/source-link-inventory.json +3231 -0
  81. package/dist/agentic/shared/ai/harness/validators.json +8 -4
  82. package/dist/agentic/shared/ai/harness/writable-ast-oracles.mjs +5 -2
  83. package/dist/agentic/shared/ai/harness/writable-behavior-oracles.mjs +3 -0
  84. package/dist/agentic/shared/ai/harness/writable-spec-oracles.mjs +879 -0
  85. package/dist/agentic/shared/ai/skills/om-auto-upgrade-0.6.7-to-0.7.0/SKILL.md +102 -0
  86. package/dist/agentic/shared/ai/skills/om-backend-ui-design/SKILL.md +1 -0
  87. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/crud-surfaces.md +15 -0
  88. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/frontend-and-design-system.md +6 -0
  89. package/dist/agentic/shared/ai/skills/om-backend-ui-design/references/page-and-navigation.md +4 -0
  90. package/dist/agentic/shared/ai/skills/om-data-model-design/SKILL.md +1 -0
  91. package/dist/agentic/shared/ai/skills/om-data-model-design/references/integrity-and-concurrency.md +2 -0
  92. package/dist/agentic/shared/ai/skills/om-data-model-design/references/migration-workflow.md +2 -0
  93. package/dist/agentic/shared/ai/skills/om-data-model-design/references/schema-design.md +3 -1
  94. package/dist/agentic/shared/ai/skills/om-eject-and-customize/SKILL.md +1 -0
  95. package/dist/agentic/shared/ai/skills/om-eject-and-customize/references/decision-and-procedure.md +2 -0
  96. package/dist/agentic/shared/ai/skills/om-evolve-harness/SKILL.md +2 -0
  97. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-template.md +3 -3
  98. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/case-workflow.md +1 -1
  99. package/dist/agentic/shared/ai/skills/om-evolve-harness/references/knowledge-change.md +133 -0
  100. package/dist/agentic/shared/ai/skills/om-integration-builder/SKILL.md +1 -0
  101. package/dist/agentic/shared/ai/skills/om-integration-builder/references/provider-families.md +11 -0
  102. package/dist/agentic/shared/ai/skills/om-judge-agent-session/references/judge-workflow.md +1 -1
  103. package/dist/agentic/shared/ai/skills/om-module-scaffold/SKILL.md +2 -2
  104. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/api-and-domain.md +14 -1
  105. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/data-and-migrations.md +2 -0
  106. package/dist/agentic/shared/ai/skills/om-module-scaffold/references/module-surfaces.md +19 -0
  107. package/dist/agentic/shared/ai/skills/om-share-this-session/scripts/prepare-share-bundle.mjs +1 -4
  108. package/dist/agentic/shared/ai/skills/om-system-extension/SKILL.md +1 -0
  109. package/dist/agentic/shared/ai/skills/om-system-extension/references/extension-branches.md +24 -0
  110. package/dist/agentic/shared/ai/skills/om-system-extension/references/unified-overrides.md +3 -1
  111. package/dist/agentic/shared/ai/skills/om-troubleshooter/SKILL.md +1 -0
  112. package/dist/agentic/shared/ai/skills/om-troubleshooter/references/diagnosis-map.md +13 -0
  113. package/dist/agentic/shared/ai/skills/tiers.json +2 -1
  114. package/dist/agentic/shared/ai/specs/2026-08-06-reference-module-activation.md +248 -0
  115. package/dist/agentic/shared/scripts/agent-harness-tool-server.mjs +39 -2
  116. package/dist/agentic/shared/scripts/design-source-contract.mjs +108 -0
  117. package/dist/agentic/shared/scripts/evaluate-agent-harness.mjs +935 -28
  118. package/dist/agentic/shared/scripts/framework-context.mjs +4 -1
  119. package/dist/agentic/shared/scripts/run-agent-harness-release.mjs +1 -1
  120. package/dist/agentic/shared/scripts/validate-knowledge-change.mjs +1511 -0
  121. package/dist/lib/__integration__/TC-INT-008.spec.js +1 -0
  122. package/dist/lib/__integration__/TC-INT-008.spec.js.map +2 -2
  123. package/dist/lib/agentic-setup.js +9 -1
  124. package/dist/lib/agentic-setup.js.map +2 -2
  125. package/dist/lib/generators/module-extension-facts.js +93 -26
  126. package/dist/lib/generators/module-extension-facts.js.map +3 -3
  127. package/dist/lib/generators/module-facts-discovery.js +23 -0
  128. package/dist/lib/generators/module-facts-discovery.js.map +2 -2
  129. package/dist/lib/generators/module-facts.js +969 -41
  130. package/dist/lib/generators/module-facts.js.map +2 -2
  131. package/dist/lib/generators/module-override-targets.js +35 -11
  132. package/dist/lib/generators/module-override-targets.js.map +2 -2
  133. package/dist/lib/generators/module-registry.js +105 -2
  134. package/dist/lib/generators/module-registry.js.map +2 -2
  135. package/dist/lib/resolver.js +5 -0
  136. package/dist/lib/resolver.js.map +2 -2
  137. package/dist/lib/testing/integration-discovery.js +34 -0
  138. package/dist/lib/testing/integration-discovery.js.map +2 -2
  139. package/dist/lib/testing/integration.js +0 -2
  140. package/dist/lib/testing/integration.js.map +2 -2
  141. package/dist/mercato.js +4 -4
  142. package/dist/mercato.js.map +2 -2
  143. package/package.json +6 -6
  144. package/src/lib/__integration__/TC-INT-008.spec.ts +4 -2
  145. package/src/lib/__tests__/resolve-environment.test.ts +18 -0
  146. package/src/lib/agentic-setup.ts +10 -2
  147. package/src/lib/generators/__tests__/helpers/override-target-diagnostic-fixtures.ts +150 -0
  148. package/src/lib/generators/__tests__/module-extension-facts.test.ts +290 -0
  149. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +72 -7
  150. package/src/lib/generators/__tests__/module-facts.computed-di-token.test.ts +88 -0
  151. package/src/lib/generators/__tests__/module-facts.example-fact-coverage.test.ts +502 -0
  152. package/src/lib/generators/__tests__/module-facts.local-reference.test.ts +414 -0
  153. package/src/lib/generators/__tests__/module-facts.search-entity-id.test.ts +151 -0
  154. package/src/lib/generators/__tests__/module-facts.source-links.test.ts +42 -1
  155. package/src/lib/generators/__tests__/module-override-targets.diagnostic-wiring.test.ts +92 -0
  156. package/src/lib/generators/__tests__/module-override-targets.test.ts +24 -0
  157. package/src/lib/generators/__tests__/module-override-targets.unknown-mode.test.ts +117 -0
  158. package/src/lib/generators/__tests__/module-subset.test.ts +60 -0
  159. package/src/lib/generators/module-extension-facts.ts +181 -25
  160. package/src/lib/generators/module-facts-discovery.ts +46 -0
  161. package/src/lib/generators/module-facts.ts +1330 -86
  162. package/src/lib/generators/module-override-targets.ts +70 -26
  163. package/src/lib/generators/module-registry.ts +135 -2
  164. package/src/lib/resolver.ts +6 -1
  165. package/src/lib/testing/__tests__/integration-discovery.test.ts +35 -0
  166. package/src/lib/testing/integration-discovery.ts +50 -0
  167. package/src/lib/testing/integration.ts +0 -2
  168. package/src/mercato.ts +3 -3
@@ -1,10 +1,29 @@
1
1
  import crypto from "node:crypto";
2
2
  import { buildFactSourceLookup } from "./module-fact-sources.js";
3
- import { getFrameworkOverrideModes } from "./module-extension-facts.js";
4
- const OVERRIDE_MODES = getFrameworkOverrideModes();
3
+ import { getFrameworkOverrideHostOperations } from "./module-extension-facts.js";
4
+ const MODULE_OVERRIDE_MODES = ["disable-replace", "replace", "additive"];
5
+ const MODULE_OVERRIDE_TARGET_NOTES = [
6
+ "safe-metadata-only",
7
+ "page-middleware-not-mutation-guard"
8
+ ];
9
+ function isModuleOverrideMode(value) {
10
+ return MODULE_OVERRIDE_MODES.includes(value);
11
+ }
12
+ const MODULE_OVERRIDE_TARGET_DIAGNOSTIC_CODES = [
13
+ "missing-owned-fact",
14
+ "missing-source",
15
+ "unsupported-dynamic-key",
16
+ "unknown-framework-domain",
17
+ "unknown-framework-mode"
18
+ ];
19
+ const OVERRIDE_HOST_OPERATIONS = getFrameworkOverrideHostOperations();
20
+ function resolveFrameworkOverrideModes(operation) {
21
+ if (operation === void 0) return { outcome: "unknown-framework-domain" };
22
+ if (!isModuleOverrideMode(operation)) return { outcome: "unknown-framework-mode", operation };
23
+ return { outcome: "resolved", modes: [operation] };
24
+ }
5
25
  function modesFor(dottedHost) {
6
- const mode = OVERRIDE_MODES[dottedHost];
7
- return mode ? [mode] : null;
26
+ return resolveFrameworkOverrideModes(OVERRIDE_HOST_OPERATIONS[dottedHost]);
8
27
  }
9
28
  function moduleIdOf(facts) {
10
29
  const segments = facts.sourceRoot.split("/").filter(Boolean);
@@ -29,8 +48,9 @@ function comparePaths(left, right) {
29
48
  return 0;
30
49
  }
31
50
  function makeTarget(input) {
32
- const modes = modesFor(input.dottedHost);
33
- if (!modes) return null;
51
+ const resolution = modesFor(input.dottedHost);
52
+ if (resolution.outcome !== "resolved") return resolution;
53
+ const { modes } = resolution;
34
54
  const target = {
35
55
  id: computeOverrideTargetId(input.moduleId, input.domain, input.path),
36
56
  domain: input.domain,
@@ -44,13 +64,13 @@ function makeTarget(input) {
44
64
  return target;
45
65
  }
46
66
  function pushTarget(targets, diagnostics, input) {
47
- const target = makeTarget(input);
48
- if (target) {
49
- targets.push(target);
67
+ const result = makeTarget(input);
68
+ if (!("outcome" in result)) {
69
+ targets.push(result);
50
70
  return;
51
71
  }
52
72
  diagnostics.push({
53
- code: "unknown-framework-domain",
73
+ code: result.outcome,
54
74
  moduleId: input.moduleId,
55
75
  domain: input.domain,
56
76
  candidatePath: input.path,
@@ -681,8 +701,12 @@ function collectModuleOverrideTargets(facts, resolveFactSource = buildFactSource
681
701
  }
682
702
  export {
683
703
  ALL_OVERRIDE_DOMAINS,
704
+ MODULE_OVERRIDE_MODES,
684
705
  MODULE_OVERRIDE_TARGET_ADAPTERS,
706
+ MODULE_OVERRIDE_TARGET_DIAGNOSTIC_CODES,
707
+ MODULE_OVERRIDE_TARGET_NOTES,
685
708
  collectModuleOverrideTargets,
686
- computeOverrideTargetId
709
+ computeOverrideTargetId,
710
+ resolveFrameworkOverrideModes
687
711
  };
688
712
  //# sourceMappingURL=module-override-targets.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/generators/module-override-targets.ts"],
4
- "sourcesContent": ["import crypto from 'node:crypto'\nimport type { ModuleOverrideDomain } from '@open-mercato/shared/modules/overrides'\nimport type { ModuleExtensionContributionFact } from '@open-mercato/shared/modules/widgets/extension-points'\nimport type {\n ModuleFactRef,\n ModuleFactSourceKind,\n ModuleFactSourceRef,\n ModuleFactsJsonEntry,\n ModuleOwnedContractFact,\n} from './module-facts'\nimport { buildFactSourceLookup, type FactSourceLookup } from './module-fact-sources'\nimport { getFrameworkOverrideModes } from './module-extension-facts'\n\n/**\n * Exact module-specific unified override targets.\n *\n * Spec: `.ai/specs/2026-08-02-module-facts-exact-override-targets.md`.\n *\n * Projects every concrete key a downstream app can set under\n * `modules.<moduleId>.overrides.<domain>` from the normalized owned facts\n * (spec 1 provenance) and the extension-surface contributions (spec 2). Each\n * target carries the structured runtime `path`, the applicable framework mode,\n * a module-owned `factRef`, and a portable `source`. The framework catalog\n * (`framework-extension-points`) stays the authority for domains/modes; this\n * layer only emits the module's concrete keys. Framework-only settings such as\n * `nav.groupOrder` are never module targets.\n */\n\nexport type ModuleOverrideMode = 'disable-replace' | 'replace' | 'additive'\n\nexport type ModuleOverrideTargetNote =\n | 'safe-metadata-only'\n | 'page-middleware-not-mutation-guard'\n\nexport type ModuleOverrideTarget = {\n id: string\n domain: ModuleOverrideDomain\n key?: string\n path: string[]\n modes: ModuleOverrideMode[]\n factRef: ModuleFactRef\n source: ModuleFactSourceRef\n notes?: ModuleOverrideTargetNote[]\n}\n\nexport type ModuleOverrideTargetDiagnosticCode =\n | 'missing-owned-fact'\n | 'missing-source'\n | 'unsupported-dynamic-key'\n | 'unknown-framework-domain'\n\nexport type ModuleOverrideTargetDiagnostic = {\n code: ModuleOverrideTargetDiagnosticCode\n moduleId: string\n domain: ModuleOverrideDomain\n candidatePath?: string[]\n source?: ModuleFactSourceRef\n}\n\n/**\n * Public, spec-shaped adapter view. `collect` mirrors the spec's illustrative\n * signature (targets only); `diagnose` is the additive per-module diagnostic\n * companion. Every adapter is bound to exactly one top-level override domain,\n * or classified `frameworkOnly` (framework-catalog settings that never become\n * module targets, e.g. `nav`).\n */\nexport type OverrideTargetAdapter = {\n domain: ModuleOverrideDomain\n collect(moduleFacts: ModuleFactsJsonEntry): ModuleOverrideTarget[]\n diagnose(moduleFacts: ModuleFactsJsonEntry): ModuleOverrideTargetDiagnostic[]\n frameworkOnly?: boolean\n}\n\ntype AdapterResult = {\n targets: ModuleOverrideTarget[]\n diagnostics: ModuleOverrideTargetDiagnostic[]\n}\n\ntype InternalAdapter = {\n domain: ModuleOverrideDomain\n frameworkOnly?: boolean\n run(moduleFacts: ModuleFactsJsonEntry, resolveFactSource: FactSourceLookup): AdapterResult\n}\n\nconst OVERRIDE_MODES = getFrameworkOverrideModes()\n\n/**\n * Supported modes come from the framework catalog only. A host the catalog does not\n * describe is never guessed: the caller emits an `unknown-framework-domain`\n * diagnostic and no target, so a downstream app is not told a key is overridable in\n * a mode the runtime may not support.\n */\nfunction modesFor(dottedHost: string): ModuleOverrideMode[] | null {\n const mode = OVERRIDE_MODES[dottedHost]\n return mode ? [mode] : null\n}\n\n/**\n * The module id equals the last segment of the portable `sourceRoot`\n * (`node_modules/<pkg>/src/modules/<moduleId>`), which the provenance builder\n * derives from the module id itself, so this round-trips losslessly.\n */\nfunction moduleIdOf(facts: ModuleFactsJsonEntry): string {\n const segments = facts.sourceRoot.split('/').filter(Boolean)\n return segments[segments.length - 1] ?? ''\n}\n\n/**\n * Deterministic id derived from the JSON-serialized `[moduleId, domain, path]`\n * tuple so segment boundaries cannot collide. `path` remains the lossless\n * authority; this is a compact stable handle for consumers that key by id.\n */\nexport function computeOverrideTargetId(moduleId: string, domain: ModuleOverrideDomain, path: string[]): string {\n return crypto.createHash('sha1').update(JSON.stringify([moduleId, domain, path])).digest('hex').slice(0, 16)\n}\n\nfunction compareSourceRefs(left: ModuleFactSourceRef, right: ModuleFactSourceRef): number {\n return (\n left.sourcePath.localeCompare(right.sourcePath) ||\n (left.line ?? 0) - (right.line ?? 0) ||\n (left.exportName ?? '').localeCompare(right.exportName ?? '')\n )\n}\n\nfunction comparePaths(left: string[], right: string[]): number {\n const length = Math.max(left.length, right.length)\n for (let index = 0; index < length; index += 1) {\n const leftSegment = left[index]\n const rightSegment = right[index]\n if (leftSegment === undefined) return -1\n if (rightSegment === undefined) return 1\n const compared = leftSegment.localeCompare(rightSegment)\n if (compared !== 0) return compared\n }\n return 0\n}\n\ntype MakeTargetInput = {\n moduleId: string\n domain: ModuleOverrideDomain\n path: string[]\n dottedHost: string\n factRef: ModuleFactRef\n source: ModuleFactSourceRef\n key?: string\n notes?: ModuleOverrideTargetNote[]\n}\n\nfunction makeTarget(input: MakeTargetInput): ModuleOverrideTarget | null {\n const modes = modesFor(input.dottedHost)\n if (!modes) return null\n const target: ModuleOverrideTarget = {\n id: computeOverrideTargetId(input.moduleId, input.domain, input.path),\n domain: input.domain,\n ...(input.key !== undefined ? { key: input.key } : {}),\n path: input.path,\n modes,\n factRef: input.factRef,\n source: input.source,\n ...(input.notes && input.notes.length > 0 ? { notes: input.notes } : {}),\n }\n return target\n}\n\n/**\n * Emits the target, or an `unknown-framework-domain` diagnostic when the framework\n * catalog does not describe the target's dotted host.\n */\nfunction pushTarget(\n targets: ModuleOverrideTarget[],\n diagnostics: ModuleOverrideTargetDiagnostic[],\n input: MakeTargetInput,\n): void {\n const target = makeTarget(input)\n if (target) {\n targets.push(target)\n return\n }\n diagnostics.push({\n code: 'unknown-framework-domain',\n moduleId: input.moduleId,\n domain: input.domain,\n candidatePath: input.path,\n source: input.source,\n })\n}\n\n/** Portable contribution source ref \u2192 override target source ref. */\nfunction contributionSource(contribution: ModuleExtensionContributionFact): ModuleFactSourceRef {\n return {\n sourcePath: contribution.source.path,\n ...(contribution.source.symbol ? { exportName: contribution.source.symbol } : {}),\n }\n}\n\n/** Owned-contract source ref, dropping the (constant) exportName for compactness. */\nfunction ownedSource(fact: ModuleOwnedContractFact): ModuleFactSourceRef {\n return {\n sourcePath: fact.source.sourcePath,\n ...(fact.source.line ? { line: fact.source.line } : {}),\n }\n}\n\nfunction contributionsOfKind<K extends ModuleExtensionContributionFact['kind']>(\n facts: ModuleFactsJsonEntry,\n kind: K,\n): Array<Extract<ModuleExtensionContributionFact, { kind: K }>> {\n const contributions = facts.extensionSurfaces?.contributions ?? []\n return contributions.filter((contribution): contribution is Extract<ModuleExtensionContributionFact, { kind: K }> =>\n contribution.kind === kind,\n )\n}\n\nfunction indexedFactSourcePath(\n resolveFactSource: FactSourceLookup,\n kind: ModuleFactSourceKind,\n id: string,\n): string | null {\n return resolveFactSource(kind, id)?.sourcePath ?? null\n}\n\n// ---------------------------------------------------------------------------\n// Local canonical override-key normalizers.\n//\n// These MIRROR the private `normalizeApiRouteOverrideKey` /\n// `normalizePageRouteOverrideKey` in\n// `packages/shared/src/modules/overrides.ts` (not exported by that module).\n// Round-trip tests feed the emitted keys back through the exported runtime\n// appliers (`applyApiOverridesToManifests` / `applyPageOverridesToManifests`)\n// to prove equivalence. See the implementation report: exporting the shared\n// normalizers would let this file import rather than mirror them.\n// ---------------------------------------------------------------------------\n\nconst VALID_HTTP_METHODS = new Set(['GET', 'POST', 'PUT', 'PATCH', 'DELETE'])\n\n/**\n * Canonical `'METHOD /api/path'` public override key for a route method. Route\n * fact paths are stored without the `/api` prefix (e.g. `/customers/x`), so the\n * public key downstream apps write is `METHOD /api<path>`.\n */\nfunction apiRouteOverrideKey(method: string, routePath: string): string | null {\n const upper = method.trim().toUpperCase()\n if (!VALID_HTTP_METHODS.has(upper)) return null\n const withLead = routePath.startsWith('/') ? routePath : `/${routePath}`\n const publicPath = withLead.startsWith('/api/') || withLead === '/api' ? withLead : `/api${withLead}`\n const normalized = publicPath.replace(/\\/+$/, '') || '/'\n return `${upper} ${normalized}`\n}\n\nfunction pageRouteOverrideKey(routePath: string): string | null {\n const trimmed = routePath.trim()\n if (!trimmed) return null\n if (trimmed.startsWith('backend:') || trimmed.startsWith('frontend:')) return trimmed\n const withLead = trimmed.startsWith('/') ? trimmed : `/${trimmed}`\n const stripped = withLead.replace(/\\/+$/, '') || '/'\n if (stripped === '/frontend') return 'frontend:/'\n if (stripped.startsWith('/frontend/')) return `frontend:/${stripped.slice('/frontend/'.length)}`\n if (stripped === '/backend' || stripped.startsWith('/backend/')) return `backend:${stripped}`\n return `frontend:${stripped}`\n}\n\n// ---------------------------------------------------------------------------\n// Adapters (one per top-level override domain).\n// ---------------------------------------------------------------------------\n\nconst aiAdapter: InternalAdapter = {\n domain: 'ai',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n for (const agent of facts.aiAgents) {\n if (!agent.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'ai', candidatePath: ['ai', 'agents', agent.id] })\n continue\n }\n const path = ['ai', 'agents', agent.id]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path, key: agent.id, dottedHost: 'ai.agents',\n factRef: { factSection: 'aiAgents', factKey: agent.id },\n source: { sourcePath: agent.sourcePath },\n })\n }\n for (const tool of facts.aiTools) {\n if (!tool.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'ai', candidatePath: ['ai', 'tools', tool.name] })\n continue\n }\n const path = ['ai', 'tools', tool.name]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path, key: tool.name, dottedHost: 'ai.tools',\n factRef: { factSection: 'aiTools', factKey: tool.name },\n source: { sourcePath: tool.sourcePath },\n })\n }\n // AI file contracts split by mode: keyed `aiAgentOverrides` / `aiToolOverrides`\n // entries are exact `ai.agents.<id>` / `ai.tools.<id>` targets, while additive\n // `aiAgentExtensions` patches belong to the keyless `ai.extensions` array.\n const aiFileContracts = facts.ownedContracts?.['ai-extension'] ?? []\n const additiveExtensions: ModuleOwnedContractFact[] = []\n for (const fact of aiFileContracts) {\n const metadata = fact.metadata ?? {}\n if (metadata.mode !== 'override') {\n additiveExtensions.push(fact)\n continue\n }\n const overrideKey = typeof metadata.overrideKey === 'string' ? metadata.overrideKey : null\n const target = metadata.target === 'agent' ? 'agents' : metadata.target === 'tool' ? 'tools' : null\n if (!overrideKey || !target) {\n diagnostics.push({\n code: 'unsupported-dynamic-key',\n moduleId,\n domain: 'ai',\n candidatePath: ['ai', target ?? 'extensions'],\n source: ownedSource(fact),\n })\n continue\n }\n const path = ['ai', target, overrideKey]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path, key: overrideKey, dottedHost: `ai.${target}`,\n factRef: { factSection: 'ownedContracts.ai-extension', factKey: fact.id },\n source: ownedSource(fact),\n })\n }\n if (additiveExtensions.length > 0) {\n const anchor = [...additiveExtensions].sort((left, right) => left.id.localeCompare(right.id))[0]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path: ['ai', 'extensions'], dottedHost: 'ai.extensions',\n factRef: { factSection: 'ownedContracts.ai-extension', factKey: anchor.id },\n source: ownedSource(anchor),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst routesAdapter: InternalAdapter = {\n domain: 'routes',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n for (const route of facts.apiRoutes) {\n for (const method of route.methods) {\n const key = apiRouteOverrideKey(method, route.path)\n if (!key) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'routes', candidatePath: ['routes', 'api', `${method} ${route.path}`] })\n continue\n }\n if (!route.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'routes', candidatePath: ['routes', 'api', key] })\n continue\n }\n const path = ['routes', 'api', key]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'routes', path, key, dottedHost: 'routes.api',\n factRef: { factSection: 'apiRoutes', factKey: route.path },\n source: { sourcePath: route.sourcePath },\n })\n }\n }\n\n const emitPage = (page: { path: string; sourcePath: string }, section: 'backendPages' | 'frontendPages'): void => {\n const key = pageRouteOverrideKey(page.path)\n if (!key) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'routes', candidatePath: ['routes', 'pages', page.path] })\n return\n }\n if (!page.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'routes', candidatePath: ['routes', 'pages', key] })\n return\n }\n const path = ['routes', 'pages', key]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'routes', path, key, dottedHost: 'routes.pages',\n factRef: { factSection: section, factKey: page.path },\n source: { sourcePath: page.sourcePath },\n })\n }\n for (const page of facts.backendPages) emitPage(page, 'backendPages')\n for (const page of facts.frontendPages) emitPage(page, 'frontendPages')\n\n return { targets, diagnostics }\n },\n}\n\nconst eventsAdapter: InternalAdapter = {\n domain: 'events',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const contribution of contributionsOfKind(facts, 'subscriber')) {\n const subscriberId = contribution.details.subscriberId || contribution.id\n const path = ['events', 'subscribers', subscriberId]\n if (!contribution.source.path) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'events', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'events', path, key: subscriberId, dottedHost: 'events.subscribers',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst workersAdapter: InternalAdapter = {\n domain: 'workers',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.worker ?? []) {\n const path = ['workers', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'workers', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'workers', path, key: fact.id, dottedHost: 'workers',\n factRef: { factSection: 'ownedContracts.worker', factKey: fact.id },\n source: ownedSource(fact),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst widgetsAdapter: InternalAdapter = {\n domain: 'widgets',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n const emitInjection = (registryKey: string, contribution: ModuleExtensionContributionFact): void => {\n const path = ['widgets', 'injection', registryKey]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'widgets', path, key: registryKey, dottedHost: 'widgets.injection',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n\n for (const contribution of contributionsOfKind(facts, 'widget')) {\n const registryKey = contribution.details.registryKey\n if (!registryKey) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'widgets', candidatePath: ['widgets', 'injection', contribution.id] })\n continue\n }\n if (contribution.details.payload === 'dashboard') {\n const path = ['widgets', 'dashboard', registryKey]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'widgets', path, key: registryKey, dottedHost: 'widgets.dashboard',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n } else {\n emitInjection(registryKey, contribution)\n }\n }\n\n // data-table / crud-form contributions are injection-widget entries whose\n // registry key is the id segment before the `@<spot>` suffix.\n for (const contribution of [\n ...contributionsOfKind(facts, 'data-table'),\n ...contributionsOfKind(facts, 'crud-form'),\n ]) {\n const registryKey = contribution.id.split('@')[0]\n if (!registryKey || registryKey === contribution.id) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'widgets', candidatePath: ['widgets', 'injection', contribution.id] })\n continue\n }\n emitInjection(registryKey, contribution)\n }\n\n for (const contribution of contributionsOfKind(facts, 'component-override')) {\n const componentId = contribution.details.handle\n const path = ['widgets', 'components', componentId]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'widgets', path, key: componentId, dottedHost: 'widgets.components',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n\n return { targets, diagnostics }\n },\n}\n\nconst notificationsAdapter: InternalAdapter = {\n domain: 'notifications',\n run(facts, resolveFactSource) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n const registrySources = new Map<string, ModuleFactSourceRef>()\n for (const contribution of contributionsOfKind(facts, 'specialized-registry')) {\n if (contribution.details.registry !== 'notification') continue\n registrySources.set(contribution.details.registryId, contributionSource(contribution))\n }\n for (const type of facts.notifications) {\n const path = ['notifications', 'types', type]\n const indexedPath = indexedFactSourcePath(resolveFactSource, 'notification', type)\n const source = registrySources.get(type) ?? (indexedPath ? { sourcePath: indexedPath } : null)\n if (!source) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'notifications', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'notifications', path, key: type, dottedHost: 'notifications.types',\n factRef: { factSection: 'notifications', factKey: type },\n source,\n })\n }\n\n // Reactive handlers (`notifications.handlers.ts`) are keyed by their declared\n // handler id; a handler that declares none cannot be addressed by runtime.\n for (const contribution of contributionsOfKind(facts, 'browser-reaction')) {\n if (!contribution.details.transports.includes('notification-effect')) continue\n const overrideKey = contribution.details.overrideKey\n if (!overrideKey) {\n diagnostics.push({\n code: 'unsupported-dynamic-key',\n moduleId,\n domain: 'notifications',\n candidatePath: ['notifications', 'handlers'],\n source: contributionSource(contribution),\n })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId,\n domain: 'notifications',\n path: ['notifications', 'handlers', overrideKey],\n key: overrideKey,\n dottedHost: 'notifications.handlers',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nfunction contributionIdAdapter(\n domain: ModuleOverrideDomain,\n kind: ModuleExtensionContributionFact['kind'],\n dottedHost: string,\n): InternalAdapter {\n return {\n domain,\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const contribution of contributionsOfKind(facts, kind)) {\n const path = [domain, contribution.id]\n if (!contribution.source.path) {\n diagnostics.push({ code: 'missing-source', moduleId, domain, candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain, path, key: contribution.id, dottedHost,\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n return { targets, diagnostics }\n },\n }\n}\n\nconst interceptorsAdapter = contributionIdAdapter('interceptors', 'api-interceptor', 'interceptors')\nconst commandInterceptorsAdapter = contributionIdAdapter('commandInterceptors', 'command-interceptor', 'commandInterceptors')\nconst enrichersAdapter = contributionIdAdapter('enrichers', 'response-enricher', 'enrichers')\n\n/**\n * `guards` targets ONLY backend/frontend page route middleware\n * (`ownedContracts['page-middleware']`). `data/guards.ts` mutation guards\n * (contribution kind `mutation-guard`) are a different runtime contract and\n * MUST NEVER surface here \u2014 every target carries the closed\n * `page-middleware-not-mutation-guard` note.\n */\nconst guardsAdapter: InternalAdapter = {\n domain: 'guards',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.['page-middleware'] ?? []) {\n const path = ['guards', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'guards', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'guards', path, key: fact.id, dottedHost: 'guards',\n factRef: { factSection: 'ownedContracts.page-middleware', factKey: fact.id },\n source: ownedSource(fact),\n notes: ['page-middleware-not-mutation-guard'],\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst cliAdapter: InternalAdapter = {\n domain: 'cli',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const command of facts.cliCommands) {\n const path = ['cli', command.command]\n if (!command.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'cli', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'cli', path, key: command.command, dottedHost: 'cli',\n factRef: { factSection: 'cliCommands', factKey: command.command },\n source: { sourcePath: command.sourcePath },\n })\n }\n return { targets, diagnostics }\n },\n}\n\n// `SetupOverridesShape` keys the runtime override resolver accepts. Only these\n// supported hook/profile properties become `setup` targets.\nconst SUPPORTED_SETUP_HOOKS = new Set(['seedDefaults', 'seedExamples', 'onTenantCreated'])\n\nconst setupAdapter: InternalAdapter = {\n domain: 'setup',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n const setupFacts = facts.ownedContracts?.setup ?? []\n for (const fact of setupFacts) {\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'setup', candidatePath: ['setup'] })\n continue\n }\n const source = ownedSource(fact)\n const properties: string[] = []\n const hooks = fact.metadata?.hooks\n if (Array.isArray(hooks)) {\n for (const hook of hooks) {\n if (typeof hook === 'string' && SUPPORTED_SETUP_HOOKS.has(hook)) properties.push(hook)\n }\n }\n const roles = fact.metadata?.roles\n if (Array.isArray(roles) && roles.length > 0) properties.push('defaultRoleFeatures')\n const customerRoles = fact.metadata?.customerRoles\n if (Array.isArray(customerRoles) && customerRoles.length > 0) properties.push('defaultCustomerRoleFeatures')\n for (const property of properties) {\n const path = ['setup', property]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'setup', path, dottedHost: 'setup',\n factRef: { factSection: 'ownedContracts.setup', factKey: fact.id },\n source,\n })\n }\n }\n return { targets, diagnostics }\n },\n}\n\nconst aclAdapter: InternalAdapter = {\n domain: 'acl',\n run(facts, resolveFactSource) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const feature of facts.aclFeatures) {\n const path = ['acl', 'features', feature]\n const sourcePath = indexedFactSourcePath(resolveFactSource, 'acl-feature', feature)\n if (!sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'acl', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'acl', path, key: feature, dottedHost: 'acl.features',\n factRef: { factSection: 'aclFeatures', factKey: feature },\n source: { sourcePath },\n })\n }\n return { targets, diagnostics }\n },\n}\n\n/**\n * `di` targets expose the exact registration token and correlate to the rich DI\n * owned fact (which carries the registration kind). They NEVER include the\n * `asValue` payload, constructed service, or factory/class body \u2014 the target\n * schema has no such field and carries the `safe-metadata-only` note.\n */\nconst diAdapter: InternalAdapter = {\n domain: 'di',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.['di-registration'] ?? []) {\n const path = ['di', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'di', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'di', path, key: fact.id, dottedHost: 'di',\n factRef: { factSection: 'ownedContracts.di-registration', factKey: fact.id },\n source: ownedSource(fact),\n notes: ['safe-metadata-only'],\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst encryptionAdapter: InternalAdapter = {\n domain: 'encryption',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.encryption ?? []) {\n const path = ['encryption', 'maps', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'encryption', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'encryption', path, key: fact.id, dottedHost: 'encryption.maps',\n factRef: { factSection: 'ownedContracts.encryption', factKey: fact.id },\n source: ownedSource(fact),\n })\n }\n return { targets, diagnostics }\n },\n}\n\n/** `nav.groupOrder` is a framework-only setting; never a module target. */\nconst navAdapter: InternalAdapter = {\n domain: 'nav',\n frameworkOnly: true,\n run() {\n return { targets: [], diagnostics: [] }\n },\n}\n\nconst INTERNAL_ADAPTERS: InternalAdapter[] = [\n aiAdapter,\n routesAdapter,\n eventsAdapter,\n workersAdapter,\n widgetsAdapter,\n notificationsAdapter,\n interceptorsAdapter,\n commandInterceptorsAdapter,\n enrichersAdapter,\n guardsAdapter,\n cliAdapter,\n setupAdapter,\n aclAdapter,\n diAdapter,\n encryptionAdapter,\n navAdapter,\n]\n\n/**\n * Runtime enumeration of every unified override domain. Typed as a\n * `Record<ModuleOverrideDomain, true>` so adding a member to the runtime\n * `ModuleOverrideDomain` union fails the build here until it is listed \u2014 and\n * the coverage test then fails until an adapter (or `frameworkOnly`\n * classification) is registered.\n */\nconst OVERRIDE_DOMAIN_PRESENCE: Record<ModuleOverrideDomain, true> = {\n ai: true,\n routes: true,\n events: true,\n workers: true,\n widgets: true,\n notifications: true,\n interceptors: true,\n commandInterceptors: true,\n enrichers: true,\n guards: true,\n cli: true,\n setup: true,\n acl: true,\n di: true,\n encryption: true,\n nav: true,\n}\n\nexport const ALL_OVERRIDE_DOMAINS = Object.keys(OVERRIDE_DOMAIN_PRESENCE) as ModuleOverrideDomain[]\n\nexport const MODULE_OVERRIDE_TARGET_ADAPTERS: OverrideTargetAdapter[] = INTERNAL_ADAPTERS.map((adapter) => ({\n domain: adapter.domain,\n ...(adapter.frameworkOnly ? { frameworkOnly: true } : {}),\n collect: (moduleFacts) => adapter.run(moduleFacts, buildFactSourceLookup(moduleFacts)).targets,\n diagnose: (moduleFacts) => adapter.run(moduleFacts, buildFactSourceLookup(moduleFacts)).diagnostics,\n}))\n\nexport type ModuleOverrideTargetsResult = {\n overrideTargets: ModuleOverrideTarget[]\n overrideTargetDiagnostics: ModuleOverrideTargetDiagnostic[]\n}\n\n/**\n * Project every exact override target (and per-module diagnostic) for one\n * module's facts. Output sorts by domain, then path segments, then source;\n * diagnostics sort by moduleId, domain, code, then path/source. Targets are\n * deduped by `(domain, path)` keeping the source-first entry.\n */\nexport function collectModuleOverrideTargets(\n facts: ModuleFactsJsonEntry,\n resolveFactSource: FactSourceLookup = buildFactSourceLookup(facts),\n): ModuleOverrideTargetsResult {\n const collected: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const adapter of INTERNAL_ADAPTERS) {\n if (adapter.frameworkOnly) continue\n const result = adapter.run(facts, resolveFactSource)\n collected.push(...result.targets)\n diagnostics.push(...result.diagnostics)\n }\n\n const byPath = new Map<string, ModuleOverrideTarget>()\n for (const target of collected) {\n const pathKey = `${target.domain} ${JSON.stringify(target.path)}`\n const existing = byPath.get(pathKey)\n if (!existing || compareSourceRefs(target.source, existing.source) < 0) byPath.set(pathKey, target)\n }\n\n const overrideTargets = [...byPath.values()].sort(\n (left, right) =>\n left.domain.localeCompare(right.domain) ||\n comparePaths(left.path, right.path) ||\n compareSourceRefs(left.source, right.source),\n )\n\n const overrideTargetDiagnostics = diagnostics.sort(\n (left, right) =>\n left.moduleId.localeCompare(right.moduleId) ||\n left.domain.localeCompare(right.domain) ||\n left.code.localeCompare(right.code) ||\n comparePaths(left.candidatePath ?? [], right.candidatePath ?? []) ||\n compareSourceRefs(left.source ?? { sour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nD,cAAU,KAAK,GAAG,OAAO,OAAO;AAChC,gBAAY,KAAK,GAAG,OAAO,WAAW;AAAA,EACxC;AAEA,QAAM,SAAS,oBAAI,IAAkC;AACrD,aAAW,UAAU,WAAW;AAC9B,UAAM,UAAU,GAAG,OAAO,MAAM,IAAI,KAAK,UAAU,OAAO,IAAI,CAAC;AAC/D,UAAM,WAAW,OAAO,IAAI,OAAO;AACnC,QAAI,CAAC,YAAY,kBAAkB,OAAO,QAAQ,SAAS,MAAM,IAAI,EAAG,QAAO,IAAI,SAAS,MAAM;AAAA,EACpG;AAEA,QAAM,kBAAkB,CAAC,GAAG,OAAO,OAAO,CAAC,EAAE;AAAA,IAC3C,CAAC,MAAM,UACL,KAAK,OAAO,cAAc,MAAM,MAAM,KACtC,aAAa,KAAK,MAAM,MAAM,IAAI,KAClC,kBAAkB,KAAK,QAAQ,MAAM,MAAM;AAAA,EAC/C;AAEA,QAAM,4BAA4B,YAAY;AAAA,IAC5C,CAAC,MAAM,UACL,KAAK,SAAS,cAAc,MAAM,QAAQ,KAC1C,KAAK,OAAO,cAAc,MAAM,MAAM,KACtC,KAAK,KAAK,cAAc,MAAM,IAAI,KAClC,aAAa,KAAK,iBAAiB,CAAC,GAAG,MAAM,iBAAiB,CAAC,CAAC,KAChE,kBAAkB,KAAK,UAAU,EAAE,YAAY,GAAG,GAAG,MAAM,UAAU,EAAE,YAAY,GAAG,CAAC;AAAA,EAC3F;AAEA,SAAO,EAAE,iBAAiB,0BAA0B;AACtD;",
4
+ "sourcesContent": ["import crypto from 'node:crypto'\nimport type { ModuleOverrideDomain } from '@open-mercato/shared/modules/overrides'\nimport type { ModuleExtensionContributionFact } from '@open-mercato/shared/modules/widgets/extension-points'\nimport type {\n ModuleFactRef,\n ModuleFactSourceKind,\n ModuleFactSourceRef,\n ModuleFactsJsonEntry,\n ModuleOwnedContractFact,\n} from './module-facts'\nimport { buildFactSourceLookup, type FactSourceLookup } from './module-fact-sources'\nimport { getFrameworkOverrideHostOperations } from './module-extension-facts'\n\n/**\n * Exact module-specific unified override targets.\n *\n * Spec: `.ai/specs/2026-08-02-module-facts-exact-override-targets.md`.\n *\n * Projects every concrete key a downstream app can set under\n * `modules.<moduleId>.overrides.<domain>` from the normalized owned facts\n * (spec 1 provenance) and the extension-surface contributions (spec 2). Each\n * target carries the structured runtime `path`, the applicable framework mode,\n * a module-owned `factRef`, and a portable `source`. The framework catalog\n * (`framework-extension-points`) stays the authority for domains/modes; this\n * layer only emits the module's concrete keys. Framework-only settings such as\n * `nav.groupOrder` are never module targets.\n */\n\n/**\n * Closed mode/note/diagnostic sets, published as `as const` ledgers whose types\n * derive from them. The `factCoverage` ledger enumerates these at runtime, so a\n * value added here without a ledger row fails the coverage contract test instead\n * of silently widening the public surface.\n */\nexport const MODULE_OVERRIDE_MODES = ['disable-replace', 'replace', 'additive'] as const\n\nexport type ModuleOverrideMode = (typeof MODULE_OVERRIDE_MODES)[number]\n\nexport const MODULE_OVERRIDE_TARGET_NOTES = [\n 'safe-metadata-only',\n 'page-middleware-not-mutation-guard',\n] as const\n\nexport type ModuleOverrideTargetNote = (typeof MODULE_OVERRIDE_TARGET_NOTES)[number]\n\nfunction isModuleOverrideMode(value: string): value is ModuleOverrideMode {\n return (MODULE_OVERRIDE_MODES as readonly string[]).includes(value)\n}\n\nexport type ModuleOverrideTarget = {\n id: string\n domain: ModuleOverrideDomain\n key?: string\n path: string[]\n modes: ModuleOverrideMode[]\n factRef: ModuleFactRef\n source: ModuleFactSourceRef\n notes?: ModuleOverrideTargetNote[]\n}\n\nexport const MODULE_OVERRIDE_TARGET_DIAGNOSTIC_CODES = [\n 'missing-owned-fact',\n 'missing-source',\n 'unsupported-dynamic-key',\n 'unknown-framework-domain',\n 'unknown-framework-mode',\n] as const\n\nexport type ModuleOverrideTargetDiagnosticCode = (typeof MODULE_OVERRIDE_TARGET_DIAGNOSTIC_CODES)[number]\n\nexport type ModuleOverrideTargetDiagnostic = {\n code: ModuleOverrideTargetDiagnosticCode\n moduleId: string\n domain: ModuleOverrideDomain\n candidatePath?: string[]\n source?: ModuleFactSourceRef\n}\n\n/**\n * Public, spec-shaped adapter view. `collect` mirrors the spec's illustrative\n * signature (targets only); `diagnose` is the additive per-module diagnostic\n * companion. Every adapter is bound to exactly one top-level override domain,\n * or classified `frameworkOnly` (framework-catalog settings that never become\n * module targets, e.g. `nav`).\n */\nexport type OverrideTargetAdapter = {\n domain: ModuleOverrideDomain\n collect(moduleFacts: ModuleFactsJsonEntry): ModuleOverrideTarget[]\n diagnose(moduleFacts: ModuleFactsJsonEntry): ModuleOverrideTargetDiagnostic[]\n frameworkOnly?: boolean\n}\n\ntype AdapterResult = {\n targets: ModuleOverrideTarget[]\n diagnostics: ModuleOverrideTargetDiagnostic[]\n}\n\ntype InternalAdapter = {\n domain: ModuleOverrideDomain\n frameworkOnly?: boolean\n run(moduleFacts: ModuleFactsJsonEntry, resolveFactSource: FactSourceLookup): AdapterResult\n}\n\nconst OVERRIDE_HOST_OPERATIONS = getFrameworkOverrideHostOperations()\n\n/**\n * Why a dotted host produced no modes. The two failure causes are distinct and a\n * downstream app needs to tell them apart: an absent host means the catalog never\n * described this override surface, while an unrecognized mode means the catalog\n * *does* describe it but names an operation this generator cannot map to a public\n * {@link ModuleOverrideMode}. Collapsing the second into the first would report a\n * catalog the generator has fallen behind as a surface that does not exist.\n */\nexport type FrameworkOverrideModeResolution =\n | { outcome: 'resolved'; modes: ModuleOverrideMode[] }\n | { outcome: 'unknown-framework-domain' }\n | { outcome: 'unknown-framework-mode'; operation: string }\n\n/**\n * Supported modes come from the framework catalog only. A host the catalog does not\n * describe is never guessed, and neither is a host whose declared operation is not a\n * known mode: both produce no target, so a downstream app is never told a key is\n * overridable in a mode the runtime may not support.\n */\nexport function resolveFrameworkOverrideModes(operation: string | undefined): FrameworkOverrideModeResolution {\n if (operation === undefined) return { outcome: 'unknown-framework-domain' }\n if (!isModuleOverrideMode(operation)) return { outcome: 'unknown-framework-mode', operation }\n return { outcome: 'resolved', modes: [operation] }\n}\n\nfunction modesFor(dottedHost: string): FrameworkOverrideModeResolution {\n return resolveFrameworkOverrideModes(OVERRIDE_HOST_OPERATIONS[dottedHost])\n}\n\n/**\n * The module id equals the last segment of the portable `sourceRoot`\n * (`node_modules/<pkg>/src/modules/<moduleId>`), which the provenance builder\n * derives from the module id itself, so this round-trips losslessly.\n */\nfunction moduleIdOf(facts: ModuleFactsJsonEntry): string {\n const segments = facts.sourceRoot.split('/').filter(Boolean)\n return segments[segments.length - 1] ?? ''\n}\n\n/**\n * Deterministic id derived from the JSON-serialized `[moduleId, domain, path]`\n * tuple so segment boundaries cannot collide. `path` remains the lossless\n * authority; this is a compact stable handle for consumers that key by id.\n */\nexport function computeOverrideTargetId(moduleId: string, domain: ModuleOverrideDomain, path: string[]): string {\n return crypto.createHash('sha1').update(JSON.stringify([moduleId, domain, path])).digest('hex').slice(0, 16)\n}\n\nfunction compareSourceRefs(left: ModuleFactSourceRef, right: ModuleFactSourceRef): number {\n return (\n left.sourcePath.localeCompare(right.sourcePath) ||\n (left.line ?? 0) - (right.line ?? 0) ||\n (left.exportName ?? '').localeCompare(right.exportName ?? '')\n )\n}\n\nfunction comparePaths(left: string[], right: string[]): number {\n const length = Math.max(left.length, right.length)\n for (let index = 0; index < length; index += 1) {\n const leftSegment = left[index]\n const rightSegment = right[index]\n if (leftSegment === undefined) return -1\n if (rightSegment === undefined) return 1\n const compared = leftSegment.localeCompare(rightSegment)\n if (compared !== 0) return compared\n }\n return 0\n}\n\ntype MakeTargetInput = {\n moduleId: string\n domain: ModuleOverrideDomain\n path: string[]\n dottedHost: string\n factRef: ModuleFactRef\n source: ModuleFactSourceRef\n key?: string\n notes?: ModuleOverrideTargetNote[]\n}\n\n/** The resolution outcomes that yield no target; each names its own diagnostic code. */\ntype UnresolvedOverrideMode = Exclude<FrameworkOverrideModeResolution, { outcome: 'resolved' }>\n\nfunction makeTarget(input: MakeTargetInput): ModuleOverrideTarget | UnresolvedOverrideMode {\n const resolution = modesFor(input.dottedHost)\n if (resolution.outcome !== 'resolved') return resolution\n const { modes } = resolution\n const target: ModuleOverrideTarget = {\n id: computeOverrideTargetId(input.moduleId, input.domain, input.path),\n domain: input.domain,\n ...(input.key !== undefined ? { key: input.key } : {}),\n path: input.path,\n modes,\n factRef: input.factRef,\n source: input.source,\n ...(input.notes && input.notes.length > 0 ? { notes: input.notes } : {}),\n }\n return target\n}\n\n/**\n * Emits the target, or the diagnostic matching why the framework catalog yielded no\n * modes: `unknown-framework-domain` when the catalog does not describe the target's\n * dotted host at all, `unknown-framework-mode` when it describes the host but names\n * an operation that is not a public {@link ModuleOverrideMode}. Neither case guesses\n * a target.\n */\nfunction pushTarget(\n targets: ModuleOverrideTarget[],\n diagnostics: ModuleOverrideTargetDiagnostic[],\n input: MakeTargetInput,\n): void {\n const result = makeTarget(input)\n if (!('outcome' in result)) {\n targets.push(result)\n return\n }\n diagnostics.push({\n code: result.outcome,\n moduleId: input.moduleId,\n domain: input.domain,\n candidatePath: input.path,\n source: input.source,\n })\n}\n\n/** Portable contribution source ref \u2192 override target source ref. */\nfunction contributionSource(contribution: ModuleExtensionContributionFact): ModuleFactSourceRef {\n return {\n sourcePath: contribution.source.path,\n ...(contribution.source.symbol ? { exportName: contribution.source.symbol } : {}),\n }\n}\n\n/** Owned-contract source ref, dropping the (constant) exportName for compactness. */\nfunction ownedSource(fact: ModuleOwnedContractFact): ModuleFactSourceRef {\n return {\n sourcePath: fact.source.sourcePath,\n ...(fact.source.line ? { line: fact.source.line } : {}),\n }\n}\n\nfunction contributionsOfKind<K extends ModuleExtensionContributionFact['kind']>(\n facts: ModuleFactsJsonEntry,\n kind: K,\n): Array<Extract<ModuleExtensionContributionFact, { kind: K }>> {\n const contributions = facts.extensionSurfaces?.contributions ?? []\n return contributions.filter((contribution): contribution is Extract<ModuleExtensionContributionFact, { kind: K }> =>\n contribution.kind === kind,\n )\n}\n\nfunction indexedFactSourcePath(\n resolveFactSource: FactSourceLookup,\n kind: ModuleFactSourceKind,\n id: string,\n): string | null {\n return resolveFactSource(kind, id)?.sourcePath ?? null\n}\n\n// ---------------------------------------------------------------------------\n// Local canonical override-key normalizers.\n//\n// These MIRROR the private `normalizeApiRouteOverrideKey` /\n// `normalizePageRouteOverrideKey` in\n// `packages/shared/src/modules/overrides.ts` (not exported by that module).\n// Round-trip tests feed the emitted keys back through the exported runtime\n// appliers (`applyApiOverridesToManifests` / `applyPageOverridesToManifests`)\n// to prove equivalence. See the implementation report: exporting the shared\n// normalizers would let this file import rather than mirror them.\n// ---------------------------------------------------------------------------\n\nconst VALID_HTTP_METHODS = new Set(['GET', 'POST', 'PUT', 'PATCH', 'DELETE'])\n\n/**\n * Canonical `'METHOD /api/path'` public override key for a route method. Route\n * fact paths are stored without the `/api` prefix (e.g. `/customers/x`), so the\n * public key downstream apps write is `METHOD /api<path>`.\n */\nfunction apiRouteOverrideKey(method: string, routePath: string): string | null {\n const upper = method.trim().toUpperCase()\n if (!VALID_HTTP_METHODS.has(upper)) return null\n const withLead = routePath.startsWith('/') ? routePath : `/${routePath}`\n const publicPath = withLead.startsWith('/api/') || withLead === '/api' ? withLead : `/api${withLead}`\n const normalized = publicPath.replace(/\\/+$/, '') || '/'\n return `${upper} ${normalized}`\n}\n\nfunction pageRouteOverrideKey(routePath: string): string | null {\n const trimmed = routePath.trim()\n if (!trimmed) return null\n if (trimmed.startsWith('backend:') || trimmed.startsWith('frontend:')) return trimmed\n const withLead = trimmed.startsWith('/') ? trimmed : `/${trimmed}`\n const stripped = withLead.replace(/\\/+$/, '') || '/'\n if (stripped === '/frontend') return 'frontend:/'\n if (stripped.startsWith('/frontend/')) return `frontend:/${stripped.slice('/frontend/'.length)}`\n if (stripped === '/backend' || stripped.startsWith('/backend/')) return `backend:${stripped}`\n return `frontend:${stripped}`\n}\n\n// ---------------------------------------------------------------------------\n// Adapters (one per top-level override domain).\n// ---------------------------------------------------------------------------\n\nconst aiAdapter: InternalAdapter = {\n domain: 'ai',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n for (const agent of facts.aiAgents) {\n if (!agent.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'ai', candidatePath: ['ai', 'agents', agent.id] })\n continue\n }\n const path = ['ai', 'agents', agent.id]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path, key: agent.id, dottedHost: 'ai.agents',\n factRef: { factSection: 'aiAgents', factKey: agent.id },\n source: { sourcePath: agent.sourcePath },\n })\n }\n for (const tool of facts.aiTools) {\n if (!tool.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'ai', candidatePath: ['ai', 'tools', tool.name] })\n continue\n }\n const path = ['ai', 'tools', tool.name]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path, key: tool.name, dottedHost: 'ai.tools',\n factRef: { factSection: 'aiTools', factKey: tool.name },\n source: { sourcePath: tool.sourcePath },\n })\n }\n // AI file contracts split by mode: keyed `aiAgentOverrides` / `aiToolOverrides`\n // entries are exact `ai.agents.<id>` / `ai.tools.<id>` targets, while additive\n // `aiAgentExtensions` patches belong to the keyless `ai.extensions` array.\n const aiFileContracts = facts.ownedContracts?.['ai-extension'] ?? []\n const additiveExtensions: ModuleOwnedContractFact[] = []\n for (const fact of aiFileContracts) {\n const metadata = fact.metadata ?? {}\n if (metadata.mode !== 'override') {\n additiveExtensions.push(fact)\n continue\n }\n const overrideKey = typeof metadata.overrideKey === 'string' ? metadata.overrideKey : null\n const target = metadata.target === 'agent' ? 'agents' : metadata.target === 'tool' ? 'tools' : null\n if (!overrideKey || !target) {\n diagnostics.push({\n code: 'unsupported-dynamic-key',\n moduleId,\n domain: 'ai',\n candidatePath: ['ai', target ?? 'extensions'],\n source: ownedSource(fact),\n })\n continue\n }\n const path = ['ai', target, overrideKey]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path, key: overrideKey, dottedHost: `ai.${target}`,\n factRef: { factSection: 'ownedContracts.ai-extension', factKey: fact.id },\n source: ownedSource(fact),\n })\n }\n if (additiveExtensions.length > 0) {\n const anchor = [...additiveExtensions].sort((left, right) => left.id.localeCompare(right.id))[0]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'ai', path: ['ai', 'extensions'], dottedHost: 'ai.extensions',\n factRef: { factSection: 'ownedContracts.ai-extension', factKey: anchor.id },\n source: ownedSource(anchor),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst routesAdapter: InternalAdapter = {\n domain: 'routes',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n for (const route of facts.apiRoutes) {\n for (const method of route.methods) {\n const key = apiRouteOverrideKey(method, route.path)\n if (!key) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'routes', candidatePath: ['routes', 'api', `${method} ${route.path}`] })\n continue\n }\n if (!route.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'routes', candidatePath: ['routes', 'api', key] })\n continue\n }\n const path = ['routes', 'api', key]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'routes', path, key, dottedHost: 'routes.api',\n factRef: { factSection: 'apiRoutes', factKey: route.path },\n source: { sourcePath: route.sourcePath },\n })\n }\n }\n\n const emitPage = (page: { path: string; sourcePath: string }, section: 'backendPages' | 'frontendPages'): void => {\n const key = pageRouteOverrideKey(page.path)\n if (!key) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'routes', candidatePath: ['routes', 'pages', page.path] })\n return\n }\n if (!page.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'routes', candidatePath: ['routes', 'pages', key] })\n return\n }\n const path = ['routes', 'pages', key]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'routes', path, key, dottedHost: 'routes.pages',\n factRef: { factSection: section, factKey: page.path },\n source: { sourcePath: page.sourcePath },\n })\n }\n for (const page of facts.backendPages) emitPage(page, 'backendPages')\n for (const page of facts.frontendPages) emitPage(page, 'frontendPages')\n\n return { targets, diagnostics }\n },\n}\n\nconst eventsAdapter: InternalAdapter = {\n domain: 'events',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const contribution of contributionsOfKind(facts, 'subscriber')) {\n const subscriberId = contribution.details.subscriberId || contribution.id\n const path = ['events', 'subscribers', subscriberId]\n if (!contribution.source.path) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'events', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'events', path, key: subscriberId, dottedHost: 'events.subscribers',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst workersAdapter: InternalAdapter = {\n domain: 'workers',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.worker ?? []) {\n const path = ['workers', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'workers', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'workers', path, key: fact.id, dottedHost: 'workers',\n factRef: { factSection: 'ownedContracts.worker', factKey: fact.id },\n source: ownedSource(fact),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst widgetsAdapter: InternalAdapter = {\n domain: 'widgets',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n const emitInjection = (registryKey: string, contribution: ModuleExtensionContributionFact): void => {\n const path = ['widgets', 'injection', registryKey]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'widgets', path, key: registryKey, dottedHost: 'widgets.injection',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n\n for (const contribution of contributionsOfKind(facts, 'widget')) {\n const registryKey = contribution.details.registryKey\n if (!registryKey) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'widgets', candidatePath: ['widgets', 'injection', contribution.id] })\n continue\n }\n if (contribution.details.payload === 'dashboard') {\n const path = ['widgets', 'dashboard', registryKey]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'widgets', path, key: registryKey, dottedHost: 'widgets.dashboard',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n } else {\n emitInjection(registryKey, contribution)\n }\n }\n\n // data-table / crud-form contributions are injection-widget entries whose\n // registry key is the id segment before the `@<spot>` suffix.\n for (const contribution of [\n ...contributionsOfKind(facts, 'data-table'),\n ...contributionsOfKind(facts, 'crud-form'),\n ]) {\n const registryKey = contribution.id.split('@')[0]\n if (!registryKey || registryKey === contribution.id) {\n diagnostics.push({ code: 'unsupported-dynamic-key', moduleId, domain: 'widgets', candidatePath: ['widgets', 'injection', contribution.id] })\n continue\n }\n emitInjection(registryKey, contribution)\n }\n\n for (const contribution of contributionsOfKind(facts, 'component-override')) {\n const componentId = contribution.details.handle\n const path = ['widgets', 'components', componentId]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'widgets', path, key: componentId, dottedHost: 'widgets.components',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n\n return { targets, diagnostics }\n },\n}\n\nconst notificationsAdapter: InternalAdapter = {\n domain: 'notifications',\n run(facts, resolveFactSource) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n\n const registrySources = new Map<string, ModuleFactSourceRef>()\n for (const contribution of contributionsOfKind(facts, 'specialized-registry')) {\n if (contribution.details.registry !== 'notification') continue\n registrySources.set(contribution.details.registryId, contributionSource(contribution))\n }\n for (const type of facts.notifications) {\n const path = ['notifications', 'types', type]\n const indexedPath = indexedFactSourcePath(resolveFactSource, 'notification', type)\n const source = registrySources.get(type) ?? (indexedPath ? { sourcePath: indexedPath } : null)\n if (!source) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'notifications', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'notifications', path, key: type, dottedHost: 'notifications.types',\n factRef: { factSection: 'notifications', factKey: type },\n source,\n })\n }\n\n // Reactive handlers (`notifications.handlers.ts`) are keyed by their declared\n // handler id; a handler that declares none cannot be addressed by runtime.\n for (const contribution of contributionsOfKind(facts, 'browser-reaction')) {\n if (!contribution.details.transports.includes('notification-effect')) continue\n const overrideKey = contribution.details.overrideKey\n if (!overrideKey) {\n diagnostics.push({\n code: 'unsupported-dynamic-key',\n moduleId,\n domain: 'notifications',\n candidatePath: ['notifications', 'handlers'],\n source: contributionSource(contribution),\n })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId,\n domain: 'notifications',\n path: ['notifications', 'handlers', overrideKey],\n key: overrideKey,\n dottedHost: 'notifications.handlers',\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n return { targets, diagnostics }\n },\n}\n\nfunction contributionIdAdapter(\n domain: ModuleOverrideDomain,\n kind: ModuleExtensionContributionFact['kind'],\n dottedHost: string,\n): InternalAdapter {\n return {\n domain,\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const contribution of contributionsOfKind(facts, kind)) {\n const path = [domain, contribution.id]\n if (!contribution.source.path) {\n diagnostics.push({ code: 'missing-source', moduleId, domain, candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain, path, key: contribution.id, dottedHost,\n factRef: { factSection: 'extensionSurfaces.contributions', factKey: contribution.id },\n source: contributionSource(contribution),\n })\n }\n return { targets, diagnostics }\n },\n }\n}\n\nconst interceptorsAdapter = contributionIdAdapter('interceptors', 'api-interceptor', 'interceptors')\nconst commandInterceptorsAdapter = contributionIdAdapter('commandInterceptors', 'command-interceptor', 'commandInterceptors')\nconst enrichersAdapter = contributionIdAdapter('enrichers', 'response-enricher', 'enrichers')\n\n/**\n * `guards` targets ONLY backend/frontend page route middleware\n * (`ownedContracts['page-middleware']`). `data/guards.ts` mutation guards\n * (contribution kind `mutation-guard`) are a different runtime contract and\n * MUST NEVER surface here \u2014 every target carries the closed\n * `page-middleware-not-mutation-guard` note.\n */\nconst guardsAdapter: InternalAdapter = {\n domain: 'guards',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.['page-middleware'] ?? []) {\n const path = ['guards', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'guards', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'guards', path, key: fact.id, dottedHost: 'guards',\n factRef: { factSection: 'ownedContracts.page-middleware', factKey: fact.id },\n source: ownedSource(fact),\n notes: ['page-middleware-not-mutation-guard'],\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst cliAdapter: InternalAdapter = {\n domain: 'cli',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const command of facts.cliCommands) {\n const path = ['cli', command.command]\n if (!command.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'cli', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'cli', path, key: command.command, dottedHost: 'cli',\n factRef: { factSection: 'cliCommands', factKey: command.command },\n source: { sourcePath: command.sourcePath },\n })\n }\n return { targets, diagnostics }\n },\n}\n\n// `SetupOverridesShape` keys the runtime override resolver accepts. Only these\n// supported hook/profile properties become `setup` targets.\nconst SUPPORTED_SETUP_HOOKS = new Set(['seedDefaults', 'seedExamples', 'onTenantCreated'])\n\nconst setupAdapter: InternalAdapter = {\n domain: 'setup',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n const setupFacts = facts.ownedContracts?.setup ?? []\n for (const fact of setupFacts) {\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'setup', candidatePath: ['setup'] })\n continue\n }\n const source = ownedSource(fact)\n const properties: string[] = []\n const hooks = fact.metadata?.hooks\n if (Array.isArray(hooks)) {\n for (const hook of hooks) {\n if (typeof hook === 'string' && SUPPORTED_SETUP_HOOKS.has(hook)) properties.push(hook)\n }\n }\n const roles = fact.metadata?.roles\n if (Array.isArray(roles) && roles.length > 0) properties.push('defaultRoleFeatures')\n const customerRoles = fact.metadata?.customerRoles\n if (Array.isArray(customerRoles) && customerRoles.length > 0) properties.push('defaultCustomerRoleFeatures')\n for (const property of properties) {\n const path = ['setup', property]\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'setup', path, dottedHost: 'setup',\n factRef: { factSection: 'ownedContracts.setup', factKey: fact.id },\n source,\n })\n }\n }\n return { targets, diagnostics }\n },\n}\n\nconst aclAdapter: InternalAdapter = {\n domain: 'acl',\n run(facts, resolveFactSource) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const feature of facts.aclFeatures) {\n const path = ['acl', 'features', feature]\n const sourcePath = indexedFactSourcePath(resolveFactSource, 'acl-feature', feature)\n if (!sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'acl', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'acl', path, key: feature, dottedHost: 'acl.features',\n factRef: { factSection: 'aclFeatures', factKey: feature },\n source: { sourcePath },\n })\n }\n return { targets, diagnostics }\n },\n}\n\n/**\n * `di` targets expose the exact registration token and correlate to the rich DI\n * owned fact (which carries the registration kind). They NEVER include the\n * `asValue` payload, constructed service, or factory/class body \u2014 the target\n * schema has no such field and carries the `safe-metadata-only` note.\n */\nconst diAdapter: InternalAdapter = {\n domain: 'di',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.['di-registration'] ?? []) {\n const path = ['di', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'di', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'di', path, key: fact.id, dottedHost: 'di',\n factRef: { factSection: 'ownedContracts.di-registration', factKey: fact.id },\n source: ownedSource(fact),\n notes: ['safe-metadata-only'],\n })\n }\n return { targets, diagnostics }\n },\n}\n\nconst encryptionAdapter: InternalAdapter = {\n domain: 'encryption',\n run(facts) {\n const moduleId = moduleIdOf(facts)\n const targets: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const fact of facts.ownedContracts?.encryption ?? []) {\n const path = ['encryption', 'maps', fact.id]\n if (!fact.source.sourcePath) {\n diagnostics.push({ code: 'missing-source', moduleId, domain: 'encryption', candidatePath: path })\n continue\n }\n pushTarget(targets, diagnostics, {\n moduleId, domain: 'encryption', path, key: fact.id, dottedHost: 'encryption.maps',\n factRef: { factSection: 'ownedContracts.encryption', factKey: fact.id },\n source: ownedSource(fact),\n })\n }\n return { targets, diagnostics }\n },\n}\n\n/** `nav.groupOrder` is a framework-only setting; never a module target. */\nconst navAdapter: InternalAdapter = {\n domain: 'nav',\n frameworkOnly: true,\n run() {\n return { targets: [], diagnostics: [] }\n },\n}\n\nconst INTERNAL_ADAPTERS: InternalAdapter[] = [\n aiAdapter,\n routesAdapter,\n eventsAdapter,\n workersAdapter,\n widgetsAdapter,\n notificationsAdapter,\n interceptorsAdapter,\n commandInterceptorsAdapter,\n enrichersAdapter,\n guardsAdapter,\n cliAdapter,\n setupAdapter,\n aclAdapter,\n diAdapter,\n encryptionAdapter,\n navAdapter,\n]\n\n/**\n * Runtime enumeration of every unified override domain. Typed as a\n * `Record<ModuleOverrideDomain, true>` so adding a member to the runtime\n * `ModuleOverrideDomain` union fails the build here until it is listed \u2014 and\n * the coverage test then fails until an adapter (or `frameworkOnly`\n * classification) is registered.\n */\nconst OVERRIDE_DOMAIN_PRESENCE: Record<ModuleOverrideDomain, true> = {\n ai: true,\n routes: true,\n events: true,\n workers: true,\n widgets: true,\n notifications: true,\n interceptors: true,\n commandInterceptors: true,\n enrichers: true,\n guards: true,\n cli: true,\n setup: true,\n acl: true,\n di: true,\n encryption: true,\n nav: true,\n}\n\nexport const ALL_OVERRIDE_DOMAINS = Object.keys(OVERRIDE_DOMAIN_PRESENCE) as ModuleOverrideDomain[]\n\nexport const MODULE_OVERRIDE_TARGET_ADAPTERS: OverrideTargetAdapter[] = INTERNAL_ADAPTERS.map((adapter) => ({\n domain: adapter.domain,\n ...(adapter.frameworkOnly ? { frameworkOnly: true } : {}),\n collect: (moduleFacts) => adapter.run(moduleFacts, buildFactSourceLookup(moduleFacts)).targets,\n diagnose: (moduleFacts) => adapter.run(moduleFacts, buildFactSourceLookup(moduleFacts)).diagnostics,\n}))\n\nexport type ModuleOverrideTargetsResult = {\n overrideTargets: ModuleOverrideTarget[]\n overrideTargetDiagnostics: ModuleOverrideTargetDiagnostic[]\n}\n\n/**\n * Project every exact override target (and per-module diagnostic) for one\n * module's facts. Output sorts by domain, then path segments, then source;\n * diagnostics sort by moduleId, domain, code, then path/source. Targets are\n * deduped by `(domain, path)` keeping the source-first entry.\n */\nexport function collectModuleOverrideTargets(\n facts: ModuleFactsJsonEntry,\n resolveFactSource: FactSourceLookup = buildFactSourceLookup(facts),\n): ModuleOverrideTargetsResult {\n const collected: ModuleOverrideTarget[] = []\n const diagnostics: ModuleOverrideTargetDiagnostic[] = []\n for (const adapter of INTERNAL_ADAPTERS) {\n if (adapter.frameworkOnly) continue\n const result = adapter.run(facts, resolveFactSource)\n collected.push(...result.targets)\n diagnostics.push(...result.diagnostics)\n }\n\n const byPath = new Map<string, ModuleOverrideTarget>()\n for (const target of collected) {\n const pathKey = `${target.domain} ${JSON.stringify(target.path)}`\n const existing = byPath.get(pathKey)\n if (!existing || compareSourceRefs(target.source, existing.source) < 0) byPath.set(pathKey, target)\n }\n\n const overrideTargets = [...byPath.values()].sort(\n (left, right) =>\n left.domain.localeCompare(right.domain) ||\n comparePaths(left.path, right.path) ||\n compareSourceRefs(left.source, right.source),\n )\n\n const overrideTargetDiagnostics = diagnostics.sort(\n (left, right) =>\n left.moduleId.localeCompare(right.moduleId) ||\n left.domain.localeCompare(right.domain) ||\n left.code.localeCompare(right.code) ||\n comparePaths(left.candidatePath ?? [], right.candidatePath ?? []) ||\n compareSourceRefs(left.source ?? { sourcePath: '' }, right.source ?? { sourcePath: '' }),\n )\n\n return { overrideTargets, overrideTargetDiagnostics }\n}\n"],
5
+ "mappings": "AAAA,OAAO,YAAY;AAUnB,SAAS,6BAAoD;AAC7D,SAAS,0CAA0C;AAuB5C,MAAM,wBAAwB,CAAC,mBAAmB,WAAW,UAAU;AAIvE,MAAM,+BAA+B;AAAA,EAC1C;AAAA,EACA;AACF;AAIA,SAAS,qBAAqB,OAA4C;AACxE,SAAQ,sBAA4C,SAAS,KAAK;AACpE;AAaO,MAAM,0CAA0C;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAqCA,MAAM,2BAA2B,mCAAmC;AAqB7D,SAAS,8BAA8B,WAAgE;AAC5G,MAAI,cAAc,OAAW,QAAO,EAAE,SAAS,2BAA2B;AAC1E,MAAI,CAAC,qBAAqB,SAAS,EAAG,QAAO,EAAE,SAAS,0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AAA,EACxC;AAEA,QAAM,SAAS,oBAAI,IAAkC;AACrD,aAAW,UAAU,WAAW;AAC9B,UAAM,UAAU,GAAG,OAAO,MAAM,IAAI,KAAK,UAAU,OAAO,IAAI,CAAC;AAC/D,UAAM,WAAW,OAAO,IAAI,OAAO;AACnC,QAAI,CAAC,YAAY,kBAAkB,OAAO,QAAQ,SAAS,MAAM,IAAI,EAAG,QAAO,IAAI,SAAS,MAAM;AAAA,EACpG;AAEA,QAAM,kBAAkB,CAAC,GAAG,OAAO,OAAO,CAAC,EAAE;AAAA,IAC3C,CAAC,MAAM,UACL,KAAK,OAAO,cAAc,MAAM,MAAM,KACtC,aAAa,KAAK,MAAM,MAAM,IAAI,KAClC,kBAAkB,KAAK,QAAQ,MAAM,MAAM;AAAA,EAC/C;AAEA,QAAM,4BAA4B,YAAY;AAAA,IAC5C,CAAC,MAAM,UACL,KAAK,SAAS,cAAc,MAAM,QAAQ,KAC1C,KAAK,OAAO,cAAc,MAAM,MAAM,KACtC,KAAK,KAAK,cAAc,MAAM,IAAI,KAClC,aAAa,KAAK,iBAAiB,CAAC,GAAG,MAAM,iBAAiB,CAAC,CAAC,KAChE,kBAAkB,KAAK,UAAU,EAAE,YAAY,GAAG,GAAG,MAAM,UAAU,EAAE,YAAY,GAAG,CAAC;AAAA,EAC3F;AAEA,SAAO,EAAE,iBAAiB,0BAA0B;AACtD;",
6
6
  "names": []
7
7
  }
@@ -108,6 +108,102 @@ function buildCacheBustedSourceImportUrl(sourceFile) {
108
108
  }
109
109
  return url.href;
110
110
  }
111
+ function assertGeneratorPluginUsesTypeOnlyImports(sourceFile) {
112
+ const source = fs.readFileSync(sourceFile, "utf8");
113
+ const scriptKind = sourceFile.endsWith(".js") || sourceFile.endsWith(".mjs") || sourceFile.endsWith(".cjs") ? ts.ScriptKind.JS : ts.ScriptKind.TS;
114
+ const parsed = ts.createSourceFile(sourceFile, source, ts.ScriptTarget.Latest, true, scriptKind);
115
+ const violations = [];
116
+ for (const statement of parsed.statements) {
117
+ if (ts.isImportDeclaration(statement) && !statement.importClause?.isTypeOnly) {
118
+ violations.push(statement.getText(parsed));
119
+ }
120
+ if (ts.isImportEqualsDeclaration(statement)) {
121
+ violations.push(statement.getText(parsed));
122
+ }
123
+ if (ts.isExportDeclaration(statement) && statement.moduleSpecifier && !statement.isTypeOnly) {
124
+ violations.push(statement.getText(parsed));
125
+ }
126
+ }
127
+ const visit = (node) => {
128
+ if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword || ts.isIdentifier(node.expression) && node.expression.text === "require")) {
129
+ violations.push(node.getText(parsed));
130
+ }
131
+ ts.forEachChild(node, visit);
132
+ };
133
+ visit(parsed);
134
+ if (violations.length > 0) {
135
+ throw new Error(
136
+ `Generator plugin ${sourceFile} contains runtime imports. generators.ts may use only \`import type\`: ${violations.join("; ")}`
137
+ );
138
+ }
139
+ }
140
+ const GENERATOR_PLUGIN_OUTPUT_MANIFEST = ".generator-plugin-outputs.json";
141
+ function normalizeGeneratorPluginOutputFileName(pluginId, outputFileName) {
142
+ const normalized = outputFileName.replace(/\\/g, "/");
143
+ if (path.isAbsolute(outputFileName) || outputFileName.includes("\\") || normalized.startsWith("/") || normalized.startsWith("../") || normalized.includes("/../") || !normalized.endsWith(".ts")) {
144
+ throw new Error(
145
+ `Generator plugin '${pluginId}' has an invalid outputFileName '${outputFileName}'; expected a relative .ts path inside the generated directory.`
146
+ );
147
+ }
148
+ return normalized;
149
+ }
150
+ function resolveGeneratorPluginOutputNames(plugins) {
151
+ const outputNames = /* @__PURE__ */ new Map();
152
+ const ownersByOutput = /* @__PURE__ */ new Map();
153
+ for (const [pluginId, plugin] of plugins) {
154
+ const outputName = normalizeGeneratorPluginOutputFileName(pluginId, plugin.outputFileName);
155
+ const existingOwner = ownersByOutput.get(outputName);
156
+ if (existingOwner) {
157
+ throw new Error(
158
+ `Generator plugins '${existingOwner}' and '${pluginId}' declare the same output file '${outputName}'.`
159
+ );
160
+ }
161
+ ownersByOutput.set(outputName, pluginId);
162
+ outputNames.set(pluginId, outputName);
163
+ }
164
+ return outputNames;
165
+ }
166
+ function reconcileGeneratorPluginOutputs(options) {
167
+ const manifestPath = path.join(options.outputDir, GENERATOR_PLUGIN_OUTPUT_MANIFEST);
168
+ let previousOutputs = [];
169
+ if (fs.existsSync(manifestPath)) {
170
+ const parsed = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
171
+ if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string")) {
172
+ throw new Error(`Invalid generator plugin output manifest: ${manifestPath}`);
173
+ }
174
+ previousOutputs = parsed.map((entry) => normalizeGeneratorPluginOutputFileName("manifest", entry));
175
+ }
176
+ const currentOutputs = new Set(options.outputNames);
177
+ for (const staleOutput of previousOutputs) {
178
+ if (currentOutputs.has(staleOutput)) continue;
179
+ for (const stalePath of [
180
+ path.join(options.outputDir, staleOutput),
181
+ path.join(options.outputDir, staleOutput.replace(/\.ts$/, ".checksum"))
182
+ ]) {
183
+ if (!fs.existsSync(stalePath)) continue;
184
+ fs.unlinkSync(stalePath);
185
+ options.result.filesWritten.push(stalePath);
186
+ }
187
+ }
188
+ if (currentOutputs.size === 0) {
189
+ if (fs.existsSync(manifestPath)) {
190
+ fs.unlinkSync(manifestPath);
191
+ options.result.filesWritten.push(manifestPath);
192
+ }
193
+ return;
194
+ }
195
+ const manifestContent = `${JSON.stringify(
196
+ [...currentOutputs].sort((left, right) => left.localeCompare(right)),
197
+ null,
198
+ 2
199
+ )}
200
+ `;
201
+ if (!fs.existsSync(manifestPath) || fs.readFileSync(manifestPath, "utf8") !== manifestContent) {
202
+ fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
203
+ fs.writeFileSync(manifestPath, manifestContent);
204
+ options.result.filesWritten.push(manifestPath);
205
+ }
206
+ }
111
207
  function unwrapObjectLiteralExpression(expression) {
112
208
  if (!expression) return void 0;
113
209
  if (ts.isObjectLiteralExpression(expression)) return expression;
@@ -2422,6 +2518,7 @@ async function generateModuleRegistryFromDiscovery(options) {
2422
2518
  for (const discovered of discovery.modules) {
2423
2519
  const resolved = discovered.resolve("generators.ts");
2424
2520
  if (!resolved) continue;
2521
+ assertGeneratorPluginUsesTypeOnlyImports(resolved.absolutePath);
2425
2522
  try {
2426
2523
  const pluginMod = await import(buildCacheBustedSourceImportUrl(resolved.absolutePath));
2427
2524
  const plugins = pluginMod.generatorPlugins ?? pluginMod.default ?? [];
@@ -2434,6 +2531,7 @@ async function generateModuleRegistryFromDiscovery(options) {
2434
2531
  } catch {
2435
2532
  }
2436
2533
  }
2534
+ const pluginOutputNames = resolveGeneratorPluginOutputNames(pluginRegistry);
2437
2535
  const imports = [];
2438
2536
  const runtimeImports = [];
2439
2537
  const frontendRouteManifestImports = [];
@@ -2924,10 +3022,15 @@ async function generateModuleRegistryFromDiscovery(options) {
2924
3022
  const importSection = state.imports.join("\n");
2925
3023
  const entriesLiteral = state.configs.join(",\n ");
2926
3024
  const content = plugin.buildOutput({ importSection, entriesLiteral });
2927
- const outFile2 = path.join(outputDir, plugin.outputFileName);
2928
- const checksumFile2 = outFile2.replace(".ts", ".checksum");
3025
+ const outFile2 = path.join(outputDir, pluginOutputNames.get(pluginId));
3026
+ const checksumFile2 = outFile2.replace(/\.ts$/, ".checksum");
2929
3027
  writeGeneratedFile({ outFile: outFile2, checksumFile: checksumFile2, content, structureChecksum, result, quiet });
2930
3028
  }
3029
+ reconcileGeneratorPluginOutputs({
3030
+ outputDir,
3031
+ outputNames: pluginOutputNames.values(),
3032
+ result
3033
+ });
2931
3034
  {
2932
3035
  const bootstrapPlugins = [...pluginRegistry.values()].filter((p) => p.bootstrapRegistration);
2933
3036
  const allEntryImports = [