feat: terminal工具的cd参数改为可选

- definitions.json: cd从required移除并标nullable,描述说明缺省用会话当前工作目录
- executor.js: 缺省逻辑本就用ctx.taskDir,顺带修正错误信息(不传cd时不再显示undefined,改为显示解析后的实际路径)
This commit is contained in:
2026-09-02 21:45:46 +08:00
parent 926b0f6eec
commit 7e046e5bbe
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -547,7 +547,7 @@ async function toolTerminal(ctx, args) {
const maxChars = cfg.terminal.max_output_chars;
let cwd = ctx.taskDir;
if (args.cd) cwd = resolveInTask(ctx.taskDir, args.cd);
if (!fs.existsSync(cwd)) throw new Error('cd 目录不存在:' + args.cd);
if (!fs.existsSync(cwd)) throw new Error('工作目录不存在:' + cwd);
return new Promise((resolve) => {
const child = spawn('/bin/sh', ['-c', args.command], { cwd, detached: true, env: process.env });