mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:41:23 +00:00
fix(agents): map container workdir paths in workspace guard
Co-authored-by: Explorer1092 <32663226+Explorer1092@users.noreply.github.com>
This commit is contained in:
@@ -42,6 +42,7 @@ import {
|
||||
normalizeToolParams,
|
||||
patchToolSchemaForClaudeCompatibility,
|
||||
wrapToolWorkspaceRootGuard,
|
||||
wrapToolWorkspaceRootGuardWithOptions,
|
||||
wrapToolParamNormalization,
|
||||
} from "./pi-tools.read.js";
|
||||
import { cleanToolSchemaForGemini, normalizeToolParameters } from "./pi-tools.schema.js";
|
||||
@@ -317,7 +318,13 @@ export function createOpenClawCodingTools(options?: {
|
||||
modelContextWindowTokens: options?.modelContextWindowTokens,
|
||||
imageSanitization,
|
||||
});
|
||||
return [workspaceOnly ? wrapToolWorkspaceRootGuard(sandboxed, sandboxRoot) : sandboxed];
|
||||
return [
|
||||
workspaceOnly
|
||||
? wrapToolWorkspaceRootGuardWithOptions(sandboxed, sandboxRoot, {
|
||||
containerWorkdir: sandbox.containerWorkdir,
|
||||
})
|
||||
: sandboxed,
|
||||
];
|
||||
}
|
||||
const freshReadTool = createReadTool(workspaceRoot);
|
||||
const wrapped = createOpenClawReadTool(freshReadTool, {
|
||||
@@ -410,15 +417,21 @@ export function createOpenClawCodingTools(options?: {
|
||||
? allowWorkspaceWrites
|
||||
? [
|
||||
workspaceOnly
|
||||
? wrapToolWorkspaceRootGuard(
|
||||
? wrapToolWorkspaceRootGuardWithOptions(
|
||||
createSandboxedEditTool({ root: sandboxRoot, bridge: sandboxFsBridge! }),
|
||||
sandboxRoot,
|
||||
{
|
||||
containerWorkdir: sandbox.containerWorkdir,
|
||||
},
|
||||
)
|
||||
: createSandboxedEditTool({ root: sandboxRoot, bridge: sandboxFsBridge! }),
|
||||
workspaceOnly
|
||||
? wrapToolWorkspaceRootGuard(
|
||||
? wrapToolWorkspaceRootGuardWithOptions(
|
||||
createSandboxedWriteTool({ root: sandboxRoot, bridge: sandboxFsBridge! }),
|
||||
sandboxRoot,
|
||||
{
|
||||
containerWorkdir: sandbox.containerWorkdir,
|
||||
},
|
||||
)
|
||||
: createSandboxedWriteTool({ root: sandboxRoot, bridge: sandboxFsBridge! }),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user