Move To-Do Tool to Session Scope from Agent Scope (#4157)
This commit is contained in:
@@ -64,9 +64,11 @@ pub struct SessionMetadata {
|
||||
pub accumulated_input_tokens: Option<i32>,
|
||||
/// The number of output tokens used in the session. Accumulated across all messages.
|
||||
pub accumulated_output_tokens: Option<i32>,
|
||||
/// Session-scoped TODO list content
|
||||
pub todo_content: Option<String>,
|
||||
}
|
||||
|
||||
// Custom deserializer to handle old sessions without working_dir
|
||||
// Custom deserializer to handle old sessions without working_dir and todo_content
|
||||
impl<'de> Deserialize<'de> for SessionMetadata {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
@@ -84,6 +86,7 @@ impl<'de> Deserialize<'de> for SessionMetadata {
|
||||
accumulated_input_tokens: Option<i32>,
|
||||
accumulated_output_tokens: Option<i32>,
|
||||
working_dir: Option<PathBuf>,
|
||||
todo_content: Option<String>, // For backward compatibility
|
||||
}
|
||||
|
||||
let helper = Helper::deserialize(deserializer)?;
|
||||
@@ -105,6 +108,7 @@ impl<'de> Deserialize<'de> for SessionMetadata {
|
||||
accumulated_input_tokens: helper.accumulated_input_tokens,
|
||||
accumulated_output_tokens: helper.accumulated_output_tokens,
|
||||
working_dir,
|
||||
todo_content: helper.todo_content,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -129,6 +133,7 @@ impl SessionMetadata {
|
||||
accumulated_total_tokens: None,
|
||||
accumulated_input_tokens: None,
|
||||
accumulated_output_tokens: None,
|
||||
todo_content: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user