feat(sdk-rust): add injection mode parity for send + websocket payloads#91
Conversation
|
Preview deployed!
This preview shares the staging database and will be cleaned up when the PR is merged or closed. Run E2E testsnpm run e2e -- https://pr91-api.relaycast.dev --ciOpen observer dashboard |
There was a problem hiding this comment.
Pull request overview
Adds injection-mode (wait/steer) support to the Rust SDK so REST send/WS payloads match the server and other SDKs.
Changes:
- Introduces
MessageInjectionModeenum and threadsinjection_modethrough message response/event types. - Extends
PostMessageRequestwith optionalmode, updatesAgentClient::sendto default towait, and addssend_with_mode. - Adds parity tests covering default
wait, explicitsteer, and WS payload deserialization.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/sdk-rust/tests/parity.rs | Adds parity tests for default/explicit injection mode and WS parsing. |
| packages/sdk-rust/src/types.rs | Defines MessageInjectionMode; adds injection_mode/mode fields to relevant types. |
| packages/sdk-rust/src/lib.rs | Re-exports MessageInjectionMode from the crate root. |
| packages/sdk-rust/src/agent.rs | Defaults send() to wait via new send_with_mode() API and forwards mode to the request. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| /// Send a message to a channel with explicit injection mode. | ||
| pub async fn send_with_mode( | ||
| &self, | ||
| channel: &str, | ||
| text: &str, | ||
| attachments: Option<Vec<String>>, | ||
| blocks: Option<Vec<MessageBlock>>, | ||
| mode: Option<MessageInjectionMode>, | ||
| idempotency_key: Option<String>, |
There was a problem hiding this comment.
Great catch — fixed in b089e70. send_with_mode now requires a non-optional MessageInjectionMode and always serializes the mode field explicitly. Re-ran cargo test for sdk-rust (all passing).
Summary
Bring Rust SDK into parity with the recently merged send-mode changes:
MessageInjectionMode(wait|steer) enuminjection_modeinMessageWithMetainjection_modein WSMessageEventPayloadPostMessageRequestwith optionalmodesend(...)backward-compatible while defaulting towaitsend_with_mode(...)for explicitsteer/waitrequestsMessageInjectionModefrom crate rootValidation
cd packages/sdk-rust && cargo test