@wildo-ai/wildo-cli 1.1.3 → 1.1.4
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.
- package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts +2 -0
- package/dist/src/commands/context/__tests__/assurance-basis.command.test.d.ts.map +1 -0
- package/dist/src/commands/context/__tests__/assurance-basis.command.test.js +63 -0
- package/dist/src/commands/context/__tests__/assurance-basis.command.test.js.map +1 -0
- package/dist/src/commands/context/assurance-basis.command.d.ts +61 -0
- package/dist/src/commands/context/assurance-basis.command.d.ts.map +1 -0
- package/dist/src/commands/context/assurance-basis.command.js +166 -0
- package/dist/src/commands/context/assurance-basis.command.js.map +1 -0
- package/dist/src/commands/dev/charts-audit.command.d.ts +5 -3
- package/dist/src/commands/dev/charts-audit.command.d.ts.map +1 -1
- package/dist/src/commands/dev/charts-audit.command.js +35 -6
- package/dist/src/commands/dev/charts-audit.command.js.map +1 -1
- package/dist/src/commands/fwk/generate-providers.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/generate-providers.command.js +18 -2
- package/dist/src/commands/fwk/generate-providers.command.js.map +1 -1
- package/dist/src/commands/generate/email-preview.command.d.ts +8 -0
- package/dist/src/commands/generate/email-preview.command.d.ts.map +1 -1
- package/dist/src/commands/generate/email-preview.command.js +57 -0
- package/dist/src/commands/generate/email-preview.command.js.map +1 -1
- package/dist/src/commands/init.command.d.ts.map +1 -1
- package/dist/src/commands/init.command.js +32 -0
- package/dist/src/commands/init.command.js.map +1 -1
- package/dist/src/commands/lock/check.command.d.ts.map +1 -1
- package/dist/src/commands/lock/check.command.js +3 -2
- package/dist/src/commands/lock/check.command.js.map +1 -1
- package/dist/src/commands/registry/login.command.d.ts.map +1 -1
- package/dist/src/commands/registry/login.command.js +2 -0
- package/dist/src/commands/registry/login.command.js.map +1 -1
- package/dist/src/commands/registry/publish.command.d.ts.map +1 -1
- package/dist/src/commands/registry/publish.command.js +2 -0
- package/dist/src/commands/registry/publish.command.js.map +1 -1
- package/dist/src/commands/registry/registry-transport.constants.d.ts +33 -0
- package/dist/src/commands/registry/registry-transport.constants.d.ts.map +1 -0
- package/dist/src/commands/registry/registry-transport.constants.js +33 -0
- package/dist/src/commands/registry/registry-transport.constants.js.map +1 -0
- package/dist/src/commands/registry/whoami.command.d.ts.map +1 -1
- package/dist/src/commands/registry/whoami.command.js +2 -0
- package/dist/src/commands/registry/whoami.command.js.map +1 -1
- package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts +2 -0
- package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.d.ts.map +1 -0
- package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js +146 -0
- package/dist/src/modules/domain/credentials/__tests__/approver-user.module.test.js.map +1 -0
- package/dist/src/modules/domain/credentials/approver-user.module.d.ts +85 -0
- package/dist/src/modules/domain/credentials/approver-user.module.d.ts.map +1 -0
- package/dist/src/modules/domain/credentials/approver-user.module.js +92 -0
- package/dist/src/modules/domain/credentials/approver-user.module.js.map +1 -0
- package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts +2 -0
- package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.d.ts.map +1 -0
- package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js +111 -0
- package/dist/src/services/application/__tests__/app-bootstrap.approving-administrator.test.js.map +1 -0
- package/dist/src/services/application/__tests__/provider-package-links.service.test.js +68 -0
- package/dist/src/services/application/__tests__/provider-package-links.service.test.js.map +1 -1
- package/dist/src/services/application/app-bootstrap.service.d.ts +9 -0
- package/dist/src/services/application/app-bootstrap.service.d.ts.map +1 -1
- package/dist/src/services/application/app-bootstrap.service.js +30 -1
- package/dist/src/services/application/app-bootstrap.service.js.map +1 -1
- package/dist/src/services/application/application-runtime-bootstrap.service.d.ts +6 -0
- package/dist/src/services/application/application-runtime-bootstrap.service.d.ts.map +1 -1
- package/dist/src/services/application/application-runtime-bootstrap.service.js +41 -0
- package/dist/src/services/application/application-runtime-bootstrap.service.js.map +1 -1
- package/dist/src/services/application/provider-package-links.service.d.ts +30 -0
- package/dist/src/services/application/provider-package-links.service.d.ts.map +1 -1
- package/dist/src/services/application/provider-package-links.service.js +35 -3
- package/dist/src/services/application/provider-package-links.service.js.map +1 -1
- package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
- package/dist/src/services/application/provider-runtime-sync.service.js +4 -3
- package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
- package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
- package/dist/src/services/application/saas-skeleton.service.js +22 -2
- package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
- package/dist/src/services/companion/workbench-cli.service.js +10 -1
- package/dist/src/services/companion/workbench-cli.service.js.map +1 -1
- package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts +2 -0
- package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.d.ts.map +1 -0
- package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js +94 -0
- package/dist/src/services/credentials/__tests__/provider-contribution-registration.guard.test.js.map +1 -0
- package/dist/src/services/credentials/ci-secrets-adapter.service.d.ts.map +1 -1
- package/dist/src/services/credentials/ci-secrets-adapter.service.js +16 -0
- package/dist/src/services/credentials/ci-secrets-adapter.service.js.map +1 -1
- package/dist/src/services/credentials/composed-provider-catalogue.d.ts +34 -0
- package/dist/src/services/credentials/composed-provider-catalogue.d.ts.map +1 -1
- package/dist/src/services/credentials/composed-provider-catalogue.js +35 -0
- package/dist/src/services/credentials/composed-provider-catalogue.js.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.d.ts +27 -0
- package/dist/src/services/credentials/credentials.schemas.d.ts.map +1 -1
- package/dist/src/services/credentials/credentials.schemas.js +50 -0
- package/dist/src/services/credentials/credentials.schemas.js.map +1 -1
- package/dist/src/services/credentials/framework-managed-secrets.d.ts +1 -1
- package/dist/src/services/credentials/framework-managed-secrets.d.ts.map +1 -1
- package/dist/src/services/credentials/framework-managed-secrets.js +49 -8
- package/dist/src/services/credentials/framework-managed-secrets.js.map +1 -1
- package/dist/src/services/deployment/infra-writer.service.d.ts.map +1 -1
- package/dist/src/services/deployment/infra-writer.service.js +23 -4
- package/dist/src/services/deployment/infra-writer.service.js.map +1 -1
- package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js +45 -2
- package/dist/src/services/deployment/k8s/__tests__/k8s-bootstrap.service.test.js.map +1 -1
- package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts +23 -0
- package/dist/src/services/deployment/k8s/k8s-bootstrap.service.d.ts.map +1 -1
- package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js +49 -6
- package/dist/src/services/deployment/k8s/k8s-bootstrap.service.js.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-vars-builder.service.js +19 -0
- package/dist/src/services/environment/env-vars-builder.service.js.map +1 -1
- package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js +8 -0
- package/dist/src/services/framework/__tests__/engine-provider-specifications.reconciliation.test.js.map +1 -1
- package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js +17 -0
- package/dist/src/services/framework/__tests__/framework-knowledge-audit.live.contract.test.js.map +1 -1
- package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js +51 -0
- package/dist/src/services/framework/__tests__/framework-knowledge-audit.service.test.js.map +1 -1
- package/dist/src/services/framework/framework-knowledge-audit.service.d.ts +41 -1
- package/dist/src/services/framework/framework-knowledge-audit.service.d.ts.map +1 -1
- package/dist/src/services/framework/framework-knowledge-audit.service.js +90 -0
- package/dist/src/services/framework/framework-knowledge-audit.service.js.map +1 -1
- package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts +2 -0
- package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.d.ts.map +1 -0
- package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js +100 -0
- package/dist/src/services/framework/provider-transposition/__tests__/base-url-is-a-declared-env-slot.test.js.map +1 -0
- package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js +55 -2
- package/dist/src/services/framework/provider-transposition/__tests__/plan-matches-emit.test.js.map +1 -1
- package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts +9 -0
- package/dist/src/services/framework/provider-transposition/provider-package.emitter.d.ts.map +1 -1
- package/dist/src/services/framework/provider-transposition/provider-package.emitter.js +139 -19
- package/dist/src/services/framework/provider-transposition/provider-package.emitter.js.map +1 -1
- package/dist/src/services/frontend/cloudflare-cdn.service.d.ts.map +1 -1
- package/dist/src/services/frontend/cloudflare-cdn.service.js +33 -2
- package/dist/src/services/frontend/cloudflare-cdn.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/scripts/app-dependency-alignment/propagated-engine-overrides.json +13 -0
- package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +64 -16
- package/templates/saas/engine-peer-closure.json +12 -0
- package/templates/saas/scenarios/add-provider/scenario.json +11 -11
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/docusaurus.config.ts.hbs +34 -0
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/pages/auth/exchange.tsx +24 -1
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/theme/Root.tsx +22 -2
- package/templates/saas/skeleton/backend-api/package.json.hbs +1 -1
- package/templates/saas/skeleton/backend-api/src/companion-exports.ts +13 -2
- package/wildo-framework.info.json +1 -1
- package/templates/saas/scenarios/add-backend-provider/scenario.json +0 -17
- package/templates/saas/skeleton/backend-api/src/provider-contributions.ts +0 -44
|
@@ -35,5 +35,11 @@ export interface ApplicationRuntimeBootstrapResult {
|
|
|
35
35
|
}
|
|
36
36
|
export declare class ApplicationRuntimeBootstrapService {
|
|
37
37
|
static initialize(input: ApplicationRuntimeBootstrapInput): Promise<ApplicationRuntimeBootstrapResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Refuse to report materialization for a target whose `.env` is not on disk.
|
|
40
|
+
*
|
|
41
|
+
* @see the note at the call site for the defect this exists to prevent.
|
|
42
|
+
*/
|
|
43
|
+
private static assertRuntimeEnvOnDisk;
|
|
38
44
|
}
|
|
39
45
|
//# sourceMappingURL=application-runtime-bootstrap.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-runtime-bootstrap.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/application-runtime-bootstrap.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"application-runtime-bootstrap.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/application-runtime-bootstrap.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAElG,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AAK5G,MAAM,WAAW,gCAAgC;IAC/C,GAAG,EAAE,gCAAgC,CAAC;IACtC,WAAW,EAAE,sBAAsB,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iCAAiC;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,kCAAkC;WAChC,UAAU,CACrB,KAAK,EAAE,gCAAgC,GACtC,OAAO,CAAC,iCAAiC,CAAC;IA4H7C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CAsBtC"}
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* that boundary explicit prevents application processes from racing the
|
|
15
15
|
* database-owned identity/config/secrets records they consume at startup.
|
|
16
16
|
*/
|
|
17
|
+
import { existsSync } from 'node:fs';
|
|
18
|
+
import { join, relative } from 'node:path';
|
|
19
|
+
import { FILE_NAMES } from '../../infrastructure/io/io.schemas.js';
|
|
17
20
|
import { AppBootstrapService } from '../../services/application/app-bootstrap.service.js';
|
|
18
21
|
import { sync as envSync } from '../../services/environment/env-sync.service.js';
|
|
19
22
|
import { EnvironmentUtils } from '../../services/environment/environment.service.js';
|
|
@@ -88,10 +91,48 @@ export class ApplicationRuntimeBootstrapService {
|
|
|
88
91
|
// rather than an existence assertion (issue #97).
|
|
89
92
|
managedDeclaration: prepared.runtimeTarget.managedDeclaration,
|
|
90
93
|
});
|
|
94
|
+
/*
|
|
95
|
+
* The claim below says "materialized". Make it TRUE rather than hopeful.
|
|
96
|
+
*
|
|
97
|
+
* Every target here is a process that reads its `.env` at startup and fails without it, so
|
|
98
|
+
* "materialized" has to mean the file is on disk — not that a writer was invoked. Until
|
|
99
|
+
* 2026-09-10 it meant the second: the application env writes were gated on framework-developer
|
|
100
|
+
* mode, so an app-creator application was told "1 backend, 1 companion, 1 frontend materialized"
|
|
101
|
+
* with zero `.env` files written, and the failure surfaced much later and somewhere else — the
|
|
102
|
+
* companion dying on `APPLICATION_ID ... undefined` inside `pnpm --parallel`, which took the
|
|
103
|
+
* rest of the stack down with it and named nothing.
|
|
104
|
+
*
|
|
105
|
+
* A postcondition here is worth more than a checker: it fires in the run that caused it, names
|
|
106
|
+
* the files, and cannot be true-by-accident. It also guards the reverse direction — a project
|
|
107
|
+
* that never completed `wildo local init` now says so here instead of compiling happily and
|
|
108
|
+
* running nothing.
|
|
109
|
+
*/
|
|
110
|
+
ApplicationRuntimeBootstrapService.assertRuntimeEnvOnDisk([...applicationBackends, ...companionApis, ...applicationFrontends,
|
|
111
|
+
...applicationWorkers, ...applicationMinions], input.log);
|
|
91
112
|
input.log.success(` Application runtime materialized: ${result.backendCount} backend, `
|
|
92
113
|
+ `${result.companionCount} companion, ${result.frontendCount} frontend, `
|
|
93
114
|
+ `${result.workerCount} worker, ${result.minionCount} minion target(s).`);
|
|
94
115
|
return result;
|
|
95
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Refuse to report materialization for a target whose `.env` is not on disk.
|
|
119
|
+
*
|
|
120
|
+
* @see the note at the call site for the defect this exists to prevent.
|
|
121
|
+
*/
|
|
122
|
+
static assertRuntimeEnvOnDisk(targets, log) {
|
|
123
|
+
const missing = targets
|
|
124
|
+
.map((target) => join(target.applicationRoot, target.relativeDir, FILE_NAMES.DOT_ENV))
|
|
125
|
+
.filter((path) => !existsSync(path));
|
|
126
|
+
if (missing.length === 0) {
|
|
127
|
+
log.info(` Runtime env verified on disk for ${targets.length} target(s).`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const applicationRoot = targets[0]?.applicationRoot ?? process.cwd();
|
|
131
|
+
throw new Error(`Application runtime env is missing for ${missing.length} of ${targets.length} target(s):\n`
|
|
132
|
+
+ `${missing.map((path) => ` - ${relative(applicationRoot, path) || path}`).join('\n')}\n`
|
|
133
|
+
+ 'Each of these is read at process startup, so the application would compile and then fail to '
|
|
134
|
+
+ 'run with an unrelated-looking validation error. Re-run `wildo local init` for this '
|
|
135
|
+
+ 'application; if it persists, the env generator did not receive this target.');
|
|
136
|
+
}
|
|
96
137
|
}
|
|
97
138
|
//# sourceMappingURL=application-runtime-bootstrap.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-runtime-bootstrap.service.js","sourceRoot":"","sources":["../../../../src/services/application/application-runtime-bootstrap.service.ts"],"names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KAAK,CAAC,GAAG,CACV,CAAC;QAEF,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;QACjG,MAAM,4CAA4C,CAAC,cAAc,CAAC;YAChE,GAAG,EAAE,WAAW;YAChB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,OAAO;YACvC,2FAA2F;YAC3F,kDAAkD;YAClD,kBAAkB,EAAE,QAAQ,CAAC,aAAa,CAAC,kBAAkB;SAC9D,CAAC,CAAC;QAEH,KAAK,CAAC,GAAG,CAAC,OAAO,CACf,uCAAuC,MAAM,CAAC,YAAY,YAAY;cACpE,GAAG,MAAM,CAAC,cAAc,eAAe,MAAM,CAAC,aAAa,aAAa;cACxE,GAAG,MAAM,CAAC,WAAW,YAAY,MAAM,CAAC,WAAW,oBAAoB,CAC1E,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/**\n * Canonical application-runtime bootstrap orchestration.\n *\n * This service is the single local lifecycle seam that turns an authored SaaS\n * application declaration into runnable process configuration:\n *\n * apps-manager registration by stable slug\n * -> bootstrap credential fetch\n * -> derived APPLICATION_ID persistence\n * -> backend/companion/frontend/worker/minion target projection\n * -> generated env materialization\n *\n * Callers must make apps-manager ready before entering this service. Keeping\n * that boundary explicit prevents application processes from racing the\n * database-owned identity/config/secrets records they consume at startup.\n */\n\nimport type { Logger } from '~wildo-cli/kernel/types';\nimport { AppBootstrapService } from '~wildo-cli/services/application/app-bootstrap.service';\nimport type { PlatformEnvSecretsJson } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { sync as envSync } from '~wildo-cli/services/environment/env-sync.service';\nimport type { PlatformEnvironmentConfiguration } from '~wildo-cli/services/environment/environment.schemas';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { hydrateEnvironmentFromConfig } from '~wildo-cli/services/environment/environment-hydration.utils';\nimport { ApplicationInitializationVerificationService } from './application-initialization-verification.service';\n\nexport interface ApplicationRuntimeBootstrapInput {\n env: PlatformEnvironmentConfiguration;\n credentials: PlatformEnvSecretsJson;\n frameworkPath: string;\n saasRoot: string;\n isFrameworkDeveloper: boolean;\n requestedAppSlug?: string | undefined;\n log: Logger;\n}\n\nexport interface ApplicationRuntimeBootstrapResult {\n backendCount: number;\n companionCount: number;\n frontendCount: number;\n workerCount: number;\n minionCount: number;\n}\n\nexport class ApplicationRuntimeBootstrapService {\n static async initialize(\n input: ApplicationRuntimeBootstrapInput,\n ): Promise<ApplicationRuntimeBootstrapResult> {\n const config = EnvironmentUtils.loadConfigJson(input.env.name);\n if (!config) {\n throw new Error(`No config for '${input.env.name}'. Run 'wildo setup' first.`);\n }\n\n /**\n * Reconcile the caller's environment record against `config.json` before any target is\n * projected from it. The record is a registry CACHE that persists only a subset of the\n * authored environment, so an identity field authored since the last write reads as\n * `undefined` here and every generator silently takes its default — see the contract on\n * {@link hydrateEnvironmentFromConfig} for what that cost when the default was `http`\n * against a TLS dev edge.\n */\n const resolvedEnv = hydrateEnvironmentFromConfig(input.env, config);\n\n const registeredTargetInput = {\n env: resolvedEnv,\n credentials: input.credentials,\n saasRoot: input.saasRoot,\n config,\n requestedAppSlug: input.requestedAppSlug,\n };\n\n input.log.info(' Registering application once and materializing every runtime target from one snapshot...');\n\n const prepared = await AppBootstrapService.prepareApplicationEnvTargets(registeredTargetInput);\n if (!prepared) {\n throw new Error(\n 'Application bootstrap resolved no application target. Check wildo.saas.config.ts and the selected application slug.',\n );\n }\n const projectionInput = { ...registeredTargetInput, prepared };\n\n // These builders are projections over the same prepared registration/credential generation. They no\n // longer make independent initialize + credential-fetch requests, so a single logical bootstrap cannot\n // mix observations from multiple control-plane generations.\n const applicationBackends = await AppBootstrapService.buildApplicationBackendTargets(\n projectionInput,\n );\n const companionApis = await AppBootstrapService.buildApplicationCompanionTargets(\n projectionInput,\n );\n const applicationWorkers = await AppBootstrapService.buildApplicationWorkerTargets(\n projectionInput,\n );\n const applicationMinions = await AppBootstrapService.buildApplicationMinionTargets(\n projectionInput,\n );\n const applicationFrontends = await AppBootstrapService.buildApplicationFrontendTargets({\n saasRoot: input.saasRoot,\n requestedAppSlug: input.requestedAppSlug,\n prepared,\n });\n\n const result: ApplicationRuntimeBootstrapResult = {\n backendCount: applicationBackends.length,\n companionCount: companionApis.length,\n frontendCount: applicationFrontends.length,\n workerCount: applicationWorkers.length,\n minionCount: applicationMinions.length,\n };\n const targetCount = Object.values(result).reduce((total, count) => total + count, 0);\n if (targetCount === 0) {\n throw new Error(\n 'Application bootstrap resolved no runtime targets. Check wildo.saas.config.ts and the selected application slug.',\n );\n }\n\n await envSync(\n resolvedEnv,\n input.credentials,\n {\n frameworkPath: input.frameworkPath,\n isFrameworkDeveloper: input.isFrameworkDeveloper,\n applicationBackends,\n companionApis,\n applicationFrontends,\n applicationWorkers,\n applicationMinions,\n },\n input.log,\n );\n\n input.log.info(' Verifying the registered platform JWT door and managed application config...');\n await ApplicationInitializationVerificationService.assertCoherent({\n env: resolvedEnv,\n credentials: input.credentials,\n appSlug: prepared.runtimeTarget.appSlug,\n // The declaration this run initialized against — what makes the postcondition a COMPARISON\n // rather than an existence assertion (issue #97).\n managedDeclaration: prepared.runtimeTarget.managedDeclaration,\n });\n\n input.log.success(\n ` Application runtime materialized: ${result.backendCount} backend, `\n + `${result.companionCount} companion, ${result.frontendCount} frontend, `\n + `${result.workerCount} worker, ${result.minionCount} minion target(s).`,\n );\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application-runtime-bootstrap.service.js","sourceRoot":"","sources":["../../../../src/services/application/application-runtime-bootstrap.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAA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eAAe,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,eAAe,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CACb,0CAA0C,OAAO,CAAC,MAAM,OAAO,OAAO,CAAC,MAAM,eAAe;cAC1F,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,QAAQ,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;cACzF,8FAA8F;cAC9F,qFAAqF;cACrF,6EAA6E,CAChF,CAAC;IACJ,CAAC;CACF","sourcesContent":["/**\n * Canonical application-runtime bootstrap orchestration.\n *\n * This service is the single local lifecycle seam that turns an authored SaaS\n * application declaration into runnable process configuration:\n *\n * apps-manager registration by stable slug\n * -> bootstrap credential fetch\n * -> derived APPLICATION_ID persistence\n * -> backend/companion/frontend/worker/minion target projection\n * -> generated env materialization\n *\n * Callers must make apps-manager ready before entering this service. Keeping\n * that boundary explicit prevents application processes from racing the\n * database-owned identity/config/secrets records they consume at startup.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join, relative } from 'node:path';\n\nimport { FILE_NAMES } from '~wildo-cli/infrastructure/io/io.schemas';\nimport type { Logger } from '~wildo-cli/kernel/types';\nimport { AppBootstrapService } from '~wildo-cli/services/application/app-bootstrap.service';\nimport type { PlatformEnvSecretsJson } from '~wildo-cli/services/credentials/credentials.schemas';\nimport { sync as envSync } from '~wildo-cli/services/environment/env-sync.service';\nimport type { PlatformEnvironmentConfiguration } from '~wildo-cli/services/environment/environment.schemas';\nimport { EnvironmentUtils } from '~wildo-cli/services/environment/environment.service';\nimport { hydrateEnvironmentFromConfig } from '~wildo-cli/services/environment/environment-hydration.utils';\nimport { ApplicationInitializationVerificationService } from './application-initialization-verification.service';\n\nexport interface ApplicationRuntimeBootstrapInput {\n env: PlatformEnvironmentConfiguration;\n credentials: PlatformEnvSecretsJson;\n frameworkPath: string;\n saasRoot: string;\n isFrameworkDeveloper: boolean;\n requestedAppSlug?: string | undefined;\n log: Logger;\n}\n\nexport interface ApplicationRuntimeBootstrapResult {\n backendCount: number;\n companionCount: number;\n frontendCount: number;\n workerCount: number;\n minionCount: number;\n}\n\nexport class ApplicationRuntimeBootstrapService {\n static async initialize(\n input: ApplicationRuntimeBootstrapInput,\n ): Promise<ApplicationRuntimeBootstrapResult> {\n const config = EnvironmentUtils.loadConfigJson(input.env.name);\n if (!config) {\n throw new Error(`No config for '${input.env.name}'. Run 'wildo setup' first.`);\n }\n\n /**\n * Reconcile the caller's environment record against `config.json` before any target is\n * projected from it. The record is a registry CACHE that persists only a subset of the\n * authored environment, so an identity field authored since the last write reads as\n * `undefined` here and every generator silently takes its default — see the contract on\n * {@link hydrateEnvironmentFromConfig} for what that cost when the default was `http`\n * against a TLS dev edge.\n */\n const resolvedEnv = hydrateEnvironmentFromConfig(input.env, config);\n\n const registeredTargetInput = {\n env: resolvedEnv,\n credentials: input.credentials,\n saasRoot: input.saasRoot,\n config,\n requestedAppSlug: input.requestedAppSlug,\n };\n\n input.log.info(' Registering application once and materializing every runtime target from one snapshot...');\n\n const prepared = await AppBootstrapService.prepareApplicationEnvTargets(registeredTargetInput);\n if (!prepared) {\n throw new Error(\n 'Application bootstrap resolved no application target. Check wildo.saas.config.ts and the selected application slug.',\n );\n }\n const projectionInput = { ...registeredTargetInput, prepared };\n\n // These builders are projections over the same prepared registration/credential generation. They no\n // longer make independent initialize + credential-fetch requests, so a single logical bootstrap cannot\n // mix observations from multiple control-plane generations.\n const applicationBackends = await AppBootstrapService.buildApplicationBackendTargets(\n projectionInput,\n );\n const companionApis = await AppBootstrapService.buildApplicationCompanionTargets(\n projectionInput,\n );\n const applicationWorkers = await AppBootstrapService.buildApplicationWorkerTargets(\n projectionInput,\n );\n const applicationMinions = await AppBootstrapService.buildApplicationMinionTargets(\n projectionInput,\n );\n const applicationFrontends = await AppBootstrapService.buildApplicationFrontendTargets({\n saasRoot: input.saasRoot,\n requestedAppSlug: input.requestedAppSlug,\n prepared,\n });\n\n const result: ApplicationRuntimeBootstrapResult = {\n backendCount: applicationBackends.length,\n companionCount: companionApis.length,\n frontendCount: applicationFrontends.length,\n workerCount: applicationWorkers.length,\n minionCount: applicationMinions.length,\n };\n const targetCount = Object.values(result).reduce((total, count) => total + count, 0);\n if (targetCount === 0) {\n throw new Error(\n 'Application bootstrap resolved no runtime targets. Check wildo.saas.config.ts and the selected application slug.',\n );\n }\n\n await envSync(\n resolvedEnv,\n input.credentials,\n {\n frameworkPath: input.frameworkPath,\n isFrameworkDeveloper: input.isFrameworkDeveloper,\n applicationBackends,\n companionApis,\n applicationFrontends,\n applicationWorkers,\n applicationMinions,\n },\n input.log,\n );\n\n input.log.info(' Verifying the registered platform JWT door and managed application config...');\n await ApplicationInitializationVerificationService.assertCoherent({\n env: resolvedEnv,\n credentials: input.credentials,\n appSlug: prepared.runtimeTarget.appSlug,\n // The declaration this run initialized against — what makes the postcondition a COMPARISON\n // rather than an existence assertion (issue #97).\n managedDeclaration: prepared.runtimeTarget.managedDeclaration,\n });\n\n /*\n * The claim below says \"materialized\". Make it TRUE rather than hopeful.\n *\n * Every target here is a process that reads its `.env` at startup and fails without it, so\n * \"materialized\" has to mean the file is on disk — not that a writer was invoked. Until\n * 2026-09-10 it meant the second: the application env writes were gated on framework-developer\n * mode, so an app-creator application was told \"1 backend, 1 companion, 1 frontend materialized\"\n * with zero `.env` files written, and the failure surfaced much later and somewhere else — the\n * companion dying on `APPLICATION_ID ... undefined` inside `pnpm --parallel`, which took the\n * rest of the stack down with it and named nothing.\n *\n * A postcondition here is worth more than a checker: it fires in the run that caused it, names\n * the files, and cannot be true-by-accident. It also guards the reverse direction — a project\n * that never completed `wildo local init` now says so here instead of compiling happily and\n * running nothing.\n */\n ApplicationRuntimeBootstrapService.assertRuntimeEnvOnDisk(\n [...applicationBackends, ...companionApis, ...applicationFrontends,\n ...applicationWorkers, ...applicationMinions],\n input.log,\n );\n\n input.log.success(\n ` Application runtime materialized: ${result.backendCount} backend, `\n + `${result.companionCount} companion, ${result.frontendCount} frontend, `\n + `${result.workerCount} worker, ${result.minionCount} minion target(s).`,\n );\n return result;\n }\n\n /**\n * Refuse to report materialization for a target whose `.env` is not on disk.\n *\n * @see the note at the call site for the defect this exists to prevent.\n */\n private static assertRuntimeEnvOnDisk(\n targets: readonly { applicationRoot: string; relativeDir: string }[],\n log: Logger,\n ): void {\n const missing = targets\n .map((target) => join(target.applicationRoot, target.relativeDir, FILE_NAMES.DOT_ENV))\n .filter((path) => !existsSync(path));\n\n if (missing.length === 0) {\n log.info(` Runtime env verified on disk for ${targets.length} target(s).`);\n return;\n }\n\n const applicationRoot = targets[0]?.applicationRoot ?? process.cwd();\n throw new Error(\n `Application runtime env is missing for ${missing.length} of ${targets.length} target(s):\\n`\n + `${missing.map((path) => ` - ${relative(applicationRoot, path) || path}`).join('\\n')}\\n`\n + 'Each of these is read at process startup, so the application would compile and then fail to '\n + 'run with an unrelated-looking validation error. Re-run `wildo local init` for this '\n + 'application; if it persists, the env generator did not receive this target.',\n );\n }\n}\n"]}
|
|
@@ -5,6 +5,36 @@
|
|
|
5
5
|
* equal today and are allowed to stop being — a package that stops publishing is still linked.
|
|
6
6
|
*/
|
|
7
7
|
export declare const PROVIDER_PACKAGE_NAME_PREFIX = "@wildo-ai/provider-";
|
|
8
|
+
/**
|
|
9
|
+
* The SCRAPED CATALOGUE package — one name, hundreds of vendors behind subpath exports.
|
|
10
|
+
*
|
|
11
|
+
* This service was built (issue #334, slice S6) against a population of `@wildo-ai/provider-<ref>`
|
|
12
|
+
* packages, one per vendor, and its whole design argument is that population's size: *"at two
|
|
13
|
+
* hundred provider packages every scaffolded application would carry two hundred `file:` links to
|
|
14
|
+
* packages it never imports."* That shape was REVERSED on 2026-09-06 in favour of one package with
|
|
15
|
+
* a subpath per vendor, and nothing here followed.
|
|
16
|
+
*
|
|
17
|
+
* Measured 2026-09-09: **no `@wildo-ai/provider-<ref>` package exists anywhere in the repository**,
|
|
18
|
+
* while both dogfood applications declare `@wildo-ai/providers`. So the prefix above matched
|
|
19
|
+
* nothing, at both production call sites, on every run — the service executed, found zero declared
|
|
20
|
+
* providers, and reported success. An application adding its first catalogue provider through
|
|
21
|
+
* `wildo compose add-provider` got the dependency and no override, and its next `pnpm install`
|
|
22
|
+
* could not resolve the package. That is not hypothetical: it is what made the ten providers
|
|
23
|
+
* declared in Wonder Todos on 2026-09-09 need a hand-written override.
|
|
24
|
+
*
|
|
25
|
+
* The PREFIX is kept rather than replaced. It still answers the question this service exists for —
|
|
26
|
+
* "is this a provider package an application declared" — for an application-owned or future
|
|
27
|
+
* per-vendor package, and the two forms are matched by one predicate so neither call site has to
|
|
28
|
+
* remember both.
|
|
29
|
+
*/
|
|
30
|
+
export declare const PROVIDER_CATALOGUE_PACKAGE_NAME = "@wildo-ai/providers";
|
|
31
|
+
/**
|
|
32
|
+
* Whether a declared dependency name is a provider package this service links.
|
|
33
|
+
*
|
|
34
|
+
* A PREDICATE rather than a prefix test, because there are now two shapes and a call site that
|
|
35
|
+
* remembers only one is exactly how this service came to match nothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isProviderPackageName(name: string): boolean;
|
|
8
38
|
/** A framework workspace member: its package name and its absolute root. */
|
|
9
39
|
export interface FrameworkWorkspacePackage {
|
|
10
40
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-package-links.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/provider-package-links.service.ts"],"names":[],"mappings":"AA0CA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE,4EAA4E;AAC5E,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,E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B,EAAE,MAAM,CAAC;QACzB,KAAK,EAAE,OAAO,CAAC;KAChB,GAAG,iCAAiC;IAoCrC;;;;;;;OAOG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE;QAC/B,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,GAAG,EAAE;YAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;YAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;SAAE,CAAC;KAC3E,GAAG,iCAAiC;IAuCrC;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,qCAAqC;IAwBpD,OAAO,CAAC,MAAM,CAAC,YAAY;IAK3B,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAGlC"}
|
|
1
|
+
{"version":3,"file":"provider-package-links.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/provider-package-links.service.ts"],"names":[],"mappings":"AA0CA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,wBAAwB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,4EAA4E;AAC5E,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAmB5G;AAYD,+EAA+E;AAC/E,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,2FAA2F;IAC3F,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iCAAiC;IAChD,6DAA6D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,GAAG,IAAI,CAAC;QAC7B,GAAG,EAAE;YAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;YAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;SAAE,CAAC;KAC3E,GAAG,iCAAiC;IAuCrC;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,qCAAqC;IAwBpD,OAAO,CAAC,MAAM,CAAC,YAAY;IAK3B,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAGlC"}
|
|
@@ -46,6 +46,38 @@ import { parse as parseYaml } from 'yaml';
|
|
|
46
46
|
* equal today and are allowed to stop being — a package that stops publishing is still linked.
|
|
47
47
|
*/
|
|
48
48
|
export const PROVIDER_PACKAGE_NAME_PREFIX = '@wildo-ai/provider-';
|
|
49
|
+
/**
|
|
50
|
+
* The SCRAPED CATALOGUE package — one name, hundreds of vendors behind subpath exports.
|
|
51
|
+
*
|
|
52
|
+
* This service was built (issue #334, slice S6) against a population of `@wildo-ai/provider-<ref>`
|
|
53
|
+
* packages, one per vendor, and its whole design argument is that population's size: *"at two
|
|
54
|
+
* hundred provider packages every scaffolded application would carry two hundred `file:` links to
|
|
55
|
+
* packages it never imports."* That shape was REVERSED on 2026-09-06 in favour of one package with
|
|
56
|
+
* a subpath per vendor, and nothing here followed.
|
|
57
|
+
*
|
|
58
|
+
* Measured 2026-09-09: **no `@wildo-ai/provider-<ref>` package exists anywhere in the repository**,
|
|
59
|
+
* while both dogfood applications declare `@wildo-ai/providers`. So the prefix above matched
|
|
60
|
+
* nothing, at both production call sites, on every run — the service executed, found zero declared
|
|
61
|
+
* providers, and reported success. An application adding its first catalogue provider through
|
|
62
|
+
* `wildo compose add-provider` got the dependency and no override, and its next `pnpm install`
|
|
63
|
+
* could not resolve the package. That is not hypothetical: it is what made the ten providers
|
|
64
|
+
* declared in Wonder Todos on 2026-09-09 need a hand-written override.
|
|
65
|
+
*
|
|
66
|
+
* The PREFIX is kept rather than replaced. It still answers the question this service exists for —
|
|
67
|
+
* "is this a provider package an application declared" — for an application-owned or future
|
|
68
|
+
* per-vendor package, and the two forms are matched by one predicate so neither call site has to
|
|
69
|
+
* remember both.
|
|
70
|
+
*/
|
|
71
|
+
export const PROVIDER_CATALOGUE_PACKAGE_NAME = '@wildo-ai/providers';
|
|
72
|
+
/**
|
|
73
|
+
* Whether a declared dependency name is a provider package this service links.
|
|
74
|
+
*
|
|
75
|
+
* A PREDICATE rather than a prefix test, because there are now two shapes and a call site that
|
|
76
|
+
* remembers only one is exactly how this service came to match nothing.
|
|
77
|
+
*/
|
|
78
|
+
export function isProviderPackageName(name) {
|
|
79
|
+
return name === PROVIDER_CATALOGUE_PACKAGE_NAME || name.startsWith(PROVIDER_PACKAGE_NAME_PREFIX);
|
|
80
|
+
}
|
|
49
81
|
/**
|
|
50
82
|
* Resolve every framework workspace member's package name → absolute root.
|
|
51
83
|
*
|
|
@@ -94,7 +126,7 @@ export class ProviderPackageLinksService {
|
|
|
94
126
|
continue;
|
|
95
127
|
for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
|
|
96
128
|
for (const name of Object.keys(manifest[field] ?? {})) {
|
|
97
|
-
if (name
|
|
129
|
+
if (isProviderPackageName(name))
|
|
98
130
|
declared.add(name);
|
|
99
131
|
}
|
|
100
132
|
}
|
|
@@ -182,7 +214,7 @@ export class ProviderPackageLinksService {
|
|
|
182
214
|
added.push({ packageName, overrideValue });
|
|
183
215
|
}
|
|
184
216
|
const surplus = Object.keys(existing)
|
|
185
|
-
.filter((name) => name
|
|
217
|
+
.filter((name) => isProviderPackageName(name))
|
|
186
218
|
.filter((name) => !(name in overrides))
|
|
187
219
|
.sort();
|
|
188
220
|
if (input.write && added.length > 0) {
|
|
@@ -259,7 +291,7 @@ export class ProviderPackageLinksService {
|
|
|
259
291
|
for (const [name, version] of Object.entries(rootManifest?.pnpm?.overrides ?? {})) {
|
|
260
292
|
if (!name.startsWith('@wildo-ai/'))
|
|
261
293
|
continue;
|
|
262
|
-
if (name
|
|
294
|
+
if (isProviderPackageName(name))
|
|
263
295
|
continue;
|
|
264
296
|
if (version.startsWith('file:') || version.startsWith('link:'))
|
|
265
297
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-package-links.service.js","sourceRoot":"","sources":["../../../../src/services/application/provider-package-links.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC;AAQlE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAAC,aAAqB;IAClE,MAAM,SAAS,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,qBAAqB,CAAC,EAAE,MAAM,CAAC,CAA4B,CAAC;IACzH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC9D,KAAK,MAAM,aAAa,IAAI,SAAS,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;QACrD,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC7C,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5D,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aA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;QACH,CAAC;QACD,MAAM,YAAY,GAAG,2BAA2B,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;QAC3G,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC;YAClF,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;gBAAE,SAAS;YAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC;gBAAE,SAAS;YAC5D,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;gBAAE,SAAS;YACzE,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,IAAI,KAAK,CACb,0GAA0G;cACxG,0FAA0F,CAC7F,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,YAAY,CAAC,YAAoB;QAC9C,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YAAE,OAAO,IAAI,CAAC;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAyB,CAAC;IAChF,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAAC,IAAY;QAC5C,OAAO,WAAW,CAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtH,CAAC;CACF","sourcesContent":["/**\n * ProviderPackageLinksService — resolve an application's DECLARED provider packages, and nothing\n * else (plan D7, slice S6, issue #334).\n *\n * ## The problem this closes\n *\n * `frameworkFileLinkPackages` is the set of framework packages every scaffolded application links,\n * and in framework-developer mode every name in it becomes a `file:` override in the application's\n * root manifest. That is correct for the framework core — an application uses all of it — and it\n * does not survive the provider population: at two hundred provider packages every scaffolded\n * application would carry two hundred `file:` links to packages it never imports, and\n * `saas-skeleton.service.ts` would THROW for any name the workspace could not produce.\n *\n * So the two populations are resolved differently, and the difference is not a size optimisation —\n * it is what each list MEANS:\n *\n * - the framework core is a CURATION: the packages an application always has. It stays authored in\n * `propagated-engine-overrides.json`, because \"which of them\" is a decision;\n * - the providers are a POPULATION: `@wildo-ai/provider-<ref>`, one per provider, generated by the\n * packager. \"Which of them does THIS application link\" has exactly one honest answer — the ones\n * its own manifests declare. Nothing needs to list them, and a list would rot the way issue #161\n * measured (a hand-kept sibling list at 37 of 155 names).\n *\n * ## Why the DECLARATION is the source\n *\n * A provider reaches an application by exactly one route: a dependency in one of the application's\n * own package manifests, written by `wildo compose add-provider` (the `package-dependency-add`\n * composition edit kind). Deriving the link set from those declarations means the application says\n * what it uses once, in the place npm itself reads, and the override follows mechanically. The\n * alternative — a second per-application list of \"linked providers\" — would be a copy that can\n * disagree with the manifests, which is the defect this slice removes rather than relocates.\n *\n * ## What it never does\n *\n * It never REMOVES an override. An override the application authored, or one left behind by a\n * provider it has since dropped, is authored content; removing it silently is how a reconciler\n * becomes an outage. Surplus is reported by the caller, never repaired here.\n */\nimport { existsSync, readFileSync, readdirSync, writeFileSync } from 'fs';\nimport { join, relative, sep } from 'path';\nimport { parse as parseYaml } from 'yaml';\n\n/**\n * The npm-name prefix of a provider package (plan D3). Deliberately duplicated from the publish\n * lane's `PUBLISHED_PROVIDER_PACKAGE_NAME_PREFIX` rather than imported: that constant answers \"does\n * this package publish\", this one answers \"is this a provider an application declared\". They are\n * equal today and are allowed to stop being — a package that stops publishing is still linked.\n */\nexport const PROVIDER_PACKAGE_NAME_PREFIX = '@wildo-ai/provider-';\n\n/** A framework workspace member: its package name and its absolute root. */\nexport interface FrameworkWorkspacePackage {\n name: string;\n root: string;\n}\n\n/**\n * Resolve every framework workspace member's package name → absolute root.\n *\n * Lives here rather than in `saas-skeleton.service.ts` because two callers now need it — the\n * scaffolder, and the provider-link reconciliation `wildo compose` runs — and a second copy of a\n * workspace reader is a second answer to \"what packages does the framework carry\".\n *\n * The one-level trailing glob stays supported here even though `pnpm-workspace.yaml` uses explicit\n * entries today: that file records the measurement (two repo-root readers refuse or silently drop a\n * wildcard), and when they are fixed this reader must not be the thing that has to change too.\n */\nexport function readFrameworkWorkspacePackages(frameworkPath: string): Map<string, FrameworkWorkspacePackage> {\n const workspace = parseYaml(readFileSync(join(frameworkPath, 'pnpm-workspace.yaml'), 'utf8')) as { packages?: string[] };\n const packages = new Map<string, FrameworkWorkspacePackage>();\n for (const memberPattern of workspace.packages ?? []) {\n const candidates = memberPattern.endsWith('/*')\n ? (existsSync(join(frameworkPath, memberPattern.slice(0, -2)))\n ? readdirSync(join(frameworkPath, memberPattern.slice(0, -2)), { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => join(memberPattern.slice(0, -2), entry.name))\n : [])\n : [memberPattern];\n for (const memberRelative of candidates) {\n const manifestPath = join(frameworkPath, memberRelative, 'package.json');\n if (!existsSync(manifestPath)) continue;\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: string };\n if (manifest.name) packages.set(manifest.name, { name: manifest.name, root: join(frameworkPath, memberRelative) });\n }\n }\n return packages;\n}\n\ninterface PackageManifestShape {\n name?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n pnpm?: { overrides?: Record<string, string> };\n [key: string]: unknown;\n}\n\n/** One provider override the reconciliation added or found already correct. */\nexport interface ProviderPackageLinkOutcome {\n packageName: string;\n /** `file:<relative path>` in framework-developer mode, the framework version otherwise. */\n overrideValue: string;\n}\n\nexport interface ProviderPackageLinkReconciliation {\n /** Providers the application's manifests declare, sorted. */\n declared: string[];\n /** Overrides written (or that would be written on a dry run). */\n added: ProviderPackageLinkOutcome[];\n /** Declared providers whose override already carries exactly this value. */\n alreadyLinked: ProviderPackageLinkOutcome[];\n /**\n * Declared providers that could not be resolved — no workspace member of that name in\n * framework-developer mode. Reported, never thrown: a declaration for a provider that has not\n * been generated yet is a state an operator can be in, and refusing the whole reconciliation\n * would take every OTHER provider's link down with it.\n */\n unresolved: string[];\n /**\n * Provider overrides present in the root manifest that no manifest declares any more. Reported\n * only — see the header: this service never removes an override.\n */\n surplus: string[];\n}\n\nexport class ProviderPackageLinksService {\n /**\n * The provider package names an application's own workspace manifests declare.\n *\n * Every dependency field is scanned, not just `dependencies`: a provider reached only from a\n * test or a build step is declared as a devDependency and still has to resolve.\n */\n static discoverDeclaredProviderPackages(applicationRoot: string): string[] {\n const declared = new Set<string>();\n for (const member of ProviderPackageLinksService.discoverApplicationWorkspaceMembers(applicationRoot)) {\n const manifest = ProviderPackageLinksService.readManifest(join(applicationRoot, member, 'package.json'));\n if (!manifest) continue;\n for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'] as const) {\n for (const name of Object.keys(manifest[field] ?? {})) {\n if (name.startsWith(PROVIDER_PACKAGE_NAME_PREFIX)) declared.add(name);\n }\n }\n }\n return [...declared].sort();\n }\n\n /**\n * The application's own workspace members, plus its root.\n *\n * `.wildo-saas/` members are skipped for the same reason the standalone alignment service skips\n * them: the companion drop's manifest is REWRITTEN on every start, so anything reconciled into it\n * is erased and the reconciler would report the same drift forever.\n */\n static discoverApplicationWorkspaceMembers(applicationRoot: string): string[] {\n const workspacePath = join(applicationRoot, 'pnpm-workspace.yaml');\n const declared = existsSync(workspacePath)\n ? ((parseYaml(readFileSync(workspacePath, 'utf8')) as { packages?: string[] } | null)?.packages ?? [])\n : [];\n const expanded: string[] = ['.'];\n for (const member of declared) {\n if (member.startsWith('.wildo-saas/')) continue;\n // A trailing one-level glob is the only glob shape an application workspace uses.\n if (member.endsWith('/*')) {\n const base = join(applicationRoot, member.slice(0, -2));\n if (!existsSync(base)) continue;\n for (const entry of ProviderPackageLinksService.readDirectoryNames(base)) expanded.push(`${member.slice(0, -2)}/${entry}`);\n continue;\n }\n expanded.push(member);\n }\n return expanded.filter((member) => existsSync(join(applicationRoot, member, 'package.json')));\n }\n\n /**\n * Compute the provider overrides an application needs, given what it declares.\n *\n * `frameworkWorkspacePackages` is the framework checkout's member map in framework-developer\n * mode; pass `null` for app-creator mode, where a provider resolves to the framework version like\n * every other `@wildo-ai/*` package.\n */\n static resolveProviderOverrides(input: {\n applicationRoot: string;\n frameworkWorkspacePackages: Map<string, { root: string }> | null;\n frameworkVersion: string;\n }): { overrides: Record<string, string>; declared: string[]; unresolved: string[] } {\n const declared = ProviderPackageLinksService.discoverDeclaredProviderPackages(input.applicationRoot);\n const overrides: Record<string, string> = {};\n const unresolved: string[] = [];\n\n for (const packageName of declared) {\n if (input.frameworkWorkspacePackages === null) {\n overrides[packageName] = input.frameworkVersion;\n continue;\n }\n const workspacePackage = input.frameworkWorkspacePackages.get(packageName);\n if (!workspacePackage) {\n unresolved.push(packageName);\n continue;\n }\n const relativePath = relative(input.applicationRoot, workspacePackage.root);\n // pnpm reads a POSIX specifier; `relative` yields the host separator on Windows.\n overrides[packageName] = `file:${relativePath.split(sep).join('/')}`;\n }\n\n return { overrides, declared, unresolved };\n }\n\n /**\n * Merge the resolved provider overrides into the application ROOT manifest.\n *\n * Merge, never replace, and sorted like every other writer of this block (`wildo init`, `wildo\n * align-deps`, the framework alignment script) so a later reconciliation reorders nothing and the\n * diff stays reviewable.\n */\n static reconcileApplicationProviderLinks(input: {\n applicationRoot: string;\n frameworkWorkspacePackages: Map<string, { root: string }> | null;\n frameworkVersion: string;\n write: boolean;\n }): ProviderPackageLinkReconciliation {\n const { overrides, declared, unresolved } = ProviderPackageLinksService.resolveProviderOverrides(input);\n const rootManifestPath = join(input.applicationRoot, 'package.json');\n const rootManifest = ProviderPackageLinksService.readManifest(rootManifestPath);\n if (!rootManifest) {\n throw new Error(`No package.json at ${rootManifestPath} — provider links are written into the application ROOT manifest.`);\n }\n\n const existing = rootManifest.pnpm?.overrides ?? {};\n const added: ProviderPackageLinkOutcome[] = [];\n const alreadyLinked: ProviderPackageLinkOutcome[] = [];\n for (const [packageName, overrideValue] of Object.entries(overrides)) {\n if (existing[packageName] === overrideValue) {\n alreadyLinked.push({ packageName, overrideValue });\n continue;\n }\n added.push({ packageName, overrideValue });\n }\n\n const surplus = Object.keys(existing)\n .filter((name) => name.startsWith(PROVIDER_PACKAGE_NAME_PREFIX))\n .filter((name) => !(name in overrides))\n .sort();\n\n if (input.write && added.length > 0) {\n const merged = { ...existing, ...overrides };\n rootManifest.pnpm = {\n ...(rootManifest.pnpm ?? {}),\n overrides: Object.fromEntries(Object.keys(merged).sort().map((name) => [name, merged[name]])),\n };\n writeFileSync(rootManifestPath, `${JSON.stringify(rootManifest, null, 2)}\\n`, 'utf8');\n }\n\n return { declared, added, alreadyLinked, unresolved, surplus };\n }\n\n /**\n * The host-facing entry: reconcile and REPORT, resolving the framework layout itself.\n *\n * `frameworkPath` null means app-creator mode — no checkout to link into, so a declared provider\n * resolves to the framework version. The version comes from `wildo-framework.info.json` in a\n * checkout and from the application's own existing `@wildo-ai/*` pin otherwise, because that is\n * the release the application actually has.\n */\n static reconcileAndReport(input: {\n applicationRoot: string;\n frameworkPath: string | null;\n log: { info: (message: string) => void; warn: (message: string) => void };\n }): ProviderPackageLinkReconciliation {\n /*\n * Nothing declared means nothing to reconcile, and the early return matters: this runs after\n * EVERY scenario, and `resolveFrameworkVersionForApplication` REFUSES rather than inventing a\n * version. Without this guard an application that declares no provider at all could have\n * `wildo compose add-locale` fail on a version it never needed.\n */\n const declaredProviders = ProviderPackageLinksService.discoverDeclaredProviderPackages(input.applicationRoot);\n if (declaredProviders.length === 0) {\n return { declared: [], added: [], alreadyLinked: [], unresolved: [], surplus: [] };\n }\n\n const frameworkWorkspacePackages = input.frameworkPath === null\n ? null\n : readFrameworkWorkspacePackages(input.frameworkPath);\n const frameworkVersion = ProviderPackageLinksService.resolveFrameworkVersionForApplication(input);\n\n const result = ProviderPackageLinksService.reconcileApplicationProviderLinks({\n applicationRoot: input.applicationRoot,\n frameworkWorkspacePackages,\n frameworkVersion,\n write: true,\n });\n\n for (const link of result.added) {\n input.log.info(` ~ package.json (pnpm.overrides ${link.packageName} → ${link.overrideValue})`);\n }\n for (const packageName of result.unresolved) {\n input.log.warn(\n ` ! ${packageName} is declared but no framework workspace member carries that name — `\n + 'generate the provider package, or remove the declaration.',\n );\n }\n if (result.added.length > 0) {\n input.log.info(' → run `pnpm install` so the new provider link resolves.');\n }\n return result;\n }\n\n /**\n * The version a provider package pins to in app-creator mode.\n *\n * Read from the checkout's `wildo-framework.info.json` when there is one; otherwise from the\n * application's OWN `pnpm.overrides`, taking the version it already pins for a framework package.\n * Deriving it from the application rather than defaulting is deliberate: a provider must land on\n * the release whose contract it was built against, and the application's existing pins are the\n * only statement of which release that is. With neither available the reconciliation refuses,\n * because inventing a version here would produce an override that installs the wrong engine.\n */\n private static resolveFrameworkVersionForApplication(input: {\n applicationRoot: string;\n frameworkPath: string | null;\n }): string {\n if (input.frameworkPath !== null) {\n const infoPath = join(input.frameworkPath, 'wildo-framework.info.json');\n if (existsSync(infoPath)) {\n const info = JSON.parse(readFileSync(infoPath, 'utf8')) as { version?: string };\n if (typeof info.version === 'string' && info.version.length > 0) return info.version;\n }\n }\n const rootManifest = ProviderPackageLinksService.readManifest(join(input.applicationRoot, 'package.json'));\n for (const [name, version] of Object.entries(rootManifest?.pnpm?.overrides ?? {})) {\n if (!name.startsWith('@wildo-ai/')) continue;\n if (name.startsWith(PROVIDER_PACKAGE_NAME_PREFIX)) continue;\n if (version.startsWith('file:') || version.startsWith('link:')) continue;\n return version;\n }\n throw new Error(\n 'Cannot resolve which framework release a provider package should pin to: no framework checkout, and the '\n + \"application's pnpm.overrides names no @wildo-ai/* version. Run `wildo align-deps` first.\",\n );\n }\n\n private static readManifest(manifestPath: string): PackageManifestShape | null {\n if (!existsSync(manifestPath)) return null;\n return JSON.parse(readFileSync(manifestPath, 'utf8')) as PackageManifestShape;\n }\n\n private static readDirectoryNames(base: string): string[] {\n return readdirSync(base, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"provider-package-links.service.js","sourceRoot":"","sources":["../../../../src/services/application/provider-package-links.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,qBAAqB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,qBAAqB,CAAC;AAErE;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO,IAAI,KAAK,+BAA+B,IAAI,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAC;AACnG,CAAC;AAQD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAAC,aAAqB;IAClE,MAAM,SAAS,GAAG,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE,qBAAqB,CAAC,EAAE,MAAM,CAAC,CAA4B,CAAC;IACzH,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC9D,KAAK,MAAM,aAAa,IAAI,SAAS,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;QACrD,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC7C,CAAC,CAA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,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtH,CAAC;CACF","sourcesContent":["/**\n * ProviderPackageLinksService — resolve an application's DECLARED provider packages, and nothing\n * else (plan D7, slice S6, issue #334).\n *\n * ## The problem this closes\n *\n * `frameworkFileLinkPackages` is the set of framework packages every scaffolded application links,\n * and in framework-developer mode every name in it becomes a `file:` override in the application's\n * root manifest. That is correct for the framework core — an application uses all of it — and it\n * does not survive the provider population: at two hundred provider packages every scaffolded\n * application would carry two hundred `file:` links to packages it never imports, and\n * `saas-skeleton.service.ts` would THROW for any name the workspace could not produce.\n *\n * So the two populations are resolved differently, and the difference is not a size optimisation —\n * it is what each list MEANS:\n *\n * - the framework core is a CURATION: the packages an application always has. It stays authored in\n * `propagated-engine-overrides.json`, because \"which of them\" is a decision;\n * - the providers are a POPULATION: `@wildo-ai/provider-<ref>`, one per provider, generated by the\n * packager. \"Which of them does THIS application link\" has exactly one honest answer — the ones\n * its own manifests declare. Nothing needs to list them, and a list would rot the way issue #161\n * measured (a hand-kept sibling list at 37 of 155 names).\n *\n * ## Why the DECLARATION is the source\n *\n * A provider reaches an application by exactly one route: a dependency in one of the application's\n * own package manifests, written by `wildo compose add-provider` (the `package-dependency-add`\n * composition edit kind). Deriving the link set from those declarations means the application says\n * what it uses once, in the place npm itself reads, and the override follows mechanically. The\n * alternative — a second per-application list of \"linked providers\" — would be a copy that can\n * disagree with the manifests, which is the defect this slice removes rather than relocates.\n *\n * ## What it never does\n *\n * It never REMOVES an override. An override the application authored, or one left behind by a\n * provider it has since dropped, is authored content; removing it silently is how a reconciler\n * becomes an outage. Surplus is reported by the caller, never repaired here.\n */\nimport { existsSync, readFileSync, readdirSync, writeFileSync } from 'fs';\nimport { join, relative, sep } from 'path';\nimport { parse as parseYaml } from 'yaml';\n\n/**\n * The npm-name prefix of a provider package (plan D3). Deliberately duplicated from the publish\n * lane's `PUBLISHED_PROVIDER_PACKAGE_NAME_PREFIX` rather than imported: that constant answers \"does\n * this package publish\", this one answers \"is this a provider an application declared\". They are\n * equal today and are allowed to stop being — a package that stops publishing is still linked.\n */\nexport const PROVIDER_PACKAGE_NAME_PREFIX = '@wildo-ai/provider-';\n\n/**\n * The SCRAPED CATALOGUE package — one name, hundreds of vendors behind subpath exports.\n *\n * This service was built (issue #334, slice S6) against a population of `@wildo-ai/provider-<ref>`\n * packages, one per vendor, and its whole design argument is that population's size: *\"at two\n * hundred provider packages every scaffolded application would carry two hundred `file:` links to\n * packages it never imports.\"* That shape was REVERSED on 2026-09-06 in favour of one package with\n * a subpath per vendor, and nothing here followed.\n *\n * Measured 2026-09-09: **no `@wildo-ai/provider-<ref>` package exists anywhere in the repository**,\n * while both dogfood applications declare `@wildo-ai/providers`. So the prefix above matched\n * nothing, at both production call sites, on every run — the service executed, found zero declared\n * providers, and reported success. An application adding its first catalogue provider through\n * `wildo compose add-provider` got the dependency and no override, and its next `pnpm install`\n * could not resolve the package. That is not hypothetical: it is what made the ten providers\n * declared in Wonder Todos on 2026-09-09 need a hand-written override.\n *\n * The PREFIX is kept rather than replaced. It still answers the question this service exists for —\n * \"is this a provider package an application declared\" — for an application-owned or future\n * per-vendor package, and the two forms are matched by one predicate so neither call site has to\n * remember both.\n */\nexport const PROVIDER_CATALOGUE_PACKAGE_NAME = '@wildo-ai/providers';\n\n/**\n * Whether a declared dependency name is a provider package this service links.\n *\n * A PREDICATE rather than a prefix test, because there are now two shapes and a call site that\n * remembers only one is exactly how this service came to match nothing.\n */\nexport function isProviderPackageName(name: string): boolean {\n return name === PROVIDER_CATALOGUE_PACKAGE_NAME || name.startsWith(PROVIDER_PACKAGE_NAME_PREFIX);\n}\n\n/** A framework workspace member: its package name and its absolute root. */\nexport interface FrameworkWorkspacePackage {\n name: string;\n root: string;\n}\n\n/**\n * Resolve every framework workspace member's package name → absolute root.\n *\n * Lives here rather than in `saas-skeleton.service.ts` because two callers now need it — the\n * scaffolder, and the provider-link reconciliation `wildo compose` runs — and a second copy of a\n * workspace reader is a second answer to \"what packages does the framework carry\".\n *\n * The one-level trailing glob stays supported here even though `pnpm-workspace.yaml` uses explicit\n * entries today: that file records the measurement (two repo-root readers refuse or silently drop a\n * wildcard), and when they are fixed this reader must not be the thing that has to change too.\n */\nexport function readFrameworkWorkspacePackages(frameworkPath: string): Map<string, FrameworkWorkspacePackage> {\n const workspace = parseYaml(readFileSync(join(frameworkPath, 'pnpm-workspace.yaml'), 'utf8')) as { packages?: string[] };\n const packages = new Map<string, FrameworkWorkspacePackage>();\n for (const memberPattern of workspace.packages ?? []) {\n const candidates = memberPattern.endsWith('/*')\n ? (existsSync(join(frameworkPath, memberPattern.slice(0, -2)))\n ? readdirSync(join(frameworkPath, memberPattern.slice(0, -2)), { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => join(memberPattern.slice(0, -2), entry.name))\n : [])\n : [memberPattern];\n for (const memberRelative of candidates) {\n const manifestPath = join(frameworkPath, memberRelative, 'package.json');\n if (!existsSync(manifestPath)) continue;\n const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: string };\n if (manifest.name) packages.set(manifest.name, { name: manifest.name, root: join(frameworkPath, memberRelative) });\n }\n }\n return packages;\n}\n\ninterface PackageManifestShape {\n name?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n pnpm?: { overrides?: Record<string, string> };\n [key: string]: unknown;\n}\n\n/** One provider override the reconciliation added or found already correct. */\nexport interface ProviderPackageLinkOutcome {\n packageName: string;\n /** `file:<relative path>` in framework-developer mode, the framework version otherwise. */\n overrideValue: string;\n}\n\nexport interface ProviderPackageLinkReconciliation {\n /** Providers the application's manifests declare, sorted. */\n declared: string[];\n /** Overrides written (or that would be written on a dry run). */\n added: ProviderPackageLinkOutcome[];\n /** Declared providers whose override already carries exactly this value. */\n alreadyLinked: ProviderPackageLinkOutcome[];\n /**\n * Declared providers that could not be resolved — no workspace member of that name in\n * framework-developer mode. Reported, never thrown: a declaration for a provider that has not\n * been generated yet is a state an operator can be in, and refusing the whole reconciliation\n * would take every OTHER provider's link down with it.\n */\n unresolved: string[];\n /**\n * Provider overrides present in the root manifest that no manifest declares any more. Reported\n * only — see the header: this service never removes an override.\n */\n surplus: string[];\n}\n\nexport class ProviderPackageLinksService {\n /**\n * The provider package names an application's own workspace manifests declare.\n *\n * Every dependency field is scanned, not just `dependencies`: a provider reached only from a\n * test or a build step is declared as a devDependency and still has to resolve.\n */\n static discoverDeclaredProviderPackages(applicationRoot: string): string[] {\n const declared = new Set<string>();\n for (const member of ProviderPackageLinksService.discoverApplicationWorkspaceMembers(applicationRoot)) {\n const manifest = ProviderPackageLinksService.readManifest(join(applicationRoot, member, 'package.json'));\n if (!manifest) continue;\n for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'] as const) {\n for (const name of Object.keys(manifest[field] ?? {})) {\n if (isProviderPackageName(name)) declared.add(name);\n }\n }\n }\n return [...declared].sort();\n }\n\n /**\n * The application's own workspace members, plus its root.\n *\n * `.wildo-saas/` members are skipped for the same reason the standalone alignment service skips\n * them: the companion drop's manifest is REWRITTEN on every start, so anything reconciled into it\n * is erased and the reconciler would report the same drift forever.\n */\n static discoverApplicationWorkspaceMembers(applicationRoot: string): string[] {\n const workspacePath = join(applicationRoot, 'pnpm-workspace.yaml');\n const declared = existsSync(workspacePath)\n ? ((parseYaml(readFileSync(workspacePath, 'utf8')) as { packages?: string[] } | null)?.packages ?? [])\n : [];\n const expanded: string[] = ['.'];\n for (const member of declared) {\n if (member.startsWith('.wildo-saas/')) continue;\n // A trailing one-level glob is the only glob shape an application workspace uses.\n if (member.endsWith('/*')) {\n const base = join(applicationRoot, member.slice(0, -2));\n if (!existsSync(base)) continue;\n for (const entry of ProviderPackageLinksService.readDirectoryNames(base)) expanded.push(`${member.slice(0, -2)}/${entry}`);\n continue;\n }\n expanded.push(member);\n }\n return expanded.filter((member) => existsSync(join(applicationRoot, member, 'package.json')));\n }\n\n /**\n * Compute the provider overrides an application needs, given what it declares.\n *\n * `frameworkWorkspacePackages` is the framework checkout's member map in framework-developer\n * mode; pass `null` for app-creator mode, where a provider resolves to the framework version like\n * every other `@wildo-ai/*` package.\n */\n static resolveProviderOverrides(input: {\n applicationRoot: string;\n frameworkWorkspacePackages: Map<string, { root: string }> | null;\n frameworkVersion: string;\n }): { overrides: Record<string, string>; declared: string[]; unresolved: string[] } {\n const declared = ProviderPackageLinksService.discoverDeclaredProviderPackages(input.applicationRoot);\n const overrides: Record<string, string> = {};\n const unresolved: string[] = [];\n\n for (const packageName of declared) {\n if (input.frameworkWorkspacePackages === null) {\n overrides[packageName] = input.frameworkVersion;\n continue;\n }\n const workspacePackage = input.frameworkWorkspacePackages.get(packageName);\n if (!workspacePackage) {\n unresolved.push(packageName);\n continue;\n }\n const relativePath = relative(input.applicationRoot, workspacePackage.root);\n // pnpm reads a POSIX specifier; `relative` yields the host separator on Windows.\n overrides[packageName] = `file:${relativePath.split(sep).join('/')}`;\n }\n\n return { overrides, declared, unresolved };\n }\n\n /**\n * Merge the resolved provider overrides into the application ROOT manifest.\n *\n * Merge, never replace, and sorted like every other writer of this block (`wildo init`, `wildo\n * align-deps`, the framework alignment script) so a later reconciliation reorders nothing and the\n * diff stays reviewable.\n */\n static reconcileApplicationProviderLinks(input: {\n applicationRoot: string;\n frameworkWorkspacePackages: Map<string, { root: string }> | null;\n frameworkVersion: string;\n write: boolean;\n }): ProviderPackageLinkReconciliation {\n const { overrides, declared, unresolved } = ProviderPackageLinksService.resolveProviderOverrides(input);\n const rootManifestPath = join(input.applicationRoot, 'package.json');\n const rootManifest = ProviderPackageLinksService.readManifest(rootManifestPath);\n if (!rootManifest) {\n throw new Error(`No package.json at ${rootManifestPath} — provider links are written into the application ROOT manifest.`);\n }\n\n const existing = rootManifest.pnpm?.overrides ?? {};\n const added: ProviderPackageLinkOutcome[] = [];\n const alreadyLinked: ProviderPackageLinkOutcome[] = [];\n for (const [packageName, overrideValue] of Object.entries(overrides)) {\n if (existing[packageName] === overrideValue) {\n alreadyLinked.push({ packageName, overrideValue });\n continue;\n }\n added.push({ packageName, overrideValue });\n }\n\n const surplus = Object.keys(existing)\n .filter((name) => isProviderPackageName(name))\n .filter((name) => !(name in overrides))\n .sort();\n\n if (input.write && added.length > 0) {\n const merged = { ...existing, ...overrides };\n rootManifest.pnpm = {\n ...(rootManifest.pnpm ?? {}),\n overrides: Object.fromEntries(Object.keys(merged).sort().map((name) => [name, merged[name]])),\n };\n writeFileSync(rootManifestPath, `${JSON.stringify(rootManifest, null, 2)}\\n`, 'utf8');\n }\n\n return { declared, added, alreadyLinked, unresolved, surplus };\n }\n\n /**\n * The host-facing entry: reconcile and REPORT, resolving the framework layout itself.\n *\n * `frameworkPath` null means app-creator mode — no checkout to link into, so a declared provider\n * resolves to the framework version. The version comes from `wildo-framework.info.json` in a\n * checkout and from the application's own existing `@wildo-ai/*` pin otherwise, because that is\n * the release the application actually has.\n */\n static reconcileAndReport(input: {\n applicationRoot: string;\n frameworkPath: string | null;\n log: { info: (message: string) => void; warn: (message: string) => void };\n }): ProviderPackageLinkReconciliation {\n /*\n * Nothing declared means nothing to reconcile, and the early return matters: this runs after\n * EVERY scenario, and `resolveFrameworkVersionForApplication` REFUSES rather than inventing a\n * version. Without this guard an application that declares no provider at all could have\n * `wildo compose add-locale` fail on a version it never needed.\n */\n const declaredProviders = ProviderPackageLinksService.discoverDeclaredProviderPackages(input.applicationRoot);\n if (declaredProviders.length === 0) {\n return { declared: [], added: [], alreadyLinked: [], unresolved: [], surplus: [] };\n }\n\n const frameworkWorkspacePackages = input.frameworkPath === null\n ? null\n : readFrameworkWorkspacePackages(input.frameworkPath);\n const frameworkVersion = ProviderPackageLinksService.resolveFrameworkVersionForApplication(input);\n\n const result = ProviderPackageLinksService.reconcileApplicationProviderLinks({\n applicationRoot: input.applicationRoot,\n frameworkWorkspacePackages,\n frameworkVersion,\n write: true,\n });\n\n for (const link of result.added) {\n input.log.info(` ~ package.json (pnpm.overrides ${link.packageName} → ${link.overrideValue})`);\n }\n for (const packageName of result.unresolved) {\n input.log.warn(\n ` ! ${packageName} is declared but no framework workspace member carries that name — `\n + 'generate the provider package, or remove the declaration.',\n );\n }\n if (result.added.length > 0) {\n input.log.info(' → run `pnpm install` so the new provider link resolves.');\n }\n return result;\n }\n\n /**\n * The version a provider package pins to in app-creator mode.\n *\n * Read from the checkout's `wildo-framework.info.json` when there is one; otherwise from the\n * application's OWN `pnpm.overrides`, taking the version it already pins for a framework package.\n * Deriving it from the application rather than defaulting is deliberate: a provider must land on\n * the release whose contract it was built against, and the application's existing pins are the\n * only statement of which release that is. With neither available the reconciliation refuses,\n * because inventing a version here would produce an override that installs the wrong engine.\n */\n private static resolveFrameworkVersionForApplication(input: {\n applicationRoot: string;\n frameworkPath: string | null;\n }): string {\n if (input.frameworkPath !== null) {\n const infoPath = join(input.frameworkPath, 'wildo-framework.info.json');\n if (existsSync(infoPath)) {\n const info = JSON.parse(readFileSync(infoPath, 'utf8')) as { version?: string };\n if (typeof info.version === 'string' && info.version.length > 0) return info.version;\n }\n }\n const rootManifest = ProviderPackageLinksService.readManifest(join(input.applicationRoot, 'package.json'));\n for (const [name, version] of Object.entries(rootManifest?.pnpm?.overrides ?? {})) {\n if (!name.startsWith('@wildo-ai/')) continue;\n if (isProviderPackageName(name)) continue;\n if (version.startsWith('file:') || version.startsWith('link:')) continue;\n return version;\n }\n throw new Error(\n 'Cannot resolve which framework release a provider package should pin to: no framework checkout, and the '\n + \"application's pnpm.overrides names no @wildo-ai/* version. Run `wildo align-deps` first.\",\n );\n }\n\n private static readManifest(manifestPath: string): PackageManifestShape | null {\n if (!existsSync(manifestPath)) return null;\n return JSON.parse(readFileSync(manifestPath, 'utf8')) as PackageManifestShape;\n }\n\n private static readDirectoryNames(base: string): string[] {\n return readdirSync(base, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-runtime-sync.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/provider-runtime-sync.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,cAAc,
|
|
1
|
+
{"version":3,"file":"provider-runtime-sync.service.d.ts","sourceRoot":"","sources":["../../../../src/services/application/provider-runtime-sync.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,cAAc,EAcf,MAAM,+BAA+B,CAAC;AASvC,OAAO,KAAK,EAGV,wBAAwB,EAEzB,MAAM,+BAA+B,CAAC;AAwBvC,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4GAA4G;IAC5G,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;;;;OAMG;IACH,0BAA0B,EAAE,MAAM,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,EACtD,YAAY,EAAE,wBAAwB,GAAG,SAAS,GACjD,MAAM,GAAG,IAAI,CAgDf;AAED,wBAAsB,kCAAkC,CACtD,GAAG,EAAE,sBAAsB,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,yBAAyB,CAAC,CAmGpC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,+CAA+C,CACnE,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAqBnB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dirname, join, sep } from 'path';
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, rmdirSync, writeFileSync } from 'fs';
|
|
3
|
-
import { buildDiscoveredProviderCatalog, InfraCapability, LEGACY_PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS, loadMinionConfigs, loadSaasConfig, loadWorkerConfigs, materializeInfraSection, materializeSaasProviderRuntimeArtifacts, PROVIDER_CATALOG_TYPES_RELATIVE_PATH, PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS, PROVIDER_RUNTIME_GENERATED_ENV_FILE_NAME, PROVIDER_RUNTIME_GENERATED_MODULE_RELATIVE_PATH, renderDiscoveredProviderCatalogTypes, renderProviderRuntimeEnvFile, renderProviderRuntimeGeneratedModule, resolveAppLayout,
|
|
3
|
+
import { buildDiscoveredProviderCatalog, InfraCapability, LEGACY_PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS, loadMinionConfigs, loadSaasConfig, loadWorkerConfigs, materializeInfraSection, materializeSaasProviderRuntimeArtifacts, PROVIDER_CATALOG_TYPES_RELATIVE_PATH, PROVIDER_RUNTIME_ARTIFACT_RELATIVE_PATHS, PROVIDER_RUNTIME_GENERATED_ENV_FILE_NAME, PROVIDER_RUNTIME_GENERATED_MODULE_RELATIVE_PATH, renderDiscoveredProviderCatalogTypes, renderProviderRuntimeEnvFile, renderProviderRuntimeGeneratedModule, resolveAppLayout, SaasLockfileEnvelopeSchema, selectScopedProviderRuntimeArtifact, } from '@wildo-ai/platform-config-lib';
|
|
4
|
+
import { resolveAndRegisterSaasProviderContributions } from '../credentials/composed-provider-catalogue.js';
|
|
4
5
|
import { EngineCapability } from '@wildo-ai/saas-models';
|
|
5
6
|
// Slice 2.5c-1 of `infra-provider-planner.md`: CLI builds the
|
|
6
7
|
// `InfraProvider → InfraProviderModule` map from the canonical
|
|
@@ -74,7 +75,7 @@ export function checkAuditProviderImmudbBacking(saasConfig, infraSection) {
|
|
|
74
75
|
export async function syncProviderRuntimeArtifactsForApp(log, saasRoot) {
|
|
75
76
|
try {
|
|
76
77
|
const saasConfig = await loadSaasConfig(join(saasRoot, 'wildo.saas.config.ts'));
|
|
77
|
-
const discoveredProviderContributions = await
|
|
78
|
+
const discoveredProviderContributions = await resolveAndRegisterSaasProviderContributions({ saasRoot, saasConfig });
|
|
78
79
|
syncProviderCatalogTypeArtifact(saasRoot, buildDiscoveredProviderCatalog(discoveredProviderContributions));
|
|
79
80
|
const minionConfigs = await loadMinionConfigs(saasRoot, saasConfig);
|
|
80
81
|
const workerConfigs = await loadWorkerConfigs(saasRoot, saasConfig);
|
|
@@ -174,7 +175,7 @@ export async function syncProviderRuntimeArtifactsForApp(log, saasRoot) {
|
|
|
174
175
|
*/
|
|
175
176
|
export async function resolveExpectedProviderRuntimeSourceModulePaths(saasRoot) {
|
|
176
177
|
const saasConfig = await loadSaasConfig(join(saasRoot, 'wildo.saas.config.ts'));
|
|
177
|
-
const discoveredProviderContributions = await
|
|
178
|
+
const discoveredProviderContributions = await resolveAndRegisterSaasProviderContributions({ saasRoot, saasConfig });
|
|
178
179
|
const minionConfigs = await loadMinionConfigs(saasRoot, saasConfig);
|
|
179
180
|
const workerConfigs = await loadWorkerConfigs(saasRoot, saasConfig);
|
|
180
181
|
const nodeWorkerKeys = workerConfigs
|