Make first-run wait for daemon D-Bus
Rolling release / release (push) Successful in 6m34s

This commit is contained in:
2026-09-11 16:45:36 -04:00
parent 049ed48787
commit 6c9a69af9e
3 changed files with 41 additions and 12 deletions
+7 -4
View File
@@ -78,10 +78,13 @@ export class JarvisDaemon extends EventEmitter {
export async function startDaemon() { export async function startDaemon() {
const daemon = new JarvisDaemon(); const daemon = new JarvisDaemon();
daemon.startVoice().catch((error) => console.error(`jarvisd: voice unavailable: ${error.message}`)); daemon.startVoice().catch((error) => console.error(`jarvisd: voice unavailable: ${error.message}`));
import('./dbus-service.js').then(({ serveOnSessionBus }) => serveOnSessionBus(daemon)).catch((error) => { import('./dbus-service.js')
daemon.emit('Error', 'DBUS_UNAVAILABLE', error.message); .then(({ serveOnSessionBus }) => serveOnSessionBus(daemon))
console.error(`jarvisd: D-Bus unavailable: ${error.message}`); .then(() => console.log('jarvisd: D-Bus name io.qvac.Jarvis ready'))
}); .catch((error) => {
daemon.emit('Error', 'DBUS_UNAVAILABLE', error.message);
console.error(`jarvisd: D-Bus unavailable: ${error.message}`);
});
process.on('SIGINT', () => daemon.close().finally(() => process.exit(0))); process.on('SIGINT', () => daemon.close().finally(() => process.exit(0)));
console.log('jarvisd ready; QVAC inference remains GPU-gated'); console.log('jarvisd ready; QVAC inference remains GPU-gated');
return daemon; return daemon;
+32 -7
View File
@@ -34,19 +34,44 @@ mkdir -p "${HOME}/.config/jarvis"
"${BARE}" packaging/write-config.js "${HOME}/.config/jarvis/config.json" "${WAKE_PHRASE}" "${MODEL_PROFILE}" "${TTS_ENABLED}" "${BARE}" packaging/write-config.js "${HOME}/.config/jarvis/config.json" "${WAKE_PHRASE}" "${MODEL_PROFILE}" "${TTS_ENABLED}"
echo "Saved wake phrase: ${WAKE_PHRASE}; model profile: ${MODEL_PROFILE}; TTS: ${TTS_ENABLED}" echo "Saved wake phrase: ${WAKE_PHRASE}; model profile: ${MODEL_PROFILE}; TTS: ${TTS_ENABLED}"
echo echo
# The daemon owns the session D-Bus name. Start it after writing the config and
# wait for that name before sending the preview or smoke-test request.
DAEMON_BUS_READY=false
if command -v systemctl >/dev/null && command -v busctl >/dev/null && [[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then
systemctl --user daemon-reload || true
systemctl --user enable jarvisd.service || true
systemctl --user restart jarvisd.service || true
for _ in {1..30}; do
if busctl --user status io.qvac.Jarvis >/dev/null 2>&1; then
DAEMON_BUS_READY=true
break
fi
sleep 0.5
done
fi
echo "[4/5] TTS preview" echo "[4/5] TTS preview"
if [[ "${TTS_ENABLED}" == true && -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then if [[ "${TTS_ENABLED}" == true && "${DAEMON_BUS_READY}" == true ]]; then
busctl --user call io.qvac.Jarvis /io/qvac/Jarvis io.qvac.Jarvis.Session Say s "JARVIS local voice preview" || true busctl --user call io.qvac.Jarvis /io/qvac/Jarvis io.qvac.Jarvis.Session Say s "JARVIS local voice preview"
elif [[ "${TTS_ENABLED}" == true ]]; then
echo "Daemon did not register io.qvac.Jarvis; preview skipped."
else else
echo "Session D-Bus is unavailable or TTS is disabled; preview skipped." echo "TTS is disabled; preview skipped."
fi fi
echo echo
echo "[5/5] Typed smoke test" echo "[5/5] Typed smoke test"
read -r -p "Type a test prompt (default: say hello): " PROMPT read -r -p "Type a test prompt (default: say hello): " PROMPT
PROMPT="${PROMPT:-say hello}" PROMPT="${PROMPT:-say hello}"
if command -v busctl >/dev/null && [[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then if [[ "${DAEMON_BUS_READY}" == true ]]; then
busctl --user call io.qvac.Jarvis /io/qvac/Jarvis io.qvac.Jarvis.Session Ask s "${PROMPT}" || true busctl --user call io.qvac.Jarvis /io/qvac/Jarvis io.qvac.Jarvis.Session Ask s "${PROMPT}"
else else
echo "Session D-Bus is unavailable; saved setup and skipped live prompt." echo "Daemon is not available on the session D-Bus; saved setup and skipped live prompt."
echo "Inspect with: systemctl --user status jarvisd.service"
echo "Logs: journalctl --user -u jarvisd.service -n 80 --no-pager"
fi
if [[ "${DAEMON_BUS_READY}" == true ]]; then
echo "First-run setup complete; jarvisd is running."
else
echo "First-run setup saved. Start with: systemctl --user enable --now jarvisd.service"
fi fi
echo "First-run setup complete. Start with: systemctl --user enable --now jarvisd.service"
+2 -1
View File
@@ -44,7 +44,8 @@ if [[ ! -f "${CONFIG_DIR}/qvac.config.json" ]]; then
fi fi
if [[ "${1:-}" == "--enable" ]]; then if [[ "${1:-}" == "--enable" ]]; then
systemctl --user daemon-reload systemctl --user daemon-reload
systemctl --user enable --now jarvisd.service systemctl --user enable jarvisd.service
systemctl --user restart jarvisd.service
fi fi
echo "Installed JARVIS-QVAC to ${APP_DIR}" echo "Installed JARVIS-QVAC to ${APP_DIR}"
echo "Run: ${APP_DIR}/packaging/first-run.sh" echo "Run: ${APP_DIR}/packaging/first-run.sh"