agent-Specialization/server/tasks/__init__.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

14 lines
663 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.

# server/tasks/__init__.py - 任务核心层(无 Web 依赖,可独立加载)
#
# Gateway 化解耦2026-09-07G4本包 __init__ 只导出任务核心层
# TaskManager 单例与 models 层符号),不创建 Flask Blueprint、
# 不 import 路由模块——保证 server.runtime 在无 Web 应用初始化的
# 进程中可独立加载使用。
# Web 路由装配入口server/tasks/web.py 的 get_tasks_blueprint()
# Flask app 初始化时由 server/app_legacy.py 显式调用)。
from server.tasks.models import *
from server.tasks.models import TaskManager
# 显式导出单例,便于旧代码导入
task_manager = TaskManager()