feat: add pre-dispatch hook for agent task middleware

Generic extension point in community codebase: PreDispatchHook type
registered in AppState, checked before every agent_query dispatch.
Enables Pro features like budget enforcement and branch policy.
This commit is contained in:
Hibryda 2026-03-17 03:27:40 +01:00
parent 19771237c9
commit 3798bedc4d
2 changed files with 10 additions and 0 deletions

View file

@ -9,6 +9,10 @@ pub fn agent_query(
state: State<'_, AppState>,
options: AgentQueryOptions,
) -> Result<(), String> {
// Run pre-dispatch hooks (budget enforcement, branch policy, etc.)
for hook in &state.pre_dispatch_hooks {
hook(&options)?;
}
state.sidecar_manager.query(&options)
}