MCPcopy Create free account
hub / github.com/backnotprop/plannotator / routeMessage

Method routeMessage

packages/ai/providers/pi-sdk-node.ts:136–153  ·  view source on GitHub ↗
(msg: Record<string, unknown>)

Source from the content-addressed store, hash-verified

134 }
135
136 private routeMessage(msg: Record<string, unknown>): void {
137 if (msg.type === "response" && typeof msg.id === "string") {
138 const pending = this.pendingRequests.get(msg.id);
139 if (pending) {
140 this.pendingRequests.delete(msg.id);
141 if (msg.success === false) {
142 pending.reject(new Error((msg.error as string) ?? "RPC error"));
143 } else {
144 pending.resolve((msg.data as Record<string, unknown>) ?? {});
145 }
146 return;
147 }
148 }
149
150 for (const listener of this.listeners) {
151 listener(msg);
152 }
153 }
154
155 send(command: Record<string, unknown>): void {
156 if (!this.proc?.stdin || this.proc.stdin.destroyed) return;

Callers 1

readStreamMethod · 0.95

Calls 3

deleteMethod · 0.80
getMethod · 0.65
resolveMethod · 0.65

Tested by

no test coverage detected