Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

feat: cli TUI支持/diff

jingjinduob9ed79d8e19c
diff --git a/jiuwenclaw/agentserver/agent_ws_server.py b/jiuwenclaw/agentserver/agent_ws_server.py
index 4c2bfee3b5..1c9f8bcad1 100644
--- a/jiuwenclaw/agentserver/agent_ws_server.py
+++ b/jiuwenclaw/agentserver/agent_ws_server.py
@@ -747,21 +747,29 @@ class AgentWebSocketServer:
await ws.send(json.dumps(wire, ensure_ascii=False))
async def _handle_command_diff(self, ws: Any, request: AgentRequest, send_lock: asyncio.Lock) -> None:
+ from jiuwenclaw.agentserver.diff_service import get_diff_service
+
try:
+ session_id = request.session_id or "default"
+ diff_service = get_diff_service()
+ turns = diff_service.get_turn_diffs(session_id)
+
+ logger.info(
+ "[AgentWebSocketServer] command.diff response: session_id=%s turns=%s",
+ session_id,
+ turns,
+ )
+
resp = AgentResponse(
request_id=request.request_id,
channel_id=request.channel_id,
ok=True,
payload={
- "summary": "Workspace diff preview",
- "items": [
- {"label": "files_changed", "value": "3"},
- {"label": "insertions", "value": "24"},
- {"label": "deletions", "value": "7"},
- ],
+ "type": "list",
+ "turns": turns,
},
)
- except Exception as e: # noqa: BLE001
+ except Exception as e:
logger.exception("[AgentWebSocketServer] command.diff failed: %s", e)
resp = AgentResponse(
request_id=request.request_id,
diff --git a/jiuwenclaw/agentserver/diff_service.py b/jiuwenclaw/agentserver/diff_service.py
new file mode 100644
index 0000000000..081d6e31c8
--- /dev/null
+++ b/jiuwenclaw/agentserver/diff_service.py
@@ -0,0 +1,299 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
+
+"""Turn-based diff service for /diff command."""
+
+from __future__ import annotations
+
+import difflib
+import json
+import logging
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any
+
+from jiuwenclaw.utils import get_agent_sessions_dir, get_agent_workspace_dir, get_user_workspace_dir
+
+
+logger = logging.getLogger(__name__)
+
+
+class DiffService:
+ """提供 turn-based diff 查询服务."""
+
+ def __init__(self) -> None:
+ self._agent_id = "jiuwenclaw"
+
+ def get_turn_diffs(self, session_id: str) -> list[dict[str, Any]]:
+ """获取 session 的所有 turn diff(完整信息).
+
+ Args:
+ session_id: 会话 ID
+
+ Returns:
+ turn diff 列表,按时间倒序排列(most recent first)
+ """
+ turns = self._compute_turn_diffs(session_id)
+ return list(reversed(turns))
+
+ def _compute_turn_diffs(self, session_id: str) -> list[dict[str, Any]]:
+ """计算 turn-based diffs."""
+ history = self._read_history(session_id)
+ agent_history = self._read_agent_history()
+
+ if not history:
+ return []
+
+ turns: list[dict[str, Any]] = []
+
+ i = 0
+ while i < len(history):
+ record = history[i]
+
+ if record["role"] == "user":
+ turn_start = record["timestamp"]
+ turn_end = None
+
+ for j in range(i + 1, len(history)):
+ next_record = history[j]
+ if next_record["role"] == "user":
+ break
+ if self._is_turn_end(next_record):
+ turn_end = next_record["timestamp"]
+ break
+
+ turns.append({
+ "turnIndex": len(turns) + 1,
+ "userPromptPreview": record.get("content", "")[:30],
+ "timestamp": self._timestamp_to_iso(record["timestamp"]),
+ "start_timestamp": turn_start,
+ "end_timestamp": turn_end,
+ "files": {},
+ "stats": {
+ "filesChanged": 0,
+ "linesAdded": 0,
+ "linesRemoved": 0,
+ },
+ })
+
+ i += 1
+
+ for turn in turns:
+ file_edits = self._find_file_edits_by_time_range(
+ agent_history,
+ start_time=turn["start_timestamp"],
+ end_time=turn["end_timestamp"],
+ )
+
+ for file_path, edit_info in file_edits.items():
+ if file_path not in turn["files"]:
+ turn["files"][file_path] = {
+ "filePath": file_path,
+ "hunks": [],
+ "isNewFile": False,
+ "linesAdded": 0,
+ "linesRemoved": 0,
+ "lastEditTime": None,
+ }
+
+ for op in edit_info["operations"]:
+ hunks = self._compute_hunks(
+ op["old_content"],
+ op["new_content"],
+ )
+ turn["files"][file_path]["hunks"].extend(hunks)
+ turn["files"][file_path]["lastEditTime"] = op["timestamp"]
+
+ if op["action"] == "write" and op["old_content"] is None:
+ turn["files"][file_path]["isNewFile"] = True
+
+ for hunk in hunks:
+ for line in hunk["lines"]:
+ if line.startswith("+") and not line.startswith("+++"):
+ turn["files"][file_path]["linesAdded"] += 1
+ elif line.startswith("-") and not line.startswith("---"):
+ turn["files"][file_path]["linesRemoved"] += 1
+
+ turn["stats"]["filesChanged"] = len(turn["files"])
+ turn["stats"]["linesAdded"] = sum(
+ f["linesAdded"] for f in turn["files"].values()
+ )
+ turn["stats"]["linesRemoved"] = sum(
+ f["linesRemoved"] for f in turn["files"].values()
+ )
+
+ turns_with_files = [t for t in turns if t["files"]]
+ for i, turn in enumerate(turns_with_files):
+ turn["turnIndex"] = i + 1
+
+ return turns_with_files
+
+ @staticmethod
+ def _is_turn_end(record: dict[str, Any]) -> bool:
+ """判断一条记录是否是 turn 的结束."""
+ event_type = record.get("event_type")
+ if event_type == "chat.final":
+ return True
+ if event_type == "chat.evolution_status" and record.get("status") == "end":
+ return True
+ return False
+
+ @staticmethod
+ def _find_next_user_time(
+ history: list[dict[str, Any]], user_index: int
+ ) -> float | None:
+ """查找下次用户消息时间."""
+ for j in range(user_index + 1, len(history)):
+ if history[j]["role"] == "user":
+ return history[j]["timestamp"]
+ return None
+
+ @staticmethod
+ def _read_history(session_id: str) -> list[dict[str, Any]]:
+ """读取 session history."""
+ history_file = get_agent_sessions_dir() / session_id / "history.json"
+ if not history_file.exists():
+ return []
+ try:
+ return json.loads(history_file.read_text(encoding="utf-8"))
+ except Exception:
+ return []
+
+ def _read_agent_history(self) -> dict[str, Any]:
+ """读取 .agent_history(同时读取两个可能的位置并合并)."""
+ result: dict[str, Any] = {}
+
+ paths = [
+ get_agent_workspace_dir() / ".agent_history" / f"file_ops_{self._agent_id}.json",
+ get_user_workspace_dir() / ".agent_history" / f"file_ops_{self._agent_id}.json",
+ ]
+
+ for history_file in paths:
+ if history_file.exists():
+ try:
+ data = json.loads(history_file.read_text(encoding="utf-8"))
+ for file_path, entries in data.items():
+ if file_path not in result:
+ result[file_path] = []
+ result[file_path].extend(entries)
+ except Exception as e:
+ logger.warning(f"Failed to read agent history file {history_file}: {e}")
+
+ return result
+
+ def _find_file_edits_by_time_range(
+ self,
+ agent_history: dict[str, Any],
+ start_time: float,
+ end_time: float | None,
+ ) -> dict[str, dict[str, Any]]:
+ """根据时间范围查找文件编辑记录.
+
+ 时间区间:[start_time, end_time) 左闭右开
+ """
+ file_edits: dict[str, dict[str, Any]] = {}
+
+ for file_path, entries in agent_history.items():
+ for entry in entries:
+ edit_time = self._iso_to_timestamp(entry["timestamp"])
+
+ if edit_time >= start_time:
+ if end_time is None or edit_time < end_time:
+ if file_path not in file_edits:
+ file_edits[file_path] = {
+ "file_path": file_path,
+ "operations": [],
+ }
+ file_edits[file_path]["operations"].append({
+ "action": entry["action"],
+ "timestamp": entry["timestamp"],
+ "old_content": entry["old_content"],
+ "new_content": entry["new_content"],
+ })
+
+ return file_edits
+
+ @staticmethod
+ def _iso_to_timestamp(iso_str: str) -> float:
+ """将 ISO 8601 字符串转换为 Unix timestamp."""
+ dt = datetime.fromisoformat(iso_str)
+ return dt.timestamp()
+
+ @staticmethod
+ def _timestamp_to_iso(timestamp: float) -> str:
+ """将 Unix timestamp 转换为 ISO 8601 字符串."""
+ dt = datetime.fromtimestamp(timestamp, tz=timezone.utc)
+ return dt.isoformat()
+
+ @staticmethod
+ def _compute_hunks(
+ old_content: str | None,
+ new_content: str,
+ ) -> list[dict[str, Any]]:
+ """计算结构化 diff hunks."""
+ if old_content is None:
+ lines = new_content.splitlines()
+ return [{
+ "oldStart": 0,
+ "oldLines": 0,
+ "newStart": 1,
+ "newLines": len(lines),
+ "lines": [f"+{line}" for line in lines],
+ }]
+
+ old_lines = old_content.splitlines(keepends=True)
+ new_lines = new_content.splitlines(keepends=True)
+
+ if not old_lines and not new_lines:
+ return []
+
+ matcher = difflib.SequenceMatcher(None, old_lines, new_lines)
+ hunks: list[dict[str, Any]] = []
+
+ for tag, i1, i2, j1, j2 in matcher.get_opcodes():
+ if tag == "equal":
+ continue
+
+ old_start = i1 + 1
+ old_count = i2 - i1
+ new_start = j1 + 1
+ new_count = j2 - j1
+
+ lines: list[str] = []
+
+ for k in range(i1, i2):
+ lines.append(f"-{old_lines[k].rstrip()}")
+
+ for k in range(j1, j2):
+ lines.append(f"+{new_lines[k].rstrip()}")
+
+ hunks.append({
+ "oldStart": old_start,
+ "oldLines": old_count,
+ "newStart": new_start,
+ "newLines": new_count,
+ "lines": lines,
+ })
+
+ return hunks
+
+ @staticmethod
+ def _finalize_turn(turn: dict[str, Any]) -> None:
+ """完成 turn 的统计信息计算."""
+ turn["stats"]["filesChanged"] = len(turn["files"])
+ turn["stats"]["linesAdded"] = sum(
+ f["linesAdded"] for f in turn["files"].values()
+ )
+ turn["stats"]["linesRemoved"] = sum(
+ f["linesRemoved"] for f in turn["files"].values()
+ )
+
+
+_diff_service: DiffService | None = None
+
+
+def get_diff_service() -> DiffService:
+ """获取 DiffService 单例实例."""
+ global _diff_service
+ if _diff_service is None:
+ _diff_service = DiffService()
+ return _diff_service
diff --git a/jiuwenclaw/cli/src/core/commands/builtins/diff.ts b/jiuwenclaw/cli/src/core/commands/builtins/diff.ts
index fde0ba7401..62a7dfd194 100644
--- a/jiuwenclaw/cli/src/core/commands/builtins/diff.ts
+++ b/jiuwenclaw/cli/src/core/commands/builtins/diff.ts
@@ -1,5 +1,11 @@
-import { addError, addInfo } from "../helpers.js";
+import { addError, addDiff } from "../helpers.js";
import { CommandKind, type SlashCommand } from "../types.js";
+import type { TurnDiff } from "../../types.js";
+
+interface DiffPayload {
+ type: "list";
+ turns: TurnDiff[];
+}
export function createDiffCommand(): SlashCommand {
return {
@@ -10,16 +16,13 @@ export function createDiffCommand(): SlashCommand {
kind: CommandKind.BUILT_IN,
action: async (ctx) => {
try {
- const payload = await ctx.request<{
- summary?: string;
- items?: Array<{ label: string; value?: string }>;
- }>("command.diff", {});
+ const payload = await ctx.request<DiffPayload>("command.diff", {});
+ const turns = payload.turns || [];
+ const summary = turns.length > 0
+ ? `Found ${turns.length} turn(s) with file changes`
+ : "No file changes in this session";
ctx.addItem(
- addInfo(ctx.sessionId, payload.summary || "Workspace diff summary", "d", {
- view: "kv",
- title: "Diff",
- items: payload.items ?? [],
- }),
+ addDiff(ctx.sessionId, summary, { turns }),
);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
diff --git a/jiuwenclaw/cli/src/core/commands/builtins/switch.ts b/jiuwenclaw/cli/src/core/commands/builtins/switch.ts
new file mode 100644
index 0000000000..5eda37d5d9
--- /dev/null
+++ b/jiuwenclaw/cli/src/core/commands/builtins/switch.ts
@@ -0,0 +1,28 @@
+import { makeItem } from "../helpers.js";
+import { CommandKind, type SlashCommand } from "../types.js";
+
+export function createSwitchCommand(): SlashCommand {
+ return {
+ name: "switch",
+ description: "Switch to an existing session",
+ usage: "/switch <session_id>",
+ example: "/switch my-session",
+ kind: CommandKind.BUILT_IN,
+ takesArgs: true,
+ action: async (ctx, args) => {
+ if (ctx.isProcessing) {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "session is busy"));
+ return;
+ }
+ const targetId = args.trim();
+ if (!targetId) {
+ ctx.addItem(makeItem(ctx.sessionId, "error", "usage: /switch <session_id>"));
+ return;
+ }
+ ctx.updateSession(targetId);
+ ctx.clearEntries();
+ ctx.addItem(makeItem(targetId, "info", `Switched to session ${targetId}`, "i"));
+ await ctx.restoreHistory(targetId);
+ },
+ };
+}
diff --git a/jiuwenclaw/cli/src/core/commands/helpers.ts b/jiuwenclaw/cli/src/core/commands/helpers.ts
index 939be4bec8..3251bde0c6 100644
--- a/jiuwenclaw/cli/src/core/commands/helpers.ts
+++ b/jiuwenclaw/cli/src/core/commands/helpers.ts
@@ -1,4 +1,4 @@
-import type { HistoryItem } from "../types.js";
+import type { HistoryItem, DiffMeta } from "../types.js";
function now(): string {
return new Date().toISOString();
@@ -30,6 +30,15 @@ export function addError(sessionId: string, content: string): HistoryItem {
return makeItem(sessionId, "error", content);
}
+export function addDiff(
+ sessionId: string,
+ content: string,
+ meta: DiffMeta,
+): HistoryItem {
+ const id = `diff-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
+ return { kind: "diff", id, sessionId, content, meta, at: now() };
+}
+
export function parseArgs(raw: string): string[] {
return raw.trim().split(/\s+/).filter(Boolean);
}
diff --git a/jiuwenclaw/cli/src/core/types.ts b/jiuwenclaw/cli/src/core/types.ts
index cfc8254385..8cf423afc1 100644
--- a/jiuwenclaw/cli/src/core/types.ts
+++ b/jiuwenclaw/cli/src/core/types.ts
@@ -122,6 +122,39 @@ export interface TeamMessageEvent {
timestamp: number;
}
+export interface Hunk {
+ oldStart: number;
+ oldLines: number;
+ newStart: number;
+ newLines: number;
+ lines: string[];
+}
+
+export interface FileDiff {
+ filePath: string;
+ hunks: Hunk[];
+ isNewFile: boolean;
+ linesAdded: number;
+ linesRemoved: number;
+ lastEditTime?: string;
+}
+
+export interface TurnDiff {
+ turnIndex: number;
+ userPromptPreview: string;
+ timestamp: string;
+ files: Record<string, FileDiff>;
+ stats: {
+ filesChanged: number;
+ linesAdded: number;
+ linesRemoved: number;
+ };
+}
+
+export interface DiffMeta {
+ turns: TurnDiff[];
+}
+
export type HistoryItem =
| { kind: "user"; id: string; sessionId: string; content: string; at: string }
| {
@@ -178,4 +211,12 @@ export type HistoryItem =
meta?: InfoMeta;
mediaItems?: MediaItem[];
at: string;
+ }
+ | {
+ kind: "diff";
+ id: string;
+ sessionId: string;
+ content: string;
+ meta: DiffMeta;
+ at: string;
};
diff --git a/jiuwenclaw/cli/src/ui/components/messages/basic-message-components.ts b/jiuwenclaw/cli/src/ui/components/messages/basic-message-components.ts
index b18d9c403e..e9868f21b6 100644
--- a/jiuwenclaw/cli/src/ui/components/messages/basic-message-components.ts
+++ b/jiuwenclaw/cli/src/ui/components/messages/basic-message-components.ts
@@ -10,3 +10,4 @@ export {
InfoMessageComponent,
SystemMessageComponent,
} from "./meta-components.js";
+export { DiffComponent } from "./diff-component.js";
diff --git a/jiuwenclaw/cli/src/ui/components/messages/diff-component.ts b/jiuwenclaw/cli/src/ui/components/messages/diff-component.ts
new file mode 100644
index 0000000000..47f6492d1e
--- /dev/null
+++ b/jiuwenclaw/cli/src/ui/components/messages/diff-component.ts
@@ -0,0 +1,91 @@
+import type { Component } from "@mariozechner/pi-tui";
+import type { HistoryItem, FileDiff } from "../../../core/types.js";
+import { palette } from "../../theme.js";
+import { renderWrappedText } from "../../rendering/text.js";
+
+export class DiffComponent implements Component {
+ constructor(private readonly entry: Extract<HistoryItem, { kind: "diff" }>) {}
+
+ invalidate(): void {}
+
+ render(width: number): string[] {
+ const lines: string[] = [];
+ const turns = this.entry.meta.turns || [];
+ const innerWidth = Math.max(1, width);
+
+ if (turns.length === 0) {
+ lines.push(...renderWrappedText(innerWidth, "· No file changes in this session", palette.text.dim));
+ return lines;
+ }
+
+ const totalFiles = turns.reduce((sum, t) => sum + t.stats.filesChanged, 0);
+ const totalAdded = turns.reduce((sum, t) => sum + t.stats.linesAdded, 0);
+ const totalRemoved = turns.reduce((sum, t) => sum + t.stats.linesRemoved, 0);
+
+ lines.push("");
+ lines.push(...renderWrappedText(innerWidth, `╭─ Workspace Diff ─${"─".repeat(Math.max(0, innerWidth - 22))}`, palette.text.info));
+
+ const statsLine = `│ Turns: ${turns.length} Files: ${totalFiles} +${totalAdded} -${totalRemoved}`;
+ lines.push(...renderWrappedText(innerWidth, statsLine, palette.text.dim));
+
+ for (const turn of turns) {
+ lines.push(...renderWrappedText(innerWidth, `├${"─".repeat(innerWidth - 2)}`, palette.text.dim));
+
+ const promptPreview = turn.userPromptPreview.length >= 30
+ ? turn.userPromptPreview + "..."
+ : turn.userPromptPreview;
+ lines.push(...renderWrappedText(innerWidth, `│ Turn ${turn.turnIndex}: "${promptPreview}"`, palette.text.accent));
+
+ for (const [, fileDiff] of Object.entries(turn.files)) {
+ lines.push(...this._renderFileDiff(fileDiff, innerWidth));
+ }
+ }
+
+ lines.push(...renderWrappedText(innerWidth, `╰${"─".repeat(innerWidth - 2)}`, palette.text.dim));
+ lines.push("");
+
+ return lines;
+ }
+
+ private _renderFileDiff(fileDiff: FileDiff, width: number): string[] {
+ const lines: string[] = [];
+ const fileName = fileDiff.filePath.split(/[/\\]/).pop() || fileDiff.filePath;
+
+ let timeStr = "";
+ if (fileDiff.lastEditTime) {
+ const dt = new Date(fileDiff.lastEditTime);
+ timeStr = ` [${dt.toLocaleDateString()} ${dt.toLocaleTimeString()}]`;
+ }
+
+ const header = `│ ${fileName} ${fileDiff.isNewFile ? "(new)" : ""} +${fileDiff.linesAdded} -${fileDiff.linesRemoved}${timeStr}`;
+ lines.push(...renderWrappedText(width, header, palette.text.assistant));
+
+ const maxHunkLines = 20;
+ let totalLines = 0;
+
+ for (const hunk of fileDiff.hunks) {
+ if (totalLines >= maxHunkLines) {
+ lines.push(...renderWrappedText(width, `│ ... (truncated)`, palette.text.dim));
+ break;
+ }
+
+ const hunkHeader = `│ @@ -${hunk.oldStart},${hunk.oldLines} +${hunk.newStart},${hunk.newLines} @@`;
+ lines.push(...renderWrappedText(width, hunkHeader, palette.text.dim));
+
+ for (const line of hunk.lines) {
+ if (totalLines >= maxHunkLines) break;
+ totalLines++;
+
+ if (line.startsWith("+")) {
+ lines.push(...renderWrappedText(width, `│ ${palette.status.success(line)}`, palette.text.dim));
+ } else if (line.startsWith("-")) {
+ lines.push(...renderWrappedText(width, `│ ${palette.status.error(line)}`, palette.text.dim));
+ } else {
+ lines.push(...renderWrappedText(width, `│ ${palette.text.dim(line)}`, palette.text.dim));
+ }
+ }
+ }
+
+ return lines;
+ }
+}
diff --git a/jiuwenclaw/cli/src/ui/components/messages/presentation-rules.ts b/jiuwenclaw/cli/src/ui/components/messages/presentation-rules.ts
index 11a245639e..bef5dc52c3 100644
--- a/jiuwenclaw/cli/src/ui/components/messages/presentation-rules.ts
+++ b/jiuwenclaw/cli/src/ui/components/messages/presentation-rules.ts
@@ -32,6 +32,7 @@ export function shouldGapAfterEntry(entry: HistoryItem, compact: boolean): boole
return !compact;
case "system":
case "info":
+ case "diff":
return false;
}
}
diff --git a/jiuwenclaw/cli/src/ui/components/messages/render-compact-entry.ts b/jiuwenclaw/cli/src/ui/components/messages/render-compact-entry.ts
index cfa664b45b..1f671daa41 100644
--- a/jiuwenclaw/cli/src/ui/components/messages/render-compact-entry.ts
+++ b/jiuwenclaw/cli/src/ui/components/messages/render-compact-entry.ts
@@ -2,6 +2,8 @@ import type { HistoryItem } from "../../../core/types.js";
import {
CompactAssistantMessageComponent,
CompactMessageComponent,
+ DiffComponent,
+ InfoMessageComponent,
UserMessageComponent,
} from "./basic-message-components.js";
import { CollapsedToolGroupMessageComponent, ToolGroupMessageComponent } from "../tools/index.js";
@@ -44,6 +46,16 @@ export function renderCompactEntry(
).render(width),
gapAfter: shouldGapAfterEntry(entry, true),
};
+ case "info":
+ return {
+ lines: new InfoMessageComponent(entry).render(width),
+ gapAfter: shouldGapAfterEntry(entry, true),
+ };
+ case "diff":
+ return {
+ lines: new DiffComponent(entry).render(width),
+ gapAfter: shouldGapAfterEntry(entry, true),
+ };
default:
return {
lines: new CompactMessageComponent(entry).render(width),
diff --git a/jiuwenclaw/cli/src/ui/components/messages/render-detailed-entry.ts b/jiuwenclaw/cli/src/ui/components/messages/render-detailed-entry.ts
index 069fd6a9c4..0ff2e8e406 100644
--- a/jiuwenclaw/cli/src/ui/components/messages/render-detailed-entry.ts
+++ b/jiuwenclaw/cli/src/ui/components/messages/render-detailed-entry.ts
@@ -1,6 +1,7 @@
import type { HistoryItem } from "../../../core/types.js";
import {
AssistantMessageComponent,
+ DiffComponent,
ErrorMessageComponent,
InfoMessageComponent,
SystemMessageComponent,
@@ -72,5 +73,10 @@ export function renderDetailedEntry(
lines: new InfoMessageComponent(entry).render(width),
gapAfter: shouldGapAfterEntry(entry, false),
};
+ case "diff":
+ return {
+ lines: new DiffComponent(entry).render(width),
+ gapAfter: shouldGapAfterEntry(entry, false),
+ };
}
}
diff --git a/pyproject.toml b/pyproject.toml
index 6ebc875c72..b2214ebf05 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -16,7 +16,7 @@ dependencies = [
"ruamel.yaml>=0.18.0",
"lark-oapi>=1.5.3",
"loguru>=0.7.3",
- "openjiuwen==0.1.10.post2",
+ "openjiuwen @ git+https://gitcode.com/openJiuwen/agent-core.git@c678a9a9c0d25ebc7d1283c07df4bc884df318d1",
"pip==26.0.1",
"pgvector>=0.4.2",
"websockets>=12.0",
diff --git a/tests/unit_tests/agentserver/test_agentserver_cli_commands.py b/tests/unit_tests/agentserver/test_agentserver_cli_commands.py
index c640487bde..88987c785a 100644
--- a/tests/unit_tests/agentserver/test_agentserver_cli_commands.py
+++ b/tests/unit_tests/agentserver/test_agentserver_cli_commands.py
@@ -136,12 +136,8 @@ async def test_handle_command_diff_returns_summary_payload(server, fake_ws):
{
"response_id": "req-diff",
"payload": {
- "summary": "Workspace diff preview",
- "items": [
- {"label": "files_changed", "value": "3"},
- {"label": "insertions", "value": "24"},
- {"label": "deletions", "value": "7"},
- ],
+ "type": "list",
+ "turns": [],
},
"ok": True,
}