Share REST and RPC response types

This commit is contained in:
weishu
2026-05-21 10:31:50 +08:00
parent 9698aa9f4c
commit d6f97065c1
13 changed files with 166 additions and 250 deletions
+95
View File
@@ -0,0 +1,95 @@
export type CommandResponse = {
success: boolean
stdout?: string
stderr?: string
exitCode?: number
error?: string
}
export type GitCommandResponse = CommandResponse
export type FileReadResponse = {
success: boolean
content?: string
error?: string
}
export type GeneratedImageResponse = {
success: boolean
content?: string
mimeType?: string
fileName?: string
error?: string
}
export type UploadFileResponse = {
success: boolean
path?: string
error?: string
}
export type DeleteUploadResponse = {
success: boolean
error?: string
}
export type DirectoryEntry = {
name: string
type: 'file' | 'directory' | 'other'
size?: number
modified?: number
}
export type ListDirectoryResponse = {
success: boolean
entries?: DirectoryEntry[]
error?: string
}
export type RpcListDirectoryResponse = ListDirectoryResponse
export type MachineDirectoryEntry = DirectoryEntry & {
isGitRepo?: boolean
}
export type MachineListDirectoryResponse = {
success: boolean
entries?: MachineDirectoryEntry[]
error?: string
}
export type PathExistsResponse = {
exists: Record<string, boolean>
}
export type MachinePathsExistsResponse = PathExistsResponse
export type CodexModelSummary = {
id: string
displayName: string
isDefault: boolean
defaultReasoningEffort?: string | null
supportedReasoningEfforts?: string[]
}
export type CodexModelsResponse = {
success: boolean
models?: CodexModelSummary[]
error?: string
}
export type ListCodexModelsResponse = CodexModelsResponse
export type OpencodeModelSummary = {
modelId: string
name?: string
}
export type OpencodeModelsResponse = {
success: boolean
availableModels?: OpencodeModelSummary[]
currentModelId?: string | null
error?: string
}
export type ListOpencodeModelsResponse = OpencodeModelsResponse