Check Point
Rolling release / release (push) Successful in 6m36s

This commit is contained in:
2026-09-12 09:07:09 -04:00
parent e9040d110a
commit a4073b9020
63 changed files with 2459 additions and 632 deletions
+16 -17
View File
@@ -1,25 +1,24 @@
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { normalizeSettings } from '../apps/gnome-extension/[email protected]/settings-values.js';
function flag(value, fallback = true) {
if (value === undefined || value === null) return fallback;
if (typeof value === 'string') return !['false', '0', 'off', 'no'].includes(value.trim().toLowerCase());
return value !== false;
export const SETTINGS_FIELDS = JSON.parse(fs.readFileSync(new URL('../apps/gnome-extension/[email protected]/settings-catalog.json', import.meta.url).pathname, 'utf8')).fields;
export const configPath = () => path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'jarvis/config.json');
export function readSettings({ strict = false } = {}) {
try {
const config = JSON.parse(fs.readFileSync(configPath(), 'utf8'));
if (!config || typeof config !== 'object' || Array.isArray(config)) throw new Error('Settings must be a JSON object');
return config;
} catch (error) { if (strict && error.code !== 'ENOENT') throw error; return {}; }
}
export function voiceSettings(source = null) {
let config = source;
if (!config) {
config = {};
try { config = JSON.parse(fs.readFileSync(path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'jarvis/config.json'), 'utf8')); } catch {}
}
const phrase = config.wakePhrase || config.wake_phrase || 'hey jarvis';
const aliases = Array.isArray(config.aliases) ? config.aliases : ['jarvis', 'okay jarvis'];
export function voiceSettings(source = null, { strict = false } = {}) {
const settings = normalizeSettings(source ?? readSettings({ strict }), SETTINGS_FIELDS, { strict });
return {
command: process.env.JARVIS_WAKE_COMMAND || config.wakeCommand || config.wake_command || '',
phrases: [phrase, ...aliases].map((item) => String(item || '').trim()).filter(Boolean),
ttsEnabled: flag(config.ttsEnabled ?? config.tts_enabled, true),
modelProfile: config.modelProfile || config.model_profile || 'laptop-16gb',
...settings,
command: process.env.JARVIS_WAKE_COMMAND || settings.wakeCommand,
phrases: [settings.wakePhrase, ...settings.aliases].map(item => item.trim()).filter(Boolean),
asrModel: process.env.JARVIS_ASR_MODEL || settings.asrModel,
ttsModel: process.env.JARVIS_TTS_MODEL || settings.ttsModel,
};
}