/** * Normalize raw `@twinklyjs/twinkly` responses into compact, LLM-friendly * shapes — and assert device-level success codes. * * The library mirrors Twinkly's HTTP API verbatim (snake_case keys, redundant * fields, string-encoded numbers). Tools shouldn't hand that to an agent, so * every read tool runs its raw response through a `format*` helper here. The * zod raw shapes are the single source of truth for the normalized model: tools * reuse them as their `outputSchema`, and the formatters return values typed by * the very same shape, so the schema and the data can't drift. */ import { z } from 'zod'; import type { DeviceDetailsResponse, GetCurrentLEDEffectResponse, GetCurrentMovieResponse, GetLEDBrightnessResponse, GetLEDColorResponse, GetLEDEffectsResponse, GetLEDOperationModeResponse, GetLEDSaturationResponse, GetMoviesResponse, GetSummaryResponse } from '@twinklyjs/twinkly'; /** * Throw if a device response carries a non-OK application code. Twinkly answers * with HTTP 200 even for logical failures (e.g. code 1104 = "movie not set"), * so writes must inspect the body code, not just the HTTP status. */ export declare function assertOk(res: { code: number; }, action: string): void; export declare const deviceDetailsShape: { readonly device: z.ZodString; readonly name: z.ZodString; readonly product: z.ZodString; readonly model: z.ZodString; readonly ledCount: z.ZodNumber; readonly ledProfile: z.ZodString; readonly frameRate: z.ZodNumber; readonly hardwareVersion: z.ZodString; readonly firmwareFamily: z.ZodString; readonly mac: z.ZodString; readonly uuid: z.ZodString; readonly uptimeSeconds: z.ZodNumber; readonly movieCapacity: z.ZodNumber; }; export type DeviceDetails = z.infer>; export declare function formatDeviceDetails(device: string, raw: DeviceDetailsResponse): DeviceDetails; export declare const summaryShape: { readonly device: z.ZodString; readonly mode: z.ZodString; readonly color: z.ZodNullable>; readonly timer: z.ZodObject<{ timeNow: z.ZodNumber; timeOn: z.ZodNumber; timeOff: z.ZodNumber; tz: z.ZodString; }, "strip", z.ZodTypeAny, { timeNow: number; timeOn: number; timeOff: number; tz: string; }, { timeNow: number; timeOn: number; timeOff: number; tz: string; }>; readonly music: z.ZodObject<{ enabled: z.ZodBoolean; active: z.ZodBoolean; mode: z.ZodString; }, "strip", z.ZodTypeAny, { enabled: boolean; active: boolean; mode: string; }, { enabled: boolean; active: boolean; mode: string; }>; readonly filters: z.ZodArray, "many">; }; export type Summary = z.infer>; export declare function formatSummary(device: string, raw: GetSummaryResponse): Summary; export declare const stateShape: { readonly device: z.ZodString; readonly mode: z.ZodString; readonly brightness: z.ZodObject<{ mode: z.ZodString; value: z.ZodNumber; }, "strip", z.ZodTypeAny, { value: number; mode: string; }, { value: number; mode: string; }>; readonly saturation: z.ZodObject<{ mode: z.ZodString; value: z.ZodNumber; }, "strip", z.ZodTypeAny, { value: number; mode: string; }, { value: number; mode: string; }>; readonly color: z.ZodNullable>; }; export type State = z.infer>; export interface RawState { mode: GetLEDOperationModeResponse; brightness: GetLEDBrightnessResponse; saturation: GetLEDSaturationResponse; /** `null` when the device firmware predates the color endpoint. */ color: GetLEDColorResponse | null; } export declare function formatState(device: string, raw: RawState): State; export declare const effectsShape: { readonly device: z.ZodString; readonly count: z.ZodNumber; readonly effectIds: z.ZodArray; readonly currentEffectId: z.ZodNullable; readonly currentEffectUniqueId: z.ZodNullable; }; export type Effects = z.infer>; /** * How the device names the effect it is currently playing is firmware- * dependent: older firmware returns a numeric `effect_id`, firmware family T * (e.g. TWQ064STW) returns `preset_id` plus the effect's `unique_id`. The * library types only declare `effect_id`, so widen every field to optional and * take whichever the device actually sent. */ type CurrentEffect = Partial & { preset_id?: number; }; export declare function formatEffects(device: string, raw: GetLEDEffectsResponse, current: CurrentEffect | null): Effects; export declare const moviesShape: { readonly device: z.ZodString; readonly movies: z.ZodArray, "many">; readonly currentMovieId: z.ZodNullable; }; export type Movies = z.infer>; export declare function formatMovies(device: string, raw: GetMoviesResponse, current: GetCurrentMovieResponse | null): Movies; export {};