@wildo-ai/platform-config-lib 1.1.8 → 1.1.9

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 (28) hide show
  1. package/dist/esm/bootstrap/bootstrap.schemas.d.ts +12 -5
  2. package/dist/esm/bootstrap/bootstrap.schemas.d.ts.map +1 -1
  3. package/dist/esm/bootstrap/bootstrap.schemas.js +21 -5
  4. package/dist/esm/bootstrap/bootstrap.schemas.js.map +1 -1
  5. package/dist/esm/index.d.ts +1 -0
  6. package/dist/esm/index.d.ts.map +1 -1
  7. package/dist/esm/index.js +1 -0
  8. package/dist/esm/index.js.map +1 -1
  9. package/dist/esm/lockfile/file-lock-hold.d.ts +87 -0
  10. package/dist/esm/lockfile/file-lock-hold.d.ts.map +1 -0
  11. package/dist/esm/lockfile/file-lock-hold.js +279 -0
  12. package/dist/esm/lockfile/file-lock-hold.js.map +1 -0
  13. package/dist/esm/lockfile/lockfile-io.d.ts +21 -3
  14. package/dist/esm/lockfile/lockfile-io.d.ts.map +1 -1
  15. package/dist/esm/lockfile/lockfile-io.js +8 -16
  16. package/dist/esm/lockfile/lockfile-io.js.map +1 -1
  17. package/dist/esm/project-config/loader.d.ts +16 -1
  18. package/dist/esm/project-config/loader.d.ts.map +1 -1
  19. package/dist/esm/project-config/loader.js +35 -1
  20. package/dist/esm/project-config/loader.js.map +1 -1
  21. package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
  22. package/dist/esm/project-config/provider-companion-discovery.js +1 -0
  23. package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
  24. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts +13 -0
  25. package/dist/esm/project-config/shared/infra-providers.schemas.d.ts.map +1 -1
  26. package/dist/esm/project-config/shared/infra-providers.schemas.js.map +1 -1
  27. package/dist/tsconfig.build.tsbuildinfo +1 -1
  28. package/package.json +7 -7
@@ -77,6 +77,14 @@ async function importConfigModule(filePath, options) {
77
77
  });
78
78
  return { absolutePath, module: await jiti.import(absolutePath) };
79
79
  }
80
+ /**
81
+ * Which file a package's companion subpath resolves to.
82
+ *
83
+ * Authored source wins when either option asks for it: `moduleResolution: 'framework-source'` (a package inside the
84
+ * framework workspace), or `preferAuthoredSource` (a reader whose contract is the working tree, wherever the package
85
+ * lives — see {@link loadPackageCompanionExport}). Otherwise the declared `exports` entry wins, and authored source
86
+ * is only the fallback when nothing is built.
87
+ */
80
88
  export function resolvePackageCompanionEntryPath(packageRoot, subpath = PACKAGE_COMPANION_SUBPATH, options) {
81
89
  const packageJsonPath = join(packageRoot, 'package.json');
82
90
  if (!existsSync(packageJsonPath)) {
@@ -99,7 +107,7 @@ export function resolvePackageCompanionEntryPath(packageRoot, subpath = PACKAGE_
99
107
  ]
100
108
  : [];
101
109
  const preferredSourceCandidate = sourceCandidates.find((candidate) => existsSync(candidate));
102
- if (options?.moduleResolution === 'framework-source' && preferredSourceCandidate) {
110
+ if ((options?.moduleResolution === 'framework-source' || options?.preferAuthoredSource === true) && preferredSourceCandidate) {
103
111
  return preferredSourceCandidate;
104
112
  }
105
113
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
@@ -196,8 +204,34 @@ export async function loadPackageCompanionExport(packageRoot, subpath = PACKAGE_
196
204
  const realPackageRoot = realpathSync(packageRoot);
197
205
  const moduleResolution = options?.moduleResolution
198
206
  ?? inferPackageCompanionModuleResolution(realPackageRoot);
207
+ /*
208
+ * A FRESH read evaluates the package's AUTHORED source, never its compiled `dist`, in every application.
209
+ *
210
+ * jiti does not transpile an ESM `.js` file in a `"type": "module"` package: it hands it to Node's native
211
+ * `import()` (`[jiti] [native] [import]` under JITI_DEBUG), whatever `moduleCache: false` says. Node's ESM registry
212
+ * is process-global and cannot be invalidated, so the first evaluation of `dist/esm/companion-exports.js` and of
213
+ * every relative module it imports is the only one the process ever sees. `freshModuleCache` was therefore inert
214
+ * for every package resolved through `exports`, which is every application OUTSIDE the framework workspace
215
+ * (`inferPackageCompanionModuleResolution` answers `package` there). Inside the workspace, `framework-source`
216
+ * picked `src/companion-exports.ts`, which jiti transpiles and does re-read — so the dogfood applications under
217
+ * `examples/` showed it working and nothing else did.
218
+ *
219
+ * Measured 2026-10-01 on an application created with the published 1.1.8 CLI: creator answers landed in
220
+ * `specifications/src/creator-inputs/index.ts`, the watcher rebuilt `dist` a second later, and the running
221
+ * companion kept reading the creator-inputs it saw at startup. Every answer saved through the dossier then
222
+ * re-landed the file from that stale read, so each save kept only its own answer, and the 16 answers written by
223
+ * hand were invisible until a restart. Reproduced in isolation: a changed `dist` entry, loaded again with
224
+ * `freshModuleCache: true`, returns the first evaluation; a changed `.ts` entry returns the new one.
225
+ *
226
+ * Reading source is also what the writers write: a landing writes `src/`, so a read-modify-write that read `dist`
227
+ * raced the watcher even in a process with a fresh registry. Only the package's OWN modules gain this; a bare
228
+ * import into another package (`@app/shared-lib`) still loads that package's compiled build natively. Keeping
229
+ * that build fresh is the caller's concern: the dev companion re-tags those URLs per build
230
+ * (`application-module-generations.companion.ts`, #2125).
231
+ */
199
232
  const entryPath = resolvePackageCompanionEntryPath(realPackageRoot, subpath, {
200
233
  moduleResolution,
234
+ preferAuthoredSource: options?.freshModuleCache === true,
201
235
  });
202
236
  return loadConfig(entryPath, {
203
237
  ...options,
@@ -1 +1 @@
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,EAA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,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, module } = await importConfigModule<{ default: T }>(filePath, options);\n if (!module.default) {\n throw new Error(`Config file must use \\`export default\\`: ${absolutePath}`);\n }\n return module.default;\n}\n\n/**\n * Load one NAMED export of an application-authored TypeScript module, through the same resolver\n * `loadConfig` uses — framework aliases, the application's own package, the per-file cache.\n *\n * For modules that are not configs and have no default export: the accepted brand assets\n * (`specifications/src/brand/resolved-assets.generated.ts` exports `generatedResolvedBrandAssets`)\n * are read by both the CLI's `wildo brand propagate` and the companion's logo step, and a second\n * TypeScript loader in each would resolve framework imports differently from every other config the\n * application authors. Returns `undefined` when the module does not export `exportName`.\n */\nexport async function loadConfigExport<T>(filePath: string, exportName: string, options?: LoadConfigOptions): Promise<T | undefined> {\n const { module } = await importConfigModule<Record<string, unknown>>(filePath, options);\n return module[exportName] as T | undefined;\n}\n\nasync function importConfigModule<TModule>(\n filePath: string,\n options?: LoadConfigOptions,\n): Promise<{ readonly absolutePath: string; readonly module: TModule }> {\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 return { absolutePath, module: await jiti.import(absolutePath) as TModule };\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 /*\n * The REAL path, as Node resolves a linked package (#2038). pnpm installs an injected or workspace package into an\n * importer's `node_modules` as a symlink to its virtual-store copy, and that copy's own dependencies sit beside it\n * there (`.pnpm/<key>/node_modules/…`), not in the importer's `node_modules`. jiti resolves a bare import from the path\n * it was handed, so the symlinked root found a dependency only when the importer happened to declare it too — the\n * catalogue's `@wildo-ai/external-connectors-public/companion` import (#1700) was the first one the backend did not,\n * and every `wildo config sync` of Wonder Todos then refused its ten catalogue providers as uncontributed.\n * A root that is not a link is its own real path, so runtime owners are unchanged.\n */\n const realPackageRoot = realpathSync(packageRoot);\n const moduleResolution = options?.moduleResolution\n ?? inferPackageCompanionModuleResolution(realPackageRoot);\n const entryPath = resolvePackageCompanionEntryPath(realPackageRoot, 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"]}
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,+BAA+B,GAGhC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAGxF,OAAO,EACL,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,GAE9B,MAAM,4CAA4C,CAAC;AAiEpD,MAAM,yBAAyB,GAAG,aAAa,CAAC;AAEhD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAI,QAAgB,EAAE,OAA2B;IAC/E,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAiB,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7F,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAA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AC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,MAAM,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 * It reaches only what jiti TRANSPILES. An ESM `.js` file in a `\"type\": \"module\"`\n * package is imported natively by Node and pinned in its process-global ESM\n * registry, whatever this says — so {@link loadPackageCompanionExport} answers\n * a fresh read from the package's authored source, not its `dist`.\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, module } = await importConfigModule<{ default: T }>(filePath, options);\n if (!module.default) {\n throw new Error(`Config file must use \\`export default\\`: ${absolutePath}`);\n }\n return module.default;\n}\n\n/**\n * Load one NAMED export of an application-authored TypeScript module, through the same resolver\n * `loadConfig` uses — framework aliases, the application's own package, the per-file cache.\n *\n * For modules that are not configs and have no default export: the accepted brand assets\n * (`specifications/src/brand/resolved-assets.generated.ts` exports `generatedResolvedBrandAssets`)\n * are read by both the CLI's `wildo brand propagate` and the companion's logo step, and a second\n * TypeScript loader in each would resolve framework imports differently from every other config the\n * application authors. Returns `undefined` when the module does not export `exportName`.\n */\nexport async function loadConfigExport<T>(filePath: string, exportName: string, options?: LoadConfigOptions): Promise<T | undefined> {\n const { module } = await importConfigModule<Record<string, unknown>>(filePath, options);\n return module[exportName] as T | undefined;\n}\n\nasync function importConfigModule<TModule>(\n filePath: string,\n options?: LoadConfigOptions,\n): Promise<{ readonly absolutePath: string; readonly module: TModule }> {\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 return { absolutePath, module: await jiti.import(absolutePath) as TModule };\n}\n\n/**\n * Which file a package's companion subpath resolves to.\n *\n * Authored source wins when either option asks for it: `moduleResolution: 'framework-source'` (a package inside the\n * framework workspace), or `preferAuthoredSource` (a reader whose contract is the working tree, wherever the package\n * lives — see {@link loadPackageCompanionExport}). Otherwise the declared `exports` entry wins, and authored source\n * is only the fallback when nothing is built.\n */\nexport function resolvePackageCompanionEntryPath(\n packageRoot: string,\n subpath: string = PACKAGE_COMPANION_SUBPATH,\n options?: Pick<LoadConfigOptions, 'moduleResolution'> & { readonly preferAuthoredSource?: boolean },\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' || options?.preferAuthoredSource === true) && 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 /*\n * The REAL path, as Node resolves a linked package (#2038). pnpm installs an injected or workspace package into an\n * importer's `node_modules` as a symlink to its virtual-store copy, and that copy's own dependencies sit beside it\n * there (`.pnpm/<key>/node_modules/…`), not in the importer's `node_modules`. jiti resolves a bare import from the path\n * it was handed, so the symlinked root found a dependency only when the importer happened to declare it too — the\n * catalogue's `@wildo-ai/external-connectors-public/companion` import (#1700) was the first one the backend did not,\n * and every `wildo config sync` of Wonder Todos then refused its ten catalogue providers as uncontributed.\n * A root that is not a link is its own real path, so runtime owners are unchanged.\n */\n const realPackageRoot = realpathSync(packageRoot);\n const moduleResolution = options?.moduleResolution\n ?? inferPackageCompanionModuleResolution(realPackageRoot);\n /*\n * A FRESH read evaluates the package's AUTHORED source, never its compiled `dist`, in every application.\n *\n * jiti does not transpile an ESM `.js` file in a `\"type\": \"module\"` package: it hands it to Node's native\n * `import()` (`[jiti] [native] [import]` under JITI_DEBUG), whatever `moduleCache: false` says. Node's ESM registry\n * is process-global and cannot be invalidated, so the first evaluation of `dist/esm/companion-exports.js` and of\n * every relative module it imports is the only one the process ever sees. `freshModuleCache` was therefore inert\n * for every package resolved through `exports`, which is every application OUTSIDE the framework workspace\n * (`inferPackageCompanionModuleResolution` answers `package` there). Inside the workspace, `framework-source`\n * picked `src/companion-exports.ts`, which jiti transpiles and does re-read — so the dogfood applications under\n * `examples/` showed it working and nothing else did.\n *\n * Measured 2026-10-01 on an application created with the published 1.1.8 CLI: creator answers landed in\n * `specifications/src/creator-inputs/index.ts`, the watcher rebuilt `dist` a second later, and the running\n * companion kept reading the creator-inputs it saw at startup. Every answer saved through the dossier then\n * re-landed the file from that stale read, so each save kept only its own answer, and the 16 answers written by\n * hand were invisible until a restart. Reproduced in isolation: a changed `dist` entry, loaded again with\n * `freshModuleCache: true`, returns the first evaluation; a changed `.ts` entry returns the new one.\n *\n * Reading source is also what the writers write: a landing writes `src/`, so a read-modify-write that read `dist`\n * raced the watcher even in a process with a fresh registry. Only the package's OWN modules gain this; a bare\n * import into another package (`@app/shared-lib`) still loads that package's compiled build natively. Keeping\n * that build fresh is the caller's concern: the dev companion re-tags those URLs per build\n * (`application-module-generations.companion.ts`, #2125).\n */\n const entryPath = resolvePackageCompanionEntryPath(realPackageRoot, subpath, {\n moduleResolution,\n preferAuthoredSource: options?.freshModuleCache === true,\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAA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B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW1E;AAsGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,uCAAuC,EAAE,GAChE,MAAM,GAAG,SAAS,CAgBpB"}
1
+ {"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAGS,MAAM,uBAAuB,CAAC;AAGvE,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;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iCAAiC,0CAA0C,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,gCAAgC,CAAC;AAEjF;;;;;GAKG;AACH,oBAAY,4BAA4B;IACtC,uGAAuG;IACvG,QAAQ,aAAa;IACrB,+GAA+G;IAC/G,gBAAgB,qBAAqB;IACrC,uGAAuG;IACvG,aAAa,kBAAkB;IAC/B,kFAAkF;IAClF,UAAU,eAAe;IACzB,gHAAgH;IAChH,mBAAmB,wBAAwB;IAC3C;;;;OAIG;IACH,cAAc,mBAAmB;IACjC,8GAA8G;IAC9G,aAAa,kBAAkB;CAChC;AAED,yDAAyD;AACzD,MAAM,WAAW,qBAAqB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AI,CAAC,eAAe,EAAE,WAAW,GAAG,iBAAiB,CAAC,CAAC;IACnE,uBAAuB,EAAE,SAAS,uCAAuC,EAAE,CAAC;CAC7E,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAoF7C;AA6ID;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,uCAAuC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAOlJ;AA0YD,kHAAkH;AAClH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW1E;AAsGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,uCAAuC,EAAE,GAChE,MAAM,GAAG,SAAS,CAgBpB"}
@@ -654,6 +654,7 @@ const BASE_OWNED_AUGMENTATION_RECORD_KEYS = {
654
654
  oauth2: 'an OAuth2 block',
655
655
  secretsContractShape: 'a secrets contract',
656
656
  secretsContract: 'a secrets contract',
657
+ protocolSecretRefs: 'the secret a protocol binding reads',
657
658
  engineCapabilities: 'an engine capability',
658
659
  providerCapabilities: 'a provider capability',
659
660
  admissibleConnections: 'the connections a provider admits',