feat: agent 架构基座(copier 预生成横切层)

- 空层包: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 就位
This commit is contained in:
baozaotumao
2026-06-02 00:40:36 -07:00
parent 434a4683ea
commit 5da86b9c6e
15 changed files with 127 additions and 6 deletions
+10
View File
@@ -0,0 +1,10 @@
import asyncio
def make_session_semaphore(max_concurrent: int) -> asyncio.Semaphore:
"""全局会话并发上限信号量。
每个会话持有 LLM 子进程/连接等昂贵资源,必须封顶(见 agent-concurrency.md)。
超出上限的会话应排队,并向前端反馈位置。
"""
return asyncio.Semaphore(max_concurrent)