import type { Db } from "@zmeel/db";
import type { ExecutionWorkspace, ExecutionWorkspaceConfig } from "@zmeel/shared";
import { agents } from "@zmeel/db";
import type { AdapterSessionCodec } from "../adapters/index.js";
import { type BudgetEnforcementScope } from "./budgets.js";
import { type ExecutionWorkspaceInput, type RealizedExecutionWorkspace } from "./workspace-runtime.js";
import { resolveExecutionWorkspaceMode } from "./execution-workspace-policy.js";
import { type SessionCompactionPolicy } from "@zmeel/adapter-utils";
export declare function applyPersistedExecutionWorkspaceConfig(input: {
    config: Record<string, unknown>;
    workspaceConfig: ExecutionWorkspaceConfig | null;
    mode: ReturnType<typeof resolveExecutionWorkspaceMode>;
}): {
    [x: string]: unknown;
};
export declare function stripWorkspaceRuntimeFromExecutionRunConfig(config: Record<string, unknown>): {
    [x: string]: unknown;
};
export declare function buildRealizedExecutionWorkspaceFromPersisted(input: {
    base: ExecutionWorkspaceInput;
    workspace: ExecutionWorkspace;
}): RealizedExecutionWorkspace | null;
interface WakeupOptions {
    source?: "timer" | "assignment" | "on_demand" | "automation";
    triggerDetail?: "manual" | "ping" | "callback" | "system";
    reason?: string | null;
    payload?: Record<string, unknown> | null;
    idempotencyKey?: string | null;
    requestedByActorType?: "user" | "agent" | "system";
    requestedByActorId?: string | null;
    contextSnapshot?: Record<string, unknown>;
}
export type ResolvedWorkspaceForRun = {
    cwd: string;
    source: "project_primary" | "task_session" | "agent_home";
    projectId: string | null;
    workspaceId: string | null;
    repoUrl: string | null;
    repoRef: string | null;
    workspaceHints: Array<{
        workspaceId: string;
        cwd: string | null;
        repoUrl: string | null;
        repoRef: string | null;
    }>;
    warnings: string[];
};
type ProjectWorkspaceCandidate = {
    id: string;
};
export declare function prioritizeProjectWorkspaceCandidatesForRun<T extends ProjectWorkspaceCandidate>(rows: T[], preferredWorkspaceId: string | null | undefined): T[];
type ResumeSessionRow = {
    sessionParamsJson: Record<string, unknown> | null;
    sessionDisplayId: string | null;
    lastRunId: string | null;
};
export declare function buildExplicitResumeSessionOverride(input: {
    resumeFromRunId: string;
    resumeRunSessionIdBefore: string | null;
    resumeRunSessionIdAfter: string | null;
    taskSession: ResumeSessionRow | null;
    sessionCodec: AdapterSessionCodec;
}): {
    sessionDisplayId: string | null;
    sessionParams: Record<string, unknown> | null;
} | null;
export declare function parseSessionCompactionPolicy(agent: typeof agents.$inferSelect): SessionCompactionPolicy;
export declare function resolveRuntimeSessionParamsForWorkspace(input: {
    agentId: string;
    previousSessionParams: Record<string, unknown> | null;
    resolvedWorkspace: ResolvedWorkspaceForRun;
}): {
    sessionParams: Record<string, unknown> | null;
    warning: string | null;
};
/**
 * Extended task key derivation that falls back to a stable synthetic key
 * for timer/heartbeat wakes. This ensures timer wakes can resume their
 * previous session via `agentTaskSessions` instead of starting fresh.
 *
 * The synthetic key is only used when:
 * - No explicit task/issue key exists in the context
 * - The wake source is "timer" (scheduled heartbeat)
 */
export declare function deriveTaskKeyWithHeartbeatFallback(contextSnapshot: Record<string, unknown> | null | undefined, payload: Record<string, unknown> | null | undefined): string | null;
export declare function shouldResetTaskSessionForWake(contextSnapshot: Record<string, unknown> | null | undefined): boolean;
export declare function formatRuntimeWorkspaceWarningLog(warning: string): {
    stream: "stdout";
    chunk: string;
};
export declare function heartbeatService(db: Db): {
    list: (companyId: string, agentId?: string, limit?: number) => Promise<{
        resultJson: Record<string, unknown> | null;
        id: string;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        status: string;
        startedAt: Date | null;
        finishedAt: Date | null;
        error: string | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
        createdAt: Date;
        updatedAt: Date;
    }[]>;
    getRun: (runId: string) => Promise<{
        error: string | null;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        startedAt: Date | null;
        finishedAt: Date | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        resultJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
    }>;
    getRuntimeState: (agentId: string) => Promise<{
        sessionDisplayId: string | null;
        sessionParamsJson: Record<string, unknown> | null;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        adapterType: string;
        agentId: string;
        sessionId: string | null;
        stateJson: Record<string, unknown>;
        lastRunId: string | null;
        lastRunStatus: string | null;
        totalInputTokens: number;
        totalOutputTokens: number;
        totalCachedInputTokens: number;
        totalCostCents: number;
        lastError: string | null;
    } | null>;
    listTaskSessions: (agentId: string) => Promise<{
        id: string;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        adapterType: string;
        agentId: string;
        lastRunId: string | null;
        lastError: string | null;
        taskKey: string;
        sessionParamsJson: Record<string, unknown> | null;
        sessionDisplayId: string | null;
    }[]>;
    resetRuntimeSession: (agentId: string, opts?: {
        taskKey?: string | null;
    }) => Promise<{
        sessionDisplayId: null;
        sessionParamsJson: null;
        clearedTaskSessions: number;
        agentId: string;
        companyId: string;
        adapterType: string;
        sessionId: string | null;
        stateJson: Record<string, unknown>;
        lastRunId: string | null;
        lastRunStatus: string | null;
        totalInputTokens: number;
        totalOutputTokens: number;
        totalCachedInputTokens: number;
        totalCostCents: number;
        lastError: string | null;
        createdAt: Date;
        updatedAt: Date;
    } | null>;
    listEvents: (runId: string, afterSeq?: number, limit?: number) => Omit<import("drizzle-orm/pg-core").PgSelectBase<"heartbeat_run_events", {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "heartbeat_run_events";
            dataType: "number";
            columnType: "PgBigSerial53";
            data: number;
            driverParam: number;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        companyId: import("drizzle-orm/pg-core").PgColumn<{
            name: "company_id";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        runId: import("drizzle-orm/pg-core").PgColumn<{
            name: "run_id";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        agentId: import("drizzle-orm/pg-core").PgColumn<{
            name: "agent_id";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        seq: import("drizzle-orm/pg-core").PgColumn<{
            name: "seq";
            tableName: "heartbeat_run_events";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        eventType: import("drizzle-orm/pg-core").PgColumn<{
            name: "event_type";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        stream: import("drizzle-orm/pg-core").PgColumn<{
            name: "stream";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        level: import("drizzle-orm/pg-core").PgColumn<{
            name: "level";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        color: import("drizzle-orm/pg-core").PgColumn<{
            name: "color";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        message: import("drizzle-orm/pg-core").PgColumn<{
            name: "message";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        payload: import("drizzle-orm/pg-core").PgColumn<{
            name: "payload";
            tableName: "heartbeat_run_events";
            dataType: "json";
            columnType: "PgJsonb";
            data: Record<string, unknown>;
            driverParam: unknown;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: Record<string, unknown>;
        }>;
        createdAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "created_at";
            tableName: "heartbeat_run_events";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    }, "single", Record<"heartbeat_run_events", "not-null">, false, "where" | "orderBy" | "limit", {
        level: string | null;
        id: number;
        createdAt: Date;
        companyId: string;
        payload: Record<string, unknown> | null;
        agentId: string;
        runId: string;
        color: string | null;
        seq: number;
        eventType: string;
        stream: string | null;
        message: string | null;
    }[], {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "heartbeat_run_events";
            dataType: "number";
            columnType: "PgBigSerial53";
            data: number;
            driverParam: number;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        companyId: import("drizzle-orm/pg-core").PgColumn<{
            name: "company_id";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        runId: import("drizzle-orm/pg-core").PgColumn<{
            name: "run_id";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        agentId: import("drizzle-orm/pg-core").PgColumn<{
            name: "agent_id";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        seq: import("drizzle-orm/pg-core").PgColumn<{
            name: "seq";
            tableName: "heartbeat_run_events";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        eventType: import("drizzle-orm/pg-core").PgColumn<{
            name: "event_type";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        stream: import("drizzle-orm/pg-core").PgColumn<{
            name: "stream";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        level: import("drizzle-orm/pg-core").PgColumn<{
            name: "level";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        color: import("drizzle-orm/pg-core").PgColumn<{
            name: "color";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        message: import("drizzle-orm/pg-core").PgColumn<{
            name: "message";
            tableName: "heartbeat_run_events";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        payload: import("drizzle-orm/pg-core").PgColumn<{
            name: "payload";
            tableName: "heartbeat_run_events";
            dataType: "json";
            columnType: "PgJsonb";
            data: Record<string, unknown>;
            driverParam: unknown;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: Record<string, unknown>;
        }>;
        createdAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "created_at";
            tableName: "heartbeat_run_events";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    }>, "where" | "orderBy" | "limit">;
    readLog: (runId: string, opts?: {
        offset?: number;
        limitBytes?: number;
    }) => Promise<{
        content: string;
        nextOffset?: number;
        runId: string;
        store: string;
        logRef: string;
    }>;
    invoke: (agentId: string, source?: "timer" | "assignment" | "on_demand" | "automation", contextSnapshot?: Record<string, unknown>, triggerDetail?: "manual" | "ping" | "callback" | "system", actor?: {
        actorType?: "user" | "agent" | "system";
        actorId?: string | null;
    }) => Promise<{
        error: string | null;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        startedAt: Date | null;
        finishedAt: Date | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        resultJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
    } | null>;
    wakeup: (agentId: string, opts?: WakeupOptions) => Promise<{
        error: string | null;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        startedAt: Date | null;
        finishedAt: Date | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        resultJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
    } | null>;
    reportRunActivity: (runId: string) => Promise<{
        id: string;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        status: string;
        startedAt: Date | null;
        finishedAt: Date | null;
        error: string | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        resultJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
        createdAt: Date;
        updatedAt: Date;
    } | null>;
    reapOrphanedRuns: (opts?: {
        staleThresholdMs?: number;
    }) => Promise<{
        reaped: number;
        runIds: string[];
    }>;
    resumeQueuedRuns: () => Promise<void>;
    tickTimers: (now?: Date) => Promise<{
        checked: number;
        enqueued: number;
        skipped: number;
    }>;
    cancelRun: (runId: string) => Promise<{
        error: string | null;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        startedAt: Date | null;
        finishedAt: Date | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        resultJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
    }>;
    cancelActiveForAgent: (agentId: string) => Promise<number>;
    cancelBudgetScopeWork: (scope: BudgetEnforcementScope) => Promise<void>;
    getActiveRunForAgent: (agentId: string) => Promise<{
        error: string | null;
        id: string;
        status: string;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        agentId: string;
        invocationSource: string;
        triggerDetail: string | null;
        startedAt: Date | null;
        finishedAt: Date | null;
        wakeupRequestId: string | null;
        exitCode: number | null;
        signal: string | null;
        usageJson: Record<string, unknown> | null;
        resultJson: Record<string, unknown> | null;
        sessionIdBefore: string | null;
        sessionIdAfter: string | null;
        logStore: string | null;
        logRef: string | null;
        logBytes: number | null;
        logSha256: string | null;
        logCompressed: boolean;
        stdoutExcerpt: string | null;
        stderrExcerpt: string | null;
        errorCode: string | null;
        externalRunId: string | null;
        processPid: number | null;
        processStartedAt: Date | null;
        retryOfRunId: string | null;
        processLossRetryCount: number;
        contextSnapshot: Record<string, unknown> | null;
    }>;
};
export {};
//# sourceMappingURL=heartbeat.d.ts.map