Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ async def _eval_with_semaphore(item):
eval_metrics[f"eval/pass_rate_{cat_key}"] = cat_pass_rate

# Store metrics for wandb_log
self.eval_metrics = [(k, v) for k, v in eval_metrics.items()]
self.eval_metrics = list(eval_metrics.items())

# ---- Print summary ----
print(f"\n{'='*60}")
Expand Down
2 changes: 1 addition & 1 deletion environments/benchmarks/yc_bench/yc_bench_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ def emit(self, record):
eval_metrics[f"eval/survival_rate_{key}"] = ps / pt if pt else 0
eval_metrics[f"eval/avg_score_{key}"] = pa

self.eval_metrics = [(k, v) for k, v in eval_metrics.items()]
self.eval_metrics = list(eval_metrics.items())

# --- Print summary ---
print(f"\n{'='*60}")
Expand Down
2 changes: 1 addition & 1 deletion gateway/platforms/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -3724,7 +3724,7 @@ async def create_handoff_thread(
return None

# DMs, voice channels, and existing threads can't host child threads.
if isinstance(parent, getattr(discord, "DMChannel", tuple())):
if isinstance(parent, getattr(discord, "DMChannel", ())):
logger.info(
"[%s] Handoff thread: parent %s is a DM; threads not supported here",
self.name, parent_chat_id,
Expand Down
4 changes: 2 additions & 2 deletions gateway/platforms/feishu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,8 @@ def _load_settings(extra: Dict[str, Any]) -> FeishuAdapterSettings:
per_chat_require_mention = _to_boolean(rule_cfg.get("require_mention"))
group_rules[str(chat_id)] = FeishuGroupRule(
policy=str(rule_cfg.get("policy", "open")).strip().lower(),
allowlist=set(str(u).strip() for u in rule_cfg.get("allowlist", []) if str(u).strip()),
blacklist=set(str(u).strip() for u in rule_cfg.get("blacklist", []) if str(u).strip()),
allowlist={str(u).strip() for u in rule_cfg.get("allowlist", []) if str(u).strip()},
blacklist={str(u).strip() for u in rule_cfg.get("blacklist", []) if str(u).strip()},
require_mention=per_chat_require_mention,
)

Expand Down
2 changes: 1 addition & 1 deletion gateway/platforms/feishu_comment_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _load_pairing_approved() -> set:
if isinstance(approved, dict):
return set(approved.keys())
if isinstance(approved, list):
return set(str(u) for u in approved if u)
return {str(u) for u in approved if u}
return set()


Expand Down
2 changes: 1 addition & 1 deletion gateway/platforms/telegram_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TelegramFallbackTransport(httpx.AsyncBaseTransport):
"""

def __init__(self, fallback_ips: Iterable[str], **transport_kwargs):
self._fallback_ips = [ip for ip in dict.fromkeys(_normalize_fallback_ips(fallback_ips))]
self._fallback_ips = list(dict.fromkeys(_normalize_fallback_ips(fallback_ips)))
proxy_url = _resolve_proxy_url(target_hosts=[_TELEGRAM_API_HOST, *self._fallback_ips])
if proxy_url and "proxy" not in transport_kwargs:
transport_kwargs["proxy"] = proxy_url
Expand Down
2 changes: 1 addition & 1 deletion hermes_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,7 @@ def _do(conn):
"SELECT id FROM sessions WHERE started_at < ? AND ended_at IS NOT NULL",
(cutoff,),
)
session_ids = set(row["id"] for row in cursor.fetchall())
session_ids = {row["id"] for row in cursor.fetchall()}

if not session_ids:
return 0
Expand Down
2 changes: 1 addition & 1 deletion scripts/profile-tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def key_metrics(data: dict[str, Any]) -> dict[str, float]:
metrics["backpressure_frames"] = bp

if react:
for pid in set(e["id"] for e in react):
for pid in {e["id"] for e in react}:
ms = [e["actualMs"] for e in react if e["id"] == pid]
metrics[f"react_{pid}_p99"] = pct(ms, 0.99)
metrics[f"react_{pid}_max"] = max(ms)
Expand Down
2 changes: 1 addition & 1 deletion scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ def main():
print(f" SemVer: v{current_version} → v{new_version}")
print(f" Previous tag: {prev_tag or '(none — first release)'}")
print(f" Commits: {len(commits)}")
print(f" Unique authors: {len(set(c['github_author'] for c in commits))}")
print(f" Unique authors: {len({c['github_author'] for c in commits})}")
print(f" Mode: {'PUBLISH' if args.publish else 'DRY RUN'}")
print(f"{'='*60}")
print()
Expand Down
4 changes: 2 additions & 2 deletions tools/memory_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def replace(self, target: str, old_text: str, new_content: str) -> Dict[str, Any

if len(matches) > 1:
# If all matches are identical (exact duplicates), operate on the first one
unique_texts = set(e for _, e in matches)
unique_texts = {e for _, e in matches}
if len(unique_texts) > 1:
previews = [e[:80] + ("..." if len(e) > 80 else "") for _, e in matches]
return {
Expand Down Expand Up @@ -341,7 +341,7 @@ def remove(self, target: str, old_text: str) -> Dict[str, Any]:

if len(matches) > 1:
# If all matches are identical (exact duplicates), remove the first one
unique_texts = set(e for _, e in matches)
unique_texts = {e for _, e in matches}
if len(unique_texts) > 1:
previews = [e[:80] + ("..." if len(e) > 80 else "") for _, e in matches]
return {
Expand Down
3 changes: 2 additions & 1 deletion tools/mixture_of_agents_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from tools.openrouter_client import get_async_client as _get_openrouter_client, check_api_key as check_openrouter_api_key
from agent.auxiliary_client import extract_content_or_reasoning
from tools.debug_helpers import DebugSession
import sys

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -451,7 +452,7 @@ def get_moa_configuration() -> Dict[str, Any]:
print("❌ OPENROUTER_API_KEY environment variable not set")
print("Please set your API key: export OPENROUTER_API_KEY='your-key-here'")
print("Get API key at: https://openrouter.ai/")
exit(1)
sys.exit(1)
else:
print("✅ OpenRouter API key found")

Expand Down
2 changes: 1 addition & 1 deletion tools/skills_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,5 +928,5 @@ def _build_summary(name: str, source: str, trust: str, verdict: str, findings: L
if not findings:
return f"{name}: clean scan, no threats detected"

categories = set(f.category for f in findings)
categories = {f.category for f in findings}
return f"{name}: {verdict} — {len(findings)} finding(s) in {', '.join(sorted(categories))}"
2 changes: 1 addition & 1 deletion tools/skills_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def reset_bundled_skill(name: str, restore: bool = False) -> dict:
manifest = _read_manifest()
bundled_dir = _get_bundled_dir()
bundled_skills = _discover_bundled_skills(bundled_dir)
bundled_by_name = {skill_name: skill_dir for skill_name, skill_dir in bundled_skills}
bundled_by_name = dict(bundled_skills)

in_manifest = name in manifest
is_bundled = name in bundled_by_name
Expand Down
2 changes: 1 addition & 1 deletion tools/skills_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ def skills_list(category: str = None, task_id: str = None) -> str:

# Extract unique categories
categories = sorted(
set(s.get("category") for s in all_skills if s.get("category"))
{s.get("category") for s in all_skills if s.get("category")}
)

return json.dumps(
Expand Down
3 changes: 2 additions & 1 deletion tools/terminal_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ def _transform_sudo_command(command: str | None) -> tuple[str | None, str | None
from tools.environments.modal import ModalEnvironment as _ModalEnvironment
from tools.environments.managed_modal import ManagedModalEnvironment as _ManagedModalEnvironment
from tools.managed_tool_gateway import is_managed_tool_gateway_ready
import sys


# Tool description for LLM
Expand Down Expand Up @@ -2243,7 +2244,7 @@ def check_terminal_requirements() -> bool:

if not check_terminal_requirements():
print("\n❌ Requirements not met. Please check the messages above.")
exit(1)
sys.exit(1)

print("\n✅ All requirements met!")
print("\nAvailable Tool:")
Expand Down
14 changes: 7 additions & 7 deletions tools/tts_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,13 +848,13 @@ def _generate_openai_tts(text: str, output_path: str, tts_config: Dict[str, Any]
OpenAIClient = _import_openai_client()
client = OpenAIClient(api_key=api_key, base_url=base_url)
try:
create_kwargs = dict(
model=model,
voice=voice,
input=text,
response_format=response_format,
extra_headers={"x-idempotency-key": str(uuid.uuid4())},
)
create_kwargs = {
"model": model,
"voice": voice,
"input": text,
"response_format": response_format,
"extra_headers": {"x-idempotency-key": str(uuid.uuid4())},
}
if speed != 1.0:
create_kwargs["speed"] = max(0.25, min(4.0, speed))
response = client.audio.speech.create(**create_kwargs)
Expand Down
3 changes: 2 additions & 1 deletion tools/vision_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from hermes_constants import get_hermes_dir
from tools.debug_helpers import DebugSession
from tools.website_policy import check_website_access
import sys

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -937,7 +938,7 @@ def check_vision_requirements() -> bool:
if not api_available:
print("❌ No auxiliary vision model available")
print("Configure a supported multimodal backend (OpenRouter, Nous, Codex, Anthropic, or a custom OpenAI-compatible endpoint).")
exit(1)
sys.exit(1)
else:
print("✅ Vision model available")

Expand Down
3 changes: 2 additions & 1 deletion tools/web_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def __repr__(self):
from tools.tool_backend_helpers import managed_nous_tools_enabled, prefers_gateway
from tools.url_safety import is_safe_url
from tools.website_policy import check_website_access
import sys

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -2153,7 +2154,7 @@ def check_auxiliary_model() -> bool:
print(f"✅ Auxiliary model available: {default_summarizer_model}")

if not web_available:
exit(1)
sys.exit(1)

print("🛠️ Web tools ready for use!")

Expand Down
20 changes: 10 additions & 10 deletions tui_gateway/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1624,27 +1624,27 @@ def _on_tool_progress(


def _agent_cbs(sid: str) -> dict:
return dict(
tool_start_callback=lambda tc_id, name, args: _on_tool_start(
return {
"tool_start_callback": lambda tc_id, name, args: _on_tool_start(
sid, tc_id, name, args
),
tool_complete_callback=lambda tc_id, name, args, result: _on_tool_complete(
"tool_complete_callback": lambda tc_id, name, args, result: _on_tool_complete(
sid, tc_id, name, args, result
),
tool_progress_callback=lambda event_type, name=None, preview=None, args=None, **kwargs: _on_tool_progress(
"tool_progress_callback": lambda event_type, name=None, preview=None, args=None, **kwargs: _on_tool_progress(
sid, event_type, name, preview, args, **kwargs
),
tool_gen_callback=lambda name: _tool_progress_enabled(sid)
"tool_gen_callback": lambda name: _tool_progress_enabled(sid)
and _emit("tool.generating", sid, {"name": name}),
thinking_callback=lambda text: _emit("thinking.delta", sid, {"text": text}),
reasoning_callback=lambda text: _emit("reasoning.delta", sid, {"text": text}),
status_callback=lambda kind, text=None: _status_update(
"thinking_callback": lambda text: _emit("thinking.delta", sid, {"text": text}),
"reasoning_callback": lambda text: _emit("reasoning.delta", sid, {"text": text}),
"status_callback": lambda kind, text=None: _status_update(
sid, str(kind), None if text is None else str(text)
),
clarify_callback=lambda q, c: _block(
"clarify_callback": lambda q, c: _block(
"clarify.request", sid, {"question": q, "choices": c}
),
)
}


def _wire_callbacks(sid: str):
Expand Down
Loading