Round-2 Copilot review on #14968 caught two leftover spots that didn't fully respect per-section overrides: - messageLine.tsx (trail branch): the previous fix gated on `SECTION_NAMES.some(...)`, which stayed true whenever any section was visible. With `thinking: 'expanded'` as the new built-in default, that meant `display.sections.tools: hidden` left an empty wrapper Box alive for trail messages. Now gates on the actual content-bearing sections for a trail message — `tools` OR `activity` — so a tools-hidden config drops the wrapper cleanly. - messageLine.tsx (showDetails): still keyed off the global `detailsMode !== 'hidden'`, so per-section overrides like `sections.thinking: expanded` couldn't escape global hidden for assistant messages with reasoning + tool metadata. Recomputed via resolved per-section modes (`thinkingMode`/`toolsMode`). - types.ts: rewrote the SectionVisibility doc comment to reflect the actual resolution order (explicit override → SECTION_DEFAULTS → global), so the docstring stops claiming "missing keys fall back to the global mode" when SECTION_DEFAULTS now layers in between. All three lookups (thinking/tools/activity) are computed once at the top of MessageLine and shared by every branch.
192 lines
4.0 KiB
TypeScript
192 lines
4.0 KiB
TypeScript
export interface ActiveTool {
|
|
context?: string
|
|
id: string
|
|
name: string
|
|
startedAt?: number
|
|
}
|
|
|
|
export interface ActivityItem {
|
|
id: number
|
|
text: string
|
|
tone: 'error' | 'info' | 'warn'
|
|
}
|
|
|
|
export interface SubagentProgress {
|
|
apiCalls?: number
|
|
costUsd?: number
|
|
depth: number
|
|
durationSeconds?: number
|
|
filesRead?: string[]
|
|
filesWritten?: string[]
|
|
goal: string
|
|
id: string
|
|
index: number
|
|
inputTokens?: number
|
|
iteration?: number
|
|
model?: string
|
|
notes: string[]
|
|
outputTail?: SubagentOutputEntry[]
|
|
outputTokens?: number
|
|
parentId: null | string
|
|
reasoningTokens?: number
|
|
startedAt?: number
|
|
status: 'completed' | 'failed' | 'interrupted' | 'queued' | 'running'
|
|
summary?: string
|
|
taskCount: number
|
|
thinking: string[]
|
|
toolCount: number
|
|
tools: string[]
|
|
toolsets?: string[]
|
|
}
|
|
|
|
export interface SubagentOutputEntry {
|
|
isError: boolean
|
|
preview: string
|
|
tool: string
|
|
}
|
|
|
|
export interface SubagentNode {
|
|
aggregate: SubagentAggregate
|
|
children: SubagentNode[]
|
|
item: SubagentProgress
|
|
}
|
|
|
|
export interface SubagentAggregate {
|
|
activeCount: number
|
|
costUsd: number
|
|
descendantCount: number
|
|
filesTouched: number
|
|
hotness: number
|
|
inputTokens: number
|
|
maxDepthFromHere: number
|
|
outputTokens: number
|
|
totalDuration: number
|
|
totalTools: number
|
|
}
|
|
|
|
export interface DelegationStatus {
|
|
active: {
|
|
depth?: number
|
|
goal?: string
|
|
model?: null | string
|
|
parent_id?: null | string
|
|
started_at?: number
|
|
status?: string
|
|
subagent_id?: string
|
|
tool_count?: number
|
|
}[]
|
|
max_concurrent_children?: number
|
|
max_spawn_depth?: number
|
|
paused: boolean
|
|
}
|
|
|
|
export interface ApprovalReq {
|
|
command: string
|
|
description: string
|
|
}
|
|
|
|
export interface ConfirmReq {
|
|
cancelLabel?: string
|
|
confirmLabel?: string
|
|
danger?: boolean
|
|
detail?: string
|
|
onConfirm: () => void
|
|
title: string
|
|
}
|
|
|
|
export interface ClarifyReq {
|
|
choices: string[] | null
|
|
question: string
|
|
requestId: string
|
|
}
|
|
|
|
export interface Msg {
|
|
info?: SessionInfo
|
|
kind?: 'diff' | 'intro' | 'panel' | 'slash' | 'trail'
|
|
panelData?: PanelData
|
|
role: Role
|
|
text: string
|
|
thinking?: string
|
|
thinkingTokens?: number
|
|
toolTokens?: number
|
|
tools?: string[]
|
|
}
|
|
|
|
export type Role = 'assistant' | 'system' | 'tool' | 'user'
|
|
export type DetailsMode = 'hidden' | 'collapsed' | 'expanded'
|
|
export type ThinkingMode = 'collapsed' | 'truncated' | 'full'
|
|
|
|
// Per-section overrides for the agent details accordion. Resolution order
|
|
// at lookup time is: explicit `display.sections.<name>` → built-in
|
|
// SECTION_DEFAULTS → global `details_mode`. Today the built-in defaults
|
|
// expand `thinking`/`tools` and hide `activity`; `subagents` falls through
|
|
// to the global mode. Any explicit value still wins for that one section.
|
|
export type SectionName = 'thinking' | 'tools' | 'subagents' | 'activity'
|
|
export type SectionVisibility = Partial<Record<SectionName, DetailsMode>>
|
|
|
|
export interface McpServerStatus {
|
|
connected: boolean
|
|
name: string
|
|
tools: number
|
|
transport: string
|
|
}
|
|
|
|
export interface SessionInfo {
|
|
cwd?: string
|
|
mcp_servers?: McpServerStatus[]
|
|
model: string
|
|
release_date?: string
|
|
skills: Record<string, string[]>
|
|
tools: Record<string, string[]>
|
|
update_behind?: number | null
|
|
update_command?: string
|
|
usage?: Usage
|
|
version?: string
|
|
}
|
|
|
|
export interface Usage {
|
|
calls: number
|
|
context_max?: number
|
|
context_percent?: number
|
|
context_used?: number
|
|
cost_usd?: number
|
|
input: number
|
|
output: number
|
|
total: number
|
|
}
|
|
|
|
export interface SudoReq {
|
|
requestId: string
|
|
}
|
|
|
|
export interface SecretReq {
|
|
envVar: string
|
|
prompt: string
|
|
requestId: string
|
|
}
|
|
|
|
export interface PanelData {
|
|
sections: PanelSection[]
|
|
title: string
|
|
}
|
|
|
|
export interface PanelSection {
|
|
items?: string[]
|
|
rows?: [string, string][]
|
|
text?: string
|
|
title?: string
|
|
}
|
|
|
|
export interface SlashCatalog {
|
|
canon: Record<string, string>
|
|
categories: SlashCategory[]
|
|
pairs: [string, string][]
|
|
skillCount: number
|
|
sub: Record<string, string[]>
|
|
}
|
|
|
|
export interface SlashCategory {
|
|
name: string
|
|
pairs: [string, string][]
|
|
}
|