import { TeamshareApi } from './api'; import type { StashResult } from './git/git-runner'; export type RunReportKind = 'run' | 'build' | 'orchestrator' | 'plan' | 'tool' | 'workflow'; export interface RunReportInput { api: TeamshareApi; projectId: string; /** Task-bound reports (every kind except a detached tool run). */ taskId?: string; toolRunId?: string; workflowRunId?: string; agentId: string; taskTitle: string; kind: RunReportKind; /** Per-run identity (`-`, tool `runId`, …). */ runKey: string; status: string; /** Fallback narrative when the agent wrote no report file. */ summary: string; /** Per-run agent file (`~/.teamshare/reports/.md`). */ reportPath: string; /** Fact lines about the work (branch, worktree, attempts, git outcome). */ details?: string[]; /** Verification lines (checklist/subtask counts, finalize outcome). */ verification?: string[]; notes?: string[]; gitLine?: string; branch?: string; sha?: string; prUrl?: string; changedPaths?: string[]; workingDir?: string; startedAt?: string; finishedAt?: string; /** Stash results from git-runner — surfaced in verification. */ stashResults?: StashResult[]; log?: (text: string, level?: 'stdout' | 'stderr') => void; } /** * Per-run report path: `~/.teamshare/reports/.md`. Per RUN, not per * task — a stale file from a previous run must never read as this run's * narrative. */ export declare function getReportPath(runKey: string): string; /** One block every run prompt carries, so all harnesses file the same way. */ export declare function runReportBlock(reportPath: string): string; /** Success, or the final sanitized error so callers can surface WHY the * report never landed (previously console-only). */ export type RunReportResult = { ok: true; id: string; name: string; documentUrl: string; } | { ok: false; error: string; }; /** * Reads this run's narrative file and saves the composed report via * `POST /run-reports` (falls back to a direct note on older backends). * Never throws; `{ ok: false }` is advisory — completed work stays complete. */ export declare function saveRunReport(input: RunReportInput): Promise; /** Best-effort cleanup of this run's narrative file (never throws). */ export declare function clearReportFile(reportPath: string): void; /** * How a run report is REFERENCED in the closing comment (2026-12). * * A markdown link (`[name](https://…/documents/)`) is a dead end inside the * app: the comment surface renders it as a raw external link, so it does not * open the document preview, and the label is whatever the file happens to be * called. The `#doc:` ENTITY TOKEN is the app's own reference grammar: * `TSMentionText` renders it as a chip, and a document chip opens the existing * preview dialog with **Open document** (the same behaviour as typing `#` in a * comment). The backend's notification projection already turns a token into * `#label`, so email/OS notifications keep a readable sentence. * * Labels are display-only; the id is authoritative. `]`, CR and LF would break * the token, so they are stripped and the label is capped like the composer's. */ export declare function runReportReference(report: { id: string; name: string; }): string;