[PR #4182] [MERGED] Smooth Roleplay streaming typewriter cadence #6273

Closed
opened 2026-10-23 04:08:49 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4182
Author: @SpicyMarinara
Created: 7/27/2026
Status: ✅ Merged
Merged: 7/27/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/roleplay-unified-typewriter


📝 Commits (1)

  • 2b6f317 Smooth Roleplay streaming typewriter cadence

📊 Changes

3 files changed (+143 additions, -8 deletions)

View changed files

📝 packages/client/src/hooks/use-generate.ts (+41 -8)
📝 packages/client/src/lib/generation-stream-policy.ts (+44 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+58 -0)

📄 Description

Linked issue

Closes #4181

Why this change

  • Roleplay streaming followed irregular provider token bursts too closely, so the visible typewriter effect paused and arrived in chunks.
  • The reveal also jumped back to the selected maximum speed as soon as transport completed, making the final text visibly accelerate.

What changed

  • Added a short Roleplay-only jitter buffer before the first visible character.
  • Decoupled Roleplay reveal pacing from provider arrival samples and introduced one queue-aware animation clock.
  • Added asymmetric easing so the typewriter slows promptly near an empty reserve and accelerates gently as more text arrives.
  • Kept Streaming Speed as the maximum cadence and preserved speed 100 as instant display.
  • Added regression coverage for buffering, acceleration, deceleration, completion, and instant mode.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Maintainer tested Roleplay streaming with the configured typewriter speed and confirmed the new cadence works well.
  • Automated synthetic pacing proof covered both frequent small chunks and 30-character bursts arriving 750 ms apart; visible output remained governed by the reveal clock.
  • pnpm check passed locally. The existing unrelated NoodleHome.tsx exhaustive-deps warning remains.
  • pnpm regression:roleplay passed, including the new cadence assertions.
  • Focused ESLint passed for the changed client files.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

  • Motion-only behavior change; maintainer verification is documented above.

Summary by CodeRabbit

  • New Features

    • Improved Roleplay and visual-novel streaming with a brief prebuffer before text begins appearing.
    • Adjusted typewriter reveal speed dynamically to provide smoother pacing as content streams, accelerates, slows, or completes.
  • Bug Fixes

    • Improved handling of buffered text and state resets when changing turns or flushing generated content.
  • Tests

    • Added coverage for buffering, speed changes, completion behavior, and immediate text flushing.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4182 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/27/2026 **Status:** ✅ Merged **Merged:** 7/27/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/roleplay-unified-typewriter` --- ### 📝 Commits (1) - [`2b6f317`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2b6f31769d074eff7139c8bb0862a9af7b7fd62e) Smooth Roleplay streaming typewriter cadence ### 📊 Changes **3 files changed** (+143 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/hooks/use-generate.ts` (+41 -8) 📝 `packages/client/src/lib/generation-stream-policy.ts` (+44 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+58 -0) </details> ### 📄 Description ## Linked issue Closes #4181 ## Why this change - Roleplay streaming followed irregular provider token bursts too closely, so the visible typewriter effect paused and arrived in chunks. - The reveal also jumped back to the selected maximum speed as soon as transport completed, making the final text visibly accelerate. ## What changed - Added a short Roleplay-only jitter buffer before the first visible character. - Decoupled Roleplay reveal pacing from provider arrival samples and introduced one queue-aware animation clock. - Added asymmetric easing so the typewriter slows promptly near an empty reserve and accelerates gently as more text arrives. - Kept Streaming Speed as the maximum cadence and preserved speed 100 as instant display. - Added regression coverage for buffering, acceleration, deceleration, completion, and instant mode. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Maintainer tested Roleplay streaming with the configured typewriter speed and confirmed the new cadence works well. - Automated synthetic pacing proof covered both frequent small chunks and 30-character bursts arriving 750 ms apart; visible output remained governed by the reveal clock. - `pnpm check` passed locally. The existing unrelated `NoodleHome.tsx` exhaustive-deps warning remains. - `pnpm regression:roleplay` passed, including the new cadence assertions. - Focused ESLint passed for the changed client files. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) - Motion-only behavior change; maintainer verification is documented above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved Roleplay and visual-novel streaming with a brief prebuffer before text begins appearing. * Adjusted typewriter reveal speed dynamically to provide smoother pacing as content streams, accelerates, slows, or completes. * **Bug Fixes** * Improved handling of buffered text and state resets when changing turns or flushing generated content. * **Tests** * Added coverage for buffering, speed changes, completion behavior, and immediate text flushing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:08:49 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6273
No description provided.