Skip to content

Commit 3d9ff00

Browse files
author
clawsweeper-repair
committed
fix(file-transfer): name file-transfer tool in invoke redirect
1 parent b712aa4 commit 3d9ff00

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/agents/tools/nodes-tool-commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export async function executeNodeCommandAction(params: {
132132
// file-transfer.
133133
if (dedicatedAction && POLICY_REDIRECT_INVOKE_COMMANDS.has(invokeCommandNormalized)) {
134134
throw new Error(
135-
`invokeCommand "${invokeCommand}" enforces a path-allowlist policy and cannot be invoked via the generic nodes.invoke surface; use action="${dedicatedAction}"`,
135+
`invokeCommand "${invokeCommand}" enforces a path-allowlist policy and cannot be invoked via the generic nodes.invoke surface; use the dedicated file-transfer tool "${dedicatedAction}"`,
136136
);
137137
}
138138
if (dedicatedAction && !params.allowMediaInvokeCommands) {

src/agents/tools/nodes-tool.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,20 @@ describe("createNodesTool screen_record duration guardrails", () => {
321321
).rejects.toThrow('invokeCommand "system.run" is reserved for shell execution');
322322
});
323323

324+
it("redirects file-transfer invoke commands to the dedicated file-transfer tool", async () => {
325+
const tool = createNodesTool({ allowMediaInvokeCommands: true });
326+
327+
await expect(
328+
tool.execute("call-1", {
329+
action: "invoke",
330+
node: "macbook",
331+
invokeCommand: "file.fetch",
332+
}),
333+
).rejects.toThrow(
334+
'invokeCommand "file.fetch" enforces a path-allowlist policy and cannot be invoked via the generic nodes.invoke surface; use the dedicated file-transfer tool "file_fetch"',
335+
);
336+
});
337+
324338
it("keeps invoke pairing guidance for scope upgrade rejections", async () => {
325339
gatewayMocks.callGatewayTool.mockRejectedValueOnce(
326340
new Error("scope upgrade pending approval (requestId: req-123)"),

0 commit comments

Comments
 (0)