import type { DevToolsSys } from "../../core"; import { type Credentials } from "../credentials"; export { getCustomInstructions } from "./rules-discovery"; import type { CodeGenInputOptions, CodegenSetLastCompletion, CodegenTurn, GenerateCodeEvent, GenerateUserMessage, GetSessionTurnsResult, UserContext, WorkspaceConfiguration, WorkspaceFolder, EnvironmentVariable, PushChangesArgs, PushChangesOptions, GenerateCompletionStepDevServerState, FusionConfig, GenerateCompletionStepGit } from "#ai-utils"; import type { SessionContext } from "../codegen"; import type { DevServerOrchestrator } from "../launch/dev-server-orchestrator"; export declare const DEFAULT_SOFT_MAX_COMPLETIONS = 100; export declare const DEFAULT_HARD_MAX_COMPLETIONS = 200; /** * Merges and deduplicates items by name. * Built-in items come first, discovered items can override them by name. * @param builtIn - Built-in items * @param discovered - Discovered items from project * @returns Deduplicated array with discovered overriding built-in */ export declare function mergeByName(builtIn: T[], discovered: T[]): T[]; export declare function getLastGoodTurn(sessionContext: SessionContext): CodegenTurn | undefined; export declare function getLastUserTurn(sessionContext: SessionContext): CodegenTurn | undefined; export declare function getLastApplyResultsTurn(sessionContext: SessionContext): CodegenTurn | undefined; export declare function getLastOne(array: T[]): T | undefined; export declare function inPlaceRemovePendingTurns(turns: CodegenTurn[]): void; export declare function restoreConsumedCredit(sys: DevToolsSys, credentials: Credentials, sessionId: string, restoreCredits: number): Promise; /** * Analyzes the payload to identify what's making it large */ export declare function analyzePayloadBreakdown(body: CodeGenInputOptions, jsonString: string): Record; export declare function completionStream(sys: DevToolsSys, credentials: Credentials, body: CodeGenInputOptions, signal: AbortSignal, debug: boolean): AsyncGenerator; export declare function codegenEndpoint(sys: DevToolsSys, credentials: Credentials, endpoint: string, body: Record, debug: boolean): Promise; /** * Makes a POST request to a codegen endpoint and returns parsed JSON. * Returns undefined on failure (no retries, silent failure). * Designed for non-critical requests like commit message generation. */ export declare function codegenPostJson(credentials: Credentials, endpoint: string, body: Record, options?: { signal?: AbortSignal; timeoutMs?: number; debug: boolean; }): Promise; export declare function setLastCompletionOfSession(sys: DevToolsSys, credentials: Credentials, data: CodegenSetLastCompletion, debug: boolean): Promise; export declare function getTurnsBySessionId(sys: DevToolsSys, credentials: Credentials, sessionId: string, linear: boolean, debug: boolean, completionIdCursor?: string, signal?: AbortSignal): Promise; export declare const parseCLIURL: (url: string | undefined) => { id: undefined; isInitial: boolean; } | { isInitial: boolean; id: string; }; export declare function getUserContext(sys: DevToolsSys, gitWorkingDirectory?: string): Promise; export declare function makeAsyncIterator(): readonly [AsyncGenerator, (event: T) => void, () => void]; export declare function isAGENTSFile(filePath: string): boolean; export declare function isBaseImportantFile(filePath: string, recommendedRootDir: string): boolean; export declare function isImportantAgentFile(filePath: string, projectRootDir: string): boolean; export declare function hasBuildError(text: string): boolean; /** * Loads a workspace configuration from a JSON file * @param sys DevToolsSys instance * @param workspaceFile Path to the workspace JSON file * @returns The workspace configuration and working directory */ export declare function loadWorkspace(sys: DevToolsSys, workspaceFile: string): Promise<{ workspace: WorkspaceConfiguration; workingDirectory: string; }>; export declare function mergeMessages(messages: GenerateUserMessage[]): GenerateUserMessage; export declare function mergeUserMessages(currentMessage: GenerateUserMessage, newMessage: GenerateUserMessage): GenerateUserMessage; export declare function keepAlive(): () => void; export declare function parseAheadBehind(line: string): { ahead: number; behind: number; }; export declare class BashError extends Error { readonly code: number | string | undefined; readonly stdout: string; readonly stderr: string; readonly command: string; constructor(command: string, code: number | string | undefined, stdout: string, stderr: string, opts?: { cause?: Error; }); } export declare class ParentBranchNotFoundError extends Error { readonly branchName: string; constructor(branchName: string, opts?: { cause?: Error; }); } export declare function mergeEnvironmentVariables(envVariables: EnvironmentVariable[], extraEnvVariables: EnvironmentVariable[]): EnvironmentVariable[]; export declare function processPushChangesArgs(opts: PushChangesArgs): PushChangesOptions; export declare function getErrorMessage(err: unknown): string; export declare function waitImmediate(): Promise; export declare function abortPromise | undefined>(promise: T, signal: AbortSignal | undefined): T; export declare function waitRace(promise: Promise, timeout: number): Promise; export declare function newAbortError(reason?: unknown): Error; export declare function getDevServerStep(devServer: DevServerOrchestrator, fusionConfig: FusionConfig | undefined): GenerateCompletionStepDevServerState; export declare function moveArrayElement(arr: T[], old_index: number, new_index: number): T[]; export declare function canCollapseWorkspace(workspace: WorkspaceConfiguration | undefined): boolean; export declare function computeRecommendedRootDir(workspace: WorkspaceConfiguration | undefined): string; export { getEnvironmentVariablesPrompt } from "#vcp-common/codegen"; /** * Converts a folder name to a per-repo GitHub token env var key. * e.g. "code" → "GH_TOKEN_CODE", "ai-services" → "GH_TOKEN_AI_SERVICES" */ export declare function toGhTokenEnvKey(folderName: string): string; export declare function generateGitStatusReminder(gitStatus: GenerateCompletionStepGit, gitEnabledFolders: WorkspaceFolder[], context: { trigger: "session-start" | "sync-success" | "push-success" | "pull-success"; syncedBranches?: string[]; pushedToRemote?: boolean; }): string;