MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / recordBlock

Method recordBlock

e2e/cloud/mcp-sse-replay.test.ts:179–198  ·  view source on GitHub ↗
(block: string)

Source from the content-addressed store, hash-verified

177 }
178
179 private recordBlock(block: string): void {
180 let data = "";
181 let id: string | null = null;
182 for (const line of block.replace(/\r/g, "").split("\n")) {
183 if (line.startsWith("data:")) data += `${line.slice("data:".length).trimStart()}\n`;
184 if (line.startsWith("id:")) id = line.slice("id:".length).trim();
185 }
186 if (id) this.eventIds.push(id);
187 const trimmed = data.trim();
188 if (!trimmed) return;
189 const parsed = JSON.parse(trimmed) as JsonRpcMessage;
190 this.messages.push(parsed);
191 if (typeof parsed.id !== "string" && typeof parsed.id !== "number") return;
192 const responseWaiters = this.responseWaiters;
193 this.responseWaiters = [];
194 for (const waiter of responseWaiters) waiter.resolve(parsed);
195 const waiters = this.waiters.get(parsed.id) ?? [];
196 this.waiters.delete(parsed.id);
197 for (const waiter of waiters) waiter.resolve(parsed);
198 }
199}
200
201const openGet = async (

Callers 1

consumeBlocksMethod · 0.95

Calls 5

pushMethod · 0.80
resolveMethod · 0.80
replaceMethod · 0.65
getMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected