/**
 * Orchestrator State Persistence Types
 *
 * Types for saving and restoring orchestrator state across
 * restarts, enabling continuous operation and self-improvement.
 *
 * @module types/orchestrator-state
 */
// =============================================================================
// Constants
// =============================================================================
/**
 * State file paths configuration
 */
export const STATE_PATHS = {
    STATE_DIR: '.crewly/state',
    CURRENT_STATE: 'orchestrator-state.json',
    BACKUP_DIR: 'backups',
    SELF_IMPROVEMENT_DIR: 'self-improvement',
};
/**
 * State version for migrations
 */
export const STATE_VERSION = '1.0.0';
/**
 * Maximum messages to persist per conversation
 */
export const MAX_PERSISTED_MESSAGES = 50;
/**
 * Checkpoint interval in milliseconds (1 minute)
 */
export const CHECKPOINT_INTERVAL_MS = 60000;
/**
 * Valid orchestrator modes array — single source of truth for runtime
 * validation and the type guard below.
 */
export const ORCHESTRATOR_MODES = [
    'normal',
    'onboarding',
    'onboarding-provisioning',
];
/**
 * Default orchestrator mode used when state is freshly initialized or
 * round-tripped from an older state file that predates the `mode` field.
 */
export const DEFAULT_ORCHESTRATOR_MODE = 'normal';
/**
 * Valid checkpoint reasons array
 */
export const CHECKPOINT_REASONS = [
    'scheduled',
    'before_restart',
    'task_completed',
    'user_request',
    'self_improvement',
    'error_recovery',
];
// =============================================================================
// Type Guards
// =============================================================================
/**
 * Check if a value is a valid CheckpointReason
 *
 * @param value - Value to check
 * @returns True if valid CheckpointReason
 */
export function isValidCheckpointReason(value) {
    return CHECKPOINT_REASONS.includes(value);
}
/**
 * Check if a value is a valid OrchestratorMode (Onboarding v3 — B2).
 *
 * Used by `state-persistence.service` when round-tripping a persisted
 * state to fall back to `DEFAULT_ORCHESTRATOR_MODE` if the file contains
 * a corrupted or future-unknown value. Narrows the input to the union.
 *
 * @param value - Value to check
 * @returns True if valid OrchestratorMode
 */
export function isValidOrchestratorMode(value) {
    return typeof value === 'string' && ORCHESTRATOR_MODES.includes(value);
}
/**
 * Check if a value is a valid TaskStatus
 *
 * @param value - Value to check
 * @returns True if valid TaskStatus
 */
export function isValidTaskStatus(value) {
    return ['pending', 'in_progress', 'blocked', 'paused', 'completed'].includes(value);
}
/**
 * Check if a value is a valid TaskPriority
 *
 * @param value - Value to check
 * @returns True if valid TaskPriority
 */
export function isValidTaskPriority(value) {
    return ['low', 'medium', 'high', 'critical'].includes(value);
}
/**
 * Check if a value is a valid ConversationSource
 *
 * @param value - Value to check
 * @returns True if valid ConversationSource
 */
export function isValidConversationSource(value) {
    return ['chat', 'slack', 'api'].includes(value);
}
//# sourceMappingURL=orchestrator-state.types.js.map