返回 CodeWhale
core_policy.rs
根目录 / crates / command-contract / src / core_policy.rs
1 pub struct ClearedConversation {
2 pub session_id: String,
3 pub model: String,
4 pub workspace: std::path::PathBuf,
5 pub mode: crate::types::CommandMode,
6 pub agent_preset: Option<String>,
7 }
8
9 pub enum ClearFailure {
10 Busy(Vec<String>),
11 Transition(String),
12 }
13
14 pub trait ClearContext {
15 fn start_empty_conversation(&mut self) -> Result<ClearedConversation, ClearFailure>;
16 }
17
18 pub enum EffortFailure {
19 Unknown,
20 Unavailable { model: String, labels: Vec<String> },
21 }
22
23 pub enum EffortChangeFailure {
24 Selection(EffortFailure),
25 Receipt(String),
26 }
27
28 pub trait EffortContext {
29 fn available_labels(&self) -> Vec<String>;
30 fn cycle(&mut self) -> (String, String);
31 fn set_supported_effort(&mut self, value: &str) -> Result<String, EffortFailure>;
32 fn cycle_checked(&mut self) -> Result<(String, String), String> {
33 Ok(self.cycle())
34 }
35 fn set_supported_effort_checked(&mut self, value: &str) -> Result<String, EffortChangeFailure> {
36 self.set_supported_effort(value)
37 .map_err(EffortChangeFailure::Selection)
38 }
39 }
40
41 pub trait FeedbackContext {
42 fn has_session(&self) -> bool;
43 fn safe_text(&self, text: &str) -> Result<String, String>;
44 }
45
46 pub enum FeedbackAction {
47 OpenPicker,
48 Feature,
49 Security,
50 Draft(String),
51 Review { id: String, change: Option<String> },
52 }
53
53 lines RUST