There should be a mechanism of defining, which variables should be predicted and which should be used as is. A method preparing explanatory variables is needed.
When the variable is marked for prediction this is what should happen inside the function:
Predict each marked explanatory variable;
Use fitted values for the estimation;
Use point forecasts for forecasting;
Use covariances between variables for the variance calculation;
There should be a mechanism of defining, which variables should be predicted and which should be used as is. A method preparing explanatory variables is needed.
When the variable is marked for prediction this is what should happen inside the function: