/**
 * Live budget kill-switch for `agents cloud` dispatch (issue #399).
 *
 * Follow-up to #346, which shipped a pre-flight budget gate for cloud runs but
 * no live mid-run enforcement — a runaway cloud task would keep spending until
 * the user hit Ctrl-C. This wires the same `makeLiveSpendWatcher` the local
 * headless run uses (src/lib/exec.ts) into the cloud SSE stream: each `usage`
 * event from the provider feeds the watcher, and on breach we call
 * `provider.cancel(taskId)` to terminate server-side.
 *
 * Wrapper shape mirrors `renderStream`'s input — it takes an
 * `AsyncIterable<CloudEvent>` and yields the same events downstream. Dormant
 * (returns the source stream unchanged) when no caps are configured.
 */
import type { CloudProvider, CloudEvent } from '../cloud/types.js';
import { type BreachInfo } from './enforce.js';
/** Result surface exposed to the caller so it can act on a mid-stream breach. */
export interface CloudBudgetGate {
    /** True once a cap crossed and cancel() was invoked. */
    breached(): boolean;
    breach(): BreachInfo | null;
}
/**
 * Wrap a cloud event stream with a live budget watcher. On a `usage` event we
 * feed the shared watcher; on the first breach we call `provider.cancel(taskId)`
 * and forward a synthetic `status:'cancelled'` + `error` frame so the renderer
 * shows why the task stopped. Returns null when no caps are configured; callers
 * fall through to the raw stream in that case.
 */
export declare function wrapStreamWithBudgetGate(args: {
    provider: CloudProvider;
    taskId: string;
    /** Project attribution key — repo slug for Rush, or cwd. */
    project: string;
    /** Agent the dispatch runs under (for per_agent cap accounting). */
    agent: string;
    /** cwd used to resolve the effective budget config. */
    cwd?: string;
}): {
    wrap: (source: AsyncIterable<CloudEvent>) => AsyncIterable<CloudEvent>;
    gate: CloudBudgetGate;
} | null;
