Updates
Rolling release / release (push) Successful in 3m14s

This commit is contained in:
2026-09-11 19:12:28 -04:00
parent 8c17112fa8
commit 7604cded2c
13 changed files with 411 additions and 52 deletions
+33
View File
@@ -2,6 +2,8 @@ import test from 'node:test';
import assert from 'node:assert/strict';
import { VoiceStateMachine } from '../daemon/voice-state.js';
import { QvacScheduler } from '../daemon/qvac-scheduler.js';
import { JarvisDaemon } from '../daemon/index.js';
import { spokenReply } from '../skills/voice-prompt.js';
test('voice state machine handles wake, reply, cancel, and idle sleep', () => {
let now = 0;
@@ -20,6 +22,37 @@ test('typed questions wake an armed voice session before thinking', () => {
assert.equal(voice.state, 'THINKING');
});
test('typed questions barge in from SPEAKING', () => {
const voice = new VoiceStateMachine();
voice.wake(); voice.utterance(); voice.speak();
voice.typedUtterance();
assert.equal(voice.state, 'THINKING');
});
test('spoken replies use harness text and strip HUD sidecars', () => {
assert.equal(spokenReply({ ok: true, text: 'Hello there.', reason: 'stop' }), 'Hello there.');
assert.equal(spokenReply({ text: 'Spoken. <jarvis_hud>{"title":"x","chips":[]}</jarvis_hud>' }), 'Spoken.');
assert.equal(spokenReply({}), '');
assert.equal(spokenReply('[object Object]'), '');
});
test('ask extracts harness reply text instead of stringifying the object', async () => {
const daemon = new JarvisDaemon();
daemon.harness = { ask: async () => ({ ok: true, text: 'Hello there.', reason: 'stop' }), cancel() {}, close: async () => {} };
daemon.voiceLoop = null;
const replies = [];
daemon.on('Reply', (text) => replies.push(text));
try {
const result = await daemon.ask('Hi');
assert.equal(result, 'Hello there.');
assert.deepEqual(replies, ['Hello there.']);
assert.equal(daemon.lastReply, 'Hello there.');
assert.equal(daemon.state, 'LISTENING');
} finally {
await daemon.close();
}
});
test('QVAC scheduler prioritizes voice and keeps one active job', async () => {
const scheduler = new QvacScheduler();
const order = [];