models/chat_input_budget library

Classes

ChatBase64ScanResult
ChatInputBudget
Host-controlled limits for untrusted ACP input.
ChatInputOmission
A typed description of ACP input that owning code omitted.
ChatJsonInputGuard
Iteratively creates bounded defensive copies of JSON-compatible values.
ChatRetainedSizeEstimator
Deterministically estimates retained JSON-compatible ACP state.
ChatStructuredUpdateGuard
Shares one host-owned node and byte budget across a structured ACP update.
ChatTextBudgetChunk
ChatUtf8LineBudgetCheckpoint
Opaque one-shot host transaction for one ChatUtf8LineBudgetCounter.
ChatUtf8LineBudgetCounter
Counts UTF-8 bytes and logical lines without joining input chunks.

Functions

chatMaxBase64EncodedLength(int decodedByteLimit) int
Returns the largest Base64 length needed for decodedByteLimit.
copyBoundedInitializeInput({required Object? agentCapabilities, required Object? authMethods, Object? agentInfo, ChatInputBudget budget = const ChatInputBudget()}) → ({Map<String, dynamic> agentCapabilities, Map<String, dynamic> agentInfo, List<Map<String, dynamic>> authMethods})
scanChatBase64(String encoded, {required int maxDecodedBytes, required String resource}) ChatBase64ScanResult
Validates standard Base64 and counts decoded bytes without decoding it.

Exceptions / Errors

ChatInputLimitExceeded
Capacity failure that never includes the rejected ACP payload.