Skip to content

13 · HTTP API 面

Client ↔ Host 的唯一通道

没有 RPC:客户端是静态 bundle(非动态 Cordis Package),无法用 host.call,全部走同源 fetch。统一 responseJson(no-store + nosniff),body 强制 application/json ≤64KB,写操作全部带 expectedRevision 乐观并发。

路由方法用途信任平面
/feedbackPOST客户端上报 outcome(auto:true)+ approval 完成 ACKtrustedHosts
/settingsGET/POST配置快照 {value,revision,writable,applies,configError} / 更新(preserveHostKeys)特权 [ ] 仅回环
/reviewer-credentialGET/POST/DELETE密钥 {configured,writable},永不回显 value特权 [ ] 仅回环
/historyGET/DELETE记录查询(逆序)/ 清空(仅清内存+history,审计留墓碑)trustedHosts
/history/exportGETattachment 下载 approval-history.jsontrustedHosts
/modelsGET?provider= 列可用模型trustedHosts
/testPOST在线端点连通性探针(回环 hostname 校验 + 8s 超时 max_tokens:1);模型库校验 modelFound特权 [ ] 仅回环
/session-modeGET查会话权限 preset(mode)trustedHosts
/review-statusGET单审批 countdown/follow 状态;callId 走 x-auto-approval-call-id 头(防 URL/devtools 泄漏)trustedHosts
/statsGET会话统计 {mode, reviewMode, counts{total,allow,deny,timeout,breaker}, breaker{…tripped}}trustedHosts

「特权平面」是什么意思

settings / reviewer-credential / test 三个配置域传 [](空白名单)→ 强制仅回环同源(Host 头须回环 + TCP 对端须真回环)。LAN 用户即使进了白名单也不能改配置或读密钥状态。其余查询路由走 trustedHosts(webRuntime 配置 → --trusted-host → 绑定 0.0.0.0 时枚举的 LAN IPv4)。