Enhance tool documentation and add new features
- Added module-level documentation for memory tools (`remember`, `recall`, `forget`) to clarify their purpose. - Improved documentation in `recall.rs` and `remember.rs` to describe the functionality and flow of memory entry operations. - Updated `mod.rs` to include descriptions for the tool trait and execution context. - Enhanced `plan.rs` with detailed comments on plan-mode signaling tools. - Documented text search tools in `search.rs` to explain their functionality. - Improved sequential-thinking tool documentation in `seqthink.rs`. - Added safety filter documentation in `shell_filter` for credential and git operations. - Enhanced utility tools documentation, including `cd`, `dir_cache_update`, and `todowrite`. - Improved rendering documentation in view modules (`chat`, `markdown`, `status`, `workflow`) to clarify rendering flows and purposes.
This commit is contained in:
@@ -1,18 +1,33 @@
|
||||
//! Unix-socket listener for the `--daemon` process.
|
||||
//!
|
||||
//! Flow: `IpcServer::bind_unix` opens/binds a Unix socket at a well-known
|
||||
//! path (clearing any stale file left by a crashed prior daemon) →
|
||||
//! `accept` blocks for the next client and wraps it as a `Connection`
|
||||
//! (see `conn.rs`) for framed request/response traffic.
|
||||
|
||||
use std::os::unix::net::UnixListener;
|
||||
use anyhow::Result;
|
||||
use super::conn::Connection;
|
||||
|
||||
/// Server-side handle for the `--daemon` process: listens on a Unix
|
||||
/// socket and hands out `Connection`s to accepted clients.
|
||||
pub struct IpcServer {
|
||||
listener: UnixListener,
|
||||
}
|
||||
|
||||
impl IpcServer {
|
||||
/// Bind a new Unix-socket listener at `path`.
|
||||
///
|
||||
/// Why: removes any stale socket file at `path` first, since a prior
|
||||
/// crashed daemon can leave one behind and `UnixListener::bind` fails
|
||||
/// on an existing path.
|
||||
pub fn bind_unix(path: &str) -> Result<Self> {
|
||||
let _ = std::fs::remove_file(path);
|
||||
let listener = UnixListener::bind(path)?;
|
||||
Ok(IpcServer { listener })
|
||||
}
|
||||
|
||||
/// Block until a client connects, then wrap it as a `Connection`.
|
||||
pub fn accept(&self) -> Result<Connection> {
|
||||
let (stream, _addr) = self.listener.accept()?;
|
||||
Connection::from_stream(stream)
|
||||
|
||||
Reference in New Issue
Block a user