UNPKG

@adobe/genstudio-extensibility-sdk

Version:
48 lines (47 loc) 1.83 kB
import { VirtualApi } from "@adobe/uix-core"; import { GenerationContext, AdditionalContext } from "../types/generationContext/GenerationContext"; export interface PromptExtensionApi extends VirtualApi { api: { promptExtension: { open: (extensionId: string) => void; close: () => void; getGenerationContext: () => Promise<GenerationContext>; updateAdditionalContext: (additionalContext: AdditionalContext<any>) => void; }; }; } export declare class PromptExtensionServiceError extends Error { constructor(message: string); } /** * Manages prompt extension functionality */ export declare class PromptExtensionService { /** * Opens the prompt extension * @param connection - The guest connection to the host * @param extensionId - The ID of the extension to open * @throws Error if connection is missing */ static open(connection: any, extensionId: string): void; /** * Closes the prompt extension * @param connection - The guest connection to the host * @throws Error if connection is missing */ static close(connection: any): void; /** * Gets the generation context from the prompt extension * @param connection - The guest connection to the host * @returns Promise<GenerationContext> The generation context * @throws Error if connection is missing */ static getGenerationContext(connection: any): Promise<GenerationContext>; /** * Updates the additional context in the prompt extension * @param connection - The guest connection to the host * @param context - The additional context to update * @throws Error if connection is missing */ static updateAdditionalContext(connection: any, context: AdditionalContext<any>): void; }