import type { AgentControllerEvent } from '@mastra/core/agent-controller'; import { z } from 'zod'; import type { AuditActorType } from '../storage/domains/audit/base.js'; import type { AuditRecorder } from '../storage/domains/audit/domain.js'; export declare const FACTORY_OPEN_RUNS_SETTING = "factoryOpenRuns"; declare const factoryOpenRunSchema: z.ZodObject<{ kickoffId: z.ZodString; bindingId: z.ZodString; role: z.ZodString; startedBy: z.ZodString; orgId: z.ZodString; factoryProjectId: z.ZodString; workItemId: z.ZodString; workItemName: z.ZodOptional; sessionId: z.ZodString; threadId: z.ZodString; branch: z.ZodString; ownerId: z.ZodOptional; heartbeatAt: z.ZodOptional; }, z.core.$strip>; export type FactoryOpenRun = z.infer; /** A heartbeat older than this means the owner is gone; nothing renews it once the run's dispatcher dies. */ export declare const FACTORY_OPEN_RUN_STALE_MS = 30000; export declare function isOpenRunLiveElsewhere(run: FactoryOpenRun, ownerId: string, now?: number): boolean; export interface RunEndCaptureSession { readonly thread: { getSetting(args: { key: string; }): Promise; setSetting(args: { key: string; value: unknown; }): Promise; }; subscribe(listener: (event: AgentControllerEvent) => void): () => void; } type RunEndReason = Extract['reason']; export declare function listSessionOpenRuns(session: RunEndCaptureSession): Promise; export declare function waitForSessionRunAudit(session: RunEndCaptureSession): Promise; export declare function recordSessionRunStart(session: RunEndCaptureSession, { audit, run, actorType, observedEnd, }: { audit: AuditRecorder; run: FactoryOpenRun; actorType: AuditActorType; observedEnd: () => RunEndReason; }): Promise; /** Renew this process's claim on an open run so other replicas keep treating it as live. */ export declare function heartbeatSessionOpenRun(session: RunEndCaptureSession, kickoffId: string, at?: number): Promise; export declare function observeSessionRunEnd(session: RunEndCaptureSession, { audit }: { audit: AuditRecorder; }): () => void; export {}; //# sourceMappingURL=run-audit.d.ts.map