/** * OpenKernel — Coder profiles * * A *profile* is a named, reusable coder configuration: which backend CLI to * run (claude / codex / opencode / gemini), which model, and any extra args/env. * Profiles are what the rotation engine (see `rotation.ts`) chooses between, so * the orchestrator can say "run this on the `deep` profile" or "rotate across * the cheap tier" without hard-coding a backend + model at every call site. * * Profiles carry lightweight cost/speed/quality metadata so a policy tier * (free-first / fastest / highest-quality / …) can order them, plus `tags` a * task-type router can match against. * * Config lives under `coder` in the node config; anything omitted falls back to * the built-in defaults below so the mesh works out of the box. */ import type { BackendId } from './types.js'; /** A named coder configuration the rotation engine can select. */ export interface CoderProfile { /** Stable name, e.g. "deep", "cheap". Filled in by the loader from the map key. */ name: string; /** Which CLI backend runs it. */ backend: BackendId; /** Model id in that backend's native format (e.g. "opus", "gpt-5-codex"). */ model?: string; /** Extra CLI args appended for this profile (via the backend's ARGS env). */ args?: string[]; /** Extra process env for this profile. */ env?: Record; /** Relative $ per task — lower is cheaper. Used by cost policies. */ cost?: number; /** Relative throughput — higher is faster. Used by the `fastest` policy. */ speed?: number; /** Relative capability — higher is stronger. Used by `highest-quality`. */ quality?: number; /** Task-type tags this profile is a good fit for (matched by the router). */ tags?: string[]; } export type RotationStrategy = 'auto' | 'tasktype' | 'policy' | 'roundrobin' | 'fallback'; export type CoderPolicy = 'free-first' | 'cheapest' | 'fastest' | 'highest-quality' | 'balanced'; /** The `coder` config block. Everything is optional; defaults fill the gaps. */ export interface CoderConfig { profiles: Record; /** Default ordered profile names used by roundrobin/fallback. */ rotation: string[]; /** Default strategy when a caller doesn't specify one. */ strategy: RotationStrategy; /** Default policy when strategy resolves to policy ordering. */ policy: CoderPolicy; /** Task-type → ordered profile names (task-type routing). */ routes: Record; /** Fallback profile when nothing else matches. */ defaultProfile: string; } /** * Built-in profiles — one per backend plus a couple of tiers. Models are the * common ids; override in config for your accounts. `cost`/`speed`/`quality` * are relative (1–10) and only used to order policy tiers. */ export declare const DEFAULT_PROFILES: Record; /** * Merge a raw `coder` config object (from node config) over the built-in * defaults, filling `name` from the map key. Safe to call with `undefined`. */ export declare function loadCoderConfig(raw?: Partial & { profiles?: Record>; }): CoderConfig;