Introduce ProgressSubtype union ("hook" | "bash" | "mcp" | "agent") and
three new fields on ParsedMessage: toolUseId, parentToolUseId, and
progressSubtype. These enable linking hook_progress events to the
tool_call that spawned them and classifying progress by source.
Session parser changes:
- Extract `id` from tool_use content blocks into toolUseId
- Extract `tool_use_id` from tool_result blocks into toolUseId (was
previously misassigned to toolName)
- Read `parentToolUseID` from raw progress lines
- Derive progressSubtype from the `data.type` field using a new
deriveProgressSubtype() helper
- Add `toolProgress` map to SessionDetailResponse for grouped progress
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
87 lines
1.9 KiB
TypeScript
87 lines
1.9 KiB
TypeScript
export type MessageCategory =
|
|
| "user_message"
|
|
| "assistant_text"
|
|
| "thinking"
|
|
| "tool_call"
|
|
| "tool_result"
|
|
| "system_message"
|
|
| "hook_progress"
|
|
| "file_snapshot"
|
|
| "summary";
|
|
|
|
export type ProgressSubtype = "hook" | "bash" | "mcp" | "agent";
|
|
|
|
export interface ParsedMessage {
|
|
uuid: string;
|
|
category: MessageCategory;
|
|
content: string;
|
|
toolName?: string;
|
|
toolInput?: string;
|
|
timestamp?: string;
|
|
rawIndex: number;
|
|
toolUseId?: string;
|
|
parentToolUseId?: string;
|
|
progressSubtype?: ProgressSubtype;
|
|
}
|
|
|
|
export interface SessionEntry {
|
|
id: string;
|
|
summary: string;
|
|
firstPrompt: string;
|
|
project: string;
|
|
created: string;
|
|
modified: string;
|
|
messageCount: number;
|
|
path: string;
|
|
duration?: number; // Duration in milliseconds from first to last message
|
|
}
|
|
|
|
export interface SessionListResponse {
|
|
sessions: SessionEntry[];
|
|
}
|
|
|
|
export interface SessionDetailResponse {
|
|
id: string;
|
|
project: string;
|
|
messages: ParsedMessage[];
|
|
toolProgress?: Record<string, ParsedMessage[]>;
|
|
}
|
|
|
|
export interface ExportRequest {
|
|
session: SessionDetailResponse;
|
|
visibleMessageUuids: string[];
|
|
redactedMessageUuids: string[];
|
|
autoRedactEnabled?: boolean;
|
|
}
|
|
|
|
export const ALL_CATEGORIES: MessageCategory[] = [
|
|
"user_message",
|
|
"assistant_text",
|
|
"thinking",
|
|
"tool_call",
|
|
"tool_result",
|
|
"system_message",
|
|
"hook_progress",
|
|
"file_snapshot",
|
|
"summary",
|
|
];
|
|
|
|
export const CATEGORY_LABELS: Record<MessageCategory, string> = {
|
|
user_message: "User Messages",
|
|
assistant_text: "Assistant Text",
|
|
thinking: "Thinking Blocks",
|
|
tool_call: "Tool Calls",
|
|
tool_result: "Tool Results",
|
|
system_message: "System Messages",
|
|
hook_progress: "Hook/Progress",
|
|
file_snapshot: "File Snapshots",
|
|
summary: "Compactions",
|
|
};
|
|
|
|
export const DEFAULT_HIDDEN_CATEGORIES: MessageCategory[] = [
|
|
"tool_result",
|
|
"system_message",
|
|
"hook_progress",
|
|
"file_snapshot",
|
|
];
|