Check if response indicates input is needed per ADCP spec
Extract the replayed field from a protocol response envelope.
Returns true if the seller set replayed: true on the envelope,
false if explicitly set to false, undefined if not present. Callers
with side effects on response (notifications, LLM memory writes, downstream
tool calls) MUST treat undefined as false — the spec says fresh
executions MAY omit the field.
Extract the A2A contextId / AdCP context_id that binds the response
to a server-side conversation. Buyers retain this across calls on the
same AgentClient so the server can route subsequent sends to the same
session. Returns undefined when the server did not surface one (e.g.,
MCP completed responses that don't need conversation continuity).
Values that fail isSafeSessionId (overlong, control characters,
non-string) are rejected and return undefined — retention falls back
to the previously retained id. The server is the authoritative issuer
but a compromised or buggy seller shouldn't be able to exhaust buyer
memory or inject control sequences into buyer debug logs.
Extract the A2A taskId for the task the server is tracking (or just
created) for this send. Retained across calls only while the last
response was non-terminal (working / input-required / submitted /
auth-required) so buyers can resume the same server-side task; cleared
by the caller on terminal responses.
Same sanitization rules as getContextId: malformed ids return
undefined.
Simple parser that follows ADCP spec exactly