[PR #8548] [MERGED] feat(mari): stream her field text into the open character editor #8664

Closed
opened 2026-11-07 16:46:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8548
Author: @Gunterlie
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @Gunterlie

Base: staging ← Head: feat/mari-quick-edit-stream


📝 Commits (1)

  • 3669a55 feat(mari): stream her field text into the open character editor

📊 Changes

9 files changed (+305 additions, -26 deletions)

View changed files

📝 packages/client/src/components/characters/MariFieldReview.tsx (+3 -0)
➕ packages/client/src/components/characters/MariFieldWriting.tsx (+18 -0)
📝 packages/client/src/components/chat/mari/use-mari-workspace-run.ts (+33 -1)
📝 packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/client/src/stores/ui.store.ts (+5 -0)
📝 packages/client/src/styles/mari.css (+17 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+130 -25)
📝 packages/shared/src/types/professor-mari-workspace.ts (+4 -0)
➕ scripts/regressions/professor-mari/field-stream.regression.ts (+94 -0)

📄 Description

Linked issue

No issue: planned work, slice 8 of the Professor Mari companion (#8418).

Why this change

Today Prof. Mari's new text for a character field appears only when her run ends. While she writes, the open editor shows nothing, so a long rewrite looks stuck. Now her text streams into the open field as she writes it, and the existing review or applied state takes over when the round ends.

What changed

  • Server: a small streaming JSON reader follows the classic runtime's frame (classic round only) and streams the string values of app_data character.update arguments.
  • New stream event edit_delta: { characterId, field, text, restart?: true } | null. field is the patch key as written; text is appended; restart marks the first chunk of a value; null ends the round after its command was applied or held.
  • Decoder fixes in the shared JSON string decoder (also used for her streamed say): \uXXXX, surrogate pairs split across chunks, \b, \f; a bad \uZZZZ stays literal.
  • Client: the store keeps her text per character (characterId → fieldId → text), so an editor opened mid-stream shows the full text so far and other characters show nothing.
  • Client: a read-only "Prof. Mari is writing…" overlay in MariFieldReview, shown only when the field has no focus. The form text is not changed. Opacity-only waver, off with reduced motion.
  • A later command for the same field restarts its text; action aliases match through normalizeAppDataActionName.
  • New regression scripts/regressions/professor-mari/field-stream.regression.ts.
  • Not yet: the Pi runtime does not stream (native tool calls), and editors other than the Character editor do not stream.

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

Agent-run checks:

  • Server and client tsc --noEmit, eslint on touched client files, prettier --check, pnpm build, pnpm localization:check: pass. Full pnpm check was not run.
  • node ./scripts/run-regressions.mjs --filter field-stream: pass.
  • Live check with a real model (MiniMax M3, classic runtime, 1440 px, before the review fixes): applied path streamed into Description, then "Edited by Prof. Mari" with Undo; held path streamed, then the in-field review with Keep / Not this one, server text unchanged. No console errors.
  • Seeded Playwright check without a model (mock stream, 1440 and 390 px, after the review fixes), 12/12: other character shows no overlay; text grows; Stop removes the overlay and leaves the form text unchanged; a focused field keeps its textarea and focus; after blur the overlay shows. No console errors.

Not verified:

  • A real-model run after the review fixes.
  • Abort in the middle of a real-model stream (the mock stream covered Stop).
  • That the old value no longer flashes between the round end and the applied or held state.
  • 768 px width.

To verify manually:

  • Open a character on the Card tab, open Prof. Mari (classic runtime), ask her to rewrite the Description, and see her text stream into the field with "Prof. Mari is writing…".
  • In Manual mode, confirm the in-field review (Keep / Not this one) takes over when she finishes; in Auto mode, confirm "Edited by Prof. Mari" with Undo.
  • Click into the field while she writes: the textarea keeps focus and your text; after you click elsewhere her text shows again.
  • Press Stop mid-stream: her text goes away and the field shows your text.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)

Screenshots were taken locally (1440 and 390 px) and are not attached.


🔄 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/8548 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `feat/mari-quick-edit-stream` --- ### 📝 Commits (1) - [`3669a55`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3669a55137dda9866a2b7f04db59149220a33deb) feat(mari): stream her field text into the open character editor ### 📊 Changes **9 files changed** (+305 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/characters/MariFieldReview.tsx` (+3 -0) ➕ `packages/client/src/components/characters/MariFieldWriting.tsx` (+18 -0) 📝 `packages/client/src/components/chat/mari/use-mari-workspace-run.ts` (+33 -1) 📝 `packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/client/src/stores/ui.store.ts` (+5 -0) 📝 `packages/client/src/styles/mari.css` (+17 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+130 -25) 📝 `packages/shared/src/types/professor-mari-workspace.ts` (+4 -0) ➕ `scripts/regressions/professor-mari/field-stream.regression.ts` (+94 -0) </details> ### 📄 Description ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> No issue: planned work, slice 8 of the Professor Mari companion (#8418). ## Why this change <!-- What user problem, bug, or goal does this solve? --> Today Prof. Mari's new text for a character field appears only when her run ends. While she writes, the open editor shows nothing, so a long rewrite looks stuck. Now her text streams into the open field as she writes it, and the existing review or applied state takes over when the round ends. - ## What changed <!-- List the key changes in this PR --> - Server: a small streaming JSON reader follows the classic runtime's frame (classic round only) and streams the string values of `app_data` `character.update` arguments. - New stream event `edit_delta`: `{ characterId, field, text, restart?: true } | null`. `field` is the patch key as written; `text` is appended; `restart` marks the first chunk of a value; `null` ends the round after its command was applied or held. - Decoder fixes in the shared JSON string decoder (also used for her streamed `say`): `\uXXXX`, surrogate pairs split across chunks, `\b`, `\f`; a bad `\uZZZZ` stays literal. - Client: the store keeps her text per character (`characterId → fieldId → text`), so an editor opened mid-stream shows the full text so far and other characters show nothing. - Client: a read-only "Prof. Mari is writing…" overlay in `MariFieldReview`, shown only when the field has no focus. The form text is not changed. Opacity-only waver, off with reduced motion. - A later command for the same field restarts its text; action aliases match through `normalizeAppDataActionName`. - New regression `scripts/regressions/professor-mari/field-stream.regression.ts`. - Not yet: the Pi runtime does not stream (native tool calls), and editors other than the Character editor do not stream. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `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 <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> Agent-run checks: - Server and client `tsc --noEmit`, `eslint` on touched client files, `prettier --check`, `pnpm build`, `pnpm localization:check`: pass. Full `pnpm check` was not run. - `node ./scripts/run-regressions.mjs --filter field-stream`: pass. - Live check with a real model (MiniMax M3, classic runtime, 1440 px, before the review fixes): applied path streamed into Description, then "Edited by Prof. Mari" with Undo; held path streamed, then the in-field review with Keep / Not this one, server text unchanged. No console errors. - Seeded Playwright check without a model (mock stream, 1440 and 390 px, after the review fixes), 12/12: other character shows no overlay; text grows; Stop removes the overlay and leaves the form text unchanged; a focused field keeps its textarea and focus; after blur the overlay shows. No console errors. Not verified: - A real-model run after the review fixes. - Abort in the middle of a real-model stream (the mock stream covered Stop). - That the old value no longer flashes between the round end and the applied or held state. - 768 px width. To verify manually: - [ ] Open a character on the Card tab, open Prof. Mari (classic runtime), ask her to rewrite the Description, and see her text stream into the field with "Prof. Mari is writing…". - [ ] In Manual mode, confirm the in-field review (Keep / Not this one) takes over when she finishes; in Auto mode, confirm "Edited by Prof. Mari" with Undo. - [ ] Click into the field while she writes: the textarea keeps focus and your text; after you click elsewhere her text shows again. - [ ] Press Stop mid-stream: her text goes away and the field shows your text. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) <!-- Add before/after screenshots or recordings for UI changes --> Screenshots were taken locally (1440 and 390 px) and are not attached. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:46:20 +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#8664
No description provided.