StructuredResponse class
Common reply shape: summary + optional warnings + nextSteps.
Renders both human text and structuredContent so callers can
branch on data instead of parsing prose.
Constructors
-
StructuredResponse({required String summary, List<
String> warnings = const [], List<String> nextSteps = const [], Map<String, Object?> ? data, bool isError = false, bool textOnly = false, List<String> imagePaths = const []}) - StructuredResponse.appBusy(Duration timeout, {String? summary, bool maybeQueued = false})
-
The VM gave no answer within
timeoutthough the app has drawn frames before: busy, not starting.summaryoverrides the headline.factory - StructuredResponse.backendError(String summary, Object e)
-
A backend exception as a reply: a BackendFailure keeps its kind, data and next steps; anything unknown is a
backendToolError.factory -
StructuredResponse.error({required String summary, required GlintErrorKind errorKind, String? detail, List<
String> nextSteps = const []}) -
factory
- StructuredResponse.fromActionResult(ActionResult r, {bool detail = false})
-
Builds a response from an ActionResult. The envelope already carries
summary/warnings/nextStepsat the top level, so those are dropped fromdatarather than duplicated. Geometry (painted, hittable, logicalCenter) is omitted unlessdetailis true; the agent only needsok+ the changed-signal to continue. The failure reason is routed to the shareddetailkey so it surfaces in prose and the action log.factory - StructuredResponse.notOnThisDevice(Ability ability, AbilityGap gap)
-
abilityrefused on a device that lacks it, with the reason and what to do instead fromgap.factory - StructuredResponse.toolchainBlocked(IosToolchainBlocked e)
-
A bridge action refused by the iOS toolchain check.
factory
Properties
-
data
→ Map<
String, Object?> ? -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
imagePaths
→ List<
String> -
PNG files shipped inline as image content, so the agent sees them without a second read.
final
- isError → bool
-
final
-
nextSteps
→ List<
String> -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- summary → String
-
final
- textOnly → bool
-
Ship only the plain text: no structuredContent, so a scene-sized reply
reaches the agent once and unescaped instead of as JSON-encoded text.
final
-
warnings
→ List<
String> -
final
- wireBytes → int
-
Bytes the client receives: the structured payload, or the text alone.
no setter
Methods
-
addWarnings(
List< String> extra) → StructuredResponse -
Appends
extrato warnings (no-op when empty). -
copyWith(
{String? summary, List< String> ? warnings, List<String> ? nextSteps, Map<String, Object?> ? data, bool? isError, bool? textOnly, List<String> ? imagePaths}) → StructuredResponse - Returns a copy with the given fields replaced — so callers augmenting a response don't re-list all five fields by hand.
-
mergeData(
Map< String, Object?> extra) → StructuredResponse -
Merges
extrainto data (extra keys win). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
renderText(
) → String -
toCallResult(
) → CallToolResult -
toString(
) → String -
A string representation of this object.
inherited
-
toStructuredContent(
) → Map< String, Object?>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
refuse(
DeviceTarget device, Ability ability) → StructuredResponse? -
abilityondevice: a refusal when the device lacks it, null when it has it.