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

Function detailOf

apps/kimi-web/src/debug/trace.ts:141–156  ·  view source on GitHub ↗

Sanitize, then hard-cap the serialized size of one entry's detail.

(value: unknown)

Source from the content-addressed store, hash-verified

139
140/** Sanitize, then hard-cap the serialized size of one entry's detail. */
141function detailOf(value: unknown): unknown {
142 if (value === undefined) return undefined;
143 const sanitized = sanitizeForTrace(value);
144 try {
145 const json = JSON.stringify(sanitized);
146 if (json !== undefined && json.length > MAX_DETAIL_JSON_CHARS) {
147 return {
148 _truncated: `detail JSON was ${json.length} chars; first ${MAX_DETAIL_JSON_CHARS} kept`,
149 preview: json.slice(0, MAX_DETAIL_JSON_CHARS),
150 };
151 }
152 } catch {
153 return '[unserializable detail]';
154 }
155 return sanitized;
156}
157
158// ---------------------------------------------------------------------------
159// REST recording — called from DaemonHttpClient

Callers 7

traceRestRequestFunction · 0.85
traceRestResponseFunction · 0.85
traceWsLifecycleFunction · 0.85
traceWsOutFunction · 0.85
traceWsInFunction · 0.85
traceClientLogFunction · 0.85
traceClientEventFunction · 0.85

Calls 1

sanitizeForTraceFunction · 0.85

Tested by

no test coverage detected