fix: select the Python interpreter for each check plan

This commit is contained in:
Agent Workbench Dev
2026-11-06 14:17:57 +08:00
parent b4b139a1ba
commit 5e824dae0f
15 changed files with 238 additions and 8 deletions
+2 -1
View File
@@ -144,6 +144,7 @@ export function validateToolArgs(tool, args, config = {}) {
if (tool === 'read_file' && args.expected_sha256 !== undefined && (typeof args.expected_sha256 !== 'string' || !/^[a-f0-9]{64}$/i.test(args.expected_sha256))) throw new Error('文件续读expected_sha256需要64位SHA256。');
if (args.case_sensitive !== undefined && typeof args.case_sensitive !== 'boolean') throw new Error('case_sensitive 必须是布尔值。');
if (tool === 'plan_checks' && args.names !== undefined && (!Array.isArray(args.names) || args.names.some(name => typeof name !== 'string'))) throw new Error('检查脚本名称需要文本数组。');
if (tool === 'plan_checks' && args.python_executable !== undefined && (typeof args.python_executable !== 'string' || !args.python_executable.trim() || /[\0\r\n]/.test(args.python_executable))) throw new Error('Python解释器需要文件路径,不接受空值、换行或命令参数。');
if (tool === 'plan_delivery' && args.message !== undefined && typeof args.message !== 'string') throw new Error('提交说明需要文本。');
if (tool === 'query_code' && (args.kind !== undefined && !['all', 'symbols', 'imports', 'files'].includes(args.kind) || args.query.length > ceiling(config, 200))) throw new Error('索引查询类型无效或查询超过200字。');
if (tool === 'propose_patch' && (!/^[a-f0-9]{64}$/i.test(args.base_sha256) || !Array.isArray(args.edits) || !args.edits.length || !unrestricted(config) && args.edits.length > 32)) throw new Error('精确补丁需要有效SHA256和1到32个替换。');
@@ -880,7 +881,7 @@ export class Runtime {
const job=await promise;return {status:job.status,job_id:job.id,plan_id:plan.id,summary:job.summary,log_artifact_id:job.logArtifactId,environment:job.after,requires_verification:job.requiresVerification};
});
}
else if (tool === 'plan_checks') result = await this.checkRunner().plan(session, args.names);
else if (tool === 'plan_checks') result = await this.checkRunner().plan(session, args.names, { pythonExecutable: args.python_executable });
else if (tool === 'plan_delivery') {
const plan = await this.gitDelivery().plan(session, args.message === undefined ? {} : { message: args.message }, { source: 'agent' });
result = { status: 'awaiting_review', plan_id: plan.id, task_id: plan.taskId, paths: plan.paths, message: plan.message,