# src/output KNOWLEDGE BASE
## OVERVIEW
Normalized output surface between agent/tool/runtime events and terminal/TUI presentation: event DTOs, redaction, streaming redactor, CLI transcript renderers, pending activity/tool summaries.
## STRUCTURE
```text
src/output/
├── mod.rs # facade re-exports for events, redaction, renderers
├── events.rs # OutputEvent, ActivityEvent, InvocationMode, context/hook metadata
├── redaction.rs # credential-like key detection, sensitive text redaction, streaming buffers
└── renderers/ # CLI/plain/rich transcript renderers and status labels
```
## WHERE TO LOOK
| Event contract | `events.rs` | Agent/TUI/CLI normalized event payloads. |
| Secret scrubbing | `redaction.rs` | `redact_sensitive_text`, `StreamingRedactor`, credential-key detection. |
| CLI display | `renderers/cli.rs`, `renderers/rich.rs`, `renderers/plain.rs` | Human transcript projection. |
| Tool/activity labels | `renderers/mod.rs` | Pending summaries and status labels. |
## CONVENTIONS
- Output events are runtime/display seam; keep provider payloads, session JSONL, and TUI state separate.
- Redact before terminal/TUI/test snapshot display when text may include credentials.
- Keep streaming redaction stateful across deltas; hard stream boundaries must flush/clear callers' buffers.
- Display summaries are bounded and factual; raw tool output stays in local display data or tool result caps.
- Add tests when changing redaction patterns, event shapes, or renderer status text.
## ANTI-PATTERNS
- Do not leak API keys, OAuth tokens, auth codes, bearer headers, account IDs, or credential JSON through events/renderers.
- Do not persist `OutputEvent` directly to JSONL; sessions own durable event shape.
- Do not put provider request shaping, tool dispatch, or TUI layout state here.
- Do not make renderer-specific labels part of provider-visible context.