处理状态
GET /api/processing 轮询论文提交后的处理流水线进度。
提交论文后,仓库会进入处理流水线(代码发现、结构化、导入、复现、核验、发布等阶段)。GET /api/processing 返回该仓库最近一次处理任务及其事件,用于轮询进度。
鉴权
身份可选(浏览器 session 或 x-api-key),但需要对该仓库有读取权限;没有权限时与任务不存在一样返回 404 {"error": "处理任务不存在"},不泄露仓库是否存在任务。
请求
Query 参数:
| 参数 | 必填 | 说明 |
|---|---|---|
| repositoryId | 是 | 仓库 ID,最长 128 |
示例
curl "https://citeark.com/api/processing?repositoryId=<仓库ID>" \
-H "x-api-key: $CITEARK_API_KEY"响应
成功返回 200,响应头 cache-control: private, no-store:
{
"job": {
"id": "…",
"repositoryId": "…",
"kind": "research_ingestion",
"state": "running",
"stage": "research_compilation",
"priority": 100,
"requestedBy": { "type": "human", "id": "…" },
"attemptCount": 1,
"maxAttempts": 3,
"availableAt": "…",
"result": {},
"lastError": "…",
"createdAt": "…",
"updatedAt": "…",
"startedAt": "…",
"finishedAt": "…"
},
"events": [
{
"eventType": "processing.queued",
"state": "queued",
"stage": "intake",
"payload": {},
"recordedAt": "…"
}
]
}job 字段:
| 字段 | 说明 |
|---|---|
| id | 处理任务 ID |
| repositoryId | 所属仓库 ID |
| kind | 任务类型,固定为 research_ingestion |
| state | 任务状态,见下方枚举 |
| stage | 流水线阶段,见下方枚举 |
| priority | 调度优先级 |
| requestedBy | 发起人,type 为 human、api_key 或 service,id 为对应主体 ID |
| attemptCount | 已尝试次数 |
| maxAttempts | 最大尝试次数 |
| availableAt | 任务可被调度的时间 |
| result | 完成后的结构化结果 |
| lastError | 最近一次错误信息,可能缺省 |
| createdAt / updatedAt | 创建与最近更新时间 |
| startedAt / finishedAt | 开始与结束时间,未完成时缺省 |
state 枚举:queued(排队中)、dispatched(已分发)、running(运行中)、blocked(被预算或执行策略阻止)、completed(已完成)、failed(失败)、cancelled(已取消)。
stage 枚举(流水线阶段):intake、source_discovery、research_compilation、research_import、reproduction_scheduling、reproduction、verification、publishing、completed。
events 为该任务最近 30 条处理事件,每条包含 eventType、state、stage、payload、recordedAt 等字段(另含事件摘要等完整性字段),按时间记录流水线的每次状态变化。
错误
错误统一形态为 {"error": "中文信息"}:
| 状态码 | 说明 |
|---|---|
| 400 | 处理任务查询无效(repositoryId 缺失或超长) |
| 404 | 处理任务不存在,或没有该仓库的读取权限 |
备注
此端点无内置限流,但请合理轮询,建议间隔不低于 10 秒。流水线完成后,仓库快照中的 Claims、实验方案等结构由流水线产出,可通过 GET /api/repositories 读取。