import { Container } from "inversify"; import { CallToolResult, Server } from "@modelcontextprotocol/server"; import { Span } from "@opentelemetry/api"; import { IncomingMessage } from "node:http"; import { z } from "zod"; //#region src/constants/playwright-types.d.ts /** * InversifyJS DI container binding tokens. * Maps service names to unique Symbol identifiers for dependency injection. * * DESIGN PATTERNS: * - Token map pattern for IoC container bindings * - Uses named constants from service-ids to avoid magic strings * - Frozen object (as const) to prevent runtime modification * * CODING STANDARDS: * - Import service ID constants instead of using inline strings * - Keep in sync with container module registrations * - Use Symbol.for() for cross-module symbol sharing * * AVOID: * - Adding entries without corresponding container bindings * - Using Symbol() instead of Symbol.for() (breaks cross-module resolution) */ declare const PLAYWRIGHT_TYPES: { readonly ProfileService: symbol; readonly ProxyConfigService: symbol; readonly PageRegistry: symbol; readonly BrowserService: symbol; readonly BrowserProcessRegistry: symbol; readonly ElementLocatorService: symbol; readonly PageMonitorService: symbol; readonly PauseController: symbol; readonly AutomationRunner: symbol; readonly SpecRunner: symbol; readonly SpecBundlerService: symbol; readonly SpecDiscoveryService: symbol; readonly SpecMetadataService: symbol; readonly SetupRunner: symbol; readonly WebServerManager: symbol; readonly Logger: symbol; readonly TelemetryService: symbol; readonly CodeSnippetService: symbol; readonly HttpServerHealthCheck: symbol; readonly HttpServerManager: symbol; readonly HttpBrowserClient: symbol; readonly RemoteToolExecutor: symbol; readonly ExtensionTaskQueue: symbol; readonly ExtensionToolDelegator: symbol; readonly ToolExecutor: symbol; readonly StealthLauncher: symbol; readonly BrowserLockManager: symbol; readonly ExtensionSessionRegistry: symbol; readonly ExtensionPageProxy: symbol; readonly ExtensionSpecRunner: symbol; readonly McpSessionTracker: symbol; readonly ChromeForTestingService: symbol; readonly WebSocketHub: symbol; readonly IdleCleanupService: symbol; readonly PortRegistryService: symbol; readonly McpPortAllocationService: symbol; readonly ProcessRegistryService: symbol; readonly Tool: symbol; }; //#endregion //#region src/container/index.d.ts /** * @deprecated Use createMcpContainer() or createHttpContainer() instead. */ declare const container: Container; /** * @deprecated Use createMcpContainer() or createHttpContainer() instead. */ declare function createContainer(): Container; //#endregion //#region src/prompts/CustomScriptAuthoringPrompt.d.ts declare const customScriptAuthoringPrompt: { name: string; description: string; arguments: { name: string; description: string; required: boolean; }[]; }; interface GenerateCustomScriptAuthoringPromptArgs { toolGoal: string; toolName?: string; pageContext?: string; } declare function generateCustomScriptAuthoringPrompt(args: GenerateCustomScriptAuthoringPromptArgs): Array<{ role: string; content: { type: string; text: string; }; }>; //#endregion //#region src/server/index.d.ts /** Logger interface for dependency injection */ interface Logger { debug(message: string, context?: Record): void; info(message: string, context?: Record): void; warn(message: string, context?: Record): void; error(message: string, context?: Record): void; runInSpan?(name: string, context: Record, callback: (span: Span | undefined) => Promise | T): Promise; } /** * Error thrown when an unknown tool is requested. * Provides error code, recovery suggestion, and available tools list. */ declare class UnknownToolError extends Error { readonly code = "UNKNOWN_TOOL"; readonly recovery = "Use ListTools to see available tools."; readonly availableTools: string[]; constructor(toolName: string, availableTools: string[], options?: ErrorOptions); } /** * Error thrown when tool execution fails. * Provides error code, tool name context, and recovery suggestion. */ declare class ToolExecutionError extends Error { readonly code = "TOOL_EXECUTION_ERROR"; readonly recovery: string; readonly toolName: string; constructor(toolName: string, message: string, options?: ErrorOptions & { recovery?: string; }); } /** * Configuration options for the MCP server. */ interface ServerConfig { /** Optional IoC container (defaults to the shared container) */ container?: Container; /** Optional logger for debugging and error tracking */ logger?: Logger; } /** * Creates a new MCP server instance with tools from the IoC container. * @param config - Optional server configuration * @returns Configured MCP Server instance */ declare function createServer(config?: ServerConfig): Server; //#endregion //#region src/transports/stdio.d.ts /** * Stdio transport handler for MCP server * Used for command-line and direct integrations */ declare class StdioTransportHandler { private readonly serverFactory; private readonly canRestart; private handle; private started; constructor(server: Server | (() => Server)); start(): Promise; stop(): Promise; } //#endregion //#region src/transports/streamable-http.d.ts /** A fresh MCP server is constructed for every modern HTTP request. */ interface StreamableHttpSessionContext { server: Server; /** Application-owned browser resources are released on transport shutdown, never per request. */ onClose?: () => Promise | void; } interface StreamableHttpSessionRequest { headers: IncomingMessage['headers']; } interface StreamableHttpTransportConfig { host: string; port: number; path?: string; /** Pins application-owned browser state until this HTTP exchange completes. */ onRequestStart?: (request: StreamableHttpSessionRequest) => () => void; } /** Modern, stateless HTTP handler; browser ownership lives in the application, not MCP sessions. */ declare class StreamableHttpTransportHandler { private readonly config; private readonly onRequestStart?; private readonly mcpHandler; private readonly nodeHandler; private readonly closeHandlers; private readonly validateHost; private readonly validateOrigin; private httpServer; constructor(sessionFactory: (request: StreamableHttpSessionRequest) => StreamableHttpSessionContext, config: StreamableHttpTransportConfig); start(): Promise; stop(): Promise; } //#endregion //#region src/validation/tool-definition.d.ts declare const JSON_SCHEMA_TYPES: readonly ["object", "string", "number", "boolean", "array", "integer", "null"]; declare const ToolDefinitionSchema: z.ZodObject<{ name: z.ZodString; title: z.ZodOptional; description: z.ZodString; inputSchema: z.ZodRecord; annotations: z.ZodOptional>; }, z.core.$strip>; //#endregion //#region src/types/spec.d.ts /** * Spec Types - Type definitions for enhanced spec execution * * DESIGN PATTERNS: * - Interface-based type definitions for type safety * - Separation of concerns: metadata, config, filtering, project info * * CODING STANDARDS: * - All interfaces have JSDoc documentation * - Types use 'interface' for object shapes * - Optional properties marked with '?' * * AVOID: * - Using 'type' for object shapes (prefer interface) * - Using 'any' type */ /** * Generic schema interface for argument validation. * Compatible with Zod schemas - uses parse method for validation. */ interface ArgsSchema { /** Parse and validate input data, throws on invalid input */ parse(data: unknown): Record; /** Safe parse that returns success/error result */ safeParse?(data: unknown): { success: boolean; data?: Record; error?: unknown; }; } /** * Metadata extracted from a spec file. * Contains information about dynamic arguments and environment prefix. */ interface SpecMetadata { /** Schema for spec arguments validation (compatible with Zod) */ argsSchema: ArgsSchema | null; /** Environment variable prefix for argument parsing (e.g., 'SPEC_LOGIN_') */ envPrefix: string | null; /** Whether the spec has dynamic arguments */ hasDynamicArgs: boolean; } /** * Web server configuration for starting a dev server before running specs. * Compatible with Playwright's webServer config. */ interface WebServerConfig { /** Command to start the server (e.g., 'npm run dev') */ command: string; /** URL to wait for before running tests */ url: string; /** Whether to reuse an existing server if one is running */ reuseExistingServer?: boolean; /** Timeout in milliseconds to wait for the server to start */ timeout?: number; /** Working directory for the server command */ cwd?: string; } /** * Playwright MCP configuration extracted from playwright.config.ts. * Contains MCP-specific settings for spec execution. */ interface PlaywrightMcpConfig { /** Base URL for relative navigation */ baseURL?: string; /** Path to setup file to run before specs */ setupFile?: string; /** Export name in setup file (default: 'default') */ setupExport?: string; /** Web server configuration */ webServer?: WebServerConfig; } /** * Filter options for selecting which tests to run. * Multiple filters are combined with AND logic. */ interface TestFilter { /** Filter by exact test name */ testName?: string; /** Filter by regex pattern on full test title */ testPattern?: string; /** Run only tests marked with test.only() */ onlyMarked?: boolean; /** Filter by describe block name pattern */ describeFilter?: string; } /** * E2E project configuration for multi-project test setups. * Represents a logical grouping of specs within a project. */ interface E2EProject { /** Project name (e.g., 'desktop', 'mobile') */ name: string; /** Project root path */ path: string; /** Path to playwright.config.ts */ configPath?: string; /** Test directory relative to project path */ testDir?: string; /** List of spec files in this project */ specs: SpecInfo[]; } /** * Information about a single spec file. * Used for listing and selecting specs to run. */ interface SpecInfo { /** Spec file name without path */ name: string; /** Absolute path to the spec file */ path: string; /** Path relative to project root */ relativePath: string; /** Whether the spec exports an argsSchema */ hasArgsSchema: boolean; /** Number of tests in the spec */ testCount: number; } //#endregion //#region src/types/index.d.ts /** * JSON Schema type values supported in tool input schemas */ type JsonSchemaType = (typeof JSON_SCHEMA_TYPES)[number]; /** * Tool definition for MCP, derived from Zod schema */ type ToolDefinition = z.infer; /** * Structured success result from tool execution */ interface ToolSuccessResult extends CallToolResult { isError: false; } /** * Structured failure result from tool execution */ interface ToolFailureResult extends CallToolResult { isError: true; } /** * Discriminated union for tool execution outcomes */ type ToolResult = ToolSuccessResult | ToolFailureResult; /** * Base tool interface following MCP SDK patterns. * Returns CallToolResult for SDK compatibility. * Use ToolResult to narrow success/failure when isError is set. */ interface Tool { getDefinition(): ToolDefinition; getInputSchema(): z.ZodObject; execute(input: TInput): Promise; } //#endregion export { type ArgsSchema, type E2EProject, JsonSchemaType, type Logger, PLAYWRIGHT_TYPES, type PlaywrightMcpConfig, type ServerConfig, type SpecInfo, type SpecMetadata, StdioTransportHandler, type StreamableHttpSessionContext, type StreamableHttpSessionRequest, type StreamableHttpTransportConfig, StreamableHttpTransportHandler, type TestFilter, Tool, ToolDefinition, ToolExecutionError, ToolFailureResult, ToolResult, ToolSuccessResult, UnknownToolError, type WebServerConfig, container, createContainer, createServer, customScriptAuthoringPrompt, generateCustomScriptAuthoringPrompt }; //# sourceMappingURL=index.d.cts.map