feat(#134): design Non-AI Quality Orchestrator service

Implement quality orchestration service to enforce standards on AI
agent work and prevent premature completion claims.

Components:
- QualityOrchestratorService: Core validation and gate execution
- QualityGate interface: Extensible gate definitions
- CompletionClaim/Validation: Track claims and verdicts
- OrchestrationConfig: Per-workspace configuration

Features:
- Validate completions against quality gates (build/lint/test/coverage)
- Run gates with command execution and output validation
- Support string and RegExp output pattern matching
- Smart continuation logic with attempt tracking
- Generate actionable feedback for failed gates
- Strict/lenient mode for gate enforcement
- 5-minute timeout, 10MB output buffer per gate

Default gates:
- Build Check (required)
- Lint Check (required)
- Test Suite (required)
- Coverage Check (optional, 85% threshold)

Tests: 21 passing with 85.98% coverage

Fixes #134

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 13:24:46 -06:00
parent 0c78923138
commit a25e9048be
11 changed files with 992 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export * from "./validate-completion.dto";
export * from "./orchestration-result.dto";

View File

@@ -0,0 +1,33 @@
import type { QualityGateResult } from "../interfaces";
/**
* DTO for orchestration results
*/
export interface OrchestrationResultDto {
/** Task ID */
taskId: string;
/** Whether the completion was accepted */
accepted: boolean;
/** Verdict from validation */
verdict: "accepted" | "rejected" | "needs-continuation";
/** All gates passed */
allGatesPassed: boolean;
/** Required gates that failed */
requiredGatesFailed: string[];
/** Results from each gate */
gateResults: QualityGateResult[];
/** Feedback for the agent */
feedback?: string;
/** Suggested actions to fix issues */
suggestedActions?: string[];
/** Continuation prompt if needed */
continuationPrompt?: string;
}

View File

@@ -0,0 +1,30 @@
import { IsString, IsArray, IsDateString, IsNotEmpty, ArrayMinSize } from "class-validator";
/**
* DTO for validating a completion claim
*/
export class ValidateCompletionDto {
@IsString()
@IsNotEmpty()
taskId!: string;
@IsString()
@IsNotEmpty()
agentId!: string;
@IsString()
@IsNotEmpty()
workspaceId!: string;
@IsDateString()
claimedAt!: string;
@IsString()
@IsNotEmpty()
message!: string;
@IsArray()
@ArrayMinSize(0)
@IsString({ each: true })
filesChanged!: string[];
}