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

Function _read_stdin

rust/py_repl_host/assets/kernel.py:152–176  ·  view source on GitHub ↗
(exec_queue)

Source from the content-addressed store, hash-verified

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

Callers 1

_mainFunction · 0.70

Calls 2

doneMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected