5da86b9c6e
- 空层包:domain / dag / llm / providers / export / storage(待功能填)
- domain/exceptions.py:AgentException + 中性化错误类(LLM_/EXTERNAL_SERVICE_)
- utils:ids / files(work_dir/会话目录/防穿越) / concurrency(会话信号量) / ansi(PTY 清洗)
- core/logging:文件 sink 到 {WORK_DIR}/logs/agent.log
- main.py:/health /ready + WS 接入点骨架 + 接线
- 验证:gemini-cli/openai-api 两 provider,ruff+mypy 全过,import + /ws 就位
11 lines
357 B
Python
11 lines
357 B
Python
import asyncio
|
|
|
|
|
|
def make_session_semaphore(max_concurrent: int) -> asyncio.Semaphore:
|
|
"""全局会话并发上限信号量。
|
|
|
|
每个会话持有 LLM 子进程/连接等昂贵资源,必须封顶(见 agent-concurrency.md)。
|
|
超出上限的会话应排队,并向前端反馈位置。
|
|
"""
|
|
return asyncio.Semaphore(max_concurrent)
|