import { type ToolNameListSide } from "./tool-name-list.js";
/** One entry of a tool-list field, read by the rule syntax. */
export interface ToolListFieldEntry {
    /** The entry's place in the field, counted from 1 over every entry the field holds — read or refused — in written order. */
    readonly position: number;
    /** The entry as written, the blanks at its ends dropped: the spelling a definition's tool list or a rule list takes as it is. */
    readonly spelling: string;
    /** The tool name the rule syntax reads (`Bash` in `Bash(git log:*)`; `*` for the lone `*`). */
    readonly name: string;
    /** The rule the parentheses hold, unescaped (`git log:*`); absent for a bare name and for `Tool()` / `Tool(*)`, the whole tool. */
    readonly arg?: string;
}
/** What a reader of the field is told. `level: "error"` — the field, or one entry of it, is not read: the value is no list
 *  (`not_a_list`), a list whose entries cannot be read (`unreadable`), a list item that is not a string or holds no entry
 *  (`not_a_name`), an entry whose parentheses are not one group closing it (`parens`), an entry that is no rule spelling
 *  (`not_a_rule`). `level: "info"` — the list is read as written and says something its author may not mean: a denied list
 *  holding the lone `*` denies every tool (`deny_all`, once, at the first such entry). */
export interface ToolListFieldProblem {
    readonly level: "error" | "info";
    readonly code: "not_a_list" | "unreadable" | "not_a_name" | "parens" | "not_a_rule" | "deny_all";
    /** The entry's place ({@link ToolListFieldEntry.position}); absent when the problem is the whole value's. */
    readonly position?: number;
    /** The entry as the cut wrote it (`parens`, `not_a_rule`, `deny_all`): data for a host to show through its own escaping, never in `why`. */
    readonly spelling?: string;
    /** The words that say why, never quoting the field: for an `error`, the clause the skills-directory reader refuses the same
     *  list with; for `deny_all`, what the list as written does. */
    readonly why: string;
}
/** A tool-list field, read: `entries` is `undefined` only for an absent field; `problems` holds every entry or value not read
 *  (`error`) and what the list as read says that its author may not mean (`info`). */
export interface ToolListField {
    readonly entries: readonly ToolListFieldEntry[] | undefined;
    readonly problems: readonly ToolListFieldProblem[];
}
/**
 * Read a tool-list FIELD — the value a host's YAML parser produced for an agent's `tools:` / `disallowedTools:` or a
 * command's `allowed-tools` — by the one grammar of this module. Nothing is dropped without a problem saying so:
 *  - `undefined` (the field is absent): `entries` is `undefined` — no list; the consumer's default applies (an agent's
 *    `tools:` absent holds every tool, its `disallowedTools:` absent denies none);
 *  - `null` (the key written with nothing after it): an empty list — the field is written and names no tool;
 *  - a string: each of its lines is cut alone (a line break ends an entry, as each line of a skill's block scalar is cut
 *    alone), an empty or blank string an empty list;
 *  - a list (read once by index, as every host-written tool-name list is): each string item is cut as a string; an item that
 *    is not a string, or a string that holds no entry, is `not_a_name` and takes one position;
 *  - any other value: `not_a_list`, and an empty list.
 * Every entry is then the rule syntax's to read: one it reads is an entry, one whose parentheses are not one zone is `parens`,
 * one it cannot read `not_a_rule`. Case is kept, a repeated entry is kept, a name no tool answers to is kept (the list's
 * consumer judges names), and the lone `*` is an entry like any other, the list never collapsed to it: the consumer reads it
 * — an allowed list holding it allows every tool, a denied list holding it denies every tool. `side` is the side the field is
 * on: a `denied` list holding a `*` entry is also told so, once (`deny_all`, `level: "info"`), its entries unchanged.
 * A field with an `error` problem is not the list its author wrote: an allowed list that lost entries holds fewer tools, a
 * denied list that lost entries denies fewer. A host refuses the definition, as the skills-directory reader refuses the skill,
 * or says so naming each problem; installing `entries` without a word is the one thing it does not do. An `info` problem is
 * the list as written: a host shows it, and installs the list.
 */
export declare function parseToolListField(value: unknown, side: ToolNameListSide): ToolListField;
