@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
|
@@ -3,6 +3,7 @@ import { pathToFileURL } from "node:url";
|
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { loadPackageCompanionExport, normalizeCompilerPathAliasesForLoader, registerStaticAssetImportNoop, resolvePackageCompanionEntryPath, } from "@wildo-ai/platform-config-lib";
|
|
5
5
|
import { signDerivedInputs } from "../utils/derived-input-signature.companion.utils.js";
|
|
6
|
+
import { advanceApplicationModuleGeneration, holdApplicationModuleGeneration } from "./application-module-generations.companion.js";
|
|
6
7
|
import { describeCaughtError } from '@wildo-ai/saas-backend-lib';
|
|
7
8
|
export function resolveCompanionServiceTarget(companionContext, serviceKey) {
|
|
8
9
|
const serviceDefinition = companionContext.servicesByKey[serviceKey];
|
|
@@ -25,6 +26,7 @@ export function resolvePrimaryBackendServiceTarget(companionContext) {
|
|
|
25
26
|
}
|
|
26
27
|
export async function loadBackendCompanionExports(companionContext, serviceKey) {
|
|
27
28
|
const resolvedTarget = serviceKey ? resolveCompanionServiceTarget(companionContext, serviceKey) : resolvePrimaryBackendServiceTarget(companionContext);
|
|
29
|
+
advanceApplicationModuleGeneration(companionContext);
|
|
28
30
|
return importCompanionDefaultExport(resolvedTarget.entryPath, `Service "${resolvedTarget.serviceKey}"`);
|
|
29
31
|
}
|
|
30
32
|
export async function loadSharedLibraryCompanionExports(companionContext, libraryId = "shared") {
|
|
@@ -32,6 +34,7 @@ export async function loadSharedLibraryCompanionExports(companionContext, librar
|
|
|
32
34
|
if (!resolvedLibrary) {
|
|
33
35
|
throw new Error(`Library "${libraryId}" is not declared in wildo.saas.config.ts.`);
|
|
34
36
|
}
|
|
37
|
+
advanceApplicationModuleGeneration(companionContext);
|
|
35
38
|
return importCompanionDefaultExport(resolvedLibrary.entryPath, `Library "${libraryId}"`);
|
|
36
39
|
}
|
|
37
40
|
export async function loadLibraryRootModuleExports(companionContext, libraryId = "shared") {
|
|
@@ -39,6 +42,7 @@ export async function loadLibraryRootModuleExports(companionContext, libraryId =
|
|
|
39
42
|
if (!resolvedLibrary) {
|
|
40
43
|
throw new Error(`Library "${libraryId}" is not declared in wildo.saas.config.ts.`);
|
|
41
44
|
}
|
|
45
|
+
advanceApplicationModuleGeneration(companionContext);
|
|
42
46
|
return importCompanionModule(resolvePackageRootEntryPath(resolvedLibrary.packageRoot));
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
@@ -57,18 +61,17 @@ export async function loadLibraryRootModuleExports(companionContext, libraryId =
|
|
|
57
61
|
* `tsconfig.json` are normalized and supplied to the loader; without them the
|
|
58
62
|
* authored source cannot resolve its own internal specifiers.
|
|
59
63
|
*
|
|
60
|
-
* **
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* `
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* `framework-source`
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* `dist
|
|
70
|
-
*
|
|
71
|
-
* must resolve the way the LOADER does, not the way the resolver defaults.
|
|
64
|
+
* **The evaluated entry is the AUTHORED `src/companion-exports.ts`, in every
|
|
65
|
+
* application.** `freshModuleCache: true` makes `loadPackageCompanionExport`
|
|
66
|
+
* prefer authored source, because jiti re-reads only what it transpiles: the
|
|
67
|
+
* compiled `dist/esm/companion-exports.js` is imported natively by Node and
|
|
68
|
+
* pinned in its process-global ESM registry for the process lifetime. Until
|
|
69
|
+
* 2026-10-01 the entry followed the INFERRED module resolution instead —
|
|
70
|
+
* `framework-source` (source) inside the framework workspace, `package` (dist)
|
|
71
|
+
* outside it — so this surface was fresh on the dogfood applications and frozen
|
|
72
|
+
* at startup on every application created with the published CLI. The resolver
|
|
73
|
+
* called with NO options still answers `dist`; anything reasoning about this
|
|
74
|
+
* surface's freshness must resolve the way the LOADER does.
|
|
72
75
|
*
|
|
73
76
|
* **Authored, not accepted, is the correct surface here.** Consumers are i18n
|
|
74
77
|
* label-key collection and cross-registry assertions, which must track what the
|
|
@@ -81,7 +84,14 @@ export async function loadSpecificationsCompanionExports(companionContext) {
|
|
|
81
84
|
// No specifications package: let the evaluator raise its own named error rather than duplicating it.
|
|
82
85
|
if (packageRoot === undefined)
|
|
83
86
|
return evaluateSpecificationsCompanionExports(companionContext);
|
|
84
|
-
|
|
87
|
+
/*
|
|
88
|
+
* The authored specifications source is only half of what one evaluation reads: its imports into the application's
|
|
89
|
+
* other packages load their compiled builds, under the generation advanced here (#2125). Both go into the cache key,
|
|
90
|
+
* so a rebuilt `shared-lib` re-evaluates the specifications exactly as an edited specification does.
|
|
91
|
+
*/
|
|
92
|
+
const generation = advanceApplicationModuleGeneration(companionContext);
|
|
93
|
+
const treeSignature = signEvaluatedCompanionTree(packageRoot);
|
|
94
|
+
const signature = treeSignature === null ? null : `${treeSignature}|generation:${generation ?? "none"}`;
|
|
85
95
|
/*
|
|
86
96
|
* A null signature means the tree could not be READ, which is never grounds to serve a cached
|
|
87
97
|
* answer — an empty walk and an unchanged one are indistinguishable from their result
|
|
@@ -96,7 +106,8 @@ export async function loadSpecificationsCompanionExports(companionContext) {
|
|
|
96
106
|
if (inFlight?.signature === signature)
|
|
97
107
|
return inFlight.load;
|
|
98
108
|
}
|
|
99
|
-
|
|
109
|
+
// Held, so the many native imports this evaluation makes through jiti all land in ONE generation (#2125).
|
|
110
|
+
const load = holdApplicationModuleGeneration(() => evaluateSpecificationsCompanionExports(companionContext));
|
|
100
111
|
specificationsCompanionExportsInFlight.set(packageRoot, { signature, load });
|
|
101
112
|
try {
|
|
102
113
|
const companionExports = await load;
|
|
@@ -129,13 +140,14 @@ const COMPANION_MODULE_RESOLUTIONS = ["framework-source", "package"];
|
|
|
129
140
|
/**
|
|
130
141
|
* A cheap fingerprint of the module tree {@link loadSpecificationsCompanionExports} actually evaluates.
|
|
131
142
|
*
|
|
132
|
-
* **It signs every tree the resolver could land on,
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* one extra re-evaluation
|
|
143
|
+
* **It signs every tree the resolver could land on, a superset of the one evaluated.** For the
|
|
144
|
+
* specifications loader that tree is authored `src/` whenever it exists (a fresh read prefers source),
|
|
145
|
+
* and resolving under `framework-source` lands on exactly that file, so `src/` is always signed. The
|
|
146
|
+
* union is kept because the creation-plane projection signs OTHER packages with this function, whose
|
|
147
|
+
* evaluated tree still follows the inferred module resolution — which `platform-config-lib` keeps
|
|
148
|
+
* private. Its cost is that a rebuild of the tree NOT evaluated also invalidates: for specifications,
|
|
149
|
+
* every tsc emit into `dist` after a source edit costs one extra re-evaluation. Never a stale answer,
|
|
150
|
+
* which is the direction this must err in.
|
|
139
151
|
*
|
|
140
152
|
* Why a signature instead of a TTL: `freshModuleCache: true` exists so a family landed while the
|
|
141
153
|
* companion runs is visible without a restart (#170), and a TTL trades exactly that away for up to its
|
|
@@ -203,17 +215,17 @@ async function evaluateSpecificationsCompanionExports(companionContext) {
|
|
|
203
215
|
}
|
|
204
216
|
catch (error) {
|
|
205
217
|
/*
|
|
206
|
-
* `freshModuleCache` covers the modules JITI evaluates — this package's own authored source.
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
218
|
+
* `freshModuleCache` covers the modules JITI evaluates — this package's own authored source. The
|
|
219
|
+
* application's other WORKSPACE PACKAGES (`@my-app/shared-lib`) are imported by NODE as their compiled
|
|
220
|
+
* build, and are re-read only when that build changes: the generation advanced above re-tags their
|
|
221
|
+
* URLs (#2125). Until 2026-10-01 nothing did, and Node's process-global registry kept a symbol added
|
|
222
|
+
* to one of them `undefined` until the companion restarted.
|
|
211
223
|
*
|
|
212
|
-
* The symptom gives no hint of
|
|
213
|
-
* enum to the application's shared-lib at 21:30 and every playbook run afterwards
|
|
214
|
-
* `Cannot read properties of undefined (reading 'ASSIGN_OWNER')` — which reads as a
|
|
215
|
-
* freshly authored specification, and is not.
|
|
216
|
-
*
|
|
224
|
+
* The symptom gives no hint of which reading applies. Measured 2026-09-16: a coding run added a
|
|
225
|
+
* `Deals_Operations` enum to the application's shared-lib at 21:30 and every playbook run afterwards
|
|
226
|
+
* failed with `Cannot read properties of undefined (reading 'ASSIGN_OWNER')` — which reads as a
|
|
227
|
+
* defect in the freshly authored specification, and is not. What remains of that case is a build
|
|
228
|
+
* that has not been emitted (a watcher behind or red).
|
|
217
229
|
*
|
|
218
230
|
* So the loader names the condition rather than leaving the next reader to re-derive it. It does
|
|
219
231
|
* not decide that this IS the cause — it cannot — it says what the cause usually is and what
|
|
@@ -247,15 +259,15 @@ export function describeSpecificationsLoadFailure(error) {
|
|
|
247
259
|
const stack = error instanceof Error ? (error.stack ?? '') : '';
|
|
248
260
|
const authoredFrame = stack.split('\n').map((line) => line.trim()).find((line) => /specifications\/src\//u.test(line));
|
|
249
261
|
const site = authoredFrame ? ` The first authored frame is: ${authoredFrame.replace(/^at\s+/u, '')}.` : '';
|
|
250
|
-
return new Error(`${described} — two readings
|
|
251
|
-
+ '(1) A symbol was added to one of the application\'s own packages
|
|
252
|
-
+ '
|
|
253
|
-
+ "
|
|
254
|
-
+ '
|
|
255
|
-
+ '
|
|
256
|
-
+ '
|
|
257
|
-
+ 'risk register importing `ApplicationRiskRegisterSchema` from the root
|
|
258
|
-
+ '
|
|
262
|
+
return new Error(`${described} — two readings.${site} `
|
|
263
|
+
+ '(1) A symbol was added to one of the application\'s own packages and that package has not been COMPILED '
|
|
264
|
+
+ 'since: authored specification source is evaluated directly, but the application\'s other packages are read '
|
|
265
|
+
+ "as their compiled build, which this companion re-reads within a second of a new build — so check that the "
|
|
266
|
+
+ 'package\'s watcher is running and green (`wildo local dev` output, or its `dist` timestamp). (2) The failing '
|
|
267
|
+
+ 'file imports the symbol from a door that does not publish it — typically a subpath-only export of '
|
|
268
|
+
+ '`@wildo-ai/saas-specifications` named at the package ROOT, which is undefined however fresh the build is '
|
|
269
|
+
+ '(measured 2026-09-21: a landed risk register importing `ApplicationRiskRegisterSchema` from the root '
|
|
270
|
+
+ 'instead of `/assurance`). If the build is current, fix the import at the frame named above.', { cause: error });
|
|
259
271
|
}
|
|
260
272
|
/** Extensions a plain-Node dynamic import cannot execute. */
|
|
261
273
|
const NON_EXECUTABLE_COMPANION_ENTRY_EXTENSIONS = Object.freeze([".ts", ".tsx", ".mts", ".cts"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-package-loaders.companion.js","sourceRoot":"","sources":["../../../../../src/core/context/companion-package-loaders.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAY,OAAO,EAAO,MAAM,WAAW,CAAC;AAClE,OAAO,EACL,0BAA0B,EAC1B,qCAAqC,EACrC,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAOjE,MAAM,UAAU,6BAA6B,CAAC,gBAAkC,EAAE,UAAkB;IAClG,MAAM,iBAAiB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AAG,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;IACxD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,+DAA+D,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACnH,CAAC;IACD,MAAM,KAAK,GAAI,MAA2D,EAAE,eAAe,EAAE,KAAK,CAAC;IACnG,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAClF,MAAM,OAAO,GAAsC,EAAE,CAAC;IACtD,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;QAChF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAoB,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,EAAE,CAAC;YACtG,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { pathToFileURL } from \"node:url\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport {\n loadPackageCompanionExport,\n normalizeCompilerPathAliasesForLoader,\n registerStaticAssetImportNoop,\n resolvePackageCompanionEntryPath,\n} from \"@wildo-ai/platform-config-lib\";\nimport type { SharedLibraryCompanionExports } from \"@wildo-ai/saas-models\";\nimport type { BackendCompanionExports } from \"@wildo-ai/saas-backend-lib/companion\";\nimport type { SpecificationsCompanionExports } from \"@wildo-ai/saas-specifications/companion\";\nimport type { CompanionContext } from \"./companion-context\";\nimport { signDerivedInputs } from \"../utils/derived-input-signature.companion.utils\";\n\nimport { describeCaughtError } from '@wildo-ai/saas-backend-lib';\nexport interface ResolvedCompanionServiceTarget {\n serviceKey: string;\n packageRoot: string;\n entryPath: string;\n}\n\nexport function resolveCompanionServiceTarget(companionContext: CompanionContext, serviceKey: string): ResolvedCompanionServiceTarget {\n const serviceDefinition = companionContext.servicesByKey[serviceKey];\n if (!serviceDefinition) {\n throw new Error(`Unknown SaaS service key \"${serviceKey}\" in companion context.`);\n }\n\n const packageRoot = resolve(companionContext.saasRoot, serviceDefinition.path);\n return {\n serviceKey,\n packageRoot,\n entryPath: resolvePackageCompanionEntryPath(packageRoot),\n };\n}\n\nexport function resolvePrimaryBackendServiceTarget(companionContext: CompanionContext): ResolvedCompanionServiceTarget {\n const backendServiceKey = Object.entries(companionContext.servicesByKey).find(([, serviceDefinition]) => !serviceDefinition.frontendType)?.[0];\n\n if (!backendServiceKey) {\n throw new Error(\"No backend SaaS service is declared in wildo.saas.config.ts.\");\n }\n\n return resolveCompanionServiceTarget(companionContext, backendServiceKey);\n}\n\nexport async function loadBackendCompanionExports(companionContext: CompanionContext, serviceKey?: string): Promise<BackendCompanionExports> {\n const resolvedTarget = serviceKey ? resolveCompanionServiceTarget(companionContext, serviceKey) : resolvePrimaryBackendServiceTarget(companionContext);\n return importCompanionDefaultExport<BackendCompanionExports>(resolvedTarget.entryPath, `Service \"${resolvedTarget.serviceKey}\"`);\n}\n\nexport async function loadSharedLibraryCompanionExports(\n companionContext: CompanionContext,\n libraryId: string = \"shared\",\n): Promise<SharedLibraryCompanionExports> {\n const resolvedLibrary = companionContext.resolvedLibraries[libraryId];\n if (!resolvedLibrary) {\n throw new Error(`Library \"${libraryId}\" is not declared in wildo.saas.config.ts.`);\n }\n\n return importCompanionDefaultExport<SharedLibraryCompanionExports>(resolvedLibrary.entryPath, `Library \"${libraryId}\"`);\n}\n\nexport async function loadLibraryRootModuleExports(companionContext: CompanionContext, libraryId: string = \"shared\"): Promise<Record<string, unknown>> {\n const resolvedLibrary = companionContext.resolvedLibraries[libraryId];\n if (!resolvedLibrary) {\n throw new Error(`Library \"${libraryId}\" is not declared in wildo.saas.config.ts.`);\n }\n\n return importCompanionModule(resolvePackageRootEntryPath(resolvedLibrary.packageRoot));\n}\n\n/**\n * Load the application's **authored** specifications companion surface.\n *\n * This deliberately does NOT go through a raw dynamic import of the resolved\n * `./companion` entry. For the specifications package that subpath is reserved\n * for the PROJECTED composition entrypoint — a contract enforced elsewhere\n * against the continuity declaration's `expectedCompanionImportPath` — so in a\n * working tree it never exists and resolution legitimately falls back to\n * authored TypeScript source, which plain Node cannot execute.\n *\n * Loading through `loadPackageCompanionExport` (jiti) is what makes that\n * authored fallback usable. The package addresses its own modules through a\n * compiler path alias, so the aliases the package declares in its own\n * `tsconfig.json` are normalized and supplied to the loader; without them the\n * authored source cannot resolve its own internal specifiers.\n *\n * **WHICH entry is resolved depends on an INFERRED option, and asking without it\n * gives the wrong answer** — worth stating because it cost this file a wrong\n * correction. `loadPackageCompanionExport` passes\n * `inferPackageCompanionModuleResolution(packageRoot)`, which answers\n * `framework-source` for a package inside the framework workspace and `package`\n * outside it. Measured on `examples/wonder-todos` (2026-09-18):\n * `framework-source` resolves `src/companion-exports.ts` (authored, jiti\n * evaluates it, so `freshModuleCache` genuinely re-reads it) while `package` —\n * and calling the resolver with NO options — answers\n * `dist/esm/companion-exports.js`, which Node's process-global ESM registry pins\n * for the process lifetime. Anything reasoning about this surface's freshness\n * must resolve the way the LOADER does, not the way the resolver defaults.\n *\n * **Authored, not accepted, is the correct surface here.** Consumers are i18n\n * label-key collection and cross-registry assertions, which must track what the\n * developer is currently writing. Reading the accepted projection instead would\n * make labels lag acceptance — a different concept that belongs to the durable\n * specification-family path, not this one.\n */\nexport async function loadSpecificationsCompanionExports(companionContext: CompanionContext): Promise<SpecificationsCompanionExports> {\n const packageRoot = companionContext.resolvedSpecifications?.packageRoot;\n // No specifications package: let the evaluator raise its own named error rather than duplicating it.\n if (packageRoot === undefined) return evaluateSpecificationsCompanionExports(companionContext);\n\n const signature = signEvaluatedCompanionTree(packageRoot);\n /*\n * A null signature means the tree could not be READ, which is never grounds to serve a cached\n * answer — an empty walk and an unchanged one are indistinguishable from their result\n * (`.claude/rules/negative-results-require-a-positive-probe.md`). It degrades to the uncached\n * behaviour that predates this cache, which is always correct and merely slow.\n */\n if (signature !== null) {\n const cached = specificationsCompanionExportsCache.get(packageRoot);\n if (cached?.signature === signature) return cached.exports;\n const inFlight = specificationsCompanionExportsInFlight.get(packageRoot);\n if (inFlight?.signature === signature) return inFlight.load;\n }\n\n const load = evaluateSpecificationsCompanionExports(companionContext);\n specificationsCompanionExportsInFlight.set(packageRoot, { signature, load });\n try {\n const companionExports = await load;\n // The signature is the one captured BEFORE the load, so an edit landing mid-load leaves the entry\n // stale-by-a-hair and the NEXT call re-signs, misses and reloads. That is exactly what an uncached\n // load already did: it too answers with the tree as it stood when it started.\n if (signature !== null) specificationsCompanionExportsCache.set(packageRoot, { signature, exports: companionExports });\n return companionExports;\n } finally {\n // A failed load caches nothing, so the next caller retries rather than inheriting the failure.\n if (specificationsCompanionExportsInFlight.get(packageRoot)?.load === load) {\n specificationsCompanionExportsInFlight.delete(packageRoot);\n }\n }\n}\n\n/** The last evaluated exports per specifications package root, valid while its tree signature holds. */\nconst specificationsCompanionExportsCache = new Map<string, { signature: string; exports: SpecificationsCompanionExports }>();\n\n/** Evaluations still running, so concurrent callers at the same signature share one of them. */\nconst specificationsCompanionExportsInFlight = new Map<string, { signature: string | null; load: Promise<SpecificationsCompanionExports> }>();\n\n/**\n * Every `moduleResolution` the companion entry resolver accepts.\n *\n * Total over the vocabulary rather than a list of the ones that matter today: a value added there must\n * widen what {@link signEvaluatedCompanionTree} covers, and a signature that silently stopped covering\n * a reachable tree would serve a stale evaluation with nothing reporting it.\n */\nconst COMPANION_MODULE_RESOLUTIONS = [\"framework-source\", \"package\"] as const satisfies readonly NonNullable<\n Parameters<typeof resolvePackageCompanionEntryPath>[2]\n>[\"moduleResolution\"][];\n\n/**\n * A cheap fingerprint of the module tree {@link loadSpecificationsCompanionExports} actually evaluates.\n *\n * **It signs every tree the resolver could land on, because this module cannot ask which one it DID.**\n * The deciding input is `inferPackageCompanionModuleResolution`, which `platform-config-lib` keeps\n * private — and the resolver's no-option default is NOT the loader's answer (see the JSDoc above; that\n * gap produced a wrong correction to this file before it produced a wrong signature). Resolving under\n * both declared values and signing the union is exact under either outcome, where naming one tree is\n * only exact under a guess. Its cost is that a rebuild of the tree NOT evaluated also invalidates —\n * one extra re-evaluation, never a stale answer, which is the direction this must err in.\n *\n * Why a signature instead of a TTL: `freshModuleCache: true` exists so a family landed while the\n * companion runs is visible without a restart (#170), and a TTL trades exactly that away for up to its\n * own length. A signature cannot — the tsc watcher writes the tree, the signature moves, the next call\n * misses and re-evaluates. What is bought is only the repeat of an evaluation of BYTES THAT DID NOT\n * CHANGE.\n *\n * Measured on `examples/wonder-todos` (444 files): ~2-5 ms to sign against ~1.2-2.9 s to re-evaluate, and\n * a creation-board refresh pays that evaluation twice — once for playbook eligibility, once for the build\n * plan — which is the bulk of the board's latency. The git probes behind the build plan cost ~0.15 s on\n * the same application and are not the bottleneck.\n *\n * Aggregates rather than hashes content: file count catches a deletion, newest mtime catches a write,\n * total bytes and the mtime sum catch a same-instant swap that preserves both, and the directories'\n * own mtimes catch a rename — see `signDerivedInputs`, which owns the technique. `dist` and `node_modules`\n * are skipped only when they sit BELOW the evaluated root, never when they are it.\n *\n * Returns `null` when the tree cannot be read or is empty. That is a refusal to authorize a cache hit,\n * not an answer.\n *\n * Exported for the creation-plane projection (#1310), whose cached boards sit ABOVE this evaluation:\n * they must drop when the tree this evaluates moves, so they sign exactly what this signs rather than\n * a second guess at which tree the loader lands on.\n */\nexport function signEvaluatedCompanionTree(packageRoot: string): string | null {\n const entryPaths: string[] = [];\n for (const moduleResolution of COMPANION_MODULE_RESOLUTIONS) {\n try {\n entryPaths.push(resolvePackageCompanionEntryPath(packageRoot, undefined, { moduleResolution }));\n } catch {\n // One value resolving and the other not is ordinary (a package with no build output yet). Only\n // NEITHER resolving means there is nothing to sign, which `signDerivedInputs` reports as null.\n }\n }\n entryPaths.sort();\n const evaluatedRoots = [...new Set(entryPaths.map((entryPath) => dirname(entryPath)))].sort();\n // The export map decides WHICH entry is evaluated, so a change to it must invalidate as surely as a\n // change to the modules behind it.\n return signDerivedInputs(evaluatedRoots, [join(packageRoot, \"package.json\")]);\n}\n\n/** Evaluates the specifications companion surface, with no caching — see {@link loadSpecificationsCompanionExports}. */\nasync function evaluateSpecificationsCompanionExports(companionContext: CompanionContext): Promise<SpecificationsCompanionExports> {\n const resolvedSpecifications = companionContext.resolvedSpecifications;\n if (!resolvedSpecifications) {\n throw new Error(\"No specifications package is declared in wildo.saas.config.ts.\");\n }\n\n const packageModuleAliases = normalizeCompilerPathAliasesForLoader(\n resolvedSpecifications.packageRoot,\n readPackageCompilerPathAliases(resolvedSpecifications.packageRoot),\n );\n\n // Application specifications are declarative control-plane input, but their\n // metadata can legitimately reach browser component modules. Static assets\n // carry no companion semantics; treating them as executable Node modules\n // would make an otherwise valid configured application unloadable solely\n // because a frontend library imports its stylesheet. Register the narrow\n // process-wide no-op hook before jiti evaluates the authored export graph.\n // The hook never handles JavaScript/TypeScript and remains inert for callers\n // that do not import a supported static asset.\n registerStaticAssetImportNoop();\n\n try {\n return await loadPackageCompanionExport<SpecificationsCompanionExports>(\n resolvedSpecifications.packageRoot,\n undefined,\n // freshModuleCache: this surface's CONTRACT is \"the working tree as the developer is writing\n // it\" (the JSDoc above), and jiti's process-global module cache broke exactly that: a family\n // landed (or a companion-exports slot wired) while the companion ran stayed invisible until\n // restart — J-1's stall B, one forced restart per landed family. Measured live 2026-08-27.\n { packageModuleAliases, freshModuleCache: true },\n );\n } catch (error) {\n /*\n * `freshModuleCache` covers the modules JITI evaluates — this package's own authored source. It\n * does NOT cover the application's compiled WORKSPACE PACKAGES: a bare specifier like\n * `@my-app/shared-lib` resolves into `node_modules` and is imported by NODE, whose ESM registry is\n * process-global and cannot be invalidated. So a symbol added to an application package while the\n * companion is running stays `undefined` in this process until it restarts.\n *\n * The symptom gives no hint of that. Measured 2026-09-16: a coding run added a `Deals_Operations`\n * enum to the application's shared-lib at 21:30 and every playbook run afterwards failed with\n * `Cannot read properties of undefined (reading 'ASSIGN_OWNER')` — which reads as a defect in the\n * freshly authored specification, and is not. Plain `node -e \"import('@my-app/shared-lib')\"` in the\n * same tree printed the enum correctly, because a fresh process has a fresh registry.\n *\n * So the loader names the condition rather than leaving the next reader to re-derive it. It does\n * not decide that this IS the cause — it cannot — it says what the cause usually is and what\n * clears it.\n */\n throw describeSpecificationsLoadFailure(error);\n }\n}\n\n/**\n * Add the pinned-registry hint to a specifications-load failure that looks like one, and leave every\n * other failure untouched.\n *\n * Exported so it can be pinned: the VALUE here is entirely in which failures get the hint. Attaching it\n * to a malformed build plan or a throwing module would send the next reader somewhere wrong, and that\n * is the half a test can hold.\n */\nexport function describeSpecificationsLoadFailure(error: unknown): unknown {\n const described = describeCaughtError(error);\n /*\n * `.*` with no space before `of`: the real message is \"Cannot read properties of undefined (reading\n * 'X')\", so a pattern requiring a segment between them matches NOTHING — which is what the first\n * draft did, and the pin below is what caught it before it shipped as a hint that never fires.\n */\n if (!/Cannot read propert(?:y|ies).*of undefined/u.test(described)) return error;\n /*\n * The AUTHORED frame — the first stack frame inside the application's specification source — is the one\n * fact that separates the two readings below, and the raw error buries it under a dozen loader frames.\n * Named here so the reader opens the right file first instead of restarting first.\n */\n const stack = error instanceof Error ? (error.stack ?? '') : '';\n const authoredFrame = stack.split('\\n').map((line) => line.trim()).find((line) => /specifications\\/src\\//u.test(line));\n const site = authoredFrame ? ` The first authored frame is: ${authoredFrame.replace(/^at\\s+/u, '')}.` : '';\n return new Error(\n `${described} — two readings, and a companion restart tells them apart.${site} `\n + '(1) A symbol was added to one of the application\\'s own packages while this companion process was '\n + 'running: authored specification SOURCE is re-read on every load, but the application\\'s compiled '\n + \"packages are pinned in Node's process-global ESM registry, so a new export stays undefined until the \"\n + 'companion restarts. (2) The failing file imports the symbol from a door that does not publish it — '\n + 'typically a subpath-only export of `@wildo-ai/saas-specifications` named at the package ROOT, which '\n + 'is undefined in a fresh process too, so a restart changes nothing (measured 2026-09-21: a landed '\n + 'risk register importing `ApplicationRiskRegisterSchema` from the root instead of `/assurance` failed '\n + 'this way across two restarts). If it survives a restart, fix the import at the frame named above.',\n { cause: error },\n );\n}\n\n\n/** Extensions a plain-Node dynamic import cannot execute. */\nconst NON_EXECUTABLE_COMPANION_ENTRY_EXTENSIONS = Object.freeze([\".ts\", \".tsx\", \".mts\", \".cts\"]);\n\n/**\n * Import one resolved companion entry.\n *\n * The companion runs as compiled JavaScript under plain Node with only an\n * asset-noop loader registered — it has no TypeScript loader. `resolvePackageCompanionEntryPath`\n * may legitimately hand back authored source: that fallback is load-bearing for\n * `loadPackageCompanionExport`, which resolves through jiti and CAN execute\n * TypeScript. Here it cannot.\n *\n * Rejecting a source entry explicitly turns a package misconfiguration into a\n * precise, actionable error. Letting it through instead produced a bare\n * `ERR_UNKNOWN_FILE_EXTENSION` from deep inside the module loader, which — because\n * several call sites are deliberately best-effort — was swallowed into a warning\n * that named neither the package nor the dangling export. That is how a\n * permanently-dangling `./companion` target stayed invisible until the companion\n * happened to survive continuity recovery for the first time.\n */\nasync function importCompanionModule(entryPath: string): Promise<Record<string, unknown>> {\n const nonExecutableExtension = NON_EXECUTABLE_COMPANION_ENTRY_EXTENSIONS.find((extension) => entryPath.endsWith(extension));\n if (nonExecutableExtension) {\n throw new Error(\n `Companion entry \"${entryPath}\" is TypeScript source, which this runtime cannot execute. `\n + \"The package's declared companion export is missing or unbuilt, so resolution fell back to authored source. \"\n + \"Build the package, or correct its package.json exports to point at a built entry.\",\n );\n }\n return import(pathToFileURL(entryPath).href) as Promise<Record<string, unknown>>;\n}\n\nasync function importCompanionDefaultExport<T extends object>(entryPath: string, exportOwnerLabel: string): Promise<T> {\n const moduleExports = await importCompanionModule(entryPath);\n const defaultExport = moduleExports.default;\n\n if (!defaultExport || typeof defaultExport !== \"object\") {\n throw new Error(`${exportOwnerLabel} companion export must default-export one typed object surface.`);\n }\n\n return defaultExport as T;\n}\n\nfunction resolvePackageRootEntryPath(packageRoot: string): string {\n const sourceCandidates = [\n join(packageRoot, \"src\", \"index.ts\"),\n join(packageRoot, \"src\", \"index.tsx\"),\n join(packageRoot, \"src\", \"index.js\"),\n join(packageRoot, \"src\", \"index.mjs\"),\n ];\n\n for (const candidate of sourceCandidates) {\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n const packageJsonPath = join(packageRoot, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n throw new Error(`Missing package.json for package root \"${packageRoot}\".`);\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as {\n exports?: Record<string, string | { import?: string; default?: string }>;\n main?: string;\n module?: string;\n };\n const rootExport = packageJson.exports?.[\".\"];\n\n if (typeof rootExport === \"string\") {\n const rootExportPath = resolve(packageRoot, rootExport);\n if (existsSync(rootExportPath)) {\n return rootExportPath;\n }\n }\n\n if (rootExport && typeof rootExport === \"object\") {\n const declaredEntryPath = rootExport.import ?? rootExport.default;\n if (typeof declaredEntryPath === \"string\") {\n const rootExportPath = resolve(packageRoot, declaredEntryPath);\n if (existsSync(rootExportPath)) {\n return rootExportPath;\n }\n }\n }\n\n for (const declaredEntryPath of [packageJson.module, packageJson.main]) {\n if (!declaredEntryPath) {\n continue;\n }\n\n const resolvedEntryPath = resolve(packageRoot, declaredEntryPath);\n if (existsSync(resolvedEntryPath)) {\n return resolvedEntryPath;\n }\n }\n\n throw new Error(`Could not resolve root entry for package \"${packageRoot}\".`);\n}\n\n/**\n * The module aliases the specifications package declares for ITSELF, read from its `tsconfig.json`.\n *\n * These used to come from an app-authored continuity declaration (`specifications/src/continuity.ts` →\n * `composition.compilerPathAliases`), which was one more place an application had to restate something it\n * had already said. The compiler config is where a package declares how its own specifiers resolve, it is\n * a committed file, and two branches can carry different versions of it and merge — so it is the source\n * this loader should have been reading all along (`.claude/rules/one-source-of-truth.md`, Rule 0).\n *\n * Scope, stated rather than discovered later: only the package's OWN `compilerOptions.paths` is read. An\n * alias inherited through `extends` is not followed, because resolving that chain here would mean\n * reimplementing a slice of tsc for a case no application has. A missing file or a missing `paths` block\n * means no aliases — the honest answer, not a fallback. Malformed JSON throws: a package whose compiler\n * config cannot be parsed cannot have its authored exports loaded correctly either.\n */\nfunction readPackageCompilerPathAliases(packageRoot: string): Readonly<Record<string, readonly string[]>> {\n const tsconfigPath = join(packageRoot, \"tsconfig.json\");\n if (!existsSync(tsconfigPath)) return {};\n let parsed: unknown;\n try {\n parsed = JSON.parse(readFileSync(tsconfigPath, \"utf8\"));\n } catch (error) {\n throw new Error(`Specifications package tsconfig.json is not parseable JSON: ${tsconfigPath}`, { cause: error });\n }\n const paths = (parsed as { compilerOptions?: { paths?: unknown } } | null)?.compilerOptions?.paths;\n if (paths === null || paths === undefined || typeof paths !== \"object\") return {};\n const aliases: Record<string, readonly string[]> = {};\n for (const [alias, targets] of Object.entries(paths as Record<string, unknown>)) {\n if (Array.isArray(targets) && targets.every((target): target is string => typeof target === \"string\")) {\n aliases[alias] = targets;\n }\n }\n return aliases;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"companion-package-loaders.companion.js","sourceRoot":"","sources":["../../../../../src/core/context/companion-package-loaders.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAY,OAAO,EAAO,MAAM,WAAW,CAAC;AAClE,OAAO,EACL,0BAA0B,EAC1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AK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAClF,MAAM,OAAO,GAAsC,EAAE,CAAC;IACtD,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;QAChF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAoB,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,EAAE,CAAC;YACtG,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { pathToFileURL } from \"node:url\";\nimport { dirname, join, relative, resolve, sep } from \"node:path\";\nimport {\n loadPackageCompanionExport,\n normalizeCompilerPathAliasesForLoader,\n registerStaticAssetImportNoop,\n resolvePackageCompanionEntryPath,\n} from \"@wildo-ai/platform-config-lib\";\nimport type { SharedLibraryCompanionExports } from \"@wildo-ai/saas-models\";\nimport type { BackendCompanionExports } from \"@wildo-ai/saas-backend-lib/companion\";\nimport type { SpecificationsCompanionExports } from \"@wildo-ai/saas-specifications/companion\";\nimport type { CompanionContext } from \"./companion-context\";\nimport { signDerivedInputs } from \"../utils/derived-input-signature.companion.utils\";\nimport { advanceApplicationModuleGeneration, holdApplicationModuleGeneration } from \"./application-module-generations.companion\";\n\nimport { describeCaughtError } from '@wildo-ai/saas-backend-lib';\nexport interface ResolvedCompanionServiceTarget {\n serviceKey: string;\n packageRoot: string;\n entryPath: string;\n}\n\nexport function resolveCompanionServiceTarget(companionContext: CompanionContext, serviceKey: string): ResolvedCompanionServiceTarget {\n const serviceDefinition = companionContext.servicesByKey[serviceKey];\n if (!serviceDefinition) {\n throw new Error(`Unknown SaaS service key \"${serviceKey}\" in companion context.`);\n }\n\n const packageRoot = resolve(companionContext.saasRoot, serviceDefinition.path);\n return {\n serviceKey,\n packageRoot,\n entryPath: resolvePackageCompanionEntryPath(packageRoot),\n };\n}\n\nexport function resolvePrimaryBackendServiceTarget(companionContext: CompanionContext): ResolvedCompanionServiceTarget {\n const backendServiceKey = Object.entries(companionContext.servicesByKey).find(([, serviceDefinition]) => !serviceDefinition.frontendType)?.[0];\n\n if (!backendServiceKey) {\n throw new Error(\"No backend SaaS service is declared in wildo.saas.config.ts.\");\n }\n\n return resolveCompanionServiceTarget(companionContext, backendServiceKey);\n}\n\nexport async function loadBackendCompanionExports(companionContext: CompanionContext, serviceKey?: string): Promise<BackendCompanionExports> {\n const resolvedTarget = serviceKey ? resolveCompanionServiceTarget(companionContext, serviceKey) : resolvePrimaryBackendServiceTarget(companionContext);\n advanceApplicationModuleGeneration(companionContext);\n return importCompanionDefaultExport<BackendCompanionExports>(resolvedTarget.entryPath, `Service \"${resolvedTarget.serviceKey}\"`);\n}\n\nexport async function loadSharedLibraryCompanionExports(\n companionContext: CompanionContext,\n libraryId: string = \"shared\",\n): Promise<SharedLibraryCompanionExports> {\n const resolvedLibrary = companionContext.resolvedLibraries[libraryId];\n if (!resolvedLibrary) {\n throw new Error(`Library \"${libraryId}\" is not declared in wildo.saas.config.ts.`);\n }\n\n advanceApplicationModuleGeneration(companionContext);\n return importCompanionDefaultExport<SharedLibraryCompanionExports>(resolvedLibrary.entryPath, `Library \"${libraryId}\"`);\n}\n\nexport async function loadLibraryRootModuleExports(companionContext: CompanionContext, libraryId: string = \"shared\"): Promise<Record<string, unknown>> {\n const resolvedLibrary = companionContext.resolvedLibraries[libraryId];\n if (!resolvedLibrary) {\n throw new Error(`Library \"${libraryId}\" is not declared in wildo.saas.config.ts.`);\n }\n\n advanceApplicationModuleGeneration(companionContext);\n return importCompanionModule(resolvePackageRootEntryPath(resolvedLibrary.packageRoot));\n}\n\n/**\n * Load the application's **authored** specifications companion surface.\n *\n * This deliberately does NOT go through a raw dynamic import of the resolved\n * `./companion` entry. For the specifications package that subpath is reserved\n * for the PROJECTED composition entrypoint — a contract enforced elsewhere\n * against the continuity declaration's `expectedCompanionImportPath` — so in a\n * working tree it never exists and resolution legitimately falls back to\n * authored TypeScript source, which plain Node cannot execute.\n *\n * Loading through `loadPackageCompanionExport` (jiti) is what makes that\n * authored fallback usable. The package addresses its own modules through a\n * compiler path alias, so the aliases the package declares in its own\n * `tsconfig.json` are normalized and supplied to the loader; without them the\n * authored source cannot resolve its own internal specifiers.\n *\n * **The evaluated entry is the AUTHORED `src/companion-exports.ts`, in every\n * application.** `freshModuleCache: true` makes `loadPackageCompanionExport`\n * prefer authored source, because jiti re-reads only what it transpiles: the\n * compiled `dist/esm/companion-exports.js` is imported natively by Node and\n * pinned in its process-global ESM registry for the process lifetime. Until\n * 2026-10-01 the entry followed the INFERRED module resolution instead —\n * `framework-source` (source) inside the framework workspace, `package` (dist)\n * outside it — so this surface was fresh on the dogfood applications and frozen\n * at startup on every application created with the published CLI. The resolver\n * called with NO options still answers `dist`; anything reasoning about this\n * surface's freshness must resolve the way the LOADER does.\n *\n * **Authored, not accepted, is the correct surface here.** Consumers are i18n\n * label-key collection and cross-registry assertions, which must track what the\n * developer is currently writing. Reading the accepted projection instead would\n * make labels lag acceptance — a different concept that belongs to the durable\n * specification-family path, not this one.\n */\nexport async function loadSpecificationsCompanionExports(companionContext: CompanionContext): Promise<SpecificationsCompanionExports> {\n const packageRoot = companionContext.resolvedSpecifications?.packageRoot;\n // No specifications package: let the evaluator raise its own named error rather than duplicating it.\n if (packageRoot === undefined) return evaluateSpecificationsCompanionExports(companionContext);\n\n /*\n * The authored specifications source is only half of what one evaluation reads: its imports into the application's\n * other packages load their compiled builds, under the generation advanced here (#2125). Both go into the cache key,\n * so a rebuilt `shared-lib` re-evaluates the specifications exactly as an edited specification does.\n */\n const generation = advanceApplicationModuleGeneration(companionContext);\n const treeSignature = signEvaluatedCompanionTree(packageRoot);\n const signature = treeSignature === null ? null : `${treeSignature}|generation:${generation ?? \"none\"}`;\n /*\n * A null signature means the tree could not be READ, which is never grounds to serve a cached\n * answer — an empty walk and an unchanged one are indistinguishable from their result\n * (`.claude/rules/negative-results-require-a-positive-probe.md`). It degrades to the uncached\n * behaviour that predates this cache, which is always correct and merely slow.\n */\n if (signature !== null) {\n const cached = specificationsCompanionExportsCache.get(packageRoot);\n if (cached?.signature === signature) return cached.exports;\n const inFlight = specificationsCompanionExportsInFlight.get(packageRoot);\n if (inFlight?.signature === signature) return inFlight.load;\n }\n\n // Held, so the many native imports this evaluation makes through jiti all land in ONE generation (#2125).\n const load = holdApplicationModuleGeneration(() => evaluateSpecificationsCompanionExports(companionContext));\n specificationsCompanionExportsInFlight.set(packageRoot, { signature, load });\n try {\n const companionExports = await load;\n // The signature is the one captured BEFORE the load, so an edit landing mid-load leaves the entry\n // stale-by-a-hair and the NEXT call re-signs, misses and reloads. That is exactly what an uncached\n // load already did: it too answers with the tree as it stood when it started.\n if (signature !== null) specificationsCompanionExportsCache.set(packageRoot, { signature, exports: companionExports });\n return companionExports;\n } finally {\n // A failed load caches nothing, so the next caller retries rather than inheriting the failure.\n if (specificationsCompanionExportsInFlight.get(packageRoot)?.load === load) {\n specificationsCompanionExportsInFlight.delete(packageRoot);\n }\n }\n}\n\n/** The last evaluated exports per specifications package root, valid while its tree signature holds. */\nconst specificationsCompanionExportsCache = new Map<string, { signature: string; exports: SpecificationsCompanionExports }>();\n\n/** Evaluations still running, so concurrent callers at the same signature share one of them. */\nconst specificationsCompanionExportsInFlight = new Map<string, { signature: string | null; load: Promise<SpecificationsCompanionExports> }>();\n\n/**\n * Every `moduleResolution` the companion entry resolver accepts.\n *\n * Total over the vocabulary rather than a list of the ones that matter today: a value added there must\n * widen what {@link signEvaluatedCompanionTree} covers, and a signature that silently stopped covering\n * a reachable tree would serve a stale evaluation with nothing reporting it.\n */\nconst COMPANION_MODULE_RESOLUTIONS = [\"framework-source\", \"package\"] as const satisfies readonly NonNullable<\n Parameters<typeof resolvePackageCompanionEntryPath>[2]\n>[\"moduleResolution\"][];\n\n/**\n * A cheap fingerprint of the module tree {@link loadSpecificationsCompanionExports} actually evaluates.\n *\n * **It signs every tree the resolver could land on, a superset of the one evaluated.** For the\n * specifications loader that tree is authored `src/` whenever it exists (a fresh read prefers source),\n * and resolving under `framework-source` lands on exactly that file, so `src/` is always signed. The\n * union is kept because the creation-plane projection signs OTHER packages with this function, whose\n * evaluated tree still follows the inferred module resolution — which `platform-config-lib` keeps\n * private. Its cost is that a rebuild of the tree NOT evaluated also invalidates: for specifications,\n * every tsc emit into `dist` after a source edit costs one extra re-evaluation. Never a stale answer,\n * which is the direction this must err in.\n *\n * Why a signature instead of a TTL: `freshModuleCache: true` exists so a family landed while the\n * companion runs is visible without a restart (#170), and a TTL trades exactly that away for up to its\n * own length. A signature cannot — the tsc watcher writes the tree, the signature moves, the next call\n * misses and re-evaluates. What is bought is only the repeat of an evaluation of BYTES THAT DID NOT\n * CHANGE.\n *\n * Measured on `examples/wonder-todos` (444 files): ~2-5 ms to sign against ~1.2-2.9 s to re-evaluate, and\n * a creation-board refresh pays that evaluation twice — once for playbook eligibility, once for the build\n * plan — which is the bulk of the board's latency. The git probes behind the build plan cost ~0.15 s on\n * the same application and are not the bottleneck.\n *\n * Aggregates rather than hashes content: file count catches a deletion, newest mtime catches a write,\n * total bytes and the mtime sum catch a same-instant swap that preserves both, and the directories'\n * own mtimes catch a rename — see `signDerivedInputs`, which owns the technique. `dist` and `node_modules`\n * are skipped only when they sit BELOW the evaluated root, never when they are it.\n *\n * Returns `null` when the tree cannot be read or is empty. That is a refusal to authorize a cache hit,\n * not an answer.\n *\n * Exported for the creation-plane projection (#1310), whose cached boards sit ABOVE this evaluation:\n * they must drop when the tree this evaluates moves, so they sign exactly what this signs rather than\n * a second guess at which tree the loader lands on.\n */\nexport function signEvaluatedCompanionTree(packageRoot: string): string | null {\n const entryPaths: string[] = [];\n for (const moduleResolution of COMPANION_MODULE_RESOLUTIONS) {\n try {\n entryPaths.push(resolvePackageCompanionEntryPath(packageRoot, undefined, { moduleResolution }));\n } catch {\n // One value resolving and the other not is ordinary (a package with no build output yet). Only\n // NEITHER resolving means there is nothing to sign, which `signDerivedInputs` reports as null.\n }\n }\n entryPaths.sort();\n const evaluatedRoots = [...new Set(entryPaths.map((entryPath) => dirname(entryPath)))].sort();\n // The export map decides WHICH entry is evaluated, so a change to it must invalidate as surely as a\n // change to the modules behind it.\n return signDerivedInputs(evaluatedRoots, [join(packageRoot, \"package.json\")]);\n}\n\n/** Evaluates the specifications companion surface, with no caching — see {@link loadSpecificationsCompanionExports}. */\nasync function evaluateSpecificationsCompanionExports(companionContext: CompanionContext): Promise<SpecificationsCompanionExports> {\n const resolvedSpecifications = companionContext.resolvedSpecifications;\n if (!resolvedSpecifications) {\n throw new Error(\"No specifications package is declared in wildo.saas.config.ts.\");\n }\n\n const packageModuleAliases = normalizeCompilerPathAliasesForLoader(\n resolvedSpecifications.packageRoot,\n readPackageCompilerPathAliases(resolvedSpecifications.packageRoot),\n );\n\n // Application specifications are declarative control-plane input, but their\n // metadata can legitimately reach browser component modules. Static assets\n // carry no companion semantics; treating them as executable Node modules\n // would make an otherwise valid configured application unloadable solely\n // because a frontend library imports its stylesheet. Register the narrow\n // process-wide no-op hook before jiti evaluates the authored export graph.\n // The hook never handles JavaScript/TypeScript and remains inert for callers\n // that do not import a supported static asset.\n registerStaticAssetImportNoop();\n\n try {\n return await loadPackageCompanionExport<SpecificationsCompanionExports>(\n resolvedSpecifications.packageRoot,\n undefined,\n // freshModuleCache: this surface's CONTRACT is \"the working tree as the developer is writing\n // it\" (the JSDoc above), and jiti's process-global module cache broke exactly that: a family\n // landed (or a companion-exports slot wired) while the companion ran stayed invisible until\n // restart — J-1's stall B, one forced restart per landed family. Measured live 2026-08-27.\n { packageModuleAliases, freshModuleCache: true },\n );\n } catch (error) {\n /*\n * `freshModuleCache` covers the modules JITI evaluates — this package's own authored source. The\n * application's other WORKSPACE PACKAGES (`@my-app/shared-lib`) are imported by NODE as their compiled\n * build, and are re-read only when that build changes: the generation advanced above re-tags their\n * URLs (#2125). Until 2026-10-01 nothing did, and Node's process-global registry kept a symbol added\n * to one of them `undefined` until the companion restarted.\n *\n * The symptom gives no hint of which reading applies. Measured 2026-09-16: a coding run added a\n * `Deals_Operations` enum to the application's shared-lib at 21:30 and every playbook run afterwards\n * failed with `Cannot read properties of undefined (reading 'ASSIGN_OWNER')` — which reads as a\n * defect in the freshly authored specification, and is not. What remains of that case is a build\n * that has not been emitted (a watcher behind or red).\n *\n * So the loader names the condition rather than leaving the next reader to re-derive it. It does\n * not decide that this IS the cause — it cannot — it says what the cause usually is and what\n * clears it.\n */\n throw describeSpecificationsLoadFailure(error);\n }\n}\n\n/**\n * Add the pinned-registry hint to a specifications-load failure that looks like one, and leave every\n * other failure untouched.\n *\n * Exported so it can be pinned: the VALUE here is entirely in which failures get the hint. Attaching it\n * to a malformed build plan or a throwing module would send the next reader somewhere wrong, and that\n * is the half a test can hold.\n */\nexport function describeSpecificationsLoadFailure(error: unknown): unknown {\n const described = describeCaughtError(error);\n /*\n * `.*` with no space before `of`: the real message is \"Cannot read properties of undefined (reading\n * 'X')\", so a pattern requiring a segment between them matches NOTHING — which is what the first\n * draft did, and the pin below is what caught it before it shipped as a hint that never fires.\n */\n if (!/Cannot read propert(?:y|ies).*of undefined/u.test(described)) return error;\n /*\n * The AUTHORED frame — the first stack frame inside the application's specification source — is the one\n * fact that separates the two readings below, and the raw error buries it under a dozen loader frames.\n * Named here so the reader opens the right file first instead of restarting first.\n */\n const stack = error instanceof Error ? (error.stack ?? '') : '';\n const authoredFrame = stack.split('\\n').map((line) => line.trim()).find((line) => /specifications\\/src\\//u.test(line));\n const site = authoredFrame ? ` The first authored frame is: ${authoredFrame.replace(/^at\\s+/u, '')}.` : '';\n return new Error(\n `${described} — two readings.${site} `\n + '(1) A symbol was added to one of the application\\'s own packages and that package has not been COMPILED '\n + 'since: authored specification source is evaluated directly, but the application\\'s other packages are read '\n + \"as their compiled build, which this companion re-reads within a second of a new build — so check that the \"\n + 'package\\'s watcher is running and green (`wildo local dev` output, or its `dist` timestamp). (2) The failing '\n + 'file imports the symbol from a door that does not publish it — typically a subpath-only export of '\n + '`@wildo-ai/saas-specifications` named at the package ROOT, which is undefined however fresh the build is '\n + '(measured 2026-09-21: a landed risk register importing `ApplicationRiskRegisterSchema` from the root '\n + 'instead of `/assurance`). If the build is current, fix the import at the frame named above.',\n { cause: error },\n );\n}\n\n\n/** Extensions a plain-Node dynamic import cannot execute. */\nconst NON_EXECUTABLE_COMPANION_ENTRY_EXTENSIONS = Object.freeze([\".ts\", \".tsx\", \".mts\", \".cts\"]);\n\n/**\n * Import one resolved companion entry.\n *\n * The companion runs as compiled JavaScript under plain Node with only an\n * asset-noop loader registered — it has no TypeScript loader. `resolvePackageCompanionEntryPath`\n * may legitimately hand back authored source: that fallback is load-bearing for\n * `loadPackageCompanionExport`, which resolves through jiti and CAN execute\n * TypeScript. Here it cannot.\n *\n * Rejecting a source entry explicitly turns a package misconfiguration into a\n * precise, actionable error. Letting it through instead produced a bare\n * `ERR_UNKNOWN_FILE_EXTENSION` from deep inside the module loader, which — because\n * several call sites are deliberately best-effort — was swallowed into a warning\n * that named neither the package nor the dangling export. That is how a\n * permanently-dangling `./companion` target stayed invisible until the companion\n * happened to survive continuity recovery for the first time.\n */\nasync function importCompanionModule(entryPath: string): Promise<Record<string, unknown>> {\n const nonExecutableExtension = NON_EXECUTABLE_COMPANION_ENTRY_EXTENSIONS.find((extension) => entryPath.endsWith(extension));\n if (nonExecutableExtension) {\n throw new Error(\n `Companion entry \"${entryPath}\" is TypeScript source, which this runtime cannot execute. `\n + \"The package's declared companion export is missing or unbuilt, so resolution fell back to authored source. \"\n + \"Build the package, or correct its package.json exports to point at a built entry.\",\n );\n }\n return import(pathToFileURL(entryPath).href) as Promise<Record<string, unknown>>;\n}\n\nasync function importCompanionDefaultExport<T extends object>(entryPath: string, exportOwnerLabel: string): Promise<T> {\n const moduleExports = await importCompanionModule(entryPath);\n const defaultExport = moduleExports.default;\n\n if (!defaultExport || typeof defaultExport !== \"object\") {\n throw new Error(`${exportOwnerLabel} companion export must default-export one typed object surface.`);\n }\n\n return defaultExport as T;\n}\n\nfunction resolvePackageRootEntryPath(packageRoot: string): string {\n const sourceCandidates = [\n join(packageRoot, \"src\", \"index.ts\"),\n join(packageRoot, \"src\", \"index.tsx\"),\n join(packageRoot, \"src\", \"index.js\"),\n join(packageRoot, \"src\", \"index.mjs\"),\n ];\n\n for (const candidate of sourceCandidates) {\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n const packageJsonPath = join(packageRoot, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n throw new Error(`Missing package.json for package root \"${packageRoot}\".`);\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as {\n exports?: Record<string, string | { import?: string; default?: string }>;\n main?: string;\n module?: string;\n };\n const rootExport = packageJson.exports?.[\".\"];\n\n if (typeof rootExport === \"string\") {\n const rootExportPath = resolve(packageRoot, rootExport);\n if (existsSync(rootExportPath)) {\n return rootExportPath;\n }\n }\n\n if (rootExport && typeof rootExport === \"object\") {\n const declaredEntryPath = rootExport.import ?? rootExport.default;\n if (typeof declaredEntryPath === \"string\") {\n const rootExportPath = resolve(packageRoot, declaredEntryPath);\n if (existsSync(rootExportPath)) {\n return rootExportPath;\n }\n }\n }\n\n for (const declaredEntryPath of [packageJson.module, packageJson.main]) {\n if (!declaredEntryPath) {\n continue;\n }\n\n const resolvedEntryPath = resolve(packageRoot, declaredEntryPath);\n if (existsSync(resolvedEntryPath)) {\n return resolvedEntryPath;\n }\n }\n\n throw new Error(`Could not resolve root entry for package \"${packageRoot}\".`);\n}\n\n/**\n * The module aliases the specifications package declares for ITSELF, read from its `tsconfig.json`.\n *\n * These used to come from an app-authored continuity declaration (`specifications/src/continuity.ts` →\n * `composition.compilerPathAliases`), which was one more place an application had to restate something it\n * had already said. The compiler config is where a package declares how its own specifiers resolve, it is\n * a committed file, and two branches can carry different versions of it and merge — so it is the source\n * this loader should have been reading all along (`.claude/rules/one-source-of-truth.md`, Rule 0).\n *\n * Scope, stated rather than discovered later: only the package's OWN `compilerOptions.paths` is read. An\n * alias inherited through `extends` is not followed, because resolving that chain here would mean\n * reimplementing a slice of tsc for a case no application has. A missing file or a missing `paths` block\n * means no aliases — the honest answer, not a fallback. Malformed JSON throws: a package whose compiler\n * config cannot be parsed cannot have its authored exports loaded correctly either.\n */\nfunction readPackageCompilerPathAliases(packageRoot: string): Readonly<Record<string, readonly string[]>> {\n const tsconfigPath = join(packageRoot, \"tsconfig.json\");\n if (!existsSync(tsconfigPath)) return {};\n let parsed: unknown;\n try {\n parsed = JSON.parse(readFileSync(tsconfigPath, \"utf8\"));\n } catch (error) {\n throw new Error(`Specifications package tsconfig.json is not parseable JSON: ${tsconfigPath}`, { cause: error });\n }\n const paths = (parsed as { compilerOptions?: { paths?: unknown } } | null)?.compilerOptions?.paths;\n if (paths === null || paths === undefined || typeof paths !== \"object\") return {};\n const aliases: Record<string, readonly string[]> = {};\n for (const [alias, targets] of Object.entries(paths as Record<string, unknown>)) {\n if (Array.isArray(targets) && targets.every((target): target is string => typeof target === \"string\")) {\n aliases[alias] = targets;\n }\n }\n return aliases;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../../../src/core/inject/models/container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAShE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../../../../src/core/inject/models/container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAShE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AA8D5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAE9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,4DAA4D,CAAC;AAyB9G,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;gBAEnC,SAAS,CAAC,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,aAAa,CAAC,EAAE,sBAAsB;IAKvH,OAAO,CAAC,YAAY;IAoLb,YAAY,IAAI,kBAAkB;CAG1C;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,aAAa,CAAC,EAAE,sBAAsB,GACrC,kBAAkB,CAMpB;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAG1D;AAED,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
|
|
@@ -56,6 +56,8 @@ import { DossierCompanionService } from "../../../meta-workflows/services/dossie
|
|
|
56
56
|
import { PlaybookInstanceCompanionService } from "../../../meta-workflows/services/playbook-instance.companion.service.js";
|
|
57
57
|
import { BuildPlanAuthoringCompanionService } from "../../../meta-workflows/services/build-plan-authoring.companion.service.js";
|
|
58
58
|
import { CodingRunWriteRegisterCompanionService } from "../../../claude-cli/services/coding-run-write-register.companion.service.js";
|
|
59
|
+
import { CreationInterventionLedgerCompanionService } from "../../../meta-workflows/services/creation-intervention-ledger.companion.service.js";
|
|
60
|
+
import { CreationRunReportCompanionService } from "../../../meta-workflows/services/creation-run-report.companion.service.js";
|
|
59
61
|
import { AcceptedChangeCommitCompanionService } from "../../../claude-cli/services/accepted-change-commit.companion.service.js";
|
|
60
62
|
export { CompanionController } from "../../../companion-api/controllers/companion.controller.js";
|
|
61
63
|
export { StartCompanionApplicationService } from "../../runtime/services/start-companion-application.service.js";
|
|
@@ -125,6 +127,8 @@ export class CompanionContainer {
|
|
|
125
127
|
this.container.bind(COMPANION_SERVICE_TYPES.PlaybookInstanceService).to(PlaybookInstanceCompanionService).inSingletonScope();
|
|
126
128
|
this.container.bind(COMPANION_SERVICE_TYPES.BuildPlanAuthoringService).to(BuildPlanAuthoringCompanionService).inSingletonScope();
|
|
127
129
|
this.container.bind(COMPANION_SERVICE_TYPES.CodingRunWriteRegisterService).to(CodingRunWriteRegisterCompanionService).inSingletonScope();
|
|
130
|
+
this.container.bind(COMPANION_SERVICE_TYPES.CreationInterventionLedgerService).to(CreationInterventionLedgerCompanionService).inSingletonScope();
|
|
131
|
+
this.container.bind(COMPANION_SERVICE_TYPES.CreationRunReportService).to(CreationRunReportCompanionService).inSingletonScope();
|
|
128
132
|
this.container.bind(COMPANION_SERVICE_TYPES.AcceptedChangeCommitService).to(AcceptedChangeCommitCompanionService).inSingletonScope();
|
|
129
133
|
this.container.bind(COMPANION_SERVICE_TYPES.LogoGenerationService).to(LogoGenerationCompanionService).inSingletonScope();
|
|
130
134
|
this.container.bind(COMPANION_SERVICE_TYPES.LogoDeliberationService).to(LogoDeliberationCompanionService).inSingletonScope();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../../../src/core/inject/models/container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAE9F,iBAAiB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B,CAAC,IAAI,CAAC,CAAC;QAC3I,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC,eAAe,CAAC;YAChF,IAAI,KAAK;gBACP,OAAO,yBAAyB,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAC3F,CAAC;SACgC,CAAC,CAAC;IACvC,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED,MAAM,UAAU,uBAAuB,CACrC,QAA6B,EAC7B,gBAAmC,EACnC,aAAsC;IAEtC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;QAC7F,eAAe,GAAG,kBAAkB,CAAC,YAAY,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC,eAAe;QAAE,OAAO,uBAAuB,EAAE,CAAC;IACvD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\n\nimport { InversifyContainer } from \"@wildo-ai/saas-backend-lib\";\nimport { SAAS_SERVICE_TYPES } from \"@wildo-ai/saas-backend-lib\";\nimport { CompositeAgentCallTraceSink } from \"@wildo-ai/saas-backend-lib\";\nimport type { AgentCallTraceSink } from \"@wildo-ai/saas-models\";\nimport type { AgentTraceabilityLevel, AgentTraceabilityPolicy } from \"@wildo-ai/saas-models\";\nimport { maxAgentTraceabilityLevel } from \"@wildo-ai/saas-models\";\nimport { setupPlatformSharedInjection } from \"@wildo-ai/platform-shared-lib\";\n\nimport { COMPANION_SERVICE_TYPES } from \"./service-types\";\nimport type { CompanionContext } from \"../../context/companion-context\";\nimport type { CompanionRuntimeConfig } from \"../../runtime/models/companion-runtime.models\";\nimport { CompanionTraceabilityLevel } from \"../../traceability/companion-traceability.models\";\n\n// Local services\nimport { CompanionController } from \"../../../companion-api/controllers/companion.controller\";\nimport { StartCompanionApplicationService } from \"../../runtime/services/start-companion-application.service\";\nimport { EmailTemplateCompanionService } from \"../../../email/services/email-template.companion.service\";\nimport { EmailSpecContextLoaderCompanionService } from \"../../../email/services/email-spec-context-loader.companion.service\";\nimport { MarketGenerationCompanionService } from \"../../../market/services/market-generation.companion.service\";\nimport { LogoGenerationCompanionService } from \"../../../brand/services/logo-generation.companion.service\";\nimport { LogoDeliberationCompanionService } from \"../../../brand/services/logo-deliberation.companion.service\";\nimport { BrandAcceptCompanionService } from \"../../../brand/services/brand-accept.companion.service\";\nimport { ExpertPersonaCompanionService } from \"../../../expert-personas/services/expert-persona.companion.service\";\nimport { DeliberationCompanionService } from \"../../../deliberations/services/deliberation.companion.service\";\nimport { StructuredDeliberationCompanionService } from \"../../../deliberations/services/structured-deliberation.companion.service\";\nimport { GitChangeSetCompanionService } from \"../../../claude-cli/services/git-change-set.companion.service\";\nimport { CodingAgentDispatchCompanionService } from \"../../../claude-cli/services/coding-agent-dispatch.companion.service\";\nimport { ResearchAgentDispatchCompanionService } from \"../../../claude-cli/services/research-agent-dispatch.companion.service\";\nimport { PlaybookSpendMeterCompanionService, installPlaybookSpendMeter } from \"../../../meta-workflows/services/playbook-spend-meter.companion.service\";\nimport { CompanionAuthFloorCompanionService } from \"../../auth/companion-auth-floor.companion.service\";\nimport { TechnicalDocCompanionService } from \"../../../technical-doc/services/technical-doc.companion.service\";\nimport { TechnicalDocumentationApplicationDerivationCompanionService } from \"../../../technical-doc/services/technical-documentation-application-derivation.companion.service\";\nimport {\n SystemTechnicalDocumentationEnvironmentClock,\n TechnicalDocumentationEnvironmentIdentityCompanionService,\n} from \"../../../technical-doc/services/technical-documentation-environment-identity.companion.service\";\nimport { CompanionIntrospectionBehaviorRegistryService } from \"../../introspection/services/companion-introspection-behavior-registry.companion.service\";\nimport { CompanionIntrospectionService } from \"../../introspection/services/companion-introspection.companion.service\";\nimport { IntrospectionDerivationStateCompanionService } from \"../../introspection/services/introspection-derivation-state.companion.service\";\nimport { IntrospectionSourceWatcherCompanionService } from \"../../introspection/services/introspection-source-watcher.companion.service\";\nimport { IntrospectionResourceNotifierCompanionService } from \"../../introspection/resources/introspection-resource-notifier.companion.service\";\nimport { IntrospectionResourceSourceCompanionService } from \"../../introspection/resources/introspection-resource-source.companion.service\";\nimport { CreationPlaneProjectionCompanionService } from \"../../introspection/resources/creation-plane-projection.companion.service\";\nimport { TranslationPlacementCompanionService } from \"../../introspection/services/translation-placement.companion.service\";\nimport { CompanionExecutionsCompanionService } from \"../../../executions/services/companion-executions.companion.service\";\nimport { CompanionActorExecutionPersistenceAdapter } from \"../../../executions/services/companion-actor-execution-persistence.adapter\";\nimport { CompanionTraceabilityService } from \"../../traceability/companion-traceability.service\";\nimport { CompanionAgentCallTraceSink, AGENT_TRACE_LEVEL_BY_COMPANION_LEVEL } from \"../../traceability/companion-agent-call-trace-sink.companion.service\";\nimport { WildoSaasLockCompanionService } from \"../../lock/wildo-saas-lock.companion.service\";\nimport { LabellingPlannerCompanionService } from \"../../../i18n-labelling/services/labelling-planner.companion.service\";\nimport { LabellingSpecContextLoaderCompanionService } from \"../../../i18n-labelling/services/labelling-spec-context-loader.companion.service\";\nimport { LabellizeOrchestratorCompanionService } from \"../../../i18n-labelling/services/labellize-orchestrator.companion.service\";\nimport { TranslateOrchestratorCompanionService } from \"../../../i18n-labelling/services/translate-orchestrator.companion.service\";\nimport { EmailTemplateLabellingUnitsCompanionService } from \"../../../i18n-labelling/services/email-template-labelling-units.companion.service\";\nimport { ComponentLabelsBootstrapCompanionService } from \"../../../i18n-labelling/services/component-labels-bootstrap.companion.service\";\n\nimport { PlaybookRunCompanionService } from \"../../../meta-workflows/services/playbook-run.companion.service\";\nimport { FoundationExecutorCompanionService } from \"../../../meta-workflows/services/foundation-executor.companion.service\";\nimport { CapabilityCompositionExecutorCompanionService } from \"../../../meta-workflows/services/capability-composition-executor.companion.service\";\nimport { ApplicationMaturityExecutorCompanionService } from \"../../../meta-workflows/services/application-maturity-executor.companion.service\";\nimport { ApplicationBuildDispatchCompanionService } from \"../../../meta-workflows/services/application-build-dispatch.companion.service\";\nimport { ApplicationBuildGenerationStepCompanionService } from \"../../../meta-workflows/services/application-build-generation-step.companion.service\";\nimport { PlaybookRunWriteRegisterCompanionService } from \"../../../meta-workflows/services/playbook-run-write-register.companion.service\";\nimport { ExecutionTraceReadCompanionService } from \"../../../meta-workflows/services/execution-trace-read.companion.service\";\nimport { DossierCompanionService } from \"../../../meta-workflows/services/dossier.companion.service\";\nimport { PlaybookInstanceCompanionService } from \"../../../meta-workflows/services/playbook-instance.companion.service\";\nimport { BuildPlanAuthoringCompanionService } from \"../../../meta-workflows/services/build-plan-authoring.companion.service\";\nimport { CodingRunWriteRegisterCompanionService } from \"../../../claude-cli/services/coding-run-write-register.companion.service\";\nimport { AcceptedChangeCommitCompanionService } from \"../../../claude-cli/services/accepted-change-commit.companion.service\";\n\nexport { CompanionController } from \"../../../companion-api/controllers/companion.controller\";\n\nexport { StartCompanionApplicationService } from \"../../runtime/services/start-companion-application.service\";\n\nlet globalContainer: InversifyContainer | null = null;\n\n/**\n * Process-safety ceilings for the local application reconciliation adapter.\n *\n * They are deliberately not semantic retry policy: retry count/backoff and\n * lease duration come from the resolved Work Cycle. Reaching either ceiling\n * fails readiness instead of publishing with hidden reconciliation debt.\n */\n/**\n * How many outboxes the STARTUP drain will attempt before giving up and letting boot continue.\n *\n * This is a COUNT bound and it does not bound duration -- reconciling one outbox left mid-flight by an\n * interrupted run was measured taking >90s on its own (2026-08-20), so lowering the count did not stop the\n * TASK_OUTBOX stage blowing its 300,000ms ceiling. The duration bound lives in\n * `reconcileOutstandingAtStartup`, which gives startup a fixed time slice and continues regardless.\n *\n * The count therefore stays generous enough for the EXECUTION-time drain, which shares this limit and\n * throws when work is still claimable after it. Lowering it to 1 broke exactly that path.\n */\nconst TASK_TERMINALIZATION_STARTUP_DRAIN_LIMIT = 64;\nconst TASK_AGGREGATE_CAS_ATTEMPT_LIMIT = 8;\n\nexport class CompanionContainer {\n private readonly container: InversifyContainer;\n\n constructor(container?: InversifyContainer, companionContext?: CompanionContext, runtimeConfig?: CompanionRuntimeConfig) {\n this.container = container ?? new InversifyContainer({ defaultScope: \"Singleton\" });\n this.bindServices(companionContext, runtimeConfig);\n }\n\n private bindServices(companionContext?: CompanionContext, runtimeConfig?: CompanionRuntimeConfig): void {\n setupPlatformSharedInjection(this.container);\n\n if (companionContext) {\n this.container.bind<CompanionContext>(COMPANION_SERVICE_TYPES.CompanionContext).toConstantValue(companionContext);\n }\n\n this.container\n .bind<CompanionRuntimeConfig>(COMPANION_SERVICE_TYPES.CompanionRuntimeConfig)\n .toConstantValue(runtimeConfig ?? { traceabilityLevel: CompanionTraceabilityLevel.NONE });\n\n // Controller (bind by symbol and by class for flexible retrieval)\n this.container.bind(COMPANION_SERVICE_TYPES.CompanionController).to(CompanionController).inSingletonScope();\n this.container.bind(CompanionController).to(CompanionController).inSingletonScope();\n\n // Start service (bind by class for retrieval)\n this.container.bind(StartCompanionApplicationService).to(StartCompanionApplicationService).inSingletonScope();\n\n // Shared companion lock file (wildo-saas.lock.json)\n this.container.bind(COMPANION_SERVICE_TYPES.WildoSaasLockService).to(WildoSaasLockCompanionService).inSingletonScope();\n\n // i18n Labelling pipeline\n this.container.bind(COMPANION_SERVICE_TYPES.LabellingSpecContextLoader).to(LabellingSpecContextLoaderCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LabellingPlannerService).to(LabellingPlannerCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService).to(LabellizeOrchestratorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TranslateOrchestratorService).to(TranslateOrchestratorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.EmailTemplateLabellingUnitsService).to(EmailTemplateLabellingUnitsCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ComponentLabelsBootstrapService).to(ComponentLabelsBootstrapCompanionService).inSingletonScope();\n\n // Email template service\n this.container.bind(COMPANION_SERVICE_TYPES.EmailSpecContextLoader).to(EmailSpecContextLoaderCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.EmailTemplateService).to(EmailTemplateCompanionService).inSingletonScope();\n\n // Market generation service (Phase 4.2)\n this.container.bind(COMPANION_SERVICE_TYPES.MarketGenerationService).to(MarketGenerationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookRunService).to(PlaybookRunCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.FoundationExecutorService).to(FoundationExecutorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CapabilityCompositionExecutorService).to(CapabilityCompositionExecutorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ApplicationMaturityExecutorService).to(ApplicationMaturityExecutorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService).to(ApplicationBuildDispatchCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.BuildGenerationStepService).to(ApplicationBuildGenerationStepCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService).to(PlaybookRunWriteRegisterCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ExecutionTraceReadService).to(ExecutionTraceReadCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.DossierService).to(DossierCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookInstanceService).to(PlaybookInstanceCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.BuildPlanAuthoringService).to(BuildPlanAuthoringCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CodingRunWriteRegisterService).to(CodingRunWriteRegisterCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.AcceptedChangeCommitService).to(AcceptedChangeCommitCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LogoGenerationService).to(LogoGenerationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LogoDeliberationService).to(LogoDeliberationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.BrandAcceptService).to(BrandAcceptCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ExpertPersonaService).to(ExpertPersonaCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.DeliberationService).to(DeliberationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.StructuredDeliberationService).to(StructuredDeliberationCompanionService).inSingletonScope();\n\n // Claude-CLI direct invocation (lower-level than the agents path).\n // Reads the `kind: 'cli-runtime'` runtime contract from the\n // backend provider registry and spawns `claude` via\n // `anthropic` in `wildo.saas.config.ts` is what makes the\n // contract reachable from this process.\n\n // Coding-agent dispatch lane (meta-workflows Step 4 / L2): read-only\n // git change-set capture (DD-8 carve-out), async dispatch runs, and\n // the P-29 auth floor (loopback assertion + companion.token).\n this.container.bind(COMPANION_SERVICE_TYPES.GitChangeSetService).to(GitChangeSetCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CodingAgentDispatchService).to(CodingAgentDispatchCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ResearchAgentDispatchService).to(ResearchAgentDispatchCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.AuthFloorService).to(CompanionAuthFloorCompanionService).inSingletonScope();\n\n // Workbench construction is effect-free. The dynamic factory creates only\n // in-memory adapters; accepted embedding reads and application-local\n // activation begin later in StartCompanionApplicationService.\n\n // New-contract registry and read-only candidate projection. Executable\n // bindings remain inert until an internal application-creation service\n // supplies exact continuity and artifact inputs.\n\n // Bind the physical executions service once, then expose that same\n // singleton through the internal physical Task port. Public companion Task\n // CRUD and continuity CAS therefore share one repository/ownership view\n // without widening the public DTO's authority.\n if (!this.container.isBound(COMPANION_SERVICE_TYPES.ExecutionsService)) {\n this.container.bind(COMPANION_SERVICE_TYPES.ExecutionsService).to(CompanionExecutionsCompanionService).inSingletonScope();\n }\n /*\n * The ENGINE's actor-plane persistence port, bound to the platform rows (#1358). The engine's\n * `ActorsSystemBackendService` drives an execution's lifecycle and asks this port to write it; a\n * host that binds nothing gets a runtime that refuses to open an execution. Same shape as\n * `SAAS_SERVICE_TYPES.IntrospectionResourceSource` below: a companion supplying an engine seam.\n */\n if (!this.container.isBound(SAAS_SERVICE_TYPES.ActorExecutionPersistencePort)) {\n this.container.bind(SAAS_SERVICE_TYPES.ActorExecutionPersistencePort).to(CompanionActorExecutionPersistenceAdapter).inSingletonScope();\n }\n\n // Any participant not owned by the subject runtime or a concrete\n // family/Task adapter binds to one throwing service. The container remains\n // resolvable for health diagnostics while semantic startup fails closed.\n \n\n // Technical documentation orchestrator (saas-technical-doc.md Step 3)\n this.container.bind(COMPANION_SERVICE_TYPES.TechnicalDocumentationEnvironmentClock).to(SystemTechnicalDocumentationEnvironmentClock).inSingletonScope();\n this.container\n .bind(COMPANION_SERVICE_TYPES.TechnicalDocumentationEnvironmentIdentityService)\n .to(TechnicalDocumentationEnvironmentIdentityCompanionService)\n .inSingletonScope();\n this.container\n .bind(COMPANION_SERVICE_TYPES.TechnicalDocumentationApplicationDerivationService)\n .to(TechnicalDocumentationApplicationDerivationCompanionService)\n .inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TechnicalDocService).to(TechnicalDocCompanionService).inSingletonScope();\n\n // Companion introspection\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionBehaviorRegistryService).to(CompanionIntrospectionBehaviorRegistryService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionDerivationStateService)\n .to(IntrospectionDerivationStateCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionSourceWatcherService)\n .to(IntrospectionSourceWatcherCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionResourceNotifierService)\n .to(IntrospectionResourceNotifierCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionService).to(CompanionIntrospectionService).inSingletonScope();\n /*\n * Bound under the ENGINE's token, not a companion one.\n *\n * `PersistenceAdapter.INTROSPECTION`'s repository resolves this port lazily from the container\n * (`SAAS_SERVICE_TYPES.IntrospectionResourceSource`) and refuses cleanly when nothing is bound —\n * which is the normal state for any application running without a companion. Binding it here is\n * what makes introspected resources readable at all, and it is the same shape\n * `platform-apps-manager` uses to supply `SAAS_SERVICE_TYPES.StorageCredentialResolver`.\n */\n this.container.bind(COMPANION_SERVICE_TYPES.CreationPlaneProjectionService).to(CreationPlaneProjectionCompanionService).inSingletonScope();\n this.container.bind(SAAS_SERVICE_TYPES.IntrospectionResourceSource).to(IntrospectionResourceSourceCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TranslationPlacementService).to(TranslationPlacementCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TraceabilityService).to(CompanionTraceabilityService).inSingletonScope();\n // Engine agent-call traceability: bind the companion filesystem sink + a\n // policy bridged from the companion's level onto the engine SAAS symbols\n // that `AgentsBackendService` `@optional()`-injects. This is what makes\n // every `invokeAgent` call (companion services, market generation, future\n // backend/minion/worker callers) emit into the companion's session/step tree.\n // The companion always adds its filesystem sink (dev artifacts), composed ON\n // TOP of whatever the engine container bound for `AgentCallTraceSink`: when a\n // PostHog LLM-observability provider is configured the engine binds it (and\n // owns its lazy client + flush), so the companion just fans out\n // \"filesystem + <engine sink>\" with no re-construction. A NoOp engine sink\n // collapses to filesystem-only. Switchable: swapping the LLM-obs provider is an\n // engine-side re-bind, transparent here. Gating: the policy `rebind` below\n // COMPOSES the companion's level with the engine's live LLM-obs level (max);\n // each sink then self-gates.\n // NB: the engine PostHog sink lazy-loads `posthog-node` — an optional peer that\n // must be installed in any runtime that binds LLM_OBSERVABILITY (this companion\n // installs it for dev verification; the missing-package path is a graceful no-op).\n // The playbook lane's spend meter (#1507), installed where the trace sink is composed and for the\n // same reason: both must be in place before anything resolves `AgentsBackendService`. It decorates\n // the engine's provider-call recorder — the one seam every physical model call passes, ungated.\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookSpendMeter).to(PlaybookSpendMeterCompanionService).inSingletonScope();\n installPlaybookSpendMeter(this.container, this.container.get<PlaybookSpendMeterCompanionService>(COMPANION_SERVICE_TYPES.PlaybookSpendMeter));\n const companionTraceSink = new CompanionAgentCallTraceSink(this.container.get<CompanionTraceabilityService>(COMPANION_SERVICE_TYPES.TraceabilityService));\n const engineAgentTraceSink = this.container.get<AgentCallTraceSink>(SAAS_SERVICE_TYPES.AgentCallTraceSink);\n this.container.rebind(SAAS_SERVICE_TYPES.AgentCallTraceSink).toConstantValue(new CompositeAgentCallTraceSink([companionTraceSink, engineAgentTraceSink]));\n // COMPOSE the policy, never override it: the engine binds a LIVE policy\n // (`DEBUG` iff an LLM-observability provider is selected + configured, else\n // `NONE`) and the previous static rebind here REPLACED it with the\n // companion's filesystem-tracing level alone — with\n // `WILDO_DEV_COMPANION_TRACEABILITY_LEVEL` unset that froze the level at\n // `NONE`, so `emitAgentCallTrace` skipped BEFORE any sink and PostHog\n // capture (plus even its missing-secret warning) went silently dead. The\n // effective level is the MAX of the two concerns; each sink still\n // self-gates (the filesystem sink skips un-correlated calls and applies the\n // session's own level), so raising the policy for LLM-obs does NOT switch\n // on filesystem artifacts.\n const engineAgentTracePolicy = this.container.get<AgentTraceabilityPolicy>(SAAS_SERVICE_TYPES.AgentTraceabilityPolicy);\n const companionAgentTraceLevel = AGENT_TRACE_LEVEL_BY_COMPANION_LEVEL[runtimeConfig?.traceabilityLevel ?? CompanionTraceabilityLevel.NONE];\n this.container.rebind(SAAS_SERVICE_TYPES.AgentTraceabilityPolicy).toConstantValue({\n get level(): AgentTraceabilityLevel {\n return maxAgentTraceabilityLevel(companionAgentTraceLevel, engineAgentTracePolicy.level);\n },\n } satisfies AgentTraceabilityPolicy);\n }\n\n public getContainer(): InversifyContainer {\n return this.container;\n }\n}\n\nexport function setupCompanionInjection(\n existing?: InversifyContainer,\n companionContext?: CompanionContext,\n runtimeConfig?: CompanionRuntimeConfig,\n): InversifyContainer {\n if (!globalContainer) {\n const companionContainer = new CompanionContainer(existing, companionContext, runtimeConfig);\n globalContainer = companionContainer.getContainer();\n }\n return globalContainer;\n}\n\nexport function getCompanionContainer(): InversifyContainer {\n if (!globalContainer) return setupCompanionInjection();\n return globalContainer;\n}\n\nexport function resetCompanionContainer(): void {\n globalContainer = null;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../../../../../src/core/inject/models/container.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAGzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAE9F,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,4DAA4D,CAAC;AAC9G,OAAO,EAAE,6BAA6B,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;QACzE,kEAAkE;QAClE,4EAA4E;QAC5E,0EAA0E;QAC1E,2BAA2B;QAC3B,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAA0B,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;QACvH,MAAM,wBAAwB,GAAG,oCAAoC,CAAC,aAAa,EAAE,iBAAiB,IAAI,0BAA0B,CAAC,IAAI,CAAC,CAAC;QAC3I,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAC,eAAe,CAAC;YAChF,IAAI,KAAK;gBACP,OAAO,yBAAyB,CAAC,wBAAwB,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;YAC3F,CAAC;SACgC,CAAC,CAAC;IACvC,CAAC;IAEM,YAAY;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED,MAAM,UAAU,uBAAuB,CACrC,QAA6B,EAC7B,gBAAmC,EACnC,aAAsC;IAEtC,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;QAC7F,eAAe,GAAG,kBAAkB,CAAC,YAAY,EAAE,CAAC;IACtD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC,eAAe;QAAE,OAAO,uBAAuB,EAAE,CAAC;IACvD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,eAAe,GAAG,IAAI,CAAC;AACzB,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\n\nimport { InversifyContainer } from \"@wildo-ai/saas-backend-lib\";\nimport { SAAS_SERVICE_TYPES } from \"@wildo-ai/saas-backend-lib\";\nimport { CompositeAgentCallTraceSink } from \"@wildo-ai/saas-backend-lib\";\nimport type { AgentCallTraceSink } from \"@wildo-ai/saas-models\";\nimport type { AgentTraceabilityLevel, AgentTraceabilityPolicy } from \"@wildo-ai/saas-models\";\nimport { maxAgentTraceabilityLevel } from \"@wildo-ai/saas-models\";\nimport { setupPlatformSharedInjection } from \"@wildo-ai/platform-shared-lib\";\n\nimport { COMPANION_SERVICE_TYPES } from \"./service-types\";\nimport type { CompanionContext } from \"../../context/companion-context\";\nimport type { CompanionRuntimeConfig } from \"../../runtime/models/companion-runtime.models\";\nimport { CompanionTraceabilityLevel } from \"../../traceability/companion-traceability.models\";\n\n// Local services\nimport { CompanionController } from \"../../../companion-api/controllers/companion.controller\";\nimport { StartCompanionApplicationService } from \"../../runtime/services/start-companion-application.service\";\nimport { EmailTemplateCompanionService } from \"../../../email/services/email-template.companion.service\";\nimport { EmailSpecContextLoaderCompanionService } from \"../../../email/services/email-spec-context-loader.companion.service\";\nimport { MarketGenerationCompanionService } from \"../../../market/services/market-generation.companion.service\";\nimport { LogoGenerationCompanionService } from \"../../../brand/services/logo-generation.companion.service\";\nimport { LogoDeliberationCompanionService } from \"../../../brand/services/logo-deliberation.companion.service\";\nimport { BrandAcceptCompanionService } from \"../../../brand/services/brand-accept.companion.service\";\nimport { ExpertPersonaCompanionService } from \"../../../expert-personas/services/expert-persona.companion.service\";\nimport { DeliberationCompanionService } from \"../../../deliberations/services/deliberation.companion.service\";\nimport { StructuredDeliberationCompanionService } from \"../../../deliberations/services/structured-deliberation.companion.service\";\nimport { GitChangeSetCompanionService } from \"../../../claude-cli/services/git-change-set.companion.service\";\nimport { CodingAgentDispatchCompanionService } from \"../../../claude-cli/services/coding-agent-dispatch.companion.service\";\nimport { ResearchAgentDispatchCompanionService } from \"../../../claude-cli/services/research-agent-dispatch.companion.service\";\nimport { PlaybookSpendMeterCompanionService, installPlaybookSpendMeter } from \"../../../meta-workflows/services/playbook-spend-meter.companion.service\";\nimport { CompanionAuthFloorCompanionService } from \"../../auth/companion-auth-floor.companion.service\";\nimport { TechnicalDocCompanionService } from \"../../../technical-doc/services/technical-doc.companion.service\";\nimport { TechnicalDocumentationApplicationDerivationCompanionService } from \"../../../technical-doc/services/technical-documentation-application-derivation.companion.service\";\nimport {\n SystemTechnicalDocumentationEnvironmentClock,\n TechnicalDocumentationEnvironmentIdentityCompanionService,\n} from \"../../../technical-doc/services/technical-documentation-environment-identity.companion.service\";\nimport { CompanionIntrospectionBehaviorRegistryService } from \"../../introspection/services/companion-introspection-behavior-registry.companion.service\";\nimport { CompanionIntrospectionService } from \"../../introspection/services/companion-introspection.companion.service\";\nimport { IntrospectionDerivationStateCompanionService } from \"../../introspection/services/introspection-derivation-state.companion.service\";\nimport { IntrospectionSourceWatcherCompanionService } from \"../../introspection/services/introspection-source-watcher.companion.service\";\nimport { IntrospectionResourceNotifierCompanionService } from \"../../introspection/resources/introspection-resource-notifier.companion.service\";\nimport { IntrospectionResourceSourceCompanionService } from \"../../introspection/resources/introspection-resource-source.companion.service\";\nimport { CreationPlaneProjectionCompanionService } from \"../../introspection/resources/creation-plane-projection.companion.service\";\nimport { TranslationPlacementCompanionService } from \"../../introspection/services/translation-placement.companion.service\";\nimport { CompanionExecutionsCompanionService } from \"../../../executions/services/companion-executions.companion.service\";\nimport { CompanionActorExecutionPersistenceAdapter } from \"../../../executions/services/companion-actor-execution-persistence.adapter\";\nimport { CompanionTraceabilityService } from \"../../traceability/companion-traceability.service\";\nimport { CompanionAgentCallTraceSink, AGENT_TRACE_LEVEL_BY_COMPANION_LEVEL } from \"../../traceability/companion-agent-call-trace-sink.companion.service\";\nimport { WildoSaasLockCompanionService } from \"../../lock/wildo-saas-lock.companion.service\";\nimport { LabellingPlannerCompanionService } from \"../../../i18n-labelling/services/labelling-planner.companion.service\";\nimport { LabellingSpecContextLoaderCompanionService } from \"../../../i18n-labelling/services/labelling-spec-context-loader.companion.service\";\nimport { LabellizeOrchestratorCompanionService } from \"../../../i18n-labelling/services/labellize-orchestrator.companion.service\";\nimport { TranslateOrchestratorCompanionService } from \"../../../i18n-labelling/services/translate-orchestrator.companion.service\";\nimport { EmailTemplateLabellingUnitsCompanionService } from \"../../../i18n-labelling/services/email-template-labelling-units.companion.service\";\nimport { ComponentLabelsBootstrapCompanionService } from \"../../../i18n-labelling/services/component-labels-bootstrap.companion.service\";\n\nimport { PlaybookRunCompanionService } from \"../../../meta-workflows/services/playbook-run.companion.service\";\nimport { FoundationExecutorCompanionService } from \"../../../meta-workflows/services/foundation-executor.companion.service\";\nimport { CapabilityCompositionExecutorCompanionService } from \"../../../meta-workflows/services/capability-composition-executor.companion.service\";\nimport { ApplicationMaturityExecutorCompanionService } from \"../../../meta-workflows/services/application-maturity-executor.companion.service\";\nimport { ApplicationBuildDispatchCompanionService } from \"../../../meta-workflows/services/application-build-dispatch.companion.service\";\nimport { ApplicationBuildGenerationStepCompanionService } from \"../../../meta-workflows/services/application-build-generation-step.companion.service\";\nimport { PlaybookRunWriteRegisterCompanionService } from \"../../../meta-workflows/services/playbook-run-write-register.companion.service\";\nimport { ExecutionTraceReadCompanionService } from \"../../../meta-workflows/services/execution-trace-read.companion.service\";\nimport { DossierCompanionService } from \"../../../meta-workflows/services/dossier.companion.service\";\nimport { PlaybookInstanceCompanionService } from \"../../../meta-workflows/services/playbook-instance.companion.service\";\nimport { BuildPlanAuthoringCompanionService } from \"../../../meta-workflows/services/build-plan-authoring.companion.service\";\nimport { CodingRunWriteRegisterCompanionService } from \"../../../claude-cli/services/coding-run-write-register.companion.service\";\nimport { CreationInterventionLedgerCompanionService } from \"../../../meta-workflows/services/creation-intervention-ledger.companion.service\";\nimport { CreationRunReportCompanionService } from \"../../../meta-workflows/services/creation-run-report.companion.service\";\nimport { AcceptedChangeCommitCompanionService } from \"../../../claude-cli/services/accepted-change-commit.companion.service\";\n\nexport { CompanionController } from \"../../../companion-api/controllers/companion.controller\";\n\nexport { StartCompanionApplicationService } from \"../../runtime/services/start-companion-application.service\";\n\nlet globalContainer: InversifyContainer | null = null;\n\n/**\n * Process-safety ceilings for the local application reconciliation adapter.\n *\n * They are deliberately not semantic retry policy: retry count/backoff and\n * lease duration come from the resolved Work Cycle. Reaching either ceiling\n * fails readiness instead of publishing with hidden reconciliation debt.\n */\n/**\n * How many outboxes the STARTUP drain will attempt before giving up and letting boot continue.\n *\n * This is a COUNT bound and it does not bound duration -- reconciling one outbox left mid-flight by an\n * interrupted run was measured taking >90s on its own (2026-08-20), so lowering the count did not stop the\n * TASK_OUTBOX stage blowing its 300,000ms ceiling. The duration bound lives in\n * `reconcileOutstandingAtStartup`, which gives startup a fixed time slice and continues regardless.\n *\n * The count therefore stays generous enough for the EXECUTION-time drain, which shares this limit and\n * throws when work is still claimable after it. Lowering it to 1 broke exactly that path.\n */\nconst TASK_TERMINALIZATION_STARTUP_DRAIN_LIMIT = 64;\nconst TASK_AGGREGATE_CAS_ATTEMPT_LIMIT = 8;\n\nexport class CompanionContainer {\n private readonly container: InversifyContainer;\n\n constructor(container?: InversifyContainer, companionContext?: CompanionContext, runtimeConfig?: CompanionRuntimeConfig) {\n this.container = container ?? new InversifyContainer({ defaultScope: \"Singleton\" });\n this.bindServices(companionContext, runtimeConfig);\n }\n\n private bindServices(companionContext?: CompanionContext, runtimeConfig?: CompanionRuntimeConfig): void {\n setupPlatformSharedInjection(this.container);\n\n if (companionContext) {\n this.container.bind<CompanionContext>(COMPANION_SERVICE_TYPES.CompanionContext).toConstantValue(companionContext);\n }\n\n this.container\n .bind<CompanionRuntimeConfig>(COMPANION_SERVICE_TYPES.CompanionRuntimeConfig)\n .toConstantValue(runtimeConfig ?? { traceabilityLevel: CompanionTraceabilityLevel.NONE });\n\n // Controller (bind by symbol and by class for flexible retrieval)\n this.container.bind(COMPANION_SERVICE_TYPES.CompanionController).to(CompanionController).inSingletonScope();\n this.container.bind(CompanionController).to(CompanionController).inSingletonScope();\n\n // Start service (bind by class for retrieval)\n this.container.bind(StartCompanionApplicationService).to(StartCompanionApplicationService).inSingletonScope();\n\n // Shared companion lock file (wildo-saas.lock.json)\n this.container.bind(COMPANION_SERVICE_TYPES.WildoSaasLockService).to(WildoSaasLockCompanionService).inSingletonScope();\n\n // i18n Labelling pipeline\n this.container.bind(COMPANION_SERVICE_TYPES.LabellingSpecContextLoader).to(LabellingSpecContextLoaderCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LabellingPlannerService).to(LabellingPlannerCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService).to(LabellizeOrchestratorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TranslateOrchestratorService).to(TranslateOrchestratorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.EmailTemplateLabellingUnitsService).to(EmailTemplateLabellingUnitsCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ComponentLabelsBootstrapService).to(ComponentLabelsBootstrapCompanionService).inSingletonScope();\n\n // Email template service\n this.container.bind(COMPANION_SERVICE_TYPES.EmailSpecContextLoader).to(EmailSpecContextLoaderCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.EmailTemplateService).to(EmailTemplateCompanionService).inSingletonScope();\n\n // Market generation service (Phase 4.2)\n this.container.bind(COMPANION_SERVICE_TYPES.MarketGenerationService).to(MarketGenerationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookRunService).to(PlaybookRunCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.FoundationExecutorService).to(FoundationExecutorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CapabilityCompositionExecutorService).to(CapabilityCompositionExecutorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ApplicationMaturityExecutorService).to(ApplicationMaturityExecutorCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService).to(ApplicationBuildDispatchCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.BuildGenerationStepService).to(ApplicationBuildGenerationStepCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService).to(PlaybookRunWriteRegisterCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ExecutionTraceReadService).to(ExecutionTraceReadCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.DossierService).to(DossierCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookInstanceService).to(PlaybookInstanceCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.BuildPlanAuthoringService).to(BuildPlanAuthoringCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CodingRunWriteRegisterService).to(CodingRunWriteRegisterCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CreationInterventionLedgerService).to(CreationInterventionLedgerCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CreationRunReportService).to(CreationRunReportCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.AcceptedChangeCommitService).to(AcceptedChangeCommitCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LogoGenerationService).to(LogoGenerationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.LogoDeliberationService).to(LogoDeliberationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.BrandAcceptService).to(BrandAcceptCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ExpertPersonaService).to(ExpertPersonaCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.DeliberationService).to(DeliberationCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.StructuredDeliberationService).to(StructuredDeliberationCompanionService).inSingletonScope();\n\n // Claude-CLI direct invocation (lower-level than the agents path).\n // Reads the `kind: 'cli-runtime'` runtime contract from the\n // backend provider registry and spawns `claude` via\n // `anthropic` in `wildo.saas.config.ts` is what makes the\n // contract reachable from this process.\n\n // Coding-agent dispatch lane (meta-workflows Step 4 / L2): read-only\n // git change-set capture (DD-8 carve-out), async dispatch runs, and\n // the P-29 auth floor (loopback assertion + companion.token).\n this.container.bind(COMPANION_SERVICE_TYPES.GitChangeSetService).to(GitChangeSetCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.CodingAgentDispatchService).to(CodingAgentDispatchCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.ResearchAgentDispatchService).to(ResearchAgentDispatchCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.AuthFloorService).to(CompanionAuthFloorCompanionService).inSingletonScope();\n\n // Workbench construction is effect-free. The dynamic factory creates only\n // in-memory adapters; accepted embedding reads and application-local\n // activation begin later in StartCompanionApplicationService.\n\n // New-contract registry and read-only candidate projection. Executable\n // bindings remain inert until an internal application-creation service\n // supplies exact continuity and artifact inputs.\n\n // Bind the physical executions service once, then expose that same\n // singleton through the internal physical Task port. Public companion Task\n // CRUD and continuity CAS therefore share one repository/ownership view\n // without widening the public DTO's authority.\n if (!this.container.isBound(COMPANION_SERVICE_TYPES.ExecutionsService)) {\n this.container.bind(COMPANION_SERVICE_TYPES.ExecutionsService).to(CompanionExecutionsCompanionService).inSingletonScope();\n }\n /*\n * The ENGINE's actor-plane persistence port, bound to the platform rows (#1358). The engine's\n * `ActorsSystemBackendService` drives an execution's lifecycle and asks this port to write it; a\n * host that binds nothing gets a runtime that refuses to open an execution. Same shape as\n * `SAAS_SERVICE_TYPES.IntrospectionResourceSource` below: a companion supplying an engine seam.\n */\n if (!this.container.isBound(SAAS_SERVICE_TYPES.ActorExecutionPersistencePort)) {\n this.container.bind(SAAS_SERVICE_TYPES.ActorExecutionPersistencePort).to(CompanionActorExecutionPersistenceAdapter).inSingletonScope();\n }\n\n // Any participant not owned by the subject runtime or a concrete\n // family/Task adapter binds to one throwing service. The container remains\n // resolvable for health diagnostics while semantic startup fails closed.\n \n\n // Technical documentation orchestrator (saas-technical-doc.md Step 3)\n this.container.bind(COMPANION_SERVICE_TYPES.TechnicalDocumentationEnvironmentClock).to(SystemTechnicalDocumentationEnvironmentClock).inSingletonScope();\n this.container\n .bind(COMPANION_SERVICE_TYPES.TechnicalDocumentationEnvironmentIdentityService)\n .to(TechnicalDocumentationEnvironmentIdentityCompanionService)\n .inSingletonScope();\n this.container\n .bind(COMPANION_SERVICE_TYPES.TechnicalDocumentationApplicationDerivationService)\n .to(TechnicalDocumentationApplicationDerivationCompanionService)\n .inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TechnicalDocService).to(TechnicalDocCompanionService).inSingletonScope();\n\n // Companion introspection\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionBehaviorRegistryService).to(CompanionIntrospectionBehaviorRegistryService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionDerivationStateService)\n .to(IntrospectionDerivationStateCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionSourceWatcherService)\n .to(IntrospectionSourceWatcherCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionResourceNotifierService)\n .to(IntrospectionResourceNotifierCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.IntrospectionService).to(CompanionIntrospectionService).inSingletonScope();\n /*\n * Bound under the ENGINE's token, not a companion one.\n *\n * `PersistenceAdapter.INTROSPECTION`'s repository resolves this port lazily from the container\n * (`SAAS_SERVICE_TYPES.IntrospectionResourceSource`) and refuses cleanly when nothing is bound —\n * which is the normal state for any application running without a companion. Binding it here is\n * what makes introspected resources readable at all, and it is the same shape\n * `platform-apps-manager` uses to supply `SAAS_SERVICE_TYPES.StorageCredentialResolver`.\n */\n this.container.bind(COMPANION_SERVICE_TYPES.CreationPlaneProjectionService).to(CreationPlaneProjectionCompanionService).inSingletonScope();\n this.container.bind(SAAS_SERVICE_TYPES.IntrospectionResourceSource).to(IntrospectionResourceSourceCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TranslationPlacementService).to(TranslationPlacementCompanionService).inSingletonScope();\n this.container.bind(COMPANION_SERVICE_TYPES.TraceabilityService).to(CompanionTraceabilityService).inSingletonScope();\n // Engine agent-call traceability: bind the companion filesystem sink + a\n // policy bridged from the companion's level onto the engine SAAS symbols\n // that `AgentsBackendService` `@optional()`-injects. This is what makes\n // every `invokeAgent` call (companion services, market generation, future\n // backend/minion/worker callers) emit into the companion's session/step tree.\n // The companion always adds its filesystem sink (dev artifacts), composed ON\n // TOP of whatever the engine container bound for `AgentCallTraceSink`: when a\n // PostHog LLM-observability provider is configured the engine binds it (and\n // owns its lazy client + flush), so the companion just fans out\n // \"filesystem + <engine sink>\" with no re-construction. A NoOp engine sink\n // collapses to filesystem-only. Switchable: swapping the LLM-obs provider is an\n // engine-side re-bind, transparent here. Gating: the policy `rebind` below\n // COMPOSES the companion's level with the engine's live LLM-obs level (max);\n // each sink then self-gates.\n // NB: the engine PostHog sink lazy-loads `posthog-node` — an optional peer that\n // must be installed in any runtime that binds LLM_OBSERVABILITY (this companion\n // installs it for dev verification; the missing-package path is a graceful no-op).\n // The playbook lane's spend meter (#1507), installed where the trace sink is composed and for the\n // same reason: both must be in place before anything resolves `AgentsBackendService`. It decorates\n // the engine's provider-call recorder — the one seam every physical model call passes, ungated.\n this.container.bind(COMPANION_SERVICE_TYPES.PlaybookSpendMeter).to(PlaybookSpendMeterCompanionService).inSingletonScope();\n installPlaybookSpendMeter(this.container, this.container.get<PlaybookSpendMeterCompanionService>(COMPANION_SERVICE_TYPES.PlaybookSpendMeter));\n const companionTraceSink = new CompanionAgentCallTraceSink(this.container.get<CompanionTraceabilityService>(COMPANION_SERVICE_TYPES.TraceabilityService));\n const engineAgentTraceSink = this.container.get<AgentCallTraceSink>(SAAS_SERVICE_TYPES.AgentCallTraceSink);\n this.container.rebind(SAAS_SERVICE_TYPES.AgentCallTraceSink).toConstantValue(new CompositeAgentCallTraceSink([companionTraceSink, engineAgentTraceSink]));\n // COMPOSE the policy, never override it: the engine binds a LIVE policy\n // (`DEBUG` iff an LLM-observability provider is selected + configured, else\n // `NONE`) and the previous static rebind here REPLACED it with the\n // companion's filesystem-tracing level alone — with\n // `WILDO_DEV_COMPANION_TRACEABILITY_LEVEL` unset that froze the level at\n // `NONE`, so `emitAgentCallTrace` skipped BEFORE any sink and PostHog\n // capture (plus even its missing-secret warning) went silently dead. The\n // effective level is the MAX of the two concerns; each sink still\n // self-gates (the filesystem sink skips un-correlated calls and applies the\n // session's own level), so raising the policy for LLM-obs does NOT switch\n // on filesystem artifacts.\n const engineAgentTracePolicy = this.container.get<AgentTraceabilityPolicy>(SAAS_SERVICE_TYPES.AgentTraceabilityPolicy);\n const companionAgentTraceLevel = AGENT_TRACE_LEVEL_BY_COMPANION_LEVEL[runtimeConfig?.traceabilityLevel ?? CompanionTraceabilityLevel.NONE];\n this.container.rebind(SAAS_SERVICE_TYPES.AgentTraceabilityPolicy).toConstantValue({\n get level(): AgentTraceabilityLevel {\n return maxAgentTraceabilityLevel(companionAgentTraceLevel, engineAgentTracePolicy.level);\n },\n } satisfies AgentTraceabilityPolicy);\n }\n\n public getContainer(): InversifyContainer {\n return this.container;\n }\n}\n\nexport function setupCompanionInjection(\n existing?: InversifyContainer,\n companionContext?: CompanionContext,\n runtimeConfig?: CompanionRuntimeConfig,\n): InversifyContainer {\n if (!globalContainer) {\n const companionContainer = new CompanionContainer(existing, companionContext, runtimeConfig);\n globalContainer = companionContainer.getContainer();\n }\n return globalContainer;\n}\n\nexport function getCompanionContainer(): InversifyContainer {\n if (!globalContainer) return setupCompanionInjection();\n return globalContainer;\n}\n\nexport function resetCompanionContainer(): void {\n globalContainer = null;\n}\n\n"]}
|
|
@@ -23,6 +23,10 @@ export declare const COMPANION_SERVICE_TYPES: {
|
|
|
23
23
|
readonly BuildPlanAuthoringService: symbol;
|
|
24
24
|
/** Which paths each CODING run changed, attributed and hashed — what `accept` commits (#1454, Step 7). */
|
|
25
25
|
readonly CodingRunWriteRegisterService: symbol;
|
|
26
|
+
/** The creation run's interventions, derived from the registers, git and the run rows; keeps restarts and stated reasons (#2231). */
|
|
27
|
+
readonly CreationInterventionLedgerService: symbol;
|
|
28
|
+
/** The creation run report: interventions per lane, spend per run, the independence score (#2231). */
|
|
29
|
+
readonly CreationRunReportService: symbol;
|
|
26
30
|
/** Acceptance as a commit: the companion's one WRITE-shaped git carve-out, pathspec-bounded to a run's register (#1454, Step 7). */
|
|
27
31
|
readonly AcceptedChangeCommitService: symbol;
|
|
28
32
|
/** In-process creation-plane projections (playbook eligibility, build-plan board, write records, traces) + the eligibility cache. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../../../../../../src/core/inject/models/service-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,uBAAuB;;IAElC,8FAA8F;;;IAG9F,mFAAmF;;;IAGnF,qFAAqF;;;;IAIrF,8DAA8D;;IAE9D,kGAAkG;;IAElG,qGAAqG;;IAErG,8EAA8E;;IAE9E,0GAA0G;;IAE1G,oIAAoI;;IAEpI,qIAAqI;;;;;;;;IAYrI,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwG/E,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"service-types.d.ts","sourceRoot":"","sources":["../../../../../../src/core/inject/models/service-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,uBAAuB;;IAElC,8FAA8F;;;IAG9F,mFAAmF;;;IAGnF,qFAAqF;;;;IAIrF,8DAA8D;;IAE9D,kGAAkG;;IAElG,qGAAqG;;IAErG,8EAA8E;;IAE9E,0GAA0G;;IAE1G,qIAAqI;;IAErI,sGAAsG;;IAEtG,oIAAoI;;IAEpI,qIAAqI;;;;;;;;IAYrI,uFAAuF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwG/E,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -23,6 +23,10 @@ export const COMPANION_SERVICE_TYPES = {
|
|
|
23
23
|
BuildPlanAuthoringService: Symbol.for("Companion.BuildPlanAuthoringService"),
|
|
24
24
|
/** Which paths each CODING run changed, attributed and hashed — what `accept` commits (#1454, Step 7). */
|
|
25
25
|
CodingRunWriteRegisterService: Symbol.for("Companion.CodingRunWriteRegisterService"),
|
|
26
|
+
/** The creation run's interventions, derived from the registers, git and the run rows; keeps restarts and stated reasons (#2231). */
|
|
27
|
+
CreationInterventionLedgerService: Symbol.for("Companion.CreationInterventionLedgerService"),
|
|
28
|
+
/** The creation run report: interventions per lane, spend per run, the independence score (#2231). */
|
|
29
|
+
CreationRunReportService: Symbol.for("Companion.CreationRunReportService"),
|
|
26
30
|
/** Acceptance as a commit: the companion's one WRITE-shaped git carve-out, pathspec-bounded to a run's register (#1454, Step 7). */
|
|
27
31
|
AcceptedChangeCommitService: Symbol.for("Companion.AcceptedChangeCommitService"),
|
|
28
32
|
/** In-process creation-plane projections (playbook eligibility, build-plan board, write records, traces) + the eligibility cache. */
|