every-plugin 3.0.0-rc.0 → 3.0.0-rc.11

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 (127) hide show
  1. package/dist/build/rspack/chunk-completeness-plugin.cjs +19 -7
  2. package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -1
  3. package/dist/build/rspack/chunk-completeness-plugin.mjs +19 -7
  4. package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -1
  5. package/dist/build/ui/generated-config.cjs +4 -0
  6. package/dist/build/ui/generated-config.cjs.map +1 -1
  7. package/dist/build/ui/generated-config.d.cts.map +1 -1
  8. package/dist/build/ui/generated-config.d.mts.map +1 -1
  9. package/dist/build/ui/generated-config.mjs +4 -1
  10. package/dist/build/ui/generated-config.mjs.map +1 -1
  11. package/dist/build/ui/rsbuild-config.cjs +1 -0
  12. package/dist/build/ui/rsbuild-config.cjs.map +1 -1
  13. package/dist/build/ui/rsbuild-config.mjs +1 -0
  14. package/dist/build/ui/rsbuild-config.mjs.map +1 -1
  15. package/dist/client.cjs +69 -0
  16. package/dist/client.cjs.map +1 -0
  17. package/dist/client.d.cts +15 -0
  18. package/dist/client.d.cts.map +1 -0
  19. package/dist/client.d.mts +15 -0
  20. package/dist/client.d.mts.map +1 -0
  21. package/dist/client.mjs +68 -0
  22. package/dist/client.mjs.map +1 -0
  23. package/dist/dev/host.cjs +149 -0
  24. package/dist/dev/host.cjs.map +1 -0
  25. package/dist/dev/host.d.cts +32 -0
  26. package/dist/dev/host.d.cts.map +1 -0
  27. package/dist/dev/host.d.mts +32 -0
  28. package/dist/dev/host.d.mts.map +1 -0
  29. package/dist/dev/host.mjs +148 -0
  30. package/dist/dev/host.mjs.map +1 -0
  31. package/dist/dev/serve.cjs +16 -111
  32. package/dist/dev/serve.cjs.map +1 -1
  33. package/dist/dev/serve.d.cts.map +1 -1
  34. package/dist/dev/serve.d.mts.map +1 -1
  35. package/dist/dev/serve.mjs +17 -112
  36. package/dist/dev/serve.mjs.map +1 -1
  37. package/dist/errors.cjs +1 -0
  38. package/dist/errors.cjs.map +1 -1
  39. package/dist/errors.d.cts +2 -2
  40. package/dist/errors.d.mts +2 -2
  41. package/dist/errors.mjs +2 -2
  42. package/dist/errors.mjs.map +1 -1
  43. package/dist/index.cjs +3 -0
  44. package/dist/index.d.cts +5 -4
  45. package/dist/index.d.mts +5 -4
  46. package/dist/index.mjs +3 -2
  47. package/dist/plugin.cjs +1 -0
  48. package/dist/plugin.cjs.map +1 -1
  49. package/dist/plugin.d.cts +23 -3
  50. package/dist/plugin.d.cts.map +1 -1
  51. package/dist/plugin.d.mts +22 -2
  52. package/dist/plugin.d.mts.map +1 -1
  53. package/dist/plugin.mjs +1 -0
  54. package/dist/plugin.mjs.map +1 -1
  55. package/dist/remote-entry.cjs +0 -1
  56. package/dist/remote-entry.cjs.map +1 -1
  57. package/dist/remote-entry.d.cts +1 -2
  58. package/dist/remote-entry.d.cts.map +1 -1
  59. package/dist/remote-entry.d.mts +1 -2
  60. package/dist/remote-entry.d.mts.map +1 -1
  61. package/dist/remote-entry.mjs +1 -1
  62. package/dist/remote-entry.mjs.map +1 -1
  63. package/dist/runtime/errors.cjs +20 -0
  64. package/dist/runtime/errors.cjs.map +1 -1
  65. package/dist/runtime/errors.d.cts +23 -1
  66. package/dist/runtime/errors.d.cts.map +1 -1
  67. package/dist/runtime/errors.d.mts +23 -1
  68. package/dist/runtime/errors.d.mts.map +1 -1
  69. package/dist/runtime/errors.mjs +20 -1
  70. package/dist/runtime/errors.mjs.map +1 -1
  71. package/dist/runtime/mf-config.cjs +1 -1
  72. package/dist/runtime/mf-config.mjs +1 -1
  73. package/dist/runtime/services/module-federation.service.cjs +1 -7
  74. package/dist/runtime/services/module-federation.service.cjs.map +1 -1
  75. package/dist/runtime/services/module-federation.service.mjs +1 -7
  76. package/dist/runtime/services/module-federation.service.mjs.map +1 -1
  77. package/dist/runtime/services/plugin-loader.service.cjs +29 -1
  78. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
  79. package/dist/runtime/services/plugin-loader.service.d.cts +2 -2
  80. package/dist/runtime/services/plugin-loader.service.mjs +29 -1
  81. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
  82. package/dist/runtime/services/shared-identity.cjs +1 -1
  83. package/dist/runtime/services/shared-identity.cjs.map +1 -1
  84. package/dist/runtime/services/shared-identity.mjs +1 -1
  85. package/dist/runtime/services/shared-identity.mjs.map +1 -1
  86. package/dist/types.d.cts +27 -2
  87. package/dist/types.d.cts.map +1 -1
  88. package/dist/types.d.mts +26 -1
  89. package/dist/types.d.mts.map +1 -1
  90. package/dist/ui/manifest/construct.cjs +69 -18
  91. package/dist/ui/manifest/construct.cjs.map +1 -1
  92. package/dist/ui/manifest/construct.d.cts.map +1 -1
  93. package/dist/ui/manifest/construct.d.mts.map +1 -1
  94. package/dist/ui/manifest/construct.mjs +69 -18
  95. package/dist/ui/manifest/construct.mjs.map +1 -1
  96. package/dist/ui/manifest/generator.cjs +1 -1
  97. package/dist/ui/manifest/generator.mjs +1 -1
  98. package/dist/ui/manifest/index.cjs +1 -1
  99. package/dist/ui/manifest/index.mjs +1 -1
  100. package/dist/version-manifest.cjs +14 -2
  101. package/dist/version-manifest.cjs.map +1 -1
  102. package/dist/version-manifest.d.cts +11 -1
  103. package/dist/version-manifest.d.cts.map +1 -1
  104. package/dist/version-manifest.d.mts +11 -1
  105. package/dist/version-manifest.d.mts.map +1 -1
  106. package/dist/version-manifest.mjs +14 -2
  107. package/dist/version-manifest.mjs.map +1 -1
  108. package/package.json +20 -3
  109. package/skills/plugin-client/SKILL.md +10 -4
  110. package/skills/plugin-testing/SKILL.md +2 -1
  111. package/src/build/rspack/chunk-completeness-plugin.ts +15 -6
  112. package/src/build/ui/generated-config.ts +4 -0
  113. package/src/build/ui/rsbuild-config.ts +1 -0
  114. package/src/client.ts +111 -0
  115. package/src/dev/host.ts +235 -0
  116. package/src/dev/serve.ts +22 -140
  117. package/src/errors.ts +2 -1
  118. package/src/index.ts +9 -0
  119. package/src/plugin.ts +26 -1
  120. package/src/remote-entry.ts +1 -2
  121. package/src/runtime/errors.ts +44 -0
  122. package/src/runtime/services/module-federation.service.ts +4 -7
  123. package/src/runtime/services/plugin-loader.service.ts +46 -2
  124. package/src/runtime/services/shared-identity.ts +1 -1
  125. package/src/types.ts +40 -2
  126. package/src/ui/manifest/construct.ts +68 -15
  127. package/src/version-manifest.ts +19 -1
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-loader.service.mjs","names":[],"sources":["../../../src/runtime/services/plugin-loader.service.ts"],"sourcesContent":["import type { InferSchemaInput, InferSchemaOutput } from \"@orpc/contract\";\nimport { Context, Effect, Exit, Layer, Scope } from \"effect\";\nimport type { z } from \"zod\";\nimport { PluginIdTag } from \"../../plugin\";\nimport type {\n AnyPlugin,\n AnyPluginConstructor,\n InitializedPlugin,\n LoadedPlugin,\n PluginInstance,\n PluginMetadata,\n PluginRegistry,\n} from \"../../types\";\nimport { PluginRuntimeError, toPluginRuntimeError } from \"../errors\";\nimport { validate } from \"../validation\";\nimport { ModuleFederationService } from \"./module-federation.service\";\nimport { SecretsService } from \"./secrets.service\";\n\nexport class PluginRegistryTag extends Context.Service<PluginRegistryTag, PluginRegistry>()(\n \"PluginRegistry\",\n) {}\n\nexport class PluginMapTag extends Context.Service<\n PluginMapTag,\n Record<string, AnyPluginConstructor>\n>()(\"PluginMap\") {}\n\nexport interface RegistryServiceShape {\n get: (\n pluginId: string,\n ) => Effect.Effect<\n { constructor: (new () => AnyPlugin) | null; metadata: PluginMetadata },\n PluginRuntimeError\n >;\n getModule: (pluginId: string) => Effect.Effect<AnyPluginConstructor | null>;\n}\n\nexport class RegistryService extends Context.Service<RegistryService, RegistryServiceShape>()(\n \"RegistryService\",\n) {}\n\nexport const RegistryServiceDefault = Layer.effect(\n RegistryService,\n Effect.gen(function* () {\n const registry = yield* PluginRegistryTag;\n const pluginMap = yield* PluginMapTag;\n\n return {\n get: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = registry[pluginId];\n\n if (!entry) {\n return yield* new PluginRuntimeError({\n pluginId,\n operation: \"validate-plugin-id\",\n cause: new Error(`Plugin ${pluginId} not found in registry`),\n });\n }\n\n if (\"module\" in entry) {\n return {\n constructor: entry.module,\n metadata: {\n remoteUrl: entry.remote || \"\",\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }\n\n return {\n constructor: null,\n metadata: {\n remoteUrl: entry.remote,\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }),\n\n getModule: (pluginId: string) => Effect.succeed(pluginMap[pluginId] || null),\n };\n }),\n);\n\nexport interface PluginLoaderServiceShape {\n loadPlugin: (pluginId: string) => Effect.Effect<LoadedPlugin, PluginRuntimeError>;\n instantiatePlugin: <T extends AnyPlugin>(\n pluginId: string,\n loadedPlugin: LoadedPlugin<T>,\n ) => Effect.Effect<PluginInstance<T>, PluginRuntimeError>;\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) => Effect.Effect<InitializedPlugin<T>, PluginRuntimeError>;\n}\n\nexport class PluginLoaderService extends Context.Service<\n PluginLoaderService,\n PluginLoaderServiceShape\n>()(\"PluginLoaderService\") {}\n\nexport const PluginLoaderServiceDefault = Layer.effect(\n PluginLoaderService,\n Effect.gen(function* () {\n const moduleFederationService = yield* ModuleFederationService;\n const secretsService = yield* SecretsService;\n const registryService = yield* RegistryService;\n\n const resolveUrl = (baseUrl: string, version?: string): string =>\n version && version !== \"latest\" ? baseUrl.replace(\"@latest\", `@${version}`) : baseUrl;\n\n return {\n loadPlugin: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = yield* registryService.get(pluginId);\n\n if (entry.constructor) {\n yield* Effect.logDebug(\"Loading plugin from direct module\", { pluginId });\n\n return {\n ctor: entry.constructor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }\n\n const url = entry.metadata.remoteUrl;\n if (!url) {\n return yield* new PluginRuntimeError({\n pluginId,\n operation: \"load-plugin\",\n cause: new Error(`Plugin ${pluginId} has no module or remote URL configured`),\n });\n }\n\n const resolvedUrl = resolveUrl(url);\n\n yield* moduleFederationService.registerRemote(pluginId, resolvedUrl).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during register-remote: ${String(error)}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"register-remote\"),\n ),\n );\n\n yield* Effect.logDebug(\"Loading plugin from remote\", { pluginId, url: resolvedUrl });\n\n const ctor = yield* moduleFederationService\n .loadRemoteConstructor(pluginId, resolvedUrl)\n .pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during load-remote: ${String(error)}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"load-remote\"),\n ),\n );\n\n return {\n ctor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }),\n\n instantiatePlugin: <T extends AnyPlugin>(pluginId: string, loadedPlugin: LoadedPlugin<T>) =>\n Effect.gen(function* () {\n const instance = yield* Effect.try(() => new loadedPlugin.ctor()).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during instantiate-plugin: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"instantiate-plugin\"),\n ),\n );\n\n (instance.id as string) = pluginId;\n\n return {\n plugin: instance,\n metadata: loadedPlugin.metadata,\n } satisfies PluginInstance<T>;\n }),\n\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) =>\n Effect.gen(function* () {\n const { plugin } = pluginInstance;\n\n // Validate and hydrate config\n const validatedVariables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n config.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-config\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Validate secrets\n const validatedSecrets = yield* validate(\n plugin.configSchema.secrets as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"secrets\"]>\n >,\n config.secrets,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-secrets\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Hydrate secrets in variables\n const hydratedConfig = yield* secretsService.hydrateSecrets({\n variables: validatedVariables,\n secrets: validatedSecrets,\n });\n\n const _variables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n hydratedConfig.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-hydrated-config\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Create a long-lived scope for this plugin instance. Initialize\n // returns a Layer which is built against this scope, so scoped\n // resources (DB pools, caches) release on plugin shutdown.\n const scope = yield* Scope.make();\n\n // Build the plugin's Layer within the scope.\n // On failure, close the scope immediately so scoped resources\n // (DB pools, caches) are released — otherwise every failed\n // initialization leaks until the process exits.\n const effectContext = yield* Effect.gen(function* () {\n const layer = yield* plugin\n .initialize({ variables: _variables, secrets: hydratedConfig.secrets }, plugins ?? {})\n .pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n );\n\n return yield* Layer.buildWithScope(layer, scope).pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-layer\"),\n ),\n );\n }).pipe(\n Effect.onExit((exit) =>\n Exit.isSuccess(exit)\n ? Effect.void\n : Scope.close(scope, exit).pipe(\n Effect.catchCause((closeCause) =>\n Effect.logWarning(\n `Failed to close scope for plugin ${plugin.id} after initialize error`,\n closeCause,\n ),\n ),\n ),\n ),\n Effect.tapError((error) =>\n Effect.logError(\n `Plugin ${plugin.id} failed during initialize-plugin: ${String(error)}`,\n ),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-plugin\"),\n ),\n );\n\n return {\n plugin,\n metadata: pluginInstance.metadata,\n config: { variables: _variables, secrets: hydratedConfig.secrets },\n effectContext,\n scope,\n } satisfies InitializedPlugin<T>;\n }),\n };\n }),\n);\n"],"mappings":";;;;;;;;AAkBA,IAAa,oBAAb,cAAuC,QAAQ,QAA2C,CAAC,CACzF,gBACF,CAAC,CAAC,CAAC;AAEH,IAAa,eAAb,cAAkC,QAAQ,QAGxC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAYlB,IAAa,kBAAb,cAAqC,QAAQ,QAA+C,CAAC,CAC3F,iBACF,CAAC,CAAC,CAAC;AAEH,MAAa,yBAAyB,MAAM,OAC1C,iBACA,OAAO,IAAI,aAAa;CACtB,MAAM,WAAW,OAAO;CACxB,MAAM,YAAY,OAAO;CAEzB,OAAO;EACL,MAAM,aACJ,OAAO,IAAI,aAAa;GACtB,MAAM,QAAQ,SAAS;GAEvB,IAAI,CAAC,OACH,OAAO,OAAO,IAAI,mBAAmB;IACnC;IACA,WAAW;IACX,uBAAO,IAAI,MAAM,UAAU,SAAS,uBAAuB;GAC7D,CAAC;GAGH,IAAI,YAAY,OACd,OAAO;IACL,aAAa,MAAM;IACnB,UAAU;KACR,WAAW,MAAM,UAAU;KAC3B,SAAS,MAAM;KACf,aAAa,MAAM;IACrB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gB;GACzB,CAAC,CACL,CACF;GAKA,MAAM,QAAQ,OAAO,MAAM,KAAK;GAMhC,MAAM,gBAAgB,OAAO,OAAO,IAAI,aAAa;IACnD,MAAM,QAAQ,OAAO,OAClB,WAAW;KAAE,WAAW;KAAY,SAAS,eAAe;IAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CACrF,KACC,OAAO,eAAe,aAAa,OAAO,EAAE,GAC5C,OAAO,eAAe,MAAM,OAAO,KAAK,CAC1C;IAEF,OAAO,OAAO,MAAM,eAAe,OAAO,KAAK,CAAC,CAAC,KAC/C,OAAO,eAAe,aAAa,OAAO,EAAE,GAC5C,OAAO,eAAe,MAAM,OAAO,KAAK,GACxC,OAAO,UAAU,UACf,qBAAqB,OAAO,OAAO,IAAI,QAAW,kBAAkB,CACtE,CACF;GACF,CAAC,CAAC,CAAC,KACD,OAAO,QAAQ,SACb,KAAK,UAAU,IAAI,IACf,OAAO,OACP,MAAM,MAAM,OAAO,IAAI,CAAC,CAAC,KACvB,OAAO,YAAY,eACjB,OAAO,WACL,oCAAoC,OAAO,GAAG,0BAC9C,UACF,CACF,CACF,CACN,GACA,OAAO,UAAU,UACf,OAAO,SACL,UAAU,OAAO,GAAG,oCAAoC,OAAO,KAAK,GACtE,CACF,GACA,OAAO,UAAU,UACf,qBAAqB,OAAO,OAAO,IAAI,QAAW,mBAAmB,CACvE,CACF;GAEA,OAAO;IACL;IACA,UAAU,eAAe;IACzB,QAAQ;KAAE,WAAW;KAAY,SAAS,eAAe;IAAQ;IACjE;IACA;GACF;EACF,CAAC;CACL;AACF,CAAC,CACH"}
1
+ {"version":3,"file":"plugin-loader.service.mjs","names":[],"sources":["../../../src/runtime/services/plugin-loader.service.ts"],"sourcesContent":["import type { InferSchemaInput, InferSchemaOutput } from \"@orpc/contract\";\nimport { Context, Effect, Exit, Layer, Scope } from \"effect\";\nimport type { z } from \"zod\";\nimport { PluginIdTag } from \"../../plugin\";\nimport type {\n AnyPlugin,\n AnyPluginConstructor,\n InitializedPlugin,\n LoadedPlugin,\n PluginInstance,\n PluginMetadata,\n PluginRegistry,\n} from \"../../types\";\nimport type { PluginWarningInfo } from \"../errors\";\nimport { PluginRuntimeError, toPluginRuntimeError } from \"../errors\";\nimport { validate } from \"../validation\";\nimport { ModuleFederationService } from \"./module-federation.service\";\nimport { SecretsService } from \"./secrets.service\";\n\n/**\n * Evaluate a plugin's `warnings` function against the validated config.\n * Fail-safe: a throwing warnings function becomes a warning itself rather\n * than failing initialization. Strings are normalized to `PluginWarningInfo`\n * with the plugin's registry key.\n */\nconst collectPluginWarnings = (\n plugin: AnyPlugin,\n config: { pluginId: string; variables: unknown; secrets: unknown },\n): PluginWarningInfo[] => {\n const warningsFn = plugin.warnings;\n if (!warningsFn) return [];\n try {\n const raw = warningsFn(config as never);\n return raw.map((warning) =>\n typeof warning === \"string\" ? { pluginKey: plugin.id, message: warning } : warning,\n );\n } catch (error) {\n return [\n {\n pluginKey: plugin.id,\n message: `Plugin warnings check failed: ${error instanceof Error ? error.message : String(error)}`,\n },\n ];\n }\n};\n\nexport class PluginRegistryTag extends Context.Service<PluginRegistryTag, PluginRegistry>()(\n \"PluginRegistry\",\n) {}\n\nexport class PluginMapTag extends Context.Service<\n PluginMapTag,\n Record<string, AnyPluginConstructor>\n>()(\"PluginMap\") {}\n\nexport interface RegistryServiceShape {\n get: (\n pluginId: string,\n ) => Effect.Effect<\n { constructor: (new () => AnyPlugin) | null; metadata: PluginMetadata },\n PluginRuntimeError\n >;\n getModule: (pluginId: string) => Effect.Effect<AnyPluginConstructor | null>;\n}\n\nexport class RegistryService extends Context.Service<RegistryService, RegistryServiceShape>()(\n \"RegistryService\",\n) {}\n\nexport const RegistryServiceDefault = Layer.effect(\n RegistryService,\n Effect.gen(function* () {\n const registry = yield* PluginRegistryTag;\n const pluginMap = yield* PluginMapTag;\n\n return {\n get: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = registry[pluginId];\n\n if (!entry) {\n return yield* new PluginRuntimeError({\n pluginId,\n operation: \"validate-plugin-id\",\n cause: new Error(`Plugin ${pluginId} not found in registry`),\n });\n }\n\n if (\"module\" in entry) {\n return {\n constructor: entry.module,\n metadata: {\n remoteUrl: entry.remote || \"\",\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }\n\n return {\n constructor: null,\n metadata: {\n remoteUrl: entry.remote,\n version: entry.version,\n description: entry.description,\n } as PluginMetadata,\n };\n }),\n\n getModule: (pluginId: string) => Effect.succeed(pluginMap[pluginId] || null),\n };\n }),\n);\n\nexport interface PluginLoaderServiceShape {\n loadPlugin: (pluginId: string) => Effect.Effect<LoadedPlugin, PluginRuntimeError>;\n instantiatePlugin: <T extends AnyPlugin>(\n pluginId: string,\n loadedPlugin: LoadedPlugin<T>,\n ) => Effect.Effect<PluginInstance<T>, PluginRuntimeError>;\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) => Effect.Effect<InitializedPlugin<T>, PluginRuntimeError>;\n}\n\nexport class PluginLoaderService extends Context.Service<\n PluginLoaderService,\n PluginLoaderServiceShape\n>()(\"PluginLoaderService\") {}\n\nexport const PluginLoaderServiceDefault = Layer.effect(\n PluginLoaderService,\n Effect.gen(function* () {\n const moduleFederationService = yield* ModuleFederationService;\n const secretsService = yield* SecretsService;\n const registryService = yield* RegistryService;\n\n const resolveUrl = (baseUrl: string, version?: string): string =>\n version && version !== \"latest\" ? baseUrl.replace(\"@latest\", `@${version}`) : baseUrl;\n\n return {\n loadPlugin: (pluginId: string) =>\n Effect.gen(function* () {\n const entry = yield* registryService.get(pluginId);\n\n if (entry.constructor) {\n yield* Effect.logDebug(\"Loading plugin from direct module\", { pluginId });\n\n return {\n ctor: entry.constructor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }\n\n const url = entry.metadata.remoteUrl;\n if (!url) {\n return yield* new PluginRuntimeError({\n pluginId,\n operation: \"load-plugin\",\n cause: new Error(`Plugin ${pluginId} has no module or remote URL configured`),\n });\n }\n\n const resolvedUrl = resolveUrl(url);\n\n yield* moduleFederationService.registerRemote(pluginId, resolvedUrl).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during register-remote: ${String(error)}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"register-remote\"),\n ),\n );\n\n yield* Effect.logDebug(\"Loading plugin from remote\", { pluginId, url: resolvedUrl });\n\n const ctor = yield* moduleFederationService\n .loadRemoteConstructor(pluginId, resolvedUrl)\n .pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during load-remote: ${String(error)}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"load-remote\"),\n ),\n );\n\n return {\n ctor,\n metadata: entry.metadata,\n } satisfies LoadedPlugin;\n }),\n\n instantiatePlugin: <T extends AnyPlugin>(pluginId: string, loadedPlugin: LoadedPlugin<T>) =>\n Effect.gen(function* () {\n const instance = yield* Effect.try(() => new loadedPlugin.ctor()).pipe(\n Effect.tapError((error) =>\n Effect.logError(`Plugin ${pluginId} failed during instantiate-plugin: ${error}`),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, pluginId, undefined, \"instantiate-plugin\"),\n ),\n );\n\n (instance.id as string) = pluginId;\n\n return {\n plugin: instance,\n metadata: loadedPlugin.metadata,\n } satisfies PluginInstance<T>;\n }),\n\n initializePlugin: <T extends AnyPlugin>(\n pluginInstance: PluginInstance<T>,\n config: {\n variables: InferSchemaInput<T[\"configSchema\"][\"variables\"]>;\n secrets: InferSchemaInput<T[\"configSchema\"][\"secrets\"]>;\n },\n plugins?: Record<string, unknown>,\n ) =>\n Effect.gen(function* () {\n const { plugin } = pluginInstance;\n\n // Validate and hydrate config\n const validatedVariables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n config.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-config\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Validate secrets\n const validatedSecrets = yield* validate(\n plugin.configSchema.secrets as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"secrets\"]>\n >,\n config.secrets,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-secrets\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Hydrate secrets in variables\n const hydratedConfig = yield* secretsService.hydrateSecrets({\n variables: validatedVariables,\n secrets: validatedSecrets,\n });\n\n const _variables = yield* validate(\n plugin.configSchema.variables as z.ZodSchema<\n InferSchemaOutput<T[\"configSchema\"][\"variables\"]>\n >,\n hydratedConfig.variables,\n plugin.id,\n \"config\",\n ).pipe(\n Effect.mapError(\n (validationError) =>\n new PluginRuntimeError({\n pluginId: plugin.id,\n operation: \"validate-hydrated-config\",\n cause: validationError.zodError,\n }),\n ),\n );\n\n // Create a long-lived scope for this plugin instance. Initialize\n // returns a Layer which is built against this scope, so scoped\n // resources (DB pools, caches) release on plugin shutdown.\n const scope = yield* Scope.make();\n\n // Build the plugin's Layer within the scope.\n // On failure, close the scope immediately so scoped resources\n // (DB pools, caches) are released — otherwise every failed\n // initialization leaks until the process exits.\n const effectContext = yield* Effect.gen(function* () {\n const layer = yield* plugin\n .initialize(\n {\n pluginId: plugin.id,\n variables: _variables,\n secrets: hydratedConfig.secrets,\n },\n plugins ?? {},\n )\n .pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n );\n\n return yield* Layer.buildWithScope(layer, scope).pipe(\n Effect.provideService(PluginIdTag, plugin.id),\n Effect.provideService(Scope.Scope, scope),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-layer\"),\n ),\n );\n }).pipe(\n Effect.onExit((exit) =>\n Exit.isSuccess(exit)\n ? Effect.void\n : Scope.close(scope, exit).pipe(\n Effect.catchCause((closeCause) =>\n Effect.logWarning(\n `Failed to close scope for plugin ${plugin.id} after initialize error`,\n closeCause,\n ),\n ),\n ),\n ),\n Effect.tapError((error) =>\n Effect.logError(\n `Plugin ${plugin.id} failed during initialize-plugin: ${String(error)}`,\n ),\n ),\n Effect.mapError((error) =>\n toPluginRuntimeError(error, plugin.id, undefined, \"initialize-plugin\"),\n ),\n );\n\n return {\n plugin,\n metadata: pluginInstance.metadata,\n config: {\n pluginId: plugin.id,\n variables: _variables,\n secrets: hydratedConfig.secrets,\n },\n effectContext,\n scope,\n warnings: collectPluginWarnings(plugin, {\n pluginId: plugin.id,\n variables: _variables,\n secrets: hydratedConfig.secrets,\n }),\n } satisfies InitializedPlugin<T>;\n }),\n };\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,yBACJ,QACA,WACwB;CACxB,MAAM,aAAa,OAAO;CAC1B,IAAI,CAAC,YAAY,OAAO,CAAC;CACzB,IAAI;EAEF,OADY,WAAW,MACd,CAAC,CAAC,KAAK,YACd,OAAO,YAAY,WAAW;GAAE,WAAW,OAAO;GAAI,SAAS;EAAQ,IAAI,OAC7E;CACF,SAAS,OAAO;EACd,OAAO,CACL;GACE,WAAW,OAAO;GAClB,SAAS,iCAAiC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EACjG,CACF;CACF;AACF;AAEA,IAAa,oBAAb,cAAuC,QAAQ,QAA2C,CAAC,CACzF,gBACF,CAAC,CAAC,CAAC;AAEH,IAAa,eAAb,cAAkC,QAAQ,QAGxC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAYlB,IAAa,kBAAb,cAAqC,QAAQ,QAA+C,CAAC,CAC3F,iBACF,CAAC,CAAC,CAAC;AAEH,MAAa,yBAA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OAAO,OAAO,IAAI,QAAW,mBAAmB,CACvE,CACF;GAEA,OAAO;IACL;IACA,UAAU,eAAe;IACzB,QAAQ;KACN,UAAU,OAAO;KACjB,WAAW;KACX,SAAS,eAAe;IAC1B;IACA;IACA;IACA,UAAU,sBAAsB,QAAQ;KACtC,UAAU,OAAO;KACjB,WAAW;KACX,SAAS,eAAe;IAC1B,CAAC;GACH;EACF,CAAC;CACL;AACF,CAAC,CACH"}
@@ -6,7 +6,7 @@ function manifestUrl(remoteUrl) {
6
6
  return remoteUrl.endsWith("/") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;
7
7
  }
8
8
  function normalizeBaseUrl(remoteUrl) {
9
- return (remoteUrl.split("#")[0] ?? remoteUrl).replace(/\/(mf-manifest\.json|remoteEntry\.js)$/i, "");
9
+ return (remoteUrl.split("#")[0] ?? remoteUrl).replace(/\/(mf-manifest\.json|remoteEntry(?:\.[^/]+)?\.js)$/i, "");
10
10
  }
11
11
  function compareSharedIdentity(remoteShared, expectedVersions) {
12
12
  const mismatches = [];
@@ -1 +1 @@
1
- {"version":3,"file":"shared-identity.cjs","names":["isEffectCriticalSharedDep"],"sources":["../../../src/runtime/services/shared-identity.ts"],"sourcesContent":["import { isEffectCriticalSharedDep } from \"../../shared-deps-spec\";\n\ninterface IdentityManifest {\n metaData?: { pluginVersion?: string; name?: string };\n shared?: Array<{ name: string; version?: string }>;\n}\n\nexport interface SharedIdentityMismatch {\n name: string;\n expected: string;\n actual: string | null;\n}\n\nconst MANIFEST_TIMEOUT_MS = 15_000;\n\nfunction manifestUrl(remoteUrl: string): string {\n return remoteUrl.endsWith(\"/\") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;\n}\n\nfunction normalizeBaseUrl(remoteUrl: string): string {\n const withoutHash = remoteUrl.split(\"#\")[0] ?? remoteUrl;\n return withoutHash.replace(/\\/(mf-manifest\\.json|remoteEntry\\.js)$/i, \"\");\n}\n\nexport function compareSharedIdentity(\n remoteShared: Array<{ name: string; version?: string }> | undefined,\n expectedVersions: Map<string, string>,\n): SharedIdentityMismatch[] {\n const mismatches: SharedIdentityMismatch[] = [];\n const remoteByName = new Map((remoteShared ?? []).map((s) => [s.name, s]));\n\n for (const [name, expected] of expectedVersions.entries()) {\n if (!isEffectCriticalSharedDep(name)) continue;\n const remoteEntry = remoteByName.get(name);\n if (!remoteEntry) continue;\n if (remoteEntry.version && remoteEntry.version !== expected) {\n mismatches.push({ name, expected, actual: remoteEntry.version });\n }\n }\n\n return mismatches;\n}\n\nexport function describeSharedIdentityMismatch(\n pluginId: string,\n mismatches: SharedIdentityMismatch[],\n hostExpectation: string,\n): string {\n const lines = mismatches.map(\n (m) =>\n ` ${m.name}: expected ${m.expected} (from ${hostExpectation}), got ${m.actual ?? \"missing\"}`,\n );\n return (\n `[SharedIdentity] Refusing to load plugin \"${pluginId}\": shared dependency version skew.\\n` +\n `${lines.join(\"\\n\")}\\n` +\n `Run \"bos mf check\" for the full report. Fix: rebuild and redeploy the host and this plugin together (single release train, e.g. \"bos publish --deploy --packages local\").`\n );\n}\n\nexport async function fetchRemoteIdentityManifest(\n remoteUrl: string,\n): Promise<IdentityManifest | null> {\n const base = normalizeBaseUrl(remoteUrl);\n const url = manifestUrl(base);\n const res = await fetch(url, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });\n if (!res.ok) return null;\n return (await res.json()) as IdentityManifest;\n}\n"],"mappings":";;;AAaA,MAAM,sBAAsB;AAE5B,SAAS,YAAY,WAA2B;CAC9C,OAAO,UAAU,SAAS,GAAG,IAAI,GAAG,UAAU,oBAAoB,GAAG,UAAU;AACjF;AAEA,SAAS,iBAAiB,WAA2B;CAEnD,QADoB,UAAU,MAAM,GAAG,CAAC,CAAC,MAAM,UAC7B,CAAC,QAAQ,2CAA2C,EAAE;AAC1E;AAEA,SAAgB,sBACd,cACA,kBAC0B;CAC1B,MAAM,aAAuC,CAAC;CAC9C,MAAM,eAAe,IAAI,KAAK,gBAAgB,CAAC,EAAC,CAAE,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CAEzE,KAAK,MAAM,CAAC,MAAM,aAAa,iBAAiB,QAAQ,GAAG;EACzD,IAAI,CAACA,mDAA0B,IAAI,GAAG;EACtC,MAAM,cAAc,aAAa,IAAI,IAAI;EACzC,IAAI,CAAC,aAAa;EAClB,IAAI,YAAY,WAAW,YAAY,YAAY,UACjD,WAAW,KAAK;GAAE;GAAM;GAAU,QAAQ,YAAY;EAAQ,CAAC;CAEnE;CAEA,OAAO;AACT;AAEA,SAAgB,+BACd,UACA,YACA,iBACQ;CAKR,OACE,6CAA6C,SAAS,sCAL1C,WAAW,KACtB,MACC,KAAK,EAAE,KAAK,aAAa,EAAE,SAAS,SAAS,gBAAgB,SAAS,EAAE,UAAU,WAI7E,CAAC,CAAC,KAAK,IAAI,EAAE;AAGxB;AAEA,eAAsB,4BACpB,WACkC;CAElC,MAAM,MAAM,YADC,iBAAiB,SACH,CAAC;CAC5B,MAAM,MAAM,MAAM,MAAM,KAAK,EAAE,QAAQ,YAAY,QAAQ,mBAAmB,EAAE,CAAC;CACjF,IAAI,CAAC,IAAI,IAAI,OAAO;CACpB,OAAQ,MAAM,IAAI,KAAK;AACzB"}
1
+ {"version":3,"file":"shared-identity.cjs","names":["isEffectCriticalSharedDep"],"sources":["../../../src/runtime/services/shared-identity.ts"],"sourcesContent":["import { isEffectCriticalSharedDep } from \"../../shared-deps-spec\";\n\ninterface IdentityManifest {\n metaData?: { pluginVersion?: string; name?: string };\n shared?: Array<{ name: string; version?: string }>;\n}\n\nexport interface SharedIdentityMismatch {\n name: string;\n expected: string;\n actual: string | null;\n}\n\nconst MANIFEST_TIMEOUT_MS = 15_000;\n\nfunction manifestUrl(remoteUrl: string): string {\n return remoteUrl.endsWith(\"/\") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;\n}\n\nfunction normalizeBaseUrl(remoteUrl: string): string {\n const withoutHash = remoteUrl.split(\"#\")[0] ?? remoteUrl;\n return withoutHash.replace(/\\/(mf-manifest\\.json|remoteEntry(?:\\.[^/]+)?\\.js)$/i, \"\");\n}\n\nexport function compareSharedIdentity(\n remoteShared: Array<{ name: string; version?: string }> | undefined,\n expectedVersions: Map<string, string>,\n): SharedIdentityMismatch[] {\n const mismatches: SharedIdentityMismatch[] = [];\n const remoteByName = new Map((remoteShared ?? []).map((s) => [s.name, s]));\n\n for (const [name, expected] of expectedVersions.entries()) {\n if (!isEffectCriticalSharedDep(name)) continue;\n const remoteEntry = remoteByName.get(name);\n if (!remoteEntry) continue;\n if (remoteEntry.version && remoteEntry.version !== expected) {\n mismatches.push({ name, expected, actual: remoteEntry.version });\n }\n }\n\n return mismatches;\n}\n\nexport function describeSharedIdentityMismatch(\n pluginId: string,\n mismatches: SharedIdentityMismatch[],\n hostExpectation: string,\n): string {\n const lines = mismatches.map(\n (m) =>\n ` ${m.name}: expected ${m.expected} (from ${hostExpectation}), got ${m.actual ?? \"missing\"}`,\n );\n return (\n `[SharedIdentity] Refusing to load plugin \"${pluginId}\": shared dependency version skew.\\n` +\n `${lines.join(\"\\n\")}\\n` +\n `Run \"bos mf check\" for the full report. Fix: rebuild and redeploy the host and this plugin together (single release train, e.g. \"bos publish --deploy --packages local\").`\n );\n}\n\nexport async function fetchRemoteIdentityManifest(\n remoteUrl: string,\n): Promise<IdentityManifest | null> {\n const base = normalizeBaseUrl(remoteUrl);\n const url = manifestUrl(base);\n const res = await fetch(url, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });\n if (!res.ok) return null;\n return (await res.json()) as IdentityManifest;\n}\n"],"mappings":";;;AAaA,MAAM,sBAAsB;AAE5B,SAAS,YAAY,WAA2B;CAC9C,OAAO,UAAU,SAAS,GAAG,IAAI,GAAG,UAAU,oBAAoB,GAAG,UAAU;AACjF;AAEA,SAAS,iBAAiB,WAA2B;CAEnD,QADoB,UAAU,MAAM,GAAG,CAAC,CAAC,MAAM,UAC7B,CAAC,QAAQ,uDAAuD,EAAE;AACtF;AAEA,SAAgB,sBACd,cACA,kBAC0B;CAC1B,MAAM,aAAuC,CAAC;CAC9C,MAAM,eAAe,IAAI,KAAK,gBAAgB,CAAC,EAAC,CAAE,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CAEzE,KAAK,MAAM,CAAC,MAAM,aAAa,iBAAiB,QAAQ,GAAG;EACzD,IAAI,CAACA,mDAA0B,IAAI,GAAG;EACtC,MAAM,cAAc,aAAa,IAAI,IAAI;EACzC,IAAI,CAAC,aAAa;EAClB,IAAI,YAAY,WAAW,YAAY,YAAY,UACjD,WAAW,KAAK;GAAE;GAAM;GAAU,QAAQ,YAAY;EAAQ,CAAC;CAEnE;CAEA,OAAO;AACT;AAEA,SAAgB,+BACd,UACA,YACA,iBACQ;CAKR,OACE,6CAA6C,SAAS,sCAL1C,WAAW,KACtB,MACC,KAAK,EAAE,KAAK,aAAa,EAAE,SAAS,SAAS,gBAAgB,SAAS,EAAE,UAAU,WAI7E,CAAC,CAAC,KAAK,IAAI,EAAE;AAGxB;AAEA,eAAsB,4BACpB,WACkC;CAElC,MAAM,MAAM,YADC,iBAAiB,SACH,CAAC;CAC5B,MAAM,MAAM,MAAM,MAAM,KAAK,EAAE,QAAQ,YAAY,QAAQ,mBAAmB,EAAE,CAAC;CACjF,IAAI,CAAC,IAAI,IAAI,OAAO;CACpB,OAAQ,MAAM,IAAI,KAAK;AACzB"}
@@ -6,7 +6,7 @@ function manifestUrl(remoteUrl) {
6
6
  return remoteUrl.endsWith("/") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;
7
7
  }
8
8
  function normalizeBaseUrl(remoteUrl) {
9
- return (remoteUrl.split("#")[0] ?? remoteUrl).replace(/\/(mf-manifest\.json|remoteEntry\.js)$/i, "");
9
+ return (remoteUrl.split("#")[0] ?? remoteUrl).replace(/\/(mf-manifest\.json|remoteEntry(?:\.[^/]+)?\.js)$/i, "");
10
10
  }
11
11
  function compareSharedIdentity(remoteShared, expectedVersions) {
12
12
  const mismatches = [];
@@ -1 +1 @@
1
- {"version":3,"file":"shared-identity.mjs","names":[],"sources":["../../../src/runtime/services/shared-identity.ts"],"sourcesContent":["import { isEffectCriticalSharedDep } from \"../../shared-deps-spec\";\n\ninterface IdentityManifest {\n metaData?: { pluginVersion?: string; name?: string };\n shared?: Array<{ name: string; version?: string }>;\n}\n\nexport interface SharedIdentityMismatch {\n name: string;\n expected: string;\n actual: string | null;\n}\n\nconst MANIFEST_TIMEOUT_MS = 15_000;\n\nfunction manifestUrl(remoteUrl: string): string {\n return remoteUrl.endsWith(\"/\") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;\n}\n\nfunction normalizeBaseUrl(remoteUrl: string): string {\n const withoutHash = remoteUrl.split(\"#\")[0] ?? remoteUrl;\n return withoutHash.replace(/\\/(mf-manifest\\.json|remoteEntry\\.js)$/i, \"\");\n}\n\nexport function compareSharedIdentity(\n remoteShared: Array<{ name: string; version?: string }> | undefined,\n expectedVersions: Map<string, string>,\n): SharedIdentityMismatch[] {\n const mismatches: SharedIdentityMismatch[] = [];\n const remoteByName = new Map((remoteShared ?? []).map((s) => [s.name, s]));\n\n for (const [name, expected] of expectedVersions.entries()) {\n if (!isEffectCriticalSharedDep(name)) continue;\n const remoteEntry = remoteByName.get(name);\n if (!remoteEntry) continue;\n if (remoteEntry.version && remoteEntry.version !== expected) {\n mismatches.push({ name, expected, actual: remoteEntry.version });\n }\n }\n\n return mismatches;\n}\n\nexport function describeSharedIdentityMismatch(\n pluginId: string,\n mismatches: SharedIdentityMismatch[],\n hostExpectation: string,\n): string {\n const lines = mismatches.map(\n (m) =>\n ` ${m.name}: expected ${m.expected} (from ${hostExpectation}), got ${m.actual ?? \"missing\"}`,\n );\n return (\n `[SharedIdentity] Refusing to load plugin \"${pluginId}\": shared dependency version skew.\\n` +\n `${lines.join(\"\\n\")}\\n` +\n `Run \"bos mf check\" for the full report. Fix: rebuild and redeploy the host and this plugin together (single release train, e.g. \"bos publish --deploy --packages local\").`\n );\n}\n\nexport async function fetchRemoteIdentityManifest(\n remoteUrl: string,\n): Promise<IdentityManifest | null> {\n const base = normalizeBaseUrl(remoteUrl);\n const url = manifestUrl(base);\n const res = await fetch(url, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });\n if (!res.ok) return null;\n return (await res.json()) as IdentityManifest;\n}\n"],"mappings":";;;AAaA,MAAM,sBAAsB;AAE5B,SAAS,YAAY,WAA2B;CAC9C,OAAO,UAAU,SAAS,GAAG,IAAI,GAAG,UAAU,oBAAoB,GAAG,UAAU;AACjF;AAEA,SAAS,iBAAiB,WAA2B;CAEnD,QADoB,UAAU,MAAM,GAAG,CAAC,CAAC,MAAM,UAC7B,CAAC,QAAQ,2CAA2C,EAAE;AAC1E;AAEA,SAAgB,sBACd,cACA,kBAC0B;CAC1B,MAAM,aAAuC,CAAC;CAC9C,MAAM,eAAe,IAAI,KAAK,gBAAgB,CAAC,EAAC,CAAE,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CAEzE,KAAK,MAAM,CAAC,MAAM,aAAa,iBAAiB,QAAQ,GAAG;EACzD,IAAI,CAAC,0BAA0B,IAAI,GAAG;EACtC,MAAM,cAAc,aAAa,IAAI,IAAI;EACzC,IAAI,CAAC,aAAa;EAClB,IAAI,YAAY,WAAW,YAAY,YAAY,UACjD,WAAW,KAAK;GAAE;GAAM;GAAU,QAAQ,YAAY;EAAQ,CAAC;CAEnE;CAEA,OAAO;AACT;AAEA,SAAgB,+BACd,UACA,YACA,iBACQ;CAKR,OACE,6CAA6C,SAAS,sCAL1C,WAAW,KACtB,MACC,KAAK,EAAE,KAAK,aAAa,EAAE,SAAS,SAAS,gBAAgB,SAAS,EAAE,UAAU,WAI7E,CAAC,CAAC,KAAK,IAAI,EAAE;AAGxB;AAEA,eAAsB,4BACpB,WACkC;CAElC,MAAM,MAAM,YADC,iBAAiB,SACH,CAAC;CAC5B,MAAM,MAAM,MAAM,MAAM,KAAK,EAAE,QAAQ,YAAY,QAAQ,mBAAmB,EAAE,CAAC;CACjF,IAAI,CAAC,IAAI,IAAI,OAAO;CACpB,OAAQ,MAAM,IAAI,KAAK;AACzB"}
1
+ {"version":3,"file":"shared-identity.mjs","names":[],"sources":["../../../src/runtime/services/shared-identity.ts"],"sourcesContent":["import { isEffectCriticalSharedDep } from \"../../shared-deps-spec\";\n\ninterface IdentityManifest {\n metaData?: { pluginVersion?: string; name?: string };\n shared?: Array<{ name: string; version?: string }>;\n}\n\nexport interface SharedIdentityMismatch {\n name: string;\n expected: string;\n actual: string | null;\n}\n\nconst MANIFEST_TIMEOUT_MS = 15_000;\n\nfunction manifestUrl(remoteUrl: string): string {\n return remoteUrl.endsWith(\"/\") ? `${remoteUrl}mf-manifest.json` : `${remoteUrl}/mf-manifest.json`;\n}\n\nfunction normalizeBaseUrl(remoteUrl: string): string {\n const withoutHash = remoteUrl.split(\"#\")[0] ?? remoteUrl;\n return withoutHash.replace(/\\/(mf-manifest\\.json|remoteEntry(?:\\.[^/]+)?\\.js)$/i, \"\");\n}\n\nexport function compareSharedIdentity(\n remoteShared: Array<{ name: string; version?: string }> | undefined,\n expectedVersions: Map<string, string>,\n): SharedIdentityMismatch[] {\n const mismatches: SharedIdentityMismatch[] = [];\n const remoteByName = new Map((remoteShared ?? []).map((s) => [s.name, s]));\n\n for (const [name, expected] of expectedVersions.entries()) {\n if (!isEffectCriticalSharedDep(name)) continue;\n const remoteEntry = remoteByName.get(name);\n if (!remoteEntry) continue;\n if (remoteEntry.version && remoteEntry.version !== expected) {\n mismatches.push({ name, expected, actual: remoteEntry.version });\n }\n }\n\n return mismatches;\n}\n\nexport function describeSharedIdentityMismatch(\n pluginId: string,\n mismatches: SharedIdentityMismatch[],\n hostExpectation: string,\n): string {\n const lines = mismatches.map(\n (m) =>\n ` ${m.name}: expected ${m.expected} (from ${hostExpectation}), got ${m.actual ?? \"missing\"}`,\n );\n return (\n `[SharedIdentity] Refusing to load plugin \"${pluginId}\": shared dependency version skew.\\n` +\n `${lines.join(\"\\n\")}\\n` +\n `Run \"bos mf check\" for the full report. Fix: rebuild and redeploy the host and this plugin together (single release train, e.g. \"bos publish --deploy --packages local\").`\n );\n}\n\nexport async function fetchRemoteIdentityManifest(\n remoteUrl: string,\n): Promise<IdentityManifest | null> {\n const base = normalizeBaseUrl(remoteUrl);\n const url = manifestUrl(base);\n const res = await fetch(url, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });\n if (!res.ok) return null;\n return (await res.json()) as IdentityManifest;\n}\n"],"mappings":";;;AAaA,MAAM,sBAAsB;AAE5B,SAAS,YAAY,WAA2B;CAC9C,OAAO,UAAU,SAAS,GAAG,IAAI,GAAG,UAAU,oBAAoB,GAAG,UAAU;AACjF;AAEA,SAAS,iBAAiB,WAA2B;CAEnD,QADoB,UAAU,MAAM,GAAG,CAAC,CAAC,MAAM,UAC7B,CAAC,QAAQ,uDAAuD,EAAE;AACtF;AAEA,SAAgB,sBACd,cACA,kBAC0B;CAC1B,MAAM,aAAuC,CAAC;CAC9C,MAAM,eAAe,IAAI,KAAK,gBAAgB,CAAC,EAAC,CAAE,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;CAEzE,KAAK,MAAM,CAAC,MAAM,aAAa,iBAAiB,QAAQ,GAAG;EACzD,IAAI,CAAC,0BAA0B,IAAI,GAAG;EACtC,MAAM,cAAc,aAAa,IAAI,IAAI;EACzC,IAAI,CAAC,aAAa;EAClB,IAAI,YAAY,WAAW,YAAY,YAAY,UACjD,WAAW,KAAK;GAAE;GAAM;GAAU,QAAQ,YAAY;EAAQ,CAAC;CAEnE;CAEA,OAAO;AACT;AAEA,SAAgB,+BACd,UACA,YACA,iBACQ;CAKR,OACE,6CAA6C,SAAS,sCAL1C,WAAW,KACtB,MACC,KAAK,EAAE,KAAK,aAAa,EAAE,SAAS,SAAS,gBAAgB,SAAS,EAAE,UAAU,WAI7E,CAAC,CAAC,KAAK,IAAI,EAAE;AAGxB;AAEA,eAAsB,4BACpB,WACkC;CAElC,MAAM,MAAM,YADC,iBAAiB,SACH,CAAC;CAC5B,MAAM,MAAM,MAAM,MAAM,KAAK,EAAE,QAAQ,YAAY,QAAQ,mBAAmB,EAAE,CAAC;CACjF,IAAI,CAAC,IAAI,IAAI,OAAO;CACpB,OAAQ,MAAM,IAAI,KAAK;AACzB"}
package/dist/types.d.cts CHANGED
@@ -1,7 +1,8 @@
1
+ import { PluginWarningInfo } from "./runtime/errors.cjs";
1
2
  import { Plugin } from "./plugin.cjs";
3
+ import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
2
4
  import { ContractedRouter, RouterClient } from "@orpc/server";
3
5
  import { Context, Scope } from "effect";
4
- import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
5
6
  //#region src/types.d.ts
6
7
  /**
7
8
  * Registry bindings interface - populated via module augmentation
@@ -16,6 +17,18 @@ import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } fro
16
17
  * ```
17
18
  */
18
19
  interface RegisteredPlugins {}
20
+ type ModuleTransport = "inproc" | "rpc" | "mf";
21
+ type ModuleSurface = "api" | "ui" | "jobs";
22
+ interface ModuleEndpoint {
23
+ readonly transport: ModuleTransport;
24
+ readonly surface?: ModuleSurface;
25
+ readonly url: string;
26
+ readonly path?: `/${string}`;
27
+ readonly manifest?: string;
28
+ }
29
+ type PluginTransport = ModuleTransport;
30
+ type PluginSurface = ModuleSurface;
31
+ type PluginEndpoint = ModuleEndpoint;
19
32
  /**
20
33
  * Base type for any plugin instance.
21
34
  */
@@ -38,10 +51,12 @@ type AnyPluginConstructor = {
38
51
  type PluginRegistryEntry = {
39
52
  module: AnyPluginConstructor;
40
53
  remote?: string;
54
+ endpoint?: PluginEndpoint;
41
55
  version?: string;
42
56
  description?: string;
43
57
  } | {
44
58
  remote: string;
59
+ endpoint?: PluginEndpoint;
45
60
  version?: string;
46
61
  description?: string;
47
62
  };
@@ -106,7 +121,14 @@ type PluginClientType<T> = RouterClient<PluginRouterType<T>>;
106
121
  type PluginServicesEntry<T = any> = {
107
122
  client: (context?: PluginContextInput<T>) => PluginClientType<T>;
108
123
  router: PluginRouterType<T>;
124
+ endpoint?: PluginEndpoint;
125
+ };
126
+ type ModuleClientEntry<C extends AnyContractRouter = AnyContractRouter> = {
127
+ client: (context?: Record<string, unknown>) => RouterClient<ContractedRouter<C, any>>;
128
+ router?: ContractedRouter<C, any>;
129
+ endpoint?: PluginEndpoint;
109
130
  };
131
+ type PluginClientEntry<C extends AnyContractRouter = AnyContractRouter> = ModuleClientEntry<C>;
110
132
  /**
111
133
  * Extract plugin type from registered plugins by key
112
134
  * @param K - The plugin key
@@ -171,6 +193,7 @@ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
171
193
  readonly plugin: T;
172
194
  readonly metadata: PluginMetadata;
173
195
  readonly config: {
196
+ pluginId: string;
174
197
  variables: InferSchemaOutput<T["configSchema"]["variables"]>;
175
198
  secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
176
199
  };
@@ -181,6 +204,8 @@ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
181
204
  */
182
205
  readonly effectContext: Context.Context<any>;
183
206
  readonly scope: Scope.Closeable;
207
+ /** Non-fatal config warnings collected during initialization (empty when none). */
208
+ readonly warnings: PluginWarningInfo[];
184
209
  }
185
210
  /**
186
211
  * Helper type to detect type errors when looking up RegisteredPlugins
@@ -244,5 +269,5 @@ interface PluginRuntimeConfig<R extends Record<string, PluginRegistryEntry> = Re
244
269
  secrets?: SecretsConfig;
245
270
  }
246
271
  //#endregion
247
- export { AnyPlugin, AnyPluginConstructor, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContextInput, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginVariables, RegisteredPlugin, RegisteredPlugins, SecretsConfig, UsePluginResult };
272
+ export { AnyPlugin, AnyPluginConstructor, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LoadedPlugin, ModuleClientEntry, ModuleEndpoint, ModuleSurface, ModuleTransport, PluginClientEntry, PluginClientType, PluginConfigInput, PluginContext, PluginContextInput, PluginContract, PluginEndpoint, PluginInstance, PluginMetadata, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginSurface, PluginTransport, PluginVariables, RegisteredPlugin, RegisteredPlugins, SecretsConfig, UsePluginResult };
248
273
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;;;;UAuBiB;;;;KAKL,YAAY,OAAO,mBAAmB,WAAW,WAAW;;;;KAK5D;UACF;EACR;IACE,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;;;;;;KAOD;EACN,QAAQ;EAAsB;EAAiB;EAAkB;;EACjE;EAAgB;EAAkB;;;;;KAK5B,kBAAkB,KAAK;EAAY,cAAc;IAAM;;;;KAKvD,yBAAyB,UAAU,eAAe,2BAC3D,WAAW,IAAI,EAAE;EAAa,cAAc;IACzC,IACA,gBAAgB,oBACd,kBAAkB;;;;KAOd,eAAe,KAAK;EAC9B;IAAW,gBAAgB,UAAU;;IAEnC;;;;KAMQ,gBAAgB,KAAK;EAAY;IAAW,iBAAiB,UAAU;;IAC/E;;;;KAMQ,cAAc,KAAK;EAAY;IAAW,eAAe,UAAU;;IAC3E;;;;KAMQ,cAAc,KAAK;EAC7B;IAAW,eAAe,UAAU;;IAElC;;;;;KAOQ,iBAAiB,KAAK,iBAAiB,eAAe;;;;KAKtD,iBAAiB,KAAK,aAAa,iBAAiB;;;;;;KAOpD,oBAAoB;EAC9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ugin.mjs";
2
3
  import { Context, Scope } from "effect";
3
4
  import { ContractedRouter, RouterClient } from "@orpc/server";
@@ -16,6 +17,18 @@ import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } fro
16
17
  * ```
17
18
  */
18
19
  interface RegisteredPlugins {}
20
+ type ModuleTransport = "inproc" | "rpc" | "mf";
21
+ type ModuleSurface = "api" | "ui" | "jobs";
22
+ interface ModuleEndpoint {
23
+ readonly transport: ModuleTransport;
24
+ readonly surface?: ModuleSurface;
25
+ readonly url: string;
26
+ readonly path?: `/${string}`;
27
+ readonly manifest?: string;
28
+ }
29
+ type PluginTransport = ModuleTransport;
30
+ type PluginSurface = ModuleSurface;
31
+ type PluginEndpoint = ModuleEndpoint;
19
32
  /**
20
33
  * Base type for any plugin instance.
21
34
  */
@@ -38,10 +51,12 @@ type AnyPluginConstructor = {
38
51
  type PluginRegistryEntry = {
39
52
  module: AnyPluginConstructor;
40
53
  remote?: string;
54
+ endpoint?: PluginEndpoint;
41
55
  version?: string;
42
56
  description?: string;
43
57
  } | {
44
58
  remote: string;
59
+ endpoint?: PluginEndpoint;
45
60
  version?: string;
46
61
  description?: string;
47
62
  };
@@ -106,7 +121,14 @@ type PluginClientType<T> = RouterClient<PluginRouterType<T>>;
106
121
  type PluginServicesEntry<T = any> = {
107
122
  client: (context?: PluginContextInput<T>) => PluginClientType<T>;
108
123
  router: PluginRouterType<T>;
124
+ endpoint?: PluginEndpoint;
125
+ };
126
+ type ModuleClientEntry<C extends AnyContractRouter = AnyContractRouter> = {
127
+ client: (context?: Record<string, unknown>) => RouterClient<ContractedRouter<C, any>>;
128
+ router?: ContractedRouter<C, any>;
129
+ endpoint?: PluginEndpoint;
109
130
  };
131
+ type PluginClientEntry<C extends AnyContractRouter = AnyContractRouter> = ModuleClientEntry<C>;
110
132
  /**
111
133
  * Extract plugin type from registered plugins by key
112
134
  * @param K - The plugin key
@@ -171,6 +193,7 @@ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
171
193
  readonly plugin: T;
172
194
  readonly metadata: PluginMetadata;
173
195
  readonly config: {
196
+ pluginId: string;
174
197
  variables: InferSchemaOutput<T["configSchema"]["variables"]>;
175
198
  secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
176
199
  };
@@ -181,6 +204,8 @@ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
181
204
  */
182
205
  readonly effectContext: Context.Context<any>;
183
206
  readonly scope: Scope.Closeable;
207
+ /** Non-fatal config warnings collected during initialization (empty when none). */
208
+ readonly warnings: PluginWarningInfo[];
184
209
  }
185
210
  /**
186
211
  * Helper type to detect type errors when looking up RegisteredPlugins
@@ -244,5 +269,5 @@ interface PluginRuntimeConfig<R extends Record<string, PluginRegistryEntry> = Re
244
269
  secrets?: SecretsConfig;
245
270
  }
246
271
  //#endregion
247
- export { AnyPlugin, AnyPluginConstructor, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContextInput, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginVariables, RegisteredPlugin, RegisteredPlugins, SecretsConfig, UsePluginResult };
272
+ export { AnyPlugin, AnyPluginConstructor, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LoadedPlugin, ModuleClientEntry, ModuleEndpoint, ModuleSurface, ModuleTransport, PluginClientEntry, PluginClientType, PluginConfigInput, PluginContext, PluginContextInput, PluginContract, PluginEndpoint, PluginInstance, PluginMetadata, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginSurface, PluginTransport, PluginVariables, RegisteredPlugin, RegisteredPlugins, SecretsConfig, UsePluginResult };
248
273
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;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AM;;WAEb,UAAU;;;;;KAMhB,oBAAoB,gBAAgB,GAAG,IAAI,qBAAqB,EAAE;EACrE,eAAe;IAEb;EACE,UAAU;EACV,WAAW;EACX,SAAS;EACT,SAAS;wBAGI,4IACF;;;;;;KAOL,gBAAgB,gBAAgB,GAAG,IAAI,qBACjD,oBAAoB,GAAG;WAER,eAAe,UAAU,mBAAmB,EAAE,QAAQ,iBAAiB,EAAE;WACzE,QAAQ,iBAAiB,EAAE;WAC3B,UAAU;WACV,aAAa,kBAAkB,iBAAiB,GAAG;IAE9D,oBAAoB,GAAG;;;;;;;KAQxB,WAAW,KAAK;EAAY,uBAAuB;IAAM,IAAI;;;;kBAKjD;;;;;;;;;;;;;;;;;;OAkBH,MACV,kBACA,SAAS,qBACP,gBAAgB,WAAW,UAAU,gBAAgB,GAAG,WAAW;;;;;UAMxD,oBACf,UAAU,eAAe,uBAAuB,eAAe;EAE/D,UAAU;EACV,UAAU"}
@@ -1,3 +1,4 @@
1
+ const require_ui_manifest_contract = require('./contract.cjs');
1
2
  const require_mount_registry = require('./mount-registry.cjs');
2
3
  const require_descriptor = require('./descriptor.cjs');
3
4
  const require_nav = require('./nav.cjs');
@@ -94,28 +95,61 @@ async function constructTree(input) {
94
95
  const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));
95
96
  const resolved = [];
96
97
  for (const ref of refs) resolved.push(await input.resolve(ref));
98
+ const ordered = [...resolved.filter((plugin) => plugin.key === "ui"), ...resolved.filter((plugin) => plugin.key !== "ui")];
97
99
  const optionsByPlugin = /* @__PURE__ */ new Map();
100
+ const skippedByPlugin = /* @__PURE__ */ new Map();
98
101
  for (const plugin of resolved) {
102
+ if (!plugin.manifest?.routes) continue;
99
103
  const optionsById = /* @__PURE__ */ new Map();
104
+ const skipped = /* @__PURE__ */ new Set();
100
105
  await Promise.all(plugin.manifest.routes.map(async (record) => {
101
106
  const loader = plugin.routeConfig.routeConfigLoaders[record.id];
102
- if (!loader) throw new Error(`routeConfig for "${plugin.key}" has no loader for route "${record.id}"`);
107
+ if (!loader) {
108
+ console.log(`[Compose] skipping route "${record.id}" in "${plugin.key}" — no routeConfig loader`);
109
+ skipped.add(record.id);
110
+ return;
111
+ }
103
112
  optionsById.set(record.id, await loader());
104
113
  }));
114
+ let changed = true;
115
+ while (changed) {
116
+ changed = false;
117
+ for (const record of plugin.manifest.routes) {
118
+ if (skipped.has(record.id)) continue;
119
+ if (record.parentId && skipped.has(record.parentId)) {
120
+ skipped.add(record.id);
121
+ changed = true;
122
+ }
123
+ }
124
+ }
105
125
  optionsByPlugin.set(plugin.key, optionsById);
126
+ skippedByPlugin.set(plugin.key, skipped);
106
127
  }
107
128
  const declarations = /* @__PURE__ */ new Map();
108
- for (const plugin of resolved) for (const record of plugin.manifest.routes) {
109
- if (!record.mount) continue;
110
- const mountId = record.mount;
111
- if (!require_mount_registry.MOUNT_REGISTRY[mountId].implemented) throw new Error(`mount "${record.mount}" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by "${plugin.key}"`);
112
- const existing = declarations.get(mountId);
113
- if (existing) throw new Error(`mount "${mountId}" declared by multiple sources: "${existing.key}" (${existing.record.file}) and "${plugin.key}" (${record.file})`);
114
- declarations.set(mountId, {
115
- key: plugin.key,
116
- record,
117
- options: optionsByPlugin.get(plugin.key).get(record.id)
118
- });
129
+ const mountByLayoutId = /* @__PURE__ */ new Map();
130
+ for (const plugin of ordered) {
131
+ if (!plugin.manifest?.routes) continue;
132
+ for (const record of plugin.manifest.routes) {
133
+ if (!record.mount) continue;
134
+ const mountId = record.mount;
135
+ if (!require_mount_registry.MOUNT_REGISTRY[mountId].implemented) throw new Error(`mount "${record.mount}" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by "${plugin.key}"`);
136
+ const existing = declarations.get(mountId);
137
+ if (existing) {
138
+ if (existing.key === "ui" && plugin.key !== "ui") {
139
+ console.log(`[Compose] mount declaration "${existing.key}:${existing.record.id}" (${mountId}) shadows "${plugin.key}:${record.id}" — core ui wins; shadowed declaration skipped`);
140
+ mountByLayoutId.set(record.id, mountId);
141
+ continue;
142
+ }
143
+ throw new Error(`mount "${mountId}" declared by multiple sources: "${existing.key}" (${existing.record.file}) and "${plugin.key}" (${record.file})`);
144
+ }
145
+ if (skippedByPlugin.get(plugin.key).has(record.id)) continue;
146
+ declarations.set(mountId, {
147
+ key: plugin.key,
148
+ record,
149
+ options: optionsByPlugin.get(plugin.key).get(record.id)
150
+ });
151
+ mountByLayoutId.set(record.id, mountId);
152
+ }
119
153
  }
120
154
  const rootRoute = toAnyRoute((0, _tanstack_react_router.createRootRoute)({
121
155
  ...input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {},
@@ -138,8 +172,6 @@ async function constructTree(input) {
138
172
  });
139
173
  mountRoutes.set(mountId, toAnyRoute(route));
140
174
  }
141
- const mountByLayoutId = /* @__PURE__ */ new Map();
142
- for (const [mountId, declaration] of declarations) mountByLayoutId.set(declaration.record.id, mountId);
143
175
  const nav = [];
144
176
  const mountCounts = {};
145
177
  const childrenByParent = /* @__PURE__ */ new Map();
@@ -150,7 +182,8 @@ async function constructTree(input) {
150
182
  list.push(child);
151
183
  childrenByParent.set(parent, list);
152
184
  };
153
- for (const plugin of resolved) {
185
+ for (const plugin of ordered) {
186
+ if (!plugin.manifest?.routes) continue;
154
187
  const optionsById = optionsByPlugin.get(plugin.key);
155
188
  const fullPathById = /* @__PURE__ */ new Map();
156
189
  const mountById = /* @__PURE__ */ new Map();
@@ -184,13 +217,24 @@ async function constructTree(input) {
184
217
  }
185
218
  throw new Error(`route "${record.id}" in "${plugin.key}" must live under a mount`);
186
219
  };
187
- const pending = plugin.manifest.routes.filter((record) => !record.mount);
220
+ const pending = plugin.manifest.routes.filter((record) => !record.mount && !skippedByPlugin.get(plugin.key).has(record.id));
221
+ const shadowedIds = /* @__PURE__ */ new Set();
188
222
  let progressed = true;
189
223
  while (pending.length > 0 && progressed) {
190
224
  progressed = false;
191
225
  for (let i = 0; i < pending.length; i += 1) {
192
226
  const record = pending[i];
193
- if (record.parentId && !byId.has(record.parentId) && !mountByLayoutId.has(record.parentId)) continue;
227
+ const parentId = record.parentId;
228
+ if (parentId) {
229
+ if (shadowedIds.has(parentId)) {
230
+ shadowedIds.add(record.id);
231
+ pending.splice(i, 1);
232
+ i -= 1;
233
+ progressed = true;
234
+ continue;
235
+ }
236
+ if (!byId.has(parentId) && !mountByLayoutId.has(parentId)) continue;
237
+ }
194
238
  pending.splice(i, 1);
195
239
  progressed = true;
196
240
  const options = optionsById.get(record.id);
@@ -200,7 +244,14 @@ async function constructTree(input) {
200
244
  if (!isLayoutRoute) {
201
245
  const siblings = claimedPathsByParent.get(parent.route) ?? /* @__PURE__ */ new Map();
202
246
  const claimant = siblings.get(routePath);
203
- if (claimant) throw new Error(`path collision: "${plugin.key}" route "${record.id}" declares "${routePath}" which is already claimed by "${claimant}" under the same parent`);
247
+ if (claimant) {
248
+ if (plugin.key !== "ui" && claimant.startsWith(`${"ui"}:`)) {
249
+ console.log(`[Compose] route claim "${claimant}" (${routePath}) shadows "${plugin.key}:${record.id}" — core ui wins; shadowed route skipped`);
250
+ shadowedIds.add(record.id);
251
+ break;
252
+ }
253
+ throw new Error(`path collision: "${plugin.key}" route "${record.id}" declares "${routePath}" which is already claimed by "${claimant}" under the same parent`);
254
+ }
204
255
  siblings.set(routePath, `${plugin.key}:${record.id}`);
205
256
  claimedPathsByParent.set(parent.route, siblings);
206
257
  }
@@ -1 +1 @@
1
- {"version":3,"file":"construct.cjs","names":["redirect","ROUTE_OPTION_KEYS","MOUNT_REGISTRY","createRootRoute","Outlet","createRoute","resolveMountSegment","compareNavItems","digestOf"],"sources":["../../../src/ui/manifest/construct.ts"],"sourcesContent":["import type { AnyRoute } from \"@tanstack/react-router\";\nimport { createRootRoute, createRoute, Outlet, redirect } from \"@tanstack/react-router\";\nimport { digestOf } from \"./descriptor\";\nimport type { PluginManifest, RouteRecord } from \"./manifest-schema\";\nimport { MOUNT_REGISTRY, type MountDef, type MountId, resolveMountSegment } from \"./mount-registry\";\nimport { compareNavItems, type NavDeclaration, type NavItem, type NavManifest } from \"./nav\";\nimport { ROUTE_OPTION_KEYS, type RouteConfigModule, type RouteOptionsBundle } from \"./route-config\";\n\n/**\n * Host-side route-graph construction (ADR 0008 §1): manifests + route\n * configs in → host-built tree out. The host constructs ITS OWN Route\n * objects from validated manifest data via public `createRoute` APIs; no\n * foreign route object is ever mutated. Gates are attached HOST-side from\n * the mount registry — plugins cannot ship a route that escapes its\n * mount's gate because plugins never construct route objects.\n *\n * Mounts are the ONLY cross-source parenting points: a root-level\n * pathless layout file (`_public.tsx`) declares the mount for the whole\n * composition (exactly one declaring source per mount); every other\n * source's routes live under the same `_mount/` directory prefix and\n * parent onto the shared mount route. This module executes inside the\n * core ui's module graph (production MF expose `./compose`, dev source\n * import) so constructed routes are minted by the same react/router\n * instance that renders them.\n */\n\n/**\n * TanStack's Route generics are intentionally invariant — routes built from\n * manifest data can't satisfy them structurally. One named boundary for\n * handing a constructed route to the tree-building APIs.\n */\nfunction toAnyRoute(route: unknown): AnyRoute {\n return route as AnyRoute;\n}\n\nexport interface GateUser {\n id: string;\n name?: string;\n /** Better Auth user role — \"admin\" gates the admin mount. */\n role?: string;\n}\n\nexport interface HostContext {\n user?: GateUser;\n session?: { user?: GateUser };\n}\n\ntype GateFn = (args: {\n context: HostContext;\n location: { pathname: string; searchStr: string };\n}) => void;\n\n/**\n * Gate redirects are absolute: gates attach to root-level mount routes, and\n * relatives would silently shift if a mount ever moved deeper in the tree.\n * The login surface is plugin-owned, never core-known.\n */\nconst LOGIN_TO: string = \"/login\";\nconst HOME_TO: string = \"/\";\n\n/**\n * Gate implementations by mount gate kind. Only `session` and `admin` are\n * implemented (ADR 0008 §3); unimplemented mounts are rejected during mount\n * declaration before any gate lookup, and gates are optional by type — a\n * mount without an entry (or `none`) renders ungated.\n */\nconst GATES: Partial<Record<MountDef[\"gate\"], GateFn>> = {\n session: ({ context, location }) => {\n const user = userOf(context);\n if (!user) {\n throw redirect({\n to: LOGIN_TO,\n search: { redirect: location.pathname + location.searchStr } as never,\n });\n }\n },\n admin: ({ context }) => {\n const user = userOf(context);\n if (!user) throw redirect({ to: LOGIN_TO });\n if (user.role !== \"admin\") throw redirect({ to: HOME_TO });\n },\n};\n\nconst userOf = (context: HostContext | undefined): GateUser | undefined =>\n context?.user ?? context?.session?.user;\n\nexport interface ConstructPluginRef {\n /** composition identity — plugin key; participates in the digest */\n key: string;\n /** deployment identity — the MF container name loadRemote targets */\n mfName: string;\n}\n\nexport interface ResolvedPlugin {\n key: string;\n manifest: PluginManifest;\n routeConfig: RouteConfigModule;\n}\n\nexport interface ConstructInput {\n name: string;\n plugins: ReadonlyArray<ConstructPluginRef>;\n resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;\n /** core ui `__root` options — component/error/notFound + head baseline */\n rootOptions?: RouteOptionsBundle;\n}\n\nexport interface ConstructedTree {\n rootRoute: AnyRoute;\n routeTree: AnyRoute;\n digest: string;\n manifests: PluginManifest[];\n nav: NavManifest;\n /** constructed route count per mount id */\n mountCounts: Record<string, number>;\n}\n\ninterface MountDeclaration {\n key: string;\n record: RouteRecord;\n options: RouteOptionsBundle;\n}\n\nfunction joinPath(a: string | undefined, b: string | undefined): string {\n const left = a && a !== \"/\" ? a.replace(/\\/+$/, \"\") : \"\";\n const right = b && b !== \"/\" ? b.replace(/^\\/+/, \"\") : \"\";\n if (!left) return right ? `/${right}` : \"/\";\n if (!right) return left;\n return `${left}/${right}`;\n}\n\nconst navOf = (options: RouteOptionsBundle): NavDeclaration | undefined => {\n const nav = options.staticData?.nav;\n if (nav && typeof nav === \"object\" && typeof (nav as NavDeclaration).label === \"string\") {\n return nav as NavDeclaration;\n }\n return undefined;\n};\n\n/** Layout routes (mount or pathless) pass their authored options through,\n * like every other route kind. On mount routes the registry gate composes\n * BEFORE the declaration's own beforeLoad so a source can never escape its\n * mount's gate (ADR 0008 §3), while the declaration's return value still\n * flows to children as route context. */\nfunction layoutBeforeLoad(\n gate: GateFn | undefined,\n declared: RouteOptionsBundle[\"beforeLoad\"],\n): RouteOptionsBundle[\"beforeLoad\"] {\n if (!gate) return declared;\n return (args) => {\n gate(args);\n return declared?.(args);\n };\n}\n\nconst AUTHORED_OPTION_KEYS = ROUTE_OPTION_KEYS.filter(\n (key) => key !== \"beforeLoad\" && key !== \"component\",\n);\n\nfunction authoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const authored: Partial<Record<keyof RouteOptionsBundle, unknown>> = {};\n for (const key of AUTHORED_OPTION_KEYS) {\n if (options[key] !== undefined) authored[key] = options[key];\n }\n return authored as Partial<RouteOptionsBundle>;\n}\n\nfunction rootAuthoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const { params: _params, ...authored } = authoredOptions(options);\n return authored;\n}\n\nexport async function constructTree(input: ConstructInput): Promise<ConstructedTree> {\n const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));\n const resolved: ResolvedPlugin[] = [];\n for (const ref of refs) {\n resolved.push(await input.resolve(ref));\n }\n\n const optionsByPlugin = new Map<string, Map<string, RouteOptionsBundle>>();\n for (const plugin of resolved) {\n const optionsById = new Map<string, RouteOptionsBundle>();\n await Promise.all(\n plugin.manifest.routes.map(async (record) => {\n const loader = plugin.routeConfig.routeConfigLoaders[record.id];\n if (!loader) {\n throw new Error(`routeConfig for \"${plugin.key}\" has no loader for route \"${record.id}\"`);\n }\n optionsById.set(record.id, await loader());\n }),\n );\n optionsByPlugin.set(plugin.key, optionsById);\n }\n\n const declarations = new Map<MountId, MountDeclaration>();\n for (const plugin of resolved) {\n for (const record of plugin.manifest.routes) {\n if (!record.mount) continue;\n const mountId = record.mount as MountId;\n const def = MOUNT_REGISTRY[mountId];\n if (!def.implemented) {\n throw new Error(\n `mount \"${record.mount}\" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by \"${plugin.key}\"`,\n );\n }\n const existing = declarations.get(mountId);\n if (existing) {\n throw new Error(\n `mount \"${mountId}\" declared by multiple sources: \"${existing.key}\" (${existing.record.file}) and \"${plugin.key}\" (${record.file})`,\n );\n }\n declarations.set(mountId, {\n key: plugin.key,\n record,\n options: optionsByPlugin.get(plugin.key)!.get(record.id)!,\n });\n }\n }\n\n const rootRoute = toAnyRoute(\n createRootRoute({\n ...(input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {}),\n component: input.rootOptions?.component ?? Outlet,\n ...(input.rootOptions?.beforeLoad ? { beforeLoad: input.rootOptions.beforeLoad } : {}),\n }),\n );\n\n const mountRoutes = new Map<MountId, AnyRoute>();\n for (const mountId of Object.keys(MOUNT_REGISTRY) as MountId[]) {\n const declaration = declarations.get(mountId);\n if (!declaration) continue;\n const def = MOUNT_REGISTRY[mountId]!;\n const gate = GATES[def.gate];\n const options = declaration.options;\n const route = createRoute({\n id: `__mount_${mountId}`,\n getParentRoute: () => rootRoute,\n ...(gate || options.beforeLoad\n ? { beforeLoad: layoutBeforeLoad(gate, options.beforeLoad) }\n : {}),\n ...authoredOptions(options),\n component: options.component ?? Outlet,\n });\n mountRoutes.set(mountId, toAnyRoute(route));\n }\n\n const mountByLayoutId = new Map<string, MountId>();\n for (const [mountId, declaration] of declarations) {\n mountByLayoutId.set(declaration.record.id, mountId);\n }\n\n const nav: NavItem[] = [];\n const mountCounts: Record<string, number> = {};\n const childrenByParent = new Map<AnyRoute, AnyRoute[]>();\n /** cross-plugin path-collision guard: claimed paths per parent route */\n const claimedPathsByParent = new Map<AnyRoute, Map<string, string>>();\n const attach = (parent: AnyRoute, child: AnyRoute) => {\n const list = childrenByParent.get(parent) ?? [];\n list.push(child);\n childrenByParent.set(parent, list);\n };\n\n for (const plugin of resolved) {\n const optionsById = optionsByPlugin.get(plugin.key)!;\n const fullPathById = new Map<string, string>();\n const mountById = new Map<string, MountId>();\n const byId = new Map<string, { record: RouteRecord; route: AnyRoute }>();\n\n const parentFor = (\n record: RouteRecord,\n ): { route: AnyRoute; fullPath: string; mount: MountId } => {\n if (record.parentId) {\n const local = byId.get(record.parentId);\n if (local) {\n return {\n route: local.route,\n fullPath: fullPathById.get(record.parentId)!,\n mount: mountById.get(record.parentId)!,\n };\n }\n const mount = mountByLayoutId.get(record.parentId);\n if (mount) return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n throw new Error(\n `unresolvable parent \"${record.parentId}\" for \"${record.id}\" in \"${plugin.key}\" — mounts are the only cross-source parenting points`,\n );\n }\n const firstSegment = record.id.split(\"/\")[0] ?? \"\";\n if (firstSegment.startsWith(\"_\")) {\n const mount = resolveMountSegment(firstSegment.slice(1));\n if (mount && mountRoutes.has(mount))\n return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n if (mount) {\n throw new Error(\n `mount \"${mount}\" is not declared by any source (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(\n `unknown mount \"_${firstSegment.slice(1)}\" (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(`route \"${record.id}\" in \"${plugin.key}\" must live under a mount`);\n };\n\n const pending = plugin.manifest.routes.filter((record) => !record.mount);\n let progressed = true;\n while (pending.length > 0 && progressed) {\n progressed = false;\n for (let i = 0; i < pending.length; i += 1) {\n const record = pending[i]!;\n if (\n record.parentId &&\n !byId.has(record.parentId) &&\n !mountByLayoutId.has(record.parentId)\n ) {\n continue;\n }\n pending.splice(i, 1);\n progressed = true;\n\n const options = optionsById.get(record.id)!;\n const parent = parentFor(record);\n const routePath = record.path;\n const isLayoutRoute = record.type === \"layout\" || routePath === undefined;\n if (!isLayoutRoute) {\n const siblings = claimedPathsByParent.get(parent.route) ?? new Map<string, string>();\n const claimant = siblings.get(routePath);\n if (claimant) {\n throw new Error(\n `path collision: \"${plugin.key}\" route \"${record.id}\" declares \"${routePath}\" which is already claimed by \"${claimant}\" under the same parent`,\n );\n }\n siblings.set(routePath, `${plugin.key}:${record.id}`);\n claimedPathsByParent.set(parent.route, siblings);\n }\n const fullPath = joinPath(parent.fullPath, routePath);\n let route: AnyRoute;\n if (isLayoutRoute) {\n route = createRoute({\n id: `${plugin.key}__${record.id}`,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n } else {\n route = createRoute({\n path: routePath,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n }\n\n byId.set(record.id, { record, route: toAnyRoute(route) });\n fullPathById.set(record.id, fullPath);\n mountById.set(record.id, parent.mount);\n attach(parent.route, toAnyRoute(route));\n mountCounts[parent.mount] = (mountCounts[parent.mount] ?? 0) + 1;\n\n const navDeclaration = navOf(options);\n if (navDeclaration && navDeclaration.hidden !== true) {\n nav.push({\n id: `${plugin.key}:${record.id}`,\n label: navDeclaration.label,\n ...(typeof navDeclaration.icon === \"string\" ? { icon: navDeclaration.icon } : {}),\n ...(typeof navDeclaration.group === \"string\" ? { group: navDeclaration.group } : {}),\n ...(typeof navDeclaration.order === \"number\" ? { order: navDeclaration.order } : {}),\n to: navDeclaration.to ?? fullPath,\n plugin: plugin.key,\n mount: parent.mount,\n });\n }\n break;\n }\n }\n if (pending.length > 0) {\n throw new Error(\n `unresolvable parentage in \"${plugin.key}\": ${pending.map((record) => record.id).join(\", \")}`,\n );\n }\n }\n\n for (const [parent, children] of childrenByParent) {\n (parent as { addChildren: (children: AnyRoute[]) => void }).addChildren(children);\n }\n rootRoute.addChildren([...mountRoutes.values()] as AnyRoute[]);\n nav.sort(compareNavItems);\n\n const digest = await digestOf({\n plugins: refs.map((ref) => ({ key: ref.key, mfName: ref.mfName })),\n manifests: resolved.map((plugin) => plugin.manifest),\n });\n\n return {\n rootRoute,\n routeTree: rootRoute,\n digest,\n manifests: resolved.map((plugin) => plugin.manifest),\n nav: { items: nav },\n mountCounts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAS,WAAW,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"file":"construct.cjs","names":["redirect","ROUTE_OPTION_KEYS","MOUNT_REGISTRY","createRootRoute","Outlet","createRoute","resolveMountSegment","compareNavItems","digestOf"],"sources":["../../../src/ui/manifest/construct.ts"],"sourcesContent":["import type { AnyRoute } from \"@tanstack/react-router\";\nimport { createRootRoute, createRoute, Outlet, redirect } from \"@tanstack/react-router\";\nimport { CORE_UI_PLUGIN_KEY } from \"./contract\";\nimport { digestOf } from \"./descriptor\";\nimport type { PluginManifest, RouteRecord } from \"./manifest-schema\";\nimport { MOUNT_REGISTRY, type MountDef, type MountId, resolveMountSegment } from \"./mount-registry\";\nimport { compareNavItems, type NavDeclaration, type NavItem, type NavManifest } from \"./nav\";\nimport { ROUTE_OPTION_KEYS, type RouteConfigModule, type RouteOptionsBundle } from \"./route-config\";\n\n/**\n * Host-side route-graph construction (ADR 0008 §1): manifests + route\n * configs in → host-built tree out. The host constructs ITS OWN Route\n * objects from validated manifest data via public `createRoute` APIs; no\n * foreign route object is ever mutated. Gates are attached HOST-side from\n * the mount registry — plugins cannot ship a route that escapes its\n * mount's gate because plugins never construct route objects.\n *\n * Mounts are the ONLY cross-source parenting points: a root-level\n * pathless layout file (`_public.tsx`) declares the mount for the whole\n * composition (exactly one declaring source per mount); every other\n * source's routes live under the same `_mount/` directory prefix and\n * parent onto the shared mount route. This module executes inside the\n * core ui's module graph (production MF expose `./compose`, dev source\n * import) so constructed routes are minted by the same react/router\n * instance that renders them.\n */\n\n/**\n * TanStack's Route generics are intentionally invariant — routes built from\n * manifest data can't satisfy them structurally. One named boundary for\n * handing a constructed route to the tree-building APIs.\n */\nfunction toAnyRoute(route: unknown): AnyRoute {\n return route as AnyRoute;\n}\n\nexport interface GateUser {\n id: string;\n name?: string;\n /** Better Auth user role — \"admin\" gates the admin mount. */\n role?: string;\n}\n\nexport interface HostContext {\n user?: GateUser;\n session?: { user?: GateUser };\n}\n\ntype GateFn = (args: {\n context: HostContext;\n location: { pathname: string; searchStr: string };\n}) => void;\n\n/**\n * Gate redirects are absolute: gates attach to root-level mount routes, and\n * relatives would silently shift if a mount ever moved deeper in the tree.\n * The login surface is plugin-owned, never core-known.\n */\nconst LOGIN_TO: string = \"/login\";\nconst HOME_TO: string = \"/\";\n\n/**\n * Gate implementations by mount gate kind. Only `session` and `admin` are\n * implemented (ADR 0008 §3); unimplemented mounts are rejected during mount\n * declaration before any gate lookup, and gates are optional by type — a\n * mount without an entry (or `none`) renders ungated.\n */\nconst GATES: Partial<Record<MountDef[\"gate\"], GateFn>> = {\n session: ({ context, location }) => {\n const user = userOf(context);\n if (!user) {\n throw redirect({\n to: LOGIN_TO,\n search: { redirect: location.pathname + location.searchStr } as never,\n });\n }\n },\n admin: ({ context }) => {\n const user = userOf(context);\n if (!user) throw redirect({ to: LOGIN_TO });\n if (user.role !== \"admin\") throw redirect({ to: HOME_TO });\n },\n};\n\nconst userOf = (context: HostContext | undefined): GateUser | undefined =>\n context?.user ?? context?.session?.user;\n\nexport interface ConstructPluginRef {\n /** composition identity — plugin key; participates in the digest */\n key: string;\n /** deployment identity — the MF container name loadRemote targets */\n mfName: string;\n}\n\nexport interface ResolvedPlugin {\n key: string;\n manifest: PluginManifest;\n routeConfig: RouteConfigModule;\n}\n\nexport interface ConstructInput {\n name: string;\n plugins: ReadonlyArray<ConstructPluginRef>;\n resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;\n /** core ui `__root` options — component/error/notFound + head baseline */\n rootOptions?: RouteOptionsBundle;\n}\n\nexport interface ConstructedTree {\n rootRoute: AnyRoute;\n routeTree: AnyRoute;\n digest: string;\n manifests: PluginManifest[];\n nav: NavManifest;\n /** constructed route count per mount id */\n mountCounts: Record<string, number>;\n}\n\ninterface MountDeclaration {\n key: string;\n record: RouteRecord;\n options: RouteOptionsBundle;\n}\n\nfunction joinPath(a: string | undefined, b: string | undefined): string {\n const left = a && a !== \"/\" ? a.replace(/\\/+$/, \"\") : \"\";\n const right = b && b !== \"/\" ? b.replace(/^\\/+/, \"\") : \"\";\n if (!left) return right ? `/${right}` : \"/\";\n if (!right) return left;\n return `${left}/${right}`;\n}\n\nconst navOf = (options: RouteOptionsBundle): NavDeclaration | undefined => {\n const nav = options.staticData?.nav;\n if (nav && typeof nav === \"object\" && typeof (nav as NavDeclaration).label === \"string\") {\n return nav as NavDeclaration;\n }\n return undefined;\n};\n\n/** Layout routes (mount or pathless) pass their authored options through,\n * like every other route kind. On mount routes the registry gate composes\n * BEFORE the declaration's own beforeLoad so a source can never escape its\n * mount's gate (ADR 0008 §3), while the declaration's return value still\n * flows to children as route context. */\nfunction layoutBeforeLoad(\n gate: GateFn | undefined,\n declared: RouteOptionsBundle[\"beforeLoad\"],\n): RouteOptionsBundle[\"beforeLoad\"] {\n if (!gate) return declared;\n return (args) => {\n gate(args);\n return declared?.(args);\n };\n}\n\nconst AUTHORED_OPTION_KEYS = ROUTE_OPTION_KEYS.filter(\n (key) => key !== \"beforeLoad\" && key !== \"component\",\n);\n\nfunction authoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const authored: Partial<Record<keyof RouteOptionsBundle, unknown>> = {};\n for (const key of AUTHORED_OPTION_KEYS) {\n if (options[key] !== undefined) authored[key] = options[key];\n }\n return authored as Partial<RouteOptionsBundle>;\n}\n\nfunction rootAuthoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const { params: _params, ...authored } = authoredOptions(options);\n return authored;\n}\n\nexport async function constructTree(input: ConstructInput): Promise<ConstructedTree> {\n const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));\n const resolved: ResolvedPlugin[] = [];\n for (const ref of refs) {\n resolved.push(await input.resolve(ref));\n }\n\n const ordered = [\n ...resolved.filter((plugin) => plugin.key === CORE_UI_PLUGIN_KEY),\n ...resolved.filter((plugin) => plugin.key !== CORE_UI_PLUGIN_KEY),\n ];\n\n const optionsByPlugin = new Map<string, Map<string, RouteOptionsBundle>>();\n const skippedByPlugin = new Map<string, Set<string>>();\n for (const plugin of resolved) {\n // A plugin with no manifest at all contributes no routes — skip it rather\n // than crashing SSR composition (same contract as the missing-loader skip\n // below).\n if (!plugin.manifest?.routes) continue;\n const optionsById = new Map<string, RouteOptionsBundle>();\n const skipped = new Set<string>();\n await Promise.all(\n plugin.manifest.routes.map(async (record) => {\n const loader = plugin.routeConfig.routeConfigLoaders[record.id];\n if (!loader) {\n console.log(\n `[Compose] skipping route \"${record.id}\" in \"${plugin.key}\" — no routeConfig loader`,\n );\n skipped.add(record.id);\n return;\n }\n optionsById.set(record.id, await loader());\n }),\n );\n // cascade: any route whose parent is skipped is also skipped\n let changed = true;\n while (changed) {\n changed = false;\n for (const record of plugin.manifest.routes) {\n if (skipped.has(record.id)) continue;\n if (record.parentId && skipped.has(record.parentId)) {\n skipped.add(record.id);\n changed = true;\n }\n }\n }\n optionsByPlugin.set(plugin.key, optionsById);\n skippedByPlugin.set(plugin.key, skipped);\n }\n\n const declarations = new Map<MountId, MountDeclaration>();\n const mountByLayoutId = new Map<string, MountId>();\n for (const plugin of ordered) {\n if (!plugin.manifest?.routes) continue;\n for (const record of plugin.manifest.routes) {\n if (!record.mount) continue;\n const mountId = record.mount as MountId;\n const def = MOUNT_REGISTRY[mountId];\n if (!def.implemented) {\n throw new Error(\n `mount \"${record.mount}\" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by \"${plugin.key}\"`,\n );\n }\n const existing = declarations.get(mountId);\n if (existing) {\n if (existing.key === CORE_UI_PLUGIN_KEY && plugin.key !== CORE_UI_PLUGIN_KEY) {\n console.log(\n `[Compose] mount declaration \"${existing.key}:${existing.record.id}\" (${mountId}) shadows \"${plugin.key}:${record.id}\" — core ui wins; shadowed declaration skipped`,\n );\n mountByLayoutId.set(record.id, mountId);\n continue;\n }\n throw new Error(\n `mount \"${mountId}\" declared by multiple sources: \"${existing.key}\" (${existing.record.file}) and \"${plugin.key}\" (${record.file})`,\n );\n }\n if (skippedByPlugin.get(plugin.key)!.has(record.id)) continue;\n declarations.set(mountId, {\n key: plugin.key,\n record,\n options: optionsByPlugin.get(plugin.key)!.get(record.id)!,\n });\n mountByLayoutId.set(record.id, mountId);\n }\n }\n\n const rootRoute = toAnyRoute(\n createRootRoute({\n ...(input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {}),\n component: input.rootOptions?.component ?? Outlet,\n ...(input.rootOptions?.beforeLoad ? { beforeLoad: input.rootOptions.beforeLoad } : {}),\n }),\n );\n\n const mountRoutes = new Map<MountId, AnyRoute>();\n for (const mountId of Object.keys(MOUNT_REGISTRY) as MountId[]) {\n const declaration = declarations.get(mountId);\n if (!declaration) continue;\n const def = MOUNT_REGISTRY[mountId]!;\n const gate = GATES[def.gate];\n const options = declaration.options;\n const route = createRoute({\n id: `__mount_${mountId}`,\n getParentRoute: () => rootRoute,\n ...(gate || options.beforeLoad\n ? { beforeLoad: layoutBeforeLoad(gate, options.beforeLoad) }\n : {}),\n ...authoredOptions(options),\n component: options.component ?? Outlet,\n });\n mountRoutes.set(mountId, toAnyRoute(route));\n }\n\n const nav: NavItem[] = [];\n const mountCounts: Record<string, number> = {};\n const childrenByParent = new Map<AnyRoute, AnyRoute[]>();\n /** cross-plugin path-collision guard: claimed paths per parent route */\n const claimedPathsByParent = new Map<AnyRoute, Map<string, string>>();\n const attach = (parent: AnyRoute, child: AnyRoute) => {\n const list = childrenByParent.get(parent) ?? [];\n list.push(child);\n childrenByParent.set(parent, list);\n };\n\n for (const plugin of ordered) {\n if (!plugin.manifest?.routes) continue;\n const optionsById = optionsByPlugin.get(plugin.key)!;\n const fullPathById = new Map<string, string>();\n const mountById = new Map<string, MountId>();\n const byId = new Map<string, { record: RouteRecord; route: AnyRoute }>();\n\n const parentFor = (\n record: RouteRecord,\n ): { route: AnyRoute; fullPath: string; mount: MountId } => {\n if (record.parentId) {\n const local = byId.get(record.parentId);\n if (local) {\n return {\n route: local.route,\n fullPath: fullPathById.get(record.parentId)!,\n mount: mountById.get(record.parentId)!,\n };\n }\n const mount = mountByLayoutId.get(record.parentId);\n if (mount) return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n throw new Error(\n `unresolvable parent \"${record.parentId}\" for \"${record.id}\" in \"${plugin.key}\" — mounts are the only cross-source parenting points`,\n );\n }\n const firstSegment = record.id.split(\"/\")[0] ?? \"\";\n if (firstSegment.startsWith(\"_\")) {\n const mount = resolveMountSegment(firstSegment.slice(1));\n if (mount && mountRoutes.has(mount))\n return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n if (mount) {\n throw new Error(\n `mount \"${mount}\" is not declared by any source (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(\n `unknown mount \"_${firstSegment.slice(1)}\" (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(`route \"${record.id}\" in \"${plugin.key}\" must live under a mount`);\n };\n\n const pending = plugin.manifest.routes.filter(\n (record) => !record.mount && !skippedByPlugin.get(plugin.key)!.has(record.id),\n );\n const shadowedIds = new Set<string>();\n let progressed = true;\n while (pending.length > 0 && progressed) {\n progressed = false;\n for (let i = 0; i < pending.length; i += 1) {\n const record = pending[i]!;\n const parentId = record.parentId;\n if (parentId) {\n if (shadowedIds.has(parentId)) {\n shadowedIds.add(record.id);\n pending.splice(i, 1);\n i -= 1;\n progressed = true;\n continue;\n }\n if (!byId.has(parentId) && !mountByLayoutId.has(parentId)) continue;\n }\n pending.splice(i, 1);\n progressed = true;\n\n const options = optionsById.get(record.id)!;\n const parent = parentFor(record);\n const routePath = record.path;\n const isLayoutRoute = record.type === \"layout\" || routePath === undefined;\n if (!isLayoutRoute) {\n const siblings = claimedPathsByParent.get(parent.route) ?? new Map<string, string>();\n const claimant = siblings.get(routePath);\n if (claimant) {\n if (\n plugin.key !== CORE_UI_PLUGIN_KEY &&\n claimant.startsWith(`${CORE_UI_PLUGIN_KEY}:`)\n ) {\n console.log(\n `[Compose] route claim \"${claimant}\" (${routePath}) shadows \"${plugin.key}:${record.id}\" — core ui wins; shadowed route skipped`,\n );\n shadowedIds.add(record.id);\n break;\n }\n throw new Error(\n `path collision: \"${plugin.key}\" route \"${record.id}\" declares \"${routePath}\" which is already claimed by \"${claimant}\" under the same parent`,\n );\n }\n siblings.set(routePath, `${plugin.key}:${record.id}`);\n claimedPathsByParent.set(parent.route, siblings);\n }\n const fullPath = joinPath(parent.fullPath, routePath);\n let route: AnyRoute;\n if (isLayoutRoute) {\n route = createRoute({\n id: `${plugin.key}__${record.id}`,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n } else {\n route = createRoute({\n path: routePath,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n }\n\n byId.set(record.id, { record, route: toAnyRoute(route) });\n fullPathById.set(record.id, fullPath);\n mountById.set(record.id, parent.mount);\n attach(parent.route, toAnyRoute(route));\n mountCounts[parent.mount] = (mountCounts[parent.mount] ?? 0) + 1;\n\n const navDeclaration = navOf(options);\n if (navDeclaration && navDeclaration.hidden !== true) {\n nav.push({\n id: `${plugin.key}:${record.id}`,\n label: navDeclaration.label,\n ...(typeof navDeclaration.icon === \"string\" ? { icon: navDeclaration.icon } : {}),\n ...(typeof navDeclaration.group === \"string\" ? { group: navDeclaration.group } : {}),\n ...(typeof navDeclaration.order === \"number\" ? { order: navDeclaration.order } : {}),\n to: navDeclaration.to ?? fullPath,\n plugin: plugin.key,\n mount: parent.mount,\n });\n }\n break;\n }\n }\n if (pending.length > 0) {\n throw new Error(\n `unresolvable parentage in \"${plugin.key}\": ${pending.map((record) => record.id).join(\", \")}`,\n );\n }\n }\n\n for (const [parent, children] of childrenByParent) {\n (parent as { addChildren: (children: AnyRoute[]) => void }).addChildren(children);\n }\n rootRoute.addChildren([...mountRoutes.values()] as AnyRoute[]);\n nav.sort(compareNavItems);\n\n const digest = await digestOf({\n plugins: refs.map((ref) => ({ key: ref.key, mfName: ref.mfName })),\n manifests: resolved.map((plugin) => plugin.manifest),\n });\n\n return {\n rootRoute,\n routeTree: rootRoute,\n digest,\n manifests: resolved.map((plugin) => plugin.manifest),\n nav: { items: nav },\n mountCounts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,WAAW,OAA0B;CAC5C,OAAO;AACT;;;;;;AAwBA,MAAM,WAAmB;AACzB,MAAM,UAAkB;;;;;;;AAQxB,MAAM,QAAmD;CACvD,UAAU,EAAE,SAAS,eAAe;EAElC,IAAI,CADS,OAAO,OACZ,GACN,UAAMA,iCAAS;GACb,IAAI;GACJ,QAAQ,EAAE,UAAU,SAAS,WAAW,SAAS,UAAU;EAC7D,CAAC;CAEL;CACA,QAAQ,EAAE,cAAc;EACtB,MAAM,OAAO,OAAO,OAAO;EAC3B,IAAI,CAAC,MAAM,UAAMA,iCAAS,EAAE,IAAI,SAAS,CAAC;EAC1C,IAAI,KAAK,SAAS,SAAS,UAAMA,iCAAS,EAAE,IAAI,QAAQ,CAAC;CAC3D;AACF;AAEA,MAAM,UAAU,YACd,SAAS,QAAQ,SAAS,SAAS;AAuCrC,SAAS,SAAS,GAAuB,GAA+B;CACtE,MAAM,OAAO,KAAK,MAAM,MAAM,EAAE,QAAQ,QAAQ,EAAE,IAAI;CACtD,MAAM,QAAQ,KAAK,MAAM,MAAM,EAAE,QAAQ,QAAQ,EAAE,IAAI;CACvD,IAAI,CAAC,MAAM,OAAO,QAAQ,IAAI,UAAU;CACxC,IAAI,CAAC,OAAO,OAAO;CACnB,OAAO,GAAG,KAAK,GAAG;AACpB;AAEA,MAAM,SAAS,YAA4D;CACzE,MAAM,MAAM,QAAQ,YAAY;CAChC,IAAI,OAAO,OAAO,QAAQ,YAAY,OAAQ,IAAuB,UAAU,UAC7E,OAAO;AAGX;;;;;;AAOA,SAAS,iBACP,MACA,UACkC;CAClC,IAAI,CAAC,MAAM,OAAO;CAClB,QAAQ,SAAS;EACf,KAAK,IAAI;EAC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2BAAe;CAOxB,OAAO;EACL;EACA,WAAW;EACX,cARmBC,4BAAS;GAC5B,SAAS,KAAK,KAAK,SAAS;IAAE,KAAK,IAAI;IAAK,QAAQ,IAAI;GAAO,EAAE;GACjE,WAAW,SAAS,KAAK,WAAW,OAAO,QAAQ;EACrD,CAAC;EAMC,WAAW,SAAS,KAAK,WAAW,OAAO,QAAQ;EACnD,KAAK,EAAE,OAAO,IAAI;EAClB;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"construct.d.cts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAmCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}
1
+ {"version":3,"file":"construct.d.cts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAoCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"construct.d.mts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAmCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}
1
+ {"version":3,"file":"construct.d.mts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAoCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}