sync update from LAN repo (source dhk-1 @ c21a2a4a)

This commit is contained in:
gozeros committed 2026-11-10 14:04:00 +08:00
1 parent 264e2200d6
commit a1fa13a238
122 files changed
+8881 -623

No files matched your search

@@ -252,6 +252,29 @@ async def refresh_skill_catalog_projection(
return len(catalog)
async def set_skill_catalog_enabled(name: str, enabled: bool) -> bool:
"""Persist one skill's online flag in the catalog row the list API reads.
The extensions file is the runtime source of truth. The skills page reads
``skills.enabled`` instead, so a toggle that only rewrites the file looks
unchanged after the list refreshes. Updating this single row avoids a full
catalog rebuild, which rewrites every skill and can roll the flag back if
an unrelated row fails.
"""
session_factory = get_session_factory()
if session_factory is None or not name:
return False
async with session_factory() as session:
result = await session.execute(
update(SkillRow)
.where(SkillRow.name == name)
.values(enabled=bool(enabled), updated_at=datetime.now(UTC))
)
await session.commit()
return int(result.rowcount or 0) > 0
def _build_catalog_payload(skills: list[Any], usage_entries: dict[str, Any]) -> list[dict[str, Any]]:
payload: list[dict[str, Any]] = []
defaults = {