fix: mobile keyboard handlers killed on SSE reconnect — re-init after cleanup

handleInit() called KeyboardHandler.cleanup() and MobileDetection.cleanup()
on every SSE connect but never re-initialized them, breaking keyboard
scroll-into-view and the /init /clear accessory bar on mobile.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-02-18 11:59:42 +01:00
co-authored by Claude Opus 4.6
parent ee22ef204f
commit c548c2d6ee
9 changed files with 619 additions and 126 deletions
+32
View File
@@ -206,6 +206,38 @@ if (claudeFound) {
console.log(colors.cyan(' curl -fsSL https://claude.ai/install.sh | bash'));
}
// ----------------------------------------------------------------------------
// 4. Copy xterm vendor files for dev mode (src/web/public/vendor/)
// ----------------------------------------------------------------------------
try {
const require = createRequire(import.meta.url);
const xtermDir = join(require.resolve('xterm'), '..', '..');
const fitDir = join(require.resolve('xterm-addon-fit'), '..', '..');
const vendorDir = join(import.meta.dirname, '..', 'src', 'web', 'public', 'vendor');
const { mkdirSync, copyFileSync } = await import('fs');
mkdirSync(vendorDir, { recursive: true });
copyFileSync(join(xtermDir, 'css', 'xterm.css'), join(vendorDir, 'xterm.css'));
// Minify xterm JS for dev vendor dir (npm packages don't ship .min.js)
try {
execSync(`npx esbuild "${join(xtermDir, 'lib', 'xterm.js')}" --minify --outfile="${join(vendorDir, 'xterm.min.js')}"`, { stdio: 'pipe' });
execSync(`npx esbuild "${join(fitDir, 'lib', 'xterm-addon-fit.js')}" --minify --outfile="${join(vendorDir, 'xterm-addon-fit.min.js')}"`, { stdio: 'pipe' });
console.log(colors.green('✓ xterm vendor files copied to src/web/public/vendor/'));
} catch {
// Fallback: copy unminified
copyFileSync(join(xtermDir, 'lib', 'xterm.js'), join(vendorDir, 'xterm.min.js'));
copyFileSync(join(fitDir, 'lib', 'xterm-addon-fit.js'), join(vendorDir, 'xterm-addon-fit.min.js'));
console.log(colors.green('✓ xterm vendor files copied') + colors.dim(' (unminified — esbuild not available)'));
}
} catch (err) {
hasWarnings = true;
console.log(colors.yellow('⚠ Failed to copy xterm vendor files'));
console.log(colors.dim(` ${err.message}`));
console.log(colors.dim(' Dev server may fail to load xterm.js — run: npm run build'));
}
// ----------------------------------------------------------------------------
// Print Summary and Next Steps
// ----------------------------------------------------------------------------