/** * base.skill.ts * * Defines the abstract base class that every Playwright Pilot AI skill must extend. * * A "skill" is a single-purpose analysis module that inspects a PageAnalysis * object and returns a SkillResult containing locators, optional generated code, * element contexts, and a confidence score. Skills are run locally without any * AI calls and are orchestrated by the SkillOrchestrator. * * The base class provides: * - The abstract name and execute() contract that all skills must implement. * - A protected buildResult() helper so each skill can construct a well-formed * SkillResult without repeating boilerplate. * * Role in the overall flow: * SkillOrchestrator → BaseSkill.execute() → SkillResult */ import { ElementContext, SkillContext, SkillResult } from '../types'; /** * Abstract base class for all Playwright Pilot AI analysis skills. * * Each skill analyses the current page state (via SkillContext) and returns * a SkillResult with locators, element contexts, optional generated code, * and a confidence score between 0 and 1. */ export declare abstract class BaseSkill { /** Unique identifier for this skill, used by the SkillOrchestrator registry. */ abstract readonly name: string; /** * Run this skill against the given context and return a result. * * @param ctx - The skill context including the full page analysis and optional * user prompt, failure context, slug, and class name. * @returns A SkillResult with selectors, element contexts, optional code, and confidence. */ abstract execute(ctx: SkillContext): Promise; /** * Helper to construct a well-formed SkillResult from this skill's outputs. * * @param selectors - Playwright locator expression strings found by this skill. * @param confidence - How confident the skill is in its results (0–1). * @param generatedCode - Optional TypeScript code snippet produced by this skill. * @param metadata - Optional extra data stored alongside the result (e.g. step arrays). * @param elementContexts - Optional element context objects for Page Object generation. * @returns A fully formed SkillResult. */ protected buildResult(selectors: string[], confidence: number, generatedCode?: string, metadata?: Record, elementContexts?: ElementContext[]): SkillResult; } //# sourceMappingURL=base.skill.d.ts.map