feat: add session-scoped client tool waits

This commit is contained in:
Xin Wang
2026-07-31 23:53:47 +08:00
parent f155f98e6e
commit ad5ff061bb
10 changed files with 339 additions and 26 deletions

View File

@@ -19,6 +19,7 @@ class ToolRuntimePolicy:
allow_interruptions: bool
execution_mode: str
wait_for_response: bool
response_wait_mode: str
@property
def cancel_on_interruption(self) -> bool:
@@ -38,8 +39,12 @@ def policy_for_tool(tool: RuntimeTool) -> ToolRuntimePolicy:
mode = str(config.get("execution_mode") or default_mode)
if mode not in {"immediate", "async"}:
mode = default_mode
response_wait_mode = str(config.get("response_wait_mode") or "timeout")
if response_wait_mode not in {"timeout", "session"}:
response_wait_mode = "timeout"
return ToolRuntimePolicy(
allow_interruptions=bool(config.get("allow_interruptions", True)),
execution_mode=mode,
wait_for_response=bool(config.get("wait_for_response", True)),
response_wait_mode=response_wait_mode,
)