@wildo-ai/platform-config-lib 1.1.3 → 1.1.5

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 (113) hide show
  1. package/dist/esm/bootstrap/bootstrap.contracts.d.ts +23 -1
  2. package/dist/esm/bootstrap/bootstrap.contracts.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.contracts.js +24 -0
  4. package/dist/esm/bootstrap/bootstrap.contracts.js.map +1 -1
  5. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +150 -1
  6. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  7. package/dist/esm/bootstrap/bootstrap.schemas.js +124 -4
  8. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  9. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts +16 -0
  10. package/dist/esm/bootstrap/platform-runtime-env.contracts.d.ts.map +1 -1
  11. package/dist/esm/bootstrap/platform-runtime-env.contracts.js +28 -0
  12. package/dist/esm/bootstrap/platform-runtime-env.contracts.js.map +1 -1
  13. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts +29 -0
  14. package/dist/esm/bootstrap/wildo-owner-organization.contracts.d.ts.map +1 -1
  15. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js +39 -0
  16. package/dist/esm/bootstrap/wildo-owner-organization.contracts.js.map +1 -1
  17. package/dist/esm/index.d.ts +1 -0
  18. package/dist/esm/index.d.ts.map +1 -1
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/lockfile/build-parallelism.d.ts +40 -0
  22. package/dist/esm/lockfile/build-parallelism.d.ts.map +1 -0
  23. package/dist/esm/lockfile/build-parallelism.js +64 -0
  24. package/dist/esm/lockfile/build-parallelism.js.map +1 -0
  25. package/dist/esm/lockfile/materialize-infra-section.d.ts +1 -1
  26. package/dist/esm/lockfile/materialize-infra-section.js +1 -1
  27. package/dist/esm/lockfile/materialize-infra-section.js.map +1 -1
  28. package/dist/esm/project-config/define-infra-env-config.d.ts +899 -15
  29. package/dist/esm/project-config/define-infra-env-config.d.ts.map +1 -1
  30. package/dist/esm/project-config/define-infra-env-config.js +397 -16
  31. package/dist/esm/project-config/define-infra-env-config.js.map +1 -1
  32. package/dist/esm/project-config/define-minion-config.d.ts.map +1 -1
  33. package/dist/esm/project-config/define-minion-config.js +1 -2
  34. package/dist/esm/project-config/define-minion-config.js.map +1 -1
  35. package/dist/esm/project-config/define-saas-config.d.ts +90 -25
  36. package/dist/esm/project-config/define-saas-config.d.ts.map +1 -1
  37. package/dist/esm/project-config/define-saas-config.js +165 -12
  38. package/dist/esm/project-config/define-saas-config.js.map +1 -1
  39. package/dist/esm/project-config/hosted-infra-env-config.d.ts +59 -0
  40. package/dist/esm/project-config/hosted-infra-env-config.d.ts.map +1 -0
  41. package/dist/esm/project-config/hosted-infra-env-config.js +187 -0
  42. package/dist/esm/project-config/hosted-infra-env-config.js.map +1 -0
  43. package/dist/esm/project-config/index.d.ts +3 -0
  44. package/dist/esm/project-config/index.d.ts.map +1 -1
  45. package/dist/esm/project-config/index.js +3 -0
  46. package/dist/esm/project-config/index.js.map +1 -1
  47. package/dist/esm/project-config/loader.d.ts +24 -0
  48. package/dist/esm/project-config/loader.d.ts.map +1 -1
  49. package/dist/esm/project-config/loader.js +114 -1
  50. package/dist/esm/project-config/loader.js.map +1 -1
  51. package/dist/esm/project-config/provider-companion-discovery.d.ts +46 -0
  52. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  53. package/dist/esm/project-config/provider-companion-discovery.js +155 -13
  54. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  55. package/dist/esm/project-config/provider-runtime-artifacts.d.ts +72 -23
  56. package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
  57. package/dist/esm/project-config/provider-runtime-artifacts.js +190 -17
  58. package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
  59. package/dist/esm/project-config/shared/auth.schemas.d.ts +14 -35
  60. package/dist/esm/project-config/shared/auth.schemas.d.ts.map +1 -1
  61. package/dist/esm/project-config/shared/auth.schemas.js +14 -35
  62. package/dist/esm/project-config/shared/auth.schemas.js.map +1 -1
  63. package/dist/esm/project-config/shared/backing-services.schemas.d.ts +37 -7
  64. package/dist/esm/project-config/shared/backing-services.schemas.d.ts.map +1 -1
  65. package/dist/esm/project-config/shared/backing-services.schemas.js +37 -7
  66. package/dist/esm/project-config/shared/backing-services.schemas.js.map +1 -1
  67. package/dist/esm/project-config/shared/csp.schemas.d.ts +11 -12
  68. package/dist/esm/project-config/shared/csp.schemas.d.ts.map +1 -1
  69. package/dist/esm/project-config/shared/csp.schemas.js +11 -12
  70. package/dist/esm/project-config/shared/csp.schemas.js.map +1 -1
  71. package/dist/esm/project-config/shared/environment.schemas.d.ts +152 -12
  72. package/dist/esm/project-config/shared/environment.schemas.d.ts.map +1 -1
  73. package/dist/esm/project-config/shared/environment.schemas.js +186 -9
  74. package/dist/esm/project-config/shared/environment.schemas.js.map +1 -1
  75. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +13 -3
  76. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  77. package/dist/esm/project-config/shared/infra-providers.schemas.js +0 -3
  78. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  79. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts +140 -34
  80. package/dist/esm/project-config/shared/minion-resource-access.validation.d.ts.map +1 -1
  81. package/dist/esm/project-config/shared/minion-resource-access.validation.js +174 -37
  82. package/dist/esm/project-config/shared/minion-resource-access.validation.js.map +1 -1
  83. package/dist/esm/project-config/shared/platform-services.schemas.d.ts +50 -0
  84. package/dist/esm/project-config/shared/platform-services.schemas.d.ts.map +1 -1
  85. package/dist/esm/project-config/shared/platform-services.schemas.js +57 -0
  86. package/dist/esm/project-config/shared/platform-services.schemas.js.map +1 -1
  87. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts +35 -0
  88. package/dist/esm/project-config/shared/platform-storage.schemas.d.ts.map +1 -0
  89. package/dist/esm/project-config/shared/platform-storage.schemas.js +37 -0
  90. package/dist/esm/project-config/shared/platform-storage.schemas.js.map +1 -0
  91. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts +81 -0
  92. package/dist/esm/project-config/shared/systems-of-record-env.schemas.d.ts.map +1 -0
  93. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js +74 -0
  94. package/dist/esm/project-config/shared/systems-of-record-env.schemas.js.map +1 -0
  95. package/dist/esm/registry/artifact-domain.schemas.d.ts +1 -1
  96. package/dist/esm/registry/module-manifest.schemas.d.ts +10 -16
  97. package/dist/esm/registry/module-manifest.schemas.d.ts.map +1 -1
  98. package/dist/esm/registry/module-manifest.schemas.js +14 -20
  99. package/dist/esm/registry/module-manifest.schemas.js.map +1 -1
  100. package/dist/esm/schemas/framework-secrets.schemas.d.ts +12 -1
  101. package/dist/esm/schemas/framework-secrets.schemas.d.ts.map +1 -1
  102. package/dist/esm/schemas/framework-secrets.schemas.js +14 -1
  103. package/dist/esm/schemas/framework-secrets.schemas.js.map +1 -1
  104. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts +4 -3
  105. package/dist/esm/workspace-scope/workspace-homes.schemas.d.ts.map +1 -1
  106. package/dist/esm/workspace-scope/workspace-homes.schemas.js +6 -5
  107. package/dist/esm/workspace-scope/workspace-homes.schemas.js.map +1 -1
  108. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts +15 -6
  109. package/dist/esm/workspace-scope/workspace-scope.schemas.d.ts.map +1 -1
  110. package/dist/esm/workspace-scope/workspace-scope.schemas.js +23 -9
  111. package/dist/esm/workspace-scope/workspace-scope.schemas.js.map +1 -1
  112. package/dist/tsconfig.build.tsbuildinfo +1 -1
  113. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/project-config/loader.ts"],"names":[],"mappings":"A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S;YACnC,SAAS,EAAE,aAAa;SACzB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { createHash } from 'crypto';\nimport { existsSync, mkdirSync, readFileSync } from 'fs';\nimport { dirname, join, relative, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { createJiti } from 'jiti';\nimport { resolveFrameworkLayout } from '../workspace-scope/workspace-homes.schemas';\nimport type { WildoFrameworkConfig } from './define-framework-config';\nimport type { WildoSaasConfig } from './define-saas-config';\nimport type { WildoMinionConfig } from './define-minion-config';\nimport type { WildoWorkerConfig } from './define-worker-config';\nimport {\n ConfigArtifactsZone,\n FRAMEWORK_WORKSPACE_MARKER_FILE,\n resolveConfigArtifactsBaseDir,\n type ConfigArtifactsLocationOptions,\n} from '../workspace-scope/workspace-scope.schemas';\n\nexport interface LoadConfigOptions {\n /**\n * Optional explicit owner zone for generated loader artifacts.\n * Use this when the authored config file lives outside its semantic runtime\n * owner and should still emit loader artifacts under the canonical runtime\n * home instead of beside the source file.\n */\n artifactLocation?: ConfigArtifactsLocationOptions;\n /**\n * Module-resolution strategy for jiti while evaluating the config file.\n *\n * - `package`: resolve `@wildo-ai/*` through installed package exports in\n * `node_modules`. This is the correct mode for normal app developers who\n * do not have framework sources checked out.\n * - `framework-source`: resolve framework-owned packages to monorepo source\n * files when the Wildo framework workspace is available. Intended only for\n * internal framework development and source-first companion discovery.\n *\n * When omitted, the loader auto-detects the mode: configs inside a Wildo\n * framework workspace use `framework-source`; external app repos use\n * `package`.\n */\n moduleResolution?: 'package' | 'framework-source';\n /**\n * Package-owned module aliases the loaded source needs in order to resolve\n * its own internal specifiers.\n *\n * A package may address its own modules through a compiler path alias (for\n * example `~specifications/modules/...`). Those specifiers are meaningless to\n * Node, so evaluating that package's authored source fails unless the alias is\n * supplied here. The framework aliases this loader owns are always applied;\n * these are merged on top, so a package can extend its own resolution without\n * being able to redirect a framework specifier away from the framework.\n *\n * Keys are exact specifier prefixes and values absolute paths — NOT the\n * tsconfig `\"~x/*\": [\"./src/*\"]` glob form. Callers holding tsconfig-shaped\n * declarations must normalize them first.\n */\n packageModuleAliases?: Readonly<Record<string, string>>;\n /**\n * Re-evaluate the loaded module graph on EVERY call instead of serving jiti's\n * module cache.\n *\n * jiti's module cache is effectively PROCESS-GLOBAL (the transpiled modules\n * land in the shared CJS registry), so a fresh `createJiti` per call does NOT\n * give a fresh read: a long-lived process that loaded a file once keeps\n * seeing that evaluation after the file changes on disk. Measured live on the\n * dev companion (wonder-crm, 2026-08-27): a `companion-exports.ts` slot wired\n * while the companion ran stayed invisible until restart — the J-1 \"stall B\"\n * that forced a companion restart after every landed specification family.\n *\n * Off by default: one-shot CLI processes gain nothing from re-evaluation,\n * and module identity within a single load stays shared either way. Turn it\n * on at read sites whose CONTRACT is \"the working tree as it is right now\".\n */\n freshModuleCache?: boolean;\n}\n\nconst PACKAGE_COMPANION_SUBPATH = './companion';\n\n/**\n * Load and evaluate a TypeScript config file via jiti.\n * The file must `export default defineXxxConfig({...})`.\n * Zod validation runs inside the defineConfig helper at evaluation time,\n * so the returned object is guaranteed valid.\n *\n * @param filePath - Absolute path to the `.ts` config file\n * @returns The validated config object (the default export)\n * @throws If the file doesn't exist, has syntax errors, or Zod validation fails\n */\nexport async function loadConfig<T>(filePath: string, options?: LoadConfigOptions): Promise<T> {\n const absolutePath = resolve(filePath);\n if (!existsSync(absolutePath)) {\n throw new Error(`Config file not found: ${absolutePath}`);\n }\n const cacheBaseDir = options?.artifactLocation\n ? resolveConfigArtifactsBaseDir(options.artifactLocation)\n : resolveConfigArtifactsBaseDir(absolutePath);\n const cacheDir = join(cacheBaseDir, createHash('sha1').update(absolutePath).digest('hex'));\n mkdirSync(cacheDir, { recursive: true });\n\n const currentModuleDirectory = dirname(fileURLToPath(import.meta.url));\n const platformConfigLibEntry = resolvePlatformConfigLibEntry(currentModuleDirectory);\n const moduleResolution = options?.moduleResolution\n ?? inferConfigModuleResolution(absolutePath, currentModuleDirectory);\n const frameworkWorkspaceRoot = moduleResolution === 'framework-source'\n ? resolveLoaderWorkspaceRoot(currentModuleDirectory)\n : tryResolveLoaderWorkspaceRoot(currentModuleDirectory);\n\n const jiti = createJiti(import.meta.url, {\n fsCache: cacheDir,\n // `moduleCache: false` forces re-evaluation of the whole loaded graph — see\n // `LoadConfigOptions.freshModuleCache` for why a fresh createJiti alone is not enough.\n ...(options?.freshModuleCache === true ? { moduleCache: false } : {}),\n alias: {\n // Package-owned aliases first so framework-owned entries always win a\n // collision: a package may extend its own resolution, never redirect a\n // framework specifier away from the framework.\n ...(options?.packageModuleAliases ?? {}),\n ...buildLoaderAliases({\n frameworkWorkspaceRoot,\n moduleResolution,\n platformConfigLibEntry,\n }),\n },\n });\n\n const module = await jiti.import(absolutePath) as { default: T };\n if (!module.default) {\n throw new Error(`Config file must use \\`export default\\`: ${absolutePath}`);\n }\n return module.default;\n}\n\nexport function resolvePackageCompanionEntryPath(\n packageRoot: string,\n subpath: string = PACKAGE_COMPANION_SUBPATH,\n options?: Pick<LoadConfigOptions, 'moduleResolution'>,\n): string {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (!existsSync(packageJsonPath)) {\n throw new Error(`Missing package.json for companion target at \"${packageRoot}\".`);\n }\n\n const sourceSubpath = resolveSafePackageSourceSubpath(subpath);\n const sourceCandidates = subpath === PACKAGE_COMPANION_SUBPATH\n ? [\n join(packageRoot, 'src', 'companion-exports.ts'),\n join(packageRoot, 'src', 'companion-exports.tsx'),\n join(packageRoot, 'src', 'companion-exports.js'),\n join(packageRoot, 'src', 'companion-exports.mjs'),\n ]\n : sourceSubpath\n ? [\n join(packageRoot, 'src', `${sourceSubpath}.ts`),\n join(packageRoot, 'src', `${sourceSubpath}.tsx`),\n join(packageRoot, 'src', sourceSubpath, 'index.ts'),\n join(packageRoot, 'src', sourceSubpath, 'index.tsx'),\n ]\n : [];\n const preferredSourceCandidate = sourceCandidates.find((candidate) => existsSync(candidate));\n if (options?.moduleResolution === 'framework-source' && preferredSourceCandidate) {\n return preferredSourceCandidate;\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {\n exports?: Record<string, string | { import?: string; default?: string }>;\n };\n\n const subpathExport = packageJson.exports?.[subpath];\n if (typeof subpathExport === 'string') {\n const exportPath = resolve(packageRoot, subpathExport);\n if (existsSync(exportPath)) {\n return exportPath;\n }\n }\n\n if (subpathExport && typeof subpathExport === 'object') {\n const declaredEntryPath = subpathExport.import ?? subpathExport.default;\n if (typeof declaredEntryPath === 'string') {\n const exportPath = resolve(packageRoot, declaredEntryPath);\n if (existsSync(exportPath)) {\n return exportPath;\n }\n }\n }\n\n // NOTE: the authored-source fallback below is deliberate and load-bearing for\n // `loadPackageCompanionExport`, which resolves through jiti and can therefore\n // execute TypeScript. Do not make it throw here — consumers that cannot\n // execute TypeScript must reject a source entry at THEIR load boundary\n // instead (see the companion's `importCompanionModule`).\n if (preferredSourceCandidate) {\n return preferredSourceCandidate;\n }\n\n throw new Error(\n `Could not resolve companion entry for subpath \"${subpath}\" in package \"${packageRoot}\".`,\n );\n}\n\n/**\n * Translate an exported `./subpath` into a contained source candidate.\n *\n * This supports typed package-owned companion extensions such as\n * `./continuity` during framework-source development without inventing a\n * second application-specific resolver. Traversal and empty path segments are\n * rejected before any filesystem candidate is constructed.\n */\nfunction resolveSafePackageSourceSubpath(subpath: string): string | null {\n if (!subpath.startsWith('./')) {\n return null;\n }\n const sourceSubpath = subpath.slice(2);\n const segments = sourceSubpath.split('/');\n if (\n segments.length === 0\n || segments.some(\n (segment) =>\n segment.length === 0 || segment === '.' || segment === '..',\n )\n ) {\n return null;\n }\n return sourceSubpath;\n}\n\n/**\n * Normalize tsconfig-shaped compiler path aliases into the exact-prefix form\n * `LoadConfigOptions.packageModuleAliases` expects.\n *\n * tsconfig declares `{\"~x/*\": [\"./src/*\"]}`; jiti matches an alias key as a\n * specifier prefix. The trailing `/*` on both sides is therefore stripped and\n * the target resolved against the owning package root.\n *\n * Only the FIRST target of each alias is used: jiti resolves one path per\n * specifier, so a multi-target tsconfig fallback list cannot be honoured. That\n * is a deliberate narrowing rather than a silent partial behaviour — a package\n * relying on later fallback entries will fail to resolve loudly at import time\n * instead of resolving inconsistently between the compiler and the loader.\n */\nexport function normalizeCompilerPathAliasesForLoader(\n packageRoot: string,\n compilerPathAliases: Readonly<Record<string, readonly string[]>>,\n): Record<string, string> {\n const normalized: Record<string, string> = {};\n for (const [alias, targets] of Object.entries(compilerPathAliases)) {\n const firstTarget = targets[0];\n if (typeof firstTarget !== 'string') {\n continue;\n }\n const aliasPrefix = alias.endsWith('/*') ? alias.slice(0, -2) : alias;\n const targetPath = firstTarget.endsWith('/*') ? firstTarget.slice(0, -2) : firstTarget;\n // A prefix that is empty or still contains a wildcard would match far more\n // than the package declared — a bare `*` would capture EVERY specifier and\n // silently redirect unrelated imports. Prefix matching cannot express those\n // patterns, so drop them rather than approximate them.\n if (aliasPrefix.length === 0 || aliasPrefix.includes('*')) {\n continue;\n }\n normalized[aliasPrefix] = resolve(packageRoot, targetPath);\n }\n return normalized;\n}\n\nexport async function loadPackageCompanionExport<T>(\n packageRoot: string,\n subpath: string = PACKAGE_COMPANION_SUBPATH,\n options?: LoadConfigOptions,\n): Promise<T> {\n const moduleResolution = options?.moduleResolution\n ?? inferPackageCompanionModuleResolution(packageRoot);\n const entryPath = resolvePackageCompanionEntryPath(packageRoot, subpath, {\n moduleResolution,\n });\n return loadConfig<T>(entryPath, {\n ...options,\n moduleResolution,\n });\n}\n\nfunction resolvePlatformConfigLibEntry(startDirectory: string): string {\n const packageRoot = resolveCurrentPackageRoot(startDirectory);\n const configAuthoringEntry = join(packageRoot, 'src', 'config-authoring.entry.ts');\n if (existsSync(configAuthoringEntry)) {\n return configAuthoringEntry;\n }\n const sourceEntry = join(packageRoot, 'src', 'index.ts');\n if (existsSync(sourceEntry)) {\n return sourceEntry;\n }\n\n return join(packageRoot, 'dist', 'esm', 'index.js');\n}\n\nfunction resolveCurrentPackageRoot(startDirectory: string): string {\n let currentDirectory = startDirectory;\n\n while (true) {\n if (existsSync(join(currentDirectory, 'package.json'))) {\n return currentDirectory;\n }\n\n const parentDirectory = dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n break;\n }\n currentDirectory = parentDirectory;\n }\n\n return startDirectory;\n}\n\nfunction tryResolveLoaderWorkspaceRoot(startDirectory: string): string | undefined {\n let currentDirectory = startDirectory;\n\n while (true) {\n if (existsSync(join(currentDirectory, FRAMEWORK_WORKSPACE_MARKER_FILE))) {\n return currentDirectory;\n }\n\n const parentDirectory = dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n break;\n }\n currentDirectory = parentDirectory;\n }\n\n return undefined;\n}\n\n/**\n * Resolve the framework workspace root when framework-source module\n * resolution is explicitly requested.\n */\nfunction resolveLoaderWorkspaceRoot(startDirectory: string): string {\n const workspaceRoot = tryResolveLoaderWorkspaceRoot(startDirectory);\n if (workspaceRoot) {\n return workspaceRoot;\n }\n\n throw new Error(\n 'Could not locate the Wildo framework workspace root from the config loader.\\n'\n + ` Expected marker: \"${FRAMEWORK_WORKSPACE_MARKER_FILE}\"\\n`\n + ` Walked up from: \"${startDirectory}\"\\n\\n`\n + ` Fix: commit \"${FRAMEWORK_WORKSPACE_MARKER_FILE}\" at the root of the framework checkout `\n + 'that owns \"@wildo-ai/platform-config-lib\". The file is the authoritative signal '\n + 'used to anchor the loader\\'s \"~wildo-*\" jiti aliases — generic markers like '\n + '\"pnpm-workspace.yaml\" are intentionally NOT accepted because they can match an '\n + 'unrelated workspace and silently misroot alias targets.',\n );\n}\n\nfunction buildLoaderAliases(input: {\n frameworkWorkspaceRoot?: string;\n moduleResolution: NonNullable<LoadConfigOptions['moduleResolution']>;\n platformConfigLibEntry: string;\n}): Record<string, string> {\n const platformConfigLibPackageRoot = resolveCurrentPackageRoot(dirname(input.platformConfigLibEntry));\n const aliases = buildDeclaredPackageSourceAliases(\n platformConfigLibPackageRoot,\n '.',\n input.platformConfigLibEntry,\n );\n if (input.moduleResolution !== 'framework-source' || !input.frameworkWorkspaceRoot) {\n return aliases;\n }\n\n const workspaceRoot = input.frameworkWorkspaceRoot;\n return {\n ...aliases,\n '@wildo-ai/external-connectors-public/app': resolve(\n workspaceRoot,\n 'engine/external-connectors-public/src/app/index.ts',\n ),\n '@wildo-ai/external-connectors-public/techdoc': resolve(\n workspaceRoot,\n 'engine/external-connectors-public/src/techdoc/index.ts',\n ),\n '@wildo-ai/external-connectors-public/website': resolve(\n workspaceRoot,\n 'engine/external-connectors-public/src/website/index.ts',\n ),\n ...buildDeclaredPackageSourceAliases(workspaceRoot, 'engine/external-connectors-models'),\n ...buildDeclaredPackageSourceAliases(workspaceRoot, 'engine/saas-backend-lib'),\n '@wildo-ai/platform-core-shared': resolve(\n workspaceRoot,\n 'platform/platform-core/platform-core-shared/src/index.ts',\n ),\n '@wildo-ai/platform-core-backend': resolve(\n workspaceRoot,\n 'platform/platform-core/platform-core-backend/src/index.ts',\n ),\n '@wildo-ai/platform-shared-lib': resolve(\n workspaceRoot,\n 'platform/platform-back-office/platform-shared-lib/src/index.ts',\n ),\n '@wildo-ai/zod-decorators': resolve(\n workspaceRoot,\n 'engine/zod-decorators/src/index.ts',\n ),\n ...buildDeclaredPackageSourceAliases(workspaceRoot, 'engine/saas-models'),\n ...buildDeclaredPackageSourceAliases(\n workspaceRoot,\n 'engine/saas-technical-doc',\n 'engine/saas-technical-doc/src/index.ts',\n ),\n ...buildDeclaredPackageSourceAliases(\n workspaceRoot,\n 'engine/saas-website',\n 'engine/saas-website/src/config/index.ts',\n ),\n '~wildo-backend-lib': resolve(workspaceRoot, 'engine/saas-backend-lib/src'),\n '~wildo-connectors': resolve(workspaceRoot, 'engine/external-connectors/src'),\n '~wildo-connectors-models': resolve(workspaceRoot, 'engine/external-connectors-models/src'),\n '~wildo-models': resolve(workspaceRoot, 'engine/saas-models/src'),\n '~wildo-zod': resolve(workspaceRoot, 'engine/zod-decorators/src'),\n };\n}\n\n/**\n * Build source-first aliases from one framework package's declared public\n * exports.\n *\n * jiti treats alias keys as prefixes rather than Node-style exact package\n * identities. Hand-authoring only the package root therefore corrupts every\n * semantic entrypoint: `@scope/package/subpath` becomes\n * `<package>/src/index.ts/subpath`. Deriving the aliases from `exports.*.source`\n * keeps the loader aligned with the package's public contract, and sorting by\n * specificity guarantees a subpath wins before its root prefix.\n *\n * `rootSourceOverride` preserves the deliberately narrower source root used by\n * packages whose normal root is unsuitable for config evaluation. Subpaths\n * still come from their declared `source` conditions.\n */\nfunction buildDeclaredPackageSourceAliases(\n workspaceRoot: string,\n packageRelativeRoot: string,\n rootSourceOverride?: string,\n): Record<string, string> {\n const packageRoot = resolve(workspaceRoot, packageRelativeRoot);\n const packageJsonPath = join(packageRoot, 'package.json');\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n name?: string;\n exports?: Record<string, string | { source?: string }>;\n };\n if (!packageJson.name) {\n throw new Error(`Framework package at \"${packageRoot}\" has no package name.`);\n }\n\n const entries: Array<readonly [string, string]> = [];\n for (const [exportKey, exportValue] of Object.entries(packageJson.exports ?? {})) {\n const declaredSource = exportValue !== null && typeof exportValue === 'object'\n ? exportValue.source\n : undefined;\n const sourcePath = exportKey === '.' && rootSourceOverride\n ? resolve(workspaceRoot, rootSourceOverride)\n : declaredSource?.startsWith('./')\n ? resolve(packageRoot, declaredSource)\n : undefined;\n if (!sourcePath) {\n continue;\n }\n if (!isPathInsideRoot(sourcePath, packageRoot)) {\n throw new Error(`Framework package source export \"${exportKey}\" escapes \"${packageRoot}\".`);\n }\n\n const specifier = exportKey === '.'\n ? packageJson.name\n : `${packageJson.name}/${exportKey.slice(2)}`;\n entries.push([specifier, sourcePath]);\n }\n\n if (rootSourceOverride && !entries.some(([specifier]) => specifier === packageJson.name)) {\n const sourcePath = resolve(workspaceRoot, rootSourceOverride);\n if (!isPathInsideRoot(sourcePath, packageRoot)) {\n throw new Error(`Framework package root override escapes \"${packageRoot}\".`);\n }\n entries.push([packageJson.name, sourcePath]);\n }\n\n entries.sort(([left], [right]) => right.length - left.length || left.localeCompare(right));\n return Object.fromEntries(entries);\n}\n\nfunction inferPackageCompanionModuleResolution(\n packageRoot: string,\n): NonNullable<LoadConfigOptions['moduleResolution']> {\n return inferConfigModuleResolution(packageRoot, dirname(fileURLToPath(import.meta.url)));\n}\n\nfunction inferConfigModuleResolution(\n targetPath: string,\n loaderModuleDirectory: string,\n): NonNullable<LoadConfigOptions['moduleResolution']> {\n const frameworkWorkspaceRoot = tryResolveLoaderWorkspaceRoot(loaderModuleDirectory);\n if (!frameworkWorkspaceRoot) {\n return 'package';\n }\n return isPathInsideRoot(targetPath, frameworkWorkspaceRoot)\n ? 'framework-source'\n : 'package';\n}\n\nfunction isPathInsideRoot(pathToCheck: string, root: string): boolean {\n const relativePath = relative(resolve(root), resolve(pathToCheck));\n return relativePath === ''\n || (!relativePath.startsWith('..') && !relativePath.startsWith(`..${requirePathSeparator()}`));\n}\n\nfunction requirePathSeparator(): string {\n return process.platform === 'win32' ? '\\\\' : '/';\n}\n\n/**\n * Load a `wildo.saas.config.ts` file.\n * Returns `null` if the file doesn't exist (non-throwing variant for optional loading).\n */\nexport async function loadSaasConfig(filePath: string, options?: LoadConfigOptions): Promise<WildoSaasConfig | null> {\n const absolutePath = resolve(filePath);\n if (!existsSync(absolutePath)) return null;\n return loadConfig<WildoSaasConfig>(absolutePath, options);\n}\n\n/**\n * Per-folder file name for a minion config (`wildo.minion.config.ts`).\n *\n * Co-located inside the minion's directory referenced by\n * `wildo.saas.config.ts > minions.<key>.path` — the loader resolves\n * `<saasRoot>/<entry.path>/wildo.minion.config.ts` exactly the same\n * way the existing tech-doc / website per-service loaders resolve\n * their authoring files.\n */\nexport const MINION_CONFIG_FILENAME = 'wildo.minion.config.ts';\n\n/**\n * Per-folder file name for a worker config (`wildo.worker.config.ts`).\n */\nexport const WORKER_CONFIG_FILENAME = 'wildo.worker.config.ts';\n\n/**\n * Result entry for `loadMinionConfigs` / `loadWorkerConfigs`.\n *\n * Carries the bucket key (the name authored under\n * `wildo.saas.config.ts > minions / workers`), the absolute path the\n * config was resolved from, and the parsed value. Returning the\n * absolute path alongside the parsed config lets callers (Phase 2 /\n * Phase 3 manifest emitters) build deterministic error messages\n * without re-deriving the path themselves.\n */\nexport interface PerFolderConfigEntry<T> {\n /** Bucket key from `wildo.saas.config.ts > minions / workers`. */\n key: string;\n /** Absolute path the config was loaded from. */\n absolutePath: string;\n /** Parsed config (Zod-validated). */\n config: T;\n}\n\n/**\n * Load every `wildo.minion.config.ts` referenced by `saasConfig.minions`.\n *\n * Phase 1 contract: this returns a typed list of entries; Phase 2's\n * `start-minion-application` consumes it to build the per-minion DI\n * container and to cross-validate `resourceAccess` against the parsed\n * resource catalog (IC-2). Missing files throw with the offending\n * bucket key in the error message — silently skipping would mask a\n * mistyped `path:` field.\n */\nexport async function loadMinionConfigs(\n saasRoot: string,\n saasConfig: WildoSaasConfig,\n options?: LoadConfigOptions,\n): Promise<PerFolderConfigEntry<WildoMinionConfig>[]> {\n return loadPerFolderConfigs<WildoMinionConfig>(\n saasRoot,\n saasConfig.minions ?? {},\n MINION_CONFIG_FILENAME,\n 'minion',\n options,\n );\n}\n\n/**\n * Load every `wildo.worker.config.ts` referenced by `saasConfig.workers`.\n *\n * Phase 1 contract identical to `loadMinionConfigs` — Phase 3's K8s\n * manifest emitter consumes it to project `replicas`, `http.port`,\n * health/ready paths into Deployment + Service manifests.\n */\nexport async function loadWorkerConfigs(\n saasRoot: string,\n saasConfig: WildoSaasConfig,\n options?: LoadConfigOptions,\n): Promise<PerFolderConfigEntry<WildoWorkerConfig>[]> {\n return loadPerFolderConfigs<WildoWorkerConfig>(\n saasRoot,\n saasConfig.workers ?? {},\n WORKER_CONFIG_FILENAME,\n 'worker',\n options,\n );\n}\n\nasync function loadPerFolderConfigs<T>(\n saasRoot: string,\n bucket: Record<string, { path: string }>,\n filename: string,\n kindLabel: 'minion' | 'worker',\n options?: LoadConfigOptions,\n): Promise<PerFolderConfigEntry<T>[]> {\n const absoluteSaasRoot = resolve(saasRoot);\n const entries = Object.entries(bucket);\n\n const out: PerFolderConfigEntry<T>[] = [];\n for (const [key, ref] of entries) {\n const absolutePath = resolve(absoluteSaasRoot, ref.path, filename);\n if (!existsSync(absolutePath)) {\n throw new Error(\n `Could not find ${kindLabel} config for '${key}': ${absolutePath} does not exist.\\n`\n + ` Authored at: wildo.saas.config.ts > ${kindLabel}s.${key}.path = '${ref.path}'\\n`\n + ` Expected file: ${filename}\\n`\n + ` Either create the file or remove the bucket entry.`,\n );\n }\n const config = await loadConfig<T>(absolutePath, options);\n out.push({ key, absolutePath, config });\n }\n return out;\n}\n\n/**\n * Load the framework-scoped `wildo.framework.config.ts` file.\n * Returns `null` if the file does not exist.\n */\nexport async function loadFrameworkConfig(\n frameworkRoot: string,\n options?: Omit<LoadConfigOptions, 'artifactLocation'>,\n): Promise<WildoFrameworkConfig | null> {\n const filePath = resolveFrameworkLayout(frameworkRoot).declarationConfigPath;\n const absolutePath = resolve(filePath);\n if (!existsSync(absolutePath)) return null;\n\n return loadConfig<WildoFrameworkConfig>(absolutePath, {\n ...options,\n artifactLocation: {\n zone: ConfigArtifactsZone.FRAMEWORK,\n ownerRoot: frameworkRoot,\n },\n });\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../../src/project-config/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAGtG,OAAO,EACL,sBAAsB,EACtB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,IAAI,KAAK,CACb,kBAAkB,SAAS,gBAAgB,GAAG,MAAM,YAAY,oBAAoB;kBAClF,yCAAyC,SAAS,KAAK,GAAG,YAAY,GAAG,CAAC,IAAI,KAAK;kBACnF,oBAAoB,QAAQ,IAAI;kBAChC,sDAAsD,CACzD,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAI,YAAY,EAAE,OAAO,CAAC,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,aAAqB,EACrB,OAAqD;IAErD,MAAM,QAAQ,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC,qBAAqB,CAAC;IAC7E,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAE3C,OAAO,UAAU,CAAuB,YAAY,EAAE;QACpD,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,IAAI,EAAE,mBAAmB,CAAC,SAAS;YACnC,SAAS,EAAE,aAAa;SACzB;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { createHash } from 'crypto';\nimport { existsSync, mkdirSync, readFileSync } from 'fs';\nimport { dirname, join, relative, resolve } from 'path';\nimport { fileURLToPath } from 'url';\nimport { createJiti } from 'jiti';\nimport { resolveAppLayout, resolveFrameworkLayout } from '../workspace-scope/workspace-homes.schemas';\nimport type { WildoFrameworkConfig } from './define-framework-config';\nimport type { WildoSaasConfig } from './define-saas-config';\nimport {\n isHostedInfraEnvConfig,\n WildoHostedInfraEnvConfigSchema,\n type WildoAuthoredInfraEnvConfig,\n type WildoInfraEnvConfig,\n} from './define-infra-env-config';\nimport { realpathSync } from 'fs';\nimport { resolveHostedInfraEnvConfig } from './hosted-infra-env-config';\nimport { AUTHORED_CONFIG_FILE_NAMES } from '../workspace-scope/workspace-scope.schemas';\nimport type { WildoMinionConfig } from './define-minion-config';\nimport type { WildoWorkerConfig } from './define-worker-config';\nimport {\n ConfigArtifactsZone,\n FRAMEWORK_WORKSPACE_MARKER_FILE,\n resolveConfigArtifactsBaseDir,\n type ConfigArtifactsLocationOptions,\n} from '../workspace-scope/workspace-scope.schemas';\n\nexport interface LoadConfigOptions {\n /**\n * Optional explicit owner zone for generated loader artifacts.\n * Use this when the authored config file lives outside its semantic runtime\n * owner and should still emit loader artifacts under the canonical runtime\n * home instead of beside the source file.\n */\n artifactLocation?: ConfigArtifactsLocationOptions;\n /**\n * Module-resolution strategy for jiti while evaluating the config file.\n *\n * - `package`: resolve `@wildo-ai/*` through installed package exports in\n * `node_modules`. This is the correct mode for normal app developers who\n * do not have framework sources checked out.\n * - `framework-source`: resolve framework-owned packages to monorepo source\n * files when the Wildo framework workspace is available. Intended only for\n * internal framework development and source-first companion discovery.\n *\n * When omitted, the loader auto-detects the mode: configs inside a Wildo\n * framework workspace use `framework-source`; external app repos use\n * `package`.\n */\n moduleResolution?: 'package' | 'framework-source';\n /**\n * Package-owned module aliases the loaded source needs in order to resolve\n * its own internal specifiers.\n *\n * A package may address its own modules through a compiler path alias (for\n * example `~specifications/modules/...`). Those specifiers are meaningless to\n * Node, so evaluating that package's authored source fails unless the alias is\n * supplied here. The framework aliases this loader owns are always applied;\n * these are merged on top, so a package can extend its own resolution without\n * being able to redirect a framework specifier away from the framework.\n *\n * Keys are exact specifier prefixes and values absolute paths — NOT the\n * tsconfig `\"~x/*\": [\"./src/*\"]` glob form. Callers holding tsconfig-shaped\n * declarations must normalize them first.\n */\n packageModuleAliases?: Readonly<Record<string, string>>;\n /**\n * Re-evaluate the loaded module graph on EVERY call instead of serving jiti's\n * module cache.\n *\n * jiti's module cache is effectively PROCESS-GLOBAL (the transpiled modules\n * land in the shared CJS registry), so a fresh `createJiti` per call does NOT\n * give a fresh read: a long-lived process that loaded a file once keeps\n * seeing that evaluation after the file changes on disk. Measured live on the\n * dev companion (wonder-crm, 2026-08-27): a `companion-exports.ts` slot wired\n * while the companion ran stayed invisible until restart — the J-1 \"stall B\"\n * that forced a companion restart after every landed specification family.\n *\n * Off by default: one-shot CLI processes gain nothing from re-evaluation,\n * and module identity within a single load stays shared either way. Turn it\n * on at read sites whose CONTRACT is \"the working tree as it is right now\".\n */\n freshModuleCache?: boolean;\n}\n\nconst PACKAGE_COMPANION_SUBPATH = './companion';\n\n/**\n * Load and evaluate a TypeScript config file via jiti.\n * The file must `export default defineXxxConfig({...})`.\n * Zod validation runs inside the defineConfig helper at evaluation time,\n * so the returned object is guaranteed valid.\n *\n * @param filePath - Absolute path to the `.ts` config file\n * @returns The validated config object (the default export)\n * @throws If the file doesn't exist, has syntax errors, or Zod validation fails\n */\nexport async function loadConfig<T>(filePath: string, options?: LoadConfigOptions): Promise<T> {\n const absolutePath = resolve(filePath);\n if (!existsSync(absolutePath)) {\n throw new Error(`Config file not found: ${absolutePath}`);\n }\n const cacheBaseDir = options?.artifactLocation\n ? resolveConfigArtifactsBaseDir(options.artifactLocation)\n : resolveConfigArtifactsBaseDir(absolutePath);\n const cacheDir = join(cacheBaseDir, createHash('sha1').update(absolutePath).digest('hex'));\n mkdirSync(cacheDir, { recursive: true });\n\n const currentModuleDirectory = dirname(fileURLToPath(import.meta.url));\n const platformConfigLibEntry = resolvePlatformConfigLibEntry(currentModuleDirectory);\n const moduleResolution = options?.moduleResolution\n ?? inferConfigModuleResolution(absolutePath, currentModuleDirectory);\n const frameworkWorkspaceRoot = moduleResolution === 'framework-source'\n ? resolveLoaderWorkspaceRoot(currentModuleDirectory)\n : tryResolveLoaderWorkspaceRoot(currentModuleDirectory);\n\n const jiti = createJiti(import.meta.url, {\n fsCache: cacheDir,\n // `moduleCache: false` forces re-evaluation of the whole loaded graph — see\n // `LoadConfigOptions.freshModuleCache` for why a fresh createJiti alone is not enough.\n ...(options?.freshModuleCache === true ? { moduleCache: false } : {}),\n alias: {\n // Package-owned aliases first so framework-owned entries always win a\n // collision: a package may extend its own resolution, never redirect a\n // framework specifier away from the framework.\n ...(options?.packageModuleAliases ?? {}),\n ...buildLoaderAliases({\n frameworkWorkspaceRoot,\n moduleResolution,\n platformConfigLibEntry,\n }),\n },\n });\n\n const module = await jiti.import(absolutePath) as { default: T };\n if (!module.default) {\n throw new Error(`Config file must use \\`export default\\`: ${absolutePath}`);\n }\n return module.default;\n}\n\nexport function resolvePackageCompanionEntryPath(\n packageRoot: string,\n subpath: string = PACKAGE_COMPANION_SUBPATH,\n options?: Pick<LoadConfigOptions, 'moduleResolution'>,\n): string {\n const packageJsonPath = join(packageRoot, 'package.json');\n if (!existsSync(packageJsonPath)) {\n throw new Error(`Missing package.json for companion target at \"${packageRoot}\".`);\n }\n\n const sourceSubpath = resolveSafePackageSourceSubpath(subpath);\n const sourceCandidates = subpath === PACKAGE_COMPANION_SUBPATH\n ? [\n join(packageRoot, 'src', 'companion-exports.ts'),\n join(packageRoot, 'src', 'companion-exports.tsx'),\n join(packageRoot, 'src', 'companion-exports.js'),\n join(packageRoot, 'src', 'companion-exports.mjs'),\n ]\n : sourceSubpath\n ? [\n join(packageRoot, 'src', `${sourceSubpath}.ts`),\n join(packageRoot, 'src', `${sourceSubpath}.tsx`),\n join(packageRoot, 'src', sourceSubpath, 'index.ts'),\n join(packageRoot, 'src', sourceSubpath, 'index.tsx'),\n ]\n : [];\n const preferredSourceCandidate = sourceCandidates.find((candidate) => existsSync(candidate));\n if (options?.moduleResolution === 'framework-source' && preferredSourceCandidate) {\n return preferredSourceCandidate;\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')) as {\n exports?: Record<string, string | { import?: string; default?: string }>;\n };\n\n const subpathExport = packageJson.exports?.[subpath];\n if (typeof subpathExport === 'string') {\n const exportPath = resolve(packageRoot, subpathExport);\n if (existsSync(exportPath)) {\n return exportPath;\n }\n }\n\n if (subpathExport && typeof subpathExport === 'object') {\n const declaredEntryPath = subpathExport.import ?? subpathExport.default;\n if (typeof declaredEntryPath === 'string') {\n const exportPath = resolve(packageRoot, declaredEntryPath);\n if (existsSync(exportPath)) {\n return exportPath;\n }\n }\n }\n\n // NOTE: the authored-source fallback below is deliberate and load-bearing for\n // `loadPackageCompanionExport`, which resolves through jiti and can therefore\n // execute TypeScript. Do not make it throw here — consumers that cannot\n // execute TypeScript must reject a source entry at THEIR load boundary\n // instead (see the companion's `importCompanionModule`).\n if (preferredSourceCandidate) {\n return preferredSourceCandidate;\n }\n\n throw new Error(\n `Could not resolve companion entry for subpath \"${subpath}\" in package \"${packageRoot}\".`,\n );\n}\n\n/**\n * Translate an exported `./subpath` into a contained source candidate.\n *\n * This supports typed package-owned companion extensions such as\n * `./continuity` during framework-source development without inventing a\n * second application-specific resolver. Traversal and empty path segments are\n * rejected before any filesystem candidate is constructed.\n */\nfunction resolveSafePackageSourceSubpath(subpath: string): string | null {\n if (!subpath.startsWith('./')) {\n return null;\n }\n const sourceSubpath = subpath.slice(2);\n const segments = sourceSubpath.split('/');\n if (\n segments.length === 0\n || segments.some(\n (segment) =>\n segment.length === 0 || segment === '.' || segment === '..',\n )\n ) {\n return null;\n }\n return sourceSubpath;\n}\n\n/**\n * Normalize tsconfig-shaped compiler path aliases into the exact-prefix form\n * `LoadConfigOptions.packageModuleAliases` expects.\n *\n * tsconfig declares `{\"~x/*\": [\"./src/*\"]}`; jiti matches an alias key as a\n * specifier prefix. The trailing `/*` on both sides is therefore stripped and\n * the target resolved against the owning package root.\n *\n * Only the FIRST target of each alias is used: jiti resolves one path per\n * specifier, so a multi-target tsconfig fallback list cannot be honoured. That\n * is a deliberate narrowing rather than a silent partial behaviour — a package\n * relying on later fallback entries will fail to resolve loudly at import time\n * instead of resolving inconsistently between the compiler and the loader.\n */\nexport function normalizeCompilerPathAliasesForLoader(\n packageRoot: string,\n compilerPathAliases: Readonly<Record<string, readonly string[]>>,\n): Record<string, string> {\n const normalized: Record<string, string> = {};\n for (const [alias, targets] of Object.entries(compilerPathAliases)) {\n const firstTarget = targets[0];\n if (typeof firstTarget !== 'string') {\n continue;\n }\n const aliasPrefix = alias.endsWith('/*') ? alias.slice(0, -2) : alias;\n const targetPath = firstTarget.endsWith('/*') ? firstTarget.slice(0, -2) : firstTarget;\n // A prefix that is empty or still contains a wildcard would match far more\n // than the package declared — a bare `*` would capture EVERY specifier and\n // silently redirect unrelated imports. Prefix matching cannot express those\n // patterns, so drop them rather than approximate them.\n if (aliasPrefix.length === 0 || aliasPrefix.includes('*')) {\n continue;\n }\n normalized[aliasPrefix] = resolve(packageRoot, targetPath);\n }\n return normalized;\n}\n\nexport async function loadPackageCompanionExport<T>(\n packageRoot: string,\n subpath: string = PACKAGE_COMPANION_SUBPATH,\n options?: LoadConfigOptions,\n): Promise<T> {\n const moduleResolution = options?.moduleResolution\n ?? inferPackageCompanionModuleResolution(packageRoot);\n const entryPath = resolvePackageCompanionEntryPath(packageRoot, subpath, {\n moduleResolution,\n });\n return loadConfig<T>(entryPath, {\n ...options,\n moduleResolution,\n });\n}\n\nfunction resolvePlatformConfigLibEntry(startDirectory: string): string {\n const packageRoot = resolveCurrentPackageRoot(startDirectory);\n const configAuthoringEntry = join(packageRoot, 'src', 'config-authoring.entry.ts');\n if (existsSync(configAuthoringEntry)) {\n return configAuthoringEntry;\n }\n const sourceEntry = join(packageRoot, 'src', 'index.ts');\n if (existsSync(sourceEntry)) {\n return sourceEntry;\n }\n\n return join(packageRoot, 'dist', 'esm', 'index.js');\n}\n\nfunction resolveCurrentPackageRoot(startDirectory: string): string {\n let currentDirectory = startDirectory;\n\n while (true) {\n if (existsSync(join(currentDirectory, 'package.json'))) {\n return currentDirectory;\n }\n\n const parentDirectory = dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n break;\n }\n currentDirectory = parentDirectory;\n }\n\n return startDirectory;\n}\n\nfunction tryResolveLoaderWorkspaceRoot(startDirectory: string): string | undefined {\n let currentDirectory = startDirectory;\n\n while (true) {\n if (existsSync(join(currentDirectory, FRAMEWORK_WORKSPACE_MARKER_FILE))) {\n return currentDirectory;\n }\n\n const parentDirectory = dirname(currentDirectory);\n if (parentDirectory === currentDirectory) {\n break;\n }\n currentDirectory = parentDirectory;\n }\n\n return undefined;\n}\n\n/**\n * Resolve the framework workspace root when framework-source module\n * resolution is explicitly requested.\n */\nfunction resolveLoaderWorkspaceRoot(startDirectory: string): string {\n const workspaceRoot = tryResolveLoaderWorkspaceRoot(startDirectory);\n if (workspaceRoot) {\n return workspaceRoot;\n }\n\n throw new Error(\n 'Could not locate the Wildo framework workspace root from the config loader.\\n'\n + ` Expected marker: \"${FRAMEWORK_WORKSPACE_MARKER_FILE}\"\\n`\n + ` Walked up from: \"${startDirectory}\"\\n\\n`\n + ` Fix: commit \"${FRAMEWORK_WORKSPACE_MARKER_FILE}\" at the root of the framework checkout `\n + 'that owns \"@wildo-ai/platform-config-lib\". The file is the authoritative signal '\n + 'used to anchor the loader\\'s \"~wildo-*\" jiti aliases — generic markers like '\n + '\"pnpm-workspace.yaml\" are intentionally NOT accepted because they can match an '\n + 'unrelated workspace and silently misroot alias targets.',\n );\n}\n\nfunction buildLoaderAliases(input: {\n frameworkWorkspaceRoot?: string;\n moduleResolution: NonNullable<LoadConfigOptions['moduleResolution']>;\n platformConfigLibEntry: string;\n}): Record<string, string> {\n const platformConfigLibPackageRoot = resolveCurrentPackageRoot(dirname(input.platformConfigLibEntry));\n const aliases = buildDeclaredPackageSourceAliases(\n platformConfigLibPackageRoot,\n '.',\n input.platformConfigLibEntry,\n );\n if (input.moduleResolution !== 'framework-source' || !input.frameworkWorkspaceRoot) {\n return aliases;\n }\n\n const workspaceRoot = input.frameworkWorkspaceRoot;\n return {\n ...aliases,\n '@wildo-ai/external-connectors-public/app': resolve(\n workspaceRoot,\n 'engine/external-connectors-public/src/app/index.ts',\n ),\n '@wildo-ai/external-connectors-public/techdoc': resolve(\n workspaceRoot,\n 'engine/external-connectors-public/src/techdoc/index.ts',\n ),\n '@wildo-ai/external-connectors-public/website': resolve(\n workspaceRoot,\n 'engine/external-connectors-public/src/website/index.ts',\n ),\n ...buildDeclaredPackageSourceAliases(workspaceRoot, 'engine/external-connectors-models'),\n ...buildDeclaredPackageSourceAliases(workspaceRoot, 'engine/saas-backend-lib'),\n '@wildo-ai/platform-core-shared': resolve(\n workspaceRoot,\n 'platform/platform-core/platform-core-shared/src/index.ts',\n ),\n '@wildo-ai/platform-core-backend': resolve(\n workspaceRoot,\n 'platform/platform-core/platform-core-backend/src/index.ts',\n ),\n '@wildo-ai/platform-shared-lib': resolve(\n workspaceRoot,\n 'platform/platform-back-office/platform-shared-lib/src/index.ts',\n ),\n '@wildo-ai/zod-decorators': resolve(\n workspaceRoot,\n 'engine/zod-decorators/src/index.ts',\n ),\n ...buildDeclaredPackageSourceAliases(workspaceRoot, 'engine/saas-models'),\n ...buildDeclaredPackageSourceAliases(\n workspaceRoot,\n 'engine/saas-technical-doc',\n 'engine/saas-technical-doc/src/index.ts',\n ),\n ...buildDeclaredPackageSourceAliases(\n workspaceRoot,\n 'engine/saas-website',\n 'engine/saas-website/src/config/index.ts',\n ),\n '~wildo-backend-lib': resolve(workspaceRoot, 'engine/saas-backend-lib/src'),\n '~wildo-connectors': resolve(workspaceRoot, 'engine/external-connectors/src'),\n '~wildo-connectors-models': resolve(workspaceRoot, 'engine/external-connectors-models/src'),\n '~wildo-models': resolve(workspaceRoot, 'engine/saas-models/src'),\n '~wildo-zod': resolve(workspaceRoot, 'engine/zod-decorators/src'),\n };\n}\n\n/**\n * Build source-first aliases from one framework package's declared public\n * exports.\n *\n * jiti treats alias keys as prefixes rather than Node-style exact package\n * identities. Hand-authoring only the package root therefore corrupts every\n * semantic entrypoint: `@scope/package/subpath` becomes\n * `<package>/src/index.ts/subpath`. Deriving the aliases from `exports.*.source`\n * keeps the loader aligned with the package's public contract, and sorting by\n * specificity guarantees a subpath wins before its root prefix.\n *\n * `rootSourceOverride` preserves the deliberately narrower source root used by\n * packages whose normal root is unsuitable for config evaluation. Subpaths\n * still come from their declared `source` conditions.\n */\nfunction buildDeclaredPackageSourceAliases(\n workspaceRoot: string,\n packageRelativeRoot: string,\n rootSourceOverride?: string,\n): Record<string, string> {\n const packageRoot = resolve(workspaceRoot, packageRelativeRoot);\n const packageJsonPath = join(packageRoot, 'package.json');\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n name?: string;\n exports?: Record<string, string | { source?: string }>;\n };\n if (!packageJson.name) {\n throw new Error(`Framework package at \"${packageRoot}\" has no package name.`);\n }\n\n const entries: Array<readonly [string, string]> = [];\n for (const [exportKey, exportValue] of Object.entries(packageJson.exports ?? {})) {\n const declaredSource = exportValue !== null && typeof exportValue === 'object'\n ? exportValue.source\n : undefined;\n const sourcePath = exportKey === '.' && rootSourceOverride\n ? resolve(workspaceRoot, rootSourceOverride)\n : declaredSource?.startsWith('./')\n ? resolve(packageRoot, declaredSource)\n : undefined;\n if (!sourcePath) {\n continue;\n }\n if (!isPathInsideRoot(sourcePath, packageRoot)) {\n throw new Error(`Framework package source export \"${exportKey}\" escapes \"${packageRoot}\".`);\n }\n\n const specifier = exportKey === '.'\n ? packageJson.name\n : `${packageJson.name}/${exportKey.slice(2)}`;\n entries.push([specifier, sourcePath]);\n }\n\n if (rootSourceOverride && !entries.some(([specifier]) => specifier === packageJson.name)) {\n const sourcePath = resolve(workspaceRoot, rootSourceOverride);\n if (!isPathInsideRoot(sourcePath, packageRoot)) {\n throw new Error(`Framework package root override escapes \"${packageRoot}\".`);\n }\n entries.push([packageJson.name, sourcePath]);\n }\n\n entries.sort(([left], [right]) => right.length - left.length || left.localeCompare(right));\n return Object.fromEntries(entries);\n}\n\nfunction inferPackageCompanionModuleResolution(\n packageRoot: string,\n): NonNullable<LoadConfigOptions['moduleResolution']> {\n return inferConfigModuleResolution(packageRoot, dirname(fileURLToPath(import.meta.url)));\n}\n\nfunction inferConfigModuleResolution(\n targetPath: string,\n loaderModuleDirectory: string,\n): NonNullable<LoadConfigOptions['moduleResolution']> {\n const frameworkWorkspaceRoot = tryResolveLoaderWorkspaceRoot(loaderModuleDirectory);\n if (!frameworkWorkspaceRoot) {\n return 'package';\n }\n return isPathInsideRoot(targetPath, frameworkWorkspaceRoot)\n ? 'framework-source'\n : 'package';\n}\n\nfunction isPathInsideRoot(pathToCheck: string, root: string): boolean {\n const relativePath = relative(resolve(root), resolve(pathToCheck));\n return relativePath === ''\n || (!relativePath.startsWith('..') && !relativePath.startsWith(`..${requirePathSeparator()}`));\n}\n\nfunction requirePathSeparator(): string {\n return process.platform === 'win32' ? '\\\\' : '/';\n}\n\n/**\n * Load a `wildo.saas.config.ts` file.\n * Returns `null` if the file doesn't exist (non-throwing variant for optional loading).\n */\nexport async function loadSaasConfig(filePath: string, options?: LoadConfigOptions): Promise<WildoSaasConfig | null> {\n const absolutePath = resolve(filePath);\n if (!existsSync(absolutePath)) return null;\n return loadConfig<WildoSaasConfig>(absolutePath, options);\n}\n\n/**\n * Where an application authors one environment's infra config: `<infrastructure home>/<env>/wildo.infra.<local|remote>.config.ts`.\n *\n * ONE rule, shared by every reader. It lived as a private helper in the CLI and was copied twice more inside it\n * (frontend publish, CSP sync); the dev companion needs it too, to read the application's declared store, so it moved\n * here beside {@link loadSaasConfig}.\n */\nexport function resolveInfraEnvConfigPath(saasRoot: string, envName: string): string {\n return join(\n resolveAppLayout(saasRoot).authoredInfrastructureHome,\n envName,\n envName === 'local' ? 'wildo.infra.local.config.ts' : 'wildo.infra.remote.config.ts',\n );\n}\n\n/**\n * Load one environment's authored `wildo.infra.<env>.config.ts`. Returns `null` when the file does not exist.\n *\n * Refuses a file whose authored `environment` is not the directory it sits in: reading `local`'s file for `staging`\n * would hand one environment another's topology, silently.\n *\n * `freshModuleCache` re-evaluates the file instead of serving jiti's process-wide module cache. A short-lived CLI\n * does not need it; a long-lived reader whose question is \"what does the file say NOW\" does — the dev companion\n * reads the application's declared store through here, and a cached evaluation would keep answering with the\n * store the file declared when the process first read it (see {@link LoadConfigOptions.freshModuleCache}).\n */\nexport async function loadInfraEnvConfig(\n saasRoot: string,\n envName: string,\n options?: Pick<LoadConfigOptions, 'freshModuleCache'>,\n): Promise<{ path: string; config: WildoInfraEnvConfig } | null> {\n const authored = await loadAuthoredInfraEnvConfigFile(saasRoot, envName, options);\n if (authored === null) return null;\n if (!isHostedInfraEnvConfig(authored.config)) {\n return { path: authored.path, config: authored.config };\n }\n\n /*\n * VALIDATE the hosted descriptor before trusting any of it. `defineHostedInfraEnvConfig` parses it, but this\n * loader also evaluates plain `export default {…}` objects — and an unvalidated `backingServices.postgresql.host`\n * would override the HOST's server in the merge, which is precisely the divergence hosting exists to make\n * impossible. A host-owned member (`runtime`, `database`, …) is refused here too, by name, instead of being\n * silently dropped.\n */\n const hostedParse = WildoHostedInfraEnvConfigSchema.safeParse(authored.config);\n if (!hostedParse.success) {\n throw new Error(`${authored.path} is a hosted environment descriptor and is invalid:\\n`\n + hostedParse.error.issues.map((issue) => ` - ${issue.path.join('.') || '(root)'}: ${issue.message}`).join('\\n'));\n }\n const hostedDescriptor = hostedParse.data;\n\n /*\n * A HOSTED descriptor resolves here and nowhere else. This is the one function that holds both the\n * application root and the environment name, and every reader of an application's infra descriptor\n * reaches it — so the host's platform is merged in once, and no consumer can see a hosted descriptor\n * that has not been resolved.\n */\n const declaredHostRoot = hostedDescriptor.infrastructureHost.applicationRoot;\n const hostApplicationRoot = resolve(saasRoot, declaredHostRoot);\n if (isSameDirectory(hostApplicationRoot, saasRoot)) {\n throw new Error(`${authored.path} declares itself as its own infrastructureHost ('${declaredHostRoot}'). `\n + 'Remove infrastructureHost: an application that owns its infrastructure declares it standalone.');\n }\n if (!existsSync(join(hostApplicationRoot, AUTHORED_CONFIG_FILE_NAMES.SAAS))) {\n throw new Error(`${authored.path} runs on the infrastructure of '${declaredHostRoot}', which resolves to `\n + `${hostApplicationRoot} — and no Wildo application is there (no ${AUTHORED_CONFIG_FILE_NAMES.SAAS}). A hosted application `\n + 'needs its host\\'s SOURCE: check the host application out at that path, or remove infrastructureHost to run this '\n + 'application on its own infrastructure.');\n }\n const host = await loadAuthoredInfraEnvConfigFile(hostApplicationRoot, envName, options);\n if (host === null) {\n throw new Error(`${authored.path} runs on the infrastructure of ${hostApplicationRoot} for environment '${envName}', but that `\n + `application has no descriptor for it (expected ${resolveInfraEnvConfigPath(hostApplicationRoot, envName)}). The host `\n + 'owns the platform per environment, so it must describe this one.');\n }\n\n return {\n path: authored.path,\n config: resolveHostedInfraEnvConfig({\n hosted: hostedDescriptor,\n hostedConfigPath: authored.path,\n host: host.config,\n hostApplicationRoot,\n hostConfigPath: host.path,\n }),\n };\n}\n\n/**\n * Whether two paths name the same directory. Compared through `realpath` when both exist, so a symlinked\n * `applicationRoot` pointing back at the application itself is still recognised as self-hosting; falls\n * back to lexical resolution when either path does not exist yet.\n */\nfunction isSameDirectory(a: string, b: string): boolean {\n try {\n return realpathSync(a) === realpathSync(b);\n } catch {\n return resolve(a) === resolve(b);\n }\n}\n\n/**\n * Evaluate one application's descriptor AS AUTHORED — standalone or hosted, unresolved. Private: a hosted\n * descriptor is not an environment until {@link loadInfraEnvConfig} merges its host in.\n *\n * The host's file is evaluated with the HOST as artifact owner, so its jiti cache lives beside its own\n * application rather than inside the hosted one's.\n */\nasync function loadAuthoredInfraEnvConfigFile(\n saasRoot: string,\n envName: string,\n options?: Pick<LoadConfigOptions, 'freshModuleCache'>,\n): Promise<{ path: string; config: WildoAuthoredInfraEnvConfig } | null> {\n const path = resolveInfraEnvConfigPath(saasRoot, envName);\n if (!existsSync(path)) return null;\n const config = await loadConfig<WildoAuthoredInfraEnvConfig>(resolve(path), {\n artifactLocation: { zone: ConfigArtifactsZone.SAAS, ownerRoot: saasRoot },\n ...(options?.freshModuleCache === true ? { freshModuleCache: true } : {}),\n });\n if (config.environment !== envName) {\n throw new Error(`Authored env descriptor mismatch: directory '${envName}' does not match authored environment '${config.environment}'.`);\n }\n return { path, config };\n}\n\n/**\n * Per-folder file name for a minion config (`wildo.minion.config.ts`).\n *\n * Co-located inside the minion's directory referenced by\n * `wildo.saas.config.ts > minions.<key>.path` — the loader resolves\n * `<saasRoot>/<entry.path>/wildo.minion.config.ts` exactly the same\n * way the existing tech-doc / website per-service loaders resolve\n * their authoring files.\n */\nexport const MINION_CONFIG_FILENAME = 'wildo.minion.config.ts';\n\n/**\n * Per-folder file name for a worker config (`wildo.worker.config.ts`).\n */\nexport const WORKER_CONFIG_FILENAME = 'wildo.worker.config.ts';\n\n/**\n * Result entry for `loadMinionConfigs` / `loadWorkerConfigs`.\n *\n * Carries the bucket key (the name authored under\n * `wildo.saas.config.ts > minions / workers`), the absolute path the\n * config was resolved from, and the parsed value. Returning the\n * absolute path alongside the parsed config lets callers (Phase 2 /\n * Phase 3 manifest emitters) build deterministic error messages\n * without re-deriving the path themselves.\n */\nexport interface PerFolderConfigEntry<T> {\n /** Bucket key from `wildo.saas.config.ts > minions / workers`. */\n key: string;\n /** Absolute path the config was loaded from. */\n absolutePath: string;\n /** Parsed config (Zod-validated). */\n config: T;\n}\n\n/**\n * Load every `wildo.minion.config.ts` referenced by `saasConfig.minions`.\n *\n * Phase 1 contract: this returns a typed list of entries; Phase 2's\n * `start-minion-application` consumes it to build the per-minion DI\n * container and to cross-validate `resourceAccess` against the parsed\n * resource catalog (IC-2). Missing files throw with the offending\n * bucket key in the error message — silently skipping would mask a\n * mistyped `path:` field.\n */\nexport async function loadMinionConfigs(\n saasRoot: string,\n saasConfig: WildoSaasConfig,\n options?: LoadConfigOptions,\n): Promise<PerFolderConfigEntry<WildoMinionConfig>[]> {\n return loadPerFolderConfigs<WildoMinionConfig>(\n saasRoot,\n saasConfig.minions ?? {},\n MINION_CONFIG_FILENAME,\n 'minion',\n options,\n );\n}\n\n/**\n * Load every `wildo.worker.config.ts` referenced by `saasConfig.workers`.\n *\n * Phase 1 contract identical to `loadMinionConfigs` — Phase 3's K8s\n * manifest emitter consumes it to project `replicas`, `http.port`,\n * health/ready paths into Deployment + Service manifests.\n */\nexport async function loadWorkerConfigs(\n saasRoot: string,\n saasConfig: WildoSaasConfig,\n options?: LoadConfigOptions,\n): Promise<PerFolderConfigEntry<WildoWorkerConfig>[]> {\n return loadPerFolderConfigs<WildoWorkerConfig>(\n saasRoot,\n saasConfig.workers ?? {},\n WORKER_CONFIG_FILENAME,\n 'worker',\n options,\n );\n}\n\nasync function loadPerFolderConfigs<T>(\n saasRoot: string,\n bucket: Record<string, { path: string }>,\n filename: string,\n kindLabel: 'minion' | 'worker',\n options?: LoadConfigOptions,\n): Promise<PerFolderConfigEntry<T>[]> {\n const absoluteSaasRoot = resolve(saasRoot);\n const entries = Object.entries(bucket);\n\n const out: PerFolderConfigEntry<T>[] = [];\n for (const [key, ref] of entries) {\n const absolutePath = resolve(absoluteSaasRoot, ref.path, filename);\n if (!existsSync(absolutePath)) {\n throw new Error(\n `Could not find ${kindLabel} config for '${key}': ${absolutePath} does not exist.\\n`\n + ` Authored at: wildo.saas.config.ts > ${kindLabel}s.${key}.path = '${ref.path}'\\n`\n + ` Expected file: ${filename}\\n`\n + ` Either create the file or remove the bucket entry.`,\n );\n }\n const config = await loadConfig<T>(absolutePath, options);\n out.push({ key, absolutePath, config });\n }\n return out;\n}\n\n/**\n * Load the framework-scoped `wildo.framework.config.ts` file.\n * Returns `null` if the file does not exist.\n */\nexport async function loadFrameworkConfig(\n frameworkRoot: string,\n options?: Omit<LoadConfigOptions, 'artifactLocation'>,\n): Promise<WildoFrameworkConfig | null> {\n const filePath = resolveFrameworkLayout(frameworkRoot).declarationConfigPath;\n const absolutePath = resolve(filePath);\n if (!existsSync(absolutePath)) return null;\n\n return loadConfig<WildoFrameworkConfig>(absolutePath, {\n ...options,\n artifactLocation: {\n zone: ConfigArtifactsZone.FRAMEWORK,\n ownerRoot: frameworkRoot,\n },\n });\n}\n"]}
@@ -53,6 +53,20 @@ export declare const FRAMEWORK_PROVIDER_PACKAGE_PREFIX = "@wildo-ai/provider-";
53
53
  * `@acme/provider-thing`.
54
54
  */
55
55
  export declare const FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE = "@wildo-ai/providers";
56
+ /**
57
+ * The ENGINE's own provider barrel, admitted exactly as the catalogue is.
58
+ *
59
+ * The engine ships 23 providers and exports them through `./companion` — the same shape every
60
+ * provider package uses. Discovery did not admit it, so an application that wanted `resend` declared
61
+ * it THREE times: the scope, a hand-authored `provider-contributions.ts` projecting the engine's own
62
+ * metadata back at it, and the package dependency. The middle one carried no information the other
63
+ * two lacked; config sync refused a scoped-but-uncontributed provider, so it was not optional either
64
+ * (#358).
65
+ *
66
+ * A NAME rather than a prefix, for the reason the catalogue's own note gives: this is one known
67
+ * package, not a family.
68
+ */
69
+ export declare const FRAMEWORK_ENGINE_PROVIDER_PACKAGE = "@wildo-ai/external-connectors-private";
56
70
  interface ProviderContributionOwner {
57
71
  kind: ProviderContributionOwnerKind;
58
72
  key: string;
@@ -61,8 +75,33 @@ interface ProviderContributionOwner {
61
75
  export interface DiscoveredProviderCompanionContribution extends ProviderCompanionContribution {
62
76
  owner: ProviderContributionOwner;
63
77
  }
78
+ /**
79
+ * An owner that DECLARES a `./companion` door and could not be read through it.
80
+ *
81
+ * Distinct from an owner that declares none, which is the ordinary case for most packages and is not
82
+ * reported: the walk asks every candidate and expects most to answer nothing.
83
+ */
84
+ export interface UnreadableProviderCompanionOwner {
85
+ readonly ownerLabel: string;
86
+ readonly packageRoot: string;
87
+ readonly reason: string;
88
+ }
64
89
  export interface DiscoverSaasProviderCompanionContributionsResult {
65
90
  contributions: DiscoveredProviderCompanionContribution[];
91
+ /**
92
+ * Owners whose companion door exists and threw. EMPTY is the normal state.
93
+ *
94
+ * Reported because a walk that fails and a walk that finds nothing were previously the same
95
+ * answer — both produced silence, and silence sums to a contribution COUNT (#1305). A count of
96
+ * zero therefore read as a legitimate result rather than as a walk that failed, which is why
97
+ * #1300 survived: a freshly scaffolded application reported 0 contributions and nothing
98
+ * distinguished that from "this application legitimately has no providers".
99
+ *
100
+ * NOT a failure — `resolveProviderPackageTargets` argues correctly that a declared-but-uninstalled
101
+ * package is an install problem `pnpm install` reports better than a config-sync stack trace. The
102
+ * ask is visibility, so this is data a caller may render, not a refusal.
103
+ */
104
+ unreadableOwners: UnreadableProviderCompanionOwner[];
66
105
  }
67
106
  export declare function discoverSaasProviderCompanionContributions(input: {
68
107
  saasRoot: string;
@@ -92,6 +131,13 @@ export declare function resolveValidatedSaasProviderContributions(input: {
92
131
  export declare function validateDiscoveredSaasProviderContributions(input: {
93
132
  saasConfig: Pick<WildoSaasConfig, 'modules' | 'providers' | 'services' | 'minions' | 'workers'>;
94
133
  discoveredContributions: DiscoveredProviderCompanionContribution[];
134
+ /**
135
+ * The owners the walk could not read. They never decide the verdict — unreadable is DATA, not a
136
+ * refusal (see `DiscoverSaasProviderCompanionContributionsResult.unreadableOwners`) — but when the
137
+ * validation refuses anyway, they are usually WHY: their contributions are simply missing from what
138
+ * was validated. So a refusal names them, with the reason each could not be read.
139
+ */
140
+ unreadableOwners?: readonly UnreadableProviderCompanionOwner[];
95
141
  }): void;
96
142
  export {};
97
143
  //# sourceMappingURL=provider-companion-discovery.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,6BAA6B,EAGnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;GAQG;AACH,oBAAY,6BAA6B;IACvC,sGAAsG;IACtG,OAAO,YAAY;IACnB,mDAAmD;IACnD,OAAO,YAAY;IACnB,kDAAkD;IAClD,MAAM,WAAW;IACjB,uDAAuD;IACvD,MAAM,WAAW;IACjB;;;;OAIG;IACH,gBAAgB,oBAAoB;CACrC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iCAAiC,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oCAAoC,wBAAwB,CAAC;AAE1E,UAAU,yBAAyB;IACjC,IAAI,EAAE,6BAA6B,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD,MAAM,WAAW,uCAAwC,SAAQ,6BAA6B;IAC5F,KAAK,EAAE,yBAAyB,CAAC;CAClC;AAED,MAAM,WAAW,gDAAgD;IAC/D,aAAa,EAAE,uCAAuC,EAAE,CAAC;CAC1D;AAED,wBAAsB,0CAA0C,CAAC,KAAK,EAAE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC,CAAC;CACnG,GAAG,OAAO,CAAC,gDAAgD,CAAC,CA+B5D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,yCAAyC,CAAC,KAAK,EAAE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC,CAAC;CAC/G,GAAG,OAAO,CAAC,uCAAuC,EAAE,CAAC,CAOrD;AAED,wBAAgB,2CAA2C,CAAC,KAAK,EAAE;IACjE,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;IAChG,uBAAuB,EAAE,uCAAuC,EAAE,CAAC;CACpE,GAAG,IAAI,CAmIP"}
1
+ {"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,6BAA6B,EAEsB,MAAM,uBAAuB,CAAC;AACxF,OAAO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BG;AACH,wBAAsB,yCAAyC,CAAC,KAAK,EAAE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC,CAAC;CAC/G,GAAG,OAAO,CAAC,uCAAuC,EAAE,CAAC,CAQrD;AAED,wBAAgB,2CAA2C,CAAC,KAAK,EAAE;IACjE,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC;IAChG,uBAAuB,EAAE,uCAAuC,EAAE,CAAC;IACnE;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,SAAS,gCAAgC,EAAE,CAAC;CAChE,GAAG,IAAI,CAoIP"}
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { dirname, join, resolve } from 'node:path';
4
- import { ProviderCompanionContributionSchema, } from '@wildo-ai/saas-models';
4
+ import { ProviderCompanionContributionSchema, describeCaughtError } from '@wildo-ai/saas-models';
5
5
  import { loadPackageCompanionExport, resolvePackageCompanionEntryPath } from './loader.js';
6
6
  /**
7
7
  * `providerPackage` was added by #330 and is the point of that slice on this file.
@@ -57,20 +57,100 @@ export const FRAMEWORK_PROVIDER_PACKAGE_PREFIX = '@wildo-ai/provider-';
57
57
  * `@acme/provider-thing`.
58
58
  */
59
59
  export const FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE = '@wildo-ai/providers';
60
+ /**
61
+ * The ENGINE's own provider barrel, admitted exactly as the catalogue is.
62
+ *
63
+ * The engine ships 23 providers and exports them through `./companion` — the same shape every
64
+ * provider package uses. Discovery did not admit it, so an application that wanted `resend` declared
65
+ * it THREE times: the scope, a hand-authored `provider-contributions.ts` projecting the engine's own
66
+ * metadata back at it, and the package dependency. The middle one carried no information the other
67
+ * two lacked; config sync refused a scoped-but-uncontributed provider, so it was not optional either
68
+ * (#358).
69
+ *
70
+ * A NAME rather than a prefix, for the reason the catalogue's own note gives: this is one known
71
+ * package, not a family.
72
+ */
73
+ export const FRAMEWORK_ENGINE_PROVIDER_PACKAGE = '@wildo-ai/external-connectors-private';
74
+ /**
75
+ * The runtime targets an application's SCOPES imply for one provider ref.
76
+ *
77
+ * ## Why a package's declared targets cannot be the answer
78
+ *
79
+ * A provider PACKAGE is shipped once and installed by many applications, so it cannot know any of
80
+ * their runtime topologies. Measured 2026-09-09: all 682 catalogue vendors declare
81
+ * `[{ kind: 'backend' }]` and every engine contribution declares `backend` (plus `companion` for the
82
+ * model-ish ones). Those are defaults standing in for an answer the package is not able to give —
83
+ * a minion key or a worker key exists only in `wildo.saas.config.ts`.
84
+ *
85
+ * The consequence was latent rather than theoretical: a CATALOGUE provider scoped to a minion would
86
+ * have failed materialization with "no discovered contribution supplies its secret-contract shape
87
+ * for this runtime", because the package declares a `backend` target and the minion scope looks for
88
+ * a `minion` one. No application had scoped one to a minion yet, so nothing had reported it.
89
+ *
90
+ * ## Why the scopes ARE the answer
91
+ *
92
+ * `providers.scopes` is where an application says which runtimes reach which provider — it is the
93
+ * same decision, already authored, in the place the runtime artifact is built from. Measured against
94
+ * Wonder Todos' hand-authored projections: the scopes reproduce 9 of 10 target sets EXACTLY, and the
95
+ * tenth is a SURPLUS (a `companion` target for a provider the companion scope does not name) which
96
+ * the artifact discards anyway, since it is built from scope INTERSECT contribution.
97
+ *
98
+ * So nothing is lost by deriving, and what is gained is that an application declares a provider once.
99
+ *
100
+ * Applies to contributions discovered from a PACKAGE. A runtime owner's own companion barrel keeps
101
+ * whatever it declares: that is the application's own file talking about itself, and an application
102
+ * package is entitled to state a target the scopes do not.
103
+ */
104
+ function resolveScopeImpliedRuntimeTargets(providerRef, saasConfig) {
105
+ const scopes = saasConfig.providers?.scopes;
106
+ if (!scopes)
107
+ return [];
108
+ const targets = [];
109
+ if (scopes.backend?.providers?.[providerRef])
110
+ targets.push({ kind: 'backend' });
111
+ if (scopes.companion?.providers?.[providerRef])
112
+ targets.push({ kind: 'companion' });
113
+ for (const [minionKey, scope] of Object.entries(scopes.minions ?? {})) {
114
+ if (scope?.providers?.[providerRef])
115
+ targets.push({ kind: 'minion', minionKey });
116
+ }
117
+ for (const [workerKey, scope] of Object.entries(scopes.workers ?? {})) {
118
+ if (scope?.providers?.[providerRef])
119
+ targets.push({ kind: 'worker', workerKey });
120
+ }
121
+ return targets;
122
+ }
60
123
  export async function discoverSaasProviderCompanionContributions(input) {
61
124
  const contributions = [];
62
125
  const runtimeOwnerTargets = resolveContributionTargets(input.saasRoot, input.saasConfig);
126
+ const unreadableOwners = [];
63
127
  for (const target of [
64
128
  ...runtimeOwnerTargets,
65
- ...resolveProviderPackageTargets(input.saasRoot, runtimeOwnerTargets),
129
+ // Unfiltered roots, NOT `runtimeOwnerTargets` — see `resolveRuntimeOwnerPackageRoots` (#1300).
130
+ ...resolveProviderPackageTargets(input.saasRoot, resolveRuntimeOwnerPackageRoots(input.saasRoot, input.saasConfig)),
66
131
  ]) {
67
- const companionExports = await tryLoadRuntimeOwnerCompanionExports(target.packageRoot);
68
- if (!companionExports) {
132
+ const loaded = await tryLoadRuntimeOwnerCompanionExports(target.packageRoot);
133
+ if (loaded.unreadable !== undefined) {
134
+ unreadableOwners.push({
135
+ ownerLabel: target.ownerLabel,
136
+ packageRoot: target.packageRoot,
137
+ reason: loaded.unreadable,
138
+ });
139
+ continue;
140
+ }
141
+ if (!loaded.exports) {
69
142
  continue;
70
143
  }
71
- const parsedContributions = ProviderCompanionContributionSchema.array().parse(companionExports.providerContributions ?? []);
144
+ const parsedContributions = ProviderCompanionContributionSchema.array().parse(loaded.exports.providerContributions ?? []);
145
+ // A PACKAGE cannot know this application's runtime topology, so its declared targets are a
146
+ // default and the SCOPES are the answer. A runtime owner's own barrel keeps what it declares —
147
+ // see `resolveScopeImpliedRuntimeTargets`.
148
+ const derivesTargetsFromScopes = target.kind === ProviderContributionOwnerKind.PROVIDER_PACKAGE;
72
149
  contributions.push(...parsedContributions.map((contribution) => ({
73
150
  ...contribution,
151
+ runtimeTargets: derivesTargetsFromScopes
152
+ ? resolveScopeImpliedRuntimeTargets(contribution.ref, input.saasConfig)
153
+ : contribution.runtimeTargets,
74
154
  owner: {
75
155
  kind: target.kind,
76
156
  key: target.key,
@@ -78,7 +158,7 @@ export async function discoverSaasProviderCompanionContributions(input) {
78
158
  },
79
159
  })));
80
160
  }
81
- return { contributions };
161
+ return { contributions, unreadableOwners };
82
162
  }
83
163
  /**
84
164
  * Walk an application's provider contributions and VALIDATE them — one step, because the two must
@@ -98,10 +178,11 @@ export async function discoverSaasProviderCompanionContributions(input) {
98
178
  * discovery and the real validation they exist to check.
99
179
  */
100
180
  export async function resolveValidatedSaasProviderContributions(input) {
101
- const { contributions } = await discoverSaasProviderCompanionContributions(input);
181
+ const { contributions, unreadableOwners } = await discoverSaasProviderCompanionContributions(input);
102
182
  validateDiscoveredSaasProviderContributions({
103
183
  saasConfig: input.saasConfig,
104
184
  discoveredContributions: contributions,
185
+ unreadableOwners,
105
186
  });
106
187
  return contributions;
107
188
  }
@@ -209,9 +290,55 @@ export function validateDiscoveredSaasProviderContributions(input) {
209
290
  });
210
291
  }
211
292
  if (errors.length > 0) {
212
- throw new Error(`Provider companion-export discovery validation failed:\n- ${errors.join('\n- ')}`);
293
+ throw new Error(`Provider companion-export discovery validation failed:\n- ${errors.join('\n- ')}`
294
+ + describeUnreadableOwnersForRefusal(input.unreadableOwners ?? []));
213
295
  }
214
296
  }
297
+ /**
298
+ * The part of a refusal that says the walk was INCOMPLETE, or nothing when it was not.
299
+ *
300
+ * Measured 2026-09-24 (#1558): Wonder CRM's frontend companion could not be loaded — its injected
301
+ * engine snapshot was missing a file — so it contributed nothing, and the refusal said only
302
+ * `Provider "sentry" is authored in scope "frontendServices.app" but no companion export contributes
303
+ * it`. That names the CATALOGUE; the cause was a LOAD. The first diagnosis recorded it as a provider
304
+ * decision. Naming the unreadable owner and its reason beside the refusal points at the real remedy.
305
+ */
306
+ function describeUnreadableOwnersForRefusal(unreadableOwners) {
307
+ if (unreadableOwners.length === 0)
308
+ return '';
309
+ return '\nThese runtime owners could not be READ, so anything they contribute is missing above — '
310
+ + 'repair the load before concluding a provider is uncontributed:\n- '
311
+ + unreadableOwners.map((owner) => `${owner.ownerLabel} (${owner.packageRoot}): ${owner.reason}`).join('\n- ');
312
+ }
313
+ /**
314
+ * Every runtime owner's package root, UNFILTERED — the roots a provider PACKAGE may be declared in.
315
+ *
316
+ * Distinct from {@link resolveContributionTargets} on purpose, and the distinction is the whole of
317
+ * issue #1300. That function answers "whose own companion exports should we LOAD", and it correctly
318
+ * skips an owner with nothing scoped to it: such an owner contributes nothing relevant. This one
319
+ * answers "whose MANIFEST may name a provider package", and for that question the scopes are not
320
+ * evidence — a manifest declares `@wildo-ai/external-connectors-private` whether or not the
321
+ * application has yet scoped anything from it.
322
+ *
323
+ * Reusing the filtered set for both made provider discovery CIRCULAR: a backend service entered the
324
+ * search only when `providers.scopes.backend` already had providers, so a freshly scaffolded
325
+ * application — whose scopes are all empty — searched only its root manifest, found no provider
326
+ * package, discovered ZERO contributions, and refused every provider it tried to scope with
327
+ * "no companion export contributes it for that runtime". Scoping a provider required having already
328
+ * scoped one. Measured on a fresh application: 0 contributions with empty scopes, 23 the moment one
329
+ * provider was added to the backend scope, from the same manifests and the same installed packages.
330
+ *
331
+ * The cost of not filtering is reading a few more `package.json` files; `resolveProviderPackageTargets`
332
+ * de-duplicates by resolved package root and skips what it cannot resolve.
333
+ */
334
+ function resolveRuntimeOwnerPackageRoots(saasRoot, saasConfig) {
335
+ return [
336
+ ...Object.values(saasConfig.services),
337
+ ...Object.values(saasConfig.libraries ?? {}),
338
+ ...Object.values(saasConfig.minions ?? {}),
339
+ ...Object.values(saasConfig.workers ?? {}),
340
+ ].map((definition) => resolve(saasRoot, definition.path));
341
+ }
215
342
  function resolveContributionTargets(saasRoot, saasConfig) {
216
343
  const shouldIncludeBackendServices = hasAnyProviders(saasConfig.providers.scopes.backend?.providers);
217
344
  const frontendServiceProviderScopes = Object.entries(saasConfig.providers.scopes.frontendServices ?? {})
@@ -272,13 +399,15 @@ function resolveContributionTargets(saasRoot, saasConfig) {
272
399
  * here would make `wildo config sync` unrunnable in exactly the state where an operator runs it to
273
400
  * find out what is wrong.
274
401
  */
275
- function resolveProviderPackageTargets(saasRoot, runtimeOwnerTargets) {
402
+ function resolveProviderPackageTargets(saasRoot, runtimeOwnerPackageRoots) {
276
403
  const prefixes = resolveProviderPackagePrefixes(saasRoot);
277
- const searchRoots = [saasRoot, ...runtimeOwnerTargets.map((target) => target.packageRoot)];
404
+ const searchRoots = [saasRoot, ...runtimeOwnerPackageRoots];
278
405
  const candidateNames = new Set();
279
406
  for (const searchRoot of searchRoots) {
280
407
  for (const dependencyName of readRuntimeReachablePackageNames(searchRoot)) {
281
- if (dependencyName === FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE || prefixes.some((prefix) => dependencyName.startsWith(prefix))) {
408
+ if (dependencyName === FRAMEWORK_PROVIDER_CATALOGUE_PACKAGE
409
+ || dependencyName === FRAMEWORK_ENGINE_PROVIDER_PACKAGE
410
+ || prefixes.some((prefix) => dependencyName.startsWith(prefix))) {
282
411
  candidateNames.add(dependencyName);
283
412
  }
284
413
  }
@@ -371,14 +500,27 @@ function readPackageName(packageRoot) {
371
500
  return undefined;
372
501
  }
373
502
  }
503
+ /**
504
+ * Read one owner's companion barrel, separating the two answers that used to look identical.
505
+ *
506
+ * - `{ exports: undefined }` — the package declares no `./companion` door. Ordinary: most packages
507
+ * do not, and the walk asks everything it can reach.
508
+ * - `{ unreadable }` — the door EXISTS and reading it threw. A broken or unbuilt install, not an
509
+ * absence, and the one case worth telling somebody about.
510
+ */
374
511
  async function tryLoadRuntimeOwnerCompanionExports(packageRoot) {
375
512
  try {
376
513
  resolvePackageCompanionEntryPath(packageRoot);
377
514
  }
378
515
  catch {
379
- return undefined;
516
+ return {};
517
+ }
518
+ try {
519
+ return { exports: await loadPackageCompanionExport(packageRoot) };
520
+ }
521
+ catch (error) {
522
+ return { unreadable: describeCaughtError(error) };
380
523
  }
381
- return loadPackageCompanionExport(packageRoot);
382
524
  }
383
525
  function validateRuntimeScopeAgainstDiscovery(input) {
384
526
  const { errors, discoveredContributions, matchesTarget, providers, scopeLabel } = input;