pub struct DebugCaptureSink { /* private fields */ }Expand description
Shared, thread-safe sink for one run’s debug-capture output.
Why: a directory-mode capture must produce ONE file per run shared by
BOTH the pm and engineer recorders (mirroring
run_task::recorder::SharedTranscript’s “one shared accumulator per
run” shape) so the file’s turn order reflects the true interleaving of
pm/engineer calls, not two disjoint per-role files.
What: Wraps a Mutex<File> (append-mode) and an AtomicU64 turn
counter. Constructed once per run via Self::from_env and cloned
(Arc) into every [DebugCaptureLlmClient] wrapping that run’s clients.
Test: debug_capture::tests::*.
Implementations§
Source§impl DebugCaptureSink
impl DebugCaptureSink
Sourcepub fn from_env() -> Option<Arc<Self>>
pub fn from_env() -> Option<Arc<Self>>
Resolve [ENV_VAR] and open (or create) the capture file, if set.
Why: the single per-run construction point every call site
(run_task::execute_run_task, task::executor::run_and_record)
invokes exactly once; a capture failure (bad path, permissions) must
degrade the run to “no capture” rather than abort it — this is
debugging tooling, not a correctness-critical dependency.
What: None when [ENV_VAR] is unset or empty (the zero-overhead
default). Otherwise resolves the path (directory → fresh per-run
file; anything else → literal file, appended) and opens it,
returning Some(Arc<Self>) on success or None (after printing an
actionable stderr warning — never stdout, which must stay clean for
MCP JSON-RPC framing) if the file could not be opened.
Test: debug_capture::tests::from_env_none_when_unset,
debug_capture::tests::from_env_opens_literal_file_path,
debug_capture::tests::from_env_directory_gets_fresh_per_run_file.
Auto Trait Implementations§
impl !Freeze for DebugCaptureSink
impl RefUnwindSafe for DebugCaptureSink
impl Send for DebugCaptureSink
impl Sync for DebugCaptureSink
impl Unpin for DebugCaptureSink
impl UnsafeUnpin for DebugCaptureSink
impl UnwindSafe for DebugCaptureSink
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more