feat: add companion API and Android APK shell
This commit is contained in:
@@ -5,6 +5,11 @@ export const hermesHealthSchema = z.object({
|
||||
cliPath: z.string().optional(),
|
||||
});
|
||||
|
||||
export const companionConfigSchema = z.object({
|
||||
workspaceRoot: z.string(),
|
||||
authConfigured: z.boolean(),
|
||||
});
|
||||
|
||||
export const healthResponseSchema = z.object({
|
||||
ok: z.boolean(),
|
||||
service: z.literal('hermes-mobile-companion'),
|
||||
@@ -15,7 +20,90 @@ export const healthResponseSchema = z.object({
|
||||
checks: z.object({
|
||||
hermes: hermesHealthSchema,
|
||||
}),
|
||||
config: companionConfigSchema,
|
||||
});
|
||||
|
||||
export const authValidateResponseSchema = z.object({
|
||||
ok: z.boolean(),
|
||||
message: z.string(),
|
||||
});
|
||||
|
||||
export const chatRequestSchema = z.object({
|
||||
prompt: z.string().min(1),
|
||||
});
|
||||
|
||||
export const chatResponseSchema = z.object({
|
||||
reply: z.string(),
|
||||
exitCode: z.number().nullable(),
|
||||
stderr: z.string().optional(),
|
||||
hermesAvailable: z.boolean(),
|
||||
});
|
||||
|
||||
export const fileEntrySchema = z.object({
|
||||
name: z.string(),
|
||||
path: z.string(),
|
||||
type: z.enum(['file', 'directory']),
|
||||
size: z.number().nonnegative(),
|
||||
modifiedAt: z.string().datetime(),
|
||||
});
|
||||
|
||||
export const fileListResponseSchema = z.object({
|
||||
path: z.string(),
|
||||
entries: z.array(fileEntrySchema),
|
||||
});
|
||||
|
||||
export const fileReadResponseSchema = z.object({
|
||||
path: z.string(),
|
||||
content: z.string(),
|
||||
size: z.number().nonnegative(),
|
||||
modifiedAt: z.string().datetime(),
|
||||
});
|
||||
|
||||
export const fileWriteRequestSchema = z.object({
|
||||
path: z.string(),
|
||||
content: z.string(),
|
||||
});
|
||||
|
||||
export const fileWriteResponseSchema = z.object({
|
||||
ok: z.boolean(),
|
||||
path: z.string(),
|
||||
bytesWritten: z.number().nonnegative(),
|
||||
});
|
||||
|
||||
export const fileMetadataResponseSchema = z.object({
|
||||
path: z.string(),
|
||||
name: z.string(),
|
||||
type: z.enum(['file', 'directory']),
|
||||
size: z.number().nonnegative(),
|
||||
modifiedAt: z.string().datetime(),
|
||||
});
|
||||
|
||||
export const terminalRunRequestSchema = z.object({
|
||||
command: z.string().min(1),
|
||||
cwd: z.string().optional(),
|
||||
timeoutMs: z.number().int().min(100).max(30000).optional(),
|
||||
});
|
||||
|
||||
export const terminalRunResponseSchema = z.object({
|
||||
cwd: z.string(),
|
||||
command: z.string(),
|
||||
stdout: z.string(),
|
||||
stderr: z.string(),
|
||||
exitCode: z.number().nullable(),
|
||||
timedOut: z.boolean(),
|
||||
});
|
||||
|
||||
export type HermesHealth = z.infer<typeof hermesHealthSchema>;
|
||||
export type CompanionConfig = z.infer<typeof companionConfigSchema>;
|
||||
export type HealthResponse = z.infer<typeof healthResponseSchema>;
|
||||
export type AuthValidateResponse = z.infer<typeof authValidateResponseSchema>;
|
||||
export type ChatRequest = z.infer<typeof chatRequestSchema>;
|
||||
export type ChatResponse = z.infer<typeof chatResponseSchema>;
|
||||
export type FileEntry = z.infer<typeof fileEntrySchema>;
|
||||
export type FileListResponse = z.infer<typeof fileListResponseSchema>;
|
||||
export type FileReadResponse = z.infer<typeof fileReadResponseSchema>;
|
||||
export type FileWriteRequest = z.infer<typeof fileWriteRequestSchema>;
|
||||
export type FileWriteResponse = z.infer<typeof fileWriteResponseSchema>;
|
||||
export type FileMetadataResponse = z.infer<typeof fileMetadataResponseSchema>;
|
||||
export type TerminalRunRequest = z.infer<typeof terminalRunRequestSchema>;
|
||||
export type TerminalRunResponse = z.infer<typeof terminalRunResponseSchema>;
|
||||
|
||||
Reference in New Issue
Block a user