packages/core/src/runtime.ts 已经承担 session 配置、context 初始化、模型请求、tool loop、compact、rewind、事件持久化和后台任务等多种职责。文件体积过大后,agent 很难定位修改边界,也难以判断副作用是否集中在正确的 adapter 或 service 层。
./runtime.js 的公开导出保持稳定,调用方继续使用 AgentRuntime 与现有 public types。AgentRuntime 只保留构造、公开 API 类型和原型方法安装,不继续承载所有实现细节。context、model、turn、tools、compact、rewind、persistence、background 和纯 helper 模块。公开契约仍由 packages/core/src/runtime.ts 提供:
AgentRuntimeAgentRuntimeConfigAgentRuntimeDepsRuntimeFactory内部契约收敛到 AgentRuntimeInternal,它只在 packages/core/src/runtime/* 内使用,用于描述 runtime 状态字段和私有协作方法。外部包不得导入 runtime internal modules。
runtime.ts 不再膨胀回巨型实现文件。npm run lint 和 npm test;如果仓库中已有未归属变更导致失败,需要记录失败点与风险。