ref:重构maisaka内置工具逻辑,拆分文件

This commit is contained in:
SengokuCola
2026-04-03 14:51:05 +08:00
parent 6e6aa0b13a
commit 6c720e0403
19 changed files with 1075 additions and 2384 deletions

View File

@@ -0,0 +1,34 @@
"""no_reply 内置工具。"""
from typing import Optional
from src.core.tooling import ToolExecutionContext, ToolExecutionResult, ToolInvocation, ToolSpec
from .context import BuiltinToolRuntimeContext
def get_tool_spec() -> ToolSpec:
"""获取 no_reply 工具声明。"""
return ToolSpec(
name="no_reply",
brief_description="本轮不进行回复,等待其他用户的新消息。",
provider_name="maisaka_builtin",
provider_type="builtin",
)
async def handle_tool(
tool_ctx: BuiltinToolRuntimeContext,
invocation: ToolInvocation,
context: Optional[ToolExecutionContext] = None,
) -> ToolExecutionResult:
"""执行 no_reply 内置工具。"""
del context
tool_ctx.runtime._enter_stop_state()
return tool_ctx.build_success_result(
invocation.tool_name,
"当前对话循环已暂停,等待新消息到来。",
metadata={"pause_execution": True},
)