[PR #90] [MERGED] Add global Hierarchical Maps turn prompt templates #799

Closed
opened 2026-10-20 17:31:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/90
Author: @thetopham
Created: 7/18/2026
Status: ✅ Merged
Merged: 7/19/2026
Merged by: @SpicyMarinara

Base: main ← Head: agent/89-maps-runtime-prompt-inspector


📝 Commits (2)

  • 3e4f237 feat: add global Maps turn prompt templates
  • 45adc4f fix: address Maps prompt template review feedback

📊 Changes

18 files changed (+1307 additions, -337 deletions)

View changed files

➕ artifacts/hierarchical-maps-1.1.7.zip (+0 -0)
📝 catalog/catalog.json (+9 -9)
📝 catalog/v2/catalog.json (+9 -9)
📝 catalog/v3/catalog.json (+1 -1)
📝 packages/hierarchical-maps/client.js (+54 -48)
📝 packages/hierarchical-maps/manifest.json (+5 -5)
📝 packages/hierarchical-maps/server.mjs (+52 -47)
📝 packages/hierarchical-maps/src/engine/packages/client/src/features/spatial-context/SpatialMapWorkspace.tsx (+0 -52)
📝 packages/hierarchical-maps/src/engine/packages/client/src/features/spatial-context/SpatialMapsHome.tsx (+373 -2)
📝 packages/hierarchical-maps/src/engine/packages/client/src/hooks/use-spatial-context.ts (+38 -27)
📝 packages/hierarchical-maps/src/engine/packages/maps-shared/src/maps-model.ts (+136 -0)
➕ packages/hierarchical-maps/src/engine/packages/maps-shared/src/runtime-prompt.ts (+105 -0)
📝 packages/hierarchical-maps/src/engine/packages/server/src/routes/spatial-context.routes.ts (+62 -0)
📝 packages/hierarchical-maps/src/engine/packages/server/src/services/spatial-context/package-runtime.ts (+62 -2)
📝 packages/hierarchical-maps/src/engine/packages/server/src/services/spatial-context/projection.ts (+40 -90)
📝 scripts/build-feature-packages.mjs (+27 -2)
📝 tests/hierarchical-maps-lifecycle.regression.ts (+127 -14)
📝 tests/spatial-context.e2e.ts (+207 -29)

📄 Description

Linked issue

Closes #89

Why this change

Hierarchical Maps showed editable map-generation prompts but hid the separate spatial system message used on every model request. Users could not inspect or globally customize the Roleplay and Game inserts, and Edit Map duplicated the Location Types editor that already belongs in Agent settings.

What changed

  • Added global, validated Roleplay and Game turn-prompt templates to the hierarchical-maps agent settings, alongside the existing global generation prompt libraries.
  • Added live and example resolved previews built by the same formatter used by runtime injection.
  • Kept the application-owned <spatial_context> wrapper and required context/authority variables outside the removable part of the runtime contract.
  • Made the actual editable template textarea 32rem tall while leaving the resolved preview sizing unchanged.
  • Removed the Location Types tab and panel from Edit Map; Agent settings remains the single editing surface.
  • Serialized package-owned global generation-library and turn-template writes so concurrent saves cannot overwrite one another.
  • Added explicit template-load failure/retry UI, safe oversized-preview handling, and rejection for malformed ${...} placeholders.
  • Bumped Hierarchical Maps to 1.1.7 and rebuilt its client, server, manifest, ZIP artifact, and v2/v3/legacy catalog metadata.

Package and security impact

  • Affected package IDs: hierarchical-maps
  • Engine compatibility impact: remains Engine >=2.3.3 and <3.0.0, capability API 1.3
  • New or changed permissions/entrypoints: none; existing client and server entrypoints and permissions are unchanged
  • Restart, storage, update, or uninstall impact: package update requires the normal Engine restart; templates are stored in the existing global agent settings record under spatialMapTurnPromptTemplates; exact-artifact update/restart/offline restart/remove/reinstall/backup/restore coverage passes

Runtime keeps generated map/location values XML-escaped, rejects unknown, malformed, or missing required variables, and falls back to the bounded built-in insert if a saved custom template cannot render. The editor does not substitute built-ins when global settings fail to load: it reports the failure, disables editing/copying, and offers Retry.

Validation

Automated evidence completed before publication:

  • MARINARA_ENGINE_ROOT=/home/matt/Marinara-Engine node scripts/build-feature-packages.mjs hierarchical-maps — passed
  • node scripts/test-catalog-lanes.mjs — passed
  • node scripts/validate-catalog.mjs — passed; 29 packages, v2=29, v3=6
  • git diff --check — passed
  • Exact hierarchical-maps-1.1.7.zip lifecycle regression — passed, including concurrent global settings preservation, malformed-template rejection, oversized-template runtime fallback, update, Roleplay/Game prompt parity, restart/offline restart, remove/reinstall, backup, and restore
  • Focused Playwright on desktop and mobile — passed for all 6 selected case/project combinations, covering global save/readback, cross-chat reuse, malformed/invalid-template rejection, oversized-preview recovery, settings-load lockout/retry, 500px+ edit height, live prompt insertion, and Edit Map Location Types removal
  • Installed the exact ZIP locally; /api/health reports hierarchical-maps 1.1.7 active and ready, and installed manifest/client/server hashes match the rebuilt package files
  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually open Hierarchical Maps Agent settings in a Roleplay chat, edit and save the global Roleplay insert, and verify a second Roleplay chat shows the same template.
  • Manually switch to Game, edit and save its global insert, and verify the resolved authority text is Game-specific.
  • Manually confirm the edit textarea stays tall and the resolved preview retains its existing size.
  • Manually open Edit Map and confirm no Location Types tab or panel is present.

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

No documentation change is needed: this is an in-product Agent-settings surface and package release metadata change.

UI evidence (if applicable)

No screenshots or recordings attached. The focused desktop/mobile Playwright proof is listed above.

Summary by CodeRabbit

  • New Features

    • Added editable “Turn prompt insert” templates for Roleplay and Game chats.
    • Preview, customize, validate, save, restore, and copy generated turn prompts.
    • Turn prompts now reflect the current map location and available destinations.
  • Changes

    • Removed the “Location types” editor from the workspace.
    • Improved spatial context formatting and prompt safety.
    • Updated the Hierarchical Maps package to version 1.1.7.

🔄 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-Agents/pull/90 **Author:** [@thetopham](https://github.com/thetopham) **Created:** 7/18/2026 **Status:** ✅ Merged **Merged:** 7/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `agent/89-maps-runtime-prompt-inspector` --- ### 📝 Commits (2) - [`3e4f237`](https://github.com/Pasta-Devs/Marinara-Agents/commit/3e4f237467582f9ffa237080077d0ac794905d09) feat: add global Maps turn prompt templates - [`45adc4f`](https://github.com/Pasta-Devs/Marinara-Agents/commit/45adc4fbe568ffd3a35c7d29523c74e64898ae09) fix: address Maps prompt template review feedback ### 📊 Changes **18 files changed** (+1307 additions, -337 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/hierarchical-maps-1.1.7.zip` (+0 -0) 📝 `catalog/catalog.json` (+9 -9) 📝 `catalog/v2/catalog.json` (+9 -9) 📝 `catalog/v3/catalog.json` (+1 -1) 📝 `packages/hierarchical-maps/client.js` (+54 -48) 📝 `packages/hierarchical-maps/manifest.json` (+5 -5) 📝 `packages/hierarchical-maps/server.mjs` (+52 -47) 📝 `packages/hierarchical-maps/src/engine/packages/client/src/features/spatial-context/SpatialMapWorkspace.tsx` (+0 -52) 📝 `packages/hierarchical-maps/src/engine/packages/client/src/features/spatial-context/SpatialMapsHome.tsx` (+373 -2) 📝 `packages/hierarchical-maps/src/engine/packages/client/src/hooks/use-spatial-context.ts` (+38 -27) 📝 `packages/hierarchical-maps/src/engine/packages/maps-shared/src/maps-model.ts` (+136 -0) ➕ `packages/hierarchical-maps/src/engine/packages/maps-shared/src/runtime-prompt.ts` (+105 -0) 📝 `packages/hierarchical-maps/src/engine/packages/server/src/routes/spatial-context.routes.ts` (+62 -0) 📝 `packages/hierarchical-maps/src/engine/packages/server/src/services/spatial-context/package-runtime.ts` (+62 -2) 📝 `packages/hierarchical-maps/src/engine/packages/server/src/services/spatial-context/projection.ts` (+40 -90) 📝 `scripts/build-feature-packages.mjs` (+27 -2) 📝 `tests/hierarchical-maps-lifecycle.regression.ts` (+127 -14) 📝 `tests/spatial-context.e2e.ts` (+207 -29) </details> ### 📄 Description ## Linked issue Closes #89 ## Why this change Hierarchical Maps showed editable map-generation prompts but hid the separate spatial system message used on every model request. Users could not inspect or globally customize the Roleplay and Game inserts, and Edit Map duplicated the Location Types editor that already belongs in Agent settings. ## What changed - Added global, validated Roleplay and Game turn-prompt templates to the `hierarchical-maps` agent settings, alongside the existing global generation prompt libraries. - Added live and example resolved previews built by the same formatter used by runtime injection. - Kept the application-owned `<spatial_context>` wrapper and required context/authority variables outside the removable part of the runtime contract. - Made the actual editable template textarea 32rem tall while leaving the resolved preview sizing unchanged. - Removed the Location Types tab and panel from Edit Map; Agent settings remains the single editing surface. - Serialized package-owned global generation-library and turn-template writes so concurrent saves cannot overwrite one another. - Added explicit template-load failure/retry UI, safe oversized-preview handling, and rejection for malformed `${...}` placeholders. - Bumped Hierarchical Maps to 1.1.7 and rebuilt its client, server, manifest, ZIP artifact, and v2/v3/legacy catalog metadata. ## Package and security impact - Affected package IDs: `hierarchical-maps` - Engine compatibility impact: remains Engine `>=2.3.3` and `<3.0.0`, capability API 1.3 - New or changed permissions/entrypoints: none; existing client and server entrypoints and permissions are unchanged - Restart, storage, update, or uninstall impact: package update requires the normal Engine restart; templates are stored in the existing global agent settings record under `spatialMapTurnPromptTemplates`; exact-artifact update/restart/offline restart/remove/reinstall/backup/restore coverage passes Runtime keeps generated map/location values XML-escaped, rejects unknown, malformed, or missing required variables, and falls back to the bounded built-in insert if a saved custom template cannot render. The editor does not substitute built-ins when global settings fail to load: it reports the failure, disables editing/copying, and offers Retry. ## Validation Automated evidence completed before publication: - `MARINARA_ENGINE_ROOT=/home/matt/Marinara-Engine node scripts/build-feature-packages.mjs hierarchical-maps` — passed - `node scripts/test-catalog-lanes.mjs` — passed - `node scripts/validate-catalog.mjs` — passed; 29 packages, v2=29, v3=6 - `git diff --check` — passed - Exact `hierarchical-maps-1.1.7.zip` lifecycle regression — passed, including concurrent global settings preservation, malformed-template rejection, oversized-template runtime fallback, update, Roleplay/Game prompt parity, restart/offline restart, remove/reinstall, backup, and restore - Focused Playwright on desktop and mobile — passed for all 6 selected case/project combinations, covering global save/readback, cross-chat reuse, malformed/invalid-template rejection, oversized-preview recovery, settings-load lockout/retry, 500px+ edit height, live prompt insertion, and Edit Map Location Types removal - Installed the exact ZIP locally; `/api/health` reports `hierarchical-maps` 1.1.7 active and ready, and installed manifest/client/server hashes match the rebuilt package files <!-- Human contributor checklist: intentionally left unchecked. --> - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - [ ] Manually open Hierarchical Maps Agent settings in a Roleplay chat, edit and save the global Roleplay insert, and verify a second Roleplay chat shows the same template. - [ ] Manually switch to Game, edit and save its global insert, and verify the resolved authority text is Game-specific. - [ ] Manually confirm the edit textarea stays tall and the resolved preview retains its existing size. - [ ] Manually open Edit Map and confirm no Location Types tab or panel is present. ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation No documentation change is needed: this is an in-product Agent-settings surface and package release metadata change. ## UI evidence (if applicable) No screenshots or recordings attached. The focused desktop/mobile Playwright proof is listed above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added editable “Turn prompt insert” templates for Roleplay and Game chats. * Preview, customize, validate, save, restore, and copy generated turn prompts. * Turn prompts now reflect the current map location and available destinations. * **Changes** * Removed the “Location types” editor from the workspace. * Improved spatial context formatting and prompt safety. * Updated the Hierarchical Maps package to version 1.1.7. <!-- 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-20 17:31:04 +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-Agents#799
No description provided.