/** * Launch-time resolution of the issues a run's intent links (crew#627). * * A governed worker cannot read GitHub: its environment carries no `gh` login (the daemon's own is * deliberately not inherited, and the engine's fence refuses `gh api` and the token variables), so * `gh issue view ` exits 4 and the worker guesses, or reads the public page through WebFetch * (nothing on a private repository, no comments beyond the page). The daemon CAN read them, under * its own identity, before the run starts. So at launch every `#N` / `owner/repo#N` / issue URL the * intent names is read with `gh issue view --json` and its title, state, body and comments are * appended to the problem the engine plans from, inside one marked block. What could not be read * is said in that block and in the launch answer, never skipped silently. * * crew#825: the block is BACKGROUND, not instruction. It opens with {@link LINKED_ISSUES_PREFACE} * (the intent above it wins where they differ — an issue is the record of the question, the intent * is the answer), each read issue reports its appended size (`chars`), and a launch can leave refs * out (`excludeLinkedIssues`): a reference in passing is not a request to inline the issue. The * launch composer previews the same reading (`POST /linked-issues/preview`) before Send. * * The block is fenced by {@link LINKED_ISSUES_OPEN} / {@link LINKED_ISSUES_CLOSE} so the deliver * text can take it back out ({@link stripLinkedIssues}): a PR body names the intent, not the issue * text the daemon attached to it. */ import { type GhExec } from './deliver.js'; export declare const LINKED_ISSUES_OPEN = ""; export declare const LINKED_ISSUES_CLOSE = ""; /** crew#825: the first line inside the block — the intent is the instruction, the issues context. */ export declare const LINKED_ISSUES_PREFACE = "Linked for reference \u2014 the intent above is the instruction; these issues are background. Where they differ (an option the issue lists, a scope it proposes), the intent wins."; /** At most this many issues are read per launch; the rest are named as not read. */ export declare const MAX_LINKED_ISSUES = 5; /** Per-issue `gh` bound — the launch answer waits on these, in parallel. */ export declare const LINKED_ISSUE_TIMEOUT_MS = 5000; /** One issue the intent named, and what the daemon could read of it. */ export interface LinkedIssue { /** The reference as the intent spelled it, normalized (`#541`, `owner/repo#7`). */ ref: string; resolved: boolean; /** Present when `resolved`. */ title?: string; /** Present when not `resolved`: why, in one line. */ error?: string; /** crew#825: present when `resolved` — characters this issue adds to the problem. */ chars?: number; /** crew#825: `true` when the launch left this ref out (`excludeLinkedIssues`); never read. */ excluded?: true; } export interface LinkedIssuesResult { issues: LinkedIssue[]; /** The marked block to append to the problem, or `null` when the intent names no issue. */ block: string | null; } /** crew#825: an exclusion as a caller may spell it — `541`, `#541`, `repo#541`, `owner/repo#541` — * in the form `issueRefs` yields for the same `repoRef` (so the refs `POST /linked-issues/preview` * answered can be sent back verbatim); `null` for anything else. */ export declare function normalizeIssueRef(raw: string, repoRef?: string | null): string | null; /** * Read every issue `problem` names (at most {@link MAX_LINKED_ISSUES}) through `gh`, in `repoRoot` * for a same-repository `#N`. Never throws: an unreadable issue is a `resolved: false` entry. A ref * in `exclude` (crew#825) is not read and not appended; it is listed as `excluded` so the answer * still says the intent named it. */ export declare function resolveLinkedIssues(problem: string, repoRoot: string | undefined, repoRef: string | undefined, exec?: GhExec, exclude?: readonly string[]): Promise; /** `problem` with the daemon's linked-issues block (if any) taken back out. */ export declare function stripLinkedIssues(problem: string): string; //# sourceMappingURL=linked-issues.d.ts.map