You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extends the plaintext-response-format spec by adding a new stripUnreadableSymbols function that strips emoji, decorative Unicode, standalone special characters, math operators, and repeated punctuation from TTS input text — complementing the existing stripMarkdownFromSpeech function.
What changed
New file:packages/core-agent/src/runtime/unreadable-symbols-stripper.ts
Extends stripMarkdownFromSpeech with additional passes to strip emoji,
decorative Unicode, standalone special chars, math operators, and
repeated punctuation from TTS input text. All passes are configurable
via options with sensible defaults (strip everything by default).
Streaming control tokens (<|ACT|>, <|DELAY|>, <|CALL|>) are preserved
via Private Use Area placeholder extraction.
Closes: extends plaintext-response-format spec
We reviewed changes in add3f5d...e5e7dfb on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable
It is considered a best practice to avoid 'polluting' the global scope with variables that are intended to be local to the script. Global variables created from a script can produce name collisions with global variables created from another script, which will usually lead to runtime errors or unexpected behavior. It is mostly useful for browser scripts.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable
It is considered a best practice to avoid 'polluting' the global scope with variables that are intended to be local to the script. Global variables created from a script can produce name collisions with global variables created from another script, which will usually lead to runtime errors or unexpected behavior. It is mostly useful for browser scripts.
result = result.replace(/[\u{267F}\u{2693}\u{26A1}\u{26AA}-\u{26AB}\u{26BD}-\u{26BE}\u{26C4}-\u{26C5}\u{26CE}\u{26D4}\u{26EA}\u{26F2}-\u{26F3}\u{26F5}\u{26FA}\u{26FD}]/gu, '')
// U+2934-U+2935: Arrows
result = result.replace(/[\u{2934}-\u{2935}]/gu, '')
// U+2B05-U+2B07: Arrows
result = result.replace(/[\u{2B05}-\u{2B07}]/gu, '')
The reason will be displayed to describe this comment to others. Learn more.
Unexpected function declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable
It is considered a best practice to avoid 'polluting' the global scope with variables that are intended to be local to the script. Global variables created from a script can produce name collisions with global variables created from another script, which will usually lead to runtime errors or unexpected behavior. It is mostly useful for browser scripts.
The reason will be displayed to describe this comment to others. Learn more.
`stripUnreadableSymbols` has a cyclomatic complexity of 6 with "medium" risk
A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the
plaintext-response-formatspec by adding a newstripUnreadableSymbolsfunction that strips emoji, decorative Unicode, standalone special characters, math operators, and repeated punctuation from TTS input text — complementing the existingstripMarkdownFromSpeechfunction.What changed
New file:
packages/core-agent/src/runtime/unreadable-symbols-stripper.tsstripUnreadableSymbols(text, options?)— 6-pass sanitizer (Markdown + emoji + decorative Unicode + standalone special chars + math operators + repeated punctuation collapsing)StripUnreadableSymbolsOptionsinterface with 5 configurable boolean flags (all defaulttrue)<|ACT|>,<|DELAY|>,<|CALL|>) preserved via Private Use Area placeholder extractionstripMarkdownFromSpeechremains exported unchanged (backward compatibility)New file:
packages/core-agent/src/runtime/unreadable-symbols-stripper.test.tsModified:
packages/core-agent/src/runtime/chat-orchestrator-runtime.tsstripMarkdownFromSpeechcalls (streaming path + final categorization path) replaced withstripUnreadableSymbolsModified:
packages/core-agent/src/index.tsstripUnreadableSymbolsandStripUnreadableSymbolsOptionsNew spec:
.roo/specs/unreadable-symbols-stripper/(requirements.md, design.md, tasks.md)How tested
pnpm -F @proj-airi/core-agent typecheck— passedpnpm -F @proj-airi/core-agent exec vitest run— 164 tests passed (14 test files)