refactor(sdk): own capsule-facing wire types - #67
Open
joshuajbouw wants to merge 1 commit into
Open
Conversation
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>
There was a problem hiding this comment.
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-typesand introduced SDK-ownedastrid_sdk::types::{ipc,llm}modules. - Added wire-shape regression tests and a compatibility test to ensure legacy import paths still compile.
- Updated
astrid-syscomments/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
RawJsonto a struct variant,to_guest_bytesneeds 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
astrid-sdkastrid_sdk::types::{ipc,llm}and all direct re-export pathsastrid-typesThis 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 --workspacecargo check --workspacecargo clippy -p astrid-sdk --no-default-features --all-targets -- -D warnings -A clippy::map-unwrap-orastrid-sysbuild script under local Rust 1.97; CI pins Rust 1.94cargo build --manifest-path examples/test-capsule/Cargo.toml --target wasm32-wasip2RUSTFLAGS='--cfg getrandom_backend="custom"' cargo build --manifest-path examples/test-capsule/Cargo.toml --target wasm32-unknown-unknowncargo package -p astrid-sdk --allow-dirty --no-verify --listcargo tree -p astrid-sdkcontains noastrid-typescargo fmt --all -- --checkgit diff --check