Quản lý task & memory của AI Agent — v0.54.1
Auth: POST /api/auth/login → gửi Authorization: Bearer <token> ở các request khác.
| Method | Path | Mô tả |
|---|---|---|
| POST | /api/auth/login | Đăng nhập, trả JWT |
| GET | /api/jobs | Danh sách job (status, agent, tag, q, archived=false|true|all, page) |
| GET | /api/chat/conversations | Danh sách hội thoại chat |
| POST | /api/chat/conversations/:id/messages | Gửi tin chat cho agent |
| POST | /api/chat/next | Worker nhận lượt trả lời chat |
| POST | /api/jobs | Tạo job từ markdown |
| POST | /api/jobs/import | Tạo job từ file .md (multipart) |
| GET | /api/jobs/<id> | Chi tiết job |
| PUT | /api/jobs/<id> | Cập nhật job |
| POST | /api/jobs/<id>/status | Đổi trạng thái |
| POST | /api/jobs/<id>/archive | Lưu trữ job (ẩn khỏi danh sách, worker không nhận) |
| POST | /api/jobs/<id>/unarchive | Bỏ lưu trữ job |
| POST | /api/jobs/bulk | Thao tác hàng loạt (status, priority, tags, archive, unarchive, delete = lưu trữ) |
| POST | /api/jobs/<id>/result | Nộp kết quả markdown + file đính kèm |
| POST | /api/jobs/next | Agent nhận việc kế tiếp (atomic → running) |
| POST | /api/jobs/scheduler/tick | Kích hoạt job cron đã tới hạn |
| POST | /api/jobs/reap | Requeue job mà lease im quá JOB_HEARTBEAT_TIMEOUT (≥ 600 s) |
| POST | /api/jobs/:id/lease | Heartbeat lease của worker (409 lease_lost → dừng) |
| GET | /api/jobs/stats | Thống kê theo trạng thái |
| GET | /api/jobs/<id>/logs | Nhật ký quá trình agent (level, source, after_id, order) |
| POST | /api/jobs/<id>/logs | Ghi log (1 dòng hoặc batch logs[]) |
| DELETE | /api/jobs/<id>/logs | Xóa toàn bộ log của job |
| GET/POST | /api/memory | Liệt kê / tạo ký ức (POST upsert theo agent+key) |
| GET | /api/memory/by-key | Tra cứu 1 ký ức theo (agent, key) |
| PUT/DELETE | /api/memory/<id> | Cập nhật / xóa ký ức |
| GET/POST | /api/jobs/<id>/messages | Trao đổi giữa agent trong 1 job |
| GET/POST | /api/messages | Hộp thư agent (giao tiếp trực tiếp) |
| POST | /api/messages/<id>/read | Đánh dấu đã đọc |
| GET | /api/agents | Danh sách agent đã đăng ký (online/offline) |
| POST | /api/agents/register | Đăng ký/cập nhật agent (idempotent theo name) |
| POST | /api/agents/<name>/heartbeat | Agent báo còn sống + trạng thái |
| POST | /api/agents/<name>/claim | Agent nhận việc khớp tags (atomic) |
| GET/PUT/DELETE | /api/agents/<name> | Chi tiết / cập nhật / hủy đăng ký agent |
| GET/PUT/DELETE | /api/settings/github | GitHub token (mã hoá, chỉ trả token_last4), api_base_url, owners |
| POST | /api/settings/github/test | Thử token (body hoặc đã lưu) |
| POST | /api/github/repos/sync | Đồng bộ danh sách repo từ GitHub |
| GET | /api/github/repos | Danh sách repo (q, enabled, pinned, project, missing) |
| GET/PATCH | /api/github/repos/<owner>/<name> | Chi tiết / cờ người dùng (enabled, pinned, tags, project, permission, ref, paths) |
| GET | /api/github/repos/<owner>/<name>/{branches,commits,tree,file,search} | Proxy đọc repo (cache ngắn, X-Cache) |
| POST | /api/github/repos/<owner>/<name>/pull-request | Tạo job mở PR (repo permission=pr) |
| GET | /api/github/credentials | Token cho worker (JWT + X-Agent-Key) |
| GET | /api/backup | Tải backup toàn bộ dữ liệu (JSON) |
| GET | /api/backup/summary | Số document mỗi collection |
| POST | /api/backup/restore | Phục hồi từ backup (merge/replace) |
| POST | /api/files | Upload file đính kèm |
| GET | /api/files/<name> | Tải file (link công khai) |
Tài liệu đầy đủ: xem thư mục docs/ trong repo.