refactor: context#155
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
internal/context 模块,将 context 构建、project rules/system state 注入,以及 compact 的裁剪与摘要链路拆成更清晰的职责边界,减少 builder 和 compact runner 内部耦合,并补齐相关测试。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
这次改动主要重构了
internal/context模块,将 context 构建、project rules/system state 注入,以及 compact 的裁剪与摘要链路拆成更清晰的职责边界,减少 builder 和 compact runner 内部耦合,并补齐相关测试。主要改动
拆分 context builder 内部职责
builder.go的重复定义与重复拼装问题增强 project rules 与 system state 的构建逻辑
AGENTS.md的发现、读取、裁剪和缓存收敛到独立 source拆分 compact 内部链路
internal/context/internalcompact共享消息 span 逻辑,统一处理 tool block 原子性和“最近明确用户指令”保护优化 compact prompt 与消息裁剪行为
补充测试
context相关单测,覆盖 source、trim policy、message span、summary validator 等边界runtime中 compact generator 相关测试,校验 compact 请求格式与约束影响范围
主要影响以下模块:
internal/contextinternal/context/compactinternal/context/internalcompactinternal/runtime(测试)验证
go build ./...go test ./...备注
这次 PR 以重构和可维护性提升为主,不改变
TUI -> Runtime -> Provider / Tool Manager主链路职责边界。