/** * Coding agent context types and validation. * * Provides Zod schemas and TypeScript types for validating coding agent * context objects used in the autonomous coding loop: code generation, * execution, error capture, iterative self-correction, and human-in-the-loop * feedback injection. * * @module services/coding-agent-context */ import { z } from "zod"; /** Schema for a single file operation within a coding iteration. */ export declare const FileOperationSchema: z.ZodObject<{ type: z.ZodEnum<{ list: "list"; search: "search"; read: "read"; write: "write"; edit: "edit"; }>; target: z.ZodString; size: z.ZodOptional; }, z.core.$strip>; /** Schema for a shell command result captured during execution. */ export declare const CommandResultSchema: z.ZodObject<{ command: z.ZodString; exitCode: z.ZodNumber; stdout: z.ZodString; stderr: z.ZodString; executedIn: z.ZodString; durationMs: z.ZodOptional; success: z.ZodBoolean; }, z.core.$strip>; /** Schema for an error captured during code execution. */ export declare const CapturedErrorSchema: z.ZodObject<{ category: z.ZodEnum<{ other: "other"; compile: "compile"; runtime: "runtime"; test: "test"; lint: "lint"; }>; message: z.ZodString; filePath: z.ZodOptional; line: z.ZodOptional; raw: z.ZodOptional; }, z.core.$strip>; /** Schema for human feedback injected into the coding loop. */ export declare const HumanFeedbackSchema: z.ZodObject<{ id: z.ZodString; timestamp: z.ZodNumber; text: z.ZodString; iterationRef: z.ZodOptional; type: z.ZodEnum<{ approval: "approval"; correction: "correction"; guidance: "guidance"; rejection: "rejection"; }>; }, z.core.$strip>; /** Schema for a single iteration of the coding agent loop. */ export declare const CodingIterationSchema: z.ZodObject<{ index: z.ZodNumber; startedAt: z.ZodNumber; completedAt: z.ZodOptional; generatedCode: z.ZodOptional; fileOperations: z.ZodDefault; target: z.ZodString; size: z.ZodOptional; }, z.core.$strip>>>; commandResults: z.ZodDefault; success: z.ZodBoolean; }, z.core.$strip>>>; errors: z.ZodDefault; message: z.ZodString; filePath: z.ZodOptional; line: z.ZodOptional; raw: z.ZodOptional; }, z.core.$strip>>>; feedback: z.ZodDefault; type: z.ZodEnum<{ approval: "approval"; correction: "correction"; guidance: "guidance"; rejection: "rejection"; }>; }, z.core.$strip>>>; selfCorrected: z.ZodDefault; summary: z.ZodOptional; }, z.core.$strip>; /** Schema for the connector type used by the coding agent. */ export declare const ConnectorTypeSchema: z.ZodEnum<{ sandbox: "sandbox"; browser: "browser"; "local-fs": "local-fs"; "git-repo": "git-repo"; api: "api"; }>; /** Schema for connector configuration. */ export declare const ConnectorConfigSchema: z.ZodObject<{ type: z.ZodEnum<{ sandbox: "sandbox"; browser: "browser"; "local-fs": "local-fs"; "git-repo": "git-repo"; api: "api"; }>; basePath: z.ZodString; available: z.ZodDefault; metadata: z.ZodOptional>; }, z.core.$strip>; /** Interaction mode for the coding session. */ export declare const InteractionModeSchema: z.ZodEnum<{ "fully-automated": "fully-automated"; "human-in-the-loop": "human-in-the-loop"; "manual-guidance": "manual-guidance"; }>; /** Schema for the full coding agent context. */ export declare const CodingAgentContextSchema: z.ZodObject<{ sessionId: z.ZodString; taskDescription: z.ZodString; workingDirectory: z.ZodString; connector: z.ZodObject<{ type: z.ZodEnum<{ sandbox: "sandbox"; browser: "browser"; "local-fs": "local-fs"; "git-repo": "git-repo"; api: "api"; }>; basePath: z.ZodString; available: z.ZodDefault; metadata: z.ZodOptional>; }, z.core.$strip>; interactionMode: z.ZodEnum<{ "fully-automated": "fully-automated"; "human-in-the-loop": "human-in-the-loop"; "manual-guidance": "manual-guidance"; }>; maxIterations: z.ZodDefault; active: z.ZodDefault; iterations: z.ZodDefault; generatedCode: z.ZodOptional; fileOperations: z.ZodDefault; target: z.ZodString; size: z.ZodOptional; }, z.core.$strip>>>; commandResults: z.ZodDefault; success: z.ZodBoolean; }, z.core.$strip>>>; errors: z.ZodDefault; message: z.ZodString; filePath: z.ZodOptional; line: z.ZodOptional; raw: z.ZodOptional; }, z.core.$strip>>>; feedback: z.ZodDefault; type: z.ZodEnum<{ approval: "approval"; correction: "correction"; guidance: "guidance"; rejection: "rejection"; }>; }, z.core.$strip>>>; selfCorrected: z.ZodDefault; summary: z.ZodOptional; }, z.core.$strip>>>; allFeedback: z.ZodDefault; type: z.ZodEnum<{ approval: "approval"; correction: "correction"; guidance: "guidance"; rejection: "rejection"; }>; }, z.core.$strip>>>; createdAt: z.ZodNumber; updatedAt: z.ZodOptional; }, z.core.$strip>; export type FileOperation = z.infer; export type CommandResult = z.infer; export type CapturedError = z.infer; export type HumanFeedback = z.infer; export type CodingIteration = z.infer; export type ConnectorType = z.infer; export type ConnectorConfig = z.infer; export type InteractionMode = z.infer; export type CodingAgentContext = z.infer; /** Result of a validation operation. */ export type ValidationResult = { ok: true; data: T; } | { ok: false; errors: Array<{ path: string; message: string; }>; }; /** * Validate a coding agent context object. * Returns a typed result with either the validated data or an array of errors. */ export declare function validateCodingAgentContext(input: Record): ValidationResult; /** * Validate a single coding iteration. */ export declare function validateCodingIteration(input: Record): ValidationResult; /** * Validate human feedback input. */ export declare function validateHumanFeedback(input: Record): ValidationResult; /** * Validate a connector configuration. */ export declare function validateConnectorConfig(input: Record): ValidationResult; /** * Create a new coding agent context with sensible defaults. */ export declare function createCodingAgentContext(params: { sessionId: string; taskDescription: string; workingDirectory: string; connectorType: ConnectorType; connectorBasePath: string; interactionMode?: InteractionMode; maxIterations?: number; }): CodingAgentContext; /** * Check if the coding agent context has reached its iteration limit. */ export declare function hasReachedMaxIterations(ctx: CodingAgentContext): boolean; /** * Check if the latest iteration resolved all errors. */ export declare function isLastIterationClean(ctx: CodingAgentContext): boolean; /** * Get all unresolved errors from the latest iteration. */ export declare function getUnresolvedErrors(ctx: CodingAgentContext): CapturedError[]; /** * Add an iteration to the context and update the timestamp. */ export declare function addIteration(ctx: CodingAgentContext, iteration: CodingIteration): CodingAgentContext; /** * Inject human feedback into the context. */ export declare function injectFeedback(ctx: CodingAgentContext, feedback: HumanFeedback): CodingAgentContext; /** * Determine if the coding loop should continue based on context state. */ export declare function shouldContinueLoop(ctx: CodingAgentContext): { shouldContinue: boolean; reason: string; }; //# sourceMappingURL=coding-agent-context.d.ts.map