MCPcopy Create free account
hub / github.com/commandoperator/cmdop-sdk / #startReader

Method #startReader

node/src/transport.ts:179–194  ·  view source on GitHub ↗

* Reader: `sizeDelimitedDecodeStream` consumes the stdout (an * `AsyncIterable `) and yields fully-assembled Envelopes, * reassembling frames split across chunk boundaries for us.

(stdout: Readable)

Source from the content-addressed store, hash-verified

177 } else if (envelope.kind === Envelope_Kind.DONE) {
178 this.#pending.delete(envelope.id);
179 pending.queue.push(envelope);
180 pending.queue.end();
181 } else if (envelope.kind === Envelope_Kind.ERROR && envelope.payload.case === "error") {
182 this.#pending.delete(envelope.id);
183 pending.queue.fail(mapCoreError(envelope.payload.value));
184 }
185 }
186
187 #failAll(error: Error): void {
188 const pending = this.#pending;
189 this.#pending = new Map();
190 for (const call of pending.values()) {
191 if (call.kind === "unary") {
192 clearTimeout(call.timer);
193 call.reject(error);
194 } else {
195 call.queue.fail(error);
196 }
197 }

Callers 2

attachStreamsForTestMethod · 0.95
#spawnMethod · 0.95

Calls 2

#dispatchMethod · 0.95
#failAllMethod · 0.95

Tested by

no test coverage detected