Skip to main content

tty_open_spec

Function tty_open_spec 

Source
pub fn tty_open_spec() -> OperationSpec
Expand description

Build the OperationSpec for channels/tty/sub.

The op is Sub-typed (consumer-opens — the initiator opens a channel and the data plane flows on the channel’s BiStream, not in the call response stream). The channel_open marker is set to ChannelOpenSpec::new("alk/tty") so the channels wrapper allocates a data channel. The AccessControl carries the tty:open scope gate (the same scope the direct-ALPN TtyAdapter checks).

The input schema is the shared part of the NegotiateRequest shape (carriage/backend/cmd required — alkcall 0.4 enforces it at dispatch). The schema is deliberately partial: tty, cwd, env, and backend-specific selector fields are free-form (additionalProperties defaults to true in raw JSON Schema), because the NegotiateRequest wire shape is owned by negotiation.rs and the backend params are opaque (ADR-053) — duplicating their full schemas here would create a second definition to drift. The registry check catches structurally-broken opens (missing command, wrong types); the full parse and semantic validation (carriage == "raw", backend lookup, ownership) and backend allocation run in the establisher (ADR-010, as amended for alkcall 0.6 — failures are channel:open_failed, including allocate_failed as dial_failed).

The op declares an ErrorDefinition for channel:open_failed (ADR-016 — establishment failures are disclosed so services/schema shows the failure contract; reason ∈ unknown_resource / handler_error / timeout, per the ADR-049 vocabulary — see make_tty_establisher for the mapping) and carries a description (review 006 E-02 — discovery enrichment).