Documentation
¶
Overview ¶
Package report renders engagement reports from PromptZero session audit data. A report aggregates:
- timeline of tool invocations with timestamps and durations
- per-risk-tier counts (low / medium / high / critical)
- MITRE ATT&CK coverage heatmap — computed via internal/attack
- aggregate success / failure / confirmation-denied totals
- session metadata (id, span, tool count)
Output is Markdown by default — small, portable, and readable both in the terminal and rendered in a GitHub / Obsidian / Notion pane. Future formats (HTML, PDF) can be added as new Renderer implementations without changing the session-summary math in Summarise.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DetectorVerdictSummary ¶
type DetectorVerdictSummary struct {
Tool string `json:"tool"`
Verdict string `json:"verdict"`
Confidence float64 `json:"confidence"`
DetectedBy string `json:"detected_by"`
Evidence string `json:"evidence,omitempty"`
}
DetectorVerdictSummary is one detector's verdict attached to one tool invocation, flattened for report rendering. Auxiliary fields (confidence, evidence) are kept so the Markdown renderer can explain why a verdict landed the way it did.
type JSONRenderer ¶ added in v0.21.0
type JSONRenderer struct{}
JSONRenderer emits a structured JSON dump of the Summary suitable for downstream tooling — engagement-tracking systems, custom dashboards, programmatic verification of session contents. Pretty- printed with two-space indent so the output is human-readable as well. Zero-value is usable.
type MarkdownRenderer ¶
type MarkdownRenderer struct{}
MarkdownRenderer emits a GFM-compatible markdown report. Zero-value is usable; no configuration surface today.
type Renderer ¶
Renderer turns a Summary into concrete output bytes. Additional implementations (HTML, PDF, JSON) can plug in by satisfying the same interface — Summarise is the shared input contract.
type Summary ¶
type Summary struct {
SessionID string
StartedAt time.Time
EndedAt time.Time
// Counts, populated by walking the audit entries.
TotalEntries int
BySuccess map[bool]int // true=success, false=failure
ByRisk map[string]int // "low" / "medium" / "high" / "critical" / ""
ByLevel map[audit.Level]int
ByTool map[string]int
// ATT&CK coverage. Each technique ID maps to the number of tool
// invocations that contributed to it.
ATTACKCoverage map[string]int
// DetectorVerdicts groups the verdicts the DetectorEngine
// emitted during the session. Extracted from each audit entry's
// Output by matching the <detector-verdict>{...}</detector-verdict>
// block appended by appendDetectorVerdicts. Keyed by detector
// name for heatmap display.
DetectorVerdicts []DetectorVerdictSummary
// Timeline is the chronologically ordered entry list. Callers that
// only want the summary counts can ignore this; the markdown
// renderer uses it for the timeline section.
Timeline []audit.Entry
// TotalDuration sums all entry.Duration fields (in milliseconds).
// Gives the report a "hands-on" time estimate distinct from
// StartedAt/EndedAt which span idle periods too.
TotalDurationMs int64
}
Summary is the intermediate, format-agnostic aggregate of a session's activity. Renderer implementations consume Summary to produce concrete output bytes; tests exercise Summarise independently of rendering.