Implement workspace-scoped conversation storage with legacy migration based on host workspace metadata, active host workspace state protection, and frontend/backend conversation list scoping. Add proactive recent-conversation prompt support with a configurable personal-space limit, frozen per conversation metadata, empty-conversation filtering, and a dedicated prompt template. Add conversation_search and conversation_review tools with readable formatted results, workspace-only access, current-conversation exclusion, multi-keyword search, list mode, message/tool counts, read/save review modes, long-review fallback to .agents/review, and frontend detail renderers. Move internal workspace artifacts under .agents, update upload/skills/compact/review paths, show .agents internal directories in prompt file trees, and adjust versioning ignores. Add create_skill and a Skills tool category, move read_skill into that category, validate and archive skill folders, support host global skills and Docker/API private skills, and sync private skills into .agents/skills and prompts. Update memory stamping with conversation/time source metadata and include frontend icon/status/display updates plus tests for workspace conversation storage and skills management.
95 lines
2.4 KiB
Python
95 lines
2.4 KiB
Python
"""工具类别配置。
|
|
|
|
提供前端和终端公用的工具分组定义,方便按类别控制启用状态。
|
|
"""
|
|
|
|
from typing import Dict, List
|
|
|
|
|
|
class ToolCategory:
|
|
"""工具类别的结构化定义。"""
|
|
|
|
def __init__(
|
|
self,
|
|
label: str,
|
|
tools: List[str],
|
|
default_enabled: bool = True,
|
|
silent_when_disabled: bool = False,
|
|
):
|
|
self.label = label
|
|
self.tools = tools
|
|
self.default_enabled = default_enabled
|
|
self.silent_when_disabled = silent_when_disabled
|
|
|
|
|
|
TOOL_CATEGORIES: Dict[str, ToolCategory] = {
|
|
"network": ToolCategory(
|
|
label="网络检索",
|
|
tools=["web_search", "extract_webpage", "save_webpage"],
|
|
),
|
|
"mcp": ToolCategory(
|
|
label="MCP 工具",
|
|
tools=["list_mcp_servers"],
|
|
),
|
|
"file_edit": ToolCategory(
|
|
label="文件编辑",
|
|
tools=[
|
|
"create_file",
|
|
"write_file",
|
|
"edit_file",
|
|
"delete_file",
|
|
"rename_file",
|
|
"create_folder",
|
|
],
|
|
),
|
|
"read_focus": ToolCategory(
|
|
label="阅读聚焦",
|
|
tools=[
|
|
"read_file",
|
|
"vlm_analyze",
|
|
"ocr_image",
|
|
"view_image",
|
|
],
|
|
),
|
|
"skills": ToolCategory(
|
|
label="Skills",
|
|
tools=["read_skill", "create_skill"],
|
|
),
|
|
"terminal_realtime": ToolCategory(
|
|
label="实时终端",
|
|
tools=[
|
|
"terminal_session",
|
|
"terminal_input",
|
|
"terminal_snapshot",
|
|
"sleep",
|
|
],
|
|
),
|
|
"terminal_command": ToolCategory(
|
|
label="终端指令",
|
|
tools=["run_command", "run_python"],
|
|
),
|
|
"memory": ToolCategory(
|
|
label="记忆",
|
|
tools=["update_memory", "conversation_search", "conversation_review"],
|
|
),
|
|
"todo": ToolCategory(
|
|
label="待办事项",
|
|
tools=["todo_create", "todo_update_task"],
|
|
),
|
|
"sub_agent": ToolCategory(
|
|
label="子智能体",
|
|
tools=["create_sub_agent", "close_sub_agent"],
|
|
),
|
|
"easter_egg": ToolCategory(
|
|
label="彩蛋实验",
|
|
tools=["trigger_easter_egg"],
|
|
default_enabled=False,
|
|
silent_when_disabled=True,
|
|
),
|
|
"personalization": ToolCategory(
|
|
label="个性化设置",
|
|
tools=["manage_personalization"],
|
|
default_enabled=True,
|
|
),
|
|
}
|