Replace the legacy terminal flow with a shared authenticated WebSocket runtime used across web, desktop, relay, and mobile surfaces. - introduce the v3 terminal protocol with scoped attachments, snapshots, ordered output, bounded replay history, reconnects, and explicit lifecycle - harden PTY creation, restart, resize, close, force-kill, idle cleanup, shell selection, login mode, environment sanitization, and appearance sync - add runtime-aware terminal APIs with relay authentication and Electron parity - add a fullscreen mobile terminal workspace with touch scrolling, long-press selection, safe-area controls, quick keys, and Ctrl/Alt input - add terminal selection attachments, preview detection, project actions, shell settings, and localized UI - harden Ghostty rendering, resize recovery, Unicode handling, block characters, line height, and stale-row behavior - remove the obsolete terminal SSE path and update reverse-proxy guidance - expand terminal runtime, transport, input, selection, and store coverage - avoid duplicate web builds when preparing mobile assets in root CI builds
48 lines
1.8 KiB
JavaScript
48 lines
1.8 KiB
JavaScript
import { describe, expect, test } from 'vitest';
|
|
import { consumeTerminalThemeQueries } from './theme-response.js';
|
|
|
|
const lightAppearance = {
|
|
themeMode: 'light',
|
|
foreground: '#1b1b1b',
|
|
background: '#faf8f0',
|
|
modeEnabled: false,
|
|
};
|
|
|
|
describe('terminal theme responses', () => {
|
|
test('answers the complete OpenTUI startup handshake', () => {
|
|
const result = consumeTerminalThemeQueries(
|
|
'',
|
|
'\u001b[?2031h\u001b]10;?\u001b\\\u001b]11;?\u001b\\\u001b[?2031$p',
|
|
lightAppearance,
|
|
);
|
|
expect(result).toEqual({
|
|
pending: '',
|
|
modeEnabled: true,
|
|
responses: [
|
|
'\u001b]10;rgb:1b1b/1b1b/1b1b\u001b\\',
|
|
'\u001b]11;rgb:fafa/f8f8/f0f0\u001b\\',
|
|
'\u001b[?2031;1$y',
|
|
],
|
|
});
|
|
});
|
|
|
|
test('handles a query split across PTY output chunks without duplicating it', () => {
|
|
const first = consumeTerminalThemeQueries('', '\u001b]11;', { ...lightAppearance, themeMode: 'dark' });
|
|
const second = consumeTerminalThemeQueries(first.pending, '?\u001b\\', { ...lightAppearance, themeMode: 'dark', modeEnabled: first.modeEnabled });
|
|
const third = consumeTerminalThemeQueries(second.pending, 'x', { ...lightAppearance, themeMode: 'dark', modeEnabled: second.modeEnabled });
|
|
expect(second.responses).toEqual(['\u001b]11;rgb:fafa/f8f8/f0f0\u001b\\']);
|
|
expect(second.pending).toBe('');
|
|
expect(third.responses).toEqual([]);
|
|
});
|
|
|
|
test('answers every repeated query in wire order', () => {
|
|
const result = consumeTerminalThemeQueries('', '\u001b[?996n\u001b[?996n\u001b]10;?\u0007\u001b]10;?\u0007', lightAppearance);
|
|
expect(result.responses).toEqual([
|
|
'\u001b[?997;2n',
|
|
'\u001b[?997;2n',
|
|
'\u001b]10;rgb:1b1b/1b1b/1b1b\u001b\\',
|
|
'\u001b]10;rgb:1b1b/1b1b/1b1b\u001b\\',
|
|
]);
|
|
});
|
|
});
|