/** * @file Declarative ROLE → tier + profile orchestration for AI call-outs. A * caller names the ROLE its spawn plays — discovery, execution, planning, * review, verification — and gets the fleet-policy model + effort pair via * `AI_TIER` plus the matching permission `AI_PROFILE`, instead of hardcoding * a model string and hand-pairing a profile at every site. * The policy encodes fleet doctrine (see docs/agents.md/fleet/{token-spend, * delegating-execution,fable-fallback}.md): Fable is the planning/review * brain; execution + verification run on the sonnet floor to save tokens, * with mechanical execution dropping to haiku; Opus is reserved for * security-sensitive planning/review — never Fable there. * Everything downstream is reuse: `spawnForRole` delegates to * `spawnTierWithFallback`, so the model/effort table (`AI_TIER`), the * availability-gated cross-engine fallback (`route.mts`), and the * Fable-adaptive-only effort omission (`spawn.mts`) stay the single source. * Model + effort can never be mismatched or omitted here — the tier supplies * both, and the profile supplies tools/permission, so a caller cannot drift * them apart. */ import { AI_PROFILE } from './profiles.js'; import type { RouteContext } from './route.js'; import type { TierSpawnResult } from './spawn.js'; import type { AiTier } from './tier.js'; import type { SpawnAiAgentOptions } from './types.js'; export type AiRole = 'discovery' | 'execution' | 'planning' | 'review' | 'verification'; export type RoleSensitivity = 'benign' | 'security'; export interface RoleTierLevers { readonly mechanical?: boolean | undefined; readonly sensitivity?: RoleSensitivity | undefined; } export interface RolePolicy { readonly tier: AiTier; readonly securityTier?: AiTier | undefined; readonly profile: keyof typeof AI_PROFILE; } /** * The role → policy table. The one place a role's tier + permission profile * live; consumers derive, never re-encode. */ export declare const ROLE_POLICY: Readonly>; /** * Resolve the tier a role runs at, applying the two levers: `security` * sensitivity escalates to the role's `securityTier` (planning/review → opus), * and `mechanical` execution drops to the haiku floor. Pure — no I/O. */ export declare function resolveRoleTier(role: AiRole, options?: RoleTierLevers | undefined): AiTier; export interface SpawnForRoleOptions extends Omit { readonly sensitivity?: RoleSensitivity | undefined; readonly mechanical?: boolean | undefined; } /** * Spawn an AI call-out by the ROLE it plays. Resolves role → tier (via * `resolveRoleTier`) and role → permission profile (via `AI_PROFILE`), then * delegates to `spawnTierWithFallback` so model/effort/fallback/Fable handling * stay in the canonical tier layer. The caller supplies only prompt/cwd/etc — * never a model, effort, or profile. */ export declare function spawnForRole(role: AiRole, ctx: RouteContext, options: SpawnForRoleOptions): Promise;