Fix: Resolve relative paths in send_file to absolute paths in sandboxDir.

This commit is contained in:
larchanka
2026-04-04 12:51:42 +02:00
committed by Mikhail Larchanka
parent 56f0c965d0
commit a1a59a610a

View File

@@ -75,6 +75,7 @@ const SKILL_TOOLS: any[] = [
];
import { randomUUID } from "node:crypto";
import { resolve, isAbsolute } from "node:path";
import { BaseProcess } from "../shared/base-process.js";
import type { CapabilityGraph, CapabilityNode } from "../shared/graph-utils.js";
import {
@@ -902,6 +903,11 @@ export class ExecutorAgent extends BaseProcess {
if (localPath) localPath = resolveValue(localPath).trim();
if (caption) caption = resolveValue(caption).trim();
// Resolve relative path against sandboxDir
if (localPath && !isAbsolute(localPath) && !localPath.startsWith("http")) {
localPath = resolve(getConfig().toolHost.sandboxDir, localPath);
}
if (!localPath) {
throw new Error("send_file requires local_path (or local_file_url)");
}