@wildo-ai/dev-companion 1.1.1 → 1.1.3
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 +408 -38
- 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 +70 -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 +110 -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 +62 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +295 -19
- 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 +243 -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 +370 -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 +40 -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 +126 -0
- package/dist/esm/core/introspection/subprocess/family-aspects.behavior.js.map +1 -0
- 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/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.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +13 -8
- 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 +31 -0
- 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 +91 -8
- 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 +4 -2
- 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 +10 -7
- package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +80 -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 +261 -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 +113 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +517 -54
- 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 +84 -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 +10 -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 +10 -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
|
@@ -15,15 +15,15 @@ import { z } from 'zod';
|
|
|
15
15
|
import { ResearchAgentDispatchCompanionService } from '../../claude-cli/services/research-agent-dispatch.companion.service.js';
|
|
16
16
|
import * as ApplicationCreationSpecs from '@wildo-ai/saas-specifications/application-creation';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
|
-
import { AI_ENGINE_CAPABILITIES, ENGINE_CLIENT_STORAGE_ENTRIES, DataRetentionClass, ErasureRetentionMode, undeclaredAiUseCapabilities, undeclaredRetentionClasses, uninventoriedClientStorageSurfaces, DataProcessingConsent, ProviderDeploymentModel, } from '@wildo-ai/saas-models';
|
|
19
|
-
import { ApplicationDocumentFactSpecificationSchema, ApplicationProcessorRegisterSchema, processorRefsNotConfigured, ProcessorRegisterEntryKind, processorProcessingRegions, registerEstablishesNoProcessorRecipients, undeclaredProcessorRefs, MetaWorkflow_ContextSource, MetaWorkflow_Executor, collectComplianceDocumentFactAvailability, } from '@wildo-ai/saas-specifications/application-creation';
|
|
18
|
+
import { AI_ENGINE_CAPABILITIES, ENGINE_CLIENT_STORAGE_ENTRIES, DataRetentionClass, ErasureRetentionMode, undeclaredAiUseCapabilities, undeclaredRetentionClasses, uninventoriedClientStorageSurfaces, BillingConfigurationSchema, outstandingOperatorComplianceIdentityParts, DataProcessingConsent, ProviderDeploymentModel, } from '@wildo-ai/saas-models';
|
|
19
|
+
import { ApplicationAuthoredDocumentFactSpecificationSchema, ApplicationDocumentFactSpecificationSchema, ApplicationProcessorRegisterSchema, processorRefsNotConfigured, ProcessorRegisterEntryKind, processorProcessingRegions, registerEstablishesNoProcessorRecipients, undeclaredProcessorRefs, MetaWorkflow_ContextSource, MetaWorkflow_Executor, collectComplianceDocumentFactAvailability, } from '@wildo-ai/saas-specifications/application-creation';
|
|
20
20
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
21
21
|
import * as path from 'node:path';
|
|
22
22
|
import { join } from 'node:path';
|
|
23
23
|
import { loadPackageCompanionExport } from '@wildo-ai/platform-config-lib';
|
|
24
24
|
import { getFrameworkKnowledgePlaybook, listFrameworkKnowledgePlaybooks, listFrameworkKnowledgeSkillSummaries } from '@wildo-ai/framework-knowledge';
|
|
25
25
|
import { MetaWorkflow_EvaluationTreatmentDefinitionSchema } from '@wildo-ai/saas-models/meta-workflows';
|
|
26
|
-
import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS, composeElicitationSection, BUILD_DECOMPOSE_INPUT_FAMILIES, STANDARD_APPLICATION_SPECIFICATION_SEMANTIC_AUTHORITY, evaluatePlaybookCatalogEligibility, buildApplicationCoherenceReport, composeAssuranceDocumentBlueprintBrief, composeAssuranceDocumentFactObligationsBrief, deriveOneFamilyFreshness, resolveStepOutputSchema, runPlaybookChoreography, buildPlaybookReviewGuide, evaluatePlaybookEligibility, getFamilyPackageRelativePath, getLandableArtifactFamilies, isPlaybookGenerationSuspension, renderApplicationCoherenceReport, renderInputFamilyContext, renderPlaybookReviewGuide, runPlaybookGeneration, DEFAULT_MAXIMUM_CLARIFICATION_ROUNDS, PlaybookClarificationAction, accumulateClarificationRequests, composeClarificationAnswersSection, runPlaybookJudge, runPlaybookLoop, } from '@wildo-ai/application-creation-runtime';
|
|
26
|
+
import { APPLICATION_SPECIFICATION_SEMANTIC_SCHEMA_BINDINGS, composeElicitationSection, BUILD_DECOMPOSE_INPUT_FAMILIES, STANDARD_APPLICATION_SPECIFICATION_SEMANTIC_AUTHORITY, evaluatePlaybookCatalogEligibility, buildApplicationCoherenceReport, composeAssuranceDocumentBlueprintBrief, composeAssuranceDocumentFactObligationsBrief, composeAssuranceProgramAuthorityBrief, deriveOneFamilyFreshness, resolveStepOutputSchema, runPlaybookChoreography, buildPlaybookReviewGuide, evaluatePlaybookEligibility, getFamilyPackageRelativePath, getLandableArtifactFamilies, isPlaybookGenerationSuspension, renderApplicationCoherenceReport, renderInputFamilyContext, renderPlaybookReviewGuide, runPlaybookGeneration, DEFAULT_MAXIMUM_CLARIFICATION_ROUNDS, PlaybookClarificationAction, accumulateClarificationRequests, composeClarificationAnswersSection, runPlaybookJudge, runPlaybookLoop, composeBillingCommercialModelBrief, composeOperatingJurisdictionCoverageBrief, } from '@wildo-ai/application-creation-runtime';
|
|
27
27
|
import { SAAS_SERVICE_TYPES } from '@wildo-ai/saas-backend-lib';
|
|
28
28
|
import { JourneyArtifactValidationState, MetaWorkflowPlaybookSchema } from '@wildo-ai/saas-specifications/application-creation';
|
|
29
29
|
import { StructuredDeliberationCompanionService } from '../../deliberations/services/structured-deliberation.companion.service.js';
|
|
@@ -34,11 +34,13 @@ import { ApplicationBuildDispatchCompanionService } from './application-build-di
|
|
|
34
34
|
import { GitChangeSetCompanionService } from '../../claude-cli/services/git-change-set.companion.service.js';
|
|
35
35
|
import { CompanionIntrospectionService } from '../../core/introspection/services/companion-introspection.companion.service.js';
|
|
36
36
|
import { FoundationExecutorCompanionService } from './foundation-executor.companion.service.js';
|
|
37
|
+
import { CodingAgentDispatchCompanionService } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
|
|
37
38
|
import { PlaybookChoreographyCheckpointCompanionService } from './playbook-choreography-checkpoint.companion.service.js';
|
|
38
39
|
import { PlaybookSuspendedRunCompanionService } from './playbook-suspended-run.companion.service.js';
|
|
39
40
|
import { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service.js';
|
|
40
41
|
import { createPlaybookExecutionTrace } from './playbook-execution-trace.companion.service.js';
|
|
41
|
-
import { loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion.js';
|
|
42
|
+
import { loadBackendCompanionExports, loadSpecificationsCompanionExports } from '../../core/context/companion-package-loaders.companion.js';
|
|
43
|
+
import { choreographyEndedByEnvironment, isInfrastructureShapedAgentFailure, waitForDevCompileQuiet, } from '../../core/runtime/dev-compile-quiet.companion.js';
|
|
42
44
|
import { META_WORKFLOWS_STRUCTURED_ARTIFACT_GENERATOR_AGENT_REF, META_WORKFLOW_TRACE_STEP_KIND } from '../models/meta-workflows-lane.models.js';
|
|
43
45
|
/**
|
|
44
46
|
* Run one compiled playbook: brief the model against the family's own schema, then land the answer as
|
|
@@ -86,6 +88,34 @@ const FILE_ONLY_ARTIFACT_FAMILIES = Object.freeze(['domain-plan', 'build-plan'])
|
|
|
86
88
|
function playbookDeclaresContextSource(playbook, source) {
|
|
87
89
|
return (playbook?.method?.contextSources ?? []).includes(source);
|
|
88
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* The application-wide verification a `DETERMINISTIC_CLI` playbook runs, per playbook ref.
|
|
93
|
+
*
|
|
94
|
+
* The HOST owns the mapping, not the playbook, and that is the same rule
|
|
95
|
+
* `APPLICATION_CODING_TASK_VERIFICATION_CATALOG` already states for coding tasks: *"a task contract
|
|
96
|
+
* names semantic check references, not commands. Translating a new ref into executable process
|
|
97
|
+
* arguments is application-host work that must be reviewed here."* A playbook naming its own
|
|
98
|
+
* commands would be an authored surface that can spawn a process, which is a much larger admission
|
|
99
|
+
* than this tier needs.
|
|
100
|
+
*
|
|
101
|
+
* An unmapped ref is REFUSED rather than defaulted. A default check set would make a new
|
|
102
|
+
* `DETERMINISTIC_CLI` playbook silently verify something nobody chose — which is the exact shape of
|
|
103
|
+
* the defect #119 closed, where an unhonoured tier fell through and produced a result the
|
|
104
|
+
* declaration never asked for.
|
|
105
|
+
*
|
|
106
|
+
* Why these four checks: topic 7 asks whether the built application ASSEMBLES, so the unit is the
|
|
107
|
+
* application's four workspace packages, not the one package a coding task happened to touch. The
|
|
108
|
+
* dispatch lane already typechecks the mutated package per task; this is the whole-app question that
|
|
109
|
+
* no per-task check can answer, which is why it is not a duplicate of a live check.
|
|
110
|
+
*/
|
|
111
|
+
const DETERMINISTIC_CLI_VERIFICATION_CHECKS = {
|
|
112
|
+
'bottom_up.assemble-verify': [
|
|
113
|
+
'check:specifications-typecheck',
|
|
114
|
+
'check:shared-lib-typecheck',
|
|
115
|
+
'check:backend-api-typecheck',
|
|
116
|
+
'check:app-typecheck',
|
|
117
|
+
],
|
|
118
|
+
};
|
|
89
119
|
/** The zero-output playbook the composite foundation executor owns (J-2 item 2). */
|
|
90
120
|
const FOUNDATION_PLAYBOOK_REF = 'bottom_up.foundation';
|
|
91
121
|
/** Marker for "the file is there, its value is not readable from here". Never confused with real content. */
|
|
@@ -102,6 +132,29 @@ const DRAFTABLE_DOCUMENT_DEFINITION_REFS = Object.freeze([
|
|
|
102
132
|
'document-definition:public.privacy-notice',
|
|
103
133
|
'document-definition:public.service-terms',
|
|
104
134
|
]);
|
|
135
|
+
/**
|
|
136
|
+
* The documents whose FACTS the producer is briefed on — a wider set than the ones the lane may draft.
|
|
137
|
+
*
|
|
138
|
+
* Declaring a fact and drafting a document are different acts with different costs. The drafting brief ships a document's sections, clauses and inclusion kinds; adding
|
|
139
|
+
* the four governance documents there would be ~42KB of obligations for documents this lane does not produce, and a prompt section that gets skimmed is
|
|
140
|
+
* indistinguishable from an absent one. The FACT brief ships names and authority kinds, which is a few lines each.
|
|
141
|
+
*
|
|
142
|
+
* TWO of the four governance documents are included, and only those two: `scope-system-description` and `program-handbook` are the ones carrying
|
|
143
|
+
* `APPLICATION_SPECIFICATION` facts — `governance-system-boundaries`, `governance-entities-products-environments`, `governance-dependencies-responsibilities` and
|
|
144
|
+
* `governance-scope-boundaries`. `roles-responsibilities` and `document-record-control` carry none: every one of their ten facts needs a creator decision or a
|
|
145
|
+
* qualified review, so briefing them would add ten "do not declare" lines about documents with nothing to declare.
|
|
146
|
+
*
|
|
147
|
+
* Withholding the two meant the only facts a governance document could ever have were the sixteen a human must write, so it could not be partially answered at all
|
|
148
|
+
* (#186).
|
|
149
|
+
*
|
|
150
|
+
* The other sixteen are rendered in the same brief as facts the producer must NOT declare, with the authority each needs. That is the whole reason it is safe to widen
|
|
151
|
+
* this list: the brief now distinguishes the two halves rather than asking for everything (#217).
|
|
152
|
+
*/
|
|
153
|
+
const FACT_OBLIGATION_DOCUMENT_DEFINITION_REFS = Object.freeze([
|
|
154
|
+
...DRAFTABLE_DOCUMENT_DEFINITION_REFS,
|
|
155
|
+
'document-definition:governance.scope-system-description',
|
|
156
|
+
'document-definition:governance.program-handbook',
|
|
157
|
+
]);
|
|
105
158
|
const FILE_PRESENT_WITHOUT_VALUE = Object.freeze({ __artifactPresentWithoutValue: true });
|
|
106
159
|
/**
|
|
107
160
|
* The map the coherence report reads: accepted families PLUS landed drafts.
|
|
@@ -194,9 +247,29 @@ function renderRetentionSchedule(schedule) {
|
|
|
194
247
|
* register but no longer configured is reported too — a stale entry keeps a recipient in the notice
|
|
195
248
|
* that receives nothing, which is the quieter of the two errors.
|
|
196
249
|
*/
|
|
197
|
-
function renderProcessorRegister(configuredProviderRefs, register) {
|
|
198
|
-
|
|
199
|
-
|
|
250
|
+
function renderProcessorRegister(configuredProviderRefs, register, choices) {
|
|
251
|
+
/*
|
|
252
|
+
* A provider the operator declared SELF_HOSTED is not a recipient, so it cannot be an outstanding
|
|
253
|
+
* DISCLOSURE either — and until this filter existed it was reported as one.
|
|
254
|
+
*
|
|
255
|
+
* `renderProviderComplianceChoices` above already draws exactly this line ("the deployment model is
|
|
256
|
+
* the axis that decides whether a bound provider is a RECIPIENT at all"), and
|
|
257
|
+
* `vendorHostedProviderRefs` exists so a caller need not remember it. The two renderers sat in ONE
|
|
258
|
+
* section disagreeing: one said a self-hosted provider is operator-run, the other listed it as an
|
|
259
|
+
* identity nobody had established. Measured on wonder-crm's `email-preview`, which renders mail to a
|
|
260
|
+
* log and calls no API — the notice reported an outstanding disclosure about a provider that
|
|
261
|
+
* discloses nothing (wildo-ai/wildo-ai#208).
|
|
262
|
+
*
|
|
263
|
+
* A provider with NO choice STAYS in scope, deliberately. Absence means nobody has answered, which is
|
|
264
|
+
* exactly the gap this section exists to report; assuming self-hosted would silence it, and assuming
|
|
265
|
+
* vendor-hosted would publish a third party nobody declared. Only an explicit SELF_HOSTED excludes.
|
|
266
|
+
*/
|
|
267
|
+
const operatorRunRefs = new Set(Object.entries(choices ?? {})
|
|
268
|
+
.filter(([, choice]) => choice.deploymentModel === ProviderDeploymentModel.SELF_HOSTED)
|
|
269
|
+
.map(([providerRef]) => providerRef));
|
|
270
|
+
const recipientCandidateRefs = configuredProviderRefs.filter((providerRef) => !operatorRunRefs.has(providerRef));
|
|
271
|
+
const undeclared = undeclaredProcessorRefs(recipientCandidateRefs, register);
|
|
272
|
+
const stale = processorRefsNotConfigured(recipientCandidateRefs, register);
|
|
200
273
|
const declared = register?.processors ?? [];
|
|
201
274
|
return [
|
|
202
275
|
'## Who else processes personal data',
|
|
@@ -448,20 +521,66 @@ function renderOperatorComplianceIdentity(identity) {
|
|
|
448
521
|
'an address or a contact — those are what a subject uses to exercise a right against a real company.',
|
|
449
522
|
];
|
|
450
523
|
}
|
|
524
|
+
/*
|
|
525
|
+
* Every part is now independently declarable (#228), so this renders PART BY PART rather than
|
|
526
|
+
* assuming a complete identity. An outstanding part is named, with the configuration key that closes
|
|
527
|
+
* it — a drafter that cannot see what is missing has no way to mark the gap, and marking it is the
|
|
528
|
+
* behaviour the whole lane depends on.
|
|
529
|
+
*/
|
|
530
|
+
const outstanding = outstandingOperatorComplianceIdentityParts(identity);
|
|
451
531
|
return [
|
|
452
532
|
'',
|
|
453
|
-
|
|
454
|
-
|
|
533
|
+
identity.legalEntityName === undefined
|
|
534
|
+
? 'Operator legal entity: OUTSTANDING — not declared in `operatorComplianceIdentity.legalEntityName`. Do NOT invent one.'
|
|
535
|
+
: `Operator: ${identity.legalEntityName}.`,
|
|
536
|
+
identity.registeredAddress === undefined
|
|
537
|
+
? 'Registered address: OUTSTANDING — `operatorComplianceIdentity.registeredAddress`. Do NOT invent one; it is what a subject uses to serve a request on a real company.'
|
|
538
|
+
: `Registered at ${identity.registeredAddress}.`,
|
|
539
|
+
identity.privacyContact === undefined
|
|
540
|
+
? 'Privacy contact route: OUTSTANDING — `operatorComplianceIdentity.privacyContact`. Do NOT invent one; a route that does not exist is worse than a stated gap.'
|
|
541
|
+
: `Privacy contact: ${identity.privacyContact}.`,
|
|
455
542
|
...(identity.representative === undefined
|
|
456
|
-
|
|
543
|
+
/*
|
|
544
|
+
* The "absent means not required" reading holds only on a COMPLETE identity. On a partial one it
|
|
545
|
+
* cannot be told apart from a part nobody reached yet, and asserting the stronger sentence there
|
|
546
|
+
* would put an unsupported claim about Art. 27 into the drafter's context.
|
|
547
|
+
*/
|
|
548
|
+
? outstanding.length === 0
|
|
549
|
+
? ['No Art. 27 representative is declared, which means one is not required — not that the question was skipped.']
|
|
550
|
+
: ['No Art. 27 representative is declared. On a partially declared identity that cannot be read as "not required" — it is simply unanswered.']
|
|
457
551
|
: [`Art. 27 representative: ${identity.representative.name}, ${identity.representative.address}.`]),
|
|
458
552
|
'',
|
|
459
|
-
|
|
460
|
-
|
|
553
|
+
...(identity.roleAllocations === undefined
|
|
554
|
+
? [
|
|
555
|
+
'Role per population of data: OUTSTANDING — `operatorComplianceIdentity.roleAllocations`. Do NOT assign the',
|
|
556
|
+
'operator a single role by default: controller and processor carry different obligations, and a product is',
|
|
557
|
+
'commonly both at once over different populations.',
|
|
558
|
+
]
|
|
559
|
+
: [
|
|
560
|
+
'Role, per population of data — there may be SEVERAL, and a notice must not collapse them into one:',
|
|
561
|
+
...identity.roleAllocations.map((allocation) => ` - ${allocation.role} for ${allocation.dataScope}`),
|
|
562
|
+
]),
|
|
461
563
|
'',
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
564
|
+
...(identity.lawfulBases === undefined
|
|
565
|
+
? [
|
|
566
|
+
'Lawful basis per purpose: OUTSTANDING — `operatorComplianceIdentity.lawfulBases`. This is a legal',
|
|
567
|
+
'determination, not a drafting choice. State it as unestablished; do NOT select a basis because one',
|
|
568
|
+
'sounds plausible, and in particular do not write CONSENT, which would tell a person their data is',
|
|
569
|
+
'processed on an agreement they could withdraw.',
|
|
570
|
+
]
|
|
571
|
+
: [
|
|
572
|
+
'Lawful basis, per purpose:',
|
|
573
|
+
...identity.lawfulBases.map((entry) => ` - ${entry.basis} for ${entry.purpose}`
|
|
574
|
+
+ (entry.assessmentNote === undefined ? '' : ` — assessment: ${entry.assessmentNote}`)),
|
|
575
|
+
]),
|
|
576
|
+
...(outstanding.length === 0
|
|
577
|
+
? []
|
|
578
|
+
: [
|
|
579
|
+
'',
|
|
580
|
+
`${outstanding.length} of 5 identity part(s) outstanding: ${outstanding.join(', ')}. The identity is PARTIALLY`,
|
|
581
|
+
'declared — state each outstanding part as an open gap in the document rather than omitting it. A document',
|
|
582
|
+
'that silently leaves them out reads as though the operator answered.',
|
|
583
|
+
]),
|
|
465
584
|
];
|
|
466
585
|
}
|
|
467
586
|
function renderClientStorage(frontendSurfaceKeys, inventory) {
|
|
@@ -500,6 +619,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
500
619
|
traceability;
|
|
501
620
|
writeRegister;
|
|
502
621
|
buildDispatch;
|
|
622
|
+
codingAgentDispatch;
|
|
503
623
|
git;
|
|
504
624
|
introspection;
|
|
505
625
|
foundationExecutor;
|
|
@@ -507,7 +627,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
507
627
|
choreographyCheckpoints;
|
|
508
628
|
structuredDeliberation;
|
|
509
629
|
logDebug;
|
|
510
|
-
constructor(logger, companionContext, researchDispatch, agents, traceability, writeRegister, buildDispatch, git, introspection, foundationExecutor, suspendedRuns, choreographyCheckpoints, structuredDeliberation) {
|
|
630
|
+
constructor(logger, companionContext, researchDispatch, agents, traceability, writeRegister, buildDispatch, codingAgentDispatch, git, introspection, foundationExecutor, suspendedRuns, choreographyCheckpoints, structuredDeliberation) {
|
|
511
631
|
this.logger = logger;
|
|
512
632
|
this.companionContext = companionContext;
|
|
513
633
|
this.researchDispatch = researchDispatch;
|
|
@@ -515,6 +635,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
515
635
|
this.traceability = traceability;
|
|
516
636
|
this.writeRegister = writeRegister;
|
|
517
637
|
this.buildDispatch = buildDispatch;
|
|
638
|
+
this.codingAgentDispatch = codingAgentDispatch;
|
|
518
639
|
this.git = git;
|
|
519
640
|
this.introspection = introspection;
|
|
520
641
|
this.foundationExecutor = foundationExecutor;
|
|
@@ -599,8 +720,24 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
599
720
|
* withheld on a phase gate its parent had already been admitted past.
|
|
600
721
|
*/
|
|
601
722
|
proceedPastSequencing: true,
|
|
602
|
-
runChild: (playbookRef, objective, stepResults) => this.runChoreographyChild({
|
|
603
|
-
|
|
723
|
+
runChild: (playbookRef, objective, stepResults) => this.runChoreographyChild({
|
|
724
|
+
playbookRef,
|
|
725
|
+
objective,
|
|
726
|
+
stepResults,
|
|
727
|
+
...(input.parentElicitationSection ? { parentElicitationSection: input.parentElicitationSection } : {}),
|
|
728
|
+
// The COMPOSITE names the investigation: every research child of every run of this
|
|
729
|
+
// composite consolidates into one evidence-store directory, which is what makes a
|
|
730
|
+
// relaunch start from what earlier runs already established.
|
|
731
|
+
evidenceScope: input.playbook.ref,
|
|
732
|
+
...(input.session ? { session: input.session } : {}),
|
|
733
|
+
}),
|
|
734
|
+
select: {
|
|
735
|
+
select: (request) => this.selectChoreographyChildren({
|
|
736
|
+
...request,
|
|
737
|
+
composite: input.playbook,
|
|
738
|
+
...(input.parentElicitationSection ? { parentElicitationSection: input.parentElicitationSection } : {}),
|
|
739
|
+
}),
|
|
740
|
+
},
|
|
604
741
|
...(input.session ? { trace: this.buildTrace(input.session, 'playbook-choreography') } : {}),
|
|
605
742
|
});
|
|
606
743
|
/*
|
|
@@ -608,11 +745,30 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
608
745
|
* and must go. Keeping it would make the next run of this composite resume a finished one, which
|
|
609
746
|
* is the failure mode a resume cache has instead of the one it replaced.
|
|
610
747
|
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
748
|
+
* ONE exception, and it is measured rather than hypothetical: a conclusion the ENVIRONMENT
|
|
749
|
+
* forced. When ALL_CHILDREN_FAILED and every fatal child was taken by infrastructure or quota
|
|
750
|
+
* (a companion pause, a 529 storm outliving the retry, "You've hit your session limit"), the
|
|
751
|
+
* children never met the work — that is the process-taken-away case the checkpoint exists for,
|
|
752
|
+
* arriving as child failures instead of a SIGTERM. On 2026-09-03 the unconditional consume here
|
|
753
|
+
* discarded a 56-minute compliance run's 10 iterations of accumulated evidence because its 11th
|
|
754
|
+
* iteration hit the provider's 5-hour session limit. The checkpoint survives that shape now, and
|
|
755
|
+
* re-running the composite resumes it — the same gesture as after a companion restart.
|
|
756
|
+
*
|
|
757
|
+
* Still unconditional for every SEMANTIC conclusion: an iteration ceiling, a chosen stop, or a
|
|
758
|
+
* fatal iteration containing even one real (non-environmental) failure, because there the next
|
|
759
|
+
* selection would see genuine information and must not inherit a finished run's state.
|
|
614
760
|
*/
|
|
615
|
-
|
|
761
|
+
const endedByEnvironment = choreographyEndedByEnvironment(result);
|
|
762
|
+
if (endedByEnvironment) {
|
|
763
|
+
this.logDebug('Choreography ended by environment; preserving its checkpoint for relaunch', {
|
|
764
|
+
playbookRef: input.playbook.ref,
|
|
765
|
+
completedIterations: result.iterations.length,
|
|
766
|
+
fatalFailures: result.iterations[result.iterations.length - 1]?.children.map((child) => child.failure?.slice(0, 160)),
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
await this.choreographyCheckpoints.consume(input.playbook.ref);
|
|
771
|
+
}
|
|
616
772
|
return {
|
|
617
773
|
playbookRef: input.playbook.ref,
|
|
618
774
|
choreographed: true,
|
|
@@ -629,6 +785,11 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
629
785
|
...(resumeFrom
|
|
630
786
|
? { resumedFrom: { completedIterations: resumeFrom.completedIterations, checkpointedAt: resumeFrom.checkpointedAt } }
|
|
631
787
|
: {}),
|
|
788
|
+
/*
|
|
789
|
+
* Reported so the caller can SAY "re-run this ref to resume" instead of reading a failed run
|
|
790
|
+
* as a dead end — the whole point of preserving the checkpoint is that somebody relaunches.
|
|
791
|
+
*/
|
|
792
|
+
...(endedByEnvironment ? { resumableFromCheckpoint: true } : {}),
|
|
632
793
|
// No acceptance, exactly as an ordinary run reports none: files landed as working edits and a
|
|
633
794
|
// human commit is the only acceptance there has ever been.
|
|
634
795
|
accepted: false,
|
|
@@ -660,18 +821,53 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
660
821
|
if (!stepOutput) {
|
|
661
822
|
throw new Error(`Research child "${child.ref}" declares no stepOutput; its evidence would have nowhere to go.`);
|
|
662
823
|
}
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
824
|
+
const researchObjective = [
|
|
825
|
+
child.method?.guidance ?? '',
|
|
826
|
+
'',
|
|
827
|
+
'# Your objective for THIS round',
|
|
828
|
+
input.objective,
|
|
829
|
+
// The creator's facts, verbatim: research that knows the real jurisdictions, data classes
|
|
830
|
+
// and commitments verifies triggers against THIS product instead of surveying the field.
|
|
831
|
+
...(input.parentElicitationSection ? ['', input.parentElicitationSection] : []),
|
|
832
|
+
'',
|
|
833
|
+
'# What to return',
|
|
834
|
+
stepOutput.condensation,
|
|
835
|
+
].join('\n');
|
|
836
|
+
/*
|
|
837
|
+
* The churn gate + one classified retry (#265, smallest shape). A research turn is READ-ONLY
|
|
838
|
+
* and its result is regenerable, which is what makes ONE retry safe here and why the coding
|
|
839
|
+
* lane gets the gate but never the retry. Two measured failure families qualify — the exit-0
|
|
840
|
+
* mid-turn kill under a companion pause, and the provider's transient overload — and nothing
|
|
841
|
+
* else does: an agent's own outcome retried is spend, not resilience.
|
|
842
|
+
*/
|
|
843
|
+
const frameworkRoot = this.companionContext.resolvedHomes.framework.repositoryRoot;
|
|
844
|
+
const logGate = (message, context) => this.logDebug(message, { playbookRef: child.ref, ...context });
|
|
845
|
+
await waitForDevCompileQuiet({ frameworkRepositoryRoot: frameworkRoot, log: logGate });
|
|
846
|
+
try {
|
|
847
|
+
const research = await this.researchDispatch.runResearchTask({
|
|
848
|
+
objective: researchObjective,
|
|
849
|
+
...(input.evidenceScope ? { evidenceScope: input.evidenceScope } : {}),
|
|
850
|
+
playbookRef: child.ref,
|
|
851
|
+
});
|
|
852
|
+
return { stepResults: new Map([[stepOutput.ref, research.evidence]]) };
|
|
853
|
+
}
|
|
854
|
+
catch (error) {
|
|
855
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
856
|
+
if (!isInfrastructureShapedAgentFailure(message))
|
|
857
|
+
throw error;
|
|
858
|
+
this.logger.warn('Research turn lost to infrastructure; retrying once', { playbookRef: child.ref, failure: message.slice(0, 200) });
|
|
859
|
+
// Overload answers deserve real backoff; a churn kill only needs the tree quiet again.
|
|
860
|
+
if (/529|429|Overloaded|overloaded_error|rate.?limit/i.test(message)) {
|
|
861
|
+
await new Promise((resolve) => setTimeout(resolve, 60_000));
|
|
862
|
+
}
|
|
863
|
+
await waitForDevCompileQuiet({ frameworkRepositoryRoot: frameworkRoot, log: logGate });
|
|
864
|
+
const research = await this.researchDispatch.runResearchTask({
|
|
865
|
+
objective: researchObjective,
|
|
866
|
+
...(input.evidenceScope ? { evidenceScope: input.evidenceScope } : {}),
|
|
867
|
+
playbookRef: child.ref,
|
|
868
|
+
});
|
|
869
|
+
return { stepResults: new Map([[stepOutput.ref, research.evidence]]) };
|
|
870
|
+
}
|
|
675
871
|
}
|
|
676
872
|
/*
|
|
677
873
|
* A CODING_AGENT child cannot ALSO produce a step value, and saying so beats routing it silently.
|
|
@@ -692,13 +888,20 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
692
888
|
}
|
|
693
889
|
if ((child.stepOutputs?.length ?? 0) > 0) {
|
|
694
890
|
const stepOutput = child.stepOutputs[0];
|
|
695
|
-
const value = await this.generateChoreographyStepValue({
|
|
891
|
+
const value = await this.generateChoreographyStepValue({
|
|
892
|
+
child,
|
|
893
|
+
stepOutput,
|
|
894
|
+
objective: input.objective,
|
|
895
|
+
stepResults: input.stepResults,
|
|
896
|
+
...(input.parentElicitationSection ? { parentElicitationSection: input.parentElicitationSection } : {}),
|
|
897
|
+
});
|
|
696
898
|
return { stepResults: new Map([[stepOutput.ref, value]]) };
|
|
697
899
|
}
|
|
698
900
|
const run = await this.runPlaybook({
|
|
699
901
|
playbookRef: input.playbookRef,
|
|
700
902
|
creatorBrief: input.objective,
|
|
701
903
|
stepResults: input.stepResults,
|
|
904
|
+
...(input.parentElicitationSection ? { parentElicitationSection: input.parentElicitationSection } : {}),
|
|
702
905
|
...(input.session ? { session: input.session } : {}),
|
|
703
906
|
});
|
|
704
907
|
/*
|
|
@@ -735,6 +938,9 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
735
938
|
'',
|
|
736
939
|
'# Your objective for THIS round',
|
|
737
940
|
input.objective,
|
|
941
|
+
// The creator's facts, for the judge that needs them: adequacy against evidence WITHOUT the
|
|
942
|
+
// product facts converges on honest-INSUFFICIENT forever (#284's deadlock, measured run 4).
|
|
943
|
+
...(input.parentElicitationSection ? ['', input.parentElicitationSection] : []),
|
|
738
944
|
'',
|
|
739
945
|
'# What you are judging',
|
|
740
946
|
/*
|
|
@@ -805,6 +1011,10 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
805
1011
|
'# Decide what this composite does next',
|
|
806
1012
|
`Goal: ${request.goal}`,
|
|
807
1013
|
...(inputTruth ? ['', inputTruth] : []),
|
|
1014
|
+
// The creator's answers rank WITH the declared inputs: round-1 research aimed at the real
|
|
1015
|
+
// jurisdictions and telemetry beats a general survey the facts then invalidate (run 4's whole
|
|
1016
|
+
// first round was that survey).
|
|
1017
|
+
...(request.parentElicitationSection ? ['', request.parentElicitationSection] : []),
|
|
808
1018
|
'',
|
|
809
1019
|
'# What you may choose from',
|
|
810
1020
|
'These are the ONLY options, computed from what has already happened rather than proposed by you.',
|
|
@@ -872,11 +1082,24 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
872
1082
|
const treatment = input.hydrated.evaluationTreatment
|
|
873
1083
|
? MetaWorkflow_EvaluationTreatmentDefinitionSchema.safeParse(input.hydrated.evaluationTreatment.value)
|
|
874
1084
|
: undefined;
|
|
1085
|
+
/*
|
|
1086
|
+
* The DECLARED derived sections, delivered to the path that actually runs this playbook.
|
|
1087
|
+
*
|
|
1088
|
+
* `composeCoherenceSection` gates on the playbook's `contextSources` declaration and was only ever
|
|
1089
|
+
* called from `composeBrief` — the GENERATION path. An assessing playbook (`outputs: []`) never
|
|
1090
|
+
* takes that path, so `top_down.phase-gate` — the sole declarer of `coherence_report`, the playbook
|
|
1091
|
+
* the section EXISTS for — judged six families with the arithmetic it declared composed one branch
|
|
1092
|
+
* over and delivered to nobody (the promise-vs-delivery class, #259; found by its own sweep,
|
|
1093
|
+
* 2026-09-02). Best-effort like the section itself: an unbuildable report must not cost the gate
|
|
1094
|
+
* its run.
|
|
1095
|
+
*/
|
|
1096
|
+
const coherenceSection = this.composeCoherenceSection(input.playbook, input.artifactState);
|
|
875
1097
|
if (treatment?.success) {
|
|
876
1098
|
judge = await runPlaybookJudge({
|
|
877
1099
|
playbookRef: input.playbookRef,
|
|
878
1100
|
treatment: treatment.data,
|
|
879
1101
|
landed: subjects,
|
|
1102
|
+
...(coherenceSection !== '' ? { derivedContext: [coherenceSection] } : {}),
|
|
880
1103
|
model: this.buildGenerationPort(),
|
|
881
1104
|
...(input.session ? { trace: this.buildTrace(input.session, `playbook-assess-${input.playbookRef}`) } : {}),
|
|
882
1105
|
});
|
|
@@ -1057,14 +1280,32 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1057
1280
|
}
|
|
1058
1281
|
return parsed.data;
|
|
1059
1282
|
}
|
|
1283
|
+
/**
|
|
1284
|
+
* BOTH fact families (#192).
|
|
1285
|
+
*
|
|
1286
|
+
* A document asserts the FACT, not one family's declaration of it, so reading only the derived half
|
|
1287
|
+
* would refuse every clause resting on a fact a human established. Each half is optional and parsed
|
|
1288
|
+
* independently: one unreadable file must not erase the other's facts, because that would turn a
|
|
1289
|
+
* wiring failure into a content verdict
|
|
1290
|
+
* (`.claude/rules/negative-results-require-a-positive-probe.md`).
|
|
1291
|
+
*
|
|
1292
|
+
* Returns nothing when NEITHER is readable — an empty availability map means "check against nothing"
|
|
1293
|
+
* and refuses every citation, which is the wrong answer for an application that has simply not run
|
|
1294
|
+
* `refinement.document-facts`.
|
|
1295
|
+
*/
|
|
1060
1296
|
resolveDeclaredDocumentFacts(artifactState) {
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1297
|
+
const readFamily = (family, schema) => {
|
|
1298
|
+
const value = artifactState.artifactsByFamily.get(family);
|
|
1299
|
+
if (value === undefined || value === FILE_PRESENT_WITHOUT_VALUE)
|
|
1300
|
+
return undefined;
|
|
1301
|
+
const parsed = schema.safeParse(value);
|
|
1302
|
+
return parsed.success ? parsed.data : undefined;
|
|
1303
|
+
};
|
|
1304
|
+
const derived = readFamily('document-facts', ApplicationDocumentFactSpecificationSchema);
|
|
1305
|
+
const authored = readFamily('document-facts-authored', ApplicationAuthoredDocumentFactSpecificationSchema);
|
|
1306
|
+
if (derived === undefined && authored === undefined)
|
|
1066
1307
|
return {};
|
|
1067
|
-
return { declaredDocumentFacts: collectComplianceDocumentFactAvailability(
|
|
1308
|
+
return { declaredDocumentFacts: collectComplianceDocumentFactAvailability(derived, authored) };
|
|
1068
1309
|
}
|
|
1069
1310
|
/**
|
|
1070
1311
|
* Refresh `src/COHERENCE.md` from the tree this run produced.
|
|
@@ -1168,7 +1409,23 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1168
1409
|
// — measured, because the bare and `/index` forms both fail to resolve.
|
|
1169
1410
|
const subpath = `./${path.basename(path.dirname(packageRelativePath))}`;
|
|
1170
1411
|
try {
|
|
1171
|
-
|
|
1412
|
+
/*
|
|
1413
|
+
* `freshModuleCache` is REQUIRED here, and its absence was issue #170.
|
|
1414
|
+
*
|
|
1415
|
+
* jiti's module cache is process-global, so in the long-lived companion a draft family
|
|
1416
|
+
* imported once stays frozen at that evaluation for the process lifetime. The accepted
|
|
1417
|
+
* families beside it are read through `loadSpecificationsCompanionExports`, which does pass
|
|
1418
|
+
* it — so a run that lands a draft produced a report comparing a STALE draft against FRESH
|
|
1419
|
+
* declarations. Measured on wonder-crm: 17 phantom
|
|
1420
|
+
* `compliance-document-cites-undeclared-fact` findings against a document that was actually
|
|
1421
|
+
* coherent, on an endpoint whose own heading claims to describe "the CURRENT working tree".
|
|
1422
|
+
*
|
|
1423
|
+
* Worst exactly when it matters most — immediately after a run lands files, which is when
|
|
1424
|
+
* someone asks for a coherence report.
|
|
1425
|
+
*/
|
|
1426
|
+
const moduleExports = await loadPackageCompanionExport(specificationsPackageRoot, subpath, {
|
|
1427
|
+
freshModuleCache: true,
|
|
1428
|
+
});
|
|
1172
1429
|
// A landed family module exports exactly one constant, named by the landing profile's
|
|
1173
1430
|
// `constantSuffix`. Taking the sole export keeps this from restating that naming rule.
|
|
1174
1431
|
const values = Object.values(moduleExports ?? {}).filter((value) => value !== undefined && value !== null);
|
|
@@ -1319,7 +1576,10 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1319
1576
|
// reason than theirs: not "nothing happened", but "what happened is not a family landing",
|
|
1320
1577
|
// and the loop's eligibility gate reads families. Its progress is visible through
|
|
1321
1578
|
// `resolveBuildExecutionProgress`, which counts landed TASKS.
|
|
1322
|
-
|
|
1579
|
+
// `verified` joins them for the same reason: a DETERMINISTIC_CLI run answers a question about
|
|
1580
|
+
// the built application and lands no family, so an empty landed set is truthful.
|
|
1581
|
+
if ('scenarios' in result || 'status' in result || 'assessed' in result || 'dispatched' in result
|
|
1582
|
+
|| 'verified' in result)
|
|
1323
1583
|
return { landed: [] };
|
|
1324
1584
|
return { landed: result.landed.map((entry) => entry.packageRelativePath) };
|
|
1325
1585
|
},
|
|
@@ -1503,7 +1763,19 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1503
1763
|
* is not a choreography at all; branching on it would make two unrelated things one code path.
|
|
1504
1764
|
*/
|
|
1505
1765
|
if (playbook.method?.choreography) {
|
|
1506
|
-
|
|
1766
|
+
/*
|
|
1767
|
+
* The umbrella's rendered elicitation travels into the run (#284 shape (a)): the questions are
|
|
1768
|
+
* declared on the COMPOSITE (validated just above, so an unanswered launch was already refused),
|
|
1769
|
+
* and the answers are the product facts every child derives from. Rendered ONCE here — children
|
|
1770
|
+
* must not re-validate parent answers against their own (empty) vocabularies, so what travels is
|
|
1771
|
+
* the section, not the raw answers. Channel-agnostic on purpose: this is "the run's elicitation
|
|
1772
|
+
* state", so answers arriving through a future mid-run workbench resume ride the same path.
|
|
1773
|
+
*/
|
|
1774
|
+
return this.runChoreography({
|
|
1775
|
+
playbook,
|
|
1776
|
+
...(elicitationSection ? { parentElicitationSection: elicitationSection } : {}),
|
|
1777
|
+
...(input.session ? { session: input.session } : {}),
|
|
1778
|
+
});
|
|
1507
1779
|
}
|
|
1508
1780
|
/*
|
|
1509
1781
|
* The CODING_AGENT tier (issue #119).
|
|
@@ -1573,7 +1845,66 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1573
1845
|
* none of those. `DETERMINISTIC_CLI` needs a registry of runnable commands, which does not
|
|
1574
1846
|
* exist. Both are decisions for whoever authors the first playbook that needs one.
|
|
1575
1847
|
*/
|
|
1576
|
-
|
|
1848
|
+
/*
|
|
1849
|
+
* The DETERMINISTIC_CLI tier (issues #147, #119).
|
|
1850
|
+
*
|
|
1851
|
+
* Topic 7 — "does the built application assemble and pass its own checks?" — had no producer:
|
|
1852
|
+
* `bottom_up.assemble-verify` was deleted on 2026-08-25 with the digest demolition, and the
|
|
1853
|
+
* question it asked went with it even though the answer needs no digests. Verification also
|
|
1854
|
+
* cannot be a build-plan task: `BuildPlanTaskTargetKind` has no member for it, so the decomposer
|
|
1855
|
+
* is structurally right to emit none. It has to be a playbook that RUNS COMMANDS.
|
|
1856
|
+
*
|
|
1857
|
+
* Keyed on the EXECUTOR, like CODING_AGENT above: any playbook declaring this tier is asking for
|
|
1858
|
+
* the same mechanism. The CHECK SET is host-owned and per-ref (see the constant), because
|
|
1859
|
+
* translating a semantic check ref into argv is reviewed host work.
|
|
1860
|
+
*
|
|
1861
|
+
* A DRY RUN resolves the checks and runs NOTHING. Not because verification mutates the
|
|
1862
|
+
* application — it does not — but because `tsc` writes `.tsbuildinfo`, so a dry run that executed
|
|
1863
|
+
* it would write, and `dryRun` is documented to the operator as "the full pipe ran and NOTHING
|
|
1864
|
+
* was written". Reporting the resolved set keeps the flag honest and cheap.
|
|
1865
|
+
*/
|
|
1866
|
+
if (playbook.executor === MetaWorkflow_Executor.DETERMINISTIC_CLI) {
|
|
1867
|
+
const checkRefs = DETERMINISTIC_CLI_VERIFICATION_CHECKS[input.playbookRef];
|
|
1868
|
+
if (!checkRefs) {
|
|
1869
|
+
throw new PlaybookNotReadyError(`"${input.playbookRef}" declares executor ${MetaWorkflow_Executor.DETERMINISTIC_CLI} but no verification `
|
|
1870
|
+
+ 'check set is registered for it. Translating a check ref into a runnable command is reviewed host '
|
|
1871
|
+
+ 'work — add the ref to DETERMINISTIC_CLI_VERIFICATION_CHECKS rather than letting it verify a '
|
|
1872
|
+
+ 'default nobody chose.');
|
|
1873
|
+
}
|
|
1874
|
+
if (input.dryRun === true) {
|
|
1875
|
+
return {
|
|
1876
|
+
playbookRef: input.playbookRef,
|
|
1877
|
+
verified: true,
|
|
1878
|
+
dryRun: true,
|
|
1879
|
+
checkRefs: [...checkRefs],
|
|
1880
|
+
checks: [],
|
|
1881
|
+
passed: null,
|
|
1882
|
+
accepted: false,
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
const { verification, infrastructureError } = await this.codingAgentDispatch
|
|
1886
|
+
.runApplicationVerificationChecks(checkRefs);
|
|
1887
|
+
/*
|
|
1888
|
+
* An infrastructure error is reported, never swallowed and never conflated with a failing
|
|
1889
|
+
* check: "the application does not typecheck" and "we could not run the typecheck" send an
|
|
1890
|
+
* operator to entirely different places, and only one of them is the application's fault.
|
|
1891
|
+
*/
|
|
1892
|
+
return {
|
|
1893
|
+
playbookRef: input.playbookRef,
|
|
1894
|
+
verified: true,
|
|
1895
|
+
checkRefs: [...checkRefs],
|
|
1896
|
+
checks: verification.map(({ checkRef, outcome }) => ({
|
|
1897
|
+
checkRef,
|
|
1898
|
+
success: outcome.success,
|
|
1899
|
+
message: outcome.message,
|
|
1900
|
+
})),
|
|
1901
|
+
passed: verification.every(({ outcome }) => outcome.success),
|
|
1902
|
+
...(infrastructureError ? { infrastructureError: String(infrastructureError) } : {}),
|
|
1903
|
+
// No acceptance, as everywhere in this lane: a human commit is the only acceptance.
|
|
1904
|
+
accepted: false,
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
if (playbook.executor === MetaWorkflow_Executor.HUMAN) {
|
|
1577
1908
|
throw new PlaybookNotReadyError(`"${input.playbookRef}" declares executor ${playbook.executor}, which this runtime does not honour. `
|
|
1578
1909
|
+ 'It is a declared design with no implementation: HUMAN needs a decided contract for what a '
|
|
1579
1910
|
+ 'human-performed step returns and how a resume supplies it, and DETERMINISTIC_CLI needs a '
|
|
@@ -1604,6 +1935,7 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1604
1935
|
const compliancePrimaryFactsSection = await this.composeCompliancePrimaryFactsSection(playbook);
|
|
1605
1936
|
const documentBlueprintSection = this.composeDocumentBlueprintSection(playbook);
|
|
1606
1937
|
const documentFactObligationsSection = this.composeDocumentFactObligationsSection(playbook);
|
|
1938
|
+
const assuranceProgramAuthoritySection = this.composeAssuranceProgramAuthoritySection(playbook);
|
|
1607
1939
|
const outputs = (playbook.outputs ?? []).map((output) => ({
|
|
1608
1940
|
family: output.family,
|
|
1609
1941
|
// A playbook output without a `schemaRef` has no family contract, so nothing could validate what the
|
|
@@ -1620,9 +1952,11 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1620
1952
|
compliancePrimaryFactsSection,
|
|
1621
1953
|
documentBlueprintSection,
|
|
1622
1954
|
documentFactObligationsSection,
|
|
1955
|
+
assuranceProgramAuthoritySection,
|
|
1623
1956
|
skillCatalogSection: this.composeSkillCatalogSection(playbook),
|
|
1624
1957
|
coherenceSection: this.composeCoherenceSection(playbook, artifactState),
|
|
1625
1958
|
stepEvidenceSection: this.composeStepEvidenceSection(input.stepResults),
|
|
1959
|
+
parentElicitationSection: input.parentElicitationSection ?? '',
|
|
1626
1960
|
clarificationAnswersSection: input.clarification
|
|
1627
1961
|
? composeClarificationAnswersSection(input.clarification.requests, input.clarification.answers, input.clarification.action)
|
|
1628
1962
|
: '',
|
|
@@ -1666,6 +2000,13 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
1666
2000
|
// citation". Collapsing them would refuse every draft in every application that has not yet
|
|
1667
2001
|
// run `refinement.document-facts`.
|
|
1668
2002
|
...this.resolveDeclaredDocumentFacts(artifactState),
|
|
2003
|
+
/*
|
|
2004
|
+
* The landed values, so the generation loop and the landing can refuse a citation of something
|
|
2005
|
+
* that does not exist — the coherence report's dangling class, moved from post-hoc page into
|
|
2006
|
+
* the findings-fed retry (2026-09-02). The same map eligibility and the input sections already
|
|
2007
|
+
* read; file-only sentinels ride along and are reported unreadable by the report, never thrown on.
|
|
2008
|
+
*/
|
|
2009
|
+
landedFamilyValues: artifactState.artifactsByFamily,
|
|
1669
2010
|
// WHICH documents this application needs, so a draft naming one it does not need is refused at
|
|
1670
2011
|
// the landing and retried in the generation loop. Same absent-vs-empty contract as the facts
|
|
1671
2012
|
// above: an omitted key skips the check rather than refusing everything.
|
|
@@ -2013,12 +2354,17 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
2013
2354
|
// writes about what is missing, which is the document this lane owes.
|
|
2014
2355
|
...(input.documentBlueprintSection ? ['', input.documentBlueprintSection] : []),
|
|
2015
2356
|
...(input.documentFactObligationsSection ? ['', input.documentFactObligationsSection] : []),
|
|
2357
|
+
...(input.assuranceProgramAuthoritySection ? ['', input.assuranceProgramAuthoritySection] : []),
|
|
2016
2358
|
...(input.compliancePrimaryFactsSection ? ['', input.compliancePrimaryFactsSection] : []),
|
|
2017
2359
|
...(input.skillCatalogSection ? ['', input.skillCatalogSection] : []),
|
|
2018
2360
|
...(input.coherenceSection ? ['', input.coherenceSection] : []),
|
|
2019
2361
|
// LAST, after every other truth: an answer the creator gave DURING this run settles whatever
|
|
2020
2362
|
// the sections above left ambiguous, and the closing word should be theirs.
|
|
2021
2363
|
...(input.clarificationAnswersSection ? ['', input.clarificationAnswersSection] : []),
|
|
2364
|
+
// The PARENT's creator answers, on a choreography child — the same last-word ranking as the
|
|
2365
|
+
// child's own elicitation, and BEFORE it, so a child that also interviews closes on its own
|
|
2366
|
+
// exchange while still seeing the composite's.
|
|
2367
|
+
...(input.parentElicitationSection ? ['', input.parentElicitationSection] : []),
|
|
2022
2368
|
...(input.elicitationSection ? ['', input.elicitationSection] : []),
|
|
2023
2369
|
].join('\n');
|
|
2024
2370
|
}
|
|
@@ -2097,10 +2443,55 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
2097
2443
|
* shape of the same one: a fact producer authors no sections and needs the closed name set, and
|
|
2098
2444
|
* burying eight lines under section obligations is how a prompt section gets skimmed.
|
|
2099
2445
|
*/
|
|
2446
|
+
/** The closed objective/source sets a compliance programme may draw on. See {@link composeAssuranceProgramAuthorityBrief}. */
|
|
2447
|
+
composeAssuranceProgramAuthoritySection(playbook) {
|
|
2448
|
+
if (!playbookDeclaresContextSource(playbook, MetaWorkflow_ContextSource.ASSURANCE_PROGRAM_AUTHORITY))
|
|
2449
|
+
return '';
|
|
2450
|
+
return composeAssuranceProgramAuthorityBrief();
|
|
2451
|
+
}
|
|
2100
2452
|
composeDocumentFactObligationsSection(playbook) {
|
|
2101
2453
|
if (!playbookDeclaresContextSource(playbook, MetaWorkflow_ContextSource.DOCUMENT_FACT_OBLIGATIONS))
|
|
2102
2454
|
return '';
|
|
2103
|
-
return composeAssuranceDocumentFactObligationsBrief(
|
|
2455
|
+
return composeAssuranceDocumentFactObligationsBrief(FACT_OBLIGATION_DOCUMENT_DEFINITION_REFS);
|
|
2456
|
+
}
|
|
2457
|
+
/**
|
|
2458
|
+
* The application's BILLING configuration, as the terms lane needs it (#227).
|
|
2459
|
+
*
|
|
2460
|
+
* Read from the backend companion exports rather than from `wildo.saas.config.ts`, because that is
|
|
2461
|
+
* where it lives: `billing` is declared in the application's `saas-config.backend.ts` and reaches the
|
|
2462
|
+
* runtime `AppConfiguration`, not the root config the companion already holds.
|
|
2463
|
+
*
|
|
2464
|
+
* THREE outcomes, never two. "The configuration could not be read" and "the application declares no
|
|
2465
|
+
* billing" are different facts with different consequences — the first means the question was not
|
|
2466
|
+
* asked, the second is a positive statement that nothing is sold through the framework — and a
|
|
2467
|
+
* drafter told the wrong one writes a confident clause about a product it never saw. Collapsing them
|
|
2468
|
+
* into `undefined` is the conflation this whole lane exists to refuse.
|
|
2469
|
+
*
|
|
2470
|
+
* Best-effort by design: this brief must not be the reason a run fails. An unreadable configuration
|
|
2471
|
+
* is rendered as unreadable and the drafter marks the gap.
|
|
2472
|
+
*/
|
|
2473
|
+
async resolveBillingDeclaration() {
|
|
2474
|
+
try {
|
|
2475
|
+
const { backendConfig } = await loadBackendCompanionExports(this.companionContext);
|
|
2476
|
+
const authored = backendConfig.billing;
|
|
2477
|
+
if (authored === undefined || authored === null)
|
|
2478
|
+
return { kind: 'ABSENT' };
|
|
2479
|
+
const parsed = BillingConfigurationSchema.safeParse(authored);
|
|
2480
|
+
if (!parsed.success) {
|
|
2481
|
+
return { kind: 'UNREADABLE', reason: 'the declared billing configuration does not satisfy its own schema' };
|
|
2482
|
+
}
|
|
2483
|
+
return {
|
|
2484
|
+
kind: 'DECLARED',
|
|
2485
|
+
billing: parsed.data,
|
|
2486
|
+
// The AUTHORED object, before defaults — which is what separates "the operator chose this" from
|
|
2487
|
+
// "the framework filled it in". The parsed value cannot answer that: every key is present there.
|
|
2488
|
+
authoredKeys: Object.keys(authored),
|
|
2489
|
+
};
|
|
2490
|
+
}
|
|
2491
|
+
catch (error) {
|
|
2492
|
+
this.logDebug('Billing configuration read failed (brief will report it as unreadable)', { error: String(error) });
|
|
2493
|
+
return { kind: 'UNREADABLE', reason: 'the backend configuration could not be loaded' };
|
|
2494
|
+
}
|
|
2104
2495
|
}
|
|
2105
2496
|
async composeCompliancePrimaryFactsSection(playbook) {
|
|
2106
2497
|
if (!playbookDeclaresContextSource(playbook, MetaWorkflow_ContextSource.COMPLIANCE_PRIMARY_FACTS))
|
|
@@ -2277,10 +2668,12 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
2277
2668
|
...renderRetentionSchedule(saasConfig.dataRetention),
|
|
2278
2669
|
'',
|
|
2279
2670
|
// Joined to the RUNTIME-SCOPED set: a profile with no runtime binding is not a recipient.
|
|
2280
|
-
...renderProcessorRegister(runtimeScopedProviderRefs, await this.resolveProcessorRegister()),
|
|
2671
|
+
...renderProcessorRegister(runtimeScopedProviderRefs, await this.resolveProcessorRegister(), saasConfig.providerComplianceChoices),
|
|
2281
2672
|
'',
|
|
2282
2673
|
...renderAiUsePosture(new Set(declaredCapabilities), saasConfig.aiUsePosture),
|
|
2283
2674
|
'',
|
|
2675
|
+
...composeBillingCommercialModelBrief(await this.resolveBillingDeclaration()),
|
|
2676
|
+
...composeOperatingJurisdictionCoverageBrief(saasConfig.operatingJurisdictions),
|
|
2284
2677
|
...renderOperatorComplianceIdentity(saasConfig.operatorComplianceIdentity),
|
|
2285
2678
|
...renderServiceConsentRequirement(saasConfig.operatorComplianceIdentity?.serviceConsentRequirement),
|
|
2286
2679
|
...renderClientStorage(Object.entries(this.companionContext.servicesByKey)
|
|
@@ -2481,7 +2874,75 @@ let PlaybookRunCompanionService = class PlaybookRunCompanionService {
|
|
|
2481
2874
|
activeChoreography = null;
|
|
2482
2875
|
/** What is running in this process, and what died leaving a resumable checkpoint. */
|
|
2483
2876
|
async readRunsInFlight() {
|
|
2484
|
-
return {
|
|
2877
|
+
return {
|
|
2878
|
+
running: this.activeChoreography,
|
|
2879
|
+
interrupted: await this.choreographyCheckpoints.list(),
|
|
2880
|
+
lastCompleted: [...this.lastCompletedDetachedRuns.values()],
|
|
2881
|
+
};
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* The most recent DETACHED run outcome per playbook ref — the read side of async submission (#265).
|
|
2885
|
+
*
|
|
2886
|
+
* In memory deliberately (one-source-of-truth Rule 5: a per-run cache; a restart costs the summary
|
|
2887
|
+
* and no fact — the artifacts are in the tree and the details in the traces). Bounded to one entry
|
|
2888
|
+
* per ref, because the question this answers is "what happened to the run I submitted", not a
|
|
2889
|
+
* history — the traces are the history.
|
|
2890
|
+
*/
|
|
2891
|
+
lastCompletedDetachedRuns = new Map();
|
|
2892
|
+
/**
|
|
2893
|
+
* Submit a run and return IMMEDIATELY — the async half of #265's envelope fix.
|
|
2894
|
+
*
|
|
2895
|
+
* The synchronous route holds one HTTP request open for the run's whole life, and the server's
|
|
2896
|
+
* 30-minute request ceiling is SHORTER than a choreography's own duration bound — measured twice:
|
|
2897
|
+
* the connection dies at exactly 1800s, the run continues and even completes server-side, and the
|
|
2898
|
+
* caller gets HTTP 000 instead of a result. This path returns at submission; the caller polls
|
|
2899
|
+
* `readRunsInFlight`, whose `lastCompleted` carries the outcome (including a failure — an async
|
|
2900
|
+
* submission must never turn an error into silence).
|
|
2901
|
+
*/
|
|
2902
|
+
submitPlaybookRunDetached(input) {
|
|
2903
|
+
const startedAt = new Date().toISOString();
|
|
2904
|
+
void this.runPlaybook(input)
|
|
2905
|
+
.then((result) => {
|
|
2906
|
+
this.lastCompletedDetachedRuns.set(input.playbookRef, {
|
|
2907
|
+
playbookRef: input.playbookRef,
|
|
2908
|
+
startedAt,
|
|
2909
|
+
finishedAt: new Date().toISOString(),
|
|
2910
|
+
ok: true,
|
|
2911
|
+
result,
|
|
2912
|
+
});
|
|
2913
|
+
})
|
|
2914
|
+
.catch((error) => {
|
|
2915
|
+
this.lastCompletedDetachedRuns.set(input.playbookRef, {
|
|
2916
|
+
playbookRef: input.playbookRef,
|
|
2917
|
+
startedAt,
|
|
2918
|
+
finishedAt: new Date().toISOString(),
|
|
2919
|
+
ok: false,
|
|
2920
|
+
error: error instanceof Error ? error.message : JSON.stringify(error)?.slice(0, 500) ?? 'unknown',
|
|
2921
|
+
});
|
|
2922
|
+
});
|
|
2923
|
+
return {
|
|
2924
|
+
accepted: false,
|
|
2925
|
+
async: true,
|
|
2926
|
+
playbookRef: input.playbookRef,
|
|
2927
|
+
note: 'Submitted. Poll GET /playbooks/runs — `running` while in flight, then your outcome in `lastCompleted`. '
|
|
2928
|
+
+ 'Validation failures (an unanswered elicitation, an ineligible playbook) surface there too, not as an HTTP error.',
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
/**
|
|
2932
|
+
* Every run waiting for its creator to answer — a THIRD state, and neither of the two above.
|
|
2933
|
+
*
|
|
2934
|
+
* `readRunsInFlight` answers `{ running, interrupted }`: the in-process marker for a choreography
|
|
2935
|
+
* executing right now, and the checkpoints of one that stopped mid-way. A SUSPENDED run is neither.
|
|
2936
|
+
* It is healthy, it has written nothing — the clarification check runs before the artifact call —
|
|
2937
|
+
* and it is waiting on a decision only a person can make. It appeared in neither read, so nothing
|
|
2938
|
+
* could name it once its creator's client was gone.
|
|
2939
|
+
*
|
|
2940
|
+
* Kept as its own method rather than folded into `readRunsInFlight` for that reason: merging the
|
|
2941
|
+
* three would say a suspended run is a kind of in-flight one, and the difference is exactly what a
|
|
2942
|
+
* reader needs — one of the three is waiting for THEM.
|
|
2943
|
+
*/
|
|
2944
|
+
async readSuspendedRuns() {
|
|
2945
|
+
return this.suspendedRuns.list();
|
|
2485
2946
|
}
|
|
2486
2947
|
modelCallBreaker = { hour: '', calls: 0, providerBudgetNoted: false };
|
|
2487
2948
|
assertPlaybookModelCallBreaker() {
|
|
@@ -2664,15 +3125,17 @@ PlaybookRunCompanionService = PlaybookRunCompanionService_1 = __decorate([
|
|
|
2664
3125
|
__param(4, inject(COMPANION_SERVICE_TYPES.TraceabilityService)),
|
|
2665
3126
|
__param(5, inject(COMPANION_SERVICE_TYPES.PlaybookRunWriteRegisterService)),
|
|
2666
3127
|
__param(6, inject(COMPANION_SERVICE_TYPES.ApplicationBuildDispatchService)),
|
|
2667
|
-
__param(7, inject(COMPANION_SERVICE_TYPES.
|
|
2668
|
-
__param(8, inject(COMPANION_SERVICE_TYPES.
|
|
2669
|
-
__param(9, inject(COMPANION_SERVICE_TYPES.
|
|
2670
|
-
__param(10, inject(COMPANION_SERVICE_TYPES.
|
|
2671
|
-
__param(11, inject(COMPANION_SERVICE_TYPES.
|
|
2672
|
-
__param(12, inject(COMPANION_SERVICE_TYPES.
|
|
3128
|
+
__param(7, inject(COMPANION_SERVICE_TYPES.CodingAgentDispatchService)),
|
|
3129
|
+
__param(8, inject(COMPANION_SERVICE_TYPES.GitChangeSetService)),
|
|
3130
|
+
__param(9, inject(COMPANION_SERVICE_TYPES.IntrospectionService)),
|
|
3131
|
+
__param(10, inject(COMPANION_SERVICE_TYPES.FoundationExecutorService)),
|
|
3132
|
+
__param(11, inject(COMPANION_SERVICE_TYPES.PlaybookSuspendedRunService)),
|
|
3133
|
+
__param(12, inject(COMPANION_SERVICE_TYPES.PlaybookChoreographyCheckpointService)),
|
|
3134
|
+
__param(13, inject(COMPANION_SERVICE_TYPES.StructuredDeliberationService)),
|
|
2673
3135
|
__metadata("design:paramtypes", [Function, Object, ResearchAgentDispatchCompanionService, Function, CompanionTraceabilityService,
|
|
2674
3136
|
PlaybookRunWriteRegisterCompanionService,
|
|
2675
3137
|
ApplicationBuildDispatchCompanionService,
|
|
3138
|
+
CodingAgentDispatchCompanionService,
|
|
2676
3139
|
GitChangeSetCompanionService,
|
|
2677
3140
|
CompanionIntrospectionService,
|
|
2678
3141
|
FoundationExecutorCompanionService,
|