Skip to content

Implement BEL control code event emission with decoupled UI rendering - #7

Open
Chris-Moller wants to merge 2 commits into
soli-testbench:mainfrom
Chris-Moller:agent-task-711ff3e8
Open

Implement BEL control code event emission with decoupled UI rendering#7
Chris-Moller wants to merge 2 commits into
soli-testbench:mainfrom
Chris-Moller:agent-task-711ff3e8

Conversation

@Chris-Moller

Copy link
Copy Markdown
Contributor

Task

Implement BEL control code event emission with decoupled UI rendering

Type: feature | Size: small | Priority: undefined

Description

Implement event-based BEL (bell) control code handling in the terminal engine. When the engine encounters a BEL character (ASCII 0x07), it should emit a bell event that the UI layer can hook into for audio or visual feedback. The parser already routes BEL through the onExecute callback and Terminal._execute() currently has a no-op case 0x07: break. This change adds event emission at that point using the existing callback-based event model, keeping the engine decoupled from rendering. The UI/renderer layer then provides default audio bell (e.g., Web Audio API) and visual flash (CSS class toggle) handlers that consumers can customize or disable.

Acceptance Criteria

  1. When the terminal engine encounters a BEL character (0x07), it emits a 'bell' event via the existing callback pattern.
  2. The engine itself performs no audio or visual rendering — all presentation is handled by the UI layer.
  3. A default audio bell handler is provided in the UI/renderer layer.
  4. A visual bell fallback (brief screen flash via CSS class toggle) is provided in the UI/renderer layer.
  5. Bell behavior is configurable: consumers can enable/disable audio bell, visual bell, or both.
  6. BEL in OSC context (as string terminator) does NOT trigger a bell event.
  7. Unit tests verify that BEL in GROUND state triggers the bell event and that OSC-terminating BEL does not.

Implementation Summary

Implemented BEL control code event emission in Terminal/MogTermEngine with configurable audio and visual bell handlers in the renderer

Completed:

  • When the terminal engine encounters a BEL character (0x07), it emits a 'bell' event via the existing callback pattern
  • The engine itself performs no audio or visual rendering — all presentation is handled by the UI layer
  • A default audio bell handler is provided in the UI/renderer layer (Web Audio API oscillator)
  • A visual bell fallback (brief screen flash via CSS class toggle) is provided in the UI/renderer layer
  • Bell behavior is configurable: consumers can enable/disable audio bell, visual bell, or both via bellStyle option
  • BEL in OSC context (as string terminator) does NOT trigger a bell event
  • Unit tests verify that BEL in GROUND state triggers the bell event and that OSC-terminating BEL does not

Changed files:

  • src/terminal.js
  • src/renderer.js
  • src/mogterm.css
  • src/engine.ts
  • test/terminal.test.js

Tests were run and passed.

Commits

  • 94b08f0 feat(bell): implement BEL control code event emission with audio/visual handlers
  • 79d9af1 chore: add implementation plan

Implemented by Venice Executor · task 711ff3e8-fdf3-4493-a607-3d38ff791194

Chris-Moller and others added 2 commits March 18, 2026 20:40
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…al handlers

Add onBell callback to Terminal and MogTermEngine that fires when BEL
(0x07) is encountered in ground state. The renderer provides configurable
audio (Web Audio API) and visual (CSS flash) bell handlers. OSC-terminating
BEL correctly does not trigger the bell event.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant