agent-Specialization/server/app.py
JOJO e5808ea5be refactor(server,web): remove Socket.IO entirely, unify on REST polling
- task event stream (_append_event) is now the sole realtime channel for web and CLI
- status snapshots: idle 5s polling of /api/status (was status_update push); operation initiator gets state from REST responses
- terminal panel: REST polling (list 5s, output 1.5s, prefix-matched incremental xterm writes)
- multi-tab passive sync deliberately degrades to polling-based perception
- delete socket_handlers/broadcast/useLegacySocket (2103-line dead file); extensions.py keeps only run_background
- remove socket token chain (/api/socket-token, prune/consume_socket_token, pending_socket_tokens)
- app.run(threaded=True) replaces socketio.run; reapers switched to plain threading
- drop flask-socketio/socket.io-client/websockets dependencies
- docs: AGENTS.md section 12.5 (replacement map + hard constraints), plus CLI rewrite companion doc updates

Co-authored-by: Astrion powered by Kimi-K3 <astrion-agent@users.noreply.github.com>
2026-09-11 17:28:47 +08:00

47 lines
1.0 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""统一入口:复用 app_legacy便于逐步替换/收敛。"""
import argparse
from .app_legacy import (
app,
run_server as _run_server,
parse_arguments as _parse_arguments,
initialize_system,
resource_busy_page,
DEFAULT_PORT,
)
def parse_arguments():
"""向后兼容的参数解析,默认端口、路径等与 app_legacy 一致。"""
return _parse_arguments()
def run_server(path: str, thinking_mode: bool = False, port: int = DEFAULT_PORT, debug: bool = False):
"""统一 run_server 入口,便于 future 替换实现。"""
return _run_server(path=path, thinking_mode=thinking_mode, port=port, debug=debug)
def main():
args = parse_arguments()
run_server(
path=args.path,
thinking_mode=args.thinking_mode,
port=args.port,
debug=args.debug,
)
__all__ = [
"app",
"run_server",
"parse_arguments",
"initialize_system",
"resource_busy_page",
"main",
"DEFAULT_PORT",
]
if __name__ == "__main__":
main()