Skip to content

Nitpicky updates

Choose a tag to compare

@knoop7 knoop7 released this 10 May 13:17

Thorough /new Cleanup

  • Cancels all running asynchronous tasks and clears Goal Manager active goals when /new is executed.
  • Synchronously cleans up DATA_CHAT_SESSION and DATA_CHAT_LOGS to ensure no residual old session data remains.
  • Removes pending_goal_continuations, completed_goal_conversations, and pipeline continuation flags.
  • Resolves the issue where residual states after /new caused LLM token length errors that previously required a restart to recover.

Accurate Entity Name Display

  • Each AI agent now displays its actual name prefix (e.g., Claw Assistant, Google Generative AI, etc.) when replying.
  • Stops uniformly labeling all agents as "Claw Assistant"; names are now dynamically resolved via the entity registry.

Voice Pipeline TTS Enhancements

TTS Markdown Filtering

  • Added _clean_for_tts: Strips Markdown formatting such as bolding, code blocks, links, images, tables, headers, blockquotes, lists, and dividers.
  • The voice pipeline now only plays plain text, while the frontend chat window retains the original full Markdown.
  • Patched the non-streaming path in PipelineRun.text_to_speech to ensure consistent filtering.

Voice Channel System Prompt Injection

  • Automatically injects prompts into the voice pipeline to guide the AI to reply in a conversational/spoken style.
  • Explicitly instructs the AI that "the user is listening, not reading," and strictly forbids the output of Markdown/URLs.
  • Comprehensively expanded prompts across three channels: HA Frontend, IM Bot, and Voice Pipeline.

API Call Timeout Protection & Context Restoration

120-Second Hard Timeout

  • Wrapped LLM API calls in orchestrator and turn_kernel with asyncio.wait_for(timeout=120).
  • Graceful degradation after timeout: Generates a summary reply based on completed steps instead of hanging indefinitely.

Orphaned tool_call Fix (sanitize_tool_pairs)

  • Added sanitize_tool_pairs: Detects orphaned tool_calls (without a corresponding tool_result) in the chat history and automatically appends placeholder results.
  • Automatically executed before API calls in agent_fallback and turn_kernel.
  • Synchronously executed during context overflow retries to prevent continuous failures caused by formatting errors.
  • Added "tool_calls" and "must be followed by" as retryable error keywords in agent_fallback; automatically retries instead of failing directly when encountering orphaned tool_call errors.

Significant Frontend Tool Enhancements

FrontendInspect Tool Refactoring

  • Added search_cache action: Automatically caches the full text after executing exec_js on large pages, enabling precise content locating via keyword searches.
  • Added press_key action: Supports keyboard operations like Enter, Escape, Tab, and arrow keys.
  • Completely rewrote tool descriptions: Clarified DOM traversal chains, collaboration workflows with the DashboardCard tool, and user intent examples.
  • snapshot deep traversal optimization: Added a node count limit to prevent DOM explosion, and automatically collapses pass-through nodes.
  • snapshot automatic entity state extraction: entity_id bound to cards directly displays inline state, unit, and friendly_name.
  • snapshot automatically captures the sidebar navigation list and the content of opened pop-ups/dialogs.
  • Leaf nodes automatically extract innerText, eliminating the need for additional exec_js to read plain text content.

Pop-up/Dialog Observer

  • Added setupDialogObserver to ha_crack.js: Uses MutationObserver to listen for pop-ups opening within the HA Shadow DOM.
  • Automatically captures pop-up titles, subtitles, form fields (including label/value/options), and button lists.
  • Reports to the backend via the ha_crack/dialog_snapshot WebSocket command, allowing AI to directly read and interact with pop-ups.

DashboardCard Tool Improvements

  • Automatically triggers the lovelace_updated event after saving dashboard configurations.
  • Uses queue_frontend_exec to achieve frontend SPA seamless (refresh-free) navigation to the modified page.

Frontend Text Cache

  • Added store_frontend_text_cache / search_frontend_text_cache: Automatically caches large amounts of text returned by exec_js.
  • AI can subsequently search cached content via keywords, avoiding repeated JS scraping executions.

Continuous Dialogue Switch Refresh

  • When toggling the "Continuous Chat Window" setting, the backend automatically performs a complete state cleanup.

Auto-Update Detection & GitHub Proxy Acceleration

Automatic Version Detection

  • Delays checking until HACS finishes loading after startup, then polls GitHub every 2 hours for new versions.
  • GitHub API requests prioritize the gh-proxy.org proxy, automatically falling back to a direct connection upon failure.
  • When a new version is detected, it directly updates HACS repository metadata, triggering the update entity to display "Update available".

Search Tool Description Optimization

  • WebSearch: Clearly marked as "Keyword search, not for scraping specific URLs" to guide AI in distinguishing between searching and scraping.
  • UrlFetch: Emphasized that "when the user provides a clear URL/link, this tool must be used directly instead of WebSearch."

Web Scraping Improvements

  • web_fetcher 4xx fast-fail: Directly throws an exception for HTTP 400-499 status codes, no longer pointlessly retrying non-existent pages.

Other Improvements

  • ha_crack.js hot update: Automatically triggers location.reload() when a JS version change is detected, removing the need to manually clear the cache.
  • **Unified frontend JS version with const.py**: frontend_loader no longer hardcodes the version and directly references VERSION.
  • Tool progress text optimization: "Thinking" -> "Deep reasoning in progress"; "Reading" -> "Accessing"; WebSearch now identifies URL-type queries and displays the domain name.

Full Changelog: [https://github.com/ha-china/ha_claw/compare/v7.7.0...v7.8.0]