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

Function wsEventEnvelopeSchema

packages/protocol/src/ws-control.ts:38–56  ·  view source on GitHub ↗
(payload: T)

Source from the content-addressed store, hash-verified

36export type CursorsBySession = z.infer<typeof cursorsBySessionSchema>;
37
38export const wsEventEnvelopeSchema = <T extends z.ZodTypeAny>(payload: T) =>
39 z.object({
40 type: z.string(),
41 seq: z.number().int().nonnegative(),
42 epoch: z.string().optional(),
43 volatile: z.boolean().optional(),
44 /**
45 * For volatile text-delta frames (`assistant.delta` / `thinking.delta`):
46 * the cumulative character offset of this delta within the in-flight
47 * turn's accumulated stream. Clients align against
48 * `snapshot.in_flight_turn.*_text.length` — `offset < local length` is a
49 * duplicate (skip), `offset > local length` means deltas were missed
50 * (re-snapshot).
51 */
52 offset: z.number().int().nonnegative().optional(),
53 session_id: z.string().optional(),
54 timestamp: isoDateTimeSchema,
55 payload,
56 });
57
58export const wsControlEnvelopeSchema = <T extends z.ZodTypeAny>(payload: T) =>
59 z.object({

Callers 2

ws-control.test.tsFile · 0.90
ws-control.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected