/**
 * Test Context for Orchestration E2E Tests
 *
 * Provides isolated test workspace setup and teardown for orchestration tests.
 * Each test run gets a completely isolated temporary directory with:
 * - Fresh git repository
 * - Minimal project structure
 * - Temporary SQLite database
 * - All required services configured
 *
 * @module
 */
import type { EventEmitter } from 'node:events';
import type { EntityId, Task } from '@stoneforge/core';
import type { QuarryAPI, InboxService } from '@stoneforge/quarry';
import type { OrchestratorAPI, AgentEntity } from '../api/index.js';
import type { AgentRegistry } from '../services/agent-registry.js';
import type { SessionManager } from '../runtime/session-manager.js';
import type { DispatchDaemon } from '../services/dispatch-daemon.js';
import type { WorktreeManager } from '../git/worktree-manager.js';
import type { TaskAssignmentService } from '../services/task-assignment-service.js';
import type { DispatchService } from '../services/dispatch-service.js';
import type { StewardScheduler } from '../services/steward-scheduler.js';
/**
 * Test context providing access to all services and utilities
 */
export interface TestContext {
    /** OrchestratorAPI for agent and task operations */
    readonly api: OrchestratorAPI;
    /** Underlying QuarryAPI */
    readonly stoneforgeApi: QuarryAPI;
    /** Dispatch daemon for task assignment */
    readonly daemon: DispatchDaemon;
    /** Session manager for agent sessions */
    readonly sessionManager: SessionManager;
    /** Agent registry for agent management */
    readonly agentRegistry: AgentRegistry;
    /** Worktree manager for git operations */
    readonly worktreeManager: WorktreeManager;
    /** Task assignment service */
    readonly taskAssignment: TaskAssignmentService;
    /** Dispatch service for task dispatch */
    readonly dispatchService: DispatchService;
    /** Steward scheduler for scheduled executions */
    readonly stewardScheduler: StewardScheduler;
    /** Inbox service for message handling */
    readonly inboxService: InboxService;
    /** Path to the temporary workspace */
    readonly tempWorkspace: string;
    /** Path to the database file */
    readonly dbPath: string;
    /** System entity ID for creating test data */
    readonly systemEntityId: EntityId;
    /** Log a message to the test output */
    readonly log: (message: string) => void;
    /** Whether verbose logging is enabled */
    readonly verbose: boolean;
    /** Test mode: 'mock' uses mock sessions, 'real' spawns Claude processes */
    readonly mode: 'mock' | 'real';
    /** Cleanup function - call when tests are done */
    readonly cleanup: () => Promise<void>;
}
/**
 * Options for creating a test context
 */
export interface TestContextOptions {
    /** Enable verbose logging (default: false) */
    readonly verbose?: boolean;
    /** Custom temp directory prefix (default: 'orchestration-test-') */
    readonly tempPrefix?: string;
    /** Poll interval for daemon in ms (default: 2000) */
    readonly pollIntervalMs?: number;
    /** Skip daemon startup (default: false) */
    readonly skipDaemonStart?: boolean;
    /** Test mode: 'mock' (default) or 'real' (spawns Claude processes) */
    readonly mode?: 'mock' | 'real';
}
/**
 * Mock session manager for testing without real Claude processes
 */
export interface MockSessionManager extends SessionManager {
    /** Tracked mock sessions */
    readonly mockSessions: Map<string, MockSession>;
    /** Create a mock session for an agent */
    createMockSession(agentId: EntityId, options?: MockSessionOptions): MockSession;
    /** Complete a mock session */
    completeMockSession(sessionId: string): void;
}
/**
 * Mock session for testing
 */
export interface MockSession {
    readonly id: string;
    readonly agentId: EntityId;
    readonly workingDirectory: string;
    readonly worktree?: string;
    readonly status: 'running' | 'terminated';
    readonly events: EventEmitter;
}
/**
 * Options for creating a mock session
 */
export interface MockSessionOptions {
    readonly workingDirectory?: string;
    readonly worktree?: string;
}
/**
 * Sets up an isolated test context for orchestration tests.
 *
 * Creates:
 * - Temporary directory with git repo
 * - Minimal project structure
 * - Fresh SQLite database
 * - All required services
 *
 * @param options - Setup options
 * @returns The test context
 *
 * @example
 * ```typescript
 * const ctx = await setupTestContext({ verbose: true });
 * try {
 *   // Run tests...
 * } finally {
 *   await ctx.cleanup();
 * }
 * ```
 */
export declare function setupTestContext(options?: TestContextOptions): Promise<TestContext>;
/**
 * Creates a mock session manager that simulates agent sessions
 * without actually spawning Claude processes.
 */
export declare function createMockSessionManager(agentRegistry: AgentRegistry): MockSessionManager;
/**
 * Creates a test worker agent.
 */
export declare function createTestWorker(ctx: TestContext, name: string, options?: {
    workerMode?: 'ephemeral' | 'persistent';
}): Promise<AgentEntity>;
/**
 * Creates a test director agent.
 */
export declare function createTestDirector(ctx: TestContext, name: string): Promise<AgentEntity>;
/**
 * Creates a test steward agent.
 */
export declare function createTestSteward(ctx: TestContext, name: string, options?: {
    focus?: 'merge' | 'docs' | 'recovery' | 'custom';
    triggers?: Array<{
        type: 'cron';
        schedule: string;
    } | {
        type: 'event';
        event: string;
    }>;
}): Promise<AgentEntity>;
/**
 * Creates a test task.
 */
export declare function createTestTask(ctx: TestContext, title: string, options?: {
    priority?: number;
    description?: string;
    tags?: string[];
    acceptanceCriteria?: string;
}): Promise<Task>;
/**
 * Sends a message to an agent's channel.
 */
export declare function sendTestMessage(ctx: TestContext, agentId: EntityId, content: string): Promise<void>;
//# sourceMappingURL=test-context.d.ts.map