989fbeb9ac
對應 .agents/specs/llm-interface/ Milestone 2.1。給 AI debug 用的執行
狀態檢視端點。3 個新路由:
GET /executions/paused
- 列當前 api_key 下所有 paused workflow(等 callback resume)
- 走 EXEC_CONTEXT KV `paused_run:*` prefix scan,過濾 state.api_key
- 回 [{task_id, run_id, paused_node_id, workflow_name, expires_at}]
- 限 limit 100,避免 KV N+1 爆
GET /executions/:task_id
- 看單一 paused state 細節(trace_so_far / paused_context / pending_result)
- 隔離租戶(state.api_key !== 用戶 ak → 回 not_found 不洩漏存在性)
- 回完整 state JSON
GET /workflows/:name/executions
- 列某 workflow 最近 N 次執行 verdict(走 ANALYTICS_KV stats:{name}:* prefix)
- 先驗 workflow 屬該 api_key
- 按 timestamp 後綴 desc sort
統一 error contract(LI SDD §1.3 / §1.4 規範):
- ok: bool
- error_code: enum (auth_missing / not_found / internal_error)
- human_message: 描述
- next_actions: 陣列,給 AI 看的下一步
- hints: 成功時的 next-step 建議
不影響既有路由 contract。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>