Skip to main content

ResponseMeta

Struct ResponseMeta 

Source
pub struct ResponseMeta {
    pub stale: bool,
    pub last_good_at: Option<String>,
    pub last_error: Option<String>,
    pub workspace_state: Option<WorkspaceState>,
    pub daemon_version: String,
}
Expand description

Metadata attached to every successful response. For Phase 8a management methods the staleness fields are always absent (stale = false, no last_good_at, no last_error, workspace_state = None). Phase 8b populates them from the server-side ServeVerdict for tool-method responses.

Fields§

§stale: bool§last_good_at: Option<String>§last_error: Option<String>§workspace_state: Option<WorkspaceState>

Canonical workspace state string (serde form of WorkspaceState). None for methods not tied to a workspace.

§daemon_version: String

Implementations§

Source§

impl ResponseMeta

Source

pub fn management(daemon_version: &str) -> Self

Construct the ResponseMeta used by daemon management methods (daemon/status, daemon/unload, daemon/stop — the ones not bound to a specific workspace).

Source

pub fn loaded(daemon_version: &str) -> Self

Construct the ResponseMeta for a successful daemon/load. Phase 8b adds fresh_from / stale_from constructors for MCP tool-method responses that route through classify_for_serve.

Source

pub fn fresh_from(state: WorkspaceState, daemon_version: &str) -> Self

Construct ResponseMeta for a tool-method response served from a Fresh workspace verdict (WorkspaceState::Loaded or Rebuilding).

Phase 8b Task 7 — populated by the tool_dispatch helper when the daemon’s WorkspaceManager::classify_for_serve returns ServeVerdict::Fresh. stale is false and both last_good_at and last_error are absent from the wire form (they are skipped by serde(skip_serializing_if = "Option::is_none")).

Source

pub fn stale_from( last_good_at: SystemTime, last_error: Option<String>, daemon_version: &str, ) -> Self

Construct ResponseMeta for a tool-method response served from a Stale verdict. last_good_at is rendered as RFC3339 UTC-Zulu via chrono::DateTime::<Utc>::from(SystemTime) -> to_rfc3339_opts(Secs, true).

workspace_state is fixed at WorkspaceState::Failed because WorkspaceManager::classify_for_serve only emits a Stale verdict when the observed state is Failed. Keeping this constructor intentionally rigid (no caller-supplied state) prevents the wire form from claiming stale = true with a workspace_state the classifier could never have produced.

Trait Implementations§

Source§

impl Clone for ResponseMeta

Source§

fn clone(&self) -> ResponseMeta

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResponseMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ResponseMeta

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ResponseMeta

Source§

fn eq(&self, other: &ResponseMeta) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ResponseMeta

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for ResponseMeta

Source§

impl StructuralPartialEq for ResponseMeta

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,