/** * The agent's index of hoocode's *own* documentation. * * The startup banner promises "hoocode can explain its own features and look up * its docs", and the docs really do ship with the install (`package.json` * `files` includes `docs`, and `copy-binary-assets` copies them into `dist/` for * the pkg binaries). What was missing is the only part that makes the promise * true: telling the model they exist. `getDocsPath()` had exactly one consumer — * `auth-guidance.ts`, which prints paths to the *human* — so nothing ever put a * docs path into model context. * * That gap is not one the model can close by itself. Its cwd is the user's * project, so `SearchCodebase` there discovers the user's docs, never hoocode's, * which live in an install directory whose path it cannot derive. * * Descriptions come from `docs/index.md` rather than being duplicated here. * That file is a curated, human-maintained table of contents, and a second * hand-written list is how an index goes stale the first week nobody updates * it. The directory listing stays the source of truth for *what exists*, so a * new doc still shows up (described from its own first paragraph) on the day it * lands, with or without an index entry. */ export interface SelfDoc { /** Stable id: the filename, e.g. `skills.md`. Also how the model refers to it. */ id: string; /** Absolute path, ready to hand to the read tool verbatim. */ path: string; /** Human title, e.g. "Skills". */ title: string; /** One line on what the doc covers. May be empty if nothing could be derived. */ description: string; } /** Drop the cached listing. Tests, and anything that relocates the package root. */ export declare function resetSelfDocs(): void; /** * Every shipped doc, sorted with the overview first and the rest alphabetical. * * Returns `[]` when the docs directory is absent rather than throwing: a source * checkout, an odd packaging, or a trimmed container should degrade to "no docs * section in the prompt", never to a failed session start. */ export declare function listSelfDocs(): SelfDoc[]; /** * The system-prompt section, or `""` when there is nothing to point at. * * Deliberately just filenames. An earlier version carried a one-line summary * per doc and cost ~860 tokens on every single turn, which is a poor trade for * something most turns never use — and it stopped being necessary once * SearchHooCode could retrieve at the heading level. Filenames alone still let * the model go straight to `themes.md` or `keybindings.md` for the obvious * cases, and anything less obvious is one search away. That is ~180 tokens. * * Directories are printed once rather than repeated per entry, for the same * reason: the path was the single largest term on every line. */ export declare function formatSelfDocsForPrompt(docs?: readonly SelfDoc[]): string; /** * A single heading's worth of a doc. * * Doc-level retrieval would add nothing the prompt listing above does not * already give: thirty files with a summary each are cheap enough to list in * full, so a search that answers "read extensions.md" is a round trip for * information the model already had. The questions that actually need * retrieval are the ones inside a 1,100-line file — "how do I register a * tool?" should land on `extensions.md § Custom tools` with a line number, not * on the file. */ export interface SelfDocSection { /** `#`, unique across the corpus. */ id: string; /** Filename, e.g. `extensions.md`. */ file: string; /** Absolute path to the file. */ path: string; /** Heading trail from the document title down, e.g. `["Extensions", "Custom tools"]`. */ headings: string[]; /** 1-based line of the heading, so a reader can jump straight to it. */ line: number; /** Start of the section body, for ranking and for showing why a hit matched. */ excerpt: string; } /** `extensions.md § Extensions › Custom tools` — what a search result is labelled with. */ export declare function sectionLabel(section: SelfDocSection): string; /** * Split one markdown file into sections at its headings. * * Fenced code is tracked so a `#` comment inside a bash block cannot be * mistaken for a heading — which would otherwise split docs at every shell * comment. Code *content* still lands in the excerpt: the exact identifiers * someone searches for (`hoo.registerTool`) usually live in the examples, and * dropping them would blind the lexical leg to the best terms in the file. */ export declare function splitIntoSections(markdown: string, file: string, path: string): SelfDocSection[]; /** Drop the cached section index. Tests, and anything that relocates the package root. */ export declare function resetSelfDocSections(): void; /** * Every section of every shipped doc. * * Reads each file once per session and caches; the docs are read-only install * content, so there is nothing to invalidate on. */ export declare function listSelfDocSections(): SelfDocSection[]; //# sourceMappingURL=self-docs.d.ts.map