mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-05 01:01:42 +00:00
feat(session): validate agents and browse workspace directories
This commit is contained in:
+23
-1
@@ -130,7 +130,12 @@ export type MachinesResponse = { machines: Machine[] }
|
||||
|
||||
export type SpawnResponse =
|
||||
| { type: 'success'; sessionId: string }
|
||||
| { type: 'error'; message: string }
|
||||
| {
|
||||
type: 'error'
|
||||
message: string
|
||||
code?: 'agent_unavailable' | 'runner_upgrade_required' | 'outside_workspace_roots'
|
||||
agent?: z.infer<typeof AgentFlavorSchema>
|
||||
}
|
||||
|
||||
export const SessionPermissionModeRequestSchema = z.object({
|
||||
mode: PermissionModeSchema
|
||||
@@ -633,6 +638,21 @@ export const MachinePathsExistsRequestSchema = z.object({
|
||||
|
||||
export type MachinePathsExistsRequest = z.infer<typeof MachinePathsExistsRequestSchema>
|
||||
|
||||
export const AgentAvailabilityReasonSchema = z.enum(['not_found', 'invalid_configuration'])
|
||||
export type AgentAvailabilityReason = z.infer<typeof AgentAvailabilityReasonSchema>
|
||||
|
||||
export const AgentAvailabilityEntrySchema = z.object({
|
||||
agent: AgentFlavorSchema,
|
||||
available: z.boolean(),
|
||||
reason: AgentAvailabilityReasonSchema.optional()
|
||||
})
|
||||
export type AgentAvailabilityEntry = z.infer<typeof AgentAvailabilityEntrySchema>
|
||||
|
||||
export const AgentAvailabilityResponseSchema = z.object({
|
||||
agents: z.array(AgentAvailabilityEntrySchema)
|
||||
})
|
||||
export type AgentAvailabilityResponse = z.infer<typeof AgentAvailabilityResponseSchema>
|
||||
|
||||
export const AuthRequestSchema = z.union([
|
||||
z.object({ initData: z.string() }),
|
||||
z.object({ accessToken: z.string() })
|
||||
@@ -716,6 +736,8 @@ export type MachineListDirectoryResponse = {
|
||||
|
||||
export type PathExistsResponse = {
|
||||
exists: Record<string, boolean>
|
||||
/** Requested paths rejected by the runner's configured workspace roots. */
|
||||
outsideWorkspaceRoots?: string[]
|
||||
}
|
||||
|
||||
export type MachinePathsExistsResponse = PathExistsResponse
|
||||
|
||||
Reference in New Issue
Block a user