feat(rpc): add validated desktop Pi RPC command palette
This commit is contained in:
@@ -58,6 +58,8 @@ pub struct UiStateV1 {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub interface_scale: Option<f64>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub default_new_session_worktree: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub dismissed_collision_warning: Option<bool>,
|
||||
}
|
||||
|
||||
@@ -73,6 +75,7 @@ impl Default for UiStateV1 {
|
||||
last_seen: BTreeMap::new(),
|
||||
workspace_cursor: None,
|
||||
interface_scale: None,
|
||||
default_new_session_worktree: None,
|
||||
dismissed_collision_warning: None,
|
||||
}
|
||||
}
|
||||
@@ -127,6 +130,13 @@ pub fn validate(state: &UiStateV1) -> Result<(), String> {
|
||||
bounded(runtime_id, "selected runtime id")?;
|
||||
total_string_bytes = total_string_bytes.saturating_add(runtime_id.len());
|
||||
}
|
||||
if let Some(worktree) = &state.default_new_session_worktree {
|
||||
bounded(worktree, "default new-session worktree")?;
|
||||
if !Path::new(worktree).is_absolute() {
|
||||
return Err("Default new-session worktree must be absolute".to_owned());
|
||||
}
|
||||
total_string_bytes = total_string_bytes.saturating_add(worktree.len());
|
||||
}
|
||||
let mut total_draft_bytes = 0usize;
|
||||
for (runtime_id, draft) in &state.drafts {
|
||||
bounded(runtime_id, "draft runtime id")?;
|
||||
|
||||
Reference in New Issue
Block a user