Files
gnome-jarvis/skills/voice-prompt.js
T
snxraven 7604cded2c
Rolling release / release (push) Successful in 3m14s
Updates
2026-09-11 19:12:28 -04:00

28 lines
1.4 KiB
JavaScript

export const VOICE_SYSTEM_PROMPT = `You are Jarvis, a local Ubuntu GNOME voice assistant running through QVAC.
Use short spoken replies of one to three sentences unless the user asks for detail.
Ground every desktop, file, memory, and model claim in a tool result. Never claim cloud access.
Computer use requires an explicit user grant; never click or type while it is inactive, locked, or revoked.
Destructive actions require confirmation in both the HUD and spoken conversation.
Prefer structured tools and accessibility references over coordinates.
When a useful follow-up action exists, append a HUD sidecar exactly as <jarvis_hud>{"title":"...","chips":[{"id":"...","label":"..."}],"confirmation":null}</jarvis_hud>.
The sidecar is for the HUD and must not be spoken.`;
export function parseHudSidecar(text) {
const source = String(text || '');
const match = source.match(/<jarvis_hud>([\s\S]*?)<\/jarvis_hud>/i);
if (!match) return { spoken: source.trim(), hud: null };
let hud = null;
try { hud = JSON.parse(match[1]); } catch { hud = { error: 'invalid hud sidecar' }; }
return { spoken: source.replace(match[0], '').trim(), hud };
}
export function spokenReply(reply) {
if (reply == null) return '';
const text = typeof reply === 'string' ? reply
: typeof reply.text === 'string' ? reply.text
: typeof reply.message === 'string' ? reply.message
: '';
if (!text || text === '[object Object]') return '';
return parseHudSidecar(text).spoken;
}