fix: correct typo in user authentication error message for invalid credentials
This commit is contained in:
+11
-5
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import contextvars
|
||||
import json
|
||||
import random
|
||||
from datetime import datetime
|
||||
@@ -65,15 +66,16 @@ SWARM_TOOLS = (
|
||||
)
|
||||
SEVERITIES = ("error", "warning", "info")
|
||||
|
||||
_FINDINGS: list[dict[str, Any]] = []
|
||||
_findings_var: contextvars.ContextVar[Optional[list]] = contextvars.ContextVar("findings", default=None)
|
||||
|
||||
|
||||
def reset_findings() -> None:
|
||||
_FINDINGS.clear()
|
||||
_findings_var.set([])
|
||||
|
||||
|
||||
def findings() -> list[dict[str, Any]]:
|
||||
return list(_FINDINGS)
|
||||
current = _findings_var.get()
|
||||
return list(current) if current is not None else []
|
||||
|
||||
|
||||
@tool
|
||||
@@ -98,7 +100,11 @@ async def report_finding(
|
||||
fix_summary: One line describing the fix when fixed is true.
|
||||
"""
|
||||
severity_value = severity if severity in SEVERITIES else "warning"
|
||||
_FINDINGS.append(
|
||||
current = _findings_var.get()
|
||||
if current is None:
|
||||
current = []
|
||||
_findings_var.set(current)
|
||||
current.append(
|
||||
{
|
||||
"severity": severity_value,
|
||||
"dimension": dimension,
|
||||
@@ -110,7 +116,7 @@ async def report_finding(
|
||||
"fix_summary": fix_summary,
|
||||
}
|
||||
)
|
||||
return json.dumps({"status": "success", "recorded": True, "total_findings": len(_FINDINGS)})
|
||||
return json.dumps({"status": "success", "recorded": True, "total_findings": len(current)})
|
||||
|
||||
|
||||
WORKER_READ_TOOLS = (
|
||||
|
||||
Reference in New Issue
Block a user