feat(sdk/rust): add SessionEnvelopeV1 harness types (parity with TS SDK)#210
Conversation
Ports the harness session-envelope schema from the TypeScript SDK (sdk/typescript/src/types/harness.ts) to the Rust SDK so Rust consumers can decode the envelope a wrapped Codex/Claude session forwards inside an encrypted Signal DM body, instead of hand-rolling a mirror. - types/harness.rs: SessionEnvelopeV1 (+ Bucket/Scope/Info/Message/Source), SESSION_ENVELOPE_VERSION_V1, SessionEnvelope alias, and is_valid_v1/parse helpers. Wire format is snake_case (the CLI emits a literal snake_case object), so structs deliberately omit rename_all=camelCase. - types/mod.rs: declare + flat re-export the module. - Unit tests: v1 round-trip (snake_case regression guard) + reject unknown version / plain DM.
|
@sanil-23 is attempting to deploy a commit to the Vezures Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a new Rust module ( ChangesHarness Envelope Schema
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)Not applicable — this PR adds a self-contained data schema and parsing utility without multi-component orchestration flow. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
Summary
Ports the harness session-envelope schema from the TypeScript SDK (
sdk/typescript/src/types/harness.ts) to the Rust SDK. Rust consumers (e.g. the OpenHuman core ingest path) can now decode the envelope a wrapped Codex/Claude session forwards inside an encrypted Signal DM body viatinyplace::types::SessionEnvelopeV1, instead of hand-maintaining a mirror that silently drifts from the TS source of truth.What's added —
sdk/rust/src/types/harness.rsMirrors the TS interface 1:1:
SessionEnvelopeV1(+HarnessBucket,HarnessScope,HarnessInfo,HarnessMessage,HarnessSource)SESSION_ENVELOPE_VERSION_V1const and theSessionEnvelopealias (matchingexport type SessionEnvelope = SessionEnvelopeV1)HarnessProvider,HarnessMessageRole,HarnessBucketUnit,HarnessEnvelopeScope) following the existingpub type EnvelopeType = Stringconvention inmessaging.rsis_valid_v1()/parse(&str) -> Option<Self>consumer helperstypes/mod.rs: module declared + flat re-exported like every siblingWire-format note (important)
The harness envelope is snake_case on the wire (the CLI wrapper emits a literal snake_case object), unlike the camelCase used by the rest of the API. The structs therefore intentionally omit
#[serde(rename_all = "camelCase")]. A round-trip unit test guards against a future camelCase "normalization" that would break decoding of real envelopes.Tests
cargo test -p tinyplace --lib harness— 2 passing:parses_and_round_trips_v1(asserts snake_case keys survive serialization)rejects_unknown_version_and_plain_dmcargo fmt --checkandcargo clippyclean on the crate.Notes
tinyplacecrate version so downstream (OpenHuman) can bump and drop its hand-written mirror.Summary by CodeRabbit
New Features
Tests