/**
 * Test pipeline processor for CLI-initiated test runs.
 *
 * Reuses the existing webhook processing pipeline steps (lock file fetch,
 * trigger matching, job dispatch) but injects a synthetic event instead
 * of processing a real webhook. This avoids the anti-pattern of calling
 * processWebhook() directly (which expects WebhookInfo from a real webhook).
 *
 * Key differences from processWebhook():
 * - Skips dedup check (test runs are always unique)
 * - Skips webhook normalization (event is already in SimulatedEvent shape)
 * - Skips repo extraction from payload (routing key is provided directly)
 * - deliveryId has `test:` prefix for identification
 * - Execution runs are marked with is_test_run=true and fixture_id
 * - Supports direct workflow execution (bypass trigger matching)
 */
import type { LockFileCache } from '../lockfile-cache.js';
import type { Dispatcher } from '../agent/dispatcher.js';
import type { CheckRunReporter } from '../reporting/check-run-reporter.js';
import type { ExecutionTracker } from '../reporting/execution-tracker.js';
import type { AgentRegistry } from '../agent/registry.js';
import type { ProviderRegistry } from '../provider-registry.js';
import type { SourceCache } from '../cache/index.js';
import type { BuildCoordinator } from '../cache/index.js';
import type { DepCache } from '../cache/index.js';
import type { PendingBuildTracker } from '../cache/index.js';
import type { SecretResolver } from '../secrets/secret-resolver.js';
import type { EnvironmentStore } from '../environments/environment-store.js';
import type { VariableStore } from '../environments/variable-store.js';
import type { LogStorage } from '../reporting/log-storage.js';
import type { Kysely } from 'kysely';
import type { Database } from '../db/types.js';
/**
 * Input for a test trigger request.
 */
export interface TestTriggerInput {
    /** Unique fixture identifier from the CLI. */
    fixtureId: string;
    /** The simulated event to inject into the pipeline. */
    event: {
        type: string;
        action?: string;
        targetBranch: string;
        sourceBranch?: string;
        payload: Record<string, unknown>;
        changedFiles?: string[];
    };
    /** Routing key for provider lookup and lock file fetch. */
    routingKey: string;
    /** Reference to uploaded tarball (optional). */
    uploadId?: string;
    /** Fixture secret context mappings (optional). */
    secrets?: Record<string, string>;
    /** Base64 X25519+AES-GCM blob of the developer's local secrets ({flat, contexts}). */
    encryptedSecrets?: string;
    /** Base64 ephemeral CLI public key that encrypted `encryptedSecrets`. */
    encryptedSecretsKey?: string;
    /** Direct workflow run -- bypass triggers (optional). */
    workflowName?: string;
    /** Resolved overlay metadata for tarball download + decryption. */
    resolvedOverlay?: {
        tarballUrl: string;
        cliPublicKey: string;
        orchestratorPrivateKey: string;
    };
    /** Request trace ID from the HTTP request. */
    requestId: string;
    /** JSON-stringified lock file content for local repos with no remote. */
    inlineLockFile?: string;
    /** When true, repo has no remote -- skip provider lookup, skip clone. */
    fullRepo?: boolean;
}
/**
 * Result of processing a test trigger.
 */
interface TestTriggerResult {
    /** Unique run identifier. */
    runId: string;
    /** Whether the test trigger was accepted or rejected. */
    status: 'accepted' | 'rejected';
    /** Reason for rejection (if rejected). */
    reason?: string;
    /** Dispatched job IDs. */
    jobIds: string[];
}
/**
 * Dependencies for the test pipeline processor.
 * All injected for testability.
 */
export interface TestPipelineDeps {
    lockFileCache: LockFileCache;
    dispatcher: Dispatcher;
    executionTracker?: ExecutionTracker;
    checkRunReporter?: CheckRunReporter;
    sourceCache?: SourceCache;
    buildCoordinator?: BuildCoordinator;
    depCache?: DepCache;
    pendingBuilds?: PendingBuildTracker;
    secretResolver?: SecretResolver;
    agentRegistry: AgentRegistry;
    providerRegistry: ProviderRegistry;
    /** Log storage for persisting test fixture payloads. Optional -- if not set, payload storage is skipped. */
    logStorage?: LogStorage;
    /** Database connection for environment protection checks. Optional. */
    db?: Kysely<Database>;
    /** Environment store for resolving environment ids in test dispatch parity. Optional. */
    environmentStore?: EnvironmentStore;
    /** Variable store for resolving environment variables in test dispatch parity. Optional. */
    variableStore?: VariableStore;
}
/**
 * Process a test trigger through the existing pipeline.
 *
 * Reuses pipeline steps starting from lock file fetch, skipping webhook
 * normalization and dedup. Supports both trigger-matched and direct
 * workflow execution modes.
 */
export declare function processTestTrigger(input: TestTriggerInput, deps: TestPipelineDeps): Promise<TestTriggerResult>;
export {};
//# sourceMappingURL=test-pipeline.d.ts.map