@wildo-ai/dev-companion 1.1.12 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +21 -0
- 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 +37 -4
- 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.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +9 -2
- 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 +66 -0
- 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 +191 -13
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +6 -2
- package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/git-change-set.companion.service.js +16 -39
- package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
- package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js +31 -2
- package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.d.ts +2 -0
- package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.js +8 -0
- package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +13 -0
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +39 -13
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts +17 -0
- package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts.map +1 -0
- package/dist/esm/companion-api/controllers/long-held-request.companion.js +33 -0
- package/dist/esm/companion-api/controllers/long-held-request.companion.js.map +1 -0
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts +9 -0
- 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 +19 -0
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.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 +7 -1
- 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 +5 -1
- package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/launch-blockers.companion.js +37 -4
- package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +14 -0
- 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 +48 -0
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts +128 -0
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js +180 -0
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +8 -20
- 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 +37 -142
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts +9 -0
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js +25 -3
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js.map +1 -1
- package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
- package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
- package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
- package/dist/esm/core/runtime/restart-drain.companion.d.ts +107 -0
- package/dist/esm/core/runtime/restart-drain.companion.d.ts.map +1 -0
- package/dist/esm/core/runtime/restart-drain.companion.js +237 -0
- package/dist/esm/core/runtime/restart-drain.companion.js.map +1 -0
- 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 +3 -2
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
- package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
- package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
- package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
- package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
- package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
- package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
- package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +18 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +34 -8
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
- package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
- package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +40 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +13 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +40 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +40 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.en.d.ts +5 -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 +6 -0
- package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +175 -170
- package/dist/esm/i18n/system_enums/application-creation.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.fr.js +175 -170
- package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
- package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
- package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
- package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
- package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -0
- package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -0
- package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
- package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
- package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
- package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
- package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
- package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
- package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +5 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +5 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +12 -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 +9 -0
- package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +200 -20
- 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 +1107 -230
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +158 -16
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +381 -46
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +58 -0
- 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 +116 -2
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
- package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
- package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +12 -0
- 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 +31 -7
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +2 -2
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +10 -8
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
- 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 +6 -3
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
- package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +68 -3
- 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 +281 -69
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/package.json +18 -18
package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-introspection.companion.service.js","sourceRoot":"","sources":["../../../../../src/core/introspection/services/companion-introspection.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAElG,OAAO,EAAE,6CAA6C,EAAE,MAAM,+DAA+D,CAAC;AAC9H,OAAO,EACL,4CAA4C,GAG7C,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AACxH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAahF,OAAO,EAAE,0CAA0C,EAAE,iCAAiC,EAAE,MAAM,0CAA0C,CAAC;AACzI,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC;;;;;;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AQ,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7D,IAAI,QAAQ,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,kGAAkG;AAClG,SAAS,iCAAiC,CAAC,MAAmF;IAC5H,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7D,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gCAAgC,CAC9C,aAA0H,EAC1H,qBAA8B;IAE9B,OAAO;QACL,2BAA2B;QAC3B,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,UAAU;QACV,aAAa,CAAC,qBAAqB;QACnC,+GAA+G;QAC/G,kEAAkE;QAClE,GAAG,CAAC,aAAa,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACrG,aAAa,CAAC,UAAU;KACzB,CAAC;AACJ,CAAC","sourcesContent":["import { spawn } from 'node:child_process';\nimport { join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { inject, injectable } from 'inversify';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { AppFrontendType } from '@wildo-ai/saas-models';\nimport { AppLibraryType, resolvePackageCompanionEntryPath } from '@wildo-ai/platform-config-lib';\nimport { CompanionIntrospectionResultSchema } from '../../../companion-api/companion-api.schemas';\nimport type { CompanionContext } from '../../context/companion-context';\nimport { CompanionIntrospectionBehaviorRegistryService } from './companion-introspection-behavior-registry.companion.service';\nimport {\n IntrospectionDerivationStateCompanionService,\n type IntrospectionCompileAffinity,\n type IntrospectionDerivationReadOptions,\n} from './introspection-derivation-state.companion.service';\nimport { IntrospectionWorkerPool } from './introspection-worker-pool.companion';\nimport { IntrospectionCompileQueue } from './introspection-compile-queue.companion';\nimport { attachIntrospectionReadSet, IntrospectionReadSetChecker } from './introspection-derivation-read-set.companion';\nimport { READ_TRACKING_ROOT_ENV } from '../subprocess/derivation-read-tracking';\nimport type {\n CompanionIntrospectionChildRequest,\n CompanionIntrospectionErrorDetails,\n CompanionIntrospectionFailureResult,\n CompanionIntrospectionHomesSnapshot,\n CompanionIntrospectionRequest,\n CompanionIntrospectionResolvedPackageTarget,\n CompanionIntrospectionResolvedTarget,\n CompanionIntrospectionResult,\n CompanionIntrospectionRouteTargetId,\n CompanionIntrospectionServiceKind,\n} from '../models/companion-introspection.models';\nimport { INTROSPECTION_PARENT_TERMINATED_ERROR_NAME, IntrospectionInputValidationError } from '../models/companion-introspection.models';\nimport { COMPANION_SERVICE_TYPES } from '../../inject/models/service-types';\n\nconst DEFAULT_MAX_CONCURRENCY = 4;\n\n/**\n * How long one introspection subprocess may run before it is killed and reported as a timeout.\n *\n * ## This bounds a HANG. It is not a latency budget.\n *\n * A child that answers slowly is still answering; the only thing this ceiling exists to catch is a\n * child that will never answer. So it must sit comfortably ABOVE the most expensive legitimate read,\n * and the cost of setting it too low is far worse than the cost of setting it too high: an\n * over-tight ceiling does not slow a playbook down, it makes the playbook permanently unable to run.\n *\n * ## Measured 2026-09-09 on `examples/wonder-todos`, and why 30s had to go\n *\n * It was `30_000` — an unjustified round number — and every `specifications`-target behavior a\n * `workspace_truth` playbook assembles EXCEEDED it, deterministically. Timing the child directly,\n * with nothing but the dev stack competing:\n *\n * | behavior | target | measured |\n * |---|---|---|\n * | `expert-persona-charters` | specifications | 11.5s |\n * | `expert-persona-derivation-inputs` | specifications | 13.5s |\n * | `specification-artifacts` | specifications | **30.6s** |\n * | `application-domain-model` | specifications | **35.3s** |\n *\n * The consequence was not an intermittent flake. `bottom_up.placement-plan` — and anything else\n * declaring `contextSources: ['workspace_truth']` — watched every one of its context reads fail at\n * exactly 30s intervals (`specification-artifacts`, `family-aspects`, `frontend-labels-needed-info`,\n * `openapi-generation-input`, …), assembled an empty brief, and could not complete. It read as a\n * `500 INTERNAL / critical`, which sends a reader looking for a bug in the behavior rather than at\n * the clock.\n *\n * ## Why 120s\n *\n * ~3.4x headroom over the worst measurement, because a developer machine mid-compile-storm is\n * materially slower than one that is idle, and this is the machine every one of these reads runs on.\n * A genuinely hung child is still detected and still reported — two minutes later instead of thirty\n * seconds, which nobody is waiting on interactively.\n *\n * Re-measure before lowering this: the cost is dominated by importing a real application's compiled\n * `specifications` package and the engine graph behind it, so it grows with the application. A\n * deployment that wants a tighter bound sets `COMPANION_INTROSPECTION_TIMEOUT_MS`.\n */\nconst DEFAULT_TIMEOUT_MS = 120_000;\n\n/**\n * How long a pooled introspection worker may sit idle before it exits (#3208).\n *\n * Long enough to carry one recompile pass into the next read at the same source state, short enough\n * that a quiet companion holds no ~1 GB children: a worker is only reusable until the tree moves, and in\n * a build wave it moves every few minutes.\n */\nconst POOLED_WORKER_IDLE_MS = 60_000;\n\n/** A derivation that waited and ran for at least this long is logged with its timing (#3452). */\nconst INTROSPECTION_TIMING_LOG_THRESHOLD_MS = 1_000;\n\n/**\n * Every worker pool this process created, so all their workers can be retired at once: by a suite that builds\n * many services in one process (each idle worker holds a whole imported application for\n * {@link POOLED_WORKER_IDLE_MS}), and by anything else that must not leave children behind.\n */\nconst liveWorkerPools = new Set<IntrospectionWorkerPool>();\n\n/** Retire the workers of every pool in this process. See {@link liveWorkerPools}. */\nexport function shutdownAllIntrospectionWorkers(): void {\n for (const pool of liveWorkerPools) pool.shutdown();\n}\n\n/** File extensions whose presence among a derivation's entries means the child needs a TypeScript loader. */\nconst TYPESCRIPT_ENTRY_PATTERN = /\\.(?:ts|tsx|mts|cts)$/u;\n\n/**\n * Whether an introspection child must preload `tsx` (#3208).\n *\n * Only when something it will import natively is TypeScript: the runner itself (the suite runs the\n * companion from source), or a target whose built entry is missing so resolution fell back to authored\n * source. A child running the compiled companion against built packages needs no loader at all, and\n * `tsx` registers its hooks OFF-THREAD (`module.register`), which made every import in the child a\n * synchronous round trip to a loader thread: measured on app-creation-test-007, importing the handler\n * graph cost 15.6 s of user CPU and 1.2 GB with `tsx` against 8.7 s and 0.7 GB without. Specifications\n * source does not count — the child evaluates it through jiti, which transpiles by itself.\n */\nexport function introspectionChildNeedsTypeScriptLoader(input: {\n readonly runnerPath: string;\n readonly entryPaths: readonly string[];\n}): boolean {\n return [input.runnerPath, ...input.entryPaths].some((path) => TYPESCRIPT_ENTRY_PATTERN.test(path));\n}\n\n/**\n * The signals that mean SOMEONE ELSE stopped this process tree.\n *\n * Read only in the exit branch that has already established this service sent no kill of its own, so\n * membership here is what separates \"the companion is going down\" from \"the derivation failed\".\n * `SIGKILL` is deliberately absent: it is what this service's own force-kill escalation sends, and a\n * child that reaches it has already been through `requestTermination`.\n */\nconst EXTERNAL_TERMINATION_SIGNALS = new Set<string>(['SIGTERM', 'SIGINT', 'SIGHUP']);\n\n/**\n * The failure recorded when a child returns a valid result and is still running a second later. Named\n * once because `runSubprocess` must tell it apart from every other termination reason: it is the only\n * one a clean `close` can overrule (#2396).\n */\nconst LATE_EXIT_FAILURE_NAME = 'CompanionIntrospectionResultExitTimeoutError';\n\n/**\n * Whether a dead introspection child was killed by SOMEONE OTHER than this service.\n *\n * Exported because it is the whole decision — the call site is one branch — and because it is the\n * part worth pinning: the plumbing around it needs a real subprocess and a real signal, while the\n * reasoning is three booleans.\n *\n * The inference rests on an invariant of this file: every termination this service performs goes\n * through `requestTermination`, which sets a pending failure BEFORE killing, and the exit handler\n * returns that failure without consulting this. So a termination signal arriving with no pending\n * failure and no parsed result means nobody here asked — the child died because its PARENT did,\n * taking the process group with it. If a future kill path forgets to set the pending failure first,\n * this starts misreporting a local kill as an external one, which is why the invariant is stated\n * here rather than left implicit at the call site.\n */\nexport function wasTerminatedFromOutside(input: {\n readonly signal: string | null;\n readonly hasPendingFailure: boolean;\n readonly hasParsedResult: boolean;\n}): boolean {\n if (input.hasPendingFailure || input.hasParsedResult) return false;\n return input.signal !== null && EXTERNAL_TERMINATION_SIGNALS.has(input.signal);\n}\n\n/**\n * Env value that turns the derivation cache off entirely.\n *\n * Read once at construction. A door rather than a design: if the cache is ever suspected of serving\n * a stale answer, an operator can settle the question in one restart instead of reasoning about the\n * invalidation, and the diagnosis stays about the application rather than about this file. The\n * default is ON — the whole point is that the workbench stops paying a cold transpile per request.\n */\nconst DISABLE_DERIVATION_CACHE_VALUE = 'off';\n\n/**\n * Env-var namespaces stripped from the spawned introspection child's\n * environment so pre-bootstrap reads surface `undefined` instead of inheriting\n * stale values from the parent shell.\n *\n * The trusted homes snapshot is delivered through the IPC handshake and\n * reapplied by `applyTrustedHomesToChildProcess()` as the first action of\n * `handleChildProcessMessage()`. Any code that happens to read these env\n * vars during the narrow window BEFORE that handler runs (for example while\n * `reflect-metadata` is loading) would otherwise see whatever the parent\n * shell had set — including stale values from a previous companion run or\n * from the operator's shell — which would reintroduce the Phase 5\n * \"env-over-context\" class of regression at the subprocess boundary.\n *\n * `WILDO_COMPANION_INTROSPECTION_CHILD` is the intentional child-mode flag\n * and is re-injected fresh for every spawn.\n */\nexport const SCRUBBED_CHILD_ENV_NAMES = [\n 'COMPANION_WORKSPACE_ROOT',\n 'COMPANION_RUNTIME_HOME',\n 'COMPANION_PACKAGE_ROOT',\n 'COMPANION_FRAMEWORK_ROOT',\n 'WILDO_COMPANION_INTROSPECTION_CHILD',\n READ_TRACKING_ROOT_ENV,\n] as const;\n\n/**\n * Render an arbitrary behavior `input` so that two structurally equal inputs produce one key.\n *\n * `JSON.stringify` alone would not: `{a:1,b:2}` and `{b:2,a:1}` are the same question and would\n * occupy two cache entries, so the second phrasing of a question would always miss. Object keys are\n * therefore sorted at every depth. Arrays keep their order, because in an input an array's order is\n * part of the question.\n *\n * A value that cannot be rendered — a cycle, a `BigInt` — yields `null`, which the caller reads as\n * \"this question is not cacheable\" rather than as an error. Nothing in the current behavior surface\n * sends such an input; treating it as uncacheable rather than throwing keeps a future one working.\n */\nexport function renderStableCacheableInput(input: unknown): string | null {\n const seen = new WeakSet<object>();\n\n const render = (value: unknown): string => {\n if (value === undefined) return 'undefined';\n if (value === null) return 'null';\n if (typeof value === 'bigint') throw new Error('BigInt is not renderable.');\n if (typeof value !== 'object') return JSON.stringify(value) ?? 'undefined';\n if (seen.has(value as object)) throw new Error('Cyclic input is not renderable.');\n seen.add(value as object);\n if (Array.isArray(value)) {\n return `[${value.map(render).join(',')}]`;\n }\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, entryValue]) => entryValue !== undefined)\n .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));\n return `{${entries.map(([key, entryValue]) => `${JSON.stringify(key)}:${render(entryValue)}`).join(',')}}`;\n };\n\n try {\n return render(input);\n } catch {\n return null;\n }\n}\n\n/**\n * The identity of a derivation on the REQUEST side.\n *\n * Everything the child is given that can change its answer: which service, which behavior, which\n * target it routes to, and the behavior input. `entryPath` and `packageRoot` are included because a\n * package whose built `./companion` export appears or disappears changes which bytes are imported\n * without changing the behavior id — and `resolvePackageCompanionEntryPath` prefers `dist` when it\n * exists and falls back to source when it does not.\n *\n * Returns `null` for an input that cannot be stably rendered, which the caller reads as\n * \"derive, do not remember\".\n */\n/** Whether a request carries an input a caller chose, as against the behavior's default question (#3452). */\nfunction hasDerivationInput(input: unknown): boolean {\n if (input === undefined || input === null) return false;\n if (typeof input === 'object') return Object.keys(input as Record<string, unknown>).length > 0;\n return true;\n}\n\nfunction buildDerivationCacheKey(target: CompanionIntrospectionResolvedTarget): string | null {\n const renderedInput = renderStableCacheableInput(target.input);\n if (renderedInput === null) return null;\n\n return [\n target.serviceKey,\n target.serviceKind,\n target.behavior,\n target.targetId,\n target.packageRoot,\n target.entryPath,\n renderedInput,\n ].join('\\u0001');\n}\n\n/**\n * Build the `env` object handed to the spawned introspection child process.\n *\n * Responsibilities:\n *\n * 1. Inherit the caller's `process.env` as a base, so the child still sees\n * normal environment (`PATH`, `NODE_OPTIONS`, node-debug flags, etc.).\n * 2. Scrub every `COMPANION_*` bootstrap seed that\n * `applyTrustedHomesToChildProcess()` owns on the child side. Leaving\n * them in place would let `reflect-metadata` (or anything else imported\n * before the first IPC message arrives) read a stale value from the\n * parent shell — the exact Phase 5 \"env-over-context\" regression class\n * this slice was introduced to close.\n * 3. Drop any pre-existing `WILDO_COMPANION_INTROSPECTION_CHILD` so it\n * cannot survive from a parent that was itself a child in a nested\n * spawn, then re-inject it as the exact string `'1'`. The child's\n * `shouldRegisterChildMessageHandler()` gate only accepts `'1'`, so\n * this is also the enforcement point that keeps the flag's contract\n * single-sourced here.\n *\n * Exported purely for unit testing; production code reaches it through\n * `this.runSubprocess(...)` in `CompanionIntrospectionService`.\n */\nexport function buildSubprocessEnv(): NodeJS.ProcessEnv {\n const scrubbed: NodeJS.ProcessEnv = { ...process.env };\n for (const key of SCRUBBED_CHILD_ENV_NAMES) {\n delete scrubbed[key];\n }\n scrubbed.WILDO_COMPANION_INTROSPECTION_CHILD = '1';\n return scrubbed;\n}\n\n@injectable()\nexport class CompanionIntrospectionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private readonly maxConcurrency: number;\n private readonly timeoutMs: number;\n /** Whether what an idle worker loaded still reads as it did, for keeping it across a moved tree (#3452). */\n private readonly workerReuseChecker = new IntrospectionReadSetChecker();\n /** The concurrency bound, with live compiles served before background ones (#3452). */\n private readonly compileQueue: IntrospectionCompileQueue;\n /** Test seam only; production always retains Node's real child-process spawn. */\n private spawnSubprocess: typeof spawn = spawn;\n /**\n * Whether compiled state may be retained at all.\n *\n * `COMPANION_INTROSPECTION_CACHE=off` still means what it always meant — every read compiles, and\n * no state is consulted or written. The flag is read here rather than inside the state service\n * because this is the door every consumer already comes through, so switching it off cannot be\n * bypassed by a caller that reaches the state service directly.\n */\n private readonly derivationCacheEnabled: boolean;\n /** Pooled workers per TypeScript-loader need (see {@link introspectionChildNeedsTypeScriptLoader}); created on first use. */\n private readonly workerPools = new Map<boolean, IntrospectionWorkerPool>();\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.IntrospectionBehaviorRegistryService)\n private readonly behaviorRegistryService: CompanionIntrospectionBehaviorRegistryService,\n @inject(COMPANION_SERVICE_TYPES.IntrospectionDerivationStateService)\n private readonly derivationState: IntrospectionDerivationStateCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('CompanionIntrospectionService');\n this.logger.setDebugTypeLogging('CompanionIntrospectionService', true);\n this.maxConcurrency = Math.max(\n 1,\n Number.parseInt(process.env.COMPANION_INTROSPECTION_MAX_CONCURRENCY ?? '', 10)\n || DEFAULT_MAX_CONCURRENCY,\n );\n this.compileQueue = new IntrospectionCompileQueue(this.maxConcurrency);\n this.timeoutMs = Math.max(\n 1_000,\n Number.parseInt(process.env.COMPANION_INTROSPECTION_TIMEOUT_MS ?? '', 10)\n || DEFAULT_TIMEOUT_MS,\n );\n this.derivationCacheEnabled = (process.env.COMPANION_INTROSPECTION_CACHE ?? '').trim().toLowerCase()\n !== DISABLE_DERIVATION_CACHE_VALUE;\n }\n\n /**\n * Answer an introspection request, re-deriving only when the application's source has moved.\n *\n * ## The three tiers, in order\n *\n * 1. **Cache hit** — a previous derivation of this exact question, taken against a source tree\n * whose observation token still matches. No subprocess, no import, no registry materialization.\n * 2. **In-flight join** — the identical question is already being derived against the identical\n * token. The caller waits on that one rather than spawning a second child.\n * 3. **Derive** — spawn, under the existing concurrency queue.\n *\n * ## What is cached, and what deliberately is not\n *\n * Only SUCCESS. A failure is not memoized, for two separate reasons and either is sufficient: the\n * common failure here is an application whose `dist` is not built, whose remedy moves the source\n * and would invalidate anyway; and a transient failure — a timeout on a loaded machine — would\n * otherwise stick to an unchanged tree and be served as the answer forever. In-flight JOINING\n * still covers failures, because two concurrent identical questions should cost one subprocess\n * whatever the outcome.\n *\n * ## Where the source reading happens\n *\n * Outside the concurrency queue. The observation is ~125 ms of filesystem work with no subprocess\n * behind it; holding one of the four queue slots for it would make a cache HIT contend with real\n * derivations, which is the opposite of the point.\n */\n /**\n * The introspection MENU — what this running companion can answer, for a caller that has to choose.\n *\n * Serves `wildo context list` (issue #252): the door's tier-1 progressive-disclosure catalog. It is a\n * COMPANION answer rather than a CLI-side copy of the behavior definitions on purpose — the CLI and a\n * running companion can be different builds, and a menu describing behaviors the serving side does not\n * have is the staleness class `.claude/rules/staleness-presents-as-a-logic-defect.md` records. Runtime\n * truth, one hop.\n *\n * `defaultBackendServiceKey` is here for the same one-authority reason: `POST /_meta/introspect`\n * REQUIRES a `serviceKey`, and the \"first backend service\" default already exists in the playbook\n * composer (`composeWorkspaceTruthSection`). Publishing the resolved default lets a CLI caller pass it\n * explicitly instead of re-deriving the rule, so the POST contract stays strict and the rule stays in\n * companion code.\n */\n public describeCatalog(): {\n readonly behaviors: ReadonlyArray<{\n readonly behaviorId: string;\n readonly description: string;\n readonly category: string;\n readonly supportedServiceKinds: readonly CompanionIntrospectionServiceKind[];\n readonly inputSummary?: string;\n }>;\n readonly serviceKeys: ReadonlyArray<{\n readonly key: string;\n readonly kind: CompanionIntrospectionServiceKind;\n /**\n * The frontend's KIND OF FRONTEND (`AppFrontendType`), for a frontend service only.\n *\n * `kind` collapses `saas-app`, `static-website` and `tech-doc` into one word, which is right\n * for ROUTING a behavior (all three are introspected the same way) and useless for CHOOSING\n * between them. An application commonly declares all three, so a caller asking a shell\n * behavior of \"the frontend\" has three answers and no way to tell which one has a shell.\n * Published so the choice is a lookup rather than a guess.\n */\n readonly frontendType?: string;\n }>;\n readonly defaultBackendServiceKey: string | null;\n /**\n * The SaaS application's own frontend — the twin of `defaultBackendServiceKey`, and the answer\n * to \"which frontend did you mean\" for every behavior that reads the application shell.\n *\n * Derived from `frontendType === 'saas-app'` rather than from declaration ORDER: order would be\n * a guess that happens to be right in the applications checked, and wrong for one that declares\n * its marketing site first. `null` when the application declares no SaaS frontend, which is a\n * real shape — a docs-only or website-only package.\n */\n readonly defaultFrontendServiceKey: string | null;\n } {\n const behaviors = this.behaviorRegistryService.listBehaviorDefinitions().map((definition) => ({\n behaviorId: definition.behaviorId,\n description: definition.description,\n category: definition.category,\n supportedServiceKinds: definition.supportedServiceKinds,\n ...(definition.inputSummary !== undefined ? { inputSummary: definition.inputSummary } : {}),\n }));\n const serviceKeys = Object.entries(this.companionContext.servicesByKey).map(([key, service]) => ({\n key,\n kind: this.resolveServiceKind(service),\n ...(service.frontendType !== undefined ? { frontendType: String(service.frontendType) } : {}),\n }));\n const defaultBackendServiceKey = serviceKeys.find((service) => service.kind === 'backend')?.key ?? null;\n const defaultFrontendServiceKey = serviceKeys.find(\n (service) => service.frontendType === AppFrontendType.SAAS_APP,\n )?.key ?? null;\n return { behaviors, serviceKeys, defaultBackendServiceKey, defaultFrontendServiceKey };\n }\n\n /**\n * `options.verifyAgainstSource` (#2364): for a caller about to act on what the answer says is absent\n * — a refusal, or a write derived from it — a held answer is checked against the source as it stands\n * now rather than trusted since the last reported move. See {@link IntrospectionDerivationReadOptions}.\n * With the cache off, or an uncacheable input, every answer is derived fresh, which already satisfies it.\n */\n public async requestInfo(\n request: CompanionIntrospectionRequest,\n options: IntrospectionDerivationReadOptions = {},\n ): Promise<CompanionIntrospectionResult> {\n const resolvedTarget = await this.resolveTarget(request);\n\n if (!this.derivationCacheEnabled) {\n return this.deriveThroughQueue(resolvedTarget);\n }\n\n const cacheKey = buildDerivationCacheKey(resolvedTarget);\n if (cacheKey === null) {\n return this.deriveThroughQueue(resolvedTarget);\n }\n\n return this.derivationState.read(\n {\n cacheKey,\n behavior: resolvedTarget.behavior,\n serviceKey: resolvedTarget.serviceKey,\n // Every package the child is handed, not only the declared route: several behaviors read a target\n // they never declared. The state service closes this over the packages' own dependencies (#2245).\n inputPackageRoots: resolveDerivationTargetPackageRoots(resolvedTarget),\n // A question with an input is forgotten once nobody asks it (#3452).\n ...(hasDerivationInput(resolvedTarget.input) ? { parameterised: true } : {}),\n },\n (affinity) => this.deriveThroughQueue(resolvedTarget, affinity),\n options,\n );\n }\n\n /**\n * Compile a derivation without consulting or writing compiled state.\n *\n * The COMPILE primitive, exposed so the state service can drive a recompilation that no read\n * asked for. It is the same path a cache miss took before, minus the memo: the concurrency queue,\n * the subprocess, the IPC result. Nothing here decides freshness, which is the separation this\n * whole change exists to make — a caller that wants the current answer asks the state service, and\n * a caller that wants a NEW answer asks this.\n */\n public async compileNow(\n request: CompanionIntrospectionRequest,\n ): Promise<CompanionIntrospectionResult> {\n return this.deriveThroughQueue(await this.resolveTarget(request));\n }\n\n /**\n * The cache key a request resolves to, for a caller that needs to talk about a derivation's\n * identity — to warm it, to stamp a notification with its generation — without running it.\n *\n * `null` means the request's input cannot be stably rendered, which every caller reads as\n * \"compile, do not remember\".\n */\n public async resolveDerivationIdentity(request: CompanionIntrospectionRequest): Promise<{\n readonly cacheKey: string;\n readonly behavior: string;\n readonly serviceKey: string;\n } | null> {\n const resolvedTarget = await this.resolveTarget(request);\n const cacheKey = buildDerivationCacheKey(resolvedTarget);\n if (cacheKey === null) return null;\n return { cacheKey, behavior: resolvedTarget.behavior, serviceKey: resolvedTarget.serviceKey };\n }\n\n /**\n * Drop every compiled derivation.\n *\n * Costs a recompilation and changes no answer — the property that makes this state per-run runtime\n * state rather than a second source of truth. Kept on this service because it is the door every\n * consumer already holds; the state itself lives one layer down.\n */\n public clearDerivationCache(): void {\n this.derivationState.clear();\n }\n\n /** Retire every pooled introspection worker. Idempotent; a worker also exits when this process dies. */\n public shutdownWorkers(): void {\n for (const pool of this.workerPools.values()) pool.shutdown();\n }\n\n /** Live pooled workers. A diagnostic for tests and profiling runs. */\n public get liveWorkerCount(): number {\n let count = 0;\n for (const pool of this.workerPools.values()) count += pool.liveWorkerCount;\n return count;\n }\n\n private async deriveThroughQueue(\n resolvedTarget: CompanionIntrospectionResolvedTarget,\n affinity?: IntrospectionCompileAffinity,\n ): Promise<CompanionIntrospectionResult> {\n const queuedAt = Date.now();\n let background = affinity?.background === true;\n return this.compileQueue.run(async () => {\n const startedAt = Date.now();\n this.logDebug('Executing companion introspection request', {\n serviceKey: resolvedTarget.serviceKey,\n behavior: resolvedTarget.behavior,\n targetId: resolvedTarget.targetId,\n entryPath: resolvedTarget.entryPath,\n pooled: affinity !== undefined,\n });\n\n const result = await (affinity === undefined ? this.runSubprocess(resolvedTarget) : this.runPooled(resolvedTarget, affinity));\n /*\n * Visible without enabling a debug type (#3452): where a derivation's time went, waiting for a slot or running.\n * The reference runs could not say, and the event-loop stalls were attributed by elimination. Only a compile that\n * cost something is logged, so a quiet companion stays quiet.\n */\n const waitedMs = startedAt - queuedAt;\n const ranMs = Date.now() - startedAt;\n if (waitedMs + ranMs >= INTROSPECTION_TIMING_LOG_THRESHOLD_MS) {\n this.logger.info('Introspection derivation timed', {\n behavior: resolvedTarget.behavior,\n serviceKey: resolvedTarget.serviceKey,\n lane: background ? 'background' : 'live',\n waitedMs,\n ranMs,\n success: result.success,\n liveQueued: this.compileQueue.liveQueued,\n backgroundQueued: this.compileQueue.backgroundQueued,\n });\n }\n return result;\n }, {\n background,\n ...(affinity?.promotion === undefined ? {} : { promotion: affinity.promotion }),\n onPromoted: () => {\n background = false;\n },\n });\n }\n\n /**\n * Derive through a worker bound to the observed source state (#3208), see {@link IntrospectionWorkerPool}.\n *\n * A failure from a worker that had already answered another request — the behavior's own failure, or the\n * worker dying under it — is asked once more of a fresh one-shot child: sharing a process is the one thing a\n * one-shot child never did, so a behavior that leaves state behind must not be able to fail its neighbour. A\n * timeout is not retried (that would double a two-minute wait), nor the companion stopping, nor a failure of\n * a worker's first request, which no neighbour could have caused.\n */\n private async runPooled(\n target: CompanionIntrospectionResolvedTarget,\n affinity: IntrospectionCompileAffinity,\n ): Promise<CompanionIntrospectionResult> {\n const startedAt = Date.now();\n const launchContext = this.resolveSubprocessLaunchContext();\n const needsTypeScriptLoader = introspectionChildNeedsTypeScriptLoader({\n runnerPath: launchContext.runnerPath,\n entryPaths: resolveDerivationTargetEntryPaths(target),\n });\n const outcome = await this.workerPoolFor(needsTypeScriptLoader).run(affinity.sourceStateToken, this.buildChildRequest(target), {\n sharedToken: affinity.sharedToken,\n stillMatches: (entries, observationToken) => this.workerReuseChecker.stillMatches(entries, observationToken),\n });\n const output = { stdout: outcome.stdout || undefined, stderr: outcome.stderr || undefined };\n const result: CompanionIntrospectionResult = outcome.kind === 'result'\n ? { ...outcome.result, ...output }\n : { ...this.buildFailureResult(target, startedAt, outcome.error), ...output };\n if (result.success) {\n // Beside the result, never in it: the result is the API's shape (see `introspection-derivation-read-set`).\n if (outcome.kind === 'result' && outcome.readSet !== undefined) attachIntrospectionReadSet(result, outcome.readSet);\n return result;\n }\n\n // A failure of a worker's FIRST request, a timeout and the companion itself stopping are not retried: no\n // neighbour could have caused the first, a retry would double a two-minute wait, and nothing would survive\n // the third. Everything else from a worker that served before — its own failure or the worker dying — is.\n const timedOutOrStopping = !result.success\n && (result.error.name === 'CompanionIntrospectionTimeoutError' || result.error.name === INTROSPECTION_PARENT_TERMINATED_ERROR_NAME);\n if (outcome.workerServedBefore === 0 || timedOutOrStopping) return result;\n const isolated = await this.runSubprocess(target);\n if (isolated.success) {\n this.logger.warn('Introspection behavior failed in a shared worker and succeeded alone; it is not safe to share a process', {\n behavior: target.behavior,\n serviceKey: target.serviceKey,\n sharedFailure: result.error.message,\n });\n }\n return isolated;\n }\n\n private workerPoolFor(needsTypeScriptLoader: boolean): IntrospectionWorkerPool {\n const existing = this.workerPools.get(needsTypeScriptLoader);\n if (existing) return existing;\n const launchContext = this.resolveSubprocessLaunchContext();\n const pool = new IntrospectionWorkerPool({\n spawnWorker: () => this.spawnSubprocess(\n process.execPath,\n buildIntrospectionChildArguments(launchContext, needsTypeScriptLoader),\n // A pooled worker records what each derivation reads, under the application root (#3207).\n { cwd: launchContext.cwd, env: { ...buildSubprocessEnv(), [READ_TRACKING_ROOT_ENV]: this.buildChildHomesSnapshot().appDeclarationRoot }, stdio: ['ignore', 'pipe', 'pipe', 'ipc'] },\n ),\n maximumWorkers: this.maxConcurrency,\n idleMs: POOLED_WORKER_IDLE_MS,\n requestTimeoutMs: this.timeoutMs,\n log: this.logDebug,\n });\n this.workerPools.set(needsTypeScriptLoader, pool);\n liveWorkerPools.add(pool);\n return pool;\n }\n\n private async resolveTarget(\n request: CompanionIntrospectionRequest,\n ): Promise<CompanionIntrospectionResolvedTarget> {\n const serviceDefinition = this.companionContext.servicesByKey[request.serviceKey];\n if (!serviceDefinition) {\n /*\n * A caller's bad input, so it must answer 4xx CARRYING ITS MESSAGE — the same contract\n * `IntrospectionInputValidationError` was introduced for (#1459). A plain `Error` here is\n * sanitized to a bodyless 500, and the CLI's health hint then fires on a companion that is\n * demonstrably up, sending the reader to check a process instead of their own argument.\n *\n * The likeliest way to get here is passing a service NAME where the key is wanted\n * (`--service scratch-journey-app` for the service keyed `app`), which is why the valid keys\n * are named rather than merely the rejected one.\n */\n throw new IntrospectionInputValidationError(\n `Unknown SaaS service key \"${request.serviceKey}\". This application declares: `\n + `${Object.keys(this.companionContext.servicesByKey).sort().map((key) => `\"${key}\"`).join(', ')}.`,\n );\n }\n\n const serviceKind = this.resolveServiceKind(serviceDefinition);\n const resolvedBehavior = this.behaviorRegistryService.resolveBehaviorForServiceKind(\n request.behavior,\n serviceKind,\n );\n\n const resolvedTargets = this.resolveCompanionTargets(serviceDefinition);\n const missingTargets = [resolvedBehavior.route.target, ...(resolvedBehavior.route.requiredTargets ?? [])]\n .filter((targetId, index, allTargetIds) => allTargetIds.indexOf(targetId) === index)\n .filter((targetId) => !resolvedTargets[targetId]);\n if (missingTargets.length > 0) {\n // Also the caller's: they named a service that cannot serve this behavior, and the message\n // says which targets are missing — so it must survive sanitization like the key above.\n throw new IntrospectionInputValidationError(\n `Behavior \"${request.behavior}\" requires config-declared target(s) ${missingTargets.map((targetId) => `\"${targetId}\"`).join(', ')}, but they are not declared or resolvable for service \"${request.serviceKey}\".`,\n );\n }\n const behaviorTarget = resolvedTargets[resolvedBehavior.route.target]!;\n\n const servicePath = resolve(this.companionContext.saasRoot, serviceDefinition.path);\n\n return {\n serviceKey: request.serviceKey,\n servicePath,\n serviceName: serviceDefinition.serviceName,\n serviceKind,\n behavior: request.behavior,\n behaviorCategory: resolvedBehavior.category,\n materializationKind: resolvedBehavior.execution.materializationKind,\n targetId: resolvedBehavior.route.target,\n packageRoot: behaviorTarget.packageRoot,\n entryPath: behaviorTarget.entryPath,\n resolvedTargets,\n resolvedBehavior,\n input: request.input,\n };\n }\n\n private resolveServiceKind(\n serviceDefinition: CompanionContext['servicesByKey'][string],\n ): CompanionIntrospectionServiceKind {\n return serviceDefinition.frontendType ? 'frontend' : 'backend';\n }\n\n private async runSubprocess(\n target: CompanionIntrospectionResolvedTarget,\n ): Promise<CompanionIntrospectionResult> {\n const childRequest = this.buildChildRequest(target);\n const launchContext = this.resolveSubprocessLaunchContext();\n\n return new Promise<CompanionIntrospectionResult>((resolvePromise) => {\n const startedAt = Date.now();\n // A one-shot child records no reads: it answers without a source-state token, so nothing it says is retained.\n const { readTrackingPath: _notRecorded, ...oneShotLaunchContext } = launchContext;\n const child = this.spawnSubprocess(process.execPath, buildIntrospectionChildArguments(\n oneShotLaunchContext,\n introspectionChildNeedsTypeScriptLoader({ runnerPath: launchContext.runnerPath, entryPaths: resolveDerivationTargetEntryPaths(target) }),\n ), {\n cwd: launchContext.cwd,\n env: buildSubprocessEnv(),\n stdio: ['ignore', 'pipe', 'pipe', 'ipc'],\n });\n\n let stdout = '';\n let stderr = '';\n let settled = false;\n let parsedResult: CompanionIntrospectionResult | null = null;\n let pendingFailure: CompanionIntrospectionFailureResult | null = null;\n let naturalExitHandle: NodeJS.Timeout | null = null;\n /** Whether the ONLY reason termination was requested is the late-exit timer. See `onClose`. */\n let lateExitTerminationRequested = false;\n let forceKillHandle: NodeJS.Timeout | null = null;\n\n /*\n * The child's output, as TWO named fields rather than one ` | `-joined blob.\n *\n * The blob was unreadable in practice: a routine success printed one useful line of stdout\n * glued to a multi-line third-party deprecation warning, and a reader could not tell at a\n * glance whether an introspection had worked, what it had found, or whether the stderr meant\n * anything. Stdout and stderr answer different questions — what it DID versus what went WRONG —\n * and joining them makes the log answer neither.\n */\n const buildOutputContext = (): { stdout?: string; stderr?: string } | undefined => {\n const trimmedStdout = stdout.trim();\n const trimmedStderr = stderr.trim();\n if (trimmedStdout.length === 0 && trimmedStderr.length === 0) return undefined;\n return {\n ...(trimmedStdout.length > 0 ? { stdout: trimmedStdout } : {}),\n ...(trimmedStderr.length > 0 ? { stderr: trimmedStderr } : {}),\n };\n };\n\n /** One line for a message that has no room for two fields. */\n const describeOutputContext = (context: { stdout?: string; stderr?: string } | undefined): string =>\n context === undefined\n ? ''\n : [\n ...(context.stdout ? [`stdout: ${context.stdout}`] : []),\n ...(context.stderr ? [`stderr: ${context.stderr}`] : []),\n ].join(' | ');\n\n const onStdout = (chunk: Buffer | string) => {\n stdout += chunk.toString();\n };\n const onStderr = (chunk: Buffer | string) => {\n stderr += chunk.toString();\n };\n child.stdout?.on('data', onStdout);\n child.stderr?.on('data', onStderr);\n\n const clearTimer = (handle: NodeJS.Timeout | null): void => {\n if (handle !== null) clearTimeout(handle);\n };\n\n const cleanup = () => {\n clearTimeout(timeoutHandle);\n clearTimer(naturalExitHandle);\n clearTimer(forceKillHandle);\n child.off('spawn', onSpawn);\n child.off('message', onMessage);\n child.off('error', onError);\n child.off('close', onClose);\n child.stdout?.off('data', onStdout);\n child.stderr?.off('data', onStderr);\n };\n\n const finalize = (result: CompanionIntrospectionResult) => {\n if (settled) {\n return;\n }\n\n settled = true;\n cleanup();\n const finalResult = {\n ...result,\n stdout: stdout || undefined,\n stderr: stderr || undefined,\n };\n resolvePromise(finalResult);\n };\n\n const requestTermination = (failure: CompanionIntrospectionFailureResult): void => {\n if (pendingFailure === null) pendingFailure = failure;\n // Any OTHER failure after the late-exit timer (a duplicate payload, a child error) is about the\n // result itself, so a clean close must no longer rescue it.\n if (failure.error.name !== LATE_EXIT_FAILURE_NAME) lateExitTerminationRequested = false;\n clearTimeout(timeoutHandle);\n clearTimer(naturalExitHandle);\n naturalExitHandle = null;\n if (forceKillHandle !== null) return;\n try {\n child.kill('SIGTERM');\n } catch {\n // A concurrent exit can make kill throw; settlement still waits for\n // the terminal `close` event rather than guessing process state.\n }\n forceKillHandle = setTimeout(() => {\n try {\n child.kill('SIGKILL');\n } catch {\n // The terminal `close` event remains the only settlement signal.\n }\n }, 1_000);\n };\n\n const onSpawn = () => {\n child.send?.(childRequest);\n };\n\n const onMessage = (message: unknown) => {\n clearTimeout(timeoutHandle);\n if (pendingFailure !== null) {\n // A child sends exactly one message. One arriving after the late-exit timer is a second payload,\n // so the first can no longer be trusted, and a clean close must not rescue it (#2396).\n lateExitTerminationRequested = false;\n return;\n }\n if (parsedResult !== null) {\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: 'Companion introspection subprocess returned more than one result payload.',\n name: 'CompanionIntrospectionDuplicateResultError',\n }));\n return;\n }\n try {\n parsedResult = CompanionIntrospectionResultSchema.parse(message) as CompanionIntrospectionResult;\n // A valid payload is provisional until the child proves that no late\n // failure occurred. Give the normal child one bounded window to\n // disconnect and exit cleanly before beginning termination.\n naturalExitHandle = setTimeout(() => {\n lateExitTerminationRequested = true;\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: 'Companion introspection subprocess returned a result but did not exit cleanly within 1000ms.',\n name: LATE_EXIT_FAILURE_NAME,\n }));\n }, 1_000);\n } catch (error) {\n // describeCaughtError: N/A — this `try` wraps exactly one statement,\n // `CompanionIntrospectionResultSchema.parse(message)`, which throws a `ZodError`.\n // No engine service is called inside it, so a `WildoError_Backend` (a plain\n // object, which the test below would reject) cannot reach here. The site also\n // needs `.name` and `.stack`, which the string helper does not carry. Left as-is\n // deliberately, not overlooked by the 2026-08-21 sweep.\n const standardError = error instanceof Error ? error : new Error('Invalid companion introspection subprocess payload.');\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: standardError.message,\n name: standardError.name,\n stack: standardError.stack,\n }));\n }\n };\n\n const onError = (error: Error) => {\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: error.message,\n name: error.name,\n stack: error.stack,\n }));\n };\n\n const onClose = (code: number | null, signal: NodeJS.Signals | null) => {\n if (settled) return;\n const outputContext = buildOutputContext();\n if (outputContext) {\n /*\n * Named for what the reader wants to know — WHICH introspection, and whether it went\n * cleanly — rather than for the mechanism. \"exited with buffered output\" described the\n * plumbing and left the behavior buried in a field.\n */\n const cleanExit = code === 0 && signal === null;\n this.logDebug(\n `Companion introspection \"${target.behavior}\" on \"${target.serviceKey}\" ${cleanExit ? 'completed' : `exited code=${code ?? 'null'} signal=${signal ?? 'null'}`}`,\n {\n serviceKey: target.serviceKey,\n behavior: target.behavior,\n targetId: target.targetId,\n code,\n signal,\n ...outputContext,\n },\n );\n }\n /*\n * A CLEAN exit after a valid result keeps the result, even when the late-exit timer already\n * asked for termination (#2396).\n *\n * That timer measures the PARENT as much as the child. It is armed when the result arrives, and\n * when this process's event loop is blocked for more than a second, the timers phase runs it\n * before the poll phase gets to deliver the child's `close` — so a child that had exited\n * cleanly, on time, was recorded as having hung, and its correct result was thrown away. Signals\n * sent to a child that has already exited do nothing, which is why such a close still reports\n * `code 0` and no signal. On app-creation-test-005 that shape (`completed`, `code: 0`, then\n * `success: false`) recurred 32 times for one derivation while the companion was saturated.\n *\n * Narrow on purpose: only the late-exit failure is set aside, and only for a close that proves\n * the child exited by itself (no signal). A child that really did not exit is ended by our\n * signal, closes with that signal, and still fails. Every other pending failure (an invalid or\n * duplicate payload, the overall timeout, a spawn error) is about the result itself and stands.\n *\n * Two shapes, because the child exits 1 after sending its own failure envelope: a SUCCESS is kept\n * only with status 0, and a FAILURE the child reported is kept with whatever status it exited,\n * since it is a failure either way and it carries the real reason. Without the second shape the\n * same overload replaced the child's named error with \"did not exit cleanly within 1000ms\", which\n * is the very loss of reason #2396 was filed about (review of #2396, M1).\n */\n const resultBeforeLateExit = pendingFailure !== null && lateExitTerminationRequested && signal === null ? parsedResult : null;\n if (resultBeforeLateExit !== null && !resultBeforeLateExit.success) {\n this.logDebug(`Companion introspection \"${target.behavior}\" on \"${target.serviceKey}\" reported its own failure before the late-exit timer; its reason is kept`, {\n serviceKey: target.serviceKey,\n behavior: target.behavior,\n code,\n durationMs: Date.now() - startedAt,\n });\n finalize(resultBeforeLateExit);\n return;\n }\n if (resultBeforeLateExit !== null && code === 0) {\n // The evidence line: each one is a second or more this process could not attend to its child.\n this.logDebug(`Companion introspection \"${target.behavior}\" on \"${target.serviceKey}\" exited cleanly after the late-exit timer; its result is kept`, {\n serviceKey: target.serviceKey,\n behavior: target.behavior,\n durationMs: Date.now() - startedAt,\n });\n finalize(resultBeforeLateExit);\n return;\n }\n if (pendingFailure !== null) {\n finalize(pendingFailure);\n return;\n }\n if (parsedResult !== null && code === 0 && signal === null) {\n finalize(parsedResult);\n return;\n }\n if (parsedResult !== null && parsedResult.success === false) {\n finalize(parsedResult);\n return;\n }\n /*\n * A signal THIS SERVICE DID NOT SEND means the kill came from outside, and saying so is the\n * difference between an actionable message and a misleading one.\n *\n * Every termination this service performs goes through `requestTermination`, which sets\n * `pendingFailure` BEFORE killing — and the branch above returns that failure. So reaching\n * here with a termination signal proves nobody here asked for it: the child died because its\n * PARENT did, taking the process group with it.\n *\n * In a dev loop that is the supervisor restarting the companion. Measured 2026-09-02 across\n * four session logs: 30 such failures at a median of 11.4 s — nowhere near the 30 s ceiling —\n * and the line immediately preceding each one is\n * `[runtime-supervisor:wildo-dev-companion] Stopping runtime before readiness...`.\n *\n * The old message named the subprocess as the thing that exited, which is true and useless:\n * it reads as a fault in the derivation, and `signal=SIGTERM` beside a 30 s timeout constant\n * reads as that timeout firing. It cost a full investigation before the log said otherwise.\n */\n const terminatedFromOutside = wasTerminatedFromOutside({\n signal,\n hasPendingFailure: pendingFailure !== null,\n hasParsedResult: parsedResult !== null,\n });\n\n finalize(this.buildFailureResult(target, startedAt, terminatedFromOutside\n ? {\n message: `Companion introspection was terminated by ${signal} that this service did not send — the companion process itself is stopping, so the derivation was cut short rather than failing. Re-run it once the companion is ready.`,\n name: INTROSPECTION_PARENT_TERMINATED_ERROR_NAME,\n }\n : {\n message: parsedResult === null\n ? `Companion introspection subprocess exited before returning a result (code=${code ?? 'null'}, signal=${signal ?? 'null'})${outputContext ? ` — ${describeOutputContext(outputContext)}` : ''}.`\n : `Companion introspection subprocess returned a result then exited unsuccessfully (code=${code ?? 'null'}, signal=${signal ?? 'null'}).`,\n name: 'CompanionIntrospectionSubprocessExitError',\n }));\n };\n\n const timeoutHandle = setTimeout(() => {\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: `Companion introspection timed out after ${this.timeoutMs}ms.`,\n name: 'CompanionIntrospectionTimeoutError',\n }));\n }, this.timeoutMs);\n\n child.on('spawn', onSpawn);\n child.on('message', onMessage);\n child.on('error', onError);\n // `close`, unlike `message` or `exit`, proves that the process and its\n // stdio handles are all quiescent. The parent never releases its queue\n // slot while the child can still emit output or fail late.\n child.on('close', onClose);\n });\n }\n\n private buildChildRequest(\n target: CompanionIntrospectionResolvedTarget,\n ): CompanionIntrospectionChildRequest {\n return {\n behavior: target.behavior,\n serviceKind: target.serviceKind,\n behaviorCategory: target.behaviorCategory,\n materializationKind: target.materializationKind,\n targetId: target.targetId,\n serviceKey: target.serviceKey,\n entryPath: target.entryPath,\n packageRoot: target.packageRoot,\n homes: this.buildChildHomesSnapshot(),\n resolvedTargets: target.resolvedTargets,\n input: target.input,\n };\n }\n\n /**\n * Resolve subprocess launch paths from THIS MODULE's own location, never from\n * `companionHome/src`. Under dist-only delivery (issue #64) the application's\n * `.wildo-saas/wildo-dev-companion` drop contains no source tree at all — the child runner and\n * the asset-noop register ship as COMPILED siblings of this service inside `dist/esm`, so the\n * only location that is guaranteed to hold them is the directory graph this very module runs\n * from. When the suite executes the source directly (vitest resolves the `.ts` module), the\n * sibling files are the authored `.ts` sources and the child is executable because the spawn\n * always registers `tsx` before the register hook. `cwd` stays the application's companion\n * home: the child resolves app packages and `node_modules` (including `tsx` itself) from there.\n */\n private resolveSubprocessLaunchContext(): {\n cwd: string;\n runnerPath: string;\n assetNoopRegisterPath: string;\n readTrackingPath: string;\n } {\n const isSourceExecution = import.meta.url.endsWith('.ts');\n const subprocessDir = fileURLToPath(new URL('../subprocess/', import.meta.url));\n return {\n cwd: this.companionContext.companionHome,\n runnerPath: join(subprocessDir, isSourceExecution ? 'companion-introspection-child.ts' : 'companion-introspection-child.js'),\n assetNoopRegisterPath: join(subprocessDir, isSourceExecution ? 'asset-noop-register.ts' : 'asset-noop-register.js'),\n readTrackingPath: join(subprocessDir, isSourceExecution ? 'derivation-read-tracking.ts' : 'derivation-read-tracking.js'),\n };\n }\n\n private buildChildHomesSnapshot(): CompanionIntrospectionHomesSnapshot {\n const appLayout = this.companionContext.resolvedHomes.app.layout;\n if (!appLayout) {\n throw new Error('Companion introspection requires an app layout in the trusted homes snapshot.');\n }\n\n return {\n appDeclarationRoot: appLayout.declarationRoot,\n appRuntimeHome: appLayout.runtimeHome,\n companionHome: this.companionContext.companionHome,\n frameworkRepositoryRoot: this.companionContext.resolvedHomes.framework.repositoryRoot,\n };\n }\n\n private resolveCompanionTargets(\n serviceDefinition: CompanionContext['servicesByKey'][string],\n ): Partial<Record<CompanionIntrospectionRouteTargetId, CompanionIntrospectionResolvedPackageTarget>> {\n const sharedLibrary = this.companionContext.resolvedLibraries.shared;\n const resolvedLibraryTarget = sharedLibrary?.libraryType === AppLibraryType.FULLSTACK\n ? {\n targetId: 'library' as const,\n packageRoot: sharedLibrary.packageRoot,\n entryPath: sharedLibrary.entryPath,\n declaredPath: sharedLibrary.declaredPath,\n }\n : undefined;\n\n return {\n service: this.tryResolveCompanionTarget('service', serviceDefinition.path),\n library: resolvedLibraryTarget,\n specifications: this.companionContext.resolvedSpecifications\n ? {\n targetId: 'specifications',\n packageRoot: this.companionContext.resolvedSpecifications.packageRoot,\n entryPath: this.companionContext.resolvedSpecifications.entryPath,\n declaredPath: this.companionContext.resolvedSpecifications.declaredPath,\n }\n : undefined,\n };\n }\n\n private tryResolveCompanionTarget(\n targetId: CompanionIntrospectionRouteTargetId,\n declaredPath: string,\n ): CompanionIntrospectionResolvedPackageTarget | undefined {\n const packageRoot = resolve(this.companionContext.saasRoot, declaredPath);\n\n try {\n return {\n targetId,\n packageRoot,\n entryPath: resolvePackageCompanionEntryPath(packageRoot),\n declaredPath,\n };\n } catch {\n return undefined;\n }\n }\n\n private buildFailureResult(\n target: CompanionIntrospectionResolvedTarget,\n startedAt: number,\n error: CompanionIntrospectionErrorDetails,\n ): CompanionIntrospectionFailureResult {\n return {\n success: false,\n behavior: target.behavior,\n serviceKey: target.serviceKey,\n serviceKind: target.serviceKind,\n behaviorCategory: target.behaviorCategory,\n materializationKind: target.materializationKind,\n targetId: target.targetId,\n durationMs: Date.now() - startedAt,\n error,\n };\n }\n}\n\n/**\n * The package roots a derivation's subprocess can import directly: its service, and every resolved\n * target it is handed (#2245). De-duplicated; the state service extends it with their dependencies.\n */\nexport function resolveDerivationTargetPackageRoots(target: Pick<CompanionIntrospectionResolvedTarget, 'servicePath' | 'packageRoot' | 'resolvedTargets'>): readonly string[] {\n const roots = new Set<string>([target.servicePath, target.packageRoot]);\n for (const resolved of Object.values(target.resolvedTargets)) {\n if (resolved !== undefined) roots.add(resolved.packageRoot);\n }\n return [...roots].sort();\n}\n\n/** Every entry a derivation's child imports natively: its route's and every resolved target's. */\nfunction resolveDerivationTargetEntryPaths(target: Pick<CompanionIntrospectionResolvedTarget, 'entryPath' | 'resolvedTargets'>): readonly string[] {\n const entries = new Set<string>([target.entryPath]);\n for (const resolved of Object.values(target.resolvedTargets)) {\n if (resolved !== undefined) entries.add(resolved.entryPath);\n }\n return [...entries];\n}\n\n/**\n * The argv of an introspection child, one-shot or pooled.\n *\n * `--disable-warning=DEP0205` silences tsx's own deprecation warning at the SOURCE: `tsx` registers its ESM\n * hooks through `module.register()`, which Node 26 deprecates. The warning said nothing about the\n * application and dominated the child's stderr, the one place a reader looks to find out what an\n * introspection did. Scoped to that one code, so a genuine future deprecation still surfaces. `tsx` itself\n * is preloaded only when the child needs it (see {@link introspectionChildNeedsTypeScriptLoader}).\n */\nexport function buildIntrospectionChildArguments(\n launchContext: { readonly runnerPath: string; readonly assetNoopRegisterPath: string; readonly readTrackingPath?: string },\n needsTypeScriptLoader: boolean,\n): string[] {\n return [\n '--disable-warning=DEP0205',\n ...(needsTypeScriptLoader ? ['--import', 'tsx'] : []),\n '--import',\n launchContext.assetNoopRegisterPath,\n // Last, so its hooks run first and see every resolution, assets included, and before any module of the child's\n // graph imports `node:fs` (#3207, `derivation-read-tracking.ts`).\n ...(launchContext.readTrackingPath === undefined ? [] : ['--import', launchContext.readTrackingPath]),\n launchContext.runnerPath,\n ];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"companion-introspection.companion.service.js","sourceRoot":"","sources":["../../../../../src/core/introspection/services/companion-introspection.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,UAAU,EAA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AC,EAAE,CAAC;QAC7D,IAAI,QAAQ,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,kGAAkG;AAClG,SAAS,iCAAiC,CAAC,MAAmF;IAC5H,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC;QAC7D,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gCAAgC,CAC9C,aAA0H,EAC1H,qBAA8B;IAE9B,OAAO;QACL,2BAA2B;QAC3B,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,UAAU;QACV,aAAa,CAAC,qBAAqB;QACnC,+GAA+G;QAC/G,kEAAkE;QAClE,GAAG,CAAC,aAAa,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACrG,aAAa,CAAC,UAAU;KACzB,CAAC;AACJ,CAAC","sourcesContent":["import { spawn } from 'node:child_process';\nimport { join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { inject, injectable } from 'inversify';\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { AppFrontendType } from '@wildo-ai/saas-models';\nimport { AppLibraryType, resolvePackageCompanionEntryPath } from '@wildo-ai/platform-config-lib';\nimport { CompanionIntrospectionResultSchema } from '../../../companion-api/companion-api.schemas';\nimport type { CompanionContext } from '../../context/companion-context';\nimport { CompanionIntrospectionBehaviorRegistryService } from './companion-introspection-behavior-registry.companion.service';\nimport {\n IntrospectionDerivationStateCompanionService,\n type IntrospectionCompileAffinity,\n type IntrospectionDerivationReadOptions,\n} from './introspection-derivation-state.companion.service';\nimport { IntrospectionWorkerPool } from './introspection-worker-pool.companion';\nimport { DependencyTreeSettleVerdict, IntrospectionDependencyTreeGate } from './introspection-dependency-tree.companion';\nimport { IntrospectionCompileQueue } from './introspection-compile-queue.companion';\nimport { attachIntrospectionReadSet, IntrospectionReadSetChecker } from './introspection-derivation-read-set.companion';\nimport { READ_TRACKING_ROOT_ENV } from '../subprocess/derivation-read-tracking';\nimport type {\n CompanionIntrospectionChildRequest,\n CompanionIntrospectionErrorDetails,\n CompanionIntrospectionFailureResult,\n CompanionIntrospectionHomesSnapshot,\n CompanionIntrospectionRequest,\n CompanionIntrospectionResolvedPackageTarget,\n CompanionIntrospectionResolvedTarget,\n CompanionIntrospectionResult,\n CompanionIntrospectionRouteTargetId,\n CompanionIntrospectionServiceKind,\n} from '../models/companion-introspection.models';\nimport { INTROSPECTION_PARENT_TERMINATED_ERROR_NAME, IntrospectionInputValidationError } from '../models/companion-introspection.models';\nimport { COMPANION_SERVICE_TYPES } from '../../inject/models/service-types';\n\nconst DEFAULT_MAX_CONCURRENCY = 4;\n\n/**\n * How long one introspection subprocess may run before it is killed and reported as a timeout.\n *\n * ## This bounds a HANG. It is not a latency budget.\n *\n * A child that answers slowly is still answering; the only thing this ceiling exists to catch is a\n * child that will never answer. So it must sit comfortably ABOVE the most expensive legitimate read,\n * and the cost of setting it too low is far worse than the cost of setting it too high: an\n * over-tight ceiling does not slow a playbook down, it makes the playbook permanently unable to run.\n *\n * ## Measured 2026-09-09 on `examples/wonder-todos`, and why 30s had to go\n *\n * It was `30_000` — an unjustified round number — and every `specifications`-target behavior a\n * `workspace_truth` playbook assembles EXCEEDED it, deterministically. Timing the child directly,\n * with nothing but the dev stack competing:\n *\n * | behavior | target | measured |\n * |---|---|---|\n * | `expert-persona-charters` | specifications | 11.5s |\n * | `expert-persona-derivation-inputs` | specifications | 13.5s |\n * | `specification-artifacts` | specifications | **30.6s** |\n * | `application-domain-model` | specifications | **35.3s** |\n *\n * The consequence was not an intermittent flake. `bottom_up.placement-plan` — and anything else\n * declaring `contextSources: ['workspace_truth']` — watched every one of its context reads fail at\n * exactly 30s intervals (`specification-artifacts`, `family-aspects`, `frontend-labels-needed-info`,\n * `openapi-generation-input`, …), assembled an empty brief, and could not complete. It read as a\n * `500 INTERNAL / critical`, which sends a reader looking for a bug in the behavior rather than at\n * the clock.\n *\n * ## Why 120s\n *\n * ~3.4x headroom over the worst measurement, because a developer machine mid-compile-storm is\n * materially slower than one that is idle, and this is the machine every one of these reads runs on.\n * A genuinely hung child is still detected and still reported — two minutes later instead of thirty\n * seconds, which nobody is waiting on interactively.\n *\n * Re-measure before lowering this: the cost is dominated by importing a real application's compiled\n * `specifications` package and the engine graph behind it, so it grows with the application. A\n * deployment that wants a tighter bound sets `COMPANION_INTROSPECTION_TIMEOUT_MS`.\n */\nconst DEFAULT_TIMEOUT_MS = 120_000;\n\n/**\n * How long a pooled introspection worker may sit idle before it exits (#3208).\n *\n * Long enough to carry one recompile pass into the next read at the same source state, short enough\n * that a quiet companion holds no ~1 GB children: a worker is only reusable until the tree moves, and in\n * a build wave it moves every few minutes.\n */\nconst POOLED_WORKER_IDLE_MS = 60_000;\n\n/**\n * How many times one derivation is derived again after the dependency tree moved under it (#3703).\n *\n * Each retry waits for the tree to settle first, so it costs nothing while the tree is moving. More than one is allowed\n * because an install relinks packages one after another: the retry after `zod` came back can meet the next package\n * still missing. A small bound, so a tree that keeps moving cannot hold a derivation for ever.\n */\nconst MAXIMUM_DEPENDENCY_TREE_RETRIES = 3;\n\n/** A derivation that waited and ran for at least this long is logged with its timing (#3452). */\nconst INTROSPECTION_TIMING_LOG_THRESHOLD_MS = 1_000;\n\n/**\n * Every worker pool this process created, so all their workers can be retired at once: by a suite that builds\n * many services in one process (each idle worker holds a whole imported application for\n * {@link POOLED_WORKER_IDLE_MS}), and by anything else that must not leave children behind.\n */\nconst liveWorkerPools = new Set<IntrospectionWorkerPool>();\n\n/** Retire the workers of every pool in this process. See {@link liveWorkerPools}. */\nexport function shutdownAllIntrospectionWorkers(): void {\n for (const pool of liveWorkerPools) pool.shutdown();\n}\n\n/** File extensions whose presence among a derivation's entries means the child needs a TypeScript loader. */\nconst TYPESCRIPT_ENTRY_PATTERN = /\\.(?:ts|tsx|mts|cts)$/u;\n\n/**\n * Whether an introspection child must preload `tsx` (#3208).\n *\n * Only when something it will import natively is TypeScript: the runner itself (the suite runs the\n * companion from source), or a target whose built entry is missing so resolution fell back to authored\n * source. A child running the compiled companion against built packages needs no loader at all, and\n * `tsx` registers its hooks OFF-THREAD (`module.register`), which made every import in the child a\n * synchronous round trip to a loader thread: measured on app-creation-test-007, importing the handler\n * graph cost 15.6 s of user CPU and 1.2 GB with `tsx` against 8.7 s and 0.7 GB without. Specifications\n * source does not count — the child evaluates it through jiti, which transpiles by itself.\n */\nexport function introspectionChildNeedsTypeScriptLoader(input: {\n readonly runnerPath: string;\n readonly entryPaths: readonly string[];\n}): boolean {\n return [input.runnerPath, ...input.entryPaths].some((path) => TYPESCRIPT_ENTRY_PATTERN.test(path));\n}\n\n/**\n * The signals that mean SOMEONE ELSE stopped this process tree.\n *\n * Read only in the exit branch that has already established this service sent no kill of its own, so\n * membership here is what separates \"the companion is going down\" from \"the derivation failed\".\n * `SIGKILL` is deliberately absent: it is what this service's own force-kill escalation sends, and a\n * child that reaches it has already been through `requestTermination`.\n */\nconst EXTERNAL_TERMINATION_SIGNALS = new Set<string>(['SIGTERM', 'SIGINT', 'SIGHUP']);\n\n/**\n * The failure recorded when a child returns a valid result and is still running a second later. Named\n * once because `runSubprocess` must tell it apart from every other termination reason: it is the only\n * one a clean `close` can overrule (#2396).\n */\nconst LATE_EXIT_FAILURE_NAME = 'CompanionIntrospectionResultExitTimeoutError';\n\n/**\n * Whether a dead introspection child was killed by SOMEONE OTHER than this service.\n *\n * Exported because it is the whole decision — the call site is one branch — and because it is the\n * part worth pinning: the plumbing around it needs a real subprocess and a real signal, while the\n * reasoning is three booleans.\n *\n * The inference rests on an invariant of this file: every termination this service performs goes\n * through `requestTermination`, which sets a pending failure BEFORE killing, and the exit handler\n * returns that failure without consulting this. So a termination signal arriving with no pending\n * failure and no parsed result means nobody here asked — the child died because its PARENT did,\n * taking the process group with it. If a future kill path forgets to set the pending failure first,\n * this starts misreporting a local kill as an external one, which is why the invariant is stated\n * here rather than left implicit at the call site.\n */\nexport function wasTerminatedFromOutside(input: {\n readonly signal: string | null;\n readonly hasPendingFailure: boolean;\n readonly hasParsedResult: boolean;\n}): boolean {\n if (input.hasPendingFailure || input.hasParsedResult) return false;\n return input.signal !== null && EXTERNAL_TERMINATION_SIGNALS.has(input.signal);\n}\n\n/**\n * Env value that turns the derivation cache off entirely.\n *\n * Read once at construction. A door rather than a design: if the cache is ever suspected of serving\n * a stale answer, an operator can settle the question in one restart instead of reasoning about the\n * invalidation, and the diagnosis stays about the application rather than about this file. The\n * default is ON — the whole point is that the workbench stops paying a cold transpile per request.\n */\nconst DISABLE_DERIVATION_CACHE_VALUE = 'off';\n\n/**\n * Env-var namespaces stripped from the spawned introspection child's\n * environment so pre-bootstrap reads surface `undefined` instead of inheriting\n * stale values from the parent shell.\n *\n * The trusted homes snapshot is delivered through the IPC handshake and\n * reapplied by `applyTrustedHomesToChildProcess()` as the first action of\n * `handleChildProcessMessage()`. Any code that happens to read these env\n * vars during the narrow window BEFORE that handler runs (for example while\n * `reflect-metadata` is loading) would otherwise see whatever the parent\n * shell had set — including stale values from a previous companion run or\n * from the operator's shell — which would reintroduce the Phase 5\n * \"env-over-context\" class of regression at the subprocess boundary.\n *\n * `WILDO_COMPANION_INTROSPECTION_CHILD` is the intentional child-mode flag\n * and is re-injected fresh for every spawn.\n */\nexport const SCRUBBED_CHILD_ENV_NAMES = [\n 'COMPANION_WORKSPACE_ROOT',\n 'COMPANION_RUNTIME_HOME',\n 'COMPANION_PACKAGE_ROOT',\n 'COMPANION_FRAMEWORK_ROOT',\n 'WILDO_COMPANION_INTROSPECTION_CHILD',\n READ_TRACKING_ROOT_ENV,\n] as const;\n\n/**\n * Render an arbitrary behavior `input` so that two structurally equal inputs produce one key.\n *\n * `JSON.stringify` alone would not: `{a:1,b:2}` and `{b:2,a:1}` are the same question and would\n * occupy two cache entries, so the second phrasing of a question would always miss. Object keys are\n * therefore sorted at every depth. Arrays keep their order, because in an input an array's order is\n * part of the question.\n *\n * A value that cannot be rendered — a cycle, a `BigInt` — yields `null`, which the caller reads as\n * \"this question is not cacheable\" rather than as an error. Nothing in the current behavior surface\n * sends such an input; treating it as uncacheable rather than throwing keeps a future one working.\n */\nexport function renderStableCacheableInput(input: unknown): string | null {\n const seen = new WeakSet<object>();\n\n const render = (value: unknown): string => {\n if (value === undefined) return 'undefined';\n if (value === null) return 'null';\n if (typeof value === 'bigint') throw new Error('BigInt is not renderable.');\n if (typeof value !== 'object') return JSON.stringify(value) ?? 'undefined';\n if (seen.has(value as object)) throw new Error('Cyclic input is not renderable.');\n seen.add(value as object);\n if (Array.isArray(value)) {\n return `[${value.map(render).join(',')}]`;\n }\n const entries = Object.entries(value as Record<string, unknown>)\n .filter(([, entryValue]) => entryValue !== undefined)\n .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));\n return `{${entries.map(([key, entryValue]) => `${JSON.stringify(key)}:${render(entryValue)}`).join(',')}}`;\n };\n\n try {\n return render(input);\n } catch {\n return null;\n }\n}\n\n/**\n * The identity of a derivation on the REQUEST side.\n *\n * Everything the child is given that can change its answer: which service, which behavior, which\n * target it routes to, and the behavior input. `entryPath` and `packageRoot` are included because a\n * package whose built `./companion` export appears or disappears changes which bytes are imported\n * without changing the behavior id — and `resolvePackageCompanionEntryPath` prefers `dist` when it\n * exists and falls back to source when it does not.\n *\n * Returns `null` for an input that cannot be stably rendered, which the caller reads as\n * \"derive, do not remember\".\n */\n/** Whether a request carries an input a caller chose, as against the behavior's default question (#3452). */\nfunction hasDerivationInput(input: unknown): boolean {\n if (input === undefined || input === null) return false;\n if (typeof input === 'object') return Object.keys(input as Record<string, unknown>).length > 0;\n return true;\n}\n\nfunction buildDerivationCacheKey(target: CompanionIntrospectionResolvedTarget): string | null {\n const renderedInput = renderStableCacheableInput(target.input);\n if (renderedInput === null) return null;\n\n return [\n target.serviceKey,\n target.serviceKind,\n target.behavior,\n target.targetId,\n target.packageRoot,\n target.entryPath,\n renderedInput,\n ].join('\\u0001');\n}\n\n/**\n * Build the `env` object handed to the spawned introspection child process.\n *\n * Responsibilities:\n *\n * 1. Inherit the caller's `process.env` as a base, so the child still sees\n * normal environment (`PATH`, `NODE_OPTIONS`, node-debug flags, etc.).\n * 2. Scrub every `COMPANION_*` bootstrap seed that\n * `applyTrustedHomesToChildProcess()` owns on the child side. Leaving\n * them in place would let `reflect-metadata` (or anything else imported\n * before the first IPC message arrives) read a stale value from the\n * parent shell — the exact Phase 5 \"env-over-context\" regression class\n * this slice was introduced to close.\n * 3. Drop any pre-existing `WILDO_COMPANION_INTROSPECTION_CHILD` so it\n * cannot survive from a parent that was itself a child in a nested\n * spawn, then re-inject it as the exact string `'1'`. The child's\n * `shouldRegisterChildMessageHandler()` gate only accepts `'1'`, so\n * this is also the enforcement point that keeps the flag's contract\n * single-sourced here.\n *\n * Exported purely for unit testing; production code reaches it through\n * `this.runSubprocess(...)` in `CompanionIntrospectionService`.\n */\nexport function buildSubprocessEnv(): NodeJS.ProcessEnv {\n const scrubbed: NodeJS.ProcessEnv = { ...process.env };\n for (const key of SCRUBBED_CHILD_ENV_NAMES) {\n delete scrubbed[key];\n }\n scrubbed.WILDO_COMPANION_INTROSPECTION_CHILD = '1';\n return scrubbed;\n}\n\n@injectable()\nexport class CompanionIntrospectionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private readonly maxConcurrency: number;\n private readonly timeoutMs: number;\n /** Whether what an idle worker loaded still reads as it did, for keeping it across a moved tree (#3452). */\n private readonly workerReuseChecker = new IntrospectionReadSetChecker();\n /** The concurrency bound, with live compiles served before background ones (#3452). */\n private readonly compileQueue: IntrospectionCompileQueue;\n /** Test seam only; production always retains Node's real child-process spawn. */\n private spawnSubprocess: typeof spawn = spawn;\n /** Waits out a dependency install under the live companion (#3703). Replaced only by tests. */\n private dependencyTreeGate: IntrospectionDependencyTreeGate;\n /**\n * Whether compiled state may be retained at all.\n *\n * `COMPANION_INTROSPECTION_CACHE=off` still means what it always meant — every read compiles, and\n * no state is consulted or written. The flag is read here rather than inside the state service\n * because this is the door every consumer already comes through, so switching it off cannot be\n * bypassed by a caller that reaches the state service directly.\n */\n private readonly derivationCacheEnabled: boolean;\n /** Pooled workers per TypeScript-loader need (see {@link introspectionChildNeedsTypeScriptLoader}); created on first use. */\n private readonly workerPools = new Map<boolean, IntrospectionWorkerPool>();\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.IntrospectionBehaviorRegistryService)\n private readonly behaviorRegistryService: CompanionIntrospectionBehaviorRegistryService,\n @inject(COMPANION_SERVICE_TYPES.IntrospectionDerivationStateService)\n private readonly derivationState: IntrospectionDerivationStateCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('CompanionIntrospectionService');\n this.logger.setDebugTypeLogging('CompanionIntrospectionService', true);\n this.maxConcurrency = Math.max(\n 1,\n Number.parseInt(process.env.COMPANION_INTROSPECTION_MAX_CONCURRENCY ?? '', 10)\n || DEFAULT_MAX_CONCURRENCY,\n );\n this.compileQueue = new IntrospectionCompileQueue(this.maxConcurrency);\n this.timeoutMs = Math.max(\n 1_000,\n Number.parseInt(process.env.COMPANION_INTROSPECTION_TIMEOUT_MS ?? '', 10)\n || DEFAULT_TIMEOUT_MS,\n );\n this.derivationCacheEnabled = (process.env.COMPANION_INTROSPECTION_CACHE ?? '').trim().toLowerCase()\n !== DISABLE_DERIVATION_CACHE_VALUE;\n this.dependencyTreeGate = new IntrospectionDependencyTreeGate({\n appRoot: this.companionContext.saasRoot,\n log: (message, context) => this.logger.warn(message, context),\n });\n }\n\n /**\n * Answer an introspection request, re-deriving only when the application's source has moved.\n *\n * ## The three tiers, in order\n *\n * 1. **Cache hit** — a previous derivation of this exact question, taken against a source tree\n * whose observation token still matches. No subprocess, no import, no registry materialization.\n * 2. **In-flight join** — the identical question is already being derived against the identical\n * token. The caller waits on that one rather than spawning a second child.\n * 3. **Derive** — spawn, under the existing concurrency queue.\n *\n * ## What is cached, and what deliberately is not\n *\n * Only SUCCESS. A failure is not memoized, for two separate reasons and either is sufficient: the\n * common failure here is an application whose `dist` is not built, whose remedy moves the source\n * and would invalidate anyway; and a transient failure — a timeout on a loaded machine — would\n * otherwise stick to an unchanged tree and be served as the answer forever. In-flight JOINING\n * still covers failures, because two concurrent identical questions should cost one subprocess\n * whatever the outcome.\n *\n * ## Where the source reading happens\n *\n * Outside the concurrency queue. The observation is ~125 ms of filesystem work with no subprocess\n * behind it; holding one of the four queue slots for it would make a cache HIT contend with real\n * derivations, which is the opposite of the point.\n */\n /**\n * The introspection MENU — what this running companion can answer, for a caller that has to choose.\n *\n * Serves `wildo context list` (issue #252): the door's tier-1 progressive-disclosure catalog. It is a\n * COMPANION answer rather than a CLI-side copy of the behavior definitions on purpose — the CLI and a\n * running companion can be different builds, and a menu describing behaviors the serving side does not\n * have is the staleness class `.claude/rules/staleness-presents-as-a-logic-defect.md` records. Runtime\n * truth, one hop.\n *\n * `defaultBackendServiceKey` is here for the same one-authority reason: `POST /_meta/introspect`\n * REQUIRES a `serviceKey`, and the \"first backend service\" default already exists in the playbook\n * composer (`composeWorkspaceTruthSection`). Publishing the resolved default lets a CLI caller pass it\n * explicitly instead of re-deriving the rule, so the POST contract stays strict and the rule stays in\n * companion code.\n */\n public describeCatalog(): {\n readonly behaviors: ReadonlyArray<{\n readonly behaviorId: string;\n readonly description: string;\n readonly category: string;\n readonly supportedServiceKinds: readonly CompanionIntrospectionServiceKind[];\n readonly inputSummary?: string;\n }>;\n readonly serviceKeys: ReadonlyArray<{\n readonly key: string;\n readonly kind: CompanionIntrospectionServiceKind;\n /**\n * The frontend's KIND OF FRONTEND (`AppFrontendType`), for a frontend service only.\n *\n * `kind` collapses `saas-app`, `static-website` and `tech-doc` into one word, which is right\n * for ROUTING a behavior (all three are introspected the same way) and useless for CHOOSING\n * between them. An application commonly declares all three, so a caller asking a shell\n * behavior of \"the frontend\" has three answers and no way to tell which one has a shell.\n * Published so the choice is a lookup rather than a guess.\n */\n readonly frontendType?: string;\n }>;\n readonly defaultBackendServiceKey: string | null;\n /**\n * The SaaS application's own frontend — the twin of `defaultBackendServiceKey`, and the answer\n * to \"which frontend did you mean\" for every behavior that reads the application shell.\n *\n * Derived from `frontendType === 'saas-app'` rather than from declaration ORDER: order would be\n * a guess that happens to be right in the applications checked, and wrong for one that declares\n * its marketing site first. `null` when the application declares no SaaS frontend, which is a\n * real shape — a docs-only or website-only package.\n */\n readonly defaultFrontendServiceKey: string | null;\n } {\n const behaviors = this.behaviorRegistryService.listBehaviorDefinitions().map((definition) => ({\n behaviorId: definition.behaviorId,\n description: definition.description,\n category: definition.category,\n supportedServiceKinds: definition.supportedServiceKinds,\n ...(definition.inputSummary !== undefined ? { inputSummary: definition.inputSummary } : {}),\n }));\n const serviceKeys = Object.entries(this.companionContext.servicesByKey).map(([key, service]) => ({\n key,\n kind: this.resolveServiceKind(service),\n ...(service.frontendType !== undefined ? { frontendType: String(service.frontendType) } : {}),\n }));\n const defaultBackendServiceKey = serviceKeys.find((service) => service.kind === 'backend')?.key ?? null;\n const defaultFrontendServiceKey = serviceKeys.find(\n (service) => service.frontendType === AppFrontendType.SAAS_APP,\n )?.key ?? null;\n return { behaviors, serviceKeys, defaultBackendServiceKey, defaultFrontendServiceKey };\n }\n\n /**\n * `options.verifyAgainstSource` (#2364): for a caller about to act on what the answer says is absent\n * — a refusal, or a write derived from it — a held answer is checked against the source as it stands\n * now rather than trusted since the last reported move. See {@link IntrospectionDerivationReadOptions}.\n * With the cache off, or an uncacheable input, every answer is derived fresh, which already satisfies it.\n */\n public async requestInfo(\n request: CompanionIntrospectionRequest,\n options: IntrospectionDerivationReadOptions = {},\n ): Promise<CompanionIntrospectionResult> {\n const resolvedTarget = await this.resolveTarget(request);\n\n if (!this.derivationCacheEnabled) {\n return this.deriveThroughQueue(resolvedTarget);\n }\n\n const cacheKey = buildDerivationCacheKey(resolvedTarget);\n if (cacheKey === null) {\n return this.deriveThroughQueue(resolvedTarget);\n }\n\n return this.derivationState.read(\n {\n cacheKey,\n behavior: resolvedTarget.behavior,\n serviceKey: resolvedTarget.serviceKey,\n // Every package the child is handed, not only the declared route: several behaviors read a target\n // they never declared. The state service closes this over the packages' own dependencies (#2245).\n inputPackageRoots: resolveDerivationTargetPackageRoots(resolvedTarget),\n // A question with an input is forgotten once nobody asks it (#3452).\n ...(hasDerivationInput(resolvedTarget.input) ? { parameterised: true } : {}),\n },\n (affinity) => this.deriveThroughQueue(resolvedTarget, affinity),\n options,\n );\n }\n\n /**\n * Compile a derivation without consulting or writing compiled state.\n *\n * The COMPILE primitive, exposed so the state service can drive a recompilation that no read\n * asked for. It is the same path a cache miss took before, minus the memo: the concurrency queue,\n * the subprocess, the IPC result. Nothing here decides freshness, which is the separation this\n * whole change exists to make — a caller that wants the current answer asks the state service, and\n * a caller that wants a NEW answer asks this.\n */\n public async compileNow(\n request: CompanionIntrospectionRequest,\n ): Promise<CompanionIntrospectionResult> {\n return this.deriveThroughQueue(await this.resolveTarget(request));\n }\n\n /**\n * The cache key a request resolves to, for a caller that needs to talk about a derivation's\n * identity — to warm it, to stamp a notification with its generation — without running it.\n *\n * `null` means the request's input cannot be stably rendered, which every caller reads as\n * \"compile, do not remember\".\n */\n public async resolveDerivationIdentity(request: CompanionIntrospectionRequest): Promise<{\n readonly cacheKey: string;\n readonly behavior: string;\n readonly serviceKey: string;\n } | null> {\n const resolvedTarget = await this.resolveTarget(request);\n const cacheKey = buildDerivationCacheKey(resolvedTarget);\n if (cacheKey === null) return null;\n return { cacheKey, behavior: resolvedTarget.behavior, serviceKey: resolvedTarget.serviceKey };\n }\n\n /**\n * Drop every compiled derivation.\n *\n * Costs a recompilation and changes no answer — the property that makes this state per-run runtime\n * state rather than a second source of truth. Kept on this service because it is the door every\n * consumer already holds; the state itself lives one layer down.\n */\n public clearDerivationCache(): void {\n this.derivationState.clear();\n }\n\n /** Retire every pooled introspection worker. Idempotent; a worker also exits when this process dies. */\n public shutdownWorkers(): void {\n for (const pool of this.workerPools.values()) pool.shutdown();\n }\n\n /** Live pooled workers. A diagnostic for tests and profiling runs. */\n public get liveWorkerCount(): number {\n let count = 0;\n for (const pool of this.workerPools.values()) count += pool.liveWorkerCount;\n return count;\n }\n\n /**\n * Derive, surviving a dependency install under the live companion (#3703).\n *\n * Every derivation's child resolves its packages from the application's `node_modules` when it starts, so a child\n * started while an install re-creates that tree dies on its first bare import (`Cannot find package 'zod'`). Two\n * decisions, both the gate's (see `introspection-dependency-tree.companion.ts`): nothing starts while a RECORDED\n * install is in flight, and a derivation that failed on a declared package the resolver could not find is derived\n * again once that package resolves, after every pooled worker started before the tree settled is retired, so the\n * retry runs in a process that read the settled tree. Any other failure is returned as it was. The waits happen\n * outside the concurrency queue, so a held derivation keeps no slot.\n */\n private async deriveThroughQueue(\n resolvedTarget: CompanionIntrospectionResolvedTarget,\n affinity?: IntrospectionCompileAffinity,\n ): Promise<CompanionIntrospectionResult> {\n await this.dependencyTreeGate.holdWhileInstallInFlight();\n let result = await this.deriveOnceThroughQueue(resolvedTarget, affinity);\n for (let retry = 1; !result.success && retry <= MAXIMUM_DEPENDENCY_TREE_RETRIES; retry++) {\n const failureText = [result.error.message, result.stderr ?? ''].join('\\n');\n const settle = await this.dependencyTreeGate.settleAfterFailure(failureText);\n if (settle.verdict !== DependencyTreeSettleVerdict.SETTLED) break;\n for (const pool of this.workerPools.values()) pool.retireWorkersStartedBefore(settle.settledAtMs ?? Date.now(), 'started before the dependency tree moved');\n this.logger.warn('Introspection derivation failed on a dependency tree in motion; deriving again now it has settled', {\n behavior: resolvedTarget.behavior,\n serviceKey: resolvedTarget.serviceKey,\n packageName: settle.unresolved?.packageName,\n importerPath: settle.unresolved?.importerPath,\n waitedMs: settle.waitedMs,\n retry,\n });\n result = await this.deriveOnceThroughQueue(resolvedTarget, affinity);\n }\n return result;\n }\n\n private async deriveOnceThroughQueue(\n resolvedTarget: CompanionIntrospectionResolvedTarget,\n affinity?: IntrospectionCompileAffinity,\n ): Promise<CompanionIntrospectionResult> {\n const queuedAt = Date.now();\n let background = affinity?.background === true;\n return this.compileQueue.run(async () => {\n const startedAt = Date.now();\n this.logDebug('Executing companion introspection request', {\n serviceKey: resolvedTarget.serviceKey,\n behavior: resolvedTarget.behavior,\n targetId: resolvedTarget.targetId,\n entryPath: resolvedTarget.entryPath,\n pooled: affinity !== undefined,\n });\n\n const result = await (affinity === undefined ? this.runSubprocess(resolvedTarget) : this.runPooled(resolvedTarget, affinity));\n /*\n * Visible without enabling a debug type (#3452): where a derivation's time went, waiting for a slot or running.\n * The reference runs could not say, and the event-loop stalls were attributed by elimination. Only a compile that\n * cost something is logged, so a quiet companion stays quiet.\n */\n const waitedMs = startedAt - queuedAt;\n const ranMs = Date.now() - startedAt;\n if (waitedMs + ranMs >= INTROSPECTION_TIMING_LOG_THRESHOLD_MS) {\n this.logger.info('Introspection derivation timed', {\n behavior: resolvedTarget.behavior,\n serviceKey: resolvedTarget.serviceKey,\n lane: background ? 'background' : 'live',\n waitedMs,\n ranMs,\n success: result.success,\n liveQueued: this.compileQueue.liveQueued,\n backgroundQueued: this.compileQueue.backgroundQueued,\n });\n }\n return result;\n }, {\n background,\n ...(affinity?.promotion === undefined ? {} : { promotion: affinity.promotion }),\n onPromoted: () => {\n background = false;\n },\n });\n }\n\n /**\n * Derive through a worker bound to the observed source state (#3208), see {@link IntrospectionWorkerPool}.\n *\n * A failure from a worker that had already answered another request — the behavior's own failure, or the\n * worker dying under it — is asked once more of a fresh one-shot child: sharing a process is the one thing a\n * one-shot child never did, so a behavior that leaves state behind must not be able to fail its neighbour. A\n * timeout is not retried (that would double a two-minute wait), nor the companion stopping, nor a failure of\n * a worker's first request, which no neighbour could have caused.\n */\n private async runPooled(\n target: CompanionIntrospectionResolvedTarget,\n affinity: IntrospectionCompileAffinity,\n ): Promise<CompanionIntrospectionResult> {\n const startedAt = Date.now();\n const launchContext = this.resolveSubprocessLaunchContext();\n const needsTypeScriptLoader = introspectionChildNeedsTypeScriptLoader({\n runnerPath: launchContext.runnerPath,\n entryPaths: resolveDerivationTargetEntryPaths(target),\n });\n const outcome = await this.workerPoolFor(needsTypeScriptLoader).run(affinity.sourceStateToken, this.buildChildRequest(target), {\n sharedToken: affinity.sharedToken,\n stillMatches: (entries, observationToken) => this.workerReuseChecker.stillMatches(entries, observationToken),\n });\n const output = { stdout: outcome.stdout || undefined, stderr: outcome.stderr || undefined };\n const result: CompanionIntrospectionResult = outcome.kind === 'result'\n ? { ...outcome.result, ...output }\n : { ...this.buildFailureResult(target, startedAt, outcome.error), ...output };\n if (result.success) {\n // Beside the result, never in it: the result is the API's shape (see `introspection-derivation-read-set`).\n if (outcome.kind === 'result' && outcome.readSet !== undefined) attachIntrospectionReadSet(result, outcome.readSet);\n return result;\n }\n\n // A failure of a worker's FIRST request, a timeout and the companion itself stopping are not retried: no\n // neighbour could have caused the first, a retry would double a two-minute wait, and nothing would survive\n // the third. Everything else from a worker that served before — its own failure or the worker dying — is.\n const timedOutOrStopping = !result.success\n && (result.error.name === 'CompanionIntrospectionTimeoutError' || result.error.name === INTROSPECTION_PARENT_TERMINATED_ERROR_NAME);\n if (outcome.workerServedBefore === 0 || timedOutOrStopping) return result;\n const isolated = await this.runSubprocess(target);\n if (isolated.success) {\n this.logger.warn('Introspection behavior failed in a shared worker and succeeded alone; it is not safe to share a process', {\n behavior: target.behavior,\n serviceKey: target.serviceKey,\n sharedFailure: result.error.message,\n });\n }\n return isolated;\n }\n\n private workerPoolFor(needsTypeScriptLoader: boolean): IntrospectionWorkerPool {\n const existing = this.workerPools.get(needsTypeScriptLoader);\n if (existing) return existing;\n const launchContext = this.resolveSubprocessLaunchContext();\n const pool = new IntrospectionWorkerPool({\n spawnWorker: () => this.spawnSubprocess(\n process.execPath,\n buildIntrospectionChildArguments(launchContext, needsTypeScriptLoader),\n // A pooled worker records what each derivation reads, under the application root (#3207).\n { cwd: launchContext.cwd, env: { ...buildSubprocessEnv(), [READ_TRACKING_ROOT_ENV]: this.buildChildHomesSnapshot().appDeclarationRoot }, stdio: ['ignore', 'pipe', 'pipe', 'ipc'] },\n ),\n maximumWorkers: this.maxConcurrency,\n idleMs: POOLED_WORKER_IDLE_MS,\n requestTimeoutMs: this.timeoutMs,\n log: this.logDebug,\n });\n this.workerPools.set(needsTypeScriptLoader, pool);\n liveWorkerPools.add(pool);\n return pool;\n }\n\n private async resolveTarget(\n request: CompanionIntrospectionRequest,\n ): Promise<CompanionIntrospectionResolvedTarget> {\n const serviceDefinition = this.companionContext.servicesByKey[request.serviceKey];\n if (!serviceDefinition) {\n /*\n * A caller's bad input, so it must answer 4xx CARRYING ITS MESSAGE — the same contract\n * `IntrospectionInputValidationError` was introduced for (#1459). A plain `Error` here is\n * sanitized to a bodyless 500, and the CLI's health hint then fires on a companion that is\n * demonstrably up, sending the reader to check a process instead of their own argument.\n *\n * The likeliest way to get here is passing a service NAME where the key is wanted\n * (`--service scratch-journey-app` for the service keyed `app`), which is why the valid keys\n * are named rather than merely the rejected one.\n */\n throw new IntrospectionInputValidationError(\n `Unknown SaaS service key \"${request.serviceKey}\". This application declares: `\n + `${Object.keys(this.companionContext.servicesByKey).sort().map((key) => `\"${key}\"`).join(', ')}.`,\n );\n }\n\n const serviceKind = this.resolveServiceKind(serviceDefinition);\n const resolvedBehavior = this.behaviorRegistryService.resolveBehaviorForServiceKind(\n request.behavior,\n serviceKind,\n );\n\n const resolvedTargets = this.resolveCompanionTargets(serviceDefinition);\n const missingTargets = [resolvedBehavior.route.target, ...(resolvedBehavior.route.requiredTargets ?? [])]\n .filter((targetId, index, allTargetIds) => allTargetIds.indexOf(targetId) === index)\n .filter((targetId) => !resolvedTargets[targetId]);\n if (missingTargets.length > 0) {\n // Also the caller's: they named a service that cannot serve this behavior, and the message\n // says which targets are missing — so it must survive sanitization like the key above.\n throw new IntrospectionInputValidationError(\n `Behavior \"${request.behavior}\" requires config-declared target(s) ${missingTargets.map((targetId) => `\"${targetId}\"`).join(', ')}, but they are not declared or resolvable for service \"${request.serviceKey}\".`,\n );\n }\n const behaviorTarget = resolvedTargets[resolvedBehavior.route.target]!;\n\n const servicePath = resolve(this.companionContext.saasRoot, serviceDefinition.path);\n\n return {\n serviceKey: request.serviceKey,\n servicePath,\n serviceName: serviceDefinition.serviceName,\n serviceKind,\n behavior: request.behavior,\n behaviorCategory: resolvedBehavior.category,\n materializationKind: resolvedBehavior.execution.materializationKind,\n targetId: resolvedBehavior.route.target,\n packageRoot: behaviorTarget.packageRoot,\n entryPath: behaviorTarget.entryPath,\n resolvedTargets,\n resolvedBehavior,\n input: request.input,\n };\n }\n\n private resolveServiceKind(\n serviceDefinition: CompanionContext['servicesByKey'][string],\n ): CompanionIntrospectionServiceKind {\n return serviceDefinition.frontendType ? 'frontend' : 'backend';\n }\n\n private async runSubprocess(\n target: CompanionIntrospectionResolvedTarget,\n ): Promise<CompanionIntrospectionResult> {\n const childRequest = this.buildChildRequest(target);\n const launchContext = this.resolveSubprocessLaunchContext();\n\n return new Promise<CompanionIntrospectionResult>((resolvePromise) => {\n const startedAt = Date.now();\n // A one-shot child records no reads: it answers without a source-state token, so nothing it says is retained.\n const { readTrackingPath: _notRecorded, ...oneShotLaunchContext } = launchContext;\n const child = this.spawnSubprocess(process.execPath, buildIntrospectionChildArguments(\n oneShotLaunchContext,\n introspectionChildNeedsTypeScriptLoader({ runnerPath: launchContext.runnerPath, entryPaths: resolveDerivationTargetEntryPaths(target) }),\n ), {\n cwd: launchContext.cwd,\n env: buildSubprocessEnv(),\n stdio: ['ignore', 'pipe', 'pipe', 'ipc'],\n });\n\n let stdout = '';\n let stderr = '';\n let settled = false;\n let parsedResult: CompanionIntrospectionResult | null = null;\n let pendingFailure: CompanionIntrospectionFailureResult | null = null;\n let naturalExitHandle: NodeJS.Timeout | null = null;\n /** Whether the ONLY reason termination was requested is the late-exit timer. See `onClose`. */\n let lateExitTerminationRequested = false;\n let forceKillHandle: NodeJS.Timeout | null = null;\n\n /*\n * The child's output, as TWO named fields rather than one ` | `-joined blob.\n *\n * The blob was unreadable in practice: a routine success printed one useful line of stdout\n * glued to a multi-line third-party deprecation warning, and a reader could not tell at a\n * glance whether an introspection had worked, what it had found, or whether the stderr meant\n * anything. Stdout and stderr answer different questions — what it DID versus what went WRONG —\n * and joining them makes the log answer neither.\n */\n const buildOutputContext = (): { stdout?: string; stderr?: string } | undefined => {\n const trimmedStdout = stdout.trim();\n const trimmedStderr = stderr.trim();\n if (trimmedStdout.length === 0 && trimmedStderr.length === 0) return undefined;\n return {\n ...(trimmedStdout.length > 0 ? { stdout: trimmedStdout } : {}),\n ...(trimmedStderr.length > 0 ? { stderr: trimmedStderr } : {}),\n };\n };\n\n /** One line for a message that has no room for two fields. */\n const describeOutputContext = (context: { stdout?: string; stderr?: string } | undefined): string =>\n context === undefined\n ? ''\n : [\n ...(context.stdout ? [`stdout: ${context.stdout}`] : []),\n ...(context.stderr ? [`stderr: ${context.stderr}`] : []),\n ].join(' | ');\n\n const onStdout = (chunk: Buffer | string) => {\n stdout += chunk.toString();\n };\n const onStderr = (chunk: Buffer | string) => {\n stderr += chunk.toString();\n };\n child.stdout?.on('data', onStdout);\n child.stderr?.on('data', onStderr);\n\n const clearTimer = (handle: NodeJS.Timeout | null): void => {\n if (handle !== null) clearTimeout(handle);\n };\n\n const cleanup = () => {\n clearTimeout(timeoutHandle);\n clearTimer(naturalExitHandle);\n clearTimer(forceKillHandle);\n child.off('spawn', onSpawn);\n child.off('message', onMessage);\n child.off('error', onError);\n child.off('close', onClose);\n child.stdout?.off('data', onStdout);\n child.stderr?.off('data', onStderr);\n };\n\n const finalize = (result: CompanionIntrospectionResult) => {\n if (settled) {\n return;\n }\n\n settled = true;\n cleanup();\n const finalResult = {\n ...result,\n stdout: stdout || undefined,\n stderr: stderr || undefined,\n };\n resolvePromise(finalResult);\n };\n\n const requestTermination = (failure: CompanionIntrospectionFailureResult): void => {\n if (pendingFailure === null) pendingFailure = failure;\n // Any OTHER failure after the late-exit timer (a duplicate payload, a child error) is about the\n // result itself, so a clean close must no longer rescue it.\n if (failure.error.name !== LATE_EXIT_FAILURE_NAME) lateExitTerminationRequested = false;\n clearTimeout(timeoutHandle);\n clearTimer(naturalExitHandle);\n naturalExitHandle = null;\n if (forceKillHandle !== null) return;\n try {\n child.kill('SIGTERM');\n } catch {\n // A concurrent exit can make kill throw; settlement still waits for\n // the terminal `close` event rather than guessing process state.\n }\n forceKillHandle = setTimeout(() => {\n try {\n child.kill('SIGKILL');\n } catch {\n // The terminal `close` event remains the only settlement signal.\n }\n }, 1_000);\n };\n\n const onSpawn = () => {\n child.send?.(childRequest);\n };\n\n const onMessage = (message: unknown) => {\n clearTimeout(timeoutHandle);\n if (pendingFailure !== null) {\n // A child sends exactly one message. One arriving after the late-exit timer is a second payload,\n // so the first can no longer be trusted, and a clean close must not rescue it (#2396).\n lateExitTerminationRequested = false;\n return;\n }\n if (parsedResult !== null) {\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: 'Companion introspection subprocess returned more than one result payload.',\n name: 'CompanionIntrospectionDuplicateResultError',\n }));\n return;\n }\n try {\n parsedResult = CompanionIntrospectionResultSchema.parse(message) as CompanionIntrospectionResult;\n // A valid payload is provisional until the child proves that no late\n // failure occurred. Give the normal child one bounded window to\n // disconnect and exit cleanly before beginning termination.\n naturalExitHandle = setTimeout(() => {\n lateExitTerminationRequested = true;\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: 'Companion introspection subprocess returned a result but did not exit cleanly within 1000ms.',\n name: LATE_EXIT_FAILURE_NAME,\n }));\n }, 1_000);\n } catch (error) {\n // describeCaughtError: N/A — this `try` wraps exactly one statement,\n // `CompanionIntrospectionResultSchema.parse(message)`, which throws a `ZodError`.\n // No engine service is called inside it, so a `WildoError_Backend` (a plain\n // object, which the test below would reject) cannot reach here. The site also\n // needs `.name` and `.stack`, which the string helper does not carry. Left as-is\n // deliberately, not overlooked by the 2026-08-21 sweep.\n const standardError = error instanceof Error ? error : new Error('Invalid companion introspection subprocess payload.');\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: standardError.message,\n name: standardError.name,\n stack: standardError.stack,\n }));\n }\n };\n\n const onError = (error: Error) => {\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: error.message,\n name: error.name,\n stack: error.stack,\n }));\n };\n\n const onClose = (code: number | null, signal: NodeJS.Signals | null) => {\n if (settled) return;\n const outputContext = buildOutputContext();\n if (outputContext) {\n /*\n * Named for what the reader wants to know — WHICH introspection, and whether it went\n * cleanly — rather than for the mechanism. \"exited with buffered output\" described the\n * plumbing and left the behavior buried in a field.\n */\n const cleanExit = code === 0 && signal === null;\n this.logDebug(\n `Companion introspection \"${target.behavior}\" on \"${target.serviceKey}\" ${cleanExit ? 'completed' : `exited code=${code ?? 'null'} signal=${signal ?? 'null'}`}`,\n {\n serviceKey: target.serviceKey,\n behavior: target.behavior,\n targetId: target.targetId,\n code,\n signal,\n ...outputContext,\n },\n );\n }\n /*\n * A CLEAN exit after a valid result keeps the result, even when the late-exit timer already\n * asked for termination (#2396).\n *\n * That timer measures the PARENT as much as the child. It is armed when the result arrives, and\n * when this process's event loop is blocked for more than a second, the timers phase runs it\n * before the poll phase gets to deliver the child's `close` — so a child that had exited\n * cleanly, on time, was recorded as having hung, and its correct result was thrown away. Signals\n * sent to a child that has already exited do nothing, which is why such a close still reports\n * `code 0` and no signal. On app-creation-test-005 that shape (`completed`, `code: 0`, then\n * `success: false`) recurred 32 times for one derivation while the companion was saturated.\n *\n * Narrow on purpose: only the late-exit failure is set aside, and only for a close that proves\n * the child exited by itself (no signal). A child that really did not exit is ended by our\n * signal, closes with that signal, and still fails. Every other pending failure (an invalid or\n * duplicate payload, the overall timeout, a spawn error) is about the result itself and stands.\n *\n * Two shapes, because the child exits 1 after sending its own failure envelope: a SUCCESS is kept\n * only with status 0, and a FAILURE the child reported is kept with whatever status it exited,\n * since it is a failure either way and it carries the real reason. Without the second shape the\n * same overload replaced the child's named error with \"did not exit cleanly within 1000ms\", which\n * is the very loss of reason #2396 was filed about (review of #2396, M1).\n */\n const resultBeforeLateExit = pendingFailure !== null && lateExitTerminationRequested && signal === null ? parsedResult : null;\n if (resultBeforeLateExit !== null && !resultBeforeLateExit.success) {\n this.logDebug(`Companion introspection \"${target.behavior}\" on \"${target.serviceKey}\" reported its own failure before the late-exit timer; its reason is kept`, {\n serviceKey: target.serviceKey,\n behavior: target.behavior,\n code,\n durationMs: Date.now() - startedAt,\n });\n finalize(resultBeforeLateExit);\n return;\n }\n if (resultBeforeLateExit !== null && code === 0) {\n // The evidence line: each one is a second or more this process could not attend to its child.\n this.logDebug(`Companion introspection \"${target.behavior}\" on \"${target.serviceKey}\" exited cleanly after the late-exit timer; its result is kept`, {\n serviceKey: target.serviceKey,\n behavior: target.behavior,\n durationMs: Date.now() - startedAt,\n });\n finalize(resultBeforeLateExit);\n return;\n }\n if (pendingFailure !== null) {\n finalize(pendingFailure);\n return;\n }\n if (parsedResult !== null && code === 0 && signal === null) {\n finalize(parsedResult);\n return;\n }\n if (parsedResult !== null && parsedResult.success === false) {\n finalize(parsedResult);\n return;\n }\n /*\n * A signal THIS SERVICE DID NOT SEND means the kill came from outside, and saying so is the\n * difference between an actionable message and a misleading one.\n *\n * Every termination this service performs goes through `requestTermination`, which sets\n * `pendingFailure` BEFORE killing — and the branch above returns that failure. So reaching\n * here with a termination signal proves nobody here asked for it: the child died because its\n * PARENT did, taking the process group with it.\n *\n * In a dev loop that is the supervisor restarting the companion. Measured 2026-09-02 across\n * four session logs: 30 such failures at a median of 11.4 s — nowhere near the 30 s ceiling —\n * and the line immediately preceding each one is\n * `[runtime-supervisor:wildo-dev-companion] Stopping runtime before readiness...`.\n *\n * The old message named the subprocess as the thing that exited, which is true and useless:\n * it reads as a fault in the derivation, and `signal=SIGTERM` beside a 30 s timeout constant\n * reads as that timeout firing. It cost a full investigation before the log said otherwise.\n */\n const terminatedFromOutside = wasTerminatedFromOutside({\n signal,\n hasPendingFailure: pendingFailure !== null,\n hasParsedResult: parsedResult !== null,\n });\n\n finalize(this.buildFailureResult(target, startedAt, terminatedFromOutside\n ? {\n message: `Companion introspection was terminated by ${signal} that this service did not send — the companion process itself is stopping, so the derivation was cut short rather than failing. Re-run it once the companion is ready.`,\n name: INTROSPECTION_PARENT_TERMINATED_ERROR_NAME,\n }\n : {\n message: parsedResult === null\n ? `Companion introspection subprocess exited before returning a result (code=${code ?? 'null'}, signal=${signal ?? 'null'})${outputContext ? ` — ${describeOutputContext(outputContext)}` : ''}.`\n : `Companion introspection subprocess returned a result then exited unsuccessfully (code=${code ?? 'null'}, signal=${signal ?? 'null'}).`,\n name: 'CompanionIntrospectionSubprocessExitError',\n }));\n };\n\n const timeoutHandle = setTimeout(() => {\n requestTermination(this.buildFailureResult(target, startedAt, {\n message: `Companion introspection timed out after ${this.timeoutMs}ms.`,\n name: 'CompanionIntrospectionTimeoutError',\n }));\n }, this.timeoutMs);\n\n child.on('spawn', onSpawn);\n child.on('message', onMessage);\n child.on('error', onError);\n // `close`, unlike `message` or `exit`, proves that the process and its\n // stdio handles are all quiescent. The parent never releases its queue\n // slot while the child can still emit output or fail late.\n child.on('close', onClose);\n });\n }\n\n private buildChildRequest(\n target: CompanionIntrospectionResolvedTarget,\n ): CompanionIntrospectionChildRequest {\n return {\n behavior: target.behavior,\n serviceKind: target.serviceKind,\n behaviorCategory: target.behaviorCategory,\n materializationKind: target.materializationKind,\n targetId: target.targetId,\n serviceKey: target.serviceKey,\n entryPath: target.entryPath,\n packageRoot: target.packageRoot,\n homes: this.buildChildHomesSnapshot(),\n resolvedTargets: target.resolvedTargets,\n input: target.input,\n };\n }\n\n /**\n * Resolve subprocess launch paths from THIS MODULE's own location, never from\n * `companionHome/src`. Under dist-only delivery (issue #64) the application's\n * `.wildo-saas/wildo-dev-companion` drop contains no source tree at all — the child runner and\n * the asset-noop register ship as COMPILED siblings of this service inside `dist/esm`, so the\n * only location that is guaranteed to hold them is the directory graph this very module runs\n * from. When the suite executes the source directly (vitest resolves the `.ts` module), the\n * sibling files are the authored `.ts` sources and the child is executable because the spawn\n * always registers `tsx` before the register hook. `cwd` stays the application's companion\n * home: the child resolves app packages and `node_modules` (including `tsx` itself) from there.\n */\n private resolveSubprocessLaunchContext(): {\n cwd: string;\n runnerPath: string;\n assetNoopRegisterPath: string;\n readTrackingPath: string;\n } {\n const isSourceExecution = import.meta.url.endsWith('.ts');\n const subprocessDir = fileURLToPath(new URL('../subprocess/', import.meta.url));\n return {\n cwd: this.companionContext.companionHome,\n runnerPath: join(subprocessDir, isSourceExecution ? 'companion-introspection-child.ts' : 'companion-introspection-child.js'),\n assetNoopRegisterPath: join(subprocessDir, isSourceExecution ? 'asset-noop-register.ts' : 'asset-noop-register.js'),\n readTrackingPath: join(subprocessDir, isSourceExecution ? 'derivation-read-tracking.ts' : 'derivation-read-tracking.js'),\n };\n }\n\n private buildChildHomesSnapshot(): CompanionIntrospectionHomesSnapshot {\n const appLayout = this.companionContext.resolvedHomes.app.layout;\n if (!appLayout) {\n throw new Error('Companion introspection requires an app layout in the trusted homes snapshot.');\n }\n\n return {\n appDeclarationRoot: appLayout.declarationRoot,\n appRuntimeHome: appLayout.runtimeHome,\n companionHome: this.companionContext.companionHome,\n frameworkRepositoryRoot: this.companionContext.resolvedHomes.framework.repositoryRoot,\n };\n }\n\n private resolveCompanionTargets(\n serviceDefinition: CompanionContext['servicesByKey'][string],\n ): Partial<Record<CompanionIntrospectionRouteTargetId, CompanionIntrospectionResolvedPackageTarget>> {\n const sharedLibrary = this.companionContext.resolvedLibraries.shared;\n const resolvedLibraryTarget = sharedLibrary?.libraryType === AppLibraryType.FULLSTACK\n ? {\n targetId: 'library' as const,\n packageRoot: sharedLibrary.packageRoot,\n entryPath: sharedLibrary.entryPath,\n declaredPath: sharedLibrary.declaredPath,\n }\n : undefined;\n\n return {\n service: this.tryResolveCompanionTarget('service', serviceDefinition.path),\n library: resolvedLibraryTarget,\n specifications: this.companionContext.resolvedSpecifications\n ? {\n targetId: 'specifications',\n packageRoot: this.companionContext.resolvedSpecifications.packageRoot,\n entryPath: this.companionContext.resolvedSpecifications.entryPath,\n declaredPath: this.companionContext.resolvedSpecifications.declaredPath,\n }\n : undefined,\n };\n }\n\n private tryResolveCompanionTarget(\n targetId: CompanionIntrospectionRouteTargetId,\n declaredPath: string,\n ): CompanionIntrospectionResolvedPackageTarget | undefined {\n const packageRoot = resolve(this.companionContext.saasRoot, declaredPath);\n\n try {\n return {\n targetId,\n packageRoot,\n entryPath: resolvePackageCompanionEntryPath(packageRoot),\n declaredPath,\n };\n } catch {\n return undefined;\n }\n }\n\n private buildFailureResult(\n target: CompanionIntrospectionResolvedTarget,\n startedAt: number,\n error: CompanionIntrospectionErrorDetails,\n ): CompanionIntrospectionFailureResult {\n return {\n success: false,\n behavior: target.behavior,\n serviceKey: target.serviceKey,\n serviceKind: target.serviceKind,\n behaviorCategory: target.behaviorCategory,\n materializationKind: target.materializationKind,\n targetId: target.targetId,\n durationMs: Date.now() - startedAt,\n error,\n };\n }\n}\n\n/**\n * The package roots a derivation's subprocess can import directly: its service, and every resolved\n * target it is handed (#2245). De-duplicated; the state service extends it with their dependencies.\n */\nexport function resolveDerivationTargetPackageRoots(target: Pick<CompanionIntrospectionResolvedTarget, 'servicePath' | 'packageRoot' | 'resolvedTargets'>): readonly string[] {\n const roots = new Set<string>([target.servicePath, target.packageRoot]);\n for (const resolved of Object.values(target.resolvedTargets)) {\n if (resolved !== undefined) roots.add(resolved.packageRoot);\n }\n return [...roots].sort();\n}\n\n/** Every entry a derivation's child imports natively: its route's and every resolved target's. */\nfunction resolveDerivationTargetEntryPaths(target: Pick<CompanionIntrospectionResolvedTarget, 'entryPath' | 'resolvedTargets'>): readonly string[] {\n const entries = new Set<string>([target.entryPath]);\n for (const resolved of Object.values(target.resolvedTargets)) {\n if (resolved !== undefined) entries.add(resolved.entryPath);\n }\n return [...entries];\n}\n\n/**\n * The argv of an introspection child, one-shot or pooled.\n *\n * `--disable-warning=DEP0205` silences tsx's own deprecation warning at the SOURCE: `tsx` registers its ESM\n * hooks through `module.register()`, which Node 26 deprecates. The warning said nothing about the\n * application and dominated the child's stderr, the one place a reader looks to find out what an\n * introspection did. Scoped to that one code, so a genuine future deprecation still surfaces. `tsx` itself\n * is preloaded only when the child needs it (see {@link introspectionChildNeedsTypeScriptLoader}).\n */\nexport function buildIntrospectionChildArguments(\n launchContext: { readonly runnerPath: string; readonly assetNoopRegisterPath: string; readonly readTrackingPath?: string },\n needsTypeScriptLoader: boolean,\n): string[] {\n return [\n '--disable-warning=DEP0205',\n ...(needsTypeScriptLoader ? ['--import', 'tsx'] : []),\n '--import',\n launchContext.assetNoopRegisterPath,\n // Last, so its hooks run first and see every resolution, assets included, and before any module of the child's\n // graph imports `node:fs` (#3207, `derivation-read-tracking.ts`).\n ...(launchContext.readTrackingPath === undefined ? [] : ['--import', launchContext.readTrackingPath]),\n launchContext.runnerPath,\n ];\n}\n"]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type DependencyInstallStatus } from '@wildo-ai/platform-core-shared/dev-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* An introspection derivation survives a dependency install under the live companion (#3703).
|
|
4
|
+
*
|
|
5
|
+
* ## Why
|
|
6
|
+
*
|
|
7
|
+
* Every derivation runs in a child process that resolves its packages (`zod` first, then the engine and the
|
|
8
|
+
* application) from the application's `node_modules` AT THE MOMENT IT STARTS. The companion process itself loaded
|
|
9
|
+
* its graph long before, so it keeps running while a `pnpm install` re-creates that tree under it, but every child
|
|
10
|
+
* started during the install dies on its first bare import. Reference run 42886943490 (2026-11-09) logged 788 such
|
|
11
|
+
* failures in six windows of 6 s to 2.5 min, every one `ERR_MODULE_NOT_FOUND: Cannot find package 'zod' imported from
|
|
12
|
+
* …/companion-introspection-child.js`: a foundation install, a monorepo reinjection (`[sync] reinjecting via pnpm`,
|
|
13
|
+
* which writes no install record), and installs nobody recorded (the backend's compile lost `react/jsx-runtime` and
|
|
14
|
+
* `@types/node` at the same instant, which is a tree being re-created, not a missing declaration). Each failure read as
|
|
15
|
+
* "unanswerable" to a landing probe, and held the build's labels step.
|
|
16
|
+
*
|
|
17
|
+
* #3552 taught the supervisors and the compile watchers to wait an install out; nothing taught this lane, whose
|
|
18
|
+
* children are started on demand rather than supervised.
|
|
19
|
+
*
|
|
20
|
+
* ## The two decisions
|
|
21
|
+
*
|
|
22
|
+
* 1. **Before a derivation starts**, {@link IntrospectionDependencyTreeGate.holdWhileInstallInFlight}: while a RECORDED
|
|
23
|
+
* install is in flight (the #3552 record, written by the foundation step and the CLI), start nothing. The record's
|
|
24
|
+
* own deadline and writer liveness bound the wait (`classifyDependencyInstall`).
|
|
25
|
+
* 2. **After a derivation failed**, {@link IntrospectionDependencyTreeGate.settleAfterFailure}: when the failure is a
|
|
26
|
+
* bare package the importer DECLARES that the resolver could not find, the tree was in motion. Wait until that
|
|
27
|
+
* package resolves again from that importer (and no recorded install is in flight), then the caller derives once
|
|
28
|
+
* more, in a process started after the tree settled. This covers the installs nobody recorded, because it asks the
|
|
29
|
+
* file system the same question Node's resolver asked rather than trusting a record.
|
|
30
|
+
*
|
|
31
|
+
* ## What is NOT waited for
|
|
32
|
+
*
|
|
33
|
+
* - A failure that names no unresolved package: every other failure is the derivation's own and is returned at once.
|
|
34
|
+
* - A package the importer does not declare: no install can make an undeclared import resolve, so it is a defect in
|
|
35
|
+
* the importing code, reported at once rather than after a wait.
|
|
36
|
+
* - The same package from the same importer once more, over the same installed tree: a wait that already ran to its
|
|
37
|
+
* ceiling is remembered against pnpm's `node_modules/.modules.yaml` time, so a package that is really missing (a
|
|
38
|
+
* lockfile that never installed it) costs one wait, not one per derivation. A later install moves that time and
|
|
39
|
+
* lifts the memory.
|
|
40
|
+
*/
|
|
41
|
+
/** A bare package the module resolver could not find, and the file that imported it. */
|
|
42
|
+
export interface UnresolvedPackageImport {
|
|
43
|
+
readonly packageName: string;
|
|
44
|
+
readonly importerPath: string;
|
|
45
|
+
}
|
|
46
|
+
/** What the gate concluded about a failed derivation. */
|
|
47
|
+
export declare enum DependencyTreeSettleVerdict {
|
|
48
|
+
/** The failure names no unresolved bare package: it is the derivation's own, and stands. */
|
|
49
|
+
NOT_A_DEPENDENCY_FAILURE = "NOT_A_DEPENDENCY_FAILURE",
|
|
50
|
+
/** The package is not one its importer declares: no install will bring it, so the failure stands. */
|
|
51
|
+
UNDECLARED_PACKAGE = "UNDECLARED_PACKAGE",
|
|
52
|
+
/** The package resolves again and no recorded install is running: derive once more, in a fresh process. */
|
|
53
|
+
SETTLED = "SETTLED",
|
|
54
|
+
/** The package still does not resolve after the ceiling (or did not over this same tree before): the failure stands. */
|
|
55
|
+
STILL_UNRESOLVED = "STILL_UNRESOLVED"
|
|
56
|
+
}
|
|
57
|
+
export interface DependencyTreeSettleOutcome {
|
|
58
|
+
readonly verdict: DependencyTreeSettleVerdict;
|
|
59
|
+
readonly unresolved?: UnresolvedPackageImport;
|
|
60
|
+
readonly waitedMs: number;
|
|
61
|
+
/** When the tree was judged settled ({@link DependencyTreeSettleVerdict.SETTLED} only): a process started before it may hold the moved tree. */
|
|
62
|
+
readonly settledAtMs?: number;
|
|
63
|
+
}
|
|
64
|
+
/** How often the gate re-reads the record and the resolver's answer while it waits. */
|
|
65
|
+
export declare const DEPENDENCY_TREE_POLL_MS = 1000;
|
|
66
|
+
/**
|
|
67
|
+
* The longest the gate waits for a package to resolve again when no recorded install explains the gap.
|
|
68
|
+
*
|
|
69
|
+
* The longest window measured (reference run 42886943490, 18:35:50 → 18:38:20) was 2.5 min, a reinjection that failed
|
|
70
|
+
* and was retried several times. Twice that leaves room for a slower host, and a package that is really missing pays it
|
|
71
|
+
* once (see the memory above). A RECORDED install extends the wait to its own deadline instead.
|
|
72
|
+
*/
|
|
73
|
+
export declare const DEPENDENCY_TREE_SETTLE_CEILING_MS: number;
|
|
74
|
+
/**
|
|
75
|
+
* The package name of a BARE specifier (`zod`, `zod/v4` → `zod`; `@scope/pkg/sub` → `@scope/pkg`), or null for a
|
|
76
|
+
* relative, absolute, URL or builtin specifier, which no install moves.
|
|
77
|
+
*/
|
|
78
|
+
export declare function packageNameOfBareSpecifier(specifier: string): string | null;
|
|
79
|
+
/** The unresolved bare package a failure text names, or null when it names none. */
|
|
80
|
+
export declare function findUnresolvedPackageImport(text: string): UnresolvedPackageImport | null;
|
|
81
|
+
/**
|
|
82
|
+
* Whether `packageName` resolves from `importerPath` the way Node's resolver looks for it: the first
|
|
83
|
+
* `node_modules/<name>/package.json` found walking up from the importer's directory. `existsSync` follows the symlink
|
|
84
|
+
* pnpm links a package through, so a link whose target is being re-created reads as absent, which is exactly the gap.
|
|
85
|
+
*/
|
|
86
|
+
export declare function isPackageResolvableFrom(packageName: string, importerPath: string, exists?: (path: string) => boolean): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the importer's own package DECLARES `packageName`: the nearest `package.json` above it that has a `name` (a
|
|
89
|
+
* `dist/esm/package.json` carrying only `"type"` is not a package boundary for this question).
|
|
90
|
+
*/
|
|
91
|
+
export declare function importerDeclaresPackage(packageName: string, importerPath: string, readText?: (path: string) => string | null): boolean;
|
|
92
|
+
export interface IntrospectionDependencyTreeGateOptions {
|
|
93
|
+
/** The application root: where the #3552 install record and pnpm's `.modules.yaml` live. */
|
|
94
|
+
readonly appRoot: string;
|
|
95
|
+
readonly log?: (message: string, context?: Record<string, unknown>) => void;
|
|
96
|
+
/** Test seams; production reads the record, the file system and the clock. */
|
|
97
|
+
readonly readInstall?: () => DependencyInstallStatus;
|
|
98
|
+
readonly readNodeModulesInstalledAtMs?: () => number | null;
|
|
99
|
+
readonly isResolvable?: (unresolved: UnresolvedPackageImport) => boolean;
|
|
100
|
+
readonly declares?: (unresolved: UnresolvedPackageImport) => boolean;
|
|
101
|
+
readonly now?: () => number;
|
|
102
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
103
|
+
readonly pollMs?: number;
|
|
104
|
+
readonly settleCeilingMs?: number;
|
|
105
|
+
}
|
|
106
|
+
/** See the module comment. One per companion introspection service. */
|
|
107
|
+
export declare class IntrospectionDependencyTreeGate {
|
|
108
|
+
private readonly options;
|
|
109
|
+
private readonly readInstall;
|
|
110
|
+
private readonly readInstalledAtMs;
|
|
111
|
+
private readonly isResolvable;
|
|
112
|
+
private readonly declares;
|
|
113
|
+
private readonly now;
|
|
114
|
+
private readonly sleep;
|
|
115
|
+
private readonly pollMs;
|
|
116
|
+
private readonly settleCeilingMs;
|
|
117
|
+
/** `<package>\0<importer>` → the `.modules.yaml` time over which a wait for it already ran out. */
|
|
118
|
+
private readonly exhausted;
|
|
119
|
+
constructor(options: IntrospectionDependencyTreeGateOptions);
|
|
120
|
+
/** Wait while a recorded install is in flight; returns how long it waited. Bounded by the record's deadline. */
|
|
121
|
+
holdWhileInstallInFlight(): Promise<number>;
|
|
122
|
+
/**
|
|
123
|
+
* Judge a failed derivation's text (its error message and stderr). Waits only when the failure is a declared
|
|
124
|
+
* package the resolver could not find; see the module comment for every case.
|
|
125
|
+
*/
|
|
126
|
+
settleAfterFailure(failureText: string): Promise<DependencyTreeSettleOutcome>;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=introspection-dependency-tree.companion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspection-dependency-tree.companion.d.ts","sourceRoot":"","sources":["../../../../../src/core/introspection/services/introspection-dependency-tree.companion.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,4CAA4C,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,wFAAwF;AACxF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,yDAAyD;AACzD,oBAAY,2BAA2B;IACrC,4FAA4F;IAC5F,wBAAwB,6BAA6B;IACrD,qGAAqG;IACrG,kBAAkB,uBAAuB;IACzC,2GAA2G;IAC3G,OAAO,YAAY;IACnB,wHAAwH;IACxH,gBAAgB,qBAAqB;CACtC;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,2BAA2B,CAAC;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,uBAAuB,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gJAAgJ;IAChJ,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,uFAAuF;AACvF,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC,QAAa,CAAC;AAQ5D;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAO3E;AAED,oFAAoF;AACpF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAQxF;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAE,CAAC,IAAI,E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