import { z } from 'zod'; /** Supported AaaC schema versions (compiler accepts only these). */ declare const SUPPORTED_SCHEMA_VERSIONS: readonly ["aaac/0.1"]; /** Pattern for schema version field: `aaac/x.y` */ declare const SCHEMA_VERSION_PATTERN: RegExp; declare const JSONSchemaRefSchema: z.ZodUnion; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>; declare const OptionSchema: z.ZodObject<{ name: z.ZodString; schema: z.ZodRecord; required: z.ZodOptional; description: z.ZodOptional; }, z.core.$strip>; declare const ArtifactSlotValueSchema: z.ZodUnion; }, z.core.$strip>]>; declare const OperationSchema: z.ZodObject<{ description: z.ZodString; agentWorkflow: z.ZodOptional; agentTask: z.ZodOptional; handler: z.ZodOptional; options: z.ZodOptional; required: z.ZodOptional; description: z.ZodOptional; }, z.core.$strip>>>; input: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>>; output: z.ZodObject<{ success: z.ZodUnion; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>; failed: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>>; }, z.core.$strip>; artifactSlots: z.ZodOptional; }, z.core.$strip>]>>>; riskLevel: z.ZodOptional>; idempotent: z.ZodOptional; requiresConfirmation: z.ZodOptional; execution: z.ZodOptional; costCeilingUsd: z.ZodOptional; }, z.core.$strip>>; memoryRef: z.ZodOptional; output: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; /** * Reference to an external binding package (e.g. `@aaac/binding-cursor`). * * The core toolchain stays binding-agnostic: it only knows that a binding * exists, which package implements it, and the CLI command name to expose. * The `config` payload is opaque to the core and is validated by the binding * package itself at runtime (via its own `configSchema`). */ declare const BindingRefSchema: z.ZodObject<{ package: z.ZodString; command: z.ZodOptional; config: z.ZodDefault>; }, z.core.$strip>; declare const ComponentSchema: z.ZodObject<{ schema: z.ZodString; info: z.ZodObject<{ id: z.ZodString; version: z.ZodString; description: z.ZodOptional; }, z.core.$strip>; implementation: z.ZodOptional; embedded_dsl_dir: z.ZodOptional; projections: z.ZodArray>; governance: z.ZodOptional; observability: z.ZodOptional; }, z.core.$strip>>; bindings: z.ZodOptional; config: z.ZodDefault>; }, z.core.$strip>>>; operations: z.ZodRecord; agentTask: z.ZodOptional; handler: z.ZodOptional; options: z.ZodOptional; required: z.ZodOptional; description: z.ZodOptional; }, z.core.$strip>>>; input: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>>; output: z.ZodObject<{ success: z.ZodUnion; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>; failed: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ $ref: z.ZodString; }, z.core.$strip>]>>; }, z.core.$strip>; artifactSlots: z.ZodOptional; }, z.core.$strip>]>>>; riskLevel: z.ZodOptional>; idempotent: z.ZodOptional; requiresConfirmation: z.ZodOptional; execution: z.ZodOptional; costCeilingUsd: z.ZodOptional; }, z.core.$strip>>; memoryRef: z.ZodOptional; output: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; type ComponentDSL = z.infer; type BindingRefDSL = z.infer; type OperationDSL = z.infer; type OptionDSL = z.infer; type JSONSchemaRefDSL = z.infer; declare class ComponentParseError extends Error { readonly filePath?: string | undefined; readonly cause?: unknown | undefined; constructor(message: string, filePath?: string | undefined, cause?: unknown | undefined); } /** * Parse and validate a component YAML string. * When `filePath` is provided, `$ref` pointers resolve relative to its directory. */ declare function parseComponentString(content: string, filePath?: string): ComponentDSL; /** * Read a component YAML file, resolve `$ref` pointers, and validate. */ declare function parseComponentFile(filePath: string): Promise; /** JSON Schema object (resolved, JSON-serializable). */ type JSONSchema = Record; /** Resolved JSON Schema reference — inline schema or resolved $ref target. */ type JSONSchemaRef = { schema: JSONSchema; } | { $ref: string; } | JSONSchema; type ProjectionTarget = "library" | "cli" | "claude" | "openai"; type ArtifactDirection = "read" | "write" | "readwrite"; type RiskLevel = "low" | "medium" | "high"; interface OptionIR { name: string; schema: JSONSchema; required: boolean; description?: string; } interface OperationMemoryRefConfig { input?: boolean; output?: boolean; } interface OperationIR { description: string; agentWorkflow?: string; agentTask?: string; /** Function name for deterministic dispatch; file is `./handlers/{handler}.ts` by convention. */ handler?: string; memoryRef?: OperationMemoryRefConfig; options: OptionIR[]; input?: JSONSchemaRef; output: { success: JSONSchemaRef; failed?: JSONSchemaRef; }; errorModel: { failureClasses: string[]; }; artifactSlots: Record; riskLevel: RiskLevel; idempotent: boolean; requiresConfirmation: boolean; execution: { timeoutMs?: number; costCeilingUsd?: number; }; } interface GovernanceConfig { guardrails?: boolean; observability?: boolean; } /** * Resolved binding entry in the IR. * * `command` is always present (defaulted to the binding id during compile). * `config` is opaque to the core toolchain — the binding package validates it. */ interface BindingIR { package: string; command: string; config: Record; } interface ComponentIR { schema: string; info: { id: string; version: string; description?: string; }; implementation?: string; embeddedDslDir?: string; projections: ProjectionTarget[]; governance?: GovernanceConfig; bindings?: Record; operations: Record; } declare class ComponentCompileError extends Error { constructor(message: string); } declare class ComponentValidationError extends ComponentCompileError { constructor(message: string); } /** * Extract failure class names from a resolved failed output schema. * * Checks, in order: * 1. Top-level `failure_classes` array * 2. `properties.failure_class.enum` * 3. `oneOf` entries with `const` or `properties.failure_class.const` */ declare function extractFailureClasses(failedRef: JSONSchemaRef | undefined): string[]; interface CompileComponentOptions { basePath?: string; /** When true (default), validate implementation file and agent workflow/task IDs. */ validate?: boolean; } /** * Compile a validated Component DSL into Component IR. */ declare function compileComponent(dsl: ComponentDSL, options?: CompileComponentOptions): ComponentIR; /** * Compile a validated Component DSL into Component IR, optionally validating * implementation references. */ declare function compileComponentAsync(dsl: ComponentDSL, options?: CompileComponentOptions): Promise; /** * Parse a component YAML file and compile it to IR. */ declare function compileComponentFile(filePath: string, options?: Omit): Promise; interface ValidationOptions { /** Base directory for resolving relative implementation paths. */ basePath: string; } interface ImplementationIds { workflowIds: string[]; taskIds: string[]; } /** * Extract workflow and task IDs from a (resolved) agent-contracts DSL document. * * Reads workflow IDs from BOTH the canonical `workflow` (singular) key used by * the aaac DSL convention AND the legacy `workflows` (plural) key, unioned for * backward compatibility. Task IDs come from `tasks`. `$`-prefixed directive * keys (e.g. `$refs`) are excluded. */ declare function extractImplementationIds(content: unknown): ImplementationIds; /** * Validate a compiled Component IR against its implementation DSL. * * Checks: * - implementation file exists (when specified) * - agentWorkflow IDs exist in implementation DSL * - agentTask IDs exist in implementation DSL */ declare function validateComponent(ir: ComponentIR, options: ValidationOptions): Promise; declare class RefResolutionError extends Error { readonly ref: string; constructor(ref: string, message: string); } interface ResolveRefsOptions { basePath?: string; } /** * Resolves `$ref` pointers within a value tree. * * - Internal refs (`#/path/to/key`) resolve against `root`. * - External file refs (`./path/file.yaml` or `./file.yaml#/pointer`) resolve * relative to `basePath`. */ declare function resolveRefs(value: T, options?: ResolveRefsOptions): T; interface GeneratedFile { path: string; content: string; overwrite: boolean; /** Set when a file is skipped (e.g. existing handler). */ warning?: string; /** When set, write relative to component.yaml directory instead of outputDir. */ targetDir?: string; } interface GenerateOptions { outputDir: string; componentPath: string; /** Pre-resolved DSL data for embedded DSL generation. */ resolvedDslData?: Record; } interface Generator { generate(ir: ComponentIR, options: GenerateOptions): GeneratedFile[]; } declare const typesGenerator: Generator; declare const clientGenerator: Generator; declare const runtimeGenerator: Generator; declare const cliGenerator: Generator; declare const handlerGenerator: Generator; /** * Emit a generated module exposing the resolved binding configs. * * The app's hand-written CLI handler imports this to obtain each binding's * `config` payload (and package name) at runtime, then delegates to the * binding package's `sync` / `check` function. Mirrors how the embedded DSL is * surfaced to the runtime. * * Emits nothing when the component declares no bindings — keeping output * byte-identical for components that don't use bindings (backward compat). */ declare const bindingsGenerator: Generator; /** * Claude Code Native Integration Generator * * Generates `.claude/` settings, hooks, and bin scripts when * `projections` includes `"claude"` in the component.yaml. * * Output layout: * .claude/settings.json — fileSuggestion + hook registrations * .claude/hooks/*.sh — Shell wrappers delegating to Node bin scripts * .claude/bin/* — Node entry scripts importing @aaac/runtime/claude-native * .claude/cache/.gitkeep — Cache directory * CLAUDE.md (append block) — Navigation-index integration docs */ declare const claudeGenerator: Generator; /** * Run all code generators for a compiled Component IR. */ declare function generateAll(ir: ComponentIR, options: GenerateOptions): GeneratedFile[]; /** * Write generated files to disk, respecting overwrite policy. * - `overwrite: true` — always write (generated/ artifacts) * - `overwrite: false` — skip if target already exists (handlers, cli stub) */ declare function writeGeneratedFiles(files: GeneratedFile[], outputDir: string): Promise<{ written: string[]; skipped: string[]; warnings: string[]; }>; /** * Governance operations for aaac init / update / uninstall. * * Self-contained implementation (mirrors packages/runtime/src/lib/governance-hooks.ts * and the relevant parts of packages/runtime/src/generator/config.ts) to avoid a * circular package dependency: @aaac/runtime already depends on @aaac/contracts. * * Keep in sync with the runtime counterpart when modifying managed-block semantics. * * .cursor/hooks.json is written in Cursor's real schema: * { "version": 1, "hooks": { "": [{ "command": "..." }] } } * A legacy flat-array format ([{ event, command }]) is still parsed for * backward compatibility and migrated to the nested schema on write. */ /** * Flat internal representation of a single Cursor hook binding. * Used for building defaults and merging; serialized into the nested * {@link CursorHooksFile} schema before writing to disk. */ interface CursorHookEntry { event: string; command: string; [key: string]: unknown; } /** A single command binding under an event in Cursor's hooks.json schema. */ interface CursorHookCommand { command: string; [key: string]: unknown; } /** Cursor's real .cursor/hooks.json schema. */ interface CursorHooksFile { version: number; hooks: Record; } declare function parseCursorHooksFile(raw: string | undefined): CursorHooksFile; declare function serializeCursorHooksFile(file: CursorHooksFile): string; /** * Idempotently merge new hook entries into an existing Cursor hooks file. * * Entries are keyed by `(event, command)`: an existing command is updated in * place, a new one is appended. This lets multiple independent writers (the * observability recorder, the cursor binding, future guardrail hooks) share a * single `.cursor/hooks.json` without clobbering each other — no single writer * owns the file. Merge order does not affect the final set. */ declare function mergeCursorHooks(existing: CursorHooksFile, newEntries: CursorHookEntry[]): CursorHooksFile; /** * Canonical observ-record.sh template distribution for aaac init / update. * * The shell recorder is materialized to the path declared in * project.yaml `bindings.observability.recorder` when it names the managed * observ-record wrapper (ends with `observ-record.sh`). */ declare const DEFAULT_RECORDER_REL = ".cursor/hooks/observ-record.sh"; /** True when governance should ship/sync the bundled observ-record.sh template. */ declare function isManagedRecorderPath(recorder: string): boolean; /** Read the bundled observ-record.sh template (from package templates/). */ declare function readRecorderScriptTemplate(): Promise; interface MaterializeRecorderScriptResult { path: string; action: "created" | "updated" | "unchanged"; } /** * Write the canonical observ-record.sh when content differs (idempotent). * Sets mode 0755 on create/update. */ declare function materializeRecorderScript(projectRoot: string, recorderRelPath: string): Promise; /** Remove a materialized recorder script (aaac uninstall). */ declare function unmaterializeRecorderScript(projectRoot: string, recorderRelPath: string): Promise; /** Package version string. */ declare const version: string; export { type ArtifactDirection, ArtifactSlotValueSchema, type BindingIR, type BindingRefDSL, BindingRefSchema, type CompileComponentOptions, ComponentCompileError, type ComponentDSL, type ComponentIR, ComponentParseError, ComponentSchema, ComponentValidationError, type CursorHookCommand, type CursorHookEntry, type CursorHooksFile, DEFAULT_RECORDER_REL, type GenerateOptions, type GeneratedFile, type Generator, type ImplementationIds, type JSONSchema, type JSONSchemaRef, type JSONSchemaRefDSL, JSONSchemaRefSchema, type OperationDSL, type OperationIR, OperationSchema, type OptionDSL, type OptionIR, OptionSchema, type ProjectionTarget, RefResolutionError, type RiskLevel, SCHEMA_VERSION_PATTERN, SUPPORTED_SCHEMA_VERSIONS, type ValidationOptions, bindingsGenerator, claudeGenerator, cliGenerator, clientGenerator, compileComponent, compileComponentAsync, compileComponentFile, extractFailureClasses, extractImplementationIds, generateAll, handlerGenerator, isManagedRecorderPath, materializeRecorderScript, mergeCursorHooks, parseComponentFile, parseComponentString, parseCursorHooksFile, readRecorderScriptTemplate, resolveRefs, runtimeGenerator, serializeCursorHooksFile, typesGenerator, unmaterializeRecorderScript, validateComponent, version, writeGeneratedFiles };