Skip to main content

Crate agent_doc_fs

Crate agent_doc_fs 

Source

Modules§

install_freshness
Filesystem probes for local agent-doc install freshness.

Functions§

baseline_overlay_path_for
Compute <project_root>/.agent-doc/baselines/<hash>.overlay.yrs.
baseline_path_for
Compute <project_root>/.agent-doc/baselines/<hash>.md for a document.
crdt_flock_path_for
Compute the CRDT flock path adjacent to the legacy CRDT sidecar.
crdt_path_for
Compute <project_root>/.agent-doc/crdt/<hash>.yrs.
crdt_replica_event_path_for
Compute <project_root>/.agent-doc/crdt-replica-events/<hash>.json for a document. The controller writes this as an editor-facing event signal after CRDT fan-out or replace rebootstrap work is queued, and editor plugins watch the directory to drain pending replica deliveries without polling.
cycle_state_path_for
Compute <project_root>/.agent-doc/state/cycles/<hash>.json for a document.
disk_change_request_path_for
Compute <project_root>/.agent-doc/disk-change-requests/<hash>.json for a document. The controller watch daemon drops this marker when the file changed on disk out of band; the CPC/controller consumer reads it, reconciles the change into the canonical replica, and clears it (the marker + idle-poll cross-process signal, mirroring recycle-request).
document_state_hash
Compute the SHA-256 hex hash used to key per-document state sidecars.
document_state_hash_from_str
Compute the per-document state hash from an already-resolved path string.
find_project_root
Walk up the directory tree from path to find the directory containing .agent-doc (the project root). Returns None if no such ancestor exists.
find_project_root_canonical
Canonicalize path first, then delegate to find_project_root. Returns None if canonicalization fails or no .agent-doc ancestor exists.
inode_of_path
Inode of the on-disk file at path. Returns None on non-Unix platforms or any stat error.
multinode_crdt_path_for
Compute <project_root>/.agent-doc/crdt/<hash>.nodes.yrs.
overlay_crdt_path_for
Compute <project_root>/.agent-doc/crdt/<hash>.overlay.yrs.
pending_response_path_for
Compute <project_root>/.agent-doc/pending/<hash>.md for a document.
pre_response_path_for
Compute <project_root>/.agent-doc/pre-response/<hash>.md.
preserve_dropped_operator_buffer
Preserve a buffer the merge is about to drop to a durable recovery sidecar at <project_root>/.agent-doc/recovery/<hash>.<pid>-<seq>.md, so concurrent operator text is recoverable instead of silently lost (#qftlossdelta). Written atomically; returns the sidecar path. Best-effort by the caller — this is a safety net alongside, not a replacement for, the merge decision.
quarantine_corrupt_file
Rename a corrupt state file aside to a sibling <name>.corrupt-<pid>-<seq> so it stops wedging reads while remaining available for forensics. A file that raced away (already removed) is treated as success.
read_optional_bytes
read_optional_text
read_valid_or_quarantine
Read path and parse it with parse. Missing → Ok(None). If the file exists but is empty / whitespace-only / fails to parse (a corrupt state file — e.g. a 0-byte controller-state.json left by a pre-write_atomic interrupted write or an external truncation), quarantine the bad file by renaming it aside and return Ok(None) so the caller reboots from a clean slate instead of wedging on every future read.
referenced_markdown_path
referenced_markdown_path_checked
rewrite_start_path
Rewrite file_path to be relative to cwd so a spawned command resolves correctly when its working directory is narrowed to a submodule root.
running_exe_inode_for_pid
The inode a process currently maps via /proc/<pid>/exe.
same_document_path
snapshot_flock_path_for
Compute the snapshot flock path adjacent to the snapshot sidecar.
snapshot_path_for
Compute <project_root>/.agent-doc/snapshots/<hash>.md for a document.
startup_document_lock_path_for
Compute <project_root>/.agent-doc/starting/<hash>.lock for a document.
startup_session_lock_name
Compute the startup lock filename for a tmux session.
startup_session_lock_path_for
Compute <project_root>/.agent-doc/starting/session-<hash>.lock.
startup_starting_dir_for
Compute <project_root>/.agent-doc/starting for a document.
state_lock_path_for
Compute <project_root>/.agent-doc/locks/<hash>.lock for a document.
turn_scope_path_for
Compute <project_root>/.agent-doc/turn-scope/<hash>.json for a document.
write_atomic
Atomically write contents to path by writing a sibling temp file and renaming it into place. rename(2) on the same filesystem is atomic, so a crash or execve mid-write leaves either the previous file or the fully-written new one — never a truncated/0-byte file. Creates the parent directory if missing.