import type { PortableTool } from "../portable-tool.js";
export declare const MONITOR_TOOL_NAME: "monitor";
/** The kind of event source the agent can monitor. */
export type MonitorSource = "process" | "file" | "task" | "custom";
export type MonitorAction = "start" | "stop" | "list";
export interface MonitorToolParams {
    action: MonitorAction;
    /** Required for start/stop — identifies the monitor instance. */
    monitorId?: string;
    /** Required for start — what kind of event source to watch. */
    source?: MonitorSource;
    /** Required for start — selector for the target (pid, path, taskId, custom key). */
    target?: string;
    /** Optional for start — conditions that should trigger wake-up. */
    conditions?: MonitorCondition[];
    /** Optional for start — max time to monitor in seconds before auto-stop. */
    timeoutSeconds?: number;
}
export interface MonitorCondition {
    /** What to check: exit code, stdout pattern, file modification, task status. */
    type: "exit" | "output_match" | "file_changed" | "task_status";
    /** Pattern or value to match (regex for output_match, status name for task_status). */
    value?: string;
}
export declare const MONITOR_TOOL_SCHEMA: {
    readonly type: "object";
    readonly properties: {
        readonly action: {
            readonly type: "string";
            readonly enum: readonly ["start", "stop", "list"];
            readonly description: "Action to perform: start a new monitor, stop an existing one, or list active monitors.";
        };
        readonly monitorId: {
            readonly type: "string";
            readonly description: "Identifier for the monitor instance. Required for start/stop.";
        };
        readonly source: {
            readonly type: "string";
            readonly enum: readonly ["file"];
            readonly description: "Type of event source to watch. Currently only \"file\" is supported.";
        };
        readonly target: {
            readonly type: "string";
            readonly description: "Selector for the monitored target. For file: a path or glob pattern.";
        };
        readonly conditions: {
            readonly type: "array";
            readonly items: {
                readonly type: "object";
                readonly properties: {
                    readonly type: {
                        readonly type: "string";
                        readonly enum: readonly ["exit", "output_match", "file_changed", "task_status"];
                    };
                    readonly value: {
                        readonly type: "string";
                    };
                };
                readonly required: readonly ["type"];
            };
            readonly description: "Conditions that trigger a wake-up notification.";
        };
        readonly timeoutSeconds: {
            readonly type: "number";
            readonly description: "Auto-stop after this many seconds (default: 3600).";
            readonly minimum: 1;
            readonly maximum: 86400;
        };
    };
    readonly required: readonly ["action"];
};
/** Info about an active monitor. */
export interface MonitorInfo {
    monitorId: string;
    source: MonitorSource;
    target: string;
    conditions: MonitorCondition[];
    startedAt: number;
    timeoutSeconds: number;
    /** Events received so far. */
    eventCount: number;
}
/** Result of monitor operations. */
export interface MonitorResult {
    action: MonitorAction;
    success: boolean;
    monitorId?: string;
    monitors?: MonitorInfo[];
    error?: string;
}
/**
 * Runtime dependencies injected by the host.
 *
 * The host is responsible for:
 * 1. Actually watching the event source (polling, inotify, process hooks, etc.)
 * 2. Delivering notifications back to the agent loop (via tick or wake-up)
 * 3. Cleaning up monitors when they time out or are stopped.
 */
export interface MonitorToolDeps {
    /** Start monitoring a target. Returns the created monitor info. */
    startMonitor(params: {
        monitorId: string;
        source: MonitorSource;
        target: string;
        conditions: MonitorCondition[];
        timeoutSeconds: number;
    }): Promise<MonitorResult>;
    /** Stop an active monitor. */
    stopMonitor(monitorId: string): Promise<MonitorResult>;
    /** List all active monitors for this session. */
    listMonitors(): Promise<MonitorInfo[]>;
}
export declare function createMonitorTool(deps: MonitorToolDeps): PortableTool<MonitorToolParams>;
