cc-haha/desktop/src/api/cliTasks.ts
程序员阿江(Relakkes) d059a8b487 feat: add Provider management UI, CLI Tasks page, and enhance NewTaskModal
- Settings: new Providers tab with full CRUD, activation, and connectivity
  test; Model tab shows active provider name; General tab simplified
- Tasks: new CLI Tasks page displaying task lists from ~/.claude/tasks/
  with status, owner, and dependency (blocks/blockedBy) visualization
- NewTaskModal: add Advanced options (model, permission mode, working dir)
- Backend: fix TaskService to parse CLI V2 task format; extend /api/tasks
  with /lists endpoint for grouped queries
- Fix ModelInfo.context type from number to string

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 10:05:50 +08:00

29 lines
864 B
TypeScript

import { api } from './client'
import type { CLITask, TaskListSummary } from '../types/cliTask'
type TaskListsResponse = { lists: TaskListSummary[] }
type TasksResponse = { tasks: CLITask[] }
type TaskResponse = { task: CLITask }
export const cliTasksApi = {
/** List all task lists with summaries */
listTaskLists() {
return api.get<TaskListsResponse>('/api/tasks/lists')
},
/** Get all tasks for a specific task list */
getTasksForList(taskListId: string) {
return api.get<TasksResponse>(`/api/tasks/lists/${encodeURIComponent(taskListId)}`)
},
/** Get a single task */
getTask(taskListId: string, taskId: string) {
return api.get<TaskResponse>(`/api/tasks/lists/${encodeURIComponent(taskListId)}/${taskId}`)
},
/** List all tasks across all task lists */
listAll() {
return api.get<TasksResponse>('/api/tasks')
},
}