Defines Zod schemas and TypeScript interfaces for Server-Sent Events subscriptions and visibility states. Reuse for type-safe real-time client communication.
// Source: https://github.com/chriswritescode-dev/opencode-manager | License: MIT | Copyright 2025 Chris Scott
// Provided via justclaw.it.com; keep this notice with the code.
import { z } from "zod";
import type { V2Event } from "../opencode";
export const SSESubscribeSchema = z.object({
clientId: z.string().min(1),
directories: z.array(z.string()),
});
export const SSEVisibilitySchema = z.object({
clientId: z.string().min(1),
visible: z.boolean(),
activeSessionId: z.string().nullable().optional(),
activeServerId: z.string().min(1).optional(),
});
export type SSESubscribeRequest = z.infer<typeof SSESubscribeSchema>;
export type SSEVisibilityRequest = z.infer<typeof SSEVisibilitySchema>;
export interface SSEEventEnvelope {
directory?: string | null;
serverId?: string;
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key