@wildo-ai/dev-companion 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.
- package/bin/companion-supervisor.d.mts +33 -0
- package/bin/companion-supervisor.mjs +174 -0
- package/bin/wildo-dev-companion-supervised.mjs +16 -0
- package/dist/esm/brand/models/logo-generation.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/brand/models/logo-generation.actors-system.definitions.js +8 -2
- package/dist/esm/brand/models/logo-generation.actors-system.definitions.js.map +1 -1
- package/dist/esm/brand/models/logo-judge.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/brand/models/logo-judge.actors-system.definitions.js +8 -2
- package/dist/esm/brand/models/logo-judge.actors-system.definitions.js.map +1 -1
- package/dist/esm/brand/services/brand-accept.companion.service.d.ts +1 -1
- package/dist/esm/brand/services/brand-accept.companion.service.d.ts.map +1 -1
- package/dist/esm/brand/services/brand-accept.companion.service.js +9 -11
- package/dist/esm/brand/services/brand-accept.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.d.ts +21 -0
- package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.js +33 -1
- package/dist/esm/claude-cli/models/application-coding-run-checkpoint.models.js.map +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +41 -2
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +43 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +57 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +75 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +90 -5
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +242 -22
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.d.ts +23 -2
- package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.js +13 -2
- package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -7
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +315 -39
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/config/primary-language.companion.utils.d.ts +5 -4
- package/dist/esm/core/config/primary-language.companion.utils.d.ts.map +1 -1
- package/dist/esm/core/config/primary-language.companion.utils.js +5 -4
- package/dist/esm/core/config/primary-language.companion.utils.js.map +1 -1
- package/dist/esm/core/context/application-module-generations.companion.d.ts +103 -0
- package/dist/esm/core/context/application-module-generations.companion.d.ts.map +1 -0
- package/dist/esm/core/context/application-module-generations.companion.js +313 -0
- package/dist/esm/core/context/application-module-generations.companion.js.map +1 -0
- package/dist/esm/core/context/companion-package-loaders.companion.d.ts +19 -19
- package/dist/esm/core/context/companion-package-loaders.companion.d.ts.map +1 -1
- package/dist/esm/core/context/companion-package-loaders.companion.js +52 -40
- package/dist/esm/core/context/companion-package-loaders.companion.js.map +1 -1
- package/dist/esm/core/inject/models/container.d.ts.map +1 -1
- package/dist/esm/core/inject/models/container.js +4 -0
- package/dist/esm/core/inject/models/container.js.map +1 -1
- package/dist/esm/core/inject/models/service-types.d.ts +4 -0
- package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/core/inject/models/service-types.js +4 -0
- package/dist/esm/core/inject/models/service-types.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts +15 -1
- package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-console-answer.companion.js +38 -3
- package/dist/esm/core/introspection/resources/creation-console-answer.companion.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts +21 -0
- package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-console-projection.companion.js +64 -25
- package/dist/esm/core/introspection/resources/creation-console-projection.companion.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +2 -0
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +0 -28
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +192 -19
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +27 -5
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts +47 -0
- package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/launch-blockers.companion.js +98 -0
- package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -0
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +6 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +20 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +34 -8
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +61 -12
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-input-closure.companion.d.ts +44 -0
- package/dist/esm/core/introspection/services/introspection-input-closure.companion.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-input-closure.companion.js +104 -0
- package/dist/esm/core/introspection/services/introspection-input-closure.companion.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +41 -22
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +64 -47
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts +7 -1
- package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.js +13 -4
- package/dist/esm/core/introspection/subprocess/expert-persona-brief.renderer.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +7 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -1
- package/dist/esm/core/lock/wildo-saas-lock.schemas.d.ts +4 -4
- package/dist/esm/core/runtime/companion-env-file.d.ts +39 -9
- package/dist/esm/core/runtime/companion-env-file.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-env-file.js +75 -16
- package/dist/esm/core/runtime/companion-env-file.js.map +1 -1
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +7 -3
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
- package/dist/esm/core/runtime/services/start-companion-application.service.js +29 -11
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/utils/bounded-concurrency.utils.d.ts +17 -0
- package/dist/esm/core/utils/bounded-concurrency.utils.d.ts.map +1 -0
- package/dist/esm/core/utils/bounded-concurrency.utils.js +37 -0
- package/dist/esm/core/utils/bounded-concurrency.utils.js.map +1 -0
- package/dist/esm/core/utils/derived-input-signature.companion.utils.d.ts +10 -1
- package/dist/esm/core/utils/derived-input-signature.companion.utils.d.ts.map +1 -1
- package/dist/esm/core/utils/derived-input-signature.companion.utils.js +9 -2
- package/dist/esm/core/utils/derived-input-signature.companion.utils.js.map +1 -1
- package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js +2 -0
- package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js.map +1 -1
- package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts.map +1 -1
- package/dist/esm/creation-conversation/creation-conversation.function-tools.js +66 -6
- package/dist/esm/creation-conversation/creation-conversation.function-tools.js.map +1 -1
- package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts +0 -17
- package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js +10 -4
- package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js.map +1 -1
- package/dist/esm/email/services/email-template.companion.service.d.ts +6 -1
- package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
- package/dist/esm/email/services/email-template.companion.service.js +4 -1
- package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
- package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js +8 -2
- package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js.map +1 -1
- package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js +8 -2
- package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js.map +1 -1
- package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
- package/dist/esm/expert-personas/services/expert-persona.companion.service.js +7 -7
- package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.en.js +41 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchAspects.en.js +7 -0
- package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.d.ts +5 -0
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.js +5 -0
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +1 -1
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +2 -1
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts +46 -0
- package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchDossierEntries.en.js +12 -0
- package/dist/esm/i18n/resources/workbenchDossierEntries.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +266 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +91 -5
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.en.d.ts +41 -0
- package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.en.js +45 -1
- package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/localization.en.d.ts +82 -0
- package/dist/esm/i18n/system_enums/localization.en.d.ts.map +1 -0
- package/dist/esm/i18n/system_enums/localization.en.js +82 -0
- package/dist/esm/i18n/system_enums/localization.en.js.map +1 -0
- package/dist/esm/i18n/system_enums/risk-register.en.d.ts +1 -0
- package/dist/esm/i18n/system_enums/risk-register.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/risk-register.en.js +1 -0
- package/dist/esm/i18n/system_enums/risk-register.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts +10 -0
- package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-dossier.en.js +13 -0
- package/dist/esm/i18n/system_enums/workbench-dossier.en.js.map +1 -1
- package/dist/esm/i18n-labelling/models/labelling-progress.models.d.ts +43 -0
- package/dist/esm/i18n-labelling/models/labelling-progress.models.d.ts.map +1 -0
- package/dist/esm/i18n-labelling/models/labelling-progress.models.js +34 -0
- package/dist/esm/i18n-labelling/models/labelling-progress.models.js.map +1 -0
- package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts +8 -0
- package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js +97 -56
- package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js.map +1 -1
- package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts +18 -0
- package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js +269 -153
- package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js.map +1 -1
- package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.d.ts +41 -0
- package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.d.ts.map +1 -0
- package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.js +47 -0
- package/dist/esm/i18n-labelling/utils/labelling-concurrency.utils.js.map +1 -0
- package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts +12 -0
- package/dist/esm/i18n-labelling/utils/per-unit-file.utils.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/utils/per-unit-file.utils.js +10 -2
- package/dist/esm/i18n-labelling/utils/per-unit-file.utils.js.map +1 -1
- package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.d.ts +89 -0
- package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.d.ts.map +1 -0
- package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.js +229 -0
- package/dist/esm/i18n-labelling/utils/staged-label-file-writer.utils.js.map +1 -0
- package/dist/esm/meta-workflows/models/build-task-rearm.models.d.ts +67 -1
- package/dist/esm/meta-workflows/models/build-task-rearm.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/build-task-rearm.models.js +64 -0
- package/dist/esm/meta-workflows/models/build-task-rearm.models.js.map +1 -1
- package/dist/esm/meta-workflows/models/creation-intervention.models.d.ts +308 -0
- package/dist/esm/meta-workflows/models/creation-intervention.models.d.ts.map +1 -0
- package/dist/esm/meta-workflows/models/creation-intervention.models.js +365 -0
- package/dist/esm/meta-workflows/models/creation-intervention.models.js.map +1 -0
- package/dist/esm/meta-workflows/models/generation-step-progress.models.d.ts +61 -0
- package/dist/esm/meta-workflows/models/generation-step-progress.models.d.ts.map +1 -0
- package/dist/esm/meta-workflows/models/generation-step-progress.models.js +58 -0
- package/dist/esm/meta-workflows/models/generation-step-progress.models.js.map +1 -0
- package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts +10 -6
- package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js +11 -6
- package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts +3 -0
- package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js +8 -1
- package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +26 -0
- package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-record.models.js +66 -10
- package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +13 -0
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +33 -0
- package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -0
- package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.d.ts +145 -0
- package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.js +179 -0
- package/dist/esm/meta-workflows/services/application-assembly-repair.companion.utils.js.map +1 -0
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +376 -17
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +805 -39
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +93 -7
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +142 -25
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +120 -3
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +325 -16
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +15 -6
- package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.js +10 -11
- package/dist/esm/meta-workflows/services/application-maturity-executor.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js +10 -11
- package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts +82 -0
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +291 -0
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -0
- package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.d.ts +60 -0
- package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.js +66 -0
- package/dist/esm/meta-workflows/services/creation-lane-preflight.companion.service.js.map +1 -0
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +53 -0
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +164 -0
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -0
- package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.d.ts +37 -0
- package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.js +52 -0
- package/dist/esm/meta-workflows/services/dossier-write-queue.companion.utils.js.map +1 -0
- package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts +74 -14
- package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/dossier.companion.service.js +180 -28
- package/dist/esm/meta-workflows/services/dossier.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts +2 -3
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +2 -8
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.d.ts +67 -0
- package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.d.ts.map +1 -0
- package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.js +64 -0
- package/dist/esm/meta-workflows/services/interview-answer-proposal.companion.js.map +1 -0
- package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js +11 -3
- package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +92 -4
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +328 -7
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +105 -6
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +309 -39
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.d.ts +62 -1
- package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.js +152 -2
- package/dist/esm/meta-workflows/services/playbook-spend-meter.companion.service.js.map +1 -1
- package/package.json +22 -18
- package/dist/esm/.tsbuildinfo +0 -1
- package/dist/esm/__tests__/asset-noop.d.ts +0 -3
- package/dist/esm/__tests__/asset-noop.d.ts.map +0 -1
- package/dist/esm/__tests__/asset-noop.js +0 -2
- package/dist/esm/__tests__/asset-noop.js.map +0 -1
- package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts +0 -2
- package/dist/esm/__tests__/chdir-dogfood-app.setup.d.ts.map +0 -1
- package/dist/esm/__tests__/chdir-dogfood-app.setup.js +0 -44
- package/dist/esm/__tests__/chdir-dogfood-app.setup.js.map +0 -1
- package/dist/esm/__tests__/internal-test-view.d.ts +0 -39
- package/dist/esm/__tests__/internal-test-view.d.ts.map +0 -1
- package/dist/esm/__tests__/internal-test-view.js +0 -2
- package/dist/esm/__tests__/internal-test-view.js.map +0 -1
- package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts +0 -50
- package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts.map +0 -1
- package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js +0 -157
- package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts +0 -8
- package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.d.ts.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.js +0 -43
- package/dist/esm/meta-workflows/services/__tests__/application-build-task-coding.companion.test-fixtures.js.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts +0 -79
- package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts.map +0 -1
- package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js +0 -193
- package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js.map +0 -1
|
@@ -16,7 +16,6 @@ import { loadInfraEnvConfig } from '@wildo-ai/platform-config-lib';
|
|
|
16
16
|
import { inject, injectable } from 'inversify';
|
|
17
17
|
import { ApplicationLineDeclarationState, CompositionScenarioRef, DomainPlanOutputSetSchema, resolveApplicationLineDeclaration, } from '@wildo-ai/saas-specifications/application-creation';
|
|
18
18
|
import { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';
|
|
19
|
-
import { getCompanionServedLanguages } from '../../core/config/primary-language.companion.utils.js';
|
|
20
19
|
import { propagateAcceptedBrand } from '../../brand/services/brand-propagation.companion.utils.js';
|
|
21
20
|
import { AppFrontendType, EngineCapabilityResolutionMode, ProviderOriginKind, getEngineCapabilityResolutionMode } from '@wildo-ai/saas-models';
|
|
22
21
|
import { engineProviderSpecifications } from '@wildo-ai/saas-specifications';
|
|
@@ -154,12 +153,10 @@ export function alreadyComposedWitness(invocation, applicationRoot) {
|
|
|
154
153
|
let FoundationExecutorCompanionService = class FoundationExecutorCompanionService {
|
|
155
154
|
logger;
|
|
156
155
|
companionContext;
|
|
157
|
-
appConfigService;
|
|
158
156
|
logDebug;
|
|
159
|
-
constructor(logger, companionContext
|
|
157
|
+
constructor(logger, companionContext) {
|
|
160
158
|
this.logger = logger;
|
|
161
159
|
this.companionContext = companionContext;
|
|
162
|
-
this.appConfigService = appConfigService;
|
|
163
160
|
this.logDebug = this.logger.debugByType('FoundationExecutorCompanionService');
|
|
164
161
|
}
|
|
165
162
|
async execute(input) {
|
|
@@ -419,8 +416,6 @@ let FoundationExecutorCompanionService = class FoundationExecutorCompanionServic
|
|
|
419
416
|
backendPort,
|
|
420
417
|
appPort,
|
|
421
418
|
publicDomainSource,
|
|
422
|
-
// The same reader the capability composition decided `add-locale` from, so the two cannot disagree.
|
|
423
|
-
servedLanguages: getCompanionServedLanguages(this.appConfigService.config),
|
|
424
419
|
};
|
|
425
420
|
}
|
|
426
421
|
/**
|
|
@@ -581,8 +576,7 @@ FoundationExecutorCompanionService = __decorate([
|
|
|
581
576
|
injectable(),
|
|
582
577
|
__param(0, inject(SAAS_SERVICE_TYPES.Logger)),
|
|
583
578
|
__param(1, inject(COMPANION_SERVICE_TYPES.CompanionContext)),
|
|
584
|
-
|
|
585
|
-
__metadata("design:paramtypes", [Function, Object, Function])
|
|
579
|
+
__metadata("design:paramtypes", [Function, Object])
|
|
586
580
|
], FoundationExecutorCompanionService);
|
|
587
581
|
export { FoundationExecutorCompanionService };
|
|
588
582
|
//# sourceMappingURL=foundation-executor.companion.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"foundation-executor.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/foundation-executor.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAC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AAI,wBAAwB,CAAC,8CAA8C,YAAY,qCAAqC,CAAC,CAAC;IACtI,CAAC;IAED;;;OAGG;IACK,eAAe,CAAC,eAAwB;QAC9C,MAAM,OAAO,GAAI,eAAgD,EAAE,OAAO,CAAC;QAC3E,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACK,yBAAyB,CAAC,eAAuB;QACvD,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QAC1E,IAAI,CAAC;YACH,MAAM,IAAI,GAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAuB,CAAC,IAAI,CAAC;YACxF,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,0CAA0C;QAC5C,CAAC;QACD,MAAM,IAAI,wBAAwB,CAAC,+CAA+C,YAAY,qCAAqC,CAAC,CAAC;IACvI,CAAC;CACF,CAAA;AA9cY,kCAAkC;IAD9C,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;;GANnC,kCAAkC,CA8c9C","sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { loadInfraEnvConfig } from '@wildo-ai/platform-config-lib';\n\nimport { inject, injectable } from 'inversify';\nimport {\n ApplicationLineDeclarationState,\n CompositionScenarioRef,\n DomainPlanOutputSetSchema,\n resolveApplicationLineDeclaration,\n type ApplicationCreatorInputs,\n} from '@wildo-ai/saas-specifications/application-creation';\nimport { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';\nimport type { AppConfigurationService, LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { getCompanionServedLanguages } from '../../core/config/primary-language.companion.utils';\nimport { propagateAcceptedBrand, type CompanionBrandPropagation } from '../../brand/services/brand-propagation.companion.utils';\nimport { AppFrontendType, EngineCapabilityResolutionMode, ProviderOriginKind, getEngineCapabilityResolutionMode, type EngineCapability } from '@wildo-ai/saas-models';\nimport { engineProviderSpecifications } from '@wildo-ai/saas-specifications';\n\nimport {\n APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS,\n addProviderToScope,\n applyCompositionScenarioPlan,\n createCompositionTemplateRenderer,\n deriveFoundationCompositionPlan,\n creatorProviderAnswerFor,\n FoundationPrimaryScope,\n listCompositionScenarioDirectories,\n loadCompositionScenario,\n planCompositionScenario,\n resolveCompositionScenarioVariables,\n setEngineCapabilityEnabled,\n setProviderSelectionPrimary,\n type CompositionTemplateRenderer,\n type FoundationCapabilityBasis,\n type FoundationBackgroundExecutionOutcome,\n type FoundationCompositionScenarioOutcome,\n type FoundationHostFacts,\n type FoundationScenarioInvocation,\n listSaasConfigOrganizationTypeRefs,\n setOrganizationTypeOwnsApplication,\n} from '@wildo-ai/application-creation-runtime';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion';\n\n/**\n * The foundation playbook's EXECUTOR — the domain-plan → compose bridge, run instead of typed by\n * hand (J-1 stall F: a human read the approved domain plan, decided the `wildo compose` calls and\n * the ORGANIZATIONS flip, derived every scenario variable, and ran them one by one).\n *\n * `bottom_up.foundation` declares `outputs: []` and `executor: \"composite\"`: it lands no\n * specification family — its deliverable is the APPLICATION (config + composed module slices).\n * The generation route therefore cannot run it (J-1 stall E); this service is what does.\n *\n * The derivation is PURE (`deriveFoundationCompositionPlan`, tested against a literal domain\n * plan); this service supplies the host facts (app root, framework root, the shared-lib package\n * name) and executes: the capability mutation through the config-mutation service, and each\n * scenario through the same engine + THE SAME renderer `wildo compose` uses — identical scenario\n * bytes produce identical files regardless of which door applied them.\n *\n * Idempotent by the engine's own contract: a re-run plans byte-identical targets as SKIPS; a\n * target that exists with DIFFERENT bytes is a collision and the whole scenario REFUSES unapplied\n * (ownership transferred to the application; git is the undo). Nothing here commits — GUIDED\n * acceptance stays a human `git commit`.\n */\n\nexport interface FoundationScenarioExecutionRecord {\n readonly scenarioRef: string;\n /** The invocation's addressing variables (moduleId, resourceDir) — enough to identify the unit. */\n readonly subject: string;\n readonly writes: number;\n readonly skippedWrites: number;\n readonly editsApplied: number;\n readonly skippedEdits: number;\n /**\n * DRY-RUN only: this invocation could not be PLANNED because it edits files a preceding\n * invocation of the same run would create (an add-resource whose module is composed by this\n * run's own add-module). A real run applies sequentially and never hits this; a dry run reports\n * the dependency honestly instead of failing on it.\n */\n readonly deferredBehindModuleComposition?: true;\n /**\n * A scenario whose witness directory already exists — a package (the website, a minion), a module or\n * a resource, composed by an earlier run or by the build since — so this run left it alone. Applying it would either skip every\n * byte-identical file (a no-op reported as writes) or refuse on the first authored one, and neither is\n * what a re-run means: the composition says the application HAS a website, and it does.\n */\n readonly alreadyComposed?: true;\n}\n\n/** The composition scenarios that create a surface serving the brand's icons and social image. */\nconst SURFACES_RECEIVING_THE_BRAND: ReadonlySet<string> = new Set<string>([\n CompositionScenarioRef.ADD_WEBSITE,\n CompositionScenarioRef.ADD_TECHNICAL_DOC,\n]);\n\n/** Whether this run composed — actually wrote, not found already composed — a surface that serves the brand. */\nexport function composedASurfaceReceivingTheBrand(scenarios: readonly Pick<FoundationScenarioExecutionRecord, 'scenarioRef' | 'writes' | 'alreadyComposed'>[]): boolean {\n return scenarios.some((record) => SURFACES_RECEIVING_THE_BRAND.has(record.scenarioRef) && record.alreadyComposed !== true && record.writes > 0);\n}\n\nexport interface FoundationExecutionResult {\n readonly playbookRef: 'bottom_up.foundation';\n readonly primaryScope: FoundationPrimaryScope;\n readonly engineCapabilityChanges: ReadonlyArray<{\n readonly capability: string;\n /** WHICH declaration decided it — so the record says why, not merely what (#1272). */\n readonly basis: FoundationCapabilityBasis;\n readonly changed: boolean;\n readonly summary: string;\n /**\n * Set when this run also DECLARED a provider so the capability could be enabled at all.\n *\n * Carried loudly rather than folded into the summary, because a credential-free provider is a\n * DEVELOPMENT SUBSTITUTE by construction — `email-preview` renders mail to a local surface and\n * its own module says to \"wire it as the `EMAIL_TRANSACTIONAL` primary in local environments…\n * with no live API key and no mail actually leaving the machine\". The application is configured\n * and working; replacing it is a deployment decision somebody still owes, and a record that did\n * not say so would let it ship unnoticed.\n *\n * spec-cite: N/A — INTERNAL. The quotation is this repository's own\n * `engine/external-connectors-private/src/providers/email-preview/email-preview.backend.module.ts`\n * module JSDoc, not an external standard. An earlier revision quoted \"never select it as primary\n * in an environment that serves real users\", which appears in no specification anywhere — a\n * paraphrase wearing quotation marks, the exact shape\n * `.claude/rules/external-specification-citations.md` exists to retire.\n */\n readonly servedByDeclaredProvider?: {\n readonly providerRef: string;\n readonly developmentSubstitute: true;\n readonly replaceBeforeRealUsers: string;\n };\n /**\n * The provider the CREATOR chose in the foundation interview (#1488), declared, selected and enabled\n * by this run. `credentialsOwed` names the env vars the provider requires and this process cannot\n * supply: the application boots (the floor reads declaration + selection), and the provider's own\n * calls fail until an operator sets them. Mark, never gate.\n */\n readonly servedByCreatorSelectedProvider?: {\n readonly providerRef: string;\n readonly credentialsOwed: ReadonlyArray<{ readonly envVarName: string; readonly description: string }>;\n readonly remedy: string;\n };\n }>;\n /**\n * Capabilities the application NEEDS and this run deliberately did not enable, because the engine\n * refuses to boot with them on and no provider resolving, and the journey cannot declare one.\n *\n * Reported rather than silently dropped: a derivation whose result nobody can see is a derivation\n * nobody acts on, and the remedy — declare a provider for it — is a sentence an operator can act\n * on today. `application-creation-directive.md`: mark, never gate.\n */\n readonly engineCapabilitiesOwedAProvider: ReadonlyArray<{\n readonly capability: string;\n readonly basis: FoundationCapabilityBasis;\n readonly remedy: string;\n }>;\n readonly scenarios: readonly FoundationScenarioExecutionRecord[];\n /** The accepted brand mark copied into a surface this run composed (a website, a portal). Absent when none was composed. */\n readonly brandPropagation?: CompanionBrandPropagation;\n /**\n * Whether this application is owned by one organization, and what this run declared for it (#1605).\n * `owed` is set when the line requires an owner and the configuration does not name one organization\n * type unambiguously: marked, never gated, since choosing among several types is authoring work.\n */\n readonly applicationOwnership?: {\n readonly required: boolean;\n readonly basis: string;\n readonly organizationTypeRef?: string;\n readonly changed?: boolean;\n readonly summary?: string;\n readonly owed?: string;\n };\n /**\n * What the capability composition decided, scenario by scenario (#1491): every scenario applied and every\n * scenario declined, with the declaration each came from. Empty when no composition has landed yet.\n */\n readonly compositionScenarios: readonly FoundationCompositionScenarioOutcome[];\n /**\n * What the run read about workers and minions (#1544): composed, declared none, or had no readable\n * integration plan to read. The last two used to be one silence.\n */\n readonly backgroundExecution: FoundationBackgroundExecutionOutcome;\n /** The host facts the optional-package scenarios were composed with, and where the public domain came from. */\n readonly hostFacts?: FoundationHostFacts & { readonly publicDomainSource: string };\n}\n\n/**\n * An engine provider this run may declare on the application's behalf, without asking anyone.\n *\n * ## The criterion is an EMPTY SECRETS CONTRACT, and that is the whole of it\n *\n * A capability in `ENGINE_CAPABILITIES_REQUIRING_A_PROVIDER_WHEN_ENABLED` cannot be enabled without\n * a provider — the backend refuses to boot. Choosing one is usually a commercial decision nobody in\n * this process is entitled to take: which payment processor, which mail vendor, on whose account.\n *\n * But a provider that declares NO SECRETS needs no account, so choosing it commits the operator to\n * nothing they can be billed or bound by. Measured across the whole engine catalogue (2026-09-17),\n * exactly two providers qualify, and only one of them serves a boot-floor capability:\n *\n * | provider | secrets | serves |\n * |---|---|---|\n * | `email-preview` | none | EMAIL_TRANSACTIONAL |\n * | `opencode` | none | AI_CODING_AGENT — not in the boot floor, and not derived by the journey |\n *\n * `stripe`, `twilio`, `resend` and every AI vendor carry a secrets contract, so BILLING and SMS stay\n * OWED. That asymmetry is the point rather than a limitation: the journey configures what costs\n * nothing to configure and leaves the commercial choices to the human who owns them.\n *\n * ## It is DERIVED from the specifications, never listed here\n *\n * A hand-kept list of another catalogue's contents is the shape that rots — the same argument the\n * build task's workspace scope makes. A provider that drops its secrets contract tomorrow becomes\n * eligible the day it does, and one that grows a secrets contract stops being, with no edit here.\n */\nexport interface SelfConfiguringProviderChoice {\n readonly providerRef: string;\n readonly providerCapabilities: readonly string[];\n readonly protocols: readonly string[];\n}\n\nexport function resolveCredentialFreeEngineProvider(capability: EngineCapability): SelfConfiguringProviderChoice | undefined {\n const candidates = Object.values(engineProviderSpecifications).filter((specification) => (\n specification.engineCapabilities.includes(capability)\n && specification.secretsContract.length === 0\n && specification.origin.kind === ProviderOriginKind.ENGINE\n // A backend-scope declaration is what the boot floor reads; a frontend-only module cannot serve it.\n && specification.facets.includes('backend')\n ));\n /*\n * Exactly one, or none. Two credential-free providers for one capability would be a CHOICE, and a\n * choice is the thing this function exists not to make on somebody's behalf — so it declines and\n * the capability stays owed, which is the outcome a human can still resolve.\n */\n if (candidates.length !== 1) return undefined;\n const chosen = candidates[0]!;\n return {\n providerRef: chosen.ref,\n providerCapabilities: chosen.providerCapabilities,\n protocols: chosen.protocols,\n };\n}\n\n/** Refusals a creator can act on (missing scope answer, unwired domain plan, collisions). */\n/**\n * The engine providers a creator may be OFFERED for a capability: ENGINE-origin, backend-scoped, serving it\n * (#1488). This is the options vocabulary of the foundation interview's provider questions, and the test\n * beside this file pins the AUTHORED options to it, so a vendor added to the catalogue is offered by being\n * added rather than by somebody remembering the question.\n */\nexport function listEngineProviderRefsServing(capability: EngineCapability): readonly string[] {\n return Object.values(engineProviderSpecifications)\n .filter((specification) => (\n specification.engineCapabilities.includes(capability)\n && specification.origin.kind === ProviderOriginKind.ENGINE\n && specification.facets.includes('backend')\n ))\n .map((specification) => specification.ref)\n .sort();\n}\n\nexport type CreatorSelectedProviderResolution =\n | {\n readonly kind: 'selected';\n readonly providerRef: string;\n readonly providerCapabilities: readonly string[];\n readonly protocols: readonly string[];\n /** The provider's REQUIRED secrets, by env var — what the operator still owes before it answers. */\n readonly credentialsOwed: ReadonlyArray<{ readonly envVarName: string; readonly description: string }>;\n }\n | {\n /** The creator named something the catalogue does not offer for this capability. Reported, never guessed around. */\n readonly kind: 'refused';\n readonly reason: string;\n };\n\n/**\n * The creator's provider choice for a capability, read off the foundation interview (#1488).\n *\n * `undefined` when the question was not answered or answered `none` (`PROVIDER_CHOICE_NONE`) — the honest\n * value: the interview requires an answer to every question, so \"decide later\" is an option, and it leaves\n * the capability OWED exactly as before (#1272). An answer outside the offered set is `refused` with the set\n * named. **That arm is a floor for DIRECT callers, not a run path**: through `runPlaybook` the interview\n * validator (`validateElicitationAnswer`) refuses an out-of-options answer before the executor is called, and\n * the compiled options are pinned to this very derivation, so a run never reaches it. Secrets are not checked\n * here: the boot floor reads declaration and selection, so the chosen provider can be declared and the\n * capability enabled while the credentials stay OWED.\n */\nexport function resolveCreatorSelectedEngineProvider(\n capability: EngineCapability,\n answers: ReadonlyArray<{ readonly questionRef: string; readonly answer: string }>,\n): CreatorSelectedProviderResolution | undefined {\n const answer = creatorProviderAnswerFor(capability, answers);\n if (answer === undefined) return undefined;\n const offered = listEngineProviderRefsServing(capability);\n const chosen = Object.values(engineProviderSpecifications).find((specification) => specification.ref === answer);\n if (!chosen || !offered.includes(answer)) {\n return {\n kind: 'refused',\n reason: `The interview answer \"${answer}\" names no engine provider serving ${capability}. Offered: ${offered.join(', ') || '(none)'}.`,\n };\n }\n return {\n kind: 'selected',\n providerRef: chosen.ref,\n providerCapabilities: chosen.providerCapabilities,\n protocols: chosen.protocols,\n credentialsOwed: chosen.secretsContract\n .filter((secret) => secret.required)\n .map((secret) => ({ envVarName: secret.envVarName, description: secret.description })),\n };\n}\n\nexport class FoundationExecutionError extends Error {}\n\n/**\n * The directory whose presence says a scenario has ALREADY been composed — its WITNESS. Total over the\n * vocabulary; `null` means the scenario has no directory of its own (a custom operation, a provider block,\n * a locale) and is never skipped on that ground.\n *\n * Modules and resources have witnesses too (#1544), and that is what makes the foundation re-runnable\n * once the build has started. With `null` for both, every re-run re-planned `add-module` and\n * `add-resource` from scratch and collided with the files the build's own tasks had written since —\n * seven of them on the first end-to-end run — and a diverged target refuses the whole scenario, so the\n * run never reached the minion it was re-run for. A module whose directory exists was composed; the\n * build owns its bytes from then on, and re-composing it can only overwrite or refuse.\n *\n * A FUNCTION of the invocation's own variables, not a constant, because three of them compose one\n * package PER SURFACE (#1496's review): a worker lands in `workers/<workerDir>` and a minion in\n * `minions/<minionDir>`, so a fixed string cannot say whether THIS minion is already there.\n *\n * Getting that wrong was not cosmetic. `add-minion` appends the deny-all `resourceAccess` whitelist\n * verbatim, and the append REFUSES a key already present with a different value — so once a minion's\n * build task widened the whitelist, as its own design requires, the next foundation run died on that\n * minion and never reached the second one. Measured against the real scenario and apply pipeline.\n */\nconst COMPOSED_WITNESS_DIRECTORY: Readonly<Record<CompositionScenarioRef, ((variables: Readonly<Record<string, string>>) => string) | null>> = {\n [CompositionScenarioRef.ADD_MODULE]: (variables) => `shared-lib/src/modules/${variables['moduleId']}`,\n [CompositionScenarioRef.ADD_RESOURCE]: (variables) => `shared-lib/src/modules/${variables['moduleId']}/resources/${variables['resourceDir']}`,\n [CompositionScenarioRef.ADD_CUSTOM_OPERATION]: null,\n [CompositionScenarioRef.ADD_WEBSITE]: () => 'website',\n [CompositionScenarioRef.ADD_WEBSITE_SECTION]: null,\n [CompositionScenarioRef.ADD_MARKETING_PAGE]: null,\n [CompositionScenarioRef.ADD_TECHNICAL_DOC]: () => 'technical-doc',\n [CompositionScenarioRef.ADD_MINION]: (variables) => `minions/${variables['minionDir']}`,\n [CompositionScenarioRef.ADD_WORKER_NODE]: (variables) => `workers/${variables['workerDir']}`,\n [CompositionScenarioRef.ADD_WORKER_RUST]: (variables) => `workers/${variables['workerDir']}`,\n [CompositionScenarioRef.ADD_PROVIDER]: null,\n [CompositionScenarioRef.ADD_FILE_PICKER_PROVIDER]: null,\n [CompositionScenarioRef.ADD_ENVIRONMENT]: null,\n [CompositionScenarioRef.ADD_LOCALE]: null,\n // No directory of its own: the 3D layout is a dependency and a registration in the existing frontend.\n [CompositionScenarioRef.ADD_3D_LAYOUT]: null,\n};\n\n/**\n * The witness directory of an invocation that is ALREADY composed in this application, or null when it\n * must be applied — the one decision that makes a foundation re-run safe (#1544).\n */\nexport function alreadyComposedWitness(\n invocation: { readonly scenarioRef: CompositionScenarioRef; readonly variables: Readonly<Record<string, string>> },\n applicationRoot: string,\n): string | null {\n const resolveDirectory = COMPOSED_WITNESS_DIRECTORY[invocation.scenarioRef];\n const witnessDirectory = resolveDirectory === null ? null : resolveDirectory(invocation.variables);\n return witnessDirectory !== null && existsSync(join(applicationRoot, witnessDirectory)) ? witnessDirectory : null;\n}\n\n@injectable()\nexport class FoundationExecutorCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n ) {\n this.logDebug = this.logger.debugByType('FoundationExecutorCompanionService');\n }\n\n public async execute(input: {\n /** The landed domain-plan VALUE (the run service resolves it from artifact state). */\n readonly domainPlan: unknown;\n /**\n * The creator's tenancy answer — the FALLBACK, for a domain plan authored before the plan\n * carried `tenancy` itself. A plan that states it wins, because that is the committed decision.\n */\n readonly elicitationAnswers: ReadonlyArray<{ readonly questionRef: string; readonly answer: string }>;\n /** Compute and report everything, write nothing. */\n readonly dryRun?: boolean;\n }): Promise<FoundationExecutionResult> {\n const primaryScope = this.resolvePrimaryScope(input.domainPlan, input.elicitationAnswers);\n const applicationRoot = this.companionContext.saasRoot;\n const sharedLibPackage = this.readSharedLibPackageName(applicationRoot);\n\n const businessModel = await this.readLandedFamilyValue('business-model');\n const capabilityComposition = await this.readLandedFamilyValue('capability-composition');\n /* What runs beside the backend (#1495) — one scenario per worker and per minion it declares. */\n const integrationPlan = await this.readLandedFamilyValue('integration-plan');\n /* The application's line (#1605) decides whether one organization owns it. */\n const lineDeclaration = resolveApplicationLineDeclaration(await this.readLandedFamilyValue('creator-inputs') as ApplicationCreatorInputs | undefined);\n /*\n * Host facts are needed by an optional PACKAGE scenario, and a worker or a minion is one: its\n * package name derives from the application slug. So they are resolved whenever EITHER family\n * has landed, not only for the composition.\n */\n const hostFacts = capabilityComposition === undefined && integrationPlan === undefined ? undefined : await this.resolveHostFacts(applicationRoot);\n const plan = deriveFoundationCompositionPlan({\n domainPlan: input.domainPlan,\n primaryScope,\n sharedLibPackage,\n ...(businessModel === undefined ? {} : { businessModel }),\n ...(capabilityComposition === undefined ? {} : { capabilityComposition }),\n /*\n * The backend-api name is read only when a MINION will need it. An integration plan declaring\n * workers and no minion refused the whole foundation run over an unreadable manifest that\n * nothing was going to use.\n */\n ...(integrationPlan === undefined ? {} : {\n integrationPlan,\n ...(this.declaresAMinion(integrationPlan) ? { backendApiPackage: this.readBackendApiPackageName(applicationRoot) } : {}),\n }),\n ...(hostFacts === undefined ? {} : { hostFacts }),\n elicitationAnswers: input.elicitationAnswers,\n ...(lineDeclaration.state === ApplicationLineDeclarationState.DECLARED ? { applicationLine: lineDeclaration.line } : {}),\n });\n this.logDebug('Foundation composition plan derived', {\n primaryScope,\n businessModelRead: businessModel !== undefined,\n capabilityCompositionRead: capabilityComposition !== undefined,\n integrationPlanRead: integrationPlan !== undefined,\n capabilityChanges: plan.engineCapabilityChanges.length,\n capabilitiesOwedAProvider: plan.engineCapabilitiesOwedAProvider.length,\n scenarioInvocations: plan.scenarioInvocations.length,\n });\n\n // Capability first: the composed resources' primary-scope posture assumes it.\n const engineCapabilityChanges: FoundationExecutionResult['engineCapabilityChanges'][number][] = plan.engineCapabilityChanges.map((change) => {\n const result = setEngineCapabilityEnabled({\n applicationRoot,\n capability: change.capability,\n enabled: true,\n ...(input.dryRun === true ? { dryRun: true } : {}),\n });\n return { capability: change.capability, basis: change.basis, changed: result.changed, summary: result.summary };\n });\n /*\n * An owed capability is SERVED here when a credential-free engine provider exists for it (#1272)\n * — declared, selected and enabled in one pass — and stays owed otherwise. Three mutations,\n * because two of them are not optional: the boot floor needs a provider in the scope, and a\n * SELECT_ONE capability needs `selection[<capability>].primary` beside it. The capability is\n * enabled LAST, so a failure part-way leaves the application not-yet-configured rather than\n * enabled-and-unbootable.\n */\n const engineCapabilitiesOwedAProvider: FoundationExecutionResult['engineCapabilitiesOwedAProvider'][number][] = [];\n for (const owed of plan.engineCapabilitiesOwedAProvider) {\n /*\n * The creator's own choice comes FIRST (#1488): an answered provider question is a decision, and a\n * credential-free substitute must never override one. A `refused` resolution cannot occur through a\n * run (the interview validator refuses first) and is handled anyway — reported on the owed entry with\n * the offered set — so a direct caller of the executor gets the same honest answer as a run.\n */\n const selected = resolveCreatorSelectedEngineProvider(owed.capability, input.elicitationAnswers);\n if (selected?.kind === 'refused') {\n engineCapabilitiesOwedAProvider.push({ capability: owed.capability, basis: owed.basis, remedy: `${selected.reason} Answer the question again with one of them.` });\n continue;\n }\n if (selected?.kind === 'selected') {\n const writeOptions = input.dryRun === true ? { dryRun: true as const } : {};\n addProviderToScope({\n applicationRoot,\n scope: { kind: 'backend' },\n providerRef: selected.providerRef,\n engineCapabilities: [owed.capability],\n providerCapabilities: selected.providerCapabilities,\n protocols: selected.protocols,\n ...writeOptions,\n });\n if (getEngineCapabilityResolutionMode(owed.capability) === EngineCapabilityResolutionMode.SELECT_ONE) {\n setProviderSelectionPrimary({\n applicationRoot,\n scope: { kind: 'backend' },\n capability: owed.capability,\n primaryProviderRef: selected.providerRef,\n ...writeOptions,\n });\n }\n const enabled = setEngineCapabilityEnabled({ applicationRoot, capability: owed.capability, enabled: true, ...writeOptions });\n engineCapabilityChanges.push({\n capability: owed.capability,\n basis: owed.basis,\n changed: enabled.changed,\n summary: enabled.summary,\n servedByCreatorSelectedProvider: {\n providerRef: selected.providerRef,\n credentialsOwed: selected.credentialsOwed,\n remedy: selected.credentialsOwed.length === 0\n ? `\\`${selected.providerRef}\\` needs no credentials; ${owed.capability} is enabled and serving.`\n : `\\`${selected.providerRef}\\` is declared, selected and ${owed.capability} is enabled — the application boots, and `\n + `${owed.capability} answers once these are set in the environment: ${selected.credentialsOwed.map((secret) => secret.envVarName).join(', ')}.`,\n },\n });\n continue;\n }\n const provider = resolveCredentialFreeEngineProvider(owed.capability);\n if (!provider) {\n engineCapabilitiesOwedAProvider.push({\n capability: owed.capability,\n basis: owed.basis,\n remedy: `This application's own declarations imply ${owed.capability} (${owed.basis}), and it is NOT enabled: `\n + 'the engine refuses to boot with it on and no provider resolving, and every provider that serves it '\n + 'needs an account this process cannot open. Declare one that serves '\n + `${owed.capability} in \\`wildo.saas.config.ts\\` under \\`providers.scopes\\`, then enable the capability beside it.`,\n });\n continue;\n }\n const writeOptions = input.dryRun === true ? { dryRun: true as const } : {};\n addProviderToScope({\n applicationRoot,\n scope: { kind: 'backend' },\n providerRef: provider.providerRef,\n engineCapabilities: [owed.capability],\n providerCapabilities: provider.providerCapabilities,\n protocols: provider.protocols,\n ...writeOptions,\n });\n // FAN_OUT capabilities take every declared provider and carry no `selection` entry; writing\n // one would put the provider into a mechanism nothing consults.\n if (getEngineCapabilityResolutionMode(owed.capability) === EngineCapabilityResolutionMode.SELECT_ONE) {\n setProviderSelectionPrimary({\n applicationRoot,\n scope: { kind: 'backend' },\n capability: owed.capability,\n primaryProviderRef: provider.providerRef,\n ...writeOptions,\n });\n }\n const enabled = setEngineCapabilityEnabled({\n applicationRoot,\n capability: owed.capability,\n enabled: true,\n ...writeOptions,\n });\n engineCapabilityChanges.push({\n capability: owed.capability,\n basis: owed.basis,\n changed: enabled.changed,\n summary: enabled.summary,\n servedByDeclaredProvider: {\n providerRef: provider.providerRef,\n developmentSubstitute: true,\n replaceBeforeRealUsers: `\\`${provider.providerRef}\\` needs no account, which is why this run could declare it — `\n + 'and it is a DEVELOPMENT substitute. Replace it with a provider that really serves '\n + `${owed.capability} before this application faces real users.`,\n },\n });\n }\n\n const frameworkRoot = this.companionContext.resolvedHomes.framework.repositoryRoot ?? null;\n const scenarioDirectoriesByRef = listCompositionScenarioDirectories({ applicationRoot, frameworkRoot });\n const renderer: CompositionTemplateRenderer = createCompositionTemplateRenderer();\n\n const modulesComposedByThisRun = new Set(\n plan.scenarioInvocations\n .filter((invocation) => invocation.scenarioRef === CompositionScenarioRef.ADD_MODULE)\n .map((invocation) => String(invocation.variables['moduleId'])),\n );\n const scenarios: FoundationScenarioExecutionRecord[] = [];\n for (const invocation of plan.scenarioInvocations) {\n // DRY-RUN sequencing honesty: an add-resource edits its module's registry files, which the\n // same run's add-module WRITES. A real run applies sequentially so the files exist by then;\n // a dry run plans against the unmodified tree, where planning the edit would (correctly)\n // refuse on a missing target. Report the dependency instead of failing the whole preview.\n if (\n input.dryRun === true\n && invocation.scenarioRef === CompositionScenarioRef.ADD_RESOURCE\n && modulesComposedByThisRun.has(String(invocation.variables['moduleId']))\n && !existsSync(join(applicationRoot, 'shared-lib', 'src', 'modules', String(invocation.variables['moduleId'])))\n ) {\n scenarios.push({\n scenarioRef: invocation.scenarioRef,\n subject: `${invocation.variables['moduleId']}/${invocation.variables['resourceDir']}`,\n writes: 0, skippedWrites: 0, editsApplied: 0, skippedEdits: 0,\n deferredBehindModuleComposition: true,\n });\n continue;\n }\n const witnessDirectory = alreadyComposedWitness(invocation, applicationRoot);\n if (witnessDirectory !== null) {\n scenarios.push({ scenarioRef: invocation.scenarioRef, subject: witnessDirectory, writes: 0, skippedWrites: 0, editsApplied: 0, skippedEdits: 0, alreadyComposed: true });\n continue;\n }\n scenarios.push(this.applyInvocation({ invocation, applicationRoot, scenarioDirectoriesByRef, renderer, dryRun: input.dryRun === true }));\n }\n /*\n * A surface composed NOW receives the mark accepted EARLIER. The logo step propagates when it runs,\n * but once landed it is never dispatched again, so a website or portal composed after it — a\n * conception re-run that newly decides one — would serve no favicon and no Open Graph image. This is\n * the moment that surface appears, so this is where it is supplied. Nothing accepted: nothing written.\n */\n const brandPropagation = composedASurfaceReceivingTheBrand(scenarios) && input.dryRun !== true\n ? await propagateAcceptedBrand(applicationRoot, this.logger)\n : undefined;\n return {\n playbookRef: 'bottom_up.foundation',\n primaryScope,\n engineCapabilityChanges,\n engineCapabilitiesOwedAProvider,\n scenarios,\n applicationOwnership: this.declareApplicationOwnership(plan.applicationOwnership, applicationRoot, input.dryRun === true),\n compositionScenarios: plan.compositionScenarios,\n backgroundExecution: plan.backgroundExecution,\n ...(hostFacts === undefined ? {} : { hostFacts }),\n ...(brandPropagation === undefined ? {} : { brandPropagation }),\n };\n }\n\n /**\n * The host facts an optional-package scenario needs and no family declares (#1491): the slug and display\n * name from the SaaS config, the port block from the declared services, and the public domain from the\n * application's own infrastructure environments — a REMOTE one first (production, then staging), because\n * that is the apex the website and the portal derive their canonical origins from, and the local one\n * otherwise. `localhost` when no environment declares one, which is the value the framework's own local\n * example uses; the source is recorded on the result so a reader can see which it was.\n */\n private async resolveHostFacts(applicationRoot: string): Promise<FoundationHostFacts & { readonly publicDomainSource: string }> {\n const services = Object.values(this.companionContext.servicesByKey);\n const backendPort = services.find((service) => service.frontendType === undefined)?.defaultPort;\n const appPort = services.find((service) => service.frontendType === AppFrontendType.SAAS_APP)?.defaultPort;\n if (backendPort === undefined || appPort === undefined) {\n throw new FoundationExecutionError(\n 'The optional-package scenarios derive their ports from the backend and app services\\' `defaultPort`, and `wildo.saas.config.ts` declares no such port for '\n + (backendPort === undefined ? 'the backend service' : 'the app service') + '.',\n );\n }\n let publicDomain = 'localhost';\n let publicDomainSource = 'default (no environment declares a public domain)';\n for (const envName of ['production', 'staging', 'local']) {\n try {\n const loaded = await loadInfraEnvConfig(applicationRoot, envName, { freshModuleCache: true });\n const declared = (loaded?.config as { publicDomain?: unknown } | undefined)?.publicDomain;\n if (typeof declared === 'string' && declared.trim().length > 0) {\n publicDomain = declared.trim();\n publicDomainSource = `infrastructure/${envName}`;\n break;\n }\n } catch (error) {\n this.logDebug(`Could not read infrastructure/${envName}; not a source for the public domain`, { error: describeCaughtError(error) });\n }\n }\n return {\n slug: this.companionContext.saasConfig.slug,\n displayName: this.companionContext.saasConfig.displayName,\n publicDomain,\n backendPort,\n appPort,\n publicDomainSource,\n // The same reader the capability composition decided `add-locale` from, so the two cannot disagree.\n servedLanguages: getCompanionServedLanguages(this.appConfigService.config),\n };\n }\n\n /**\n * The landed `business-model` family VALUE, or `undefined` when this application has none.\n *\n * ## Why the executor reads it rather than being handed it\n *\n * The run service resolves every landed family into one `artifactsByFamily` map and passes this\n * executor the domain plan alone. Widening that hand-off is the tidier change and it is NOT the one\n * made here: that file is being actively worked by another lane, and the export field this needs is\n * already named once in the semantic-authority bindings — so reading it through the SAME binding is\n * a second door onto one vocabulary rather than a second copy of it.\n *\n * ## Lenient by design\n *\n * Absent, unloadable or unparseable all answer `undefined`, and the derivation treats that as \"this\n * decides nothing\". `bottom_up.foundation` gates on `domain-plan` and `vision-brief` alone, so an\n * eligible run legitimately has no business model — refusing here would turn one of its OPTIONAL\n * declared inputs into a precondition, which is the shape `application-creation-directive.md`\n * forbids.\n */\n /**\n * Declare the organization type that owns the application when its line requires one (#1605), BEFORE\n * the first initialization: an organization's type is fixed when it is created, so declaring it after\n * boot would need `wildo config reapply-declaration` and the `organizations.promoteToOwnerOrganization`\n * door. With exactly one declared type the answer is unambiguous; with several it is authoring work,\n * so it is marked owed, never guessed.\n */\n private declareApplicationOwnership(\n decision: { readonly required: boolean; readonly basis: string },\n applicationRoot: string,\n dryRun: boolean,\n ): NonNullable<FoundationExecutionResult['applicationOwnership']> {\n if (!decision.required) return decision;\n const organizationTypeRefs = listSaasConfigOrganizationTypeRefs({ applicationRoot });\n if (organizationTypeRefs.length !== 1) {\n return {\n ...decision,\n owed: organizationTypeRefs.length === 0\n ? 'The configuration declares no organization type; declare the one that owns the application, with `ownsApplication: true`.'\n : `The configuration declares ${organizationTypeRefs.length} organization types (${organizationTypeRefs.join(', ')}); `\n + 'mark the one that owns the application with `ownsApplication: true`.',\n };\n }\n const organizationTypeRef = organizationTypeRefs[0]!;\n const result = setOrganizationTypeOwnsApplication({ applicationRoot, organizationTypeRef, ownsApplication: true, ...(dryRun ? { dryRun: true } : {}) });\n return { ...decision, organizationTypeRef, changed: result.changed, summary: result.summary };\n }\n\n private async readLandedFamilyValue(family: 'business-model' | 'capability-composition' | 'integration-plan' | 'creator-inputs'): Promise<unknown> {\n const binding = APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.find((entry) => entry.family === family);\n if (binding?.companionExportsField === undefined) return undefined;\n try {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n return (exports as unknown as Record<string, unknown>)[binding.companionExportsField] ?? undefined;\n } catch (error) {\n this.logDebug(`Could not read the landed ${family}; nothing is derived from it`, {\n error: describeCaughtError(error),\n });\n return undefined;\n }\n }\n\n private applyInvocation(input: {\n readonly invocation: FoundationScenarioInvocation;\n readonly applicationRoot: string;\n readonly scenarioDirectoriesByRef: ReadonlyMap<string, string>;\n readonly renderer: CompositionTemplateRenderer;\n readonly dryRun: boolean;\n }): FoundationScenarioExecutionRecord {\n const scenarioDirectory = input.scenarioDirectoriesByRef.get(input.invocation.scenarioRef);\n if (!scenarioDirectory) {\n throw new FoundationExecutionError(\n `The \"${input.invocation.scenarioRef}\" composition scenario is not available to this application `\n + '(neither the app-delivered templates nor a framework checkout carries it).',\n );\n }\n const scenario = loadCompositionScenario(scenarioDirectory);\n const variables = resolveCompositionScenarioVariables(scenario.manifest, { ...input.invocation.variables });\n const plan = planCompositionScenario({ scenario, applicationRoot: input.applicationRoot, variables, renderer: input.renderer });\n const subject = input.invocation.variables['resourceDir']\n ? `${input.invocation.variables['moduleId']}/${input.invocation.variables['resourceDir']}`\n : input.invocation.variables['moduleId'] !== undefined\n ? String(input.invocation.variables['moduleId'])\n : (COMPOSED_WITNESS_DIRECTORY[input.invocation.scenarioRef]?.(input.invocation.variables) ?? input.invocation.scenarioRef);\n if (plan.collisions.length > 0) {\n // The engine's never-half-apply invariant: a collision means the application EDITED a target\n // this scenario would rewrite. Refusing with the paths is the honest outcome — the creator\n // reconciles (git is the undo), then re-runs; foundation never overwrites authored work.\n throw new FoundationExecutionError(\n `Composing ${input.invocation.scenarioRef} for ${subject} collides with existing application files: `\n + plan.collisions.join(', ')\n + ' — reconcile them (the application owns those bytes) and re-run.',\n );\n }\n if (!input.dryRun) {\n applyCompositionScenarioPlan({ plan, applicationRoot: input.applicationRoot });\n }\n return {\n scenarioRef: input.invocation.scenarioRef,\n subject,\n writes: plan.writes.length,\n skippedWrites: plan.skipped.length,\n editsApplied: plan.edits.length,\n skippedEdits: plan.skippedEdits.length,\n };\n }\n\n /**\n * The tenancy model, from the PLAN first and the interview second.\n *\n * The plan wins because it is the committed artifact: a creator who answered the question on\n * `bottom_up.domain-plan` has already had that answer shape the modules and relationships, and\n * re-asking here would let a second answer contradict a model built on the first.\n *\n * The elicitation fallback stays for plans authored before `tenancy` existed on the family schema\n * (wonder-crm and wonder-todos are both such plans). Neither source present is still a refusal:\n * the executor deliberately does not derive this.\n */\n private resolvePrimaryScope(\n domainPlan: unknown,\n answers: ReadonlyArray<{ readonly questionRef: string; readonly answer: string }>,\n ): FoundationPrimaryScope {\n const parsed = DomainPlanOutputSetSchema.safeParse(domainPlan);\n if (parsed.success && parsed.data.tenancy !== undefined) return parsed.data.tenancy;\n const answer = answers.find((candidate) => candidate.questionRef === 'primary-scope')?.answer?.trim();\n if (answer === FoundationPrimaryScope.ORGANIZATIONS || answer === FoundationPrimaryScope.USERS) return answer;\n throw new FoundationExecutionError(\n 'The tenancy model is a creator decision the executor deliberately does not derive, and neither '\n + 'source supplied it: the domain plan carries no `tenancy`, and no \"primary-scope\" elicitation '\n + 'answer (\"organizations\" or \"users\") was given.'\n + (answer ? ` Received answer: \"${answer}\".` : ''),\n );\n }\n\n private readSharedLibPackageName(applicationRoot: string): string {\n const manifestPath = join(applicationRoot, 'shared-lib', 'package.json');\n try {\n const name = (JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: string }).name;\n if (name) return name;\n } catch {\n // fall through to the named refusal below\n }\n throw new FoundationExecutionError(`Cannot read the shared-lib package name at ${manifestPath} — not a composed application root.`);\n }\n\n /**\n * Whether the landed integration plan declares a minion — read leniently, because an unparseable\n * plan declares nothing and the derivation reads it the same way.\n */\n private declaresAMinion(integrationPlan: unknown): boolean {\n const minions = (integrationPlan as { minions?: unknown } | null)?.minions;\n return Array.isArray(minions) && minions.length > 0;\n }\n\n /**\n * The backend-api package name — a minion's package re-derives the application's initialization\n * from it, so `add-minion` binds it as a variable. Read the same way as the shared-lib name, and\n * refusing the same way: a composed application root has both, and a minion composed against a\n * guessed package name produces a package that cannot resolve its own initialization.\n */\n private readBackendApiPackageName(applicationRoot: string): string {\n const manifestPath = join(applicationRoot, 'backend-api', 'package.json');\n try {\n const name = (JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: string }).name;\n if (name) return name;\n } catch {\n // fall through to the named refusal below\n }\n throw new FoundationExecutionError(`Cannot read the backend-api package name at ${manifestPath} — not a composed application root.`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"foundation-executor.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/foundation-executor.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,iCAAiC,GAElC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,E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IAAI,CAAC,eAAe,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;QAC1E,IAAI,CAAC;YACH,MAAM,IAAI,GAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAuB,CAAC,IAAI,CAAC;YACxF,IAAI,IAAI;gBAAE,OAAO,IAAI,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,0CAA0C;QAC5C,CAAC;QACD,MAAM,IAAI,wBAAwB,CAAC,+CAA+C,YAAY,qCAAqC,CAAC,CAAC;IACvI,CAAC;CACF,CAAA;AA3cY,kCAAkC;IAD9C,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GALxC,kCAAkC,CA2c9C","sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nimport { loadInfraEnvConfig } from '@wildo-ai/platform-config-lib';\n\nimport { inject, injectable } from 'inversify';\nimport {\n ApplicationLineDeclarationState,\n CompositionScenarioRef,\n DomainPlanOutputSetSchema,\n resolveApplicationLineDeclaration,\n type ApplicationCreatorInputs,\n} from '@wildo-ai/saas-specifications/application-creation';\nimport { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { propagateAcceptedBrand, type CompanionBrandPropagation } from '../../brand/services/brand-propagation.companion.utils';\nimport { AppFrontendType, EngineCapabilityResolutionMode, ProviderOriginKind, getEngineCapabilityResolutionMode, type EngineCapability } from '@wildo-ai/saas-models';\nimport { engineProviderSpecifications } from '@wildo-ai/saas-specifications';\n\nimport {\n APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS,\n addProviderToScope,\n applyCompositionScenarioPlan,\n createCompositionTemplateRenderer,\n deriveFoundationCompositionPlan,\n creatorProviderAnswerFor,\n FoundationPrimaryScope,\n listCompositionScenarioDirectories,\n loadCompositionScenario,\n planCompositionScenario,\n resolveCompositionScenarioVariables,\n setEngineCapabilityEnabled,\n setProviderSelectionPrimary,\n type CompositionTemplateRenderer,\n type FoundationCapabilityBasis,\n type FoundationBackgroundExecutionOutcome,\n type FoundationCompositionScenarioOutcome,\n type FoundationHostFacts,\n type FoundationScenarioInvocation,\n listSaasConfigOrganizationTypeRefs,\n setOrganizationTypeOwnsApplication,\n} from '@wildo-ai/application-creation-runtime';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion';\n\n/**\n * The foundation playbook's EXECUTOR — the domain-plan → compose bridge, run instead of typed by\n * hand (J-1 stall F: a human read the approved domain plan, decided the `wildo compose` calls and\n * the ORGANIZATIONS flip, derived every scenario variable, and ran them one by one).\n *\n * `bottom_up.foundation` declares `outputs: []` and `executor: \"composite\"`: it lands no\n * specification family — its deliverable is the APPLICATION (config + composed module slices).\n * The generation route therefore cannot run it (J-1 stall E); this service is what does.\n *\n * The derivation is PURE (`deriveFoundationCompositionPlan`, tested against a literal domain\n * plan); this service supplies the host facts (app root, framework root, the shared-lib package\n * name) and executes: the capability mutation through the config-mutation service, and each\n * scenario through the same engine + THE SAME renderer `wildo compose` uses — identical scenario\n * bytes produce identical files regardless of which door applied them.\n *\n * Idempotent by the engine's own contract: a re-run plans byte-identical targets as SKIPS; a\n * target that exists with DIFFERENT bytes is a collision and the whole scenario REFUSES unapplied\n * (ownership transferred to the application; git is the undo). Nothing here commits — GUIDED\n * acceptance stays a human `git commit`.\n */\n\nexport interface FoundationScenarioExecutionRecord {\n readonly scenarioRef: string;\n /** The invocation's addressing variables (moduleId, resourceDir) — enough to identify the unit. */\n readonly subject: string;\n readonly writes: number;\n readonly skippedWrites: number;\n readonly editsApplied: number;\n readonly skippedEdits: number;\n /**\n * DRY-RUN only: this invocation could not be PLANNED because it edits files a preceding\n * invocation of the same run would create (an add-resource whose module is composed by this\n * run's own add-module). A real run applies sequentially and never hits this; a dry run reports\n * the dependency honestly instead of failing on it.\n */\n readonly deferredBehindModuleComposition?: true;\n /**\n * A scenario whose witness directory already exists — a package (the website, a minion), a module or\n * a resource, composed by an earlier run or by the build since — so this run left it alone. Applying it would either skip every\n * byte-identical file (a no-op reported as writes) or refuse on the first authored one, and neither is\n * what a re-run means: the composition says the application HAS a website, and it does.\n */\n readonly alreadyComposed?: true;\n}\n\n/** The composition scenarios that create a surface serving the brand's icons and social image. */\nconst SURFACES_RECEIVING_THE_BRAND: ReadonlySet<string> = new Set<string>([\n CompositionScenarioRef.ADD_WEBSITE,\n CompositionScenarioRef.ADD_TECHNICAL_DOC,\n]);\n\n/** Whether this run composed — actually wrote, not found already composed — a surface that serves the brand. */\nexport function composedASurfaceReceivingTheBrand(scenarios: readonly Pick<FoundationScenarioExecutionRecord, 'scenarioRef' | 'writes' | 'alreadyComposed'>[]): boolean {\n return scenarios.some((record) => SURFACES_RECEIVING_THE_BRAND.has(record.scenarioRef) && record.alreadyComposed !== true && record.writes > 0);\n}\n\nexport interface FoundationExecutionResult {\n readonly playbookRef: 'bottom_up.foundation';\n readonly primaryScope: FoundationPrimaryScope;\n readonly engineCapabilityChanges: ReadonlyArray<{\n readonly capability: string;\n /** WHICH declaration decided it — so the record says why, not merely what (#1272). */\n readonly basis: FoundationCapabilityBasis;\n readonly changed: boolean;\n readonly summary: string;\n /**\n * Set when this run also DECLARED a provider so the capability could be enabled at all.\n *\n * Carried loudly rather than folded into the summary, because a credential-free provider is a\n * DEVELOPMENT SUBSTITUTE by construction — `email-preview` renders mail to a local surface and\n * its own module says to \"wire it as the `EMAIL_TRANSACTIONAL` primary in local environments…\n * with no live API key and no mail actually leaving the machine\". The application is configured\n * and working; replacing it is a deployment decision somebody still owes, and a record that did\n * not say so would let it ship unnoticed.\n *\n * spec-cite: N/A — INTERNAL. The quotation is this repository's own\n * `engine/external-connectors-private/src/providers/email-preview/email-preview.backend.module.ts`\n * module JSDoc, not an external standard. An earlier revision quoted \"never select it as primary\n * in an environment that serves real users\", which appears in no specification anywhere — a\n * paraphrase wearing quotation marks, the exact shape\n * `.claude/rules/external-specification-citations.md` exists to retire.\n */\n readonly servedByDeclaredProvider?: {\n readonly providerRef: string;\n readonly developmentSubstitute: true;\n readonly replaceBeforeRealUsers: string;\n };\n /**\n * The provider the CREATOR chose in the foundation interview (#1488), declared, selected and enabled\n * by this run. `credentialsOwed` names the env vars the provider requires and this process cannot\n * supply: the application boots (the floor reads declaration + selection), and the provider's own\n * calls fail until an operator sets them. Mark, never gate.\n */\n readonly servedByCreatorSelectedProvider?: {\n readonly providerRef: string;\n readonly credentialsOwed: ReadonlyArray<{ readonly envVarName: string; readonly description: string }>;\n readonly remedy: string;\n };\n }>;\n /**\n * Capabilities the application NEEDS and this run deliberately did not enable, because the engine\n * refuses to boot with them on and no provider resolving, and the journey cannot declare one.\n *\n * Reported rather than silently dropped: a derivation whose result nobody can see is a derivation\n * nobody acts on, and the remedy — declare a provider for it — is a sentence an operator can act\n * on today. `application-creation-directive.md`: mark, never gate.\n */\n readonly engineCapabilitiesOwedAProvider: ReadonlyArray<{\n readonly capability: string;\n readonly basis: FoundationCapabilityBasis;\n readonly remedy: string;\n }>;\n readonly scenarios: readonly FoundationScenarioExecutionRecord[];\n /** The accepted brand mark copied into a surface this run composed (a website, a portal). Absent when none was composed. */\n readonly brandPropagation?: CompanionBrandPropagation;\n /**\n * Whether this application is owned by one organization, and what this run declared for it (#1605).\n * `owed` is set when the line requires an owner and the configuration does not name one organization\n * type unambiguously: marked, never gated, since choosing among several types is authoring work.\n */\n readonly applicationOwnership?: {\n readonly required: boolean;\n readonly basis: string;\n readonly organizationTypeRef?: string;\n readonly changed?: boolean;\n readonly summary?: string;\n readonly owed?: string;\n };\n /**\n * What the capability composition decided, scenario by scenario (#1491): every scenario applied and every\n * scenario declined, with the declaration each came from. Empty when no composition has landed yet.\n */\n readonly compositionScenarios: readonly FoundationCompositionScenarioOutcome[];\n /**\n * What the run read about workers and minions (#1544): composed, declared none, or had no readable\n * integration plan to read. The last two used to be one silence.\n */\n readonly backgroundExecution: FoundationBackgroundExecutionOutcome;\n /** The host facts the optional-package scenarios were composed with, and where the public domain came from. */\n readonly hostFacts?: FoundationHostFacts & { readonly publicDomainSource: string };\n}\n\n/**\n * An engine provider this run may declare on the application's behalf, without asking anyone.\n *\n * ## The criterion is an EMPTY SECRETS CONTRACT, and that is the whole of it\n *\n * A capability in `ENGINE_CAPABILITIES_REQUIRING_A_PROVIDER_WHEN_ENABLED` cannot be enabled without\n * a provider — the backend refuses to boot. Choosing one is usually a commercial decision nobody in\n * this process is entitled to take: which payment processor, which mail vendor, on whose account.\n *\n * But a provider that declares NO SECRETS needs no account, so choosing it commits the operator to\n * nothing they can be billed or bound by. Measured across the whole engine catalogue (2026-09-17),\n * exactly two providers qualify, and only one of them serves a boot-floor capability:\n *\n * | provider | secrets | serves |\n * |---|---|---|\n * | `email-preview` | none | EMAIL_TRANSACTIONAL |\n * | `opencode` | none | AI_CODING_AGENT — not in the boot floor, and not derived by the journey |\n *\n * `stripe`, `twilio`, `resend` and every AI vendor carry a secrets contract, so BILLING and SMS stay\n * OWED. That asymmetry is the point rather than a limitation: the journey configures what costs\n * nothing to configure and leaves the commercial choices to the human who owns them.\n *\n * ## It is DERIVED from the specifications, never listed here\n *\n * A hand-kept list of another catalogue's contents is the shape that rots — the same argument the\n * build task's workspace scope makes. A provider that drops its secrets contract tomorrow becomes\n * eligible the day it does, and one that grows a secrets contract stops being, with no edit here.\n */\nexport interface SelfConfiguringProviderChoice {\n readonly providerRef: string;\n readonly providerCapabilities: readonly string[];\n readonly protocols: readonly string[];\n}\n\nexport function resolveCredentialFreeEngineProvider(capability: EngineCapability): SelfConfiguringProviderChoice | undefined {\n const candidates = Object.values(engineProviderSpecifications).filter((specification) => (\n specification.engineCapabilities.includes(capability)\n && specification.secretsContract.length === 0\n && specification.origin.kind === ProviderOriginKind.ENGINE\n // A backend-scope declaration is what the boot floor reads; a frontend-only module cannot serve it.\n && specification.facets.includes('backend')\n ));\n /*\n * Exactly one, or none. Two credential-free providers for one capability would be a CHOICE, and a\n * choice is the thing this function exists not to make on somebody's behalf — so it declines and\n * the capability stays owed, which is the outcome a human can still resolve.\n */\n if (candidates.length !== 1) return undefined;\n const chosen = candidates[0]!;\n return {\n providerRef: chosen.ref,\n providerCapabilities: chosen.providerCapabilities,\n protocols: chosen.protocols,\n };\n}\n\n/** Refusals a creator can act on (missing scope answer, unwired domain plan, collisions). */\n/**\n * The engine providers a creator may be OFFERED for a capability: ENGINE-origin, backend-scoped, serving it\n * (#1488). This is the options vocabulary of the foundation interview's provider questions, and the test\n * beside this file pins the AUTHORED options to it, so a vendor added to the catalogue is offered by being\n * added rather than by somebody remembering the question.\n */\nexport function listEngineProviderRefsServing(capability: EngineCapability): readonly string[] {\n return Object.values(engineProviderSpecifications)\n .filter((specification) => (\n specification.engineCapabilities.includes(capability)\n && specification.origin.kind === ProviderOriginKind.ENGINE\n && specification.facets.includes('backend')\n ))\n .map((specification) => specification.ref)\n .sort();\n}\n\nexport type CreatorSelectedProviderResolution =\n | {\n readonly kind: 'selected';\n readonly providerRef: string;\n readonly providerCapabilities: readonly string[];\n readonly protocols: readonly string[];\n /** The provider's REQUIRED secrets, by env var — what the operator still owes before it answers. */\n readonly credentialsOwed: ReadonlyArray<{ readonly envVarName: string; readonly description: string }>;\n }\n | {\n /** The creator named something the catalogue does not offer for this capability. Reported, never guessed around. */\n readonly kind: 'refused';\n readonly reason: string;\n };\n\n/**\n * The creator's provider choice for a capability, read off the foundation interview (#1488).\n *\n * `undefined` when the question was not answered or answered `none` (`PROVIDER_CHOICE_NONE`) — the honest\n * value: the interview requires an answer to every question, so \"decide later\" is an option, and it leaves\n * the capability OWED exactly as before (#1272). An answer outside the offered set is `refused` with the set\n * named. **That arm is a floor for DIRECT callers, not a run path**: through `runPlaybook` the interview\n * validator (`validateElicitationAnswer`) refuses an out-of-options answer before the executor is called, and\n * the compiled options are pinned to this very derivation, so a run never reaches it. Secrets are not checked\n * here: the boot floor reads declaration and selection, so the chosen provider can be declared and the\n * capability enabled while the credentials stay OWED.\n */\nexport function resolveCreatorSelectedEngineProvider(\n capability: EngineCapability,\n answers: ReadonlyArray<{ readonly questionRef: string; readonly answer: string }>,\n): CreatorSelectedProviderResolution | undefined {\n const answer = creatorProviderAnswerFor(capability, answers);\n if (answer === undefined) return undefined;\n const offered = listEngineProviderRefsServing(capability);\n const chosen = Object.values(engineProviderSpecifications).find((specification) => specification.ref === answer);\n if (!chosen || !offered.includes(answer)) {\n return {\n kind: 'refused',\n reason: `The interview answer \"${answer}\" names no engine provider serving ${capability}. Offered: ${offered.join(', ') || '(none)'}.`,\n };\n }\n return {\n kind: 'selected',\n providerRef: chosen.ref,\n providerCapabilities: chosen.providerCapabilities,\n protocols: chosen.protocols,\n credentialsOwed: chosen.secretsContract\n .filter((secret) => secret.required)\n .map((secret) => ({ envVarName: secret.envVarName, description: secret.description })),\n };\n}\n\nexport class FoundationExecutionError extends Error {}\n\n/**\n * The directory whose presence says a scenario has ALREADY been composed — its WITNESS. Total over the\n * vocabulary; `null` means the scenario has no directory of its own (a custom operation, a provider block,\n * a locale) and is never skipped on that ground.\n *\n * Modules and resources have witnesses too (#1544), and that is what makes the foundation re-runnable\n * once the build has started. With `null` for both, every re-run re-planned `add-module` and\n * `add-resource` from scratch and collided with the files the build's own tasks had written since —\n * seven of them on the first end-to-end run — and a diverged target refuses the whole scenario, so the\n * run never reached the minion it was re-run for. A module whose directory exists was composed; the\n * build owns its bytes from then on, and re-composing it can only overwrite or refuse.\n *\n * A FUNCTION of the invocation's own variables, not a constant, because three of them compose one\n * package PER SURFACE (#1496's review): a worker lands in `workers/<workerDir>` and a minion in\n * `minions/<minionDir>`, so a fixed string cannot say whether THIS minion is already there.\n *\n * Getting that wrong was not cosmetic. `add-minion` appends the deny-all `resourceAccess` whitelist\n * verbatim, and the append REFUSES a key already present with a different value — so once a minion's\n * build task widened the whitelist, as its own design requires, the next foundation run died on that\n * minion and never reached the second one. Measured against the real scenario and apply pipeline.\n */\nconst COMPOSED_WITNESS_DIRECTORY: Readonly<Record<CompositionScenarioRef, ((variables: Readonly<Record<string, string>>) => string) | null>> = {\n [CompositionScenarioRef.ADD_MODULE]: (variables) => `shared-lib/src/modules/${variables['moduleId']}`,\n [CompositionScenarioRef.ADD_RESOURCE]: (variables) => `shared-lib/src/modules/${variables['moduleId']}/resources/${variables['resourceDir']}`,\n [CompositionScenarioRef.ADD_CUSTOM_OPERATION]: null,\n [CompositionScenarioRef.ADD_WEBSITE]: () => 'website',\n [CompositionScenarioRef.ADD_WEBSITE_SECTION]: null,\n [CompositionScenarioRef.ADD_MARKETING_PAGE]: null,\n [CompositionScenarioRef.ADD_TECHNICAL_DOC]: () => 'technical-doc',\n [CompositionScenarioRef.ADD_MINION]: (variables) => `minions/${variables['minionDir']}`,\n [CompositionScenarioRef.ADD_WORKER_NODE]: (variables) => `workers/${variables['workerDir']}`,\n [CompositionScenarioRef.ADD_WORKER_RUST]: (variables) => `workers/${variables['workerDir']}`,\n [CompositionScenarioRef.ADD_PROVIDER]: null,\n [CompositionScenarioRef.ADD_FILE_PICKER_PROVIDER]: null,\n [CompositionScenarioRef.ADD_ENVIRONMENT]: null,\n [CompositionScenarioRef.ADD_LOCALE]: null,\n // No directory of its own: the 3D layout is a dependency and a registration in the existing frontend.\n [CompositionScenarioRef.ADD_3D_LAYOUT]: null,\n};\n\n/**\n * The witness directory of an invocation that is ALREADY composed in this application, or null when it\n * must be applied — the one decision that makes a foundation re-run safe (#1544).\n */\nexport function alreadyComposedWitness(\n invocation: { readonly scenarioRef: CompositionScenarioRef; readonly variables: Readonly<Record<string, string>> },\n applicationRoot: string,\n): string | null {\n const resolveDirectory = COMPOSED_WITNESS_DIRECTORY[invocation.scenarioRef];\n const witnessDirectory = resolveDirectory === null ? null : resolveDirectory(invocation.variables);\n return witnessDirectory !== null && existsSync(join(applicationRoot, witnessDirectory)) ? witnessDirectory : null;\n}\n\n@injectable()\nexport class FoundationExecutorCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('FoundationExecutorCompanionService');\n }\n\n public async execute(input: {\n /** The landed domain-plan VALUE (the run service resolves it from artifact state). */\n readonly domainPlan: unknown;\n /**\n * The creator's tenancy answer — the FALLBACK, for a domain plan authored before the plan\n * carried `tenancy` itself. A plan that states it wins, because that is the committed decision.\n */\n readonly elicitationAnswers: ReadonlyArray<{ readonly questionRef: string; readonly answer: string }>;\n /** Compute and report everything, write nothing. */\n readonly dryRun?: boolean;\n }): Promise<FoundationExecutionResult> {\n const primaryScope = this.resolvePrimaryScope(input.domainPlan, input.elicitationAnswers);\n const applicationRoot = this.companionContext.saasRoot;\n const sharedLibPackage = this.readSharedLibPackageName(applicationRoot);\n\n const businessModel = await this.readLandedFamilyValue('business-model');\n const capabilityComposition = await this.readLandedFamilyValue('capability-composition');\n /* What runs beside the backend (#1495) — one scenario per worker and per minion it declares. */\n const integrationPlan = await this.readLandedFamilyValue('integration-plan');\n /* The application's line (#1605) decides whether one organization owns it. */\n const lineDeclaration = resolveApplicationLineDeclaration(await this.readLandedFamilyValue('creator-inputs') as ApplicationCreatorInputs | undefined);\n /*\n * Host facts are needed by an optional PACKAGE scenario, and a worker or a minion is one: its\n * package name derives from the application slug. So they are resolved whenever EITHER family\n * has landed, not only for the composition.\n */\n const hostFacts = capabilityComposition === undefined && integrationPlan === undefined ? undefined : await this.resolveHostFacts(applicationRoot);\n const plan = deriveFoundationCompositionPlan({\n domainPlan: input.domainPlan,\n primaryScope,\n sharedLibPackage,\n ...(businessModel === undefined ? {} : { businessModel }),\n ...(capabilityComposition === undefined ? {} : { capabilityComposition }),\n /*\n * The backend-api name is read only when a MINION will need it. An integration plan declaring\n * workers and no minion refused the whole foundation run over an unreadable manifest that\n * nothing was going to use.\n */\n ...(integrationPlan === undefined ? {} : {\n integrationPlan,\n ...(this.declaresAMinion(integrationPlan) ? { backendApiPackage: this.readBackendApiPackageName(applicationRoot) } : {}),\n }),\n ...(hostFacts === undefined ? {} : { hostFacts }),\n elicitationAnswers: input.elicitationAnswers,\n ...(lineDeclaration.state === ApplicationLineDeclarationState.DECLARED ? { applicationLine: lineDeclaration.line } : {}),\n });\n this.logDebug('Foundation composition plan derived', {\n primaryScope,\n businessModelRead: businessModel !== undefined,\n capabilityCompositionRead: capabilityComposition !== undefined,\n integrationPlanRead: integrationPlan !== undefined,\n capabilityChanges: plan.engineCapabilityChanges.length,\n capabilitiesOwedAProvider: plan.engineCapabilitiesOwedAProvider.length,\n scenarioInvocations: plan.scenarioInvocations.length,\n });\n\n // Capability first: the composed resources' primary-scope posture assumes it.\n const engineCapabilityChanges: FoundationExecutionResult['engineCapabilityChanges'][number][] = plan.engineCapabilityChanges.map((change) => {\n const result = setEngineCapabilityEnabled({\n applicationRoot,\n capability: change.capability,\n enabled: true,\n ...(input.dryRun === true ? { dryRun: true } : {}),\n });\n return { capability: change.capability, basis: change.basis, changed: result.changed, summary: result.summary };\n });\n /*\n * An owed capability is SERVED here when a credential-free engine provider exists for it (#1272)\n * — declared, selected and enabled in one pass — and stays owed otherwise. Three mutations,\n * because two of them are not optional: the boot floor needs a provider in the scope, and a\n * SELECT_ONE capability needs `selection[<capability>].primary` beside it. The capability is\n * enabled LAST, so a failure part-way leaves the application not-yet-configured rather than\n * enabled-and-unbootable.\n */\n const engineCapabilitiesOwedAProvider: FoundationExecutionResult['engineCapabilitiesOwedAProvider'][number][] = [];\n for (const owed of plan.engineCapabilitiesOwedAProvider) {\n /*\n * The creator's own choice comes FIRST (#1488): an answered provider question is a decision, and a\n * credential-free substitute must never override one. A `refused` resolution cannot occur through a\n * run (the interview validator refuses first) and is handled anyway — reported on the owed entry with\n * the offered set — so a direct caller of the executor gets the same honest answer as a run.\n */\n const selected = resolveCreatorSelectedEngineProvider(owed.capability, input.elicitationAnswers);\n if (selected?.kind === 'refused') {\n engineCapabilitiesOwedAProvider.push({ capability: owed.capability, basis: owed.basis, remedy: `${selected.reason} Answer the question again with one of them.` });\n continue;\n }\n if (selected?.kind === 'selected') {\n const writeOptions = input.dryRun === true ? { dryRun: true as const } : {};\n addProviderToScope({\n applicationRoot,\n scope: { kind: 'backend' },\n providerRef: selected.providerRef,\n engineCapabilities: [owed.capability],\n providerCapabilities: selected.providerCapabilities,\n protocols: selected.protocols,\n ...writeOptions,\n });\n if (getEngineCapabilityResolutionMode(owed.capability) === EngineCapabilityResolutionMode.SELECT_ONE) {\n setProviderSelectionPrimary({\n applicationRoot,\n scope: { kind: 'backend' },\n capability: owed.capability,\n primaryProviderRef: selected.providerRef,\n ...writeOptions,\n });\n }\n const enabled = setEngineCapabilityEnabled({ applicationRoot, capability: owed.capability, enabled: true, ...writeOptions });\n engineCapabilityChanges.push({\n capability: owed.capability,\n basis: owed.basis,\n changed: enabled.changed,\n summary: enabled.summary,\n servedByCreatorSelectedProvider: {\n providerRef: selected.providerRef,\n credentialsOwed: selected.credentialsOwed,\n remedy: selected.credentialsOwed.length === 0\n ? `\\`${selected.providerRef}\\` needs no credentials; ${owed.capability} is enabled and serving.`\n : `\\`${selected.providerRef}\\` is declared, selected and ${owed.capability} is enabled — the application boots, and `\n + `${owed.capability} answers once these are set in the environment: ${selected.credentialsOwed.map((secret) => secret.envVarName).join(', ')}.`,\n },\n });\n continue;\n }\n const provider = resolveCredentialFreeEngineProvider(owed.capability);\n if (!provider) {\n engineCapabilitiesOwedAProvider.push({\n capability: owed.capability,\n basis: owed.basis,\n remedy: `This application's own declarations imply ${owed.capability} (${owed.basis}), and it is NOT enabled: `\n + 'the engine refuses to boot with it on and no provider resolving, and every provider that serves it '\n + 'needs an account this process cannot open. Declare one that serves '\n + `${owed.capability} in \\`wildo.saas.config.ts\\` under \\`providers.scopes\\`, then enable the capability beside it.`,\n });\n continue;\n }\n const writeOptions = input.dryRun === true ? { dryRun: true as const } : {};\n addProviderToScope({\n applicationRoot,\n scope: { kind: 'backend' },\n providerRef: provider.providerRef,\n engineCapabilities: [owed.capability],\n providerCapabilities: provider.providerCapabilities,\n protocols: provider.protocols,\n ...writeOptions,\n });\n // FAN_OUT capabilities take every declared provider and carry no `selection` entry; writing\n // one would put the provider into a mechanism nothing consults.\n if (getEngineCapabilityResolutionMode(owed.capability) === EngineCapabilityResolutionMode.SELECT_ONE) {\n setProviderSelectionPrimary({\n applicationRoot,\n scope: { kind: 'backend' },\n capability: owed.capability,\n primaryProviderRef: provider.providerRef,\n ...writeOptions,\n });\n }\n const enabled = setEngineCapabilityEnabled({\n applicationRoot,\n capability: owed.capability,\n enabled: true,\n ...writeOptions,\n });\n engineCapabilityChanges.push({\n capability: owed.capability,\n basis: owed.basis,\n changed: enabled.changed,\n summary: enabled.summary,\n servedByDeclaredProvider: {\n providerRef: provider.providerRef,\n developmentSubstitute: true,\n replaceBeforeRealUsers: `\\`${provider.providerRef}\\` needs no account, which is why this run could declare it — `\n + 'and it is a DEVELOPMENT substitute. Replace it with a provider that really serves '\n + `${owed.capability} before this application faces real users.`,\n },\n });\n }\n\n const frameworkRoot = this.companionContext.resolvedHomes.framework.repositoryRoot ?? null;\n const scenarioDirectoriesByRef = listCompositionScenarioDirectories({ applicationRoot, frameworkRoot });\n const renderer: CompositionTemplateRenderer = createCompositionTemplateRenderer();\n\n const modulesComposedByThisRun = new Set(\n plan.scenarioInvocations\n .filter((invocation) => invocation.scenarioRef === CompositionScenarioRef.ADD_MODULE)\n .map((invocation) => String(invocation.variables['moduleId'])),\n );\n const scenarios: FoundationScenarioExecutionRecord[] = [];\n for (const invocation of plan.scenarioInvocations) {\n // DRY-RUN sequencing honesty: an add-resource edits its module's registry files, which the\n // same run's add-module WRITES. A real run applies sequentially so the files exist by then;\n // a dry run plans against the unmodified tree, where planning the edit would (correctly)\n // refuse on a missing target. Report the dependency instead of failing the whole preview.\n if (\n input.dryRun === true\n && invocation.scenarioRef === CompositionScenarioRef.ADD_RESOURCE\n && modulesComposedByThisRun.has(String(invocation.variables['moduleId']))\n && !existsSync(join(applicationRoot, 'shared-lib', 'src', 'modules', String(invocation.variables['moduleId'])))\n ) {\n scenarios.push({\n scenarioRef: invocation.scenarioRef,\n subject: `${invocation.variables['moduleId']}/${invocation.variables['resourceDir']}`,\n writes: 0, skippedWrites: 0, editsApplied: 0, skippedEdits: 0,\n deferredBehindModuleComposition: true,\n });\n continue;\n }\n const witnessDirectory = alreadyComposedWitness(invocation, applicationRoot);\n if (witnessDirectory !== null) {\n scenarios.push({ scenarioRef: invocation.scenarioRef, subject: witnessDirectory, writes: 0, skippedWrites: 0, editsApplied: 0, skippedEdits: 0, alreadyComposed: true });\n continue;\n }\n scenarios.push(this.applyInvocation({ invocation, applicationRoot, scenarioDirectoriesByRef, renderer, dryRun: input.dryRun === true }));\n }\n /*\n * A surface composed NOW receives the mark accepted EARLIER. The logo step propagates when it runs,\n * but once landed it is never dispatched again, so a website or portal composed after it — a\n * conception re-run that newly decides one — would serve no favicon and no Open Graph image. This is\n * the moment that surface appears, so this is where it is supplied. Nothing accepted: nothing written.\n */\n const brandPropagation = composedASurfaceReceivingTheBrand(scenarios) && input.dryRun !== true\n ? await propagateAcceptedBrand(applicationRoot, this.logger)\n : undefined;\n return {\n playbookRef: 'bottom_up.foundation',\n primaryScope,\n engineCapabilityChanges,\n engineCapabilitiesOwedAProvider,\n scenarios,\n applicationOwnership: this.declareApplicationOwnership(plan.applicationOwnership, applicationRoot, input.dryRun === true),\n compositionScenarios: plan.compositionScenarios,\n backgroundExecution: plan.backgroundExecution,\n ...(hostFacts === undefined ? {} : { hostFacts }),\n ...(brandPropagation === undefined ? {} : { brandPropagation }),\n };\n }\n\n /**\n * The host facts an optional-package scenario needs and no family declares (#1491): the slug and display\n * name from the SaaS config, the port block from the declared services, and the public domain from the\n * application's own infrastructure environments — a REMOTE one first (production, then staging), because\n * that is the apex the website and the portal derive their canonical origins from, and the local one\n * otherwise. `localhost` when no environment declares one, which is the value the framework's own local\n * example uses; the source is recorded on the result so a reader can see which it was.\n */\n private async resolveHostFacts(applicationRoot: string): Promise<FoundationHostFacts & { readonly publicDomainSource: string }> {\n const services = Object.values(this.companionContext.servicesByKey);\n const backendPort = services.find((service) => service.frontendType === undefined)?.defaultPort;\n const appPort = services.find((service) => service.frontendType === AppFrontendType.SAAS_APP)?.defaultPort;\n if (backendPort === undefined || appPort === undefined) {\n throw new FoundationExecutionError(\n 'The optional-package scenarios derive their ports from the backend and app services\\' `defaultPort`, and `wildo.saas.config.ts` declares no such port for '\n + (backendPort === undefined ? 'the backend service' : 'the app service') + '.',\n );\n }\n let publicDomain = 'localhost';\n let publicDomainSource = 'default (no environment declares a public domain)';\n for (const envName of ['production', 'staging', 'local']) {\n try {\n const loaded = await loadInfraEnvConfig(applicationRoot, envName, { freshModuleCache: true });\n const declared = (loaded?.config as { publicDomain?: unknown } | undefined)?.publicDomain;\n if (typeof declared === 'string' && declared.trim().length > 0) {\n publicDomain = declared.trim();\n publicDomainSource = `infrastructure/${envName}`;\n break;\n }\n } catch (error) {\n this.logDebug(`Could not read infrastructure/${envName}; not a source for the public domain`, { error: describeCaughtError(error) });\n }\n }\n return {\n slug: this.companionContext.saasConfig.slug,\n displayName: this.companionContext.saasConfig.displayName,\n publicDomain,\n backendPort,\n appPort,\n publicDomainSource,\n };\n }\n\n /**\n * The landed `business-model` family VALUE, or `undefined` when this application has none.\n *\n * ## Why the executor reads it rather than being handed it\n *\n * The run service resolves every landed family into one `artifactsByFamily` map and passes this\n * executor the domain plan alone. Widening that hand-off is the tidier change and it is NOT the one\n * made here: that file is being actively worked by another lane, and the export field this needs is\n * already named once in the semantic-authority bindings — so reading it through the SAME binding is\n * a second door onto one vocabulary rather than a second copy of it.\n *\n * ## Lenient by design\n *\n * Absent, unloadable or unparseable all answer `undefined`, and the derivation treats that as \"this\n * decides nothing\". `bottom_up.foundation` gates on `domain-plan` and `vision-brief` alone, so an\n * eligible run legitimately has no business model — refusing here would turn one of its OPTIONAL\n * declared inputs into a precondition, which is the shape `application-creation-directive.md`\n * forbids.\n */\n /**\n * Declare the organization type that owns the application when its line requires one (#1605), BEFORE\n * the first initialization: an organization's type is fixed when it is created, so declaring it after\n * boot would need `wildo config reapply-declaration` and the `organizations.promoteToOwnerOrganization`\n * door. With exactly one declared type the answer is unambiguous; with several it is authoring work,\n * so it is marked owed, never guessed.\n */\n private declareApplicationOwnership(\n decision: { readonly required: boolean; readonly basis: string },\n applicationRoot: string,\n dryRun: boolean,\n ): NonNullable<FoundationExecutionResult['applicationOwnership']> {\n if (!decision.required) return decision;\n const organizationTypeRefs = listSaasConfigOrganizationTypeRefs({ applicationRoot });\n if (organizationTypeRefs.length !== 1) {\n return {\n ...decision,\n owed: organizationTypeRefs.length === 0\n ? 'The configuration declares no organization type; declare the one that owns the application, with `ownsApplication: true`.'\n : `The configuration declares ${organizationTypeRefs.length} organization types (${organizationTypeRefs.join(', ')}); `\n + 'mark the one that owns the application with `ownsApplication: true`.',\n };\n }\n const organizationTypeRef = organizationTypeRefs[0]!;\n const result = setOrganizationTypeOwnsApplication({ applicationRoot, organizationTypeRef, ownsApplication: true, ...(dryRun ? { dryRun: true } : {}) });\n return { ...decision, organizationTypeRef, changed: result.changed, summary: result.summary };\n }\n\n private async readLandedFamilyValue(family: 'business-model' | 'capability-composition' | 'integration-plan' | 'creator-inputs'): Promise<unknown> {\n const binding = APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS.find((entry) => entry.family === family);\n if (binding?.companionExportsField === undefined) return undefined;\n try {\n const exports = await loadSpecificationsCompanionExports(this.companionContext);\n return (exports as unknown as Record<string, unknown>)[binding.companionExportsField] ?? undefined;\n } catch (error) {\n this.logDebug(`Could not read the landed ${family}; nothing is derived from it`, {\n error: describeCaughtError(error),\n });\n return undefined;\n }\n }\n\n private applyInvocation(input: {\n readonly invocation: FoundationScenarioInvocation;\n readonly applicationRoot: string;\n readonly scenarioDirectoriesByRef: ReadonlyMap<string, string>;\n readonly renderer: CompositionTemplateRenderer;\n readonly dryRun: boolean;\n }): FoundationScenarioExecutionRecord {\n const scenarioDirectory = input.scenarioDirectoriesByRef.get(input.invocation.scenarioRef);\n if (!scenarioDirectory) {\n throw new FoundationExecutionError(\n `The \"${input.invocation.scenarioRef}\" composition scenario is not available to this application `\n + '(neither the app-delivered templates nor a framework checkout carries it).',\n );\n }\n const scenario = loadCompositionScenario(scenarioDirectory);\n const variables = resolveCompositionScenarioVariables(scenario.manifest, { ...input.invocation.variables });\n const plan = planCompositionScenario({ scenario, applicationRoot: input.applicationRoot, variables, renderer: input.renderer });\n const subject = input.invocation.variables['resourceDir']\n ? `${input.invocation.variables['moduleId']}/${input.invocation.variables['resourceDir']}`\n : input.invocation.variables['moduleId'] !== undefined\n ? String(input.invocation.variables['moduleId'])\n : (COMPOSED_WITNESS_DIRECTORY[input.invocation.scenarioRef]?.(input.invocation.variables) ?? input.invocation.scenarioRef);\n if (plan.collisions.length > 0) {\n // The engine's never-half-apply invariant: a collision means the application EDITED a target\n // this scenario would rewrite. Refusing with the paths is the honest outcome — the creator\n // reconciles (git is the undo), then re-runs; foundation never overwrites authored work.\n throw new FoundationExecutionError(\n `Composing ${input.invocation.scenarioRef} for ${subject} collides with existing application files: `\n + plan.collisions.join(', ')\n + ' — reconcile them (the application owns those bytes) and re-run.',\n );\n }\n if (!input.dryRun) {\n applyCompositionScenarioPlan({ plan, applicationRoot: input.applicationRoot });\n }\n return {\n scenarioRef: input.invocation.scenarioRef,\n subject,\n writes: plan.writes.length,\n skippedWrites: plan.skipped.length,\n editsApplied: plan.edits.length,\n skippedEdits: plan.skippedEdits.length,\n };\n }\n\n /**\n * The tenancy model, from the PLAN first and the interview second.\n *\n * The plan wins because it is the committed artifact: a creator who answered the question on\n * `bottom_up.domain-plan` has already had that answer shape the modules and relationships, and\n * re-asking here would let a second answer contradict a model built on the first.\n *\n * The elicitation fallback stays for plans authored before `tenancy` existed on the family schema\n * (wonder-crm and wonder-todos are both such plans). Neither source present is still a refusal:\n * the executor deliberately does not derive this.\n */\n private resolvePrimaryScope(\n domainPlan: unknown,\n answers: ReadonlyArray<{ readonly questionRef: string; readonly answer: string }>,\n ): FoundationPrimaryScope {\n const parsed = DomainPlanOutputSetSchema.safeParse(domainPlan);\n if (parsed.success && parsed.data.tenancy !== undefined) return parsed.data.tenancy;\n const answer = answers.find((candidate) => candidate.questionRef === 'primary-scope')?.answer?.trim();\n if (answer === FoundationPrimaryScope.ORGANIZATIONS || answer === FoundationPrimaryScope.USERS) return answer;\n throw new FoundationExecutionError(\n 'The tenancy model is a creator decision the executor deliberately does not derive, and neither '\n + 'source supplied it: the domain plan carries no `tenancy`, and no \"primary-scope\" elicitation '\n + 'answer (\"organizations\" or \"users\") was given.'\n + (answer ? ` Received answer: \"${answer}\".` : ''),\n );\n }\n\n private readSharedLibPackageName(applicationRoot: string): string {\n const manifestPath = join(applicationRoot, 'shared-lib', 'package.json');\n try {\n const name = (JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: string }).name;\n if (name) return name;\n } catch {\n // fall through to the named refusal below\n }\n throw new FoundationExecutionError(`Cannot read the shared-lib package name at ${manifestPath} — not a composed application root.`);\n }\n\n /**\n * Whether the landed integration plan declares a minion — read leniently, because an unparseable\n * plan declares nothing and the derivation reads it the same way.\n */\n private declaresAMinion(integrationPlan: unknown): boolean {\n const minions = (integrationPlan as { minions?: unknown } | null)?.minions;\n return Array.isArray(minions) && minions.length > 0;\n }\n\n /**\n * The backend-api package name — a minion's package re-derives the application's initialization\n * from it, so `add-minion` binds it as a variable. Read the same way as the shared-lib name, and\n * refusing the same way: a composed application root has both, and a minion composed against a\n * guessed package name produces a package that cannot resolve its own initialization.\n */\n private readBackendApiPackageName(applicationRoot: string): string {\n const manifestPath = join(applicationRoot, 'backend-api', 'package.json');\n try {\n const name = (JSON.parse(readFileSync(manifestPath, 'utf8')) as { name?: string }).name;\n if (name) return name;\n } catch {\n // fall through to the named refusal below\n }\n throw new FoundationExecutionError(`Cannot read the backend-api package name at ${manifestPath} — not a composed application root.`);\n }\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type InterviewAnswerProposal } from '@wildo-ai/application-creation-runtime';
|
|
2
|
+
import type { ApplicationCreatorInputs, MetaWorkflowPlaybook } from '@wildo-ai/saas-specifications/application-creation';
|
|
3
|
+
import type { ZodType } from 'zod';
|
|
4
|
+
/**
|
|
5
|
+
* PROPOSE answers to interview questions the person does not know (#2129) — the companion half.
|
|
6
|
+
*
|
|
7
|
+
* The runtime owns what a proposal IS (`interview-answer-proposal.application-creation.service.ts`): which
|
|
8
|
+
* questions to propose, the prompt, the output contract, and the check of what comes back. This owns only the
|
|
9
|
+
* call and the retry, and it WRITES NOTHING: the proposals go back to the caller. A surface shows them to the
|
|
10
|
+
* person, and what they keep is answered through the ordinary answer door as ASSUMED; an unattended round
|
|
11
|
+
* (`PlaybookRunCompanionService.assumeInterviewAnswers`) records them as ASSUMED itself, through the same door.
|
|
12
|
+
*
|
|
13
|
+
* ## Why one call for every surface
|
|
14
|
+
*
|
|
15
|
+
* The plugin, the workbench conversation, the console and the unattended loop and composite runs all reach this
|
|
16
|
+
* one function through the companion, bound once by `PlaybookRunCompanionService.interviewAnswerProposalPorts()`,
|
|
17
|
+
* so a proposal reads the same whichever asked. A plugin-side proposer would have lived in prompt
|
|
18
|
+
* prose and left the workbench with nothing.
|
|
19
|
+
*/
|
|
20
|
+
/** What a proposal reads and calls. Bound by the controller to the dossier service and the playbook lane's generation port. */
|
|
21
|
+
export interface InterviewAnswerProposalPorts {
|
|
22
|
+
/** The playbook as an answer to it is checked — the options a proposal must choose from are the ones the dossier offers. */
|
|
23
|
+
readonly readAnswerablePlaybook: (playbookRef: string) => Promise<MetaWorkflowPlaybook | undefined>;
|
|
24
|
+
/** Every playbook that interviews, for the question texts the dossier is rendered through. */
|
|
25
|
+
readonly listInterviewPlaybooks: () => readonly MetaWorkflowPlaybook[];
|
|
26
|
+
readonly readCreatorInputs: () => Promise<ApplicationCreatorInputs | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* The landed families, as the run reads them: the proposer is shown the ones the asking playbook declares as
|
|
29
|
+
* inputs, so a proposal for the brand's visual direction rests on the market's voice and not only on what the
|
|
30
|
+
* creator typed. Absent (a test, a host with no tree), proposals rest on the dossier alone.
|
|
31
|
+
*/
|
|
32
|
+
readonly readArtifactsByFamily?: () => Promise<ReadonlyMap<string, unknown>>;
|
|
33
|
+
/**
|
|
34
|
+
* ONE schema-constrained model call. The playbook lane's own port (`PlaybookRunCompanionService.generateStructured`),
|
|
35
|
+
* so a proposal is counted by the same runaway breaker as every other lane call.
|
|
36
|
+
*/
|
|
37
|
+
readonly generate: (input: {
|
|
38
|
+
readonly prompt: string;
|
|
39
|
+
readonly schema: ZodType<unknown>;
|
|
40
|
+
readonly label: string;
|
|
41
|
+
}) => Promise<{
|
|
42
|
+
readonly output: unknown;
|
|
43
|
+
readonly generationFindings?: readonly string[];
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export interface InterviewAnswerProposalResult {
|
|
47
|
+
readonly playbookRef: string;
|
|
48
|
+
readonly proposals: readonly InterviewAnswerProposal[];
|
|
49
|
+
/** Asked for, and nothing admissible came back — each with the last refusal. The person answers these. */
|
|
50
|
+
readonly unproposed: readonly {
|
|
51
|
+
readonly questionRef: string;
|
|
52
|
+
readonly reason: string;
|
|
53
|
+
}[];
|
|
54
|
+
}
|
|
55
|
+
/** Attempts per proposal call, matching the generation lane's default of three attempts per output. */
|
|
56
|
+
export declare const INTERVIEW_ANSWER_PROPOSAL_MAXIMUM_ATTEMPTS = 3;
|
|
57
|
+
/**
|
|
58
|
+
* Propose answers for `questionRefs`, or — when none are named — for every unanswered question the
|
|
59
|
+
* application's interview depth does not ask of the person. Refuses, before any call, a playbook that is not
|
|
60
|
+
* in the catalog and a question only the person may answer.
|
|
61
|
+
*/
|
|
62
|
+
export declare function proposeInterviewAnswers(ports: InterviewAnswerProposalPorts, request: {
|
|
63
|
+
readonly playbookRef: string;
|
|
64
|
+
readonly instanceKey?: string;
|
|
65
|
+
readonly questionRefs?: readonly string[];
|
|
66
|
+
}): Promise<InterviewAnswerProposalResult>;
|
|
67
|
+
//# sourceMappingURL=interview-answer-proposal.companion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interview-answer-proposal.companion.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/interview-answer-proposal.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,uBAAuB,EAC7B,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AACzH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC;;;;;;;;;;;;;;;GAeG;AAEH,+HAA+H;AAC/H,MAAM,WAAW,4BAA4B;IAC3C,4HAA4H;IAC5H,QAAQ,CAAC,sBAAsB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;IACpG,8FAA8F;IAC9F,QAAQ,CAAC,sBAAsB,EAAE,MAAM,SAAS,oBAAoB,EAAE,CAAC;IACvE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAC;IAChF;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7E;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;QAC5H,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;QACzB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACjD,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACvD,0GAA0G;IAC1G,QAAQ,CAAC,UAAU,EAAE,SAAS;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3F;AAED,uGAAuG;AACvG,eAAO,MAAM,0CAA0C,IAAI,CAAC;AAE5D;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,4BAA4B,EACnC,OAAO,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAClH,OAAO,CAAC,6BAA6B,CAAC,CAoDxC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { InterviewAnswerProposalOutputSchema, PlaybookElicitationError, admitInterviewAnswerProposals, assertInterviewProposalTargets, composeInterviewAnswerProposalPrompt, defaultInterviewProposalTargets, renderApplicationContextForProposal, renderDossierForProposal, unansweredElicitationQuestionRefs, } from '@wildo-ai/application-creation-runtime';
|
|
2
|
+
/** Attempts per proposal call, matching the generation lane's default of three attempts per output. */
|
|
3
|
+
export const INTERVIEW_ANSWER_PROPOSAL_MAXIMUM_ATTEMPTS = 3;
|
|
4
|
+
/**
|
|
5
|
+
* Propose answers for `questionRefs`, or — when none are named — for every unanswered question the
|
|
6
|
+
* application's interview depth does not ask of the person. Refuses, before any call, a playbook that is not
|
|
7
|
+
* in the catalog and a question only the person may answer.
|
|
8
|
+
*/
|
|
9
|
+
export async function proposeInterviewAnswers(ports, request) {
|
|
10
|
+
const playbook = await ports.readAnswerablePlaybook(request.playbookRef);
|
|
11
|
+
if (!playbook)
|
|
12
|
+
throw new PlaybookElicitationError(`No compiled playbook is registered under "${request.playbookRef}", so there is nothing to propose for.`);
|
|
13
|
+
const creatorInputs = await ports.readCreatorInputs();
|
|
14
|
+
const targets = request.questionRefs !== undefined
|
|
15
|
+
? [...new Set(request.questionRefs)]
|
|
16
|
+
: defaultInterviewProposalTargets({
|
|
17
|
+
playbook,
|
|
18
|
+
unansweredQuestionRefs: unansweredElicitationQuestionRefs(playbook, creatorInputs, request.instanceKey),
|
|
19
|
+
interviewDepth: creatorInputs?.interviewDepth,
|
|
20
|
+
});
|
|
21
|
+
assertInterviewProposalTargets(playbook, targets);
|
|
22
|
+
if (targets.length === 0)
|
|
23
|
+
return { playbookRef: playbook.ref, proposals: [], unproposed: [] };
|
|
24
|
+
const dossier = renderDossierForProposal({ catalog: ports.listInterviewPlaybooks(), creatorInputs });
|
|
25
|
+
const applicationContext = ports.readArtifactsByFamily
|
|
26
|
+
? renderApplicationContextForProposal({ playbook, artifactsByFamily: await ports.readArtifactsByFamily() })
|
|
27
|
+
: undefined;
|
|
28
|
+
const admitted = new Map();
|
|
29
|
+
let remaining = targets;
|
|
30
|
+
let findings = [];
|
|
31
|
+
for (let attempt = 1; attempt <= INTERVIEW_ANSWER_PROPOSAL_MAXIMUM_ATTEMPTS && remaining.length > 0; attempt += 1) {
|
|
32
|
+
const generated = await ports.generate({
|
|
33
|
+
prompt: composeInterviewAnswerProposalPrompt({
|
|
34
|
+
playbook,
|
|
35
|
+
targetQuestionRefs: remaining,
|
|
36
|
+
dossier,
|
|
37
|
+
...(applicationContext !== undefined ? { applicationContext } : {}),
|
|
38
|
+
findings,
|
|
39
|
+
}),
|
|
40
|
+
schema: InterviewAnswerProposalOutputSchema,
|
|
41
|
+
label: `interview-proposal:${playbook.ref}:attempt-${attempt}`,
|
|
42
|
+
});
|
|
43
|
+
const parsed = InterviewAnswerProposalOutputSchema.safeParse(generated.output);
|
|
44
|
+
if (!parsed.success) {
|
|
45
|
+
/* The provider's own refusal reason when it gave one; otherwise the schema's. Either goes back verbatim. */
|
|
46
|
+
findings = generated.generationFindings?.length ? generated.generationFindings : parsed.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const checked = admitInterviewAnswerProposals({ playbook, targetQuestionRefs: remaining, output: parsed.data });
|
|
50
|
+
for (const proposal of checked.admitted)
|
|
51
|
+
admitted.set(proposal.questionRef, proposal);
|
|
52
|
+
remaining = remaining.filter((ref) => !admitted.has(ref));
|
|
53
|
+
findings = checked.findings;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
playbookRef: playbook.ref,
|
|
57
|
+
proposals: targets.flatMap((ref) => (admitted.has(ref) ? [admitted.get(ref)] : [])),
|
|
58
|
+
unproposed: remaining.map((questionRef) => ({
|
|
59
|
+
questionRef,
|
|
60
|
+
reason: findings.find((finding) => finding.includes(`"${questionRef}"`)) ?? findings[0] ?? 'No admissible proposal came back.',
|
|
61
|
+
})),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=interview-answer-proposal.companion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interview-answer-proposal.companion.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/interview-answer-proposal.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACxB,6BAA6B,EAC7B,8BAA8B,EAC9B,oCAAoC,EACpC,+BAA+B,EAC/B,mCAAmC,EACnC,wBAAwB,EACxB,iCAAiC,GAEl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AE,CAAC,CAAC;QAChH,KAAK,MAAM,QAAQ,IAAI,OAAO,CAAC,QAAQ;YAAE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACtF,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC9B,CAAC;IACD,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,GAAG;QACzB,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACpF,UAAU,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAC1C,WAAW;YACX,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,mCAAmC;SAC/H,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC","sourcesContent":["import {\n InterviewAnswerProposalOutputSchema,\n PlaybookElicitationError,\n admitInterviewAnswerProposals,\n assertInterviewProposalTargets,\n composeInterviewAnswerProposalPrompt,\n defaultInterviewProposalTargets,\n renderApplicationContextForProposal,\n renderDossierForProposal,\n unansweredElicitationQuestionRefs,\n type InterviewAnswerProposal,\n} from '@wildo-ai/application-creation-runtime';\nimport type { ApplicationCreatorInputs, MetaWorkflowPlaybook } from '@wildo-ai/saas-specifications/application-creation';\nimport type { ZodType } from 'zod';\n\n/**\n * PROPOSE answers to interview questions the person does not know (#2129) — the companion half.\n *\n * The runtime owns what a proposal IS (`interview-answer-proposal.application-creation.service.ts`): which\n * questions to propose, the prompt, the output contract, and the check of what comes back. This owns only the\n * call and the retry, and it WRITES NOTHING: the proposals go back to the caller. A surface shows them to the\n * person, and what they keep is answered through the ordinary answer door as ASSUMED; an unattended round\n * (`PlaybookRunCompanionService.assumeInterviewAnswers`) records them as ASSUMED itself, through the same door.\n *\n * ## Why one call for every surface\n *\n * The plugin, the workbench conversation, the console and the unattended loop and composite runs all reach this\n * one function through the companion, bound once by `PlaybookRunCompanionService.interviewAnswerProposalPorts()`,\n * so a proposal reads the same whichever asked. A plugin-side proposer would have lived in prompt\n * prose and left the workbench with nothing.\n */\n\n/** What a proposal reads and calls. Bound by the controller to the dossier service and the playbook lane's generation port. */\nexport interface InterviewAnswerProposalPorts {\n /** The playbook as an answer to it is checked — the options a proposal must choose from are the ones the dossier offers. */\n readonly readAnswerablePlaybook: (playbookRef: string) => Promise<MetaWorkflowPlaybook | undefined>;\n /** Every playbook that interviews, for the question texts the dossier is rendered through. */\n readonly listInterviewPlaybooks: () => readonly MetaWorkflowPlaybook[];\n readonly readCreatorInputs: () => Promise<ApplicationCreatorInputs | undefined>;\n /**\n * The landed families, as the run reads them: the proposer is shown the ones the asking playbook declares as\n * inputs, so a proposal for the brand's visual direction rests on the market's voice and not only on what the\n * creator typed. Absent (a test, a host with no tree), proposals rest on the dossier alone.\n */\n readonly readArtifactsByFamily?: () => Promise<ReadonlyMap<string, unknown>>;\n /**\n * ONE schema-constrained model call. The playbook lane's own port (`PlaybookRunCompanionService.generateStructured`),\n * so a proposal is counted by the same runaway breaker as every other lane call.\n */\n readonly generate: (input: { readonly prompt: string; readonly schema: ZodType<unknown>; readonly label: string }) => Promise<{\n readonly output: unknown;\n readonly generationFindings?: readonly string[];\n }>;\n}\n\nexport interface InterviewAnswerProposalResult {\n readonly playbookRef: string;\n readonly proposals: readonly InterviewAnswerProposal[];\n /** Asked for, and nothing admissible came back — each with the last refusal. The person answers these. */\n readonly unproposed: readonly { readonly questionRef: string; readonly reason: string }[];\n}\n\n/** Attempts per proposal call, matching the generation lane's default of three attempts per output. */\nexport const INTERVIEW_ANSWER_PROPOSAL_MAXIMUM_ATTEMPTS = 3;\n\n/**\n * Propose answers for `questionRefs`, or — when none are named — for every unanswered question the\n * application's interview depth does not ask of the person. Refuses, before any call, a playbook that is not\n * in the catalog and a question only the person may answer.\n */\nexport async function proposeInterviewAnswers(\n ports: InterviewAnswerProposalPorts,\n request: { readonly playbookRef: string; readonly instanceKey?: string; readonly questionRefs?: readonly string[] },\n): Promise<InterviewAnswerProposalResult> {\n const playbook = await ports.readAnswerablePlaybook(request.playbookRef);\n if (!playbook) throw new PlaybookElicitationError(`No compiled playbook is registered under \"${request.playbookRef}\", so there is nothing to propose for.`);\n const creatorInputs = await ports.readCreatorInputs();\n const targets = request.questionRefs !== undefined\n ? [...new Set(request.questionRefs)]\n : defaultInterviewProposalTargets({\n playbook,\n unansweredQuestionRefs: unansweredElicitationQuestionRefs(playbook, creatorInputs, request.instanceKey),\n interviewDepth: creatorInputs?.interviewDepth,\n });\n assertInterviewProposalTargets(playbook, targets);\n if (targets.length === 0) return { playbookRef: playbook.ref, proposals: [], unproposed: [] };\n\n const dossier = renderDossierForProposal({ catalog: ports.listInterviewPlaybooks(), creatorInputs });\n const applicationContext = ports.readArtifactsByFamily\n ? renderApplicationContextForProposal({ playbook, artifactsByFamily: await ports.readArtifactsByFamily() })\n : undefined;\n const admitted = new Map<string, InterviewAnswerProposal>();\n let remaining = targets;\n let findings: readonly string[] = [];\n for (let attempt = 1; attempt <= INTERVIEW_ANSWER_PROPOSAL_MAXIMUM_ATTEMPTS && remaining.length > 0; attempt += 1) {\n const generated = await ports.generate({\n prompt: composeInterviewAnswerProposalPrompt({\n playbook,\n targetQuestionRefs: remaining,\n dossier,\n ...(applicationContext !== undefined ? { applicationContext } : {}),\n findings,\n }),\n schema: InterviewAnswerProposalOutputSchema,\n label: `interview-proposal:${playbook.ref}:attempt-${attempt}`,\n });\n const parsed = InterviewAnswerProposalOutputSchema.safeParse(generated.output);\n if (!parsed.success) {\n /* The provider's own refusal reason when it gave one; otherwise the schema's. Either goes back verbatim. */\n findings = generated.generationFindings?.length ? generated.generationFindings : parsed.error.issues.map((issue) => `${issue.path.join('.')}: ${issue.message}`);\n continue;\n }\n const checked = admitInterviewAnswerProposals({ playbook, targetQuestionRefs: remaining, output: parsed.data });\n for (const proposal of checked.admitted) admitted.set(proposal.questionRef, proposal);\n remaining = remaining.filter((ref) => !admitted.has(ref));\n findings = checked.findings;\n }\n return {\n playbookRef: playbook.ref,\n proposals: targets.flatMap((ref) => (admitted.has(ref) ? [admitted.get(ref)!] : [])),\n unproposed: remaining.map((questionRef) => ({\n questionRef,\n reason: findings.find((finding) => finding.includes(`\"${questionRef}\"`)) ?? findings[0] ?? 'No admissible proposal came back.',\n })),\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-instance.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-instance.companion.service.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAEL,sCAAsC,EACtC,8BAA8B,EAM9B,KAAK,6BAA6B,EACnC,MAAM,oDAAoD,CAAC;AAG5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAgB,mBAAmB,EAAE,KAAK,oCAAoC,EAAE,MAAM,oEAAoE,CAAC;AAOlK,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"playbook-instance.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-instance.companion.service.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;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,YAAY,CAAC,KAAK,EAAE;QAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,kIAAkI;QAClI,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,8BAA8B,EAAE,CAAC;QACpE,yGAAyG;QACzG,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,8BAA8B,EAAE,CAAC;QACrE,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;QACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAqGvC;;;;;;;;;;OAUG;YACW,eAAe;IAoD7B;;;;;OAKG;IACU,aAAa,CAAC,KAAK,EAAE;QAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,IAAI,EAAE,sCAAsC,CAAC;QACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,mBAAmB,CAAC;KACrC,GAAG,OAAO,CAAC;QACV,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAC5B,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;QAC5C,QAAQ,CAAC,wBAAwB,EAAE,SAAS,MAAM,EAAE,CAAC;QACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC;CAmEH"}
|
|
@@ -22,6 +22,7 @@ import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.
|
|
|
22
22
|
import { AcceptOrigin } from '../../claude-cli/services/accepted-change-commit.companion.service.js';
|
|
23
23
|
import { APPLICATION_CREATION_AUTONOMY_POSTURE, LaneBoundaryTreatment, laneBoundaryTreatmentFor, } from '../models/playbook-run-checkpoint.models.js';
|
|
24
24
|
import { readCompiledApplicationLineCatalog } from '../models/application-line-catalog.models.js';
|
|
25
|
+
import { serializeDossierWrite } from './dossier-write-queue.companion.utils.js';
|
|
25
26
|
/** The same prefix every landed specification constant carries (issue #65): app identity lives in values, never in export names. */
|
|
26
27
|
const LANDED_CONSTANT_PREFIX = 'application';
|
|
27
28
|
/**
|
|
@@ -152,10 +153,16 @@ let PlaybookInstanceCompanionService = class PlaybookInstanceCompanionService {
|
|
|
152
153
|
note: `Opened and committed (${committed.commitSha.slice(0, 8)}). Run it with instanceKey "${parsedKey.data}".`,
|
|
153
154
|
};
|
|
154
155
|
};
|
|
156
|
+
/*
|
|
157
|
+
* The dossier write queue INSIDE the workspace lock (#2179): the lock keeps a coding run out of the tree, the
|
|
158
|
+
* queue keeps an answer landing at the same moment from building on the same dossier read. Nothing holding
|
|
159
|
+
* the queue asks for the workspace lock, so the two cannot deadlock.
|
|
160
|
+
*/
|
|
161
|
+
const recordQueued = () => serializeDossierWrite(specificationsPackageRoot, record);
|
|
155
162
|
if (input.dryRun === true)
|
|
156
|
-
return
|
|
163
|
+
return recordQueued();
|
|
157
164
|
try {
|
|
158
|
-
return await withDedicatedFileLock(getWorkspaceMutationLockPath(this.companionContext.saasRoot),
|
|
165
|
+
return await withDedicatedFileLock(getWorkspaceMutationLockPath(this.companionContext.saasRoot), recordQueued, { retries: OPEN_INSTANCE_LOCK_RETRIES });
|
|
159
166
|
}
|
|
160
167
|
catch (error) {
|
|
161
168
|
if (error instanceof PlaybookInstanceRefusedError)
|
|
@@ -263,7 +270,8 @@ let PlaybookInstanceCompanionService = class PlaybookInstanceCompanionService {
|
|
|
263
270
|
};
|
|
264
271
|
let commitSha;
|
|
265
272
|
try {
|
|
266
|
-
|
|
273
|
+
// The dossier write queue inside the workspace lock, as when opening one (#2179).
|
|
274
|
+
commitSha = await withDedicatedFileLock(getWorkspaceMutationLockPath(this.companionContext.saasRoot), () => serializeDossierWrite(specificationsPackageRoot, record), { retries: OPEN_INSTANCE_LOCK_RETRIES });
|
|
267
275
|
}
|
|
268
276
|
catch (error) {
|
|
269
277
|
if (error instanceof PlaybookInstanceRefusedError)
|