import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
/**
 * A plan being written by a live Plan-mode execution, detected mid-stream so
 * the UI can promote it to a document surface (panel plan tab + compact thread
 * card) instead of letting it dump into the chat as a giant streaming bubble.
 */
export interface StreamingPlan {
    /** Index of the plan message in `execution.status.messages`. */
    readonly messageIndex: number;
    /**
     * The plan text to render on document surfaces: the message content with
     * any enclosing plan fence stripped, streaming-tolerantly (an unterminated
     * opening fence is stripped too — see {@link findStreamingPlan}). Purely a
     * display projection; the stored message is never mutated.
     */
    readonly displayText: string;
}
/**
 * Detects the plan a live Plan-mode execution is currently writing, or
 * `undefined` when the execution has no recognizable plan in flight.
 *
 * This is the third leg of the plan convention, alongside the runner's prompt
 * directive ("your FINAL message IS the plan, starting with a single `#`
 * title" — `plan-mode-prompt.ts`) and the completion-time artifact detection
 * by filename ({@link isPlanArtifact}). Completion makes the plan unambiguous
 * (the published `plan.md` artifact); mid-stream it must be inferred, and the
 * directive's mandated shape is the inference:
 *
 * - the execution runs in Plan mode and is **non-terminal** (a completed turn
 *   is owned by the artifact path; a stopped/failed turn has no live plan),
 * - the candidate is the **last content-bearing `MESSAGE_AI`** — the exact
 *   selection rule the runner's `extractFinalPlanText` and the thread's
 *   `findPlanMessageIndex` share, so all three stay in lockstep,
 * - and that candidate opens with an `# H1` title (after tolerating an
 *   enclosing plan fence, see {@link unwrapStreamingPlanFence}) — the shape
 *   the directive mandates and narration essentially never has.
 *
 * Degradation is graceful by design: a model that ignores the directive
 * simply streams its plan in the thread as before, and the completion-time
 * pipeline is unaffected either way. Only the LAST content-bearing AI message
 * is ever considered — an earlier message is settled narration, and falling
 * back to it would promote the wrong text.
 */
export declare function findStreamingPlan(execution: AgentExecution | null | undefined): StreamingPlan | undefined;
//# sourceMappingURL=detect-streaming-plan.d.ts.map