refactor(#2302): type socket wire fields as ident, validated by serde on deserialize
This commit is contained in:
parent
bf644cc126
commit
84b750fba5
33 changed files with 333 additions and 263 deletions
|
|
@ -41,7 +41,7 @@ pub fn spawn(coord: Arc<Coordinator>) {
|
|||
if lifecycle::is_running(&logical).await {
|
||||
current_running.insert(logical.clone());
|
||||
}
|
||||
if hive_host_sock::Ident::parse(&logical)
|
||||
if hive_types::Ident::parse(&logical)
|
||||
.is_ok_and(|id| claude_has_session(&Coordinator::agent_claude_dir(&id)))
|
||||
{
|
||||
current_logged_in.insert(logical.clone());
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ fn inline_fallback(req_path: &str, reason: &str, message: &str) -> String {
|
|||
/// inline-falls-back). `pub` because `socket_server::handle_remind`
|
||||
/// reuses it for the at-remind-time auto-file path.
|
||||
pub fn write_payload(agent: &str, host_path: &Path, message: &str) -> Result<(), String> {
|
||||
let agent = hive_host_sock::Ident::parse(agent)
|
||||
let agent = hive_types::Ident::parse(agent)
|
||||
.map_err(|e| format!("invalid agent name {agent:?}: {e}"))?;
|
||||
let Some(parent) = host_path.parent() else {
|
||||
return Err("internal: host path has no parent".to_owned());
|
||||
|
|
@ -191,7 +191,7 @@ pub fn container_state_prefix(agent: &str) -> String {
|
|||
/// reason string on rejection. `pub` so `socket_server::handle_remind`
|
||||
/// can reuse it for the at-remind-time auto-file path.
|
||||
pub fn resolve_host_path(agent: &str, req_path: &str) -> Result<PathBuf, String> {
|
||||
let agent = hive_host_sock::Ident::parse(agent)
|
||||
let agent = hive_types::Ident::parse(agent)
|
||||
.map_err(|e| format!("invalid agent name {agent:?}: {e}"))?;
|
||||
let prefix = container_state_prefix(agent.as_str());
|
||||
let Some(rel) = req_path.strip_prefix(&prefix) else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue