Skip to content

Voice Mode: migrate from vendored libs to VS Code patterns#321168

Merged
meganrogge merged 6 commits into
mainfrom
meganrogge/migrate-voice-libs
Jun 12, 2026
Merged

Voice Mode: migrate from vendored libs to VS Code patterns#321168
meganrogge merged 6 commits into
mainfrom
meganrogge/migrate-voice-libs

Conversation

@meganrogge

Copy link
Copy Markdown
Collaborator

Resolves #321142

Summary

Migrates the voice UI from vendored lit-html and @preact/signals-core to VS Code's native patterns.

1. preact-signals → VS Code observables

  • 23 signal()observableValue()
  • 1 computed()derived()
  • 3 effect()autorun()
  • All .value reads → .read(reader) (tracked) or .get() (untracked)
  • All .value writes → .set(value, undefined)

2. lit-html → imperative DOM construction

Each component is now a factory function returning { element, update(props) }:

  • element: stable DOM node created once
  • update(): targeted mutations (no full rebuilds)

This preserves focus, scroll position, and textarea state across re-renders.

3. Glow animation decoupled from reactive system

The glow/waveform animation (running at 60fps via requestAnimationFrame) previously updated two observables each frame, triggering full autorun re-renders. Now it directly updates the glow element's CSS — the autorun only fires for actual state changes.

4. Vendored libraries removed

  • Deleted src/vs/base/common/lit-html/ (11 files)
  • Deleted src/vs/base/common/signals-core/ (3 files)

No other consumers existed.

Files changed

  • agentsVoiceWidget.ts — signals + render loop migration
  • 8 component files in components/ — lit-html → DOM
  • Vendored library directories removed

meganrogge and others added 3 commits June 12, 2026 11:14
Replace signal(), computed(), effect() from vendored signals-core with
observableValue(), derived(), autorun() from VS Code's observable system.

- 23 signal() → observableValue()
- 1 computed() → derived()
- 3 effect() → autorun()
- All .value reads → .get() (untracked) or .read(reader) (tracked in autorun)
- All .value writes → .set(value, undefined)

Part of #321142

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace all lit-html html`` tagged templates and render() calls with VS Code-style
imperative DOM construction using dom.$(), document.createElement(), and
addEventListener().

Each component is now a factory function returning { element, update(props) }:
- element: stable HTMLElement created once
- update(): targeted DOM mutations (no full rebuilds)

Key improvements:
- Glow animation decoupled from autorun — direct RAF style updates
  eliminates 60fps observable thrashing
- Stable DOM structure preserves focus, scroll position, and textarea state
- No more vendored lit-html dependency

Components migrated (8 files, ~860 lines):
- confirmationComponent.ts
- voiceBarComponent.ts
- statusRowsComponent.ts
- transcriptComponent.ts
- onboardingComponent.ts
- feedbackDialog.ts
- headerComponent.ts
- sessionListComponent.ts

Widget (agentsVoiceWidget.ts):
- Replaced _view() returning TemplateResult with _updateDOM() doing targeted updates
- Components created once in field initializers, updated in autorun
- Removed _glowIntensity and _glowPhase observables (now local to RAF loop)

Part of #321142

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These vendored libraries are no longer used after migrating to VS Code's
native DOM construction and observable patterns.

- Removed src/vs/base/common/lit-html/ (11 files)
- Removed src/vs/base/common/signals-core/ (3 files)

Part of #321142

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 12, 2026 15:30
@meganrogge meganrogge added debt Code quality issues voice-mode labels Jun 12, 2026
@meganrogge meganrogge self-assigned this Jun 12, 2026
@meganrogge meganrogge marked this pull request as draft June 12, 2026 15:31
@meganrogge meganrogge marked this pull request as ready for review June 12, 2026 15:37
- Remove toggleWindow() call from pushToTalk action (prevents Space from
  opening the mini aux window)
- Add dynamic PTT key tracking: captures last keydown code at document
  level, snapshots it on pttDown, matches on keyup — works with any
  rebound key, not just hardcoded Space
- Add keydown preventDefault to block role='button' click activation
  during hold-to-talk

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Agents Voice UI away from vendored lit-html and @preact/signals-core to VS Code’s native observable/reactive patterns and imperative DOM construction, while also removing the now-unused vendored libraries.

Changes:

  • Replaced signal/computed/effect usage with observableValue/derived/autorun in AgentsVoiceWidget, and moved the glow animation to direct DOM updates in the RAF loop.
  • Reworked Agents Voice UI components from lit-html templates into stable DOM factories (createX(): { element, update(...) }) with targeted updates.
  • Deleted the vendored lit-html and signals-core implementations and their CG manifests.
Show a summary per file
File Description
src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts Migrates widget state to VS Code observables, replaces templated rendering with imperative DOM updates, and decouples the glow animation from reactivity.
src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.ts Converts the header from lit-html to DOM factory/update pattern and rewires header actions imperatively.
src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.ts Converts onboarding UI from template rendering to imperative DOM construction with an update() pass.
src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.ts Converts session list rendering to imperative DOM; rebuilds list on update and rewires per-row actions.
src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.ts Converts status row rendering to imperative DOM and integrates tool confirmations via component factory.
src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.ts Converts transcript rendering to imperative DOM and performs per-update rebuilding of visible turns.
src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.ts Replaces lit-html dialog rendering with a component factory and updates controller to use update()/clearNode().
src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.ts Converts tool confirmation rendering to imperative DOM factory/update pattern.
src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.ts Converts the voice bar from template rendering to imperative DOM factory/update pattern.
src/vs/base/common/signals-core/signals-core.js Removed vendored @preact/signals-core runtime.
src/vs/base/common/signals-core/signals-core.d.ts Removed vendored @preact/signals-core types.
src/vs/base/common/signals-core/cgmanifest.json Removed CG manifest for vendored @preact/signals-core.
src/vs/base/common/lit-html/lit-html.js Removed vendored lit-html runtime.
src/vs/base/common/lit-html/lit-html.d.ts Removed vendored lit-html types.
src/vs/base/common/lit-html/lit-html.d.ts.map Removed vendored lit-html type map.
src/vs/base/common/lit-html/directive.js Removed vendored lit-html directive helpers.
src/vs/base/common/lit-html/directive.d.ts Removed vendored lit-html directive types.
src/vs/base/common/lit-html/directive.d.ts.map Removed vendored lit-html directive type map.
src/vs/base/common/lit-html/directive-helpers.js Removed vendored lit-html directive helper utilities.
src/vs/base/common/lit-html/directive-helpers.d.ts Removed vendored lit-html directive helper types.
src/vs/base/common/lit-html/directive-helpers.d.ts.map Removed vendored lit-html directive helper type map.
src/vs/base/common/lit-html/directives/repeat.js Removed vendored lit-html repeat directive runtime.
src/vs/base/common/lit-html/directives/repeat.d.ts Removed vendored lit-html repeat directive types.
src/vs/base/common/lit-html/directives/repeat.d.ts.map Removed vendored lit-html repeat directive type map.
src/vs/base/common/lit-html/cgmanifest.json Removed CG manifest for vendored lit-html.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts:582

  • The fallback feedback error message is user-visible but not localized ('Failed to submit'). This should use localize(...) like the rest of the voice UI strings.
		}
	}

	/**
  • Files reviewed: 17/26 changed files
  • Comments generated: 15

Comment thread src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.ts Outdated
Comment thread src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.ts Outdated
Comment thread src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts
Comment thread src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts
Comment thread src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts
Comment thread src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.ts Outdated
…ice-libs

# Conflicts:
#	src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.ts
@meganrogge meganrogge marked this pull request as draft June 12, 2026 15:43
- Fix style injection bug: move transcript CSS outside clearNode scope
- Add Enter/Space keyboard activation to all role='button' elements
  via shared addKeyboardActivation() helper in tokens.ts
- Change mousedown→click handlers for session row actions (keyboard compat)
- Add focusin/focusout to session rows to reveal actions for keyboard users
- Fix popout button visibility in centerConnectButton mode
- Make chevron wrapper a proper button (role, tabIndex, key handler)
- Localize 'Failed to submit' fallback string

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meganrogge meganrogge marked this pull request as ready for review June 12, 2026 15:47
@meganrogge meganrogge enabled auto-merge (squash) June 12, 2026 15:47
@meganrogge meganrogge merged commit 115a1e0 into main Jun 12, 2026
25 checks passed
@meganrogge meganrogge deleted the meganrogge/migrate-voice-libs branch June 12, 2026 16:56
@vs-code-engineering vs-code-engineering Bot added this to the 1.125.0 milestone Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Code quality issues voice-mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Voice Mode: migrate from vendored libs to VS Code patterns

3 participants