import { TeamshareApi, Task, type Comment } from './api'; export interface BriefOptions { /** Legacy: no longer used for doc content (names-only in compact brief). */ maxDocChars?: number; /** * The session's working directory. When it is an isolation mirror, the brief * reports what a PREVIOUS attempt left behind (adopted uncommitted files, or * a task branch it resumed from). Without this the agent sees a clean tree, * concludes nothing was done, and re-implements the same feature from the * plan - the double-work failure this section exists to prevent. */ workingDir?: string; /** * Per-run report key (`-`, tool `runId`, …). When set, * the brief tells the agent to write its narrative to the per-run file * `~/.teamshare/reports/.md`; the runner uploads it as this run's * report. Absent, the brief falls back to the legacy per-task path. */ runReportKey?: string; /** * When true, the brief carries no `## Run report` section at all. * For sessions that file no report (orchestrator planner passes). */ omitRunReport?: boolean; /** * This agent's USER id (2026-11). Lets the brief tell a reply to the agent's * OWN comment apart from a reply to another agent's/human's comment, so a * direct reply can be named as such instead of read as generic context. */ selfUserId?: string; } /** * "A human answered the question you asked" block (2026-10). * * The resume-on-answer path used to require a LOCAL harness session: with no * record on this PC the wake was skipped and the answer dropped outright. It * now starts a fresh session instead, which creates a new problem - a fresh * session has no memory of having asked anything, so the answer is just another * line in "Recent comment activity (context only)", three lines down, under a * heading that tells the agent not to treat it as an obligation. * * So the brief states the fact outright, in the READ FIRST region beside the * other two obligations. It is derived from the comment thread the brief already * fetches, rather than threaded down from the wake, so every spawn path gets it * (run, plan, build, worker) without a new argument to pass through four CLI * commands. */ export declare function answeredQuestionLines(comments: Comment[]): string[]; /** * The tree the session was handed (2026-11-18). * * Two things about the BASE a run must never have to guess: * - it was put on the task's own branch and UPDATED from the branch the task * started from, so "the code I am reading is current" is true; * - if that update CONFLICTED, the conflict is sitting in the working tree * right now, and the agent is the one who resolves it (the bridge never * guesses a resolution). Silence here would mean the agent works around * conflict markers, or commits them. */ export declare function treeStateLines(workingDir?: string): string[]; export declare function fetchTaskBrief(api: TeamshareApi, taskId: string, opts?: BriefOptions): Promise; /** Best-effort heartbeat wrapper - never throws. */ export declare function reportStatus(api: TeamshareApi, agentId: string, status: 'online' | 'working' | 'offline', taskId?: string, sessionId?: string): Promise; /** * Deterministically moves a picked-up task to `in_progress`. The bridge owns * this transition (it must not depend on the harness/LLM). Only writes when the * task is still `open`, so a resumed or already-progressing task is never * disturbed. Best-effort: never throws; returns true when the write succeeded. */ export declare function markTaskInProgress(api: TeamshareApi, taskId: string, currentStatus?: string): Promise; /** * Reopens a task after a failed / incomplete run (in_progress -> open) so it * can be retried. Best-effort and never throws; the caller guards it to tasks * the bridge itself moved to in_progress. */ export declare function reopenRunTask(api: TeamshareApi, taskId: string): Promise; /** Posts the closing summary comment - best-effort, never throws. */ export declare function postClosingComment(api: TeamshareApi, taskId: string, summary: string): Promise; /** Waits for the task to leave open/in_progress, or times out. */ export declare function waitForTaskCompletion(api: TeamshareApi, taskId: string, pollMs?: number, maxWaitMs?: number, onProgress?: (status: string) => void): Promise;