Expand description
Transport-agnostic reporting seam for src/core/ and src/services/.
Core engines need to say things to whoever is driving them: a diagnostic
about work in progress, a warning about a recovered problem, the token
accounting for one AI API call, a line on the long-running-work progress
stream. Historically each engine printed those messages itself and asked
the CLI process-global output mode whether it was allowed to. That made
src/core/ and src/services/ depend on the CLI layer — the one upward
edge that blocks extracting core into its own crate.
This module inverts the dependency. Core owns the Reporter trait —
the sink it reports through — and never knows what transport, if any,
sits behind it. The CLI owns the only terminal implementation
(TerminalReporter in src/cli/reporter.rs), which is where all mode
gating (--output json, --quiet) lives. When src/core/ moves into
the subx-core crate, this module travels with it unchanged.
The layering rule this module exists to enforce: no module under
src/core/ or src/services/ may reference the CLI layer. The
tests/core_cli_boundary.rs guard test enforces it mechanically.
Attachment is builder-style: engines and clients default their reporter
to noop() (a NoopReporter, so library consumers such as the
desktop GUI see silence by default) and accept an Arc<dyn Reporter>
through a with_reporter method, leaving every existing constructor
signature untouched.
Structs§
- AiUsage
- Token accounting for one completed AI API call.
- Noop
Reporter - The default
Reporter: silently swallows everything.
Enums§
- Progress
Event - An event on the long-running-work progress stream.
Traits§
- Reporter
- A transport-agnostic sink for human-oriented core output.
Functions§
- noop
- Shared handle to a
NoopReporter.