/**
 * @fileoverview Clipboard routes.
 * Accepts text via POST and broadcasts to connected browsers for clipboard write.
 */
import { SseEvent } from '../sse-events.js';
import { createErrorResponse, ApiErrorCode } from '../../types.js';
export function registerClipboardRoutes(app, ctx) {
    app.post('/api/clipboard', async (req) => {
        const body = req.body;
        const text = body?.text;
        if (typeof text !== 'string' || text.length === 0) {
            return createErrorResponse(ApiErrorCode.INVALID_INPUT, 'Missing or empty "text" field');
        }
        ctx.broadcast(SseEvent.ClipboardWrite, {
            text,
            sessionId: body.sessionId ?? null,
            timestamp: Date.now(),
        });
        return {};
    });
}
//# sourceMappingURL=clipboard-routes.js.map