pub struct RunPaths {
pub root: PathBuf,
pub run_id: RunId,
}Expand description
Per-run paths anchored on <root>/runs/<run-id>/.
Fields§
§root: PathBufThe run’s root directory; every other path is derived from it.
run_id: RunIdThe validated run id this directory belongs to. Carried explicitly so
event envelopes never re-derive it from root.file_name().
Implementations§
Source§impl RunPaths
impl RunPaths
Sourcepub fn new(root: impl Into<PathBuf>, run_id: impl Into<String>) -> Result<Self>
pub fn new(root: impl Into<PathBuf>, run_id: impl Into<String>) -> Result<Self>
Construct paths for root (the run directory) carrying a validated
run_id. Rejects malformed ids up front so every downstream event
envelope and projection is stamped with a well-formed id, and rejects a
run root that is a symlink (Error::SymlinkRunDir) so a replaced run
directory cannot redirect writes outside the run tree. An absent root is
fine — a fresh run is created later; only an existing symlink is
refused. See reject_symlink for the best-effort/TOCTOU caveat.
Sourcepub fn from_validated(root: impl Into<PathBuf>, run_id: RunId) -> Result<Self>
pub fn from_validated(root: impl Into<PathBuf>, run_id: RunId) -> Result<Self>
Construct paths from an already-validated RunId, skipping the
re-parse RunPaths::new does (but not the symlink-root check —
that one symlink_metadata is negligible and is the production CLI’s
only construction-time guard, since this is the constructor it uses).
root must be the run directory (typically run_dir’s output for this
same id). Rejects a symlinked root with Error::SymlinkRunDir.
Sourcepub fn nodes_dir(&self) -> PathBuf
pub fn nodes_dir(&self) -> PathBuf
Path to the nodes/ directory holding per-node projection files.
Sourcepub fn node(&self, node_id: &NodeId) -> PathBuf
pub fn node(&self, node_id: &NodeId) -> PathBuf
Path to a single node’s projection file (nodes/<node-id>.json).
Takes a validated NodeId, so the filename can never contain / or
.. and the result can never escape nodes/.
Sourcepub fn discussions_dir(&self) -> PathBuf
pub fn discussions_dir(&self) -> PathBuf
Path to the discussions/ directory.
Sourcepub fn discussion(&self, id: &DiscussionId) -> PathBuf
pub fn discussion(&self, id: &DiscussionId) -> PathBuf
Path to a single discussion file (discussions/<id>.json).
Takes a validated DiscussionId, so the result can never escape
discussions/.
Sourcepub fn spinoffs_dir(&self) -> PathBuf
pub fn spinoffs_dir(&self) -> PathBuf
Path to the spinoffs/ directory.
Sourcepub fn spinoff(&self, id: &ProposalId) -> PathBuf
pub fn spinoff(&self, id: &ProposalId) -> PathBuf
Path to a single spin-off proposal file (spinoffs/<id>.json).
Takes a validated ProposalId, so the result can never escape
spinoffs/.
Sourcepub fn supervisor_pid(&self) -> PathBuf
pub fn supervisor_pid(&self) -> PathBuf
Path to the supervisor pid file (supervisor.pid).
Sourcepub fn agent_log(&self) -> PathBuf
pub fn agent_log(&self) -> PathBuf
Path to the durable capture of the agent’s tmux pane
(agent.log). The supervisor tees the worker pane here via
tmux pipe-pane right after spawn confirmation so a post-mortem
survives teardown — the file lives in the run dir, NOT the worktree,
so it persists after the tmux window and worktree are removed.