/** * Photon Adapter * * Adapts Photon classes to the InternalMCP interface * Handles schema extraction and tool registration */ import { InternalMCP, InternalTool, InternalToolResult, SettingsSchema, NotificationSubscription } from './types.js'; import { PhotonMCP } from '@portel/photon-core'; import type { MCPClientFactory } from './mcp-client-factory.js'; import { ElicitationServer } from '../utils/elicitation-helper.js'; /** * Adapter that converts Photon instances to InternalMCP interface */ export declare class PhotonAdapter implements InternalMCP { readonly name: string; readonly description: string; tools: InternalTool[]; private instance; private mcpClass; private sourceFilePath?; private elicitationServer?; private mcpClientFactory?; private instanceStore?; /** * Settings schema from Photon's `protected settings = {...}` declaration * Extracted via photon-core's extractAllFromSource */ readonly settingsSchema?: SettingsSchema; /** * Notification subscriptions from Photon's @notify-on JSDoc tag */ readonly notificationSubscriptions?: NotificationSubscription; /** * Resolved settings instance - stores user-provided values * Prevents re-elicitation on every tool call */ private resolvedSettings?; private constructor(); /** * Inject MCP client factory into the Photon instance * Enables this.mcp('name') calls within Photons */ private injectMCPFactory; /** * Get MCP name from class (supports both Photon subclasses and plain classes) */ private getMCPName; /** * Create and initialize a PhotonAdapter * * @param mcpClass The Photon class * @param instance Instance of the Photon class * @param sourceFilePath Path to the source file (for schema extraction) * @param mcpClientFactory Optional MCP client factory for enabling this.mcp() calls * @param settingsSchema Optional settings schema from photon-core * @param notificationSubscriptions Optional notification subscriptions from photon-core */ static create(mcpClass: typeof PhotonMCP, instance: PhotonMCP, sourceFilePath?: string, mcpClientFactory?: MCPClientFactory, settingsSchema?: SettingsSchema, notificationSubscriptions?: NotificationSubscription): Promise; /** * Get tool methods from class (supports both Photon subclasses and plain classes) */ private getToolMethods; /** * Initialize tools from class methods */ private initializeTools; /** * Extract schemas from .schema.json or TypeScript source code * Uses extractAllFromSource to get full metadata including settings and notifications */ private extractSchemasFromSource; /** * Create basic tools without detailed schemas (fallback) */ private createBasicTools; /** * Set the elicitation server for generator input prompts and settings elicitation */ setElicitationServer(server: ElicitationServer): void; /** * Elicit required settings from user if not already resolved * Returns resolved settings to be injected into Photon instance */ private elicitRequiredSettings; /** * Inject resolved settings into Photon instance */ private injectSettings; /** * Create input provider for generator ask yields using MCP elicitation * Supports the new ask/emit pattern from photon-core 1.2.0 */ private createInputProvider; /** * Create output handler for generator emit yields * Logs progress, status, and other output types */ private createOutputHandler; /** * Execute a tool (supports both Photon subclasses, plain classes, and generators) * Automatically elicits and injects required settings before execution */ executeTool(toolName: string, parameters: any): Promise; } //# sourceMappingURL=photon-adapter.d.ts.map