chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"""boom_async fixture tool (always raises, to exercise the async failure path)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from omnigent_client.tools import tool
|
||||
|
||||
|
||||
@tool
|
||||
def boom_async() -> str:
|
||||
"""
|
||||
Always raise so the failure path of the async pipeline is exercised.
|
||||
|
||||
:raises RuntimeError: Always, with message ``ASYNC_TOOL_BOOM_MARKER``.
|
||||
:returns: Never returns normally.
|
||||
"""
|
||||
raise RuntimeError("ASYNC_TOOL_BOOM_MARKER")
|
||||
@@ -0,0 +1,16 @@
|
||||
"""count_chars fixture tool (sync; returns character count)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from omnigent_client.tools import tool
|
||||
|
||||
|
||||
@tool
|
||||
def count_chars(text: str) -> int:
|
||||
"""
|
||||
Return the literal character count of ``text``.
|
||||
|
||||
:param text: Text to measure, e.g. ``"abc"``.
|
||||
:returns: Length of ``text``, e.g. ``3``.
|
||||
"""
|
||||
return len(text)
|
||||
@@ -0,0 +1,23 @@
|
||||
"""delayed_echo fixture tool (slow; exercises async dispatch ↔ auto-delivery)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
|
||||
from omnigent_client.tools import tool
|
||||
|
||||
|
||||
@tool
|
||||
def delayed_echo(label: str) -> str:
|
||||
"""
|
||||
Sleep 2s, then echo ``label`` inside an unambiguous marker.
|
||||
|
||||
The delay makes the dispatch -> auto-delivery sequence observable as
|
||||
distinct events; the marker is a distinctive substring so e2e
|
||||
assertions like ``"ECHO_FROM_ASYNC[..." in final_text`` are unambiguous.
|
||||
|
||||
:param label: Text to echo back, e.g. ``"alpha"``.
|
||||
:returns: ``f"ECHO_FROM_ASYNC[{label}]"``.
|
||||
"""
|
||||
time.sleep(2)
|
||||
return f"ECHO_FROM_ASYNC[{label}]"
|
||||
Reference in New Issue
Block a user