stage.py:
- Add StageProcessResult type alias for better type checking
- Change process method signature for better compatibility
respond/stage.py & result_decorate/stage.py:
- Improve type annotations and code structure
content_safety_check/stage.py:
- Add better type handling
agent_sub_stages (internal.py, third_party.py):
- Improve type annotations for better code quality
Other pipeline stages:
- Minor improvements to type annotations
message.py:
- Use TypeGuard for type narrowing instead of isinstance checks
- Improve type annotations for ContentPart validation
- Add type annotations for content part registry
mcp_client.py:
- Improve type annotations and code quality
runners (base, dashscope, deerflow, dify, tool_loop):
- Add/improve type annotations
- Clean up code structure
tool.py & tool_image_cache.py:
- Improve type annotations
entities.py:
- Improve assemble_context return type annotation
- Add explicit type annotations for content_blocks
- Add safety checks for text content extraction
provider.py:
- Improve type annotations throughout
- Clean up code structure
Various source providers:
- Add/improve type annotations in anthropic, azure_tts, gemini, volcengine_tts, etc.
- Improve code quality in whisper and xinference providers
- Remove redundant session: AsyncSession type comments in sqlite.py
- Add type annotations to shared_preferences_v3.py migration
- Improve vec_db implementations with better type hints
- Add __init__.py marker for db package
alter_cmd.py:
- Add explicit type annotations for alter_cmd_cfg
- Rename variables for clarity (scene_num -> scene_index, cmd_type -> permission_type)
- Add validation for permission_type parameter
conversation.py:
- Add type annotations and improve command handling
persona.py:
- Clean up type annotations
provider.py:
- Add type annotations and improve provider command handling
setunset.py:
- Add type annotations for configuration operations
- Use ComponentType enum instead of string literals for component types
- Add type annotations for discord button declarations
- Clean up unnecessary code in various platform adapters
- Add type guard function for str-keyed dicts
- Add I18nGroup TypedDict for better type checking
- Replace isinstance checks with TypeGuard-based validation
- Improve type annotations throughout
command_parser.py:
- Add explicit type annotations for tokens list and return type
config_number.py:
- Handle float to int conversion explicitly
- Simplify type checking logic
file_extract.py:
- Add type annotations and improve file extraction handling
io.py:
- Add type annotations for I/O operations
log_pipe.py:
- Implement TextIO interface for better compatibility
- Add comprehensive type annotations
- Add callback support and identifier logging
session_waiter.py:
- Clean up type annotations
* fix(agent): improve send_message_to_user tool description to prevent misuse
Fixes#6402
The AI was inappropriately using send_message_to_user tool in normal
conversations for text replies, causing duplicate messages (once via tool,
once via normal response).
Root cause: Tool description was not clear enough about when to use it.
Changes:
- Restructure description with clear sections using markdown
- Emphasize two valid use cases:
1. Sending media files (image, record, video, file) in any conversation
2. Proactive messaging scenarios (cron jobs, background tasks)
- Add explicit warning: Do NOT use for normal text replies
- Explain consequence: Using for text causes duplicate messages
This approach (better documentation) is safer than restricting tool
registration, which would break media file sending in normal conversations.
Alternative to PR #6413 which was closed due to breaking media delivery.
* fix: correct syntax error and use triple-quoted string for description
Address review feedback:
- P0: Add missing closing parenthesis (was causing SyntaxError on import)
- Use triple-quoted string for better readability (suggested by gemini-code-assist)
- Remove explicit newline characters, let Python handle line breaks
---------
Co-authored-by: ccsang <ccsang@users.noreply.github.com>
* perf: enhance layout responsiveness and text handling in stats page
* perf: enhance subagent, future task UI
- Updated the overall structure of the SubAgentPage component for better readability and maintainability.
- Introduced a new dashboard layout with improved header and action buttons.
- Replaced the old settings card with a more visually appealing setting card design.
- Enhanced the agent list section with a more user-friendly display and added empty state handling.
- Implemented unsaved changes notification and confirmation dialogs for better user interaction.
- Refactored code for better clarity and organization, including the use of computed properties for state management.
- tool_loop_agent_runner.py: add wrapper coroutine for create_task
- tool_image_cache.py: add cast for Self return type
- astr_agent_tool_exec.py: add type ignore for add_tool
- astr_main_agent.py: add type ignores for tool operations
- astr_main_agent_resources.py: add type ignore for msg_dict
- astrbot_config_mgr.py: add type annotations
- MCPTool_T must be imported at runtime, not in TYPE_CHECKING
- Add __future__ annotations for forward references
- Fix remaining conflict markers in openai_source.py
* fix: send SSE heartbeat to prevent WebChat disconnect during compression
When context compression triggers with slow reasoning models (e.g.
deepseek-reasoner), the backend can go 30+ seconds without pushing any
SSE data. The client-side EventSource / browser then assumes the
connection is dead and disconnects, causing the WebUI to hang
indefinitely since it never receives the eventual response.
Fix: yield an SSE comment (`: heartbeat`) on every empty poll cycle.
Comment lines are defined in the SSE spec as keep-alive signals --
the EventSource API ignores them but the HTTP connection stays open.
Fixes#6938
* chore(dashboard): extract SSE heartbeat to constant
---------
Co-authored-by: Yufeng He <40085740+universeplayer@users.noreply.github.com>
Co-authored-by: RC-CHN <1051989940@qq.com>
- TraceDisplayer: new timeline-style layout with vertical track, dot markers, and expandable event cards
- TracePage: redesigned topbar with custom toggle switch, removed scoped CSS conflicts
- All colors use explicit hex values with !important to ensure visibility across themes
- Vue 3 Composition API with shallowRef to avoid reactive overhead
Root cause: invalid CSS var --v-theme-primaryText resolved to white,
making text invisible against transparent background.
Fix: add global (non-scoped) <style> block with !important color
overrides and explicit dark background for trace table elements.
Also changed .trace-table background from transparent to
var(--v-theme-surface) for proper dark theme support.