@wildo-ai/dev-companion 1.1.1 → 1.1.2
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 +12 -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 +11 -0
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +153 -1
- 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 +419 -41
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +25 -10
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +65 -24
- package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +86 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js +127 -0
- package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -0
- package/dist/esm/companion-api/companion-api.schemas.d.ts +59 -2
- package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.js +60 -0
- package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +63 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +322 -21
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/core/inject/models/container.d.ts.map +1 -1
- package/dist/esm/core/inject/models/container.js +11 -0
- package/dist/esm/core/inject/models/container.js.map +1 -1
- package/dist/esm/core/inject/models/service-types.d.ts +5 -0
- package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/core/inject/models/service-types.js +5 -0
- package/dist/esm/core/inject/models/service-types.js.map +1 -1
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js +81 -0
- package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js.map +1 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.d.ts +11 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
- package/dist/esm/core/introspection/models/companion-introspection.models.js +39 -0
- package/dist/esm/core/introspection/models/companion-introspection.models.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +8 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +317 -0
- package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts +45 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +250 -0
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts +123 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js +298 -0
- package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts +78 -1
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js +155 -6
- package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +131 -2
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +259 -9
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts +243 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js +417 -0
- package/dist/esm/core/introspection/services/introspection-derivation-state.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +186 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +368 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts +101 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js +278 -0
- package/dist/esm/core/introspection/services/introspection-source-watcher.companion.service.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +365 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js +167 -0
- package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -0
- 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 +332 -3
- package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts +19 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js +164 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +3 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +36 -23
- package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +51 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +391 -0
- package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -0
- package/dist/esm/core/runtime/companion-startup-assembly.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-startup-assembly.js +5 -0
- package/dist/esm/core/runtime/companion-startup-assembly.js.map +1 -1
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +103 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js +124 -0
- package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -0
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +39 -2
- 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 +122 -11
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts +6 -0
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.d.ts.map +1 -1
- package/dist/esm/core/specifications/non-composite-view-specification-context.shared.js.map +1 -1
- package/dist/esm/core/specifications/specification-context-factory.shared.d.ts +23 -0
- package/dist/esm/core/specifications/specification-context-factory.shared.d.ts.map +1 -1
- package/dist/esm/core/specifications/specification-context-factory.shared.js +26 -4
- package/dist/esm/core/specifications/specification-context-factory.shared.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +82 -3
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +126 -12
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +12 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +12 -0
- package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +13 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +1 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.js +91 -0
- package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +1 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts +38 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.d.ts.map +1 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.js +41 -0
- package/dist/esm/i18n/composite_views/app.domain-model.en.js.map +1 -0
- package/dist/esm/i18n/index.d.ts +3 -3
- package/dist/esm/i18n/index.js +3 -3
- package/dist/esm/i18n/index.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +24 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +20 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts +31 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js +27 -0
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.en.js.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts +24 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js +20 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts +28 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js +24 -0
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts +138 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.js +100 -0
- package/dist/esm/i18n/resources/workbenchDomainResources.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +29 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +25 -0
- package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +27 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +23 -0
- package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +806 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +326 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts +26 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.d.ts.map +1 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.js +22 -0
- package/dist/esm/i18n/resources/workbenchTraceSessions.en.js.map +1 -0
- package/dist/esm/i18n/system_enums/market.en.d.ts +202 -0
- package/dist/esm/i18n/system_enums/market.en.d.ts.map +1 -0
- package/dist/esm/i18n/system_enums/market.en.js +209 -0
- package/dist/esm/i18n/system_enums/market.en.js.map +1 -0
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +112 -2
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +201 -34
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts +31 -3
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +48 -12
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts +36 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.d.ts.map +1 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +75 -0
- package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -0
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +105 -7
- 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 +298 -24
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +46 -3
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +95 -2
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts +9 -0
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js +13 -0
- package/dist/esm/meta-workflows/services/execution-trace-read.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +12 -0
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +23 -0
- package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +120 -3
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +636 -81
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts +40 -0
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js +63 -1
- package/dist/esm/meta-workflows/services/playbook-suspended-run.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts +21 -0
- package/dist/esm/technical-doc/services/technical-doc.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js +86 -2
- package/dist/esm/technical-doc/services/technical-doc.companion.service.js.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts +12 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.d.ts.map +1 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js +47 -1
- package/dist/esm/technical-doc/services/technical-documentation-application-derivation.companion.service.js.map +1 -1
- package/package.json +17 -17
- package/dist/esm/.builder.pid +0 -9
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts +0 -36
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js +0 -32
- package/dist/esm/i18n/resources/workbenchApplicationModules.en.js.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts +0 -29
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.d.ts.map +0 -1
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js +0 -25
- package/dist/esm/i18n/resources/workbenchResourceRelationships.en.js.map +0 -1
package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { LabellingPlannerCompanionService } from '../../i18n-labelling/services/
|
|
|
5
5
|
import { LabellizeOrchestratorCompanionService, type LabellizeRunResult } from '../../i18n-labelling/services/labellize-orchestrator.companion.service';
|
|
6
6
|
import { TranslateOrchestratorCompanionService, type TranslateRunResult } from '../../i18n-labelling/services/translate-orchestrator.companion.service';
|
|
7
7
|
import { EmailTemplateCompanionService, type GenerateEmailTemplatesResult, type TranslateEmailTemplateLabelsResult } from '../../email/services/email-template.companion.service';
|
|
8
|
+
import { LogoDeliberationCompanionService, type LogoDeliberationResult } from '../../brand/services/logo-deliberation.companion.service';
|
|
9
|
+
import { BrandAcceptCompanionService, type BrandAcceptResult } from '../../brand/services/brand-accept.companion.service';
|
|
8
10
|
import type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';
|
|
9
11
|
/**
|
|
10
12
|
* The companion generation steps this host can EXECUTE.
|
|
@@ -24,7 +26,18 @@ import type { CompanionExecutionSessionContext } from '../../core/traceability/c
|
|
|
24
26
|
*/
|
|
25
27
|
export declare enum ApplicationBuildGenerationStep {
|
|
26
28
|
I18N_LABELS = "i18n-labels",
|
|
27
|
-
EMAIL_TEMPLATES = "email-templates"
|
|
29
|
+
EMAIL_TEMPLATES = "email-templates",
|
|
30
|
+
/**
|
|
31
|
+
* The brand mark: an expert panel derives creative directions, images are generated, a vision
|
|
32
|
+
* judge scores them, and the winner is promoted into the specifications SSOT.
|
|
33
|
+
*
|
|
34
|
+
* Added under the rule this enum's docblock states — a value joins WHEN a pipeline exists to
|
|
35
|
+
* execute it. That pipeline was fully built and reachable only by a human issuing
|
|
36
|
+
* `POST /brand/{generate,deliberate,accept}-logo`, so an application could acquire a considered
|
|
37
|
+
* mark only if someone drove it by hand (issue #220). Hand-supplying a logo stays available and
|
|
38
|
+
* unchanged; what this adds is the journey's own path to one.
|
|
39
|
+
*/
|
|
40
|
+
LOGO = "logo"
|
|
28
41
|
}
|
|
29
42
|
/** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */
|
|
30
43
|
export declare class ApplicationBuildUnknownGenerationStepError extends Error {
|
|
@@ -50,8 +63,26 @@ export interface ApplicationBuildEmailTemplatesStepRunResult {
|
|
|
50
63
|
/** The app-root-relative files this step is responsible for — the same paths the landed check reads. */
|
|
51
64
|
readonly evidencePaths: readonly string[];
|
|
52
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* What one executed logo step did.
|
|
68
|
+
*
|
|
69
|
+
* `deliberation`/`accept` are absent when the step was SKIPPED because the application already has
|
|
70
|
+
* an accepted mark — see the executor for why skipping is the incremental answer here rather than
|
|
71
|
+
* the freshness lock the text pipelines use.
|
|
72
|
+
*/
|
|
73
|
+
export interface ApplicationBuildLogoStepRunResult {
|
|
74
|
+
readonly generationStepRef: ApplicationBuildGenerationStep.LOGO;
|
|
75
|
+
/** The expert-panel deliberation that derived directions, generated marks and picked a winner. */
|
|
76
|
+
readonly deliberation?: LogoDeliberationResult;
|
|
77
|
+
/** Promotion of that winner into `specifications/src/brand/` — images plus the rewritten SSOT. */
|
|
78
|
+
readonly accept?: BrandAcceptResult;
|
|
79
|
+
/** True when an accepted mark already existed and no model was called. */
|
|
80
|
+
readonly skippedBecauseAlreadyAccepted: boolean;
|
|
81
|
+
/** The app-root-relative files this step is responsible for — the same paths the landed check reads. */
|
|
82
|
+
readonly evidencePaths: readonly string[];
|
|
83
|
+
}
|
|
53
84
|
/** One executed generation step's result, discriminated by the step it ran. */
|
|
54
|
-
export type ApplicationBuildGenerationStepRunResult = ApplicationBuildI18nLabelsStepRunResult | ApplicationBuildEmailTemplatesStepRunResult;
|
|
85
|
+
export type ApplicationBuildGenerationStepRunResult = ApplicationBuildI18nLabelsStepRunResult | ApplicationBuildEmailTemplatesStepRunResult | ApplicationBuildLogoStepRunResult;
|
|
55
86
|
/**
|
|
56
87
|
* Execute companion-owned generation steps of a build plan, and answer which
|
|
57
88
|
* files each step is responsible for.
|
|
@@ -84,8 +115,10 @@ export declare class ApplicationBuildGenerationStepCompanionService {
|
|
|
84
115
|
private readonly labellize;
|
|
85
116
|
private readonly translate;
|
|
86
117
|
private readonly emailTemplates;
|
|
118
|
+
private readonly logoDeliberation;
|
|
119
|
+
private readonly brandAccept;
|
|
87
120
|
private readonly logDebug;
|
|
88
|
-
constructor(logger: LoggerService, appConfigService: AppConfigurationService, companionContext: CompanionContext, planner: LabellingPlannerCompanionService, labellize: LabellizeOrchestratorCompanionService, translate: TranslateOrchestratorCompanionService, emailTemplates: EmailTemplateCompanionService);
|
|
121
|
+
constructor(logger: LoggerService, appConfigService: AppConfigurationService, companionContext: CompanionContext, planner: LabellingPlannerCompanionService, labellize: LabellizeOrchestratorCompanionService, translate: TranslateOrchestratorCompanionService, emailTemplates: EmailTemplateCompanionService, logoDeliberation: LogoDeliberationCompanionService, brandAccept: BrandAcceptCompanionService);
|
|
89
122
|
/**
|
|
90
123
|
* The app-root-relative files this task's generation step is responsible
|
|
91
124
|
* for. The landed check treats the task as landed when EVERY one of them is
|
|
@@ -99,6 +132,16 @@ export declare class ApplicationBuildGenerationStepCompanionService {
|
|
|
99
132
|
* an already-satisfied step costs a plan read, not a model call.
|
|
100
133
|
*/
|
|
101
134
|
executeGenerationStep(task: BuildPlanTask, session?: CompanionExecutionSessionContext): Promise<ApplicationBuildGenerationStepRunResult>;
|
|
135
|
+
/**
|
|
136
|
+
* Does this application already carry an accepted brand mark?
|
|
137
|
+
*
|
|
138
|
+
* Presence of the SSOT module is the whole test. It is written only by a promotion, so its
|
|
139
|
+
* existence means a winner was chosen — and its ABSENCE is what makes the step run. Reading the
|
|
140
|
+
* module's contents to count assets was considered and rejected: it would need the specifications
|
|
141
|
+
* package evaluated, which is a far heavier question than "has this step ever succeeded", and the
|
|
142
|
+
* landed check next door already keys on the same file.
|
|
143
|
+
*/
|
|
144
|
+
private hasAcceptedBrandMark;
|
|
102
145
|
private requireGenerationStepRef;
|
|
103
146
|
/**
|
|
104
147
|
* The locales this application ENABLES — `appPreferences.languages.enabledLanguages`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-build-generation-step.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"application-build-generation-step.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE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E,aAAa,EACX,gBAAgB,EAAE,uBAAuB,EACpC,gBAAgB,EAAE,gBAAgB,EAC3B,OAAO,EAAE,gCAAgC,EACpC,SAAS,EAAE,qCAAqC,EAChD,SAAS,EAAE,qCAAqC,EACxD,cAAc,EAAE,6BAA6B,EAC1C,gBAAgB,EAAE,gCAAgC,EACvD,WAAW,EAAE,2BAA2B;IAK/G;;;;;OAKG;IACU,kCAAkC,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAiChG;;;;OAIG;IACU,qBAAqB,CAChC,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE,gCAAgC,GACzC,OAAO,CAAC,uCAAuC,CAAC;IA8EnD;;;;;;;;OAQG;YACW,oBAAoB;IAgBlC,OAAO,CAAC,wBAAwB;IAQhC;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAa7B,gHAAgH;IAChH,OAAO,CAAC,uBAAuB;CAOhC"}
|
package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js
CHANGED
|
@@ -11,6 +11,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
12
|
};
|
|
13
13
|
import * as path from 'node:path';
|
|
14
|
+
import { stat } from 'node:fs/promises';
|
|
14
15
|
import { inject, injectable } from 'inversify';
|
|
15
16
|
import { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
|
|
16
17
|
import { AvailableLanguage } from '@wildo-ai/presets-components-models';
|
|
@@ -21,6 +22,8 @@ import { LabellingPlannerCompanionService } from '../../i18n-labelling/services/
|
|
|
21
22
|
import { LabellizeOrchestratorCompanionService, } from '../../i18n-labelling/services/labellize-orchestrator.companion.service.js';
|
|
22
23
|
import { TranslateOrchestratorCompanionService, } from '../../i18n-labelling/services/translate-orchestrator.companion.service.js';
|
|
23
24
|
import { EmailTemplateCompanionService, } from '../../email/services/email-template.companion.service.js';
|
|
25
|
+
import { LogoDeliberationCompanionService, } from '../../brand/services/logo-deliberation.companion.service.js';
|
|
26
|
+
import { BrandAcceptCompanionService, } from '../../brand/services/brand-accept.companion.service.js';
|
|
24
27
|
/**
|
|
25
28
|
* The companion generation steps this host can EXECUTE.
|
|
26
29
|
*
|
|
@@ -41,7 +44,25 @@ export var ApplicationBuildGenerationStep;
|
|
|
41
44
|
(function (ApplicationBuildGenerationStep) {
|
|
42
45
|
ApplicationBuildGenerationStep["I18N_LABELS"] = "i18n-labels";
|
|
43
46
|
ApplicationBuildGenerationStep["EMAIL_TEMPLATES"] = "email-templates";
|
|
47
|
+
/**
|
|
48
|
+
* The brand mark: an expert panel derives creative directions, images are generated, a vision
|
|
49
|
+
* judge scores them, and the winner is promoted into the specifications SSOT.
|
|
50
|
+
*
|
|
51
|
+
* Added under the rule this enum's docblock states — a value joins WHEN a pipeline exists to
|
|
52
|
+
* execute it. That pipeline was fully built and reachable only by a human issuing
|
|
53
|
+
* `POST /brand/{generate,deliberate,accept}-logo`, so an application could acquire a considered
|
|
54
|
+
* mark only if someone drove it by hand (issue #220). Hand-supplying a logo stays available and
|
|
55
|
+
* unchanged; what this adds is the journey's own path to one.
|
|
56
|
+
*/
|
|
57
|
+
ApplicationBuildGenerationStep["LOGO"] = "logo";
|
|
44
58
|
})(ApplicationBuildGenerationStep || (ApplicationBuildGenerationStep = {}));
|
|
59
|
+
/**
|
|
60
|
+
* The SSOT module `brand-accept` rewrites when it promotes a winner.
|
|
61
|
+
*
|
|
62
|
+
* Restated here rather than imported because it is a module-private constant of the brand service;
|
|
63
|
+
* the two must agree, and the pin in this lane's tests is what says so.
|
|
64
|
+
*/
|
|
65
|
+
const BRAND_RESOLVED_ASSETS_MODULE = 'resolved-assets.generated.ts';
|
|
45
66
|
/** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */
|
|
46
67
|
export class ApplicationBuildUnknownGenerationStepError extends Error {
|
|
47
68
|
constructor(taskRef, generationStepRef) {
|
|
@@ -81,8 +102,10 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
|
|
|
81
102
|
labellize;
|
|
82
103
|
translate;
|
|
83
104
|
emailTemplates;
|
|
105
|
+
logoDeliberation;
|
|
106
|
+
brandAccept;
|
|
84
107
|
logDebug;
|
|
85
|
-
constructor(logger, appConfigService, companionContext, planner, labellize, translate, emailTemplates) {
|
|
108
|
+
constructor(logger, appConfigService, companionContext, planner, labellize, translate, emailTemplates, logoDeliberation, brandAccept) {
|
|
86
109
|
this.logger = logger;
|
|
87
110
|
this.appConfigService = appConfigService;
|
|
88
111
|
this.companionContext = companionContext;
|
|
@@ -90,6 +113,8 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
|
|
|
90
113
|
this.labellize = labellize;
|
|
91
114
|
this.translate = translate;
|
|
92
115
|
this.emailTemplates = emailTemplates;
|
|
116
|
+
this.logoDeliberation = logoDeliberation;
|
|
117
|
+
this.brandAccept = brandAccept;
|
|
93
118
|
this.logDebug = this.logger.debugByType('ApplicationBuildGenerationStep');
|
|
94
119
|
}
|
|
95
120
|
/**
|
|
@@ -110,6 +135,20 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
|
|
|
110
135
|
case ApplicationBuildGenerationStep.EMAIL_TEMPLATES:
|
|
111
136
|
// Placement is the email domain's authority; this lane only crosses it with the enabled locales.
|
|
112
137
|
return this.emailTemplates.resolveExpectedArtifactRelativePaths(this.resolveEnabledLocales());
|
|
138
|
+
case ApplicationBuildGenerationStep.LOGO:
|
|
139
|
+
/*
|
|
140
|
+
* The SSOT MODULE alone, deliberately — not the asset images beside it.
|
|
141
|
+
*
|
|
142
|
+
* Evidence must be derivable BEFORE the step runs, and the image filenames cannot be: they
|
|
143
|
+
* are named after whichever mark the panel picks. The module can, and it is the honest
|
|
144
|
+
* marker either way — `brand-accept` writes it only when a winner is promoted, so it is
|
|
145
|
+
* absent on an application that has never accepted a logo and present exactly when one has.
|
|
146
|
+
*
|
|
147
|
+
* This is NOT the directory-prefix shortcut this class's docblock warns about. That check
|
|
148
|
+
* would pass on any app whose `specifications/` is committed at all; this file exists only
|
|
149
|
+
* as a consequence of the step's own work.
|
|
150
|
+
*/
|
|
151
|
+
return [path.posix.join('specifications', 'src', 'brand', BRAND_RESOLVED_ASSETS_MODULE)];
|
|
113
152
|
default:
|
|
114
153
|
throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);
|
|
115
154
|
}
|
|
@@ -160,10 +199,60 @@ let ApplicationBuildGenerationStepCompanionService = class ApplicationBuildGener
|
|
|
160
199
|
evidencePaths: await this.resolveGenerationStepEvidencePaths(task),
|
|
161
200
|
};
|
|
162
201
|
}
|
|
202
|
+
case ApplicationBuildGenerationStep.LOGO: {
|
|
203
|
+
const evidencePaths = await this.resolveGenerationStepEvidencePaths(task);
|
|
204
|
+
/*
|
|
205
|
+
* Incremental, but by PRESENCE rather than by the freshness lock the text pipelines use.
|
|
206
|
+
*
|
|
207
|
+
* Those pipelines skip per UNIT, because a label is cheap and units come and go. A logo
|
|
208
|
+
* deliberation is a panel of three experts, N generated images and a vision judge — the
|
|
209
|
+
* most expensive step in this enum by a wide margin — and an application has exactly one
|
|
210
|
+
* accepted mark. So the honest unit of freshness is "is there an accepted mark", and the
|
|
211
|
+
* answer is the same file the landed check reads. Re-running a satisfied step costs a
|
|
212
|
+
* `stat`, not a model call.
|
|
213
|
+
*
|
|
214
|
+
* Replacing an existing mark stays a deliberate act through the brand routes; a build must
|
|
215
|
+
* never quietly redraw an application's identity because it ran again.
|
|
216
|
+
*/
|
|
217
|
+
if (await this.hasAcceptedBrandMark()) {
|
|
218
|
+
this.logDebug('Skipping the logo generation step — an accepted mark already exists', {
|
|
219
|
+
taskRef: task.taskRef,
|
|
220
|
+
});
|
|
221
|
+
return { generationStepRef, skippedBecauseAlreadyAccepted: true, evidencePaths };
|
|
222
|
+
}
|
|
223
|
+
this.logDebug('Running the logo generation step', { taskRef: task.taskRef });
|
|
224
|
+
const deliberation = await this.logoDeliberation.run({});
|
|
225
|
+
/*
|
|
226
|
+
* `run` stages its winner as the standard single-candidate manifest `accept` expects, which
|
|
227
|
+
* is why the two compose with no adapter. Passing the ref explicitly rather than relying on
|
|
228
|
+
* that staging is the point at which this lane would otherwise trust an implicit hand-off.
|
|
229
|
+
*/
|
|
230
|
+
const accept = await this.brandAccept.accept({ candidateRef: deliberation.staged.winnerRef });
|
|
231
|
+
return { generationStepRef, deliberation, accept, skippedBecauseAlreadyAccepted: false, evidencePaths };
|
|
232
|
+
}
|
|
163
233
|
default:
|
|
164
234
|
throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);
|
|
165
235
|
}
|
|
166
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Does this application already carry an accepted brand mark?
|
|
239
|
+
*
|
|
240
|
+
* Presence of the SSOT module is the whole test. It is written only by a promotion, so its
|
|
241
|
+
* existence means a winner was chosen — and its ABSENCE is what makes the step run. Reading the
|
|
242
|
+
* module's contents to count assets was considered and rejected: it would need the specifications
|
|
243
|
+
* package evaluated, which is a far heavier question than "has this step ever succeeded", and the
|
|
244
|
+
* landed check next door already keys on the same file.
|
|
245
|
+
*/
|
|
246
|
+
async hasAcceptedBrandMark() {
|
|
247
|
+
const ssotModulePath = path.resolve(this.companionContext.saasRoot, 'specifications', 'src', 'brand', BRAND_RESOLVED_ASSETS_MODULE);
|
|
248
|
+
try {
|
|
249
|
+
await stat(ssotModulePath);
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
167
256
|
requireGenerationStepRef(task) {
|
|
168
257
|
const target = task.target;
|
|
169
258
|
if (target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {
|
|
@@ -204,10 +293,14 @@ ApplicationBuildGenerationStepCompanionService = __decorate([
|
|
|
204
293
|
__param(4, inject(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService)),
|
|
205
294
|
__param(5, inject(COMPANION_SERVICE_TYPES.TranslateOrchestratorService)),
|
|
206
295
|
__param(6, inject(COMPANION_SERVICE_TYPES.EmailTemplateService)),
|
|
296
|
+
__param(7, inject(COMPANION_SERVICE_TYPES.LogoDeliberationService)),
|
|
297
|
+
__param(8, inject(COMPANION_SERVICE_TYPES.BrandAcceptService)),
|
|
207
298
|
__metadata("design:paramtypes", [Function, Function, Object, LabellingPlannerCompanionService,
|
|
208
299
|
LabellizeOrchestratorCompanionService,
|
|
209
300
|
TranslateOrchestratorCompanionService,
|
|
210
|
-
EmailTemplateCompanionService
|
|
301
|
+
EmailTemplateCompanionService,
|
|
302
|
+
LogoDeliberationCompanionService,
|
|
303
|
+
BrandAcceptCompanionService])
|
|
211
304
|
], ApplicationBuildGenerationStepCompanionService);
|
|
212
305
|
export { ApplicationBuildGenerationStepCompanionService };
|
|
213
306
|
//# sourceMappingURL=application-build-generation-step.companion.service.js.map
|
package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-build-generation-step.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAsB,MAAM,oDAAoD,CAAC;AAEjH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,EAAE,gCAAgC,EAAE,MAAM,mEAAmE,CAAC;AACrH,OAAO,EACL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CAAC,MAA2B,CAAC,CAAC;YAC3E,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,CAAC,GAAG,IAAI,GAAG,CAAoB,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,gHAAgH;IACxG,uBAAuB;QAC7B,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACjE,CAAC;CACF,CAAA;AAjIY,8CAA8C;IAD1D,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAA;iEAH8B,gCAAgC;QACzB,qCAAqC;QACrC,qCAAqC;QACxC,6BAA6B;GAV3G,8CAA8C,CAiI1D","sourcesContent":["import * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\n\nimport type { AppConfigurationService, LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { AvailableLanguage } from '@wildo-ai/presets-components-models';\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { getCompanionConfiguredPrimaryLanguage } from '../../core/config/primary-language.companion.utils';\nimport { LabellingPlannerCompanionService } from '../../i18n-labelling/services/labelling-planner.companion.service';\nimport {\n LabellizeOrchestratorCompanionService,\n type LabellizeRunResult,\n} from '../../i18n-labelling/services/labellize-orchestrator.companion.service';\nimport {\n TranslateOrchestratorCompanionService,\n type TranslateRunResult,\n} from '../../i18n-labelling/services/translate-orchestrator.companion.service';\nimport {\n EmailTemplateCompanionService,\n type GenerateEmailTemplatesResult,\n type TranslateEmailTemplateLabelsResult,\n} from '../../email/services/email-template.companion.service';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\n\n/**\n * The companion generation steps this host can EXECUTE.\n *\n * The values are the `generationStepRef` slugs a build plan authors on a\n * `COMPANION_GENERATION_STEP` target — the closed vocabulary this enum is the\n * named home of. A build plan may only reference steps that exist here: an\n * unknown ref refuses by name (below) instead of silently parking the build,\n * which is exactly how the first generation step ever authored\n * (`i18n-labels`) stalled the Wonder Todos build plan — the vocabulary\n * existed in `_core`, and nothing executed it.\n *\n * Seeds join this enum WHEN a seed-generation pipeline exists to execute —\n * adding the value without one would let a build plan dispatch a step that can\n * only fail; the unknown-ref refusal below is the honest answer until then.\n * The executor is the integration point, not a new lane per step.\n */\nexport enum ApplicationBuildGenerationStep {\n I18N_LABELS = 'i18n-labels',\n EMAIL_TEMPLATES = 'email-templates',\n}\n\n/** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */\nexport class ApplicationBuildUnknownGenerationStepError extends Error {\n public constructor(taskRef: string, generationStepRef: string) {\n super(\n `Build task ${taskRef} references generation step \"${generationStepRef}\", which this companion cannot execute. `\n + `Known steps: ${Object.values(ApplicationBuildGenerationStep).join(', ')}.`,\n );\n }\n}\n\n/** What one executed i18n-labels step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildI18nLabelsStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.I18N_LABELS;\n /** Primary-locale label generation (incremental — fresh units are skipped by the freshness lock). */\n readonly labellize: LabellizeRunResult;\n /** Translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly translate?: TranslateRunResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** What one executed email-templates step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildEmailTemplatesStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.EMAIL_TEMPLATES;\n /** Primary-locale template + labels generation (incremental — existing template+labels pairs are skipped). */\n readonly emailGenerate: GenerateEmailTemplatesResult;\n /** Label translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly emailTranslate?: TranslateEmailTemplateLabelsResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** One executed generation step's result, discriminated by the step it ran. */\nexport type ApplicationBuildGenerationStepRunResult =\n | ApplicationBuildI18nLabelsStepRunResult\n | ApplicationBuildEmailTemplatesStepRunResult;\n\n/**\n * Execute companion-owned generation steps of a build plan, and answer which\n * files each step is responsible for.\n *\n * A `COMPANION_GENERATION_STEP` is deterministic in its ROUTING and its\n * PLACEMENT — which pipeline runs and where the files land is decided by\n * code, never by a coding agent (`application-build-task-coding-policy`\n * refuses to compose a coding contract for one). The CONTENT may still come\n * from a model (labels are generated text), which is exactly the directive's\n * bucket-3 shape: a companion-owned generation step interleaved by the build\n * loop.\n *\n * ## Landed evidence, and why it is planner-derived\n *\n * The build lane's landed answer is GIT: a task has landed when the files it\n * produces are committed. A generation step's target carries only its\n * `generationStepRef` — no paths — so the file set must be DERIVED. For\n * `i18n-labels` it is the labelling planner's unit inventory crossed with the\n * app's enabled locales: exactly the files the pipelines write, re-derivable\n * after a restart, a fresh clone, or a branch switch. Deliberately NOT the\n * whole i18n directory: that is already committed on any app with history, and\n * a directory-prefix check would report the step landed without it ever\n * having run for the units it still owes.\n */\n@injectable()\nexport class ApplicationBuildGenerationStepCompanionService {\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(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.LabellingPlannerService) private readonly planner: LabellingPlannerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService) private readonly labellize: LabellizeOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.TranslateOrchestratorService) private readonly translate: TranslateOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.EmailTemplateService) private readonly emailTemplates: EmailTemplateCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('ApplicationBuildGenerationStep');\n }\n\n /**\n * The app-root-relative files this task's generation step is responsible\n * for. The landed check treats the task as landed when EVERY one of them is\n * committed — same doctrine as every coding task, same reader\n * (`isWorktreePathCommitted`).\n */\n public async resolveGenerationStepEvidencePaths(task: BuildPlanTask): Promise<readonly string[]> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const i18nRoot = this.resolveI18nRelativeRoot();\n const locales = this.resolveEnabledLocales();\n const units = await this.planner.planAllUnits();\n return units.flatMap((unit) =>\n locales.map((locale) => path.posix.join(i18nRoot, unit.filePathHint.bucket, `${unit.filePathHint.slug}.${locale}.ts`)),\n );\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES:\n // Placement is the email domain's authority; this lane only crosses it with the enabled locales.\n return this.emailTemplates.resolveExpectedArtifactRelativePaths(this.resolveEnabledLocales());\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n /**\n * Run the task's generation step. Incremental by construction: both\n * pipelines consult the freshness lock and skip fresh units, so re-running\n * an already-satisfied step costs a plan read, not a model call.\n */\n public async executeGenerationStep(\n task: BuildPlanTask,\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildGenerationStepRunResult> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the i18n-labels generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const labellizeResult = await this.labellize.labellize({}, session);\n const translateResult = targetLocales.length > 0\n ? await this.translate.translate({ targetLocales }, session)\n : undefined;\n return {\n generationStepRef,\n labellize: labellizeResult,\n ...(translateResult ? { translate: translateResult } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the email-templates generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const emailGenerate = await this.emailTemplates.generateTemplates({}, session);\n const emailTranslate = targetLocales.length > 0\n ? await this.emailTemplates.translateEmailTemplateLabels({ targetLocales: [...targetLocales] }, session)\n : undefined;\n return {\n generationStepRef,\n emailGenerate,\n ...(emailTranslate ? { emailTranslate } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n private requireGenerationStepRef(task: BuildPlanTask): string {\n const target = task.target;\n if (target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n throw new Error(`Build task ${task.taskRef} is not a companion generation step.`);\n }\n return target.generationStepRef;\n }\n\n /**\n * The locales this application ENABLES — `appPreferences.languages.enabledLanguages`,\n * always including the primary. This is the \"every configured locale\" the\n * build task's objective speaks of; an app that enables only its primary\n * locale gets no translate pass and no foreign-locale evidence.\n */\n private resolveEnabledLocales(): readonly AvailableLanguage[] {\n const config = this.appConfigService.config as {\n appPreferences?: { languages?: { defaultLanguage?: unknown; enabledLanguages?: unknown } };\n } | null | undefined;\n const primary = getCompanionConfiguredPrimaryLanguage(config);\n const declared = config?.appPreferences?.languages?.enabledLanguages;\n const enabled = Array.isArray(declared)\n ? declared.filter((locale): locale is AvailableLanguage =>\n Object.values(AvailableLanguage).includes(locale as AvailableLanguage))\n : [];\n return [...new Set<AvailableLanguage>([primary, ...enabled])];\n }\n\n /** `<backend service path>/src/engine/i18n`, app-root relative — the same tree the orchestrators write into. */\n private resolveI18nRelativeRoot(): string {\n const backendService = Object.values(this.companionContext.backendServices)[0];\n if (!backendService) {\n throw new Error('No backend service configured for per-unit i18n output.');\n }\n return path.posix.join(backendService.path, 'src/engine/i18n');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application-build-generation-step.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/application-build-generation-step.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAsB,MAAM,oDAAoD,CAAC;AAEjH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,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kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC3C,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAChD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,4BAA4B,CAAC,CAAA;IAC5D,WAAA,MAAM,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAA;IACpD,WAAA,MAAM,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAA;IACvD,WAAA,MAAM,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAA;iEALgC,gCAAgC;QACzB,qCAAqC;QACrC,qCAAqC;QACxC,6BAA6B;QACxB,gCAAgC;QAC1C,2BAA2B;GAZpG,8CAA8C,CA0M1D","sourcesContent":["import * as path from 'node:path';\nimport { stat } from 'node:fs/promises';\nimport { inject, injectable } from 'inversify';\n\nimport type { AppConfigurationService, LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';\nimport { AvailableLanguage } from '@wildo-ai/presets-components-models';\nimport { BuildPlanTaskTargetKind, type BuildPlanTask } from '@wildo-ai/saas-specifications/application-creation';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\nimport { getCompanionConfiguredPrimaryLanguage } from '../../core/config/primary-language.companion.utils';\nimport { LabellingPlannerCompanionService } from '../../i18n-labelling/services/labelling-planner.companion.service';\nimport {\n LabellizeOrchestratorCompanionService,\n type LabellizeRunResult,\n} from '../../i18n-labelling/services/labellize-orchestrator.companion.service';\nimport {\n TranslateOrchestratorCompanionService,\n type TranslateRunResult,\n} from '../../i18n-labelling/services/translate-orchestrator.companion.service';\nimport {\n EmailTemplateCompanionService,\n type GenerateEmailTemplatesResult,\n type TranslateEmailTemplateLabelsResult,\n} from '../../email/services/email-template.companion.service';\nimport {\n LogoDeliberationCompanionService,\n type LogoDeliberationResult,\n} from '../../brand/services/logo-deliberation.companion.service';\nimport {\n BrandAcceptCompanionService,\n type BrandAcceptResult,\n} from '../../brand/services/brand-accept.companion.service';\nimport type { CompanionExecutionSessionContext } from '../../core/traceability/companion-traceability.models';\n\n/**\n * The companion generation steps this host can EXECUTE.\n *\n * The values are the `generationStepRef` slugs a build plan authors on a\n * `COMPANION_GENERATION_STEP` target — the closed vocabulary this enum is the\n * named home of. A build plan may only reference steps that exist here: an\n * unknown ref refuses by name (below) instead of silently parking the build,\n * which is exactly how the first generation step ever authored\n * (`i18n-labels`) stalled the Wonder Todos build plan — the vocabulary\n * existed in `_core`, and nothing executed it.\n *\n * Seeds join this enum WHEN a seed-generation pipeline exists to execute —\n * adding the value without one would let a build plan dispatch a step that can\n * only fail; the unknown-ref refusal below is the honest answer until then.\n * The executor is the integration point, not a new lane per step.\n */\nexport enum ApplicationBuildGenerationStep {\n I18N_LABELS = 'i18n-labels',\n EMAIL_TEMPLATES = 'email-templates',\n /**\n * The brand mark: an expert panel derives creative directions, images are generated, a vision\n * judge scores them, and the winner is promoted into the specifications SSOT.\n *\n * Added under the rule this enum's docblock states — a value joins WHEN a pipeline exists to\n * execute it. That pipeline was fully built and reachable only by a human issuing\n * `POST /brand/{generate,deliberate,accept}-logo`, so an application could acquire a considered\n * mark only if someone drove it by hand (issue #220). Hand-supplying a logo stays available and\n * unchanged; what this adds is the journey's own path to one.\n */\n LOGO = 'logo',\n}\n\n/**\n * The SSOT module `brand-accept` rewrites when it promotes a winner.\n *\n * Restated here rather than imported because it is a module-private constant of the brand service;\n * the two must agree, and the pin in this lane's tests is what says so.\n */\nconst BRAND_RESOLVED_ASSETS_MODULE = 'resolved-assets.generated.ts';\n\n/** A build plan referenced a generation step this companion cannot execute. Named, so the plan author sees the vocabulary. */\nexport class ApplicationBuildUnknownGenerationStepError extends Error {\n public constructor(taskRef: string, generationStepRef: string) {\n super(\n `Build task ${taskRef} references generation step \"${generationStepRef}\", which this companion cannot execute. `\n + `Known steps: ${Object.values(ApplicationBuildGenerationStep).join(', ')}.`,\n );\n }\n}\n\n/** What one executed i18n-labels step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildI18nLabelsStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.I18N_LABELS;\n /** Primary-locale label generation (incremental — fresh units are skipped by the freshness lock). */\n readonly labellize: LabellizeRunResult;\n /** Translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly translate?: TranslateRunResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** What one executed email-templates step did — the per-pipeline results, verbatim. */\nexport interface ApplicationBuildEmailTemplatesStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.EMAIL_TEMPLATES;\n /** Primary-locale template + labels generation (incremental — existing template+labels pairs are skipped). */\n readonly emailGenerate: GenerateEmailTemplatesResult;\n /** Label translation into the other enabled locales; absent when the app enables only its primary locale. */\n readonly emailTranslate?: TranslateEmailTemplateLabelsResult;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/**\n * What one executed logo step did.\n *\n * `deliberation`/`accept` are absent when the step was SKIPPED because the application already has\n * an accepted mark — see the executor for why skipping is the incremental answer here rather than\n * the freshness lock the text pipelines use.\n */\nexport interface ApplicationBuildLogoStepRunResult {\n readonly generationStepRef: ApplicationBuildGenerationStep.LOGO;\n /** The expert-panel deliberation that derived directions, generated marks and picked a winner. */\n readonly deliberation?: LogoDeliberationResult;\n /** Promotion of that winner into `specifications/src/brand/` — images plus the rewritten SSOT. */\n readonly accept?: BrandAcceptResult;\n /** True when an accepted mark already existed and no model was called. */\n readonly skippedBecauseAlreadyAccepted: boolean;\n /** The app-root-relative files this step is responsible for — the same paths the landed check reads. */\n readonly evidencePaths: readonly string[];\n}\n\n/** One executed generation step's result, discriminated by the step it ran. */\nexport type ApplicationBuildGenerationStepRunResult =\n | ApplicationBuildI18nLabelsStepRunResult\n | ApplicationBuildEmailTemplatesStepRunResult\n | ApplicationBuildLogoStepRunResult;\n\n/**\n * Execute companion-owned generation steps of a build plan, and answer which\n * files each step is responsible for.\n *\n * A `COMPANION_GENERATION_STEP` is deterministic in its ROUTING and its\n * PLACEMENT — which pipeline runs and where the files land is decided by\n * code, never by a coding agent (`application-build-task-coding-policy`\n * refuses to compose a coding contract for one). The CONTENT may still come\n * from a model (labels are generated text), which is exactly the directive's\n * bucket-3 shape: a companion-owned generation step interleaved by the build\n * loop.\n *\n * ## Landed evidence, and why it is planner-derived\n *\n * The build lane's landed answer is GIT: a task has landed when the files it\n * produces are committed. A generation step's target carries only its\n * `generationStepRef` — no paths — so the file set must be DERIVED. For\n * `i18n-labels` it is the labelling planner's unit inventory crossed with the\n * app's enabled locales: exactly the files the pipelines write, re-derivable\n * after a restart, a fresh clone, or a branch switch. Deliberately NOT the\n * whole i18n directory: that is already committed on any app with history, and\n * a directory-prefix check would report the step landed without it ever\n * having run for the units it still owes.\n */\n@injectable()\nexport class ApplicationBuildGenerationStepCompanionService {\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(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.LabellingPlannerService) private readonly planner: LabellingPlannerCompanionService,\n @inject(COMPANION_SERVICE_TYPES.LabellizeOrchestratorService) private readonly labellize: LabellizeOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.TranslateOrchestratorService) private readonly translate: TranslateOrchestratorCompanionService,\n @inject(COMPANION_SERVICE_TYPES.EmailTemplateService) private readonly emailTemplates: EmailTemplateCompanionService,\n @inject(COMPANION_SERVICE_TYPES.LogoDeliberationService) private readonly logoDeliberation: LogoDeliberationCompanionService,\n @inject(COMPANION_SERVICE_TYPES.BrandAcceptService) private readonly brandAccept: BrandAcceptCompanionService,\n ) {\n this.logDebug = this.logger.debugByType('ApplicationBuildGenerationStep');\n }\n\n /**\n * The app-root-relative files this task's generation step is responsible\n * for. The landed check treats the task as landed when EVERY one of them is\n * committed — same doctrine as every coding task, same reader\n * (`isWorktreePathCommitted`).\n */\n public async resolveGenerationStepEvidencePaths(task: BuildPlanTask): Promise<readonly string[]> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const i18nRoot = this.resolveI18nRelativeRoot();\n const locales = this.resolveEnabledLocales();\n const units = await this.planner.planAllUnits();\n return units.flatMap((unit) =>\n locales.map((locale) => path.posix.join(i18nRoot, unit.filePathHint.bucket, `${unit.filePathHint.slug}.${locale}.ts`)),\n );\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES:\n // Placement is the email domain's authority; this lane only crosses it with the enabled locales.\n return this.emailTemplates.resolveExpectedArtifactRelativePaths(this.resolveEnabledLocales());\n case ApplicationBuildGenerationStep.LOGO:\n /*\n * The SSOT MODULE alone, deliberately — not the asset images beside it.\n *\n * Evidence must be derivable BEFORE the step runs, and the image filenames cannot be: they\n * are named after whichever mark the panel picks. The module can, and it is the honest\n * marker either way — `brand-accept` writes it only when a winner is promoted, so it is\n * absent on an application that has never accepted a logo and present exactly when one has.\n *\n * This is NOT the directory-prefix shortcut this class's docblock warns about. That check\n * would pass on any app whose `specifications/` is committed at all; this file exists only\n * as a consequence of the step's own work.\n */\n return [path.posix.join('specifications', 'src', 'brand', BRAND_RESOLVED_ASSETS_MODULE)];\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n /**\n * Run the task's generation step. Incremental by construction: both\n * pipelines consult the freshness lock and skip fresh units, so re-running\n * an already-satisfied step costs a plan read, not a model call.\n */\n public async executeGenerationStep(\n task: BuildPlanTask,\n session?: CompanionExecutionSessionContext,\n ): Promise<ApplicationBuildGenerationStepRunResult> {\n const generationStepRef = this.requireGenerationStepRef(task);\n switch (generationStepRef) {\n case ApplicationBuildGenerationStep.I18N_LABELS: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the i18n-labels generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const labellizeResult = await this.labellize.labellize({}, session);\n const translateResult = targetLocales.length > 0\n ? await this.translate.translate({ targetLocales }, session)\n : undefined;\n return {\n generationStepRef,\n labellize: labellizeResult,\n ...(translateResult ? { translate: translateResult } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n case ApplicationBuildGenerationStep.EMAIL_TEMPLATES: {\n const primaryLocale = getCompanionConfiguredPrimaryLanguage(this.appConfigService.config);\n const targetLocales = this.resolveEnabledLocales().filter((locale) => locale !== primaryLocale);\n this.logDebug('Running the email-templates generation step', {\n taskRef: task.taskRef,\n primaryLocale,\n targetLocales,\n });\n const emailGenerate = await this.emailTemplates.generateTemplates({}, session);\n const emailTranslate = targetLocales.length > 0\n ? await this.emailTemplates.translateEmailTemplateLabels({ targetLocales: [...targetLocales] }, session)\n : undefined;\n return {\n generationStepRef,\n emailGenerate,\n ...(emailTranslate ? { emailTranslate } : {}),\n evidencePaths: await this.resolveGenerationStepEvidencePaths(task),\n };\n }\n case ApplicationBuildGenerationStep.LOGO: {\n const evidencePaths = await this.resolveGenerationStepEvidencePaths(task);\n /*\n * Incremental, but by PRESENCE rather than by the freshness lock the text pipelines use.\n *\n * Those pipelines skip per UNIT, because a label is cheap and units come and go. A logo\n * deliberation is a panel of three experts, N generated images and a vision judge — the\n * most expensive step in this enum by a wide margin — and an application has exactly one\n * accepted mark. So the honest unit of freshness is \"is there an accepted mark\", and the\n * answer is the same file the landed check reads. Re-running a satisfied step costs a\n * `stat`, not a model call.\n *\n * Replacing an existing mark stays a deliberate act through the brand routes; a build must\n * never quietly redraw an application's identity because it ran again.\n */\n if (await this.hasAcceptedBrandMark()) {\n this.logDebug('Skipping the logo generation step — an accepted mark already exists', {\n taskRef: task.taskRef,\n });\n return { generationStepRef, skippedBecauseAlreadyAccepted: true, evidencePaths };\n }\n\n this.logDebug('Running the logo generation step', { taskRef: task.taskRef });\n const deliberation = await this.logoDeliberation.run({});\n /*\n * `run` stages its winner as the standard single-candidate manifest `accept` expects, which\n * is why the two compose with no adapter. Passing the ref explicitly rather than relying on\n * that staging is the point at which this lane would otherwise trust an implicit hand-off.\n */\n const accept = await this.brandAccept.accept({ candidateRef: deliberation.staged.winnerRef });\n return { generationStepRef, deliberation, accept, skippedBecauseAlreadyAccepted: false, evidencePaths };\n }\n default:\n throw new ApplicationBuildUnknownGenerationStepError(task.taskRef, generationStepRef);\n }\n }\n\n /**\n * Does this application already carry an accepted brand mark?\n *\n * Presence of the SSOT module is the whole test. It is written only by a promotion, so its\n * existence means a winner was chosen — and its ABSENCE is what makes the step run. Reading the\n * module's contents to count assets was considered and rejected: it would need the specifications\n * package evaluated, which is a far heavier question than \"has this step ever succeeded\", and the\n * landed check next door already keys on the same file.\n */\n private async hasAcceptedBrandMark(): Promise<boolean> {\n const ssotModulePath = path.resolve(\n this.companionContext.saasRoot,\n 'specifications',\n 'src',\n 'brand',\n BRAND_RESOLVED_ASSETS_MODULE,\n );\n try {\n await stat(ssotModulePath);\n return true;\n } catch {\n return false;\n }\n }\n\n private requireGenerationStepRef(task: BuildPlanTask): string {\n const target = task.target;\n if (target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {\n throw new Error(`Build task ${task.taskRef} is not a companion generation step.`);\n }\n return target.generationStepRef;\n }\n\n /**\n * The locales this application ENABLES — `appPreferences.languages.enabledLanguages`,\n * always including the primary. This is the \"every configured locale\" the\n * build task's objective speaks of; an app that enables only its primary\n * locale gets no translate pass and no foreign-locale evidence.\n */\n private resolveEnabledLocales(): readonly AvailableLanguage[] {\n const config = this.appConfigService.config as {\n appPreferences?: { languages?: { defaultLanguage?: unknown; enabledLanguages?: unknown } };\n } | null | undefined;\n const primary = getCompanionConfiguredPrimaryLanguage(config);\n const declared = config?.appPreferences?.languages?.enabledLanguages;\n const enabled = Array.isArray(declared)\n ? declared.filter((locale): locale is AvailableLanguage =>\n Object.values(AvailableLanguage).includes(locale as AvailableLanguage))\n : [];\n return [...new Set<AvailableLanguage>([primary, ...enabled])];\n }\n\n /** `<backend service path>/src/engine/i18n`, app-root relative — the same tree the orchestrators write into. */\n private resolveI18nRelativeRoot(): string {\n const backendService = Object.values(this.companionContext.backendServices)[0];\n if (!backendService) {\n throw new Error('No backend service configured for per-unit i18n output.');\n }\n return path.posix.join(backendService.path, 'src/engine/i18n');\n }\n}\n"]}
|
|
@@ -39,6 +39,15 @@ export declare class ExecutionTraceReadCompanionService {
|
|
|
39
39
|
private readonly companionContext;
|
|
40
40
|
constructor(companionContext: CompanionContext);
|
|
41
41
|
listSessions(limit?: number): Promise<readonly ExecutionTraceSessionSummary[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Every session DIRECTORY NAME, unbounded and cheap — one readdir, no per-session summarize.
|
|
44
|
+
*
|
|
45
|
+
* Exists for JOIN resolution (a write record's runId → its session by longest-prefix match):
|
|
46
|
+
* bounding that lookup with the display limit made records older than the newest N silently
|
|
47
|
+
* lose their trace link, which is a correctness question the display bound has no business
|
|
48
|
+
* answering (completion-review finding 11a).
|
|
49
|
+
*/
|
|
50
|
+
listSessionIds(): Promise<readonly string[]>;
|
|
42
51
|
readSession(sessionId: string): Promise<ExecutionTraceSession>;
|
|
43
52
|
/** One artifact's body, by session and step and file name. The bodies are why the trace is worth keeping. */
|
|
44
53
|
readArtifact(sessionId: string, stepDirName: string, fileName: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-trace-read.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/execution-trace-read.companion.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAsB,SAAQ,4BAA4B;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC/C;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD;;;;;;;;;;GAUG;AACH,qBACa,kCAAkC;IAEO,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAG1F,YAAY,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,SAAS,4BAA4B,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"execution-trace-read.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/execution-trace-read.companion.service.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iGAAiG;IACjG,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAsB,SAAQ,4BAA4B;IACzE,QAAQ,CAAC,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC/C;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD;;;;;;;;;;GAUG;AACH,qBACa,kCAAkC;IAEO,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAG1F,YAAY,CAAC,KAAK,SAAK,GAAG,OAAO,CAAC,SAAS,4BAA4B,EAAE,CAAC;IASvF;;;;;;;OAOG;IACU,cAAc,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAM5C,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAe3E,6GAA6G;IAChG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAUpG,OAAO,CAAC,YAAY;YAIN,SAAS;YAkBT,UAAU;YAUV,SAAS;CAOxB"}
|
|
@@ -41,6 +41,19 @@ let ExecutionTraceReadCompanionService = class ExecutionTraceReadCompanionServic
|
|
|
41
41
|
const summaries = await Promise.all(newestFirst.map((name) => this.summarize(root, name)));
|
|
42
42
|
return summaries.filter((entry) => entry !== null);
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Every session DIRECTORY NAME, unbounded and cheap — one readdir, no per-session summarize.
|
|
46
|
+
*
|
|
47
|
+
* Exists for JOIN resolution (a write record's runId → its session by longest-prefix match):
|
|
48
|
+
* bounding that lookup with the display limit made records older than the newest N silently
|
|
49
|
+
* lose their trace link, which is a correctness question the display bound has no business
|
|
50
|
+
* answering (completion-review finding 11a).
|
|
51
|
+
*/
|
|
52
|
+
async listSessionIds() {
|
|
53
|
+
const root = this.sessionsRoot();
|
|
54
|
+
const names = await readdir(root).catch(() => []);
|
|
55
|
+
return names.filter((name) => name.startsWith('dev-'));
|
|
56
|
+
}
|
|
44
57
|
async readSession(sessionId) {
|
|
45
58
|
const root = this.sessionsRoot();
|
|
46
59
|
// A session id is a directory NAME. Anything with a separator is a traversal attempt, not a typo.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-trace-read.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/execution-trace-read.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM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,EAAE;IAGR,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GAFxC,kCAAkC,CA+E9C","sourcesContent":["import { readdir, readFile, stat } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport { inject, injectable } from 'inversify';\n\nimport { resolveAppLayout } from '@wildo-ai/platform-config-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\n\nexport interface ExecutionTraceSessionSummary {\n readonly sessionId: string;\n readonly startedAt: string;\n readonly label: string | null;\n readonly eventCount: number;\n readonly stepCount: number;\n}\n\nexport interface ExecutionTraceEvent {\n readonly timestamp: string;\n readonly type: string;\n readonly summary: string;\n readonly stepId?: string;\n readonly payload?: unknown;\n}\n\nexport interface ExecutionTraceStep {\n readonly stepDirName: string;\n /** File names only — a listing, not the bodies. One answer artifact can be tens of kilobytes. */\n readonly artifacts: readonly string[];\n}\n\nexport interface ExecutionTraceSession extends ExecutionTraceSessionSummary {\n readonly events: readonly ExecutionTraceEvent[];\n readonly steps: readonly ExecutionTraceStep[];\n}\n\nexport class ExecutionTraceNotFoundError extends Error {}\n\n/**\n * Read what a run recorded — the half that makes a trace a trace.\n *\n * Two write-only journal streams were deleted on 2026-08-24 for having no reader. The events this serves\n * are written by the same kind of code, and the difference is exactly this service: it shipped in the same\n * change as the writer, so \"a person can read it\" was true on day one rather than promised.\n *\n * It is READ-ONLY and takes no session identity from the caller beyond the id it is asked for — resolved\n * against the companion's own logs home, and refusing any id that is not a plain session directory name, so\n * a request cannot walk out of the tree it is allowed to read.\n */\n@injectable()\nexport class ExecutionTraceReadCompanionService {\n public constructor(\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {}\n\n public async listSessions(limit = 50): Promise<readonly ExecutionTraceSessionSummary[]> {\n const root = this.sessionsRoot();\n const names = await readdir(root).catch(() => [] as string[]);\n // Session directory names are `dev-<ISO-ish timestamp>-<suffix>`, so lexical DESC is chronological.\n const newestFirst = names.filter((name) => name.startsWith('dev-')).sort().reverse().slice(0, limit);\n const summaries = await Promise.all(newestFirst.map((name) => this.summarize(root, name)));\n return summaries.filter((entry): entry is ExecutionTraceSessionSummary => entry !== null);\n }\n\n public async readSession(sessionId: string): Promise<ExecutionTraceSession> {\n const root = this.sessionsRoot();\n // A session id is a directory NAME. Anything with a separator is a traversal attempt, not a typo.\n if (!/^[A-Za-z0-9._-]+$/.test(sessionId)) {\n throw new ExecutionTraceNotFoundError(`\"${sessionId}\" is not a session id.`);\n }\n const sessionDir = join(root, sessionId);\n const exists = await stat(sessionDir).then((entry) => entry.isDirectory(), () => false);\n if (!exists) throw new ExecutionTraceNotFoundError(`No trace session \"${sessionId}\".`);\n\n const summary = await this.summarize(root, sessionId);\n if (!summary) throw new ExecutionTraceNotFoundError(`Trace session \"${sessionId}\" has no readable session record.`);\n return { ...summary, events: await this.readEvents(sessionDir), steps: await this.readSteps(sessionDir) };\n }\n\n /** One artifact's body, by session and step and file name. The bodies are why the trace is worth keeping. */\n public async readArtifact(sessionId: string, stepDirName: string, fileName: string): Promise<string> {\n if (!/^[A-Za-z0-9._-]+$/.test(sessionId) || !/^[A-Za-z0-9._-]+$/.test(stepDirName) || !/^[A-Za-z0-9._-]+$/.test(fileName)) {\n throw new ExecutionTraceNotFoundError('Session, step and file names may contain no path separators.');\n }\n const path = join(this.sessionsRoot(), sessionId, 'steps', stepDirName, fileName);\n return readFile(path, 'utf8').catch(() => {\n throw new ExecutionTraceNotFoundError(`No artifact \"${fileName}\" in step \"${stepDirName}\" of session \"${sessionId}\".`);\n });\n }\n\n private sessionsRoot(): string {\n return join(resolveAppLayout(this.companionContext.saasRoot).companionLogsHome, 'sessions');\n }\n\n private async summarize(root: string, sessionId: string): Promise<ExecutionTraceSessionSummary | null> {\n const dir = join(root, sessionId);\n const record = await readFile(join(dir, 'session.json'), 'utf8').then(\n (raw) => JSON.parse(raw) as Record<string, unknown>,\n () => null,\n );\n if (!record) return null;\n const events = await this.readEvents(dir);\n const steps = await readdir(join(dir, 'steps')).catch(() => [] as string[]);\n return {\n sessionId,\n startedAt: typeof record.startedAt === 'string' ? record.startedAt : '',\n label: typeof record.label === 'string' ? record.label : null,\n eventCount: events.length,\n stepCount: steps.length,\n };\n }\n\n private async readEvents(sessionDir: string): Promise<readonly ExecutionTraceEvent[]> {\n const raw = await readFile(join(sessionDir, 'events.ndjson'), 'utf8').catch(() => '');\n return raw\n .split('\\n')\n .filter((line) => line.trim().length > 0)\n .flatMap((line) => {\n try { return [JSON.parse(line) as ExecutionTraceEvent]; } catch { return []; }\n });\n }\n\n private async readSteps(sessionDir: string): Promise<readonly ExecutionTraceStep[]> {\n const stepNames = await readdir(join(sessionDir, 'steps')).catch(() => [] as string[]);\n return Promise.all(stepNames.sort().map(async (stepDirName) => ({\n stepDirName,\n artifacts: (await readdir(join(sessionDir, 'steps', stepDirName)).catch(() => [] as string[])).sort(),\n })));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"execution-trace-read.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/execution-trace-read.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AA8BjF,MAAM,OAAO,2BAA4B,SAAQ,KAAK;CAAG;AAEzD;;;;;;;;;;GAUG;AAEI,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAEwB;IADrE,YACqE,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;IACpG,CAAC;IAEG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import { readdir, readFile, stat } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport { inject, injectable } from 'inversify';\n\nimport { resolveAppLayout } from '@wildo-ai/platform-config-lib';\n\nimport { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types';\nimport type { CompanionContext } from '../../core/context/companion-context';\n\nexport interface ExecutionTraceSessionSummary {\n readonly sessionId: string;\n readonly startedAt: string;\n readonly label: string | null;\n readonly eventCount: number;\n readonly stepCount: number;\n}\n\nexport interface ExecutionTraceEvent {\n readonly timestamp: string;\n readonly type: string;\n readonly summary: string;\n readonly stepId?: string;\n readonly payload?: unknown;\n}\n\nexport interface ExecutionTraceStep {\n readonly stepDirName: string;\n /** File names only — a listing, not the bodies. One answer artifact can be tens of kilobytes. */\n readonly artifacts: readonly string[];\n}\n\nexport interface ExecutionTraceSession extends ExecutionTraceSessionSummary {\n readonly events: readonly ExecutionTraceEvent[];\n readonly steps: readonly ExecutionTraceStep[];\n}\n\nexport class ExecutionTraceNotFoundError extends Error {}\n\n/**\n * Read what a run recorded — the half that makes a trace a trace.\n *\n * Two write-only journal streams were deleted on 2026-08-24 for having no reader. The events this serves\n * are written by the same kind of code, and the difference is exactly this service: it shipped in the same\n * change as the writer, so \"a person can read it\" was true on day one rather than promised.\n *\n * It is READ-ONLY and takes no session identity from the caller beyond the id it is asked for — resolved\n * against the companion's own logs home, and refusing any id that is not a plain session directory name, so\n * a request cannot walk out of the tree it is allowed to read.\n */\n@injectable()\nexport class ExecutionTraceReadCompanionService {\n public constructor(\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {}\n\n public async listSessions(limit = 50): Promise<readonly ExecutionTraceSessionSummary[]> {\n const root = this.sessionsRoot();\n const names = await readdir(root).catch(() => [] as string[]);\n // Session directory names are `dev-<ISO-ish timestamp>-<suffix>`, so lexical DESC is chronological.\n const newestFirst = names.filter((name) => name.startsWith('dev-')).sort().reverse().slice(0, limit);\n const summaries = await Promise.all(newestFirst.map((name) => this.summarize(root, name)));\n return summaries.filter((entry): entry is ExecutionTraceSessionSummary => entry !== null);\n }\n\n /**\n * Every session DIRECTORY NAME, unbounded and cheap — one readdir, no per-session summarize.\n *\n * Exists for JOIN resolution (a write record's runId → its session by longest-prefix match):\n * bounding that lookup with the display limit made records older than the newest N silently\n * lose their trace link, which is a correctness question the display bound has no business\n * answering (completion-review finding 11a).\n */\n public async listSessionIds(): Promise<readonly string[]> {\n const root = this.sessionsRoot();\n const names = await readdir(root).catch(() => [] as string[]);\n return names.filter((name) => name.startsWith('dev-'));\n }\n\n public async readSession(sessionId: string): Promise<ExecutionTraceSession> {\n const root = this.sessionsRoot();\n // A session id is a directory NAME. Anything with a separator is a traversal attempt, not a typo.\n if (!/^[A-Za-z0-9._-]+$/.test(sessionId)) {\n throw new ExecutionTraceNotFoundError(`\"${sessionId}\" is not a session id.`);\n }\n const sessionDir = join(root, sessionId);\n const exists = await stat(sessionDir).then((entry) => entry.isDirectory(), () => false);\n if (!exists) throw new ExecutionTraceNotFoundError(`No trace session \"${sessionId}\".`);\n\n const summary = await this.summarize(root, sessionId);\n if (!summary) throw new ExecutionTraceNotFoundError(`Trace session \"${sessionId}\" has no readable session record.`);\n return { ...summary, events: await this.readEvents(sessionDir), steps: await this.readSteps(sessionDir) };\n }\n\n /** One artifact's body, by session and step and file name. The bodies are why the trace is worth keeping. */\n public async readArtifact(sessionId: string, stepDirName: string, fileName: string): Promise<string> {\n if (!/^[A-Za-z0-9._-]+$/.test(sessionId) || !/^[A-Za-z0-9._-]+$/.test(stepDirName) || !/^[A-Za-z0-9._-]+$/.test(fileName)) {\n throw new ExecutionTraceNotFoundError('Session, step and file names may contain no path separators.');\n }\n const path = join(this.sessionsRoot(), sessionId, 'steps', stepDirName, fileName);\n return readFile(path, 'utf8').catch(() => {\n throw new ExecutionTraceNotFoundError(`No artifact \"${fileName}\" in step \"${stepDirName}\" of session \"${sessionId}\".`);\n });\n }\n\n private sessionsRoot(): string {\n return join(resolveAppLayout(this.companionContext.saasRoot).companionLogsHome, 'sessions');\n }\n\n private async summarize(root: string, sessionId: string): Promise<ExecutionTraceSessionSummary | null> {\n const dir = join(root, sessionId);\n const record = await readFile(join(dir, 'session.json'), 'utf8').then(\n (raw) => JSON.parse(raw) as Record<string, unknown>,\n () => null,\n );\n if (!record) return null;\n const events = await this.readEvents(dir);\n const steps = await readdir(join(dir, 'steps')).catch(() => [] as string[]);\n return {\n sessionId,\n startedAt: typeof record.startedAt === 'string' ? record.startedAt : '',\n label: typeof record.label === 'string' ? record.label : null,\n eventCount: events.length,\n stepCount: steps.length,\n };\n }\n\n private async readEvents(sessionDir: string): Promise<readonly ExecutionTraceEvent[]> {\n const raw = await readFile(join(sessionDir, 'events.ndjson'), 'utf8').catch(() => '');\n return raw\n .split('\\n')\n .filter((line) => line.trim().length > 0)\n .flatMap((line) => {\n try { return [JSON.parse(line) as ExecutionTraceEvent]; } catch { return []; }\n });\n }\n\n private async readSteps(sessionDir: string): Promise<readonly ExecutionTraceStep[]> {\n const stepNames = await readdir(join(sessionDir, 'steps')).catch(() => [] as string[]);\n return Promise.all(stepNames.sort().map(async (stepDirName) => ({\n stepDirName,\n artifacts: (await readdir(join(sessionDir, 'steps', stepDirName)).catch(() => [] as string[])).sort(),\n })));\n }\n}\n"]}
|
|
@@ -51,6 +51,18 @@ export declare class PlaybookRunWriteRegisterCompanionService {
|
|
|
51
51
|
private readonly logger;
|
|
52
52
|
private readonly companionContext;
|
|
53
53
|
private readonly logDebug;
|
|
54
|
+
/**
|
|
55
|
+
* Notified after every mutation of the register (a `record` or a `revert`).
|
|
56
|
+
*
|
|
57
|
+
* The seam exists for the creation-plane eligibility cache: a run landing files is exactly the
|
|
58
|
+
* event that changes playbook eligibility, and the projection service subscribes here rather
|
|
59
|
+
* than being injected INTO this service (which would cycle — it already depends on this one).
|
|
60
|
+
* Listeners are fire-and-forget and must not throw; a cache invalidation failing must never
|
|
61
|
+
* fail the write it observes.
|
|
62
|
+
*/
|
|
63
|
+
private readonly mutationListeners;
|
|
64
|
+
registerMutationListener(listener: () => void): void;
|
|
65
|
+
private notifyMutation;
|
|
54
66
|
constructor(logger: LoggerService, companionContext: CompanionContext);
|
|
55
67
|
record(record: PlaybookRunWriteRecord): Promise<void>;
|
|
56
68
|
/** Newest first. A record that no longer parses is skipped (a cache never fails its reader). */
|
package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-run-write-register.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-run-write-register.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAa7E,QAAA,MAAM,oBAAoB;;;;;QATxB,kDAAkD;;;QAGlD,yDAAyD;;QAEzD,4GAA4G;;;kBAS5G,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,sIAAsI;IACtI,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED,qBAAa,mCAAoC,SAAQ,KAAK;gBACzC,KAAK,EAAE,MAAM;CAGjC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBACa,wCAAwC;
|
|
1
|
+
{"version":3,"file":"playbook-run-write-register.companion.service.d.ts","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-run-write-register.companion.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MA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,CAAC,wBAAwB,CAAC;IAuCjH,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,iBAAiB;CAK1B"}
|
|
@@ -63,6 +63,27 @@ let PlaybookRunWriteRegisterCompanionService = class PlaybookRunWriteRegisterCom
|
|
|
63
63
|
logger;
|
|
64
64
|
companionContext;
|
|
65
65
|
logDebug;
|
|
66
|
+
/**
|
|
67
|
+
* Notified after every mutation of the register (a `record` or a `revert`).
|
|
68
|
+
*
|
|
69
|
+
* The seam exists for the creation-plane eligibility cache: a run landing files is exactly the
|
|
70
|
+
* event that changes playbook eligibility, and the projection service subscribes here rather
|
|
71
|
+
* than being injected INTO this service (which would cycle — it already depends on this one).
|
|
72
|
+
* Listeners are fire-and-forget and must not throw; a cache invalidation failing must never
|
|
73
|
+
* fail the write it observes.
|
|
74
|
+
*/
|
|
75
|
+
mutationListeners = [];
|
|
76
|
+
registerMutationListener(listener) {
|
|
77
|
+
this.mutationListeners.push(listener);
|
|
78
|
+
}
|
|
79
|
+
notifyMutation() {
|
|
80
|
+
for (const listener of this.mutationListeners) {
|
|
81
|
+
try {
|
|
82
|
+
listener();
|
|
83
|
+
}
|
|
84
|
+
catch { /* a listener must never fail the write it observes */ }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
66
87
|
constructor(logger, companionContext) {
|
|
67
88
|
this.logger = logger;
|
|
68
89
|
this.companionContext = companionContext;
|
|
@@ -74,6 +95,7 @@ let PlaybookRunWriteRegisterCompanionService = class PlaybookRunWriteRegisterCom
|
|
|
74
95
|
await mkdir(registerDirectory, { recursive: true });
|
|
75
96
|
await writeFile(this.resolveRecordPath(parsed.runId), `${JSON.stringify(parsed, null, 2)}\n`, 'utf8');
|
|
76
97
|
this.logDebug('Recorded run writes', { runId: parsed.runId, files: parsed.files.length });
|
|
98
|
+
this.notifyMutation();
|
|
77
99
|
}
|
|
78
100
|
/** Newest first. A record that no longer parses is skipped (a cache never fails its reader). */
|
|
79
101
|
async list() {
|
|
@@ -132,6 +154,7 @@ let PlaybookRunWriteRegisterCompanionService = class PlaybookRunWriteRegisterCom
|
|
|
132
154
|
await rm(this.resolveRecordPath(runId), { force: true });
|
|
133
155
|
}
|
|
134
156
|
this.logDebug('Reverted run writes', { runId, reverted: reverted.length, refused: refusedDiverged.length });
|
|
157
|
+
this.notifyMutation();
|
|
135
158
|
return { runId, reverted, refusedDiverged };
|
|
136
159
|
}
|
|
137
160
|
resolveRegisterDirectory() {
|
package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbook-run-write-register.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-run-write-register.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAGjF,4DAA4D;AAC5D,MAAM,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC;IACxC,kDAAkD;IAClD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;IAC1B,yDAAyD;IACzD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,4GAA4G;IAC5G,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH,MA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,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;;GALxC,wCAAwC,CAoFpD","sourcesContent":["import { mkdir, readFile, readdir, rm, unlink, writeFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } 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';\n\n/** One file a run wrote, with everything a revert needs. */\nconst RunWriteFileSchema = z.strictObject({\n /** App-root-relative path of the written file. */\n path: z.string().min(1),\n existedBefore: z.boolean(),\n /** The file's bytes before the run, when one existed. */\n previousContent: z.string().optional(),\n /** The exact bytes the run wrote — revert refuses when the file has moved on from these (unless forced). */\n writtenContent: z.string().min(1),\n});\n\nconst RunWriteRecordSchema = z.strictObject({\n runId: z.string().min(1),\n playbookRef: z.string().min(1),\n at: z.string().min(1),\n files: z.array(RunWriteFileSchema).min(1),\n});\nexport type PlaybookRunWriteRecord = z.infer<typeof RunWriteRecordSchema>;\n\nexport interface PlaybookRunRevertOutcome {\n readonly runId: string;\n readonly reverted: readonly string[];\n /** Files whose CURRENT bytes differ from what the run wrote — refused without `force` so a human edit is never silently destroyed. */\n readonly refusedDiverged: readonly string[];\n}\n\nexport class PlaybookRunWriteRecordNotFoundError extends Error {\n public constructor(runId: string) {\n super(`No write record exists for run \"${runId}\".`);\n }\n}\n\n/**\n * The per-run WRITE REGISTER: which files each playbook run wrote, with pre-images, so any run can be\n * reverted in one call while mechanisms are being exercised.\n *\n * ## A runtime convenience, not a second truth\n *\n * Records live in the gitignored companion state directory. Deleting them all costs exactly the\n * convenience — git still holds every accepted state, and `git diff` still shows every un-accepted write.\n * Nothing reads these records to make a decision; the ONLY consumers are the list/revert doors below,\n * both operated by a human testing the mechanism. (`.claude/rules/one-source-of-truth.md`: cache, not\n * ledger — losing it costs time, never truth.)\n *\n * ## Revert protects the human's later edits\n *\n * Revert restores a file's pre-image (or deletes a file the run created) ONLY when the file still holds\n * the exact bytes the run wrote. A file that has moved on — a human edited it after the run — is refused\n * and reported, because destroying a person's edit to undo a machine's is the wrong trade. `force`\n * overrides per explicit request.\n *\n * This register is also the natural future home of per-file run locking (issue #48): the mechanism that\n * knows which files a run touches is the one that can hold locks between concurrent CLIs.\n */\n@injectable()\nexport class PlaybookRunWriteRegisterCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('PlaybookRunWriteRegister');\n }\n\n public async record(record: PlaybookRunWriteRecord): Promise<void> {\n const parsed = RunWriteRecordSchema.parse(record);\n const registerDirectory = this.resolveRegisterDirectory();\n await mkdir(registerDirectory, { recursive: true });\n await writeFile(this.resolveRecordPath(parsed.runId), `${JSON.stringify(parsed, null, 2)}\\n`, 'utf8');\n this.logDebug('Recorded run writes', { runId: parsed.runId, files: parsed.files.length });\n }\n\n /** Newest first. A record that no longer parses is skipped (a cache never fails its reader). */\n public async list(): Promise<readonly PlaybookRunWriteRecord[]> {\n const registerDirectory = this.resolveRegisterDirectory();\n const entries = await readdir(registerDirectory).catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return [] as string[];\n throw error;\n });\n const records: PlaybookRunWriteRecord[] = [];\n for (const entry of entries.filter((name) => name.endsWith('.json'))) {\n try {\n const raw = await readFile(path.join(registerDirectory, entry), 'utf8');\n records.push(RunWriteRecordSchema.parse(JSON.parse(raw)));\n } catch {\n this.logDebug('Skipping unreadable run-write record', { entry });\n }\n }\n return records.sort((left, right) => right.at.localeCompare(left.at));\n }\n\n public async revert(runId: string, options: { readonly force?: boolean } = {}): Promise<PlaybookRunRevertOutcome> {\n const raw = await readFile(this.resolveRecordPath(runId), 'utf8').catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') throw new PlaybookRunWriteRecordNotFoundError(runId);\n throw error;\n });\n const record = RunWriteRecordSchema.parse(JSON.parse(raw));\n\n const reverted: string[] = [];\n const refusedDiverged: string[] = [];\n for (const file of record.files) {\n const absolutePath = path.resolve(this.companionContext.saasRoot, file.path);\n const current = await readFile(absolutePath, 'utf8').catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return undefined;\n throw error;\n });\n if (options.force !== true && current !== undefined && current !== file.writtenContent) {\n refusedDiverged.push(file.path);\n continue;\n }\n if (file.existedBefore && file.previousContent !== undefined) {\n await writeFile(absolutePath, file.previousContent, 'utf8');\n } else {\n await unlink(absolutePath).catch((error: NodeJS.ErrnoException) => {\n if (error?.code !== 'ENOENT') throw error;\n });\n }\n reverted.push(file.path);\n }\n\n // The record is consumed only when every file it covers has been settled — a partial revert keeps it,\n // so the refused files can be reverted later (with force) without losing their pre-images.\n if (refusedDiverged.length === 0) {\n await rm(this.resolveRecordPath(runId), { force: true });\n }\n this.logDebug('Reverted run writes', { runId, reverted: reverted.length, refused: refusedDiverged.length });\n return { runId, reverted, refusedDiverged };\n }\n\n private resolveRegisterDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/run-writes');\n }\n\n private resolveRecordPath(runId: string): string {\n // The runId doubles as a file name; refuse anything path-shaped.\n if (!/^[a-zA-Z0-9._-]+$/.test(runId)) throw new Error(`Run id \"${runId}\" is not a valid record name.`);\n return path.join(this.resolveRegisterDirectory(), `${runId}.json`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"playbook-run-write-register.companion.service.js","sourceRoot":"","sources":["../../../../../src/meta-workflows/services/playbook-run-write-register.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,S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/promises';\nimport * as path from 'node:path';\nimport { inject, injectable } from 'inversify';\nimport { z } from 'zod';\n\nimport type { LoggerService } from '@wildo-ai/saas-backend-lib';\nimport { SAAS_SERVICE_TYPES } 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';\n\n/** One file a run wrote, with everything a revert needs. */\nconst RunWriteFileSchema = z.strictObject({\n /** App-root-relative path of the written file. */\n path: z.string().min(1),\n existedBefore: z.boolean(),\n /** The file's bytes before the run, when one existed. */\n previousContent: z.string().optional(),\n /** The exact bytes the run wrote — revert refuses when the file has moved on from these (unless forced). */\n writtenContent: z.string().min(1),\n});\n\nconst RunWriteRecordSchema = z.strictObject({\n runId: z.string().min(1),\n playbookRef: z.string().min(1),\n at: z.string().min(1),\n files: z.array(RunWriteFileSchema).min(1),\n});\nexport type PlaybookRunWriteRecord = z.infer<typeof RunWriteRecordSchema>;\n\nexport interface PlaybookRunRevertOutcome {\n readonly runId: string;\n readonly reverted: readonly string[];\n /** Files whose CURRENT bytes differ from what the run wrote — refused without `force` so a human edit is never silently destroyed. */\n readonly refusedDiverged: readonly string[];\n}\n\nexport class PlaybookRunWriteRecordNotFoundError extends Error {\n public constructor(runId: string) {\n super(`No write record exists for run \"${runId}\".`);\n }\n}\n\n/**\n * The per-run WRITE REGISTER: which files each playbook run wrote, with pre-images, so any run can be\n * reverted in one call while mechanisms are being exercised.\n *\n * ## A runtime convenience, not a second truth\n *\n * Records live in the gitignored companion state directory. Deleting them all costs exactly the\n * convenience — git still holds every accepted state, and `git diff` still shows every un-accepted write.\n * Nothing reads these records to make a decision; the ONLY consumers are the list/revert doors below,\n * both operated by a human testing the mechanism. (`.claude/rules/one-source-of-truth.md`: cache, not\n * ledger — losing it costs time, never truth.)\n *\n * ## Revert protects the human's later edits\n *\n * Revert restores a file's pre-image (or deletes a file the run created) ONLY when the file still holds\n * the exact bytes the run wrote. A file that has moved on — a human edited it after the run — is refused\n * and reported, because destroying a person's edit to undo a machine's is the wrong trade. `force`\n * overrides per explicit request.\n *\n * This register is also the natural future home of per-file run locking (issue #48): the mechanism that\n * knows which files a run touches is the one that can hold locks between concurrent CLIs.\n */\n@injectable()\nexport class PlaybookRunWriteRegisterCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n /**\n * Notified after every mutation of the register (a `record` or a `revert`).\n *\n * The seam exists for the creation-plane eligibility cache: a run landing files is exactly the\n * event that changes playbook eligibility, and the projection service subscribes here rather\n * than being injected INTO this service (which would cycle — it already depends on this one).\n * Listeners are fire-and-forget and must not throw; a cache invalidation failing must never\n * fail the write it observes.\n */\n private readonly mutationListeners: Array<() => void> = [];\n\n public registerMutationListener(listener: () => void): void {\n this.mutationListeners.push(listener);\n }\n\n private notifyMutation(): void {\n for (const listener of this.mutationListeners) {\n try { listener(); } catch { /* a listener must never fail the write it observes */ }\n }\n }\n\n public constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext) private readonly companionContext: CompanionContext,\n ) {\n this.logDebug = this.logger.debugByType('PlaybookRunWriteRegister');\n }\n\n public async record(record: PlaybookRunWriteRecord): Promise<void> {\n const parsed = RunWriteRecordSchema.parse(record);\n const registerDirectory = this.resolveRegisterDirectory();\n await mkdir(registerDirectory, { recursive: true });\n await writeFile(this.resolveRecordPath(parsed.runId), `${JSON.stringify(parsed, null, 2)}\\n`, 'utf8');\n this.logDebug('Recorded run writes', { runId: parsed.runId, files: parsed.files.length });\n this.notifyMutation();\n }\n\n /** Newest first. A record that no longer parses is skipped (a cache never fails its reader). */\n public async list(): Promise<readonly PlaybookRunWriteRecord[]> {\n const registerDirectory = this.resolveRegisterDirectory();\n const entries = await readdir(registerDirectory).catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return [] as string[];\n throw error;\n });\n const records: PlaybookRunWriteRecord[] = [];\n for (const entry of entries.filter((name) => name.endsWith('.json'))) {\n try {\n const raw = await readFile(path.join(registerDirectory, entry), 'utf8');\n records.push(RunWriteRecordSchema.parse(JSON.parse(raw)));\n } catch {\n this.logDebug('Skipping unreadable run-write record', { entry });\n }\n }\n return records.sort((left, right) => right.at.localeCompare(left.at));\n }\n\n public async revert(runId: string, options: { readonly force?: boolean } = {}): Promise<PlaybookRunRevertOutcome> {\n const raw = await readFile(this.resolveRecordPath(runId), 'utf8').catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') throw new PlaybookRunWriteRecordNotFoundError(runId);\n throw error;\n });\n const record = RunWriteRecordSchema.parse(JSON.parse(raw));\n\n const reverted: string[] = [];\n const refusedDiverged: string[] = [];\n for (const file of record.files) {\n const absolutePath = path.resolve(this.companionContext.saasRoot, file.path);\n const current = await readFile(absolutePath, 'utf8').catch((error: NodeJS.ErrnoException) => {\n if (error?.code === 'ENOENT') return undefined;\n throw error;\n });\n if (options.force !== true && current !== undefined && current !== file.writtenContent) {\n refusedDiverged.push(file.path);\n continue;\n }\n if (file.existedBefore && file.previousContent !== undefined) {\n await writeFile(absolutePath, file.previousContent, 'utf8');\n } else {\n await unlink(absolutePath).catch((error: NodeJS.ErrnoException) => {\n if (error?.code !== 'ENOENT') throw error;\n });\n }\n reverted.push(file.path);\n }\n\n // The record is consumed only when every file it covers has been settled — a partial revert keeps it,\n // so the refused files can be reverted later (with force) without losing their pre-images.\n if (refusedDiverged.length === 0) {\n await rm(this.resolveRecordPath(runId), { force: true });\n }\n this.logDebug('Reverted run writes', { runId, reverted: reverted.length, refused: refusedDiverged.length });\n this.notifyMutation();\n return { runId, reverted, refusedDiverged };\n }\n\n private resolveRegisterDirectory(): string {\n return path.resolve(this.companionContext.saasRoot, '.wildo-saas/state/meta-workflows/run-writes');\n }\n\n private resolveRecordPath(runId: string): string {\n // The runId doubles as a file name; refuse anything path-shaped.\n if (!/^[a-zA-Z0-9._-]+$/.test(runId)) throw new Error(`Run id \"${runId}\" is not a valid record name.`);\n return path.join(this.resolveRegisterDirectory(), `${runId}.json`);\n }\n}\n"]}
|