Skip to content

Commit 9aa21fe

Browse files
committed
✨ enhanced intelligence
1 parent 2bdf70d commit 9aa21fe

File tree

6 files changed

+317
-15
lines changed

6 files changed

+317
-15
lines changed

src/agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,12 @@ def chat(self, user_input: str, _retry_count: int = 0) -> str:
973973
display_warning(f"API error detected. Retrying... (attempt {_retry_count + 1}/3)")
974974
return self.chat(user_input, _retry_count=_retry_count + 1)
975975

976+
# Handle parsing errors from GPT-OSS and similar models
977+
if "parsing failed" in error_str.lower() or "could not be parsed" in error_str.lower():
978+
log_debug(f"Model parsing error detected, retrying...")
979+
display_warning(f"Model output parsing error. Retrying... (attempt {_retry_count + 1}/3)")
980+
return self.chat(user_input, _retry_count=_retry_count + 1)
981+
976982
# For other transient errors, simple retry with backoff
977983
if any(err_type in error_str.lower() for err_type in [
978984
"connection", "timeout", "temporary", "unavailable",

src/command_handler.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,63 @@ def _execute_command(self, command: Command, args: str) -> Tuple[bool, Optional[
792792

793793
return True, None
794794

795+
elif name == "domain":
796+
from .web_tools import get_url_verifier
797+
798+
verifier = get_url_verifier()
799+
parts = args.strip().split() if args else []
800+
subcommand = parts[0].lower() if parts else "list"
801+
802+
if subcommand == "list":
803+
# Show all domain decisions
804+
rejected = verifier.get_rejected_domains()
805+
accepted = verifier.get_accepted_domains()
806+
807+
console.print(f"\n[bold {COLORS['secondary']}]Domain Security Decisions[/]\n")
808+
809+
if rejected:
810+
console.print(f"[bold red]Blocked Domains ({len(rejected)}):[/]")
811+
for domain in rejected:
812+
console.print(f" [red]✗[/] {domain}")
813+
console.print()
814+
815+
if accepted:
816+
console.print(f"[bold yellow]Allowed Domains ({len(accepted)}):[/]")
817+
for domain in accepted:
818+
console.print(f" [yellow]![/] {domain} [dim](proceed at risk)[/]")
819+
console.print()
820+
821+
if not rejected and not accepted:
822+
console.print(f" [{COLORS['muted']}]No domain decisions recorded yet.[/]\n")
823+
824+
console.print(f"[{COLORS['muted']}]Commands:[/]")
825+
console.print(f" /domain allow <domain> - Allow access to a blocked domain")
826+
console.print(f" /domain block <domain> - Block access to an allowed domain")
827+
console.print(f" /domain reset <domain> - Remove decision (will ask again)")
828+
console.print()
829+
830+
elif subcommand == "allow" and len(parts) >= 2:
831+
domain = parts[1].lower()
832+
verifier.allow_domain(domain)
833+
display_success(f"Domain '{domain}' is now allowed")
834+
835+
elif subcommand == "block" and len(parts) >= 2:
836+
domain = parts[1].lower()
837+
verifier.block_domain(domain)
838+
display_success(f"Domain '{domain}' is now blocked")
839+
840+
elif subcommand == "reset" and len(parts) >= 2:
841+
domain = parts[1].lower()
842+
if verifier.remove_domain_decision(domain):
843+
display_success(f"Decision for '{domain}' has been reset")
844+
else:
845+
display_warning(f"No decision found for '{domain}'")
846+
847+
else:
848+
display_error("Usage: /domain [list|allow <domain>|block <domain>|reset <domain>]")
849+
850+
return True, None
851+
795852
elif name == "getapikey":
796853
from .lib.providers import (
797854
API_KEY_PROVIDERS, PROVIDERS, get_provider,

src/commands.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ def __post_init__(self):
266266
arg_hint="on|off|status",
267267
aliases=["url-verify"]
268268
),
269+
"domain": Command(
270+
name="domain",
271+
description="Manage blocked/allowed domains for URL verification",
272+
category=CommandCategory.PROVIDERS,
273+
usage="/domain [list|allow <domain>|block <domain>|reset <domain>]",
274+
has_args=True,
275+
arg_hint="action"
276+
),
269277

270278
# History Commands
271279
"resume": Command(

src/lib/providers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ProviderInfo:
7272
id="dymo",
7373
name="Dymo API",
7474
description="URL/Domain verification and fraud detection",
75-
api_key_url="https://tpeoficial.com/p/dymo-api",
75+
api_key_url="https://tpe.li/new-api-key",
7676
env_key="DYMO_API_KEY",
7777
provides_ai=False
7878
)

0 commit comments

Comments
 (0)