/** * SERV Photon Executor * * Executes photons with SERV context (session, OAuth, tenant isolation). * Wraps the PhotonLoader with SERV-specific input/output handling. */ import type { Session, Tenant } from '../types/index.js'; import type { OAuthFlowHandler } from '../auth/oauth.js'; import type { TokenVault } from '../vault/token-vault.js'; import { OAuthContext, OAuthElicitationRequired, type OAuthAsk } from './oauth-context.js'; export interface ExecutorConfig { oauthFlow: OAuthFlowHandler; tokenVault: TokenVault; } export interface ExecutionContext { session: Session; tenant: Tenant; photonId: string; } export interface ExecutionResult { success: boolean; result?: unknown; error?: { code: string; message: string; data?: unknown; }; } /** * SERV Photon Executor * * Provides a SERV-aware execution environment for photons: * - OAuth token management via yields * - Session-scoped execution * - Tenant isolation */ export declare class PhotonExecutor { private config; constructor(config: ExecutorConfig); /** * Create an OAuth context for a photon execution */ createOAuthContext(context: ExecutionContext): OAuthContext; /** * Create an input provider with OAuth support * * @param context - Execution context * @param fallbackProvider - Provider for non-OAuth asks */ createInputProvider(context: ExecutionContext, fallbackProvider?: (ask: Record) => Promise): (ask: OAuthAsk | Record) => Promise; /** * Format an error for MCP response */ formatError(error: unknown): ExecutionResult; } /** * Check if an error is an OAuth elicitation request */ export declare function isOAuthElicitationError(error: unknown): error is OAuthElicitationRequired; /** * Format OAuth elicitation error for MCP tool response * * Returns a structured error that MCP clients can understand * and potentially auto-handle (e.g., opening auth URL in browser). */ export declare function formatElicitationToolResponse(error: OAuthElicitationRequired): { content: Array<{ type: 'text'; text: string; annotations?: { mimeType?: string; }; }>; isError: boolean; }; //# sourceMappingURL=executor.d.ts.map