/**
 * Shared types and utilities for the per-owner realize emit path.
 *
 * Extracted from the (now-deleted) per-action-emitter / per-action-runner /
 * per-action-llm-emit modules when the per-action path retired in engines
 * 6.45.0. Per-owner has been the default since 6.41.0; the per-action
 * escape hatch was scheduled to retire one cycle later (6.42.x) but was
 * pushed by the methodology refactor (6.43.0-6.44.0). This module holds
 * the small set of types + helpers that per-owner-emit and per-owner-runner
 * still need.
 *
 * Three groups of content:
 *
 *   1. **Type re-exports from @specverse/types** — `MatchResult`,
 *      `MatcherFn`, `SharedConvention`, `SharedStepContext`. The
 *      canonical home is @specverse/types (since #54 in engines 6.37);
 *      we re-export here so consumers don't have to know the cross-
 *      package path.
 *
 *   2. **Realize-internal types** — `ActionSpec`, `RealizeContext`,
 *      `CollectedAction`. The shape of "one action under one owner,
 *      ready to dispatch through the matcher and the LLM". These don't
 *      live in @specverse/types because they're emit-pipeline-internal.
 *
 *   3. **Helper functions** — `extractTypescriptBlock` (LLM-output
 *      fence extraction), `collectActions` (walk a spec, build the
 *      per-owner action list), `buildAvailableClientsByOwner` (resolve
 *      V2 component imports to per-owner clients map).
 */
export type { SharedStepContext, SharedConvention, MatchResult, MatcherFn, } from '@specverse/types';
/**
 * The unit of work the emitter is asked to fill. A spec-derived view of
 * an action / operation. Plain shape so callers in different phases of
 * the realize pipeline can construct it without coupling to AST internals.
 */
export interface ActionSpec {
    /** Action / operation name as it appears in the spec (e.g. `processOrder`). */
    name: string;
    /** Owning component / class — for prompt context + identity. */
    ownerName: string;
    /** Whether this owner is a controller, service, or model.behaviors host. */
    ownerKind: 'controller' | 'service' | 'model';
    /** The spec step bullets — what the LLM (or matcher) is filling in. */
    steps: string[];
    /** Action-level metadata, threaded into both the matcher and the LLM. */
    description?: string;
    parameters?: Record<string, string>;
    returns?: string;
    requires?: string[];
    ensures?: string[];
    publishes?: string[];
}
/**
 * Per-owner emission context. Carries what the emitter needs to walk
 * matchers and hand owners to the LLM. Some fields are vestigial from
 * the per-action era (e.g. `aiArgsExpr`, `canCallLLM`) but are still
 * consumed by per-owner-emit's owner-level orchestration.
 */
export interface RealizeContext {
    /** Component name the owning entity lives in. */
    componentName: string;
    /** Spec model name powering this controller / service. */
    modelName: string;
    /** Convention-matcher walker (`matchAgainstConventions`). */
    matcher?: import('@specverse/types').MatcherFn;
    /** ORM/driver-specific convention list the matcher walks. */
    conventions?: ReadonlyArray<import('@specverse/types').SharedConvention<import('@specverse/types').SharedStepContext>>;
    /** AI-fallback args expression — per-ORM (prisma vs pg-native shapes). */
    aiArgsExpr?: (inputs: string[], paramNames: string[]) => string;
    /** V2 P3: clients exposed to the LLM via the prompt's `availableClients` slot. */
    availableClients?: string;
}
/**
 * One collected action ready for per-owner emission. Built by
 * {@link collectActions} from the inferred spec.
 */
export interface CollectedAction {
    ownerKind: 'controller' | 'service' | 'model';
    /** Controller / service name (the file owner). */
    ownerName: string;
    /** The controller's `model:` reference (or service's "self" name). */
    modelName: string;
    /** Action / operation name as it appears in the spec. */
    actionName: string;
    /** Original ActionSpec — passed through to the LLM emit hook. */
    spec: ActionSpec;
}
/**
 * Pull the first ```typescript fenced block out of an LLM response.
 * Tolerates plain ``` (no language tag) when the body starts with
 * recognisably-TS content. Returns null if no block is found.
 */
export declare function extractTypescriptBlock(text: string): string | null;
/**
 * Walk an inferred spec and produce the flat list of actions across all
 * controllers and services. Per-owner-runner groups these by `ownerName`
 * to emit one `<Owner>.ai.ts` file per controller / service.
 *
 * Accepts both spec shapes: `{Name: {...}}` keyed object (the canonical
 * analyse-pipeline output) and `[{name, ...}]` array.
 */
export declare function collectActions(spec: any): CollectedAction[];
/**
 * Build a single component's `availableClients` prompt string from its
 * V2 `import:` block. Returns null when the component has no imports.
 */
export declare function buildAvailableClientsForComponent(component: any, topologyByFrom?: Map<string, string>): string | null;
/**
 * Walk a parsed spec and build the per-owner `availableClients` map.
 * V2 imports are component-scoped; every controller and service inside
 * a component shares the same `availableClients` string.
 */
export declare function buildAvailableClientsByOwner(spec: any, topologyByFrom?: Map<string, string>): Map<string, string>;
//# sourceMappingURL=owner-emit-shared.d.ts.map