Compare commits

..
14 changed files with 32 additions and 52 deletions

No files matched your search

@@ -0,0 +1,5 @@
- Keep single-key app shortcuts off Cmd, Ctrl and Alt combinations, so Cmd+F,
Cmd+C and Cmd+R reach the browser instead of hiding the layer panel or
switching layers on. `F` now collapses the layer panel the way its button
does, instead of hiding the panel and the button that brings it back
(asturksever, #1598).
@@ -1,4 +0,0 @@
- Without `OPENAI_API_KEY`, the mic now says the key is missing and to add it in
Provider Settings, instead of showing the raw server error with a hint to
check microphone permissions. `/api/realtime/token` returns
`code: "API_KEY_MISSING"` with its 503 (asturksever, #1599).
+1 -6
View File
@@ -224,12 +224,7 @@ function createRealtimeTokenHandler({
if (!bearer) {
res.statusCode = 503;
res.setHeader('Content-Type', 'application/json');
res.end(
JSON.stringify({
error: 'OPENAI_API_KEY is not set',
code: 'API_KEY_MISSING',
}),
);
res.end(JSON.stringify({ error: 'OPENAI_API_KEY is not set' }));
return;
}
}
+1 -4
View File
@@ -150,10 +150,7 @@ test('the installed keyless HUD route stays successful after the voice quota is
const firstToken = await invokeRoute(token);
const secondToken = await invokeRoute(token);
assert.equal(firstToken.statusCode, 503);
assert.deepEqual(firstToken.body, {
error: 'OPENAI_API_KEY is not set',
code: 'API_KEY_MISSING',
});
assert.deepEqual(firstToken.body, { error: 'OPENAI_API_KEY is not set' });
assert.equal(secondToken.statusCode, 429);
for (let attempt = 0; attempt < 2; attempt += 1) {
+1
View File
@@ -542,6 +542,7 @@ export class StyleManager extends ShellFacade {
_toggleOrbit: (...args) => this._toggleOrbit(...args),
toggleCleanView: (...args) => this.toggleCleanView(...args),
_toggleCctvEnabled: (...args) => this._toggleCctvEnabled(...args),
_togglePanel: (panelId) => this._panelChrome._togglePanel(panelId),
_setBloomEnabled: (...args) => this._setBloomEnabled(...args),
_setBloomIntensity: (...args) => this._setBloomIntensity(...args),
_setSharpenEnabled: (...args) => this._setSharpenEnabled(...args),
+5
View File
@@ -27,6 +27,11 @@ export function bindApplicationShortcuts({
event.target?.matches?.('select, input, textarea') ||
event.target === searchInput;
if (isFormControl && event.key !== 'Escape') return;
// Browser and OS shortcuts (Cmd+C, Ctrl+F, Alt+1…) are not ours.
if (event.metaKey || event.ctrlKey || event.altKey) {
if (event.key === 'Escape') actions.dismissSearch();
return;
}
if (STYLE_KEYS[event.key]) actions.setStyle(STYLE_KEYS[event.key]);
if (event.key === 'Escape') actions.dismissSearch();
+2 -2
View File
@@ -64,8 +64,8 @@ export class DisplayBindings {
},
toggleOrbit: () => this._toggleOrbit(),
toggleCleanView: () => this.toggleCleanView(),
toggleLayers: () =>
document.getElementById('data-panel').classList.toggle('active'),
// Same collapse as the panel's own button, so its rail entry stays.
toggleLayers: () => this._togglePanel('data-panel'),
cycleDetection: () => {
this.shareLinkManager?.claimRestoreLane?.('visual');
this.claimDetection();
+1 -1
View File
@@ -166,7 +166,7 @@ const frameStyle = (panel) => ({
<button class="gev-voice-error-dismiss" type="button" @click="controls?.dismissError()">{{ t('DISMISS') }}</button>
</div>
<div id="gev-voice-error-detail">{{ view.error.text }}</div>
<div class="gev-voice-error-hint" :hidden="view.error.typed || view.error.hint === false">{{ t('Check microphone permission and network access, then try again.') }}</div>
<div class="gev-voice-error-hint" :hidden="view.error.typed">{{ t('Check microphone permission and network access, then try again.') }}</div>
</div>
</div>
</template>
+12 -2
View File
@@ -117,9 +117,19 @@ test('the supplied search target retains editing even without form markup', () =
assert.deepEqual(f.calls, [['dismissSearch']]);
});
test('shortcut extraction does not change repeat or modifier policy', () => {
test('browser shortcuts with Cmd, Ctrl or Alt never reach app shortcuts', () => {
const f = shortcuts();
f.press('h', new Element(), { repeat: true, ctrlKey: true });
for (const modifier of ['metaKey', 'ctrlKey', 'altKey'])
for (const key of ['1', 'h', 'o', 'v', 'f', 'd', 'c'])
f.press(key, new Element(), { [modifier]: true });
assert.deepEqual(f.calls, []);
f.press('Escape', new Element(), { metaKey: true });
assert.deepEqual(f.calls, [['dismissSearch']]);
});
test('a held key still repeats its shortcut', () => {
const f = shortcuts();
f.press('h', new Element(), { repeat: true });
assert.deepEqual(f.calls, [['toggleHud']]);
});
+1 -1
View File
@@ -107,7 +107,7 @@ function initialState(panel) {
t('Hold Space to speak · tap Space to activate focused controls'),
},
// A typed chat error reads as chat's, without the microphone hint.
error: { text: '', typed: false, hint: true },
error: { text: '', typed: false },
// Connection and turn state beside the selected mode's indicator.
phase: { text: '' },
voicePanel: {
+2 -3
View File
@@ -39,9 +39,8 @@ export function createRealtimeBackend({
if (!response.ok) {
const reason =
typeof data?.error === 'string' ? data.error : data?.error?.message;
throw Object.assign(
new Error(reason || `Realtime token failed: HTTP ${response.status}`),
typeof data?.code === 'string' ? { code: data.code } : {},
throw new Error(
reason || `Realtime token failed: HTTP ${response.status}`,
);
}
const token =
-14
View File
@@ -143,17 +143,3 @@ test('controller lifetime stops pending transport and releases resources through
assert.equal(controller.stream, null);
assert.equal(controller.isActive(), false);
});
test('a missing server key keeps its code, so the UI can point to Provider Settings', async () => {
const backend = createRealtimeBackend({
tokenTransport: async () =>
Response.json(
{ error: 'OPENAI_API_KEY is not set', code: 'API_KEY_MISSING' },
{ status: 503 },
),
});
await assert.rejects(backend.requestToken(), {
message: 'OPENAI_API_KEY is not set',
code: 'API_KEY_MISSING',
});
});
+1 -4
View File
@@ -18,7 +18,7 @@ import {
} from './pointerContext.js';
import { shouldPauseRadioForVoice } from './realtimeProtocol.js';
import { missingVoiceKeyText, postDebugLog } from './realtimeDiagnostics.js';
import { postDebugLog } from './realtimeDiagnostics.js';
export {
readStoredVoiceTier,
@@ -436,9 +436,6 @@ export class GevRealtimeController extends RealtimeFacade {
status === 'error'
? resolvedDetail() || t('Voice session could not be started.')
: '',
// "Check microphone permission" is wrong advice for a missing key.
hint: () =>
!(status === 'error' && resolvedDetail() === missingVoiceKeyText()),
});
if (status === 'idle' || status === 'connecting' || status === 'error') {
this.setVoiceSpeaker('idle');
-11
View File
@@ -1,11 +1,3 @@
import { t } from '../i18n/index.js';
/** The voice error when the server has no OpenAI key: where to add it. */
export const missingVoiceKeyText = () =>
t('Needs {envVars} — add it in Provider Settings', {
envVars: 'OPENAI_API_KEY',
});
const ERROR_LOG_LIMIT = 30;
const ERROR_STORAGE_KEY = 'gev-realtime-errors';
@@ -91,7 +83,6 @@ function createErrorRecord(source, error, extra = {}) {
String(error?.message || '').trim() ||
'No browser error message supplied',
errorDetail: rtcError?.errorDetail || null,
code: typeof rtcError?.code === 'string' ? rtcError.code : null,
sctpCauseCode: rtcError?.sctpCauseCode ?? null,
receivedAlert: rtcError?.receivedAlert ?? null,
sentAlert: rtcError?.sentAlert ?? null,
@@ -100,8 +91,6 @@ function createErrorRecord(source, error, extra = {}) {
}
function formatErrorForDisplay(record) {
// A missing key is a setup step, not a connection fault: say where to add it.
if (record.code === 'API_KEY_MISSING') return missingVoiceKeyText();
const primary = [record.source, record.message].filter(Boolean).join(': ');
const state = [
record.errorDetail && `detail=${record.errorDetail}`,