/**
 * Stored custom notification following ACP extensibility model.
 * Custom notifications use underscore-prefixed methods (e.g., `_posthog/phase_start`).
 * See: https://agentclientprotocol.com/docs/extensibility
 */
interface StoredNotification {
    type: "notification";
    /** When this notification was stored */
    timestamp: string;
    /** JSON-RPC 2.0 notification (no id field = notification, not request) */
    notification: {
        jsonrpc: "2.0";
        method: string;
        params?: Record<string, unknown>;
    };
}
/**
 * Type alias for stored log entries.
 */
type StoredEntry = StoredNotification;
interface Task {
    id: string;
    task_number?: number;
    slug?: string;
    title: string;
    description: string;
    origin_product: "error_tracking" | "eval_clusters" | "user_created" | "support_queue" | "session_summaries";
    github_integration?: number | null;
    repository: string;
    json_schema?: Record<string, unknown> | null;
    created_at: string;
    updated_at: string;
    created_by?: {
        id: number;
        uuid: string;
        distinct_id: string;
        first_name: string;
        email: string;
    };
    latest_run?: TaskRun;
}
type ArtifactType = "plan" | "context" | "reference" | "output" | "artifact" | "tree_snapshot";
interface TaskRunArtifact {
    name: string;
    type: ArtifactType;
    size?: number;
    content_type?: string;
    storage_path?: string;
    uploaded_at?: string;
}
type TaskRunStatus = "not_started" | "queued" | "in_progress" | "completed" | "failed" | "cancelled";
type TaskRunEnvironment = "local" | "cloud";
interface TaskRun {
    id: string;
    task: string;
    team: number;
    branch: string | null;
    stage: string | null;
    environment: TaskRunEnvironment;
    status: TaskRunStatus;
    log_url: string;
    error_message: string | null;
    output: Record<string, unknown> | null;
    state: Record<string, unknown>;
    artifacts?: TaskRunArtifact[];
    created_at: string;
    updated_at: string;
    completed_at: string | null;
}
interface ProcessSpawnedCallback {
    onProcessSpawned?: (info: {
        pid: number;
        command: string;
        sessionId?: string;
    }) => void;
    onProcessExited?: (pid: number) => void;
}
interface TaskExecutionOptions {
    repositoryPath?: string;
    adapter?: "claude" | "codex";
    model?: string;
    codexBinaryPath?: string;
    processCallbacks?: ProcessSpawnedCallback;
}
type LogLevel = "debug" | "info" | "warn" | "error";
type OnLogCallback = (level: LogLevel, scope: string, message: string, data?: unknown) => void;
interface PostHogAPIConfig {
    apiUrl: string;
    getApiKey: () => string;
    projectId: number;
    userAgent?: string;
}
interface OtelTransportConfig {
    /** PostHog ingest host, e.g., "https://us.i.posthog.com" */
    host: string;
    /** Project API key */
    apiKey: string;
    /** Override the logs endpoint path (default: /i/v1/logs) */
    logsPath?: string;
}
interface AgentConfig {
    posthog?: PostHogAPIConfig;
    /** OTEL transport config for shipping logs to PostHog Logs */
    otelTransport?: OtelTransportConfig;
    /** Skip session log persistence (e.g. for preview sessions with no real task) */
    skipLogPersistence?: boolean;
    /** Local cache path for instant log loading (e.g., ~/.posthog-code) */
    localCachePath?: string;
    debug?: boolean;
    onLog?: OnLogCallback;
}
interface DeviceInfo {
    type: "local" | "cloud";
    name?: string;
}
type AgentMode = "interactive" | "background";
type FileStatus = "A" | "M" | "D";
interface FileChange {
    path: string;
    status: FileStatus;
}
interface TreeSnapshot {
    treeHash: string;
    baseCommit: string | null;
    archiveUrl?: string;
    changes: FileChange[];
    timestamp: string;
    interrupted?: boolean;
}
interface TreeSnapshotEvent extends TreeSnapshot {
    device?: DeviceInfo;
}

export type { AgentConfig, AgentMode, ArtifactType, DeviceInfo, FileChange, FileStatus, LogLevel, OnLogCallback, OtelTransportConfig, PostHogAPIConfig, ProcessSpawnedCallback, StoredEntry, StoredNotification, Task, TaskExecutionOptions, TaskRun, TaskRunArtifact, TaskRunEnvironment, TaskRunStatus, TreeSnapshot, TreeSnapshotEvent };
