import type { Db } from "@zmeel/db";
import { agents } from "@zmeel/db";
interface RevisionMetadata {
    createdByAgentId?: string | null;
    createdByUserId?: string | null;
    source?: string;
    rolledBackFromRevisionId?: string | null;
}
interface UpdateAgentOptions {
    recordRevision?: RevisionMetadata;
}
interface AgentShortnameRow {
    id: string;
    name: string;
    status: string;
}
interface AgentShortnameCollisionOptions {
    excludeAgentId?: string | null;
}
export declare function hasAgentShortnameCollision(candidateName: string, existingAgents: AgentShortnameRow[], options?: AgentShortnameCollisionOptions): boolean;
export declare function deduplicateAgentName(candidateName: string, existingAgents: AgentShortnameRow[]): string;
export declare function agentService(db: Db): {
    list: (companyId: string, options?: {
        includeTerminated?: boolean;
    }) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    })[]>;
    getById: (id: string) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    create: (companyId: string, data: Omit<typeof agents.$inferInsert, "companyId">) => Promise<{
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }>;
    update: (id: string, data: Partial<typeof agents.$inferInsert>, options?: UpdateAgentOptions) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    pause: (id: string, reason?: "manual" | "budget" | "system") => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    resume: (id: string) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    terminate: (id: string) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    remove: (id: string) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    activatePendingApproval: (id: string) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    updatePermissions: (id: string, permissions: {
        canCreateAgents: boolean;
    }) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    listConfigRevisions: (id: string) => Promise<{
        id: string;
        createdAt: Date;
        companyId: string;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        agentId: string;
        source: string;
        rolledBackFromRevisionId: string | null;
        changedKeys: string[];
        beforeConfig: Record<string, unknown>;
        afterConfig: Record<string, unknown>;
    }[]>;
    getConfigRevision: (id: string, revisionId: string) => Promise<{
        id: string;
        createdAt: Date;
        companyId: string;
        createdByAgentId: string | null;
        createdByUserId: string | null;
        agentId: string;
        source: string;
        rolledBackFromRevisionId: string | null;
        changedKeys: string[];
        beforeConfig: Record<string, unknown>;
        afterConfig: Record<string, unknown>;
    }>;
    rollbackConfigRevision: (id: string, revisionId: string, actor: {
        agentId?: string | null;
        userId?: string | null;
    }) => Promise<({
        permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
        id: string;
        name: string;
        status: string;
        pauseReason: string | null;
        pausedAt: Date | null;
        budgetMonthlyCents: number;
        spentMonthlyCents: number;
        createdAt: Date;
        updatedAt: Date;
        companyId: string;
        role: string;
        title: string | null;
        icon: string | null;
        reportsTo: string | null;
        capabilities: string | null;
        adapterType: string;
        adapterConfig: Record<string, unknown>;
        runtimeConfig: Record<string, unknown>;
        lastHeartbeatAt: Date | null;
        metadata: Record<string, unknown> | null;
    } & {
        urlKey: string;
    }) | null>;
    createApiKey: (id: string, name: string) => Promise<{
        id: string;
        name: string;
        token: string;
        createdAt: Date;
    }>;
    listKeys: (id: string) => Omit<import("drizzle-orm/pg-core").PgSelectBase<"agent_api_keys", {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "agent_api_keys";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        name: import("drizzle-orm/pg-core").PgColumn<{
            name: "name";
            tableName: "agent_api_keys";
            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;
        }, {}, {}>;
        createdAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "created_at";
            tableName: "agent_api_keys";
            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;
        }, {}, {}>;
        revokedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "revoked_at";
            tableName: "agent_api_keys";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    }, "partial", Record<"agent_api_keys", "not-null">, false, "where", {
        id: string;
        name: string;
        createdAt: Date;
        revokedAt: Date | null;
    }[], {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "agent_api_keys";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        name: import("drizzle-orm/pg-core").PgColumn<{
            name: "name";
            tableName: "agent_api_keys";
            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;
        }, {}, {}>;
        createdAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "created_at";
            tableName: "agent_api_keys";
            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;
        }, {}, {}>;
        revokedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "revoked_at";
            tableName: "agent_api_keys";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    }>, "where">;
    revokeKey: (keyId: string) => Promise<{
        id: string;
        agentId: string;
        companyId: string;
        name: string;
        keyHash: string;
        lastUsedAt: Date | null;
        revokedAt: Date | null;
        createdAt: Date;
    }>;
    orgForCompany: (companyId: string) => Promise<Record<string, unknown>[]>;
    getChainOfCommand: (agentId: string) => Promise<{
        id: string;
        name: string;
        role: string;
        title: string | null;
    }[]>;
    runningForAgent: (agentId: string) => Omit<import("drizzle-orm/pg-core").PgSelectBase<"heartbeat_runs", {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            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_runs";
            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_runs";
            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;
        }, {}, {}>;
        invocationSource: import("drizzle-orm/pg-core").PgColumn<{
            name: "invocation_source";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        triggerDetail: import("drizzle-orm/pg-core").PgColumn<{
            name: "trigger_detail";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        status: import("drizzle-orm/pg-core").PgColumn<{
            name: "status";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        startedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "started_at";
            tableName: "heartbeat_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        finishedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "finished_at";
            tableName: "heartbeat_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        error: import("drizzle-orm/pg-core").PgColumn<{
            name: "error";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        wakeupRequestId: import("drizzle-orm/pg-core").PgColumn<{
            name: "wakeup_request_id";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        exitCode: import("drizzle-orm/pg-core").PgColumn<{
            name: "exit_code";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        signal: import("drizzle-orm/pg-core").PgColumn<{
            name: "signal";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        usageJson: import("drizzle-orm/pg-core").PgColumn<{
            name: "usage_json";
            tableName: "heartbeat_runs";
            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>;
        }>;
        resultJson: import("drizzle-orm/pg-core").PgColumn<{
            name: "result_json";
            tableName: "heartbeat_runs";
            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>;
        }>;
        sessionIdBefore: import("drizzle-orm/pg-core").PgColumn<{
            name: "session_id_before";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        sessionIdAfter: import("drizzle-orm/pg-core").PgColumn<{
            name: "session_id_after";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logStore: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_store";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logRef: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_ref";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logBytes: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_bytes";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgBigInt53";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        logSha256: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_sha256";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logCompressed: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_compressed";
            tableName: "heartbeat_runs";
            dataType: "boolean";
            columnType: "PgBoolean";
            data: boolean;
            driverParam: boolean;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        stdoutExcerpt: import("drizzle-orm/pg-core").PgColumn<{
            name: "stdout_excerpt";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        stderrExcerpt: import("drizzle-orm/pg-core").PgColumn<{
            name: "stderr_excerpt";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        errorCode: import("drizzle-orm/pg-core").PgColumn<{
            name: "error_code";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        externalRunId: import("drizzle-orm/pg-core").PgColumn<{
            name: "external_run_id";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        processPid: import("drizzle-orm/pg-core").PgColumn<{
            name: "process_pid";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        processStartedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "process_started_at";
            tableName: "heartbeat_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        retryOfRunId: import("drizzle-orm/pg-core").PgColumn<{
            name: "retry_of_run_id";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        processLossRetryCount: import("drizzle-orm/pg-core").PgColumn<{
            name: "process_loss_retry_count";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        contextSnapshot: import("drizzle-orm/pg-core").PgColumn<{
            name: "context_snapshot";
            tableName: "heartbeat_runs";
            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_runs";
            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;
        }, {}, {}>;
        updatedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "updated_at";
            tableName: "heartbeat_runs";
            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_runs", "not-null">, false, "where", {
        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;
    }[], {
        id: import("drizzle-orm/pg-core").PgColumn<{
            name: "id";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            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_runs";
            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_runs";
            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;
        }, {}, {}>;
        invocationSource: import("drizzle-orm/pg-core").PgColumn<{
            name: "invocation_source";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        triggerDetail: import("drizzle-orm/pg-core").PgColumn<{
            name: "trigger_detail";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        status: import("drizzle-orm/pg-core").PgColumn<{
            name: "status";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        startedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "started_at";
            tableName: "heartbeat_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        finishedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "finished_at";
            tableName: "heartbeat_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        error: import("drizzle-orm/pg-core").PgColumn<{
            name: "error";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        wakeupRequestId: import("drizzle-orm/pg-core").PgColumn<{
            name: "wakeup_request_id";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        exitCode: import("drizzle-orm/pg-core").PgColumn<{
            name: "exit_code";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        signal: import("drizzle-orm/pg-core").PgColumn<{
            name: "signal";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        usageJson: import("drizzle-orm/pg-core").PgColumn<{
            name: "usage_json";
            tableName: "heartbeat_runs";
            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>;
        }>;
        resultJson: import("drizzle-orm/pg-core").PgColumn<{
            name: "result_json";
            tableName: "heartbeat_runs";
            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>;
        }>;
        sessionIdBefore: import("drizzle-orm/pg-core").PgColumn<{
            name: "session_id_before";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        sessionIdAfter: import("drizzle-orm/pg-core").PgColumn<{
            name: "session_id_after";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logStore: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_store";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logRef: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_ref";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logBytes: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_bytes";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgBigInt53";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        logSha256: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_sha256";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        logCompressed: import("drizzle-orm/pg-core").PgColumn<{
            name: "log_compressed";
            tableName: "heartbeat_runs";
            dataType: "boolean";
            columnType: "PgBoolean";
            data: boolean;
            driverParam: boolean;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        stdoutExcerpt: import("drizzle-orm/pg-core").PgColumn<{
            name: "stdout_excerpt";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        stderrExcerpt: import("drizzle-orm/pg-core").PgColumn<{
            name: "stderr_excerpt";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        errorCode: import("drizzle-orm/pg-core").PgColumn<{
            name: "error_code";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        externalRunId: import("drizzle-orm/pg-core").PgColumn<{
            name: "external_run_id";
            tableName: "heartbeat_runs";
            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;
        }, {}, {}>;
        processPid: import("drizzle-orm/pg-core").PgColumn<{
            name: "process_pid";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        processStartedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "process_started_at";
            tableName: "heartbeat_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        retryOfRunId: import("drizzle-orm/pg-core").PgColumn<{
            name: "retry_of_run_id";
            tableName: "heartbeat_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        processLossRetryCount: import("drizzle-orm/pg-core").PgColumn<{
            name: "process_loss_retry_count";
            tableName: "heartbeat_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        contextSnapshot: import("drizzle-orm/pg-core").PgColumn<{
            name: "context_snapshot";
            tableName: "heartbeat_runs";
            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_runs";
            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;
        }, {}, {}>;
        updatedAt: import("drizzle-orm/pg-core").PgColumn<{
            name: "updated_at";
            tableName: "heartbeat_runs";
            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">;
    resolveByReference: (companyId: string, reference: string) => Promise<{
        readonly agent: null;
        readonly ambiguous: false;
    } | {
        readonly agent: {
            permissions: import("./agent-permissions.js").NormalizedAgentPermissions;
            id: string;
            name: string;
            status: string;
            pauseReason: string | null;
            pausedAt: Date | null;
            budgetMonthlyCents: number;
            spentMonthlyCents: number;
            createdAt: Date;
            updatedAt: Date;
            companyId: string;
            role: string;
            title: string | null;
            icon: string | null;
            reportsTo: string | null;
            capabilities: string | null;
            adapterType: string;
            adapterConfig: Record<string, unknown>;
            runtimeConfig: Record<string, unknown>;
            lastHeartbeatAt: Date | null;
            metadata: Record<string, unknown> | null;
        } & {
            urlKey: string;
        };
        readonly ambiguous: false;
    } | {
        readonly agent: null;
        readonly ambiguous: true;
    }>;
};
export {};
//# sourceMappingURL=agents.d.ts.map