@wildo-ai/dev-companion 1.1.13 → 1.1.15
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 +89 -1
- 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 +114 -9
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +46 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +39 -2
- package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
- package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts +6 -0
- package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.js.map +1 -1
- package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts +19 -5
- package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/verification-tool-availability.models.js +17 -5
- package/dist/esm/claude-cli/models/verification-tool-availability.models.js.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +16 -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 +53 -6
- 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 +145 -6
- 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 +474 -47
- 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/claude-cli/services/research-evidence-store.companion.d.ts +14 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +35 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts +36 -0
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts.map +1 -0
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js +134 -0
- package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js.map +1 -0
- 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 +7 -0
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +26 -12
- 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 +12 -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/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/translation-placement.companion.service.d.ts +3 -2
- package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/translation-placement.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +24 -14
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
- package/dist/esm/core/introspection/workspace-element-index.companion.d.ts +42 -0
- package/dist/esm/core/introspection/workspace-element-index.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/workspace-element-index.companion.js +42 -0
- package/dist/esm/core/introspection/workspace-element-index.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/dev-compile-quiet.companion.d.ts +53 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js +119 -2
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
- 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 +16 -3
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +2 -2
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +6 -6
- package/dist/esm/core/runtime/utils/companion-platform-config.companion.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/email/services/email-template.companion.service.d.ts +5 -0
- package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
- package/dist/esm/email/services/email-template.companion.service.js +44 -11
- package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
- package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts +26 -2
- package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
- package/dist/esm/email/utils/email-template-fs-discovery.utils.js +41 -2
- package/dist/esm/email/utils/email-template-fs-discovery.utils.js.map +1 -1
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts +19 -0
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts.map +1 -0
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js +171 -0
- package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js.map +1 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.d.ts +75 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.d.ts.map +1 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.js +162 -0
- package/dist/esm/email/utils/module-email-root.companion.utils.js.map +1 -0
- 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_AGENT_CONFIG.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js.map +1 -1
- 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/workbenchAspects.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchAspects.en.js +4 -0
- package/dist/esm/i18n/resources/workbenchAspects.en.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 +35 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +12 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +536 -531
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +536 -531
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +170 -170
- package/dist/esm/i18n/system_enums/application-creation.fr.js +170 -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 -2
- 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 -2
- 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/email-template-labelling-units.companion.service.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +7 -3
- package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.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/creation-journey-timeline.models.d.ts +9 -0
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +18 -2
- package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +153 -22
- 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 +970 -208
- 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 +115 -13
- 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 +295 -56
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.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 +1 -1
- 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 +48 -26
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts +12 -0
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js +30 -1
- package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.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.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +12 -1
- 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 +8 -1
- 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 +119 -25
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts +55 -1
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js +157 -10
- package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js.map +1 -1
- package/dist/esm/module-layout/module-layout-convention.companion.d.ts +158 -0
- package/dist/esm/module-layout/module-layout-convention.companion.d.ts.map +1 -0
- package/dist/esm/module-layout/module-layout-convention.companion.js +272 -0
- package/dist/esm/module-layout/module-layout-convention.companion.js.map +1 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.d.ts +42 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.d.ts.map +1 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.js +290 -0
- package/dist/esm/module-layout/module-layout-inspection.companion.js.map +1 -0
- package/dist/esm/module-layout/module-source-files.companion.d.ts +3 -0
- package/dist/esm/module-layout/module-source-files.companion.d.ts.map +1 -0
- package/dist/esm/module-layout/module-source-files.companion.js +45 -0
- package/dist/esm/module-layout/module-source-files.companion.js.map +1 -0
- package/package.json +18 -18
|
@@ -14,6 +14,18 @@ import { DomainPlanTenancyModel } from '@wildo-ai/saas-specifications/applicatio
|
|
|
14
14
|
*/
|
|
15
15
|
/** Where the application's compiled skill catalogue is installed, relative to its root. */
|
|
16
16
|
export declare const INSTALLED_SKILL_INDEX_RELATIVE_PATH = ".claude/skills/INDEX.md";
|
|
17
|
+
/** The coding brief source that carries {@link sliceSkillIndexForTask}'s slice. */
|
|
18
|
+
export declare const SKILL_INDEX_BRIEF_SOURCE_REF = "application-creation:context/skill-index";
|
|
19
|
+
/**
|
|
20
|
+
* The skills a brief's skill-index source DESCRIBES (#3892): every skill named in its routed domains, which the slice
|
|
21
|
+
* carries with their trigger phrases. The agent's native listing then lists these by name only, so each skill is
|
|
22
|
+
* described once. Reads the brief's own content, so a source the context budget dropped describes nothing and every
|
|
23
|
+
* skill keeps its native description. The other domains are carried by heading only and describe no skill.
|
|
24
|
+
*/
|
|
25
|
+
export declare function skillsDescribedBySkillIndexSource(sources: readonly {
|
|
26
|
+
readonly sourceRef: string;
|
|
27
|
+
readonly content?: unknown;
|
|
28
|
+
}[]): string[];
|
|
17
29
|
/**
|
|
18
30
|
* The skill index as a worker needs it: the full sections of the DOMAINS its routed skills belong to (every sibling
|
|
19
31
|
* skill there, with its trigger phrases), and the heading of every other domain, so a skill the decomposer did not name
|
package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-task-brief-application-facts.companion.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/build-task-brief-application-facts.companion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE5F;;;;;;;;;;;GAWG;AAEH,2FAA2F;AAC3F,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"build-task-brief-application-facts.companion.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/build-task-brief-application-facts.companion.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE5F;;;;;;;;;;;GAWG;AAEH,2FAA2F;AAC3F,eAAO,MAAM,mCAAmC,4BAA4B,CAAC;AAE7E,mFAAmF;AACnF,eAAO,MAAM,4BAA4B,6CAA6C,CAAC;AAKvF;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,SAAS;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,MAAM,EAAE,CAW1I;AAuCD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG;IAC3F,QAAQ,CAAC,aAAa,EAAE,SAAS;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxF,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C,GAAG,SAAS,CAQZ;AAED,kGAAkG;AAClG,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,0GAA0G;IAC1G,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACjD,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IAC1C,uGAAuG;IACvG,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;;;;GAMG;AAOH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAC3C,GAAG,0BAA0B,CAyB7B"}
|
|
@@ -15,6 +15,31 @@ import { DomainPlanTenancyModel } from '@wildo-ai/saas-specifications/applicatio
|
|
|
15
15
|
*/
|
|
16
16
|
/** Where the application's compiled skill catalogue is installed, relative to its root. */
|
|
17
17
|
export const INSTALLED_SKILL_INDEX_RELATIVE_PATH = '.claude/skills/INDEX.md';
|
|
18
|
+
/** The coding brief source that carries {@link sliceSkillIndexForTask}'s slice. */
|
|
19
|
+
export const SKILL_INDEX_BRIEF_SOURCE_REF = 'application-creation:context/skill-index';
|
|
20
|
+
/** A skill as the index names it: `**\`<id>\`**`, or `\`<id>\` _(redirect …)` for a renamed one. */
|
|
21
|
+
const SKILL_INDEX_ENTRY = /\*\*`([a-z0-9][a-z0-9-]*)`\*\*|`([a-z0-9][a-z0-9-]*)` _\(redirect/g;
|
|
22
|
+
/**
|
|
23
|
+
* The skills a brief's skill-index source DESCRIBES (#3892): every skill named in its routed domains, which the slice
|
|
24
|
+
* carries with their trigger phrases. The agent's native listing then lists these by name only, so each skill is
|
|
25
|
+
* described once. Reads the brief's own content, so a source the context budget dropped describes nothing and every
|
|
26
|
+
* skill keeps its native description. The other domains are carried by heading only and describe no skill.
|
|
27
|
+
*/
|
|
28
|
+
export function skillsDescribedBySkillIndexSource(sources) {
|
|
29
|
+
const source = sources.find((candidate) => candidate.sourceRef === SKILL_INDEX_BRIEF_SOURCE_REF);
|
|
30
|
+
const routedDomains = source?.content?.routedDomains;
|
|
31
|
+
if (!Array.isArray(routedDomains))
|
|
32
|
+
return [];
|
|
33
|
+
const names = new Set();
|
|
34
|
+
for (const domain of routedDomains) {
|
|
35
|
+
const skills = domain?.skills;
|
|
36
|
+
if (typeof skills !== 'string')
|
|
37
|
+
continue;
|
|
38
|
+
for (const name of skillsNamedIn(skills))
|
|
39
|
+
names.add(name);
|
|
40
|
+
}
|
|
41
|
+
return [...names];
|
|
42
|
+
}
|
|
18
43
|
/** The `### …` sections under the index's `## Domains` heading, in authored order. */
|
|
19
44
|
function readDomainSections(indexMarkdown) {
|
|
20
45
|
const start = indexMarkdown.search(/^## Domains\s*$/m);
|
|
@@ -38,7 +63,11 @@ function readDomainSections(indexMarkdown) {
|
|
|
38
63
|
* review F8): a task routed to one belongs to that domain as much as to the skill it redirects to.
|
|
39
64
|
*/
|
|
40
65
|
function sectionListsSkill(section, skillRef) {
|
|
41
|
-
return section.body
|
|
66
|
+
return skillsNamedIn(section.body).includes(skillRef);
|
|
67
|
+
}
|
|
68
|
+
/** Every skill an index text names, by {@link SKILL_INDEX_ENTRY}: the one reading of the generator's row format. */
|
|
69
|
+
function skillsNamedIn(text) {
|
|
70
|
+
return [...text.matchAll(SKILL_INDEX_ENTRY)].map((match) => (match[1] ?? match[2]));
|
|
42
71
|
}
|
|
43
72
|
/**
|
|
44
73
|
* The skill index as a worker needs it: the full sections of the DOMAINS its routed skills belong to (every sibling
|
package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-task-brief-application-facts.companion.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/build-task-brief-application-facts.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE5F;;;;;;;;;;;GAWG;AAEH,2FAA2F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,KAAK,CAAC,aAAa,EAAE,UAAU,EAAE,CAAC,CAAC;QACpH,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACxF,CAAC;IACD,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,KAAK,sBAAsB,CAAC,aAAa,IAAI,CAAC,eAAe;QAC9F,CAAC,CAAC,yIAAyI;cACvI,qJAAqJ;QACzJ,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,sBAAsB,CAAC,KAAK,IAAI,eAAe;YACjE,CAAC,CAAC,gJAAgJ;kBAC9I,0EAA0E;YAC9E,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,WAAW,GAAG,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACpE,OAAO;QACL,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;QACrD,OAAO;QACP,QAAQ;QACR,UAAU;QACV,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAClE,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC","sourcesContent":["import { readApplicationDisplayName, readEngineCapabilityEnabled } from '@wildo-ai/application-creation-runtime';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport { DomainPlanTenancyModel } from '@wildo-ai/saas-specifications/application-creation';\n\n/**\n * Two facts a coding worker could not see, measured over ~100 coding runs of app-creation-test-005 (#2495):\n *\n * - **Which skills exist beyond the ones it was handed.** The skill index was opened 0 times; where the routed\n * `skillRefs` fell short, workers read the engine's compiled `dist` instead (55% of tool calls on seed tasks).\n * - **What the application has turned on.** 005 shipped `ORGANIZATIONS` disabled with every resource\n * organization-scoped and organization roles on every operation, and no worker had a way to see the contradiction.\n *\n * Both are DERIVED here from what the application already carries — its installed `.claude/skills/INDEX.md` and its\n * `wildo.saas.config.ts` — never a hand-kept list, so a skill or a capability added tomorrow reaches the brief the day it\n * exists.\n */\n\n/** Where the application's compiled skill catalogue is installed, relative to its root. */\nexport const INSTALLED_SKILL_INDEX_RELATIVE_PATH = '.claude/skills/INDEX.md';\n\n/** One `### <domain>` section of the skill index. */\ninterface SkillIndexSection {\n readonly heading: string;\n readonly body: string;\n}\n\n/** The `### …` sections under the index's `## Domains` heading, in authored order. */\nfunction readDomainSections(indexMarkdown: string): readonly SkillIndexSection[] {\n const start = indexMarkdown.search(/^## Domains\\s*$/m);\n if (start < 0) return [];\n const afterDomains = indexMarkdown.slice(start).split('\\n').slice(1).join('\\n');\n // The domains end at the next second-level heading (`## Notes`).\n const end = afterDomains.search(/^## /m);\n const domains = end < 0 ? afterDomains : afterDomains.slice(0, end);\n return domains\n .split(/^(?=### )/m)\n .filter((chunk) => chunk.startsWith('### '))\n .map((chunk) => {\n const [headingLine, ...rest] = chunk.split('\\n');\n return { heading: headingLine!.replace(/^### /, '').trim(), body: rest.join('\\n').trim() };\n });\n}\n\n/**\n * Whether a section lists the skill `skillRef` as one of its rows. The index bolds each id in backticks; a REDIRECT row\n * (an older id kept as an installed folder) is written `` `id` _(redirect → …)_ ``, unbolded, and counts too (#2495\n * review F8): a task routed to one belongs to that domain as much as to the skill it redirects to.\n */\nfunction sectionListsSkill(section: SkillIndexSection, skillRef: string): boolean {\n return section.body.includes(`**\\`${skillRef}\\`**`) || section.body.includes(`\\`${skillRef}\\` _(redirect`);\n}\n\n/**\n * The skill index as a worker needs it: the full sections of the DOMAINS its routed skills belong to (every sibling\n * skill there, with its trigger phrases), and the heading of every other domain, so a skill the decomposer did not name\n * can still be found. `undefined` when the application has no installed index or it holds no domain section.\n */\nexport function sliceSkillIndexForTask(indexMarkdown: string, skillRefs: readonly string[]): {\n readonly routedDomains: readonly { readonly domain: string; readonly skills: string }[];\n readonly otherDomains: readonly string[];\n} | undefined {\n const sections = readDomainSections(indexMarkdown);\n if (sections.length === 0) return undefined;\n const routed = sections.filter((section) => skillRefs.some((skillRef) => sectionListsSkill(section, skillRef)));\n return {\n routedDomains: routed.map((section) => ({ domain: section.heading, skills: section.body })),\n otherDomains: sections.filter((section) => !routed.includes(section)).map((section) => section.heading),\n };\n}\n\n/** What the application's configuration turns on, and how the domain plan partitions its data. */\nexport interface ApplicationCapabilityFacts {\n readonly displayName?: string;\n /** Every engine capability, read from `engineCapabilities`: enabled, disabled, or not declared at all. */\n readonly enabled: readonly EngineCapability[];\n readonly disabled: readonly EngineCapability[];\n readonly undeclared: readonly EngineCapability[];\n /** The domain plan's tenancy decision, when it made one. */\n readonly tenancy?: DomainPlanTenancyModel;\n /** A contradiction between the two, stated so the worker raises it instead of building on one half. */\n readonly contradiction?: string;\n}\n\n/**\n * The application's capability facts, total over `EngineCapability` (a capability added to the vocabulary is reported\n * the day it exists). Tenancy is the domain plan's decision; an organization-tenancy plan beside a disabled\n * `ORGANIZATIONS` capability is the contradiction 005 shipped. Neither half is corrected here, which one is wrong is not\n * this brief's to decide; the worker is told what it may build on (organization scoping needs the capability; a USERS\n * plan says scope to the user) and to report the mismatch.\n */\n/*\n * Read with the same predicate the `engine-capabilities` step writes with (#2497), so the two agree. It reads a literal\n * `[EngineCapability.X]: { enabled: … }` entry (every application measured declares them that way); an entry reached\n * through an imported spread or a bare string key reads as undeclared, and an imported whole object makes the read\n * throw, which drops this source with a WARN.\n */\nexport function readApplicationCapabilityFacts(input: {\n readonly configContent: string;\n readonly configPath: string;\n readonly tenancy?: DomainPlanTenancyModel;\n}): ApplicationCapabilityFacts {\n const enabled: EngineCapability[] = [];\n const disabled: EngineCapability[] = [];\n const undeclared: EngineCapability[] = [];\n for (const capability of Object.values(EngineCapability)) {\n const state = readEngineCapabilityEnabled({ filePath: input.configPath, content: input.configContent, capability });\n (state === true ? enabled : state === false ? disabled : undeclared).push(capability);\n }\n const organizationsOn = enabled.includes(EngineCapability.ORGANIZATIONS);\n const contradiction = input.tenancy === DomainPlanTenancyModel.ORGANIZATIONS && !organizationsOn\n ? 'The domain plan partitions data by ORGANIZATION, and the configuration does not enable ORGANIZATIONS. Do not resolve this by guessing: '\n + 'organization-scoped resources and organization roles assume the capability. Report it in your result so the plan or the configuration is corrected.'\n : input.tenancy === DomainPlanTenancyModel.USERS && organizationsOn\n ? 'The domain plan keeps every user\\'s data their own (USERS tenancy), and the configuration enables ORGANIZATIONS. Scope this task\\'s resources '\n + 'to the user as the plan decided, and report the mismatch in your result.'\n : undefined;\n const displayName = readApplicationDisplayName(input.configContent);\n return {\n ...(displayName === undefined ? {} : { displayName }),\n enabled,\n disabled,\n undeclared,\n ...(input.tenancy === undefined ? {} : { tenancy: input.tenancy }),\n ...(contradiction === undefined ? {} : { contradiction }),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"build-task-brief-application-facts.companion.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/build-task-brief-application-facts.companion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE5F;;;;;;;;;;;GAWG;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;AAE7E,mFAAmF;AACnF,MAAM,CAAC,MAAM,4BAA4B,GAAG,0CAA0C,CAAC;AAEvF,oG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K,sBAAsB,CAAC,aAAa,IAAI,CAAC,eAAe;QAC9F,CAAC,CAAC,yIAAyI;cACvI,qJAAqJ;QACzJ,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,sBAAsB,CAAC,KAAK,IAAI,eAAe;YACjE,CAAC,CAAC,gJAAgJ;kBAC9I,0EAA0E;YAC9E,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,WAAW,GAAG,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IACpE,OAAO;QACL,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;QACrD,OAAO;QACP,QAAQ;QACR,UAAU;QACV,GAAG,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAClE,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC","sourcesContent":["import { readApplicationDisplayName, readEngineCapabilityEnabled } from '@wildo-ai/application-creation-runtime';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport { DomainPlanTenancyModel } from '@wildo-ai/saas-specifications/application-creation';\n\n/**\n * Two facts a coding worker could not see, measured over ~100 coding runs of app-creation-test-005 (#2495):\n *\n * - **Which skills exist beyond the ones it was handed.** The skill index was opened 0 times; where the routed\n * `skillRefs` fell short, workers read the engine's compiled `dist` instead (55% of tool calls on seed tasks).\n * - **What the application has turned on.** 005 shipped `ORGANIZATIONS` disabled with every resource\n * organization-scoped and organization roles on every operation, and no worker had a way to see the contradiction.\n *\n * Both are DERIVED here from what the application already carries — its installed `.claude/skills/INDEX.md` and its\n * `wildo.saas.config.ts` — never a hand-kept list, so a skill or a capability added tomorrow reaches the brief the day it\n * exists.\n */\n\n/** Where the application's compiled skill catalogue is installed, relative to its root. */\nexport const INSTALLED_SKILL_INDEX_RELATIVE_PATH = '.claude/skills/INDEX.md';\n\n/** The coding brief source that carries {@link sliceSkillIndexForTask}'s slice. */\nexport const SKILL_INDEX_BRIEF_SOURCE_REF = 'application-creation:context/skill-index';\n\n/** A skill as the index names it: `**\\`<id>\\`**`, or `\\`<id>\\` _(redirect …)` for a renamed one. */\nconst SKILL_INDEX_ENTRY = /\\*\\*`([a-z0-9][a-z0-9-]*)`\\*\\*|`([a-z0-9][a-z0-9-]*)` _\\(redirect/g;\n\n/**\n * The skills a brief's skill-index source DESCRIBES (#3892): every skill named in its routed domains, which the slice\n * carries with their trigger phrases. The agent's native listing then lists these by name only, so each skill is\n * described once. Reads the brief's own content, so a source the context budget dropped describes nothing and every\n * skill keeps its native description. The other domains are carried by heading only and describe no skill.\n */\nexport function skillsDescribedBySkillIndexSource(sources: readonly { readonly sourceRef: string; readonly content?: unknown }[]): string[] {\n const source = sources.find((candidate) => candidate.sourceRef === SKILL_INDEX_BRIEF_SOURCE_REF);\n const routedDomains = (source?.content as { routedDomains?: unknown } | undefined)?.routedDomains;\n if (!Array.isArray(routedDomains)) return [];\n const names = new Set<string>();\n for (const domain of routedDomains) {\n const skills = (domain as { skills?: unknown } | null)?.skills;\n if (typeof skills !== 'string') continue;\n for (const name of skillsNamedIn(skills)) names.add(name);\n }\n return [...names];\n}\n\n/** One `### <domain>` section of the skill index. */\ninterface SkillIndexSection {\n readonly heading: string;\n readonly body: string;\n}\n\n/** The `### …` sections under the index's `## Domains` heading, in authored order. */\nfunction readDomainSections(indexMarkdown: string): readonly SkillIndexSection[] {\n const start = indexMarkdown.search(/^## Domains\\s*$/m);\n if (start < 0) return [];\n const afterDomains = indexMarkdown.slice(start).split('\\n').slice(1).join('\\n');\n // The domains end at the next second-level heading (`## Notes`).\n const end = afterDomains.search(/^## /m);\n const domains = end < 0 ? afterDomains : afterDomains.slice(0, end);\n return domains\n .split(/^(?=### )/m)\n .filter((chunk) => chunk.startsWith('### '))\n .map((chunk) => {\n const [headingLine, ...rest] = chunk.split('\\n');\n return { heading: headingLine!.replace(/^### /, '').trim(), body: rest.join('\\n').trim() };\n });\n}\n\n/**\n * Whether a section lists the skill `skillRef` as one of its rows. The index bolds each id in backticks; a REDIRECT row\n * (an older id kept as an installed folder) is written `` `id` _(redirect → …)_ ``, unbolded, and counts too (#2495\n * review F8): a task routed to one belongs to that domain as much as to the skill it redirects to.\n */\nfunction sectionListsSkill(section: SkillIndexSection, skillRef: string): boolean {\n return skillsNamedIn(section.body).includes(skillRef);\n}\n\n/** Every skill an index text names, by {@link SKILL_INDEX_ENTRY}: the one reading of the generator's row format. */\nfunction skillsNamedIn(text: string): string[] {\n return [...text.matchAll(SKILL_INDEX_ENTRY)].map((match) => (match[1] ?? match[2])!);\n}\n\n/**\n * The skill index as a worker needs it: the full sections of the DOMAINS its routed skills belong to (every sibling\n * skill there, with its trigger phrases), and the heading of every other domain, so a skill the decomposer did not name\n * can still be found. `undefined` when the application has no installed index or it holds no domain section.\n */\nexport function sliceSkillIndexForTask(indexMarkdown: string, skillRefs: readonly string[]): {\n readonly routedDomains: readonly { readonly domain: string; readonly skills: string }[];\n readonly otherDomains: readonly string[];\n} | undefined {\n const sections = readDomainSections(indexMarkdown);\n if (sections.length === 0) return undefined;\n const routed = sections.filter((section) => skillRefs.some((skillRef) => sectionListsSkill(section, skillRef)));\n return {\n routedDomains: routed.map((section) => ({ domain: section.heading, skills: section.body })),\n otherDomains: sections.filter((section) => !routed.includes(section)).map((section) => section.heading),\n };\n}\n\n/** What the application's configuration turns on, and how the domain plan partitions its data. */\nexport interface ApplicationCapabilityFacts {\n readonly displayName?: string;\n /** Every engine capability, read from `engineCapabilities`: enabled, disabled, or not declared at all. */\n readonly enabled: readonly EngineCapability[];\n readonly disabled: readonly EngineCapability[];\n readonly undeclared: readonly EngineCapability[];\n /** The domain plan's tenancy decision, when it made one. */\n readonly tenancy?: DomainPlanTenancyModel;\n /** A contradiction between the two, stated so the worker raises it instead of building on one half. */\n readonly contradiction?: string;\n}\n\n/**\n * The application's capability facts, total over `EngineCapability` (a capability added to the vocabulary is reported\n * the day it exists). Tenancy is the domain plan's decision; an organization-tenancy plan beside a disabled\n * `ORGANIZATIONS` capability is the contradiction 005 shipped. Neither half is corrected here, which one is wrong is not\n * this brief's to decide; the worker is told what it may build on (organization scoping needs the capability; a USERS\n * plan says scope to the user) and to report the mismatch.\n */\n/*\n * Read with the same predicate the `engine-capabilities` step writes with (#2497), so the two agree. It reads a literal\n * `[EngineCapability.X]: { enabled: … }` entry (every application measured declares them that way); an entry reached\n * through an imported spread or a bare string key reads as undeclared, and an imported whole object makes the read\n * throw, which drops this source with a WARN.\n */\nexport function readApplicationCapabilityFacts(input: {\n readonly configContent: string;\n readonly configPath: string;\n readonly tenancy?: DomainPlanTenancyModel;\n}): ApplicationCapabilityFacts {\n const enabled: EngineCapability[] = [];\n const disabled: EngineCapability[] = [];\n const undeclared: EngineCapability[] = [];\n for (const capability of Object.values(EngineCapability)) {\n const state = readEngineCapabilityEnabled({ filePath: input.configPath, content: input.configContent, capability });\n (state === true ? enabled : state === false ? disabled : undeclared).push(capability);\n }\n const organizationsOn = enabled.includes(EngineCapability.ORGANIZATIONS);\n const contradiction = input.tenancy === DomainPlanTenancyModel.ORGANIZATIONS && !organizationsOn\n ? 'The domain plan partitions data by ORGANIZATION, and the configuration does not enable ORGANIZATIONS. Do not resolve this by guessing: '\n + 'organization-scoped resources and organization roles assume the capability. Report it in your result so the plan or the configuration is corrected.'\n : input.tenancy === DomainPlanTenancyModel.USERS && organizationsOn\n ? 'The domain plan keeps every user\\'s data their own (USERS tenancy), and the configuration enables ORGANIZATIONS. Scope this task\\'s resources '\n + 'to the user as the plan decided, and report the mismatch in your result.'\n : undefined;\n const displayName = readApplicationDisplayName(input.configContent);\n return {\n ...(displayName === undefined ? {} : { displayName }),\n enabled,\n disabled,\n undeclared,\n ...(input.tenancy === undefined ? {} : { tenancy: input.tenancy }),\n ...(contradiction === undefined ? {} : { contradiction }),\n };\n}\n"]}
|
package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-intervention-ledger.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-intervention-ledger.companion.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"creation-intervention-ledger.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-intervention-ledger.companion.service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAa,KAAK,sCAAsC,EAAE,MAAM,uEAAuE,CAAC;AAC/I,OAAO,EAAmB,KAAK,wCAAwC,EAAE,MAAM,iDAAiD,CAAC;AAEjI,OAAO,EAQL,KAAK,+BAA+B,EAEpC,KAAK,oBAAoB,EACzB,KAAK,oCAAoC,EACzC,KAAK,qBAAqB,EAE3B,MAAM,wCAAwC,CAAC;AAsBhD,4GAA4G;AAC5G,qBAAa,iCAAkC,SAAQ,KAAK;aACvB,cAAc,EAAE,MAAM;gBAAtB,cAAc,EAAE,MAAM;CAG1D;AAED;;;;;;;;;;;GAWG;AACH,qBACa,0CAA0C;IAIhB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACR,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACpB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IANrG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+D;gBAGlC,MAAM,EAAE,aAAa,EACN,gBAAgB,EAAE,gBAAgB,EACrB,eAAe,EAAE,sCAAsC,EACrD,iBAAiB,EAAE,wCAAwC;IAK/I;;;;;OAKG;IACU,aAA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BAAiB;IAIzB,OAAO,CAAC,WAAW;CAGpB"}
|
|
@@ -10,10 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
-
import { execFile } from 'node:child_process';
|
|
14
13
|
import { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
15
14
|
import * as path from 'node:path';
|
|
16
|
-
import { promisify } from 'node:util';
|
|
17
15
|
import { inject, injectable } from 'inversify';
|
|
18
16
|
import { z } from 'zod';
|
|
19
17
|
import { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';
|
|
@@ -22,7 +20,7 @@ import { sha256Hex } from '../../claude-cli/services/coding-run-write-register.c
|
|
|
22
20
|
import { writtenSha256Of } from './playbook-run-write-register.companion.service.js';
|
|
23
21
|
import { OPERATOR_BUILD_TASK_REARM_REASONS } from '@wildo-ai/platform-core-shared';
|
|
24
22
|
import { CREATION_BUILD_LANE, applyStatedReasons, classifyCommitAsIntervention, classifyWorkingTreeEdits, deriveBuildAttemptInterventions, deriveRestartIntervention, deriveRevertInterventions, } from '../models/creation-intervention.models.js';
|
|
25
|
-
|
|
23
|
+
import { gitReadBroker } from '../../core/utils/git-read-broker.companion.js';
|
|
26
24
|
/** Git may only be READ here: the ledger observes the history, it never writes it. */
|
|
27
25
|
const READ_ONLY_GIT_SUBCOMMANDS = new Set(['log', 'show', 'status', 'rev-parse']);
|
|
28
26
|
const GIT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
|
|
@@ -277,14 +275,15 @@ let CreationInterventionLedgerCompanionService = class CreationInterventionLedge
|
|
|
277
275
|
/** `<commit>:<path>` → the sha-256 of its bytes. Immutable, so never invalidated; bounded by the run's commits × files. */
|
|
278
276
|
committedBlobHashes = new Map();
|
|
279
277
|
async gitBlob(object) {
|
|
280
|
-
|
|
278
|
+
// Through the git read helper (#3204): forking `git` from the companion's 2 GB process blocked its event loop.
|
|
279
|
+
const { stdout } = await gitReadBroker.execGitBuffer(['-C', this.companionContext.saasRoot, 'show', object], { maxBuffer: GIT_MAX_BUFFER_BYTES, timeout: GIT_TIMEOUT_MS });
|
|
281
280
|
return stdout;
|
|
282
281
|
}
|
|
283
282
|
async git(args) {
|
|
284
283
|
if (!READ_ONLY_GIT_SUBCOMMANDS.has(args[0] ?? ''))
|
|
285
284
|
throw new Error(`git ${args[0]} is outside the intervention ledger's read-only set`);
|
|
286
285
|
// `core.quotePath=false`: a quoted non-ASCII path would never match the registers' (#2231 review F13).
|
|
287
|
-
const { stdout } = await
|
|
286
|
+
const { stdout } = await gitReadBroker.execGit(['-C', this.companionContext.saasRoot, '-c', 'core.quotePath=false', ...args], { maxBuffer: GIT_MAX_BUFFER_BYTES, timeout: GIT_TIMEOUT_MS });
|
|
288
287
|
return { stdout };
|
|
289
288
|
}
|
|
290
289
|
interventionsDirectory() {
|
package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-intervention-ledger.companion.service.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-intervention-ledger.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAErF,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AqD,CAAC,CAAC;QACxI,uGAAuG;QACvG,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;QAC3L,OAAO,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC;IAEO,sBAAsB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gDAAgD,CAAC,CAAC;IACxG,CAAC;IAEO,iBAAiB;QACvB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC;IAEO,WAAW;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,cAAc,CAAC,CAAC;IAClE,CAAC;CACF,CAAA;AA9OY,0CAA0C;IADtD,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,6BAA6B,CAAC,CAAA;IAC7D,WAAA,MAAM,CAAC,uBAAuB,CAAC,+BAA+B,CAAC,CAAA;;GAPvD,0CAA0C,CA8OtD","sourcesContent":["import { execFile } from 'node:child_process';\nimport { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { promisify } from 'node:util';\n\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { sha256Hex, type CodingRunWriteRegisterCompanionService } from '../../claude-cli/services/coding-run-write-register.companion.service';\nimport { writtenSha256Of, type PlaybookRunWriteRegisterCompanionService } from './playbook-run-write-register.companion.service';\nimport { OPERATOR_BUILD_TASK_REARM_REASONS } from '@wildo-ai/platform-core-shared';\nimport {\n CREATION_BUILD_LANE,\n applyStatedReasons,\n classifyCommitAsIntervention,\n classifyWorkingTreeEdits,\n deriveBuildAttemptInterventions,\n deriveRestartIntervention,\n deriveRevertInterventions,\n type CreationBuildAttemptObservation,\n type CreationCommitObservation,\n type CreationIntervention,\n type CreationInterruptedPlaybookExecution,\n type CreationRestartRecord,\n type CreationRunFootprint,\n} from '../models/creation-intervention.models';\n\nconst execFileAsync = promisify(execFile);\n\n/** Git may only be READ here: the ledger observes the history, it never writes it. */\nconst READ_ONLY_GIT_SUBCOMMANDS = new Set(['log', 'show', 'status', 'rev-parse']);\nconst GIT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;\nconst GIT_TIMEOUT_MS = 60_000;\n/** The separators the commit query's `--format` emits: a commit's start, and the end of its header. */\nconst COMMIT_MARK = '\\x1e';\nconst HEADER_END = '\\x1d';\nconst FIELD = '\\x1f';\n\nconst CreationRestartRecordSchema = z.strictObject({\n bootAt: z.string().min(1),\n codingTaskIds: z.array(z.string().min(1)),\n playbookExecutionIds: z.array(z.string().min(1)),\n generationExecutionIds: z.array(z.string().min(1)),\n});\n\nconst StatedReasonsSchema = z.record(z.string().min(1), z.strictObject({ reason: z.string().min(1), statedAt: z.string().min(1) }));\n\n/** Refused: a reason was stated for an id no current derivation produces, so it would attach to nothing. */\nexport class CreationInterventionNotFoundError extends Error {\n public constructor(public readonly interventionId: string) {\n super(`No intervention \"${interventionId}\" in this creation run. List them with \\`wildo creation report\\`.`);\n }\n}\n\n/**\n * The companion half of the INTERVENTION LEDGER (#2231). The derivations are in\n * `creation-intervention.models.ts`; this gathers what they read and keeps the two facts no later read can\n * recover — each restart (`recordRestart`, called by the boot) and each reason a person states.\n *\n * Deliberately light: the boot path injects it, so it depends on the two write registers and the context\n * only. The run rows it also needs (build attempts, playbook executions) are handed in by the report.\n *\n * Everything it stores is under `.wildo-saas/state/meta-workflows/interventions/`, throwaway like the rest of\n * that tree: deleting it loses the restarts and the stated reasons, which is time, and nothing the lane\n * reads, because nothing in the lane reads it.\n */\n@injectable()\nexport class CreationInterventionLedgerCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.CodingRunWriteRegisterService) private readonly codingRunWrites: CodingRunWriteRegisterCompanionService,\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService) private readonly playbookRunWrites: PlaybookRunWriteRegisterCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('CreationInterventionLedger');\n }\n\n /**\n * Record a boot that found runs in flight — a restart, as `deriveRestartIntervention` counts it. Called by\n * the boot right after its reconciliation, with what that reconciliation settled. A boot that found\n * nothing writes nothing: an ordinary start is no intervention. Never throws: a boot must not fail on a\n * report (`continuity-drift-and-cas-basis.md`, Rule 3).\n */\n public async recordRestart(record: CreationRestartRecord): Promise<void> {\n if (record.codingTaskIds.length + record.playbookExecutionIds.length + record.generationExecutionIds.length === 0) return;\n try {\n const parsed = CreationRestartRecordSchema.parse(record);\n await mkdir(this.restartsDirectory(), { recursive: true });\n await writeFile(path.join(this.restartsDirectory(), `${parsed.bootAt.replace(/[^0-9A-Za-z-]/g, '-')}.json`), `${JSON.stringify(parsed, null, 2)}\\n`, 'utf8');\n } catch (error) {\n this.logger.warn('Could not record the restart in the intervention ledger; the run report will not count it.', { error: describeCaughtError(error) });\n }\n }\n\n /** Every recorded restart, oldest first. An unreadable record is skipped, as the registers skip theirs. */\n public async listRestarts(): Promise<readonly CreationRestartRecord[]> {\n const entries = await readdir(this.restartsDirectory()).catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return [] as string[];\n throw error;\n });\n const restarts: CreationRestartRecord[] = [];\n for (const entry of entries.filter((name) => name.endsWith('.json'))) {\n try {\n restarts.push(CreationRestartRecordSchema.parse(JSON.parse(await readFile(path.join(this.restartsDirectory(), entry), 'utf8'))));\n } catch {\n this.logDebug('Skipping unreadable restart record', { entry });\n }\n }\n return restarts.sort((left, right) => left.bootAt.localeCompare(right.bootAt));\n }\n\n /** The reasons people stated, by intervention id. */\n public async readStatedReasons(): Promise<Readonly<Record<string, { readonly reason: string; readonly statedAt: string }>>> {\n try {\n return StatedReasonsSchema.parse(JSON.parse(await readFile(this.reasonsPath(), 'utf8')));\n } catch (error) {\n if ((error as NodeJS.ErrnoException)?.code !== 'ENOENT') this.logDebug('Stated reasons unreadable; reading none', { error: String(error) });\n return {};\n }\n }\n\n /**\n * Record why a person intervened — the one thing the ledger asks of anyone. `knownIds` is the current\n * derivation's ids: a reason for an id nothing produces would attach to nothing, so it is refused.\n */\n public async stateReason(interventionId: string, reason: string, knownIds: ReadonlySet<string>): Promise<{ readonly interventionId: string; readonly statedAt: string }> {\n if (!knownIds.has(interventionId)) throw new CreationInterventionNotFoundError(interventionId);\n const statedAt = new Date().toISOString();\n const reasons = { ...(await this.readStatedReasons()), [interventionId]: { reason: reason.trim(), statedAt } };\n await mkdir(path.dirname(this.reasonsPath()), { recursive: true });\n await writeFile(this.reasonsPath(), `${JSON.stringify(StatedReasonsSchema.parse(reasons), null, 2)}\\n`, 'utf8');\n return { interventionId, statedAt };\n }\n\n /**\n * Every intervention of the run, oldest first, with the reasons stated so far — and what could not be\n * checked, said rather than silently left out.\n */\n public async deriveInterventions(input: {\n readonly buildAttempts: readonly CreationBuildAttemptObservation[];\n /** Every meta-workflows execution the report read, by id: its lane, and its root when it is a composite's child. */\n readonly playbookExecutions: ReadonlyMap<string, CreationInterruptedPlaybookExecution>;\n /** A run is in flight: the working tree then holds writes no record names yet, so uncommitted edits are not judged. */\n readonly runsInFlight: number;\n }): Promise<{ readonly interventions: readonly CreationIntervention[]; readonly notChecked: readonly string[] }> {\n const notChecked: string[] = [];\n const footprints = await this.readFootprints();\n const codingTaskRefById = new Map(input.buildAttempts.map((attempt) => [attempt.runTaskId, attempt.taskRef] as const));\n for (const record of await this.codingRunWrites.list()) codingTaskRefById.set(record.taskId, record.taskRef);\n\n const reverts = await this.playbookRunWrites.listReverts();\n const recordedRunIds = new Set((await this.playbookRunWrites.list()).map((record) => record.runId));\n // A fully reverted run's record is gone; its marker keeps its footprint. Only a marker from before that cannot.\n const unrecorded = new Set(reverts.filter((revert) => !recordedRunIds.has(revert.runId) && revert.runFootprint === undefined).map((revert) => revert.runId));\n if (unrecorded.size > 0) {\n notChecked.push(`${unrecorded.size} reverted playbook run(s) no longer have a write record, so commits of their files made before the revert are not attributed`);\n }\n const derived: CreationIntervention[] = [\n ...deriveBuildAttemptInterventions(input.buildAttempts, OPERATOR_BUILD_TASK_REARM_REASONS),\n ...deriveRevertInterventions(reverts),\n ...(await this.listRestarts()).map((restart) => deriveRestartIntervention(restart, {\n codingTaskRef: (taskId) => codingTaskRefById.get(taskId),\n playbookExecution: (executionId) => input.playbookExecutions.get(executionId),\n })),\n ];\n try {\n derived.push(...await this.deriveCommitInterventions(footprints));\n } catch (error) {\n notChecked.push(`commits: git could not be read (${describeCaughtError(error)}), so no manual commit or committed hand edit is counted`);\n }\n if (input.runsInFlight > 0) {\n notChecked.push(`uncommitted hand edits: ${input.runsInFlight} run(s) in flight are writing files no record names yet; read the report again once they settle`);\n } else {\n try {\n derived.push(...await this.deriveWorkingTreeEdits(footprints));\n } catch (error) {\n notChecked.push(`uncommitted hand edits: the working tree could not be read (${describeCaughtError(error)})`);\n }\n }\n const interventions = applyStatedReasons(derived, await this.readStatedReasons())\n .sort((left, right) => left.at.localeCompare(right.at) || left.id.localeCompare(right.id));\n return { interventions, notChecked };\n }\n\n /** What each recorded run wrote: coding runs from their change-set register, playbook runs from theirs. */\n private async readFootprints(): Promise<CreationRunFootprint[]> {\n const coding = (await this.codingRunWrites.list()).map((record) => ({\n target: { lane: CREATION_BUILD_LANE, task: record.taskRef },\n at: record.at,\n files: new Map(record.files.map((file) => [file.path, file.contentSha256 ?? null] as const)),\n }));\n const playbook = (await this.playbookRunWrites.list()).map((record) => ({\n target: { lane: record.playbookRef, task: record.runId },\n at: record.at,\n files: new Map(record.files.map((file) => [file.path, writtenSha256Of(file)] as const)),\n }));\n /*\n * A REVERTED run still wrote what it wrote: a commit of those files before the revert is still a person's\n * commit of that run's work. Its marker keeps the footprint the revert deleted from the register.\n */\n const reverted = (await this.playbookRunWrites.listReverts()).flatMap((revert) => (revert.runFootprint ? [{\n target: { lane: revert.playbookRef, task: revert.runId },\n at: revert.runFootprint.runAt,\n files: new Map(revert.runFootprint.writtenFiles.map((file) => [file.path, file.sha256] as const)),\n until: revert.at,\n }] : []));\n return [...coding, ...playbook, ...reverted];\n }\n\n /**\n * Every non-merge commit since the first recorded run, each with the bytes of the run-owned paths it\n * touched. Only those paths are hashed: a commit of nothing a run wrote is a person's own work beside the\n * lane, and `classifyCommitAsIntervention` would discard it anyway.\n */\n private async deriveCommitInterventions(footprints: readonly CreationRunFootprint[]): Promise<CreationIntervention[]> {\n if (footprints.length === 0) return [];\n const since = footprints.reduce((earliest, footprint) => (footprint.at < earliest ? footprint.at : earliest), footprints[0]!.at);\n // `--relative`: the registers hold APP-relative paths, and an application nested in its repository (every\n // `examples/*` dogfood app) would otherwise match none of them and read as needing nobody (#2231 review F3).\n const { stdout } = await this.git(['log', '--relative', '--no-merges', '--no-renames', '--name-status', `--since=${since}`,\n `--format=${COMMIT_MARK}%H${FIELD}%cI${FIELD}%an${FIELD}%s${FIELD}%b${HEADER_END}`]);\n const interventions: CreationIntervention[] = [];\n for (const chunk of stdout.split(COMMIT_MARK).filter((entry) => entry.trim().length > 0)) {\n const [header, changes = ''] = chunk.split(HEADER_END);\n const [sha, committedAt, authorName, subject, body = ''] = (header ?? '').split(FIELD);\n if (!sha || !committedAt || authorName === undefined || subject === undefined) continue;\n // `%cI` carries the committer's offset and the registers write UTC: compared as text, they must agree.\n const at = new Date(committedAt).toISOString();\n const files: { path: string; sha256: string | null }[] = [];\n for (const line of changes.split('\\n').filter((entry) => entry.includes('\\t'))) {\n const [status, filePath] = line.split('\\t');\n // Any footprint that ever held the path makes it worth hashing; ownership at this instant is decided with the bytes.\n if (!status || !filePath || !footprints.some((footprint) => footprint.files.has(filePath) && footprint.at <= at)) continue;\n files.push({ path: filePath, sha256: status.startsWith('D') ? null : await this.committedBlobSha256(sha, filePath) });\n }\n const observation: CreationCommitObservation = { sha, at, authorName, subject, body, files };\n const intervention = classifyCommitAsIntervention(observation, footprints);\n if (intervention) interventions.push(intervention);\n }\n return interventions;\n }\n\n /** Dirty run-owned files whose bytes are neither the run's nor HEAD's. */\n private async deriveWorkingTreeEdits(footprints: readonly CreationRunFootprint[]): Promise<CreationIntervention[]> {\n if (footprints.length === 0) return [];\n const owned = new Set(footprints.flatMap((footprint) => [...footprint.files.keys()]));\n // Porcelain paths are relative to the REPOSITORY root whatever the working directory; the app's prefix is stripped.\n const prefix = (await this.git(['rev-parse', '--show-prefix'])).stdout.trim();\n const { stdout } = await this.git(['status', '--porcelain=v1', '-z', '--untracked-files=all', '--no-renames', '--', '.']);\n const dirty: { path: string; sha256: string | null; headSha256: string | null }[] = [];\n for (const entry of stdout.split('\\0').filter((line) => line.length > 3)) {\n const repositoryPath = entry.slice(3);\n if (!repositoryPath.startsWith(prefix)) continue;\n const filePath = repositoryPath.slice(prefix.length);\n if (!owned.has(filePath)) continue;\n const current = await readFile(path.resolve(this.companionContext.saasRoot, filePath)).catch(() => undefined);\n const head = await this.gitBlob(`HEAD:./${filePath}`).catch(() => undefined);\n dirty.push({ path: filePath, sha256: current === undefined ? null : sha256Hex(current), headSha256: head === undefined ? null : sha256Hex(head) });\n }\n return classifyWorkingTreeEdits(dirty, footprints, new Date().toISOString());\n }\n\n /**\n * The hash of a file as one commit holds it, read once per companion (#3204). A commit's content never changes, so the\n * answer is held for good. Every report re-reads every commit since the run began, and asked `git show` for each\n * run-owned file of each of them: on reference run 42523477847 that was a spawn per (commit, file) on every read, the\n * companion's largest remaining CPU cost during the build (8% of samples) while the creation drive asked repeatedly.\n */\n private async committedBlobSha256(commitSha: string, filePath: string): Promise<string> {\n const key = `${commitSha}:${filePath}`;\n const held = this.committedBlobHashes.get(key);\n if (held !== undefined) return held;\n const hashed = sha256Hex(await this.gitBlob(`${commitSha}:./${filePath}`));\n this.committedBlobHashes.set(key, hashed);\n return hashed;\n }\n\n /** `<commit>:<path>` → the sha-256 of its bytes. Immutable, so never invalidated; bounded by the run's commits × files. */\n private readonly committedBlobHashes = new Map<string, string>();\n\n private async gitBlob(object: string): Promise<Buffer> {\n const { stdout } = await execFileAsync('git', ['-C', this.companionContext.saasRoot, 'show', object], { encoding: 'buffer', maxBuffer: GIT_MAX_BUFFER_BYTES, timeout: GIT_TIMEOUT_MS });\n return stdout;\n }\n\n private async git(args: string[]): Promise<{ stdout: string }> {\n if (!READ_ONLY_GIT_SUBCOMMANDS.has(args[0] ?? '')) throw new Error(`git ${args[0]} is outside the intervention ledger's read-only set`);\n // `core.quotePath=false`: a quoted non-ASCII path would never match the registers' (#2231 review F13).\n const { stdout } = await execFileAsync('git', ['-C', this.companionContext.saasRoot, '-c', 'core.quotePath=false', ...args], { maxBuffer: GIT_MAX_BUFFER_BYTES, timeout: GIT_TIMEOUT_MS });\n return { stdout };\n }\n\n private interventionsDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/interventions');\n }\n\n private restartsDirectory(): string {\n return path.join(this.interventionsDirectory(), 'restarts');\n }\n\n private reasonsPath(): string {\n return path.join(this.interventionsDirectory(), 'reasons.json');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"creation-intervention-ledger.companion.service.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-intervention-ledger.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAErF,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,SAAS,EAA+C,MAAM,uEAAuE,CAAC;AAC/I,OAAO,EAAE,eAAe,EAAiD,MAAM,iDAAiD,CAAC;AACjI,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AACnF,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,yBAAyB,EACzB,yBAAyB,GAO1B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAG3E,sFAAsF;AACtF,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAClF,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,uGAAuG;AACvG,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,KAAK,GAAG,MAAM,CAAC;AAErB,MAAM,2BAA2B,GAAG,CAAC,CAAC,YAAY,CAAC;IAC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CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,6BAA6B,CAAC,CAAA;IAC7D,WAAA,MAAM,CAAC,uBAAuB,CAAC,+BAA+B,CAAC,CAAA;;GAPvD,0CAA0C,CA+OtD","sourcesContent":["import { mkdir, readFile, readdir, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\n\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { sha256Hex, type CodingRunWriteRegisterCompanionService } from '../../claude-cli/services/coding-run-write-register.companion.service';\nimport { writtenSha256Of, type PlaybookRunWriteRegisterCompanionService } from './playbook-run-write-register.companion.service';\nimport { OPERATOR_BUILD_TASK_REARM_REASONS } from '@wildo-ai/platform-core-shared';\nimport {\n CREATION_BUILD_LANE,\n applyStatedReasons,\n classifyCommitAsIntervention,\n classifyWorkingTreeEdits,\n deriveBuildAttemptInterventions,\n deriveRestartIntervention,\n deriveRevertInterventions,\n type CreationBuildAttemptObservation,\n type CreationCommitObservation,\n type CreationIntervention,\n type CreationInterruptedPlaybookExecution,\n type CreationRestartRecord,\n type CreationRunFootprint,\n} from '../models/creation-intervention.models';\nimport { gitReadBroker } from '../../core/utils/git-read-broker.companion';\n\n\n/** Git may only be READ here: the ledger observes the history, it never writes it. */\nconst READ_ONLY_GIT_SUBCOMMANDS = new Set(['log', 'show', 'status', 'rev-parse']);\nconst GIT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;\nconst GIT_TIMEOUT_MS = 60_000;\n/** The separators the commit query's `--format` emits: a commit's start, and the end of its header. */\nconst COMMIT_MARK = '\\x1e';\nconst HEADER_END = '\\x1d';\nconst FIELD = '\\x1f';\n\nconst CreationRestartRecordSchema = z.strictObject({\n bootAt: z.string().min(1),\n codingTaskIds: z.array(z.string().min(1)),\n playbookExecutionIds: z.array(z.string().min(1)),\n generationExecutionIds: z.array(z.string().min(1)),\n});\n\nconst StatedReasonsSchema = z.record(z.string().min(1), z.strictObject({ reason: z.string().min(1), statedAt: z.string().min(1) }));\n\n/** Refused: a reason was stated for an id no current derivation produces, so it would attach to nothing. */\nexport class CreationInterventionNotFoundError extends Error {\n public constructor(public readonly interventionId: string) {\n super(`No intervention \"${interventionId}\" in this creation run. List them with \\`wildo creation report\\`.`);\n }\n}\n\n/**\n * The companion half of the INTERVENTION LEDGER (#2231). The derivations are in\n * `creation-intervention.models.ts`; this gathers what they read and keeps the two facts no later read can\n * recover — each restart (`recordRestart`, called by the boot) and each reason a person states.\n *\n * Deliberately light: the boot path injects it, so it depends on the two write registers and the context\n * only. The run rows it also needs (build attempts, playbook executions) are handed in by the report.\n *\n * Everything it stores is under `.wildo-saas/state/meta-workflows/interventions/`, throwaway like the rest of\n * that tree: deleting it loses the restarts and the stated reasons, which is time, and nothing the lane\n * reads, because nothing in the lane reads it.\n */\n@injectable()\nexport class CreationInterventionLedgerCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.CodingRunWriteRegisterService) private readonly codingRunWrites: CodingRunWriteRegisterCompanionService,\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService) private readonly playbookRunWrites: PlaybookRunWriteRegisterCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('CreationInterventionLedger');\n }\n\n /**\n * Record a boot that found runs in flight — a restart, as `deriveRestartIntervention` counts it. Called by\n * the boot right after its reconciliation, with what that reconciliation settled. A boot that found\n * nothing writes nothing: an ordinary start is no intervention. Never throws: a boot must not fail on a\n * report (`continuity-drift-and-cas-basis.md`, Rule 3).\n */\n public async recordRestart(record: CreationRestartRecord): Promise<void> {\n if (record.codingTaskIds.length + record.playbookExecutionIds.length + record.generationExecutionIds.length === 0) return;\n try {\n const parsed = CreationRestartRecordSchema.parse(record);\n await mkdir(this.restartsDirectory(), { recursive: true });\n await writeFile(path.join(this.restartsDirectory(), `${parsed.bootAt.replace(/[^0-9A-Za-z-]/g, '-')}.json`), `${JSON.stringify(parsed, null, 2)}\\n`, 'utf8');\n } catch (error) {\n this.logger.warn('Could not record the restart in the intervention ledger; the run report will not count it.', { error: describeCaughtError(error) });\n }\n }\n\n /** Every recorded restart, oldest first. An unreadable record is skipped, as the registers skip theirs. */\n public async listRestarts(): Promise<readonly CreationRestartRecord[]> {\n const entries = await readdir(this.restartsDirectory()).catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return [] as string[];\n throw error;\n });\n const restarts: CreationRestartRecord[] = [];\n for (const entry of entries.filter((name) => name.endsWith('.json'))) {\n try {\n restarts.push(CreationRestartRecordSchema.parse(JSON.parse(await readFile(path.join(this.restartsDirectory(), entry), 'utf8'))));\n } catch {\n this.logDebug('Skipping unreadable restart record', { entry });\n }\n }\n return restarts.sort((left, right) => left.bootAt.localeCompare(right.bootAt));\n }\n\n /** The reasons people stated, by intervention id. */\n public async readStatedReasons(): Promise<Readonly<Record<string, { readonly reason: string; readonly statedAt: string }>>> {\n try {\n return StatedReasonsSchema.parse(JSON.parse(await readFile(this.reasonsPath(), 'utf8')));\n } catch (error) {\n if ((error as NodeJS.ErrnoException)?.code !== 'ENOENT') this.logDebug('Stated reasons unreadable; reading none', { error: String(error) });\n return {};\n }\n }\n\n /**\n * Record why a person intervened — the one thing the ledger asks of anyone. `knownIds` is the current\n * derivation's ids: a reason for an id nothing produces would attach to nothing, so it is refused.\n */\n public async stateReason(interventionId: string, reason: string, knownIds: ReadonlySet<string>): Promise<{ readonly interventionId: string; readonly statedAt: string }> {\n if (!knownIds.has(interventionId)) throw new CreationInterventionNotFoundError(interventionId);\n const statedAt = new Date().toISOString();\n const reasons = { ...(await this.readStatedReasons()), [interventionId]: { reason: reason.trim(), statedAt } };\n await mkdir(path.dirname(this.reasonsPath()), { recursive: true });\n await writeFile(this.reasonsPath(), `${JSON.stringify(StatedReasonsSchema.parse(reasons), null, 2)}\\n`, 'utf8');\n return { interventionId, statedAt };\n }\n\n /**\n * Every intervention of the run, oldest first, with the reasons stated so far — and what could not be\n * checked, said rather than silently left out.\n */\n public async deriveInterventions(input: {\n readonly buildAttempts: readonly CreationBuildAttemptObservation[];\n /** Every meta-workflows execution the report read, by id: its lane, and its root when it is a composite's child. */\n readonly playbookExecutions: ReadonlyMap<string, CreationInterruptedPlaybookExecution>;\n /** A run is in flight: the working tree then holds writes no record names yet, so uncommitted edits are not judged. */\n readonly runsInFlight: number;\n }): Promise<{ readonly interventions: readonly CreationIntervention[]; readonly notChecked: readonly string[] }> {\n const notChecked: string[] = [];\n const footprints = await this.readFootprints();\n const codingTaskRefById = new Map(input.buildAttempts.map((attempt) => [attempt.runTaskId, attempt.taskRef] as const));\n for (const record of await this.codingRunWrites.list()) codingTaskRefById.set(record.taskId, record.taskRef);\n\n const reverts = await this.playbookRunWrites.listReverts();\n const recordedRunIds = new Set((await this.playbookRunWrites.list()).map((record) => record.runId));\n // A fully reverted run's record is gone; its marker keeps its footprint. Only a marker from before that cannot.\n const unrecorded = new Set(reverts.filter((revert) => !recordedRunIds.has(revert.runId) && revert.runFootprint === undefined).map((revert) => revert.runId));\n if (unrecorded.size > 0) {\n notChecked.push(`${unrecorded.size} reverted playbook run(s) no longer have a write record, so commits of their files made before the revert are not attributed`);\n }\n const derived: CreationIntervention[] = [\n ...deriveBuildAttemptInterventions(input.buildAttempts, OPERATOR_BUILD_TASK_REARM_REASONS),\n ...deriveRevertInterventions(reverts),\n ...(await this.listRestarts()).map((restart) => deriveRestartIntervention(restart, {\n codingTaskRef: (taskId) => codingTaskRefById.get(taskId),\n playbookExecution: (executionId) => input.playbookExecutions.get(executionId),\n })),\n ];\n try {\n derived.push(...await this.deriveCommitInterventions(footprints));\n } catch (error) {\n notChecked.push(`commits: git could not be read (${describeCaughtError(error)}), so no manual commit or committed hand edit is counted`);\n }\n if (input.runsInFlight > 0) {\n notChecked.push(`uncommitted hand edits: ${input.runsInFlight} run(s) in flight are writing files no record names yet; read the report again once they settle`);\n } else {\n try {\n derived.push(...await this.deriveWorkingTreeEdits(footprints));\n } catch (error) {\n notChecked.push(`uncommitted hand edits: the working tree could not be read (${describeCaughtError(error)})`);\n }\n }\n const interventions = applyStatedReasons(derived, await this.readStatedReasons())\n .sort((left, right) => left.at.localeCompare(right.at) || left.id.localeCompare(right.id));\n return { interventions, notChecked };\n }\n\n /** What each recorded run wrote: coding runs from their change-set register, playbook runs from theirs. */\n private async readFootprints(): Promise<CreationRunFootprint[]> {\n const coding = (await this.codingRunWrites.list()).map((record) => ({\n target: { lane: CREATION_BUILD_LANE, task: record.taskRef },\n at: record.at,\n files: new Map(record.files.map((file) => [file.path, file.contentSha256 ?? null] as const)),\n }));\n const playbook = (await this.playbookRunWrites.list()).map((record) => ({\n target: { lane: record.playbookRef, task: record.runId },\n at: record.at,\n files: new Map(record.files.map((file) => [file.path, writtenSha256Of(file)] as const)),\n }));\n /*\n * A REVERTED run still wrote what it wrote: a commit of those files before the revert is still a person's\n * commit of that run's work. Its marker keeps the footprint the revert deleted from the register.\n */\n const reverted = (await this.playbookRunWrites.listReverts()).flatMap((revert) => (revert.runFootprint ? [{\n target: { lane: revert.playbookRef, task: revert.runId },\n at: revert.runFootprint.runAt,\n files: new Map(revert.runFootprint.writtenFiles.map((file) => [file.path, file.sha256] as const)),\n until: revert.at,\n }] : []));\n return [...coding, ...playbook, ...reverted];\n }\n\n /**\n * Every non-merge commit since the first recorded run, each with the bytes of the run-owned paths it\n * touched. Only those paths are hashed: a commit of nothing a run wrote is a person's own work beside the\n * lane, and `classifyCommitAsIntervention` would discard it anyway.\n */\n private async deriveCommitInterventions(footprints: readonly CreationRunFootprint[]): Promise<CreationIntervention[]> {\n if (footprints.length === 0) return [];\n const since = footprints.reduce((earliest, footprint) => (footprint.at < earliest ? footprint.at : earliest), footprints[0]!.at);\n // `--relative`: the registers hold APP-relative paths, and an application nested in its repository (every\n // `examples/*` dogfood app) would otherwise match none of them and read as needing nobody (#2231 review F3).\n const { stdout } = await this.git(['log', '--relative', '--no-merges', '--no-renames', '--name-status', `--since=${since}`,\n `--format=${COMMIT_MARK}%H${FIELD}%cI${FIELD}%an${FIELD}%s${FIELD}%b${HEADER_END}`]);\n const interventions: CreationIntervention[] = [];\n for (const chunk of stdout.split(COMMIT_MARK).filter((entry) => entry.trim().length > 0)) {\n const [header, changes = ''] = chunk.split(HEADER_END);\n const [sha, committedAt, authorName, subject, body = ''] = (header ?? '').split(FIELD);\n if (!sha || !committedAt || authorName === undefined || subject === undefined) continue;\n // `%cI` carries the committer's offset and the registers write UTC: compared as text, they must agree.\n const at = new Date(committedAt).toISOString();\n const files: { path: string; sha256: string | null }[] = [];\n for (const line of changes.split('\\n').filter((entry) => entry.includes('\\t'))) {\n const [status, filePath] = line.split('\\t');\n // Any footprint that ever held the path makes it worth hashing; ownership at this instant is decided with the bytes.\n if (!status || !filePath || !footprints.some((footprint) => footprint.files.has(filePath) && footprint.at <= at)) continue;\n files.push({ path: filePath, sha256: status.startsWith('D') ? null : await this.committedBlobSha256(sha, filePath) });\n }\n const observation: CreationCommitObservation = { sha, at, authorName, subject, body, files };\n const intervention = classifyCommitAsIntervention(observation, footprints);\n if (intervention) interventions.push(intervention);\n }\n return interventions;\n }\n\n /** Dirty run-owned files whose bytes are neither the run's nor HEAD's. */\n private async deriveWorkingTreeEdits(footprints: readonly CreationRunFootprint[]): Promise<CreationIntervention[]> {\n if (footprints.length === 0) return [];\n const owned = new Set(footprints.flatMap((footprint) => [...footprint.files.keys()]));\n // Porcelain paths are relative to the REPOSITORY root whatever the working directory; the app's prefix is stripped.\n const prefix = (await this.git(['rev-parse', '--show-prefix'])).stdout.trim();\n const { stdout } = await this.git(['status', '--porcelain=v1', '-z', '--untracked-files=all', '--no-renames', '--', '.']);\n const dirty: { path: string; sha256: string | null; headSha256: string | null }[] = [];\n for (const entry of stdout.split('\\0').filter((line) => line.length > 3)) {\n const repositoryPath = entry.slice(3);\n if (!repositoryPath.startsWith(prefix)) continue;\n const filePath = repositoryPath.slice(prefix.length);\n if (!owned.has(filePath)) continue;\n const current = await readFile(path.resolve(this.companionContext.saasRoot, filePath)).catch(() => undefined);\n const head = await this.gitBlob(`HEAD:./${filePath}`).catch(() => undefined);\n dirty.push({ path: filePath, sha256: current === undefined ? null : sha256Hex(current), headSha256: head === undefined ? null : sha256Hex(head) });\n }\n return classifyWorkingTreeEdits(dirty, footprints, new Date().toISOString());\n }\n\n /**\n * The hash of a file as one commit holds it, read once per companion (#3204). A commit's content never changes, so the\n * answer is held for good. Every report re-reads every commit since the run began, and asked `git show` for each\n * run-owned file of each of them: on reference run 42523477847 that was a spawn per (commit, file) on every read, the\n * companion's largest remaining CPU cost during the build (8% of samples) while the creation drive asked repeatedly.\n */\n private async committedBlobSha256(commitSha: string, filePath: string): Promise<string> {\n const key = `${commitSha}:${filePath}`;\n const held = this.committedBlobHashes.get(key);\n if (held !== undefined) return held;\n const hashed = sha256Hex(await this.gitBlob(`${commitSha}:./${filePath}`));\n this.committedBlobHashes.set(key, hashed);\n return hashed;\n }\n\n /** `<commit>:<path>` → the sha-256 of its bytes. Immutable, so never invalidated; bounded by the run's commits × files. */\n private readonly committedBlobHashes = new Map<string, string>();\n\n private async gitBlob(object: string): Promise<Buffer> {\n // Through the git read helper (#3204): forking `git` from the companion's 2 GB process blocked its event loop.\n const { stdout } = await gitReadBroker.execGitBuffer(['-C', this.companionContext.saasRoot, 'show', object], { maxBuffer: GIT_MAX_BUFFER_BYTES, timeout: GIT_TIMEOUT_MS });\n return stdout;\n }\n\n private async git(args: string[]): Promise<{ stdout: string }> {\n if (!READ_ONLY_GIT_SUBCOMMANDS.has(args[0] ?? '')) throw new Error(`git ${args[0]} is outside the intervention ledger's read-only set`);\n // `core.quotePath=false`: a quoted non-ASCII path would never match the registers' (#2231 review F13).\n const { stdout } = await gitReadBroker.execGit(['-C', this.companionContext.saasRoot, '-c', 'core.quotePath=false', ...args], { maxBuffer: GIT_MAX_BUFFER_BYTES, timeout: GIT_TIMEOUT_MS });\n return { stdout };\n }\n\n private interventionsDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/interventions');\n }\n\n private restartsDirectory(): string {\n return path.join(this.interventionsDirectory(), 'restarts');\n }\n\n private reasonsPath(): string {\n return path.join(this.interventionsDirectory(), 'reasons.json');\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-run-report.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-run-report.companion.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"creation-run-report.companion.service.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-run-report.companion.service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAiC,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAI9G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,kEAAkE,CAAC;AAC5H,OAAO,EAIL,KAAK,wCAAwC,EAC9C,MAAM,gDAAgD,CAAC;AAIxD,OAAO,KAAK,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AACnH,OAAO,EAAiC,KAAK,wCAAwC,EAAE,MAAM,iDAAiD,CAAC;AAa/I,OAAO,EAGL,uBAAuB,EACvB,kBAAkB,EAClB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EAEzB,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC9B,MAAM,wCAAwC,CAAC;AAGhD,uGAAuG;AACvG,MAAM,WAAW,iB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CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED;;;;GAIG;AACH,qBACa,iCAAiC;IAEyB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU;IACb,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAJC,MAAM,EAAE,0CAA0C,EAClE,UAAU,EAAE,mCAAmC,EACjC,aAAa,EAAE,wCAAwC,EACvD,iBAAiB,EAAE,wCAAwC,EAC1E,gBAAgB,EAAE,gBAAgB;IAG1F,QAAQ,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAqInD;;;;;;;;;;;;;;;;;OAiBG;IACU,gBAAgB,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAwElE;;;;;OAKG;YACW,kBAAkB;IA0BhC,0FAA0F;IAC7E,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAI1I"}
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
|
+
import { readResearchTurnRecords } from '../../claude-cli/services/research-evidence-store.companion.js';
|
|
13
14
|
import { inject, injectable } from 'inversify';
|
|
14
15
|
import { FlowsActors_Status, describeCaughtError } from '@wildo-ai/saas-models';
|
|
15
16
|
import { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';
|
|
@@ -256,7 +257,17 @@ let CreationRunReportCompanionService = class CreationRunReportCompanionService
|
|
|
256
257
|
}
|
|
257
258
|
const { phaseOf, ambiguousPlaybookRefs } = classifyPlaybookRefsByJourneyPhase(readCompiledChoreographyAdmits);
|
|
258
259
|
const buildPlanGraph = await this.readBuildPlanGraph(notChecked);
|
|
259
|
-
|
|
260
|
+
// Research turns write no playbook-run row (#3896); their evidence records say when they ran.
|
|
261
|
+
let researchTurns = [];
|
|
262
|
+
try {
|
|
263
|
+
// A context with no application root has no evidence store to read.
|
|
264
|
+
if (this.companionContext.saasRoot)
|
|
265
|
+
researchTurns = readResearchTurnRecords(this.companionContext.saasRoot);
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
notChecked.push(`research turns: their evidence records could not be read (${describeCaughtError(error)}), so a phase that began with research may start late`);
|
|
269
|
+
}
|
|
270
|
+
return deriveCreationJourneyTimeline({ now: new Date(), playbookRuns, researchTurns, buildAttempts, phaseOf, ambiguousPlaybookRefs, buildPlanGraph, notChecked });
|
|
260
271
|
}
|
|
261
272
|
/**
|
|
262
273
|
* The accepted build plan's tasks and their prerequisites, by SHAPE: the timeline needs two fields, not a validated
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-run-report.companion.service.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-run-report.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAE/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AAErG,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,GAE9B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAA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CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC","sourcesContent":["import { inject, injectable } from 'inversify';\n\nimport { FlowsActors_Status, describeCaughtError } from '@wildo-ai/saas-models';\nimport type { PlaybookSpend } from '@wildo-ai/application-creation-runtime';\nimport type { CreationJourney_BuildPlanTask, CreationJourney_Timeline } from '@wildo-ai/platform-core-shared';\nimport { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationFamilyData } from '../../core/context/specification-family-data.companion';\nimport type { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service';\nimport {\n BUILD_TASK_RECORD_HISTORY_CEILING,\n projectBuildTaskAttempt,\n isBuildPlanHeldByFailedModule,\n type ApplicationBuildDispatchCompanionService,\n} from './application-build-dispatch.companion.service';\nimport { APPLICATION_CODING_SYSTEM_REF } from '../models/application-coding-agent.actors-system.definitions';\nimport { APPLICATION_BUILD_SYSTEM_REF } from '../models/application-build.actors-system.definitions';\nimport { ApplicationCodingTaskDisposition, isInterruptedAtStartupOutput } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport type { CreationInterventionLedgerCompanionService } from './creation-intervention-ledger.companion.service';\nimport { describeFailedLandingRemedies, type PlaybookRunWriteRegisterCompanionService } from './playbook-run-write-register.companion.service';\nimport { META_WORKFLOWS_SYSTEM_REF } from '../models/meta-workflows-lane.models';\nimport {\n projectPlaybookLoops,\n readPlaybookRunMeasurement,\n type PlaybookRunExecutionRow,\n} from '../models/playbook-run-record.models';\nimport {\n classifyPlaybookRefsByJourneyPhase,\n deriveCreationJourneyTimeline,\n type CreationJourneyBuildAttempt,\n type CreationJourneyPlaybookRun,\n} from '../models/creation-journey-timeline.models';\nimport {\n CREATION_BUILD_LANE,\n CREATION_LOOP_LANE,\n deriveIndependenceScore,\n deriveJourneySpend,\n type CreationCodingRunSpend,\n type CreationGenerationStepSpend,\n type CreationIntervention,\n type CreationInterruptedPlaybookExecution,\n type CreationLoopSelectionSpend,\n type CreationPlaybookRunSpend,\n} from '../models/creation-intervention.models';\n\n\n/** What `GET /api/companion/creation/report` answers (#2231) — what `wildo creation report` prints. */\nexport interface CreationRunReport {\n readonly generatedAt: string;\n /**\n * The application the report is about, by its `wildo.saas.config` slug — the name a defect found during its\n * creation carries in its `**Creation run:**` field (#2287), which `wildo creation report` looks up on the tracker.\n */\n readonly application: { readonly slug: string };\n /** Oldest first, each with what it unblocked and why, when a reason is known. */\n readonly interventions: readonly CreationIntervention[];\n readonly independence: ReturnType<typeof deriveIndependenceScore> & {\n /** Build tasks the plan reads LANDED: the per-landed-task denominator the build lane is judged by. */\n readonly landedBuildTasks: number;\n readonly interventionsPerLandedBuildTask: number | null;\n };\n readonly spend: {\n readonly playbookRuns: readonly CreationPlaybookRunSpend[];\n readonly codingRuns: readonly CreationCodingRunSpend[];\n readonly generationSteps: readonly CreationGenerationStepSpend[];\n readonly loopSelections: readonly CreationLoopSelectionSpend[];\n readonly total: ReturnType<typeof deriveJourneySpend>;\n };\n /**\n * Playbook runs that FAILED after writing and whose writes nobody accepted (#3265), newest first: each a half-applied\n * composition the posture never commits and no coding door takes. Not landings, so not counted in `independence`; listed\n * here with the two doors each waits on, because nothing else prompts a person to act on them.\n */\n readonly failedLandings: readonly CreationFailedLanding[];\n /** What this report could not see, said rather than left out — each line a reason a figure is a floor. */\n readonly notChecked: readonly string[];\n}\n\n/** One failed landing the report lists (#3265): which run, what it left in the tree, and how to settle it. */\nexport interface CreationFailedLanding {\n readonly runId: string;\n readonly playbookRef: string;\n readonly at: string;\n readonly paths: readonly string[];\n readonly remedies: { readonly accept: string; readonly revert: string };\n}\n\n/**\n * The CREATION RUN REPORT (#2231): what a person had to do, what each run spent, and how independent the lane\n * was — the report app-creation-test-004's driving session wrote by hand. Derived on every read from rows,\n * registers and git; nothing is stored here, and nothing in the lane reads it.\n */\n@injectable()\nexport class CreationRunReportCompanionService {\n public constructor(\n @inject(COMPANION_SERVICE_TYPES.CreationInterventionLedgerService) private readonly ledger: CreationInterventionLedgerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ExecutionsService) private readonly executions: CompanionExecutionsCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService) private readonly buildDispatch: ApplicationBuildDispatchCompanionService,\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService) private readonly playbookRunWrites: PlaybookRunWriteRegisterCompanionService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {}\n\n public async describe(): Promise<CreationRunReport> {\n const notChecked: string[] = [];\n /*\n * To the build record's history ceiling, as the timeline reads them (#3706): the HTTP listing's 200-row cap dropped\n * the oldest runs of a long creation, so their spend and the playbook a restart interrupted went missing. The same\n * query as the timeline's, so the two share one cached listing.\n */\n const rows = await this.executions.listActorExecutions(\n { systemRef: META_WORKFLOWS_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING },\n ) as unknown as PlaybookRunExecutionRow[];\n if (rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING) {\n notChecked.push(`playbook runs: only the newest ${BUILD_TASK_RECORD_HISTORY_CEILING} executions were read, so older runs' spend and restarts' playbook names are missing`);\n }\n const playbookExecutions = new Map<string, CreationInterruptedPlaybookExecution>();\n // The unattended loop's rows name no playbook; a restart that interrupted one is still a restart of the loop.\n for (const loop of projectPlaybookLoops(rows)) playbookExecutions.set(loop.runId, { lane: CREATION_LOOP_LANE });\n const playbookRuns: CreationPlaybookRunSpend[] = [];\n let playbookRunsInFlight = 0;\n for (const row of rows) {\n const refs = row.standaloneTasks[0]?.context?.correlation?.refs;\n const playbookRef = refs?.['playbookRef'];\n if (typeof playbookRef !== 'string') continue;\n playbookExecutions.set(row._id, { lane: playbookRef, ...(typeof refs?.['rootRunId'] === 'string' ? { rootRunId: refs['rootRunId'] } : {}) });\n if (row.status === FlowsActors_Status.PROCESSING || row.status === FlowsActors_Status.PENDING) playbookRunsInFlight += 1;\n // A child's spend is inside its root's: only ROOT runs are summed, or a composite's work counts twice.\n if (typeof refs?.['rootRunId'] === 'string') continue;\n const measurement = readPlaybookRunMeasurement(row.standaloneTasks[0]?.output);\n playbookRuns.push({\n runId: row._id,\n playbookRef,\n ...(typeof refs?.['instanceKey'] === 'string' ? { instanceKey: refs['instanceKey'] } : {}),\n startedAt: row.createdAt.toISOString(),\n ...(row.finishedAt ? { finishedAt: row.finishedAt.toISOString() } : {}),\n status: row.status,\n ...(measurement ? { spend: measurement.spend } : {}),\n });\n }\n playbookRuns.sort((left, right) => left.startedAt.localeCompare(right.startedAt));\n\n const loopSelections = projectPlaybookLoops(rows).map((loop): CreationLoopSelectionSpend => {\n // The loop's own row counts every lane it ran; each lane is also a root run above, so only the rest is the loop's.\n const laneSpends: PlaybookSpend[] = (loop.steps ?? []).flatMap((step) => (step.lanes ?? []).flatMap((lane) => (lane.spend ? [lane.spend] : [])));\n const cost: Record<string, number> = { ...(loop.measurement?.spend.cost ?? {}) };\n for (const lane of laneSpends) for (const [currency, amount] of Object.entries(lane.cost ?? {})) cost[currency] = (cost[currency] ?? 0) - amount;\n const kept = Object.fromEntries(Object.entries(cost).filter((entry) => entry[1] > 0));\n return { runId: loop.runId, startedAt: loop.startedAt, ...(Object.keys(kept).length > 0 ? { cost: kept } : {}) };\n });\n\n let build: Awaited<ReturnType<ApplicationBuildDispatchCompanionService['describeBuildTaskRecords']>>;\n try {\n build = await this.buildDispatch.describeBuildTaskRecords();\n if (build === undefined) notChecked.push('build: the application has no build plan yet, so there are no coding runs to count');\n } catch (error) {\n // A plan a failed module holds exists (#3258): the report says so instead of dying, or of saying there is none.\n if (!isBuildPlanHeldByFailedModule(error)) throw error;\n notChecked.push(`build: the build plan could not be read, so its coding runs are not counted. ${error.message}`);\n }\n if (build?.attemptsTruncated) notChecked.push('build: the attempt listing hit its page cap, so coding runs, generation steps and their spend are a floor');\n const attempts = (build?.tasks ?? []).flatMap((task) => task.attempts.map((attempt) => ({ taskRef: task.taskRef, attempt })));\n const codingRuns: CreationCodingRunSpend[] = attempts\n // A generation step is an attempt and no agent run: it is not a coding run. Its own spend is listed apart, below.\n .filter(({ attempt }) => attempt.ranNothing !== true && attempt.generationStep !== true)\n .map(({ taskRef, attempt }) => ({\n runTaskId: attempt.runTaskId,\n taskRef,\n startedAt: attempt.startedAt,\n ...(attempt.settledAt ? { settledAt: attempt.settledAt } : {}),\n ...(attempt.tokens ? { tokens: attempt.tokens } : {}),\n ...(attempt.cost ? { cost: attempt.cost } : {}),\n }))\n .sort((left, right) => left.startedAt.localeCompare(right.startedAt));\n const generationSteps: CreationGenerationStepSpend[] = attempts\n .filter(({ attempt }) => attempt.ranNothing !== true && attempt.generationStep === true)\n .map(({ taskRef, attempt }) => ({\n runTaskId: attempt.runTaskId,\n taskRef,\n startedAt: attempt.startedAt,\n ...(attempt.settledAt ? { settledAt: attempt.settledAt } : {}),\n ...(attempt.generationStepSpend ? { spend: attempt.generationStepSpend } : {}),\n }))\n .sort((left, right) => left.startedAt.localeCompare(right.startedAt));\n const codingRunsInFlight = attempts.filter(({ attempt }) => attempt.status === FlowsActors_Status.PROCESSING || attempt.status === FlowsActors_Status.PENDING).length;\n\n const { interventions, notChecked: ledgerNotChecked } = await this.ledger.deriveInterventions({\n buildAttempts: attempts.map(({ taskRef, attempt }) => ({\n taskRef,\n runTaskId: attempt.runTaskId,\n startedAt: attempt.startedAt,\n ...(attempt.rearm ? { rearm: attempt.rearm } : {}),\n ...(attempt.landedOverride ? { landedOverride: attempt.landedOverride } : {}),\n })),\n playbookExecutions,\n runsInFlight: playbookRunsInFlight + codingRunsInFlight,\n });\n notChecked.push(...ledgerNotChecked);\n\n // A playbook lane's landings are its runs that landed files; the build's, its tasks the plan reads landed.\n // A FAILED landing's record (#3237) holds what a run left behind when it threw, which is no landing.\n const landedByLane = new Map<string, number>();\n const playbookRunWriteRecords = await this.playbookRunWrites.list();\n for (const record of playbookRunWriteRecords.filter((candidate) => candidate.landingFailed !== true)) {\n landedByLane.set(record.playbookRef, (landedByLane.get(record.playbookRef) ?? 0) + 1);\n }\n // Listed instead (#3265): an accepted one has been settled by a person and is history, not a prompt.\n const failedLandings: CreationFailedLanding[] = playbookRunWriteRecords\n .filter((record) => record.landingFailed === true && record.acceptedCommitSha === undefined)\n .map((record) => ({\n runId: record.runId,\n playbookRef: record.playbookRef,\n at: record.at,\n paths: record.files.map((file) => file.path),\n remedies: describeFailedLandingRemedies(record.runId),\n }));\n const landedBuildTasks = build?.summary.landed ?? 0;\n if (build !== undefined) landedByLane.set(CREATION_BUILD_LANE, landedBuildTasks);\n const independence = deriveIndependenceScore(interventions, landedByLane);\n const buildInterventions = interventions.filter((intervention) => intervention.targets.some((target) => target.lane === CREATION_BUILD_LANE)).length;\n\n return {\n generatedAt: new Date().toISOString(),\n application: { slug: this.companionContext.saasConfig.slug },\n interventions,\n independence: {\n ...independence,\n landedBuildTasks,\n interventionsPerLandedBuildTask: landedBuildTasks > 0 ? Math.round((buildInterventions / landedBuildTasks) * 100) / 100 : buildInterventions === 0 ? 0 : null,\n },\n spend: { playbookRuns, codingRuns, generationSteps, loopSelections, total: deriveJourneySpend({ playbookRuns, codingRuns, generationSteps, loopSelections }) },\n failedLandings,\n notChecked,\n };\n }\n\n /**\n * `GET /creation/timeline` (#3206, epic #3204): how long each phase of the journey took, the wall clock, and the\n * slowest build tasks with their dispatch wait and run time. Derived on every read from the rows, like the report,\n * and read on its own: it needs no build plan, no landing pass and no git, so it answers on an application whose\n * build has not started and costs two listings.\n *\n * Reads the playbook runs to the build record's history ceiling, as `describe` does: a phase's START is its OLDEST\n * run, which is the first a newest-first window drops.\n *\n * It also carries the accepted build plan's GRAPH (#3204's budget: \"at least 3 concurrent tasks when ready\" needs to\n * know when a task could have run, which no attempt row says). Read from the specifications' data slots, which the\n * companion holds cached while nothing changed, and still with no landing pass: a plan that cannot be read is said in\n * `notChecked` and leaves the graph NULL, never failing the read.\n *\n * A playbook run a restart ended is measured to the restart like a build attempt, and unlike one it is not marked:\n * the engine's startup sweep writes the same failure for it as for any orphan, and the meta-workflows sweep passes no\n * description of its own. A phase interrupted by a restart may therefore run long.\n */\n public async describeTimeline(): Promise<CreationJourney_Timeline> {\n const notChecked: string[] = [];\n const [playbookRows, ...attemptPages] = await Promise.all([\n this.executions.listActorExecutions({ systemRef: META_WORKFLOWS_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING }),\n ...[APPLICATION_CODING_SYSTEM_REF, APPLICATION_BUILD_SYSTEM_REF].map((systemRef) =>\n this.executions.listActorExecutions({ systemRef, limit: BUILD_TASK_RECORD_HISTORY_CEILING })),\n ]);\n if (playbookRows.length >= BUILD_TASK_RECORD_HISTORY_CEILING) {\n notChecked.push(`playbook runs: only the newest ${BUILD_TASK_RECORD_HISTORY_CEILING} executions were read, so the earliest phase starts are later than they were`);\n }\n if (attemptPages.some((page) => page.length >= BUILD_TASK_RECORD_HISTORY_CEILING)) {\n notChecked.push(`build attempts: only the newest ${BUILD_TASK_RECORD_HISTORY_CEILING} of a system were read, so the build's start and the task totals are a floor`);\n }\n const playbookRuns: CreationJourneyPlaybookRun[] = [];\n for (const row of playbookRows as unknown as PlaybookRunExecutionRow[]) {\n const playbookRef = row.standaloneTasks[0]?.context?.correlation?.refs?.['playbookRef'];\n // The unattended loop's own rows name no playbook: each lane it ran is a row of its own, counted there.\n if (typeof playbookRef !== 'string') continue;\n playbookRuns.push({\n runId: row._id,\n playbookRef,\n startedAt: row.createdAt.toISOString(),\n ...(row.finishedAt ? { finishedAt: row.finishedAt.toISOString() } : {}),\n status: row.status,\n ...(row.suspension?.suspendedAt ? { suspendedAt: row.suspension.suspendedAt } : {}),\n });\n }\n const buildAttempts: CreationJourneyBuildAttempt[] = [];\n for (const row of attemptPages.flat() as unknown as ReadonlyArray<Parameters<typeof projectBuildTaskAttempt>[0] & {\n readonly suspension?: { readonly suspendedAt?: string } | null;\n }>) {\n const projected = projectBuildTaskAttempt(row);\n if (projected === null) continue;\n const { attempt } = projected;\n // A coding run parked on a question (AWAITING_APPROVAL) is waiting on a person, as a parked playbook run is.\n const parkedAt = attempt.status === FlowsActors_Status.AWAITING_APPROVAL ? row.suspension?.suspendedAt : undefined;\n buildAttempts.push({\n taskRef: projected.taskRef,\n selectedAt: attempt.startedAt,\n ...(attempt.preparationStartedAt ? { preparationStartedAt: attempt.preparationStartedAt } : {}),\n ...(attempt.admittedAt ? { admittedAt: attempt.admittedAt } : {}),\n ...(attempt.settledAt ? { settledAt: attempt.settledAt } : {}),\n ...(parkedAt ? { waitingOnPersonSince: parkedAt } : {}),\n /*\n * Settled by a later process's startup sweep: the coding lane's interrupted disposition (every row it ever wrote),\n * or the startup marker the sweep writes on a selected-only run and a generation step since #3206.\n */\n endedByCompanionRestart: attempt.disposition === ApplicationCodingTaskDisposition.INTERRUPTED_REQUIRES_REVIEW\n || isInterruptedAtStartupOutput(row.standaloneTasks[0]?.output),\n generationStep: attempt.generationStep === true,\n });\n }\n if (buildAttempts.some((attempt) => attempt.preparationStartedAt === undefined)) {\n notChecked.push('dispatch wait: an attempt recorded before #3206 carries no preparation start, so its wait is measured from its selection and is a floor');\n }\n const endedByRestart = buildAttempts.filter((attempt) => attempt.endedByCompanionRestart).length;\n if (endedByRestart > 0) {\n notChecked.push(`build attempts: ${endedByRestart} ended by a companion restart are measured to that restart, which includes any time the companion was down`);\n }\n const { phaseOf, ambiguousPlaybookRefs } = classifyPlaybookRefsByJourneyPhase(readCompiledChoreographyAdmits);\n const buildPlanGraph = await this.readBuildPlanGraph(notChecked);\n return deriveCreationJourneyTimeline({ now: new Date(), playbookRuns, buildAttempts, phaseOf, ambiguousPlaybookRefs, buildPlanGraph, notChecked });\n }\n\n /**\n * The accepted build plan's tasks and their prerequisites, by SHAPE: the timeline needs two fields, not a validated\n * plan, and validating it is the dispatcher's job (an invalid plan dispatches nothing, which its own reads say). NULL\n * when no plan is authored yet, which is a true answer for every application before build-decompose; NULL plus a\n * `notChecked` line when one exists and cannot be read, so \"no plan\" and \"could not look\" stay apart.\n */\n private async readBuildPlanGraph(notChecked: string[]): Promise<readonly CreationJourney_BuildPlanTask[] | null> {\n let authored: unknown;\n try {\n authored = (await loadSpecificationFamilyData(this.companionContext) as unknown as Record<string, unknown>).buildPlanSpecification;\n } catch (error) {\n notChecked.push(`build plan: the specifications could not be read (${describeCaughtError(error)}), so the plan graph is absent`);\n return null;\n }\n if (authored === undefined || authored === null) return null;\n const tasks = (authored as { readonly tasks?: unknown }).tasks;\n const graph: CreationJourney_BuildPlanTask[] = [];\n for (const task of Array.isArray(tasks) ? tasks : []) {\n const { taskRef, prerequisiteTaskRefs } = (task ?? {}) as { readonly taskRef?: unknown; readonly prerequisiteTaskRefs?: unknown };\n if (typeof taskRef !== 'string' || taskRef.length === 0) continue;\n graph.push({\n taskRef,\n prerequisiteTaskRefs: Array.isArray(prerequisiteTaskRefs) ? prerequisiteTaskRefs.filter((ref): ref is string => typeof ref === 'string' && ref.length > 0) : [],\n });\n }\n if (!Array.isArray(tasks) || graph.length !== tasks.length) {\n notChecked.push('build plan: the authored plan has tasks of no readable shape, so the plan graph is absent');\n return null;\n }\n return graph;\n }\n\n /** Record why a person intervened; refused for an id the current report does not hold. */\n public async stateReason(interventionId: string, reason: string): Promise<{ readonly interventionId: string; readonly statedAt: string }> {\n const report = await this.describe();\n return this.ledger.stateReason(interventionId, reason, new Set(report.interventions.map((intervention) => intervention.id)));\n }\n}\n\n/**\n * What a compiled playbook's choreography admits, read from the framework-knowledge catalog the companion ships with:\n * the catalog is what the lanes ran from, so it is what says which lane a run's playbook belongs to. Read by shape\n * (the loader types a playbook `unknown`), and loaded once per process — the compiled catalog does not change under a\n * running companion.\n */\nlet compiledChoreographyAdmits: ReadonlyMap<string, readonly string[]> | undefined;\nfunction readCompiledChoreographyAdmits(ref: string): readonly string[] {\n compiledChoreographyAdmits ??= new Map(listFrameworkKnowledgePlaybooks().map((entry) => {\n const admits = (getFrameworkKnowledgePlaybook(entry.ref)?.playbook as { method?: { choreography?: { admits?: unknown } } } | undefined)?.method?.choreography?.admits;\n return [entry.ref, Array.isArray(admits) ? admits.filter((admitted): admitted is string => typeof admitted === 'string') : []];\n }));\n return compiledChoreographyAdmits.get(ref) ?? [];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"creation-run-report.companion.service.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/creation-run-report.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6DAA6D,CAAC;AACtG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGhF,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAE/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wDAAwD,CAAC;AAErG,OAAO,EACL,iCAAiC,EACjC,uBAAuB,EACvB,6BAA6B,GAE9B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,gCAAgC,EAAE,4BAA4B,EAAE,MAAM,sDAAsD,CAAC;AAEtI,OAAO,EAAE,6BAA6B,EAAiD,MAAM,iDAAiD,CAAC;AAC/I,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAE3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,kCAAkC,EAClC,6BAA6B,GAG9B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,mBAAmB,EACn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Content":["import { readResearchTurnRecords } from '../../claude-cli/services/research-evidence-store.companion';\nimport { inject, injectable } from 'inversify';\n\nimport { FlowsActors_Status, describeCaughtError } from '@wildo-ai/saas-models';\nimport type { PlaybookSpend } from '@wildo-ai/application-creation-runtime';\nimport type { CreationJourney_BuildPlanTask, CreationJourney_Timeline } from '@wildo-ai/platform-core-shared';\nimport { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks } from '@wildo-ai/framework-knowledge';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { loadSpecificationFamilyData } from '../../core/context/specification-family-data.companion';\nimport type { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service';\nimport {\n BUILD_TASK_RECORD_HISTORY_CEILING,\n projectBuildTaskAttempt,\n isBuildPlanHeldByFailedModule,\n type ApplicationBuildDispatchCompanionService,\n} from './application-build-dispatch.companion.service';\nimport { APPLICATION_CODING_SYSTEM_REF } from '../models/application-coding-agent.actors-system.definitions';\nimport { APPLICATION_BUILD_SYSTEM_REF } from '../models/application-build.actors-system.definitions';\nimport { ApplicationCodingTaskDisposition, isInterruptedAtStartupOutput } from '../../claude-cli/models/coding-agent-dispatch.models';\nimport type { CreationInterventionLedgerCompanionService } from './creation-intervention-ledger.companion.service';\nimport { describeFailedLandingRemedies, type PlaybookRunWriteRegisterCompanionService } from './playbook-run-write-register.companion.service';\nimport { META_WORKFLOWS_SYSTEM_REF } from '../models/meta-workflows-lane.models';\nimport {\n projectPlaybookLoops,\n readPlaybookRunMeasurement,\n type PlaybookRunExecutionRow,\n} from '../models/playbook-run-record.models';\nimport {\n classifyPlaybookRefsByJourneyPhase,\n deriveCreationJourneyTimeline,\n type CreationJourneyBuildAttempt,\n type CreationJourneyPlaybookRun,\n} from '../models/creation-journey-timeline.models';\nimport {\n CREATION_BUILD_LANE,\n CREATION_LOOP_LANE,\n deriveIndependenceScore,\n deriveJourneySpend,\n type CreationCodingRunSpend,\n type CreationGenerationStepSpend,\n type CreationIntervention,\n type CreationInterruptedPlaybookExecution,\n type CreationLoopSelectionSpend,\n type CreationPlaybookRunSpend,\n} from '../models/creation-intervention.models';\n\n\n/** What `GET /api/companion/creation/report` answers (#2231) — what `wildo creation report` prints. */\nexport interface CreationRunReport {\n readonly generatedAt: string;\n /**\n * The application the report is about, by its `wildo.saas.config` slug — the name a defect found during its\n * creation carries in its `**Creation run:**` field (#2287), which `wildo creation report` looks up on the tracker.\n */\n readonly application: { readonly slug: string };\n /** Oldest first, each with what it unblocked and why, when a reason is known. */\n readonly interventions: readonly CreationIntervention[];\n readonly independence: ReturnType<typeof deriveIndependenceScore> & {\n /** Build tasks the plan reads LANDED: the per-landed-task denominator the build lane is judged by. */\n readonly landedBuildTasks: number;\n readonly interventionsPerLandedBuildTask: number | null;\n };\n readonly spend: {\n readonly playbookRuns: readonly CreationPlaybookRunSpend[];\n readonly codingRuns: readonly CreationCodingRunSpend[];\n readonly generationSteps: readonly CreationGenerationStepSpend[];\n readonly loopSelections: readonly CreationLoopSelectionSpend[];\n readonly total: ReturnType<typeof deriveJourneySpend>;\n };\n /**\n * Playbook runs that FAILED after writing and whose writes nobody accepted (#3265), newest first: each a half-applied\n * composition the posture never commits and no coding door takes. Not landings, so not counted in `independence`; listed\n * here with the two doors each waits on, because nothing else prompts a person to act on them.\n */\n readonly failedLandings: readonly CreationFailedLanding[];\n /** What this report could not see, said rather than left out — each line a reason a figure is a floor. */\n readonly notChecked: readonly string[];\n}\n\n/** One failed landing the report lists (#3265): which run, what it left in the tree, and how to settle it. */\nexport interface CreationFailedLanding {\n readonly runId: string;\n readonly playbookRef: string;\n readonly at: string;\n readonly paths: readonly string[];\n readonly remedies: { readonly accept: string; readonly revert: string };\n}\n\n/**\n * The CREATION RUN REPORT (#2231): what a person had to do, what each run spent, and how independent the lane\n * was — the report app-creation-test-004's driving session wrote by hand. Derived on every read from rows,\n * registers and git; nothing is stored here, and nothing in the lane reads it.\n */\n@injectable()\nexport class CreationRunReportCompanionService {\n public constructor(\n @inject(COMPANION_SERVICE_TYPES.CreationInterventionLedgerService) private readonly ledger: CreationInterventionLedgerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ExecutionsService) private readonly executions: CompanionExecutionsCompanionService,\n @inject(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService) private readonly buildDispatch: ApplicationBuildDispatchCompanionService,\n @inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService) private readonly playbookRunWrites: PlaybookRunWriteRegisterCompanionService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {}\n\n public async describe(): Promise<CreationRunReport> {\n const notChecked: string[] = [];\n /*\n * To the build record's history ceiling, as the timeline reads them (#3706): the HTTP listing's 200-row cap dropped\n * the oldest runs of a long creation, so their spend and the playbook a restart interrupted went missing. The same\n * query as the timeline's, so the two share one cached listing.\n */\n const rows = await this.executions.listActorExecutions(\n { systemRef: META_WORKFLOWS_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING },\n ) as unknown as PlaybookRunExecutionRow[];\n if (rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING) {\n notChecked.push(`playbook runs: only the newest ${BUILD_TASK_RECORD_HISTORY_CEILING} executions were read, so older runs' spend and restarts' playbook names are missing`);\n }\n const playbookExecutions = new Map<string, CreationInterruptedPlaybookExecution>();\n // The unattended loop's rows name no playbook; a restart that interrupted one is still a restart of the loop.\n for (const loop of projectPlaybookLoops(rows)) playbookExecutions.set(loop.runId, { lane: CREATION_LOOP_LANE });\n const playbookRuns: CreationPlaybookRunSpend[] = [];\n let playbookRunsInFlight = 0;\n for (const row of rows) {\n const refs = row.standaloneTasks[0]?.context?.correlation?.refs;\n const playbookRef = refs?.['playbookRef'];\n if (typeof playbookRef !== 'string') continue;\n playbookExecutions.set(row._id, { lane: playbookRef, ...(typeof refs?.['rootRunId'] === 'string' ? { rootRunId: refs['rootRunId'] } : {}) });\n if (row.status === FlowsActors_Status.PROCESSING || row.status === FlowsActors_Status.PENDING) playbookRunsInFlight += 1;\n // A child's spend is inside its root's: only ROOT runs are summed, or a composite's work counts twice.\n if (typeof refs?.['rootRunId'] === 'string') continue;\n const measurement = readPlaybookRunMeasurement(row.standaloneTasks[0]?.output);\n playbookRuns.push({\n runId: row._id,\n playbookRef,\n ...(typeof refs?.['instanceKey'] === 'string' ? { instanceKey: refs['instanceKey'] } : {}),\n startedAt: row.createdAt.toISOString(),\n ...(row.finishedAt ? { finishedAt: row.finishedAt.toISOString() } : {}),\n status: row.status,\n ...(measurement ? { spend: measurement.spend } : {}),\n });\n }\n playbookRuns.sort((left, right) => left.startedAt.localeCompare(right.startedAt));\n\n const loopSelections = projectPlaybookLoops(rows).map((loop): CreationLoopSelectionSpend => {\n // The loop's own row counts every lane it ran; each lane is also a root run above, so only the rest is the loop's.\n const laneSpends: PlaybookSpend[] = (loop.steps ?? []).flatMap((step) => (step.lanes ?? []).flatMap((lane) => (lane.spend ? [lane.spend] : [])));\n const cost: Record<string, number> = { ...(loop.measurement?.spend.cost ?? {}) };\n for (const lane of laneSpends) for (const [currency, amount] of Object.entries(lane.cost ?? {})) cost[currency] = (cost[currency] ?? 0) - amount;\n const kept = Object.fromEntries(Object.entries(cost).filter((entry) => entry[1] > 0));\n return { runId: loop.runId, startedAt: loop.startedAt, ...(Object.keys(kept).length > 0 ? { cost: kept } : {}) };\n });\n\n let build: Awaited<ReturnType<ApplicationBuildDispatchCompanionService['describeBuildTaskRecords']>>;\n try {\n build = await this.buildDispatch.describeBuildTaskRecords();\n if (build === undefined) notChecked.push('build: the application has no build plan yet, so there are no coding runs to count');\n } catch (error) {\n // A plan a failed module holds exists (#3258): the report says so instead of dying, or of saying there is none.\n if (!isBuildPlanHeldByFailedModule(error)) throw error;\n notChecked.push(`build: the build plan could not be read, so its coding runs are not counted. ${error.message}`);\n }\n if (build?.attemptsTruncated) notChecked.push('build: the attempt listing hit its page cap, so coding runs, generation steps and their spend are a floor');\n const attempts = (build?.tasks ?? []).flatMap((task) => task.attempts.map((attempt) => ({ taskRef: task.taskRef, attempt })));\n const codingRuns: CreationCodingRunSpend[] = attempts\n // A generation step is an attempt and no agent run: it is not a coding run. Its own spend is listed apart, below.\n .filter(({ attempt }) => attempt.ranNothing !== true && attempt.generationStep !== true)\n .map(({ taskRef, attempt }) => ({\n runTaskId: attempt.runTaskId,\n taskRef,\n startedAt: attempt.startedAt,\n ...(attempt.settledAt ? { settledAt: attempt.settledAt } : {}),\n ...(attempt.tokens ? { tokens: attempt.tokens } : {}),\n ...(attempt.cost ? { cost: attempt.cost } : {}),\n }))\n .sort((left, right) => left.startedAt.localeCompare(right.startedAt));\n const generationSteps: CreationGenerationStepSpend[] = attempts\n .filter(({ attempt }) => attempt.ranNothing !== true && attempt.generationStep === true)\n .map(({ taskRef, attempt }) => ({\n runTaskId: attempt.runTaskId,\n taskRef,\n startedAt: attempt.startedAt,\n ...(attempt.settledAt ? { settledAt: attempt.settledAt } : {}),\n ...(attempt.generationStepSpend ? { spend: attempt.generationStepSpend } : {}),\n }))\n .sort((left, right) => left.startedAt.localeCompare(right.startedAt));\n const codingRunsInFlight = attempts.filter(({ attempt }) => attempt.status === FlowsActors_Status.PROCESSING || attempt.status === FlowsActors_Status.PENDING).length;\n\n const { interventions, notChecked: ledgerNotChecked } = await this.ledger.deriveInterventions({\n buildAttempts: attempts.map(({ taskRef, attempt }) => ({\n taskRef,\n runTaskId: attempt.runTaskId,\n startedAt: attempt.startedAt,\n ...(attempt.rearm ? { rearm: attempt.rearm } : {}),\n ...(attempt.landedOverride ? { landedOverride: attempt.landedOverride } : {}),\n })),\n playbookExecutions,\n runsInFlight: playbookRunsInFlight + codingRunsInFlight,\n });\n notChecked.push(...ledgerNotChecked);\n\n // A playbook lane's landings are its runs that landed files; the build's, its tasks the plan reads landed.\n // A FAILED landing's record (#3237) holds what a run left behind when it threw, which is no landing.\n const landedByLane = new Map<string, number>();\n const playbookRunWriteRecords = await this.playbookRunWrites.list();\n for (const record of playbookRunWriteRecords.filter((candidate) => candidate.landingFailed !== true)) {\n landedByLane.set(record.playbookRef, (landedByLane.get(record.playbookRef) ?? 0) + 1);\n }\n // Listed instead (#3265): an accepted one has been settled by a person and is history, not a prompt.\n const failedLandings: CreationFailedLanding[] = playbookRunWriteRecords\n .filter((record) => record.landingFailed === true && record.acceptedCommitSha === undefined)\n .map((record) => ({\n runId: record.runId,\n playbookRef: record.playbookRef,\n at: record.at,\n paths: record.files.map((file) => file.path),\n remedies: describeFailedLandingRemedies(record.runId),\n }));\n const landedBuildTasks = build?.summary.landed ?? 0;\n if (build !== undefined) landedByLane.set(CREATION_BUILD_LANE, landedBuildTasks);\n const independence = deriveIndependenceScore(interventions, landedByLane);\n const buildInterventions = interventions.filter((intervention) => intervention.targets.some((target) => target.lane === CREATION_BUILD_LANE)).length;\n\n return {\n generatedAt: new Date().toISOString(),\n application: { slug: this.companionContext.saasConfig.slug },\n interventions,\n independence: {\n ...independence,\n landedBuildTasks,\n interventionsPerLandedBuildTask: landedBuildTasks > 0 ? Math.round((buildInterventions / landedBuildTasks) * 100) / 100 : buildInterventions === 0 ? 0 : null,\n },\n spend: { playbookRuns, codingRuns, generationSteps, loopSelections, total: deriveJourneySpend({ playbookRuns, codingRuns, generationSteps, loopSelections }) },\n failedLandings,\n notChecked,\n };\n }\n\n /**\n * `GET /creation/timeline` (#3206, epic #3204): how long each phase of the journey took, the wall clock, and the\n * slowest build tasks with their dispatch wait and run time. Derived on every read from the rows, like the report,\n * and read on its own: it needs no build plan, no landing pass and no git, so it answers on an application whose\n * build has not started and costs two listings.\n *\n * Reads the playbook runs to the build record's history ceiling, as `describe` does: a phase's START is its OLDEST\n * run, which is the first a newest-first window drops.\n *\n * It also carries the accepted build plan's GRAPH (#3204's budget: \"at least 3 concurrent tasks when ready\" needs to\n * know when a task could have run, which no attempt row says). Read from the specifications' data slots, which the\n * companion holds cached while nothing changed, and still with no landing pass: a plan that cannot be read is said in\n * `notChecked` and leaves the graph NULL, never failing the read.\n *\n * A playbook run a restart ended is measured to the restart like a build attempt, and unlike one it is not marked:\n * the engine's startup sweep writes the same failure for it as for any orphan, and the meta-workflows sweep passes no\n * description of its own. A phase interrupted by a restart may therefore run long.\n */\n public async describeTimeline(): Promise<CreationJourney_Timeline> {\n const notChecked: string[] = [];\n const [playbookRows, ...attemptPages] = await Promise.all([\n this.executions.listActorExecutions({ systemRef: META_WORKFLOWS_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING }),\n ...[APPLICATION_CODING_SYSTEM_REF, APPLICATION_BUILD_SYSTEM_REF].map((systemRef) =>\n this.executions.listActorExecutions({ systemRef, limit: BUILD_TASK_RECORD_HISTORY_CEILING })),\n ]);\n if (playbookRows.length >= BUILD_TASK_RECORD_HISTORY_CEILING) {\n notChecked.push(`playbook runs: only the newest ${BUILD_TASK_RECORD_HISTORY_CEILING} executions were read, so the earliest phase starts are later than they were`);\n }\n if (attemptPages.some((page) => page.length >= BUILD_TASK_RECORD_HISTORY_CEILING)) {\n notChecked.push(`build attempts: only the newest ${BUILD_TASK_RECORD_HISTORY_CEILING} of a system were read, so the build's start and the task totals are a floor`);\n }\n const playbookRuns: CreationJourneyPlaybookRun[] = [];\n for (const row of playbookRows as unknown as PlaybookRunExecutionRow[]) {\n const playbookRef = row.standaloneTasks[0]?.context?.correlation?.refs?.['playbookRef'];\n // The unattended loop's own rows name no playbook: each lane it ran is a row of its own, counted there.\n if (typeof playbookRef !== 'string') continue;\n playbookRuns.push({\n runId: row._id,\n playbookRef,\n startedAt: row.createdAt.toISOString(),\n ...(row.finishedAt ? { finishedAt: row.finishedAt.toISOString() } : {}),\n status: row.status,\n ...(row.suspension?.suspendedAt ? { suspendedAt: row.suspension.suspendedAt } : {}),\n });\n }\n const buildAttempts: CreationJourneyBuildAttempt[] = [];\n for (const row of attemptPages.flat() as unknown as ReadonlyArray<Parameters<typeof projectBuildTaskAttempt>[0] & {\n readonly suspension?: { readonly suspendedAt?: string } | null;\n }>) {\n const projected = projectBuildTaskAttempt(row);\n if (projected === null) continue;\n const { attempt } = projected;\n // A coding run parked on a question (AWAITING_APPROVAL) is waiting on a person, as a parked playbook run is.\n const parkedAt = attempt.status === FlowsActors_Status.AWAITING_APPROVAL ? row.suspension?.suspendedAt : undefined;\n buildAttempts.push({\n taskRef: projected.taskRef,\n selectedAt: attempt.startedAt,\n ...(attempt.preparationStartedAt ? { preparationStartedAt: attempt.preparationStartedAt } : {}),\n ...(attempt.admittedAt ? { admittedAt: attempt.admittedAt } : {}),\n ...(attempt.settledAt ? { settledAt: attempt.settledAt } : {}),\n ...(parkedAt ? { waitingOnPersonSince: parkedAt } : {}),\n /*\n * Settled by a later process's startup sweep: the coding lane's interrupted disposition (every row it ever wrote),\n * or the startup marker the sweep writes on a selected-only run and a generation step since #3206.\n */\n endedByCompanionRestart: attempt.disposition === ApplicationCodingTaskDisposition.INTERRUPTED_REQUIRES_REVIEW\n || isInterruptedAtStartupOutput(row.standaloneTasks[0]?.output),\n generationStep: attempt.generationStep === true,\n });\n }\n if (buildAttempts.some((attempt) => attempt.preparationStartedAt === undefined)) {\n notChecked.push('dispatch wait: an attempt recorded before #3206 carries no preparation start, so its wait is measured from its selection and is a floor');\n }\n const endedByRestart = buildAttempts.filter((attempt) => attempt.endedByCompanionRestart).length;\n if (endedByRestart > 0) {\n notChecked.push(`build attempts: ${endedByRestart} ended by a companion restart are measured to that restart, which includes any time the companion was down`);\n }\n const { phaseOf, ambiguousPlaybookRefs } = classifyPlaybookRefsByJourneyPhase(readCompiledChoreographyAdmits);\n const buildPlanGraph = await this.readBuildPlanGraph(notChecked);\n // Research turns write no playbook-run row (#3896); their evidence records say when they ran.\n let researchTurns: ReturnType<typeof readResearchTurnRecords> = [];\n try {\n // A context with no application root has no evidence store to read.\n if (this.companionContext.saasRoot) researchTurns = readResearchTurnRecords(this.companionContext.saasRoot);\n } catch (error) {\n notChecked.push(`research turns: their evidence records could not be read (${describeCaughtError(error)}), so a phase that began with research may start late`);\n }\n return deriveCreationJourneyTimeline({ now: new Date(), playbookRuns, researchTurns, buildAttempts, phaseOf, ambiguousPlaybookRefs, buildPlanGraph, notChecked });\n }\n\n /**\n * The accepted build plan's tasks and their prerequisites, by SHAPE: the timeline needs two fields, not a validated\n * plan, and validating it is the dispatcher's job (an invalid plan dispatches nothing, which its own reads say). NULL\n * when no plan is authored yet, which is a true answer for every application before build-decompose; NULL plus a\n * `notChecked` line when one exists and cannot be read, so \"no plan\" and \"could not look\" stay apart.\n */\n private async readBuildPlanGraph(notChecked: string[]): Promise<readonly CreationJourney_BuildPlanTask[] | null> {\n let authored: unknown;\n try {\n authored = (await loadSpecificationFamilyData(this.companionContext) as unknown as Record<string, unknown>).buildPlanSpecification;\n } catch (error) {\n notChecked.push(`build plan: the specifications could not be read (${describeCaughtError(error)}), so the plan graph is absent`);\n return null;\n }\n if (authored === undefined || authored === null) return null;\n const tasks = (authored as { readonly tasks?: unknown }).tasks;\n const graph: CreationJourney_BuildPlanTask[] = [];\n for (const task of Array.isArray(tasks) ? tasks : []) {\n const { taskRef, prerequisiteTaskRefs } = (task ?? {}) as { readonly taskRef?: unknown; readonly prerequisiteTaskRefs?: unknown };\n if (typeof taskRef !== 'string' || taskRef.length === 0) continue;\n graph.push({\n taskRef,\n prerequisiteTaskRefs: Array.isArray(prerequisiteTaskRefs) ? prerequisiteTaskRefs.filter((ref): ref is string => typeof ref === 'string' && ref.length > 0) : [],\n });\n }\n if (!Array.isArray(tasks) || graph.length !== tasks.length) {\n notChecked.push('build plan: the authored plan has tasks of no readable shape, so the plan graph is absent');\n return null;\n }\n return graph;\n }\n\n /** Record why a person intervened; refused for an id the current report does not hold. */\n public async stateReason(interventionId: string, reason: string): Promise<{ readonly interventionId: string; readonly statedAt: string }> {\n const report = await this.describe();\n return this.ledger.stateReason(interventionId, reason, new Set(report.interventions.map((intervention) => intervention.id)));\n }\n}\n\n/**\n * What a compiled playbook's choreography admits, read from the framework-knowledge catalog the companion ships with:\n * the catalog is what the lanes ran from, so it is what says which lane a run's playbook belongs to. Read by shape\n * (the loader types a playbook `unknown`), and loaded once per process — the compiled catalog does not change under a\n * running companion.\n */\nlet compiledChoreographyAdmits: ReadonlyMap<string, readonly string[]> | undefined;\nfunction readCompiledChoreographyAdmits(ref: string): readonly string[] {\n compiledChoreographyAdmits ??= new Map(listFrameworkKnowledgePlaybooks().map((entry) => {\n const admits = (getFrameworkKnowledgePlaybook(entry.ref)?.playbook as { method?: { choreography?: { admits?: unknown } } } | undefined)?.method?.choreography?.admits;\n return [entry.ref, Array.isArray(admits) ? admits.filter((admitted): admitted is string => typeof admitted === 'string') : []];\n }));\n return compiledChoreographyAdmits.get(ref) ?? [];\n}\n"]}
|