agent-Specialization/server/tasks/web.py
JOJO d9bd599c1c feat(runtime): Gateway 独立启动与公共协议落地(改造第 0-3 步)
- 闭环修复:审批 task_id 显式化(N2)、通知回退路径门闸 finally 释放(N1)、
  personalization 原子写(S10,公共 atomic_write_json)
- server.tasks 拆解:__init__ 轻量化、Blueprint/路由移至 blueprint.py/web.py,
  app_legacy 装配点惰性挂载;models.py 循环依赖死导入移除
- 执行链 Web 解耦:emit_event/run_background 安全包装(socketio 未绑定静默),
  清除 4 处裸 socketio.emit(含 task_stopped 先写事件流再推送的顺序修复)
- RuntimeService 补建对话下沉:chat 任务无 conversation_id 时服务层装配,
  客户端无需复制 Web 两步流程
- 事件协议:get_task_events 返回 meta.window_start 缺口检测水位
- 验收:test_runtime_standalone_lifecycle 子进程隔离(config import 固化问题),
  独立启动 + 协议全链路 + 审批语义全绿;全量 74 测试失败恰为 4 项存量
2026-09-07 23:00:15 +08:00

20 lines
911 B
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.

"""tasks 包的 Web 路由装配入口Flask app 初始化时调用)。
独立 Gateway/Runtime 进程不需要本模块——任务核心层server.tasks
包的 task_manager 单例与 models 层)可脱离 Web 应用独立加载。
"""
from server.tasks.blueprint import tasks_bp
def get_tasks_blueprint():
"""返回已挂载全部路由的 tasks 蓝图。
通过 import 路由模块触发 @tasks_bp.route 装饰器完成挂载;
Python 模块只 import 一次,重复调用幂等。
"""
from server.tasks import skills as _skills # noqa: F401 @tasks_bp.route 挂载)
from server.tasks import helpers as _helpers # noqa: F401 (保持历史装配行为等价)
from server.tasks import media as _media # noqa: F401 (保持历史装配行为等价)
from server.tasks import api as _api # noqa: F401 @tasks_bp.route 挂载)
return tasks_bp