/**
 * Configuration schema for config.json.
 * See PRD § 14 for full specification.
 */
export const DEFAULT_CONFIG = {
    opencode: {
        port: 4096,
    },
    fileWatcher: {
        debounceMs: 300,
        maxChangesPerMessage: 500,
    },
    terminal: {
        maxTerminals: 5,
    },
};
/**
 * Validates config values and returns an array of error messages.
 * Returns empty array if config is valid.
 */
export function validateConfig(config) {
    const errors = [];
    if (config.machineLabel !== undefined && typeof config.machineLabel !== "string") {
        errors.push("machineLabel must be a string");
    }
    if (config.gatewayUrl !== undefined) {
        if (typeof config.gatewayUrl !== "string") {
            errors.push("gatewayUrl must be a string");
        }
        else if (!config.gatewayUrl.startsWith("ws://") && !config.gatewayUrl.startsWith("wss://")) {
            errors.push("gatewayUrl must start with ws:// or wss://");
        }
    }
    if (typeof config.opencode?.port !== "number" ||
        config.opencode.port < 1 ||
        config.opencode.port > 65535) {
        errors.push("opencode.port must be a number between 1 and 65535");
    }
    if (typeof config.fileWatcher?.debounceMs !== "number" || config.fileWatcher.debounceMs < 0) {
        errors.push("fileWatcher.debounceMs must be a non-negative number");
    }
    if (typeof config.fileWatcher?.maxChangesPerMessage !== "number" ||
        config.fileWatcher.maxChangesPerMessage < 1) {
        errors.push("fileWatcher.maxChangesPerMessage must be a positive number");
    }
    if (config.terminal?.shell !== undefined && typeof config.terminal.shell !== "string") {
        errors.push("terminal.shell must be a string");
    }
    if (typeof config.terminal?.maxTerminals !== "number" || config.terminal.maxTerminals < 1) {
        errors.push("terminal.maxTerminals must be a positive number");
    }
    return errors;
}
//# sourceMappingURL=schema.js.map