antigravity 0.12.0
antigravity: ^0.12.0 copied to clipboard
A native Dart client SDK for Google Antigravity, fully decoupled from the Flutter framework for server, CLI, and mobile compatibility.
0.12.0 #
- Sync with Python SDK v0.1.15:
- Stop Lifecycle Hook (
StopHook):- Added
StopHook,StopDecision,StopHookResult, andStopArgsfor intercepting turn completion when the agent reaches idle. - Enables inspecting the assistant's final response and deciding whether to allow the turn to finish (
StopDecision.allowStop) or continue execution (StopDecision.continueTurn) with an injected feedback system prompt. - Added
HookRunner.dispatchStopand wiredLIFECYCLE_HOOK_STOPthroughHookRouter, preserving turn context across continuation cycles. - Followed Dart language heuristics: mapped Python
StopDecision.CONTINUEtoStopDecision.continueTurn(sincecontinueis a reserved control flow keyword in Dart) while maintaining exact wire compatibility (CONTINUEon the wire, supporting both prefixed and bare values).
- Added
- Terminal Command Sandbox Configuration (
enableSandbox):- Added
enableSandboxproperty toRunCommandConfig(defaults tofalse). - Propagated
enable_sandboxintolocalharnessharness_side_tools.run_commandconfiguration over the wire, allowing opt-in execution within OS-level sandboxing (exebox).
- Added
- Universal JSON Schema Normalization (
normalizeSchema):- Added
normalizeSchemainschema_utils.dartto canonicalize custom tool input schemas before wire transmission. - Recursively normalizes uppercase type names (
STRING,OBJECT, etc.) to standard lowercase OpenAPI/JSON Schema strings (string,object), converts snake_case combiners and attributes (any_of,additional_properties, etc.) to camelCase (anyOf,additionalProperties), and preserves literal constraints (enum,const,default). - Eliminates HTTP 400 Bad Request schema validation errors when targeting local OpenAI-compatible inference endpoints (Ollama, LM Studio, vLLM).
- Added
- Tool Execution Metadata Preservation:
- Added
serverNametoToolResultand preservedid,callId,stepId, andserverNameacross allToolResultexecutions, error handlers, and internal SDK fallback responses.
- Added
- Interactive CLI Execution Behavior:
- Updated
runInteractiveLoopininteractive.dartto ensurecapabilities.agentBehavioris explicitly set toAgentBehavior.interactive.
- Updated
- Harness Downloader Default Version:
- Updated default upstream
localharnessbinary download version inHarnessDownloaderto0.1.15.
- Updated default upstream
- Stop Lifecycle Hook (
0.11.0 #
- Sync with Python SDK v0.1.14:
- Workspace Path Normalization:
- Added
normalizeWorkspacePathandnormalizeWorkspacePathsinlocal_connection_config.dartto expand~, normalizefile:///URIs, and resolve relative workspace paths against the current working directory to absolute filesystem paths. - Updated
BaseLocalAgentConfigandLocalConnectionStrategyto canonicalize all workspace directories before transmitting tolocalharness, preventing incorrect resolution againstappDataDir.
- Added
- Compaction Lifecycle Hook:
- Added
LIFECYCLE_HOOK_ON_COMPACTIONsupport toHookRouterand enabled hooks payload inLocalConnection. - Removed duplicate compaction hook dispatches from raw streaming
StepUpdateevents, ensuringOnCompactionHookhandlers fire exactly once per compaction event. This matches the upstream fix, which routes compaction solely through the lifecycle hook RPC.
- Added
- Compaction index de-duplication (Dart-only, no Python counterpart):
- Added a
Conversationsafeguard that de-duplicatescompactionIndicesby compaction step identity (wireid, elsetrajectoryId:stepIndex). The Python SDK appends compaction indices unconditionally and relies on the harness emitting a singleCOMPACTIONstep per event; this guard keeps the count correct if successiveACTIVE/DONEupdates arrive for the same step. It is a deliberate divergence, not a port.
- Added a
- Vertex AI authentication override:
- Verified against the upstream
VertexEndpointand thelocalharnessproto contract: the accepted resolution was theapi_key(Express Mode) field, and there is noauthfield in either the Python model or the wire message. Dart already shipped this in v0.10.0, so is satisfied without further work in this release.
- Verified against the upstream
- Subagent Custom Tools Scoping & Discovery:
- Added
AgentConfig.getAllCustomTools()to automatically collect and register custom callable tools across the main agent and subagents, detecting name collisions early. - Added support for subagent-exclusive tools and resolved tool definitions automatically in
LocalConnectionStrategy._buildHarnessConfig().
- Added
- Harness Downloader Default Version:
- Updated default upstream
localharnessbinary download version inHarnessDownloaderto0.1.14.
- Updated default upstream
- Workspace Path Normalization:
0.10.0 #
- Sync with Python SDK v0.1.13:
- Pre-Tool Hook Argument Modification:
- Pre-tool lifecycle hooks can now inspect, sanitize, and modify tool input arguments prior to execution by returning
HookResult(allow: true, modifiedArgs: {...}). - Added sequential argument modification chaining across registered
PreToolCallDecideHookinstances inHookRunner.dispatchPreToolCall. - Updated
HookRouterto emitmodified_arguments_jsoninPreToolResultfor harness-side tool authorization.
- Pre-tool lifecycle hooks can now inspect, sanitize, and modify tool input arguments prior to execution by returning
- Tool Lifecycle Step Correlation (
stepId):- Added
stepId(@MappableField(key: 'step_id')) toToolCallandToolResult. - Added
stepIdparameter and property toToolExecutionException. - Updated
HookRouterto extract and correlatestepId(trajectory_id:step_index) across pre-tool, post-tool, and on-tool-error lifecycle hooks.
- Added
- Structured Command Execution Configuration (
RunCommandConfig):- Introduced
RunCommandConfigto configure execution timeouts (timeoutSeconds) and authorize background daemon commands (enableDaemons). - Added
runCommandConfigproperty toCapabilitiesConfigandSubagentCapabilities. - Mapped
RunCommandConfigtolocalharnessharness_side_tools.run_commandconfiguration (enable_daemon_commandsandmax_timeout_ms).
- Introduced
- Vertex AI Custom Base URL Support:
- Updated
VertexEndpointto avoid hydrating ambientGOOGLE_CLOUD_PROJECTandGOOGLE_CLOUD_LOCATIONenvironment variables when a custombaseUrlis specified.
- Updated
- Harness & Binary Discovery:
- Updated default
localharnessbinary download version inHarnessDownloaderto0.1.13.
- Updated default
- Pre-Tool Hook Argument Modification:
0.9.2 #
- Fix
RetryConfigSerialization:ModelAPIRetryConfig.toMap()/toJson()(and anyRetryConfigcontaining one) threwMapperException: Unknown type Durationand emitted a spuriousinitial_sleep_durationkey thatlocalharnessrejects. TheinitialSleepDurationDurationis a convenience argument, not a wire field, but was being generated as one.- Added
ModelAPIRetryConfig.raw()as the@MappableConstructor(), so only the integerinitialSleepDurationMsis serialized. The unnamed constructor still accepts eitherinitialSleepDurationMsorinitialSleepDuration.
- Fix Subagent Tool Protobuf Naming:
- Corrected
harness_side_toolsfield names for subagents inLocalConnectionStrategy("file_edit"and"write_to_file", matchinglocalharness.proto), resolvingunknown field "edit_file"errors when launching static subagents.
- Corrected
- CI & Example Automation:
- Added non-interactive terminal fallback (
stdin.hasTerminal) toexample/getting_started/human_in_the_loop.dartto prevent test runs from blocking on headless standard input.
- Added non-interactive terminal fallback (
0.9.1 #
- Critical Bug Fixes for Local Harness Execution:
- Trajectory Idle State Recognition: Added support for
STATE_FULLY_IDLE(andFULLY_IDLE) inLocalConnectiontrajectory state updates, properly emitting theidle_sentinelstep and preventingagent.chat()/response.text()from hanging at turn completion. - Tool Authorization Handshake: Added handler for
LIFECYCLE_HOOK_PRE_TOOL/PRE_TOOLinHookRouter, returning validpre_tool_resultdecisions (ALLOW/DENY) to the harness and resolving tool execution deadlocks. - Wire Path Normalization: Added wire-format URI normalization (
file:///,cns://) for tool call arguments inHookRouterto support path-based safety policies and canonical workspace containment.
- Trajectory Idle State Recognition: Added support for
0.9.0 #
- Sync with Python SDK v0.1.11:
- Default Model Upgrade to Gemini 3.7 Flash: Updated default generative text model in
lib/src/models.darttogemini-3.7-flash. - Session Budget Enforcement (
BudgetConfig) & Stop Reasons (StopReason):- Introduced
BudgetConfigto configure session-level caps:maxModelCalls,maxToolCalls,maxInputTokens,maxOutputTokens,maxTotalTokens. - Added
StopReasonenum (unspecified,maxModelCallsExceeded,maxToolCallsExceeded,maxInputTokensExceeded,maxOutputTokensExceeded,maxTotalTokensExceeded,quotaExhausted). - Exposed
ChatResponse.stopReason,ChatResponse.usage, andConversation.lastTurnStopReason.
- Introduced
- Vertex AI Express Mode (
apiKey):- Added
apiKeysupport toVertexEndpointfor Vertex AI Express Mode authentication. - Implemented mutual exclusivity validation: rejects configurations passing both
apiKey(Express Mode) andproject/location(Standard Mode).
- Added
- Agent Behavior Standard (
AgentBehavior):- Renamed
AgentModeenum toAgentBehavior(autonomous,interactive), mapping toAGENT_BEHAVIOR_AUTONOMOUSandAGENT_BEHAVIOR_INTERACTIVEprotobuf values. - Provided
typedef AgentMode = AgentBehaviorand constructor/getter aliases for backward compatibility.
- Renamed
- Hierarchical & Nested Subagent Controls:
- Added
maxSubagentDepthandallowedSubagentsallowlist configuration onCapabilitiesConfigandSubagentCapabilities. - Enabled
BuiltinTools.startSubagenton custom subagents when configured in their capability toolsets. - Validated that
maxSubagentDepthandallowedSubagentscannot be set when subagents are disabled. - Added subagent allowlist validation on
BaseLocalAgentConfigensuring all referenced subagent names exist in the configuredsubagentslist.
- Added
- Step Metadata & Image Artifact Paths:
- Added
parentTrajectoryIdanddepthfields toStepand updatedStep.fromMapparser. - Added
outputPathtoGenerateImageResultand updatedtoString()to returnoutputPathwhen non-empty.
- Added
- Policy Enhancements:
- Made
handleroptional inaskUserpolicy builder for host platform delegation compatibility.
- Made
- New Example & Documentation:
- Added
example/getting_started/budget_limits.dartdemonstrating all 5 budget limits and stop reason inspection. - Updated
example/getting_started/subagents.dartshowcasing dynamic self-delegation, static subagents, and nested subagent hierarchies.
- Added
- SDK Version Bump & Dependency Synchronization:
- Updated package version to
0.9.0and MCP implementation version to0.9.0.
- Updated package version to
- Default Model Upgrade to Gemini 3.7 Flash: Updated default generative text model in
0.8.0 #
- Sync with Python SDK v0.1.10 & Dart-Idiomatic Enhancements:
- Breaking API Change:
Conversation.lastTurnUsagesignature updated toUsageMetadata?(matching Python SDK v0.1.10) to returnnullwhen no token usage was recorded during a turn. - Gemini Prioritized Inference (
ServiceTier): IntroducedServiceTierenum (standard,priority,flex) and support inGeminiModelOptionsandUsageMetadatato configure high-priority model execution with automated fallback. - Live Token Usage Updates: Added support for live
UsageUpdateevent streaming over WebSockets, accumulating per-trajectory token usage live during execution. Added subtraction (-) operator support toUsageMetadata. - Agent Execution Modes (
AgentMode): IntroducedAgentModeenum (autonomous,interactive) inCapabilitiesConfigandSubagentCapabilitieswith interactive tool validation warnings (BuiltinTools.askQuestion). - Interactive CLI Spinner: Updated interactive CLI step spinner formatting (
formatStepSpinnerMessage) to display all active tool names during concurrent tool calls (e.g.Running tools 'tool_a', 'tool_b'...). - Tool Call Correlation ID: Added
callIdcorrelation support acrossToolCall,ToolResult,ToolExecutionException, and lifecycle hook payloads. - Flexible Context-Aware Lifecycle Hooks: Added
.stateless()factory constructors toFunctionInspectHook,FunctionDecideHook, andFunctionTransformHookto seamlessly support both(data)and(context, data)callback signatures. - ActionCompaction Handling: Emits context window compaction events over WebSockets and dispatches registered
OnCompactionHookhandlers. - Standardized System Instructions Strategy: Plain string instructions default to an appended system instruction strategy, while
CustomSystemInstructionscompletely replaces built-in instructions. - LiteRT Token Output Limit: Increased LiteRT default
maxOutputTokensfrom 8192 to 16,384 tokens to prevent truncation during complex generation.
- Breaking API Change:
0.7.0 #
- Sync with Python SDK v0.1.9 & Dart-Idiomatic Enhancements:
- Model-Call Retry & Backoff Configuration: Introduced
RetryConfig,ModelAPIRetryConfig, andModelOutputRetryConfigwithRetryConfig.benchmark()preset for controlling exponential backoff and output retry behavior acrossLocalAgentConfig,LocalOpenAIAgentConfig, andLiteRTAgentConfig. - Strongly-Typed
Duration& Jitter Ratio Validation: AddedDurationsupport (initialSleepDuration,serverTimeout) toModelAPIRetryConfigandMcpServerConfig. ValidatesjitterRangeas a ratio between0.0and1.0. - Strongly-Typed Logging with
package:logging:DebugConfigaccepts strongly-typedLevelobjects (level: Level.WARNING) or string names, validating levels and applying process-safe logger updates onAgent.start(). Uri&Uint8ListMedia Buffers: AddedUrigetters (uri,baseUri) onMcpStreamableHttpServerandModelEndpoint, plusMcpStreamableHttpServer.fromUri()factory constructor. AddedUint8List get bytesgetter onMediaContentandFileobject support infromFile().- Step & Turn Extensions: Added extension getters (
isUserTurn,isModelTurn,isFinished,isDone) onStep,StepSource, andStepStatus. - LiteRT Warm-up Timeout Scaling: Dynamically scales LiteRT engine warm-up timeouts based on context size (
maxContextTokens). - Expanded Audio Payload MIME Support: Added support for
audio/x-wav,audio/wave,audio/vnd.wave,audio/mp4,audio/webm, and additional audio formats. - Prompt Validation: Added strict validation in
Conversation.chat()to reject null, empty string, whitespace-only, or empty content prompts withAntigravityValidationException. - Hybrid Exception Hierarchy:
AntigravityValidationExceptionimplements bothExceptionandArgumentErrorfor backwards compatibility. - SDK Alignment: Bumped SDK version to
0.7.0aligned with Python SDKv0.1.9release.
- Model-Call Retry & Backoff Configuration: Introduced
0.6.0 #
- Sync with Python SDK v0.1.8:
- Default Model Upgrade to Gemini 3.6 Flash: Updated default generative text model in
lib/src/models.darttogemini-3.6-flash. - Prompt Sanitization: Strips null bytes (
\x00) and dangerous control characters (DEL,BEL,C1) from incoming string prompts at the wire boundary. - Tool Execution Exception: Introduced
ToolExecutionExceptioncarryingmessage,toolName, andserverNamemetadata when tool execution fails, with updated hook routing inHookRouter. - Subagent Custom & Templated System Instructions: Expanded
SubagentConfigsystem instructions to supportCustomSystemInstructionsandTemplatedSystemInstructions. - SDK Version Bump & Alignment: Bumping SDK version to 0.6.0 aligned with Python SDK v0.1.8 release updates.
- Default Model Upgrade to Gemini 3.6 Flash: Updated default generative text model in
0.5.0 #
- Sync with Python SDK v0.1.7:
- Hierarchical Thread-Safe State Management: Introduced the
StateStoreclass for hierarchical context state sharing and lock/reentrancy support. RetargetedHookContextandToolContextto inherit fromStateStore. - Session Continuation Modes: Implemented
SessionContinuationModeto specify continuation behavior (RESUME,CREATE_OR_RESUME,CREATE_ONLY,SESSION_CONTINUATION_MODE_UNSPECIFIED) with validation checks onAgentConfig. - Dynamic Environment Hydration: Hydrates Vertex project and location parameters automatically from standard
GOOGLE_CLOUD_PROJECTandGOOGLE_CLOUD_LOCATIONenvironment variables when not explicitly passed, and enables Vertex mode automatically whenGOOGLE_GENAI_USE_VERTEXAIorGOOGLE_GENAI_USE_ENTERPRISEis set. - Websocket Retry Backoff & DNS Resolution: Refactored websocket connections in
LocalConnectionStrategyto retry on bothlocalhostand127.0.0.1to ensure reliable connections in containerized sandboxes. - Spinner Pause/Resume: Enhanced CLI
Spinnerwith pause and resume behaviors, and integrated them into user confirmation/question hooks to prevent prompt clobbering. - Custom Tool Execution Support: Added
custom_toolparsing support inStep.fromMapand filtered out tool calls from StepUpdate if they are local custom tools to prevent client duplicate events. - Addition Operator for Token Usage: Implemented
+addition operator onUsageMetadatafor clean accumulation of token usage. - Updated default image generation model to
'gemini-3.1-flash-lite-image'. - Added
ThinkingLevel.extraHigh('extra_high') level support.
- Hierarchical Thread-Safe State Management: Introduced the
0.4.1 #
- Bug Fixes & Adjustments:
- Restored default workspaces (current working directory) and capabilities configuration on
BaseLocalAgentConfigto prevent silent sandboxing regressions. - Fixed client handshake protocol to announce the correct client version instead of a stale one.
- Added missing
read_url_contenttool field mapping inStep.fromMapparser. - Resolved
HttpClientsocket/connection leak in LiteRT loopback server health checks. - Documented public configuration fields on
LocalOpenAIAgentConfigandLiteRTAgentConfig.
- Restored default workspaces (current working directory) and capabilities configuration on
0.4.0 #
- Local Inference & OpenAI Endpoint Support:
- Added support for local Gemma execution using LiteRT via
LiteRTAgentConfigandLiteRTConnectionStrategy(which manages a python loopback HTTP server). - Added support for any OpenAI-compatible completions API (e.g. Ollama, LM Studio) via
LocalOpenAIAgentConfigandLocalOpenAIConnectionStrategy.
- Added support for local Gemma execution using LiteRT via
- Multimodal Tool Outputs:
- Enabled custom tools to return media assets (images, audio, video, documents) directly via a single tool response without needing separate follow-up turns. Media is extracted and sent as
supplemental_mediaintool_response.
- Enabled custom tools to return media assets (images, audio, video, documents) directly via a single tool response without needing separate follow-up turns. Media is extracted and sent as
- Model Context Protocol (MCP):
- Decoupled tool calls and safety policy engines from legacy
mcp_string prefix synthesis, utilizing explicitserverNameattributes in tool evaluation.
- Decoupled tool calls and safety policy engines from legacy
- Alias Deserialization Support:
- Handled
results/entriesalias inListDirectoryResultandoutput/combined_outputalias inRunCommandResult.
- Handled
- Automated Binary Discovery Updates:
- Added version checking logic to verify if the cached
localharnessbinary is out of date. - Automatically triggers a re-download/upgrade if the cached binary version is older than the SDK's default version (
0.1.6).
- Added version checking logic to verify if the cached
0.3.1 #
-
Fix Tool Error Hook Dispatching:
- Resolved a bug where
OnToolErrorHookwas never dispatched for either client-side custom tool failures or harness-side built-in tool failures. - Implemented client-side tool error dispatching in
local_connection.dartwith support for recovery values. - Added routing for
LIFECYCLE_HOOK_ON_TOOL_ERRORandON_TOOL_ERRORhook requests inhook_router.dartand covered it with a unit test.
- Resolved a bug where
-
Dart 3 Modernization:
- Refactored core classes
ConnectionandConnectionStrategyto use Dart 3abstract interface classmodifiers. - Marked
MediaContentas asealed classto restrict subclass hierarchy and support compiler-level exhaustiveness checks. - Modernized
registerHook,allow,deny, andaskUserto leverage case type pattern matching inside switch statements. - Refactored policy bucket index resolution (
_bucketIndex), file change triggers (onFileChange), shorthand model builder (_buildShorthandModels), and step state mappings (Step.fromMap) to use clean switch expressions and logical OR patterns. - Updated local connection classes to implement rather than extend the new interface classes.
- Added conditional imports in
lib/src/types/content.dartto support running the package on the web.
- Refactored core classes
0.3.0 #
- Synchronize updates from Python SDK (v0.1.5):
- Added new
read_url_contentbuiltin tool and itsReadUrlContentResultstructured output. - Added
StepType.thinkingto enum representation for telemetry tracking. - Implemented the
HookRouterto process WebSocket-basedCallHookRequestturn and tool lifecycle hooks delegated by the harness. - Added support for telemetry
PreStepHookandPostStepHookinsideHookRunnerand connection parser. - Implemented
_StepTrackerto prevent duplicate step hooks or non-linear state transitions. - Supported error and cancelled propagation in
trajectory_state_updateevents. - Historical Step Absorption: Aligned startup handshake to await and parse pre-existing conversation history and usage metadata from
initialize_conversation_response, populating them immediately inConversationon start.
- Added new
0.2.2 #
- Update to support web platform use
0.2.1 #
- Reintroduce generated files in package
0.2.0 #
- Model Configuration Overhaul: Replaced the monolithic
GeminiConfigwith a more flexibleModelTargetand polymorphicModelEndpointclass hierarchy (GeminiAPIEndpoint,VertexEndpoint). - Subagents Feature: Introduced
SubagentConfigandSubagentCapabilitiesallowing definition and inclusion of subagents in the main agent's configuration. - New Builtin Tools: Added
SearchWebtool and relatedSearchWebResultstructured output. - Enhanced Configuration: Support for environment variables (
env) inMcpStdioServer. RemovedimageModelfromCapabilitiesConfigto favor the new generic model targeting features.
0.1.3 #
- Added support for Vertex AI configuration (project, location, vertex options) in
GeminiConfig. - Refactored Model Context Protocol (MCP) server configurations to run connections natively on the Go-based harness, removing client-side
McpBridgereferences. - Added
SlashCommandstructure to input content primitives to support built-in planning flows. - Integrated CLI
SpinnerintorunInteractiveLoopwith step-by-step progress tracking viaagent.conversation.receiveSteps(). - Enhanced policy engine with a 9-level priority model supporting prefix wildcards and custom MCP policy validators.
- Added
AntigravityCancelledExceptionandAntigravityExecutionExceptionfor robust error handling.
0.0.1 #
- Initial release of the Antigravity Dart SDK.