refactor: share api dto types

This commit is contained in:
Federico Jaramillo Martinez
2026-05-07 23:45:13 +02:00
parent ef63a7a063
commit d7cb7ed655
8 changed files with 165 additions and 266 deletions
+13 -70
View File
@@ -1,70 +1,13 @@
export interface Project {
id: string;
name: string;
path: string;
createdAt: string;
}
export interface Workspace {
id: string;
projectId: string;
path: string;
label: string;
branch?: string;
isMain: boolean;
isGitWorktree: boolean;
}
export interface ClientSession {
id: string;
path: string;
cwd: string;
name?: string;
created: string;
modified: string;
messageCount: number;
firstMessage: string;
archived?: boolean;
archivedAt?: string;
}
export interface ClientMessagePage {
messages: unknown[];
start: number;
total: number;
}
export interface ClientSessionStatus {
sessionId: string;
model?: { provider?: string; id?: string; name?: string; contextWindow?: number; reasoning?: unknown };
thinkingLevel?: string;
isStreaming: boolean;
isCompacting: boolean;
isBashRunning: boolean;
pendingMessageCount: number;
tokens: { input: number; output: number; cacheRead: number; cacheWrite: number; total: number };
cost: number;
contextUsage?: { tokens: number | null; contextWindow: number; percent: number | null };
}
export interface ClientCommand {
name: string;
description?: string;
source: "extension" | "prompt" | "skill" | "builtin";
}
export interface ClientFileSuggestion {
path: string;
kind: "tracked" | "untracked" | "other";
}
export interface ClientCommandOption {
value: string;
label: string;
description?: string;
}
export type ClientCommandResult =
| { type: "done"; message?: string; session?: ClientSession }
| { type: "select"; requestId: string; title: string; options: ClientCommandOption[] }
| { type: "unsupported"; message: string };
export type {
Project,
Workspace,
SessionInfo as ClientSession,
MessagePage as ClientMessagePage,
SessionStatus as ClientSessionStatus,
SlashCommand as ClientCommand,
FileSuggestion as ClientFileSuggestion,
CommandOption as ClientCommandOption,
CommandResult as ClientCommandResult,
SessionActivity as ClientSessionActivity,
SessionUiEvent,
} from "../shared/apiTypes.js";