/**
 * Coordinator Prompt — System prompt template for mesh coordinator sessions
 *
 * When an MCP server starts in mesh mode, this prompt is injected into the
 * coordinator agent's context so it understands:
 *   1. What the mesh is (repo, nodes, policy)
 *   2. What tools are available
 *   3. How to orchestrate work across nodes
 *
 * The prompt is generated dynamically from the current mesh state.
 *
 * User customization:
 *   ~/.adhdev/coordinator-prompts/<cliType>.md         — full override
 *   ~/.adhdev/coordinator-prompts/<cliType>.append.md  — appended to default
 *   ~/.adhdev/coordinator-prompts/default.md           — full override (any CLI)
 *   ~/.adhdev/coordinator-prompts/default.append.md    — appended to default (any CLI)
 *
 * CLI-specific files take precedence over default.* files. The override file
 * still gets the node/policy facts substituted via the same {{placeholders}}
 * the daemon understands; an override that doesn't reference them just gets
 * a static prompt, which is also fine.
 */
import type { LocalMeshEntry, RepoMeshStatus } from '../repo-mesh-types.js';
import type { MagiKindPanelMap } from '@adhdev/mesh-shared';
/**
 * Cheap, locally-derived "what just happened" snapshot for the coordinator
 * prompt. Built at launch from the local ledger + work-queue stats — no remote
 * peer probe. Surfaces the gap a fresh coordinator otherwise misses: it can't
 * see recent failures / queue depth until it manually calls mesh_task_history.
 *
 * All fields are optional so callers that have nothing to report (or fail to
 * read the ledger) simply omit the section — the prompt output stays identical
 * to the pre-activity form in that case.
 */
export interface CoordinatorRecentActivity {
    /** task_failed entries from the recent window, newest last. */
    recentFailures?: Array<{
        timestamp?: string;
        nodeId?: string;
        /** Short task title/message, already truncated by the caller. */
        summary?: string;
    }>;
    /** Count of task_failed entries inside the recent window. */
    recentFailureCount?: number;
    /**
     * Size of the "recent" window in minutes. Drives the "failed in the last
     * N min" phrasing. Omitted → defaults to 30, matching the prior hardcoded
     * wording so existing callers render identically.
     */
    windowMinutes?: number;
    /** Pending (unclaimed) tasks in the work queue. */
    pendingTasks?: number;
    /** Assigned-but-not-yet-terminal tasks in the work queue. */
    assignedTasks?: number;
    /** Stalled tasks recorded in the ledger. */
    stalledTasks?: number;
    /** ISO timestamp of the most recent ledger activity, if any. */
    lastActivityAt?: string | null;
}
/**
 * One coordinator operating note — a runtime-accumulated lesson (provider
 * quirk, pattern to avoid, recovery lesson) persisted in the ledger so it
 * survives coordinator restarts and is provider-neutral (visible to codex /
 * hermes / antigravity coordinators, not just Claude's memory).
 */
export interface CoordinatorOperatingNote {
    text: string;
    category?: 'provider_quirk' | 'pattern_to_avoid' | 'recovery_lesson';
    createdAt?: string;
    sourceCoordinator?: string;
}
export interface CoordinatorPromptContext {
    mesh: LocalMeshEntry;
    status?: RepoMeshStatus;
    userInstruction?: string;
    coordinatorCliType?: string;
    /**
     * M3: pre-rendered active mission section (from buildMissionPromptSection).
     * Empty/undefined when the mesh has no active mission — the prompt output
     * stays identical to the pre-M3 form in that case.
     */
    missionSection?: string;
    /**
     * Gap1: recent ledger/queue activity surfaced so a freshly-launched
     * coordinator sees recent failures + queue depth without first calling
     * mesh_task_history. Omitted → no "## Recent Activity" section.
     */
    recentActivity?: CoordinatorRecentActivity;
    /**
     * Gap2-A: runtime-accumulated operating notes (provider-neutral lessons)
     * read from the ledger at launch. Omitted/empty → no "## Operating Notes"
     * section.
     */
    operatingNotes?: CoordinatorOperatingNote[];
    /**
     * Machine-local MAGI kind-panel bindings (`~/.adhdev/meshes.json`
     * `magiKindPanels`), read live at launch. Omitted / empty / all-empty →
     * no "## Configured MAGI panels" section, so a mesh with no MAGI configured
     * renders identically to before. Threaded in the same systematic way as the
     * brain presets: read machine-local config at launch, render a pure section.
     */
    magiKindPanels?: MagiKindPanelMap;
}
export declare function buildCoordinatorSystemPrompt(ctx: CoordinatorPromptContext): string;
/**
 * Render the machine-local MAGI kind-panel bindings so the coordinator KNOWS
 * which cross-verification panels (rca / design / claim_audit / freeform) are
 * actually configured on this machine. Without this the coordinator only sees
 * the `mesh_magi_*` tools in the static table and has no idea MAGI is set up.
 *
 * Pure — takes the panels map (read live at launch, mirroring how brain presets
 * read getDifficultyBrains). Returns null (section OMITTED) when nothing usable
 * is configured: undefined/null map, or every kind maps to an empty slot list.
 * That keeps a MAGI-less mesh's prompt byte-identical to before.
 */
export declare function buildMagiKindPanelsSection(panels: MagiKindPanelMap | undefined | null): string | null;
