Add public SDK cancel endpoint and CloudClient method

- POST /v1/tasks/{task_id}/cancel: tasks:submit scoped, 200 for
  immediate/idempotent cancellation, 202 for newly recorded pending
  cancellation, 404 for unknown task, 409 for terminal task.
- TaskCancellationResponse{task_id, status} model.
- Widen list_tasks status_filter Literal to include "cancelled".
- CloudClient.cancel_task(task_id).
- SDK-level tests covering queued/assigned/idempotent/404/409/scope
  cases for both the router and CloudClient.

Task 5/9 of task-cancellation change.
This commit is contained in:
2026-07-15 18:39:00 +08:00
parent d3024b4810
commit 6776ac2f2d
6 changed files with 192 additions and 7 deletions
@@ -25,6 +25,11 @@ class TaskSubmissionResponse(BaseModel):
task_id: str
class TaskCancellationResponse(BaseModel):
task_id: str
status: str
class TaskStatusResponse(BaseModel):
id: str
status: str