MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / write

Method write

src/cli_core/structured_io.py:189–196  ·  view source on GitHub ↗
(self, event: HeadlessEvent | dict[str, Any])

Source from the content-addressed store, hash-verified

187 self._stream = stream if stream is not None else sys.stdout
188
189 def write(self, event: HeadlessEvent | dict[str, Any]) -> None:
190 payload = event.to_dict() if isinstance(event, HeadlessEvent) else dict(event)
191 line = ndjson_safe_dumps(payload)
192 self._stream.write(line + "\n")
193 try:
194 self._stream.flush()
195 except Exception:
196 pass
197
198 def write_many(self, events: Iterable[HeadlessEvent | dict[str, Any]]) -> None:
199 for event in events:

Calls 3

ndjson_safe_dumpsFunction · 0.85
to_dictMethod · 0.45
flushMethod · 0.45