import { z } from 'zod'; export type EntityKind = 'agent' | 'template' | 'shell'; /** `path` anchors the issue at a field (`transitions[2].from`) so the editor can point at it. */ export interface Issue { path: string; message: string; } export interface ValidationResult { errors: Issue[]; warnings: Issue[]; } /** Raw (unexpanded, un-file-ref-resolved) config as it sits on disk: name → parsed JSON. */ export interface RawRegistry { agents: Record; templates: Record; shells: Record; } /** Optional filesystem probes. Omitted in unit tests, injected by the API handler. */ export interface RefResolver { promptsDir: string; pluginBaseDir: string; join: (...parts: string[]) => string; exists: (absPath: string) => boolean; isAbsolute: (p: string) => boolean; } /** `__active__` is the runtime-resolved default agent (prompt-builder.ts:20), not a config entity. */ export declare const ACTIVE_AGENT = "__active__"; export declare const stageSchema: z.ZodObject<{ promptTemplate: z.ZodString; continuesSession: z.ZodOptional; description: z.ZodOptional; }, z.core.$strip>; export declare const conditionSchema: z.ZodObject<{ type: z.ZodEnum<{ always: "always"; convergence: "convergence"; output_contains: "output_contains"; output_not_contains: "output_not_contains"; }>; marker: z.ZodOptional; pattern: z.ZodOptional; maxIterations: z.ZodOptional; }, z.core.$strip>; export declare const transitionSchema: z.ZodObject<{ from: z.ZodString; to: z.ZodString; condition: z.ZodObject<{ type: z.ZodEnum<{ always: "always"; convergence: "convergence"; output_contains: "output_contains"; output_not_contains: "output_not_contains"; }>; marker: z.ZodOptional; pattern: z.ZodOptional; maxIterations: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>; export declare const hookConfigSchema: z.ZodObject<{ command: z.ZodString; args: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>; export declare const hooksSchema: z.ZodObject<{ onStart: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; onTransition: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; onEnd: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; export declare const agentSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional; profile: z.ZodString; persistSession: z.ZodBoolean; directive: z.ZodOptional; systemPrompt: z.ZodOptional; promptTemplate: z.ZodOptional; claudeAgent: z.ZodOptional; outputStyle: z.ZodOptional; tools: z.ZodOptional; pluginDirs: z.ZodOptional>; mcpComposition: z.ZodOptional>; stages: z.ZodOptional; description: z.ZodOptional; }, z.core.$strip>>>; entryStage: z.ZodOptional; }, z.core.$strip>; export declare const agentRefOverrideSchema: z.ZodObject<{ ref: z.ZodString; promptTemplate: z.ZodOptional; directive: z.ZodOptional; systemPrompt: z.ZodOptional; persistSession: z.ZodOptional; claudeAgent: z.ZodOptional; outputStyle: z.ZodOptional; tools: z.ZodOptional; pluginDirs: z.ZodOptional>; }, z.core.$strip>; export declare const agentRefSchema: z.ZodUnion; directive: z.ZodOptional; systemPrompt: z.ZodOptional; persistSession: z.ZodOptional; claudeAgent: z.ZodOptional; outputStyle: z.ZodOptional; tools: z.ZodOptional; pluginDirs: z.ZodOptional>; }, z.core.$strip>]>; export declare const templateSchema: z.ZodObject<{ name: z.ZodOptional; description: z.ZodString; agents: z.ZodArray; directive: z.ZodOptional; systemPrompt: z.ZodOptional; persistSession: z.ZodOptional; claudeAgent: z.ZodOptional; outputStyle: z.ZodOptional; tools: z.ZodOptional; pluginDirs: z.ZodOptional>; }, z.core.$strip>]>>; transitions: z.ZodArray; marker: z.ZodOptional; pattern: z.ZodOptional; maxIterations: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>>; entryAgent: z.ZodString; entryStage: z.ZodOptional; maxTotalSteps: z.ZodNumber; maxTotalCostUsd: z.ZodOptional; disableHooks: z.ZodOptional; hooks: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; onTransition: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; onEnd: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; export declare const shellBindingSchema: z.ZodObject<{ shell: z.ZodString; description: z.ZodOptional; maxTotalSteps: z.ZodOptional; }, z.core.$strip>; export declare const shellSchema: z.ZodObject<{ params: z.ZodArray; agents: z.ZodArray; transitions: z.ZodArray; marker: z.ZodOptional; pattern: z.ZodOptional; maxIterations: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>>; entryAgent: z.ZodString; entryStage: z.ZodOptional; maxTotalSteps: z.ZodNumber; maxTotalCostUsd: z.ZodOptional; hooks: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; onTransition: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; onEnd: z.ZodOptional>; timeout: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; /** Names of the templates whose definition mentions this agent or shell. */ export declare function dependentTemplates(kind: EntityKind, name: string, registry: RawRegistry): string[]; /** * Validate one entity against the registry it will live in. The caller is expected to pass a * registry with the candidate already swapped in, so cross-entity references resolve against the * post-save world rather than the current one. */ export declare function validateEntity(kind: EntityKind, name: string, body: unknown, registry: RawRegistry, refs?: RefResolver): ValidationResult; /** Validate every entity in a registry. Key format: `:`. */ export declare function validateRegistry(registry: RawRegistry, refs?: RefResolver): Map; /** The only I/O in this module: read `/{agents,templates,shells}/*.json` as raw bodies. * An unparseable file lands as `null`, which every validator reports as a root-level error. */ export declare function rawRegistryFromDir(dir: string, io: { readdirSync: (p: string) => string[]; readFileSync: (p: string, enc: 'utf8') => string; existsSync: (p: string) => boolean; join: (...parts: string[]) => string; }): RawRegistry; /** Copy of a registry with one entity replaced — what a save would produce. */ export declare function withCandidate(registry: RawRegistry, kind: EntityKind, name: string, body: unknown): RawRegistry;