Increase security and reformat

This commit is contained in:
2026-03-07 20:52:13 +00:00
parent 10588a18b9
commit bca4d6898f
144 changed files with 6735 additions and 3960 deletions

View File

@@ -32,7 +32,8 @@ def _legacy_defaults(profile: CommandProfile, post_result_enabled: bool) -> dict
"enabled": True,
"generation_mode": "ai",
"send_plan_to_egress": bool(post_result_enabled),
"send_status_to_source": str(profile.visibility_mode or "") == "status_in_source",
"send_status_to_source": str(profile.visibility_mode or "")
== "status_in_source",
"send_status_to_egress": False,
"store_document": True,
}
@@ -56,7 +57,9 @@ def ensure_variant_policies_for_profile(
*,
action_rows: Iterable[CommandAction] | None = None,
) -> dict[str, CommandVariantPolicy]:
actions = list(action_rows) if action_rows is not None else list(profile.actions.all())
actions = (
list(action_rows) if action_rows is not None else list(profile.actions.all())
)
post_result_enabled = any(
row.action_type == "post_result" and bool(row.enabled) for row in actions
)
@@ -91,7 +94,9 @@ def ensure_variant_policies_for_profile(
return result
def load_variant_policy(profile: CommandProfile, variant_key: str) -> CommandVariantPolicy | None:
def load_variant_policy(
profile: CommandProfile, variant_key: str
) -> CommandVariantPolicy | None:
key = str(variant_key or "").strip()
if not key:
return None