import { AzureOpenAI } from 'openai'; import Handlebars from 'handlebars'; import { z } from 'zod'; import { UI } from './ui'; export declare const MAX_PROMPT_LENGTH = 30000; export declare const hashContent: (content: string) => string; export declare const getFilePaths: (dir: string, extensions: string[]) => string[]; export declare const client: AzureOpenAI; export declare const callOpenAiApi: (prompt: string, model?: string) => Promise; export interface OpenAIMessage { role: 'system' | 'user' | 'assistant'; content: string; } export declare const FsStep: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"CREATE_FILE">; filePath: z.ZodString; fileContents: z.ZodString; }, "strip", z.ZodTypeAny, { type: "CREATE_FILE"; filePath: string; fileContents: string; }, { type: "CREATE_FILE"; filePath: string; fileContents: string; }>, z.ZodObject<{ type: z.ZodLiteral<"CREATE_DIR">; dirPath: z.ZodString; }, "strip", z.ZodTypeAny, { type: "CREATE_DIR"; dirPath: string; }, { type: "CREATE_DIR"; dirPath: string; }>, z.ZodObject<{ type: z.ZodLiteral<"EDIT_FILE">; filePath: z.ZodString; fileContents: z.ZodString; }, "strip", z.ZodTypeAny, { type: "EDIT_FILE"; filePath: string; fileContents: string; }, { type: "EDIT_FILE"; filePath: string; fileContents: string; }>, z.ZodObject<{ type: z.ZodLiteral<"DELETE_FILE">; filePath: z.ZodString; }, "strip", z.ZodTypeAny, { type: "DELETE_FILE"; filePath: string; }, { type: "DELETE_FILE"; filePath: string; }>]>; export type FsStep = z.infer; export declare const FsSteps: z.ZodObject<{ steps: z.ZodArray; filePath: z.ZodString; fileContents: z.ZodString; }, "strip", z.ZodTypeAny, { type: "CREATE_FILE"; filePath: string; fileContents: string; }, { type: "CREATE_FILE"; filePath: string; fileContents: string; }>, z.ZodObject<{ type: z.ZodLiteral<"CREATE_DIR">; dirPath: z.ZodString; }, "strip", z.ZodTypeAny, { type: "CREATE_DIR"; dirPath: string; }, { type: "CREATE_DIR"; dirPath: string; }>, z.ZodObject<{ type: z.ZodLiteral<"EDIT_FILE">; filePath: z.ZodString; fileContents: z.ZodString; }, "strip", z.ZodTypeAny, { type: "EDIT_FILE"; filePath: string; fileContents: string; }, { type: "EDIT_FILE"; filePath: string; fileContents: string; }>, z.ZodObject<{ type: z.ZodLiteral<"DELETE_FILE">; filePath: z.ZodString; }, "strip", z.ZodTypeAny, { type: "DELETE_FILE"; filePath: string; }, { type: "DELETE_FILE"; filePath: string; }>]>, "many">; }, "strip", z.ZodTypeAny, { steps: ({ type: "CREATE_FILE"; filePath: string; fileContents: string; } | { type: "CREATE_DIR"; dirPath: string; } | { type: "EDIT_FILE"; filePath: string; fileContents: string; } | { type: "DELETE_FILE"; filePath: string; })[]; }, { steps: ({ type: "CREATE_FILE"; filePath: string; fileContents: string; } | { type: "CREATE_DIR"; dirPath: string; } | { type: "EDIT_FILE"; filePath: string; fileContents: string; } | { type: "DELETE_FILE"; filePath: string; })[]; }>; export type FsSteps = z.infer; export declare const AutoStep: z.ZodUnion<[z.ZodObject<{ type: z.ZodLiteral<"REQUEST_FILE">; filePath: z.ZodString; }, "strip", z.ZodTypeAny, { type: "REQUEST_FILE"; filePath: string; }, { type: "REQUEST_FILE"; filePath: string; }>, z.ZodObject<{ type: z.ZodLiteral<"QUERY_USER">; message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; type: "QUERY_USER"; }, { message: string; type: "QUERY_USER"; }>, z.ZodObject<{ type: z.ZodLiteral<"RUN_SHELL">; cwd: z.ZodString; command: z.ZodString; }, "strip", z.ZodTypeAny, { type: "RUN_SHELL"; cwd: string; command: string; }, { type: "RUN_SHELL"; cwd: string; command: string; }>, z.ZodObject<{ type: z.ZodLiteral<"GOOGLE_SEARCH">; query: z.ZodString; }, "strip", z.ZodTypeAny, { type: "GOOGLE_SEARCH"; query: string; }, { type: "GOOGLE_SEARCH"; query: string; }>, z.ZodObject<{ type: z.ZodLiteral<"HTTP_REQUEST_GET">; url: z.ZodString; }, "strip", z.ZodTypeAny, { type: "HTTP_REQUEST_GET"; url: string; }, { type: "HTTP_REQUEST_GET"; url: string; }>, z.ZodObject<{ type: z.ZodLiteral<"CODE_OPERATION">; relatedFiles: z.ZodArray; outputFiles: z.ZodArray; prompt: z.ZodString; }, "strip", z.ZodTypeAny, { type: "CODE_OPERATION"; relatedFiles: string[]; outputFiles: string[]; prompt: string; }, { type: "CODE_OPERATION"; relatedFiles: string[]; outputFiles: string[]; prompt: string; }>, z.ZodObject<{ type: z.ZodLiteral<"DONE">; }, "strip", z.ZodTypeAny, { type: "DONE"; }, { type: "DONE"; }>]>; export type AutoStep = z.infer; export declare const AutoSteps: z.ZodObject<{ steps: z.ZodArray; filePath: z.ZodString; }, "strip", z.ZodTypeAny, { type: "REQUEST_FILE"; filePath: string; }, { type: "REQUEST_FILE"; filePath: string; }>, z.ZodObject<{ type: z.ZodLiteral<"QUERY_USER">; message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; type: "QUERY_USER"; }, { message: string; type: "QUERY_USER"; }>, z.ZodObject<{ type: z.ZodLiteral<"RUN_SHELL">; cwd: z.ZodString; command: z.ZodString; }, "strip", z.ZodTypeAny, { type: "RUN_SHELL"; cwd: string; command: string; }, { type: "RUN_SHELL"; cwd: string; command: string; }>, z.ZodObject<{ type: z.ZodLiteral<"GOOGLE_SEARCH">; query: z.ZodString; }, "strip", z.ZodTypeAny, { type: "GOOGLE_SEARCH"; query: string; }, { type: "GOOGLE_SEARCH"; query: string; }>, z.ZodObject<{ type: z.ZodLiteral<"HTTP_REQUEST_GET">; url: z.ZodString; }, "strip", z.ZodTypeAny, { type: "HTTP_REQUEST_GET"; url: string; }, { type: "HTTP_REQUEST_GET"; url: string; }>, z.ZodObject<{ type: z.ZodLiteral<"CODE_OPERATION">; relatedFiles: z.ZodArray; outputFiles: z.ZodArray; prompt: z.ZodString; }, "strip", z.ZodTypeAny, { type: "CODE_OPERATION"; relatedFiles: string[]; outputFiles: string[]; prompt: string; }, { type: "CODE_OPERATION"; relatedFiles: string[]; outputFiles: string[]; prompt: string; }>, z.ZodObject<{ type: z.ZodLiteral<"DONE">; }, "strip", z.ZodTypeAny, { type: "DONE"; }, { type: "DONE"; }>]>, "many">; }, "strip", z.ZodTypeAny, { steps: ({ type: "REQUEST_FILE"; filePath: string; } | { message: string; type: "QUERY_USER"; } | { type: "RUN_SHELL"; cwd: string; command: string; } | { type: "GOOGLE_SEARCH"; query: string; } | { type: "HTTP_REQUEST_GET"; url: string; } | { type: "CODE_OPERATION"; relatedFiles: string[]; outputFiles: string[]; prompt: string; } | { type: "DONE"; })[]; }, { steps: ({ type: "REQUEST_FILE"; filePath: string; } | { message: string; type: "QUERY_USER"; } | { type: "RUN_SHELL"; cwd: string; command: string; } | { type: "GOOGLE_SEARCH"; query: string; } | { type: "HTTP_REQUEST_GET"; url: string; } | { type: "CODE_OPERATION"; relatedFiles: string[]; outputFiles: string[]; prompt: string; } | { type: "DONE"; })[]; }>; export type AutoSteps = z.infer; export declare const callOpenAiApiStructured: (messages: OpenAIMessage[], model: string | undefined, responseType: any, responseTypeName: string) => Promise; export declare const handleFsSteps: (ui: UI, fsSteps: FsSteps) => Promise; export declare const handleAutoSteps: (ui: UI, filePaths: string[], autoSteps: AutoSteps) => Promise; export declare const loadTemplate: (templateName: string) => Handlebars.TemplateDelegate; export declare const getCachedResponseKey: (templateContent: string, args: object, model: string, messages?: OpenAIMessage[]) => string; export declare const getCachedResponse: (templateContent: string, args: object, model: string, messages?: OpenAIMessage[]) => string | null; export declare const cacheResponse: (template: any, args: object, response: string, model: string, messages?: OpenAIMessage[]) => void; export declare const getResponse: (template: any, args: object, model: string) => Promise; export declare const getResponseStructured: (messages: OpenAIMessage[], model: string, responseType: any, responseTypeName: string) => Promise; export declare const dataDir: string; export declare const summariseDeep: (filePaths: string[], outPath: string) => Promise;