/** * Output styles: files that set how the agent talks for a whole session, * chosen by a name in the harness settings. * * The core knows only that idea. Where the files live, how a name is read from * one, which setting selects it and how a run shows that it arrived are each * harness's own rules, given by its layout as `outputStyles`. A layout without * them is a harness that has no output styles. */ import type { ModelRequest } from "./harness-driver.js"; import type { PluginLayout } from "./layout.js"; /** One style, read by its harness's rules. */ export interface OutputStyle { /** * Relative to the directory the caller scanned (a bundle), `/`-separated, * exactly as the caller's file map keyed it. A plain string by the same * contract as every scan-core path; `Bundle.scanned` in `frame.ts` gives it * a frame. Not the `BundlePath` brand: that type is internal and must not * reach this public interface. */ readonly path: string; /** The name a setting must spell, or null when the harness cannot tell. */ readonly name: string | null; /** The text the harness delivers, frontmatter removed. */ readonly body: string; } /** How one harness keeps output styles and switches one on. */ export interface OutputStyleRules { /** The folder of style files, e.g. `output-styles`. */ readonly dir: string; /** Whether a path inside that folder is a file the harness loads. */ readonly isStyleFile: (pathInDir: string) => boolean; /** Reads one style file as this harness does. */ readonly read: (path: string, text: string) => OutputStyle; /** The settings that switch the named style on. */ readonly select: (name: string) => Readonly>; /** * The settings that switch every style off, so a run without the style does * not pick up one the user turned on for all their projects. */ readonly selectNone: Readonly>; /** Whether one model request carries the style. */ readonly reached: (style: OutputStyle, request: ModelRequest) => boolean; } /** What a repository holds, or that its harness has no such thing. */ export type OutputStyleScan = { readonly kind: "not-supported"; } | { readonly kind: "found"; readonly styles: readonly OutputStyle[]; }; type StyleLayout = Pick; /** The folders a harness reads styles from: a plugin's root and the user surface root. */ export declare function outputStyleHomes(layout: StyleLayout): readonly string[]; /** Every style among `files` (repository path → text). Pure: the caller reads the disk. */ export declare function findOutputStyles(layout: StyleLayout, files: ReadonlyMap): OutputStyleScan; /** A run with one style switched on, or why it cannot be set up. */ export type StyleRunPlan = { readonly kind: "refused"; readonly reason: string; } | { readonly kind: "planned"; /** The style as the harness will read it, at its place in the work dir. */ readonly style: OutputStyle; readonly files: Readonly>; readonly settings: Readonly>; }; /** * Put one style file into a test's fixture and switch it on BY THE NAME THE * HARNESS READS from it — never a name the caller types. Pure: the caller reads * the file. Refuses instead of guessing when the harness has no styles, would * not load such a file, cannot tell its name, or the fixture already decides. */ export declare function planStyleRun(layout: StyleLayout, source: { readonly path: string; readonly text: string; }, fixture: { readonly files: Readonly>; readonly settings: unknown; }): StyleRunPlan; /** Whether any request of a run carried the style, by its harness's own rule. */ export declare function styleReached(rules: OutputStyleRules, style: OutputStyle, requests: readonly ModelRequest[]): boolean; export {}; //# sourceMappingURL=output-style.d.ts.map