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

Function traceWsOut

apps/kimi-web/src/debug/trace.ts:250–265  ·  view source on GitHub ↗
(frame: unknown)

Source from the content-addressed store, hash-verified

248
249/** Outbound client frame (client_hello / subscribe / unsubscribe / abort / pong). */
250export function traceWsOut(frame: unknown): void {
251 if (!isTraceEnabled()) return;
252 const f = (frame ?? {}) as Record<string, unknown>;
253 const type = typeof f['type'] === 'string' ? (f['type'] as string) : '(unknown)';
254 const payload = f['payload'] as Record<string, unknown> | undefined;
255 const sessionId =
256 typeof payload?.['session_id'] === 'string' ? (payload['session_id'] as string) : undefined;
257 push({
258 source: 'ws',
259 kind: 'ws:out',
260 eventType: type,
261 sessionId,
262 label: `→ ${type}`,
263 detail: detailOf(frame),
264 });
265}
266
267/** Inbound server frame — control frames and event frames alike. */
268export function traceWsIn(frame: unknown): void {

Callers 1

sendMethod · 0.90

Calls 3

isTraceEnabledFunction · 0.85
detailOfFunction · 0.85
pushFunction · 0.70

Tested by

no test coverage detected