better chat ui

This commit is contained in:
2026-02-22 20:52:19 +00:00
parent f1e3ce4b76
commit 7fe7260f51
7 changed files with 731 additions and 322 deletions
File diff suppressed because it is too large Load Diff
+89
View File
@@ -152,3 +152,92 @@ export type ModelInfo = {
reasoning?: boolean;
images?: boolean;
};
// ── Pi-native JSONL types ──────────────────────────────────────────────
export type JnlSessionHeader = {
type: 'session';
version: 3;
id: string;
timestamp: string;
cwd: string;
};
export type JnlEntryBase = {
type: string;
id: string;
parentId?: string;
timestamp: string;
};
export type JnlTextContent = {
type: 'text';
text: string;
};
export type JnlToolCall = {
type: 'tool_use';
id: string;
name: string;
input: Record<string, unknown>;
};
export type JnlUserMessage = JnlEntryBase & {
type: 'message';
message: {
role: 'user';
content: string;
};
};
export type JnlAssistantMessage = JnlEntryBase & {
type: 'message';
message: {
role: 'assistant';
content: Array<JnlTextContent | JnlToolCall>;
};
};
export type JnlToolResultMessage = JnlEntryBase & {
type: 'message';
message: {
role: 'toolResult';
toolCallId: string;
toolName: string;
content: Array<JnlTextContent>;
isError?: boolean;
};
};
export type JnlMessageEntry = JnlUserMessage | JnlAssistantMessage | JnlToolResultMessage;
export type JnlSessionInfoEntry = JnlEntryBase & {
type: 'session_info';
name: string;
officer?: {
cost: MessageCost;
model: string;
groupSlug?: string | null;
messageCount: number;
createdAt: number;
updatedAt: number;
};
};
export type JnlEntry = JnlMessageEntry | JnlSessionInfoEntry;
// ── Session Index ──────────────────────────────────────────────────────
export type SessionIndexEntry = {
file: string;
title: string;
model: string;
cwd: string;
createdAt: number;
updatedAt: number;
messageCount: number;
cost: MessageCost;
groupSlug?: string | null;
};
export type SessionIndex = Record<string, SessionIndexEntry>;