Expand description
Stream-message state parsers: rate-limit / api-retry /
runtime-session / settings-parse-error. Mirrors upstreamโs
agent-sdk/src/bridge/state_parsing.ts.
Re-exportsยง
use serde_json::Map;๐use serde_json::Value;๐use forge_primitives::ApiRetryError;๐use forge_primitives::RateLimitStatus;๐use forge_primitives::RuntimeSessionState;๐use forge_primitives::SettingsParseErrorUpdate;๐
Functionsยง
- build_
api_ retry_ update - Mirrors upstreamโs
buildApiRetryUpdate(message). Returns a typedApiRetryUpdatewhen all three required numeric fields parse correctly. - build_
rate_ limit_ update - Mirrors upstreamโs
buildRateLimitUpdate(rateLimitInfo). Returns a typedRateLimitUpdatewhen the input has a recognisedstatus, populating optional fields when present. - normalize_
settings_ ๐parse_ error - Mirrors
normalizeSettingsParseError(value). - normalize_
settings_ parse_ errors - Accepts either a single record or an array; returns all valid entries.
- number_
field ๐ - parse_
api_ ๐retry_ error - parse_
clamped_ ๐u64 - Reads a numeric field as
u64, returningNonewhen the field is missing or its value is outside[0, u64::MAX)(note the open upper bound - see the body comment). Out-of-range drops emit a debug breadcrumb so a misbehaving CLI is observable. - parse_
clamped_ ๐u16_ optional - Optional sibling of
parse_clamped_u64for u16-sized fields (status codes). Field-absent is silent (None); out-of-range value logs at debug and returnsNone. - parse_
enum ๐ - Deserialize a wire-string enum variant from an optional JSON
value. Returns
Nonefor missing field, wrong JSON type, or unrecognised variant - the three failure modes share a single drop path. Each enum carries#[serde(rename_all = "snake_case")]so this is just the typed wrapper. - parse_
rate_ ๐limit_ status - parse_
runtime_ session_ state - record ๐