import { MessageConnection } from "vscode-jsonrpc/node"; import { Recipe, RecipeDescriptor } from "../../recipe"; import { RecipeMarketplace } from "../../marketplace"; export declare class PrepareRecipe { private readonly id; private readonly options?; constructor(id: string, options?: any | undefined); static handle(connection: MessageConnection, marketplace: RecipeMarketplace, preparedRecipes: Map, metricsCsv?: string): void; /** * Minimal stand-in descriptor for a recipe the host will resolve locally via * {@link PrepareRecipeResponse.delegatesTo}. The host reads only `delegatesTo` for * delegated recipes and ignores this descriptor, but the response type requires one. */ private static delegateDescriptor; /** * Prepares a recipe instance and recursively its whole child tree, registering every node in * {@code preparedRecipes} and returning the prepared response with {@code recipeList} populated, * so the host builds the tree locally instead of a PrepareRecipe round-trip per child. * * Mirrors the C# server's PrepareInstance. Required options are validated as each node is * prepared (covering the whole tree). A child hosted on the peer (an {@link RpcRecipe}, e.g. from * prepareJavaRecipe) carries only {@code delegatesTo} for the host to resolve locally; every other * child carries its own {@code recipeList}. Delegating recipes forward validation to the recipe * they delegate to, so they are not validated here. */ private static prepareInstance; /** * For preconditions that can be evaluated on the remote peer, let the remote peer * evaluate them and know that we will only have to do the visit work if the * precondition passes. */ private static optimizePreconditions; /** * Translate a precondition condition (operand) to a wire entry. * * Mirrors the Java {@code PrepareRecipeResponse.Precondition} schema: * leaves carry {@code visitorName} (+ optional options); composites * carry {@code op} ({@code "or"}/{@code "and"}/{@code "not"}) and a * nested {@code operands} list. Returns {@code undefined} when the * condition can't be serialized — the caller leaves the wrapper * intact so the gate runs in-process as a fallback. */ private static conditionWireEntry; private static visitorTypePrecondition; } export interface DelegatesTo { recipeName: string; options: Record; } export interface PrepareRecipeResponse { id: string; descriptor: RecipeDescriptor; editVisitor: string; editPreconditions: Precondition[]; scanVisitor?: string; scanPreconditions: Precondition[]; delegatesTo?: DelegatesTo; /** * The prepared child recipes of a composite. When present, the host builds the recipe tree * locally from these instead of re-preparing each child by name (the whole-tree optimization). */ recipeList?: PrepareRecipeResponse[]; } /** * Either a leaf (a single visitor identified by {@code visitorName} + * optional {@code visitorOptions}) or a composite of nested preconditions * joined by {@code op} ({@code "or"} / {@code "and"} / {@code "not"}). * * When {@code op} is undefined the entry is a leaf and {@code visitorName} * is required; when {@code op} is set, {@code operands} carries the * children and the visitor fields are ignored. The composite form mirrors * Java's {@code Preconditions.or}/{@code and}/{@code not} so remote * languages can express the same gate shapes the Java side does. */ export interface Precondition { visitorName?: string; visitorOptions?: {}; op?: "or" | "and" | "not"; operands?: Precondition[]; } //# sourceMappingURL=prepare-recipe.d.ts.map