@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
|
@@ -63,9 +63,10 @@ import { existsSync, realpathSync } from 'node:fs';
|
|
|
63
63
|
import { inject, injectable } from 'inversify';
|
|
64
64
|
import { AgentsBackendService, ErrorBuilderBackendService, LoggerService, SAAS_SERVICE_TYPES, executeBoundedSubprocess, describeCaughtError, } from '@wildo-ai/saas-backend-lib';
|
|
65
65
|
import { Actor_Task_Topics, ErrorCustomMessageReference, ErrorType, FlowsActors_IO_PartKind, FlowsActors_Status, isWildoBackendError, } from '@wildo-ai/saas-models';
|
|
66
|
-
import { CodingAgent_StopReason, } from '@wildo-ai/external-connectors-models';
|
|
66
|
+
import { CodingAgent_SessionSuspensionSchema, CodingAgent_StopReason, } from '@wildo-ai/external-connectors-models';
|
|
67
67
|
import { ApplicationCodingTaskContractSchema, } from '@wildo-ai/saas-specifications/application-creation';
|
|
68
68
|
import { getWorkspaceMutationLockPath as resolveWorkspaceMutationLockPath, withDedicatedFileLock, } from '@wildo-ai/platform-config-lib';
|
|
69
|
+
import { sanitizeWorkbenchCreationPlaneIdentity } from '@wildo-ai/platform-core-shared';
|
|
69
70
|
import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.js';
|
|
70
71
|
import { CompanionTraceabilityLevel, CompanionTraceAliasKind } from '../../core/traceability/companion-traceability.models.js';
|
|
71
72
|
import { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service.js';
|
|
@@ -73,7 +74,7 @@ import { CompanionIntrospectionService } from '../../core/introspection/services
|
|
|
73
74
|
import { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service.js';
|
|
74
75
|
import { CompanionCreateActorTaskRequestSchema, CompanionUpdateActorTaskRequestSchema, } from '../../companion-api/companion-api.schemas.js';
|
|
75
76
|
import { GitChangeSetCompanionService } from './git-change-set.companion.service.js';
|
|
76
|
-
import { APPLICATION_CODING_AGENT_REF } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions.js';
|
|
77
|
+
import { APPLICATION_CODING_AGENT_REF, APPLICATION_CODING_TURN_CLASSIFIER_AGENT_REF, CodingTurnEndClassificationOutputSchema, APPLICATION_CODING_AGENT_REFS, isApplicationCodingAgentRef, resolveSelectedApplicationCodingAgentBinding, } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions.js';
|
|
77
78
|
import { ChangeSetAttributionClass, ApplicationCodingTaskDisposition, DISPATCH_DEFAULT_MAX_CAPTURED_BYTES, DISPATCH_DEFAULT_TIMEOUT_MS, DISPATCH_HARD_MAX_CAPTURED_BYTES, DISPATCH_HARD_MAX_TIMEOUT_MS, VerificationKind, renderApplicationCodingTaskAgentPrompt, resolveApplicationCodingTaskVerificationPlans, } from '../models/coding-agent-dispatch.models.js';
|
|
78
79
|
/** Fixed, non-overridable limits for the verification hook subprocess. */
|
|
79
80
|
const VERIFICATION_TIMEOUT_MS = 10 * 60_000;
|
|
@@ -88,6 +89,10 @@ const RETAINED_CODING_SESSION_EVENT_KINDS = new Set(['tool_call', 'tool_call_upd
|
|
|
88
89
|
const RETAINED_CODING_SESSION_FRAME_LIMIT = 200;
|
|
89
90
|
/** Tail size persisted on the task row; full streams go to traceability artifacts. */
|
|
90
91
|
const OUTPUT_TAIL_CHARS = 16_000;
|
|
92
|
+
/** Local narrow: is this an indexable object (not null, not an array)? */
|
|
93
|
+
function isRecordValue(value) {
|
|
94
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
95
|
+
}
|
|
91
96
|
/**
|
|
92
97
|
* Scope checking is deliberately based on the post-run attribution capture,
|
|
93
98
|
* not only clean-baseline files. A baseline-dirty file changed again during a
|
|
@@ -239,6 +244,19 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
239
244
|
* which is correct — restart reconciliation already terminalized it.
|
|
240
245
|
*/
|
|
241
246
|
applicationCodingTaskSettlements = new Map();
|
|
247
|
+
/**
|
|
248
|
+
* Tasks parked on a question, keyed by task id — the answerable set. A task
|
|
249
|
+
* enters here when a run returns a `suspension` and leaves when it is answered
|
|
250
|
+
* (resumed) or explicitly abandoned. See {@link ParkedCodingSessionState}.
|
|
251
|
+
*/
|
|
252
|
+
parkedCodingSessions = new Map();
|
|
253
|
+
/**
|
|
254
|
+
* Live-frame subscribers keyed by task id. Fed by the coding session's own
|
|
255
|
+
* event stream and the ladder's state transitions while a run is active;
|
|
256
|
+
* drained by the SSE endpoint. Best-effort throughout — a slow or throwing
|
|
257
|
+
* subscriber never touches the run it observes.
|
|
258
|
+
*/
|
|
259
|
+
codingSessionSubscribers = new Map();
|
|
242
260
|
constructor(logger, errorBuilder, companionContext, agentsService, gitChangeSetService, executionsService, traceabilityService, introspectionService) {
|
|
243
261
|
this.logger = logger;
|
|
244
262
|
this.errorBuilder = errorBuilder;
|
|
@@ -374,8 +392,32 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
374
392
|
}, sessionContext);
|
|
375
393
|
const reconciledTaskIds = [];
|
|
376
394
|
for (const task of processingTasks) {
|
|
377
|
-
|
|
395
|
+
// MEMBERSHIP, not equality with one constant: with a second declared coding
|
|
396
|
+
// agent, equality silently skips every task addressed to it — a task never
|
|
397
|
+
// claimed and never reported, which is worse than one that fails loudly.
|
|
398
|
+
if (!isApplicationCodingAgentRef(task.actors?.actorRef))
|
|
378
399
|
continue;
|
|
400
|
+
/*
|
|
401
|
+
* A PARKED task is deliberately PROCESSING with no live child — its agent process is already
|
|
402
|
+
* closed and the answer resumes the persisted session via `session/load`. That is the ONE
|
|
403
|
+
* PROCESSING shape a restart must NOT terminalize: surviving the restart is the suspension's
|
|
404
|
+
* whole design (`reconstructParkedCodingTaskForResume` re-selects it from the build plan).
|
|
405
|
+
* Measured 2026-09-04, first live park on a restart: this sweep terminalized the parked row
|
|
406
|
+
* and nulled its suspension three seconds before the operator's answer arrived, so the
|
|
407
|
+
* restart-durability door refused with "no coding task is awaiting an answer". Only a FRESH,
|
|
408
|
+
* RESUMABLE suspension is exempt — an expired `parkedUntil`, or an agent that cannot
|
|
409
|
+
* `session/load`, leaves a question nobody can answer on the same session, and terminalizing
|
|
410
|
+
* it for review is then the honest outcome.
|
|
411
|
+
*/
|
|
412
|
+
const parkedOutput = task.output;
|
|
413
|
+
if (parkedOutput?.disposition === ApplicationCodingTaskDisposition.AWAITING_OPERATOR_INPUT) {
|
|
414
|
+
const parsedSuspension = CodingAgent_SessionSuspensionSchema.safeParse(parkedOutput.suspension);
|
|
415
|
+
const stillAnswerable = parsedSuspension.success
|
|
416
|
+
&& parsedSuspension.data.resumable
|
|
417
|
+
&& Date.parse(parsedSuspension.data.parkedUntil) > Date.now();
|
|
418
|
+
if (stillAnswerable)
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
379
421
|
let currentSnapshot = null;
|
|
380
422
|
let captureError = null;
|
|
381
423
|
try {
|
|
@@ -447,8 +489,12 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
447
489
|
// usable — that depends on the provider configuration and on an agent
|
|
448
490
|
// process this service has not started, and a status field that overstates
|
|
449
491
|
// its knowledge is worse than one that is narrow about it.
|
|
450
|
-
|
|
451
|
-
|
|
492
|
+
// Every declared agent must resolve, not merely the default: a registry
|
|
493
|
+
// missing the SELECTED agent reports healthy while dispatch refuses.
|
|
494
|
+
codingAgentRegistered: APPLICATION_CODING_AGENT_REFS.every((ref) => this.agentsService.getAgent(ref) !== undefined),
|
|
495
|
+
activeRun: this.activeRun ? { taskId: this.activeRun.taskId, startedAt: this.activeRun.startedAt } : null,
|
|
496
|
+
// The answerable set: what is parked waiting for an operator response.
|
|
497
|
+
pendingQuestions: this.listPendingCodingQuestions(),
|
|
452
498
|
limits: {
|
|
453
499
|
defaultTimeoutMs: DISPATCH_DEFAULT_TIMEOUT_MS,
|
|
454
500
|
hardMaxTimeoutMs: DISPATCH_HARD_MAX_TIMEOUT_MS,
|
|
@@ -479,10 +525,15 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
479
525
|
async createApplicationCodingTask(task, baseline, sessionContext) {
|
|
480
526
|
const payload = CompanionCreateActorTaskRequestSchema.parse({
|
|
481
527
|
title: `Application coding task ${task.taskRef}`,
|
|
528
|
+
/* The cross-plane join key — the board's build-plan row this task executes (Phase 4, R5). */
|
|
529
|
+
workbenchBuildPlanTaskId: sanitizeWorkbenchCreationPlaneIdentity(task.taskRef),
|
|
482
530
|
description: `Typed application coding task for ${task.objectiveRef}; acceptance remains outside the coding host.`,
|
|
483
531
|
topic: Actor_Task_Topics.IMPLEMENTATION,
|
|
484
532
|
status: FlowsActors_Status.PROCESSING,
|
|
485
|
-
|
|
533
|
+
// The SELECTED agent, resolved once at creation and carried on the row —
|
|
534
|
+
// so a task records which agent it was addressed to, and a selection
|
|
535
|
+
// changed between creation and claim cannot silently redirect it.
|
|
536
|
+
actors: { actorRef: resolveSelectedApplicationCodingAgentBinding().ref },
|
|
486
537
|
input: {
|
|
487
538
|
taskRef: task.taskRef,
|
|
488
539
|
objectiveRef: task.objectiveRef,
|
|
@@ -515,7 +566,15 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
515
566
|
* evidence. This method runs inside the worktree lock and therefore is the
|
|
516
567
|
* sole typed path allowed to observe its own before/after Git boundary.
|
|
517
568
|
*/
|
|
518
|
-
async executeApplicationCodingTask(task, renderedPrompt, verificationPlans, durableTask, baseline
|
|
569
|
+
async executeApplicationCodingTask(task, renderedPrompt, verificationPlans, durableTask, baseline,
|
|
570
|
+
/**
|
|
571
|
+
* Present when this run ANSWERS a parked question rather than starting the
|
|
572
|
+
* task: the agent session is resumed by id via `session/load` and the answer
|
|
573
|
+
* is delivered as the next turn. The task's mutation scope, verification plan
|
|
574
|
+
* and original baseline are unchanged — the resume is held to exactly the
|
|
575
|
+
* bounds the first run was.
|
|
576
|
+
*/
|
|
577
|
+
resume) {
|
|
519
578
|
let runSession;
|
|
520
579
|
let runStep;
|
|
521
580
|
const traceabilityErrors = [];
|
|
@@ -560,7 +619,11 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
560
619
|
agentRef: APPLICATION_CODING_AGENT_REF,
|
|
561
620
|
initiator: {},
|
|
562
621
|
invocationContext: [],
|
|
563
|
-
|
|
622
|
+
// A resume delivers the operator's ANSWER as the turn and re-enters the
|
|
623
|
+
// parked session; a first run delivers the rendered task.
|
|
624
|
+
input: resume
|
|
625
|
+
? { prompt: resume.answerPrompt, continuationOfSessionId: resume.continuationOfSessionId }
|
|
626
|
+
: { prompt: renderedPrompt },
|
|
564
627
|
output: { finalMessage: '', stopReason: CodingAgent_StopReason.END_TURN },
|
|
565
628
|
executionContext: { callTimestamp: new Date().toISOString() },
|
|
566
629
|
artifactBindings: [],
|
|
@@ -608,6 +671,16 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
608
671
|
&& RETAINED_CODING_SESSION_EVENT_KINDS.has(event.kind)) {
|
|
609
672
|
retainedCodingSessionFrames.push(event);
|
|
610
673
|
}
|
|
674
|
+
this.publishCodingSessionFrame(durableTask._id, { channel: 'event', payload: event });
|
|
675
|
+
},
|
|
676
|
+
// The JUDGMENT half of the interactive lane: classify each end-of-turn
|
|
677
|
+
// message so the engine ladder can auto-continue a self-pause and park
|
|
678
|
+
// a genuine question. The engine fails OPEN if this throws, so a
|
|
679
|
+
// classifier fault degrades to "the turn is complete" rather than
|
|
680
|
+
// hanging the run — this method may therefore throw freely.
|
|
681
|
+
classifyCodingTurnEnd: (input) => this.classifyCodingTurnEnd(input),
|
|
682
|
+
onCodingSessionStateChange: (state) => {
|
|
683
|
+
this.publishCodingSessionFrame(durableTask._id, { channel: 'state', payload: state });
|
|
611
684
|
},
|
|
612
685
|
...(this.activeRun ? { codingSessionAbortSignal: this.activeRun.abortController.signal } : {}),
|
|
613
686
|
});
|
|
@@ -618,6 +691,31 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
618
691
|
codingPermissionDecisions = codingOutput?.permissionDecisions;
|
|
619
692
|
const text = codingOutput?.finalMessage;
|
|
620
693
|
agentStopReason = codingOutput?.stopReason;
|
|
694
|
+
// A PARKED run stopped WITHOUT finishing to ask the operator a question.
|
|
695
|
+
// Its `finalMessage` is the question and its partial edits are NOT a final
|
|
696
|
+
// change set — so it must skip assessment, verification and the
|
|
697
|
+
// terminal disposition entirely, and instead record an answerable,
|
|
698
|
+
// non-terminal state. Handled here, before the CANCELLED/empty checks,
|
|
699
|
+
// because a question is a non-empty END_TURN message that would otherwise
|
|
700
|
+
// read as a completed working result.
|
|
701
|
+
if (codingOutput?.suspension) {
|
|
702
|
+
await this.recordParkedApplicationCodingTask({
|
|
703
|
+
task,
|
|
704
|
+
verificationPlans,
|
|
705
|
+
durableTask,
|
|
706
|
+
baseline,
|
|
707
|
+
suspension: codingOutput.suspension,
|
|
708
|
+
output: codingOutput,
|
|
709
|
+
usage: codingUsage,
|
|
710
|
+
codingSessionEventCount,
|
|
711
|
+
retainedCodingSessionFrames,
|
|
712
|
+
startedAtMs,
|
|
713
|
+
runSession,
|
|
714
|
+
runStep,
|
|
715
|
+
traceBestEffort,
|
|
716
|
+
});
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
621
719
|
// A CANCELLED turn is not a completed one, and its partial change set must
|
|
622
720
|
// not be read as a working result. Refused here rather than downstream so
|
|
623
721
|
// the disposition names the actual reason.
|
|
@@ -648,39 +746,10 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
648
746
|
// application package/cache if started together. The ordered outcomes are
|
|
649
747
|
// easier to inspect and avoid turning a bounded coding task into an
|
|
650
748
|
// accidental local-build fan-out.
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
try {
|
|
656
|
-
verification.push({
|
|
657
|
-
checkRef: plan.checkRef,
|
|
658
|
-
// The FK-resolution check is not a CLI command: it runs in the companion's
|
|
659
|
-
// introspection subprocess (fresh working-tree import), so it branches before
|
|
660
|
-
// the argv-plan path.
|
|
661
|
-
outcome: plan.kind === VerificationKind.FRONTEND_FK_RESOLUTION
|
|
662
|
-
? await this.runForeignKeyResolutionVerification()
|
|
663
|
-
: plan.kind === VerificationKind.SETTINGS_PLACEMENT_CONTENT
|
|
664
|
-
? await this.runSettingsPlacementContentVerification()
|
|
665
|
-
: await this.runVerification(this.buildVerificationPlan(plan.kind, plan.path ?? undefined)),
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
catch (error) {
|
|
669
|
-
verificationInfrastructureError ??= error;
|
|
670
|
-
verification.push({
|
|
671
|
-
checkRef: plan.checkRef,
|
|
672
|
-
outcome: {
|
|
673
|
-
kind: plan.kind,
|
|
674
|
-
path: plan.path,
|
|
675
|
-
success: false,
|
|
676
|
-
message: describeCaughtError(error),
|
|
677
|
-
stdoutTail: '',
|
|
678
|
-
stderrTail: '',
|
|
679
|
-
},
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
}
|
|
749
|
+
const shouldVerify = !runError && !captureError && scopeAssessment?.allowed === true;
|
|
750
|
+
const { verification, infrastructureError: verificationInfrastructureError } = shouldVerify
|
|
751
|
+
? await this.executeVerificationPlans(verificationPlans)
|
|
752
|
+
: { verification: [], infrastructureError: null };
|
|
684
753
|
const failedVerification = verification.find(({ outcome }) => !outcome.success) ?? null;
|
|
685
754
|
if (agentOutput) {
|
|
686
755
|
await traceBestEffort('write-agent-output', () => this.traceOperationArtifact(runSession, runStep, 'application-coding-task-agent-output.txt', agentOutput));
|
|
@@ -789,6 +858,254 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
789
858
|
payload: output,
|
|
790
859
|
}));
|
|
791
860
|
}
|
|
861
|
+
// ================================================================
|
|
862
|
+
// Interactive lane — classifier, live relay, park & resume
|
|
863
|
+
// ================================================================
|
|
864
|
+
/**
|
|
865
|
+
* Classify a coding agent's end-of-turn message through the dedicated
|
|
866
|
+
* structured classifier agent. Throws on any fault; the ENGINE ladder wraps
|
|
867
|
+
* that into `CLASSIFIER_UNAVAILABLE` and settles, so this never has to invent
|
|
868
|
+
* a safe default of its own.
|
|
869
|
+
*/
|
|
870
|
+
async classifyCodingTurnEnd(input) {
|
|
871
|
+
const prompt = [
|
|
872
|
+
'A coding agent ended its turn with the message below. Classify what the message means so an '
|
|
873
|
+
+ 'autonomous runner can decide whether to continue automatically, or to surface a question to '
|
|
874
|
+
+ 'the operator.',
|
|
875
|
+
'',
|
|
876
|
+
'# Agent end-of-turn message',
|
|
877
|
+
input.finalMessage,
|
|
878
|
+
].join('\n');
|
|
879
|
+
const invocation = {
|
|
880
|
+
agentRef: APPLICATION_CODING_TURN_CLASSIFIER_AGENT_REF,
|
|
881
|
+
initiator: {},
|
|
882
|
+
invocationContext: [],
|
|
883
|
+
input: { prompt, schema: CodingTurnEndClassificationOutputSchema },
|
|
884
|
+
output: { object: {} },
|
|
885
|
+
executionContext: {},
|
|
886
|
+
artifactBindings: [],
|
|
887
|
+
};
|
|
888
|
+
const response = await this.agentsService.invokeAgent(invocation);
|
|
889
|
+
const raw = response.output?.object;
|
|
890
|
+
const parsed = CodingTurnEndClassificationOutputSchema.safeParse(raw);
|
|
891
|
+
if (!parsed.success) {
|
|
892
|
+
// A malformed classifier answer is a classifier fault: let the ladder fail
|
|
893
|
+
// open rather than guess which situation the model meant.
|
|
894
|
+
throw new Error('Coding turn-end classifier returned an unparseable result.');
|
|
895
|
+
}
|
|
896
|
+
return parsed.data.classification;
|
|
897
|
+
}
|
|
898
|
+
/** Fan one live frame out to a task's SSE subscribers. Best-effort, never throws into the run. */
|
|
899
|
+
publishCodingSessionFrame(taskId, frame) {
|
|
900
|
+
const listeners = this.codingSessionSubscribers.get(taskId);
|
|
901
|
+
if (!listeners)
|
|
902
|
+
return;
|
|
903
|
+
for (const listener of listeners) {
|
|
904
|
+
try {
|
|
905
|
+
listener(frame);
|
|
906
|
+
}
|
|
907
|
+
catch {
|
|
908
|
+
// A subscriber must never be able to fail the run it observes.
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Subscribe to a task's live coding frames. Returns an unsubscribe function.
|
|
914
|
+
*
|
|
915
|
+
* Frames flow only while a run is ACTIVE for that task; a subscriber that
|
|
916
|
+
* attaches after the run parked or finished simply receives nothing further,
|
|
917
|
+
* which is why the SSE endpoint sends the current pending question up front.
|
|
918
|
+
*/
|
|
919
|
+
subscribeToCodingSession(taskId, listener) {
|
|
920
|
+
let listeners = this.codingSessionSubscribers.get(taskId);
|
|
921
|
+
if (!listeners) {
|
|
922
|
+
listeners = new Set();
|
|
923
|
+
this.codingSessionSubscribers.set(taskId, listeners);
|
|
924
|
+
}
|
|
925
|
+
listeners.add(listener);
|
|
926
|
+
return () => {
|
|
927
|
+
const set = this.codingSessionSubscribers.get(taskId);
|
|
928
|
+
if (!set)
|
|
929
|
+
return;
|
|
930
|
+
set.delete(listener);
|
|
931
|
+
if (set.size === 0)
|
|
932
|
+
this.codingSessionSubscribers.delete(taskId);
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
/** The questions currently awaiting an operator answer, for status/UX. */
|
|
936
|
+
listPendingCodingQuestions() {
|
|
937
|
+
return [...this.parkedCodingSessions.values()].map((parked) => ({
|
|
938
|
+
taskId: parked.durableTask._id,
|
|
939
|
+
taskRef: parked.task.taskRef,
|
|
940
|
+
question: parked.suspension.question,
|
|
941
|
+
parkedAt: parked.parkedAt,
|
|
942
|
+
resumable: parked.suspension.resumable,
|
|
943
|
+
}));
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Record a run that parked on a question: persist the non-terminal durable row
|
|
947
|
+
* (status PROCESSING, disposition AWAITING_OPERATOR_INPUT, question on the
|
|
948
|
+
* output) and retain the answerable state in memory for the resume door.
|
|
949
|
+
*
|
|
950
|
+
* Deliberately skips change-set assessment and verification: a parked run's
|
|
951
|
+
* edits are partial by definition, and assessing them as a final change set is
|
|
952
|
+
* exactly the "read a suspended turn as complete" mistake the suspension field
|
|
953
|
+
* exists to prevent.
|
|
954
|
+
*/
|
|
955
|
+
async recordParkedApplicationCodingTask(params) {
|
|
956
|
+
const { task, durableTask, baseline, suspension, output, verificationPlans } = params;
|
|
957
|
+
this.parkedCodingSessions.set(durableTask._id, {
|
|
958
|
+
durableTask,
|
|
959
|
+
task,
|
|
960
|
+
verificationPlans,
|
|
961
|
+
baseline,
|
|
962
|
+
suspension,
|
|
963
|
+
parkedAt: new Date().toISOString(),
|
|
964
|
+
});
|
|
965
|
+
const durableOutput = {
|
|
966
|
+
succeeded: false,
|
|
967
|
+
disposition: ApplicationCodingTaskDisposition.AWAITING_OPERATOR_INPUT,
|
|
968
|
+
durationMs: Date.now() - params.startedAtMs,
|
|
969
|
+
// The question the operator must answer, front and centre.
|
|
970
|
+
pendingQuestion: suspension.question,
|
|
971
|
+
suspension,
|
|
972
|
+
agentOutputTail: (output.finalMessage ?? '').slice(-OUTPUT_TAIL_CHARS),
|
|
973
|
+
...(output.stopReason ? { agentStopReason: output.stopReason } : {}),
|
|
974
|
+
...(output.turnCount ? { turnCount: output.turnCount } : {}),
|
|
975
|
+
...(output.continuations && output.continuations.length > 0 ? { continuations: output.continuations } : {}),
|
|
976
|
+
...(params.codingSessionEventCount > 0 ? { codingSessionEventCount: params.codingSessionEventCount } : {}),
|
|
977
|
+
...(params.retainedCodingSessionFrames.length > 0 ? { codingSessionFrames: params.retainedCodingSessionFrames } : {}),
|
|
978
|
+
...(params.usage ? { usage: params.usage } : {}),
|
|
979
|
+
...(output.deniedPermissionCount !== undefined ? { deniedPermissionCount: output.deniedPermissionCount } : {}),
|
|
980
|
+
...(output.permissionDecisions && output.permissionDecisions.length > 0 ? { permissionDecisions: output.permissionDecisions } : {}),
|
|
981
|
+
};
|
|
982
|
+
// Status stays PROCESSING: the task is genuinely still in flight, waiting on
|
|
983
|
+
// the operator. It is not COMPLETED (nothing was accepted) and not FAILED
|
|
984
|
+
// (nothing went wrong) — the disposition carries the real state.
|
|
985
|
+
const updatePayload = CompanionUpdateActorTaskRequestSchema.parse({
|
|
986
|
+
status: FlowsActors_Status.PROCESSING,
|
|
987
|
+
output: durableOutput,
|
|
988
|
+
});
|
|
989
|
+
await this.executionsService.updateActorTask(durableTask._id, updatePayload, params.runSession);
|
|
990
|
+
await params.traceBestEffort('record-awaiting-input', () => this.traceOperationStart({
|
|
991
|
+
sessionContext: params.runSession,
|
|
992
|
+
step: params.runStep,
|
|
993
|
+
type: 'application-coding-task-awaiting-input',
|
|
994
|
+
summary: `Application coding task ${task.taskRef} is awaiting an operator answer`,
|
|
995
|
+
payload: { taskId: durableTask._id, question: suspension.question, resumable: suspension.resumable },
|
|
996
|
+
}));
|
|
997
|
+
}
|
|
998
|
+
/** The in-process answerable state for a parked task, if this process is the one that parked it. */
|
|
999
|
+
getParkedCodingSessionState(taskId) {
|
|
1000
|
+
return this.parkedCodingSessions.get(taskId) ?? null;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Load the DURABLE facts needed to RECONSTRUCT a parked task's answerable state
|
|
1004
|
+
* after the in-process map has lost it (a companion restart).
|
|
1005
|
+
*
|
|
1006
|
+
* Returns the build-plan `taskRef` and the persisted `suspension` — enough for
|
|
1007
|
+
* the build-dispatch layer to re-compose the task contract and rebuild a
|
|
1008
|
+
* {@link ParkedCodingSessionState}. `null` when the row is not a parked coding
|
|
1009
|
+
* task (wrong actor, no suspension, or not found).
|
|
1010
|
+
*/
|
|
1011
|
+
async loadPersistedParkedCodingTask(taskId, sessionContext) {
|
|
1012
|
+
let durableTask;
|
|
1013
|
+
try {
|
|
1014
|
+
durableTask = await this.executionsService.getActorTask(taskId, sessionContext);
|
|
1015
|
+
}
|
|
1016
|
+
catch {
|
|
1017
|
+
return null;
|
|
1018
|
+
}
|
|
1019
|
+
const row = durableTask;
|
|
1020
|
+
if (row.actors?.actorRef !== APPLICATION_CODING_AGENT_REF)
|
|
1021
|
+
return null;
|
|
1022
|
+
const taskRef = isRecordValue(row.input) && typeof row.input.taskRef === 'string' ? row.input.taskRef : null;
|
|
1023
|
+
const suspensionRaw = isRecordValue(row.output) ? row.output.suspension : undefined;
|
|
1024
|
+
const parsedSuspension = CodingAgent_SessionSuspensionSchema.safeParse(suspensionRaw);
|
|
1025
|
+
if (!taskRef || !parsedSuspension.success)
|
|
1026
|
+
return null;
|
|
1027
|
+
return { taskRef, suspension: parsedSuspension.data, durableTask };
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Answer a parked coding task's question and resume the SAME agent session.
|
|
1031
|
+
*
|
|
1032
|
+
* The IN-PROCESS door: it answers a task THIS process parked. For a task whose
|
|
1033
|
+
* in-process state was lost to a restart, the caller reconstructs a
|
|
1034
|
+
* {@link ParkedCodingSessionState} (from the build plan) and uses
|
|
1035
|
+
* {@link resumeParkedCodingTask} directly.
|
|
1036
|
+
*/
|
|
1037
|
+
async respondToApplicationCodingTaskQuestion(taskId, answer) {
|
|
1038
|
+
// A missing answer is a VALIDATION 400 regardless of whether a task is parked
|
|
1039
|
+
// — it is a malformed request, not a state conflict.
|
|
1040
|
+
this.admitTypedInput(() => {
|
|
1041
|
+
if (answer.trim().length === 0)
|
|
1042
|
+
throw new Error('empty answer');
|
|
1043
|
+
return answer;
|
|
1044
|
+
}, 'An answer is required to resume a parked coding task.');
|
|
1045
|
+
const parked = this.parkedCodingSessions.get(taskId);
|
|
1046
|
+
if (!parked) {
|
|
1047
|
+
throw this.buildDispatchConflictError(`No coding task is awaiting an answer under id ${taskId} in this process. `
|
|
1048
|
+
+ 'A companion restart drops in-flight answerable state; re-dispatch the task instead.');
|
|
1049
|
+
}
|
|
1050
|
+
return this.resumeParkedCodingTask(parked, answer);
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Run a resume against an EXPLICIT parked state — from the in-process map or
|
|
1054
|
+
* reconstructed from the build plan after a restart.
|
|
1055
|
+
*
|
|
1056
|
+
* Runs under the worktree mutation lock exactly like a fresh dispatch (a resume
|
|
1057
|
+
* mutates the same worktree) and re-enters the turn ladder through
|
|
1058
|
+
* `session/load`, so the agent continues with its full context. The mutation
|
|
1059
|
+
* scope and verification plan are the parked contract's; a resume is held to the
|
|
1060
|
+
* same bounds as the first run.
|
|
1061
|
+
*/
|
|
1062
|
+
async resumeParkedCodingTask(parked, answer) {
|
|
1063
|
+
const trimmedAnswer = this.admitTypedInput(() => {
|
|
1064
|
+
const value = answer.trim();
|
|
1065
|
+
if (value.length === 0)
|
|
1066
|
+
throw new Error('empty answer');
|
|
1067
|
+
return value;
|
|
1068
|
+
}, 'An answer is required to resume a parked coding task.');
|
|
1069
|
+
const taskId = parked.durableTask._id;
|
|
1070
|
+
if (!parked.suspension.resumable) {
|
|
1071
|
+
throw this.buildDispatchConflictError(`Coding task ${taskId} parked on a question, but its agent does not support session resume, `
|
|
1072
|
+
+ 'so the answer cannot be delivered to the same session. Re-dispatch the task with the answer folded into the objective.');
|
|
1073
|
+
}
|
|
1074
|
+
if (this.activeRun) {
|
|
1075
|
+
throw this.buildDispatchConflictError(`A coding-agent run is already active (task ${this.activeRun.taskId}). Answers are serialized behind the same worktree lock.`);
|
|
1076
|
+
}
|
|
1077
|
+
// Taken out of the answerable set for the duration of the resume; a resume
|
|
1078
|
+
// that parks again re-registers it through the same suspension branch.
|
|
1079
|
+
this.parkedCodingSessions.delete(taskId);
|
|
1080
|
+
const admission = createDeferred();
|
|
1081
|
+
const resumeRun = withDedicatedFileLock(this.getWorkspaceMutationLockPath(), async () => {
|
|
1082
|
+
this.activeRun = { taskId, startedAt: new Date().toISOString(), abortController: new AbortController() };
|
|
1083
|
+
const settlement = createDeferred();
|
|
1084
|
+
this.applicationCodingTaskSettlements.set(taskId, { promise: settlement.promise, resolve: () => settlement.resolve(undefined) });
|
|
1085
|
+
admission.resolve({
|
|
1086
|
+
taskId,
|
|
1087
|
+
status: FlowsActors_Status.PROCESSING,
|
|
1088
|
+
taskRef: parked.task.taskRef,
|
|
1089
|
+
baselineHeadSha: parked.baseline.headSha,
|
|
1090
|
+
baselineDirtyFileCount: Object.keys(parked.baseline.files).length,
|
|
1091
|
+
});
|
|
1092
|
+
try {
|
|
1093
|
+
await this.executeApplicationCodingTask(parked.task, renderApplicationCodingTaskAgentPrompt(parked.task), parked.verificationPlans, parked.durableTask, parked.baseline, { continuationOfSessionId: parked.suspension.sessionId, answerPrompt: trimmedAnswer });
|
|
1094
|
+
}
|
|
1095
|
+
finally {
|
|
1096
|
+
this.activeRun = null;
|
|
1097
|
+
this.applicationCodingTaskSettlements.get(taskId)?.resolve();
|
|
1098
|
+
}
|
|
1099
|
+
}, { retries: { retries: 0 } });
|
|
1100
|
+
resumeRun.catch((error) => {
|
|
1101
|
+
admission.reject(this.mapLockError(error));
|
|
1102
|
+
this.logDebug('Application coding-task resume run terminated with error', {
|
|
1103
|
+
taskId,
|
|
1104
|
+
error: describeCaughtError(error),
|
|
1105
|
+
});
|
|
1106
|
+
});
|
|
1107
|
+
return admission.promise;
|
|
1108
|
+
}
|
|
792
1109
|
buildApplicationCodingTaskTraceSummary(task) {
|
|
793
1110
|
return {
|
|
794
1111
|
taskRef: task.taskRef,
|
|
@@ -914,6 +1231,67 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
|
|
|
914
1231
|
stderrTail: '',
|
|
915
1232
|
};
|
|
916
1233
|
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Run a resolved verification plan set and return one outcome per check.
|
|
1236
|
+
*
|
|
1237
|
+
* Extracted from the coding-task dispatch so the SAME executor serves a second caller: the
|
|
1238
|
+
* `DETERMINISTIC_CLI` playbook tier, which verifies an already-built application and dispatches no
|
|
1239
|
+
* agent (issue #147). The alternative was a second loop that re-derived which kinds branch away
|
|
1240
|
+
* from the argv path — and the two would drift the first time a `VerificationKind` was added,
|
|
1241
|
+
* silently, because a missed kind falls through to a typecheck that passes.
|
|
1242
|
+
*
|
|
1243
|
+
* A thrown error is an INFRASTRUCTURE failure, not a failing check: the subprocess could not be
|
|
1244
|
+
* run at all. It is recorded as a failed outcome so the caller sees which check was affected, and
|
|
1245
|
+
* surfaced separately so a caller can tell "the application is broken" from "we could not ask".
|
|
1246
|
+
*/
|
|
1247
|
+
async executeVerificationPlans(plans) {
|
|
1248
|
+
const verification = [];
|
|
1249
|
+
let infrastructureError = null;
|
|
1250
|
+
for (const plan of plans) {
|
|
1251
|
+
try {
|
|
1252
|
+
verification.push({
|
|
1253
|
+
checkRef: plan.checkRef,
|
|
1254
|
+
// The FK-resolution check is not a CLI command: it runs in the companion's
|
|
1255
|
+
// introspection subprocess (fresh working-tree import), so it branches before
|
|
1256
|
+
// the argv-plan path.
|
|
1257
|
+
outcome: plan.kind === VerificationKind.FRONTEND_FK_RESOLUTION
|
|
1258
|
+
? await this.runForeignKeyResolutionVerification()
|
|
1259
|
+
: plan.kind === VerificationKind.SETTINGS_PLACEMENT_CONTENT
|
|
1260
|
+
? await this.runSettingsPlacementContentVerification()
|
|
1261
|
+
: await this.runVerification(this.buildVerificationPlan(plan.kind, plan.path ?? undefined)),
|
|
1262
|
+
});
|
|
1263
|
+
}
|
|
1264
|
+
catch (error) {
|
|
1265
|
+
infrastructureError ??= error;
|
|
1266
|
+
verification.push({
|
|
1267
|
+
checkRef: plan.checkRef,
|
|
1268
|
+
outcome: {
|
|
1269
|
+
kind: plan.kind,
|
|
1270
|
+
path: plan.path,
|
|
1271
|
+
success: false,
|
|
1272
|
+
message: describeCaughtError(error),
|
|
1273
|
+
stdoutTail: '',
|
|
1274
|
+
stderrTail: '',
|
|
1275
|
+
},
|
|
1276
|
+
});
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return { verification, infrastructureError };
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Run named verification checks against the application, outside any agent dispatch.
|
|
1283
|
+
*
|
|
1284
|
+
* The public door for the `DETERMINISTIC_CLI` tier. Check refs resolve through the same closed
|
|
1285
|
+
* `APPLICATION_CODING_TASK_VERIFICATION_CATALOG` a coding task uses, so an unknown ref is refused
|
|
1286
|
+
* here rather than becoming an unrun check that reports success by absence.
|
|
1287
|
+
*
|
|
1288
|
+
* Deliberately takes NO worktree lock and captures NO change set: this reads the application, and
|
|
1289
|
+
* pretending otherwise would serialize verification against the single-flight coding lane for no
|
|
1290
|
+
* reason.
|
|
1291
|
+
*/
|
|
1292
|
+
async runApplicationVerificationChecks(checkRefs) {
|
|
1293
|
+
return this.executeVerificationPlans(resolveApplicationCodingTaskVerificationPlans(checkRefs));
|
|
1294
|
+
}
|
|
917
1295
|
async runVerification(plan) {
|
|
918
1296
|
try {
|
|
919
1297
|
const result = await executeBoundedSubprocess({
|