MCPcopy Create free account
hub / github.com/cloudflare/computer / encodeExecEvents

Function encodeExecEvents

packages/computer/src/exec-wire.ts:90–100  ·  view source on GitHub ↗
(
  events: ReadableStream<WorkspaceExecEvent<ExecEncoding>>,
)

Source from the content-addressed store, hash-verified

88
89// Frame a stream of exec events as JSONL bytes for the wire.
90export function encodeExecEvents(
91 events: ReadableStream<WorkspaceExecEvent<ExecEncoding>>,
92): ReadableStream<Uint8Array> {
93 return events.pipeThrough(
94 new TransformStream<WorkspaceExecEvent<ExecEncoding>, Uint8Array>({
95 transform(event, controller) {
96 controller.enqueue(encodeExecEvent(event));
97 },
98 }),
99 );
100}
101
102// Parse a JSONL byte stream from the wire back into exec events.
103// Buffers partial lines so a chunk boundary can fall anywhere.

Callers 2

roundTripFunction · 0.85
exec-wire.test.tsFile · 0.85

Calls 1

pipeThroughMethod · 0.65

Tested by 1

roundTripFunction · 0.68