From 4063dd71575f32533a2248048df0d8dca66c0c1a Mon Sep 17 00:00:00 2001 From: He Wang Date: Sat, 9 May 2026 18:21:01 +0800 Subject: [PATCH] feat(debug): print presented file paths with physical resolution (#2825) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Surface artifacts produced via the present_files tool in the CLI debug REPL so headless clients without a frontend (VS Code launch configs, etc.) can locate output files. Each turn prints newly added artifacts plus their resolved host path. Works for any source that goes through present_files — ACP agents, subagents, or sandbox writes. Co-authored-by: Claude Opus 4 --- backend/debug.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/backend/debug.py b/backend/debug.py index 341c676ed..97e12ec66 100644 --- a/backend/debug.py +++ b/backend/debug.py @@ -79,7 +79,9 @@ async def main(): from langgraph.runtime import Runtime from deerflow.agents import make_lead_agent + from deerflow.config.paths import get_paths from deerflow.mcp import initialize_mcp_tools + from deerflow.runtime.user_context import get_effective_user_id # Initialize MCP tools at startup try: @@ -113,6 +115,8 @@ async def main(): print("Tip: `uv sync --group dev` to enable arrow-key & history support") print("=" * 50) + seen_artifacts: set[str] = set() + while True: try: if session: @@ -134,6 +138,22 @@ async def main(): last_message = result["messages"][-1] print(f"\nAgent: {last_message.content}") + # Show files presented to the user this turn (new artifacts only) + artifacts = result.get("artifacts") or [] + new_artifacts = [p for p in artifacts if p not in seen_artifacts] + if new_artifacts: + thread_id = config["configurable"]["thread_id"] + user_id = get_effective_user_id() + paths = get_paths() + print("\n[Presented files]") + for virtual in new_artifacts: + try: + physical = paths.resolve_virtual_path(thread_id, virtual, user_id=user_id) + print(f" - {virtual}\n → {physical}") + except ValueError as exc: + print(f" - {virtual} (failed to resolve physical path: {exc})") + seen_artifacts.update(new_artifacts) + except (KeyboardInterrupt, EOFError): print("\nGoodbye!") break