[PR #2805] [MERGED] Refactor Professor Mari workspace runtime to not use native tool calling anymore! #5739

Closed
opened 2026-10-22 04:19:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2805
Author: @ghost
Created: 6/22/2026
Status: ✅ Merged
Merged: 6/22/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/professor-mari-command-runtime


📝 Commits (4)

  • f11e67a Refactor Professor Mari workspace to native command runtime
  • a340a7a Make Professor Mari workspace loop fluid
  • 9d45688 Harden Professor Mari workspace data mutations
  • 41f40c2 Resolve staging conflicts for Professor Mari command runtime

📊 Changes

3 files changed (+1454 additions, -1029 deletions)

View changed files

📝 packages/client/src/components/chat/HomeProfessorMariChat.tsx (+18 -30)
📝 packages/server/src/services/mari-db/mari-db.service.ts (+120 -18)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+1316 -981)

📄 Description

Summary

This PR replaces Professor Mari’s Pi-backed workspace path with a Marinara-native workspace command runtime and hardens the data mutation flow so Mari can work reliably
across local/remote models without depending on native provider tool calls.

Why

Professor Mari’s Home workspace mode was brittle with local models and generic command execution. It could:

  • mis-handle tool/function calling on providers without native tool support,
  • narrate failed commands as if they succeeded,
  • patch raw DB fields that were not actually app-visible,
  • split file paths with spaces through shell execution,
  • read raw storage tables and mistake serialized JSON columns for corrupted app data,
  • leave the UI looking stale after workspace-approved changes.

Changes

  • Reworked packages/server/src/services/professor-mari/workspace-agent.service.ts

    • Adds a Marinara-native command runtime.
    • Supports hidden workspace tools: read, grep, find, ls, edit, write, bash.
    • Supports structured say + tool_calls action frames.
    • Keeps XML/bracket command fallbacks for local/non-tool-call models.
    • Adds optional native tool definitions for providers that support them.
    • Adds silent tool use and parallel read-only command batches.
    • Persists compact hidden workspace continuity so “go ahead” can continue prior work.
    • Preserves existing SSE events and mari ... approval flow.
    • Runs simple mari ... commands directly instead of relying on shell parsing.
    • Treats non-zero shell exits as tool errors.
    • Blocks storage table JSON misuse and warns on raw storage reads.
  • Hardened packages/server/src/services/mari-db/mari-db.service.ts

    • Rejects JSON arrays where one JSON object is required.
    • Blocks tables/characters.json-style full table files from character helper JSON input.
    • Normalizes/validates character card JSON more safely.
    • Detects numeric keys from accidental table-array merges.
    • Blocks unknown raw DB columns so mari db patch characters ... {"appearance": ...} cannot falsely “succeed” while changing nothing visible.
    • Gives actionable error hints for nested JSON-column edits.
  • Updated packages/client/src/components/chat/HomeProfessorMariChat.tsx

    • Broadens app-data cache invalidation after approved workspace changes.
    • Prevents approved workspace edits from looking stale across characters, personas, lorebooks, themes, agents, tools, and related data.

Validation

  • pnpm check passed.
  • Note: local validation emitted the existing Node engine warning:
    • wanted >=24 <26
    • current v22.22.3

Manual verification needed

  • Manually verify Professor Mari can inspect files and run simple workspace commands.
  • Manually verify a character edit through mari characters update --appearance ... --apply updates the editor/readback.
  • Manually verify a generic raw DB patch with an unknown field is blocked.
  • Manually verify approved workspace changes refresh visible app data without requiring a manual reload.
  • Manually verify local/non-tool-call models still work via text command frames.

Linked issue

No linked issue yet. One should be opened or linked before submitting the PR.


🔄 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/2805 **Author:** [@ghost](https://github.com/ghost) **Created:** 6/22/2026 **Status:** ✅ Merged **Merged:** 6/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/professor-mari-command-runtime` --- ### 📝 Commits (4) - [`f11e67a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f11e67aeb0ece6cc4b3f78eb35920b6f124ac674) Refactor Professor Mari workspace to native command runtime - [`a340a7a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a340a7a3da92d09ff8813330f0b9b7fdf0624b8a) Make Professor Mari workspace loop fluid - [`9d45688`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9d45688aead7e786e5d7490a5438a9974431a098) Harden Professor Mari workspace data mutations - [`41f40c2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/41f40c2b3465f7abb86920e1e346dcc693548b04) Resolve staging conflicts for Professor Mari command runtime ### 📊 Changes **3 files changed** (+1454 additions, -1029 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/HomeProfessorMariChat.tsx` (+18 -30) 📝 `packages/server/src/services/mari-db/mari-db.service.ts` (+120 -18) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+1316 -981) </details> ### 📄 Description ## Summary This PR replaces Professor Mari’s Pi-backed workspace path with a Marinara-native workspace command runtime and hardens the data mutation flow so Mari can work reliably across local/remote models without depending on native provider tool calls. ## Why Professor Mari’s Home workspace mode was brittle with local models and generic command execution. It could: - mis-handle tool/function calling on providers without native tool support, - narrate failed commands as if they succeeded, - patch raw DB fields that were not actually app-visible, - split file paths with spaces through shell execution, - read raw storage tables and mistake serialized JSON columns for corrupted app data, - leave the UI looking stale after workspace-approved changes. ## Changes - Reworked `packages/server/src/services/professor-mari/workspace-agent.service.ts` - Adds a Marinara-native command runtime. - Supports hidden workspace tools: `read`, `grep`, `find`, `ls`, `edit`, `write`, `bash`. - Supports structured `say + tool_calls` action frames. - Keeps XML/bracket command fallbacks for local/non-tool-call models. - Adds optional native tool definitions for providers that support them. - Adds silent tool use and parallel read-only command batches. - Persists compact hidden workspace continuity so “go ahead” can continue prior work. - Preserves existing SSE events and `mari ...` approval flow. - Runs simple `mari ...` commands directly instead of relying on shell parsing. - Treats non-zero shell exits as tool errors. - Blocks storage table JSON misuse and warns on raw storage reads. - Hardened `packages/server/src/services/mari-db/mari-db.service.ts` - Rejects JSON arrays where one JSON object is required. - Blocks `tables/characters.json`-style full table files from character helper JSON input. - Normalizes/validates character card JSON more safely. - Detects numeric keys from accidental table-array merges. - Blocks unknown raw DB columns so `mari db patch characters ... {"appearance": ...}` cannot falsely “succeed” while changing nothing visible. - Gives actionable error hints for nested JSON-column edits. - Updated `packages/client/src/components/chat/HomeProfessorMariChat.tsx` - Broadens app-data cache invalidation after approved workspace changes. - Prevents approved workspace edits from looking stale across characters, personas, lorebooks, themes, agents, tools, and related data. ## Validation - `pnpm check` passed. - Note: local validation emitted the existing Node engine warning: - wanted `>=24 <26` - current `v22.22.3` ## Manual verification needed - Manually verify Professor Mari can inspect files and run simple workspace commands. - Manually verify a character edit through `mari characters update --appearance ... --apply` updates the editor/readback. - Manually verify a generic raw DB patch with an unknown field is blocked. - Manually verify approved workspace changes refresh visible app data without requiring a manual reload. - Manually verify local/non-tool-call models still work via text command frames. ## Linked issue No linked issue yet. One should be opened or linked before submitting the PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:19:01 +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#5739
No description provided.