fix: cargo fmt corrections for relaycast_ws.rs#639
fix: cargo fmt corrections for relaycast_ws.rs#639barryonthecape wants to merge 16 commits intomainfrom
Conversation
There was a problem hiding this comment.
🟡 HTTP API relay_inbound events omit injection mode despite both SDKs reading it
When a message is sent via the HTTP API with mode: "steer", the relay_inbound events emitted to the SDK (lines 2150-2161 for local delivery, lines 2214-2225 for relaycast publish) do not include the mode or injection_mode field in their JSON payload, even though the mode variable is available in scope from ListenApiRequest::Send. Both the TypeScript SDK (packages/sdk/src/relay.ts:1016: mode: event.injection_mode ?? event.mode) and the Python SDK (packages/sdk-py/src/agent_relay/relay.py:782: mode=event.get("injection_mode") or event.get("mode")) explicitly read these fields from relay_inbound events, and the TypeScript protocol type at packages/sdk/src/protocol.ts:236-237 was updated to declare them. As a result, Message.mode will always be undefined/None for messages received via onMessageReceived, even when a dashboard user explicitly specified steer mode. The actual PTY delivery is unaffected since queue_and_try_delivery_raw correctly passes mode through RelayDelivery.
(Refers to lines 2150-2163)
Prompt for agents
In src/main.rs, the two relay_inbound event emissions in the HTTP API ListenApiRequest::Send handler need to include the injection mode. There are two locations:
1. Lines 2150-2163 (local delivery succeeded path): Add "injection_mode" to the json! macro, using the mode variable from the surrounding scope. The mode variable is of type MessageInjectionMode, which implements Serialize.
2. Lines 2214-2227 (relaycast publish succeeded path): Same fix — add "injection_mode" to the json! macro.
For both locations, add a field like:
"injection_mode": mode,
into the json!({...}) block that constructs the relay_inbound event. The mode variable is already in scope from the ListenApiRequest::Send destructuring.
Was this helpful? React with 👍 or 👎 to provide feedback.
Fixes format violations caught in CI for PR #601.
Changes:
This branch was derived from PR #601, so once merged to main it can be integrated into #601.