Skip to content

refactor(sdk): own capsule-facing wire types - #67

Open
joshuajbouw wants to merge 1 commit into
mainfrom
codex/own-sdk-wire-types
Open

refactor(sdk): own capsule-facing wire types#67
joshuajbouw wants to merge 1 commit into
mainfrom
codex/own-sdk-wire-types

Conversation

@joshuajbouw

Copy link
Copy Markdown
Member

Summary

  • move the existing capsule-facing IPC and LLM Rust definitions into astrid-sdk
  • preserve astrid_sdk::types::{ipc,llm} and all direct re-export paths
  • remove the SDK dependency on core-owned astrid-types
  • pin the established JSON forms and public import paths with regressions

This makes the SDK the owner of its language-native authoring types while keeping canonical WIT and serialized wire shapes as the runtime compatibility boundary.

Closes #66.

Validation

  • cargo test --workspace
  • cargo check --workspace
  • cargo clippy -p astrid-sdk --no-default-features --all-targets -- -D warnings -A clippy::map-unwrap-or
    • the narrow allowance is for one pre-existing lint in the untouched astrid-sys build script under local Rust 1.97; CI pins Rust 1.94
  • cargo build --manifest-path examples/test-capsule/Cargo.toml --target wasm32-wasip2
  • RUSTFLAGS='--cfg getrandom_backend="custom"' cargo build --manifest-path examples/test-capsule/Cargo.toml --target wasm32-unknown-unknown
  • cargo package -p astrid-sdk --allow-dirty --no-verify --list
  • cargo tree -p astrid-sdk contains no astrid-types
  • cargo fmt --all -- --check
  • git diff --check

Move the IPC and LLM representations currently exposed by astrid_sdk::types into the SDK while preserving their public paths and serialized shapes. Remove the dependency on core-owned astrid-types and pin the compatibility boundary with wire-shape and source-path regressions.\n\nCloses #66.

Signed-off-by: Joshua J. Bouw <jjb@unicity-labs.com>
@joshuajbouw
joshuajbouw marked this pull request as ready for review August 15, 2026 03:08
Copilot AI lite review requested due to automatic review settings August 15, 2026 03:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR moves the capsule-facing IPC and LLM Rust wire types into astrid-sdk (removing the SDK’s dependency on core-owned astrid-types) while preserving the existing astrid_sdk::types::{ipc,llm} module paths and direct re-exported type paths. It also adds regression tests intended to pin legacy JSON wire shapes and import compatibility.

Changes:

  • Removed workspace/SDK dependency on astrid-types and introduced SDK-owned astrid_sdk::types::{ipc,llm} modules.
  • Added wire-shape regression tests and a compatibility test to ensure legacy import paths still compile.
  • Updated astrid-sys comments/docs to reflect the new dependency graph.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CHANGELOG.md Documents the SDK now owning capsule-facing IPC/LLM types and adds note about golden tests.
Cargo.toml Removes astrid-types from workspace dependencies.
astrid-sys/src/lib.rs Updates comment to reflect uuid is no longer pulled via astrid-types.
astrid-sys/Cargo.toml Updates comment about uuid/getrandom transitive dependency.
astrid-sdk/tests/types_compat.rs Adds integration test ensuring legacy astrid_sdk::types paths and direct re-exports remain usable.
astrid-sdk/src/types/wire_tests.rs Adds unit tests asserting key legacy JSON wire shapes for IPC + LLM types.
astrid-sdk/src/types/mod.rs Introduces new SDK-owned types module and re-exports IPC/LLM types.
astrid-sdk/src/types/llm.rs Adds SDK-owned LLM message/tool/streaming wire types.
astrid-sdk/src/types/ipc.rs Adds SDK-owned IPC message/payload wire types plus JSON helpers.
astrid-sdk/src/lib.rs Switches types from re-exporting astrid_types to a native SDK module.
astrid-sdk/Cargo.toml Removes astrid-types, adds chrono, and enables uuid’s serde feature for JSON wire compatibility.
Suppressed comments (1)

astrid-sdk/src/types/ipc.rs:275

  • After changing RawJson to a struct variant, to_guest_bytes needs to match the updated shape; otherwise this will stop compiling and/or fail to serialize raw JSON payloads as intended.
    pub fn to_guest_bytes(&self) -> Result<Vec<u8>, serde_json::Error> {
        match self {
            Self::Custom { data } | Self::RawJson(data) => serde_json::to_vec(data),
            other => serde_json::to_vec(other),
        }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +69 to +74
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum IpcPayload {
/// Raw, arbitrary JSON.
RawJson(Value),
/// User input provided via a frontend (CLI, Telegram).
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.

Own capsule-facing wire types in the Rust SDK

2 participants