/** * Macro Recording Types * * Types for macro recording, playback, and management. * * @since v1.58.2 */ import type { Tier } from '../../core/types/auth.js'; /** * A recorded macro */ export interface Macro { /** Unique identifier */ id: string; /** User-friendly name */ name: string; /** Optional description */ description?: string; /** Recorded steps */ steps: MacroStep[]; /** When the macro was created */ createdAt: number; /** When the macro was last modified */ updatedAt: number; /** Assigned register slot (q, w, e, r) */ register?: string; /** Tags for organization */ tags?: string[]; } /** * A step in a macro */ export interface MacroStep { /** Step type */ type: MacroStepType; /** Step data (type-specific) */ data: MacroStepData; /** Timestamp relative to start (for timing playback) */ timestamp?: number; } /** * Types of macro steps */ export type MacroStepType = 'keypress' | 'input' | 'wait' | 'action' | 'assert'; /** * Union type for step data */ export type MacroStepData = KeypressData | InputData | WaitData | ActionData | AssertData; /** * Keypress step data */ export interface KeypressData { type: 'keypress'; /** Key that was pressed */ key: string; /** Modifier keys held */ modifiers?: ('ctrl' | 'alt' | 'shift' | 'meta')[]; } /** * Text input step data */ export interface InputData { type: 'input'; /** Input value */ value: string; /** Field identifier (optional) */ field?: string; } /** * Wait step data */ export interface WaitData { type: 'wait'; /** Duration in milliseconds */ duration: number; /** Optional condition to wait for */ condition?: string; } /** * Action step data */ export interface ActionData { type: 'action'; /** Action identifier (e.g., 'sync:all', 'update:check') */ action: string; /** Optional parameters */ params?: Record; } /** * Assertion step data */ export interface AssertData { type: 'assert'; /** Condition to check */ condition: string; /** Expected value */ expected: unknown; /** What to do on failure */ failAction?: 'stop' | 'continue' | 'skip'; } /** * Macro recorder state */ export interface MacroRecorderState { /** Whether recording is active */ isRecording: boolean; /** Current register being recorded to */ currentRegister: string | null; /** Steps recorded so far */ steps: MacroStep[]; /** When recording started */ startTime: number | null; /** Error if any */ error: string | null; } /** * Macro playback state */ export interface MacroPlaybackState { /** Whether playback is active */ isPlaying: boolean; /** Macro being played */ currentMacro: Macro | null; /** Current step index */ currentStep: number; /** Total steps */ totalSteps: number; /** Remaining loop iterations */ remainingLoops: number; /** Whether paused */ isPaused: boolean; /** Playback speed (1.0 = normal) */ speed: number; /** Error if any */ error: string | null; } /** * Macro library state */ export interface MacroLibrary { /** All saved macros */ macros: Macro[]; /** Quick-access registers (q, w, e, r) */ registers: Record; /** Last played macro ID */ lastPlayedId: string | null; } /** * Macro recorder configuration */ export interface MacroRecorderConfig { /** Whether recording is enabled */ enabled: boolean; /** User's tier for feature gating */ userTier: Tier; /** Maximum steps per macro */ maxSteps: number; /** Whether to record timing */ recordTiming: boolean; /** Default playback speed */ defaultSpeed: number; /** Available registers */ registers: string[]; } /** * Default macro recorder configuration */ export declare const DEFAULT_MACRO_CONFIG: MacroRecorderConfig; /** * Macro file format for import/export */ export interface MacroExportFormat { version: 1; exportedAt: number; macros: Macro[]; } /** * Create an empty macro */ export declare function createEmptyMacro(name: string, register?: string): Macro; /** * Create initial recorder state */ export declare function createInitialRecorderState(): MacroRecorderState; /** * Create initial playback state */ export declare function createInitialPlaybackState(): MacroPlaybackState; /** * Create initial library */ export declare function createInitialLibrary(): MacroLibrary; /** * Format a step for display */ export declare function formatStep(step: MacroStep): string; /** * Calculate total duration of a macro */ export declare function calculateMacroDuration(macro: Macro): number; /** * Validate a macro */ export declare function validateMacro(macro: Macro): { valid: boolean; errors: string[]; }; //# sourceMappingURL=macro-types.d.ts.map