agent_servers: Decode v2 terminal notifications (#64985)

Add a composable SDK v2 terminal-notification ingress component that
hands decoded updates to the existing shared terminal model.

- Decode output snapshots and each output chunk independently into raw
bytes, preserving split ANSI/UTF-8 sequences and arbitrary binary data.
Do not concatenate encoded chunks or introduce another output-history
store.
- Preserve omitted/null/value patch semantics and keep
notification-envelope, terminal, snapshot, exit, and chunk metadata in
their own scopes.
- Validate output before dispatch: malformed base64 or malformed
non-null snapshot shapes cannot apply sibling fields or create an unseen
terminal. Guard the SDK's malformed-output-to-`Undefined` normalization
explicitly.
- Sanitize SDK parse errors so warning logs do not echo complete
notification params.
- Claim only terminal updates/chunks. Forward other methods and update
kinds using the original untyped JSON, preserving unknown fields.
- Apply decoded updates only to a matching session, using the terminal
identity/replacement boundary from #64976.

## Review guide

1. [SDK handler and claiming/forwarding
boundary](https://github.com/zed-industries/zed/blob/b8578a587d8003606579900a692c16fe42776516/crates/agent_servers/src/acp.rs#L636-L674):
terminal-only recognition, original-message fallthrough, and error
propagation.
2. [Decoded notification/application
types](https://github.com/zed-industries/zed/blob/b8578a587d8003606579900a692c16fe42776516/crates/agent_servers/src/acp/terminal_updates.rs#L8-L44)
and
[parser/decoder](https://github.com/zed-industries/zed/blob/b8578a587d8003606579900a692c16fe42776516/crates/agent_servers/src/acp/terminal_updates.rs#L47-L113):
session isolation, byte decoding, tri-state fields, metadata scopes, and
sanitized errors.
3. [Real SDK-channel harness and
tests](https://github.com/zed-industries/zed/blob/b8578a587d8003606579900a692c16fe42776516/crates/agent_servers/src/acp.rs#L2627-L3190):
actual v2 initialization, SDK-receive plus foreground-application
barriers, reference-first ordering, snapshot/append/replacement/clear,
atomic invalid-input rejection, and exact JSON forwarding.
4. [Decoder/parser
fixtures](https://github.com/zed-industries/zed/blob/b8578a587d8003606579900a692c16fe42776516/crates/agent_servers/src/acp/terminal_updates.rs#L115):
absent/null/value, byte fidelity, independent chunks, and
private-payload error sanitization.

Release Notes:

- N/A
e8c6c67fadBen Brandt committed on 9/30/2026, 2:31:57 PM· committed by GitHubparent15dc0e9
5 files changedLine totals unavailable