MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / formatPair

Function formatPair

packages/agent-core/src/logging/formatter.ts:123–128  ·  view source on GitHub ↗
(key: string, raw: unknown)

Source from the content-addressed store, hash-verified

121}
122
123function formatPair(key: string, raw: unknown): string {
124 const limited = truncate(serializeValue(raw), CTX_VALUE_MAX_CHARS);
125 const renderedKey = SAFE_KEY_RE.test(key) ? key : quote(key);
126 const renderedVal = /[\s="\\]/.test(limited) || limited.length === 0 ? quote(limited) : limited;
127 return `${renderedKey}=${renderedVal}`;
128}
129
130function clipBytes(text: string, maxBytes: number): string {
131 if (Buffer.byteLength(text, 'utf-8') <= maxBytes) return text;

Callers 1

formatEntryFunction · 0.85

Calls 3

serializeValueFunction · 0.85
quoteFunction · 0.85
truncateFunction · 0.70

Tested by

no test coverage detected