Use native Codex steering and transcript deletion
This commit is contained in:
1 parent
00538cc19b
commit
8c88a7e991
12 files changed
+1004
-390
No files matched your search
@@ -187,6 +187,39 @@ pub fn clear(session_dir: &Path) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a session stdin fifo and opens it read-write for the child.
|
||||
///
|
||||
/// The child holding the write end is what keeps a detached JSON server from
|
||||
/// reading EOF when ai-server restarts and temporarily closes its own writer.
|
||||
pub fn make_fifo(path: &Path) -> Result<std::fs::File> {
|
||||
if !path.exists() {
|
||||
let c_path = std::ffi::CString::new(path.as_os_str().as_encoded_bytes())
|
||||
.with_context(|| format!("{} is not a usable path", path.display()))?;
|
||||
// SAFETY: `c_path` is nul-terminated and this call only reads it.
|
||||
let made = unsafe { libc::mkfifo(c_path.as_ptr(), 0o600) };
|
||||
if made != 0 {
|
||||
return Err(std::io::Error::last_os_error())
|
||||
.with_context(|| format!("creating the fifo {}", path.display()));
|
||||
}
|
||||
}
|
||||
std::fs::OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.open(path)
|
||||
.with_context(|| format!("opening the fifo {}", path.display()))
|
||||
}
|
||||
|
||||
/// A fresh owner-only log for a detached session process.
|
||||
pub fn create_log(path: &Path) -> Result<std::fs::File> {
|
||||
std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
.truncate(true)
|
||||
.mode(0o600)
|
||||
.open(path)
|
||||
.with_context(|| format!("creating {}", path.display()))
|
||||
}
|
||||
|
||||
/// Grace period between asking a session's process to stop and killing it.
|
||||
/// Here rather than beside each caller: two drivers plus the manager had
|
||||
/// written the same five seconds down separately.
|
||||
|
||||
Reference in new issue
Block a user