对齐 run_command 与 write_file 的默认路径行为。

将 run_command 在未传 cwd 时改为默认 data/workspace,并将 write_file 调整为相对路径写入 data/workspace、绝对路径直写(经路径守卫校验),同步更新测试与文档。

Made-with: Cursor
This commit is contained in:
oliver 2026-05-01 01:10:03 +08:00
parent d0a66d190d
commit e06184cc2f
5 changed files with 15 additions and 15 deletions

View file

@ -73,8 +73,9 @@ class LocalAdapter:
try:
timeout_s = max(1, min(int(timeout or 30), 600))
# run_command never follows adapter cd state.
# It only uses explicit cwd; otherwise defaults to workspace root (".").
workdir = str(resolve_workspace_path(cwd or "."))
# It only uses explicit cwd; otherwise defaults to data/workspace.
workdir = str(resolve_workspace_path(cwd or "data/workspace"))
Path(workdir).mkdir(parents=True, exist_ok=True)
run_kwargs: dict[str, Any] = {
"cwd": workdir,
"shell": True,