refactor: share core REST payload types

This commit is contained in:
weishu
2026-05-21 14:35:47 +08:00
parent 7c26c1e749
commit e88a9075df
4 changed files with 121 additions and 99 deletions
+6 -28
View File
@@ -20,11 +20,17 @@ export type {
MachineDirectoryEntry,
MachineListDirectoryResponse,
MachinePathsExistsResponse,
AuthResponse,
MachinesResponse,
MessagesResponse,
OpencodeModelsResponse,
OpencodeModelSummary,
PathExistsResponse,
SlashCommand,
SlashCommandsResponse,
SessionResponse,
SessionsResponse,
SpawnResponse,
UploadFileResponse
} from '@hapi/protocol/apiTypes'
@@ -73,34 +79,6 @@ export type DecryptedMessage = ProtocolDecryptedMessage & {
invokedAt?: number | null
}
export type AuthResponse = {
token: string
user: {
id: number
username?: string
firstName?: string
lastName?: string
}
}
export type SessionsResponse = { sessions: SessionSummary[] }
export type SessionResponse = { session: Session }
export type MessagesResponse = {
messages: DecryptedMessage[]
page: {
limit: number
nextBeforeSeq: number | null
nextBeforeAt: number | null
hasMore: boolean
}
}
export type MachinesResponse = { machines: Machine[] }
export type SpawnResponse =
| { type: 'success'; sessionId: string }
| { type: 'error'; message: string }
export type FileSearchItem = {
fileName: string
filePath: string