pub fn apply_with_target(
surface: &AgentSurface,
value: Value,
target: Option<Map<String, Value>>,
) -> Result<Value, AppError>Expand description
The body of apply, with the resolved target supplied rather than read.
The target lives in a process-wide OnceLock, which is correct for a
one-shot binary and wrong for a test binary: paths and agent_surface unit
tests share one process, so whether a target exists would depend on which
test ran first. Taking it as an argument makes every test state its own
premise, and keeps the production call site the only place that reads global
state.
§Errors
Returns AppError::Usage when the request cannot be honoured as asked.