fix: preserve raw media invoke for HTTP tool clients (#34365)

This commit is contained in:
Ayaan Zaidi
2026-03-04 17:17:24 +05:30
committed by Ayaan Zaidi
parent ef4fa43df8
commit 7b5e64ef2e
6 changed files with 54 additions and 6 deletions

View File

@@ -161,6 +161,7 @@ export function createNodesTool(options?: {
currentThreadTs?: string | number;
config?: OpenClawConfig;
modelHasVision?: boolean;
allowMediaInvokeCommands?: boolean;
}): AnyAgentTool {
const sessionKey = options?.agentSessionKey?.trim() || undefined;
const turnSourceChannel = options?.agentChannel?.trim() || undefined;
@@ -754,7 +755,7 @@ export function createNodesTool(options?: {
const invokeCommandNormalized = invokeCommand.trim().toLowerCase();
const dedicatedAction =
MEDIA_INVOKE_ACTIONS[invokeCommandNormalized as keyof typeof MEDIA_INVOKE_ACTIONS];
if (dedicatedAction) {
if (dedicatedAction && !options?.allowMediaInvokeCommands) {
throw new Error(
`invokeCommand "${invokeCommand}" returns media payloads and is blocked to prevent base64 context bloat; use action="${dedicatedAction}"`,
);