feat(v2): T-M2 采纳 pi branch-summarization——折叠摘要携带文件清单 + rollup 行带产物锚点
- AgentService._history_from_session:从全部轮次的 write_file/edit_file 工具调用提取已读写文件清单(去重/单路径裁 120 字符/封顶 20 个),以摘要轮 注入对话上下文——轮次滑出窗口后事实清单仍在(丢上下文不丢事实) - Workspace.rollup:done 折叠行追加(产出: <artifact 锚点>),上下文折叠后 产物事实在 a:// 锚点体系内仍可寻址;既有子串断言全部兼容 - 新增 tests/test_branch_manifest.py 4 项
This commit is contained in:
@@ -397,7 +397,12 @@ class Workspace:
|
||||
new_progress: List[Dict[str, Any]] = []
|
||||
for entry in self._data.get("progress", []):
|
||||
if entry.get("status") == "done" and entry.get("step"):
|
||||
line = _clip(f"{entry['step']}: {entry.get('summary', '')}", LIMITS["archive"])
|
||||
# T-M2(采纳 pi branch-summarization 思想):折叠行携带产物锚点,
|
||||
# 上下文折叠后产物事实仍在 archive 中可寻址(a:// 锚点体系)
|
||||
base = f"{entry['step']}: {entry.get('summary', '')}"
|
||||
if entry.get("artifact"):
|
||||
base += f"(产出: {entry['artifact']})"
|
||||
line = _clip(base, LIMITS["archive"])
|
||||
if line not in self._data["archive"]:
|
||||
self._data["archive"].append(line)
|
||||
folded += 1
|
||||
|
||||
Reference in New Issue
Block a user