feat: agent 本机 SimAdmin 登录与会话维持;中继设备侧限流与 agent Retry-After

- runtime.NodeAuth:agent 自查 /api/auth/status,需要时自行 POST /api/auth/login 并持
  simadmin_session Cookie 转发;错误密码进入 60s 冷却(对齐控制台 ensureAuthenticated),
  节点回 401/403 即失效重探,SimAdmin 重启无需重启 agent
- 节点密码进 agent 配置(nodePassword),永不经中继、永不下发到手机;登录路径仍被策略
  挡在电话可达面之外(TestAuthPathsAreUnreachable)
- 新拒绝分类 node_auth_failed:与 upstream_error 区分,手机可提示'该节点需重新配置'
- 中继:/v1/request 每设备固定窗口限流(默认 30/分钟),未鉴权调用不消耗预算
- transport:解析 Retry-After 并入退避;main loop 对 429 直接遵从中继指示
- contracts/envelope.schema.json 补 InnerResponse.outcome 字段
- 设计文档与 README 同步:WSS 改为长轮询的实现修订、响应方向已临时×临时、P2/P3 状态
This commit is contained in:
chick
2026-09-16 09:15:25 +08:00
parent 54d9696a4d
commit 443af20e0a
9 changed files with 645 additions and 12 deletions
+4
View File
@@ -40,6 +40,10 @@ type File struct {
SignKey string `json:"signKey"`
// KxKey is the agent's X25519 private key, base64.
KxKey string `json:"kxKey"`
// NodePassword is the local SimAdmin password the agent logs in with so the phone never
// handles or transmits it. Empty declares the node unprotected; a protected node then refuses
// commands with node_auth_failed rather than looping against a lockout.
NodePassword string `json:"nodePassword,omitempty"`
// AuditPath is where the audit log is appended.
AuditPath string `json:"auditPath"`
Devices []Device `json:"devices"`