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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user