Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions crates/libsy-protocol/src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! The request/response envelope: the normalized [`LlmRequest`]/[`LlmResponse`] paired
//! with the original provider payload and correlation [`Metadata`].

use crate::{LlmRequest, LlmResponse, WireFormat};
use crate::{LlmRequest, LlmResponse, Metadata};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve the existing envelope::Metadata public path.

The private import removes libsy_protocol::envelope::Metadata, breaking consumers using the previous public path. Re-export the relocated type here.

Proposed compatibility fix
-use crate::{LlmRequest, LlmResponse, Metadata};
+use crate::{LlmRequest, LlmResponse};
+pub use crate::Metadata;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
use crate::{LlmRequest, LlmResponse, Metadata};
use crate::{LlmRequest, LlmResponse};
pub use crate::Metadata;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/libsy-protocol/src/envelope.rs` at line 7, Update the imports in the
envelope module to publicly re-export Metadata, preserving the existing
libsy_protocol::envelope::Metadata path while retaining the existing LlmRequest
and LlmResponse imports.

use std::collections::HashMap;

/// Per-request state threaded to an algorithm alongside a request. A placeholder
Expand All @@ -15,29 +15,6 @@ pub struct Context {
pub values: HashMap<String, String>,
}

/// Correlation and routing metadata attached to a request or response.
///
/// All fields are optional; algorithms and observers use whichever are present
/// (e.g. to key per-session state or emit correlated telemetry). `extra_metadata`
/// is a free-form escape hatch for host-specific keys.
#[derive(Clone)]
pub struct Metadata {
/// Stable id for a multi-request session/conversation.
pub session_id: Option<String>,
/// Id of the agent making the request.
pub agent_id: Option<String>,
/// Id of the task the request belongs to.
pub task_id: Option<String>,
/// External trace/request id for joining with the host's telemetry.
pub correlation_id: Option<String>,
/// Arbitrary host-defined key/value metadata.
pub extra_metadata: Option<std::collections::BTreeMap<String, String>>,
/// HTTP headers to attach when forwarding the request/response, if any.
pub http_headers: Option<std::collections::BTreeMap<String, String>>,
/// The wire format the request/response was originally encoded in, if known.
pub wire_format: Option<WireFormat>,
}

/// A request an algorithm routes: the normalized [`LlmRequest`] plus the original
/// provider payload and correlation [`Metadata`].
#[derive(Clone)]
Expand Down
2 changes: 2 additions & 0 deletions crates/libsy-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ pub mod client;
pub mod envelope;
pub mod format;
pub mod llm;
pub mod metadata;
pub mod stream;

pub use client::*;
pub use envelope::*;
pub use format::*;
pub use llm::*;
pub use metadata::*;
pub use stream::*;

/// Build a single-turn request: one user message carrying `prompt`, for `model`.
Expand Down
Loading
Loading