Add control residual options table with liquidity-only manual close.

Fleet status exposes enriched residuals; manual close skips the premium recovery gate while auto mid-close remains unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-02 15:13:29 +08:00
parent 92c2e89b0e
commit a7aee8f425
8 changed files with 407 additions and 46 deletions
+29
View File
@@ -442,6 +442,35 @@ async def node_stats(
return data
class ResidualCloseBody(BaseModel):
group_id: str = Field(min_length=1, max_length=128)
@router.post("/{node_id}/residual/close")
async def node_residual_close(
node_id: int,
body: ResidualCloseBody,
_user: Annotated[str, Depends(require_control_user)],
) -> dict:
"""代理策略机手动平单条残留(只验流动性)。"""
db = get_control_db()
node = db.get_node(node_id)
if not node:
raise HTTPException(status_code=404, detail="节点不存在")
if not node.get("token_sealed"):
raise HTTPException(status_code=400, detail="未生成 Token")
code, data = await call_node(
node,
"POST",
"/api/fleet/residual/close",
json_body={"group_id": body.group_id},
timeout=30.0,
)
if code >= 400:
_raise_node_error(code, data)
return {"ok": True, "result": data}
@router.post("/{node_id}/start")
async def node_start(
node_id: int,