sync update from LAN repo (source master-nj @ 067eb808)

This commit is contained in:
gozeros committed 2026-11-10 14:04:09 +08:00
1 parent 1244fb1f2f
commit 1d5dd8fc90
182 files changed
+18973 -769

No files matched your search

@@ -91,6 +91,7 @@ from app.gateway.routers import (
skill_addresses,
skill_knowledge,
skills,
strategy_agents,
suggestions,
system_settings,
tags,
@@ -1087,6 +1088,21 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
"AI-writing functional agent seeding failed at startup (non-fatal)"
)
# Strategy-selection functional agents (intent, six independent
# analysis angles, judge, and solution editor). Seed them before
# _sync_legacy_agents so they are immediately visible and editable in
# the existing agent-management UI on a fresh deployment.
try:
from app.gateway.routers._strategy_selection_seed import (
ensure_strategy_selection_agents,
)
ensure_strategy_selection_agents()
except Exception:
logger.exception(
"Strategy-selection functional agent seeding failed at startup (non-fatal)"
)
# 内置「模板数据转换器」agent(JSON → HTML 模板填充)。同样必须在
# _sync_legacy_agents **之前**补建目录,后者把它 upsert 进 agents 表,
# 第一次启动 /api/agents 与定时任务下拉框里就有它。
@@ -1211,6 +1227,15 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
await ensure_builtin_agent_purpose_tags(agent_store, tag_store)
except Exception:
logger.exception("Built-in agent purpose-tag seeding failed at startup (non-fatal)")
# Synchronize every worker's strategy registry only after the
# folder agents have been imported. In memory mode this also
# restores dynamic/default angle lifecycle from sidecars.
try:
await strategy_agents.ensure_strategy_agent_registry(app)
logger.info("Strategy agent registry synchronized for worker")
except Exception:
logger.exception("Strategy agent role seeding failed at startup (non-fatal)")
except Exception:
logger.exception("Legacy agent sync failed at startup (non-fatal)")
@@ -1590,7 +1615,6 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
from app.gateway.routers import wiki_packages
app.include_router(wiki_packages.router)
# Artifacts API is mounted at /api/threads/{thread_id}/artifacts
app.include_router(artifacts.router)
@@ -1601,10 +1625,13 @@ This gateway provides custom endpoints for models, MCP configuration, skills, an
app.include_router(browser_context.router)
# Thread cleanup API is mounted at /api/threads/{thread_id}
app.include_router(threads.router)
from app.gateway.routers import analysis_projects
app.include_router(analysis_projects.router)
app.include_router(threads.router)
# Agents API is mounted at /api/agents
app.include_router(agents.router)
app.include_router(strategy_agents.router)
# Recommended Questions API is mounted at /api/recommended-questions
app.include_router(recommended_questions.router)