mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Merge origin/main into fix/hal-722-radio-next-no-autoplay
main moved the Radio markup into Vue views and rebuilt the UI tests on
stores. Resolved:
- src/ui/templates/context.html: deleted in main; the new privacy note now
lives in src/ui/views/panels/RadioPanel.vue.
- src/ui/radioControls.test.mjs: main's store fixture; the Next/Previous
autoplay test drives store.act('cycleRadio').
- src/voice/gevRealtime.test.mjs: main's createTestVoiceUi; the stop and
select handoff cases stay one table-driven test.
- src/data/radioNextState.test.mjs reads the published gev-radio view.
- src/i18n/locales/ar.json: the new note translated for the Arabic locale.
This commit is contained in:
commit
a2be947aba
679 files changed
+45369
-19625
No files matched your search
+47
-212
@@ -34,6 +34,7 @@ import {
|
||||
withToolCatalog,
|
||||
} from './gevRealtime.js';
|
||||
import { createVoiceCostTracker } from './voiceCost.js';
|
||||
import { createTestVoiceUi } from '../testSupport/voiceUi.mjs';
|
||||
|
||||
test('push-to-talk recognizes Space by code or key', () => {
|
||||
assert.equal(PUSH_TO_TALK_HOLD_DELAY_MS, 500);
|
||||
@@ -114,10 +115,7 @@ function createPushToTalkFixture(t) {
|
||||
const makeController = () => {
|
||||
const microphone = { enabled: false, stopped: false, stop() { this.stopped = true; } };
|
||||
const controller = new GevRealtimeController({
|
||||
ui: {
|
||||
root: { dataset: {}, querySelectorAll: () => [], remove() {} },
|
||||
status: {}, detail: {},
|
||||
},
|
||||
ui: createTestVoiceUi(),
|
||||
runner: async () => ({}),
|
||||
radioLayer: {
|
||||
pause: () => radio.push('pause'),
|
||||
@@ -318,8 +316,8 @@ test('push-to-talk starts once at 500ms and repeat does not reset the threshold'
|
||||
assert.equal(f.controller.spaceKeyHeld, false);
|
||||
assert.equal(f.controller.pushToTalkKeyHeld, false);
|
||||
assert.equal(f.microphone.enabled, false);
|
||||
assert.equal(f.controller.ui.root.dataset.pushToTalk, undefined);
|
||||
assert.equal(f.controller.ui.detail.textContent, 'Hold Space to talk');
|
||||
assert.equal(f.controller.ui.state.root.pushToTalk, null);
|
||||
assert.equal(f.controller.ui.state.detail.text, 'Hold Space to talk');
|
||||
});
|
||||
|
||||
test('push-to-talk treats a Space release before 500ms as a background tap', (t) => {
|
||||
@@ -392,7 +390,7 @@ test('push-to-talk cancels pending and active holds on blur or hidden document',
|
||||
assert.equal(f.controller.spaceKeyHeld, false);
|
||||
assert.equal(f.controller.pushToTalkKeyHeld, false);
|
||||
assert.equal(f.microphone.enabled, false);
|
||||
assert.equal(f.controller.ui.root.dataset.pushToTalk, undefined);
|
||||
assert.equal(f.controller.ui.state.root.pushToTalk, null);
|
||||
assert.equal(f.key('keyup', background).defaultPrevented, false);
|
||||
f.document.visibilityState = 'visible';
|
||||
}
|
||||
@@ -579,7 +577,7 @@ test('failed or superseded Radio preflight keeps voice open and cancels audio',
|
||||
test('replacement input invalidates an in-flight Radio preflight immediately', () => {
|
||||
const order = [];
|
||||
const controller = new GevRealtimeController({
|
||||
ui: {},
|
||||
ui: createTestVoiceUi(),
|
||||
runner: async () => ({}),
|
||||
radioLayer: { stopPlayback: () => order.push('radio-stop') },
|
||||
});
|
||||
@@ -604,12 +602,7 @@ for (const [name, control, message] of [
|
||||
test(name, async () => {
|
||||
const order = [];
|
||||
let playbackControl = null;
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async () => ({ ok: true }),
|
||||
@@ -646,12 +639,7 @@ for (const [name, control, message] of [
|
||||
test('confirmed manual Radio playback closes active voice without stopping Radio', () => {
|
||||
const order = [];
|
||||
let playbackControl = null;
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async () => ({ ok: true }),
|
||||
@@ -684,12 +672,7 @@ test('manual playback takeover survives stale voice preflight cleanup', async ()
|
||||
let resolvePreflight;
|
||||
let activeAttemptId = null;
|
||||
const stopRequests = [];
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const radioLayer = {
|
||||
subscribePlaybackControls(listener) {
|
||||
playbackControl = listener;
|
||||
@@ -741,7 +724,7 @@ test('manual playback takeover survives stale voice preflight cleanup', async ()
|
||||
test('internal Radio cleanup controls do not masquerade as newer user input', () => {
|
||||
let playbackControl = null;
|
||||
const controller = new GevRealtimeController({
|
||||
ui: {},
|
||||
ui: createTestVoiceUi(),
|
||||
runner: async () => ({}),
|
||||
radioLayer: {
|
||||
subscribePlaybackControls(listener) {
|
||||
@@ -766,7 +749,7 @@ test('manual Radio playback does not close voice when voice is already idle', ()
|
||||
let playbackControl = null;
|
||||
let voiceStops = 0;
|
||||
const controller = new GevRealtimeController({
|
||||
ui: {},
|
||||
ui: createTestVoiceUi(),
|
||||
runner: async () => ({}),
|
||||
radioLayer: {
|
||||
subscribePlaybackControls(listener) {
|
||||
@@ -786,12 +769,7 @@ test('manual Radio playback does not close voice when voice is already idle', ()
|
||||
test('active-response Realtime errors invalidate pending and in-flight Radio handoffs', async () => {
|
||||
const order = [];
|
||||
let playbackControl = null;
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async () => ({ ok: true }),
|
||||
@@ -839,16 +817,7 @@ test('voice ownership ducks tuner static before pausing broadcaster audio', () =
|
||||
test('Radio handoff waits for response.done so later multi-intent tools execute before voice closes', async () => {
|
||||
const order = [];
|
||||
const confirmationInstructions = [];
|
||||
const ui = {
|
||||
root: {
|
||||
dataset: {},
|
||||
classList: { remove() {} },
|
||||
querySelectorAll: () => [],
|
||||
},
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const runner = async (name) => {
|
||||
order.push(`tool:${name}`);
|
||||
if (name === 'control_radio') {
|
||||
@@ -933,12 +902,7 @@ test('Radio handoff waits for response.done so later multi-intent tools execute
|
||||
test('Radio playback failure leaves voice connected and speaks a correction', async () => {
|
||||
const sent = [];
|
||||
const order = [];
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async () => ({
|
||||
@@ -991,16 +955,7 @@ test('Radio playback failure leaves voice connected and speaks a correction', as
|
||||
|
||||
test('detected speech cancels a prepared Radio handoff before a cancelled response completes', async () => {
|
||||
const order = [];
|
||||
const ui = {
|
||||
root: {
|
||||
dataset: {},
|
||||
classList: { remove() {} },
|
||||
querySelectorAll: () => [],
|
||||
},
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async () => ({
|
||||
@@ -1059,12 +1014,7 @@ test('a Radio tool result that resolves after speech interruption cannot re-arm
|
||||
let resolveRunner;
|
||||
const runnerResult = new Promise((resolve) => { resolveRunner = resolve; });
|
||||
let receivedSignal = null;
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (_name, _args, options) => {
|
||||
@@ -1119,12 +1069,7 @@ test('sibling tool calls in one response do not abort an in-flight Radio action'
|
||||
let resolveRadio;
|
||||
let radioSignal = null;
|
||||
const radioResult = new Promise((resolve) => { resolveRadio = resolve; });
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (name, _args, options) => {
|
||||
@@ -1165,12 +1110,7 @@ test('Radio stop does not abort an unrelated sibling tool from the same response
|
||||
let releaseStyle;
|
||||
let styleSignal = null;
|
||||
const styleResult = new Promise((resolve) => { releaseStyle = resolve; });
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (name, _args, options) => {
|
||||
@@ -1244,12 +1184,7 @@ test('real Radio Select cannot enable or play after a same-response Disable comp
|
||||
return true;
|
||||
},
|
||||
};
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
globalThis.window = { __GOOGLE_MAPS_API_KEY__: 'test-key' };
|
||||
globalThis.fetch = async () => {
|
||||
announceLookupStarted();
|
||||
@@ -1375,12 +1310,7 @@ test('generic same-response Radio visibility disable supersedes delayed Select',
|
||||
camera: { moveEnd: { addEventListener() {} } },
|
||||
};
|
||||
const genericRunner = createGevActionRunner({ viewer, styleManager: {}, dataManager });
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
globalThis.window = { __GOOGLE_MAPS_API_KEY__: 'test-key' };
|
||||
globalThis.fetch = async () => {
|
||||
announceLookupStarted();
|
||||
@@ -1510,12 +1440,7 @@ test('same-response Pause aborts a real manager enable already in flight', async
|
||||
dataManager.subscribe((change) => {
|
||||
if (change.type === 'visibility') trace.push(`visibility:${change.enabled}`);
|
||||
});
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager,
|
||||
@@ -1641,12 +1566,7 @@ test('Pause and Stop preserve independent dedicated and generic Radio ON across
|
||||
styleManager: {},
|
||||
dataManager,
|
||||
});
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager,
|
||||
@@ -1775,12 +1695,7 @@ test('successful same- or newer-response Stop aborts Select across real manager
|
||||
if (change.origin === 'voice') persistenceWrites.push(change.enabled);
|
||||
}
|
||||
});
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
radioLayer,
|
||||
@@ -1846,12 +1761,7 @@ test('same-response pause and disable suppress play/select handoffs without canc
|
||||
const playbackGate = new Promise((resolve) => { releasePlayback = resolve; });
|
||||
const sent = [];
|
||||
const radioState = { enabled: true, audioState: 'playing' };
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
radioLayer: { getUIState: () => ({ ...radioState }) },
|
||||
@@ -1927,12 +1837,7 @@ test('Realtime Radio route exceptions preserve the authoritative lifecycle summa
|
||||
for (const route of ['dedicated', 'generic']) {
|
||||
const sent = [];
|
||||
const lifecycle = { enabled: true, lifecycleState: 'disabling', uncertain: true };
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager: {
|
||||
@@ -1979,12 +1884,7 @@ test('different-response Radio stop remains a cancellation authority for an olde
|
||||
let releaseSelect;
|
||||
const selectGate = new Promise((resolve) => { releaseSelect = resolve; });
|
||||
const sent = [];
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (_name, args) => {
|
||||
@@ -2057,12 +1957,7 @@ test('failed same-response stop does not suppress a successful playback request'
|
||||
}]]),
|
||||
isEnabled: () => true,
|
||||
};
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (_name, args) => {
|
||||
@@ -2165,12 +2060,7 @@ test('failed same-response Stop preserves Select auto-enable held inside real ma
|
||||
};
|
||||
dataManager = new DataLayerManager({});
|
||||
dataManager.register(radioLayer);
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager,
|
||||
@@ -2253,12 +2143,7 @@ test('failed same-response Pause and Disable do not suppress valid older playbac
|
||||
return () => visibilityListeners.delete(listener);
|
||||
},
|
||||
};
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager,
|
||||
@@ -2316,12 +2201,7 @@ test('failed generic same-response Radio OFF does not suppress valid older playb
|
||||
let releaseSelect;
|
||||
const selectGate = new Promise((resolve) => { releaseSelect = resolve; });
|
||||
const sent = [];
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (name, args) => {
|
||||
@@ -2410,12 +2290,7 @@ test('direct user Radio OFF aborts an in-flight voice enable before settled publ
|
||||
dataManager.subscribe((change) => {
|
||||
if (change.type === 'visibility') visibility.push(`${change.origin}:${change.enabled}`);
|
||||
});
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager,
|
||||
@@ -2501,12 +2376,7 @@ test('direct user Radio OFF freezes a prepared handoff until disable success or
|
||||
dataManager = new DataLayerManager({});
|
||||
dataManager.register(radioLayer);
|
||||
await dataManager.setEnabled('radio', true);
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
dataManager,
|
||||
@@ -2580,12 +2450,7 @@ test('dedicated and generic Radio OFF reservations freeze an in-flight playback
|
||||
},
|
||||
getUIState: () => ({ enabled: true, audioState: 'stopped' }),
|
||||
};
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
radioLayer,
|
||||
@@ -2682,12 +2547,7 @@ test('delayed Stop reports its result before committing or resuming a prepared h
|
||||
},
|
||||
getUIState: () => ({ enabled: true, audioState: 'stopped' }),
|
||||
};
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
radioLayer,
|
||||
@@ -2765,12 +2625,7 @@ test('stale handoff cleanup cannot erase a resumed successor across repeated fai
|
||||
return true;
|
||||
},
|
||||
};
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
radioLayer,
|
||||
@@ -2817,12 +2672,7 @@ test('stale handoff cleanup cannot erase a resumed successor across repeated fai
|
||||
});
|
||||
|
||||
test('a later same-response stop clears an already prepared playback result', async () => {
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: async (_name, args) => args.action === 'select'
|
||||
@@ -3116,22 +2966,7 @@ const usdUsage = (usd) => ({
|
||||
/** A controller wired to inert UI stubs, with the cost surface present. */
|
||||
function costControllerHarness({ runner } = {}) {
|
||||
const toolCalls = [];
|
||||
const ui = {
|
||||
root: { dataset: {}, classList: { remove() {}, add() {} }, querySelectorAll: () => [] },
|
||||
status: { textContent: '' },
|
||||
detail: { textContent: '', title: '' },
|
||||
errorDetail: { textContent: '' },
|
||||
button: { dataset: {} },
|
||||
buttonLabel: { textContent: '' },
|
||||
tierButton: {
|
||||
textContent: '',
|
||||
title: '',
|
||||
attrs: {},
|
||||
setAttribute(key, value) { this.attrs[key] = value; },
|
||||
getAttribute(key) { return this.attrs[key] ?? null; },
|
||||
},
|
||||
costValue: { textContent: '', title: '', dataset: {} },
|
||||
};
|
||||
const ui = createTestVoiceUi();
|
||||
const controller = new GevRealtimeController({
|
||||
ui,
|
||||
runner: runner || (async (name) => { toolCalls.push(name); return { ok: true }; }),
|
||||
@@ -3199,9 +3034,9 @@ test('F1: the toggle still records the next-session preference while live', () =
|
||||
controller.status = 'listening';
|
||||
controller.setVoiceTier('mini');
|
||||
assert.equal(controller.voiceTier, 'mini');
|
||||
assert.equal(ui.tierButton.textContent, 'MINI');
|
||||
assert.equal(ui.state.tier.text, 'MINI');
|
||||
// ...and says so, rather than implying the live session switched.
|
||||
assert.match(ui.tierButton.title, /this session stays on/i);
|
||||
assert.match(ui.state.tier.title, /this session stays on/i);
|
||||
});
|
||||
|
||||
test('OAuth cloud sessions report unknown cost and usage without tripping the API spend guard', () => {
|
||||
@@ -3211,8 +3046,8 @@ test('OAuth cloud sessions report unknown cost and usage without tripping the AP
|
||||
controller._cost.sessionCloudVoiceAuth = 'oauth';
|
||||
controller.syncCostUi();
|
||||
const before = controller.costTracker.state();
|
||||
assert.equal(ui.costValue.hidden, false);
|
||||
assert.equal(ui.costValue.textContent, 'COST UNKNOWN');
|
||||
assert.equal(ui.state.cost.hidden, false);
|
||||
assert.equal(ui.state.cost.text, 'COST UNKNOWN');
|
||||
assert.deepEqual(controller.recordUsage(usdUsage(100)), {
|
||||
responses: 1,
|
||||
input: 0,
|
||||
@@ -3223,11 +3058,11 @@ test('OAuth cloud sessions report unknown cost and usage without tripping the AP
|
||||
const after = controller.costTracker.state();
|
||||
assert.equal(after.totalUsd, before.totalUsd);
|
||||
assert.equal(controller.costCapStopped, false);
|
||||
assert.match(ui.costValue.title, /1 response\(s\).*1562500 output tokens/);
|
||||
assert.match(ui.state.cost.title, /1 response\(s\).*1562500 output tokens/);
|
||||
controller.dc = {};
|
||||
controller.responseActive = true;
|
||||
controller.stop();
|
||||
assert.match(ui.costValue.title, /Usage is incomplete/);
|
||||
assert.match(ui.state.cost.title, /Usage is incomplete/);
|
||||
});
|
||||
|
||||
test('OAuth cloud sessions count caption transcriptions without pricing them into the API cap', () => {
|
||||
@@ -3248,8 +3083,8 @@ test('OAuth cloud sessions count caption transcriptions without pricing them int
|
||||
assert.equal(after.totalUsd, before.totalUsd);
|
||||
assert.equal(after.capReached, false);
|
||||
assert.equal(controller.costCapStopped, false);
|
||||
assert.equal(ui.costValue.textContent, 'COST UNKNOWN');
|
||||
assert.match(ui.costValue.title, /1 caption transcription\(s\)/);
|
||||
assert.equal(ui.state.cost.text, 'COST UNKNOWN');
|
||||
assert.match(ui.state.cost.title, /1 caption transcription\(s\)/);
|
||||
});
|
||||
|
||||
test('F1: when idle, toggling does re-price the preview meter', () => {
|
||||
@@ -3453,7 +3288,7 @@ test('F4: two clicks during a live session return to the original preference', (
|
||||
|
||||
controller.toggleVoiceTier();
|
||||
assert.equal(controller.voiceTier, 'standard', 'second click switches back');
|
||||
assert.equal(ui.tierButton.textContent, 'STD');
|
||||
assert.equal(ui.state.tier.text, 'STD');
|
||||
});
|
||||
|
||||
test('F4: the toggle alternates across many clicks mid-session', () => {
|
||||
@@ -3490,7 +3325,7 @@ test('F3: an unrecognised session model bills at the most expensive known rates'
|
||||
function textCommandController() {
|
||||
const sent = [];
|
||||
const controller = new GevRealtimeController({
|
||||
ui: {},
|
||||
ui: createTestVoiceUi(),
|
||||
runner: async () => ({}),
|
||||
});
|
||||
controller.dc = { readyState: 'open' };
|
||||
|
||||
Reference in new issue
Block a user