[PR #7790] [MERGED] feat(state-editor): phone tracker sheets, agent's section, coloured JSON #7930

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7790
Author: @ylli-selmani
Created: 10/18/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ylli-selmani

Base: staging ← Head: feat/state-editor-phone-tracker-windows


📝 Commits (3)

  • afb43f8 feat(state-editor): open it from the phone tracker sheets and the agent's section
  • 6700147 feat(state-editor): colour the JSON view
  • 90aa269 Update packages/client/src/components/ui/state-editor/StateJsonField.tsx

📊 Changes

6 files changed (+165 additions, -26 deletions)

View changed files

📝 docs/roleplay/hud-and-trackers.md (+2 -2)
📝 packages/client/src/components/chat/AgentSuiteModal.tsx (+7 -1)
📝 packages/client/src/components/chat/RoleplayHUD.tsx (+15 -0)
📝 packages/client/src/components/ui/state-editor/StateJsonField.tsx (+60 -23)
📝 packages/client/src/lib/state-editor/state-editor-json.ts (+41 -0)
📝 scripts/regressions/state-editor.regression.ts (+40 -0)

📄 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 #7789

Why this change

  • The { } State Editor control added in #7780 reached the desktop surfaces but not the phone ones. The phone tracker windows are their own components (MobileTrackerWindow), so on a phone the editor stayed unreachable unless the layout widened into the desktop windows.
  • Agent Suite's Open in State Editor link ignored which agent was being looked at and always opened on Scene.
  • Every section's JSON view was one flat colour, while Agent Suite's JSON blocks read as syntax.

What changed

  • Phone tracker sheets. MobileTrackerWindow renders TrackerStateEditorButton in its title bar, so World State and Player & Tracker both carry { } next to lock/close on a phone. World State opens on Scene; Player & Tracker is a combined sheet, so it opens on Scene as well.
  • Agent Suite. The Tracker Data link passes initialSectionId: selectedAgent?.id, so it opens on the selected agent's section (Character Tracker → Present Characters, Quest Tracker → Active Quests, World State → Scene).
  • Coloured JSON. tokenizeStateJson splits JSON into tokens without parsing it, and StateJsonField paints them on a layer behind a transparent textarea. Typing, selection, the caret and the line-number gutter behave exactly as before; the colours come from theme tokens (--color-rgb-*), so themed installs and the accent picker keep working, and there is no editor library.
  • Docs. docs/roleplay/hud-and-trackers.md covers the phone sheets, the Agent Suite section and the JSON colours.
  • Regression. scripts/regressions/state-editor.regression.ts pins the tokenizer: tokens reproduce the text byte for byte, keys, strings, numbers and literals keep their kinds, and a half-typed value still leaves its key highlighted.

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

Run on this branch's own worktree (dev stack on port 6989). Nothing here was run against a real install or the maintainer's daily app, so the boxes above are still a to-do list for a human.

  • pnpm check — exit 0 (format, lint, localization, type checks, full build).
  • node ./scripts/run-regressions.mjs --filter scripts/regressions/state-editor.regression.ts — passed.
  • Phone viewport, 390×844: { } appears in both sheet title bars, and the editor opened on Scene from World State and from Player & Tracker.
  • Desktop: Agent Suite → Character Tracker → Open in State Editor opened on Present Characters.
  • Coloured JSON: the highlight layer's text equalled the textarea's value character for character (297/297 on phone, 1200/1200 on desktop) and stayed in sync after typing into the field.
  • Not covered yet: light theme, a non-default accent, and a JSON draft that does not parse (the field turns red and must stay unsaveable).

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)

Phone sheets, 390×844. The { } button now sits in the title bar of World State and Player & Tracker, next to lock and close:

World State sheet with the State Editor button

Coloured JSON. Keys, strings, numbers and true/false/null are coloured; the line-number gutter, caret and selection are unchanged:

Coloured JSON in the State Editor

Summary by CodeRabbit

  • New Features
    • Added syntax highlighting for JSON keys and values in the state editor, including while JSON is incomplete or invalid.
    • Added direct access to the state editor from mobile tracker windows and phone sheets. The editor opens at the relevant tracker section, including the selected agent’s section.
  • Documentation
    • Clarified where to open the state editor and how field controls differ from JSON editing.

🔄 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/7790 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `feat/state-editor-phone-tracker-windows` --- ### 📝 Commits (3) - [`afb43f8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/afb43f88462a85e0389c352b854c39dbdf252f70) feat(state-editor): open it from the phone tracker sheets and the agent's section - [`6700147`](https://github.com/Pasta-Devs/Marinara-Engine/commit/67001476e6587dae134885cddafeda2ef02f0e88) feat(state-editor): colour the JSON view - [`90aa269`](https://github.com/Pasta-Devs/Marinara-Engine/commit/90aa269d6c2afaf7ed82475a3074780fe9292e12) Update packages/client/src/components/ui/state-editor/StateJsonField.tsx ### 📊 Changes **6 files changed** (+165 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `docs/roleplay/hud-and-trackers.md` (+2 -2) 📝 `packages/client/src/components/chat/AgentSuiteModal.tsx` (+7 -1) 📝 `packages/client/src/components/chat/RoleplayHUD.tsx` (+15 -0) 📝 `packages/client/src/components/ui/state-editor/StateJsonField.tsx` (+60 -23) 📝 `packages/client/src/lib/state-editor/state-editor-json.ts` (+41 -0) 📝 `scripts/regressions/state-editor.regression.ts` (+40 -0) </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`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7789 ## Why this change - The **{ }** State Editor control added in #7780 reached the desktop surfaces but not the phone ones. The phone tracker windows are their own components (`MobileTrackerWindow`), so on a phone the editor stayed unreachable unless the layout widened into the desktop windows. - Agent Suite's **Open in State Editor** link ignored which agent was being looked at and always opened on **Scene**. - Every section's JSON view was one flat colour, while Agent Suite's JSON blocks read as syntax. ## What changed - **Phone tracker sheets.** `MobileTrackerWindow` renders `TrackerStateEditorButton` in its title bar, so **World State** and **Player & Tracker** both carry **{ }** next to lock/close on a phone. World State opens on **Scene**; Player & Tracker is a combined sheet, so it opens on **Scene** as well. - **Agent Suite.** The Tracker Data link passes `initialSectionId: selectedAgent?.id`, so it opens on the selected agent's section (Character Tracker → **Present Characters**, Quest Tracker → **Active Quests**, World State → **Scene**). - **Coloured JSON.** `tokenizeStateJson` splits JSON into tokens without parsing it, and `StateJsonField` paints them on a layer behind a transparent textarea. Typing, selection, the caret and the line-number gutter behave exactly as before; the colours come from theme tokens (`--color-rgb-*`), so themed installs and the accent picker keep working, and there is no editor library. - **Docs.** `docs/roleplay/hud-and-trackers.md` covers the phone sheets, the Agent Suite section and the JSON colours. - **Regression.** `scripts/regressions/state-editor.regression.ts` pins the tokenizer: tokens reproduce the text byte for byte, keys, strings, numbers and literals keep their kinds, and a half-typed value still leaves its key highlighted. ## 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 Run on this branch's own worktree (dev stack on port 6989). Nothing here was run against a real install or the maintainer's daily app, so the boxes above are still a to-do list for a human. - `pnpm check` — exit 0 (format, lint, localization, type checks, full build). - `node ./scripts/run-regressions.mjs --filter scripts/regressions/state-editor.regression.ts` — passed. - Phone viewport, 390×844: **{ }** appears in both sheet title bars, and the editor opened on **Scene** from World State and from Player & Tracker. - Desktop: Agent Suite → Character Tracker → **Open in State Editor** opened on **Present Characters**. - Coloured JSON: the highlight layer's text equalled the textarea's value character for character (297/297 on phone, 1200/1200 on desktop) and stayed in sync after typing into the field. - Not covered yet: light theme, a non-default accent, and a JSON draft that does not parse (the field turns red and must stay unsaveable). ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README) as needed - [x] 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) **Phone sheets, 390×844.** The **{ }** button now sits in the title bar of **World State** and **Player & Tracker**, next to lock and close: ![World State sheet with the State Editor button](https://raw.githubusercontent.com/ylli-selmani/Marinara-Engine-Ylli-Edits/pr-assets/state-editor-phone/01-phone-sheets.png) **Coloured JSON.** Keys, strings, numbers and `true`/`false`/`null` are coloured; the line-number gutter, caret and selection are unchanged: ![Coloured JSON in the State Editor](https://raw.githubusercontent.com/ylli-selmani/Marinara-Engine-Ylli-Edits/pr-assets/state-editor-phone/02-coloured-json.png) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added syntax highlighting for JSON keys and values in the state editor, including while JSON is incomplete or invalid. * Added direct access to the state editor from mobile tracker windows and phone sheets. The editor opens at the relevant tracker section, including the selected agent’s section. * **Documentation** * Clarified where to open the state editor and how field controls differ from JSON editing. <!-- 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-24 04:08:55 +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#7930
No description provided.