- 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>
17 lines
497 B
Python
17 lines
497 B
Python
"""后台任务辅助(WebSocket 移除后仅剩后台线程启动器)。"""
|
||
import threading
|
||
|
||
|
||
def run_background(fn, *args, **kwargs):
|
||
"""以 daemon 线程启动后台任务。
|
||
|
||
历史上该函数会在 Web 模式优先走 socketio.start_background_task;
|
||
Socket.IO 移除后统一为 daemon 线程(与原降级路径行为一致)。
|
||
"""
|
||
t = threading.Thread(target=fn, args=args, kwargs=kwargs, daemon=True)
|
||
t.start()
|
||
return t
|
||
|
||
|
||
__all__ = ["run_background"]
|