import { b as SdkFunctionTool, O as ObserverEmitFn, c as TaskContext, d as TaskOutcome, e as AgentContractLike, f as TaskContractLike, P as PromptBuilderOptions, W as WorkflowResult, S as SdkAdapter, g as WorkflowRegistries, H as HandoffInput, h as StepCompleteEvent, i as StepResult, D as DelegateStep, j as MemoryStore, M as MemoryRef, R as ResolvedComponent, k as ArtifactBindingConfig, l as RunToolchainChecksOptions, m as ModelMappingConfig, n as TaskRunResult, L as LibraryToolRegistry, o as ResolvedToolchain, p as LibraryToolDefinition } from './task-runner-Sez_CXcD.js'; export { q as AdapterOrFactory, A as AdapterSendOptions, a as AgentExecutionRequest, r as AgentProgressEvent, B as BoundResolveOptions, s as BoundResolver, C as CacheConfig, t as CandidateAgent, u as ConvergenceEnvelope, v as ConvergenceEnvelopePayload, E as EnvelopeParams, w as EvaluateStep, G as GateStep, I as InMemoryStore, x as InnerSpanOptions, y as ModelAwareSdkAdapterFactory, z as ModelClass, F as ModelResolver, J as ModelResolverOptions, K as OBSERVABILITY_ENV_VARS, N as ObservabilityIds, Q as ReceiveSpec, U as ResolvedModel, V as RetryDecision, X as SdkAdapterFactory, Y as SplitPrompt, Z as TaskRunOptions, T as TokenUsage, _ as ToolchainCheckResult, $ as ToolchainManifest, a0 as ToolchainManifestSchema, a1 as WorkflowContractLike, a2 as WorkflowInvocation, a3 as WorkflowRunOptions, a4 as WorkflowStep, a5 as buildCandidateAgents, a6 as buildGateEvaluationPrompt, a7 as buildObservabilityEnv, a8 as buildPerAgentGuardrails, a9 as buildRetryFollowUp, aa as buildSdkFunctionTools, ab as buildSplitTaskPrompt, ac as buildTaskPrompt, ad as collectAnalyzerToolIds, ae as createExecutionEnvelope, af as createLibraryToolRegistry, ag as createModelResolver, ah as createRegistryFromSdkTools, ai as deriveToolchainsForAgents, aj as emitIterationClose, ak as emitIterationMetric, al as emitIterationOpen, am as emitLlmTurnClose, an as emitLlmTurnOpen, ao as emitSessionClose, ap as emitSessionOpen, aq as emitSubagentClose, ar as emitSubagentOpen, as as emitToolExecClose, at as emitToolExecOpen, au as emitToolchainClose, av as emitToolchainOpen, aw as extractStructuredResult, ax as getEffectiveGuardrailIds, ay as getGuardrailRulesForAgent, az as guardrailContextToRuleData, aA as isNavigationIndex, aB as parseGateEvaluationResponse, aC as renderAgentSystemPrompt, aD as renderAnalyzerExplorationMandatePrompt, aE as renderNavigationIndexPrompt, aF as runTask, aG as runToolchainChecks, aH as runWorkflow, aI as serializeObserverEmit, aJ as shouldInjectAnalyzerExplorationMandate, aK as zodSchemaToPromptDescription, aL as zodSchemaToYamlExample } from './task-runner-Sez_CXcD.js'; import { a as GuardrailRuleData, G as GuardrailHooks, H as HookResponse, b as GuardrailCheckResult } from './guardrail-hooks-slK-z0Dz.js'; export { c as GuardrailCheckFunctions, d as GuardrailRule, e as HookContext, f as createGuardrailHooks, g as createGuardrailHooksForAgent, h as createGuardrailHooksFromRules, i as getBlockingViolations, j as getWarnings, k as hasBlockingViolation } from './guardrail-hooks-slK-z0Dz.js'; import { z } from 'zod'; import { OperationIR, ComponentIR } from '@aaac/contracts'; import { OtelEmitter } from '@aaac/observability'; export { ExecutionEnvelope } from '@aaac/observability'; import { ResolvedConfig } from './generator/index.js'; export { a as NavigationContext, N as NavigationContextOptions, b as buildNavigationContext } from './navigation-context-BE1KHJ_8.js'; import './context-DKkamYX_.js'; /** * Analyzer Bridge — integrates artifact-contracts-analyzer as a standard * runtime tool provider. * * Wraps analyzeImpact, generateContextPack, and buildCallGraph behind a * lazily-initialised DependencyGraph, and exposes them as SdkFunctionTool[] * for adapter consumption. * * `artifact-contracts-analyzer` is a peerDependency (optional) loaded via * dynamic import; when absent, every method returns a descriptive error * rather than crashing. */ /** Subset of DependencyGraph that the bridge caches and exposes. */ type DependencyGraph = Record; /** Subset of ImpactReport returned by analyzeImpact. */ type ImpactReport = Record; /** Subset of ContextPack returned by generateContextPack. */ type ContextPack = { entries: Array<{ path: string; artifactId?: string; relevanceScore: number; contentMode: string; content: string; reason: string; }>; metadata: { totalTokens: number; budgetTokens: number; filesIncluded: number; filesExcluded: number; filesReferenced: number; artifactsCovered: string[]; generatedAt: string; }; taskId?: string; }; /** Subset of CallGraph returned by buildCallGraph. */ type CallGraph = Record; /** Subset of ContextMap returned by getContextMap. */ type ContextMap = Record; interface GetContextMapInput { instruction: string; candidates: Array<{ path?: string; symbolId?: string; artifactId?: string; }>; depth?: number; direction?: "downstream" | "upstream" | "both"; budgetTokens?: number; } interface AnalyzerBridgeOptions { projectRoot: string; navigationIndex?: Record; artifactPatterns?: Map; manifests?: string[]; } interface AnalyzeImpactInput { direction: "downstream" | "upstream"; maxDepth: number; limit: number; } interface GenerateContextPackInput { budgetTokens: number; granularity: "file" | "symbol"; } interface BuildCallGraphInput { maxDepth: number; direction: "forward" | "reverse"; } interface AnalyzerBridge { buildGraph(): Promise; getGraph(): Promise; analyzeImpact(changed: string[], options?: Partial): Promise; generateContextPack(changed: string[], options?: Partial): Promise; buildCallGraph(entry: string, options?: Partial): Promise; getContextMap(input: GetContextMapInput): Promise; invalidateCache(): void; buildAnalyzerTools(): SdkFunctionTool[]; } declare function createAnalyzerBridge(options: AnalyzerBridgeOptions): AnalyzerBridge; /** * Duck-type check: does `value` look like a ContextPack? * Checks for the `entries` array and `metadata` object with expected fields. */ declare function isContextPack(value: unknown): value is ContextPack; /** * Render a ContextPack as a structured prompt section. * Used by task-runner when `variables.analyzerContextPack` is present. */ declare function renderContextPackPrompt(pack: ContextPack): string; /** * Virtual workflow entry step — materializes WorkflowInvocation input as a * DAG-addressable output so downstream steps can use depends_on / receives. */ /** Step id referenced in workflow DSL depends_on / receives.from. */ declare const WORKFLOW_INPUT_STEP_ID = "workflow-input"; interface WorkflowInputHandoff { readonly type: string; readonly version?: number; readonly payload: unknown; } interface WorkflowInputOutput { readonly user_request: string; readonly handoff?: WorkflowInputHandoff; } declare function buildWorkflowInputOutput(userRequest: string, handoff?: WorkflowInputHandoff): WorkflowInputOutput; declare function stepDependsOnWorkflowInput(dependsOn: readonly string[] | undefined): boolean; declare function formatWorkflowInputContext(output: WorkflowInputOutput): string; /** * Process axis emit helpers for runtime integration. * These wrap @aaac/observability's EventCollector for structured process axis events. */ interface ProcessWorkflowOptions { workflowId: string; sessionId: string; parentSpanId?: string; /** Optional observer — no-op when undefined. */ observer?: ObserverEmitFn; } interface ProcessTaskOptions { taskId: string; targetAgent: string; sessionId: string; parentSpanId?: string; /** Optional observer — no-op when undefined. */ observer?: ObserverEmitFn; } interface ProcessEditOptions { filePath: string; artifactId?: string; sessionId: string; parentSpanId?: string; /** Optional observer — no-op when undefined. */ observer?: ObserverEmitFn; } /** * True when a tool name denotes a file-mutating edit, so a process.edit event * should be emitted for it. Used by the task runner to instrument the Process * axis from live tool-use progress events (#167). */ declare function isFileEditTool(toolName: string | undefined): boolean; /** * Emit process.workflow open span. */ declare function emitProcessWorkflowOpen(options: ProcessWorkflowOptions): string | undefined; /** * Emit process.workflow close span. */ declare function emitProcessWorkflowClose(spanId: string, options: { status: string; durationMs?: number; observer?: ObserverEmitFn; }): void; /** * Emit process.task open span. */ declare function emitProcessTaskOpen(options: ProcessTaskOptions): string | undefined; /** * Emit process.task close span. */ declare function emitProcessTaskClose(spanId: string, options: { status: string; durationMs?: number; observer?: ObserverEmitFn; }): void; /** * Emit process.edit instant span. */ declare function emitProcessEdit(options: ProcessEditOptions): string | undefined; /** * Plugin Interface — extension points for user code injection */ interface GuardrailResult { matched: boolean; guardrail_id: string; severity: "critical" | "mandatory" | "warning" | "info"; action: "block" | "warn" | "shadow" | "info"; message: string; } interface PromptBuilderArgs { agent: AgentContractLike; task: TaskContractLike; context: TaskContext; options?: PromptBuilderOptions; } interface AgentPlugin { readonly id: string; beforeTask?(taskId: string, context: TaskContext): Promise; afterTask?(taskId: string, outcome: TaskOutcome): Promise; /** * Enrich the structured TaskContext before prompt generation. * Unlike beforeTask (which can skip a task by returning null), * this hook is purely for context augmentation. */ contextEnhancer?(taskId: string, context: TaskContext): TaskContext; /** * Lightweight prompt post-processor. Applied after the prompt is built. * Use for appending instructions or modifying sections. */ promptEnhancer?(taskId: string, prompt: string, context: TaskContext): string; /** * Full prompt builder override. If provided and returns a non-null string, * replaces the default buildTaskPrompt output entirely. * Receives the agent/task contracts and context so the plugin can build * a completely custom prompt. */ promptBuilder?(args: PromptBuilderArgs): string | null; customGuardrails?: { evaluateCommand?(command: string): GuardrailResult[]; evaluateFilePath?(filePath: string): GuardrailResult[]; evaluateFileContent?(filePath: string, content: string): GuardrailResult[]; }; beforeWorkflow?(workflowId: string, userRequest: string): Promise; afterWorkflow?(workflowId: string, result: WorkflowResult): Promise; } declare class PluginRegistry { private plugins; register(plugin: AgentPlugin): void; getAll(): readonly AgentPlugin[]; runBeforeTask(taskId: string, context: TaskContext): Promise; runAfterTask(taskId: string, outcome: TaskOutcome): Promise; applyContextEnhancers(taskId: string, context: TaskContext): TaskContext; /** * Try plugin promptBuilder hooks. Returns custom prompt if any plugin provides one, * or null to use the default buildTaskPrompt. */ applyPromptBuilder(args: PromptBuilderArgs): string | null; applyPromptEnhancers(taskId: string, prompt: string, context: TaskContext): string; evaluateCommandGuardrails(command: string): GuardrailResult[]; evaluateFilePathGuardrails(filePath: string): GuardrailResult[]; evaluateFileContentGuardrails(filePath: string, content: string): GuardrailResult[]; runBeforeWorkflow(workflowId: string, userRequest: string): Promise; runAfterWorkflow(workflowId: string, result: WorkflowResult): Promise; } declare const pluginRegistry: PluginRegistry; /** * Fluent Builder API for workflow invocation. * * Usage: * const runtime = createRuntime({ adapter, registries }); * const result = await runtime * .workflow("feature-implement") * .handoff(handoffs.featureImplementationRequest({ ... })) * .maxFollowUps(3) * .onGate(async () => true) * .run(); */ interface RuntimeConfig { adapter: SdkAdapter; registries?: WorkflowRegistries; } interface Runtime { workflow(workflowId: string): WorkflowBuilder; } declare function createRuntime(config: RuntimeConfig): Runtime; declare class WorkflowBuilder { private adapter; private invocation; private registries; constructor(adapter: SdkAdapter, workflowId: string, registries?: WorkflowRegistries); /** Set a typed handoff envelope as input. */ handoff(input: HandoffInput): this; /** Set a simple string request (convenience shorthand). */ request(userRequest: string): this; maxFollowUps(n: number): this; maxRetries(n: number): this; onStepComplete(cb: (event: StepCompleteEvent) => void): this; onGate(cb: (gateKind: string, description: string, stepResults: StepResult[]) => Promise): this; onOptionalStep(cb: (step: DelegateStep, context: TaskContext) => Promise): this; /** Set progress output sink for real-time execution visibility. */ progressOutput(sink: { write(chunk: string): unknown; }): this; run(): Promise; } /** * Plugin Loader — auto-discovers and registers user plugin files * * Discovery strategies (in priority order): * 1. Config-based: `plugins` array in agents.conf.yaml * 2. Convention-based: scan `src/plugins/` for files exporting AgentPlugin * * Each discovered module is dynamically import()'d. Exports that satisfy the * AgentPlugin interface (have an `id` string property) are registered with * the pluginRegistry singleton. */ interface PluginLoadResult { loaded: number; files: string[]; errors: Array<{ file: string; error: string; }>; } /** * Load plugins from explicit paths (config-based discovery). */ declare function loadPluginsFromPaths(paths: string[], baseDir: string): Promise; /** * Load plugins using convention-based directory scanning. * Scans `/src/plugins/` by default. */ declare function loadPluginsFromDirectory(dir: string): Promise; /** * Auto-discover and load plugins. Uses config-based paths if provided, * otherwise falls back to convention-based scanning of src/plugins/. */ declare function loadPlugins(options: { pluginPaths?: string[]; projectDir: string; }): Promise; /** * Runtime DSL Context — builds WorkflowRegistries from embedded DSL data, * optionally merging with project-level DSL extensions. * * Default flow: * CLI binary embeds resolved DSL data (from code generation) → * loadDslContext() builds registries from it. * * Extended flow: * Project provides a DSL that extends/overrides the embedded base → * loadDslContext() merges via agent-contracts' mergeDsl() → * builds registries from the merged result. */ interface LoadDslOptions { /** * Pre-resolved DSL data embedded in the CLI binary. * Produced by the code generator alongside TypeScript contracts. * This is the default DSL — used as-is when no project extension exists. */ embeddedDsl: Record; /** * Path to a project-level DSL file that extends/overrides the embedded DSL. * When provided, the project DSL is resolved (including its own extends chain) * and merged with embeddedDsl via mergeDsl(). */ projectDslPath?: string; /** Entities the CLI depends on — validated after merge. */ requiredEntities?: RequiredEntities; } interface RequiredEntities { workflows?: string[]; tasks?: string[]; } interface DslContext { readonly registries: WorkflowRegistries; readonly dsl: Record; readonly guardrailRules?: GuardrailRuleData; } declare class DslValidationError extends Error { readonly missing: string[]; constructor(missing: string[]); } declare function buildGuardrailRulesFromDsl(dsl: Record): GuardrailRuleData | undefined; declare function buildRegistriesFromDsl(dsl: Record): WorkflowRegistries; /** * Build a DslContext from embedded DSL data, optionally merging with * a project-level DSL extension. * * Default (no projectDslPath): * Builds registries directly from embeddedDsl — no filesystem access. * * Extended (with projectDslPath): * Resolves the project DSL from filesystem, merges it over embeddedDsl * via agent-contracts' mergeDsl(), then builds registries from the result. */ declare function loadDslContext(options: LoadDslOptions): Promise; /** * Runtime JSON Schema → Zod converter. * * Mirrors the compile-time zodType Handlebars helper in * generator/template-engine.ts but produces live z.ZodType * objects instead of code strings. */ /** * Convert a JSON Schema definition to a Zod schema object at runtime. * * Supports the same subset as the compile-time zodType helper: * object, array, string, number, integer, boolean, enum, const, allOf. */ declare function jsonSchemaToZod(schema: Record): z.ZodType; /** * Progress Sink — configurable output target for agent execution progress. * * Supports writing to stderr, file, or both (tee). File naming strategies * allow single-file append, per-invocation unique files, or daily rotation. */ interface ProgressSinkOptions { /** Write to process.stderr. Default: false */ stderr?: boolean; /** Base file path for log output. */ file?: string; /** * File naming strategy: * - "single": always append to `file` (default) * - "per-invocation": {dir}/{base}-{YYYY-MM-DDTHHmmss}-{label}{ext} * - "daily": {dir}/{base}-{YYYY-MM-DD}{ext} */ naming?: "single" | "per-invocation" | "daily"; /** Label for per-invocation naming (e.g. workflow ID). */ label?: string; } interface ProgressSink { write(chunk: string): void; close(): void; /** Resolved file path (undefined if file output is disabled). */ readonly filePath?: string; } declare function createProgressSink(options: ProgressSinkOptions): ProgressSink; interface FileMemoryStoreOptions { baseDir?: string; } /** * File-backed MemoryStore. Persists memory content as JSON files under * `/` (default: `.agent-logs/memories/`). */ declare class FileMemoryStore implements MemoryStore { readonly baseDir: string; constructor(options?: FileMemoryStoreOptions); save(ref: MemoryRef, content: unknown): Promise; load(ref: MemoryRef): Promise; delete(ref: MemoryRef): Promise; } interface RunLogEvent { timestamp: string; type: "operation_start" | "operation_end" | "operation_error" | "workflow_start" | "workflow_end" | "task_start" | "task_end" | "handoff"; runId: string; operationName?: string; agentId?: string; data?: unknown; durationMs?: number; error?: string; } interface AgentLogWriterOptions { baseDir?: string; } declare class AgentLogWriter { readonly baseDir: string; private memoryStore; constructor(options?: AgentLogWriterOptions); getMemoryStore(): FileMemoryStore; writeRunEvent(runId: string, event: RunLogEvent): Promise; readRunLog(runId: string): Promise; writeHandoff(runId: string, step: string, data: unknown): Promise; readHandoff(runId: string, step: string): Promise; cleanOlderThan(maxAgeMs: number): Promise<{ deleted: number; }>; } /** * Adapter Factory — public API for creating SDK adapters by name. * * Centralises the adapter-name → SDK-class mapping so that consumers * no longer need a local switch statement with dynamic imports. */ type PermissionMode = "default" | "acceptEdits" | "bypassPermissions" | "plan"; interface CreateAdapterOptions { model?: string; cwd?: string; tools?: string[]; permissionMode?: PermissionMode; guardrailHooks?: GuardrailHooks; } /** * Create an SDK adapter instance by name. * * @param name - One of: "mock", "claude", "openai", "gemini" * @param options - Adapter-specific configuration */ declare function createAdapter(name: string, options?: CreateAdapterOptions): Promise; /** * High-level execution APIs — executeTask / executeWorkflow * * Encapsulates the common boilerplate shared across all CLI consumers: * 1. Adapter creation * 2. DSL context loading (registries) * 3. Progress sink setup * 4. Task/workflow invocation with retry policy * * CLI consumers only need to provide: * - domain-specific context (user_request) * - adapter name + options * - DSL blob (resolvedDsl from codegen) */ interface ExecuteOptions { adapter: string; model?: string; dsl: Record; projectDslPath?: string; logFile?: string; adapterOptions?: Partial; maxFollowUps?: number; maxRetries?: number; /** Pre-resolved component from BoundResolver (skips runtime resolve). */ resolvedComponent?: ResolvedComponent; /** Component id for BoundResolver cache keying. */ componentId?: string; /** Software binding paths for runtime guardrail resolution. */ bindingPaths?: string[]; /** Active guardrail policy name. */ activeGuardrailPolicy?: string; /** Artifact binding config for runtime resolveBound(). */ artifactBinding?: ArtifactBindingConfig; /** Path substitutions for artifact binding. */ paths?: Record; /** * Observer emit function for agent-axis spans (agent.session / agent.subagent / * toolchain.execution / evaluate.*). When undefined, all emission is a no-op. * Auto-wired from project.yaml `bindings.observability` by createProjectRuntime — * callers do NOT hand-write this. */ observer?: ObserverEmitFn; /** * Optional toolchain-check observation config. When set together with `observer`, * the workflow runner runs these checks once post-run and emits one * toolchain.execution span per check (OBSERVATION ONLY — never changes the * workflow outcome). Auto-wired from project.yaml `toolchains` + `bindings.observability` * by createProjectRuntime; `observer`/`parentSpanId` are injected by runWorkflow. * Only consumed by executeWorkflow (toolchain checks are a run-level concern). */ toolchain?: RunToolchainChecksOptions; /** Per-class adapter/model mapping from project.yaml (used by executeWorkflow / executeTask). */ modelMapping?: ModelMappingConfig; /** * When true, `adapter` is used for all model classes; only the model name * varies per class (CLI `--adapter mock` override). */ pinAdapter?: boolean; } interface TaskHookContext { adapter: SdkAdapter; registries: WorkflowRegistries; taskId: string; } interface ExecuteTaskOptions extends ExecuteOptions { request: string; hooks?: { beforeTask?: (ctx: TaskHookContext) => Promise; afterTask?: (result: TaskRunResult) => Promise; }; } declare function executeTask(taskId: string, options: ExecuteTaskOptions): Promise; interface WorkflowHookContext { adapter: SdkAdapter; registries: WorkflowRegistries; workflowId: string; } interface ExecuteWorkflowOptions extends ExecuteOptions { request?: string; handoff?: HandoffInput; context?: { cwd?: string; environment?: "local" | "ci" | "remote"; artifacts?: Record; variables?: Record; }; autoApproveGates?: boolean; hooks?: { beforeWorkflow?: (ctx: WorkflowHookContext) => Promise; afterWorkflow?: (result: WorkflowResult) => Promise; onStepComplete?: (event: StepCompleteEvent) => void; onGate?: (gateKind: string, description: string, stepResults: StepResult[]) => Promise; onOptionalStep?: (step: DelegateStep, context: TaskContext) => Promise; }; } declare function executeWorkflow(workflowId: string, options: ExecuteWorkflowOptions): Promise; interface OperationMemoryRefConfig { output?: boolean; input?: boolean; provider?: string; compat?: string; } interface MemoryStoreEntry { result: unknown; memoryRef: MemoryRef; } interface AaacInvocationContext { runtime: AaacRuntime; policy?: AaacPolicy; observer?: AaacObserver; parentRunId?: string; abortSignal?: AbortSignal; memoryRef?: MemoryRef; memoryStore?: MemoryStore; logWriter?: AgentLogWriter; /** Populated when resuming from a previous memory_ref. */ resumedState?: unknown; /** Current run ID for this invocation chain. */ runId?: string; } interface AaacRuntime { runWorkflow(workflowId: string, options: Record, input: unknown, ctx: AaacInvocationContext): Promise; runTask(taskId: string, options: Record, input: unknown, ctx: AaacInvocationContext): Promise; } interface AaacPolicy { assertAllowed(operationName: string): void | Promise; } interface AaacObserver { onOperationStart?(operationName: string, input: unknown): void; onOperationEnd?(operationName: string, output: unknown): void; onOperationError?(operationName: string, error: Error): void; /** * Emit an agent-axis event to the observability pipeline. * Structurally matches EventCollector.emit() from @aaac/observability. * Pass an EventCollector instance to wire up the full pipeline. * When undefined, emission is a no-op (observer is optional). */ emit?: ObserverEmitFn; } type OperationHandler = (options: Record, input: unknown, ctx: AaacInvocationContext) => Promise; interface RuntimeBinding { execute(operationName: string, options: Record, input: unknown, ctx: AaacInvocationContext): Promise; getOperationNames(): string[]; getOperationIR(name: string): OperationIR | undefined; } declare function createRuntimeBinding(component: ComponentIR, handlers?: Record): RuntimeBinding; /** * Standard project runtime — the reusable, CLI-facing `AaacRuntime` that every * generated component CLI uses, so that NO caller hand-writes `ctx.runtime`. * Named "project" because it is driven by the external `project.yaml` manifest. * * It: * - discovers/loads the external `project.yaml` (walk up from cwd, or explicit * config path) via loadProjectConfig, * - resolves the effective DSL = project `agents` overlay merged over the * bundled `/$embedded/` component DSL (reusing executeWorkflow/executeTask's * loadDslContext merge — the overlay may `extends: /$embedded/` or be * self-contained), * - selects adapter/model from the project model_mapping (env/flag overrides) * via createModelResolver, * - implements runWorkflow → executeWorkflow and runTask → executeTask, * passing bindingPaths / activeGuardrailPolicy / artifactBinding so machine * guardrails operate on the merged DSL. */ declare const PROJECT_CONFIG_FILENAME = "project.yaml"; /** * Walk up from `startDir` to the filesystem root looking for the nearest * `project.yaml`. Returns the absolute path, or undefined if none is found. */ declare function findProjectConfig(startDir: string, filename?: string): string | undefined; interface CreateProjectRuntimeOptions { /** The bundled `/$embedded/` component DSL (the component's own agent-contracts). */ embeddedDsl: Record; /** Explicit project.yaml path; when omitted, discovered by walking up from cwd. */ configPath?: string; /** Launch directory for config discovery (defaults to process.cwd()). */ cwd?: string; /** Adapter override (CLI `--adapter`); falls back to env + model_mapping. */ adapter?: string; /** Model override (CLI `--model`). */ model?: string; /** Environment for adapter/model resolution (defaults to process.env). */ env?: Record; /** Auto-approve workflow gates (CLI is non-interactive by default). */ autoApproveGates?: boolean; } interface ResolvedAdapterSelection { adapter: string; model?: string; } interface ProjectRuntime { /** The standard AaacRuntime — assign to `ctx.runtime` (or use `.context`). */ runtime: AaacRuntime; /** A ready-made invocation context with `runtime` wired in. */ context: AaacInvocationContext; /** The loaded, resolved project config. */ config: ResolvedConfig; /** Absolute path to the discovered/explicit project.yaml. */ configPath: string; /** Absolute path to the project's `agents` overlay DSL (cfg.dslPath). */ dslSource: string; /** Resolve the effective adapter + model (for --dry-run reporting). */ resolveAdapter(): ResolvedAdapterSelection; /** * The in-process OtelEmitter created by createPipeline, when observability * is configured. Exposed for test verification that the otel config is * actually wired through to the emitter (F-002 / issue #125). * Undefined when bindings.observability is absent or disabled. */ otelEmitter?: OtelEmitter; } /** * Build the standard component runtime from the bundled embedded DSL + the * discovered/explicit project.yaml. Throws a clear error when no config exists. */ declare function createProjectRuntime(options: CreateProjectRuntimeOptions): Promise; interface ComponentScope { componentId: string; componentIR: ComponentIR; binding: RuntimeBinding; toolsByAgent: Map; guardrailsByAgent: Map; libraryTools?: LibraryToolRegistry; toolchainsByAgent?: Map; } interface CreateComponentScopeOptions { resolvedComponent?: ResolvedComponent; libraryToolDefs?: LibraryToolDefinition[]; } declare function createComponentScope(componentIR: ComponentIR, binding: RuntimeBinding, options?: CreateComponentScopeOptions): ComponentScope; interface ArtifactResolveOptions { dsl: Record; artifactBinding?: { source: string; mappings?: Record; }; paths?: Record; } interface ArtifactResolveResult { dsl: Record; diagnostics: Array<{ path: string; message: string; severity: string; }>; } declare function resolveArtifacts(options: ArtifactResolveOptions): Promise; /** * Guard CLI commands — evaluate/list/status for guardrail enforcement. * * These functions back the `guard evaluate`, `guard list`, and `guard status` * sub-commands that are auto-injected by @aaac/contracts cli-generator * whenever `governance.guardrails: true` is declared in component.yaml. * * exit code contract (evaluate): * 0 = allowed / pass / warn * 2 = denied (permission === "deny") */ interface EvaluateGuardrailOptions { /** Raw JSON string read from stdin (HookContext format). */ hookJson: string; /** Component agent-contracts DSL (contains guardrails + guardrail_policies). */ dsl: Record; /** Paths to software binding YAML files (contain guardrail_impl matchers). */ bindingPaths: string[]; /** Active guardrail policy name (from project.yaml active_guardrail_policy). */ activeGuardrailPolicy?: string; } interface EvaluateGuardrailResult { /** HookResponse to write to stdout. */ response: HookResponse; /** * CLI exit code. * 0 = allowed (pass or warn) * 2 = denied (permission === "deny") */ exitCode: 0 | 2; /** All check results from all matchers. */ checks: GuardrailCheckResult[]; } /** * Evaluate a guardrail hook from a JSON string (typically stdin). * * Detects the hook type from which fields are present in the input: * - `command` → beforeShellExecution * - `tool_name` / `tool_input` → preToolUse * - `file_path` (without command) → afterFileEdit */ declare function evaluateGuardrail(opts: EvaluateGuardrailOptions): Promise; interface ListGuardrailsOptions { /** Component agent-contracts DSL. */ dsl: Record; /** Paths to software binding YAML files. */ bindingPaths: string[]; /** Active guardrail policy name. */ activeGuardrailPolicy?: string; } interface GuardrailListEntry { guardrail_id: string; description: string; matcher_type: string; action: string; severity: string; pattern: string; } interface ListGuardrailsResult { policy: string | undefined; entries: GuardrailListEntry[]; } /** * List all active guardrails and their enforcement settings. * * Reads DSL + binding files and builds the guardrail context for the active * policy, returning a flat list of guardrail_id / matcher_type / action / * severity rows for display. */ declare function listGuardrails(opts: ListGuardrailsOptions): Promise; interface GuardStatusOptions { /** Base directory for agent logs (defaults to ".agent-logs"). */ baseDir?: string; /** Maximum number of recent run events to return (defaults to 10). */ limit?: number; } interface GuardStatusResult { hasHistory: boolean; message: string; /** Recent run log events (operation_start/end, etc.). */ recentEvents: unknown[]; } /** * Show recent guardrail evaluation summary. * * Phase 1 limitation: RunLogEvent does not yet include a `guardrail_evaluate` * event type, so this command reports general run history from .agent-logs/runs/. * Guard-specific event tracking will be added in a future phase. * * Gracefully returns "no evaluation history" when .agent-logs/ does not exist. */ declare function guardStatus(opts?: GuardStatusOptions): Promise; declare const ClaudeConfigSchema: z.ZodObject<{ output_dir: z.ZodDefault; config_path: z.ZodDefault; guard_command: z.ZodOptional; component_id: z.ZodOptional; }, z.core.$strip>; type ClaudeConfig = z.infer; /** Parse and default-fill an opaque config payload from component.yaml. */ declare function parseClaudeConfig(raw: unknown): ClaudeConfig; type FileAction = "created" | "updated" | "unchanged"; interface SyncOptions { projectRoot: string; /** Opaque config payload from component.yaml (validated here). */ config: unknown; /** Resolved agent DSL (plain object; the value the runtime embeds). */ dsl: Record; /** When true, compute changes without writing. */ dryRun?: boolean; } interface SyncResult { files: Array<{ path: string; action: FileAction; }>; } interface CheckResult { inSync: boolean; drift: Array<{ path: string; reason: "missing" | "changed"; }>; } /** * Materialize `.claude/*` and the CLAUDE.md integration block from the embedded DSL. * * Idempotent: re-running with no changes writes nothing. CLAUDE.md uses a * marker-delimited block merge so user content outside the block is preserved. */ declare function syncClaude(opts: SyncOptions): Promise; /** * Read-only drift gate. Reports files whose on-disk content differs from a * fresh render. For CLAUDE.md, drift means the aaac:claude-native block is * missing or stale (content outside the block is ignored). */ declare function checkClaude(opts: SyncOptions): Promise; /** * Prompt Executor — natural language routing via LLM tool selection. * * Converts component operations into tool descriptions, sends them to an LLM * for routing, and dispatches the selected operation through the existing * component binding. */ interface OperationToolDef { name: string; description: string; inputSchema: Record; } interface PromptResult { selectedOperation: string; mappedInput: Record; output?: unknown; dryRun?: boolean; model?: string; } interface PromptExecuteOptions { dryRun?: boolean; adapter: string; model?: string; } /** * Convert non-handler, non-prompt operations from ComponentIR into tool definitions * for LLM routing. */ declare function operationsToTools(ir: ComponentIR): OperationToolDef[]; /** * Parse the LLM router response to extract selected operation and mapped input. */ declare function parseRouterResponse(response: string, validNames: string[]): { selectedOperation: string; mappedInput: Record; }; /** * Execute a natural language prompt by routing to the appropriate operation. */ declare function executePrompt(message: string, ir: ComponentIR, binding: RuntimeBinding, ctx: AaacInvocationContext, opts: PromptExecuteOptions): Promise; /** * @aaac/runtime — public API * * Runtime bridge for executing agent-contracts workflows on Agent SDKs. */ /** Package version string. */ declare const version: string; export { type AaacInvocationContext, type AaacObserver, type AaacPolicy, type AaacRuntime, AgentContractLike, AgentLogWriter, type AgentLogWriterOptions, type AgentPlugin, type AnalyzeImpactInput, type AnalyzerBridge, type AnalyzerBridgeOptions, ArtifactBindingConfig, type ArtifactResolveOptions, type ArtifactResolveResult, type BuildCallGraphInput, type CheckResult as ClaudeCheckResult, type ClaudeConfig, type FileAction as ClaudeFileAction, type SyncOptions as ClaudeSyncOptions, type SyncResult as ClaudeSyncResult, type ComponentScope, type CreateAdapterOptions, type CreateComponentScopeOptions, type CreateProjectRuntimeOptions, DelegateStep, type DslContext, DslValidationError, type EvaluateGuardrailOptions, type EvaluateGuardrailResult, type ExecuteOptions, type ExecuteTaskOptions, type ExecuteWorkflowOptions, FileMemoryStore, type GenerateContextPackInput, type GuardStatusOptions, type GuardStatusResult, GuardrailCheckResult, GuardrailHooks, type GuardrailListEntry, type GuardrailResult, GuardrailRuleData, HandoffInput, HookResponse, LibraryToolDefinition, LibraryToolRegistry, type ListGuardrailsOptions, type ListGuardrailsResult, type LoadDslOptions, MemoryRef, MemoryStore, type MemoryStoreEntry, ModelMappingConfig, ObserverEmitFn, type OperationHandler, type OperationMemoryRefConfig, type OperationToolDef, PROJECT_CONFIG_FILENAME, type PermissionMode, type PluginLoadResult, PluginRegistry, type ProcessEditOptions, type ProcessTaskOptions, type ProcessWorkflowOptions, type ProgressSink, type ProgressSinkOptions, type ProjectRuntime, type PromptBuilderArgs, PromptBuilderOptions, type PromptExecuteOptions, type PromptResult, type RequiredEntities, type ResolvedAdapterSelection, ResolvedComponent, ResolvedToolchain, type RunLogEvent, RunToolchainChecksOptions, type Runtime, type RuntimeBinding, type RuntimeConfig, SdkAdapter, SdkFunctionTool, StepCompleteEvent, StepResult, TaskContext, TaskContractLike, type TaskHookContext, TaskOutcome, TaskRunResult, WORKFLOW_INPUT_STEP_ID, WorkflowBuilder, type WorkflowHookContext, type WorkflowInputHandoff, type WorkflowInputOutput, WorkflowRegistries, WorkflowResult, buildGuardrailRulesFromDsl, buildRegistriesFromDsl, buildWorkflowInputOutput, checkClaude, createAdapter, createAnalyzerBridge, createComponentScope, createProgressSink, createProjectRuntime, createRuntime, createRuntimeBinding, emitProcessEdit, emitProcessTaskClose, emitProcessTaskOpen, emitProcessWorkflowClose, emitProcessWorkflowOpen, evaluateGuardrail, executePrompt, executeTask, executeWorkflow, findProjectConfig, formatWorkflowInputContext, guardStatus, isContextPack, isFileEditTool, jsonSchemaToZod, listGuardrails, loadDslContext, loadPlugins, loadPluginsFromDirectory, loadPluginsFromPaths, operationsToTools, parseClaudeConfig, parseRouterResponse, pluginRegistry, renderContextPackPrompt, resolveArtifacts, stepDependsOnWorkflowInput, syncClaude, version };