/** * Protocol validation common utilities - ported from lib/validation/protocol-validation-common.sh * * Reusable validation functions for checking output files, manifest fields, * return message format, key findings count, status validity, and provenance. * * @task T4527 * @epic T4454 */ export interface ProtocolViolation { requirement: string; severity: 'error' | 'warning'; message: string; fix?: string; } export interface ProtocolValidationResult { valid: boolean; violations: ProtocolViolation[]; score: number; } /** * Check if expected output file exists. * @task T4527 */ export declare function checkOutputFileExists(taskId: string, expectedDir: string, pattern?: string): boolean; /** * Check if file contains required documentation sections. * @task T4527 */ export declare function checkDocumentationSections(filePath: string, sections: string[]): boolean; /** * A subagent return message, parsed (T12521). * * Two forms are accepted: * - **compressed** — line 1 ` . manifest:`, then * optional `commits:`, `gates:` and `blocker:` lines, each at most once. * - **legacy** — the single line * ` . Manifest appended to pipeline_manifest.` */ export interface ParsedReturnMessage { /** Which accepted form the message used. */ form: 'compressed' | 'legacy'; /** Type word, e.g. `Implementation`. */ type: string; /** Status word: `complete`, `completed`, `partial` or `blocked`. */ status: string; /** Manifest entry id (compressed form only; `null` for legacy). */ entryId: string | null; /** `commits:` value, or `null` when the line is absent. */ commits: string | null; /** `gates:` value, or `null` when the line is absent. */ gates: string | null; /** `blocker:` value, or `null` when the line is absent. */ blocker: string | null; } /** * Parse a subagent return message in the compressed or the legacy form. * * One surrounding ``` fence is stripped first. In the compressed form: * `blocker` must be `none` (or absent) when the status is * `complete`/`completed`, and present and not `none` when it is * `partial`/`blocked`; `manifest:none` is accepted only for `partial`/`blocked`; * an entry id containing `<` or `>` (an unfilled `` placeholder) is * rejected. Unknown, duplicate or empty detail lines reject the message, and a * legacy message must be exactly one line (its rules are unchanged). * * @param message - Raw return message (surrounding whitespace and one * surrounding code fence are ignored). * @param types - Allowed type words; omitted, any non-empty type is allowed. * @returns The parsed message, or `null` when it matches neither form. * @task T12521 */ export declare function parseReturnMessage(message: string, types?: readonly string[]): ParsedReturnMessage | null; /** * Check if return message follows protocol format — the compressed form * (` . manifest:` plus optional detail lines) or the * legacy one-liner (` . Manifest appended to pipeline_manifest.`). * * When protocolType is provided, the message type must match the protocol * (e.g., a 'research' protocol must produce a "Research ..." message). * * @task T4527 * @task T12521 */ export declare function checkReturnMessageFormat(message: string, protocolType?: string): boolean; /** * Check if manifest entry has a required field (non-null, non-empty). * @task T4527 */ export declare function checkManifestFieldPresent(entry: Record, fieldName: string): boolean; /** * Check if manifest field has expected type. * @task T4527 */ export declare function checkManifestFieldType(entry: Record, fieldName: string, expectedType: 'string' | 'array' | 'number' | 'boolean' | 'object'): boolean; /** * Check if key_findings array has valid count (3-7). * @task T4527 */ export declare function checkKeyFindingsCount(entry: Record): boolean; /** * Check if status is valid enum value. * @task T4527 */ export declare function checkStatusValid(entry: Record): boolean; /** * Check if agent_type matches expected value. * @task T4527 */ export declare function checkAgentType(entry: Record, expectedType: string): boolean; /** * Check if linked_tasks array contains required task IDs. * @task T4527 */ export declare function checkLinkedTasksPresent(entry: Record, requiredIds: string[]): boolean; /** * Check if file contains @task provenance tag. * @task T4527 */ export declare function checkProvenanceTags(filePath: string, taskId?: string): boolean; /** * Validate common manifest requirements across all protocols. * * When protocolType is provided, additionally validates that the manifest * entry's agent_type matches the expected protocol type. * * @task T4527 */ export declare function validateCommonManifestRequirements(entry: Record, protocolType?: string): ProtocolValidationResult; //# sourceMappingURL=protocol-common.d.ts.map