Repository navigation
Feat/speech - #4
Conversation
speak and listen wrap the Web Speech API with the handling browsers need: long text split into short utterances, a cancel before new speech and a retry when Chrome accepts speech but never starts it, pausing without the browser's pause, and continuous listening restarted until stopped. React hooks (useSpeech, useListen, useVoices) are in @plexusone/speech/react, and a standalone build exposes window.PlexusSpeech. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
speak takes onWord, called with each word's segment and its start and end offsets in the text passed, mapped back through chunking and whitespace collapsing. A boundary without a length runs to the next space or punctuation. useSpeech keeps the current word in word when trackWords is set; it is off by default because it re-renders on every word. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chrome includes trailing punctuation in a word's length while Safari gives no length, so the two marked different spans. Punctuation is now trimmed from both ends of every word, a closing apostrophe is kept, and a piece that is only punctuation is not reported. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A dash, an ellipsis or a symbol spoken on its own was reported as a word. A word now needs a letter or digit, and dashes are trimmed from its ends like other punctuation. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@plexusone/speech is added at 0.1.0. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
|
| Layer / File(s) | Summary |
|---|---|
Text chunking and speech synthesis packages/speech/src/text.ts, packages/speech/src/synthesis.ts, packages/speech/src/errors.ts, packages/speech/src/index.ts, packages/speech/src/__tests__/fakes.ts, packages/speech/src/__tests__/text.test.ts, packages/speech/src/__tests__/synthesis.test.ts |
Adds text chunking with source-position mapping, speech playback controls, voice selection, word-boundary reporting, and speech error handling. Tests cover chunking, playback, voice loading, and speech events. |
Browser speech recognition packages/speech/src/recognition.ts, packages/speech/src/__tests__/fakes.ts, packages/speech/src/__tests__/recognition.test.ts |
Adds recognition configuration, transcript updates, continuous-session restart, silence limits, and stop and abort controls. Tests cover results, session endings, errors, and unsupported recognition. |
React speech hooks packages/speech/src/react.ts, packages/speech/src/__tests__/react.test.tsx |
Adds useVoices, useSpeech, and useListen. The hooks expose speech and recognition state, support status, controls, and cleanup behavior. |
Package entry points and builds packages/speech/package.json, packages/speech/tsconfig.json, packages/speech/tsup.config.ts, vitest.config.ts, packages/speech/README.md |
Defines package entry points, build settings, and a test alias. The package README documents installation and entry points. |
Package documentation and release docs/packages/speech.md, docs/guides/read-aloud.md, docs/releases/v0.6.0.md, docs/packages/index.md, mkdocs.yml, CHANGELOG.json, CHANGELOG.md, docs/changelog.md, README.md |
Adds speech package and read-aloud documentation, includes the package and release in documentation navigation and package listings, and records the v0.6.0 release. |
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Application
participant useSpeech
participant speak
participant SpeechSynthesis
Application->>useSpeech: provide speech input and options
useSpeech->>speak: start speech
speak->>SpeechSynthesis: enqueue utterance
SpeechSynthesis-->>speak: report utterance events
speak-->>useSpeech: report state and completion
useSpeech-->>Application: expose updated hook state
sequenceDiagram
participant Application
participant useListen
participant listen
participant SpeechRecognition
Application->>useListen: start recognition
useListen->>listen: provide recognition options
listen->>SpeechRecognition: start recognition session
SpeechRecognition-->>listen: report transcript and session events
listen-->>useListen: report results and completion
useListen-->>Application: expose transcript and listening state
Merge Risk: 
Moderate · previous review afbaa
-
The speech package works for the common paths, but a few issues should be handled before release. Dictation on Android Chrome may duplicate transcript text. Mixing the main and React entry points splits speech state. The standalone browser build could be deleted during a build. The docs should not imply that dictation stays on-device.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 55.88% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 34 functions across 13 files. (12 skipped: 12 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
With splitting off, the main and React entry points each bundled their own copy of the speaking code, so stopSpeaking() and new speech from one could not see speech started through the other. Both now load one shared chunk. The two builds run at once, so the module build no longer cleans the standalone build's file. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Chrome on Android marks each partial result final with confidence 0, so dictation appended every partial result and repeated the text. Those results now stay interim, and interim text left when a session ends is kept, so nothing is lost on a browser that never sends a final result. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… length Without a word length, as in Safari, a word ran only to the next punctuation, so "don't" was marked as "don" and "3.5" as "3". It now runs to the next space or dash, and punctuation at its ends is trimmed as before. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n's end and word ends Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… button Chrome sends dictation audio to Google's speech service, so the docs no longer say there is no service. The highlighting example starts speech from a button, and the guide's start-timeout message reads the error of the hook that started the speech. Refs: RMI-SYSTEMFORGEWEB-031 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary by CodeRabbit