/** * skill-orchestrator.ts * * Coordinates the execution of all Playwright Pilot AI skills against a page analysis, * decides which skills to run based on what the page contains, and merges the * results into a unified output. * * Skills are registered in a fixed registry at construction time. The * autoExecute() method selects which skills to run based on what the page * actually contains (e.g. form-detection only runs if forms are present), * runs them all in parallel, and merges the results. * * Merge strategy: * - Selectors: deduplicated union of all skill results * - ElementContexts: richer entries preferred (more fields win) * - Code: the playwright-generation skill's POM code is used exclusively * * The orchestrator also exposes an estimatePayloadSize() utility to check * whether the resulting element table would exceed the recommended AI token budget. * * Role in the overall flow: * generate_test → SkillOrchestrator.autoExecute() → SkillResult[] * → SkillOrchestrator.mergeResults() → pomCode + elementContexts */ import { ElementContext, SkillContext, SkillResult } from '../types'; /** Union of all valid skill names that can be passed to executeSkill() or executeSkills(). */ export type SkillName = 'playwright-generation' | 'semantic-locator' | 'assertion-generation' | 'healing' | 'navigation-detection' | 'form-detection' | 'table-detection' | 'popup-detection' | 'authentication-flow'; /** * Manages the skill registry, selects skills based on page content, runs them * in parallel, and merges their results. */ export declare class SkillOrchestrator { private registry; /** * Execute a single named skill against the given context. * * @param name - The name of the skill to run. * @param ctx - The skill context (page analysis, user prompt, etc.). * @returns The SkillResult produced by the skill. * @throws Error if the skill name is not registered. */ executeSkill(name: SkillName, ctx: SkillContext): Promise; /** * Execute multiple skills in parallel and return all their results. * * @param names - Array of skill names to run concurrently. * @param ctx - The shared skill context for all skills. * @returns An array of SkillResults in the same order as the input names. */ executeSkills(names: SkillName[], ctx: SkillContext): Promise; /** * Automatically select and run the appropriate skills based on what the page * contains, then return all results. * * playwright-generation and semantic-locator always run first. * Other skills are added based on the presence of forms, navigation, tables, * popups, a failure context, or auth-related keywords in the user prompt. * assertion-generation always runs last. * * @param ctx - The skill context including the full page analysis and optional user prompt. * @returns An array of SkillResults from every skill that ran. */ autoExecute(ctx: SkillContext): Promise; /** * Merge multiple SkillResults into a single unified output. * * Merging rules: * - selectors: deduplicated union of all selectors across all results * - elementContexts: richest version of each element wins (most fields set) * - code: taken exclusively from the playwright-generation skill result * * @param results - The array of SkillResults to merge. * @returns An object with deduplicated selectors, merged element contexts, and POM code. */ mergeResults(results: SkillResult[]): { selectors: string[]; elementContexts: ElementContext[]; code: string; }; /** * Estimate the approximate AI token cost of including the given element contexts * in a prompt, and report whether it exceeds the recommended 600-token budget. * * Estimation: ~12 tokens per row in the compact element table, plus 200 tokens * for prompt scaffolding. * * @param elementContexts - The element contexts to estimate for. * @returns An object with estimatedTokens and overBudget flag. */ estimatePayloadSize(elementContexts: ElementContext[]): { estimatedTokens: number; overBudget: boolean; }; } //# sourceMappingURL=skill-orchestrator.d.ts.map