MCPcopy Index your code
hub / github.com/github/copilot-sdk / watch_event

Function watch_event

python/samples/manual_tool_resume.py:19–29  ·  view source on GitHub ↗
(session, data_type: type[T], predicate=None)

Source from the content-addressed store, hash-verified

17
18
19def watch_event(session, data_type: type[T], predicate=None) -> asyncio.Future:
20 loop = asyncio.get_running_loop()
21 future = loop.create_future()
22
23 def on_event(event):
24 if isinstance(event.data, data_type) and (predicate is None or predicate(event.data)):
25 unsubscribe()
26 future.set_result(event)
27
28 unsubscribe = session.on(on_event)
29 return future
30
31
32async def wait_for_event(future: asyncio.Future) -> SessionEvent:

Callers 1

mainFunction · 0.85

Calls 1

onMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…