pub struct Activity {
pub tool: Option<String>,
pub turn: bool,
pub secs: u64,
}Expand description
What the hooks of a session saw last (01M41FZNTPXQNCZ1S99HE42PYQ):
a tool that runs, a turn that runs between two tools, or a turn
that ended. A hook writes it on the machine at each tool call and at
the end of each turn, and makes no call. riff mcp sends the newest
one in its keep-alive. A riff tool and riff watch give no fact:
they are no work.
use riff_core::wire::Activity;
let tool = Activity { tool: Some("Bash: run just ci".into()), turn: true, secs: 30 };
assert!(tool.works());
let between = Activity { tool: None, turn: true, secs: 2 };
assert!(between.works());
let ended = Activity { tool: None, turn: false, secs: 5 };
assert!(!ended.works());
let json = serde_json::to_string(&ended).unwrap();
assert_eq!(json, r#"{"secs":5}"#);Fields§
§tool: Option<String>The tool that runs, with its short text: Bash: run just ci.
turn: boolTrue while a turn runs. False when the turn ended.
secs: u64The seconds since the fact.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Activity
impl<'de> Deserialize<'de> for Activity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 JsonSchema for Activity
impl JsonSchema for Activity
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl Eq for Activity
impl StructuralPartialEq for Activity
Auto Trait Implementations§
impl Freeze for Activity
impl RefUnwindSafe for Activity
impl Send for Activity
impl Sync for Activity
impl Unpin for Activity
impl UnsafeUnpin for Activity
impl UnwindSafe for Activity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.