MCPcopy Create free account
hub / github.com/apache/maka / encodeProtocolMessage

Function encodeProtocolMessage

packages/runtime-host/src/protocol/index.ts:341–350  ·  view source on GitHub ↗
(value: ClientFrame | HostFrame)

Source from the content-addressed store, hash-verified

339}
340
341export function encodeProtocolMessage(value: ClientFrame | HostFrame): EncodedProtocolMessage {
342 const encoded = Buffer.from(JSON.stringify(value), 'utf8');
343 if (encoded.byteLength > RUNTIME_HOST_MAX_MESSAGE_BYTES) {
344 throw new RuntimeHostProtocolError(
345 'frame_too_large',
346 'Runtime Host message exceeds the byte limit',
347 );
348 }
349 return encoded as EncodedProtocolMessage;
350}
351
352function requireProtocolVersion(value: unknown, label: string): number {
353 if (!Number.isSafeInteger(value) || (value as number) < 0) {

Callers 15

#offerMethod · 0.85
writeClientFrameFunction · 0.85
#serveConnectionMethod · 0.85
#enqueueMethod · 0.85
#evictSlowSubscriberMethod · 0.85
slowConsumerFrameBytesFunction · 0.85
terminalFrameByteBudgetFunction · 0.85
wireTextByteLimitFunction · 0.85
enqueueMethod · 0.85

Calls 1

fromMethod · 0.80

Tested by 10

writeProtocolFrameFunction · 0.68
writeHostFrameFunction · 0.68
writeClientFrameFunction · 0.68
writeClientFrameFunction · 0.68
queryUsageRowsFunction · 0.68
queryUsageBucketsFunction · 0.68
writeProtocolFrameFunction · 0.68
encodeLocalIpcTestFrameFunction · 0.68
writeProtocolFrameFunction · 0.68
writeClientFrameFunction · 0.68