@@ -57,13 +57,15 @@ import {
5757} from '@sim/testing'
5858import { DrizzleQueryError } from 'drizzle-orm/errors'
5959import { afterAll , afterEach , beforeAll , beforeEach , describe , expect , it , vi } from 'vitest'
60+ import { videoToolBodySchema } from '@/lib/api/contracts/tools/media/video'
6061import { withAssistantActionExecution } from '@/lib/assistant-actions/execution-scope'
6162import type { BillingAttributionSnapshot } from '@/lib/billing/core/attribution'
6263import type { EnvironmentResolutionSnapshot } from '@/lib/environment/utils'
6364import { executeBitbucketTool } from '@/lib/internal/bitbucket/execute-tool'
6465import { createInternalToolFileResult } from '@/lib/internal/tool-operations/file-result'
6566import type { InternalToolOperationCall } from '@/lib/internal/tool-operations/types'
6667import { executeVantaTool } from '@/lib/internal/vanta/execute-tool'
68+ import { buildDirectVideoRequest } from '@/lib/internal/video/direct-request'
6769import { projectToolResultForCopilot } from '@/lib/mothership/request/tools/resolved-secret-result'
6870import { VideoGeneratorV3Block } from '@/blocks/blocks/video_generator'
6971import {
@@ -5115,6 +5117,34 @@ describe('File Parameter Normalization', () => {
51155117 }
51165118 )
51175119
5120+ it . each ( [
5121+ { configured : undefined , requested : false , expected : false } ,
5122+ { configured : undefined , requested : true , expected : true } ,
5123+ { configured : false , requested : true , expected : false } ,
5124+ ] ) ( 'preserves Agent audio choices and configured overrides ($expected)' , async ( testCase ) => {
5125+ const providerTool = await transformBlockTool (
5126+ {
5127+ type : 'video_generator_v3' ,
5128+ params : {
5129+ provider : 'runway' ,
5130+ apiKey : 'test-runway-key' ,
5131+ directGenerateAudio : testCase . configured ,
5132+ } ,
5133+ } ,
5134+ { getAllBlocks : ( ) => [ VideoGeneratorV3Block ] , getTool : ( ) => runwayVideoTool }
5135+ )
5136+ if ( ! providerTool ) throw new Error ( 'Video tool was not exposed to the Agent' )
5137+ const prepared = prepareToolExecution (
5138+ providerTool ,
5139+ { model : 'veo3.1' , prompt : 'Animate the boat' , generateAudio : testCase . requested } ,
5140+ { } ,
5141+ 'call-video-audio'
5142+ )
5143+ const input = videoToolBodySchema . parse ( prepared . toolParams )
5144+ const request = buildDirectVideoRequest ( { ...input , provider : 'runway' } )
5145+ expect ( request . body . audio ) . toBe ( testCase . expected )
5146+ } )
5147+
51185148 it ( 'resolves canonical file IDs for single-file params during copilot execution' , async ( ) => {
51195149 mockResolveWorkspaceFileReference . mockResolvedValue ( {
51205150 id : 'wf_123' ,
0 commit comments