[PR #7567] [MERGED] Professor Mari: live words, batch step rows, more model call formats #7799

Closed
opened 2026-10-24 04:07:37 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: feat/mari-pi-runtime ← Head: feat/mari-pi-runtime-5-polish


📝 Commits (6)

  • 90e4369 Read DeepSeek V3, Kimi, GLM, Qwen, MiniMax and Mistral call markup as tool calls
  • ffe4765 Keep the prose written beside a textual tool call in the OpenAI provider result
  • 4d90f6d Show Professor Mari's words live while she writes
  • 88dcd50 Show a batch step's items on its step row
  • d3de46d Merge branch 'feat/mari-pi-runtime-5-parser' into feat/mari-pi-runtime-5-polish
  • ef6bb34 Make textual tool-call parsing linear, stop unclosed calls merging, and scrub the live draft

📊 Changes

16 files changed (+620 additions, -61 deletions)

View changed files

📝 packages/client/src/components/chat/mari/MariTranscript.tsx (+1 -0)
📝 packages/client/src/components/chat/mari/MariWorkTimeline.tsx (+33 -6)
📝 packages/client/src/components/chat/mari/use-mari-workspace-run.ts (+17 -1)
📝 packages/client/src/lib/mari-referenced-resources.ts (+20 -0)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/client/src/stores/chat.store.ts (+13 -0)
📝 packages/client/src/styles/mari.css (+17 -0)
📝 packages/server/src/routes/generate.routes.ts (+13 -7)
📝 packages/server/src/services/llm/providers/openai.provider.ts (+3 -3)
📝 packages/server/src/services/llm/textual-tool-call-parser.ts (+179 -19)
📝 packages/server/src/services/professor-mari/pi-runtime.ts (+32 -6)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+68 -14)
📝 packages/shared/src/types/professor-mari-workspace.ts (+3 -0)
📝 scripts/regressions/mari/lorebook-entries-paging.regression.ts (+25 -1)
📝 scripts/regressions/professor-mari/pi-runtime.regression.ts (+171 -4)
📝 scripts/regressions/provider-stream-completion.regression.ts (+23 -0)

📄 Description

Linked issue

No linked issue. This is planned work: slice 5 on the integration branch feat/mari-pi-runtime. It is stacked on slice 4 (#7546) and targets that branch, so the diff shows only this slice.

Why this change

  • In a real test, Professor Mari looked idle during long runs: her words appear only after a round is parsed and audited, and a step that created six lorebook entries showed as one row.
  • Models other than DeepSeek also write their native call markup as text at times; the run then ends with that markup as the answer.
  • When the OpenAI provider read a call from text, it dropped the words written next to it.

What changed

  • Live words. The provider's text deltas reach the client as a provisional draft event on both runtimes (Pi rounds now stream). The event carries the full visible text so far, scrubbed of internal names, cut at the first tool-call marker, with a half-written marker held back. The client shows it in the live area, one update per frame, and clears it when the round or run ends. A draft is never saved and never replaces the audited answer.
  • Batch step rows. A step that created or changed several items shows the count and the names (capped, with an ellipsis).
  • More call markup. The shared textual parser reads DeepSeek V3/R1, Kimi K2, GLM 4.5/4.6, Qwen3-Coder, MiniMax M2 and Mistral markup, next to DeepSeek V4 DSML. Only known tools yield a call; an unclosed call yields none. The block matching is linear (spans() with indexOf), and the older fence pattern was made linear too.
  • Provider keeps prose. openai.provider.ts keeps the words around a call it parsed from text. The roleplay route replaces the streamed round text whenever it differs from what the provider returned, so raw markup is not saved in a reply.

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

Not done by a person yet. To verify by hand:

  • Manually verify the live words line on Classic and Pi at 390 / 768 / 1440 px, light and dark: it appears while she writes, never shows tool-call markup, and is gone when the answer lands, after Stop, after an error and after a chat switch.
  • Manually verify a long Professor Mari chat stays smooth while the draft updates.
  • Manually verify a batch step row ("6 entries: …") at 390 px.
  • Manually verify a roleplay chat with function calling on a model that writes calls as text: no markup in the saved reply, no doubled text, regenerate and swipe behave as before.
  • Manually verify a roleplay chat on a native tool-call model is unchanged.

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)

None. No screenshot harness was available to the agents; the live words line and the batch step row have not been seen in a browser.

Proof

Run by agents on commit ef6bb34a3:

  • pnpm check: exit 0. Server typecheck clean. pnpm localization:check: passed.
  • Regressions: mari 50/50, pi-runtime 1/1, roleplay-function 1/1, prompt.regression 7/7, provider-stream 1/1.
  • Parser regression (in pi-runtime.regression.ts): one case per markup format (name, arguments, strip), unknown tool, prose mention, two unclosed GLM calls yield none, and adversarial timing inputs (GLM 30 pairs with a bad tail, 20,000 spaces after an open fence, 200 KB prose, each opener repeated 2,000 times): slowest call 31 ms against a 250 ms limit.
  • Provider regression (provider-stream-completion.regression.ts): prose is kept next to a text call, stream and non-stream.
  • Read-only adversarial review (Opus): 6 findings, all fixed. The serious one: the first GLM pattern backtracked exponentially (64 s on about 1 KB) and would have run on every OpenAI-provider reply with tools. Also fixed: merged unclosed GLM calls, raw markup saved in a roleplay reply when the call came before the prose, draft showing markup of the new formats, unscrubbed draft, Mistral marker cutting prose.
  • Local CodeRabbit: 4 findings; 3 fixed, 1 needed no change (note on two draft lifecycles).

Known limits:

  • The roleplay route change (generate.routes.ts near line 8774) has no regression that drives that route path.
  • A draft can briefly show words that the claim audit then replaces, and the words of a round that ends in a hold.
  • The last word of a draft appears only when more text arrives.
  • Closing tags of call markup are matched case-sensitively.

🔄 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/7567 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `feat/mari-pi-runtime` ← **Head:** `feat/mari-pi-runtime-5-polish` --- ### 📝 Commits (6) - [`90e4369`](https://github.com/Pasta-Devs/Marinara-Engine/commit/90e4369199319a28c4e0984c8a1c78693193a933) Read DeepSeek V3, Kimi, GLM, Qwen, MiniMax and Mistral call markup as tool calls - [`ffe4765`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ffe47653c0e93d6df4069f5a55a4803b590fcb4d) Keep the prose written beside a textual tool call in the OpenAI provider result - [`4d90f6d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4d90f6d7b88de7a0844d0034a0f68f387a58e364) Show Professor Mari's words live while she writes - [`88dcd50`](https://github.com/Pasta-Devs/Marinara-Engine/commit/88dcd50ea08d9a3ff20ac414fa9659a80a56a290) Show a batch step's items on its step row - [`d3de46d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d3de46d1b6fd0a48724869af9cacbb47727dd2f7) Merge branch 'feat/mari-pi-runtime-5-parser' into feat/mari-pi-runtime-5-polish - [`ef6bb34`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ef6bb34a3ca5ebb33950c5e2dd7b2b19df7fab78) Make textual tool-call parsing linear, stop unclosed calls merging, and scrub the live draft ### 📊 Changes **16 files changed** (+620 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/mari/MariTranscript.tsx` (+1 -0) 📝 `packages/client/src/components/chat/mari/MariWorkTimeline.tsx` (+33 -6) 📝 `packages/client/src/components/chat/mari/use-mari-workspace-run.ts` (+17 -1) 📝 `packages/client/src/lib/mari-referenced-resources.ts` (+20 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/client/src/stores/chat.store.ts` (+13 -0) 📝 `packages/client/src/styles/mari.css` (+17 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+13 -7) 📝 `packages/server/src/services/llm/providers/openai.provider.ts` (+3 -3) 📝 `packages/server/src/services/llm/textual-tool-call-parser.ts` (+179 -19) 📝 `packages/server/src/services/professor-mari/pi-runtime.ts` (+32 -6) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+68 -14) 📝 `packages/shared/src/types/professor-mari-workspace.ts` (+3 -0) 📝 `scripts/regressions/mari/lorebook-entries-paging.regression.ts` (+25 -1) 📝 `scripts/regressions/professor-mari/pi-runtime.regression.ts` (+171 -4) 📝 `scripts/regressions/provider-stream-completion.regression.ts` (+23 -0) </details> ### 📄 Description ## Linked issue No linked issue. This is planned work: slice 5 on the integration branch `feat/mari-pi-runtime`. It is stacked on slice 4 (#7546) and targets that branch, so the diff shows only this slice. ## Why this change - In a real test, Professor Mari looked idle during long runs: her words appear only after a round is parsed and audited, and a step that created six lorebook entries showed as one row. - Models other than DeepSeek also write their native call markup as text at times; the run then ends with that markup as the answer. - When the OpenAI provider read a call from text, it dropped the words written next to it. ## What changed - **Live words.** The provider's text deltas reach the client as a provisional `draft` event on both runtimes (Pi rounds now stream). The event carries the full visible text so far, scrubbed of internal names, cut at the first tool-call marker, with a half-written marker held back. The client shows it in the live area, one update per frame, and clears it when the round or run ends. A draft is never saved and never replaces the audited answer. - **Batch step rows.** A step that created or changed several items shows the count and the names (capped, with an ellipsis). - **More call markup.** The shared textual parser reads DeepSeek V3/R1, Kimi K2, GLM 4.5/4.6, Qwen3-Coder, MiniMax M2 and Mistral markup, next to DeepSeek V4 DSML. Only known tools yield a call; an unclosed call yields none. The block matching is linear (`spans()` with `indexOf`), and the older fence pattern was made linear too. - **Provider keeps prose.** `openai.provider.ts` keeps the words around a call it parsed from text. The roleplay route replaces the streamed round text whenever it differs from what the provider returned, so raw markup is not saved in a reply. ## 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 Not done by a person yet. To verify by hand: - Manually verify the live words line on Classic and Pi at 390 / 768 / 1440 px, light and dark: it appears while she writes, never shows tool-call markup, and is gone when the answer lands, after Stop, after an error and after a chat switch. - Manually verify a long Professor Mari chat stays smooth while the draft updates. - Manually verify a batch step row ("6 entries: …") at 390 px. - Manually verify a roleplay chat with function calling on a model that writes calls as text: no markup in the saved reply, no doubled text, regenerate and swipe behave as before. - Manually verify a roleplay chat on a native tool-call model is unchanged. ## 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) None. No screenshot harness was available to the agents; the live words line and the batch step row have not been seen in a browser. ## Proof Run by agents on commit `ef6bb34a3`: - `pnpm check`: exit 0. Server typecheck clean. `pnpm localization:check`: passed. - Regressions: `mari` 50/50, `pi-runtime` 1/1, `roleplay-function` 1/1, `prompt.regression` 7/7, `provider-stream` 1/1. - Parser regression (in `pi-runtime.regression.ts`): one case per markup format (name, arguments, strip), unknown tool, prose mention, two unclosed GLM calls yield none, and adversarial timing inputs (GLM 30 pairs with a bad tail, 20,000 spaces after an open fence, 200 KB prose, each opener repeated 2,000 times): slowest call 31 ms against a 250 ms limit. - Provider regression (`provider-stream-completion.regression.ts`): prose is kept next to a text call, stream and non-stream. - Read-only adversarial review (Opus): 6 findings, all fixed. The serious one: the first GLM pattern backtracked exponentially (64 s on about 1 KB) and would have run on every OpenAI-provider reply with tools. Also fixed: merged unclosed GLM calls, raw markup saved in a roleplay reply when the call came before the prose, draft showing markup of the new formats, unscrubbed draft, Mistral marker cutting prose. - Local CodeRabbit: 4 findings; 3 fixed, 1 needed no change (note on two draft lifecycles). Known limits: - The roleplay route change (`generate.routes.ts` near line 8774) has no regression that drives that route path. - A draft can briefly show words that the claim audit then replaces, and the words of a round that ends in a hold. - The last word of a draft appears only when more text arrives. - Closing tags of call markup are matched case-sensitively. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:07:37 +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#7799
No description provided.