feat: align Rust SDK with Python SDK (ClientInfo, Vertex AI, TerminalError, 9-bucket policy)#4
Merged
Merged
Conversation
…s, and MCP server fields - Add ClientInfo message (language, version) to InputConfig proto for SDK identification - Add use_vertex, project, location fields to InputConfig for Vertex AI backend support - Add TerminalError variant to StepStatus enum (proto state=5) - Add AntigravityExecutionError type for terminal failures - Add name, enabled_tools, disabled_tools fields to all McpServerConfig variants - Add McpServerConfig::name() accessor method - Extend GeminiConfig with vertex/project/location fields and update default tests
…l parsing - Expand from 6-bucket to 9-bucket system (specific/prefix/global × deny/ask/allow) - Add longest-match MCP tool parsing via sorted server_names list - Add fail-closed security guard: reject MCP policies without registered servers - Update enforce() signature to accept mcp_servers parameter - Add matches_target() for granular policy matching (exact, prefix wildcard, global) - Update all existing tests for new enforce() API signature
…nnection strategies - Send ClientInfo (language='rust', version=crate version) in InputConfig during handshake - Pass use_vertex/project/location fields from GeminiConfig to proto InputConfig - Map proto state=5 to StepStatus::TerminalError in both local and wasm readers - Propagate TerminalError as AntigravityExecutionError to terminate agent execution - Add rustc_version() helper for client metadata reporting - Update start_harness.rs import for ProtoClientInfo
… handling - Update Agent::start() to pass empty server_names to PolicyEnforcer::new() - Handle StepStatus::TerminalError in agent_server SSE streaming - Map TerminalError to 'TERMINAL_ERROR' status string in SSE events
…r propagation - Add test_agent_terminal_error_propagation to verify fatal error handling - Update test_agent_chat_integration to verify client metadata (language/version) - Refactor mock_localharness: extract handle_ws_connection() to satisfy clippy - Update mock harness to decode InputConfig and echo client info in responses - Fix model version: gemini-2.5-flash -> gemini-3.5-flash in all tests
The install script (just install / scripts/install_harness.sh) places the binary at ./bin/localharness. Prioritize this location before system PATH since it's the standard install method for Rust SDK users. Lookup order is now: 1. ANTIGRAVITY_HARNESS_PATH env var (explicit override) 2. ./bin/localharness (local install via just install) 3. System PATH (pip install google-antigravity) 4. Python site-packages
8aaa3b6 to
715c689
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Aligns the Rust SDK with recent Python SDK changes to ensure feature parity across both SDKs.
Changes
1. ClientInfo Handshake Protocol
ClientInfomessage toInputConfigproto (language, version fields)language="rust",version=<crate_version>)2. Vertex AI Backend Support
use_vertex,project, andlocationfields toGeminiConfigandInputConfigproto3. TerminalError Status
TerminalErrorvariant toStepStatusenum (proto state=5)AntigravityExecutionErrorcustom error typeTerminalErrorin SSE events4. 9-Bucket Policy Enforcer
specific/prefix/global × deny/ask/allowserver_nameslist for securitymatches_target()for granular policy matching (exact, prefix wildcard, global)5. MCP Server Config Enhancements
name,enabled_tools,disabled_toolsfields to allMcpServerConfigvariants (Stdio/Sse/Http)McpServerConfig::name()accessor method6. Tests
test_agent_terminal_error_propagationintegration testtest_agent_chat_integrationto verify client metadata handshakemock_localharnessto support terminal error and ClientInfo verificationgemini-2.5-flash→gemini-3.5-flashfor consistency7. Chore
Test Results
Files Changed (11 files, +608/-97)
proto/localharness.protosrc/types.rssrc/policy.rssrc/local.rssrc/wasm.rssrc/agent.rssrc/bin/start_harness.rssrc/bin/mock_localharness.rsexamples/agent_server/src/main.rstests/integration_tests.rsscripts/install_harness.sh