/** * CoreEngineRunner:模型与 tool-loop 主循环执行器。 * * 关键点(中文) * - 只负责单次已装配输入的执行,不负责外层运行上下文、重试与历史准备。 * - 把 step 循环、续写恢复、最终 assistant 汇总等细节从 Executor 中剥离。 * - 保持失败返回结构稳定,避免对外 Session 行为变化。 */ import { type LanguageModel } from "ai"; import type { Logger } from "../../utils/logger/Logger.js"; import type { SessionTurnContext } from "../../types/executor/SessionTurnContext.js"; import type { SessionStepExecutionInput, SessionTurnExecutionResult } from "../../types/session/SessionExecution.js"; import type { SessionRecordV1 } from "../../executor/types/SessionRecords.js"; interface CoreEngineRunnerOptions { /** 当前 Session 稳定标识。 */ session_id: string; /** * 当前 session 统一日志器。 */ logger: Logger; /** * 判断某次执行错误是否应该上抛给外层压缩重试。 */ should_compact_on_error: (error: unknown) => boolean; } interface CoreEngineTurnInput { /** * 已装配好的执行输入。 */ execute_input: SessionStepExecutionInput; /** * 当前轮模型实例。 */ model: LanguageModel; /** * 当前显式运行上下文。 */ turn_context: SessionTurnContext; /** * 在统一输入队列提交后解析当前 Session step 的 effective 配置。 */ resolve_step_inputs: () => Promise<{ /** 当前 Session step 使用的模型。 */ model: LanguageModel; /** 当前 Session step 使用的 system messages。 */ system: SessionStepExecutionInput["system"]; /** 当前 Session step 使用的工具集合。 */ tools: SessionStepExecutionInput["tools"]; /** 当前 Session step 模型支持的总上下文窗口长度。 */ context_window?: number; }>; /** 持久化 compact 后重新读取 Composer 生成的 canonical history。 */ reload_history: () => Promise; } /** * 模型与 tool-loop 主循环执行器。 */ export declare class CoreEngineRunner { private readonly session_id; private readonly logger; private readonly should_compact_on_error; /** 最近一次已经通过真实 usage 验收的持久化 Summary 标识。 */ private validated_compaction_summary_id; constructor(options: CoreEngineRunnerOptions); /** * 执行一次已装配完成的模型/tool-loop 运行。 */ execute(input: CoreEngineTurnInput): Promise; } export {}; //# sourceMappingURL=CoreEngineRunner.d.ts.map