[PR #7366] [CLOSED] refactor(mari): move workspace tool definitions into a tool registry #7702

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7366
Author: @ATreemanDork
Created: 10/9/2026
Status: ❌ Closed

Base: staging ← Head: feat/mari-tool-registry


📝 Commits (1)

  • 74882da refactor(mari): move workspace tool definitions into a tool registry

📊 Changes

4 files changed (+1342 additions, -411 deletions)

View changed files

➕ packages/server/src/services/professor-mari/tool-registry.ts (+1296 -0)
📝 packages/server/src/services/professor-mari/workspace-agent.service.ts (+32 -407)
📝 scripts/regressions/open-issues.regression.ts (+7 -1)
📝 scripts/regressions/professor-mari/shell-sandbox.regression.ts (+7 -3)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7367

Why this change

Professor Mari's 15 workspace tool definitions (including the 78-action app_data table) were inlined in the ~4,600-line workspace-agent.service.ts as three overlapping arrays, with read/write classification handled by ad-hoc regexes. Two problems this fixes:

  • The service is a god-file: tool metadata, classifiers, and runtime logic all live in one module, and every new capability grows the same file.
  • The skill library (PR 2 of this 3-PR series) needs per-tool and per-action behavioral metadata (read vs write, self-verifying, verify-with, idempotent) that the regexes can't express.

This extracts the tool definitions and action table into a tool-registry.ts single source of truth and rewrites the classifiers to consult it — behavior-preserving, verified by an offline parity proof.

What changed

  • New packages/server/src/services/professor-mari/tool-registry.ts: TOOLS (15 tools, descriptions verbatim from the service), APP_DATA_ACTIONS (78 actions with kind/selfVerifying/verifyWith metadata), derived exports (WORKSPACE_TOOL_NAMES, WORKSPACE_TOOL_DEFINITIONS, WORKSPACE_TEXTUAL_TOOL_DEFINITIONS, PROFESSOR_MARI_APP_DATA_ACTIONS), and lookup helpers (getTool, getAppDataAction, isAppDataRead, isAppDataWrite).
  • workspace-agent.service.ts (−410/+39): inline arrays and the local WorkspaceToolDefinition type deleted; isReadOnlyWorkspaceCommand / isMutatingWorkspaceCommand now classify via registry kind lookups; appDataActionLooksReadOnly deleted. The v2.5.0 decision.record bookkeeping carve-out (non-mutating, no read-back) and the package_service list-vs-run split are preserved verbatim.
  • PROFESSOR_MARI_APP_DATA_ACTIONS is re-exported from the service so existing importers keep working.
  • Two regression files (scripts/regressions/professor-mari/shell-sandbox.regression.ts, scripts/regressions/open-issues.regression.ts) now read tool-registry.ts for the moved tool-definition text assertions — the same patterns, asserted against the file that now carries the text. No assertions deleted, skipped, or loosened.

No behavior change

  • Classification parity proof (offline): 262 checks — 13 plan-1 sample commands + all 78 app_data actions × 3 apply variants + 15 tool sweeps — comparing old vs new isReadOnlyWorkspaceCommand / isMutatingWorkspaceCommand: zero divergence. Unknown/malformed actions remain mutating (the data case uses !isAppDataRead, which mirrors the old conservative regex for every input).
  • Tool descriptions are verbatim copies, so the workspace prompt is byte-identical; prompt.regression.ts passes in the full suite.

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

  • Server-side-only refactor; no UI surface touched, so light/dark/mobile checks do not apply.
  • Full node regression suite: 545/545 pass (pnpm regression:node), including the professor-mari/* lanes, open-issues, and prompt.regression.ts.
  • Outstanding for human reviewer: run Professor Mari in the app and confirm mutating commands still raise approval cards and read back, read-only commands do not, and decision.record does not raise an approval card.

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)

N/A — server-side refactor, no UI change.


🔄 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/7366 **Author:** [@ATreemanDork](https://github.com/ATreemanDork) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `feat/mari-tool-registry` --- ### 📝 Commits (1) - [`74882da`](https://github.com/Pasta-Devs/Marinara-Engine/commit/74882da1ca9d8453d03518ac14cdf1e719098158) refactor(mari): move workspace tool definitions into a tool registry ### 📊 Changes **4 files changed** (+1342 additions, -411 deletions) <details> <summary>View changed files</summary> ➕ `packages/server/src/services/professor-mari/tool-registry.ts` (+1296 -0) 📝 `packages/server/src/services/professor-mari/workspace-agent.service.ts` (+32 -407) 📝 `scripts/regressions/open-issues.regression.ts` (+7 -1) 📝 `scripts/regressions/professor-mari/shell-sandbox.regression.ts` (+7 -3) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7367 ## Why this change Professor Mari's 15 workspace tool definitions (including the 78-action `app_data` table) were inlined in the ~4,600-line `workspace-agent.service.ts` as three overlapping arrays, with read/write classification handled by ad-hoc regexes. Two problems this fixes: - The service is a god-file: tool metadata, classifiers, and runtime logic all live in one module, and every new capability grows the same file. - The skill library (PR 2 of this 3-PR series) needs per-tool and per-action behavioral metadata (read vs write, self-verifying, verify-with, idempotent) that the regexes can't express. This extracts the tool definitions and action table into a `tool-registry.ts` single source of truth and rewrites the classifiers to consult it — behavior-preserving, verified by an offline parity proof. ## What changed - **New** `packages/server/src/services/professor-mari/tool-registry.ts`: `TOOLS` (15 tools, descriptions verbatim from the service), `APP_DATA_ACTIONS` (78 actions with kind/selfVerifying/verifyWith metadata), derived exports (`WORKSPACE_TOOL_NAMES`, `WORKSPACE_TOOL_DEFINITIONS`, `WORKSPACE_TEXTUAL_TOOL_DEFINITIONS`, `PROFESSOR_MARI_APP_DATA_ACTIONS`), and lookup helpers (`getTool`, `getAppDataAction`, `isAppDataRead`, `isAppDataWrite`). - `workspace-agent.service.ts` (−410/+39): inline arrays and the local `WorkspaceToolDefinition` type deleted; `isReadOnlyWorkspaceCommand` / `isMutatingWorkspaceCommand` now classify via registry kind lookups; `appDataActionLooksReadOnly` deleted. The v2.5.0 `decision.record` bookkeeping carve-out (non-mutating, no read-back) and the `package_service` list-vs-run split are preserved verbatim. - `PROFESSOR_MARI_APP_DATA_ACTIONS` is re-exported from the service so existing importers keep working. - Two regression files (`scripts/regressions/professor-mari/shell-sandbox.regression.ts`, `scripts/regressions/open-issues.regression.ts`) now read `tool-registry.ts` for the moved tool-definition text assertions — the same patterns, asserted against the file that now carries the text. No assertions deleted, skipped, or loosened. ## No behavior change - Classification parity proof (offline): 262 checks — 13 plan-1 sample commands + all 78 `app_data` actions × 3 apply variants + 15 tool sweeps — comparing old vs new `isReadOnlyWorkspaceCommand` / `isMutatingWorkspaceCommand`: **zero divergence**. Unknown/malformed actions remain mutating (the `data` case uses `!isAppDataRead`, which mirrors the old conservative regex for every input). - Tool descriptions are verbatim copies, so the workspace prompt is byte-identical; `prompt.regression.ts` passes in the full suite. ## Validation - [x] `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) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Server-side-only refactor; no UI surface touched, so light/dark/mobile checks do not apply. - Full node regression suite: 545/545 pass (`pnpm regression:node`), including the `professor-mari/*` lanes, `open-issues`, and `prompt.regression.ts`. - Outstanding for human reviewer: run Professor Mari in the app and confirm mutating commands still raise approval cards and read back, read-only commands do not, and `decision.record` does not raise an approval card. ## Docs and release impact - [x] 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) N/A — server-side refactor, no UI change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:40 +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#7702
No description provided.