import { GitHandoffBranchDivergence } from '@posthog/git/handoff';
import { PostHogAPIClient } from './posthog-api.js';
import { HandoffLocalGitState, GitCheckpoint } from './types.js';
import { L as Logger } from './logger-RC7sPv0S.js';
import '@posthog/shared';
import '@posthog/shared/domain-types';

/**
 * Handoff artifacts used to be stored as base64 text (inline uploads without
 * content_encoding); direct-to-storage uploads store raw bytes. Detect raw
 * git payloads by their magic bytes and fall back to the legacy base64
 * decode otherwise.
 */
declare function decodeHandoffArtifact(buffer: Buffer): Buffer;
interface HandoffCheckpointTrackerConfig {
    repositoryPath: string;
    taskId: string;
    runId: string;
    apiClient?: PostHogAPIClient;
    logger?: Logger;
}
declare class HandoffCheckpointTracker {
    private repositoryPath;
    private taskId;
    private runId;
    private apiClient?;
    private logger;
    constructor(config: HandoffCheckpointTrackerConfig);
    captureForHandoff(localGitState?: HandoffLocalGitState): Promise<GitCheckpoint | null>;
    applyFromHandoff(checkpoint: GitCheckpoint, options?: {
        localGitState?: HandoffLocalGitState;
        onDivergedBranch?: (divergence: GitHandoffBranchDivergence) => Promise<boolean>;
    }): Promise<{
        packBytes: number;
        indexBytes: number;
        totalBytes: number;
    }>;
    private toGitCheckpoint;
    private uploadArtifactFile;
    private uploadArtifactDirect;
    private postToPresignedUrl;
    private uploadArtifactInline;
    private uploadArtifacts;
    private downloadArtifactToFile;
    private downloadArtifacts;
    private createGitTracker;
    private logCaptureMetrics;
    private logApplyMetrics;
    private sumRawBytes;
    private removeIfPresent;
}

export { HandoffCheckpointTracker, type HandoffCheckpointTrackerConfig, decodeHandoffArtifact };
