UNPKG

@synstack/reforge

Version:

Runtime tools for interactive DevX with the ReForge IDE extension

283 lines (278 loc) 10.7 kB
import { z } from 'zod/v4'; import { v as vscode_lib } from './vscode.index-CURr6mfX.js'; import * as net from 'net'; declare const getFocusedFileConfig: { readonly name: "GET_FOCUSED_FILE"; readonly requestSchema: null; readonly responseSchema: z.ZodNullable<z.ZodString>; }; /** * Retrieve the absolute path to the actively focused file in the editor */ declare const getFocusedFile: () => Promise<string | null>; declare const getOpenedFilesConfig: { readonly name: "GET_OPENED_FILES"; readonly requestSchema: null; readonly responseSchema: z.ZodArray<z.ZodString>; }; /** * Retrieve the absolute paths to all opened files in the editor * * @warning this list also includes the focused file */ declare const getOpenedFiles: () => Promise<string[]>; declare const promptSelectConfig: { readonly name: "PROMPT_SELECT"; readonly requestSchema: z.ZodObject<{ title: z.ZodOptional<z.ZodString>; options: z.ZodArray<z.ZodString>; placeHolder: z.ZodOptional<z.ZodString>; }, z.core.$strip>; readonly responseSchema: z.ZodNullable<z.ZodString>; }; /** * Prompts the user to select an option from a list of options * @returns The selected option or null if the user cancels the prompt */ declare const promptSelect: (data: { options: string[]; title?: string | undefined; placeHolder?: string | undefined; }) => Promise<string | null>; declare const promptInputConfig: { readonly name: "PROMPT_INPUT"; readonly requestSchema: z.ZodObject<{ title: z.ZodOptional<z.ZodString>; prompt: z.ZodOptional<z.ZodString>; placeHolder: z.ZodOptional<z.ZodString>; defaultValue: z.ZodOptional<z.ZodString>; isPassword: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; }, z.core.$strip>; readonly responseSchema: z.ZodNullable<z.ZodString>; }; /** * Prompts the user to input a value * @returns The input value or null if the user cancels the prompt */ declare const promptInput: (data: { title?: string | undefined; prompt?: string | undefined; placeHolder?: string | undefined; defaultValue?: string | undefined; isPassword?: boolean | undefined; }) => Promise<string | null>; declare const promptMultiSelectConfig: { readonly name: "PROMPT_MULTI_SELECT"; readonly requestSchema: z.ZodObject<{ title: z.ZodOptional<z.ZodString>; options: z.ZodArray<z.ZodString>; placeHolder: z.ZodOptional<z.ZodString>; }, z.core.$strip>; readonly responseSchema: z.ZodArray<z.ZodString>; }; /** * Prompts the user to select multiple options from a list of options * @returns The selected options as an array */ declare const promptMultiSelect: (data: { options: string[]; title?: string | undefined; placeHolder?: string | undefined; }) => Promise<string[]>; declare const notifyConfig: { readonly name: "NOTIFY"; readonly requestSchema: z.ZodObject<{ title: z.ZodOptional<z.ZodString>; message: z.ZodString; type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{ error: "error"; info: "info"; warning: "warning"; }>>>; buttons: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strip>; readonly responseSchema: z.ZodNullable<z.ZodString>; }; /** * Displays a notification to the user * @returns the button clicked by the user or null if the user dismissed the notification */ declare const notify: (data: { message: string; title?: string | undefined; type?: "error" | "info" | "warning" | undefined; buttons?: string[] | undefined; }) => Promise<string | null>; declare const openFileConfig: { name: string; requestSchema: z.ZodObject<{ path: z.ZodString; config: z.ZodDefault<z.ZodObject<{ force: z.ZodDefault<z.ZodBoolean>; preview: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; column: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{ active: "active"; beside: "beside"; }>, z.ZodNumber]>>; }, z.core.$strip>>; }, z.core.$strip>; responseSchema: z.ZodObject<{ path: z.ZodString; isAlreadyOpened: z.ZodBoolean; }, z.core.$strip>; }; /** * Opens a file in the editor */ declare const openFile: (data: { path: string; config?: { force?: boolean | undefined; preview?: boolean | undefined; column?: number | "active" | "beside" | undefined; } | undefined; }) => Promise<{ path: string; isAlreadyOpened: boolean; }>; declare const openFilesConfig: { name: string; requestSchema: z.ZodObject<{ paths: z.ZodArray<z.ZodString>; config: z.ZodDefault<z.ZodObject<{ force: z.ZodDefault<z.ZodBoolean>; preview: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; column: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{ active: "active"; beside: "beside"; }>, z.ZodNumber]>>; }, z.core.$strip>>; }, z.core.$strip>; /** * Array of absolute paths to the files & whether they were already open in the editor */ responseSchema: z.ZodArray<z.ZodObject<{ path: z.ZodString; isAlreadyOpened: z.ZodBoolean; }, z.core.$strip>>; }; declare const openFiles: (data: { paths: string[]; config?: { force?: boolean | undefined; preview?: boolean | undefined; column?: number | "active" | "beside" | undefined; } | undefined; }) => Promise<{ path: string; isAlreadyOpened: boolean; }[]>; declare const getFocusedFileSelectionsConfig: { name: string; requestSchema: null; responseSchema: z.ZodNullable<z.ZodObject<{ path: z.ZodString; selections: z.ZodArray<z.ZodObject<{ start: z.ZodObject<{ character: z.ZodNumber; line: z.ZodNumber; lineCharacter: z.ZodNumber; }, z.core.$strip>; end: z.ZodObject<{ character: z.ZodNumber; line: z.ZodNumber; lineCharacter: z.ZodNumber; }, z.core.$strip>; content: z.ZodString; length: z.ZodNumber; }, z.core.$strip>>; }, z.core.$strip>>; }; /** * Retrieve the active selections in the actively focused file in the editor */ declare const getFocusedFileSelections: () => Promise<{ path: string; selections: { start: { character: number; line: number; lineCharacter: number; }; end: { character: number; line: number; lineCharacter: number; }; content: string; length: number; }[]; } | null>; declare const getPinnedFilesConfig: { name: string; requestSchema: null; responseSchema: z.ZodArray<z.ZodString>; }; /** * Retrieve the list of pinned files in the editor * @returns The list of pinned files */ declare const getPinnedFiles: () => Promise<string[]>; declare const pinFilesConfig: { name: string; requestSchema: z.ZodObject<{ paths: z.ZodArray<z.ZodString>; }, z.core.$strip>; responseSchema: z.ZodArray<z.ZodString>; }; /** * Pin a list of files in the editor * @returns The list of pinned files */ declare const pinFiles: (data: { paths: string[]; }) => Promise<string[]>; declare const unpinFilesConfig: { name: string; requestSchema: z.ZodObject<{ paths: z.ZodArray<z.ZodString>; }, z.core.$strip>; responseSchema: z.ZodArray<z.ZodString>; }; /** * Unpin a list of files in the editor * @returns The list of pinned files */ declare const unpinFiles: (data: { paths: string[]; }) => Promise<string[]>; declare const reforge_bundle_getFocusedFile: typeof getFocusedFile; declare const reforge_bundle_getFocusedFileSelections: typeof getFocusedFileSelections; declare const reforge_bundle_getOpenedFiles: typeof getOpenedFiles; declare const reforge_bundle_getPinnedFiles: typeof getPinnedFiles; declare const reforge_bundle_notify: typeof notify; declare const reforge_bundle_openFile: typeof openFile; declare const reforge_bundle_openFiles: typeof openFiles; declare const reforge_bundle_pinFiles: typeof pinFiles; declare const reforge_bundle_promptInput: typeof promptInput; declare const reforge_bundle_promptMultiSelect: typeof promptMultiSelect; declare const reforge_bundle_promptSelect: typeof promptSelect; declare const reforge_bundle_unpinFiles: typeof unpinFiles; declare namespace reforge_bundle { export { reforge_bundle_getFocusedFile as getFocusedFile, reforge_bundle_getFocusedFileSelections as getFocusedFileSelections, reforge_bundle_getOpenedFiles as getOpenedFiles, reforge_bundle_getPinnedFiles as getPinnedFiles, reforge_bundle_notify as notify, reforge_bundle_openFile as openFile, reforge_bundle_openFiles as openFiles, reforge_bundle_pinFiles as pinFiles, reforge_bundle_promptInput as promptInput, reforge_bundle_promptMultiSelect as promptMultiSelect, reforge_bundle_promptSelect as promptSelect, reforge_bundle_unpinFiles as unpinFiles, vscode_lib as vscode }; } declare const RESPONSE_SUFFIX = "_RESPONSE"; declare const getIpcClient: () => Promise<net.Socket>; interface ToolConfig<NAME extends string, REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodAny> { name: NAME; requestSchema: REQUEST_SCHEMA; responseSchema: RESPONSE_SCHEMA; } type ToolFn<REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodTypeAny> = REQUEST_SCHEMA extends z.ZodType ? (data: z.input<REQUEST_SCHEMA>) => Promise<z.output<RESPONSE_SCHEMA>> : () => Promise<z.output<RESPONSE_SCHEMA>>; declare const baseResponseSchema: z.ZodObject<{ type: z.ZodString; id: z.ZodString; status: z.ZodUnion<readonly [z.ZodLiteral<"ok">, z.ZodLiteral<"error">]>; }, z.core.$strip>; declare const toolFactory: <NAME extends string, REQUEST_SCHEMA extends z.ZodType | null, RESPONSE_SCHEMA extends z.ZodType = z.ZodAny>(toolConfig: ToolConfig<NAME, REQUEST_SCHEMA, RESPONSE_SCHEMA>) => ToolFn<REQUEST_SCHEMA, RESPONSE_SCHEMA>; export { RESPONSE_SUFFIX, type ToolConfig, type ToolFn, baseResponseSchema, getFocusedFile, getFocusedFileConfig, getFocusedFileSelections, getFocusedFileSelectionsConfig, getIpcClient, getOpenedFiles, getOpenedFilesConfig, getPinnedFiles, getPinnedFilesConfig, notify, notifyConfig, openFile, openFileConfig, openFiles, openFilesConfig, pinFiles, pinFilesConfig, promptInput, promptInputConfig, promptMultiSelect, promptMultiSelectConfig, promptSelect, promptSelectConfig, reforge_bundle as reforge, toolFactory, unpinFiles, unpinFilesConfig };