Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

update dash view

Justin D'Souza63c59d1c64ff
diff --git a/cli/beacon/internal/endpoint/dashboard/events_test.go b/cli/beacon/internal/endpoint/dashboard/events_test.go
index f84656d8..bb246b02 100644
--- a/cli/beacon/internal/endpoint/dashboard/events_test.go
+++ b/cli/beacon/internal/endpoint/dashboard/events_test.go
@@ -349,6 +349,110 @@ func TestReadEventsFiltersBySessionState(t *testing.T) {
}
}
+func TestReadSessionsGroupsEventsBySession(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "runtime.jsonl")
+ events := []schema.Event{
+ testSchemaEvent("2026-05-13T01:00:00Z", "cursor", "prompt.submitted", "prompt", "repo-a"),
+ testSchemaEvent("2026-05-13T01:01:00Z", "cursor", "command.executed", "command", "repo-a"),
+ testSchemaEvent("2026-05-13T01:02:00Z", "claude_code", "tool.failed", "tool", "repo-b"),
+ testSchemaEvent("2026-05-13T01:03:00Z", "cursor", "inventory.heartbeat", "inventory", "repo-c"),
+ }
+ events[0].Session = &schema.SessionInfo{ID: "session-a", WorkingDirectory: "/tmp/repo-a"}
+ events[0].Prompt = &schema.PromptInfo{Text: "Investigate the dashboard"}
+ events[1].Session = &schema.SessionInfo{ID: "session-a", WorkingDirectory: "/tmp/repo-a"}
+ events[1].Command = &schema.CommandInfo{Command: "go test ./..."}
+ events[2].Session = &schema.SessionInfo{ID: "session-b"}
+ events[2].Severity = schema.SeverityHigh
+ writeTestLog(t, path, marshalEvents(t, events...)...)
+
+ result, err := ReadSessions(path, EventQuery{Limit: 10})
+ if err != nil {
+ t.Fatalf("ReadSessions returned error: %v", err)
+ }
+ if result.EventsMatched != 4 || result.TotalSessions != 2 || len(result.Sessions) != 2 {
+ t.Fatalf("sessions result = matched %d total %d len %d, want 4/2/2", result.EventsMatched, result.TotalSessions, len(result.Sessions))
+ }
+ if result.Sessions[0].ID != "session-b" || result.Sessions[0].EventCount != 1 || result.Sessions[0].ReviewCount != 1 {
+ t.Fatalf("newest session = %#v, want high-risk session-b", result.Sessions[0])
+ }
+ if result.Sessions[1].ID != "session-a" || result.Sessions[1].EventCount != 2 || result.Sessions[1].CommandCount != 1 || result.Sessions[1].PromptCount != 1 {
+ t.Fatalf("older session = %#v, want aggregated session-a", result.Sessions[1])
+ }
+ if result.Sessions[1].WorkingDir != "/tmp/repo-a" || result.Sessions[1].LastArtifact != "go test ./..." {
+ t.Fatalf("session metadata = dir %q artifact %q", result.Sessions[1].WorkingDir, result.Sessions[1].LastArtifact)
+ }
+ if result.Sessions[1].OriginalPrompt != "Investigate the dashboard" {
+ t.Fatalf("original prompt = %q, want first submitted prompt", result.Sessions[1].OriginalPrompt)
+ }
+}
+
+func TestReadSessionsCountsEachEventInOneActivityCategory(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "runtime.jsonl")
+ event := testSchemaEvent("2026-05-13T01:00:00Z", "cursor", "tool.completed", "tool", "repo-a")
+ event.Session = &schema.SessionInfo{ID: "session-a"}
+ event.Tool = &schema.ToolInfo{Name: "Shell"}
+ event.Command = &schema.CommandInfo{Command: "go test ./..."}
+ event.File = &schema.FileInfo{Path: "main.go", Operation: "modify"}
+ event.MCP = &schema.MCPInfo{Server: "filesystem", Tool: "write_file"}
+ event.Approval = &schema.ApprovalInfo{Decision: "approved"}
+ writeTestLog(t, path, marshalEvents(t, event)...)
+
+ result, err := ReadSessions(path, EventQuery{Limit: 10})
+ if err != nil {
+ t.Fatalf("ReadSessions returned error: %v", err)
+ }
+ if len(result.Sessions) != 1 {
+ t.Fatalf("sessions length = %d, want 1", len(result.Sessions))
+ }
+ session := result.Sessions[0]
+ if session.EventCount != 1 || session.ToolCount != 1 {
+ t.Fatalf("session counts = events %d tools %d, want 1/1", session.EventCount, session.ToolCount)
+ }
+ if session.CommandCount != 0 || session.FileCount != 0 || session.MCPCount != 0 || session.ApprovalCount != 0 {
+ t.Fatalf("one tool event counted in multiple activity categories: %#v", session)
+ }
+}
+
+func TestHandlerSessionDetailReturnsRawEventsInTimelineOrder(t *testing.T) {
+ path := filepath.Join(t.TempDir(), "runtime.jsonl")
+ events := []schema.Event{
+ testSchemaEvent("2026-05-13T01:01:00Z", "cursor", "command.executed", "command", "repo-a"),
+ testSchemaEvent("2026-05-13T01:00:00Z", "cursor", "prompt.submitted", "prompt", "repo-a"),
+ testSchemaEvent("2026-05-13T01:02:00Z", "cursor", "file.modified", "file", "repo-a"),
+ }
+ events[0].Session = &schema.SessionInfo{ID: "session-a"}
+ events[0].Command = &schema.CommandInfo{Command: "go test ./..."}
+ events[1].Session = &schema.SessionInfo{ID: "session-a"}
+ events[1].Prompt = &schema.PromptInfo{Text: "Investigate the dashboard"}
+ events[2].Session = &schema.SessionInfo{ID: "session-b"}
+ writeTestLog(t, path, marshalEvents(t, events...)...)
+
+ handler, err := Handler(Options{LogPath: path, UserMode: true})
+ if err != nil {
+ t.Fatalf("Handler returned error: %v", err)
+ }
+ req := httptest.NewRequest(http.MethodGet, "/api/session?id=session-a", nil)
+ rec := httptest.NewRecorder()
+ handler.ServeHTTP(rec, req)
+
+ if rec.Code != http.StatusOK {
+ t.Fatalf("status = %d, want 200; body=%s", rec.Code, rec.Body.String())
+ }
+ var detail SessionDetail
+ if err := json.Unmarshal(rec.Body.Bytes(), &detail); err != nil {
+ t.Fatalf("decode session detail: %v", err)
+ }
+ if detail.Session.ID != "session-a" || len(detail.Events) != 2 {
+ t.Fatalf("detail session=%q events=%d, want session-a/2", detail.Session.ID, len(detail.Events))
+ }
+ if detail.Events[0].Event.Event.Action != "prompt.submitted" || detail.Events[1].Event.Event.Action != "command.executed" {
+ t.Fatalf("actions = %q, %q; want chronological prompt then command", detail.Events[0].Event.Event.Action, detail.Events[1].Event.Event.Action)
+ }
+ if len(detail.Events[0].RawEvent) == 0 || !json.Valid(detail.Events[0].RawEvent) {
+ t.Fatalf("raw_event missing or invalid: %s", string(detail.Events[0].RawEvent))
+ }
+}
+
func TestReadEventsFiltersByUntil(t *testing.T) {
path := filepath.Join(t.TempDir(), "runtime.jsonl")
writeTestLog(t, path,
diff --git a/cli/beacon/internal/endpoint/dashboard/server.go b/cli/beacon/internal/endpoint/dashboard/server.go
index c74d4ac3..cd50cffb 100644
--- a/cli/beacon/internal/endpoint/dashboard/server.go
+++ b/cli/beacon/internal/endpoint/dashboard/server.go
@@ -145,6 +145,39 @@ func Handler(opts Options) (http.Handler, error) {
}
writeJSON(w, events)
})
+ mux.HandleFunc("/api/sessions", func(w http.ResponseWriter, r *http.Request) {
+ if r.Method != http.MethodGet {
+ methodNotAllowed(w)
+ return
+ }
+ sessions, err := ReadSessions(opts.LogPath, parseQuery(r, defaultEventLimit))
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, err)
+ return
+ }
+ writeJSON(w, sessions)
+ })
+ mux.HandleFunc("/api/session", func(w http.ResponseWriter, r *http.Request) {
+ if r.Method != http.MethodGet {
+ methodNotAllowed(w)
+ return
+ }
+ id := strings.TrimSpace(r.URL.Query().Get("id"))
+ if id == "" {
+ writeError(w, http.StatusBadRequest, fmt.Errorf("session id is required"))
+ return
+ }
+ detail, ok, err := ReadSessionDetail(opts.LogPath, id)
+ if err != nil {
+ writeError(w, http.StatusInternalServerError, err)
+ return
+ }
+ if !ok {
+ writeError(w, http.StatusNotFound, fmt.Errorf("session not found"))
+ return
+ }
+ writeJSON(w, detail)
+ })
mux.HandleFunc("/api/traces", func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
methodNotAllowed(w)
diff --git a/cli/beacon/internal/endpoint/dashboard/sessions.go b/cli/beacon/internal/endpoint/dashboard/sessions.go
new file mode 100644
index 00000000..3177f955
--- /dev/null
+++ b/cli/beacon/internal/endpoint/dashboard/sessions.go
@@ -0,0 +1,275 @@
+package dashboard
+
+import (
+ "encoding/json"
+ "sort"
+ "time"
+
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/schema"
+)
+
+type SessionRecord struct {
+ ID string `json:"id"`
+ FirstEventAt string `json:"first_event_at,omitempty"`
+ LastEventAt string `json:"last_event_at,omitempty"`
+ EventCount int `json:"event_count"`
+ ReviewCount int `json:"review_count"`
+ MaxSeverity string `json:"max_severity,omitempty"`
+ Harness string `json:"harness,omitempty"`
+ Model string `json:"model,omitempty"`
+ Repository string `json:"repository,omitempty"`
+ Branch string `json:"branch,omitempty"`
+ WorkingDir string `json:"working_directory,omitempty"`
+ OriginalPrompt string `json:"original_prompt,omitempty"`
+ LastAction string `json:"last_action,omitempty"`
+ LastMessage string `json:"last_message,omitempty"`
+ LastArtifact string `json:"last_artifact,omitempty"`
+ CommandCount int `json:"command_count"`
+ FileCount int `json:"file_count"`
+ MCPCount int `json:"mcp_count"`
+ ApprovalCount int `json:"approval_count"`
+ PromptCount int `json:"prompt_count"`
+ ToolCount int `json:"tool_count"`
+}
+
+type SessionResult struct {
+ Sessions []SessionRecord `json:"sessions"`
+ EventsMatched int `json:"events_matched"`
+ TotalSessions int `json:"total_sessions"`
+ MalformedLines int `json:"malformed_lines"`
+ Limit int `json:"limit"`
+ Query string `json:"query,omitempty"`
+ Filters map[string]string `json:"filters,omitempty"`
+ Returned int `json:"returned"`
+ Truncated bool `json:"truncated"`
+}
+
+type SessionEventRecord struct {
+ ID string `json:"id"`
+ Line int `json:"line"`
+ Event schema.Event `json:"event"`
+ RawEvent json.RawMessage `json:"raw_event,omitempty"`
+ Parsed time.Time `json:"parsed_timestamp,omitempty"`
+ WazuhLevel int `json:"wazuh_level,omitempty"`
+}
+
+type SessionDetail struct {
+ Session SessionRecord `json:"session"`
+ Events []SessionEventRecord `json:"events"`
+}
+
+func ReadSessions(path string, query EventQuery) (SessionResult, error) {
+ limit := normalizeLimit(query.Limit)
+ query.NoLimit = true
+ events, err := ReadEvents(path, query)
+ if err != nil {
+ return SessionResult{}, err
+ }
+ SortRecordsAppendOrder(events.Events)
+ byID := map[string]*sessionAccumulator{}
+ for _, record := range events.Events {
+ id := sessionID(record.Event)
+ if id == "" {
+ continue
+ }
+ acc := byID[id]
+ if acc == nil {
+ acc = &sessionAccumulator{record: SessionRecord{ID: id}}
+ byID[id] = acc
+ }
+ acc.add(record)
+ }
+ sessions := make([]SessionRecord, 0, len(byID))
+ for _, acc := range byID {
+ sessions = append(sessions, acc.record)
+ }
+ sort.SliceStable(sessions, func(i, j int) bool {
+ li := parseSessionTime(sessions[i].LastEventAt)
+ lj := parseSessionTime(sessions[j].LastEventAt)
+ if !li.Equal(lj) {
+ return li.After(lj)
+ }
+ return sessions[i].ID > sessions[j].ID
+ })
+ total := len(sessions)
+ if len(sessions) > limit {
+ sessions = sessions[:limit]
+ }
+ return SessionResult{
+ Sessions: sessions,
+ EventsMatched: events.TotalMatched,
+ TotalSessions: total,
+ MalformedLines: events.MalformedLines,
+ Limit: limit,
+ Query: events.Query,
+ Filters: events.Filters,
+ Returned: len(sessions),
+ Truncated: total > len(sessions),
+ }, nil
+}
+
+func ReadSessionDetail(path, id string) (SessionDetail, bool, error) {
+ result, err := ReadEvents(path, EventQuery{Session: id, NoLimit: true})
+ if err != nil {
+ return SessionDetail{}, false, err
+ }
+ records := make([]EventRecord, 0, len(result.Events))
+ for _, record := range result.Events {
+ if sessionID(record.Event) == id {
+ records = append(records, record)
+ }
+ }
+ if len(records) == 0 {
+ return SessionDetail{}, false, nil
+ }
+ SortRecordsAppendOrder(records)
+ acc := &sessionAccumulator{record: SessionRecord{ID: id}}
+ events := make([]SessionEventRecord, 0, len(records))
+ for _, record := range records {
+ acc.add(record)
+ events = append(events, SessionEventRecord{
+ ID: record.ID,
+ Line: record.Line,
+ Event: record.Event,
+ RawEvent: append(json.RawMessage(nil), record.Raw...),
+ Parsed: record.Parsed,
+ WazuhLevel: record.WazuhLevel,
+ })
+ }
+ return SessionDetail{Session: acc.record, Events: events}, true, nil
+}
+
+type sessionAccumulator struct {
+ record SessionRecord
+ first time.Time
+ last time.Time
+}
+
+func (acc *sessionAccumulator) add(record EventRecord) {
+ event := record.Event
+ acc.record.EventCount++
+ if isNeedsReview(record) {
+ acc.record.ReviewCount++
+ }
+ acc.record.MaxSeverity = maxSeverity(acc.record.MaxSeverity, string(event.Severity))
+ if event.Harness.Name != "" && acc.record.Harness == "" {
+ acc.record.Harness = event.Harness.Name
+ }
+ if event.Model != "" && acc.record.Model == "" {
+ acc.record.Model = event.Model
+ }
+ if event.Repository != "" && acc.record.Repository == "" {
+ acc.record.Repository = event.Repository
+ }
+ if event.Branch != "" && acc.record.Branch == "" {
+ acc.record.Branch = event.Branch
+ }
+ if event.Session != nil && event.Session.WorkingDirectory != "" && acc.record.WorkingDir == "" {
+ acc.record.WorkingDir = event.Session.WorkingDirectory
+ }
+ if acc.record.OriginalPrompt == "" && isPromptEvent(event) {
+ acc.record.OriginalPrompt = promptText(event)
+ }
+ switch event.Event.Category {
+ case "prompt":
+ acc.record.PromptCount++
+ case "tool":
+ acc.record.ToolCount++
+ case "command":
+ acc.record.CommandCount++
+ case "file":
+ acc.record.FileCount++
+ case "mcp":
+ acc.record.MCPCount++
+ case "approval":
+ acc.record.ApprovalCount++
+ }
+ if record.Parsed.IsZero() {
+ return
+ }
+ if acc.first.IsZero() || record.Parsed.Before(acc.first) {
+ acc.first = record.Parsed
+ acc.record.FirstEventAt = event.Timestamp
+ }
+ if acc.last.IsZero() || record.Parsed.After(acc.last) || record.Parsed.Equal(acc.last) {
+ acc.last = record.Parsed
+ acc.record.LastEventAt = event.Timestamp
+ acc.record.LastAction = event.Event.Action
+ acc.record.LastMessage = event.Message
+ acc.record.LastArtifact = sessionArtifact(event)
+ }
+}
+
+func sessionID(event schema.Event) string {
+ if event.Session == nil {
+ return ""
+ }
+ return event.Session.ID
+}
+
+func sessionArtifact(event schema.Event) string {
+ if event.Prompt != nil && event.Prompt.Text != "" {
+ return event.Prompt.Text
+ }
+ if event.Command != nil && event.Command.Command != "" {
+ return event.Command.Command
+ }
+ if event.File != nil && event.File.Path != "" {
+ return event.File.Path
+ }
+ if event.MCP != nil && (event.MCP.Server != "" || event.MCP.Tool != "") {
+ if event.MCP.Server == "" {
+ return event.MCP.Tool
+ }
+ if event.MCP.Tool == "" {
+ return event.MCP.Server
+ }
+ return event.MCP.Server + " / " + event.MCP.Tool
+ }
+ if event.Tool != nil && event.Tool.Name != "" {
+ return event.Tool.Name
+ }
+ return ""
+}
+
+func promptText(event schema.Event) string {
+ if event.Prompt != nil && event.Prompt.Text != "" {
+ return event.Prompt.Text
+ }
+ if text := rawString(event.Raw, "first_prompt"); text != "" {
+ return text
+ }
+ if event.Event.Action == "prompt.submitted" {
+ return event.Message
+ }
+ return ""
+}
+
+func maxSeverity(a, b string) string {
+ if severityRank(b) > severityRank(a) {
+ return b
+ }
+ return a
+}
+
+func severityRank(value string) int {
+ switch value {
+ case "critical":
+ return 5
+ case "high":
+ return 4
+ case "medium":
+ return 3
+ case "low":
+ return 2
+ case "info":
+ return 1
+ default:
+ return 0
+ }
+}
+
+func parseSessionTime(value string) time.Time {
+ parsed, _ := schema.ParseTimestamp(value)
+ return parsed
+}
diff --git a/cli/beacon/internal/endpoint/dashboard/static/app.js b/cli/beacon/internal/endpoint/dashboard/static/app.js
index 841465ba..1234e2e3 100644
--- a/cli/beacon/internal/endpoint/dashboard/static/app.js
+++ b/cli/beacon/internal/endpoint/dashboard/static/app.js
@@ -3,6 +3,9 @@ const state = {
summary: null,
events: [],
eventResult: null,
+ sessions: [],
+ sessionResult: null,
+ sessionDetail: null,
inventory: null,
loading: false,
error: null,
@@ -18,12 +21,21 @@ const state = {
inventoryRuntime: "",
inventoryUser: "",
inventorySearch: "",
+ sessionEventFilters: {
+ search: "",
+ type: "",
+ severity: "",
+ destructive: false,
+ showInternal: false,
+ },
};
const $ = (selector) => document.querySelector(selector);
const $$ = (selector) => Array.from(document.querySelectorAll(selector));
const navCollapsedStorageKey = "beacon.dashboard.navCollapsed";
const isActivityPage = !document.body.dataset.page;
+const isSessionsPage = document.body.dataset.page === "sessions";
+const isSessionDetailPage = document.body.dataset.page === "session-detail";
const isOverviewPage = document.body.dataset.page === "overview";
const isTokensPage = document.body.dataset.page === "tokens";
const isDetectionsPage = document.body.dataset.page === "detections";
@@ -176,6 +188,7 @@ async function load({ updateLocation = false, mode = "replace" } = {}) {
const query = queryFromFilters();
if (updateLocation) updateURL(query);
const suffix = query ? `?${query}` : "";
+ const activityPath = isSessionsPage ? "/api/sessions" : "/api/events";
const quiet = mode === "poll";
state.loading = !quiet;
state.error = null;
@@ -185,15 +198,17 @@ async function load({ updateLocation = false, mode = "replace" } = {}) {
const [status, summary, events] = await Promise.all([
getJSON("/api/status"),
getJSON(`/api/summary${suffix}`),
- getJSON(`/api/events${suffix}`),
+ getJSON(`${activityPath}${suffix}`),
]);
const previousEvents = state.events;
const previousQuery = state.currentQuery;
state.status = status;
state.summary = summary;
- state.eventResult = events;
+ state.eventResult = isSessionsPage ? null : events;
+ state.sessionResult = isSessionsPage ? events : null;
state.currentQuery = query;
- state.events = events.events || [];
+ state.events = isSessionsPage ? [] : (events.events || []);
+ state.sessions = isSessionsPage ? (events.sessions || []) : [];
if (quiet && previousQuery === query && canPatchEvents(previousEvents, state.events)) {
patchEvents(previousEvents, state.events);
renderSummaryOnly();
@@ -349,10 +364,12 @@ function renderInsights() {
function renderSearchState() {
if (!$("#result-meta")) return;
- const result = state.eventResult || {};
- const returned = result.returned ?? state.events.length;
- const total = result.total_matched ?? 0;
- $("#result-meta").textContent = state.loading ? "Loading..." : `${returned} shown of ${total} matched`;
+ const result = isSessionsPage ? (state.sessionResult || {}) : (state.eventResult || {});
+ const returned = result.returned ?? (isSessionsPage ? state.sessions.length : state.events.length);
+ const total = isSessionsPage ? (result.total_sessions ?? 0) : (result.total_matched ?? 0);
+ const unit = isSessionsPage ? "session" : "event";
+ const suffix = isSessionsPage && result.events_matched !== undefined ? ` (${result.events_matched} matching events)` : "";
+ $("#result-meta").textContent = state.loading ? "Loading..." : `${returned} shown of ${total} matched ${unit}${total === 1 ? "" : "s"}${suffix}`;
const notice = $("#notice");
if (state.error) {
@@ -360,7 +377,7 @@ function renderSearchState() {
notice.textContent = `Failed to load dashboard: ${state.error.message}`;
} else if (result.truncated) {
notice.hidden = false;
- notice.textContent = `Showing the latest ${returned} matching events. Narrow the search or raise the limit to see more.`;
+ notice.textContent = `Showing the latest ${returned} matching ${unit}${returned === 1 ? "" : "s"}. Narrow the search or raise the limit to see more.`;
} else if (result.malformed_lines) {
notice.hidden = false;
notice.textContent = `${result.malformed_lines} malformed log line${result.malformed_lines === 1 ? "" : "s"} skipped.`;
@@ -393,6 +410,340 @@ function renderSummaryOnly() {
renderSearchState();
}
+async function loadSessionPage() {
+ const params = new URLSearchParams(window.location.search);
+ const id = (params.get("id") || "").trim();
+ if (!id) {
+ state.error = new Error("session id is required");
+ renderSessionPage();
+ return;
+ }
+ const initialLoad = !state.sessionDetail;
+ state.loading = initialLoad;
+ if (initialLoad) setSessionDetailViewState("loading");
+ try {
+ const [status, detail] = await Promise.all([
+ getJSON("/api/status"),
+ getJSON(`/api/session?id=${encodeURIComponent(id)}`),
+ ]);
+ state.status = status;
+ state.sessionDetail = detail;
+ state.events = detail.events || [];
+ state.error = null;
+ } catch (err) {
+ state.error = err;
+ } finally {
+ state.loading = false;
+ renderSessionPage();
+ }
+}
+
+function renderSessionPage() {
+ setText("#log-path", state.status?.log_path || "Runtime log unavailable");
+ const detail = state.sessionDetail || {};
+ if (state.error && !state.sessionDetail) {
+ setSessionDetailViewState("error", `Failed to load session: ${state.error.message}`);
+ return;
+ }
+ renderSessionOverview(detail);
+ renderSessionEventFilters();
+ renderSessionEventTable();
+ setSessionDetailViewState("ready");
+ if ($("#notice")) {
+ $("#notice").hidden = !state.error;
+ $("#notice").textContent = state.error ? `Unable to refresh session: ${state.error.message}` : "";
+ }
+}
+
+function setSessionDetailViewState(mode, message = "") {
+ const view = $("#session-detail-view");
+ const status = $("#session-detail-status");
+ if (view) view.hidden = mode !== "ready";
+ if (!status) return;
+ status.hidden = mode === "ready";
+ status.classList.toggle("error", mode === "error");
+ setText(
+ "#session-detail-status-message",
+ message || (mode === "loading" ? "Loading session details..." : ""),
+ );
+}
+
+const sessionTypeOptions = [
+ ["", "All types"],
+ ["prompt", "Prompt"],
+ ["tool", "Tool"],
+ ["command", "Command"],
+ ["file", "File"],
+ ["mcp", "MCP"],
+ ["approval", "Approval"],
+ ["session", "Session"],
+ ["inventory", "Inventory"],
+ ["validation", "Validation"],
+];
+
+const sessionSeverityOptions = [
+ ["", "All severities"],
+ ["info", "Info"],
+ ["low", "Low"],
+ ["medium", "Medium"],
+ ["high", "High"],
+ ["critical", "Critical"],
+];
+
+function renderSessionEventFilters() {
+ const filters = state.sessionEventFilters;
+ const search = $("#session-event-search");
+ if (search) {
+ search.value = filters.search;
+ search.oninput = (event) => {
+ filters.search = event.target.value;
+ renderSessionEventTable();
+ };
+ }
+ renderSessionFilterButtons("#session-type-filters", sessionTypeOptions, filters.type, "session-event-type");
+ renderSessionFilterButtons("#session-severity-filters", sessionSeverityOptions, filters.severity, "session-event-severity");
+ const actionFilters = $("#session-action-filters");
+ if (actionFilters) {
+ actionFilters.innerHTML = `
+ <button type="button" class="${filters.destructive ? "" : "active"}" data-session-destructive="false">All actions</button>
+ <button type="button" class="${filters.destructive ? "active" : ""}" data-session-destructive="true">Contains destructive action</button>
+ `;
+ }
+ $$("[data-session-event-type]").forEach((button) => {
+ button.onclick = () => {
+ filters.type = button.dataset.sessionEventType;
+ renderSessionEventFilters();
+ renderSessionEventTable();
+ };
+ });
+ $$("[data-session-event-severity]").forEach((button) => {
+ button.onclick = () => {
+ filters.severity = button.dataset.sessionEventSeverity;
+ renderSessionEventFilters();
+ renderSessionEventTable();
+ };
+ });
+ $$("[data-session-destructive]").forEach((button) => {
+ button.onclick = () => {
+ filters.destructive = button.dataset.sessionDestructive === "true";
+ renderSessionEventFilters();
+ renderSessionEventTable();
+ };
+ });
+ const internal = $("#toggle-internal-events");
+ if (internal) {
+ internal.textContent = filters.showInternal ? "Hide internal events" : "Show internal events";
+ internal.classList.toggle("active", filters.showInternal);
+ internal.onclick = () => {
+ filters.showInternal = !filters.showInternal;
+ renderSessionEventFilters();
+ renderSessionEventTable();
+ };
+ }
+}
+
+function renderSessionFilterButtons(selector, options, current, dataName) {
+ const container = $(selector);
+ if (!container) return;
+ const attribute = dataName.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
+ container.innerHTML = options.map(([value, label]) => `
+ <button type="button" class="${current === value ? "active" : ""}" data-${attribute}="${escapeHTML(value)}">${escapeHTML(label)}</button>
+ `).join("");
+}
+
+function renderSessionEventTable() {
+ const tbody = $("#events");
+ if (!tbody) return;
+ const records = filteredSessionEvents();
+ const filters = state.sessionEventFilters;
+ const typeLabel = sessionTypeOptions.find(([value]) => value === filters.type)?.[1] || "All types";
+ const severityLabel = sessionSeverityOptions.find(([value]) => value === filters.severity)?.[1] || "All severities";
+ const actionLabel = filters.destructive ? "Destructive" : "All";
+ const runtimeLabel = filters.showInternal ? "internal shown" : "internal hidden";
+ setText("#result-meta", `Type: ${typeLabel} · Severity: ${severityLabel} · Action: ${actionLabel} · Runtime: ${runtimeLabel} · ${records.length} of ${state.events.length} events`);
+ if (!records.length) {
+ tbody.innerHTML = `<tr><td colspan="11" class="muted">No events match these filters.</td></tr>`;
+ return;
+ }
+ tbody.innerHTML = records.map(({ record, index }) => sessionEventRowHTML(record, index)).join("");
+ $$("[data-session-json-index]").forEach((button) => {
+ button.onclick = (event) => {
+ event.stopPropagation();
+ showRawSessionEvent(Number(button.dataset.sessionJsonIndex));
+ };
+ });
+ $$("[data-session-value-index]").forEach((button) => {
+ button.onclick = (event) => {
+ event.stopPropagation();
+ showSessionEventValue(Number(button.dataset.sessionValueIndex));
+ };
+ });
+}
+
+function filteredSessionEvents() {
+ const filters = state.sessionEventFilters;
+ const query = filters.search.trim().toLowerCase();
+ return state.events.map((record, index) => ({ record, index })).filter(({ record }) => {
+ const event = record.event || {};
+ const type = sessionDisplayEventType(event);
+ if (!filters.showInternal && isInternalSessionEvent(event)) return false;
+ if (filters.type && type !== filters.type) return false;
+ if (filters.severity && String(event.severity || "info").toLowerCase() !== filters.severity) return false;
+ if (filters.destructive && !isDestructiveSessionEvent(record)) return false;
+ if (query) {
+ const raw = record.raw_event || event;
+ if (!JSON.stringify(raw).toLowerCase().includes(query)) return false;
+ }
+ return true;
+ });
+}
+
+function sessionEventRowHTML(record, index) {
+ const event = record.event || {};
+ const usage = event.gen_ai?.usage || {};
+ const type = sessionDisplayEventType(event);
+ const action = event.event?.action || "event";
+ const eventID = event.event?.id || record.id || "";
+ const value = sessionEventValue(event);
+ const actionDetail = event.tool?.name || event.mcp?.tool || event.model || event.harness?.name || "";
+ return `
+ <tr>
+ <td class="mono session-event-id" title="${escapeHTML(eventID)}">${escapeHTML(shortEventID(eventID))}</td>
+ <td class="col-timestamp timestamp-cell">${timestampCellHTML(event.timestamp)}</td>
+ <td>${sessionSeverityPill(event.severity || "info")}</td>
+ <td>${sessionTypePill(type)}</td>
+ <td class="session-event-action">
+ <strong>${escapeHTML(sessionActionLabel(event))}</strong>
+ ${actionDetail ? `<span>${escapeHTML(actionDetail)}</span>` : ""}
+ </td>
+ <td class="session-event-value">
+ <span>${escapeHTML(truncateMiddle(value, 180) || "-")}</span>
+ ${value ? `<button type="button" class="session-value-button" data-session-value-index="${index}">View full ${escapeHTML(sessionValueKind(event))}</button>` : ""}
+ </td>
+ <td>${sessionUsageValue(usage.input_tokens)}</td>
+ <td>${sessionUsageValue(usage.output_tokens)}</td>
+ <td>${sessionUsageValue(usage.cache_creation?.input_tokens)}</td>
+ <td>${sessionUsageValue(usage.cache_read?.input_tokens)}</td>
+ <td><button type="button" class="session-json-button" data-session-json-index="${index}" aria-label="Inspect raw JSON for ${escapeHTML(action)}">JSON</button></td>
+ </tr>
+ `;
+}
+
+function sessionDisplayEventType(event) {
+ const category = String(event.event?.category || "").toLowerCase();
+ if (category) return category;
+ return sessionEventCategory(event);
+}
+
+function isInternalSessionEvent(event) {
+ const category = sessionDisplayEventType(event);
+ const action = String(event.event?.action || "").toLowerCase();
+ return ["inventory", "validation", "metric"].includes(category)
+ || ["inventory.", "validation.", "metric.", "endpoint.", "telemetry."].some((prefix) => action.startsWith(prefix));
+}
+
+function isDestructiveSessionEvent(record) {
+ const event = record.event || {};
+ const text = JSON.stringify(record.raw_event || event).toLowerCase();
+ if (event.severity === "high" || event.severity === "critical") return true;
+ if (["approval.denied", "policy.blocked", "tool.failed"].includes(event.event?.action)) return true;
+ return /\b(rm\s+-rf|git\s+reset\s+--hard|git\s+clean\s+-f|drop\s+(table|database)|truncate\s+table|delete\s+from)\b/.test(text);
+}
+
+function sessionSeverityPill(severity) {
+ const normalized = String(severity || "info").toLowerCase();
+ return `<span class="session-severity-pill session-severity-${escapeHTML(normalized)}">${escapeHTML(normalized)}</span>`;
+}
+
+function sessionTypePill(type) {
+ const normalized = String(type || "other").toLowerCase();
+ return `<span class="session-type-pill session-type-${escapeHTML(normalized)}">${escapeHTML(normalized)}</span>`;
+}
+
+function sessionActionLabel(event) {
+ if (event.message && event.message !== event.event?.action) return event.message;
+ return String(event.event?.action || "event")
+ .replaceAll(".", " ")
+ .replaceAll("_", " ")
+ .replace(/\b\w/g, (char) => char.toUpperCase());
+}
+
+function sessionEventValue(event) {
+ const reasoning = sessionReasoningValue(event);
+ if (reasoning) return reasoning;
+ if (event.command?.command) return event.command.command;
+ if (event.file?.path) return [event.file.operation, event.file.path].filter(Boolean).join(" ");
+ if (event.prompt?.text) return event.prompt.text;
+ if (event.mcp) return [event.mcp.server, event.mcp.tool].filter(Boolean).join(" / ");
+ if (event.approval) return [event.approval.decision, event.approval.reason].filter(Boolean).join(": ");
+ if (event.policy) return [event.policy.decision, event.policy.reason].filter(Boolean).join(": ");
+ if (event.tool) return [event.tool.name, event.tool.command, event.tool.path].filter(Boolean).join(" ");
+ return event.message || "";
+}
+
+function sessionReasoningValue(event) {
+ let messages = event.gen_ai?.output?.messages;
+ if (typeof messages === "string") {
+ try {
+ messages = JSON.parse(messages);
+ } catch {
+ return "";
+ }
+ }
+ if (!Array.isArray(messages)) return "";
+ return messages.flatMap((message) => Array.isArray(message?.parts) ? message.parts : [])
+ .filter((part) => part?.type === "reasoning" && typeof part.content === "string")
+ .map((part) => part.content)
+ .filter(Boolean)
+ .join("\n\n");
+}
+
+function sessionValueKind(event) {
+ if (sessionReasoningValue(event)) return "reasoning";
+ if (event.command?.command) return "command";
+ if (event.prompt?.text) return "prompt";
+ if (event.file?.path) return "file";
+ if (event.mcp) return "MCP value";
+ if (event.approval || event.policy) return "decision";
+ return "value";
+}
+
+function sessionUsageValue(value) {
+ return value === undefined || value === null ? `<span class="muted">-</span>` : escapeHTML(formatTokens(value));
+}
+
+function shortEventID(value) {
+ const id = String(value || "");
+ if (!id) return "-";
+ return id.length > 6 ? `…${id.slice(-5)}` : id;
+}
+
+function showRawSessionEvent(index) {
+ const record = state.events[index];
+ if (!record || !$("#drawer")) return;
+ setText("#drawer .drawer-head h2", "Raw Event JSON");
+ $("#event-summary").innerHTML = detailSummary(record);
+ $("#event-json").textContent = JSON.stringify(record.raw_event || record.event || {}, null, 2);
+ $("#drawer").classList.add("open");
+ $("#drawer").setAttribute("aria-hidden", "false");
+}
+
+function showSessionEventValue(index) {
+ const event = state.events[index]?.event || {};
+ const value = sessionEventValue(event);
+ const dialog = $("#session-value-dialog");
+ if (!value || !dialog) return;
+ const kind = sessionValueKind(event);
+ setText("#session-value-dialog-title", `Full ${kind}`);
+ setText("#session-value-dialog-content", value);
+ dialog.showModal();
+ const close = $("#close-session-value");
+ if (close) close.onclick = () => dialog.close();
+ dialog.onclick = (clickEvent) => {
+ if (clickEvent.target === dialog) dialog.close();
+ };
+}
+
async function loadInventory() {
try {
const [status, inventory] = await Promise.all([
@@ -1183,6 +1534,10 @@ function configKindLabel(kind) {
function renderEvents() {
if (!$("#events")) return;
+ if (isSessionsPage) {
+ renderSessions();
+ return;
+ }
if (state.loading) {
renderLoading();
return;
@@ -1201,6 +1556,66 @@ function renderEvents() {
bindEventRows();
}
+function renderSessions() {
+ if (state.loading) {
+ renderLoading();
+ return;
+ }
+ if (state.error) {
+ $("#events").innerHTML = `<tr><td colspan="9">Failed to load dashboard: ${escapeHTML(state.error.message)}</td></tr>`;
+ return;
+ }
+ if (!state.sessions.length) {
+ $("#events").innerHTML = `<tr><td colspan="9">No sessions match this search. Clear filters or broaden the query.</td></tr>`;
+ return;
+ }
+ $("#events").innerHTML = state.sessions
+ .map((session) => sessionRowHTML(session))
+ .join("");
+ bindSessionRows();
+}
+
+function sessionRowHTML(session) {
+ const review = session.review_count || 0;
+ const activity = sessionActivitySummary(session);
+ const lastDetail = session.last_artifact || session.last_message || "";
+ const models = uniqueValues([...(session.models || []), session.model]);
+ const prompt = session.original_prompt
+ ? escapeHTML(truncateMiddle(session.original_prompt, 180))
+ : `<span class="muted">No prompt captured</span>`;
+ return `
+ <tr class="row-link" data-session-id="${escapeHTML(session.id)}">
+ <td class="mono"><span class="cell-link">${escapeHTML(formatSessionID(session.id))}</span></td>
+ <td>${badge(session.max_severity || "unknown", `severity-${session.max_severity || "unknown"}`)}${review ? `<br /><span class="muted">${escapeHTML(review)} review</span>` : ""}</td>
+ <td>${sessionHarnessCell(session)}</td>
+ <td class="col-message">
+ <span class="session-list-prompt">
+ ${models.length ? `<strong class="session-list-prompt-model">${models.map(escapeHTML).join(" · ")}</strong>` : ""}
+ <span>${prompt}</span>
+ </span>
+ </td>
+ <td class="session-activity-cell">${activity}</td>
+ <td class="col-timestamp timestamp-cell">${timestampCellHTML(session.first_event_at)}</td>
+ <td class="col-timestamp timestamp-cell">${timestampCellHTML(session.last_event_at)}</td>
+ <td class="col-duration">${escapeHTML(durationLabel(session.first_event_at, session.last_event_at))}</td>
+ <td class="col-message"><strong>${escapeHTML(session.last_action || "event")}</strong>${lastDetail ? `<br /><span class="muted">${escapeHTML(truncateMiddle(lastDetail, 140))}</span>` : ""}</td>
+ </tr>
+ `;
+}
+
+function bindSessionRows(scope = document) {
+ const rows = scope.matches?.("tr[data-session-id]") ? [scope] : Array.from(scope.querySelectorAll("tr[data-session-id]"));
+ rows.forEach((row) => {
+ row.addEventListener("click", () => {
+ window.location.href = sessionPageURL(row.dataset.sessionId);
+ });
+ });
+}
+
+function sessionPageURL(id) {
+ return `/session.html?id=${encodeURIComponent(id)}`;
+}
+
function eventRowHTML(record) {
const event = record.event || {};
const session = event.session || {};
@@ -1302,6 +1717,7 @@ function showNewEvents() {
async function showEvent(id) {
if (!$("#drawer")) return;
const record = await getJSON(`/api/event?id=${encodeURIComponent(id)}`);
+ setText("#drawer .drawer-head h2", "Event Detail");
$("#event-summary").innerHTML = detailSummary(record);
$("#event-json").textContent = JSON.stringify(record.event, null, 2);
$$("#event-summary [data-apply-filter]").forEach((button) => {
@@ -1311,6 +1727,17 @@ async function showEvent(id) {
$("#drawer").setAttribute("aria-hidden", "false");
}
+async function showSession(id) {
+ if (!$("#drawer")) return;
+ const detail = await getJSON(`/api/session?id=${encodeURIComponent(id)}`);
+ setText("#drawer .drawer-head h2", "Session Detail");
+ $("#event-summary").innerHTML = sessionDetailSummary(detail);
+ const rawEvents = (detail.events || []).map((record) => record.raw_event || record.event || {});
+ $("#event-json").textContent = JSON.stringify(rawEvents, null, 2);
+ $("#drawer").classList.add("open");
+ $("#drawer").setAttribute("aria-hidden", "false");
+}
+
function closeDrawer() {
if (!$("#drawer")) return;
$("#drawer").classList.remove("open");
@@ -1319,7 +1746,8 @@ function closeDrawer() {
function renderLoading() {
setText("#result-meta", "Loading...");
- if ($("#events")) $("#events").innerHTML = `<tr><td colspan="8">Loading events...</td></tr>`;
+ const columns = isSessionDetailPage ? 11 : (isSessionsPage ? 7 : 8);
+ if ($("#events")) $("#events").innerHTML = `<tr><td colspan="${columns}">Loading ${isSessionsPage ? "sessions" : "events"}...</td></tr>`;
}
function signalCell(record) {
@@ -1348,6 +1776,11 @@ function harnessCell(event) {
`;
}
+function sessionHarnessCell(session) {
+ if (!session.harness) return "";
+ return harnessCell({ harness: { name: session.harness } });
+}
+
function captureMethodLabel(value) {
const labels = {
hook: "Hooks",
@@ -1365,6 +1798,45 @@ function signalAction(record) {
return info.action || "unknown";
}
+function sessionActivitySummary(session) {
+ const items = [
+ ["tool", Number(session.tool_count) || 0],
+ ["command", Number(session.command_count) || 0],
+ ["file", Number(session.file_count) || 0],
+ ["prompt", Number(session.prompt_count) || 0],
+ ["mcp", Number(session.mcp_count) || 0],
+ ["approval", Number(session.approval_count) || 0],
+ ];
+ const eventCount = Number(session.event_count) || 0;
+ const categorizedCount = items.reduce((sum, [, count]) => sum + count, 0);
+ const otherCount = Math.max(0, eventCount - categorizedCount);
+ const segments = otherCount > 0 ? [...items, ["other", otherCount]] : items;
+ const scale = Math.max(eventCount, categorizedCount, 1);
+ let segmentOffset = 0;
+ const segmentRects = segments
+ .filter(([, count]) => count > 0)
+ .map(([label, count]) => {
+ const x = (segmentOffset / scale) * 100;
+ const width = (count / scale) * 100;
+ segmentOffset += count;
+ return `<rect class="session-activity-segment session-activity-${escapeHTML(label)}" x="${x}%" width="${width}%" height="100%"></rect>`;
+ })
+ .join("");
+ const visibleItems = items.filter(([, count]) => count > 0).slice(0, 3);
+ const totalLabel = `${formatTokens(eventCount)} event${eventCount === 1 ? "" : "s"}`;
+ const detailLabel = visibleItems.length
+ ? visibleItems.map(([label, count]) => `${formatTokens(count)} ${label}`).join(" · ")
+ : "session lifecycle";
+ const ariaLabel = `${totalLabel}; ${items.filter(([, count]) => count > 0).map(([label, count]) => `${formatTokens(count)} ${label}`).join(", ") || "session lifecycle events"}`;
+ return `
+ <div class="session-activity-summary" aria-label="${escapeHTML(ariaLabel)}">
+ <div class="session-activity-total"><strong>${escapeHTML(formatTokens(eventCount))}</strong><span>event${eventCount === 1 ? "" : "s"}</span></div>
+ <svg class="session-activity-track" aria-hidden="true" preserveAspectRatio="none" viewBox="0 0 100 1">${segmentRects}</svg>
+ <div class="session-activity-detail">${escapeHTML(detailLabel)}</div>
+ </div>
+ `;
+}
+
function metricName(event) {
return event.raw?.metric_name || event.message || "";
}
@@ -1428,10 +1900,324 @@ function detailSummary(record) {
.join("");
}
+function sessionDetailSummary(detail) {
+ const session = detail.session || {};
+ const events = detail.events || [];
+ const rows = [
+ ["Session", session.id],
+ ["Events", `${events.length || session.event_count || 0}`],
+ ["First event", session.first_event_at ? formatTime(session.first_event_at) : ""],
+ ["Last event", session.last_event_at ? formatTime(session.last_event_at) : ""],
+ ["Harness", session.harness],
+ ["Model", session.model],
+ ["Repository", sessionRepositoryLabel(session)],
+ ["Session prompt", session.original_prompt],
+ ["Working directory", session.working_directory],
+ ["Max severity", session.max_severity],
+ ["Needs review", session.review_count ? `${session.review_count} event${session.review_count === 1 ? "" : "s"}` : ""],
+ ].filter(([, value]) => value);
+ return `
+ ${rows.map(([label, value]) => `
+ <div>
+ <span class="muted">${escapeHTML(label)}</span>
+ <strong>${escapeHTML(label === "Session" ? formatSessionID(value) : value)}</strong>
+ </div>
+ `).join("")}
+ <div class="session-raw-note">
+ <span class="muted">Raw events</span>
+ <strong>Full JSON timeline shown below</strong>
+ </div>
+ `;
+}
+
+function renderSessionOverview(detail) {
+ const session = detail.session || {};
+ const records = detail.events || [];
+ const events = records.map((record) => record.event || {});
+ const firstEvent = events[0] || {};
+ const userName = firstNonEmpty(events.map((event) => event.user?.name)) || "Local user";
+ const harness = session.harness || firstNonEmpty(events.map((event) => event.harness?.name)) || "agent";
+ const start = session.first_event_at || firstEvent.timestamp;
+ const end = session.last_event_at || events[events.length - 1]?.timestamp;
+ const title = `${possessive(userName)} ${harnessLabel(harness)} session${sessionDateTitle(start, end)}`;
+ setText("#session-page-title", title);
+ setText("#session-full-id", session.id || "");
+ setText("#session-time-range", sessionTimeRange(start, end));
+ const promptText = session.original_prompt || "No prompt captured";
+ setText("#session-prompt", promptText);
+ setText("#session-prompt-dialog-content", promptText);
+
+ const badges = [
+ session.review_count
+ ? `<span class="session-badge session-badge-risk">${escapeHTML(session.review_count)} event${session.review_count === 1 ? "" : "s"} need review</span>`
+ : `<span class="session-badge session-badge-ok">No high risk events</span>`,
+ `<span class="session-badge session-badge-info">${escapeHTML(session.event_count || records.length)} events captured</span>`,
+ ];
+ $("#session-badges").innerHTML = badges.join("");
+
+ renderSessionMetadata(session, events);
+ renderSessionActivity(session, records);
+ bindSessionOverviewActions(session.id || "");
+}
+
+function renderSessionMetadata(session, events) {
+ const firstEvent = events[0] || {};
+ const userName = firstNonEmpty(events.map((event) => event.user?.name)) || "Local user";
+ const device = firstNonEmpty(events.map((event) => event.endpoint?.hostname))
+ || firstNonEmpty(events.map((event) => event.endpoint?.os))
+ || "Local endpoint";
+ const harness = session.harness || firstNonEmpty(events.map((event) => event.harness?.name)) || "-";
+ const methods = uniqueValues(events.map((event) => event.harness?.collection_method)).map(captureMethodLabel);
+ const models = uniqueValues(events.map((event) => event.model));
+ const usage = sessionUsage(events);
+ const rows = [
+ {
+ label: "User",
+ value: `<span class="session-person"><i>${escapeHTML(userName.slice(0, 1).toUpperCase())}</i>${escapeHTML(userName)}</span>`,
+ },
+ { label: "Environment", value: `<span class="session-meta-pill">Endpoint</span>` },
+ { label: "Device", value: `<span class="session-device"><i aria-hidden="true"></i>${escapeHTML(device)}</span>` },
+ {
+ label: "Harness",
+ value: `${sessionHarnessCell({ harness })}${methods.length ? `<small>${escapeHTML(methods.join(", "))}</small>` : ""}`,
+ className: "session-meta-harness",
+ },
+ { label: "Model", value: models.length ? escapeHTML(models.join(", ")) : `<span class="muted">-</span>`, className: "mono" },
+ { label: "Tokens", value: usage.tokens ? escapeHTML(formatCompactTokens(usage.tokens)) : `<span class="muted">-</span>` },
+ { label: "Est. Cost", value: usage.cost ? `$${escapeHTML(usage.cost.toFixed(4))}` : `<span class="muted">-</span>` },
+ { label: "Repository", value: session.repository ? escapeHTML(repositoryOptionLabel(session.repository)) : `<span class="muted">-</span>`, className: "mono" },
+ { label: "Branch", value: session.branch ? escapeHTML(session.branch) : `<span class="muted">-</span>`, className: "mono" },
+ ];
+ $("#session-metadata").innerHTML = rows.map((row) => `
+ <div class="session-meta-item ${row.className || ""}">
+ <span>${escapeHTML(row.label)}</span>
+ <strong>${row.value}</strong>
+ </div>
+ `).join("");
+}
+
+function renderSessionActivity(session, records) {
+ const categoryConfig = [
+ ["tool", "Tools", "#0ea5b7"],
+ ["command", "Commands", "#7c3aed"],
+ ["file", "Files", "#3b82f6"],
+ ["prompt", "Prompts", "#a855f7"],
+ ["approval", "Approvals", "#10b981"],
+ ["mcp", "MCP", "#d946ef"],
+ ["other", "Other", "#cbd5e1"],
+ ];
+ const counts = Object.fromEntries(categoryConfig.map(([key]) => [key, 0]));
+ for (const record of records) counts[sessionEventCategory(record.event || {})]++;
+ const duration = durationLabel(session.first_event_at, session.last_event_at);
+ setText("#session-activity-summary", `${duration} session · ${records.length} events · peak ${peakEventsPerBucket(records)} per interval`);
+ $("#session-activity-legend").innerHTML = categoryConfig
+ .filter(([key]) => counts[key] > 0)
+ .map(([key, label, color]) => `<span><i data-session-color="${escapeHTML(color)}"></i>${escapeHTML(counts[key])} ${escapeHTML(label)}</span>`)
+ .join("");
+
+ const buckets = sessionActivityBuckets(records, 24);
+ const max = Math.max(1, ...buckets.map((bucket) => bucket.total));
+ const start = session.first_event_at;
+ const end = session.last_event_at;
+ $("#session-activity-chart").innerHTML = `
+ <div class="session-chart-y"><span>${escapeHTML(max)}</span><span>${escapeHTML(Math.ceil(max / 2))}</span><span>0</span></div>
+ <div class="session-chart-plot">
+ <div class="session-chart-grid" aria-hidden="true"></div>
+ <div class="session-chart-bars">
+ ${buckets.map((bucket) => `
+ <div class="session-chart-bar" title="${escapeHTML(bucket.total)} event${bucket.total === 1 ? "" : "s"}">
+ <div data-session-height="${(bucket.total / max) * 100}">
+ ${categoryConfig.map(([key, , color]) => bucket.counts[key] ? `<span data-session-flex="${bucket.counts[key]}" data-session-color="${escapeHTML(color)}"></span>` : "").join("")}
+ </div>
+ </div>
+ `).join("")}
+ </div>
+ <div class="session-chart-axis">
+ <span>${escapeHTML(formatClockTime(start))}</span>
+ <span>${escapeHTML(formatClockTime(midpointTimestamp(start, end)))}</span>
+ <span>${escapeHTML(formatClockTime(end))}</span>
+ </div>
+ </div>
+ `;
+
+ const severityOrder = [
+ ["critical", "#be123c"],
+ ["high", "#e11d48"],
+ ["medium", "#f59e0b"],
+ ["low", "#06b6d4"],
+ ["info", "#3b82f6"],
+ ];
+ const severities = {};
+ for (const record of records) {
+ const severity = record.event?.severity || "info";
+ severities[severity] = (severities[severity] || 0) + 1;
+ }
+ const severityMax = Math.max(1, ...Object.values(severities));
+ $("#session-severity-breakdown").innerHTML = `
+ <h3>Breakdown by severity</h3>
+ ${severityOrder.filter(([key]) => severities[key]).map(([key, color]) => `
+ <div class="session-severity-row">
+ <div><strong>${escapeHTML(titleCase(key))}</strong><span>${escapeHTML(severities[key])}</span></div>
+ <i><b data-session-width="${(severities[key] / severityMax) * 100}" data-session-color="${escapeHTML(color)}"></b></i>
+ </div>
+ `).join("")}
+ `;
+ applySessionActivityStyles();
+}
+
+function applySessionActivityStyles() {
+ $$("[data-session-color]").forEach((element) => {
+ element.style.backgroundColor = element.dataset.sessionColor;
+ });
+ $$("[data-session-height]").forEach((element) => {
+ element.style.height = `${element.dataset.sessionHeight}%`;
+ });
+ $$("[data-session-width]").forEach((element) => {
+ element.style.width = `${element.dataset.sessionWidth}%`;
+ });
+ $$("[data-session-flex]").forEach((element) => {
+ element.style.flexGrow = element.dataset.sessionFlex;
+ });
+}
+
+function bindSessionOverviewActions(sessionID) {
+ const copy = $("#copy-session-id");
+ if (copy) {
+ copy.onclick = async () => {
+ try {
+ await navigator.clipboard.writeText(sessionID);
+ copy.textContent = "Copied";
+ } catch (_) {
+ copy.textContent = "Copy failed";
+ }
+ window.setTimeout(() => { copy.textContent = "Copy"; }, 1400);
+ };
+ }
+ const toggle = $("#toggle-session-prompt");
+ const dialog = $("#session-prompt-dialog");
+ const close = $("#close-session-prompt");
+ if (toggle && dialog) {
+ toggle.onclick = () => dialog.showModal();
+ }
+ if (close && dialog) {
+ close.onclick = () => dialog.close();
+ dialog.onclick = (event) => {
+ if (event.target === dialog) dialog.close();
+ };
+ }
+}
+
+function sessionActivityBuckets(records, bucketCount) {
+ const timestamps = records.map((record) => new Date(record.event?.timestamp || 0).getTime()).filter(Number.isFinite);
+ const start = Math.min(...timestamps);
+ const end = Math.max(...timestamps);
+ const span = Math.max(1, end - start);
+ const buckets = Array.from({ length: bucketCount }, () => ({
+ total: 0,
+ counts: { tool: 0, command: 0, file: 0, prompt: 0, approval: 0, mcp: 0, other: 0 },
+ }));
+ for (const record of records) {
+ const timestamp = new Date(record.event?.timestamp || 0).getTime();
+ const index = Number.isFinite(timestamp) ? Math.min(bucketCount - 1, Math.floor(((timestamp - start) / span) * bucketCount)) : 0;
+ const category = sessionEventCategory(record.event || {});
+ buckets[index].total++;
+ buckets[index].counts[category]++;
+ }
+ return buckets;
+}
+
+function peakEventsPerBucket(records) {
+ return Math.max(0, ...sessionActivityBuckets(records, 24).map((bucket) => bucket.total));
+}
+
+function sessionEventCategory(event) {
+ const category = event.event?.category;
+ if (["tool", "command", "file", "prompt", "approval", "mcp"].includes(category)) return category;
+ if (event.command) return "command";
+ if (event.file) return "file";
+ if (event.mcp) return "mcp";
+ if (event.approval || event.policy) return "approval";
+ if (event.prompt) return "prompt";
+ if (event.tool) return "tool";
+ return "other";
+}
+
+function sessionUsage(events) {
+ let tokens = 0;
+ let cost = 0;
+ for (const event of events) {
+ const usage = event.gen_ai?.usage || {};
+ tokens += Number(usage.input_tokens || 0)
+ + Number(usage.output_tokens || 0)
+ + Number(usage.cache_read?.input_tokens || 0)
+ + Number(usage.cache_creation?.input_tokens || 0)
+ + Number(usage.reasoning?.output_tokens || 0);
+ cost += Number(usage.cost_usd || 0);
+ }
+ return { tokens, cost };
+}
+
+function firstNonEmpty(values) {
+ return values.find((value) => String(value || "").trim()) || "";
+}
+
+function uniqueValues(values) {
+ return Array.from(new Set(values.map((value) => String(value || "").trim()).filter(Boolean)));
+}
+
+function possessive(value) {
+ return `${value}${value.endsWith("s") ? "'" : "'s"}`;
+}
+
+function sessionDateTitle(start, end) {
+ const first = new Date(start || 0);
+ const last = new Date(end || start || 0);
+ if (Number.isNaN(first.getTime())) return "";
+ const date = first.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" });
+ return ` on ${date} from ${first.toLocaleTimeString()} to ${Number.isNaN(last.getTime()) ? "-" : last.toLocaleTimeString()}`;
+}
+
+function sessionTimeRange(start, end) {
+ if (!start) return "";
+ return `${formatTime(start)} → ${formatTime(end || start)} · duration ${durationLabel(start, end)}`;
+}
+
+function durationLabel(start, end) {
+ const first = new Date(start || 0).getTime();
+ const last = new Date(end || start || 0).getTime();
+ if (!Number.isFinite(first) || !Number.isFinite(last)) return "-";
+ let seconds = Math.max(0, Math.round((last - first) / 1000));
+ const hours = Math.floor(seconds / 3600);
+ seconds %= 3600;
+ const minutes = Math.floor(seconds / 60);
+ seconds %= 60;
+ return [hours ? `${hours}h` : "", minutes ? `${minutes}m` : "", `${seconds}s`].filter(Boolean).join(" ");
+}
+
+function formatClockTime(timestamp) {
+ if (!timestamp) return "";
+ const parsed = new Date(timestamp);
+ return Number.isNaN(parsed.getTime()) ? "" : parsed.toLocaleTimeString();
+}
+
+function midpointTimestamp(start, end) {
+ const first = new Date(start || 0).getTime();
+ const last = new Date(end || start || 0).getTime();
+ return Number.isFinite(first) && Number.isFinite(last) ? new Date(first + ((last - first) / 2)).toISOString() : "";
+}
+
+function titleCase(value) {
+ return String(value || "").replace(/\b\w/g, (char) => char.toUpperCase());
+}
+
function repositoryLabel(event) {
return [event.repository, event.branch].filter(Boolean).join(" @ ");
}
+function sessionRepositoryLabel(session) {
+ return [session.repository, session.branch].filter(Boolean).join(" @ ");
+}
+
function repositoryShortLabel(event) {
if (!event.repository) return event.branch || "";
const parts = event.repository.split("/").filter(Boolean);
@@ -2467,6 +3253,9 @@ if (isDetectionsPage) {
} else if (isTokensPage) {
loadTokens().catch(console.error);
setInterval(() => loadTokens().catch(console.error), 15000);
+} else if (isSessionDetailPage) {
+ loadSessionPage().catch(console.error);
+ setInterval(() => loadSessionPage().catch(console.error), 15000);
} else if (isInventoryPage) {
hydrateInventoryStateFromURL();
loadInventory().catch(console.error);
diff --git a/cli/beacon/internal/endpoint/dashboard/static/fonts/FAMILJEN-GROTESK-LICENSE.txt b/cli/beacon/internal/endpoint/dashboard/static/fonts/FAMILJEN-GROTESK-LICENSE.txt
new file mode 100644
index 00000000..b3fff222
--- /dev/null
+++ b/cli/beacon/internal/endpoint/dashboard/static/fonts/FAMILJEN-GROTESK-LICENSE.txt
@@ -0,0 +1,93 @@
+Copyright 2021 The Familjen Grotesk Project Authors (https://github.com/Familjen-Sthlm/Familjen-Grotesk) FamiljenGrotesk-Italic[wght].ttf: Copyright 2021 The Familjen Grotesk Project Authors (https://github.com/Familjen-Sthlm/Familjen-Grotesk)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/cli/beacon/internal/endpoint/dashboard/static/fonts/familjen-grotesk-latin-wght-italic.woff2 b/cli/beacon/internal/endpoint/dashboard/static/fonts/familjen-grotesk-latin-wght-italic.woff2
new file mode 100644
index 00000000..5c1d3bc4
Binary files /dev/null and b/cli/beacon/internal/endpoint/dashboard/static/fonts/familjen-grotesk-latin-wght-italic.woff2 differ
diff --git a/cli/beacon/internal/endpoint/dashboard/static/fonts/familjen-grotesk-latin-wght-normal.woff2 b/cli/beacon/internal/endpoint/dashboard/static/fonts/familjen-grotesk-latin-wght-normal.woff2
new file mode 100644
index 00000000..c9a2461e
Binary files /dev/null and b/cli/beacon/internal/endpoint/dashboard/static/fonts/familjen-grotesk-latin-wght-normal.woff2 differ
diff --git a/cli/beacon/internal/endpoint/dashboard/static/index.html b/cli/beacon/internal/endpoint/dashboard/static/index.html
index d4d008f0..c4e5b46a 100644
--- a/cli/beacon/internal/endpoint/dashboard/static/index.html
+++ b/cli/beacon/internal/endpoint/dashboard/static/index.html
@@ -160,13 +160,14 @@
<thead>
<tr>
<th>Session ID</th>
- <th>Severity</th>
- <th class="col-timestamp">Timestamp</th>
+ <th>Risk</th>
<th>Agent Harness</th>
- <th>Repository</th>
- <th>Signal</th>
- <th class="col-artifact">Artifact</th>
- <th class="col-message">Message</th>
+ <th>Session Prompt</th>
+ <th>Activity</th>
+ <th class="col-timestamp">Start</th>
+ <th class="col-timestamp">End</th>
+ <th class="col-duration">Duration</th>
+ <th class="col-message">Last Event</th>
</tr>
</thead>
<tbody id="events"></tbody>
@@ -178,7 +179,7 @@
<aside id="drawer" class="drawer" aria-hidden="true">
<div class="drawer-head">
- <h2>Event Detail</h2>
+ <h2>Session Detail</h2>
<button id="close-drawer">Close</button>
</div>
<div id="event-summary" class="event-summary"></div>
diff --git a/cli/beacon/internal/endpoint/dashboard/static/session.html b/cli/beacon/internal/endpoint/dashboard/static/session.html
new file mode 100644
index 00000000..c3b707b7
--- /dev/null
+++ b/cli/beacon/internal/endpoint/dashboard/static/session.html
@@ -0,0 +1,148 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title>Beacon Endpoint Session Events</title>
+ <link rel="icon" type="image/svg+xml" href="/logo.svg" />
+ <link rel="stylesheet" href="/styles.css" />
+ </head>
+ <body data-page="session-detail">
+ <header class="topbar">
+ <div>
+ <p class="eyebrow">Local-only</p>
+ <h1>Agent Activity</h1>
+ </div>
+ <nav class="nav-toggle" aria-label="Dashboard navigation">
+ <div class="nav-section">
+ <div class="nav-section-title">Overview</div>
+ <a href="/findings.html">Findings</a>
+ </div>
+ <div class="nav-section">
+ <div class="nav-parent">Analytics</div>
+ <a href="/tokens.html">Token Usage</a>
+ <a href="/overview.html">Agent Activity</a>
+ </div>
+ <div class="nav-section">
+ <div class="nav-section-title">Observe</div>
+ <a href="/inventory.html">Agent Inventory</a>
+ <a class="active" aria-current="page" href="/">Agent Activity Sessions</a>
+ </div>
+ <div class="nav-section">
+ <div class="nav-section-title">Control</div>
+ <a href="/detections.html">Detections</a>
+ </div>
+ </nav>
+ </header>
+
+ <div id="session-detail-status" class="session-detail-status" role="status" aria-live="polite">
+ <div>
+ <span class="session-detail-spinner" aria-hidden="true"></span>
+ <p id="session-detail-status-message">Loading session details...</p>
+ </div>
+ </div>
+
+ <main id="session-detail-view" class="session-detail-main" hidden>
+ <a class="session-back-link" href="/">
+ <span aria-hidden="true">&larr;</span>
+ Back to agent activity
+ </a>
+
+ <section class="session-overview-panel">
+ <div class="session-overview-head">
+ <h2 id="session-page-title">Session Events</h2>
+ <div id="session-badges" class="session-badges"></div>
+ <div id="session-time-range" class="session-time-range muted"></div>
+ <div class="session-id-line">
+ <code id="session-full-id"></code>
+ <button type="button" id="copy-session-id" class="session-copy-button">Copy</button>
+ </div>
+ </div>
+
+ <div class="session-prompt-card">
+ <div class="session-prompt-head">
+ <span>Session prompt</span>
+ <button type="button" id="toggle-session-prompt">View full prompt</button>
+ </div>
+ <p id="session-prompt">No prompt captured</p>
+ </div>
+
+ <div id="session-metadata" class="session-metadata"></div>
+ </section>
+
+ <section class="session-activity-panel">
+ <div class="session-activity-head">
+ <div>
+ <h2>Agent Activity over time</h2>
+ <p id="session-activity-summary" class="muted"></p>
+ </div>
+ <div id="session-activity-legend" class="session-activity-legend"></div>
+ </div>
+ <div class="session-activity-body">
+ <div id="session-activity-chart" class="session-activity-chart"></div>
+ <div id="session-severity-breakdown" class="session-severity-breakdown"></div>
+ </div>
+ </section>
+
+ <section class="panel search-panel session-events-panel">
+ <div class="session-event-filters">
+ <label class="session-event-search">
+ <span class="search-icon" aria-hidden="true"></span>
+ <input id="session-event-search" type="search" placeholder="Search events by keyword, file, command, or message..." autocomplete="off" />
+ </label>
+ <div id="session-type-filters" class="session-filter-row" aria-label="Filter events by type"></div>
+ <div id="session-action-filters" class="session-filter-row" aria-label="Filter events by action"></div>
+ <div id="session-severity-filters" class="session-filter-row" aria-label="Filter events by severity"></div>
+ </div>
+ <div id="notice" class="notice" hidden></div>
+ <div class="table-wrap">
+ <table class="session-raw-table">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th class="col-timestamp">Timestamp</th>
+ <th>Severity</th>
+ <th>Type</th>
+ <th>Agent Action</th>
+ <th>Value</th>
+ <th>Input tokens</th>
+ <th>Output tokens</th>
+ <th>Cache creation input tokens</th>
+ <th>Cache read input tokens</th>
+ <th>Inspect</th>
+ </tr>
+ </thead>
+ <tbody id="events"></tbody>
+ </table>
+ </div>
+ </section>
+ </main>
+
+ <dialog id="session-prompt-dialog" class="session-prompt-dialog" aria-labelledby="session-prompt-dialog-title">
+ <div class="session-prompt-dialog-head">
+ <h2 id="session-prompt-dialog-title">Full session prompt</h2>
+ <button type="button" id="close-session-prompt" aria-label="Close full prompt">Close</button>
+ </div>
+ <p id="session-prompt-dialog-content"></p>
+ </dialog>
+
+ <dialog id="session-value-dialog" class="session-prompt-dialog" aria-labelledby="session-value-dialog-title">
+ <div class="session-prompt-dialog-head">
+ <h2 id="session-value-dialog-title">Full event value</h2>
+ <button type="button" id="close-session-value" aria-label="Close full event value">Close</button>
+ </div>
+ <p id="session-value-dialog-content"></p>
+ </dialog>
+
+ <aside id="drawer" class="drawer" aria-hidden="true">
+ <div class="drawer-head">
+ <h2>Event Detail</h2>
+ <button id="close-drawer">Close</button>
+ </div>
+ <div id="event-summary" class="event-summary"></div>
+ <pre id="event-json"></pre>
+ </aside>
+
+ <script src="/app.js"></script>
+ </body>
+</html>
diff --git a/cli/beacon/internal/endpoint/dashboard/static/styles.css b/cli/beacon/internal/endpoint/dashboard/static/styles.css
index bd4f3c3e..4474371a 100644
--- a/cli/beacon/internal/endpoint/dashboard/static/styles.css
+++ b/cli/beacon/internal/endpoint/dashboard/static/styles.css
@@ -1,3 +1,19 @@
+@font-face {
+ font-family: "Familjen Grotesk";
+ src: url("/fonts/familjen-grotesk-latin-wght-normal.woff2") format("woff2-variations");
+ font-style: normal;
+ font-weight: 400 700;
+ font-display: swap;
+}
+
+@font-face {
+ font-family: "Familjen Grotesk";
+ src: url("/fonts/familjen-grotesk-latin-wght-italic.woff2") format("woff2-variations");
+ font-style: italic;
+ font-weight: 400 700;
+ font-display: swap;
+}
+
:root {
color-scheme: light;
--bg: #ffffff;
@@ -20,7 +36,7 @@ body {
margin: 0;
background: var(--bg);
color: var(--text);
- font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+ font-family: "Familjen Grotesk", ui-sans-serif, system-ui, sans-serif;
}
button,
@@ -489,6 +505,14 @@ tr:hover {
text-align: center;
}
+.col-duration {
+ width: 6rem;
+ text-align: center;
+ white-space: nowrap;
+ font-variant-numeric: tabular-nums;
+ font-weight: 650;
+}
+
.timestamp-cell {
vertical-align: middle;
padding-left: 0.35rem;
@@ -866,7 +890,7 @@ body {
radial-gradient(circle at 100% 0%, rgba(3, 106, 162, 0.08), transparent 32rem),
linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
color: var(--text);
- font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
+ font-family: "Familjen Grotesk", ui-sans-serif, system-ui, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@@ -1207,260 +1231,1131 @@ body.nav-collapsed .nav-toggle a.active::before {
letter-spacing: -0.03em;
}
-body[data-page="sessions"] main {
+body[data-page="sessions"] main,
+body[data-page="session-detail"] main {
max-width: none;
padding-top: calc(var(--topbar-height) + 1.6rem);
}
-.activity-page-head {
- min-height: 2.25rem;
- align-items: center;
- justify-content: center;
- text-align: center;
+.session-detail-main {
+ gap: 0.75rem;
+ padding: 1rem 1.25rem 3rem;
}
-.activity-page-head h2 {
- font-size: 1.42rem;
- letter-spacing: -0.04em;
+.session-detail-main[hidden],
+.session-detail-status[hidden] {
+ display: none;
}
-.activity-page-head p {
- display: none;
+.session-detail-status {
+ min-height: 100vh;
+ padding: calc(var(--topbar-height) + 2rem) 1.25rem 3rem;
+ display: grid;
+ place-items: center;
+ color: #667080;
+ font-size: 0.78rem;
+ text-align: center;
}
-.analytics-hero,
-.inventory-hero {
- align-items: center;
+.session-detail-status > div {
+ display: grid;
+ justify-items: center;
+ gap: 0.75rem;
}
-.analytics-hero {
- position: relative;
- justify-content: center;
- text-align: center;
+.session-detail-status.error {
+ color: #b42318;
}
-.analytics-hero > div:first-child {
- max-width: 48rem;
- margin: 0 auto;
+.session-detail-spinner {
+ width: 1.5rem;
+ height: 1.5rem;
+ border: 2px solid rgba(14, 165, 183, 0.2);
+ border-top-color: var(--accent);
+ border-radius: 999px;
+ animation: session-detail-spin 0.8s linear infinite;
}
-.analytics-hero .range-pills {
- position: absolute;
- right: 0;
- top: 50%;
- transform: translateY(-50%);
+.session-detail-status.error .session-detail-spinner {
+ display: none;
}
-.range-pills,
-.inventory-tabs {
- display: inline-flex;
- flex-wrap: wrap;
- gap: 0.35rem;
+@keyframes session-detail-spin {
+ to {
+ transform: rotate(360deg);
+ }
}
-.range-pills span,
-.inventory-tabs a {
+.session-back-link {
+ width: max-content;
display: inline-flex;
align-items: center;
- min-height: 2rem;
- border: 1px solid var(--line);
- border-radius: 999px;
- background: #ffffff;
- color: #374151;
- font-size: 0.75rem;
- font-weight: 700;
- padding: 0.35rem 0.7rem;
+ gap: 0.5rem;
+ color: #252a34;
+ font-size: 0.78rem;
+ font-weight: 650;
text-decoration: none;
- box-shadow: var(--shadow-sm);
}
-.range-pills span.active,
-.inventory-tabs a:hover {
- border-color: rgba(3, 106, 162, 0.22);
- background: var(--accent-soft);
+.session-back-link:hover {
color: var(--accent);
}
-.inventory-tabs {
- position: sticky;
- top: calc(var(--topbar-height) + 0.75rem);
- z-index: 1;
- border: 1px solid var(--line);
- border-radius: 14px;
- background: rgba(255, 255, 255, 0.94);
- padding: 0.5rem;
- box-shadow: var(--shadow-sm);
+.session-overview-panel,
+.session-activity-panel {
+ overflow: hidden;
+ border: 1px solid rgba(17, 24, 39, 0.12);
+ border-radius: 13px;
+ background: rgba(255, 255, 255, 0.98);
+ box-shadow: 0 1px 3px rgba(15, 23, 42, 0.07);
}
-.analytics-grid,
-.token-breakdown-row {
- display: grid;
- grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
- gap: 1rem;
+.session-overview-head {
+ padding: 1.15rem 1.25rem 0.7rem;
}
-.analytics-stack {
- display: grid;
- gap: 1rem;
+.session-overview-head h2 {
+ max-width: 75rem;
+ color: #101318;
+ font-size: clamp(1.2rem, 2vw, 1.65rem);
+ font-weight: 700;
+ letter-spacing: -0.035em;
+ line-height: 1.14;
}
-.analytics-panel {
- min-width: 0;
- border: 1px solid var(--line);
- border-radius: 14px;
- background: rgba(255, 255, 255, 0.98);
- padding: 1rem;
- box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
+.session-badges {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.4rem;
+ margin-top: 0.7rem;
}
-.panel-title-row {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: 1rem;
+.session-badge {
+ display: inline-flex;
+ align-items: center;
+ min-height: 1.55rem;
+ border-radius: 999px;
+ font-size: 0.68rem;
+ font-weight: 650;
+ line-height: 1;
+ padding: 0.25rem 0.55rem;
}
-.panel-title-row h2 {
- font-size: 0.88rem;
- font-weight: 700;
+.session-badge::before {
+ content: "";
+ width: 0.4rem;
+ height: 0.4rem;
+ margin-right: 0.35rem;
+ border-radius: 999px;
+ background: currentColor;
}
-.panel-title-row p {
- margin-top: 0.35rem;
- font-size: 0.75rem;
- line-height: 1.55;
+.session-badge-ok {
+ background: #e8fbf4;
+ color: #087457;
}
-.panel-total {
- color: var(--muted);
- font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
- font-size: 0.76rem;
+.session-badge-risk {
+ background: #fff0f2;
+ color: #be123c;
}
-.chart-legend {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-end;
- gap: 0.4rem 0.8rem;
- margin: 0.75rem 0 0.65rem;
- color: var(--muted);
- font-size: 0.68rem;
+.session-badge-info {
+ background: #eef7fd;
+ color: #036aa2;
}
-.chart-legend span,
-.token-split-legend span,
-.breakdown-list button span {
- min-width: 0;
+.session-time-range {
display: inline-flex;
- align-items: center;
- gap: 0.4rem;
+ margin: 0.65rem 0 0 0.85rem;
+ font-size: 0.7rem;
}
-.chart-legend i,
-.token-split-legend i,
-.breakdown-list i {
- width: 0.5rem;
- height: 0.5rem;
- flex: 0 0 auto;
- border-radius: 2px;
- background: #0f7498;
+.session-time-range::before {
+ content: "◷";
+ margin-right: 0.35rem;
}
-.chart-bars,
-.stacked-chart {
- min-height: 17.8rem;
+.session-id-line {
+ display: flex;
+ align-items: center;
+ gap: 0.45rem;
+ margin-top: 0.55rem;
}
-.stacked-chart {
- display: flex;
- align-items: end;
- gap: 0.55rem;
- padding: 0.75rem 0.35rem 0.25rem;
- border-radius: 16px;
- background:
- repeating-linear-gradient(0deg, transparent 0 3.45rem, rgba(15, 23, 42, 0.08) 3.45rem calc(3.45rem + 1px)),
- linear-gradient(180deg, rgba(248, 250, 252, 0.28), rgba(248, 250, 252, 0.7));
+.session-id-line code {
+ color: #6b7280;
+ font-size: 0.7rem;
}
-.stacked-chart.compact {
- min-height: 15.6rem;
+.session-copy-button,
+.session-prompt-head button {
+ min-height: 1.65rem;
+ border-color: rgba(17, 24, 39, 0.1);
+ background: #ffffff;
+ color: #4b5563;
+ font-size: 0.67rem;
+ font-weight: 650;
+ padding: 0.25rem 0.55rem;
+ box-shadow: none;
}
-.stacked-chart-column {
- min-width: 0;
- flex: 1 1 0;
- height: 13.5rem;
+.session-prompt-card {
+ margin: 0 1.25rem 0.85rem;
+ border: 1px solid rgba(17, 24, 39, 0.1);
+ border-radius: 10px;
+ padding: 0.85rem 1rem 1rem;
+ background: #ffffff;
+}
+
+.session-prompt-head {
display: flex;
- flex-direction: column;
align-items: center;
- justify-content: end;
- gap: 0.35rem;
- border: 0;
- border-radius: 0;
- background: transparent;
- box-shadow: none;
- color: inherit;
- padding: 0;
+ justify-content: space-between;
+ gap: 1rem;
+ color: #6b7280;
+ font-size: 0.7rem;
+ font-weight: 650;
}
-button.stacked-chart-column:hover {
- background: transparent;
+.session-prompt-card p {
+ display: -webkit-box;
+ overflow: hidden;
+ margin-top: 0.75rem;
+ color: #151922;
+ font-size: 0.88rem;
+ line-height: 1.55;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 3;
}
-.stacked-chart-bar {
- width: min(2.1rem, 72%);
- min-height: 0.45rem;
- border-radius: 4px 4px 0 0;
- box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.12);
+.session-prompt-dialog {
+ width: min(44rem, calc(100vw - 2rem));
+ max-height: min(38rem, calc(100vh - 2rem));
+ overflow: hidden;
+ border: 1px solid rgba(17, 24, 39, 0.14);
+ border-radius: 14px;
+ background: #ffffff;
+ color: #151922;
+ padding: 0;
+ box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}
-.stacked-chart-value,
-.stacked-chart-label {
- max-width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: 0.68rem;
+.session-prompt-dialog::backdrop {
+ background: rgba(15, 23, 42, 0.46);
+ backdrop-filter: blur(2px);
}
-.stacked-chart-value {
- color: #334155;
- font-weight: 750;
+.session-prompt-dialog-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 1rem;
+ border-bottom: 1px solid rgba(17, 24, 39, 0.1);
+ padding: 0.85rem 1rem;
}
-.stacked-chart-label {
- color: var(--muted);
+.session-prompt-dialog-head h2 {
+ font-size: 0.9rem;
}
-.analytics-footnote {
- margin-top: 0.75rem;
- font-size: 0.72rem;
+.session-prompt-dialog-head button {
+ min-height: 1.8rem;
+ font-size: 0.7rem;
+ font-weight: 650;
+ padding: 0.3rem 0.65rem;
}
-.attention-list {
+.session-prompt-dialog > p {
+ max-height: min(32rem, calc(100vh - 7rem));
+ overflow: auto;
+ padding: 1.1rem;
+ font-size: 0.9rem;
+ line-height: 1.6;
+ white-space: pre-wrap;
+}
+
+.session-metadata {
display: grid;
- gap: 0.7rem;
- margin-top: 1rem;
+ grid-template-columns: repeat(7, minmax(7rem, 1fr));
+ gap: 1.2rem 1rem;
+ border-top: 1px solid rgba(17, 24, 39, 0.1);
+ padding: 1rem 1.25rem 1.15rem;
}
-.attention-card {
+.session-meta-item {
+ min-width: 0;
display: grid;
- grid-template-columns: minmax(0, 1fr) max-content;
- align-items: center;
- gap: 1rem;
- width: 100%;
- min-height: 3.15rem;
- border: 0;
- border-radius: 12px;
- background: #f8fafc;
- color: #334155;
- padding: 0.75rem 0.85rem;
- box-shadow: none;
- text-align: left;
+ align-content: start;
+ gap: 0.38rem;
}
-.attention-card span {
- font-size: 0.76rem;
+.session-meta-item > span {
+ color: #6b7280;
+ font-size: 0.66rem;
+}
+
+.session-meta-item > strong {
+ min-width: 0;
+ overflow: hidden;
+ color: #1f2937;
+ font-size: 0.75rem;
+ font-weight: 600;
+ text-overflow: ellipsis;
+}
+
+.session-meta-item.mono > strong {
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 0.68rem;
+}
+
+.session-person,
+.session-device {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.5rem;
+ white-space: nowrap;
+}
+
+.session-person i,
+.session-device i {
+ width: 1.55rem;
+ height: 1.55rem;
+ display: inline-grid;
+ flex: 0 0 auto;
+ place-items: center;
+ border-radius: 999px;
+ background: #1976e9;
+ color: #ffffff;
+ font-size: 0.68rem;
+ font-style: normal;
+}
+
+.session-device i {
+ border-radius: 0.5rem;
+ background: #172033;
+}
+
+.session-device i::after {
+ content: "";
+ width: 0.75rem;
+ height: 0.48rem;
+ border: 1px solid #ffffff;
+ border-radius: 2px;
+}
+
+.session-meta-pill {
+ width: max-content;
+ display: inline-flex;
+ border-radius: 999px;
+ background: #f1f3f5;
+ color: #626b78;
+ padding: 0.22rem 0.5rem;
+}
+
+.session-meta-harness .session-harness-cell {
+ min-width: 0;
+ flex-direction: row;
+ justify-content: flex-start;
+}
+
+.session-meta-harness .session-harness-logo {
+ width: 1.55rem;
+ height: 1.55rem;
+ border-radius: 0.5rem;
+}
+
+.session-meta-harness .session-harness-name {
+ font-size: 0.75rem;
+}
+
+.session-meta-harness small {
+ display: block;
+ width: max-content;
+ margin-top: 0.3rem;
+ border-radius: 999px;
+ background: #f3f4f6;
+ color: #6b7280;
+ font-size: 0.56rem;
+ font-weight: 700;
+ padding: 0.14rem 0.35rem;
+ text-transform: uppercase;
+}
+
+.session-activity-panel {
+ padding: 1rem 1.25rem 1.15rem;
+}
+
+.session-activity-head {
+ display: grid;
+ grid-template-columns: minmax(0, 3fr) minmax(16rem, 1.45fr);
+ align-items: start;
+ gap: 2rem;
+}
+
+.session-activity-head > div:first-child,
+.session-activity-legend {
+ grid-column: 1;
+ grid-row: 1;
+}
+
+.session-activity-head h2 {
+ color: #1b2029;
+ font-size: 0.9rem;
+ font-weight: 700;
+}
+
+.session-activity-head p {
+ margin-top: 0.35rem;
+ font-size: 0.68rem;
+}
+
+.session-activity-legend {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ justify-self: center;
+ gap: 0.35rem 0.8rem;
+ color: #667080;
+ font-size: 0.66rem;
+}
+
+.session-activity-legend span {
+ display: inline-flex;
+ align-items: center;
+ gap: 0.35rem;
+}
+
+.session-activity-legend i {
+ width: 0.45rem;
+ height: 0.45rem;
+ border-radius: 999px;
+}
+
+.session-activity-body {
+ display: grid;
+ grid-template-columns: minmax(0, 3fr) minmax(16rem, 1.45fr);
+ gap: 2rem;
+ margin-top: 1rem;
+}
+
+.session-activity-chart {
+ min-height: 12rem;
+ display: grid;
+ grid-template-columns: 1.7rem minmax(0, 1fr);
+ gap: 0.55rem;
+}
+
+.session-chart-y {
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ padding: 0 0 1.4rem;
+ color: #94a3b8;
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 0.6rem;
+ text-align: right;
+}
+
+.session-chart-plot {
+ position: relative;
+ min-width: 0;
+ display: grid;
+ grid-template-rows: 1fr 1.4rem;
+}
+
+.session-chart-grid {
+ position: absolute;
+ inset: 0 0 1.4rem;
+ background: repeating-linear-gradient(0deg, transparent 0 calc(50% - 1px), #e8edf2 calc(50% - 1px) 50%);
+ border-bottom: 1px solid #e1e7ed;
+}
+
+.session-chart-bars {
+ position: relative;
+ z-index: 1;
+ display: grid;
+ grid-template-columns: repeat(24, minmax(3px, 1fr));
+ align-items: end;
+ gap: clamp(2px, 0.4vw, 6px);
+ padding: 0 0.2rem;
+}
+
+.session-chart-bar {
+ height: 100%;
+ display: flex;
+ align-items: end;
+}
+
+.session-chart-bar > div {
+ width: 100%;
+ min-height: 2px;
+ display: flex;
+ flex-direction: column-reverse;
+ overflow: hidden;
+ border-radius: 3px 3px 0 0;
+ background: #eef2f6;
+}
+
+.session-chart-bar span {
+ display: block;
+ min-height: 2px;
+}
+
+.session-chart-axis {
+ display: flex;
+ justify-content: space-between;
+ color: #8b95a3;
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
+ font-size: 0.58rem;
+ padding-top: 0.45rem;
+}
+
+.session-severity-breakdown {
+ min-width: 0;
+ padding-top: 0.2rem;
+}
+
+.session-severity-breakdown h3 {
+ margin: 0 0 0.85rem;
+ color: #6b7280;
+ font-size: 0.61rem;
+ font-weight: 700;
+ letter-spacing: 0.16em;
+ text-transform: uppercase;
+}
+
+.session-severity-row {
+ display: grid;
+ gap: 0.3rem;
+ margin-bottom: 0.8rem;
+}
+
+.session-severity-row div {
+ display: flex;
+ justify-content: space-between;
+ color: #536070;
+ font-size: 0.66rem;
+}
+
+.session-severity-row div strong {
+ color: #252b35;
+ font-weight: 650;
+}
+
+.session-severity-row > i {
+ height: 0.28rem;
+ overflow: hidden;
+ border-radius: 999px;
+ background: #e7ebef;
+}
+
+.session-severity-row > i b {
+ display: block;
+ height: 100%;
+ border-radius: inherit;
+}
+
+.session-events-panel {
+ margin-top: 0.2rem;
+}
+
+.session-events-panel > .section-head {
+ padding: 0.15rem 0.25rem 0.7rem;
+}
+
+.session-events-panel > .section-head h2 {
+ color: #252b35;
+ font-size: 0.88rem;
+}
+
+.session-events-panel > .section-head p {
+ margin-top: 0.28rem;
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 0.62rem;
+}
+
+.session-internal-toggle {
+ min-height: 2rem;
+ border-color: rgba(17, 24, 39, 0.12);
+ border-radius: 8px;
+ background: #ffffff;
+ color: #4b5563;
+ font-size: 0.7rem;
+ font-weight: 650;
+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
+}
+
+.session-internal-toggle::before {
+ content: "◉";
+ margin-right: 0.4rem;
+ color: #8792a2;
+}
+
+.session-internal-toggle.active {
+ border-color: #9bd1e7;
+ background: #eaf7fc;
+ color: #075f85;
+}
+
+.session-event-filters {
+ display: grid;
+ gap: 0.55rem;
+ padding: 0 0.25rem 0.85rem;
+}
+
+.session-event-search {
+ position: relative;
+ display: block;
+}
+
+.session-event-search .search-icon {
+ position: absolute;
+ top: 50%;
+ left: 0.75rem;
+ width: 0.72rem;
+ height: 0.72rem;
+ border: 1.5px solid #7b8794;
+ border-radius: 999px;
+ transform: translateY(-60%);
+}
+
+.session-event-search .search-icon::after {
+ content: "";
+ position: absolute;
+ right: -0.26rem;
+ bottom: -0.18rem;
+ width: 0.36rem;
+ height: 1.5px;
+ background: #7b8794;
+ transform: rotate(45deg);
+}
+
+.session-event-search input {
+ width: 100%;
+ min-height: 2.45rem;
+ border-color: rgba(17, 24, 39, 0.12);
+ border-radius: 9px;
+ background: #ffffff;
+ font-size: 0.72rem;
+ padding: 0.55rem 0.8rem 0.55rem 2.25rem;
+ box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
+}
+
+.session-filter-row {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.38rem;
+}
+
+.session-filter-row button {
+ min-height: 1.75rem;
+ border-color: transparent;
+ border-radius: 999px;
+ background: #f3f4f6;
+ color: #303742;
+ font-size: 0.66rem;
+ font-weight: 650;
+ padding: 0.3rem 0.65rem;
+ box-shadow: none;
+}
+
+.session-filter-row button:hover {
+ background: #e9eef2;
+}
+
+.session-filter-row button.active {
+ border-color: #94c9dd;
+ background: #dff2fa;
+ color: #075f85;
+ box-shadow: inset 0 0 0 1px rgba(7, 95, 133, 0.06);
+}
+
+.session-events-panel .table-wrap {
+ margin-right: -0.75rem;
+ margin-bottom: -0.75rem;
+ margin-left: -0.75rem;
+ border-top: 1px solid rgba(17, 24, 39, 0.09);
+}
+
+.session-raw-table {
+ min-width: 92rem;
+ table-layout: fixed;
+ font-size: 0.7rem;
+}
+
+body[data-page="session-detail"] .session-raw-table th,
+body[data-page="session-detail"] .session-raw-table td {
+ padding: 0.72rem 0.65rem;
+ text-align: left;
+ vertical-align: top;
+}
+
+body[data-page="session-detail"] .session-raw-table th {
+ background: #f8f9fb;
+ color: #687385;
+ font-size: 0.6rem;
+ font-weight: 650;
+ letter-spacing: 0;
+ line-height: 1.25;
+ text-transform: none;
+}
+
+.session-raw-table th:nth-child(1),
+.session-raw-table td:nth-child(1) {
+ width: 5.5rem;
+}
+
+.session-raw-table th:nth-child(2),
+.session-raw-table td:nth-child(2) {
+ width: 9rem;
+}
+
+.session-raw-table th:nth-child(3),
+.session-raw-table td:nth-child(3),
+.session-raw-table th:nth-child(4),
+.session-raw-table td:nth-child(4) {
+ width: 6rem;
+}
+
+.session-raw-table th:nth-child(5),
+.session-raw-table td:nth-child(5) {
+ width: 14rem;
+}
+
+.session-raw-table th:nth-child(6),
+.session-raw-table td:nth-child(6) {
+ width: 16rem;
+}
+
+.session-raw-table th:nth-child(n+7):nth-child(-n+10),
+.session-raw-table td:nth-child(n+7):nth-child(-n+10) {
+ width: 6.6rem;
+ text-align: center;
+}
+
+.session-raw-table th:nth-child(11),
+.session-raw-table td:nth-child(11) {
+ width: 4.5rem;
+ text-align: center;
+}
+
+.session-event-id {
+ color: #6b7280;
+ font-size: 0.65rem;
+}
+
+.session-event-action {
+ display: table-cell;
+}
+
+.session-event-action strong {
+ display: block;
+ color: #202630;
+ font-size: 0.7rem;
+ font-weight: 700;
+ line-height: 1.35;
+}
+
+.session-event-action span {
+ display: block;
+ margin-top: 0.2rem;
+ color: #818b99;
+ font-size: 0.62rem;
+}
+
+.session-event-value span {
+ display: block;
+ overflow-wrap: anywhere;
+ color: #343b46;
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 0.62rem;
+ line-height: 1.45;
+}
+
+.session-value-button {
+ display: block;
+ min-height: 0;
+ margin-top: 0.18rem;
+ border: 0;
+ border-radius: 0;
+ background: transparent;
+ color: #5d6673;
+ font-size: 0.54rem;
+ font-weight: 700;
+ letter-spacing: 0.06em;
+ padding: 0;
+ text-align: left;
+ text-transform: uppercase;
+ box-shadow: none;
+}
+
+.session-value-button:hover {
+ background: transparent;
+ color: #075f85;
+ text-decoration: underline;
+}
+
+.session-severity-pill,
+.session-type-pill {
+ display: inline-flex;
+ align-items: center;
+ min-height: 1.25rem;
+ border-radius: 4px;
+ font-size: 0.58rem;
+ font-weight: 700;
+ line-height: 1;
+ padding: 0.2rem 0.38rem;
+ text-transform: lowercase;
+}
+
+.session-severity-info {
+ background: #e3f6ef;
+ color: #08775d;
+}
+
+.session-severity-low {
+ background: #e9f6fb;
+ color: #0e7490;
+}
+
+.session-severity-medium {
+ background: #fff4d8;
+ color: #a16207;
+}
+
+.session-severity-high {
+ background: #ffe8e8;
+ color: #c0262d;
+}
+
+.session-severity-critical {
+ background: #f9dce5;
+ color: #9f1239;
+}
+
+.session-type-prompt {
+ background: #f5e9ff;
+ color: #7e22ce;
+}
+
+.session-type-tool {
+ background: #dff6f8;
+ color: #0f7580;
+}
+
+.session-type-command {
+ background: #fff0e7;
+ color: #c2410c;
+}
+
+.session-type-file {
+ background: #e8f0ff;
+ color: #1d4ed8;
+}
+
+.session-type-mcp {
+ background: #eee8ff;
+ color: #6d28d9;
+}
+
+.session-type-approval {
+ background: #fff3d8;
+ color: #b45309;
+}
+
+.session-type-session {
+ background: #eceef1;
+ color: #596273;
+}
+
+.session-type-inventory,
+.session-type-validation,
+.session-type-metric {
+ background: #e8edf2;
+ color: #4b5563;
+}
+
+.session-json-button {
+ min-height: 1.45rem;
+ border-color: rgba(17, 24, 39, 0.12);
+ border-radius: 7px;
+ background: #ffffff;
+ color: #303742;
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 0.58rem;
+ font-weight: 700;
+ padding: 0.25rem 0.45rem;
+ box-shadow: none;
+}
+
+.session-json-button:hover {
+ border-color: #86bfd5;
+ background: #eaf7fc;
+ color: #075f85;
+}
+
+body[data-page="session-detail"] .drawer {
+ width: min(820px, 100vw);
+}
+
+body[data-page="session-detail"] .drawer pre {
+ flex: 1;
+ background: #0e1726;
+ color: #d9e5f2;
+ font-size: 0.72rem;
+ line-height: 1.55;
+}
+
+.activity-page-head {
+ min-height: 2.25rem;
+ align-items: center;
+ justify-content: center;
+ text-align: center;
+}
+
+.activity-page-head h2 {
+ font-size: 1.42rem;
+ letter-spacing: -0.04em;
+}
+
+.activity-page-head p {
+ display: none;
+}
+
+.analytics-hero,
+.inventory-hero {
+ align-items: center;
+}
+
+.analytics-hero {
+ position: relative;
+ justify-content: center;
+ text-align: center;
+}
+
+.analytics-hero > div:first-child {
+ max-width: 48rem;
+ margin: 0 auto;
+}
+
+.analytics-hero .range-pills {
+ position: absolute;
+ right: 0;
+ top: 50%;
+ transform: translateY(-50%);
+}
+
+.range-pills,
+.inventory-tabs {
+ display: inline-flex;
+ flex-wrap: wrap;
+ gap: 0.35rem;
+}
+
+.range-pills span,
+.inventory-tabs a {
+ display: inline-flex;
+ align-items: center;
+ min-height: 2rem;
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: #ffffff;
+ color: #374151;
+ font-size: 0.75rem;
+ font-weight: 700;
+ padding: 0.35rem 0.7rem;
+ text-decoration: none;
+ box-shadow: var(--shadow-sm);
+}
+
+.range-pills span.active,
+.inventory-tabs a:hover {
+ border-color: rgba(3, 106, 162, 0.22);
+ background: var(--accent-soft);
+ color: var(--accent);
+}
+
+.inventory-tabs {
+ position: sticky;
+ top: calc(var(--topbar-height) + 0.75rem);
+ z-index: 1;
+ border: 1px solid var(--line);
+ border-radius: 14px;
+ background: rgba(255, 255, 255, 0.94);
+ padding: 0.5rem;
+ box-shadow: var(--shadow-sm);
+}
+
+.analytics-grid,
+.token-breakdown-row {
+ display: grid;
+ grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
+ gap: 1rem;
+}
+
+.analytics-stack {
+ display: grid;
+ gap: 1rem;
+}
+
+.analytics-panel {
+ min-width: 0;
+ border: 1px solid var(--line);
+ border-radius: 14px;
+ background: rgba(255, 255, 255, 0.98);
+ padding: 1rem;
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
+}
+
+.panel-title-row {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 1rem;
+}
+
+.panel-title-row h2 {
+ font-size: 0.88rem;
+ font-weight: 700;
+}
+
+.panel-title-row p {
+ margin-top: 0.35rem;
+ font-size: 0.75rem;
+ line-height: 1.55;
+}
+
+.panel-total {
+ color: var(--muted);
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
+ font-size: 0.76rem;
+}
+
+.chart-legend {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: flex-end;
+ gap: 0.4rem 0.8rem;
+ margin: 0.75rem 0 0.65rem;
+ color: var(--muted);
+ font-size: 0.68rem;
+}
+
+.chart-legend span,
+.token-split-legend span,
+.breakdown-list button span {
+ min-width: 0;
+ display: inline-flex;
+ align-items: center;
+ gap: 0.4rem;
+}
+
+.chart-legend i,
+.token-split-legend i,
+.breakdown-list i {
+ width: 0.5rem;
+ height: 0.5rem;
+ flex: 0 0 auto;
+ border-radius: 2px;
+ background: #0f7498;
+}
+
+.chart-bars,
+.stacked-chart {
+ min-height: 17.8rem;
+}
+
+.stacked-chart {
+ display: flex;
+ align-items: end;
+ gap: 0.55rem;
+ padding: 0.75rem 0.35rem 0.25rem;
+ border-radius: 16px;
+ background:
+ repeating-linear-gradient(0deg, transparent 0 3.45rem, rgba(15, 23, 42, 0.08) 3.45rem calc(3.45rem + 1px)),
+ linear-gradient(180deg, rgba(248, 250, 252, 0.28), rgba(248, 250, 252, 0.7));
+}
+
+.stacked-chart.compact {
+ min-height: 15.6rem;
+}
+
+.stacked-chart-column {
+ min-width: 0;
+ flex: 1 1 0;
+ height: 13.5rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: end;
+ gap: 0.35rem;
+ border: 0;
+ border-radius: 0;
+ background: transparent;
+ box-shadow: none;
+ color: inherit;
+ padding: 0;
+}
+
+button.stacked-chart-column:hover {
+ background: transparent;
+}
+
+.stacked-chart-bar {
+ width: min(2.1rem, 72%);
+ min-height: 0.45rem;
+ border-radius: 4px 4px 0 0;
+ box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.12);
+}
+
+.stacked-chart-value,
+.stacked-chart-label {
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-size: 0.68rem;
+}
+
+.stacked-chart-value {
+ color: #334155;
+ font-weight: 750;
+}
+
+.stacked-chart-label {
+ color: var(--muted);
+}
+
+.analytics-footnote {
+ margin-top: 0.75rem;
+ font-size: 0.72rem;
+}
+
+.attention-list {
+ display: grid;
+ gap: 0.7rem;
+ margin-top: 1rem;
+}
+
+.attention-card {
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) max-content;
+ align-items: center;
+ gap: 1rem;
+ width: 100%;
+ min-height: 3.15rem;
+ border: 0;
+ border-radius: 12px;
+ background: #f8fafc;
+ color: #334155;
+ padding: 0.75rem 0.85rem;
+ box-shadow: none;
+ text-align: left;
+}
+
+.attention-card span {
+ font-size: 0.76rem;
line-height: 1.35;
}
@@ -1763,7 +2658,8 @@ body[data-page="sessions"] .status-panel {
display: none;
}
-body[data-page="sessions"] .search-panel {
+body[data-page="sessions"] .search-panel,
+body[data-page="session-detail"] .search-panel {
overflow: hidden;
border-color: rgba(17, 24, 39, 0.1);
border-radius: 16px;
@@ -1879,7 +2775,9 @@ body[data-page="sessions"] .search-input {
}
body[data-page="sessions"] th,
-body[data-page="sessions"] td {
+body[data-page="sessions"] td,
+body[data-page="session-detail"] th,
+body[data-page="session-detail"] td {
text-align: center;
vertical-align: middle;
}
@@ -1924,6 +2822,127 @@ body[data-page="sessions"] td {
line-height: 1.1;
}
+.session-activity-cell {
+ width: clamp(15rem, 22vw, 21rem);
+ min-width: 15rem;
+ padding-top: 0.9rem;
+ padding-bottom: 0.9rem;
+}
+
+.session-list-prompt {
+ display: grid;
+ justify-items: center;
+ gap: 0.42rem;
+ text-align: center;
+}
+
+.session-list-prompt-model {
+ display: block;
+ max-width: 100%;
+ overflow-wrap: anywhere;
+ color: #536070;
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 0.68rem;
+ font-weight: 700;
+ line-height: 1.3;
+}
+
+.session-activity-summary {
+ width: 100%;
+ min-width: 0;
+ display: grid;
+ justify-items: center;
+ gap: 0.58rem;
+}
+
+.session-activity-total {
+ display: inline-flex;
+ align-items: baseline;
+ justify-content: center;
+ gap: 0.45rem;
+ color: #6b7280;
+ line-height: 1;
+}
+
+.session-activity-total strong {
+ color: #111827;
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
+ font-size: 1.15rem;
+ font-variant-numeric: tabular-nums;
+ font-weight: 750;
+ letter-spacing: -0.035em;
+}
+
+.session-activity-total span {
+ font-size: 0.74rem;
+ font-weight: 550;
+}
+
+.session-activity-track {
+ width: 100%;
+ height: 0.48rem;
+ display: block;
+ overflow: hidden;
+ border-radius: 999px;
+ background: #edf0f3;
+}
+
+.session-activity-segment {
+ shape-rendering: crispEdges;
+}
+
+.session-activity-tool {
+ background: #0ea5e9;
+ fill: #0ea5e9;
+}
+
+.session-activity-command {
+ background: #8b5cf6;
+ fill: #8b5cf6;
+}
+
+.session-activity-file {
+ background: #10b981;
+ fill: #10b981;
+}
+
+.session-activity-prompt {
+ background: #60a5fa;
+ fill: #60a5fa;
+}
+
+.session-activity-mcp {
+ background: #14b8a6;
+ fill: #14b8a6;
+}
+
+.session-activity-approval {
+ background: #fbbf24;
+ fill: #fbbf24;
+}
+
+.session-activity-other {
+ background: #fb8c00;
+ fill: #fb8c00;
+}
+
+.session-activity-detail {
+ width: 100%;
+ overflow: hidden;
+ color: #6b7280;
+ font-size: 0.71rem;
+ font-weight: 500;
+ line-height: 1.2;
+ text-align: center;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.session-raw-note {
+ border-top: 1px solid var(--line);
+ padding-top: 0.75rem;
+}
+
.capture-method-badge {
display: inline-flex;
align-items: center;
@@ -2340,6 +3359,22 @@ pre {
.session-filter-grid {
grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}
+
+ .session-metadata {
+ grid-template-columns: repeat(3, minmax(8rem, 1fr));
+ }
+
+ .session-activity-body {
+ grid-template-columns: 1fr;
+ }
+
+ .session-activity-head {
+ grid-template-columns: 1fr;
+ }
+
+ .session-activity-legend {
+ grid-row: auto;
+ }
}
@media (max-width: 760px) {
@@ -2383,4 +3418,26 @@ pre {
.session-filter-grid {
grid-template-columns: 1fr;
}
+
+ .session-detail-main {
+ padding: 0.85rem;
+ }
+
+ .session-time-range {
+ display: flex;
+ margin-left: 0;
+ }
+
+ .session-metadata,
+ .session-activity-head {
+ grid-template-columns: 1fr;
+ }
+
+ .session-metadata {
+ gap: 0.9rem;
+ }
+
+ .session-activity-legend {
+ justify-content: center;
+ }
}