// schemas/output-schemas.ts — Zod output schemas for MCP tools with structured output.
// Used with registerTool({ outputSchema }) to declare tool output structure.
// See: https://spec.modelcontextprotocol.io/specification/draft/server/tools/#structured-content
import { z } from 'zod';
// ── list_specs ──────────────────────────────────────────────────────────────
export const ListSpecsOutputSchema = {
    projectId: z.string(),
    filters: z.object({
        status: z.string(),
        type: z.string(),
    }),
    count: z.number(),
    totalCount: z.number(),
    specs: z.array(z.object({
        id: z.string(),
        title: z.string(),
        type: z.string(),
        scope: z.string().optional(),
        status: z.string(),
        difficulty: z.string().optional(),
        risk: z.string().optional(),
        target: z.string().optional(),
        tags: z.array(z.string()),
        gitBranch: z.string().optional(),
        estimation: z
            .object({
            devHours: z.number(),
            totalCostUsd: z.number(),
        })
            .optional(),
        createdAt: z.string().optional(),
        updatedAt: z.string().optional(),
        lastModified: z.string().optional(),
    })),
    summary: z.object({
        byStatus: z.record(z.string(), z.number()),
        byType: z.record(z.string(), z.number()),
        totalDevHours: z.number(),
        totalReviewHours: z.number(),
        totalCostUsd: z.number(),
    }),
    teamSuggestion: z
        .object({
        recommended: z.boolean(),
        reason: z.string(),
        templateId: z.string(),
        teamSize: z.number(),
        specs: z.array(z.string()),
        toolCalls: z.array(z.string()),
    })
        .nullable(),
    message: z.string(),
    teamDistributionHint: z.string().optional(),
    humanSummary: z.string().optional(),
    branchInfo: z
        .object({
        current: z.string(),
        all: z.array(z.string()),
        count: z.number(),
    })
        .optional(),
    autopilotSummary: z.array(z.string()).optional(),
    migrationIssues: z
        .object({
        ambiguousCriteria: z.array(z.object({
            specId: z.string(),
            specTitle: z.string(),
            specContext: z.string(),
            criterionText: z.string(),
            score: z.number(),
            reason: z.string(),
        })),
    })
        .optional(),
    interactiveQuestions: z
        .array(z.object({
        question: z.string(),
        header: z.string(),
        options: z.array(z.object({
            label: z.string(),
            description: z.string(),
        })),
        multiSelect: z.boolean(),
    }))
        .optional(),
};
// ── estimate ────────────────────────────────────────────────────────────────
export const EstimateOutputSchema = {
    specId: z.string(),
    difficulty: z.number(),
    confidence: z.string().optional(),
    estimation: z.object({
        devHours: z.number(),
        reviewHours: z.number(),
        totalHours: z.number(),
        recommendedModel: z.string(),
        tokensOpus: z.number(),
        tokensSonnet: z.number(),
        apiCostUsd: z.number(),
        humanCostUsd: z.number(),
        totalCostUsd: z.number(),
        tokenOptimization: z.object({
            mode: z.string(),
            reasoning: z.string(),
            estimatedTokens: z.number(),
            savings: z.string(),
        }),
    }),
    tokenStrategy: z.object({
        operationMode: z.string(),
        suggestedAiModel: z.string(),
        modelRationale: z.string(),
    }),
    reasoning: z.string().optional(),
    similarSpecs: z.array(z.string()).optional(),
    historyUsed: z.boolean(),
    calibrationApplied: z.string().nullable().optional(),
};
// ── validate ────────────────────────────────────────────────────────────────
export const ValidateOutputSchema = {
    specId: z.string(),
    title: z.string().optional(),
    score: z.number().nullable(),
    fieldsImplemented: z.number(),
    fieldsTotal: z.number(),
    matches: z.array(z.string()),
    missing: z.array(z.string()),
    extra: z.array(z.string()),
    qualityIssues: z.array(z.object({
        file: z.string(),
        line: z.number().optional(),
        severity: z.string(),
        rule: z.string(),
        message: z.string(),
        suggestion: z.string().optional(),
    })),
    implementationQualityScore: z.object({
        overall: z.number(),
        gradeLetter: z.string(),
        filesAudited: z.number(),
        categories: z.array(z.object({
            category: z.string(),
            score: z.number(),
            weight: z.number(),
            issueCount: z.number(),
            worstSeverity: z.string(),
        })),
    }),
    definitionOfReady: z.object({
        isReady: z.boolean(),
        passed: z.number(),
        required: z.number(),
        items: z
            .array(z.object({
            id: z.string(),
            description: z.string(),
            status: z.string(),
        }))
            .optional(),
    }),
    definitionOfDone: z.object({
        isDone: z.boolean(),
        passed: z.number(),
        required: z.number(),
        failedItems: z
            .array(z.object({
            id: z.string(),
            description: z.string(),
            category: z.string().optional(),
            status: z.string(),
        }))
            .optional(),
        items: z
            .array(z.object({
            id: z.string(),
            description: z.string(),
            status: z.string(),
        }))
            .optional(),
    }),
    conventionCompliance: z
        .object({
        totalViolations: z.number(),
        regressionDetected: z.boolean(),
        violations: z.array(z.object({
            category: z.string(),
            file: z.string(),
            line: z.number().optional(),
            message: z.string(),
            severity: z.string(),
        })),
    })
        .optional(),
    lintCheck: z
        .object({
        passed: z.boolean(),
        command: z.string(),
        issueCount: z.number(),
        output: z.string(),
    })
        .optional(),
    suggestions: z.array(z.string()).optional(),
    summary: z
        .object({
        specId: z.string(),
        score: z.number().nullable(),
        passed: z.number(),
        failed: z.number(),
        total: z.number(),
        status: z.string(),
    })
        .optional(),
};
// ── check_readiness ─────────────────────────────────────────────────────────
export const CheckReadinessOutputSchema = {
    specId: z.string(),
    score: z.number(),
    ready: z.boolean(),
    mode: z.string(),
    issues: z.object({
        score: z.number().optional(),
        blockers: z.array(z.string()),
        warnings: z.array(z.string()),
        breakdown: z.object({
            hu: z.number().optional(),
            criteria: z.number().optional(),
            files: z.number().optional(),
            dependencies: z.number().optional(),
        }),
    }),
    recommendations: z.array(z.string()).optional(),
    qualityScore: z
        .object({
        total: z.number(),
        completeness: z.number(),
        testability: z.number(),
        ambiguity: z.number(),
        risk: z.number(),
        grade: z.string(),
    })
        .optional(),
    humanSummary: z.string().optional(),
};
// ── license_status ──────────────────────────────────────────────────────────
export const LicenseStatusOutputSchema = {
    version: z.string(),
    plan: z.string(),
    toolsAvailable: z.number(),
    toolsTotal: z.number(),
    limits: z.object({
        maxProjects: z.number(),
        currentProjects: z.number(),
        maxActiveSpecs: z.number(),
    }),
    customer: z
        .object({
        name: z.string(),
        email: z.string(),
        variant: z.string(),
        activatedAt: z.string(),
        lastValidatedAt: z.string(),
    })
        .optional(),
    activationSlots: z
        .object({
        used: z.number(),
        total: z.number(),
    })
        .optional(),
    upgradeUrl: z.string().optional(),
};
//# sourceMappingURL=output-schemas.js.map