Skip to content

feat(sdk-rust): add injection mode parity for send + websocket payloads#91

Merged
willwashburn merged 2 commits into
mainfrom
feat/rust-sdk-injection-mode
Mar 17, 2026
Merged

feat(sdk-rust): add injection mode parity for send + websocket payloads#91
willwashburn merged 2 commits into
mainfrom
feat/rust-sdk-injection-mode

Conversation

@barryonthecape
Copy link
Copy Markdown
Contributor

@barryonthecape barryonthecape commented Mar 17, 2026

Summary

Bring Rust SDK into parity with the recently merged send-mode changes:

  • add MessageInjectionMode (wait|steer) enum
  • include optional injection_mode in MessageWithMeta
  • include optional injection_mode in WS MessageEventPayload
  • extend PostMessageRequest with optional mode
  • keep send(...) backward-compatible while defaulting to wait
  • add send_with_mode(...) for explicit steer/wait requests
  • export MessageInjectionMode from crate root
  • add parity tests for default wait mode, explicit steer mode, and WS payload parsing

Validation

  • cd packages/sdk-rust && cargo test
  • all tests passed (unit + parity + doc tests)

Open with Devin

@github-actions
Copy link
Copy Markdown

Preview deployed!

Environment URL
API https://pr91-api.relaycast.dev
Health https://pr91-api.relaycast.dev/health
Observer https://pr91-observer.relaycast.dev/observer

This preview shares the staging database and will be cleaned up when the PR is merged or closed.

Run E2E tests

npm run e2e -- https://pr91-api.relaycast.dev --ci

Open observer dashboard

https://pr91-observer.relaycast.dev/observer

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MessageInjectionMode enum and threads injection_mode through message response/event types.
  • Extends PostMessageRequest with optional mode, updates AgentClient::send to default to wait, and adds send_with_mode.
  • Adds parity tests covering default wait, explicit steer, 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.

Comment on lines +155 to +163
/// 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>,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@willwashburn willwashburn merged commit f83cd37 into main Mar 17, 2026
4 checks passed
@willwashburn willwashburn deleted the feat/rust-sdk-injection-mode branch March 17, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants