/** * DelegationStatusReader interface and Zod schemas for persistence validation. * * REQ-C6-02: Provides runtime type safety at persistence boundaries. * Two implementations: SessionTrackerStatusReader (new format) and * LegacyPersistenceStatusReader (old format). * * @module tools/delegation/readers/types */ import { z } from "zod"; import type { Delegation } from "../../../coordination/delegation/types.js"; /** * Interface for reading delegation data from different persistence formats. * * Both implementations read from project-local JSON files and return * Delegation[] arrays for consumption by the delegation-status tool. */ export interface DelegationStatusReader { /** * Read all child delegations for a parent session. * * @param parentSessionId - The parent session ID to search for children. * @param projectRoot - The project root path. * @returns Array of Delegation records for matching children. */ readChildren(parentSessionId: string, projectRoot: string): Promise; /** * Read a single delegation by ID. * * @param delegationId - The delegation ID to look up. * @param projectRoot - The project root path. * @returns The Delegation record, or null if not found. */ readDelegation(delegationId: string, projectRoot: string): Promise; } /** * Zod schema for hierarchy-manifest.json children entries. * * Validates the runtime shape of each child entry in the manifest's * `children` record. Used by SessionTrackerStatusReader to validate * parsed JSON before constructing Delegation objects. */ export declare const HierarchyManifestChildSchema: z.ZodObject<{ parentSessionID: z.ZodString; status: z.ZodString; subagentType: z.ZodOptional; delegationDepth: z.ZodOptional; createdAt: z.ZodString; updatedAt: z.ZodOptional; childFile: z.ZodOptional; rootMainSessionID: z.ZodOptional; delegatedBy: z.ZodOptional; turnCount: z.ZodOptional; delegationType: z.ZodOptional>; }, z.core.$strip>; export type HierarchyManifestChildValidated = z.infer; /** * Zod schema for delegations.json entries. * * Validates the runtime shape of each delegation record in the legacy * persistence format. Used by LegacyPersistenceStatusReader to validate * parsed JSON before constructing Delegation objects. */ export declare const LegacyDelegationRecordSchema: z.ZodObject<{ id: z.ZodString; parentSessionId: z.ZodOptional; childSessionId: z.ZodOptional; agent: z.ZodOptional; status: z.ZodString; createdAt: z.ZodOptional; completedAt: z.ZodOptional; result: z.ZodOptional; error: z.ZodOptional; executionMode: z.ZodOptional; surface: z.ZodOptional; recoveryGuarantee: z.ZodOptional; workingDirectory: z.ZodOptional; nestingDepth: z.ZodOptional; terminalKind: z.ZodOptional; terminationSignal: z.ZodOptional; explicitCancellation: z.ZodOptional; messageCount: z.ZodOptional; toolCallCount: z.ZodOptional; actionCount: z.ZodOptional; finalMessageExcerpt: z.ZodOptional; }, z.core.$strip>; export type LegacyDelegationRecordValidated = z.infer; /** * Converts a validated HierarchyManifestChild to a Delegation record. * * @param childSessionId - The child session ID (key in the children map). * @param child - The validated child entry from the manifest. * @param projectRoot - The project root path. * @returns A Delegation record suitable for the delegation-status tool. */ export declare function hierarchyChildToDelegation(childSessionId: string, child: HierarchyManifestChildValidated, projectRoot: string): Delegation; /** * Converts a validated legacy delegation record to a Delegation record. * * @param record - The validated legacy record from delegations.json. * @param projectRoot - The project root path. * @returns A Delegation record suitable for the delegation-status tool. */ export declare function legacyRecordToDelegation(record: LegacyDelegationRecordValidated, projectRoot: string): Delegation; //# sourceMappingURL=types.d.ts.map