MCPcopy Create free account
hub / github.com/Noumena-Network/code / _read_stdin

Function _read_stdin

src/tools/REPLTool/kernel.py:144–168  ·  view source on GitHub ↗
(exec_queue)

Source from the content-addressed store, hash-verified

142
143
144async def _read_stdin(exec_queue):
145 loop = asyncio.get_running_loop()
146 while True:
147 line = await loop.run_in_executor(None, sys.stdin.readline)
148 if line == "":
149 await exec_queue.put(None)
150 return
151
152 line = line.strip()
153 if not line:
154 continue
155
156 try:
157 message = json.loads(line)
158 except Exception:
159 continue
160
161 msg_type = message.get("type")
162 if msg_type == "exec":
163 await exec_queue.put(message)
164 elif msg_type == "run_tool_result":
165 tool_id = message.get("id")
166 future = pending_tool.pop(tool_id, None)
167 if future and not future.done():
168 future.set_result(message)
169
170
171async def _main():

Callers 1

_mainFunction · 0.70

Calls 2

doneMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected