sync update from LAN repo (source ji @ 85078a31)

This commit is contained in:
gozeros committed 2026-10-21 15:09:16 +08:00
1 parent 5d6627af50
commit e602d88695
864 files changed
+99150 -6346

No files matched your search

@@ -328,6 +328,7 @@ async def _validate_strategy_agent_skills(
*,
app_config: AppConfig,
skill_store: SkillStore,
existing_skills: list[str] | None = None,
) -> list[str] | None:
"""Validate a global strategy role's skill allowlist.
@@ -335,9 +336,12 @@ async def _validate_strategy_agent_skills(
every user. Their allowlists may therefore reference only canonical skill
names that exist on disk, are enabled/active, and are globally visible:
deployment-owned public skills, explicit built-in rows, or custom skills
currently published by their owner. In particular, an administrator must
not be able to attach a different user's unpublished skill merely because
``?admin=true`` exposes it in the management catalog.
currently published by their owner. An update may retain a previously
configured skill that was since disabled/archived, so administrators can
remove it without the rest of the edit being rejected; newly attaching an
unavailable skill remains forbidden. In particular, an administrator
must not be able to attach a different user's unpublished skill merely
because ``?admin=true`` exposes it in the management catalog.
"""
if requested_skills is None:
@@ -372,7 +376,16 @@ async def _validate_strategy_agent_skills(
detail=f"Unknown strategy agent skills: {', '.join(unknown)}",
)
unavailable = [name for name in normalized if not by_name[name].enabled or str((usage_entries.get(name) or {}).get("state") or "active") != "active"]
retained_names = {str(name).strip() for name in (existing_skills or []) if str(name).strip()}
unavailable = [
name
for name in normalized
if (
not by_name[name].enabled
or str((usage_entries.get(name) or {}).get("state") or "active") != "active"
)
and name not in retained_names
]
if unavailable:
raise HTTPException(
status_code=422,