Give Guardian V2 full tool action context (#38441)

## Why

Guardian V2 needs the requested action and its conversation context to assess
risk; a tool name and call ID alone do not describe what the tool will do.

## What changed

- Expose the original, pre-hook `ToolPayload` to tool lifecycle contributors.
- Build Guardian V2 classifier input from the bounded conversation transcript
  and a structured planned-action object containing the tool name and arguments.
- Warn and skip classification if the planned action cannot be serialized.

## Testing

- Verify lifecycle contributors receive tool arguments.
- Verify Guardian V2 sends transcript history and planned-action JSON to the
  classifier.

GitOrigin-RevId: 28266ef7c1d2267ba705fcfbd9be4ef48e64e104
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-13 21:49:32 +00:00
1 parent 4343b2bdc4
commit 53eaa297e5
7 files changed
+133 -16

No files matched your search

+1
View File
@@ -32,6 +32,7 @@ pub(crate) async fn notify_tool_start(invocation: &ToolInvocation) {
turn_id: invocation.turn.sub_id.as_str(),
call_id: invocation.call_id.as_str(),
tool_name: &invocation.tool_name,
payload: &invocation.payload,
conversation_history: Arc::clone(&conversation_history),
source: extension_tool_call_source(invocation.source.clone()),
})