feat: add frontend API clients for branches, handoffs, and resolutions
Adds branchesApi (getBranches, createFork, updateBranchStatus, switchBranch, reviveBranch, sendBranchMessage), handoffsApi (createHandoff, listHandoffs, claimHandoff, getQueue), and resolutionsApi (getOutputs, editOutput, pushOutput). All exported from api/index.ts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
39
frontend/src/api/handoffs.ts
Normal file
39
frontend/src/api/handoffs.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import apiClient from './client'
|
||||
import type {
|
||||
HandoffCreateRequest,
|
||||
HandoffResponse,
|
||||
QueueItemResponse,
|
||||
} from '@/types/branching'
|
||||
|
||||
export const handoffsApi = {
|
||||
async createHandoff(sessionId: string, data: HandoffCreateRequest): Promise<HandoffResponse> {
|
||||
const response = await apiClient.post<HandoffResponse>(
|
||||
`/ai-sessions/${sessionId}/handoff`,
|
||||
data
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async listHandoffs(sessionId: string): Promise<HandoffResponse[]> {
|
||||
const response = await apiClient.get<HandoffResponse[]>(
|
||||
`/ai-sessions/${sessionId}/handoffs`
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async claimHandoff(handoffId: string): Promise<HandoffResponse> {
|
||||
const response = await apiClient.post<HandoffResponse>(
|
||||
`/handoffs/${handoffId}/claim`
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async getQueue(params?: { intent?: 'park' | 'escalate'; limit?: number }): Promise<QueueItemResponse[]> {
|
||||
const response = await apiClient.get<QueueItemResponse[]>('/handoffs/queue', {
|
||||
params,
|
||||
})
|
||||
return response.data
|
||||
},
|
||||
}
|
||||
|
||||
export default handoffsApi
|
||||
Reference in New Issue
Block a user