Skip to content

feat(voice): add speech recognition API and dictation command - #3011

Open
soumik183 wants to merge 2 commits into
Acode-Foundation:mainfrom
soumik183:main
Open

soumik183 wants to merge 2 commits into
Acode-Foundation:mainfrom
soumik183:main

Conversation

@soumik183

Copy link
Copy Markdown
  • add native AcodeVoice Cordova plugin using Android SpeechRecognizer
  • expose acode.require("voice") with permissions, events, and one-shot recognition
  • add voice-input command with Ctrl-Alt-V and Web Speech API fallback
  • declare microphone permissions and remember granted access

- add native AcodeVoice Cordova plugin using Android SpeechRecognizer
- expose acode.require("voice") with permissions, events, and one-shot recognition
- add voice-input command with Ctrl-Alt-V and Web Speech API fallback
- declare microphone permissions and remember granted access
@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[High impact] The PR adds microphone-based speech recognition to Acode for callers that use the new voice API.

Fix browser cancellation before merging so cancelled calls cannot affect later recordings.

Findings

  1. P1 Cancelled calls affect new recordings ▶

Summary

Adds speech recognition through acode.require("voice"), backed by an Android plugin with a browser fallback.

  • Acode callers can start speech recognition and get transcripts.
  • Android can recognize speech and send results to Acode.

Reviews (2) · Last reviewed commit: "fix(voice): harden sessions and keep voi..." · Reviewed by Greptile

Comment thread src/lib/voice.js Resolved
Comment thread src/lib/voice.js Resolved
Comment thread src/lib/voice.js Resolved
Comment thread src/lib/voice.js Resolved
- reserve start sessions and serialize stop/cancel with pending starts
- share pending native permission requests across callers
- wait for the final Web Speech result on stop and ignore stale callbacks
- disable Web restart after non-recoverable errors
- remove the built-in voice-input command and Ctrl-Alt-V binding
@soumik183

Copy link
Copy Markdown
Author

@UnschooledGamer @bajrangCoder Please review the code, add a voice recording API for the community plugin, and then prepare a release.

Comment thread src/lib/voice.js
Comment on lines +725 to +727
detachWebHandlers(recognition);
try {
recognition.abort();

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.

P1 Cancelled calls affect new recordings

Cancelling a browser recognize() call now detaches its handlers before abort(). The cancelled call never receives the error that would settle it, so its timer and shared result listeners stay active.

If another session starts, the cancelled call can resolve with that session’s transcript. Its old timeout can also call cancel() and abort the new recording. Settle the owning recognize() call and remove its listeners and timer during cancellation, while keeping the guards against old browser events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant