/**
 * Orchestrator Setup Service
 *
 * Provides a service-level entrypoint for triggering orchestrator setup,
 * mirroring the logic behind `POST /api/orchestrator/setup`. Used by the
 * SlackBridge auto-recovery path so it can reattempt setup without going
 * through HTTP.
 *
 * Design notes:
 * - Dependencies are injected via `setOrchestratorSetupDependencies()` from
 *   the bootstrap layer (`backend/src/index.ts`), keeping this service
 *   decoupled from the API context shape.
 * - Concurrent calls are deduplicated via an in-flight promise — if a
 *   setup is already running, the second caller awaits the same result.
 * - Callers should impose their own timeout on the returned promise; this
 *   service does not enforce a timeout because setup duration varies per
 *   runtime type.
 *
 * @module services/orchestrator/orchestrator-setup.service
 */
import { type RuntimeType } from '../../constants.js';
import type { StorageService } from '../core/storage.service.js';
/**
 * Minimal contract expected from the agent registration service.
 *
 * Defined as an inline structural type rather than imported to avoid a
 * circular module graph (agent-registration → orchestrator → bridge →
 * agent-registration). Matches `AgentRegistrationService.createAgentSession`.
 */
export interface AgentRegistrationServiceLike {
    createAgentSession(config: {
        sessionName: string;
        role: string;
        projectPath: string;
        windowName: string;
        runtimeType: RuntimeType;
        forceRecreate?: boolean;
        additionalAllowlistPaths?: string[];
    }): Promise<{
        success: boolean;
        sessionName?: string;
        message?: string;
        error?: string;
    }>;
}
/**
 * Result of `triggerOrchestratorSetup()`.
 */
export interface OrchestratorSetupResult {
    /** Whether the setup attempt succeeded (or the orchestrator was already healthy). */
    success: boolean;
    /** Session name if setup succeeded. */
    sessionName?: string;
    /** Human-readable status message. */
    message?: string;
    /** Error message if setup failed. */
    error?: string;
    /** True when setup was skipped because the orchestrator was already healthy. */
    skipped?: boolean;
}
/**
 * Injected dependencies wired by the bootstrap layer.
 */
interface SetupDependencies {
    agentRegistrationService: AgentRegistrationServiceLike;
    storageService: StorageService;
}
/**
 * Wire the dependencies needed to trigger setup from any caller.
 *
 * Must be called once during bootstrap, after the agent registration service
 * is created. Passing the same dependencies twice is safe (last write wins).
 *
 * @param deps - Required service dependencies
 *
 * @example
 * ```typescript
 * setOrchestratorSetupDependencies({
 *   agentRegistrationService,
 *   storageService,
 * });
 * ```
 */
export declare function setOrchestratorSetupDependencies(deps: SetupDependencies): void;
/**
 * Reset injected dependencies. Test-only helper.
 *
 * @internal
 */
export declare function _resetOrchestratorSetupDependenciesForTesting(): void;
/**
 * Trigger orchestrator setup if it is not already healthy.
 *
 * Steps:
 * 1. Health-check via `getOrchestratorStatus()` — if active, return early.
 * 2. Resolve runtime type from persisted orchestrator status (default: claude-code).
 * 3. Call `createAgentSession()` with `forceRecreate: true`.
 * 4. Initialize memory and start chat monitoring (best-effort).
 *
 * Concurrent callers receive the same in-flight promise — at most one setup
 * runs at a time across the process.
 *
 * The orchestrator's conversation history (`AgentRunner.state.messages`) is
 * left empty after this call. The registration path skips the activation
 * kickoff message for the orchestrator session — this preserves the B1
 * `messageCount === 0` cold-start invariant.
 *
 * @returns Setup result. `skipped: true` if the orchestrator was already healthy.
 *
 * @throws Never — errors are returned in the result object instead.
 */
export declare function triggerOrchestratorSetup(): Promise<OrchestratorSetupResult>;
export {};
//# sourceMappingURL=orchestrator-setup.service.d.ts.map