ChatStructuredUpdateGuard class final
Shares one host-owned node and byte budget across a structured ACP update.
Callers count each List/Map/model container with consumeContainerNode or
consumeEntry. A List<String> copies each item directly with
copyString, while a List<Model> consumes one entry before copying that
model's fields. Nested Lists and Maps each consume their own container node.
The constructor's resource and every method's field must be host-owned
constants and must never be derived from an untrusted ACP payload.
Failed copyMetadata and copyJsonValue calls leave this guard's budgets
unchanged.
Reentrant calls made by a metadata source are rejected.
Constructors
- ChatStructuredUpdateGuard({required ChatInputBudget budget, required String resource})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkCollection(
Object? value, {required String field}) → int -
consumeContainerNode(
{required String field}) → void -
consumeEntry(
{required String field}) → void -
copyJsonValue(
Object? value, {required String field, bool omitEmbeddedMediaDataUris = false}) → Object? - Creates a detached, deeply immutable copy of any JSON-compatible value.
-
copyMetadata(
Object? value, {required String field}) → Map< String, Object?> -
copyScalar(
Object? value, {required String field}) → Object? -
copyString(
Object? value, {required String field}) → String -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited