Preserve app-server thread working directories across platforms (#62375)

## Why

A remote app server can report a working directory in a different path
convention from the client. Decoding a Windows drive path as a client-native
absolute path can make a Unix client reject the thread response.

## What changed

Keep thread `cwd` values as server-native strings in summaries, settings,
and start, resume, and fork responses. Preserve the JSON and generated SDK
types. In the TUI, store the session directory as a `PathUri` using the
server's path convention when available. Use that directory to match diff
and skill results and to display the project name in the terminal title.

## Testing

Add regression coverage for foreign-path response round trips, diff results
matched against a remote session directory, and terminal titles derived
from a Windows path. Verify that the server rejects a working directory
that cannot be encoded as UTF-8.

GitOrigin-RevId: 600f0b531939db4cd4ec884de166224082995e00
This commit is contained in:
Eric Traut
2026-11-18 22:13:26 +00:00
committed by copyberry
parent fecf5cc672
commit b82943092c
111 changed files with 720 additions and 479 deletions
@@ -9,6 +9,7 @@ use serde::Serialize;
use serde::Serializer;
use std::fmt;
use std::path::Path;
use std::path::PathBuf;
use thiserror::Error;
use ts_rs::TS;
@@ -188,6 +189,16 @@ impl LegacyAppPathString {
}
}
/// Borrows the API string as a path without validating it for this host.
pub fn as_path(&self) -> &Path {
Path::new(&self.0)
}
/// Copies the API path text into a path buffer without normalization.
pub fn to_path_buf(&self) -> PathBuf {
self.as_path().to_owned()
}
pub fn as_str(&self) -> &str {
&self.0
}