feat(tool): tambah abort_flag ke ToolCtx dan sambungkan dari session state
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b1c0265e8c
commit
79e2bfcc9c
@@ -283,6 +283,29 @@ impl AppStateRest {
|
||||
lsp_manager: self.lsp_manager.clone(),
|
||||
turn_events: Some(self.turn_events.clone()),
|
||||
workflow_findings: None,
|
||||
abort_flag: Some(self.abort_flag.clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn tool_ctx_for_shares_the_session_abort_flag() {
|
||||
let tmp = std::env::temp_dir().join(format!("zesdex-rest-test-{}", uuid::Uuid::new_v4()));
|
||||
std::fs::create_dir_all(&tmp).unwrap();
|
||||
let state = AppStateRest::new(vec![tmp.clone()], &tmp, tmp.join("memory"));
|
||||
|
||||
let ctx = state.tool_ctx_for(Origin::Main);
|
||||
|
||||
assert!(ctx.abort_flag.is_some());
|
||||
assert!(std::sync::Arc::ptr_eq(
|
||||
ctx.abort_flag.as_ref().unwrap(),
|
||||
&state.abort_flag,
|
||||
));
|
||||
|
||||
std::fs::remove_dir_all(&tmp).ok();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user