import { RunResult, TestCase, TestCaseResult } from '../types'; export interface BackendConfig { /** API 基础 URL */ apiUrl?: string; /** 请求超时时间(毫秒) */ timeout?: number; /** 是否启用调试日志 */ debug?: boolean; } export interface BackendResponse { stdout: string; stderr: string; exit_code: number; execution_time_ms: number; error: string; test_results?: TestCaseResult[]; } /** * 后端运行器 * 通过 HTTP API 调用 code-backend 服务 */ export declare class BackendRunner { private config; constructor(config?: BackendConfig); /** * 运行代码 */ run(language: string, code: string, testCases?: TestCase[], questionId?: number): Promise; /** * 提交代码(异步执行) */ submit(language: string, code: string, testCases?: TestCase[], questionId?: number): Promise; /** * 查询提交状态 */ getStatus(submissionId: string): Promise<{ status: "Pending" | "Running" | "Completed" | "Failed"; result?: BackendResponse; }>; /** * 轮询等待结果 */ waitForResult(submissionId: string, maxAttempts?: number, interval?: number): Promise; /** * 获取题目信息 */ getQuestion(questionId?: number): Promise; /** * 检查后端健康状态 */ healthCheck(): Promise; /** * 转换后端响应为前端格式 */ private convertResponse; /** * 格式化错误信息 */ private formatError; /** * 带超时的 fetch */ private fetchWithTimeout; /** * 更新配置 */ setConfig(config: Partial): void; /** * 获取当前配置 */ getConfig(): Readonly>; } /** * 创建默认的后端运行器实例 */ export declare function createBackendRunner(config?: BackendConfig): BackendRunner; //# sourceMappingURL=BackendRunner.d.ts.map