/** * Deciding what a CI agent may attempt to fix, and under what boundary. * * The reviewer already finds problems. This decides which of them are worth * handing to an agent, caps how much it may take on, and pins the capabilities * it runs with. It deliberately stops there: it produces a plan, never a * commit. Staging, branching and opening a pull request belong to the action, * which has the token — and keeping git out of the agent's reach is half the * reason this is safe to run in CI at all. * * The boundary is the point. A fix run gets `files` (it must edit) and `tests` * (it must check its own work) and nothing else. No shell, no git, no network. * Enforced by the same machinery as any other custom bot, so an agent that * decides it would like to curl something simply has no tool to do it with. */ import type { ReviewIssue } from './codeReview.js'; import type { Personality } from './personalities.js'; export interface FixPlanOptions { /** Lowest severity to attempt. Defaults to `warning`. */ minSeverity?: 'error' | 'warning'; /** Most issues to hand over in one run. */ maxIssues?: number; /** Most files to touch. A fix that rewrites half the repo is not a fix. */ maxFiles?: number; } export interface FixPlan { /** The issues the agent is being asked to address, in file order. */ issues: ReviewIssue[]; /** Files it is allowed to be working in. */ files: string[]; /** Why nothing is being attempted, when that is the case. */ skipped?: 'no-issues' | 'nothing-fixable'; /** The instruction handed to the agent. */ prompt: string; /** The capability boundary the run executes under. */ personality: Personality; } /** * `suggestion` and `info` are opinion — style preferences, "consider extracting * this". Acting on them unasked produces churn in someone else's pull request * and buries the findings that matter. Only what the reviewer states as a * defect is eligible. */ export declare function isFixable(issue: ReviewIssue, minSeverity: 'error' | 'warning'): boolean; /** * The capability set a CI fix runs under. * * Not a suggestion in the prompt — a real `custom-bot/v1` personality, enforced * by `isPersonalityToolCallAllowed` and by the tool registry filter, exactly as * a bot built in Agent Studio would be. An agent running unattended against * someone else's repository is precisely where a boundary has to be real. */ export declare function ciFixPersonality(): Personality; /** * Turn a review into a bounded instruction, or decline. * * Caps matter more than they look. An agent handed sixty findings across forty * files will produce a pull request nobody reviews, which is the same as no * pull request — except it also burned tokens and someone's afternoon. */ export declare function buildFixPlan(issues: ReviewIssue[], options?: FixPlanOptions): FixPlan; /** The instruction the agent receives: the findings, grouped by file. */ export declare function formatFixPrompt(issues: ReviewIssue[]): string; /** A one-line summary for the pull request body the action opens. */ export declare function summariseFixPlan(plan: FixPlan): string; /** * What the agent actually did, in one line. * * A fix that changes nothing is the hardest outcome to act on, because the * summary that reports it — "the run did not finish", "nothing was changed" — * says what did not happen and never what did. Debugging one such run through * CI cost two releases and forty minutes of guessing at whether the agent * could not find the file, could not write, or was being refused a tool. * * Counting the action log answers that in the message itself. Failures are * called out separately from successes, and one failing detail is quoted, * because a refusal reason is usually the whole explanation. */ export declare function describeAgentActivity(actions: { type: string; result: string; details?: string; }[]): string;